fix: clean docker onboarding warnings + preserve agentId casing

This commit is contained in:
Peter Steinberger
2026-01-24 19:07:01 +00:00
parent bcedeb4e1f
commit 6d79c6cd26
8 changed files with 111 additions and 14 deletions

View File

@@ -64,6 +64,19 @@ export function normalizeAgentId(value: string | undefined | null): string {
);
}
export function sanitizeAgentId(value: string | undefined | null): string {
const trimmed = (value ?? "").trim();
if (!trimmed) return DEFAULT_AGENT_ID;
if (/^[a-z0-9][a-z0-9_-]{0,63}$/i.test(trimmed)) return trimmed;
return (
trimmed
.replace(/[^a-z0-9_-]+/gi, "-")
.replace(/^-+/, "")
.replace(/-+$/, "")
.slice(0, 64) || DEFAULT_AGENT_ID
);
}
export function normalizeAccountId(value: string | undefined | null): string {
const trimmed = (value ?? "").trim();
if (!trimmed) return DEFAULT_ACCOUNT_ID;