Integrate Docker NemoClaw and Hermes

This commit is contained in:
mmckeen-nv
2026-05-08 13:27:29 -07:00
parent efa3690b39
commit c197d9eb28
17 changed files with 572 additions and 77 deletions
+46 -2
View File
@@ -1,5 +1,5 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { readFile, stat } from 'node:fs/promises'
import path from 'node:path'
const root = process.cwd()
@@ -25,6 +25,8 @@ const inferencePanelPath = path.join(root, 'app/components/InferenceEndpointPane
const sandboxInferencePanelPath = path.join(root, 'app/components/SandboxInferencePanel.tsx')
const sidebarPath = path.join(root, 'app/components/Sidebar.tsx')
const sandboxListPath = path.join(root, 'app/components/SandboxList.tsx')
const openClawLogoPath = path.join(root, 'public/sandbox-logos/openclaw.svg')
const hermesLogoPath = path.join(root, 'public/sandbox-logos/hermes.png')
const createRouteSource = await readFile(createRoutePath, 'utf8')
const deleteRouteSource = await readFile(deleteRoutePath, 'utf8')
@@ -48,6 +50,8 @@ const inferencePanelSource = await readFile(inferencePanelPath, 'utf8')
const sandboxInferencePanelSource = await readFile(sandboxInferencePanelPath, 'utf8')
const sidebarSource = await readFile(sidebarPath, 'utf8')
const sandboxListSource = await readFile(sandboxListPath, 'utf8')
const openClawLogoStat = await stat(openClawLogoPath)
const hermesLogoStat = await stat(hermesLogoPath)
assert.match(
createRouteSource,
@@ -59,12 +63,24 @@ assert.match(
/readiness:\s*\{\s*attempts: readiness\.attempts,\s*elapsedMs: readiness\.elapsedMs,/,
'blueprint create response must expose readiness polling metadata',
)
assert.match(createRouteSource, /"onboard", "--non-interactive", "--recreate-sandbox"/, 'blueprint create must use the Monday-era normal NemoClaw onboard flow')
assert.match(createRouteSource, /"onboard",[\s\S]*"--non-interactive",[\s\S]*"--recreate-sandbox"/, 'blueprint create must use the Monday-era normal NemoClaw onboard flow')
assert.match(createRouteSource, /type NemoClawAgent = "openclaw" \| "hermes"/, 'blueprint create must model OpenClaw and Hermes NemoClaw agents')
assert.match(createRouteSource, /function nemoClawAgentForBlueprint\(blueprint: string\): NemoClawAgent/, 'blueprint create must map dashboard blueprints to NemoClaw agents')
assert.match(createRouteSource, /blueprint === "nemoclaw-hermes" \? "hermes" : "openclaw"/, 'Hermes blueprint must select the Hermes NemoClaw agent without changing the OpenClaw default')
assert.match(createRouteSource, /agent === "hermes" \? \["--agent", "hermes"\] : \[\]/, 'Hermes sandbox creation must pass --agent hermes to NemoClaw')
assert.match(createRouteSource, /type CreateGpuMode = "none" \| "auto" \| "required"/, 'blueprint create must model explicit GPU passthrough modes')
assert.match(createRouteSource, /process\.env\.OPENSHELL_CONTROL_CREATE_GPU_MODE \|\| "none"/, 'sandbox create must default to no GPU passthrough unless requested')
assert.match(createRouteSource, /mode === "required"[\s\S]*return \["--gpu"\]/, 'NemoClaw create must pass --gpu when GPU passthrough is required')
assert.match(createRouteSource, /mode === "none"[\s\S]*return \["--no-gpu"\]/, 'NemoClaw create must pass --no-gpu by default to avoid CDI failures')
assert.match(createRouteSource, /openShellGpuArgs\(mode: CreateGpuMode\)/, 'OpenShell create paths must share GPU request handling')
assert.doesNotMatch(createRouteSource, /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, /id: "redeploy-image"/, 'create API must expose image redeploy as a sandbox creation path')
assert.match(createRouteSource, /label: "Quick Deploy New NemoClaw Sandbox"/, 'image redeploy must be labeled as the quick deploy default path')
assert.match(createRouteSource, /label: "Fresh NemoClaw Image"/, 'full rebuild path must be labeled as fresh image creation')
assert.match(createRouteSource, /id: "nemoclaw-hermes"/, 'create API must expose Hermes sandbox creation')
assert.match(createRouteSource, /label: "Fresh Hermes Sandbox"/, 'Hermes sandbox creation must be labeled clearly in the create API')
assert.match(createRouteSource, /source: "~\/NemoClaw\/agents\/hermes\/Dockerfile"/, 'Hermes sandbox creation must point at the upstream Hermes agent source')
assert.match(createRouteSource, /readNemoClawRegistry/, 'image redeploy must discover the default NemoClaw sandbox image automatically')
assert.match(createRouteSource, /listOpenShellSandboxNames/, 'image redeploy must fall back to live OpenShell inventory when registry entries are stale')
assert.match(createRouteSource, /resolveSourcePodImage\(sourceSandboxName, sandboxName\)/, 'image redeploy must allow optional explicit source while defaulting automatically')
@@ -82,6 +98,8 @@ assert.doesNotMatch(createRouteSource, /repairOpenClawRuntimePolicy|runtimePolic
assert.doesNotMatch(createRouteSource, /stabilizeOpenClawGatewayConfig|gatewayConfigRepair|repairOpenClawWorkspacePermissions|workspaceRepair/, 'sandbox create must not patch OpenClaw internals after the Monday rollback')
assert.match(createRouteSource, /repairOpenClawExecApprovalsFile/, 'sandbox create may apply the narrow exec approvals symlink compatibility repair')
assert.match(createRouteSource, /execApprovalsRepair/, 'sandbox create response must report the narrow exec approvals compatibility repair')
assert.match(createRouteSource, /created && isOpenClawAgent \? await repairOpenClawExecApprovalsFile/, 'Hermes create must skip OpenClaw-only exec approvals repair')
assert.match(createRouteSource, /created && isOpenClawAgent \? await approveOpenClawDeviceRequests/, 'Hermes create must skip OpenClaw-only device approval')
assert.doesNotMatch(sandboxPrivilegedFilesSource, /openshell-openclaw-policy-|"policy", "set"|withoutReadOnlyOpenClaw/, 'OpenClaw repair must not mutate OpenShell filesystem policy')
assert.match(sandboxPrivilegedFilesSource, /plugins\.entries\.bonjour/, 'gateway config stabilization must disable the crashing Bonjour plugin')
assert.match(sandboxPrivilegedFilesSource, /sha256sum openclaw\.json > \.config-hash/, 'gateway config stabilization must refresh OpenClaw config hash')
@@ -123,6 +141,7 @@ assert.match(hostCommandsSource, /config\.json/, 'shared host command environmen
assert.match(hostCommandsSource, /gatewayHost/, 'OpenShell gateway address config must support a top-level gatewayHost key')
assert.match(hostCommandsSource, /gateway\.host/, 'OpenShell gateway address config must support a nested gateway host key')
assert.match(createRouteSource, /const env: NodeJS\.ProcessEnv = hostCommandEnv\(\{[\s\S]*NEMOCLAW_SANDBOX_NAME: sandboxName[\s\S]*OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY \|\| "nemoclaw"/, 'NemoClaw onboard must receive the shared host command environment')
assert.match(createRouteSource, /NEMOCLAW_AGENT: agent/, 'NemoClaw onboard must receive the selected dashboard agent')
assert.match(deleteRouteSource, /env: hostCommandEnv\(\{[\s\S]*OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY \|\| "nemoclaw"/, 'delete route must pass the shared host command environment to OpenShell')
assert.match(deleteRouteSource, /waitForSandboxDeleted/, 'delete route must poll authoritative inventory until the sandbox is gone')
assert.doesNotMatch(deleteRouteSource, /cleanupNemoClawSandbox/, 'delete route must not run NemoClaw destroy cleanup after OpenShell deletion')
@@ -133,6 +152,26 @@ assert.match(deleteRouteSource, /openShellAlreadyGone/, 'delete route must toler
assert.doesNotMatch(deleteRouteSource, /isGatewayRecoverable|recoverableGateway/, 'delete route must not include the later gateway-repair branching')
assert.match(telemetryRouteSource, /const names = parseOpenShellSandboxNames\(sandboxListStdout\)/, 'telemetry must derive inventory from OpenShell before consulting NemoClaw')
assert.match(telemetryRouteSource, /names\.length > 0[\s\S]*execNemoclaw\(\["list"\]\)[\s\S]*execNemoclaw\(\["status"\]\)/, 'telemetry must skip NemoClaw list/status when OpenShell reports zero live sandboxes')
assert.match(telemetryRouteSource, /readNemoClawRegistry/, 'telemetry must read the NemoClaw registry for agent metadata')
assert.match(telemetryRouteSource, /resolveSandboxAgent/, 'telemetry must resolve OpenClaw versus Hermes agent metadata')
assert.match(telemetryRouteSource, /"nemoclaw\.ai\/agent": agent/, 'telemetry pod labels must include the selected NemoClaw agent')
assert.match(hookSource, /agent\?: string/, 'inventory items must carry optional agent metadata')
assert.match(hookSource, /agent: typeof sandbox\.agent === 'string' && sandbox\.agent \? sandbox\.agent : 'openclaw'/, 'inventory summary mapping must default older registry entries to OpenClaw')
assert.match(sandboxListSource, /function displaySandboxAgent\(agent\?: string\)/, 'sandbox list must render agent labels')
assert.match(sandboxListSource, /function SandboxTypeLogo\(\{ agent \}/, 'sandbox list must render per-agent sandbox logos')
assert.match(sandboxListSource, /const OPENCLAW_SANDBOX_LOGO = '\/sandbox-logos\/openclaw\.svg'/, 'OpenClaw sandboxes must use the local OpenClaw favicon asset')
assert.match(sandboxListSource, /const HERMES_SANDBOX_LOGO = '\/sandbox-logos\/hermes\.png'/, 'Hermes sandboxes must use the local Hermes favicon asset')
assert.match(sandboxListSource, /const logoSrc = isHermes \? HERMES_SANDBOX_LOGO : OPENCLAW_SANDBOX_LOGO/, 'sandbox type logo must switch assets by agent type')
assert.ok(openClawLogoStat.size > 0, 'OpenClaw favicon asset must be vendored locally')
assert.ok(hermesLogoStat.size > 0, 'Hermes favicon asset must be vendored locally')
assert.match(sandboxListSource, /selectedSandbox\?\.agent === 'hermes'/, 'sandbox operations must detect Hermes sandboxes')
assert.match(sandboxListSource, /Connect to Hermes/, 'sandbox operations must show a Hermes connect action instead of an OpenClaw dashboard action')
assert.match(sandboxListSource, /launch: 'hermes'/, 'Hermes connect action must open the operator terminal in Hermes launch mode')
assert.match(sandboxListSource, /dashboardSessionId/, 'Hermes connect action must preserve the dashboard terminal session id')
assert.match(sandboxListSource, /DISMISSED_PERMISSION_ALERTS_STORAGE_KEY/, 'sandbox list must persist locally hidden permission alerts')
assert.match(sandboxListSource, /visiblePendingRequests\(feed, sandbox, dismissedPermissionAlerts\)/, 'sandbox permission dropdown must hide dismissed pending alerts')
assert.match(sandboxListSource, /<option value=\{DISMISS_PERMISSION_VALUE\}>Do Nothing<\/option>/, 'permission dropdown must offer a Do Nothing option')
assert.match(sandboxListSource, /dismissPermissionAlerts\(selectedSandbox, request\.chunkId\)/, 'sandbox policy drawer must support doing nothing for a specific permission request')
assert.match(inferenceRouteSource, /\["provider", "create", "--name", name, "--type", type\]/, 'inference route must create OpenShell providers')
assert.match(inferenceRouteSource, /\["provider", "update", name\]/, 'inference route must update existing OpenShell providers')
assert.match(inferenceRouteSource, /\["provider", "delete", name\]/, 'inference route must delete OpenShell providers')
@@ -207,7 +246,12 @@ assert.doesNotMatch(pageSource, /console\.log\('Destroying sandbox:'/, 'destroy
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, /type CreateGpuMode = "none" \| "auto" \| "required"/, 'create panel must expose explicit GPU passthrough modes')
assert.match(configPanelSource, /gpuMode: createGpuMode/, 'create panel must send the selected GPU mode to the create API')
assert.match(configPanelSource, /Require GPU/, 'create panel must let operators require GPU passthrough')
assert.match(configPanelSource, /createInference/, 'create panel must send create-time inference settings')
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-blueprint' \|\| selectedBlueprint === 'nemoclaw-hermes'/, 'create panel must treat Hermes as a NemoClaw onboard blueprint')
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-hermes' \? 'my-hermes'/, 'create panel must provide a Hermes-specific sandbox name placeholder')
assert.match(configPanelSource, /useState<string>\('redeploy-image'\)/, 'create panel must default to quick deploy')
assert.doesNotMatch(configPanelSource, /Source Sandbox|sourceSandboxName/, 'basic create panel must not require choosing a source image')