From c197d9eb282ecac649f3a7fcfd19f3f24c0d07e5 Mon Sep 17 00:00:00 2001 From: mmckeen-nv Date: Fri, 8 May 2026 13:27:29 -0700 Subject: [PATCH] Integrate Docker NemoClaw and Hermes --- .env.example | 3 + README.md | 15 +- app/api/sandbox/create/route.ts | 100 ++++++- app/api/telemetry/real/route.ts | 37 ++- app/components/ConfigurationPanel.tsx | 29 +- app/components/SandboxList.tsx | 260 ++++++++++++++---- app/hooks/useSandboxInventory.ts | 3 + app/lib/dashboardSession.ts | 4 + app/operator-terminal/page.tsx | 73 ++++- app/page.tsx | 2 + install.sh | 2 + public/sandbox-logos/hermes.png | Bin 0 -> 4100 bytes public/sandbox-logos/openclaw.svg | 22 ++ tests/dashboard-session-check.mjs | 12 +- tests/portable-install-check.mjs | 4 +- ...post-authority-terminal-contract-check.mjs | 35 +++ tests/sandbox-lifecycle-check.mjs | 48 +++- 17 files changed, 572 insertions(+), 77 deletions(-) create mode 100644 public/sandbox-logos/hermes.png create mode 100644 public/sandbox-logos/openclaw.svg diff --git a/.env.example b/.env.example index 0c88e98..9109959 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,9 @@ OPEN_SHELL_CONTAINER=openshell-cluster-openshell # OpenShell gateway name used by CLI commands OPENSHELL_GATEWAY=nemoclaw +# Sandbox create GPU mode: none, auto, or required. +OPENSHELL_CONTROL_CREATE_GPU_MODE=none + # Optional gateway address override for containerized OpenShell/NemoClaw CLIs # OPENSHELL_GATEWAY_HOST=host.docker.internal # OPENSHELL_GATEWAY_PORT=8080 diff --git a/README.md b/README.md index 10f1b7f..6b37d5a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ It is currently built for active development and lab use. It includes a simple p ## Features - View live OpenShell sandbox inventory. -- Create, destroy, and restart sandboxes. +- Create, destroy, and restart OpenClaw and Hermes sandboxes. - Launch a sandbox-specific OpenClaw Gateway Dashboard through the local proxy. - Approve or reject pending OpenShell network permission requests. - Configure per-sandbox inference routes for Ollama, NIM, vLLM, and external endpoints. @@ -218,6 +218,10 @@ The custom server in `server.mjs` also handles websocket upgrades for: Those upgrade paths are protected by the same auth cookie as the HTTP routes. Behind a reverse proxy, route WebSocket upgrades for the dashboard proxy paths to the same `server.mjs` listener as the HTTP app. Use `OPENCLAW_DASHBOARD_BASE_WS_URL` or `BASE_WS_URL` only when the browser-visible WebSocket base must be a fully qualified override such as `wss://control.example.com/api/ws-proxy`. +## Hermes Notes + +With NemoClaw `v0.0.37`, the create flow includes a Fresh Hermes Sandbox option. It uses NemoClaw onboard with `--agent hermes`; the existing Fresh NemoClaw Image and Quick Deploy paths remain OpenClaw-oriented. + ## Remote Controller Nodes The Wizards page includes **Spawn a Controller Node** for preparing a small OpenShell Control install on another VPS. This is intended for topologies where the browser-facing dashboard and the OpenShell gateway/sandbox hosts are not the same machine. @@ -334,6 +338,8 @@ NEXT_PUBLIC_ENABLE_SANDBOX_OPERATIONS=true # OPENCLAW_DASHBOARD_WS_PROXY_PORT=3001 OPEN_SHELL_CONTAINER=openshell-cluster-nemoclaw OPENSHELL_GATEWAY=nemoclaw +# Sandbox create GPU mode: none, auto, or required. Default none passes --no-gpu to NemoClaw. +OPENSHELL_CONTROL_CREATE_GPU_MODE=none # For containerized CLI runs, when supported by the installed OpenShell/NemoClaw versions: # OPENSHELL_GATEWAY_HOST=host.docker.internal # OPENSHELL_GATEWAY_PORT=8080 @@ -381,6 +387,13 @@ openshell list docker ps | grep openshell ``` +If sandbox creation fails with `unresolvable CDI devices nvidia.com/gpu=all`, either create the sandbox with GPU mode set to `none`, or generate the NVIDIA CDI spec on the host: + +```bash +sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml +nvidia-ctk cdi list +``` + Check auth: ```bash diff --git a/app/api/sandbox/create/route.ts b/app/api/sandbox/create/route.ts index 3fde4fd..be0c95f 100644 --- a/app/api/sandbox/create/route.ts +++ b/app/api/sandbox/create/route.ts @@ -66,6 +66,8 @@ type NemoClawCreateCommand = { } type CreateInferenceMode = "auto" | "vllm" | "nim" +type CreateGpuMode = "none" | "auto" | "required" +type NemoClawAgent = "openclaw" | "hermes" type CreateInferenceSettings = { mode: CreateInferenceMode @@ -79,6 +81,13 @@ type NemoClawRegistryData = { defaultSandbox?: string | null } +function parseCreateGpuMode(body: any): CreateGpuMode { + const raw = typeof body?.gpuMode === "string" + ? body.gpuMode + : process.env.OPENSHELL_CONTROL_CREATE_GPU_MODE || "none" + return raw === "auto" || raw === "required" ? raw : "none" +} + function parseCreateInferenceSettings(body: any): CreateInferenceSettings { const raw = body?.createInference && typeof body.createInference === "object" ? body.createInference : {} const requestedMode = typeof raw.mode === "string" ? raw.mode : "vllm" @@ -124,13 +133,45 @@ function applyCreateInferenceEnv(env: NodeJS.ProcessEnv, settings: CreateInferen return settings } -function buildNemoClawCreateCommand(): NemoClawCreateCommand { +function nemoClawGpuArgs(mode: CreateGpuMode) { + if (mode === "required") return ["--gpu"] + if (mode === "none") return ["--no-gpu"] + return [] +} + +function nemoClawAgentArgs(agent: NemoClawAgent) { + return agent === "hermes" ? ["--agent", "hermes"] : [] +} + +function isNemoClawOnboardBlueprint(blueprint: string) { + return blueprint === "nemoclaw-blueprint" || blueprint === "nemoclaw-hermes" +} + +function nemoClawAgentForBlueprint(blueprint: string): NemoClawAgent { + return blueprint === "nemoclaw-hermes" ? "hermes" : "openclaw" +} + +function openShellGpuArgs(mode: CreateGpuMode) { + return mode === "required" ? ["--gpu"] : [] +} + +function buildNemoClawCreateCommand(gpuMode: CreateGpuMode, agent: NemoClawAgent): NemoClawCreateCommand { if (NEMOCLAW_BIN && commandExists(NEMOCLAW_BIN)) { - const args = ["onboard", "--non-interactive", "--recreate-sandbox", "--yes-i-accept-third-party-software"] + const args = [ + "onboard", + "--non-interactive", + "--recreate-sandbox", + "--yes-i-accept-third-party-software", + ...nemoClawAgentArgs(agent), + ...nemoClawGpuArgs(gpuMode), + ] return /\.(?:c?m?js|ts)$/i.test(NEMOCLAW_BIN) ? { file: NODE_BIN, args: [NEMOCLAW_BIN, ...args], mode: "cli-onboard" } : { file: NEMOCLAW_BIN, args, mode: "cli-onboard" } } + if (agent === "hermes") { + throw new Error("Hermes sandbox creation requires the current NemoClaw CLI with --agent hermes support. Set NEMOCLAW_BIN in .env.local.") + } if (NEMOCLAW_SETUP && commandExists(NEMOCLAW_SETUP)) { return { file: "/bin/bash", args: [NEMOCLAW_SETUP], mode: "legacy-setup" } } @@ -669,6 +710,14 @@ export async function GET() { source: "~/NemoClaw/nemoclaw-blueprint/blueprint.yaml", supportsTailscale: true, }, + { + id: "nemoclaw-hermes", + label: "Fresh Hermes Sandbox", + description: "Bootstraps a Hermes Agent sandbox using NemoClaw's Hermes workflow.", + type: "blueprint", + source: "~/NemoClaw/agents/hermes/Dockerfile", + supportsTailscale: false, + }, { id: "custom-sandbox", label: "New Custom Sandbox", @@ -698,17 +747,21 @@ 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) + const gpuMode = parseCreateGpuMode(body) const createInference = parseCreateInferenceSettings(body) - console.log(`[sandbox/create] request:parsed sandbox=${sandboxName} blueprint=${blueprint} enableTailscale=${enableTailscale} inferenceMode=${createInference.mode} elapsedMs=${elapsedMs(requestStartedAt)}`) + console.log(`[sandbox/create] request:parsed sandbox=${sandboxName} blueprint=${blueprint} enableTailscale=${enableTailscale} gpuMode=${gpuMode} inferenceMode=${createInference.mode} elapsedMs=${elapsedMs(requestStartedAt)}`) if (!blueprint) { return NextResponse.json({ ok: false, error: "blueprint is required" }, { status: 400 }) } - if (blueprint === "nemoclaw-blueprint") { - const createCommand = buildNemoClawCreateCommand() + if (isNemoClawOnboardBlueprint(blueprint)) { + const agent = nemoClawAgentForBlueprint(blueprint) + const isOpenClawAgent = agent === "openclaw" + const createCommand = buildNemoClawCreateCommand(gpuMode, agent) const env: NodeJS.ProcessEnv = hostCommandEnv({ NEMOCLAW_SANDBOX_NAME: sandboxName, + NEMOCLAW_AGENT: agent, NEMOCLAW_NON_INTERACTIVE: "1", NEMOCLAW_RECREATE_SANDBOX: "1", NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1", @@ -735,8 +788,10 @@ export async function POST(request: Request) { stdout: result.stdout, stderr: result.stderr, blueprint, + agent, sandboxName, enableTailscale, + gpuMode, createInference, }, { status: 500 }) } @@ -748,25 +803,27 @@ export async function POST(request: Request) { error: "Sandbox readiness polling produced no verification result.", } const created = readiness.verified - const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({ + const execApprovalsRepair = created && isOpenClawAgent ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({ sandboxName, path: "/sandbox/.openclaw/exec-approvals.json", error: error instanceof Error ? error.message : "Failed to repair OpenClaw exec approvals file", })) : null - const deviceApproval = created ? await approveOpenClawDeviceRequests(sandboxName) : null + const deviceApproval = created && isOpenClawAgent ? await approveOpenClawDeviceRequests(sandboxName) : null console.log( - `[sandbox/create] request:complete sandbox=${sandboxName} created=${created} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`, + `[sandbox/create] request:complete sandbox=${sandboxName} created=${created} agent=${agent} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`, ) return NextResponse.json({ ok: created, blueprint, + agent, sandboxName, created, verified: verification.verified, verification, - mode: "nemoclaw-blueprint", + mode: blueprint, enableTailscale, + gpuMode, createInference, createCommand, hostPath: HOST_PATH, @@ -780,9 +837,16 @@ export async function POST(request: Request) { stderr: result.stderr, note: created ? appendNote( - enableTailscale - ? "NemoClaw blueprint workflow completed with Tailscale-enabled prerequisites. Existing healthy OpenShell gateways are reused before any new gateway start is attempted." - : "NemoClaw blueprint workflow completed in local/default mode. Existing healthy OpenShell gateways are reused before any new gateway start is attempted.", + agent === "hermes" + ? "NemoClaw Hermes workflow completed. Hermes exposes an API endpoint from the sandbox rather than an OpenClaw browser dashboard." + : enableTailscale + ? "NemoClaw blueprint workflow completed with Tailscale-enabled prerequisites. Existing healthy OpenShell gateways are reused before any new gateway start is attempted." + : "NemoClaw blueprint workflow completed in local/default mode. Existing healthy OpenShell gateways are reused before any new gateway start is attempted.", + gpuMode === "none" + ? "GPU passthrough was disabled for this create run." + : gpuMode === "required" + ? "GPU passthrough was required for this create run." + : "NemoClaw chose GPU passthrough automatically for this create run.", execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false, execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false, deviceApproval?.note, @@ -798,7 +862,7 @@ export async function POST(request: Request) { CLICOLOR: "0", CLICOLOR_FORCE: "0", }) - const createAttempt = await runCreateCommandBounded(OPENSHELL_BIN, ["sandbox", "create", "--name", sandboxName], env, 15000) + const createAttempt = await runCreateCommandBounded(OPENSHELL_BIN, ["sandbox", "create", "--name", sandboxName, ...openShellGpuArgs(gpuMode)], env, 15000) if (createAttempt.completed && createAttempt.exitCode !== 0) { return NextResponse.json({ @@ -808,6 +872,7 @@ export async function POST(request: Request) { stderr: createAttempt.stderr, blueprint, sandboxName, + gpuMode, }, { status: 500 }) } @@ -836,6 +901,7 @@ export async function POST(request: Request) { verified: verification.verified, verification, mode: "custom-sandbox", + gpuMode, stdout: createAttempt.stdout, stderr: createAttempt.stderr, createCommand: { @@ -859,6 +925,9 @@ export async function POST(request: Request) { : (policyPrepared ? "Custom sandbox created. Policy draft is prepared, but applying it live should be a follow-up action." : "Custom sandbox created."), + gpuMode === "required" + ? "GPU passthrough was requested for this create run." + : false, execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false, execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false, deviceApproval?.note, @@ -881,6 +950,7 @@ export async function POST(request: Request) { "create", "--name", sandboxName, + ...openShellGpuArgs(gpuMode), "--from", sourceImage, "--policy", @@ -921,6 +991,7 @@ export async function POST(request: Request) { verified: verification.verified, verification, mode: "redeploy-image", + gpuMode, stdout: createAttempt.stdout, stderr: createAttempt.stderr, createCommand: { @@ -941,6 +1012,9 @@ export async function POST(request: Request) { note: created ? appendNote( `Sandbox created by redeploying the running image from '${source.name}' instead of rebuilding it.`, + gpuMode === "required" + ? "GPU passthrough was requested for this create run." + : false, createAttempt.forcedReady ? "The dashboard returned as soon as OpenShell reported the redeployed sandbox Ready." : false, diff --git a/app/api/telemetry/real/route.ts b/app/api/telemetry/real/route.ts index 55c68cb..0491e1b 100644 --- a/app/api/telemetry/real/route.ts +++ b/app/api/telemetry/real/route.ts @@ -1,11 +1,14 @@ import { NextResponse } from "next/server" import { execFile } from "node:child_process" +import { existsSync, readFileSync } from "node:fs" import { hostname, networkInterfaces } from "node:os" +import path from "node:path" import { promisify } from "node:util" import { NEMOCLAW_BIN, NODE_BIN, OPENSHELL_BIN, hostCommandEnv } from "@/app/lib/hostCommands" import { resolveRuntimeAuthority } from "@/app/lib/runtimeAuthority" const execFileAsync = promisify(execFile) +const NEMOCLAW_REGISTRY_FILE = path.join(process.env.HOME || "/tmp", ".nemoclaw", "sandboxes.json") type SandboxSummary = { id: string @@ -16,6 +19,7 @@ type SandboxSummary = { hasSshConfig: boolean source: "openshell" isDefault: boolean + agent: string } type NemoClawSummary = { @@ -26,6 +30,10 @@ type NemoClawSummary = { source: "nemoclaw-cli" | "none" } +type NemoClawRegistryData = { + sandboxes?: Record +} + type SandboxItem = { metadata: { name: string @@ -145,6 +153,24 @@ function buildNemoClawSummary(output: string | null, defaultSandboxNames: Set entry?.name === name || Boolean(id && entry?.name === id)) + const agent = directEntry?.agent || namedEntry?.agent + return typeof agent === "string" && agent.trim() ? agent.trim() : "openclaw" +} + async function execNemoclaw(args: string[]) { const env = hostCommandEnv({ OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw", @@ -189,7 +215,7 @@ function readHostIdentity() { return { hostname: hostname(), address: "127.0.0.1", interface: "lo0" } } -async function readSandbox(name: string, defaultSandboxNames: Set): Promise<{ summary: SandboxSummary; pod: SandboxItem }> { +async function readSandbox(name: string, defaultSandboxNames: Set, registry: NemoClawRegistryData): Promise<{ summary: SandboxSummary; pod: SandboxItem }> { try { const [{ stdout: detailsStdout }, { stdout: sshStdout }] = await Promise.all([ execOpenShell(["sandbox", "get", name]), @@ -203,6 +229,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom const sshConfig = sshStdout.trim() const sshHostAlias = parseSshHostAlias(sshConfig, sandboxName) const isDefault = defaultSandboxNames.has(sandboxName) + const agent = resolveSandboxAgent(sandboxName, sandboxId, registry) return { summary: { @@ -214,6 +241,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom hasSshConfig: Boolean(sshConfig), source: "openshell", isDefault, + agent, }, pod: { metadata: { @@ -223,6 +251,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom "nemoclaw.ai/sandbox-name": sandboxName, ...(sandboxId ? { "nemoclaw.ai/sandbox-id": sandboxId } : {}), ...(isDefault ? { "nemoclaw.ai/default": "true" } : {}), + "nemoclaw.ai/agent": agent, }, }, spec: { @@ -245,6 +274,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom } catch (error) { const sandboxName = name const isDefault = defaultSandboxNames.has(sandboxName) + const agent = resolveSandboxAgent(sandboxName, sandboxName, registry) return { summary: { id: sandboxName, @@ -255,6 +285,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom hasSshConfig: false, source: "openshell", isDefault, + agent, }, pod: { metadata: { @@ -264,6 +295,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set): Prom "nemoclaw.ai/sandbox-name": sandboxName, "nemoclaw.ai/sandbox-id": sandboxName, ...(isDefault ? { "nemoclaw.ai/default": "true" } : {}), + "nemoclaw.ai/agent": agent, }, }, spec: { @@ -297,7 +329,8 @@ export async function GET() { ]) : [null, null] const defaultSandboxNames = parseDefaultSandboxNames(nemoclawListResult?.stdout ?? "") - const results = await Promise.all(names.map((name) => readSandbox(name, defaultSandboxNames))) + const registry = readNemoClawRegistry() + const results = await Promise.all(names.map((name) => readSandbox(name, defaultSandboxNames, registry))) const sandboxes = results.map((result) => result.summary) const items = results.map((result) => result.pod) const nemoclaw = buildNemoClawSummary(nemoclawStatusResult?.stdout ?? null, defaultSandboxNames) diff --git a/app/components/ConfigurationPanel.tsx b/app/components/ConfigurationPanel.tsx index edc2966..70f89c9 100644 --- a/app/components/ConfigurationPanel.tsx +++ b/app/components/ConfigurationPanel.tsx @@ -8,6 +8,7 @@ type EndpointTls = "" | "terminate" | "passthrough" type EndpointEnforcement = "" | "enforce" | "audit" type EndpointAccess = "" | "read-only" | "read-write" | "full" type CreateInferenceMode = "auto" | "vllm" | "nim" +type CreateGpuMode = "none" | "auto" | "required" interface NetworkRule { method: string; path: string } interface NetworkEndpoint { host: string; port: string; protocol: EndpointProtocol; tls: EndpointTls; enforcement: EndpointEnforcement; access: EndpointAccess; rules: NetworkRule[] } @@ -88,6 +89,7 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre const [selectedBlueprint, setSelectedBlueprint] = useState('redeploy-image') const [sandboxName, setSandboxName] = useState('') const [enableTailscale, setEnableTailscale] = useState(false) + const [createGpuMode, setCreateGpuMode] = useState("none") const [createInferenceMode, setCreateInferenceMode] = useState("vllm") const [createInferenceModel, setCreateInferenceModel] = useState("") const [createNvidiaApiKey, setCreateNvidiaApiKey] = useState("") @@ -126,6 +128,7 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre const assembledPolicy = useMemo(() => ({ ...policy, network_policies: blocksToPolicy(blocks) }), [policy, blocks]) const activePreset = selectedPreset ? getSecurityPreset(selectedPreset) : null const activeBlueprint = blueprints.find((bp) => bp.id === selectedBlueprint) + const isNemoClawOnboardBlueprint = selectedBlueprint === 'nemoclaw-blueprint' || selectedBlueprint === 'nemoclaw-hermes' function applyPreset(presetId: SecurityPresetId) { const preset = getSecurityPreset(presetId); if (!preset) return @@ -143,7 +146,7 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre 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 res = await fetch('/api/sandbox/create', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ blueprint: selectedBlueprint, sandboxName: sandboxName.trim(), enableTailscale, gpuMode: createGpuMode, 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 @@ -216,7 +219,27 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
- setSandboxName(e.target.value)} placeholder={selectedBlueprint === 'nemoclaw-blueprint' ? 'my-assistant' : selectedBlueprint === 'redeploy-image' ? 'my-assistant-copy' : '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)]" /> + setSandboxName(e.target.value)} placeholder={selectedBlueprint === 'nemoclaw-hermes' ? 'my-hermes' : selectedBlueprint === 'nemoclaw-blueprint' ? 'my-assistant' : selectedBlueprint === 'redeploy-image' ? 'my-assistant-copy' : '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)]" /> +
+
+
+
GPU Passthrough
+

Choose whether new sandboxes should request NVIDIA GPU devices.

+
+
+ + + +
{selectedBlueprint === 'redeploy-image' && (
@@ -229,7 +252,7 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre )} {enableTailscale &&
Tailscale-enabled creation requires NVIDIA_API_KEY in the dashboard process environment.
} - {selectedBlueprint === 'nemoclaw-blueprint' &&
+ {isNemoClawOnboardBlueprint &&
Inference at Create

Choose the provider NemoClaw should use while onboarding this sandbox.

diff --git a/app/components/SandboxList.tsx b/app/components/SandboxList.tsx index 5f2f56d..ee2a529 100644 --- a/app/components/SandboxList.tsx +++ b/app/components/SandboxList.tsx @@ -5,6 +5,7 @@ import ConfigurationPanel from './ConfigurationPanel' import SandboxArchivePanel from './SandboxArchivePanel' import SandboxFilesPanel from './SandboxFilesPanel' import SandboxInferencePanel from './SandboxInferencePanel' +import { buildOperatorTerminalRoute } from '../lib/dashboardSession' import type { NemoClawSummary, SandboxInventoryItem } from '../hooks/useSandboxInventory' interface TelemetryData { @@ -25,6 +26,7 @@ interface SandboxListProps { onSandboxSelect: (id: string | null) => void isDestroyMode: boolean onInventoryRefresh: () => Promise + dashboardSessionId: string } type DrawerKey = 'operations' | 'files' | 'inference' | 'policy' | 'archive' | 'mcp' @@ -55,6 +57,13 @@ type PermissionFeed = { rejectedCount?: number } +type DismissedPermissionAlerts = Record + +const DISMISSED_PERMISSION_ALERTS_STORAGE_KEY = 'openshell-control-dismissed-permission-alerts' +const DISMISS_PERMISSION_VALUE = '__dismiss_permission_alerts__' +const OPENCLAW_SANDBOX_LOGO = '/sandbox-logos/openclaw.svg' +const HERMES_SANDBOX_LOGO = '/sandbox-logos/hermes.png' + function renderDashboardTruthMessage(data: any) { if (data.reachable) return 'OpenClaw dashboard opened in a new tab.' return 'OpenClaw dashboard is not reachable from this host right now.' @@ -68,6 +77,74 @@ function openDashboardUrl(url: string, openInNewTab: boolean) { } } +function displaySandboxAgent(agent?: string) { + if (agent === 'hermes') return 'Hermes' + return 'OpenClaw' +} + +function SandboxTypeLogo({ agent }: { agent?: string }) { + const isHermes = agent === 'hermes' + const label = isHermes ? 'Hermes sandbox' : 'OpenClaw sandbox' + const logoSrc = isHermes ? HERMES_SANDBOX_LOGO : OPENCLAW_SANDBOX_LOGO + return ( + + + ) +} + +function normalizeDismissedPermissionAlerts(value: unknown): DismissedPermissionAlerts { + if (!value || typeof value !== 'object' || Array.isArray(value)) return {} + return Object.entries(value as Record).reduce((normalized, [sandboxId, chunks]) => { + if (Array.isArray(chunks)) { + const ids = chunks.filter((chunk): chunk is string => typeof chunk === 'string' && chunk.length > 0) + if (ids.length > 0) normalized[sandboxId] = Array.from(new Set(ids)) + } + return normalized + }, {}) +} + +function loadDismissedPermissionAlerts(): DismissedPermissionAlerts { + if (typeof window === 'undefined') return {} + try { + return normalizeDismissedPermissionAlerts(JSON.parse(window.localStorage.getItem(DISMISSED_PERMISSION_ALERTS_STORAGE_KEY) || '{}')) + } catch { + return {} + } +} + +function saveDismissedPermissionAlerts(alerts: DismissedPermissionAlerts) { + if (typeof window === 'undefined') return + window.localStorage.setItem(DISMISSED_PERMISSION_ALERTS_STORAGE_KEY, JSON.stringify(alerts)) +} + +function dismissedPermissionSet(alerts: DismissedPermissionAlerts, sandbox: SandboxInventoryItem) { + return new Set([...(alerts[sandbox.id] || []), ...(alerts[sandbox.name] || [])]) +} + +function visiblePendingRequests(feed: PermissionFeed | undefined, sandbox: SandboxInventoryItem, alerts: DismissedPermissionAlerts) { + const dismissed = dismissedPermissionSet(alerts, sandbox) + return (feed?.pending || []).filter((request) => !request.chunkId || !dismissed.has(request.chunkId)) +} + +function permissionFeedNeedsAttention(feed: PermissionFeed | undefined, sandbox: SandboxInventoryItem, alerts: DismissedPermissionAlerts) { + const latestStatus = feed?.latest?.status || '' + const latestChunkId = feed?.latest?.chunkId || '' + const dismissed = dismissedPermissionSet(alerts, sandbox) + return Boolean( + visiblePendingRequests(feed, sandbox, alerts).length > 0 || + (/pending|fail|error|unavailable/i.test(latestStatus) && (!latestChunkId || !dismissed.has(latestChunkId))), + ) +} + function DrawerSection({ title, summary, @@ -120,11 +197,13 @@ export default function SandboxList({ onSandboxSelect, isDestroyMode, onInventoryRefresh, + dashboardSessionId, }: SandboxListProps) { const [dashboardMessage, setDashboardMessage] = useState('') const [restartInProgress, setRestartInProgress] = useState(false) const [permissionMessage, setPermissionMessage] = useState('') const [permissionFeeds, setPermissionFeeds] = useState>({}) + const [dismissedPermissionAlerts, setDismissedPermissionAlerts] = useState(() => loadDismissedPermissionAlerts()) const [grantingSandboxId, setGrantingSandboxId] = useState(null) const [mcpServers, setMcpServers] = useState([]) const [mcpMessage, setMcpMessage] = useState('') @@ -244,6 +323,16 @@ export default function SandboxList({ const allowedMcpServersForSandbox = (sandbox: SandboxInventoryItem) => ( mcpServers.filter((server) => sandboxCanAccessMcpServer(sandbox, server)) ) + const selectedSandboxIsHermes = selectedSandbox?.agent === 'hermes' + + const connectToHermes = (sandbox: SandboxInventoryItem) => { + const route = buildOperatorTerminalRoute({ + sandboxId: sandbox.name, + dashboardSessionId, + launch: 'hermes', + }) + window.open(route, '_blank', 'noopener,noreferrer') + } const updateMcpServerAccess = async ( server: McpServerAccess, @@ -313,6 +402,41 @@ export default function SandboxList({ }, `${server.name} revoked from ${sandbox.name}.`).then(() => syncMcpManifest(sandbox)) } + const dismissPermissionAlerts = (sandbox: SandboxInventoryItem, chunkId?: string) => { + const feed = permissionFeeds[sandbox.id] + const visibleIds = visiblePendingRequests(feed, sandbox, dismissedPermissionAlerts) + .map((request) => request.chunkId) + .filter(Boolean) + const idsToDismiss = chunkId ? [chunkId] : visibleIds + + if (idsToDismiss.length === 0) { + setPermissionMessage(`No permission alerts to hide for ${sandbox.name}.`) + return + } + + setDismissedPermissionAlerts((current) => { + const existing = new Set(current[sandbox.id] || []) + for (const id of idsToDismiss) existing.add(id) + const next = { ...current, [sandbox.id]: Array.from(existing) } + saveDismissedPermissionAlerts(next) + return next + }) + setPermissionMessage(idsToDismiss.length === 1 ? `Permission alert hidden for ${sandbox.name}.` : `Permission alerts hidden for ${sandbox.name}.`) + } + + const clearDismissedPermissionAlert = (sandbox: SandboxInventoryItem, chunkId: string) => { + setDismissedPermissionAlerts((current) => { + const existing = current[sandbox.id] + if (!existing?.includes(chunkId)) return current + const remaining = existing.filter((id) => id !== chunkId) + const next = { ...current } + if (remaining.length > 0) next[sandbox.id] = remaining + else delete next[sandbox.id] + saveDismissedPermissionAlerts(next) + return next + }) + } + const resolvePermissionRequest = async (sandbox: SandboxInventoryItem, action: 'approve' | 'reject', chunkId: string) => { if (!chunkId) return try { @@ -328,6 +452,7 @@ export default function SandboxList({ if (data.result?.feed) { setPermissionFeeds((current) => ({ ...current, [sandbox.id]: data.result.feed })) } + clearDismissedPermissionAlert(sandbox, chunkId) setPermissionMessage(data.note || `Network request ${action === 'approve' ? 'approved' : 'rejected'} for ${sandbox.name}.`) } catch (error) { setPermissionMessage(error instanceof Error ? error.message : 'Failed to resolve permission request') @@ -384,11 +509,13 @@ export default function SandboxList({ >
+ {(() => { const feed = permissionFeeds[sandbox.id] - const needsAttention = Boolean((feed?.pendingCount || 0) > 0 || /pending|fail|error|unavailable/i.test(feed?.latest?.status || '')) + const visiblePending = visiblePendingRequests(feed, sandbox, dismissedPermissionAlerts) + const needsAttention = permissionFeedNeedsAttention(feed, sandbox, dismissedPermissionAlerts) return needsAttention ? ( - + @@ -441,6 +568,7 @@ export default function SandboxList({
{([ + ['Agent', displaySandboxAgent(sandbox.agent), '120px'], ['Attach Target', sandbox.ip, '180px'], ['Namespace', sandbox.namespace, '120px'], ['Host Alias', sandbox.sshHostAlias || 'N/A', '140px'], @@ -454,30 +582,43 @@ export default function SandboxList({
- + {(() => { + const feed = permissionFeeds[sandbox.id] + const visiblePending = visiblePendingRequests(feed, sandbox, dismissedPermissionAlerts) + return ( + + ) + })()}
))} @@ -493,36 +634,45 @@ export default function SandboxList({ <> toggleDrawer('operations')} >
- + }} + className="action-button px-3 py-2" + > + Start OpenClaw Gateway Dashboard + + ) : ( + + )} +
diff --git a/app/hooks/useSandboxInventory.ts b/app/hooks/useSandboxInventory.ts index 751ca2b..f18e843 100644 --- a/app/hooks/useSandboxInventory.ts +++ b/app/hooks/useSandboxInventory.ts @@ -11,6 +11,7 @@ export interface SandboxInventoryItem { ready: boolean sshHostAlias?: string isDefault?: boolean + agent?: string } export interface NemoClawSummary { @@ -48,6 +49,7 @@ function mapSandboxSummary(sandbox: any): SandboxInventoryItem { ready: status === 'running', sshHostAlias: sandbox.sshHostAlias || undefined, isDefault: Boolean(sandbox.isDefault), + agent: typeof sandbox.agent === 'string' && sandbox.agent ? sandbox.agent : 'openclaw', } } @@ -62,6 +64,7 @@ function mapPodItem(pod: any): SandboxInventoryItem { ready: pod.status?.conditions?.find((c: any) => c.type === 'Ready')?.status === 'True', sshHostAlias: pod.status?.podIP || undefined, isDefault: pod.metadata?.labels?.['nemoclaw.ai/default'] === 'true', + agent: pod.metadata?.labels?.['nemoclaw.ai/agent'] || 'openclaw', } } diff --git a/app/lib/dashboardSession.ts b/app/lib/dashboardSession.ts index 4c04017..5211ab0 100644 --- a/app/lib/dashboardSession.ts +++ b/app/lib/dashboardSession.ts @@ -78,12 +78,16 @@ export function persistDashboardSessionState(session: DashboardSessionState) { export function buildOperatorTerminalRoute(params: { sandboxId?: string | null dashboardSessionId: string + launch?: 'hermes' | null }) { const searchParams = new URLSearchParams() if (params.sandboxId) { searchParams.set('sandboxId', params.sandboxId) } searchParams.set('dashboardSessionId', params.dashboardSessionId) + if (params.launch) { + searchParams.set('launch', params.launch) + } const query = searchParams.toString() return query ? `/operator-terminal?${query}` : '/operator-terminal' } diff --git a/app/operator-terminal/page.tsx b/app/operator-terminal/page.tsx index f56f27c..42f3340 100644 --- a/app/operator-terminal/page.tsx +++ b/app/operator-terminal/page.tsx @@ -59,9 +59,39 @@ const defaultAlias = (sandboxId: string | null) => `ssh openshell-${sandboxId || const defaultFallback = (sandboxId: string | null) => `ssh openshell-${sandboxId || 'my-assistant'}` const defaultLoginShell = (sandboxId: string | null) => `env PATH=$HOME/.local/bin:$PATH bash -l -c 'ssh openshell-${sandboxId || 'my-assistant'}'` const DEFAULT_SHELL_HINT = 'If your non-interactive shell misses local tooling, retry from a login shell or prepend PATH=$HOME/.local/bin:$PATH before ssh.' + +function shellQuote(value: string) { + return `'${value.replace(/'/g, `'"'"'`)}'` +} + +function escapeRegExp(value: string) { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + +function buildHermesTerminalConnectCommand(sandboxId: string) { + const target = shellQuote(sandboxId) + const alias = shellQuote(`openshell-${sandboxId}`) + const message = shellQuote(`[OpenShell Control] Connecting to Hermes sandbox ${sandboxId}...`) + return [ + `printf '\\n%s\\n' ${message}`, + `if command -v nemohermes >/dev/null 2>&1; then nemohermes ${target} connect; elif command -v nemoclaw >/dev/null 2>&1; then nemoclaw ${target} connect; else ssh ${alias}; fi`, + ].join('; ') +} + +const HERMES_AGENT_COMMAND = "if command -v hermes >/dev/null 2>&1; then hermes; else echo 'Hermes CLI not found in this shell. Check that the terminal is attached to a Hermes sandbox.' >&2; fi" + +function isHermesAttachReadyOutput(output: string, sandboxId: string) { + const escapedSandboxId = escapeRegExp(sandboxId) + return ( + new RegExp(`(?:^|\\n)sandbox@${escapedSandboxId}:[^\\n]*[$#]\\s*$`).test(output) || + /(?:^|\n)sandbox@[^:\s]+:[^\n]*[$#]\s*$/.test(output) + ) +} + function OperatorTerminalInner() { const searchParams = useSearchParams() const sandboxId = searchParams.get('sandboxId') + const launchMode = searchParams.get('launch') const requestedDashboardSessionId = searchParams.get('dashboardSessionId') const [dashboardSessionId, setDashboardSessionId] = useState( () => requestedDashboardSessionId?.trim() || HYDRATION_SAFE_DASHBOARD_SESSION_ID @@ -84,12 +114,18 @@ function OperatorTerminalInner() { const liveSessionRequestRef = useRef | null>(null) const reconnectCounterRef = useRef(0) const resizeObserverRef = useRef(null) + const hermesLaunchSentRef = useRef(false) + const hermesAgentSentRef = useRef(false) + const hermesAttachBufferRef = useRef('') useEffect(() => { setDashboardSessionId(ensureDashboardSessionId(requestedDashboardSessionId)) }, [requestedDashboardSessionId]) - const terminalDescription = sandboxId ? 'Live operator terminal for the selected sandbox, brokered through the dashboard-owned terminal bridge.' : 'Live operator terminal for host mode, brokered through the dashboard-owned terminal bridge.' + const shouldLaunchHermes = launchMode === 'hermes' && Boolean(sandboxId) + const terminalDescription = shouldLaunchHermes + ? 'Live operator terminal for Hermes. The dashboard connects to the sandbox and starts the Hermes CLI.' + : sandboxId ? 'Live operator terminal for the selected sandbox, brokered through the dashboard-owned terminal bridge.' : 'Live operator terminal for host mode, brokered through the dashboard-owned terminal bridge.' const refreshReadiness = useCallback(async () => { if (!sandboxId) { @@ -119,6 +155,9 @@ function OperatorTerminalInner() { if (reset) { reconnectCounterRef.current += 1 liveSessionIdRef.current = '' + hermesLaunchSentRef.current = false + hermesAgentSentRef.current = false + hermesAttachBufferRef.current = '' socketRef.current?.close() socketRef.current = null } @@ -162,6 +201,12 @@ function OperatorTerminalInner() { } }, [dashboardSessionId, sandboxId]) + useEffect(() => { + hermesLaunchSentRef.current = false + hermesAgentSentRef.current = false + hermesAttachBufferRef.current = '' + }, [launchMode, sandboxId]) + useEffect(() => { refreshReadiness() }, [refreshReadiness]) useEffect(() => { ensureLiveSession() }, [ensureLiveSession]) @@ -247,7 +292,9 @@ function OperatorTerminalInner() { socket.addEventListener('open', () => { setTerminalState('connected') - setTerminalStatus(`Live terminal connected for ${liveSession.sandboxId}.`) + setTerminalStatus(shouldLaunchHermes + ? `Live terminal connected for ${liveSession.sandboxId}; launching Hermes…` + : `Live terminal connected for ${liveSession.sandboxId}.`) try { fitAddonRef.current?.fit() } catch { @@ -255,6 +302,14 @@ function OperatorTerminalInner() { } term.focus() socket.send(JSON.stringify({ type: 'resize', cols: term.cols, rows: term.rows })) + if (shouldLaunchHermes && sandboxId && !hermesLaunchSentRef.current) { + hermesLaunchSentRef.current = true + window.setTimeout(() => { + if (socket.readyState === WebSocket.OPEN) { + socket.send(JSON.stringify({ type: 'input', data: `\n\n${buildHermesTerminalConnectCommand(sandboxId)}\n` })) + } + }, 250) + } }) socket.addEventListener('message', (event) => { @@ -265,6 +320,18 @@ function OperatorTerminalInner() { term.write(message.replay) } else if (message.type === 'data' && typeof message.data === 'string') { term.write(message.data) + if (shouldLaunchHermes && sandboxId && !hermesAgentSentRef.current) { + hermesAttachBufferRef.current = `${hermesAttachBufferRef.current}${message.data}`.slice(-8000) + if (isHermesAttachReadyOutput(hermesAttachBufferRef.current, sandboxId)) { + hermesAgentSentRef.current = true + setTerminalStatus(`Hermes sandbox ${sandboxId} attached; starting Hermes CLI…`) + window.setTimeout(() => { + if (socket.readyState === WebSocket.OPEN) { + socket.send(JSON.stringify({ type: 'input', data: `\n\n${HERMES_AGENT_COMMAND}\n` })) + } + }, 350) + } + } } else if (message.type === 'exit') { setTerminalState('error') setTerminalStatus(`Terminal exited with code ${message.exitCode ?? 'unknown'}.`) @@ -291,7 +358,7 @@ function OperatorTerminalInner() { socket.close() if (socketRef.current === socket) socketRef.current = null } - }, [liveSession, terminalReady]) + }, [liveSession, terminalReady, shouldLaunchHermes, sandboxId]) const readiness = useMemo(() => { if (!sandboxId) return { tone: 'border-[var(--status-pending)] text-[var(--status-pending)]', label: 'HOST MODE', detail: 'No sandbox query was provided. The dashboard terminal stays in host mode and keeps dashboard-session diagnostics for reconnect behavior.' } diff --git a/app/page.tsx b/app/page.tsx index 613809b..b7ac735 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -341,6 +341,7 @@ export default function Dashboard() { onSandboxSelect={handleSandboxSelect} isDestroyMode={isDestroyMode} onInventoryRefresh={refresh} + dashboardSessionId={dashboardSession.dashboardSessionId} /> )}
@@ -429,6 +430,7 @@ export default function Dashboard() { onSandboxSelect={handleSandboxSelect} isDestroyMode={isDestroyMode} onInventoryRefresh={refresh} + dashboardSessionId={dashboardSession.dashboardSessionId} /> )} diff --git a/install.sh b/install.sh index fed8307..a12a9fc 100755 --- a/install.sh +++ b/install.sh @@ -403,6 +403,7 @@ NEXT_PUBLIC_API_BASE=/api NEXT_PUBLIC_ENABLE_SANDBOX_OPERATIONS=true OPEN_SHELL_CONTAINER=${OPEN_SHELL_CONTAINER_DEFAULT} OPENSHELL_GATEWAY=nemoclaw +OPENSHELL_CONTROL_CREATE_GPU_MODE=none # For containerized CLI runs, when supported by the installed OpenShell/NemoClaw versions: # OPENSHELL_GATEWAY_HOST=host.docker.internal # OPENSHELL_GATEWAY_PORT=8080 @@ -422,6 +423,7 @@ upsert_env "NEXT_PUBLIC_API_BASE" "/api" upsert_env "NEXT_PUBLIC_ENABLE_SANDBOX_OPERATIONS" "true" upsert_env "OPEN_SHELL_CONTAINER" "$OPEN_SHELL_CONTAINER_DEFAULT" upsert_env "OPENSHELL_GATEWAY" "nemoclaw" +upsert_env "OPENSHELL_CONTROL_CREATE_GPU_MODE" "none" set_env "OPENSHELL_GATEWAY_HOST" "${OPENSHELL_GATEWAY_HOST:-}" set_env "OPENSHELL_GATEWAY_PORT" "${OPENSHELL_GATEWAY_PORT:-}" set_env "OPENSHELL_GATEWAY_URL" "${OPENSHELL_GATEWAY_URL:-}" diff --git a/public/sandbox-logos/hermes.png b/public/sandbox-logos/hermes.png new file mode 100644 index 0000000000000000000000000000000000000000..2d629d2f2452f00a7bc5a3252c1c1829c0b476bd GIT binary patch literal 4100 zcmV+f5c}_mP){X5y4f#U|SWXSdQz;Y7iAvkSIm5gc6mu zg2#wQKp<;D1O!4+2%z*90!UHP_kNfB!_1@*(K++}|NZyXd*AIZEIvLy?VWet$xlg1 z$^ARZlqpkkr%judJAL}}+|<-mE7XC}_IIqo9B;q zii(QlT#6L`PMyk;tb#x5`Mn;A#TC`A<(lUJbaM4AiPoF;0y?b}L<(6BdYu7F^ zc<>NOOZ!~1vkw=~Am_Bcx92ebEETLc=cJ&ZKz{!DXWQtDBSy%m(WB(U4?mRc+qcV& zH{K{?$BdQFKmS}(Ql{8p|Ja|x6tXLrvCXAQ9eeY1Dy2*R*y(dSH9u?(^K2 z%=xbj8Z<~MRjTA){nV*bvV8e+gL6vE>D;*?Q6U7Jb4J0JUw&D7C_7A?I8k=*-ff%o z?@B9ddfT>bGIHcd-F!c#_)4i;w~mY+J=&0th=|Z$Xa0G4d3I9$`t_3q3l^NyNmK}d zWy_Y?hLVz!WcQvuXLe9d?VE4Dk;KG%<=bz+6%}TA?z!h|j?f|D;o$<(!-fr0gjf7& zB+5mgprBA@%$Okq`uCUg^mHjKEEE=WuJq%sT)DD9Wj5Tnabw%~*s)_JGjog7s8Pe% zEG8z#kArj0`Zs9MK=M>hmM&c?hYlV3Q%IDF0Gmxsoi0gA^}YM{NmzK8RH;%$>eQ(t zKA+DP4hswOZ-$DhOS$HnYvkgKFBart)~wm0YFZ{voFF+lxze<0Q+fRH$8Bs>RFn|| z*#LouA9+MtwQ6N2mXnjibQLPWJ18FFoRcL>mdGcce4@hVGwRi-UR|!f`f7p7)v8sK zh7F^IO@IuW;AEiuqmMqSs&cS&>())GRjVpL{q&P*nqPj|X0s^rx0ed20WZYV6#+DXG`bKouzrR=5qe|=SxgXOX=0C zm(;6YU+Qa7qa8DNj1`Zr39XfQ7IkRW0E}vlP5*BLH=3061!3X87x89P(d+#;MRnrqf z$4{6r!L-+`S+iush$K01V889;(n~Kj=LGe*c<~b1uwlI(WrngrHD#MfS+{PT$piZSrI%ikS6+EVo_+RNY1giu zJoC&ml9-q%k0>8wfm5eXmlG#WDBtJE$&)8d_&0CfY;%bInlx!@^6=SbpP5l~&iPrb zP>tlyojYae(k0sS?EfGH=>Glp-^<*&pUBfnc?1sr9I1xsqmMqaBgRcYKEC_zJHa5K zH8yP6V8W*kn_Ax#nW+>%cI+6_+2*Ox_v^2}*3+A)i2q9>BO?LJ(W6J@!V52ytp28Pd`$#_cEJS~Q1utoI`+d42&t4nfOaNz z&Iyy@$76ihI8jreEvTe%Zj&ZW)bVR;1uvDc%t1jgQIXUuQaAzT$7T2WgCrh-_Z|8! z6@kD`+1ZCIvWkm~H&+-6o@p;KYO`stoM{tt49i2nxnQ7aTVBQ-9^3~EJ#2yR+aVppyPK-XloO8k{ zfz%H_ESJ)L5$kfuawI!yUapD=gLN4*REaWHZzuTrH&(SNXDkK~ zVJ5cTB9*|&wA+tDxx;EYJa>?0)9T6 zb2gE4XWk-Cyx$%TcDy>83rdo~W+NV)w{uRD29-_dJp}S~(|-BV;D+QFd)%lwrehjA z)6conYlV4}q^B>{$mj^4{z9-$XAgij7&Yn@%~)(Sl}aEEuj6nnTlRgipTy~i<(0f~ zIAbF<;k$qTezWc#oHqnx!}Res?S0dZO@ILO+o`8|NbM4N*L+nlv>O72g+&%hu3Wj& z!b#_x@h|xq>!c|}=T2jcHt62Ho4M3+8r4uH3yXhDl3GOB>#W}7eYZ0 zCb*Ao7%i!(AF5#ADtbq(F>;%;o?P&3r@v6)9>MUFxO-r4WIbSOWG9TS@S)EaAx}K< zq$2RX<>@mu0YwKcEePs~w$|zeAN@-!$O!s6I=Z2Sid(j1Y7D)|E(0e`dfS3{pI(gM zg0$3&42&A5Ri{o}X{t)1O`A4?M!VsL8-mi6-dY&5E$U371>q7-mVFxnbmAi-B3yI* z@iJ%596Nz~?zzV(2tR{46se;bw9*6_N)hW;uTfpD(Oa6>*jNoWYgs&v?SNva(*NlF zaU+$b7`6>7)0~5S0DW z=0|`J3Jp+->r#Y;3omR2tqQpzR2qFl3+i>E-U;CIkTRJzZJJD-I#u)rUtWFn zRg0--D{+XU-+lL8fj|g)OiT-jjcqMGHOJIVZ$WY95_v}Z0{{U3|0DMb*8l(j21!IgR09C-TiCif!tT@n0000 + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/dashboard-session-check.mjs b/tests/dashboard-session-check.mjs index f52cb60..2144ddf 100644 --- a/tests/dashboard-session-check.mjs +++ b/tests/dashboard-session-check.mjs @@ -17,6 +17,11 @@ assert.match( /searchParams\.set\('dashboardSessionId', params\.dashboardSessionId\)/, 'operator terminal route builder must thread dashboardSessionId' ) +assert.match( + helperSource, + /searchParams\.set\('launch', params\.launch\)/, + 'operator terminal route builder must thread explicit launch modes' +) const routeSource = await readFile(routePath, 'utf8') assert.match(routeSource, /dashboardSessionId/, 'terminal live route must accept dashboardSessionId') @@ -43,10 +48,11 @@ assert.match( 'terminal server responses must expose dashboardSessionId metadata' ) -const buildOperatorTerminalRoute = ({ sandboxId, dashboardSessionId }) => { +const buildOperatorTerminalRoute = ({ sandboxId, dashboardSessionId, launch }) => { const searchParams = new URLSearchParams() if (sandboxId) searchParams.set('sandboxId', sandboxId) searchParams.set('dashboardSessionId', dashboardSessionId) + if (launch) searchParams.set('launch', launch) const query = searchParams.toString() return query ? `/operator-terminal?${query}` : '/operator-terminal' } @@ -59,5 +65,9 @@ assert.equal( buildOperatorTerminalRoute({ sandboxId: null, dashboardSessionId: 'dash-123' }), '/operator-terminal?dashboardSessionId=dash-123' ) +assert.equal( + buildOperatorTerminalRoute({ sandboxId: 'my-hermes', dashboardSessionId: 'dash-123', launch: 'hermes' }), + '/operator-terminal?sandboxId=my-hermes&dashboardSessionId=dash-123&launch=hermes' +) console.log('dashboard-session-check: PASS route/session scope assertions') diff --git a/tests/portable-install-check.mjs b/tests/portable-install-check.mjs index 9175746..fe70a31 100644 --- a/tests/portable-install-check.mjs +++ b/tests/portable-install-check.mjs @@ -44,6 +44,7 @@ assert.match(installSource, /set_env "NEMOCLAW_SETUP"/, 'installer must persist assert.match(installSource, /set_env "NEMOCLAW_BIN"/, 'installer must persist discovered NemoClaw CLI path') assert.match(installSource, /set_env "OPENSHELL_HOME"/, 'installer must persist the OpenShell config home') assert.match(installSource, /set_env "OPENSHELL_BIN"/, 'installer must persist discovered OpenShell path') +assert.match(installSource, /upsert_env "OPENSHELL_CONTROL_CREATE_GPU_MODE" "none"/, 'installer must default dashboard-created sandboxes to no GPU passthrough') assert.match(installSource, /upsert_env "TERMINAL_SERVER_AUTOSTART" "true"/, 'installer must enable terminal bridge autostart by default') assert.match(installSource, /ensure_npx\(\)/, 'installer must install or verify npx for stdio MCP servers') assert.match(installSource, /ensure_uvx\(\)/, 'installer must install or verify uvx for stdio MCP servers') @@ -87,9 +88,10 @@ assert.match(mcpBrokerUrlSource, /discoverSandboxProxyOrigin/, 'MCP broker URL g assert.match(mcpBrokerUrlSource, /HTTP_PROXY/, 'MCP broker URL generation must use the sandbox proxy environment when available') assert.match(mcpBrokerClientSource, /PATH: HOST_PATH/, 'MCP stdio broker launches must inherit the shared host PATH') -assert.match(createRouteSource, /buildNemoClawCreateCommand\(\)/, 'NemoClaw blueprint create must resolve a current CLI command') +assert.match(createRouteSource, /buildNemoClawCreateCommand\(gpuMode, agent\)/, 'NemoClaw blueprint create must resolve a current CLI command with the selected GPU mode and agent') assert.match(createRouteSource, /"onboard",[\s\S]*"--non-interactive"/, 'NemoClaw blueprint create must use the supported onboard CLI flow') assert.match(createRouteSource, /NEMOCLAW_SANDBOX_NAME: sandboxName/, 'NemoClaw blueprint create must pass the requested sandbox name to onboard') +assert.match(createRouteSource, /NEMOCLAW_AGENT: agent/, 'NemoClaw blueprint create must pass the requested agent to onboard') assert.match(createRouteSource, /NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1"/, 'NemoClaw blueprint create must be able to run onboard non-interactively') assert.match(createRouteSource, /mode: "legacy-setup"/, 'NemoClaw blueprint create may fall back to legacy setup.sh for old clones') assert.match(createRouteSource, /NemoClaw CLI was not found/, 'missing current CLI must produce an actionable error') diff --git a/tests/post-authority-terminal-contract-check.mjs b/tests/post-authority-terminal-contract-check.mjs index 0f32973..55a1dc8 100644 --- a/tests/post-authority-terminal-contract-check.mjs +++ b/tests/post-authority-terminal-contract-check.mjs @@ -62,6 +62,41 @@ assert.match( /: 'Live operator terminal for host mode, brokered through the dashboard-owned terminal bridge\.'/, 'operator terminal page must distinguish host mode from sandbox mode' ) +assert.match( + pageSource, + /const launchMode = searchParams\.get\('launch'\)/, + 'operator terminal page must read explicit launch modes from the URL' +) +assert.match( + pageSource, + /buildHermesTerminalConnectCommand/, + 'operator terminal page must define the Hermes connect bootstrap command' +) +assert.match( + pageSource, + /nemohermes \$\{target\} connect/, + 'Hermes terminal launch must prefer the NemoHermes connect workflow' +) +assert.match( + pageSource, + /elif command -v nemoclaw[\s\S]*nemoclaw \$\{target\} connect/, + 'Hermes terminal launch must fall back to the NemoClaw connect workflow before raw ssh' +) +assert.match( + pageSource, + /HERMES_AGENT_COMMAND/, + 'Hermes terminal launch must run the Hermes CLI after attaching' +) +assert.match( + pageSource, + /isHermesAttachReadyOutput/, + 'Hermes terminal launch must wait for the sandbox prompt before running Hermes' +) +assert.match( + pageSource, + /data: `\\n\\n\$\{HERMES_AGENT_COMMAND\}\\n`/, + 'Hermes terminal launch must nudge the attached shell before running Hermes' +) assert.doesNotMatch( pageSource, /Live operator terminal for the host machine\. The selected sandbox is preserved as context for helper commands and status lookups, but this shell is intentionally machine-scoped\./, diff --git a/tests/sandbox-lifecycle-check.mjs b/tests/sandbox-lifecycle-check.mjs index 79c9eaf..86efc60 100644 --- a/tests/sandbox-lifecycle-check.mjs +++ b/tests/sandbox-lifecycle-check.mjs @@ -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, /