fix: align sandbox name validation with NemoClaw (#51)

Co-authored-by: mmckeen-nv <mmckeen-nv@users.noreply.github.com>
This commit is contained in:
mmckeen-nv
2026-09-19 23:09:39 -07:00
committed by GitHub
co-authored by mmckeen-nv
parent f70c10d767
commit 52fe7a2d83
5 changed files with 22 additions and 7 deletions
+3 -3
View File
@@ -27,9 +27,9 @@ const NEMOCLAW_STATE_ROOT = path.join(process.env.HOME || "/tmp", ".nemoclaw")
function validateSandboxName(name: string) {
if (!name || typeof name !== "string") throw new Error("sandbox name is required")
if (name.length > 63) throw new Error("sandbox name too long (max 63 chars)")
if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name)) {
throw new Error("sandbox name must be lowercase alphanumeric with optional internal hyphens")
if (name.length > 19) throw new Error("sandbox name too long (max 19 chars)")
if (!/^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/.test(name)) {
throw new Error("sandbox name must start with a lowercase letter and contain only lowercase letters, numbers, and single internal hyphens")
}
return name
}