Restore version-locked sandbox create flow
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
# OpenShell Control
|
||||
|
||||
THIS IS VERSION LOCKED TO OpenShell v0.0.26 and NemoClaw v0.0.15.
|
||||
|
||||
OpenShell Control is a local, development-stage dashboard for operating OpenShell sandboxes and their OpenClaw gateway dashboards.
|
||||
|
||||
It is currently built for active development and lab use. It includes a simple password gate, but it is not a hardened production control plane yet.
|
||||
|
||||
+82
-163
@@ -1,10 +1,6 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import { execFile, spawn } from "node:child_process"
|
||||
import { existsSync } from "node:fs"
|
||||
import { readFile, writeFile } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { promisify } from "node:util"
|
||||
import { normalizeInferenceBaseUrlForGateway } from "@/app/lib/inferenceEndpointUrl"
|
||||
import { inspectSandbox } from "@/app/lib/openshellHost"
|
||||
import {
|
||||
commandExists,
|
||||
@@ -16,7 +12,6 @@ import {
|
||||
NEMOCLAW_SETUP_CANDIDATES,
|
||||
NODE_BIN,
|
||||
OPENSHELL_BIN,
|
||||
hostCommandEnv,
|
||||
} from "@/app/lib/hostCommands"
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
@@ -48,161 +43,80 @@ type SandboxVerification = {
|
||||
const AUTHORITATIVE_SUCCESS_PHASE = "Ready"
|
||||
const NO_PENDING_DEVICE_REQUESTS = /no pending device pairing requests/i
|
||||
|
||||
type ConfiguredInferenceRoute = {
|
||||
provider: string
|
||||
model: string
|
||||
}
|
||||
|
||||
function elapsedMs(start: number) {
|
||||
return Date.now() - start
|
||||
}
|
||||
|
||||
function stripAnsi(value: string) {
|
||||
return value.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "")
|
||||
}
|
||||
|
||||
function readField(output: string, label: string) {
|
||||
const match = output.match(new RegExp(`^\\s*${label}:\\s*(.+?)\\s*$`, "im"))
|
||||
return match ? match[1].trim() : ""
|
||||
}
|
||||
|
||||
function parseConfiguredInferenceRoute(output: string, label: "Gateway inference" | "System inference"): ConfiguredInferenceRoute | null {
|
||||
const otherLabel = label === "Gateway inference" ? "System inference" : "Gateway inference"
|
||||
const pattern = new RegExp(`${label}:\\s*([\\s\\S]*?)(?:\\n\\s*${otherLabel}:|$)`, "i")
|
||||
const section = output.match(pattern)?.[1] ?? ""
|
||||
if (!section || /Not configured/i.test(section)) return null
|
||||
const provider = readField(section, "Provider")
|
||||
const model = readField(section, "Model")
|
||||
return provider && model ? { provider, model } : null
|
||||
}
|
||||
|
||||
async function resolveConfiguredPrimaryInferenceRoute() {
|
||||
try {
|
||||
const { stdout } = await execFileAsync(OPENSHELL_BIN, ["inference", "get"], {
|
||||
env: hostCommandEnv({
|
||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
||||
}),
|
||||
timeout: 30000,
|
||||
maxBuffer: 5 * 1024 * 1024,
|
||||
})
|
||||
const output = stripAnsi(String(stdout).trim())
|
||||
return parseConfiguredInferenceRoute(output, "Gateway inference") || parseConfiguredInferenceRoute(output, "System inference")
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function mapOpenShellProviderToNemoClawProvider(provider: string) {
|
||||
const normalized = provider.trim().toLowerCase()
|
||||
const mappings: Record<string, string> = {
|
||||
"nvidia-inference": "build",
|
||||
"nvidia-prod": "build",
|
||||
"nvidia": "build",
|
||||
"nvidia-nim": "nim-local",
|
||||
"nim-local": "nim-local",
|
||||
"ollama-local": "ollama",
|
||||
"ollama": "ollama",
|
||||
"vllm-local": "vllm",
|
||||
"vllm": "vllm",
|
||||
"openai-api": "openai",
|
||||
"openai": "openai",
|
||||
"anthropic-prod": "anthropic",
|
||||
"anthropic": "anthropic",
|
||||
"compatible-anthropic-endpoint": "anthropicCompatible",
|
||||
"anthropiccompatible": "anthropicCompatible",
|
||||
"compatible-endpoint": "custom",
|
||||
"custom": "custom",
|
||||
}
|
||||
return mappings[normalized] || ""
|
||||
}
|
||||
|
||||
function applyConfiguredInferenceToOnboardEnv(env: NodeJS.ProcessEnv, route: ConfiguredInferenceRoute | null) {
|
||||
if (!route) return null
|
||||
const provider = mapOpenShellProviderToNemoClawProvider(route.provider)
|
||||
if (!provider) return null
|
||||
|
||||
env.NEMOCLAW_PROVIDER = provider
|
||||
env.NEMOCLAW_MODEL = route.model
|
||||
if (provider === "nim-local" || provider === "vllm") {
|
||||
env.NEMOCLAW_EXPERIMENTAL = env.NEMOCLAW_EXPERIMENTAL || "1"
|
||||
}
|
||||
if (provider === "custom") {
|
||||
const endpointUrl = process.env.NEMOCLAW_ENDPOINT_URL || process.env.OPENAI_BASE_URL || process.env.VLLM_BASE_URL || ""
|
||||
const normalizedEndpointUrl = normalizeInferenceBaseUrlForGateway(endpointUrl, "openai")
|
||||
if (normalizedEndpointUrl) env.NEMOCLAW_ENDPOINT_URL = normalizedEndpointUrl
|
||||
const providerKey = process.env.NEMOCLAW_PROVIDER_KEY || process.env.OPENAI_API_KEY || process.env.VLLM_API_KEY || ""
|
||||
if (providerKey) env.NEMOCLAW_PROVIDER_KEY = providerKey
|
||||
}
|
||||
return {
|
||||
openshellProvider: route.provider,
|
||||
nemoclawProvider: provider,
|
||||
model: route.model,
|
||||
}
|
||||
}
|
||||
|
||||
function appendNote(...parts: Array<string | false | null | undefined>) {
|
||||
return parts.filter(Boolean).join(" ")
|
||||
}
|
||||
|
||||
function resolvePreferredNemoClawDockerfile() {
|
||||
const home = process.env.HOME || ""
|
||||
const candidates = [
|
||||
process.env.NEMOCLAW_DOCKERFILE,
|
||||
home ? path.join(home, ".nemoclaw/source/Dockerfile") : undefined,
|
||||
NEMOCLAW_CWD ? path.join(NEMOCLAW_CWD, "Dockerfile") : undefined,
|
||||
home ? path.join(home, "NemoClaw/Dockerfile") : undefined,
|
||||
].filter((candidate): candidate is string => Boolean(candidate))
|
||||
return candidates.find((candidate) => existsSync(candidate)) || null
|
||||
}
|
||||
|
||||
async function relaxKnownNemoClawDockerfileOpenClawPatch(dockerfilePath: string | null) {
|
||||
if (!dockerfilePath) return null
|
||||
try {
|
||||
const source = await readFile(dockerfilePath, "utf8")
|
||||
const strictAssertion = "assert old in src, 'writeConfigFile(params.nextConfig) pattern not found'"
|
||||
if (!source.includes(strictAssertion)) {
|
||||
return { dockerfilePath, patched: false, reason: "no-known-brittle-openclaw-patch" }
|
||||
}
|
||||
|
||||
let next = source.replace(
|
||||
strictAssertion,
|
||||
"print('[nemoclaw] replaceConfigFile shape changed; skipping optional EACCES compatibility patch', file=sys.stderr)",
|
||||
)
|
||||
next = next.replace(
|
||||
/grep -REq\s+--include='\*\.js'\s+'OPENSHELL_SANDBOX\.\*EACCES'\s+"\$rcf_file"\s+\|\|\s+\{\s+echo\s+"ERROR: Patch 4 \(replaceConfigFile EACCES\) not applied"\s+>&2;\s+exit 1;\s+\}/g,
|
||||
"grep -REq --include='*.js' 'OPENSHELL_SANDBOX.*EACCES' \"$rcf_file\" || echo \"WARN: Patch 4 (replaceConfigFile EACCES) not applied; OpenClaw write shape changed\" >&2",
|
||||
)
|
||||
if (next !== source) {
|
||||
await writeFile(dockerfilePath, next)
|
||||
return { dockerfilePath, patched: true, reason: "relaxed-brittle-openclaw-patch" }
|
||||
}
|
||||
return { dockerfilePath, patched: false, reason: "known-patch-present-but-unmodified" }
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error ?? "unknown error")
|
||||
return { dockerfilePath, patched: false, reason: `patch-check-failed: ${message}` }
|
||||
}
|
||||
}
|
||||
|
||||
type NemoClawCreateCommand = {
|
||||
file: string
|
||||
args: string[]
|
||||
mode: "cli-onboard" | "legacy-setup"
|
||||
dockerfilePath?: string | null
|
||||
}
|
||||
|
||||
type CreateInferenceMode = "auto" | "vllm" | "nim"
|
||||
|
||||
type CreateInferenceSettings = {
|
||||
mode: CreateInferenceMode
|
||||
model: string
|
||||
hasApiKey: boolean
|
||||
envSummary: string[]
|
||||
}
|
||||
|
||||
function parseCreateInferenceSettings(body: any): CreateInferenceSettings {
|
||||
const raw = body?.createInference && typeof body.createInference === "object" ? body.createInference : {}
|
||||
const requestedMode = typeof raw.mode === "string" ? raw.mode : "auto"
|
||||
const mode: CreateInferenceMode = requestedMode === "vllm" || requestedMode === "nim" ? requestedMode : "auto"
|
||||
const model = typeof raw.model === "string" ? raw.model.trim() : ""
|
||||
const apiKey = typeof raw.apiKey === "string" ? raw.apiKey.trim() : ""
|
||||
|
||||
return {
|
||||
mode,
|
||||
model,
|
||||
hasApiKey: Boolean(apiKey),
|
||||
envSummary: [],
|
||||
}
|
||||
}
|
||||
|
||||
function applyCreateInferenceEnv(env: NodeJS.ProcessEnv, settings: CreateInferenceSettings, body: any) {
|
||||
if (settings.mode === "auto") return settings
|
||||
|
||||
env.NEMOCLAW_EXPERIMENTAL = "1"
|
||||
settings.envSummary.push("NEMOCLAW_EXPERIMENTAL=1")
|
||||
|
||||
if (settings.mode === "vllm") {
|
||||
env.NEMOCLAW_PROVIDER = "vllm"
|
||||
settings.envSummary.push("NEMOCLAW_PROVIDER=vllm")
|
||||
}
|
||||
|
||||
if (settings.mode === "nim") {
|
||||
env.NEMOCLAW_PROVIDER = "nim-local"
|
||||
settings.envSummary.push("NEMOCLAW_PROVIDER=nim-local")
|
||||
const apiKey = typeof body?.createInference?.apiKey === "string" ? body.createInference.apiKey.trim() : ""
|
||||
if (apiKey) {
|
||||
env.NVIDIA_API_KEY = apiKey
|
||||
env.NEMOCLAW_PROVIDER_KEY = apiKey
|
||||
settings.envSummary.push("NVIDIA_API_KEY=<provided>", "NEMOCLAW_PROVIDER_KEY=<provided>")
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.model) {
|
||||
env.NEMOCLAW_MODEL = settings.model
|
||||
settings.envSummary.push(`NEMOCLAW_MODEL=${settings.model}`)
|
||||
}
|
||||
|
||||
return settings
|
||||
}
|
||||
|
||||
function buildNemoClawCreateCommand(): NemoClawCreateCommand {
|
||||
if (NEMOCLAW_BIN && commandExists(NEMOCLAW_BIN)) {
|
||||
const dockerfilePath = resolvePreferredNemoClawDockerfile()
|
||||
const args = [
|
||||
"onboard",
|
||||
"--non-interactive",
|
||||
"--recreate-sandbox",
|
||||
"--yes-i-accept-third-party-software",
|
||||
...(dockerfilePath ? ["--from", dockerfilePath] : []),
|
||||
]
|
||||
const args = ["onboard", "--non-interactive", "--recreate-sandbox", "--yes-i-accept-third-party-software"]
|
||||
return /\.(?:c?m?js|ts)$/i.test(NEMOCLAW_BIN)
|
||||
? { file: NODE_BIN, args: [NEMOCLAW_BIN, ...args], mode: "cli-onboard", dockerfilePath }
|
||||
: { file: NEMOCLAW_BIN, args, mode: "cli-onboard", dockerfilePath }
|
||||
? { file: NODE_BIN, args: [NEMOCLAW_BIN, ...args], mode: "cli-onboard" }
|
||||
: { file: NEMOCLAW_BIN, args, mode: "cli-onboard" }
|
||||
}
|
||||
if (NEMOCLAW_SETUP && commandExists(NEMOCLAW_SETUP)) {
|
||||
return { file: "/bin/bash", args: [NEMOCLAW_SETUP], mode: "legacy-setup" }
|
||||
@@ -380,9 +294,14 @@ async function approveOpenClawDeviceRequests(sandboxName: string) {
|
||||
"sh",
|
||||
"-lc",
|
||||
"openclaw devices approve --latest --json --timeout 10000",
|
||||
], hostCommandEnv({
|
||||
], {
|
||||
...process.env,
|
||||
PATH: HOST_PATH,
|
||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
||||
}), 15000)
|
||||
NO_COLOR: "1",
|
||||
CLICOLOR: "0",
|
||||
CLICOLOR_FORCE: "0",
|
||||
}, 15000)
|
||||
|
||||
const combinedOutput = `${result.stdout}\n${result.stderr}`.trim()
|
||||
const noPending = NO_PENDING_DEVICE_REQUESTS.test(combinedOutput)
|
||||
@@ -466,7 +385,8 @@ export async function POST(request: Request) {
|
||||
const sandboxName = validateSandboxName(typeof body?.sandboxName === "string" ? body.sandboxName.trim() : "")
|
||||
const policy = body?.policy && typeof body.policy === "object" ? body.policy : null
|
||||
const enableTailscale = Boolean(body?.enableTailscale)
|
||||
console.log(`[sandbox/create] request:parsed sandbox=${sandboxName} blueprint=${blueprint} enableTailscale=${enableTailscale} elapsedMs=${elapsedMs(requestStartedAt)}`)
|
||||
const createInference = parseCreateInferenceSettings(body)
|
||||
console.log(`[sandbox/create] request:parsed sandbox=${sandboxName} blueprint=${blueprint} enableTailscale=${enableTailscale} inferenceMode=${createInference.mode} elapsedMs=${elapsedMs(requestStartedAt)}`)
|
||||
|
||||
if (!blueprint) {
|
||||
return NextResponse.json({ ok: false, error: "blueprint is required" }, { status: 400 })
|
||||
@@ -474,24 +394,22 @@ export async function POST(request: Request) {
|
||||
|
||||
if (blueprint === "nemoclaw-blueprint") {
|
||||
const createCommand = buildNemoClawCreateCommand()
|
||||
const dockerfileCompatibility = await relaxKnownNemoClawDockerfileOpenClawPatch(createCommand.dockerfilePath ?? null)
|
||||
const configuredInferenceRoute = await resolveConfiguredPrimaryInferenceRoute()
|
||||
const env: NodeJS.ProcessEnv = hostCommandEnv({
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
...process.env,
|
||||
PATH: HOST_PATH,
|
||||
NEMOCLAW_SANDBOX_NAME: sandboxName,
|
||||
NEMOCLAW_NON_INTERACTIVE: "1",
|
||||
NEMOCLAW_RECREATE_SANDBOX: "1",
|
||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1",
|
||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
||||
})
|
||||
const onboardInference = applyConfiguredInferenceToOnboardEnv(env, configuredInferenceRoute)
|
||||
console.log(
|
||||
`[sandbox/create] inference-default sandbox=${sandboxName} openshellProvider=${onboardInference?.openshellProvider || "unconfigured"} nemoclawProvider=${onboardInference?.nemoclawProvider || "default"} model=${onboardInference?.model || "default"} elapsedMs=${elapsedMs(requestStartedAt)}`,
|
||||
)
|
||||
}
|
||||
|
||||
if (!enableTailscale && !onboardInference) {
|
||||
if (!enableTailscale) {
|
||||
env.NVIDIA_API_KEY = env.NVIDIA_API_KEY || "optional-local-mode"
|
||||
}
|
||||
|
||||
applyCreateInferenceEnv(env, createInference, body)
|
||||
|
||||
const result = await runCommand(
|
||||
createCommand.file,
|
||||
createCommand.mode === "legacy-setup" ? [...createCommand.args, sandboxName] : createCommand.args,
|
||||
@@ -508,10 +426,7 @@ export async function POST(request: Request) {
|
||||
blueprint,
|
||||
sandboxName,
|
||||
enableTailscale,
|
||||
configuredInferenceRoute,
|
||||
onboardInference,
|
||||
createCommand,
|
||||
dockerfileCompatibility,
|
||||
createInference,
|
||||
}, { status: 500 })
|
||||
}
|
||||
|
||||
@@ -536,10 +451,8 @@ export async function POST(request: Request) {
|
||||
verification,
|
||||
mode: "nemoclaw-blueprint",
|
||||
enableTailscale,
|
||||
configuredInferenceRoute,
|
||||
onboardInference,
|
||||
createInference,
|
||||
createCommand,
|
||||
dockerfileCompatibility,
|
||||
hostPath: HOST_PATH,
|
||||
readiness: {
|
||||
attempts: readiness.attempts,
|
||||
@@ -560,7 +473,13 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
if (blueprint === "custom-sandbox") {
|
||||
const env: NodeJS.ProcessEnv = hostCommandEnv()
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
...process.env,
|
||||
PATH: HOST_PATH,
|
||||
NO_COLOR: "1",
|
||||
CLICOLOR: "0",
|
||||
CLICOLOR_FORCE: "0",
|
||||
}
|
||||
const createAttempt = await runCreateCommandBounded(OPENSHELL_BIN, ["sandbox", "create", "--name", sandboxName], env, 15000)
|
||||
|
||||
if (createAttempt.completed && createAttempt.exitCode !== 0) {
|
||||
|
||||
@@ -7,6 +7,7 @@ type EndpointProtocol = "" | "rest"
|
||||
type EndpointTls = "" | "terminate" | "passthrough"
|
||||
type EndpointEnforcement = "" | "enforce" | "audit"
|
||||
type EndpointAccess = "" | "read-only" | "read-write" | "full"
|
||||
type CreateInferenceMode = "auto" | "vllm" | "nim"
|
||||
|
||||
interface NetworkRule { method: string; path: string }
|
||||
interface NetworkEndpoint { host: string; port: string; protocol: EndpointProtocol; tls: EndpointTls; enforcement: EndpointEnforcement; access: EndpointAccess; rules: NetworkRule[] }
|
||||
@@ -87,6 +88,9 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
|
||||
const [selectedBlueprint, setSelectedBlueprint] = useState<string>('nemoclaw-blueprint')
|
||||
const [sandboxName, setSandboxName] = useState<string>('')
|
||||
const [enableTailscale, setEnableTailscale] = useState<boolean>(false)
|
||||
const [createInferenceMode, setCreateInferenceMode] = useState<CreateInferenceMode>("vllm")
|
||||
const [createInferenceModel, setCreateInferenceModel] = useState<string>("")
|
||||
const [createNvidiaApiKey, setCreateNvidiaApiKey] = useState<string>("")
|
||||
const [restoreFromBackup, setRestoreFromBackup] = useState<boolean>(false)
|
||||
const [restoreArchive, setRestoreArchive] = useState<File | null>(null)
|
||||
const [restorePath, setRestorePath] = useState<string>('/sandbox')
|
||||
@@ -134,7 +138,12 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
|
||||
if (mode === 'create') {
|
||||
if (!sandboxName.trim()) throw new Error('sandbox name is required')
|
||||
if (restoreFromBackup && !restoreArchive) throw new Error('backup archive is required when restore from backup is enabled')
|
||||
const res = await fetch('/api/sandbox/create', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ blueprint: selectedBlueprint, sandboxName: sandboxName.trim(), enableTailscale, policy: assembledPolicy, preset: selectedPreset || null }) })
|
||||
const createInference = {
|
||||
mode: createInferenceMode,
|
||||
model: createInferenceModel.trim(),
|
||||
apiKey: createInferenceMode === 'nim' ? createNvidiaApiKey.trim() : '',
|
||||
}
|
||||
const res = await fetch('/api/sandbox/create', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ blueprint: selectedBlueprint, sandboxName: sandboxName.trim(), enableTailscale, createInference, policy: assembledPolicy, preset: selectedPreset || null }) })
|
||||
const data = await res.json()
|
||||
if (!res.ok) throw new Error([data.error, data.verification?.summary, data.verification?.error, data.stdout, data.stderr].filter(Boolean).join('\n\n'))
|
||||
const createdSandboxId = data.verification?.details?.id || data.verification?.details?.name || data.sandboxName
|
||||
@@ -188,7 +197,76 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
|
||||
</div>
|
||||
)}
|
||||
{loading ? <div className="text-sm text-[var(--foreground-dim)]">Loading policy…</div> : <div className="space-y-8">
|
||||
{mode === 'create' && <section className="space-y-4 rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-4"><div><h5 className="text-xs uppercase tracking-wider text-[var(--foreground)]">Create Sandbox</h5><p className="text-xs text-[var(--foreground-dim)] mt-1">Choose a template and enter a sandbox name.</p></div><div className="grid grid-cols-1 md:grid-cols-2 gap-4">{blueprints.map((bp) => <button key={bp.id} type="button" onClick={() => setSelectedBlueprint(bp.id)} className={`rounded-sm border p-4 text-left ${selectedBlueprint === bp.id ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background)]'}`}><div className="flex items-center justify-between gap-3"><span className="text-sm font-semibold text-[var(--foreground)] uppercase tracking-wider">{bp.label}</span><Badge tone={bp.type === 'custom' ? 'static' : 'dynamic'}>{bp.type}</Badge></div><p className="text-xs text-[var(--foreground-dim)] mt-2">{bp.description}</p></button>)}</div><div><label className="text-xs uppercase tracking-wider text-[var(--foreground-dim)]">Sandbox Name<FieldHelp text="Lowercase letters, numbers, and hyphens only." /></label><input value={sandboxName} onChange={(e) => setSandboxName(e.target.value)} placeholder={selectedBlueprint === 'nemoclaw-blueprint' ? 'my-assistant' : 'custom-sandbox'} className="mt-2 w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" /></div>{activeBlueprint?.supportsTailscale && <label className="flex items-center gap-3 text-sm text-[var(--foreground)] font-mono"><input type="checkbox" checked={enableTailscale} onChange={(e) => setEnableTailscale(e.target.checked)} /> Enable Tailscale</label>}{enableTailscale && <div className="rounded-sm border border-amber-500/40 bg-amber-500/10 p-3 text-sm text-amber-300">Tailscale-enabled creation requires NVIDIA_API_KEY in the dashboard process environment.</div>}<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4"><label className="flex items-start gap-3"><input type="checkbox" checked={restoreFromBackup} onChange={(e) => setRestoreFromBackup(e.target.checked)} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" /><span><span className="block text-xs font-semibold uppercase tracking-wider text-[var(--foreground)]">Restore from Backup</span><span className="mt-1 block text-xs text-[var(--foreground-dim)]">After the sandbox reaches Ready, restore a .tar.gz archive into it.</span></span></label>{restoreFromBackup && <div className="grid grid-cols-1 gap-4 md:grid-cols-2"><div className="space-y-2"><label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">Backup Archive</label><input type="file" accept=".tar.gz,.tgz,application/gzip,application/x-gzip" onChange={(e) => setRestoreArchive(e.target.files?.[0] || null)} className="block w-full text-xs text-[var(--foreground-dim)] file:mr-3 file:rounded-sm file:border file:border-[var(--border-subtle)] file:bg-[var(--background-tertiary)] file:px-3 file:py-2 file:text-xs file:font-mono file:uppercase file:text-[var(--foreground)]" /></div><div className="space-y-2"><label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">Restore Target</label><input value={restorePath} onChange={(e) => setRestorePath(e.target.value)} placeholder="/sandbox" className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" /></div><label className="md:col-span-2 flex items-start gap-3 rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-3"><input type="checkbox" checked={restoreReplace} onChange={(e) => setRestoreReplace(e.target.checked)} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" /><span><span className="block text-xs font-mono uppercase tracking-wider text-[var(--foreground)]">Replace target contents</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Recommended for cloning from a backup into a fresh sandbox.</span></span></label></div>}</div></section>}
|
||||
{mode === 'create' && (
|
||||
<section className="space-y-4 rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-4">
|
||||
<div>
|
||||
<h5 className="text-xs uppercase tracking-wider text-[var(--foreground)]">Create Sandbox</h5>
|
||||
<p className="text-xs text-[var(--foreground-dim)] mt-1">Choose a template and enter a sandbox name.</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{blueprints.map((bp) => (
|
||||
<button key={bp.id} type="button" onClick={() => setSelectedBlueprint(bp.id)} className={`rounded-sm border p-4 text-left ${selectedBlueprint === bp.id ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background)]'}`}>
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<span className="text-sm font-semibold text-[var(--foreground)] uppercase tracking-wider">{bp.label}</span>
|
||||
<Badge tone={bp.type === 'custom' ? 'static' : 'dynamic'}>{bp.type}</Badge>
|
||||
</div>
|
||||
<p className="text-xs text-[var(--foreground-dim)] mt-2">{bp.description}</p>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
<label className="text-xs uppercase tracking-wider text-[var(--foreground-dim)]">Sandbox Name<FieldHelp text="Lowercase letters, numbers, and hyphens only." /></label>
|
||||
<input value={sandboxName} onChange={(e) => setSandboxName(e.target.value)} placeholder={selectedBlueprint === 'nemoclaw-blueprint' ? 'my-assistant' : 'custom-sandbox'} className="mt-2 w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" />
|
||||
</div>
|
||||
{activeBlueprint?.supportsTailscale && (
|
||||
<label className="flex items-center gap-3 text-sm text-[var(--foreground)] font-mono">
|
||||
<input type="checkbox" checked={enableTailscale} onChange={(e) => setEnableTailscale(e.target.checked)} /> Enable Tailscale
|
||||
</label>
|
||||
)}
|
||||
{enableTailscale && <div className="rounded-sm border border-amber-500/40 bg-amber-500/10 p-3 text-sm text-amber-300">Tailscale-enabled creation requires NVIDIA_API_KEY in the dashboard process environment.</div>}
|
||||
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4">
|
||||
<div>
|
||||
<h6 className="text-xs font-semibold uppercase tracking-wider text-[var(--foreground)]">Inference at Create</h6>
|
||||
<p className="mt-1 text-xs text-[var(--foreground-dim)]">Choose the provider NemoClaw should use while onboarding this sandbox.</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-3 md:grid-cols-3">
|
||||
<label className={`flex items-start gap-3 rounded-sm border p-3 text-sm text-[var(--foreground)] ${createInferenceMode === 'auto' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="checkbox" checked={createInferenceMode === 'auto'} onChange={() => setCreateInferenceMode('auto')} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-mono uppercase tracking-wider">Auto</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Let NemoClaw choose.</span></span>
|
||||
</label>
|
||||
<label className={`flex items-start gap-3 rounded-sm border p-3 text-sm text-[var(--foreground)] ${createInferenceMode === 'vllm' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="checkbox" checked={createInferenceMode === 'vllm'} onChange={() => setCreateInferenceMode('vllm')} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-mono uppercase tracking-wider">Use vLLM in experimental mode</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Sets NEMOCLAW_EXPERIMENTAL and vLLM.</span></span>
|
||||
</label>
|
||||
<label className={`flex items-start gap-3 rounded-sm border p-3 text-sm text-[var(--foreground)] ${createInferenceMode === 'nim' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="checkbox" checked={createInferenceMode === 'nim'} onChange={() => setCreateInferenceMode('nim')} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-mono uppercase tracking-wider">Use NVIDIA NIM</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Uses the experimental local NIM provider.</span></span>
|
||||
</label>
|
||||
</div>
|
||||
{createInferenceMode !== 'auto' && (
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">Model</label>
|
||||
<input value={createInferenceModel} onChange={(e) => setCreateInferenceModel(e.target.value)} placeholder={createInferenceMode === 'vllm' ? 'auto-detect from vLLM' : 'model name'} className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" />
|
||||
</div>
|
||||
{createInferenceMode === 'nim' && (
|
||||
<div className="space-y-2">
|
||||
<label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">NVIDIA API Key</label>
|
||||
<input type="password" value={createNvidiaApiKey} onChange={(e) => setCreateNvidiaApiKey(e.target.value)} placeholder="nvapi-..." className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4">
|
||||
<label className="flex items-start gap-3">
|
||||
<input type="checkbox" checked={restoreFromBackup} onChange={(e) => setRestoreFromBackup(e.target.checked)} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-semibold uppercase tracking-wider text-[var(--foreground)]">Restore from Backup</span><span className="mt-1 block text-xs text-[var(--foreground-dim)]">After the sandbox reaches Ready, restore a .tar.gz archive into it.</span></span>
|
||||
</label>
|
||||
{restoreFromBackup && <div className="grid grid-cols-1 gap-4 md:grid-cols-2"><div className="space-y-2"><label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">Backup Archive</label><input type="file" accept=".tar.gz,.tgz,application/gzip,application/x-gzip" onChange={(e) => setRestoreArchive(e.target.files?.[0] || null)} className="block w-full text-xs text-[var(--foreground-dim)] file:mr-3 file:rounded-sm file:border file:border-[var(--border-subtle)] file:bg-[var(--background-tertiary)] file:px-3 file:py-2 file:text-xs file:font-mono file:uppercase file:text-[var(--foreground)]" /></div><div className="space-y-2"><label className="text-[10px] uppercase tracking-wider text-[var(--foreground-dim)]">Restore Target</label><input value={restorePath} onChange={(e) => setRestorePath(e.target.value)} placeholder="/sandbox" className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)]" /></div><label className="md:col-span-2 flex items-start gap-3 rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-3"><input type="checkbox" checked={restoreReplace} onChange={(e) => setRestoreReplace(e.target.checked)} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" /><span><span className="block text-xs font-mono uppercase tracking-wider text-[var(--foreground)]">Replace target contents</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Recommended for cloning from a backup into a fresh sandbox.</span></span></label></div>}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
<section className="space-y-4"><div className="flex items-center justify-between gap-4 flex-wrap"><div><h5 className="text-xs uppercase tracking-wider text-[var(--foreground)]">Security Presets</h5><p className="text-xs text-[var(--foreground-dim)] mt-1">Use a canned profile for new sandboxes or switch an existing sandbox policy baseline on the fly.</p></div><div className="min-w-[260px]"><select value={selectedPreset} onChange={(e) => { const value = e.target.value as SecurityPresetId | ''; setSelectedPreset(value); if (value) applyPreset(value) }} className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)]"><option value="">Select preset…</option>{SECURITY_PRESETS.map((preset) => <option key={preset.id} value={preset.id}>{preset.label}</option>)}</select></div></div>{activePreset && <div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-4 space-y-3"><div className="flex items-center gap-3 flex-wrap"><span className="text-sm font-semibold text-[var(--foreground)] uppercase tracking-wider">{activePreset.label}</span></div><p className="text-sm text-[var(--foreground-dim)]">{activePreset.summary}</p></div>}</section>
|
||||
<section className="space-y-4"><div className="flex items-center gap-3"><h5 className="text-xs uppercase tracking-wider text-[var(--foreground)]">Filesystem Policy</h5><Badge tone="static">Static</Badge></div><label className="flex items-center gap-3 text-sm text-[var(--foreground)] font-mono"><input type="checkbox" checked={policy.filesystem_policy.include_workdir} onChange={(e) => setPolicy({ ...policy, filesystem_policy: { ...policy.filesystem_policy, include_workdir: e.target.checked } })} />Include workdir<FieldHelp text="Automatically adds the agent working directory to read_write. Static: changing this requires recreating the sandbox." /></label><div className="grid grid-cols-1 md:grid-cols-2 gap-4"><TextListEditor label="Read-only paths" tooltipText="Absolute paths the sandbox can read but not modify. Paths not listed are inaccessible." value={policy.filesystem_policy.read_only} onChange={(v) => setPolicy({ ...policy, filesystem_policy: { ...policy.filesystem_policy, read_only: v } })} placeholder="/usr\n/lib\n/etc" /><TextListEditor label="Read-write paths" tooltipText="Absolute paths the sandbox can read and write. Keep this scoped; broad paths are rejected." value={policy.filesystem_policy.read_write} onChange={(v) => setPolicy({ ...policy, filesystem_policy: { ...policy.filesystem_policy, read_write: v } })} placeholder="/sandbox\n/tmp" /></div></section>
|
||||
<section className="space-y-4"><div className="flex items-center gap-3"><h5 className="text-xs uppercase tracking-wider text-[var(--foreground)]">Network Policies</h5><Badge tone="dynamic">Dynamic</Badge></div><button onClick={addBlock} className="px-3 py-2 rounded-sm bg-[var(--background-tertiary)] text-xs font-mono uppercase tracking-wider hover:bg-[var(--background-panel)]">Add policy block</button></section>
|
||||
|
||||
@@ -39,6 +39,9 @@ Options:
|
||||
|
||||
This project is in development. The installer prepares a local dev/operator
|
||||
environment; it is not a systemd/production service installer.
|
||||
|
||||
To install the OpenShell/NemoClaw versions validated with this dashboard, run:
|
||||
./install_versioned_nemoclaw_openshell.sh
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -308,6 +311,7 @@ set_env() {
|
||||
|
||||
echo -e "${GREEN}=== ${APP_NAME} Installer ===${NC}"
|
||||
echo "Development build: expect sharp edges; do not expose this UI broadly without hardening."
|
||||
echo "This installs the dashboard only. For pinned OpenShell/NemoClaw dependencies, run ./install_versioned_nemoclaw_openshell.sh."
|
||||
echo ""
|
||||
|
||||
if [[ "${EUID:-$(id -u)}" -eq 0 && "$ALLOW_ROOT" -ne 1 ]]; then
|
||||
|
||||
Executable
+167
@@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install the OpenShell/NemoClaw versions this dashboard is validated against.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
OPENSHELL_VERSION="${OPENSHELL_VERSION:-v0.0.26}"
|
||||
OPENSHELL_INSTALL_URL="${OPENSHELL_INSTALL_URL:-https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh}"
|
||||
NEMOCLAW_INSTALL_TAG="${NEMOCLAW_INSTALL_TAG:-v0.0.15}"
|
||||
NEMOCLAW_ZIP_URL="${NEMOCLAW_ZIP_URL:-https://github.com/NVIDIA/NemoClaw/archive/refs/tags/${NEMOCLAW_INSTALL_TAG}.zip}"
|
||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-1}"
|
||||
NEMOCLAW_NON_INTERACTIVE="${NEMOCLAW_NON_INTERACTIVE:-1}"
|
||||
|
||||
SKIP_OPENSHELL=0
|
||||
SKIP_NEMOCLAW=0
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Versioned OpenShell/NemoClaw installer
|
||||
|
||||
Usage:
|
||||
./install_versioned_nemoclaw_openshell.sh [options]
|
||||
|
||||
Options:
|
||||
--nvidia-api-key KEY Pass NVIDIA_API_KEY to the NemoClaw installer
|
||||
--skip-openshell Do not install OpenShell
|
||||
--skip-nemoclaw Do not install NemoClaw
|
||||
--help Show this help
|
||||
|
||||
Defaults:
|
||||
OPENSHELL_VERSION=$OPENSHELL_VERSION
|
||||
NEMOCLAW_INSTALL_TAG=$NEMOCLAW_INSTALL_TAG
|
||||
|
||||
Environment overrides:
|
||||
OPENSHELL_VERSION
|
||||
OPENSHELL_INSTALL_URL
|
||||
NEMOCLAW_INSTALL_TAG
|
||||
NEMOCLAW_ZIP_URL
|
||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE
|
||||
NEMOCLAW_NON_INTERACTIVE
|
||||
NVIDIA_API_KEY
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--nvidia-api-key)
|
||||
[[ $# -ge 2 ]] || { echo -e "${RED}ERROR:${NC} --nvidia-api-key requires a value" >&2; exit 1; }
|
||||
export NVIDIA_API_KEY="$2"
|
||||
shift 2
|
||||
;;
|
||||
--skip-openshell)
|
||||
SKIP_OPENSHELL=1
|
||||
shift
|
||||
;;
|
||||
--skip-nemoclaw)
|
||||
SKIP_NEMOCLAW=1
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}ERROR:${NC} Unknown option: $1" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
log() {
|
||||
echo -e "${GREEN}==>${NC} $*"
|
||||
}
|
||||
|
||||
warn() {
|
||||
echo -e "${YELLOW}WARN:${NC} $*"
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo -e "${RED}ERROR:${NC} $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command -v "$1" >/dev/null 2>&1 || fail "$1 is required but was not found."
|
||||
}
|
||||
|
||||
extract_zip() {
|
||||
local zip_path="$1"
|
||||
local dest_dir="$2"
|
||||
|
||||
if command -v unzip >/dev/null 2>&1; then
|
||||
unzip -q "$zip_path" -d "$dest_dir"
|
||||
return
|
||||
fi
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python3 -m zipfile -e "$zip_path" "$dest_dir"
|
||||
return
|
||||
fi
|
||||
|
||||
fail "unzip or python3 is required to extract NemoClaw."
|
||||
}
|
||||
|
||||
install_openshell() {
|
||||
require_command curl
|
||||
require_command sh
|
||||
log "Installing OpenShell $OPENSHELL_VERSION"
|
||||
curl -LsSf "$OPENSHELL_INSTALL_URL" | OPENSHELL_VERSION="$OPENSHELL_VERSION" sh
|
||||
}
|
||||
|
||||
install_nemoclaw() {
|
||||
require_command curl
|
||||
require_command sh
|
||||
|
||||
local work_dir zip_path source_dir
|
||||
work_dir="$(mktemp -d)"
|
||||
zip_path="$work_dir/nemoclaw-${NEMOCLAW_INSTALL_TAG}.zip"
|
||||
trap 'rm -rf "$work_dir"' RETURN
|
||||
|
||||
log "Downloading NemoClaw $NEMOCLAW_INSTALL_TAG"
|
||||
curl -LsSf "$NEMOCLAW_ZIP_URL" -o "$zip_path"
|
||||
extract_zip "$zip_path" "$work_dir"
|
||||
|
||||
source_dir="$(find "$work_dir" -maxdepth 1 -type d -name 'NemoClaw-*' | head -n 1)"
|
||||
[[ -n "$source_dir" && -f "$source_dir/install.sh" ]] || fail "Could not find NemoClaw install.sh in downloaded archive."
|
||||
|
||||
if [[ -z "${NVIDIA_API_KEY:-}" ]]; then
|
||||
warn "NVIDIA_API_KEY is not set. NemoClaw may require it for non-local provider setup."
|
||||
fi
|
||||
|
||||
log "Installing NemoClaw $NEMOCLAW_INSTALL_TAG"
|
||||
(
|
||||
cd "$source_dir"
|
||||
NEMOCLAW_INSTALL_TAG="$NEMOCLAW_INSTALL_TAG" \
|
||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="$NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE" \
|
||||
NEMOCLAW_NON_INTERACTIVE="$NEMOCLAW_NON_INTERACTIVE" \
|
||||
NVIDIA_API_KEY="${NVIDIA_API_KEY:-}" \
|
||||
./install.sh
|
||||
)
|
||||
}
|
||||
|
||||
echo -e "${GREEN}=== Versioned OpenShell/NemoClaw Installer ===${NC}"
|
||||
echo "OpenShell: $OPENSHELL_VERSION"
|
||||
echo "NemoClaw: $NEMOCLAW_INSTALL_TAG"
|
||||
echo ""
|
||||
|
||||
if [[ "$SKIP_OPENSHELL" -eq 0 ]]; then
|
||||
install_openshell
|
||||
else
|
||||
warn "Skipping OpenShell install"
|
||||
fi
|
||||
|
||||
if [[ "$SKIP_NEMOCLAW" -eq 0 ]]; then
|
||||
install_nemoclaw
|
||||
else
|
||||
warn "Skipping NemoClaw install"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}=== Versioned Install Complete ===${NC}"
|
||||
echo "Run ./install.sh afterward to install or refresh the dashboard."
|
||||
@@ -6,6 +6,7 @@ const root = process.cwd()
|
||||
|
||||
const [
|
||||
installSource,
|
||||
versionedInstallSource,
|
||||
hostCommandsSource,
|
||||
createRouteSource,
|
||||
deleteRouteSource,
|
||||
@@ -19,6 +20,7 @@ const [
|
||||
mcpBrokerClientSource,
|
||||
] = await Promise.all([
|
||||
readFile(path.join(root, 'install.sh'), 'utf8'),
|
||||
readFile(path.join(root, 'install_versioned_nemoclaw_openshell.sh'), 'utf8'),
|
||||
readFile(path.join(root, 'app/lib/hostCommands.ts'), 'utf8'),
|
||||
readFile(path.join(root, 'app/api/sandbox/create/route.ts'), 'utf8'),
|
||||
readFile(path.join(root, 'app/api/sandbox/delete/route.ts'), 'utf8'),
|
||||
@@ -32,6 +34,7 @@ const [
|
||||
readFile(path.join(root, 'app/lib/mcpBrokerClient.ts'), 'utf8'),
|
||||
])
|
||||
|
||||
assert.match(installSource, /install_versioned_nemoclaw_openshell\.sh/, 'dashboard installer must point operators to the pinned OpenShell/NemoClaw installer')
|
||||
assert.match(installSource, /find_nemoclaw_bin\(\)/, 'installer must discover NemoClaw CLI')
|
||||
assert.match(installSource, /find_nemoclaw_setup\(\)/, 'installer may discover the legacy NemoClaw setup workflow')
|
||||
assert.match(installSource, /\$HOME\/nemoclaw\/scripts\/setup\.sh/, 'installer must check common lowercase ~/nemoclaw setup path')
|
||||
@@ -50,6 +53,15 @@ assert.match(installSource, /python3 -m venv "\$PROJECT_VENV"/, 'installer must
|
||||
assert.match(installSource, /\$venv_python" -m pip install --upgrade uv/, 'installer must install uvx into the virtual environment')
|
||||
assert.match(installSource, /set_env "OPENSHELL_CONTROL_VENV"/, 'installer must persist the virtual environment path for runtime MCP launches')
|
||||
|
||||
assert.match(versionedInstallSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.26\}"/, 'versioned installer must pin OpenShell v0.0.26 by default')
|
||||
assert.match(versionedInstallSource, /NEMOCLAW_INSTALL_TAG="\$\{NEMOCLAW_INSTALL_TAG:-v0\.0\.15\}"/, 'versioned installer must pin NemoClaw v0.0.15 by default')
|
||||
assert.match(versionedInstallSource, /https:\/\/raw\.githubusercontent\.com\/NVIDIA\/OpenShell\/main\/install\.sh/, 'versioned installer must use the OpenShell installer URL')
|
||||
assert.match(versionedInstallSource, /https:\/\/github\.com\/NVIDIA\/NemoClaw\/archive\/refs\/tags\/\$\{NEMOCLAW_INSTALL_TAG\}\.zip/, 'versioned installer must download NemoClaw from the pinned tag archive')
|
||||
assert.match(versionedInstallSource, /OPENSHELL_VERSION="\$OPENSHELL_VERSION" sh/, 'versioned installer must pass the pinned OpenShell version to upstream install.sh')
|
||||
assert.match(versionedInstallSource, /NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="\$NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE"/, 'versioned installer must support non-interactive third-party acceptance')
|
||||
assert.match(versionedInstallSource, /NEMOCLAW_NON_INTERACTIVE="\$NEMOCLAW_NON_INTERACTIVE"/, 'versioned installer must run NemoClaw non-interactively by default')
|
||||
assert.match(versionedInstallSource, /NVIDIA_API_KEY="\$\{NVIDIA_API_KEY:-\}"/, 'versioned installer must pass NVIDIA_API_KEY through to NemoClaw install')
|
||||
|
||||
assert.match(hostCommandsSource, /export const HOST_PATH/, 'host command resolution must centralize PATH construction')
|
||||
assert.match(hostCommandsSource, /OPENSHELL_CONTROL_VENV/, 'host command resolution must include the installer-managed virtual environment')
|
||||
assert.match(hostCommandsSource, /\.venv\/bin/, 'host command resolution must include the default project virtual environment')
|
||||
|
||||
@@ -55,15 +55,13 @@ assert.match(
|
||||
/readiness:\s*\{\s*attempts: readiness\.attempts,\s*elapsedMs: readiness\.elapsedMs,/,
|
||||
'blueprint create response must expose readiness polling metadata',
|
||||
)
|
||||
assert.match(createRouteSource, /resolveConfiguredPrimaryInferenceRoute/, 'blueprint create must resolve the configured primary OpenShell inference route')
|
||||
assert.match(createRouteSource, /applyConfiguredInferenceToOnboardEnv/, 'blueprint create must pass the configured inference route into NemoClaw onboarding')
|
||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER/, 'blueprint create must set NemoClaw provider from inference configuration')
|
||||
assert.match(createRouteSource, /NEMOCLAW_MODEL/, 'blueprint create must set NemoClaw model from inference configuration')
|
||||
assert.match(createRouteSource, /!enableTailscale && !onboardInference/, 'blueprint create must not inject the optional NVIDIA placeholder when a primary inference route is configured')
|
||||
assert.match(createRouteSource, /resolvePreferredNemoClawDockerfile/, 'blueprint create must pass an explicit NemoClaw Dockerfile to onboard')
|
||||
assert.match(createRouteSource, /"--from", dockerfilePath/, 'blueprint create must make onboard use the selected Dockerfile instead of implicit refresh paths')
|
||||
assert.match(createRouteSource, /relaxKnownNemoClawDockerfileOpenClawPatch/, 'blueprint create must self-heal the known brittle OpenClaw Dockerfile patch')
|
||||
assert.match(createRouteSource, /writeConfigFile\(params\.nextConfig\) pattern not found/, 'Dockerfile compatibility guard must target the observed OpenClaw patch assertion')
|
||||
assert.match(createRouteSource, /"onboard", "--non-interactive", "--recreate-sandbox"/, 'blueprint create must use the Monday-era normal NemoClaw onboard flow')
|
||||
assert.doesNotMatch(createRouteSource, /"--from"|resolvePreferredNemoClawDockerfile|prepareDashboardOwnedNemoClawDockerfile/, 'blueprint create must not force the explicit Dockerfile path')
|
||||
assert.match(createRouteSource, /NEMOCLAW_SANDBOX_NAME: sandboxName/, 'blueprint create must pass the requested sandbox name to NemoClaw onboarding')
|
||||
assert.match(createRouteSource, /NEMOCLAW_EXPERIMENTAL = "1"/, 'blueprint create must support NemoClaw experimental provider onboarding')
|
||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "vllm"/, 'blueprint create must support the vLLM onboarding provider')
|
||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "nim-local"/, 'blueprint create must support the NVIDIA NIM onboarding provider')
|
||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER_KEY = apiKey/, 'blueprint create must pass NVIDIA API keys through provider env without changing NemoClaw')
|
||||
|
||||
assert.match(hookSource, /type RefreshOptions = \{\s*force\?: boolean\s*\}/, 'inventory refresh must accept a force option')
|
||||
assert.match(hookSource, /!refreshOptions\?\.force && inFlightRef\.current/, 'forced inventory refresh must bypass existing in-flight reads')
|
||||
@@ -94,7 +92,6 @@ assert.match(inferenceRouteSource, /isVllmEndpoint\(name, baseUrl\)/, 'inference
|
||||
assert.match(inferenceRouteSource, /normalizeProviderType\(requestedType, name, baseUrl\)/, 'inference route must force vLLM endpoints through the OpenAI-compatible provider type')
|
||||
assert.match(inferenceRouteSource, /normalizeInferenceBaseUrlForGateway\(\s*baseUrl,/, 'inference route must normalize endpoint URLs for the OpenShell gateway pod')
|
||||
assert.match(inferenceRouteSource, /OPENAI_BASE_URL=\$\{normalizedBaseUrl\}/, 'inference route must pass the normalized endpoint URL as provider config')
|
||||
assert.match(createRouteSource, /normalizeInferenceBaseUrlForGateway\(endpointUrl, "openai"\)/, 'sandbox create must normalize env-derived OpenAI-compatible endpoints before NemoClaw onboarding')
|
||||
assert.match(inferenceEndpointUrlSource, /host\.docker\.internal/, 'endpoint normalization must rewrite host-local URLs to a gateway-reachable host alias')
|
||||
assert.match(inferenceEndpointUrlSource, /\/chat\/completions/, 'endpoint normalization must strip concrete OpenAI endpoint suffixes to the base URL')
|
||||
assert.match(inferencePanelSource, /INFERENCE ENDPOINTS/, 'settings UI must expose inference endpoint configuration')
|
||||
@@ -156,5 +153,8 @@ assert.match(
|
||||
)
|
||||
assert.doesNotMatch(pageSource, /console\.log\('Destroying sandbox:'/, 'destroy workflow must not be a UI-only placeholder')
|
||||
assert.doesNotMatch(configPanelSource, /onInventoryRefresh/, 'create panel must leave post-create inventory orchestration to the parent')
|
||||
assert.match(configPanelSource, /Use vLLM in experimental mode/, 'create panel must expose vLLM experimental onboarding')
|
||||
assert.match(configPanelSource, /Use NVIDIA NIM/, 'create panel must expose NVIDIA NIM onboarding')
|
||||
assert.match(configPanelSource, /createInference/, 'create panel must send create-time inference settings')
|
||||
|
||||
console.log('sandbox-lifecycle-check: PASS create/destroy lifecycle assertions')
|
||||
|
||||
Reference in New Issue
Block a user