Integrate Docker NemoClaw and Hermes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<string, { name?: string; agent?: string | null }>
|
||||
}
|
||||
|
||||
type SandboxItem = {
|
||||
metadata: {
|
||||
name: string
|
||||
@@ -145,6 +153,24 @@ function buildNemoClawSummary(output: string | null, defaultSandboxNames: Set<st
|
||||
}
|
||||
}
|
||||
|
||||
function readNemoClawRegistry(): NemoClawRegistryData {
|
||||
try {
|
||||
return existsSync(NEMOCLAW_REGISTRY_FILE)
|
||||
? JSON.parse(readFileSync(NEMOCLAW_REGISTRY_FILE, "utf8"))
|
||||
: {}
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function resolveSandboxAgent(name: string, id: string | null, registry: NemoClawRegistryData) {
|
||||
const entries = registry.sandboxes ?? {}
|
||||
const directEntry = entries[name] || (id ? entries[id] : undefined)
|
||||
const namedEntry = Object.values(entries).find((entry) => 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<string>): Promise<{ summary: SandboxSummary; pod: SandboxItem }> {
|
||||
async function readSandbox(name: string, defaultSandboxNames: Set<string>, 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<string>): 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<string>): Prom
|
||||
hasSshConfig: Boolean(sshConfig),
|
||||
source: "openshell",
|
||||
isDefault,
|
||||
agent,
|
||||
},
|
||||
pod: {
|
||||
metadata: {
|
||||
@@ -223,6 +251,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set<string>): 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<string>): 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<string>): Prom
|
||||
hasSshConfig: false,
|
||||
source: "openshell",
|
||||
isDefault,
|
||||
agent,
|
||||
},
|
||||
pod: {
|
||||
metadata: {
|
||||
@@ -264,6 +295,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set<string>): 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)
|
||||
|
||||
@@ -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<string>('redeploy-image')
|
||||
const [sandboxName, setSandboxName] = useState<string>('')
|
||||
const [enableTailscale, setEnableTailscale] = useState<boolean>(false)
|
||||
const [createGpuMode, setCreateGpuMode] = useState<CreateGpuMode>("none")
|
||||
const [createInferenceMode, setCreateInferenceMode] = useState<CreateInferenceMode>("vllm")
|
||||
const [createInferenceModel, setCreateInferenceModel] = useState<string>("")
|
||||
const [createNvidiaApiKey, setCreateNvidiaApiKey] = useState<string>("")
|
||||
@@ -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
|
||||
</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' : 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)]" />
|
||||
<input value={sandboxName} onChange={(e) => 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)]" />
|
||||
</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)]">GPU Passthrough</h6>
|
||||
<p className="mt-1 text-xs text-[var(--foreground-dim)]">Choose whether new sandboxes should request NVIDIA GPU devices.</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)] ${createGpuMode === 'none' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="radio" name="create-gpu-mode" checked={createGpuMode === 'none'} onChange={() => setCreateGpuMode('none')} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-mono uppercase tracking-wider">No GPU</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Passes --no-gpu to NemoClaw and avoids CDI setup.</span></span>
|
||||
</label>
|
||||
<label className={`flex items-start gap-3 rounded-sm border p-3 text-sm text-[var(--foreground)] ${createGpuMode === 'auto' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="radio" name="create-gpu-mode" checked={createGpuMode === 'auto'} onChange={() => setCreateGpuMode('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/OpenShell infer GPU intent.</span></span>
|
||||
</label>
|
||||
<label className={`flex items-start gap-3 rounded-sm border p-3 text-sm text-[var(--foreground)] ${createGpuMode === 'required' ? 'border-[var(--nvidia-green)] bg-[rgba(118,185,0,0.08)]' : 'border-[var(--border-subtle)] bg-[var(--background-tertiary)]'}`}>
|
||||
<input type="radio" name="create-gpu-mode" checked={createGpuMode === 'required'} onChange={() => setCreateGpuMode('required')} className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]" />
|
||||
<span><span className="block text-xs font-mono uppercase tracking-wider">Require GPU</span><span className="mt-1 block text-[11px] text-[var(--foreground-dim)]">Requires NVIDIA CDI devices or gateway GPU support.</span></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{selectedBlueprint === 'redeploy-image' && (
|
||||
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4">
|
||||
@@ -229,7 +252,7 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
|
||||
</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>}
|
||||
{selectedBlueprint === 'nemoclaw-blueprint' && <div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4">
|
||||
{isNemoClawOnboardBlueprint && <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>
|
||||
|
||||
+209
-51
@@ -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<SandboxInventoryItem[]>
|
||||
dashboardSessionId: string
|
||||
}
|
||||
|
||||
type DrawerKey = 'operations' | 'files' | 'inference' | 'policy' | 'archive' | 'mcp'
|
||||
@@ -55,6 +57,13 @@ type PermissionFeed = {
|
||||
rejectedCount?: number
|
||||
}
|
||||
|
||||
type DismissedPermissionAlerts = Record<string, string[]>
|
||||
|
||||
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 (
|
||||
<span
|
||||
aria-label={label}
|
||||
title={label}
|
||||
className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border shadow-inner ${
|
||||
isHermes
|
||||
? 'border-sky-300/60 bg-sky-500/15'
|
||||
: 'border-rose-300/60 bg-rose-500/15'
|
||||
}`}
|
||||
>
|
||||
<span aria-hidden="true" className="h-6 w-6 bg-contain bg-center bg-no-repeat" style={{ backgroundImage: `url(${logoSrc})` }} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
function normalizeDismissedPermissionAlerts(value: unknown): DismissedPermissionAlerts {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return {}
|
||||
return Object.entries(value as Record<string, unknown>).reduce<DismissedPermissionAlerts>((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<string>('')
|
||||
const [restartInProgress, setRestartInProgress] = useState(false)
|
||||
const [permissionMessage, setPermissionMessage] = useState('')
|
||||
const [permissionFeeds, setPermissionFeeds] = useState<Record<string, PermissionFeed>>({})
|
||||
const [dismissedPermissionAlerts, setDismissedPermissionAlerts] = useState<DismissedPermissionAlerts>(() => loadDismissedPermissionAlerts())
|
||||
const [grantingSandboxId, setGrantingSandboxId] = useState<string | null>(null)
|
||||
const [mcpServers, setMcpServers] = useState<McpServerAccess[]>([])
|
||||
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({
|
||||
>
|
||||
<div className="mb-3 flex items-start justify-between gap-3">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<SandboxTypeLogo agent={sandbox.agent} />
|
||||
{(() => {
|
||||
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 ? (
|
||||
<span className="inline-flex h-5 w-5 items-center justify-center rounded-full bg-amber-400 text-black animate-pulse" title={`Network permission: ${feed?.pendingCount || 0} pending`}>
|
||||
<span className="inline-flex h-5 w-5 items-center justify-center rounded-full bg-amber-400 text-black animate-pulse" title={`Network permission: ${visiblePending.length} pending`}>
|
||||
<svg className="h-3.5 w-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M12 8v5m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" />
|
||||
</svg>
|
||||
@@ -441,6 +568,7 @@ export default function SandboxList({
|
||||
|
||||
<div className="space-y-1.5">
|
||||
{([
|
||||
['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({
|
||||
</div>
|
||||
</button>
|
||||
<div className="border-t border-[var(--border-subtle)] p-3">
|
||||
<select
|
||||
value=""
|
||||
disabled={grantingSandboxId === sandbox.id}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onChange={(event) => {
|
||||
const value = event.target.value
|
||||
event.currentTarget.value = ''
|
||||
resolvePermissionRequest(sandbox, 'approve', value)
|
||||
}}
|
||||
className="field-control w-full px-3 py-2 font-mono text-xs uppercase tracking-wider"
|
||||
>
|
||||
<option value="">
|
||||
{grantingSandboxId === sandbox.id
|
||||
? 'Granting...'
|
||||
: (permissionFeeds[sandbox.id]?.pendingCount || 0) > 0
|
||||
? 'Grant Permission'
|
||||
: 'No Permission Requests'}
|
||||
</option>
|
||||
{(permissionFeeds[sandbox.id]?.pending || []).map((request) => (
|
||||
<option key={request.chunkId} value={request.chunkId}>
|
||||
{(request.endpoints[0] || request.rule || request.chunkId).slice(0, 46)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{(() => {
|
||||
const feed = permissionFeeds[sandbox.id]
|
||||
const visiblePending = visiblePendingRequests(feed, sandbox, dismissedPermissionAlerts)
|
||||
return (
|
||||
<select
|
||||
value=""
|
||||
disabled={grantingSandboxId === sandbox.id}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onChange={(event) => {
|
||||
const value = event.target.value
|
||||
event.currentTarget.value = ''
|
||||
if (value === DISMISS_PERMISSION_VALUE) {
|
||||
dismissPermissionAlerts(sandbox)
|
||||
return
|
||||
}
|
||||
resolvePermissionRequest(sandbox, 'approve', value)
|
||||
}}
|
||||
className="field-control w-full px-3 py-2 font-mono text-xs uppercase tracking-wider"
|
||||
>
|
||||
<option value="">
|
||||
{grantingSandboxId === sandbox.id
|
||||
? 'Granting...'
|
||||
: visiblePending.length > 0
|
||||
? 'Grant Permission'
|
||||
: 'No Permission Requests'}
|
||||
</option>
|
||||
{visiblePending.length > 0 ? (
|
||||
<option value={DISMISS_PERMISSION_VALUE}>Do Nothing</option>
|
||||
) : null}
|
||||
{visiblePending.map((request) => (
|
||||
<option key={request.chunkId} value={request.chunkId}>
|
||||
{(request.endpoints[0] || request.rule || request.chunkId).slice(0, 46)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -493,36 +634,45 @@ export default function SandboxList({
|
||||
<>
|
||||
<DrawerSection
|
||||
title={`${selectedSandbox.name} - Operations`}
|
||||
summary="Dashboard, terminal, restart, refresh, and live telemetry."
|
||||
summary={selectedSandboxIsHermes ? "Terminal, restart, refresh, and live telemetry." : "Dashboard, terminal, restart, refresh, and live telemetry."}
|
||||
open={openDrawers.operations}
|
||||
onToggle={() => toggleDrawer('operations')}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
<div className="flex flex-wrap items-center gap-3 max-sm:[&>button]:w-full">
|
||||
<button
|
||||
onClick={async () => {
|
||||
try {
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set('sandboxId', selectedSandbox.name)
|
||||
searchParams.set('inventoryCount', String(sandboxes.length))
|
||||
const res = await fetch(`/api/openshell/dashboard/open?${searchParams.toString()}`)
|
||||
const data = await res.json()
|
||||
setDashboardMessage(renderDashboardTruthMessage(data))
|
||||
if (data.reachable && data.launchUrl) {
|
||||
openDashboardUrl(data.launchUrl, data.openInNewTab)
|
||||
} else if (data.reachable && data.proxiedUrl) {
|
||||
openDashboardUrl(data.proxiedUrl, data.openInNewTab)
|
||||
} else if (data.reachable && data.dashboardUrl && !data.loopbackOnly) {
|
||||
openDashboardUrl(data.dashboardUrl, data.openInNewTab)
|
||||
{!selectedSandboxIsHermes ? (
|
||||
<button
|
||||
onClick={async () => {
|
||||
try {
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set('sandboxId', selectedSandbox.name)
|
||||
searchParams.set('inventoryCount', String(sandboxes.length))
|
||||
const res = await fetch(`/api/openshell/dashboard/open?${searchParams.toString()}`)
|
||||
const data = await res.json()
|
||||
setDashboardMessage(renderDashboardTruthMessage(data))
|
||||
if (data.reachable && data.launchUrl) {
|
||||
openDashboardUrl(data.launchUrl, data.openInNewTab)
|
||||
} else if (data.reachable && data.proxiedUrl) {
|
||||
openDashboardUrl(data.proxiedUrl, data.openInNewTab)
|
||||
} else if (data.reachable && data.dashboardUrl && !data.loopbackOnly) {
|
||||
openDashboardUrl(data.dashboardUrl, data.openInNewTab)
|
||||
}
|
||||
} catch (error) {
|
||||
setDashboardMessage('Failed to resolve OpenClaw Dashboard endpoint.')
|
||||
}
|
||||
} catch (error) {
|
||||
setDashboardMessage('Failed to resolve OpenClaw Dashboard endpoint.')
|
||||
}
|
||||
}}
|
||||
className="action-button px-3 py-2"
|
||||
>
|
||||
Start OpenClaw Gateway Dashboard
|
||||
</button>
|
||||
}}
|
||||
className="action-button px-3 py-2"
|
||||
>
|
||||
Start OpenClaw Gateway Dashboard
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
onClick={() => connectToHermes(selectedSandbox)}
|
||||
className="action-button px-3 py-2"
|
||||
>
|
||||
Connect to Hermes
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={restartSandbox}
|
||||
disabled={restartInProgress}
|
||||
@@ -679,7 +829,7 @@ export default function SandboxList({
|
||||
<div className="space-y-4">
|
||||
{(() => {
|
||||
const feed = permissionFeeds[selectedSandbox.id]
|
||||
const pending = feed?.pending || []
|
||||
const pending = visiblePendingRequests(feed, selectedSandbox, dismissedPermissionAlerts)
|
||||
if (pending.length === 0) {
|
||||
return (
|
||||
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] p-4 text-xs text-[var(--foreground-dim)]">
|
||||
@@ -724,6 +874,14 @@ export default function SandboxList({
|
||||
>
|
||||
Reject
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={grantingSandboxId === selectedSandbox.id}
|
||||
onClick={() => dismissPermissionAlerts(selectedSandbox, request.chunkId)}
|
||||
className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono uppercase tracking-wider text-[var(--foreground-dim)] disabled:opacity-50"
|
||||
>
|
||||
Do Nothing
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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<Promise<void> | null>(null)
|
||||
const reconnectCounterRef = useRef(0)
|
||||
const resizeObserverRef = useRef<ResizeObserver | null>(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.' }
|
||||
|
||||
@@ -341,6 +341,7 @@ export default function Dashboard() {
|
||||
onSandboxSelect={handleSandboxSelect}
|
||||
isDestroyMode={isDestroyMode}
|
||||
onInventoryRefresh={refresh}
|
||||
dashboardSessionId={dashboardSession.dashboardSessionId}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@@ -429,6 +430,7 @@ export default function Dashboard() {
|
||||
onSandboxSelect={handleSandboxSelect}
|
||||
isDestroyMode={isDestroyMode}
|
||||
onInventoryRefresh={refresh}
|
||||
dashboardSessionId={dashboardSession.dashboardSessionId}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -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:-}"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,22 @@
|
||||
<svg viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="lobster-gradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stop-color="#ff4d4d"/>
|
||||
<stop offset="100%" stop-color="#991b1b"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<!-- Body -->
|
||||
<path d="M60 10 C30 10 15 35 15 55 C15 75 30 95 45 100 L45 110 L55 110 L55 100 C55 100 60 102 65 100 L65 110 L75 110 L75 100 C90 95 105 75 105 55 C105 35 90 10 60 10Z" fill="url(#lobster-gradient)"/>
|
||||
<!-- Left Claw -->
|
||||
<path d="M20 45 C5 40 0 50 5 60 C10 70 20 65 25 55 C28 48 25 45 20 45Z" fill="url(#lobster-gradient)"/>
|
||||
<!-- Right Claw -->
|
||||
<path d="M100 45 C115 40 120 50 115 60 C110 70 100 65 95 55 C92 48 95 45 100 45Z" fill="url(#lobster-gradient)"/>
|
||||
<!-- Antenna -->
|
||||
<path d="M45 15 Q35 5 30 8" stroke="#ff4d4d" stroke-width="3" stroke-linecap="round"/>
|
||||
<path d="M75 15 Q85 5 90 8" stroke="#ff4d4d" stroke-width="3" stroke-linecap="round"/>
|
||||
<!-- Eyes -->
|
||||
<circle cx="45" cy="35" r="6" fill="#050810"/>
|
||||
<circle cx="75" cy="35" r="6" fill="#050810"/>
|
||||
<circle cx="46" cy="34" r="2.5" fill="#00e5cc"/>
|
||||
<circle cx="76" cy="34" r="2.5" fill="#00e5cc"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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\./,
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user