Compare commits
10
Commits
7ec2969c7a
...
fa3d5d0a8f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa3d5d0a8f | ||
|
|
11840644c8 | ||
|
|
52fe7a2d83 | ||
|
|
f70c10d767 | ||
|
|
4e2d51e84a | ||
|
|
85c6777c55 | ||
|
|
6154088197 | ||
|
|
270eb109f1 | ||
|
|
cbbdd1b4d2 | ||
|
|
5f8e30c33e |
@@ -45,11 +45,11 @@ It is currently built for active development and lab use. It includes a simple p
|
|||||||
|
|
||||||
## Compatibility Targets
|
## Compatibility Targets
|
||||||
|
|
||||||
This dashboard is validated against the current NVIDIA NemoClaw repo and the OpenShell version range declared in NemoClaw's `nemoclaw-blueprint/blueprint.yaml`, not the older April 2026 point releases. Current NemoClaw `main` pins OpenShell exactly to `0.0.106`, so the bundled refresh helper defaults to:
|
This dashboard is validated against the current NVIDIA NemoClaw repo and the OpenShell version range declared in NemoClaw's `nemoclaw-blueprint/blueprint.yaml`, not the older April 2026 point releases. Current NemoClaw `main` pins OpenShell exactly to `0.0.116`, so the bundled refresh helper defaults to:
|
||||||
|
|
||||||
- OpenShell installer release: `v0.0.106` (`OPENSHELL_VERSION=v0.0.106`)
|
- OpenShell installer release: `v0.0.116` (`OPENSHELL_VERSION=v0.0.116`)
|
||||||
- NemoClaw source ref: `main` (`NEMOCLAW_INSTALL_REF=main`)
|
- NemoClaw source ref: `main` (`NEMOCLAW_INSTALL_REF=main`)
|
||||||
- OpenClaw base-image build target: `2026.7.1` (`OPENCLAW_VERSION=2026.7.1`) unless overridden
|
- OpenClaw base-image build target: `2026.9.2` (`OPENCLAW_VERSION=2026.9.2`) unless overridden
|
||||||
|
|
||||||
Runtime/toolchain versions used during development:
|
Runtime/toolchain versions used during development:
|
||||||
|
|
||||||
@@ -60,6 +60,8 @@ Runtime/toolchain versions used during development:
|
|||||||
- OpenShell CLI and gateway compatible with current `NVIDIA/NemoClaw` blueprint constraints
|
- OpenShell CLI and gateway compatible with current `NVIDIA/NemoClaw` blueprint constraints
|
||||||
- NemoClaw CLI compatible with the current `NVIDIA/NemoClaw` repo
|
- NemoClaw CLI compatible with the current `NVIDIA/NemoClaw` repo
|
||||||
|
|
||||||
|
Sandbox creation follows NemoClaw's OpenShell routed-name contract: names are 1-19 characters, start with a lowercase letter, contain only lowercase letters, numbers, and single internal hyphens, and end with a letter or number.
|
||||||
|
|
||||||
Use `./install_versioned_nemoclaw_openshell.sh` to install or refresh the OpenShell/NemoClaw pair. Override `OPENSHELL_VERSION`, `NEMOCLAW_INSTALL_REF`, or `OPENCLAW_VERSION` only when intentionally testing a different pair.
|
Use `./install_versioned_nemoclaw_openshell.sh` to install or refresh the OpenShell/NemoClaw pair. Override `OPENSHELL_VERSION`, `NEMOCLAW_INSTALL_REF`, or `OPENCLAW_VERSION` only when intentionally testing a different pair.
|
||||||
|
|
||||||
The app uses Next.js `15.5.15`, React `18.3.1`, TypeScript, Tailwind CSS, `ws`, `node-pty`, and the official MCP TypeScript SDK.
|
The app uses Next.js `15.5.15`, React `18.3.1`, TypeScript, Tailwind CSS, `ws`, `node-pty`, and the official MCP TypeScript SDK.
|
||||||
@@ -90,6 +92,8 @@ OpenShell must already be installed and able to reach its gateway. On this host
|
|||||||
|
|
||||||
The installer does not create an OpenShell gateway for you. Start or connect OpenShell first, then install this dashboard.
|
The installer does not create an OpenShell gateway for you. Start or connect OpenShell first, then install this dashboard.
|
||||||
|
|
||||||
|
Controller commands follow OpenShell's active gateway by default. Set `OPENSHELL_GATEWAY` only for an intentional override; leaving it unset also allows current NemoClaw to restore a port-qualified gateway such as `nemoclaw-8990` when its installer selected an alternate gateway port. Quick Deploy image discovery checks both the default NemoClaw registry and its numeric alternate-port registry roots, and fails closed if a sandbox name is registered under multiple gateways.
|
||||||
|
|
||||||
## Installer
|
## Installer
|
||||||
|
|
||||||
Install or refresh the locked OpenShell/NemoClaw pair first:
|
Install or refresh the locked OpenShell/NemoClaw pair first:
|
||||||
@@ -98,7 +102,7 @@ Install or refresh the locked OpenShell/NemoClaw pair first:
|
|||||||
./install_versioned_nemoclaw_openshell.sh
|
./install_versioned_nemoclaw_openshell.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
That helper defaults to `OPENSHELL_VERSION=v0.0.106`, `NEMOCLAW_INSTALL_REF=main`, and `OPENCLAW_VERSION=2026.7.1`.
|
That helper defaults to `OPENSHELL_VERSION=v0.0.116`, `NEMOCLAW_INSTALL_REF=main`, and `OPENCLAW_VERSION=2026.9.2`.
|
||||||
|
|
||||||
Then install the dashboard from the repository root:
|
Then install the dashboard from the repository root:
|
||||||
|
|
||||||
@@ -221,7 +225,11 @@ The dashboard shells out to the OpenShell CLI for several operations:
|
|||||||
- `openshell provider create/update/delete/list`
|
- `openshell provider create/update/delete/list`
|
||||||
- `openshell inference set/get/update`
|
- `openshell inference set/get/update`
|
||||||
|
|
||||||
The **Quick Deploy New NemoClaw Sandbox** path clones a registered image through OpenShell, but it deliberately does not write the clone into NemoClaw's private `sandboxes.json`. Current NemoClaw entries include lifecycle identity, policy-authority, and workload receipts that must be issued by NemoClaw itself. The clone remains visible and operable through OpenShell Control; use **Fresh NemoClaw Image** when the new sandbox must participate in NemoClaw-managed lifecycle operations.
|
The **Quick Deploy New NemoClaw Sandbox** path clones a registered image through OpenShell, but it deliberately does not write the clone into NemoClaw's private `sandboxes.json`. Current NemoClaw entries include lifecycle identity, workload provenance, and agent-specific state that must be issued by NemoClaw itself. The clone remains visible and operable through OpenShell Control; use **Fresh NemoClaw Image** when the new sandbox must participate in NemoClaw-managed lifecycle operations.
|
||||||
|
|
||||||
|
Sandbox gateway restarts use NemoClaw's native-agent lifecycle command. The controller does not kill or launch OpenClaw or Hermes gateway processes directly; if NemoClaw cannot verify the restart, the request fails without bypassing the agent-owned lifecycle boundary.
|
||||||
|
|
||||||
|
OpenClaw owns `openclaw.json` after first launch. Controller-managed MCP and inference updates use OpenClaw's native `config patch --stdin` boundary and do not replace the file or recreate NemoClaw's retired `.config-hash` ownership metadata.
|
||||||
|
|
||||||
OpenClaw dashboard access is loopback-only inside the host/sandbox context, so the UI uses local proxy routes:
|
OpenClaw dashboard access is loopback-only inside the host/sandbox context, so the UI uses local proxy routes:
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ async function runOpenShell(args: string[], extraEnv: Record<string, string> = {
|
|||||||
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, args, {
|
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, args, {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
...extraEnv,
|
...extraEnv,
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
maxBuffer: 20 * 1024 * 1024,
|
maxBuffer: 20 * 1024 * 1024,
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { execFile } from "node:child_process"
|
import { restartSandboxGatewayWithNemoClaw } from "@/app/lib/nemoclawCli"
|
||||||
import { promisify } from "node:util"
|
|
||||||
import { OPENSHELL_BIN, hostCommandEnv } from "@/app/lib/hostCommands"
|
|
||||||
import { recoverSandboxWithNemoClaw } from "@/app/lib/nemoclawCli"
|
|
||||||
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
|
||||||
const SANDBOX_DASHBOARD_REMOTE_PORT = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_REMOTE_PORT || "18789", 10)
|
|
||||||
|
|
||||||
function sleep(ms: number) {
|
function sleep(ms: number) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
}
|
}
|
||||||
@@ -18,20 +12,6 @@ function validateSandboxName(value: string) {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runOpenShell(args: string[], timeout = 30000) {
|
|
||||||
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, args, {
|
|
||||||
env: hostCommandEnv({
|
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
|
||||||
}),
|
|
||||||
timeout,
|
|
||||||
maxBuffer: 4 * 1024 * 1024,
|
|
||||||
})
|
|
||||||
return { stdout: String(stdout).trim(), stderr: String(stderr).trim() }
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runSandboxShell(sandboxName: string, script: string, timeout = 30000) {
|
|
||||||
return runOpenShell(["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], timeout)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitForSandboxReady(sandboxName: string, timeoutMs: number, intervalMs: number) {
|
async function waitForSandboxReady(sandboxName: string, timeoutMs: number, intervalMs: number) {
|
||||||
const startedAt = Date.now()
|
const startedAt = Date.now()
|
||||||
@@ -55,29 +35,6 @@ async function waitForSandboxReady(sandboxName: string, timeoutMs: number, inter
|
|||||||
return { ready: false, attempts, elapsedMs: Date.now() - startedAt, lastError }
|
return { ready: false, attempts, elapsedMs: Date.now() - startedAt, lastError }
|
||||||
}
|
}
|
||||||
|
|
||||||
function restartOpenClawGatewayScript() {
|
|
||||||
return [
|
|
||||||
`port=${SANDBOX_DASHBOARD_REMOTE_PORT}`,
|
|
||||||
"for p in /proc/[0-9]*; do",
|
|
||||||
" cmd=$(tr '\\0' ' ' < \"$p/cmdline\" 2>/dev/null || true)",
|
|
||||||
" case \"$cmd\" in",
|
|
||||||
" *'openclaw gateway run'*) kill \"${p##*/}\" 2>/dev/null || true ;;",
|
|
||||||
" esac",
|
|
||||||
"done",
|
|
||||||
"sleep 1",
|
|
||||||
"if command -v openclaw >/dev/null 2>&1; then openclaw_bin=$(command -v openclaw);",
|
|
||||||
"elif [ -x /usr/local/bin/openclaw ]; then openclaw_bin=/usr/local/bin/openclaw;",
|
|
||||||
"else echo 'openclaw command not found in sandbox' >&2; exit 127; fi",
|
|
||||||
"nohup \"$openclaw_bin\" gateway run --allow-unconfigured --bind loopback --port \"$port\" >/tmp/gateway.log 2>&1 &",
|
|
||||||
"for i in 1 2 3 4 5 6 7 8 9 10; do",
|
|
||||||
" curl -fsS --max-time 2 \"http://127.0.0.1:$port/\" >/dev/null 2>&1 && exit 0",
|
|
||||||
" sleep 1",
|
|
||||||
"done",
|
|
||||||
"echo 'OpenClaw gateway did not answer after restart. Last log lines:' >&2",
|
|
||||||
"tail -40 /tmp/gateway.log >&2 2>/dev/null || true",
|
|
||||||
"exit 1",
|
|
||||||
].join("\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
_request: Request,
|
_request: Request,
|
||||||
@@ -101,37 +58,34 @@ export async function POST(
|
|||||||
}, { status: 409 })
|
}, { status: 409 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const nemoclawRecover = await recoverSandboxWithNemoClaw(sandboxName)
|
const nemoclawRestart = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||||
if (nemoclawRecover.attempted && nemoclawRecover.ok) {
|
if (nemoclawRestart.attempted && nemoclawRestart.ok) {
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
ok: true,
|
ok: true,
|
||||||
restarted: true,
|
restarted: true,
|
||||||
restartMode: "nemoclaw-recover",
|
restartMode: "nemoclaw-native-gateway",
|
||||||
sandboxId: resolved.id,
|
sandboxId: resolved.id,
|
||||||
sandboxName,
|
sandboxName,
|
||||||
readiness,
|
readiness,
|
||||||
nemoclawRecover,
|
nemoclawRestart,
|
||||||
elapsedMs: Date.now() - startedAt,
|
elapsedMs: Date.now() - startedAt,
|
||||||
note: "NemoClaw recover completed. The sandbox runtime and dashboard forward were checked without deleting the sandbox.",
|
note: "NemoClaw asked the sandbox's native agent to restart its gateway, then verified gateway health and host forwards.",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const runtime = await runSandboxShell(sandboxName, restartOpenClawGatewayScript(), 45000)
|
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
ok: true,
|
ok: false,
|
||||||
restarted: true,
|
restarted: false,
|
||||||
restartMode: "openclaw-runtime",
|
restartMode: "nemoclaw-native-gateway",
|
||||||
sandboxId: resolved.id,
|
sandboxId: resolved.id,
|
||||||
sandboxName,
|
sandboxName,
|
||||||
readiness,
|
readiness,
|
||||||
nemoclawRecover,
|
nemoclawRestart,
|
||||||
runtime,
|
|
||||||
elapsedMs: Date.now() - startedAt,
|
elapsedMs: Date.now() - startedAt,
|
||||||
note: nemoclawRecover.attempted
|
note: nemoclawRestart.attempted
|
||||||
? "NemoClaw recover did not complete, so the dashboard fell back to restarting the in-sandbox OpenClaw runtime. The sandbox pod was not deleted."
|
? "NemoClaw could not complete the native gateway restart. The controller did not bypass the agent-owned lifecycle boundary."
|
||||||
: "OpenClaw runtime restarted inside the sandbox. The sandbox pod was not deleted.",
|
: "The installed NemoClaw CLI does not support the native gateway restart command. Upgrade NemoClaw before retrying.",
|
||||||
})
|
}, { status: nemoclawRestart.attempted ? 502 : 409 })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = error instanceof Error ? error.message : "Failed to restart sandbox runtime"
|
const message = error instanceof Error ? error.message : "Failed to restart sandbox runtime"
|
||||||
return NextResponse.json({ ok: false, restarted: false, error: message }, { status: /required|invalid/.test(message) ? 400 : 500 })
|
return NextResponse.json({ ok: false, restarted: false, error: message }, { status: /required|invalid/.test(message) ? 400 : 500 })
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
import { NextResponse } from "next/server"
|
import { NextResponse } from "next/server"
|
||||||
import { execFile, spawn } from "node:child_process"
|
import { execFile, spawn } from "node:child_process"
|
||||||
import { existsSync, readFileSync } from "node:fs"
|
import { existsSync } from "node:fs"
|
||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import { promisify } from "node:util"
|
import { promisify } from "node:util"
|
||||||
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
|
||||||
import { recordActivity } from "@/app/lib/activityLog"
|
import { recordActivity } from "@/app/lib/activityLog"
|
||||||
import { repairOpenClawExecApprovalsFile } from "@/app/lib/sandboxPrivilegedFiles"
|
import {
|
||||||
|
findNemoClawRegistryEntry,
|
||||||
|
listNemoClawRegistryCandidates,
|
||||||
|
} from "@/app/lib/nemoclawRegistry.mjs"
|
||||||
import {
|
import {
|
||||||
commandExists,
|
commandExists,
|
||||||
HOST_PATH,
|
HOST_PATH,
|
||||||
@@ -20,13 +23,13 @@ import {
|
|||||||
} from "@/app/lib/hostCommands"
|
} from "@/app/lib/hostCommands"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
const execFileAsync = promisify(execFile)
|
||||||
const NEMOCLAW_REGISTRY_FILE = path.join(process.env.HOME || "/tmp", ".nemoclaw", "sandboxes.json")
|
const NEMOCLAW_STATE_ROOT = path.join(process.env.HOME || "/tmp", ".nemoclaw")
|
||||||
|
|
||||||
function validateSandboxName(name: string) {
|
function validateSandboxName(name: string) {
|
||||||
if (!name || typeof name !== "string") throw new Error("sandbox name is required")
|
if (!name || typeof name !== "string") throw new Error("sandbox name is required")
|
||||||
if (name.length > 63) throw new Error("sandbox name too long (max 63 chars)")
|
if (name.length > 19) throw new Error("sandbox name too long (max 19 chars)")
|
||||||
if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(name)) {
|
if (!/^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/.test(name)) {
|
||||||
throw new Error("sandbox name must be lowercase alphanumeric with optional internal hyphens")
|
throw new Error("sandbox name must start with a lowercase letter and contain only lowercase letters, numbers, and single internal hyphens")
|
||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
@@ -84,10 +87,6 @@ type CreateInferenceSettings = {
|
|||||||
envSummary: string[]
|
envSummary: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type NemoClawRegistryData = {
|
|
||||||
sandboxes?: Record<string, { name?: string; createdAt?: string; imageTag?: string }>
|
|
||||||
defaultSandbox?: string | null
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseCreateGpuMode(body: any): CreateGpuMode {
|
function parseCreateGpuMode(body: any): CreateGpuMode {
|
||||||
const raw = typeof body?.gpuMode === "string"
|
const raw = typeof body?.gpuMode === "string"
|
||||||
@@ -270,21 +269,11 @@ function parseOpenShellSandboxNames(output: string) {
|
|||||||
.filter((entry): entry is string => Boolean(entry))
|
.filter((entry): entry is string => Boolean(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
function readNemoClawRegistry(): NemoClawRegistryData {
|
|
||||||
try {
|
|
||||||
return existsSync(NEMOCLAW_REGISTRY_FILE)
|
|
||||||
? JSON.parse(readFileSync(NEMOCLAW_REGISTRY_FILE, "utf8"))
|
|
||||||
: {}
|
|
||||||
} catch {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function listOpenShellSandboxNames() {
|
async function listOpenShellSandboxNames() {
|
||||||
try {
|
try {
|
||||||
const { stdout } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "list"], {
|
const { stdout } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "list"], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 1024 * 1024,
|
||||||
@@ -299,7 +288,7 @@ async function resolveSourcePodImageFromRef(sourceSandboxRef: string) {
|
|||||||
const requested = sourceSandboxRef.trim()
|
const requested = sourceSandboxRef.trim()
|
||||||
const source = await resolveSandboxRef(requested)
|
const source = await resolveSandboxRef(requested)
|
||||||
const sourceName = validateSandboxName(source.name)
|
const sourceName = validateSandboxName(source.name)
|
||||||
const registryEntry = readNemoClawRegistry().sandboxes?.[sourceName]
|
const registryEntry = findNemoClawRegistryEntry(sourceName)?.entry
|
||||||
const sourceImage = registryEntry?.imageTag?.trim() || null
|
const sourceImage = registryEntry?.imageTag?.trim() || null
|
||||||
|
|
||||||
if (!sourceImage) {
|
if (!sourceImage) {
|
||||||
@@ -319,15 +308,10 @@ async function resolveSourcePodImage(sourceSandboxRef: string | null | undefined
|
|||||||
return await resolveSourcePodImageFromRef(sourceSandboxRef)
|
return await resolveSourcePodImageFromRef(sourceSandboxRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
const registry = readNemoClawRegistry()
|
const registeredNames = listNemoClawRegistryCandidates()
|
||||||
const registeredEntries = Object.entries(registry.sandboxes ?? {})
|
|
||||||
const newestRegisteredNames = registeredEntries
|
|
||||||
.sort(([, a], [, b]) => String(b?.createdAt ?? "").localeCompare(String(a?.createdAt ?? "")))
|
|
||||||
.map(([key, value]) => value?.name || key)
|
|
||||||
const liveNames = await listOpenShellSandboxNames()
|
const liveNames = await listOpenShellSandboxNames()
|
||||||
const candidates = Array.from(new Set([
|
const candidates = Array.from(new Set([
|
||||||
registry.defaultSandbox || undefined,
|
...registeredNames,
|
||||||
...newestRegisteredNames,
|
|
||||||
...liveNames,
|
...liveNames,
|
||||||
].filter((candidate): candidate is string => Boolean(candidate && candidate !== targetSandboxName))))
|
].filter((candidate): candidate is string => Boolean(candidate && candidate !== targetSandboxName))))
|
||||||
|
|
||||||
@@ -346,8 +330,8 @@ function skippedNemoClawImageRedeployRegistration() {
|
|||||||
return {
|
return {
|
||||||
registered: false as const,
|
registered: false as const,
|
||||||
skipped: true as const,
|
skipped: true as const,
|
||||||
registryFile: NEMOCLAW_REGISTRY_FILE,
|
registryFile: NEMOCLAW_STATE_ROOT,
|
||||||
note: "The quick-deployed sandbox remains an OpenShell-managed clone and was not written into NemoClaw's private registry. Current NemoClaw registry entries carry lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely.",
|
note: "The quick-deployed sandbox remains an OpenShell-managed clone and was not written into NemoClaw's private registry. Current NemoClaw registry entries carry lifecycle identity, workload provenance, and agent-specific state that only NemoClaw can issue safely.",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,7 +632,7 @@ async function approveOpenClawDeviceRequests(sandboxName: string) {
|
|||||||
"-lc",
|
"-lc",
|
||||||
"openclaw devices approve --latest --json --timeout 10000",
|
"openclaw devices approve --latest --json --timeout 10000",
|
||||||
], hostCommandEnv({
|
], hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}), 15000)
|
}), 15000)
|
||||||
|
|
||||||
const combinedOutput = `${result.stdout}\n${result.stderr}`.trim()
|
const combinedOutput = `${result.stdout}\n${result.stderr}`.trim()
|
||||||
@@ -783,7 +767,7 @@ export async function POST(request: Request) {
|
|||||||
NEMOCLAW_NON_INTERACTIVE: "1",
|
NEMOCLAW_NON_INTERACTIVE: "1",
|
||||||
NEMOCLAW_RECREATE_SANDBOX: "1",
|
NEMOCLAW_RECREATE_SANDBOX: "1",
|
||||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1",
|
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1",
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!enableTailscale) {
|
if (!enableTailscale) {
|
||||||
@@ -829,11 +813,6 @@ export async function POST(request: Request) {
|
|||||||
error: "Sandbox readiness polling produced no verification result.",
|
error: "Sandbox readiness polling produced no verification result.",
|
||||||
}
|
}
|
||||||
const created = readiness.verified
|
const created = readiness.verified
|
||||||
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 && isOpenClawAgent ? await approveOpenClawDeviceRequests(sandboxName) : null
|
const deviceApproval = created && isOpenClawAgent ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||||
console.log(
|
console.log(
|
||||||
`[sandbox/create] request:complete sandbox=${sandboxName} created=${created} agent=${agent} 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)}`,
|
||||||
@@ -867,7 +846,6 @@ export async function POST(request: Request) {
|
|||||||
attempts: readiness.attempts,
|
attempts: readiness.attempts,
|
||||||
elapsedMs: readiness.elapsedMs,
|
elapsedMs: readiness.elapsedMs,
|
||||||
},
|
},
|
||||||
execApprovalsRepair,
|
|
||||||
deviceApproval,
|
deviceApproval,
|
||||||
stdout: result.stdout,
|
stdout: result.stdout,
|
||||||
stderr: result.stderr,
|
stderr: result.stderr,
|
||||||
@@ -883,8 +861,6 @@ export async function POST(request: Request) {
|
|||||||
: gpuMode === "required"
|
: gpuMode === "required"
|
||||||
? "GPU passthrough was required for this create run."
|
? "GPU passthrough was required for this create run."
|
||||||
: "NemoClaw chose GPU passthrough automatically 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,
|
deviceApproval?.note,
|
||||||
)
|
)
|
||||||
: "Blueprint command reported success, but the sandbox never reached a ready verification state afterward.",
|
: "Blueprint command reported success, but the sandbox never reached a ready verification state afterward.",
|
||||||
@@ -893,7 +869,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
if (blueprint === "custom-sandbox") {
|
if (blueprint === "custom-sandbox") {
|
||||||
const env: NodeJS.ProcessEnv = hostCommandEnv({
|
const env: NodeJS.ProcessEnv = hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
NO_COLOR: "1",
|
NO_COLOR: "1",
|
||||||
CLICOLOR: "0",
|
CLICOLOR: "0",
|
||||||
CLICOLOR_FORCE: "0",
|
CLICOLOR_FORCE: "0",
|
||||||
@@ -926,11 +902,6 @@ export async function POST(request: Request) {
|
|||||||
error: "Sandbox readiness polling produced no verification result.",
|
error: "Sandbox readiness polling produced no verification result.",
|
||||||
}
|
}
|
||||||
const created = readiness.verified
|
const created = readiness.verified
|
||||||
const execApprovalsRepair = created ? 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 ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||||
const policyPrepared = Boolean(policy)
|
const policyPrepared = Boolean(policy)
|
||||||
console.log(
|
console.log(
|
||||||
@@ -968,7 +939,6 @@ export async function POST(request: Request) {
|
|||||||
attempts: readiness.attempts,
|
attempts: readiness.attempts,
|
||||||
elapsedMs: readiness.elapsedMs,
|
elapsedMs: readiness.elapsedMs,
|
||||||
},
|
},
|
||||||
execApprovalsRepair,
|
|
||||||
deviceApproval,
|
deviceApproval,
|
||||||
policyPrepared,
|
policyPrepared,
|
||||||
note: created
|
note: created
|
||||||
@@ -981,8 +951,6 @@ export async function POST(request: Request) {
|
|||||||
gpuMode === "required"
|
gpuMode === "required"
|
||||||
? "GPU passthrough was requested for this create run."
|
? "GPU passthrough was requested for this create run."
|
||||||
: false,
|
: false,
|
||||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
|
||||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
|
||||||
deviceApproval?.note,
|
deviceApproval?.note,
|
||||||
)
|
)
|
||||||
: "Create command started, but the sandbox never reached a ready verification state afterward.",
|
: "Create command started, but the sandbox never reached a ready verification state afterward.",
|
||||||
@@ -995,7 +963,7 @@ export async function POST(request: Request) {
|
|||||||
const sourceImage = source.image
|
const sourceImage = source.image
|
||||||
const basePolicyPath = resolveNemoClawBasePolicyPath()
|
const basePolicyPath = resolveNemoClawBasePolicyPath()
|
||||||
const env: NodeJS.ProcessEnv = hostCommandEnv({
|
const env: NodeJS.ProcessEnv = hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
const createAttempt = await runCreateCommandUntilReady(OPENSHELL_BIN, [
|
const createAttempt = await runCreateCommandUntilReady(OPENSHELL_BIN, [
|
||||||
@@ -1028,11 +996,6 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
const created = readiness.verified
|
const created = readiness.verified
|
||||||
const registry = created ? skippedNemoClawImageRedeployRegistration() : null
|
const registry = created ? skippedNemoClawImageRedeployRegistration() : null
|
||||||
const execApprovalsRepair = created ? 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 ? await approveOpenClawDeviceRequests(sandboxName) : null
|
||||||
console.log(
|
console.log(
|
||||||
`[sandbox/create] request:complete sandbox=${sandboxName} created=${created} mode=redeploy-image createTimedOut=${createAttempt.timedOut} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`,
|
`[sandbox/create] request:complete sandbox=${sandboxName} created=${created} mode=redeploy-image createTimedOut=${createAttempt.timedOut} readinessAttempts=${readiness.attempts} deviceApproval=${deviceApproval?.approved ?? false} elapsedMs=${elapsedMs(requestStartedAt)}`,
|
||||||
@@ -1079,7 +1042,6 @@ export async function POST(request: Request) {
|
|||||||
elapsedMs: readiness.elapsedMs,
|
elapsedMs: readiness.elapsedMs,
|
||||||
},
|
},
|
||||||
registry,
|
registry,
|
||||||
execApprovalsRepair,
|
|
||||||
deviceApproval,
|
deviceApproval,
|
||||||
note: created
|
note: created
|
||||||
? appendNote(
|
? appendNote(
|
||||||
@@ -1094,8 +1056,6 @@ export async function POST(request: Request) {
|
|||||||
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
|
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
|
||||||
: false,
|
: false,
|
||||||
registry?.note,
|
registry?.note,
|
||||||
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
|
|
||||||
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
|
|
||||||
deviceApproval?.note,
|
deviceApproval?.note,
|
||||||
)
|
)
|
||||||
: createFailed
|
: createFailed
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ async function deleteSandbox(sandboxName: string) {
|
|||||||
try {
|
try {
|
||||||
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "delete", sandboxName], {
|
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "delete", sandboxName], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
maxBuffer: 20 * 1024 * 1024,
|
maxBuffer: 20 * 1024 * 1024,
|
||||||
@@ -154,7 +154,7 @@ async function wipePersistentSandboxState(sandboxName: string, agent: string | n
|
|||||||
try {
|
try {
|
||||||
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
maxBuffer: 1024 * 1024,
|
maxBuffer: 1024 * 1024,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const dynamic = "force-dynamic"
|
|||||||
async function run(command: string, args: string[]) {
|
async function run(command: string, args: string[]) {
|
||||||
try {
|
try {
|
||||||
const env = command === OPENSHELL_BIN
|
const env = command === OPENSHELL_BIN
|
||||||
? hostCommandEnv({ OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw" })
|
? hostCommandEnv({ OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined })
|
||||||
: { ...process.env, PATH: HOST_PATH, NO_COLOR: "1", CLICOLOR: "0", CLICOLOR_FORCE: "0" }
|
: { ...process.env, PATH: HOST_PATH, NO_COLOR: "1", CLICOLOR: "0", CLICOLOR_FORCE: "0" }
|
||||||
const { stdout, stderr } = await execFileAsync(command, args, {
|
const { stdout, stderr } = await execFileAsync(command, args, {
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ import { hostname, networkInterfaces } from "node:os"
|
|||||||
import path from "node:path"
|
import path from "node:path"
|
||||||
import { promisify } from "node:util"
|
import { promisify } from "node:util"
|
||||||
import { NEMOCLAW_BIN, NODE_BIN, OPENSHELL_BIN, hostCommandEnv } from "@/app/lib/hostCommands"
|
import { NEMOCLAW_BIN, NODE_BIN, OPENSHELL_BIN, hostCommandEnv } from "@/app/lib/hostCommands"
|
||||||
|
import {
|
||||||
|
parseDefaultSandboxNames,
|
||||||
|
parseNemoclawListJson,
|
||||||
|
resolveSandboxAgent,
|
||||||
|
type NemoClawListJsonIdentity,
|
||||||
|
type NemoClawRegistryData,
|
||||||
|
} from "@/app/lib/nemoclawIdentity.mjs"
|
||||||
import { resolveRuntimeAuthority } from "@/app/lib/runtimeAuthority"
|
import { resolveRuntimeAuthority } from "@/app/lib/runtimeAuthority"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
const execFileAsync = promisify(execFile)
|
||||||
@@ -30,10 +37,6 @@ type NemoClawSummary = {
|
|||||||
source: "nemoclaw-cli" | "none"
|
source: "nemoclaw-cli" | "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
type NemoClawRegistryData = {
|
|
||||||
sandboxes?: Record<string, { name?: string; agent?: string | null }>
|
|
||||||
}
|
|
||||||
|
|
||||||
type SandboxItem = {
|
type SandboxItem = {
|
||||||
metadata: {
|
metadata: {
|
||||||
name: string
|
name: string
|
||||||
@@ -115,17 +118,6 @@ function parseOpenShellSandboxNames(output: string) {
|
|||||||
.filter((entry): entry is string => Boolean(entry))
|
.filter((entry): entry is string => Boolean(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseDefaultSandboxNames(output: string) {
|
|
||||||
return new Set(
|
|
||||||
output
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.map((entry) => stripAnsi(entry))
|
|
||||||
.filter((entry) => /^\s{2,}[\w.-]+(?:\s+\*)?\s*$/.test(entry) && entry.includes("*"))
|
|
||||||
.map((entry) => entry.replace("*", "").trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildNemoClawSummary(output: string | null, defaultSandboxNames: Set<string>): NemoClawSummary {
|
function buildNemoClawSummary(output: string | null, defaultSandboxNames: Set<string>): NemoClawSummary {
|
||||||
if (!output) {
|
if (!output) {
|
||||||
return {
|
return {
|
||||||
@@ -163,17 +155,9 @@ function readNemoClawRegistry(): NemoClawRegistryData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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[]) {
|
async function execNemoclaw(args: string[]) {
|
||||||
const env = hostCommandEnv({
|
const env = hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
const command = /\.(?:c?m?js|ts)$/i.test(NEMOCLAW_BIN)
|
const command = /\.(?:c?m?js|ts)$/i.test(NEMOCLAW_BIN)
|
||||||
@@ -215,7 +199,12 @@ function readHostIdentity() {
|
|||||||
return { hostname: hostname(), address: "127.0.0.1", interface: "lo0" }
|
return { hostname: hostname(), address: "127.0.0.1", interface: "lo0" }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function readSandbox(name: string, defaultSandboxNames: Set<string>, registry: NemoClawRegistryData): Promise<{ summary: SandboxSummary; pod: SandboxItem }> {
|
async function readSandbox(
|
||||||
|
name: string,
|
||||||
|
defaultSandboxNames: Set<string>,
|
||||||
|
listJsonIdentity: NemoClawListJsonIdentity | null,
|
||||||
|
registry: NemoClawRegistryData | null
|
||||||
|
): Promise<{ summary: SandboxSummary; pod: SandboxItem }> {
|
||||||
try {
|
try {
|
||||||
const [{ stdout: detailsStdout }, { stdout: sshStdout }] = await Promise.all([
|
const [{ stdout: detailsStdout }, { stdout: sshStdout }] = await Promise.all([
|
||||||
execOpenShell(["sandbox", "get", name]),
|
execOpenShell(["sandbox", "get", name]),
|
||||||
@@ -229,7 +218,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set<string>, regis
|
|||||||
const sshConfig = sshStdout.trim()
|
const sshConfig = sshStdout.trim()
|
||||||
const sshHostAlias = parseSshHostAlias(sshConfig, sandboxName)
|
const sshHostAlias = parseSshHostAlias(sshConfig, sandboxName)
|
||||||
const isDefault = defaultSandboxNames.has(sandboxName)
|
const isDefault = defaultSandboxNames.has(sandboxName)
|
||||||
const agent = resolveSandboxAgent(sandboxName, sandboxId, registry)
|
const agent = resolveSandboxAgent(sandboxName, sandboxId, listJsonIdentity, registry)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
summary: {
|
summary: {
|
||||||
@@ -274,7 +263,7 @@ async function readSandbox(name: string, defaultSandboxNames: Set<string>, regis
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
const sandboxName = name
|
const sandboxName = name
|
||||||
const isDefault = defaultSandboxNames.has(sandboxName)
|
const isDefault = defaultSandboxNames.has(sandboxName)
|
||||||
const agent = resolveSandboxAgent(sandboxName, sandboxName, registry)
|
const agent = resolveSandboxAgent(sandboxName, sandboxName, listJsonIdentity, registry)
|
||||||
return {
|
return {
|
||||||
summary: {
|
summary: {
|
||||||
id: sandboxName,
|
id: sandboxName,
|
||||||
@@ -322,15 +311,28 @@ export async function GET() {
|
|||||||
try {
|
try {
|
||||||
const { stdout: sandboxListStdout } = await execOpenShell(["sandbox", "list"])
|
const { stdout: sandboxListStdout } = await execOpenShell(["sandbox", "list"])
|
||||||
const names = parseOpenShellSandboxNames(sandboxListStdout)
|
const names = parseOpenShellSandboxNames(sandboxListStdout)
|
||||||
const [nemoclawListResult, nemoclawStatusResult] = names.length > 0
|
let listJsonIdentity: NemoClawListJsonIdentity | null = null
|
||||||
? await Promise.all([
|
let legacyListResult: { stdout: string; stderr: string } | null = null
|
||||||
execNemoclaw(["list"]).catch(() => null),
|
const nemoclawStatusPromise = names.length > 0
|
||||||
execNemoclaw(["status"]).catch(() => null),
|
? execNemoclaw(["status"]).catch(() => null)
|
||||||
])
|
: Promise.resolve(null)
|
||||||
: [null, null]
|
|
||||||
const defaultSandboxNames = parseDefaultSandboxNames(nemoclawListResult?.stdout ?? "")
|
if (names.length > 0) {
|
||||||
const registry = readNemoClawRegistry()
|
const nemoclawListJsonResult = await execNemoclaw(["list", "--json"]).catch(() => null)
|
||||||
const results = await Promise.all(names.map((name) => readSandbox(name, defaultSandboxNames, registry)))
|
listJsonIdentity = parseNemoclawListJson(nemoclawListJsonResult?.stdout ?? "")
|
||||||
|
if (!listJsonIdentity) {
|
||||||
|
legacyListResult = await execNemoclaw(["list"]).catch(() => null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const nemoclawStatusResult = await nemoclawStatusPromise
|
||||||
|
const defaultSandboxNames = listJsonIdentity
|
||||||
|
? new Set(listJsonIdentity.defaultSandboxNames)
|
||||||
|
: parseDefaultSandboxNames(legacyListResult?.stdout ?? "")
|
||||||
|
const registry = listJsonIdentity ? null : readNemoClawRegistry()
|
||||||
|
const results = await Promise.all(
|
||||||
|
names.map((name) => readSandbox(name, defaultSandboxNames, listJsonIdentity, registry))
|
||||||
|
)
|
||||||
const sandboxes = results.map((result) => result.summary)
|
const sandboxes = results.map((result) => result.summary)
|
||||||
const items = results.map((result) => result.pod)
|
const items = results.map((result) => result.pod)
|
||||||
const nemoclaw = buildNemoClawSummary(nemoclawStatusResult?.stdout ?? null, defaultSandboxNames)
|
const nemoclaw = buildNemoClawSummary(nemoclawStatusResult?.stdout ?? null, defaultSandboxNames)
|
||||||
@@ -363,7 +365,11 @@ export async function GET() {
|
|||||||
explicitInstanceOverride: authority.explicitInstanceOverride,
|
explicitInstanceOverride: authority.explicitInstanceOverride,
|
||||||
usedMappedSandboxInstance: authority.usedMappedSandboxInstance,
|
usedMappedSandboxInstance: authority.usedMappedSandboxInstance,
|
||||||
})),
|
})),
|
||||||
defaultSource: defaultSandboxNames.size > 0 ? "nemoclaw-cli" : "none",
|
defaultSource: listJsonIdentity
|
||||||
|
? "nemoclaw-list-json"
|
||||||
|
: defaultSandboxNames.size > 0
|
||||||
|
? "nemoclaw-cli"
|
||||||
|
: "none",
|
||||||
count: inventoryCount,
|
count: inventoryCount,
|
||||||
message: hasMappedFallbackWithoutInventory
|
message: hasMappedFallbackWithoutInventory
|
||||||
? "Fetched live OpenShell inventory: zero sandboxes reported, so any mapped NemoClaw dashboard should be treated as fallback-only."
|
? "Fetched live OpenShell inventory: zero sandboxes reported, so any mapped NemoClaw dashboard should be treated as fallback-only."
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ export default function ConfigurationPanel({ sandboxId, mode = 'existing', onCre
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="text-xs uppercase tracking-wider text-[var(--foreground-dim)]">Sandbox Name<FieldHelp text="Lowercase letters, numbers, and hyphens only." /></label>
|
<label className="text-xs uppercase tracking-wider text-[var(--foreground-dim)]">Sandbox Name<FieldHelp text="1-19 characters; start with a lowercase letter; use lowercase letters, numbers, and single internal hyphens only." /></label>
|
||||||
<input value={sandboxName} onChange={(e) => setSandboxName(e.target.value)} placeholder={selectedBlueprint === 'nemoclaw-hermes' ? 'my-hermes' : selectedBlueprint === 'nemoclaw-deepagents-code' ? 'my-deepagents-code' : 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)} maxLength={19} pattern="(?!.*--)[a-z](?:[a-z0-9-]*[a-z0-9])?" placeholder={selectedBlueprint === 'nemoclaw-hermes' ? 'my-hermes' : selectedBlueprint === 'nemoclaw-deepagents-code' ? 'my-deepagents-code' : 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)] focus:outline-none focus:border-[var(--nvidia-green)]" />
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4">
|
<div className="rounded-sm border border-[var(--border-subtle)] bg-[var(--background)] p-4 space-y-4">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -78,14 +78,19 @@ function openDashboardUrl(url: string, openInNewTab: boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function displaySandboxAgent(agent?: string) {
|
function displaySandboxAgent(agent?: string) {
|
||||||
if (agent === 'hermes') return 'Hermes'
|
const normalized = typeof agent === 'string' ? agent.trim().toLowerCase() : ''
|
||||||
return 'OpenClaw'
|
if (normalized === 'hermes') return 'Hermes'
|
||||||
|
if (!normalized || normalized === 'openclaw') return 'OpenClaw'
|
||||||
|
if (normalized === 'unknown') return 'Unknown'
|
||||||
|
return agent || 'Unknown'
|
||||||
}
|
}
|
||||||
|
|
||||||
function SandboxTypeLogo({ agent }: { agent?: string }) {
|
function SandboxTypeLogo({ agent }: { agent?: string }) {
|
||||||
const isHermes = agent === 'hermes'
|
const normalized = typeof agent === 'string' ? agent.trim().toLowerCase() : ''
|
||||||
const label = isHermes ? 'Hermes sandbox' : 'OpenClaw sandbox'
|
const isHermes = normalized === 'hermes'
|
||||||
const logoSrc = isHermes ? HERMES_SANDBOX_LOGO : OPENCLAW_SANDBOX_LOGO
|
const isOpenClaw = !normalized || normalized === 'openclaw'
|
||||||
|
const label = isHermes ? 'Hermes sandbox' : isOpenClaw ? 'OpenClaw sandbox' : 'Non-OpenClaw sandbox'
|
||||||
|
const logoSrc = isHermes ? HERMES_SANDBOX_LOGO : isOpenClaw ? OPENCLAW_SANDBOX_LOGO : null
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
@@ -93,10 +98,16 @@ function SandboxTypeLogo({ agent }: { agent?: string }) {
|
|||||||
className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border shadow-inner ${
|
className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border shadow-inner ${
|
||||||
isHermes
|
isHermes
|
||||||
? 'border-sky-300/60 bg-sky-500/15'
|
? 'border-sky-300/60 bg-sky-500/15'
|
||||||
: 'border-rose-300/60 bg-rose-500/15'
|
: isOpenClaw
|
||||||
|
? 'border-rose-300/60 bg-rose-500/15'
|
||||||
|
: 'border-slate-300/60 bg-slate-500/15 text-[10px] font-semibold uppercase tracking-wide text-[var(--foreground-dim)]'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
|
{logoSrc ? (
|
||||||
<span aria-hidden="true" className="h-6 w-6 bg-contain bg-center bg-no-repeat" style={{ backgroundImage: `url(${logoSrc})` }} />
|
<span aria-hidden="true" className="h-6 w-6 bg-contain bg-center bg-no-repeat" style={{ backgroundImage: `url(${logoSrc})` }} />
|
||||||
|
) : (
|
||||||
|
<span aria-hidden="true">?</span>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ function contentDispositionFileName(value: string | null, fallback: string) {
|
|||||||
|
|
||||||
function defaultCloneName(source?: SandboxInventoryItem) {
|
function defaultCloneName(source?: SandboxInventoryItem) {
|
||||||
if (!source) return ""
|
if (!source) return ""
|
||||||
return `${source.name.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")}-clone`.slice(0, 63)
|
const base = source.name.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 13).replace(/-+$/g, "")
|
||||||
|
return `${base || "sandbox"}-clone`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function WizardPanel({
|
export default function WizardPanel({
|
||||||
@@ -134,7 +135,7 @@ export default function WizardPanel({
|
|||||||
|
|
||||||
const canContinue = (() => {
|
const canContinue = (() => {
|
||||||
if (activeStep === "source") return Boolean(sourceSandbox)
|
if (activeStep === "source") return Boolean(sourceSandbox)
|
||||||
if (activeStep === "target") return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(targetName) && targetName.length <= 63
|
if (activeStep === "target") return /^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/.test(targetName) && targetName.length <= 19
|
||||||
if (activeStep === "options") return Boolean(backupPath.trim() && restorePath.trim())
|
if (activeStep === "options") return Boolean(backupPath.trim() && restorePath.trim())
|
||||||
if (activeStep === "review") return Boolean(sourceSandbox && targetName.trim())
|
if (activeStep === "review") return Boolean(sourceSandbox && targetName.trim())
|
||||||
return false
|
return false
|
||||||
@@ -626,9 +627,12 @@ export default function WizardPanel({
|
|||||||
<input
|
<input
|
||||||
value={targetName}
|
value={targetName}
|
||||||
onChange={(event) => setTargetName(event.target.value)}
|
onChange={(event) => setTargetName(event.target.value)}
|
||||||
|
maxLength={19}
|
||||||
|
pattern="(?!.*--)[a-z](?:[a-z0-9-]*[a-z0-9])?"
|
||||||
placeholder="source-clone"
|
placeholder="source-clone"
|
||||||
className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)] focus:outline-none focus:border-[var(--nvidia-green)]"
|
className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)] focus:outline-none focus:border-[var(--nvidia-green)]"
|
||||||
/>
|
/>
|
||||||
|
<span className="text-[11px] text-[var(--foreground-dim)]">1-19 characters; start with a lowercase letter; no consecutive hyphens.</span>
|
||||||
</label>
|
</label>
|
||||||
{activeBlueprint?.supportsTailscale && (
|
{activeBlueprint?.supportsTailscale && (
|
||||||
<label className="flex items-center gap-3 text-sm font-mono text-[var(--foreground)]">
|
<label className="flex items-center gap-3 text-sm font-mono text-[var(--foreground)]">
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function parseRouteModel(output: string, label: "Gateway inference" | "System in
|
|||||||
async function readOpenShellInferenceModel() {
|
async function readOpenShellInferenceModel() {
|
||||||
const { stdout } = await execFileAsync(OPENSHELL_BIN, ["inference", "get"], {
|
const { stdout } = await execFileAsync(OPENSHELL_BIN, ["inference", "get"], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
maxBuffer: 5 * 1024 * 1024,
|
maxBuffer: 5 * 1024 * 1024,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { promisify } from "node:util"
|
|||||||
import { NEMOCLAW_BIN, NODE_BIN, commandExists, hostCommandEnv } from "./hostCommands"
|
import { NEMOCLAW_BIN, NODE_BIN, commandExists, hostCommandEnv } from "./hostCommands"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
const execFileAsync = promisify(execFile)
|
||||||
const NEMOCLAW_RECOVERY_MIN_VERSION = "0.0.37"
|
const NEMOCLAW_LIFECYCLE_MIN_VERSION = "0.0.37"
|
||||||
|
|
||||||
type NemoClawInvocation = {
|
type NemoClawInvocation = {
|
||||||
file: string
|
file: string
|
||||||
@@ -98,7 +98,7 @@ async function runNemoClaw(args: string[], timeout = 30000): Promise<NemoClawRun
|
|||||||
try {
|
try {
|
||||||
const { stdout, stderr } = await execFileAsync(invocation.file, invocation.args, {
|
const { stdout, stderr } = await execFileAsync(invocation.file, invocation.args, {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
NO_COLOR: "1",
|
NO_COLOR: "1",
|
||||||
CLICOLOR: "0",
|
CLICOLOR: "0",
|
||||||
CLICOLOR_FORCE: "0",
|
CLICOLOR_FORCE: "0",
|
||||||
@@ -143,8 +143,8 @@ async function hasModernNemoClawSurface() {
|
|||||||
const version = await getNemoClawVersion()
|
const version = await getNemoClawVersion()
|
||||||
return {
|
return {
|
||||||
...version,
|
...version,
|
||||||
supported: version.version ? versionGte(version.version, NEMOCLAW_RECOVERY_MIN_VERSION) : false,
|
supported: version.version ? versionGte(version.version, NEMOCLAW_LIFECYCLE_MIN_VERSION) : false,
|
||||||
minimumVersion: NEMOCLAW_RECOVERY_MIN_VERSION,
|
minimumVersion: NEMOCLAW_LIFECYCLE_MIN_VERSION,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ export async function getNemoClawDoctorReport(sandboxName: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function recoverSandboxWithNemoClaw(sandboxName: string) {
|
export async function restartSandboxGatewayWithNemoClaw(sandboxName: string) {
|
||||||
const capability = await hasModernNemoClawSurface()
|
const capability = await hasModernNemoClawSurface()
|
||||||
if (!capability.supported) {
|
if (!capability.supported) {
|
||||||
return {
|
return {
|
||||||
@@ -196,12 +196,12 @@ export async function recoverSandboxWithNemoClaw(sandboxName: string) {
|
|||||||
stderr: "",
|
stderr: "",
|
||||||
exitCode: null as number | null,
|
exitCode: null as number | null,
|
||||||
error: capability.available
|
error: capability.available
|
||||||
? `NemoClaw ${capability.version || "unknown"} does not expose sandbox recover`
|
? `NemoClaw ${capability.version || "unknown"} does not expose sandbox gateway restart`
|
||||||
: capability.error || "NemoClaw CLI is not available",
|
: capability.error || "NemoClaw CLI is not available",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await runNemoClaw([sandboxName, "recover"], 90000)
|
const result = await runNemoClaw(["sandbox", "gateway", "restart", sandboxName], 90000)
|
||||||
return {
|
return {
|
||||||
available: true,
|
available: true,
|
||||||
supported: true,
|
supported: true,
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export type NemoClawRegistryData = {
|
||||||
|
sandboxes?: Record<string, { name?: string; agent?: string | null }>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NemoClawListJsonIdentity = {
|
||||||
|
agentsByName: Record<string, string>
|
||||||
|
defaultSandboxNames: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeAgentIdentifier(agent: unknown): string | null
|
||||||
|
export function parseNemoclawListJson(output: string): NemoClawListJsonIdentity | null
|
||||||
|
export function parseDefaultSandboxNames(output: string): Set<string>
|
||||||
|
export function resolveSandboxAgent(
|
||||||
|
name: string,
|
||||||
|
id: string | null,
|
||||||
|
listJsonIdentity: NemoClawListJsonIdentity | null,
|
||||||
|
registry: NemoClawRegistryData | null
|
||||||
|
): string
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
function canonicalizeAgent(value) {
|
||||||
|
return value
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^a-z0-9]+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function normalizeAgentIdentifier(agent) {
|
||||||
|
if (typeof agent !== 'string') return null
|
||||||
|
const trimmed = agent.trim()
|
||||||
|
if (!trimmed) return null
|
||||||
|
|
||||||
|
const compact = trimmed.toLowerCase().replace(/[^a-z0-9]/g, '')
|
||||||
|
if (compact === 'openclaw') return 'openclaw'
|
||||||
|
if (compact === 'nemohermes' || compact === 'hermes') return 'hermes'
|
||||||
|
if (compact.includes('openclaw')) return 'openclaw'
|
||||||
|
if (compact.includes('hermes')) return 'hermes'
|
||||||
|
|
||||||
|
const canonical = canonicalizeAgent(trimmed)
|
||||||
|
if (!canonical) return null
|
||||||
|
if (canonical === 'unknown') return 'unknown'
|
||||||
|
return canonical
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseNemoclawListJson(output) {
|
||||||
|
if (typeof output !== 'string' || output.trim().length === 0) return null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(output)
|
||||||
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return null
|
||||||
|
if (parsed.schemaVersion !== 1) return null
|
||||||
|
if (!Array.isArray(parsed.sandboxes)) return null
|
||||||
|
|
||||||
|
const agentsByName = {}
|
||||||
|
const defaultSandboxNames = []
|
||||||
|
|
||||||
|
for (const entry of parsed.sandboxes) {
|
||||||
|
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) continue
|
||||||
|
const name = typeof entry.name === 'string' ? entry.name.trim() : ''
|
||||||
|
if (!name) continue
|
||||||
|
|
||||||
|
const normalized = normalizeAgentIdentifier(entry.agent)
|
||||||
|
agentsByName[name] = normalized || 'unknown'
|
||||||
|
if (entry.isDefault === true) defaultSandboxNames.push(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
agentsByName,
|
||||||
|
defaultSandboxNames,
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseDefaultSandboxNames(output) {
|
||||||
|
return new Set(
|
||||||
|
output
|
||||||
|
.split(/\r?\n/)
|
||||||
|
.map((entry) => entry.replace(/\u001b\[[0-9;]*m/g, ''))
|
||||||
|
.filter((entry) => /^\s{2,}[\w.-]+(?:\s+\*)?\s*$/.test(entry) && entry.includes('*'))
|
||||||
|
.map((entry) => entry.replace('*', '').trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveSandboxAgent(name, id, listJsonIdentity, registry) {
|
||||||
|
if (listJsonIdentity) {
|
||||||
|
const direct = listJsonIdentity.agentsByName[name] || (id ? listJsonIdentity.agentsByName[id] : null)
|
||||||
|
return direct || 'unknown'
|
||||||
|
}
|
||||||
|
|
||||||
|
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 normalized = normalizeAgentIdentifier(directEntry?.agent ?? namedEntry?.agent)
|
||||||
|
|
||||||
|
if (normalized) return normalized
|
||||||
|
return 'openclaw'
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
|
export function discoverNemoClawRegistryFiles(home = process.env.HOME || '/tmp') {
|
||||||
|
const stateRoot = path.join(home, '.nemoclaw')
|
||||||
|
const files = [path.join(stateRoot, 'sandboxes.json')]
|
||||||
|
const gatewaysRoot = path.join(stateRoot, 'gateways')
|
||||||
|
|
||||||
|
if (existsSync(gatewaysRoot)) {
|
||||||
|
try {
|
||||||
|
const ports = readdirSync(gatewaysRoot, { withFileTypes: true })
|
||||||
|
.filter((entry) => entry.isDirectory() && /^(?:[1-9][0-9]{0,4})$/.test(entry.name))
|
||||||
|
.map((entry) => Number(entry.name))
|
||||||
|
.filter((port) => port <= 65535)
|
||||||
|
.sort((a, b) => a - b)
|
||||||
|
for (const port of ports) files.push(path.join(gatewaysRoot, String(port), 'sandboxes.json'))
|
||||||
|
} catch {
|
||||||
|
// Individual readable registry files remain usable when directory discovery is unavailable.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return files.filter((file) => existsSync(file))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function readNemoClawRegistries(home = process.env.HOME || '/tmp') {
|
||||||
|
return discoverNemoClawRegistryFiles(home).flatMap((registryFile) => {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(readFileSync(registryFile, 'utf8'))
|
||||||
|
return data && typeof data === 'object' && !Array.isArray(data)
|
||||||
|
? [{ registryFile, data }]
|
||||||
|
: []
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function findNemoClawRegistryEntry(sandboxName, home = process.env.HOME || '/tmp') {
|
||||||
|
const matches = []
|
||||||
|
for (const registry of readNemoClawRegistries(home)) {
|
||||||
|
const entries = registry.data.sandboxes && typeof registry.data.sandboxes === 'object'
|
||||||
|
? registry.data.sandboxes
|
||||||
|
: {}
|
||||||
|
const keyed = entries[sandboxName]
|
||||||
|
const entry = keyed || Object.values(entries).find((candidate) => candidate?.name === sandboxName)
|
||||||
|
if (entry) matches.push({ entry, registryFile: registry.registryFile })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matches.length > 1) {
|
||||||
|
throw new Error(`Sandbox '${sandboxName}' appears in multiple NemoClaw gateway registries; resolve the duplicate registration before quick deploy.`)
|
||||||
|
}
|
||||||
|
return matches[0] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listNemoClawRegistryCandidates(home = process.env.HOME || '/tmp') {
|
||||||
|
const defaults = []
|
||||||
|
const entries = []
|
||||||
|
for (const { data } of readNemoClawRegistries(home)) {
|
||||||
|
if (typeof data.defaultSandbox === 'string' && data.defaultSandbox.trim()) {
|
||||||
|
defaults.push(data.defaultSandbox.trim())
|
||||||
|
}
|
||||||
|
for (const [key, value] of Object.entries(data.sandboxes || {})) {
|
||||||
|
const name = typeof value?.name === 'string' && value.name.trim() ? value.name.trim() : key
|
||||||
|
entries.push({ name, createdAt: String(value?.createdAt || '') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
|
||||||
|
return [...new Set([...defaults, ...entries.map(({ name }) => name)])]
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { spawn } from "node:child_process"
|
||||||
|
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||||
|
|
||||||
|
export type OpenClawConfigPatch = Record<string, unknown>
|
||||||
|
|
||||||
|
export function applyNativeOpenClawConfigPatch(
|
||||||
|
sandboxName: string,
|
||||||
|
patch: OpenClawConfigPatch,
|
||||||
|
timeoutMs = 60000,
|
||||||
|
) {
|
||||||
|
const payload = JSON.stringify(patch)
|
||||||
|
return new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve, reject) => {
|
||||||
|
const child = spawn(
|
||||||
|
OPENSHELL_BIN,
|
||||||
|
[
|
||||||
|
"sandbox",
|
||||||
|
"exec",
|
||||||
|
"-n",
|
||||||
|
sandboxName,
|
||||||
|
"--env",
|
||||||
|
"HOME=/sandbox",
|
||||||
|
"--",
|
||||||
|
"openclaw",
|
||||||
|
"config",
|
||||||
|
"patch",
|
||||||
|
"--stdin",
|
||||||
|
],
|
||||||
|
{
|
||||||
|
env: hostCommandEnv({
|
||||||
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
|
}),
|
||||||
|
stdio: ["pipe", "pipe", "pipe"],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
let stdout = ""
|
||||||
|
let stderr = ""
|
||||||
|
let settled = false
|
||||||
|
const timer = setTimeout(() => child.kill("SIGTERM"), timeoutMs)
|
||||||
|
child.stdout.on("data", (chunk) => { stdout += String(chunk) })
|
||||||
|
child.stderr.on("data", (chunk) => { stderr += String(chunk) })
|
||||||
|
child.on("error", (error) => {
|
||||||
|
if (settled) return
|
||||||
|
settled = true
|
||||||
|
clearTimeout(timer)
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
child.on("close", (code) => {
|
||||||
|
if (settled) return
|
||||||
|
settled = true
|
||||||
|
clearTimeout(timer)
|
||||||
|
resolve({ stdout: stdout.trim(), stderr: stderr.trim(), code })
|
||||||
|
})
|
||||||
|
child.stdin.end(payload)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function writeNativeOpenClawConfigPatch(
|
||||||
|
sandboxName: string,
|
||||||
|
patch: OpenClawConfigPatch,
|
||||||
|
failureMessage: string,
|
||||||
|
) {
|
||||||
|
const result = await applyNativeOpenClawConfigPatch(sandboxName, patch)
|
||||||
|
if (result.code !== 0) throw new Error(result.stderr || failureMessage)
|
||||||
|
return result
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import { execFile, spawn } from "node:child_process"
|
|||||||
import { promisify } from "node:util"
|
import { promisify } from "node:util"
|
||||||
import { HOST_PATH, OPENCLAW_BIN, OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
import { HOST_PATH, OPENCLAW_BIN, OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||||
import { getDefaultOpenClawInstance, getOpenClawDashboardPortForSandbox, resolveOpenClawInstance } from "./openclawInstances"
|
import { getDefaultOpenClawInstance, getOpenClawDashboardPortForSandbox, resolveOpenClawInstance } from "./openclawInstances"
|
||||||
|
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
const execFileAsync = promisify(execFile)
|
||||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
||||||
@@ -397,13 +398,16 @@ function resolveSandboxInstanceId(instanceId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildSandboxSshArgs(sandboxName: string, extraArgs: string[]) {
|
function buildSandboxSshArgs(sandboxName: string, extraArgs: string[]) {
|
||||||
|
const gatewayOption = OPENSHELL_GATEWAY
|
||||||
|
? ` --gateway-name ${JSON.stringify(OPENSHELL_GATEWAY)}`
|
||||||
|
: ""
|
||||||
return [
|
return [
|
||||||
"-o", "BatchMode=yes",
|
"-o", "BatchMode=yes",
|
||||||
"-o", "StrictHostKeyChecking=no",
|
"-o", "StrictHostKeyChecking=no",
|
||||||
"-o", "UserKnownHostsFile=/dev/null",
|
"-o", "UserKnownHostsFile=/dev/null",
|
||||||
"-o", "GlobalKnownHostsFile=/dev/null",
|
"-o", "GlobalKnownHostsFile=/dev/null",
|
||||||
"-o", "LogLevel=ERROR",
|
"-o", "LogLevel=ERROR",
|
||||||
"-o", `ProxyCommand=${OPENSHELL_BIN} ssh-proxy --gateway-name nemoclaw --name ${sandboxName}`,
|
"-o", `ProxyCommand=${OPENSHELL_BIN} ssh-proxy${gatewayOption} --name ${sandboxName}`,
|
||||||
`sandbox@openshell-${sandboxName}`,
|
`sandbox@openshell-${sandboxName}`,
|
||||||
...extraArgs,
|
...extraArgs,
|
||||||
]
|
]
|
||||||
@@ -418,13 +422,13 @@ async function execSandboxSsh(sandboxName: string, command: string, timeoutMs =
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function ensureRemoteSandboxOpenClawDashboard(sandboxName: string) {
|
async function ensureRemoteSandboxOpenClawDashboard(sandboxName: string) {
|
||||||
const command = [
|
try {
|
||||||
`curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null 2>&1`,
|
await execSandboxSsh(sandboxName, `curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null`, 5000)
|
||||||
"||",
|
return true
|
||||||
`(nohup /usr/local/bin/openclaw gateway run --allow-unconfigured --bind loopback --port ${SANDBOX_DASHBOARD_REMOTE_PORT} >/tmp/gateway.log 2>&1 &)`
|
} catch {
|
||||||
].join(" ")
|
const restart = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||||
|
if (!restart.ok) return false
|
||||||
await execSandboxSsh(sandboxName, command).catch(() => null)
|
}
|
||||||
|
|
||||||
for (let attempt = 0; attempt < 16; attempt += 1) {
|
for (let attempt = 0; attempt < 16; attempt += 1) {
|
||||||
try {
|
try {
|
||||||
@@ -445,7 +449,7 @@ async function ensureSandboxOpenClawDashboardTunnel(sandboxName: string) {
|
|||||||
const initial = await inspectListeningPort(port)
|
const initial = await inspectListeningPort(port)
|
||||||
if (initial.listenerPresent) return initial
|
if (initial.listenerPresent) return initial
|
||||||
|
|
||||||
await ensureRemoteSandboxOpenClawDashboard(sandboxName)
|
if (!await ensureRemoteSandboxOpenClawDashboard(sandboxName)) return initial
|
||||||
|
|
||||||
const child = spawn("ssh", buildSandboxSshArgs(sandboxName, [
|
const child = spawn("ssh", buildSandboxSshArgs(sandboxName, [
|
||||||
"-N",
|
"-N",
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function runSandboxExec(sandboxName: string, script: string, input?: Buffer, tim
|
|||||||
return new Promise<{ stdout: Buffer; stderr: string; code: number | null }>((resolve, reject) => {
|
return new Promise<{ stdout: Buffer; stderr: string; code: number | null }>((resolve, reject) => {
|
||||||
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
stdio: ["pipe", "pipe", "pipe"],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { execFile, spawn } from "node:child_process"
|
import { execFile } from "node:child_process"
|
||||||
import { promisify } from "node:util"
|
import { promisify } from "node:util"
|
||||||
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||||
|
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||||
|
import { writeNativeOpenClawConfigPatch } from "./openClawNativeConfig"
|
||||||
import { getSandboxInferenceConfig, type SandboxInferenceRoute } from "./sandboxInferenceStore"
|
import { getSandboxInferenceConfig, type SandboxInferenceRoute } from "./sandboxInferenceStore"
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile)
|
const execFileAsync = promisify(execFile)
|
||||||
@@ -106,11 +108,9 @@ function resolveOpenClawRoute(route: SandboxInferenceRoute) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOpenClawConfig(current: any, routes: SandboxInferenceRoute[], primary: SandboxInferenceRoute) {
|
function buildOpenClawConfigPatch(routes: SandboxInferenceRoute[], primary: SandboxInferenceRoute) {
|
||||||
const providers: Record<string, any> = {}
|
const providers: Record<string, any> = {}
|
||||||
let primaryModelRef = primary.model
|
let primaryModelRef = primary.model
|
||||||
const channelDefaults = { ...(current?.channels?.defaults || {}) }
|
|
||||||
delete channelDefaults.configWrites
|
|
||||||
|
|
||||||
for (const route of routes.filter((item) => item.enabled)) {
|
for (const route of routes.filter((item) => item.enabled)) {
|
||||||
const resolved = resolveOpenClawRoute(route)
|
const resolved = resolveOpenClawRoute(route)
|
||||||
@@ -125,26 +125,20 @@ function buildOpenClawConfig(current: any, routes: SandboxInferenceRoute[], prim
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...current,
|
|
||||||
agents: {
|
agents: {
|
||||||
...(current?.agents || {}),
|
|
||||||
defaults: {
|
defaults: {
|
||||||
...(current?.agents?.defaults || {}),
|
|
||||||
model: {
|
model: {
|
||||||
...(current?.agents?.defaults?.model || {}),
|
|
||||||
primary: primaryModelRef,
|
primary: primaryModelRef,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
models: {
|
models: {
|
||||||
...(current?.models || {}),
|
|
||||||
mode: "merge",
|
mode: "merge",
|
||||||
providers,
|
providers,
|
||||||
},
|
},
|
||||||
channels: {
|
channels: {
|
||||||
...(current?.channels || {}),
|
|
||||||
defaults: {
|
defaults: {
|
||||||
...channelDefaults,
|
configWrites: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -161,64 +155,30 @@ async function runOpenShell(args: string[]) {
|
|||||||
return { stdout: String(stdout).trim(), stderr: String(stderr).trim() }
|
return { stdout: String(stdout).trim(), stderr: String(stderr).trim() }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runOpenShellExec(sandboxName: string, script: string, input?: string) {
|
|
||||||
return await new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve, reject) => {
|
|
||||||
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
|
||||||
env: hostCommandEnv({
|
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
|
||||||
}),
|
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
|
||||||
})
|
|
||||||
let stdout = ""
|
|
||||||
let stderr = ""
|
|
||||||
child.stdout.on("data", (chunk) => { stdout += String(chunk) })
|
|
||||||
child.stderr.on("data", (chunk) => { stderr += String(chunk) })
|
|
||||||
child.on("error", reject)
|
|
||||||
child.on("close", (code) => resolve({ stdout: stdout.trim(), stderr: stderr.trim(), code }))
|
|
||||||
if (input) child.stdin.end(input)
|
|
||||||
else child.stdin.end()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readCurrentOpenClawConfig(sandboxName: string) {
|
|
||||||
const result = await runOpenShellExec(sandboxName, "cat /sandbox/.openclaw/openclaw.json")
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "Failed to read OpenClaw config")
|
|
||||||
return JSON.parse(result.stdout)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeOpenClawConfig(sandboxName: string, config: any) {
|
|
||||||
const payload = `${JSON.stringify(config, null, 2)}\n`
|
|
||||||
const script = [
|
|
||||||
"cat > /sandbox/.openclaw/openclaw.json",
|
|
||||||
"chmod 600 /sandbox/.openclaw/openclaw.json",
|
|
||||||
"sha256sum /sandbox/.openclaw/openclaw.json > /sandbox/.openclaw/.config-hash",
|
|
||||||
"chmod 600 /sandbox/.openclaw/.config-hash",
|
|
||||||
].join(" && ")
|
|
||||||
const result = await runOpenShellExec(sandboxName, script, payload)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "Failed to write OpenClaw config")
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
async function restartOpenClawGatewayIfRunning(sandboxName: string) {
|
|
||||||
const script = "for p in /proc/[0-9]*; do cmd=$(tr '\\0' ' ' < \"$p/cmdline\" 2>/dev/null || true); case \"$cmd\" in *'openclaw gateway'*) kill \"${p##*/}\" 2>/dev/null || true;; esac; done"
|
|
||||||
return await runOpenShellExec(sandboxName, script)
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function applySandboxInferenceProfile(sandboxId: string, sandboxName: string) {
|
export async function applySandboxInferenceProfile(sandboxId: string, sandboxName: string) {
|
||||||
const config = await getSandboxInferenceConfig(sandboxId)
|
const config = await getSandboxInferenceConfig(sandboxId)
|
||||||
const enabledRoutes = config.routes.filter((route) => route.enabled)
|
const enabledRoutes = config.routes.filter((route) => route.enabled)
|
||||||
if (enabledRoutes.length === 0) throw new Error("No enabled inference routes are configured for this sandbox")
|
if (enabledRoutes.length === 0) throw new Error("No enabled inference routes are configured for this sandbox")
|
||||||
const primary = enabledRoutes.find((route) => route.id === config.primaryRouteId) || enabledRoutes[0]
|
const primary = enabledRoutes.find((route) => route.id === config.primaryRouteId) || enabledRoutes[0]
|
||||||
|
|
||||||
const currentOpenClawConfig = await readCurrentOpenClawConfig(sandboxName)
|
const openClawPatch = buildOpenClawConfigPatch(enabledRoutes, primary)
|
||||||
const nextOpenClawConfig = buildOpenClawConfig(currentOpenClawConfig, enabledRoutes, primary)
|
await writeNativeOpenClawConfigPatch(
|
||||||
await writeOpenClawConfig(sandboxName, nextOpenClawConfig)
|
sandboxName,
|
||||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
openClawPatch,
|
||||||
|
"Failed to apply native OpenClaw inference config",
|
||||||
|
)
|
||||||
const routeResult = await runOpenShell(["inference", "set", "--no-verify", "--provider", primary.provider, "--model", primary.model])
|
const routeResult = await runOpenShell(["inference", "set", "--no-verify", "--provider", primary.provider, "--model", primary.model])
|
||||||
|
const restartResult = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||||
|
if (!restartResult.ok) {
|
||||||
|
throw new Error(
|
||||||
|
restartResult.stderr || restartResult.error ||
|
||||||
|
"NemoClaw could not verify the native agent gateway restart after applying inference config",
|
||||||
|
)
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
primaryRoute: primary,
|
primaryRoute: primary,
|
||||||
routesApplied: enabledRoutes.length,
|
routesApplied: enabledRoutes.length,
|
||||||
gatewayRoute: routeResult,
|
gatewayRoute: routeResult,
|
||||||
|
gatewayRestart: "nemoclaw-native-gateway",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
syncSandboxOpenClawMcpConfig,
|
syncSandboxOpenClawMcpConfig,
|
||||||
revokeSandboxOpenClawMcpConfig,
|
revokeSandboxOpenClawMcpConfig,
|
||||||
} from "./sandboxOpenClawMcpConfig"
|
} from "./sandboxOpenClawMcpConfig"
|
||||||
import { repairOpenClawExecApprovalsFile, writeSandboxFilePrivileged } from "./sandboxPrivilegedFiles"
|
import { writeSandboxFilePrivileged } from "./sandboxPrivilegedFiles"
|
||||||
|
|
||||||
export const SANDBOX_MCP_MANIFEST_PATH = "/sandbox/openshell_control_mcp.md"
|
export const SANDBOX_MCP_MANIFEST_PATH = "/sandbox/openshell_control_mcp.md"
|
||||||
|
|
||||||
@@ -112,8 +112,6 @@ export async function syncSandboxMcpManifest(
|
|||||||
options.brokerBaseUrl,
|
options.brokerBaseUrl,
|
||||||
handoff.token,
|
handoff.token,
|
||||||
)
|
)
|
||||||
const execApprovals = await repairOpenClawExecApprovalsFile(sandboxName)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path: uploaded.path,
|
path: uploaded.path,
|
||||||
sandboxName: uploaded.sandboxName,
|
sandboxName: uploaded.sandboxName,
|
||||||
@@ -126,7 +124,6 @@ export async function syncSandboxMcpManifest(
|
|||||||
expiresAt: handoff.session.expiresAt,
|
expiresAt: handoff.session.expiresAt,
|
||||||
},
|
},
|
||||||
openClaw,
|
openClaw,
|
||||||
execApprovals,
|
|
||||||
markdown: handoff.markdown,
|
markdown: handoff.markdown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +1,21 @@
|
|||||||
import { spawn } from "node:child_process"
|
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||||
import { OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
import { writeNativeOpenClawConfigPatch } from "./openClawNativeConfig"
|
||||||
|
|
||||||
export const OPENSHELL_CONTROL_MCP_SERVER_NAME = "openshell-control"
|
export const OPENSHELL_CONTROL_MCP_SERVER_NAME = "openshell-control"
|
||||||
export const OPENCLAW_CONFIG_PATH = "/sandbox/.openclaw/openclaw.json"
|
export const OPENCLAW_CONFIG_PATH = "/sandbox/.openclaw/openclaw.json"
|
||||||
const OPENCLAW_CONFIG_HASH_PATH = "/sandbox/.openclaw/.config-hash"
|
|
||||||
|
|
||||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
||||||
return Boolean(value) && typeof value === "object" && !Array.isArray(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeBrokerBaseUrl(value: string) {
|
function normalizeBrokerBaseUrl(value: string) {
|
||||||
return value.replace(/\/+$/, "")
|
return value.replace(/\/+$/, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
function runSandboxShell(sandboxName: string, script: string, input?: string, timeoutMs = 60000) {
|
async function restartNativeGateway(sandboxName: string) {
|
||||||
return new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve, reject) => {
|
const result = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||||
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
if (!result.ok) {
|
||||||
env: hostCommandEnv({
|
throw new Error(
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
result.stderr || result.error ||
|
||||||
}),
|
"NemoClaw could not verify the native agent gateway restart after updating MCP config",
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
)
|
||||||
})
|
}
|
||||||
let stdout = ""
|
|
||||||
let stderr = ""
|
|
||||||
const timer = setTimeout(() => child.kill("SIGTERM"), timeoutMs)
|
|
||||||
child.stdout.on("data", (chunk) => { stdout += String(chunk) })
|
|
||||||
child.stderr.on("data", (chunk) => { stderr += String(chunk) })
|
|
||||||
child.on("error", (error) => {
|
|
||||||
clearTimeout(timer)
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
child.on("close", (code) => {
|
|
||||||
clearTimeout(timer)
|
|
||||||
resolve({ stdout: stdout.trim(), stderr: stderr.trim(), code })
|
|
||||||
})
|
|
||||||
if (input) child.stdin.end(input)
|
|
||||||
else child.stdin.end()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readOpenClawConfig(sandboxName: string) {
|
|
||||||
const result = await runSandboxShell(sandboxName, `cat ${OPENCLAW_CONFIG_PATH}`)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "Failed to read OpenClaw config")
|
|
||||||
const parsed = JSON.parse(result.stdout)
|
|
||||||
if (!isRecord(parsed)) throw new Error("OpenClaw config must be a JSON object")
|
|
||||||
return parsed
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeOpenClawConfig(sandboxName: string, config: Record<string, unknown>) {
|
|
||||||
const payload = `${JSON.stringify(config, null, 2)}\n`
|
|
||||||
const script = [
|
|
||||||
`cat > ${OPENCLAW_CONFIG_PATH}`,
|
|
||||||
`chmod 0660 ${OPENCLAW_CONFIG_PATH}`,
|
|
||||||
`chown sandbox:sandbox ${OPENCLAW_CONFIG_PATH} 2>/dev/null || chown 998:998 ${OPENCLAW_CONFIG_PATH}`,
|
|
||||||
`sha256sum ${OPENCLAW_CONFIG_PATH} > ${OPENCLAW_CONFIG_HASH_PATH}`,
|
|
||||||
`chmod 0660 ${OPENCLAW_CONFIG_HASH_PATH}`,
|
|
||||||
`chown sandbox:sandbox ${OPENCLAW_CONFIG_HASH_PATH} 2>/dev/null || chown 998:998 ${OPENCLAW_CONFIG_HASH_PATH}`,
|
|
||||||
].join(" && ")
|
|
||||||
const result = await runSandboxShell(sandboxName, script, payload)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "Failed to write OpenClaw MCP config")
|
|
||||||
}
|
|
||||||
|
|
||||||
async function restartOpenClawGatewayIfRunning(sandboxName: string) {
|
|
||||||
const script = "for p in /proc/[0-9]*; do cmd=$(tr '\\0' ' ' < \"$p/cmdline\" 2>/dev/null || true); case \"$cmd\" in *'openclaw gateway'*) kill \"${p##*/}\" 2>/dev/null || true;; esac; done"
|
|
||||||
await runSandboxShell(sandboxName, script)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildOpenClawMcpServerConfig(brokerBaseUrl: string, token: string) {
|
export function buildOpenClawMcpServerConfig(brokerBaseUrl: string, token: string) {
|
||||||
@@ -82,19 +34,14 @@ export async function syncSandboxOpenClawMcpConfig(
|
|||||||
brokerBaseUrl: string,
|
brokerBaseUrl: string,
|
||||||
token: string,
|
token: string,
|
||||||
) {
|
) {
|
||||||
const current = await readOpenClawConfig(sandboxName)
|
|
||||||
const mcp = isRecord(current.mcp) ? { ...current.mcp } : {}
|
|
||||||
const servers = isRecord(mcp.servers) ? { ...mcp.servers } : {}
|
|
||||||
const serverConfig = buildOpenClawMcpServerConfig(brokerBaseUrl, token)
|
const serverConfig = buildOpenClawMcpServerConfig(brokerBaseUrl, token)
|
||||||
|
|
||||||
servers[OPENSHELL_CONTROL_MCP_SERVER_NAME] = serverConfig
|
await writeNativeOpenClawConfigPatch(
|
||||||
mcp.servers = servers
|
sandboxName,
|
||||||
|
{ mcp: { servers: { [OPENSHELL_CONTROL_MCP_SERVER_NAME]: serverConfig } } },
|
||||||
await writeOpenClawConfig(sandboxName, {
|
"Failed to apply native OpenClaw MCP config",
|
||||||
...current,
|
)
|
||||||
mcp,
|
await restartNativeGateway(sandboxName)
|
||||||
})
|
|
||||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path: OPENCLAW_CONFIG_PATH,
|
path: OPENCLAW_CONFIG_PATH,
|
||||||
@@ -105,23 +52,12 @@ export async function syncSandboxOpenClawMcpConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function revokeSandboxOpenClawMcpConfig(sandboxName: string) {
|
export async function revokeSandboxOpenClawMcpConfig(sandboxName: string) {
|
||||||
const current = await readOpenClawConfig(sandboxName)
|
await writeNativeOpenClawConfigPatch(
|
||||||
const mcp = isRecord(current.mcp) ? { ...current.mcp } : {}
|
sandboxName,
|
||||||
const servers = isRecord(mcp.servers) ? { ...mcp.servers } : {}
|
{ mcp: { servers: { [OPENSHELL_CONTROL_MCP_SERVER_NAME]: null } } },
|
||||||
delete servers[OPENSHELL_CONTROL_MCP_SERVER_NAME]
|
"Failed to remove native OpenClaw MCP config",
|
||||||
|
)
|
||||||
const nextConfig: Record<string, unknown> = { ...current }
|
await restartNativeGateway(sandboxName)
|
||||||
if (Object.keys(servers).length > 0) {
|
|
||||||
mcp.servers = servers
|
|
||||||
nextConfig.mcp = mcp
|
|
||||||
} else {
|
|
||||||
delete mcp.servers
|
|
||||||
if (Object.keys(mcp).length > 0) nextConfig.mcp = mcp
|
|
||||||
else delete nextConfig.mcp
|
|
||||||
}
|
|
||||||
|
|
||||||
await writeOpenClawConfig(sandboxName, nextConfig)
|
|
||||||
await restartOpenClawGatewayIfRunning(sandboxName)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path: OPENCLAW_CONFIG_PATH,
|
path: OPENCLAW_CONFIG_PATH,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type BrokerNetworkAction = {
|
|||||||
function runOpenShell(args: string[], timeout = 60000) {
|
function runOpenShell(args: string[], timeout = 60000) {
|
||||||
return execFileAsync(OPENSHELL_BIN, args, {
|
return execFileAsync(OPENSHELL_BIN, args, {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
TERM: "dumb",
|
TERM: "dumb",
|
||||||
}),
|
}),
|
||||||
timeout,
|
timeout,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function runSandboxShell(sandboxName: string, script: string, input?: Buffer | s
|
|||||||
return new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve, reject) => {
|
return new Promise<{ stdout: string; stderr: string; code: number | null }>((resolve, reject) => {
|
||||||
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
const child = spawn(OPENSHELL_BIN, ["sandbox", "exec", "-n", sandboxName, "--", "sh", "-lc", script], {
|
||||||
env: hostCommandEnv({
|
env: hostCommandEnv({
|
||||||
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
|
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY?.trim() || undefined,
|
||||||
}),
|
}),
|
||||||
stdio: ["pipe", "pipe", "pipe"],
|
stdio: ["pipe", "pipe", "pipe"],
|
||||||
})
|
})
|
||||||
@@ -51,107 +51,3 @@ export async function writeSandboxFilePrivileged(
|
|||||||
bytes: payload.byteLength,
|
bytes: payload.byteLength,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function repairOpenClawExecApprovalsFile(sandboxName: string) {
|
|
||||||
const normalizeScript = [
|
|
||||||
`const fs = require("fs")`,
|
|
||||||
`const approval = "/sandbox/.openclaw/exec-approvals.json"`,
|
|
||||||
`const tmp = process.argv[1]`,
|
|
||||||
`let source = ""`,
|
|
||||||
`try { source = fs.readFileSync(approval, "utf8") } catch {}`,
|
|
||||||
`const trimmed = source.trim()`,
|
|
||||||
`let payload = "{}\\n"`,
|
|
||||||
`if (trimmed) { try { payload = JSON.stringify(JSON.parse(trimmed), null, 2) + "\\n" } catch {} }`,
|
|
||||||
`fs.writeFileSync(tmp, payload)`,
|
|
||||||
].join("; ")
|
|
||||||
const script = [
|
|
||||||
`mkdir -p /sandbox/.openclaw`,
|
|
||||||
`tmp="/sandbox/.openclaw/.exec-approvals.json.$$"`,
|
|
||||||
`node -e ${shellQuote(normalizeScript)} "$tmp"`,
|
|
||||||
`rm -f /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
`mv "$tmp" /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
`chown sandbox:sandbox /sandbox/.openclaw/exec-approvals.json 2>/dev/null || chown 998:998 /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
`chmod 0600 /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
].join(" && ")
|
|
||||||
const result = await runSandboxShell(sandboxName, script)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "failed to repair OpenClaw exec approvals file")
|
|
||||||
return {
|
|
||||||
sandboxName,
|
|
||||||
path: "/sandbox/.openclaw/exec-approvals.json",
|
|
||||||
note: "Replaced OpenClaw exec approvals symlink with a real sandbox-owned file for newer OpenClaw versions.",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function stabilizeOpenClawGatewayConfig(sandboxName: string) {
|
|
||||||
const patchConfig = [
|
|
||||||
`const fs = require("fs")`,
|
|
||||||
`const path = "/sandbox/.openclaw/openclaw.json"`,
|
|
||||||
`const cfg = JSON.parse(fs.readFileSync(path, "utf8"))`,
|
|
||||||
`cfg.plugins = cfg.plugins && typeof cfg.plugins === "object" && !Array.isArray(cfg.plugins) ? cfg.plugins : {}`,
|
|
||||||
`cfg.plugins.entries = cfg.plugins.entries && typeof cfg.plugins.entries === "object" && !Array.isArray(cfg.plugins.entries) ? cfg.plugins.entries : {}`,
|
|
||||||
`cfg.plugins.entries.bonjour = { ...(cfg.plugins.entries.bonjour || {}), enabled: false }`,
|
|
||||||
`fs.writeFileSync(path, JSON.stringify(cfg, null, 2) + "\\n")`,
|
|
||||||
].join("; ")
|
|
||||||
const script = [
|
|
||||||
`node -e ${shellQuote(patchConfig)}`,
|
|
||||||
`chmod 444 /sandbox/.openclaw/openclaw.json`,
|
|
||||||
`chown root:root /sandbox/.openclaw/openclaw.json`,
|
|
||||||
`(cd /sandbox/.openclaw && sha256sum openclaw.json > .config-hash)`,
|
|
||||||
`chmod 444 /sandbox/.openclaw/.config-hash`,
|
|
||||||
`chown root:root /sandbox/.openclaw/.config-hash`,
|
|
||||||
`mkdir -p /sandbox/.openclaw-data/logs`,
|
|
||||||
`chown -R sandbox:sandbox /sandbox/.openclaw-data/logs 2>/dev/null || chown -R 998:998 /sandbox/.openclaw-data/logs`,
|
|
||||||
`openclaw gateway stop >/dev/null 2>&1 || true`,
|
|
||||||
`if command -v gosu >/dev/null 2>&1; then nohup gosu sandbox openclaw gateway run >/sandbox/.openclaw-data/logs/gateway.log 2>&1 & else nohup openclaw gateway run >/sandbox/.openclaw-data/logs/gateway.log 2>&1 & fi`,
|
|
||||||
].join(" && ")
|
|
||||||
const result = await runSandboxShell(sandboxName, script)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "failed to stabilize OpenClaw gateway config")
|
|
||||||
return {
|
|
||||||
sandboxName,
|
|
||||||
path: "/sandbox/.openclaw/openclaw.json",
|
|
||||||
note: "Disabled the Bonjour gateway discovery plugin inside the sandbox because it crashes under the OpenShell network namespace.",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function repairOpenClawWorkspacePermissions(sandboxName: string) {
|
|
||||||
const mutableDirs = [
|
|
||||||
"agents",
|
|
||||||
"extensions",
|
|
||||||
"workspace",
|
|
||||||
"skills",
|
|
||||||
"hooks",
|
|
||||||
"identity",
|
|
||||||
"devices",
|
|
||||||
"canvas",
|
|
||||||
"cron",
|
|
||||||
"memory",
|
|
||||||
"logs",
|
|
||||||
"credentials",
|
|
||||||
"flows",
|
|
||||||
"sandbox",
|
|
||||||
"telegram",
|
|
||||||
"plugin-runtime-deps",
|
|
||||||
]
|
|
||||||
const mutableFiles = [
|
|
||||||
"update-check.json",
|
|
||||||
]
|
|
||||||
const script = [
|
|
||||||
`mkdir -p /sandbox/.openclaw /sandbox/.openclaw-data/agents/main/agent`,
|
|
||||||
`for dir in ${mutableDirs.map(shellQuote).join(" ")}; do target="/sandbox/.openclaw-data/$dir"; link="/sandbox/.openclaw/$dir"; mkdir -p "$target"; if [ -d "$link" ] && [ ! -L "$link" ]; then cp -a "$link/." "$target/" 2>/dev/null || true; rm -rf "$link"; fi; ln -sfn "$target" "$link"; done`,
|
|
||||||
`for file in ${mutableFiles.map(shellQuote).join(" ")}; do target="/sandbox/.openclaw-data/$file"; link="/sandbox/.openclaw/$file"; if [ ! -e "$target" ]; then if [ -f "$link" ] && [ ! -L "$link" ]; then cp "$link" "$target" 2>/dev/null || : > "$target"; else : > "$target"; fi; fi; if [ -e "$link" ] && [ ! -L "$link" ]; then rm -f "$link"; fi; ln -sfn "$target" "$link"; done`,
|
|
||||||
`approval="/sandbox/.openclaw/exec-approvals.json"; approval_data="/sandbox/.openclaw-data/exec-approvals.json"; tmp="/sandbox/.openclaw/.exec-approvals.reconcile.$$"; if [ -L "$approval" ]; then if [ -s "$approval_data" ]; then cp "$approval_data" "$tmp" 2>/dev/null || : > "$tmp"; else : > "$tmp"; fi; rm -f "$approval"; mv "$tmp" "$approval"; elif [ ! -e "$approval" ]; then : > "$approval"; fi`,
|
|
||||||
`chown -R sandbox:sandbox /sandbox/.openclaw-data 2>/dev/null || chown -R 998:998 /sandbox/.openclaw-data`,
|
|
||||||
`chown sandbox:sandbox /sandbox/.openclaw /sandbox/.openclaw/exec-approvals.json 2>/dev/null || chown 998:998 /sandbox/.openclaw /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
`chmod 0755 /sandbox/.openclaw && chmod 0600 /sandbox/.openclaw/exec-approvals.json`,
|
|
||||||
].join(" && ")
|
|
||||||
const result = await runSandboxShell(sandboxName, script)
|
|
||||||
if (result.code !== 0) throw new Error(result.stderr || "failed to repair OpenClaw mutable paths")
|
|
||||||
return {
|
|
||||||
sandboxName,
|
|
||||||
path: "/sandbox/.openclaw",
|
|
||||||
target: "/sandbox/.openclaw-data",
|
|
||||||
mutableDirs,
|
|
||||||
mutableFiles,
|
|
||||||
note: "Reconciled the OpenClaw directory layout for NemoClaw: mutable state paths, AGENTS.md, session locks, update-check state, plugin runtime deps, and exec approvals are writable where the bundled OpenClaw expects them.",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ YELLOW='\033[1;33m'
|
|||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
OPENSHELL_VERSION="${OPENSHELL_VERSION:-v0.0.106}"
|
OPENSHELL_VERSION="${OPENSHELL_VERSION:-v0.0.116}"
|
||||||
OPENSHELL_INSTALL_URL="${OPENSHELL_INSTALL_URL:-https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh}"
|
OPENSHELL_INSTALL_URL="${OPENSHELL_INSTALL_URL:-https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh}"
|
||||||
NEMOCLAW_INSTALL_REF="${NEMOCLAW_INSTALL_REF:-${NEMOCLAW_INSTALL_TAG:-main}}"
|
NEMOCLAW_INSTALL_REF="${NEMOCLAW_INSTALL_REF:-${NEMOCLAW_INSTALL_TAG:-main}}"
|
||||||
NEMOCLAW_SOURCE_URL="${NEMOCLAW_SOURCE_URL:-https://github.com/NVIDIA/NemoClaw.git}"
|
NEMOCLAW_SOURCE_URL="${NEMOCLAW_SOURCE_URL:-https://github.com/NVIDIA/NemoClaw.git}"
|
||||||
OPENCLAW_VERSION="${OPENCLAW_VERSION:-2026.7.1}"
|
OPENCLAW_VERSION="${OPENCLAW_VERSION:-2026.9.2}"
|
||||||
NEMOCLAW_BASE_IMAGE="${NEMOCLAW_BASE_IMAGE:-ghcr.io/nvidia/nemoclaw/sandbox-base:latest}"
|
NEMOCLAW_BASE_IMAGE="${NEMOCLAW_BASE_IMAGE:-ghcr.io/nvidia/nemoclaw/sandbox-base:latest}"
|
||||||
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-1}"
|
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE="${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-1}"
|
||||||
NEMOCLAW_NON_INTERACTIVE="${NEMOCLAW_NON_INTERACTIVE:-1}"
|
NEMOCLAW_NON_INTERACTIVE="${NEMOCLAW_NON_INTERACTIVE:-1}"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const execFileAsync = promisify(execFile)
|
|||||||
const DASHBOARD_PORT_BASE = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_PORT_BASE || "19000", 10)
|
const DASHBOARD_PORT_BASE = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_PORT_BASE || "19000", 10)
|
||||||
const DASHBOARD_PORT_RANGE = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_PORT_RANGE || "2000", 10)
|
const DASHBOARD_PORT_RANGE = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_PORT_RANGE || "2000", 10)
|
||||||
const REMOTE_DASHBOARD_PORT = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_REMOTE_PORT || "18789", 10)
|
const REMOTE_DASHBOARD_PORT = Number.parseInt(process.env.OPENCLAW_SANDBOX_DASHBOARD_REMOTE_PORT || "18789", 10)
|
||||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY || "nemoclaw"
|
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
||||||
const CONTROL_UI_ORIGIN = process.env.OPENCLAW_SANDBOX_CONTROL_UI_ORIGIN || "http://127.0.0.1:18789"
|
const CONTROL_UI_ORIGIN = process.env.OPENCLAW_SANDBOX_CONTROL_UI_ORIGIN || "http://127.0.0.1:18789"
|
||||||
const CONNECT_TIMEOUT_MS = Number.parseInt(process.env.INTER_SANDBOX_CHAT_OPENCLAW_CONNECT_TIMEOUT_MS || "15000", 10)
|
const CONNECT_TIMEOUT_MS = Number.parseInt(process.env.INTER_SANDBOX_CHAT_OPENCLAW_CONNECT_TIMEOUT_MS || "15000", 10)
|
||||||
const SEND_TIMEOUT_MS = Number.parseInt(process.env.INTER_SANDBOX_CHAT_OPENCLAW_SEND_TIMEOUT_MS || "120000", 10)
|
const SEND_TIMEOUT_MS = Number.parseInt(process.env.INTER_SANDBOX_CHAT_OPENCLAW_SEND_TIMEOUT_MS || "120000", 10)
|
||||||
@@ -28,6 +28,13 @@ const OPENSHELL_BIN = firstExisting([
|
|||||||
"/usr/local/bin/openshell",
|
"/usr/local/bin/openshell",
|
||||||
"/opt/homebrew/bin/openshell",
|
"/opt/homebrew/bin/openshell",
|
||||||
], "openshell")
|
], "openshell")
|
||||||
|
const NEMOCLAW_BIN = firstExisting([
|
||||||
|
process.env.NEMOCLAW_BIN,
|
||||||
|
path.join(os.homedir(), ".local/bin/nemoclaw"),
|
||||||
|
path.join(os.homedir(), ".nemoclaw/source/bin/nemoclaw.js"),
|
||||||
|
"/usr/local/bin/nemoclaw",
|
||||||
|
"/opt/homebrew/bin/nemoclaw",
|
||||||
|
], "nemoclaw")
|
||||||
|
|
||||||
function cleanText(value, fallback = "") {
|
function cleanText(value, fallback = "") {
|
||||||
return String(value ?? fallback).trim()
|
return String(value ?? fallback).trim()
|
||||||
@@ -54,13 +61,16 @@ function getDashboardPort(sandboxName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildSandboxSshArgs(sandboxName, extraArgs) {
|
function buildSandboxSshArgs(sandboxName, extraArgs) {
|
||||||
|
const gatewayOption = OPENSHELL_GATEWAY
|
||||||
|
? ` --gateway-name ${JSON.stringify(OPENSHELL_GATEWAY)}`
|
||||||
|
: ""
|
||||||
return [
|
return [
|
||||||
"-o", "BatchMode=yes",
|
"-o", "BatchMode=yes",
|
||||||
"-o", "StrictHostKeyChecking=no",
|
"-o", "StrictHostKeyChecking=no",
|
||||||
"-o", "UserKnownHostsFile=/dev/null",
|
"-o", "UserKnownHostsFile=/dev/null",
|
||||||
"-o", "GlobalKnownHostsFile=/dev/null",
|
"-o", "GlobalKnownHostsFile=/dev/null",
|
||||||
"-o", "LogLevel=ERROR",
|
"-o", "LogLevel=ERROR",
|
||||||
"-o", `ProxyCommand=${OPENSHELL_BIN} ssh-proxy --gateway-name ${OPENSHELL_GATEWAY} --name ${sandboxName}`,
|
"-o", `ProxyCommand=${OPENSHELL_BIN} ssh-proxy${gatewayOption} --name ${sandboxName}`,
|
||||||
`sandbox@openshell-${sandboxName}`,
|
`sandbox@openshell-${sandboxName}`,
|
||||||
...extraArgs,
|
...extraArgs,
|
||||||
]
|
]
|
||||||
@@ -99,12 +109,17 @@ async function waitForPort(port, timeoutMs = 8000) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function ensureRemoteDashboard(sandboxName) {
|
async function ensureRemoteDashboard(sandboxName) {
|
||||||
const command = [
|
try {
|
||||||
`curl -fsS --max-time 2 http://127.0.0.1:${REMOTE_DASHBOARD_PORT}/ >/dev/null 2>&1`,
|
await execSandboxSsh(sandboxName, `curl -fsS --max-time 2 http://127.0.0.1:${REMOTE_DASHBOARD_PORT}/ >/dev/null`, 5000)
|
||||||
"||",
|
return true
|
||||||
`(nohup /usr/local/bin/openclaw gateway run --allow-unconfigured --bind loopback --port ${REMOTE_DASHBOARD_PORT} >/tmp/gateway.log 2>&1 &)`,
|
} catch {
|
||||||
].join(" ")
|
await execFileAsync(NEMOCLAW_BIN, ["sandbox", "gateway", "restart", sandboxName], {
|
||||||
await execSandboxSsh(sandboxName, command, 15000).catch(() => null)
|
timeout: 90000,
|
||||||
|
maxBuffer: 8 * 1024 * 1024,
|
||||||
|
env: process.env,
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function ensureDashboardTunnel(sandboxName, port) {
|
async function ensureDashboardTunnel(sandboxName, port) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ const brokerMcpRoutePath = path.join(root, 'app/api/mcp/broker/mcp/route.ts')
|
|||||||
const sandboxMcpRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/mcp/route.ts')
|
const sandboxMcpRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/mcp/route.ts')
|
||||||
const brokerUrlPath = path.join(root, 'app/lib/mcpBrokerUrl.ts')
|
const brokerUrlPath = path.join(root, 'app/lib/mcpBrokerUrl.ts')
|
||||||
const sandboxOpenClawMcpConfigPath = path.join(root, 'app/lib/sandboxOpenClawMcpConfig.ts')
|
const sandboxOpenClawMcpConfigPath = path.join(root, 'app/lib/sandboxOpenClawMcpConfig.ts')
|
||||||
|
const openClawNativeConfigPath = path.join(root, 'app/lib/openClawNativeConfig.ts')
|
||||||
const sandboxPermissionsPath = path.join(root, 'app/lib/sandboxPermissions.ts')
|
const sandboxPermissionsPath = path.join(root, 'app/lib/sandboxPermissions.ts')
|
||||||
const preflightLibPath = path.join(root, 'app/lib/mcpPreflight.ts')
|
const preflightLibPath = path.join(root, 'app/lib/mcpPreflight.ts')
|
||||||
const preflightRepairLibPath = path.join(root, 'app/lib/mcpPreflightRepair.ts')
|
const preflightRepairLibPath = path.join(root, 'app/lib/mcpPreflightRepair.ts')
|
||||||
@@ -43,7 +44,7 @@ const interSandboxChatPath = path.join(root, 'scripts/inter-sandbox-chat-mcp.mjs
|
|||||||
const interSandboxChatOpenClawDispatchPath = path.join(root, 'scripts/inter-sandbox-chat-openclaw-dispatch.mjs')
|
const interSandboxChatOpenClawDispatchPath = path.join(root, 'scripts/inter-sandbox-chat-openclaw-dispatch.mjs')
|
||||||
const interSandboxChatSidecarPath = path.join(root, 'scripts/inter-sandbox-chat-sidecar.mjs')
|
const interSandboxChatSidecarPath = path.join(root, 'scripts/inter-sandbox-chat-sidecar.mjs')
|
||||||
|
|
||||||
const [storeSource, brokerStoreSource, brokerClientSource, brokerProtocolSource, sandboxAutoSyncSource, manifestSource, privilegedFilesSource, routeSource, uploadRouteSource, preflightRouteSource, healthRouteSource, registryRouteSource, registriesRouteSource, registriesAssistRouteSource, installAssistRouteSource, registryStoreSource, inferenceModelSource, brokerCapabilitiesRouteSource, brokerCallRouteSource, brokerMcpRouteSource, sandboxMcpRouteSource, brokerUrlSource, sandboxOpenClawMcpConfigSource, sandboxPermissionsSource, preflightLibSource, preflightRepairLibSource, mcpServerSpecsSource, middlewareSource, panelSource, helpSource, sidebarSource, sandboxListSource, pageSource, interSandboxChatCoreSource, interSandboxChatSource, interSandboxChatOpenClawDispatchSource, interSandboxChatSidecarSource, serverSource] = await Promise.all([
|
const [storeSource, brokerStoreSource, brokerClientSource, brokerProtocolSource, sandboxAutoSyncSource, manifestSource, privilegedFilesSource, routeSource, uploadRouteSource, preflightRouteSource, healthRouteSource, registryRouteSource, registriesRouteSource, registriesAssistRouteSource, installAssistRouteSource, registryStoreSource, inferenceModelSource, brokerCapabilitiesRouteSource, brokerCallRouteSource, brokerMcpRouteSource, sandboxMcpRouteSource, brokerUrlSource, sandboxOpenClawMcpConfigSource, openClawNativeConfigSource, sandboxPermissionsSource, preflightLibSource, preflightRepairLibSource, mcpServerSpecsSource, middlewareSource, panelSource, helpSource, sidebarSource, sandboxListSource, pageSource, interSandboxChatCoreSource, interSandboxChatSource, interSandboxChatOpenClawDispatchSource, interSandboxChatSidecarSource, serverSource] = await Promise.all([
|
||||||
readFile(storePath, 'utf8'),
|
readFile(storePath, 'utf8'),
|
||||||
readFile(brokerStorePath, 'utf8'),
|
readFile(brokerStorePath, 'utf8'),
|
||||||
readFile(brokerClientPath, 'utf8'),
|
readFile(brokerClientPath, 'utf8'),
|
||||||
@@ -67,6 +68,7 @@ const [storeSource, brokerStoreSource, brokerClientSource, brokerProtocolSource,
|
|||||||
readFile(sandboxMcpRoutePath, 'utf8'),
|
readFile(sandboxMcpRoutePath, 'utf8'),
|
||||||
readFile(brokerUrlPath, 'utf8'),
|
readFile(brokerUrlPath, 'utf8'),
|
||||||
readFile(sandboxOpenClawMcpConfigPath, 'utf8'),
|
readFile(sandboxOpenClawMcpConfigPath, 'utf8'),
|
||||||
|
readFile(openClawNativeConfigPath, 'utf8'),
|
||||||
readFile(sandboxPermissionsPath, 'utf8'),
|
readFile(sandboxPermissionsPath, 'utf8'),
|
||||||
readFile(preflightLibPath, 'utf8'),
|
readFile(preflightLibPath, 'utf8'),
|
||||||
readFile(preflightRepairLibPath, 'utf8'),
|
readFile(preflightRepairLibPath, 'utf8'),
|
||||||
@@ -140,6 +142,8 @@ assert.match(interSandboxChatOpenClawDispatchSource, /WebSocket/, 'Inter-Sandbox
|
|||||||
assert.match(interSandboxChatOpenClawDispatchSource, /openclaw\.json/, 'Inter-Sandbox Chat OpenClaw dispatch must read the sandbox gateway token from OpenClaw config')
|
assert.match(interSandboxChatOpenClawDispatchSource, /openclaw\.json/, 'Inter-Sandbox Chat OpenClaw dispatch must read the sandbox gateway token from OpenClaw config')
|
||||||
assert.match(interSandboxChatOpenClawDispatchSource, /ssh-proxy/, 'Inter-Sandbox Chat OpenClaw dispatch must route through the OpenShell sandbox SSH proxy')
|
assert.match(interSandboxChatOpenClawDispatchSource, /ssh-proxy/, 'Inter-Sandbox Chat OpenClaw dispatch must route through the OpenShell sandbox SSH proxy')
|
||||||
assert.match(interSandboxChatOpenClawDispatchSource, /OPENCLAW_SANDBOX_DASHBOARD_PORT_BASE/, 'Inter-Sandbox Chat OpenClaw dispatch must share controller sandbox dashboard port mapping')
|
assert.match(interSandboxChatOpenClawDispatchSource, /OPENCLAW_SANDBOX_DASHBOARD_PORT_BASE/, 'Inter-Sandbox Chat OpenClaw dispatch must share controller sandbox dashboard port mapping')
|
||||||
|
assert.match(interSandboxChatOpenClawDispatchSource, /NEMOCLAW_BIN[\s\S]*\["sandbox", "gateway", "restart", sandboxName\]/, 'Inter-Sandbox Chat dashboard recovery must use NemoClaw native agent lifecycle')
|
||||||
|
assert.doesNotMatch(interSandboxChatOpenClawDispatchSource, /\/usr\/local\/bin\/openclaw gateway run/, 'Inter-Sandbox Chat must not manually launch OpenClaw in a managed sandbox')
|
||||||
assert.match(serverSource, /inter-sandbox-chat-sidecar\.mjs/, 'OpenShell controller must start the Inter-Sandbox Chat sidecar with the server')
|
assert.match(serverSource, /inter-sandbox-chat-sidecar\.mjs/, 'OpenShell controller must start the Inter-Sandbox Chat sidecar with the server')
|
||||||
assert.match(serverSource, /INTER_SANDBOX_CHAT_SIDECAR_AUTOSTART/, 'OpenShell controller must let operators disable the chat sidecar autostart')
|
assert.match(serverSource, /INTER_SANDBOX_CHAT_SIDECAR_AUTOSTART/, 'OpenShell controller must let operators disable the chat sidecar autostart')
|
||||||
assert.match(brokerProtocolSource, /tools\/list/, 'MCP broker protocol adapter must expose an MCP tools/list JSON-RPC method')
|
assert.match(brokerProtocolSource, /tools\/list/, 'MCP broker protocol adapter must expose an MCP tools/list JSON-RPC method')
|
||||||
@@ -184,10 +188,14 @@ assert.match(brokerUrlSource, /if \(!shouldUseProxyWrappedBrokerUrl\(\)\) return
|
|||||||
assert.match(brokerUrlSource, /discoverSandboxProxyOrigin/, 'Sandbox MCP broker handoff must discover each sandbox proxy endpoint')
|
assert.match(brokerUrlSource, /discoverSandboxProxyOrigin/, 'Sandbox MCP broker handoff must discover each sandbox proxy endpoint')
|
||||||
assert.match(brokerUrlSource, /HTTP_PROXY/, 'Sandbox MCP broker handoff must derive the proxy endpoint from sandbox environment')
|
assert.match(brokerUrlSource, /HTTP_PROXY/, 'Sandbox MCP broker handoff must derive the proxy endpoint from sandbox environment')
|
||||||
assert.match(brokerUrlSource, /FALLBACK_SANDBOX_PROXY_ORIGIN/, 'Sandbox MCP broker handoff may keep a fallback for older OpenShell layouts')
|
assert.match(brokerUrlSource, /FALLBACK_SANDBOX_PROXY_ORIGIN/, 'Sandbox MCP broker handoff may keep a fallback for older OpenShell layouts')
|
||||||
assert.match(sandboxOpenClawMcpConfigSource, /mcp\.servers = servers/, 'Sandbox MCP sync must write mcp.servers into OpenClaw config')
|
assert.match(sandboxOpenClawMcpConfigSource, /writeNativeOpenClawConfigPatch/, 'Sandbox MCP sync must use OpenClaw native config ownership')
|
||||||
|
assert.match(openClawNativeConfigSource, /"openclaw",[\s\S]*"config",[\s\S]*"patch",[\s\S]*"--stdin"/, 'OpenClaw config helper must use the native patch stdin command')
|
||||||
|
assert.match(sandboxOpenClawMcpConfigSource, /\[OPENSHELL_CONTROL_MCP_SERVER_NAME\]: null/, 'Sandbox MCP revoke must remove only the controller-owned native config entry')
|
||||||
|
assert.doesNotMatch(sandboxOpenClawMcpConfigSource, /config-hash|cat > .*openclaw\.json|chmod .*openclaw\.json/, 'Sandbox MCP sync must not replace OpenClaw native config or recreate retired ownership metadata')
|
||||||
assert.match(sandboxOpenClawMcpConfigSource, /streamable-http/, 'OpenClaw MCP broker config must use streamable HTTP transport')
|
assert.match(sandboxOpenClawMcpConfigSource, /streamable-http/, 'OpenClaw MCP broker config must use streamable HTTP transport')
|
||||||
assert.match(sandboxOpenClawMcpConfigSource, /Authorization: `Bearer \$\{token\}`/, 'OpenClaw MCP broker config must pass the sandbox broker token as bearer auth')
|
assert.match(sandboxOpenClawMcpConfigSource, /Authorization: `Bearer \$\{token\}`/, 'OpenClaw MCP broker config must pass the sandbox broker token as bearer auth')
|
||||||
assert.match(sandboxOpenClawMcpConfigSource, /restartOpenClawGatewayIfRunning/, 'OpenClaw gateway must restart after MCP config changes')
|
assert.match(sandboxOpenClawMcpConfigSource, /restartSandboxGatewayWithNemoClaw/, 'MCP config changes must restart through NemoClaw native agent lifecycle')
|
||||||
|
assert.doesNotMatch(sandboxOpenClawMcpConfigSource, /\/proc\/[[]0-9[]][*]|openclaw gateway run/, 'MCP config changes must not kill or launch OpenClaw processes outside NemoClaw lifecycle ownership')
|
||||||
assert.match(sandboxPermissionsSource, /method: "initialize"[\s\S]*method: "POST"/, 'MCP broker network sync must probe the actual streamable HTTP POST initialize path')
|
assert.match(sandboxPermissionsSource, /method: "initialize"[\s\S]*method: "POST"/, 'MCP broker network sync must probe the actual streamable HTTP POST initialize path')
|
||||||
assert.match(sandboxPermissionsSource, /"--input-type=module"/, 'MCP broker network sync probe must support top-level await')
|
assert.match(sandboxPermissionsSource, /"--input-type=module"/, 'MCP broker network sync probe must support top-level await')
|
||||||
assert.match(sandboxPermissionsSource, /await fetch\(/, 'MCP broker network sync probe must wait for the policy-generating request')
|
assert.match(sandboxPermissionsSource, /await fetch\(/, 'MCP broker network sync probe must wait for the policy-generating request')
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ const [helperSource, healthRouteSource, restartRouteSource] = await Promise.all(
|
|||||||
readFile(restartRoutePath, 'utf8'),
|
readFile(restartRoutePath, 'utf8'),
|
||||||
])
|
])
|
||||||
|
|
||||||
assert.match(helperSource, /const NEMOCLAW_RECOVERY_MIN_VERSION = "0\.0\.37"/, 'NemoClaw doctor/recover integration must be gated behind the v0.0.37 CLI surface')
|
assert.match(helperSource, /const NEMOCLAW_LIFECYCLE_MIN_VERSION = "0\.0\.37"/, 'NemoClaw doctor/lifecycle integration must be gated behind the v0.0.37 CLI surface')
|
||||||
assert.match(helperSource, /NEMOCLAW_BIN, NODE_BIN, commandExists, hostCommandEnv/, 'NemoClaw helper must use the shared host command resolver')
|
assert.match(helperSource, /NEMOCLAW_BIN, NODE_BIN, commandExists, hostCommandEnv/, 'NemoClaw helper must use the shared host command resolver')
|
||||||
assert.match(helperSource, /parseVersion/, 'NemoClaw helper must parse CLI versions instead of assuming latest behavior')
|
assert.match(helperSource, /parseVersion/, 'NemoClaw helper must parse CLI versions instead of assuming latest behavior')
|
||||||
assert.match(helperSource, /versionGte/, 'NemoClaw helper must compare semantic versions before using newer commands')
|
assert.match(helperSource, /versionGte/, 'NemoClaw helper must compare semantic versions before using newer commands')
|
||||||
assert.match(helperSource, /export async function getNemoClawDoctorReport/, 'NemoClaw helper must expose a doctor JSON probe')
|
assert.match(helperSource, /export async function getNemoClawDoctorReport/, 'NemoClaw helper must expose a doctor JSON probe')
|
||||||
assert.match(helperSource, /\[sandboxName, "doctor", "--json"\]/, 'doctor probe must use the structured NemoClaw doctor JSON command')
|
assert.match(helperSource, /\[sandboxName, "doctor", "--json"\]/, 'doctor probe must use the structured NemoClaw doctor JSON command')
|
||||||
assert.match(helperSource, /export async function recoverSandboxWithNemoClaw/, 'NemoClaw helper must expose sandbox recovery')
|
assert.match(helperSource, /export async function restartSandboxGatewayWithNemoClaw/, 'NemoClaw helper must expose native sandbox gateway restart')
|
||||||
assert.match(helperSource, /\[sandboxName, "recover"\]/, 'sandbox recovery must use the new NemoClaw recover command')
|
assert.match(helperSource, /\["sandbox", "gateway", "restart", sandboxName\]/, 'sandbox restart must use the canonical NemoClaw native gateway restart command')
|
||||||
assert.match(helperSource, /supported: false,[\s\S]*attempted: false/, 'unsupported old NemoClaw versions must skip newer commands without failing')
|
assert.match(helperSource, /supported: false,[\s\S]*attempted: false/, 'unsupported old NemoClaw versions must skip newer commands without failing')
|
||||||
|
|
||||||
assert.match(healthRouteSource, /getNemoClawDoctorReport/, 'sandbox health must include NemoClaw doctor integration when available')
|
assert.match(healthRouteSource, /getNemoClawDoctorReport/, 'sandbox health must include NemoClaw doctor integration when available')
|
||||||
@@ -28,13 +28,9 @@ assert.match(healthRouteSource, /key: "nemoclaw-doctor"/, 'sandbox health must s
|
|||||||
assert.match(healthRouteSource, /Using OpenShell compatibility checks/, 'sandbox health must explicitly fall back for current NemoClaw versions')
|
assert.match(healthRouteSource, /Using OpenShell compatibility checks/, 'sandbox health must explicitly fall back for current NemoClaw versions')
|
||||||
assert.match(healthRouteSource, /minimumVersion/, 'sandbox health response must expose the minimum version for doctor support')
|
assert.match(healthRouteSource, /minimumVersion/, 'sandbox health response must expose the minimum version for doctor support')
|
||||||
|
|
||||||
assert.match(restartRouteSource, /recoverSandboxWithNemoClaw/, 'sandbox restart must try NemoClaw recover when supported')
|
assert.match(restartRouteSource, /restartSandboxGatewayWithNemoClaw/, 'sandbox restart must use NemoClaw native gateway restart when supported')
|
||||||
assert.ok(
|
assert.match(restartRouteSource, /restartMode: "nemoclaw-native-gateway"/, 'restart route must report the native gateway lifecycle path')
|
||||||
restartRouteSource.indexOf('recoverSandboxWithNemoClaw(sandboxName)') < restartRouteSource.indexOf('runSandboxShell(sandboxName, restartOpenClawGatewayScript()'),
|
assert.match(restartRouteSource, /did not bypass the agent-owned lifecycle boundary/, 'restart route must fail closed when native restart fails')
|
||||||
'sandbox restart must try NemoClaw recover before the legacy OpenClaw runtime restart fallback',
|
assert.doesNotMatch(restartRouteSource, /runSandboxShell|restartOpenClawGatewayScript|openclaw gateway run/, 'sandbox restart must not bypass native agent lifecycle with a manual OpenClaw process launch')
|
||||||
)
|
|
||||||
assert.match(restartRouteSource, /restartMode: "nemoclaw-recover"/, 'restart route must report when the new NemoClaw recovery path succeeds')
|
|
||||||
assert.match(restartRouteSource, /restartMode: "openclaw-runtime"/, 'restart route must retain the current OpenShell/OpenClaw runtime fallback')
|
|
||||||
assert.match(restartRouteSource, /NemoClaw recover did not complete[\s\S]*fell back/, 'restart route must report fallback when modern recovery is attempted but fails')
|
|
||||||
|
|
||||||
console.log('nemoclaw-compat-check: PASS NemoClaw old/new compatibility assertions')
|
console.log('nemoclaw-compat-check: PASS NemoClaw old/new compatibility assertions')
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import {
|
||||||
|
normalizeAgentIdentifier,
|
||||||
|
parseNemoclawListJson,
|
||||||
|
resolveSandboxAgent,
|
||||||
|
} from '../app/lib/nemoclawIdentity.mjs'
|
||||||
|
|
||||||
|
const jsonInventory = JSON.stringify({
|
||||||
|
schemaVersion: 1,
|
||||||
|
sandboxes: [
|
||||||
|
{ name: 'my-hermes', agent: 'Hermes', isDefault: true },
|
||||||
|
{ name: 'gateway-recovered', agent: 'unknown', isDefault: false },
|
||||||
|
{ name: 'custom-agent', agent: 'LangChain DeepAgents Code', isDefault: false },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
const parsed = parseNemoclawListJson(jsonInventory)
|
||||||
|
assert.ok(parsed, 'schemaVersion=1 NemoClaw JSON inventory should parse')
|
||||||
|
assert.deepEqual(parsed.defaultSandboxNames, ['my-hermes'])
|
||||||
|
assert.equal(parsed.agentsByName['my-hermes'], 'hermes')
|
||||||
|
assert.equal(parsed.agentsByName['gateway-recovered'], 'unknown')
|
||||||
|
assert.equal(parsed.agentsByName['custom-agent'], 'langchain-deepagents-code')
|
||||||
|
|
||||||
|
assert.equal(resolveSandboxAgent('my-hermes', null, parsed, null), 'hermes')
|
||||||
|
assert.equal(resolveSandboxAgent('gateway-recovered', null, parsed, null), 'unknown')
|
||||||
|
assert.equal(resolveSandboxAgent('missing-from-json', null, parsed, null), 'unknown')
|
||||||
|
|
||||||
|
assert.equal(normalizeAgentIdentifier('OpenClaw'), 'openclaw')
|
||||||
|
assert.equal(normalizeAgentIdentifier('nemohermes'), 'hermes')
|
||||||
|
assert.equal(normalizeAgentIdentifier('unknown'), 'unknown')
|
||||||
|
|
||||||
|
const legacyRegistry = {
|
||||||
|
sandboxes: {
|
||||||
|
'legacy-null-agent': { name: 'legacy-null-agent', agent: null },
|
||||||
|
'explicit-hermes': { name: 'explicit-hermes', agent: 'Hermes' },
|
||||||
|
'explicit-unknown': { name: 'explicit-unknown', agent: 'unknown' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.equal(resolveSandboxAgent('legacy-null-agent', null, null, legacyRegistry), 'openclaw')
|
||||||
|
assert.equal(resolveSandboxAgent('explicit-hermes', null, null, legacyRegistry), 'hermes')
|
||||||
|
assert.equal(resolveSandboxAgent('explicit-unknown', null, null, legacyRegistry), 'unknown')
|
||||||
|
|
||||||
|
assert.equal(parseNemoclawListJson('{'), null, 'invalid JSON must fail closed')
|
||||||
|
assert.equal(parseNemoclawListJson(JSON.stringify({ schemaVersion: 2, sandboxes: [] })), null, 'unsupported schema versions must fail closed')
|
||||||
|
|
||||||
|
console.log('nemoclaw-identity-resolution-check: PASS json identity resolution assertions')
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
|
||||||
|
import os from 'node:os'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
|
import {
|
||||||
|
discoverNemoClawRegistryFiles,
|
||||||
|
findNemoClawRegistryEntry,
|
||||||
|
listNemoClawRegistryCandidates,
|
||||||
|
} from '../app/lib/nemoclawRegistry.mjs'
|
||||||
|
|
||||||
|
const home = await mkdtemp(path.join(os.tmpdir(), 'nemoclaw-registry-roots-'))
|
||||||
|
try {
|
||||||
|
const root = path.join(home, '.nemoclaw')
|
||||||
|
await mkdir(path.join(root, 'gateways', '8990'), { recursive: true })
|
||||||
|
await mkdir(path.join(root, 'gateways', 'not-a-port'), { recursive: true })
|
||||||
|
await writeFile(path.join(root, 'sandboxes.json'), JSON.stringify({
|
||||||
|
defaultSandbox: 'base-box',
|
||||||
|
sandboxes: {
|
||||||
|
'base-box': { name: 'base-box', imageTag: 'base:image', createdAt: '2026-09-01' },
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
await writeFile(path.join(root, 'gateways', '8990', 'sandboxes.json'), JSON.stringify({
|
||||||
|
defaultSandbox: 'port-box',
|
||||||
|
sandboxes: {
|
||||||
|
'port-box': { name: 'port-box', imageTag: 'port:image', createdAt: '2026-09-02' },
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
await writeFile(path.join(root, 'gateways', 'not-a-port', 'sandboxes.json'), '{}')
|
||||||
|
|
||||||
|
const files = discoverNemoClawRegistryFiles(home)
|
||||||
|
assert.deepEqual(files, [
|
||||||
|
path.join(root, 'sandboxes.json'),
|
||||||
|
path.join(root, 'gateways', '8990', 'sandboxes.json'),
|
||||||
|
], 'registry discovery must include the default root and numeric alternate-port roots only')
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
findNemoClawRegistryEntry('port-box', home)?.entry.imageTag,
|
||||||
|
'port:image',
|
||||||
|
'quick deploy must resolve image metadata from an alternate-port registry',
|
||||||
|
)
|
||||||
|
assert.deepEqual(
|
||||||
|
listNemoClawRegistryCandidates(home),
|
||||||
|
['base-box', 'port-box'],
|
||||||
|
'defaults remain first and registered candidates are deduplicated across roots',
|
||||||
|
)
|
||||||
|
|
||||||
|
await writeFile(path.join(root, 'sandboxes.json'), JSON.stringify({
|
||||||
|
sandboxes: { duplicate: { name: 'port-box', imageTag: 'wrong:image' } },
|
||||||
|
}))
|
||||||
|
assert.throws(
|
||||||
|
() => findNemoClawRegistryEntry('port-box', home),
|
||||||
|
/multiple NemoClaw gateway registries/,
|
||||||
|
'ambiguous cross-port registrations must fail closed',
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log('nemoclaw-registry-roots-check: PASS cross-port registry resolution assertions')
|
||||||
|
} finally {
|
||||||
|
await rm(home, { recursive: true, force: true })
|
||||||
|
}
|
||||||
@@ -54,10 +54,10 @@ assert.match(installSource, /python3 -m venv "\$PROJECT_VENV"/, 'installer must
|
|||||||
assert.match(installSource, /\$venv_python" -m pip install --upgrade uv/, 'installer must install uvx into the virtual environment')
|
assert.match(installSource, /\$venv_python" -m pip install --upgrade uv/, 'installer must install uvx into the virtual environment')
|
||||||
assert.match(installSource, /set_env "OPENSHELL_CONTROL_VENV"/, 'installer must persist the virtual environment path for runtime MCP launches')
|
assert.match(installSource, /set_env "OPENSHELL_CONTROL_VENV"/, 'installer must persist the virtual environment path for runtime MCP launches')
|
||||||
|
|
||||||
assert.match(versionedInstallSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.106\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
assert.match(versionedInstallSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.116\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
||||||
assert.match(versionedInstallSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default')
|
assert.match(versionedInstallSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default')
|
||||||
assert.match(versionedInstallSource, /NEMOCLAW_SOURCE_URL="\$\{NEMOCLAW_SOURCE_URL:-https:\/\/github\.com\/NVIDIA\/NemoClaw\.git\}"/, 'versioned installer must use the NemoClaw source repository URL')
|
assert.match(versionedInstallSource, /NEMOCLAW_SOURCE_URL="\$\{NEMOCLAW_SOURCE_URL:-https:\/\/github\.com\/NVIDIA\/NemoClaw\.git\}"/, 'versioned installer must use the NemoClaw source repository URL')
|
||||||
assert.match(versionedInstallSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.7\.1\}"/, 'versioned installer must default to NemoClaw main\'s current OpenClaw build target')
|
assert.match(versionedInstallSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.9\.2\}"/, 'versioned installer must default to NemoClaw main\'s current OpenClaw build target')
|
||||||
assert.match(versionedInstallSource, /https:\/\/raw\.githubusercontent\.com\/NVIDIA\/OpenShell\/main\/install\.sh/, 'versioned installer must use the OpenShell installer URL')
|
assert.match(versionedInstallSource, /https:\/\/raw\.githubusercontent\.com\/NVIDIA\/OpenShell\/main\/install\.sh/, 'versioned installer must use the OpenShell installer URL')
|
||||||
assert.match(versionedInstallSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw from the selected git ref')
|
assert.match(versionedInstallSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw from the selected git ref')
|
||||||
assert.match(versionedInstallSource, /Requested NemoClaw install ref/, 'versioned installer must fail clearly when the selected NemoClaw ref is unavailable')
|
assert.match(versionedInstallSource, /Requested NemoClaw install ref/, 'versioned installer must fail clearly when the selected NemoClaw ref is unavailable')
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ assert.match(terminalReadinessSource, /const authority = resolveRuntimeAuthority
|
|||||||
assert.match(telemetrySource, /authoritySource: "runtimeAuthority"/, 'inventory route must declare shared authority source')
|
assert.match(telemetrySource, /authoritySource: "runtimeAuthority"/, 'inventory route must declare shared authority source')
|
||||||
assert.match(telemetrySource, /authorities: authorities\.map\(/, 'inventory route must expose per-sandbox authority metadata')
|
assert.match(telemetrySource, /authorities: authorities\.map\(/, 'inventory route must expose per-sandbox authority metadata')
|
||||||
assert.match(openshellHostSource, /const OPENSHELL_GATEWAY = process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'OpenShell host commands must not force the legacy openshell gateway when NemoClaw has selected the nemoclaw gateway')
|
assert.match(openshellHostSource, /const OPENSHELL_GATEWAY = process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'OpenShell host commands must not force the legacy openshell gateway when NemoClaw has selected the nemoclaw gateway')
|
||||||
|
assert.match(openshellHostSource, /ssh-proxy\$\{gatewayOption\}/, 'sandbox SSH proxy commands must make the explicit gateway option conditional')
|
||||||
|
assert.doesNotMatch(openshellHostSource, /ssh-proxy --gateway-name nemoclaw/, 'sandbox SSH proxy commands must not force the legacy unqualified NemoClaw gateway')
|
||||||
|
assert.match(openshellHostSource, /restartSandboxGatewayWithNemoClaw\(sandboxName\)/, 'sandbox dashboard recovery must use NemoClaw native agent lifecycle')
|
||||||
|
assert.doesNotMatch(openshellHostSource, /\/usr\/local\/bin\/openclaw gateway run/, 'sandbox dashboard recovery must not manually launch OpenClaw')
|
||||||
assert.match(sandboxHealthSource, /stripAnsi/, 'sandbox health must strip OpenShell ANSI styling before parsing fields such as Phase')
|
assert.match(sandboxHealthSource, /stripAnsi/, 'sandbox health must strip OpenShell ANSI styling before parsing fields such as Phase')
|
||||||
assert.match(openshellHostSource, /const canMintBootstrapFromCli = instance\.id === defaultInstance\.id/, 'bootstrap minting should only use CLI for the default OpenClaw instance')
|
assert.match(openshellHostSource, /const canMintBootstrapFromCli = instance\.id === defaultInstance\.id/, 'bootstrap minting should only use CLI for the default OpenClaw instance')
|
||||||
assert.match(openshellHostSource, /readSandboxOpenClawDashboardToken/, 'sandbox dashboard bootstrap must fall back to the sandbox OpenClaw token when CLI output is bare')
|
assert.match(openshellHostSource, /readSandboxOpenClawDashboardToken/, 'sandbox dashboard bootstrap must fall back to the sandbox OpenClaw token when CLI output is bare')
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const ollamaModelsRoutePath = path.join(root, 'app/api/ollama/models/route.ts')
|
|||||||
const sandboxInferenceRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/route.ts')
|
const sandboxInferenceRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/route.ts')
|
||||||
const sandboxInferenceApplyRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/apply/route.ts')
|
const sandboxInferenceApplyRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/inference/apply/route.ts')
|
||||||
const sandboxInferenceApplyLibPath = path.join(root, 'app/lib/sandboxInferenceApply.ts')
|
const sandboxInferenceApplyLibPath = path.join(root, 'app/lib/sandboxInferenceApply.ts')
|
||||||
|
const openClawNativeConfigPath = path.join(root, 'app/lib/openClawNativeConfig.ts')
|
||||||
const sandboxInferenceStorePath = path.join(root, 'app/lib/sandboxInferenceStore.ts')
|
const sandboxInferenceStorePath = path.join(root, 'app/lib/sandboxInferenceStore.ts')
|
||||||
const sandboxRestartRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/restart/route.ts')
|
const sandboxRestartRoutePath = path.join(root, 'app/api/sandbox/[sandboxId]/restart/route.ts')
|
||||||
const gatewayRepairRoutePath = path.join(root, 'app/api/openshell/gateway/repair/route.ts')
|
const gatewayRepairRoutePath = path.join(root, 'app/api/openshell/gateway/repair/route.ts')
|
||||||
@@ -24,6 +25,7 @@ const versionedInstallerPath = path.join(root, 'install_versioned_nemoclaw_opens
|
|||||||
const hookPath = path.join(root, 'app/hooks/useSandboxInventory.ts')
|
const hookPath = path.join(root, 'app/hooks/useSandboxInventory.ts')
|
||||||
const pagePath = path.join(root, 'app/page.tsx')
|
const pagePath = path.join(root, 'app/page.tsx')
|
||||||
const configPanelPath = path.join(root, 'app/components/ConfigurationPanel.tsx')
|
const configPanelPath = path.join(root, 'app/components/ConfigurationPanel.tsx')
|
||||||
|
const wizardPanelPath = path.join(root, 'app/components/WizardPanel.tsx')
|
||||||
const activityPanelPath = path.join(root, 'app/components/ActivityPanel.tsx')
|
const activityPanelPath = path.join(root, 'app/components/ActivityPanel.tsx')
|
||||||
const inferencePanelPath = path.join(root, 'app/components/InferenceEndpointPanel.tsx')
|
const inferencePanelPath = path.join(root, 'app/components/InferenceEndpointPanel.tsx')
|
||||||
const sandboxInferencePanelPath = path.join(root, 'app/components/SandboxInferencePanel.tsx')
|
const sandboxInferencePanelPath = path.join(root, 'app/components/SandboxInferencePanel.tsx')
|
||||||
@@ -45,6 +47,7 @@ const ollamaModelsRouteSource = await readFile(ollamaModelsRoutePath, 'utf8')
|
|||||||
const sandboxInferenceRouteSource = await readFile(sandboxInferenceRoutePath, 'utf8')
|
const sandboxInferenceRouteSource = await readFile(sandboxInferenceRoutePath, 'utf8')
|
||||||
const sandboxInferenceApplyRouteSource = await readFile(sandboxInferenceApplyRoutePath, 'utf8')
|
const sandboxInferenceApplyRouteSource = await readFile(sandboxInferenceApplyRoutePath, 'utf8')
|
||||||
const sandboxInferenceApplyLibSource = await readFile(sandboxInferenceApplyLibPath, 'utf8')
|
const sandboxInferenceApplyLibSource = await readFile(sandboxInferenceApplyLibPath, 'utf8')
|
||||||
|
const openClawNativeConfigSource = await readFile(openClawNativeConfigPath, 'utf8')
|
||||||
const sandboxInferenceStoreSource = await readFile(sandboxInferenceStorePath, 'utf8')
|
const sandboxInferenceStoreSource = await readFile(sandboxInferenceStorePath, 'utf8')
|
||||||
const sandboxRestartRouteSource = await readFile(sandboxRestartRoutePath, 'utf8')
|
const sandboxRestartRouteSource = await readFile(sandboxRestartRoutePath, 'utf8')
|
||||||
const gatewayRepairRouteSource = await readFile(gatewayRepairRoutePath, 'utf8')
|
const gatewayRepairRouteSource = await readFile(gatewayRepairRoutePath, 'utf8')
|
||||||
@@ -53,6 +56,7 @@ const versionedInstallerSource = await readFile(versionedInstallerPath, 'utf8')
|
|||||||
const hookSource = await readFile(hookPath, 'utf8')
|
const hookSource = await readFile(hookPath, 'utf8')
|
||||||
const pageSource = await readFile(pagePath, 'utf8')
|
const pageSource = await readFile(pagePath, 'utf8')
|
||||||
const configPanelSource = await readFile(configPanelPath, 'utf8')
|
const configPanelSource = await readFile(configPanelPath, 'utf8')
|
||||||
|
const wizardPanelSource = await readFile(wizardPanelPath, 'utf8')
|
||||||
const activityPanelSource = await readFile(activityPanelPath, 'utf8')
|
const activityPanelSource = await readFile(activityPanelPath, 'utf8')
|
||||||
const inferencePanelSource = await readFile(inferencePanelPath, 'utf8')
|
const inferencePanelSource = await readFile(inferencePanelPath, 'utf8')
|
||||||
const sandboxInferencePanelSource = await readFile(sandboxInferencePanelPath, 'utf8')
|
const sandboxInferencePanelSource = await readFile(sandboxInferencePanelPath, 'utf8')
|
||||||
@@ -94,6 +98,8 @@ assert.match(createRouteSource, /mode === "none"[\s\S]*return \["--no-gpu"\]/, '
|
|||||||
assert.match(createRouteSource, /openShellGpuArgs\(mode: CreateGpuMode\)/, 'OpenShell create paths must share GPU request handling')
|
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.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, /NEMOCLAW_SANDBOX_NAME: sandboxName/, 'blueprint create must pass the requested sandbox name to NemoClaw onboarding')
|
||||||
|
assert.match(createRouteSource, /name\.length > 19/, 'create API must enforce NemoClaw\'s 19-character routed sandbox-name limit')
|
||||||
|
assert.match(createRouteSource, /\^\(\?!\.\*--\)\[a-z\]/, 'create API must require a leading lowercase letter and reject consecutive hyphens')
|
||||||
assert.match(createRouteSource, /id: "redeploy-image"/, 'create API must expose image redeploy as a sandbox creation path')
|
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: "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, /label: "Fresh NemoClaw Image"/, 'full rebuild path must be labeled as fresh image creation')
|
||||||
@@ -102,7 +108,7 @@ assert.match(createRouteSource, /label: "Fresh Hermes Sandbox"/, 'Hermes sandbox
|
|||||||
assert.match(createRouteSource, /source: "~\/NemoClaw\/agents\/hermes\/Dockerfile"/, 'Hermes sandbox creation must point at the upstream Hermes agent source')
|
assert.match(createRouteSource, /source: "~\/NemoClaw\/agents\/hermes\/Dockerfile"/, 'Hermes sandbox creation must point at the upstream Hermes agent source')
|
||||||
assert.match(createRouteSource, /id: "nemoclaw-deepagents-code"/, 'create API must expose Deep Agents Code sandbox creation')
|
assert.match(createRouteSource, /id: "nemoclaw-deepagents-code"/, 'create API must expose Deep Agents Code sandbox creation')
|
||||||
assert.match(createRouteSource, /source: "~\/NemoClaw\/agents\/langchain-deepagents-code\/manifest\.yaml"/, 'Deep Agents Code sandbox creation must point at the upstream agent manifest')
|
assert.match(createRouteSource, /source: "~\/NemoClaw\/agents\/langchain-deepagents-code\/manifest\.yaml"/, 'Deep Agents Code sandbox creation must point at the upstream agent manifest')
|
||||||
assert.match(createRouteSource, /readNemoClawRegistry/, 'image redeploy must discover the default NemoClaw sandbox image automatically')
|
assert.match(createRouteSource, /findNemoClawRegistryEntry/, 'image redeploy must discover NemoClaw sandbox images across default and alternate-port registries')
|
||||||
assert.match(createRouteSource, /listOpenShellSandboxNames/, 'image redeploy must fall back to live OpenShell inventory when registry entries are stale')
|
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')
|
assert.match(createRouteSource, /resolveSourcePodImage\(sourceSandboxName, sandboxName\)/, 'image redeploy must allow optional explicit source while defaulting automatically')
|
||||||
assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must pass the resolved image to openshell sandbox create')
|
assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must pass the resolved image to openshell sandbox create')
|
||||||
@@ -110,7 +116,7 @@ assert.match(createRouteSource, /registryEntry\?\.imageTag\?\.trim\(\)/, 'image
|
|||||||
assert.doesNotMatch(createRouteSource, /OPENSHELL_CLUSTER_CONTAINER|readPodImage|"kubectl"/, 'image redeploy must not depend on obsolete cluster containers or in-container kubectl')
|
assert.doesNotMatch(createRouteSource, /OPENSHELL_CLUSTER_CONTAINER|readPodImage|"kubectl"/, 'image redeploy must not depend on obsolete cluster containers or in-container kubectl')
|
||||||
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
|
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
|
||||||
assert.match(createRouteSource, /skippedNemoClawImageRedeployRegistration/, 'image redeploy must report that NemoClaw registry registration was deliberately skipped')
|
assert.match(createRouteSource, /skippedNemoClawImageRedeployRegistration/, 'image redeploy must report that NemoClaw registry registration was deliberately skipped')
|
||||||
assert.match(createRouteSource, /lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely/, 'image redeploy must explain why direct NemoClaw registry writes are unsafe')
|
assert.match(createRouteSource, /lifecycle identity, workload provenance, and agent-specific state that only NemoClaw can issue safely/, 'image redeploy must explain why direct NemoClaw registry writes are unsafe')
|
||||||
assert.doesNotMatch(createRouteSource, /function registerNemoClawImageRedeploy|writeFileSync\(tempPath|renameSync\(tempPath/, 'image redeploy must not forge current NemoClaw registry entries by copying source-bound authority receipts')
|
assert.doesNotMatch(createRouteSource, /function registerNemoClawImageRedeploy|writeFileSync\(tempPath|renameSync\(tempPath/, 'image redeploy must not forge current NemoClaw registry entries by copying source-bound authority receipts')
|
||||||
assert.match(createRouteSource, /readyVerification\?: SandboxVerification/, 'ready-aware create command must carry the authoritative verification result')
|
assert.match(createRouteSource, /readyVerification\?: SandboxVerification/, 'ready-aware create command must carry the authoritative verification result')
|
||||||
assert.match(createRouteSource, /readyVerification: verification/, 'ready-aware create command must return the verification that proved readiness')
|
assert.match(createRouteSource, /readyVerification: verification/, 'ready-aware create command must return the verification that proved readiness')
|
||||||
@@ -124,36 +130,15 @@ assert.match(createRouteSource, /NEMOCLAW_ENDPOINT_URL = settings\.endpointUrl/,
|
|||||||
assert.match(createRouteSource, /COMPATIBLE_API_KEY = apiKey \|\| "dummy"/, 'OpenAI-compatible onboarding must pass COMPATIBLE_API_KEY or a no-auth placeholder')
|
assert.match(createRouteSource, /COMPATIBLE_API_KEY = apiKey \|\| "dummy"/, 'OpenAI-compatible onboarding must pass COMPATIBLE_API_KEY or a no-auth placeholder')
|
||||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER_KEY = env\.COMPATIBLE_API_KEY/, 'OpenAI-compatible onboarding must bridge the provider key without printing secrets')
|
assert.match(createRouteSource, /NEMOCLAW_PROVIDER_KEY = env\.COMPATIBLE_API_KEY/, 'OpenAI-compatible onboarding must bridge the provider key without printing secrets')
|
||||||
assert.match(createRouteSource, /Hosted NVIDIA Build onboarding requires an nvapi-\*/, 'blueprint create must reject non-nvapi keys for the hosted NVIDIA build provider')
|
assert.match(createRouteSource, /Hosted NVIDIA Build onboarding requires an nvapi-\*/, 'blueprint create must reject non-nvapi keys for the hosted NVIDIA build provider')
|
||||||
assert.match(versionedInstallerSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.106\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
assert.match(versionedInstallerSource, /OPENSHELL_VERSION="\$\{OPENSHELL_VERSION:-v0\.0\.116\}"/, 'versioned installer must default to the OpenShell release supported by current NemoClaw main')
|
||||||
assert.match(versionedInstallerSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default while preserving the legacy tag override')
|
assert.match(versionedInstallerSource, /NEMOCLAW_INSTALL_REF="\$\{NEMOCLAW_INSTALL_REF:-\$\{NEMOCLAW_INSTALL_TAG:-main\}\}"/, 'versioned installer must track the current NemoClaw main ref by default while preserving the legacy tag override')
|
||||||
assert.match(versionedInstallerSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.7\.1\}"/, 'versioned installer must pin the current NemoClaw-compatible OpenClaw base image version')
|
assert.match(versionedInstallerSource, /OPENCLAW_VERSION="\$\{OPENCLAW_VERSION:-2026\.9\.2\}"/, 'versioned installer must pin the current NemoClaw-compatible OpenClaw base image version')
|
||||||
assert.match(versionedInstallerSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw by git ref so branch heads and tags both work')
|
assert.match(versionedInstallerSource, /git -C "\$source_dir" fetch[\s\S]*"\$NEMOCLAW_INSTALL_REF"/, 'versioned installer must fetch NemoClaw by git ref so branch heads and tags both work')
|
||||||
assert.match(versionedInstallerSource, /docker build[\s\S]*Dockerfile\.base[\s\S]*--build-arg "OPENCLAW_VERSION=\$OPENCLAW_VERSION"[\s\S]*"\$source_dir"/, 'versioned installer must rebuild the stock NemoClaw base image with the pinned OpenClaw version')
|
assert.match(versionedInstallerSource, /docker build[\s\S]*Dockerfile\.base[\s\S]*--build-arg "OPENCLAW_VERSION=\$OPENCLAW_VERSION"[\s\S]*"\$source_dir"/, 'versioned installer must rebuild the stock NemoClaw base image with the pinned OpenClaw version')
|
||||||
assert.doesNotMatch(createRouteSource, /repairOpenClawRuntimePolicy|runtimePolicyRepair/, 'sandbox create must not mutate OpenShell filesystem policy for OpenClaw')
|
assert.doesNotMatch(createRouteSource, /repairOpenClawRuntimePolicy|runtimePolicyRepair/, 'sandbox create must not mutate OpenShell filesystem policy for OpenClaw')
|
||||||
assert.doesNotMatch(createRouteSource, /stabilizeOpenClawGatewayConfig|gatewayConfigRepair|repairOpenClawWorkspacePermissions|workspaceRepair/, 'sandbox create must not patch OpenClaw internals after the Monday rollback')
|
assert.doesNotMatch(createRouteSource, /stabilizeOpenClawGatewayConfig|gatewayConfigRepair|repairOpenClawWorkspacePermissions|workspaceRepair|repairOpenClawExecApprovalsFile|execApprovalsRepair/, 'sandbox create must not patch OpenClaw internals owned by current NemoClaw images')
|
||||||
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.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.doesNotMatch(sandboxPrivilegedFilesSource, /exec-approvals\.json|openclaw gateway run|plugins\.entries\.bonjour|\.openclaw-data/, 'privileged file helper must not recreate retired OpenClaw state or bypass NemoClaw lifecycle ownership')
|
||||||
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')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /openclaw gateway run/, 'gateway config stabilization must restart the OpenClaw gateway')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"workspace"/, 'workspace repair must target the OpenClaw workspace directory')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /\/sandbox\/\.openclaw-data\/\$dir/, 'workspace repair must use the policy-writable OpenClaw data tree')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /ln -sfn/, 'workspace repair must link the OpenClaw workspace path into writable storage')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"flows"/, 'workspace repair must include the stock NemoClaw flows symlink')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"plugin-runtime-deps"/, 'workspace repair must include the OpenClaw plugin runtime dependency directory')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"update-check\.json"/, 'workspace repair must include the stock NemoClaw update-check symlink')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /exec-approvals\.json/, 'workspace repair must include exec approval state handling')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /const mutableFiles = \[\s*"update-check\.json",\s*\]/, 'workspace repair must not leave exec approvals in the symlinked mutable files list for newer OpenClaw')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /chmod 0600 \/sandbox\/\.openclaw\/exec-approvals\.json/, 'workspace repair must make exec approvals a real writable file for newer OpenClaw')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /chown -R sandbox:sandbox \/sandbox\/\.openclaw-data/, 'workspace repair must restore stock NemoClaw ownership for OpenClaw data')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /AGENTS\.md/, 'workspace repair note must document the AGENTS.md permission failure it prevents')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"agents"/, 'workspace repair must target the OpenClaw agent directory so sessions are writable through .openclaw-data')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /"agents"[\s\S]*"workspace"[\s\S]*"memory"/, 'workspace repair must cover NemoClaw expected OpenClaw mutable symlink directories')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /sessions\.json\.lock|session lock/, 'workspace repair note must document the sessions.json.lock permission failure it prevents')
|
|
||||||
assert.match(sandboxPrivilegedFilesSource, /bundled OpenClaw expects/, 'workspace repair note must document the dashboard reconciles to the bundled OpenClaw expectations')
|
|
||||||
|
|
||||||
assert.match(hookSource, /type RefreshOptions = \{\s*force\?: boolean\s*\}/, 'inventory refresh must accept a force option')
|
assert.match(hookSource, /type RefreshOptions = \{\s*force\?: boolean\s*\}/, 'inventory refresh must accept a force option')
|
||||||
assert.match(hookSource, /!refreshOptions\?\.force && inFlightRef\.current/, 'forced inventory refresh must bypass existing in-flight reads')
|
assert.match(hookSource, /!refreshOptions\?\.force && inFlightRef\.current/, 'forced inventory refresh must bypass existing in-flight reads')
|
||||||
@@ -168,7 +153,7 @@ assert.match(deleteRouteSource, /workspace-\*/, 'persistent state wipe must incl
|
|||||||
assert.match(pageSource, /JSON\.stringify\(\{ sandboxName, agent: sandbox\?\.agent \|\| 'openclaw' \}\)/, 'destroy workflow must pass the selected NemoClaw agent to delete state cleanup')
|
assert.match(pageSource, /JSON\.stringify\(\{ sandboxName, agent: sandbox\?\.agent \|\| 'openclaw' \}\)/, 'destroy workflow must pass the selected NemoClaw agent to delete state cleanup')
|
||||||
assert.match(deleteRouteSource, /validateSandboxName/, 'delete route must validate sandbox names before execution')
|
assert.match(deleteRouteSource, /validateSandboxName/, 'delete route must validate sandbox names before execution')
|
||||||
assert.match(deleteRouteSource, /resolveSandboxRef/, 'delete route must resolve sandbox ids to names before deleting')
|
assert.match(deleteRouteSource, /resolveSandboxRef/, 'delete route must resolve sandbox ids to names before deleting')
|
||||||
assert.match(deleteRouteSource, /OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY \|\| "nemoclaw"/, 'delete route must use the NemoClaw gateway context')
|
assert.match(deleteRouteSource, /OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'delete route must preserve an explicit gateway without forcing the legacy NemoClaw name')
|
||||||
assert.match(hostCommandsSource, /export function hostCommandEnv/, 'host commands must provide a shared environment for OpenShell child processes')
|
assert.match(hostCommandsSource, /export function hostCommandEnv/, 'host commands must provide a shared environment for OpenShell child processes')
|
||||||
assert.match(hostCommandsSource, /XDG_CONFIG_HOME/, 'shared host command environment must preserve the OpenShell config home')
|
assert.match(hostCommandsSource, /XDG_CONFIG_HOME/, 'shared host command environment must preserve the OpenShell config home')
|
||||||
assert.match(hostCommandsSource, /export function openshellGatewayAddressEnv/, 'shared host command environment must expose gateway address override variables')
|
assert.match(hostCommandsSource, /export function openshellGatewayAddressEnv/, 'shared host command environment must expose gateway address override variables')
|
||||||
@@ -179,9 +164,9 @@ assert.match(hostCommandsSource, /gateway\.json/, 'shared host command environme
|
|||||||
assert.match(hostCommandsSource, /config\.json/, 'shared host command environment must also support the general OpenShell config file')
|
assert.match(hostCommandsSource, /config\.json/, 'shared host command environment must also support the general OpenShell config file')
|
||||||
assert.match(hostCommandsSource, /gatewayHost/, 'OpenShell gateway address config must support a top-level gatewayHost key')
|
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(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, /const env: NodeJS\.ProcessEnv = hostCommandEnv\(\{[\s\S]*NEMOCLAW_SANDBOX_NAME: sandboxName[\s\S]*OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'NemoClaw onboard must preserve an explicit gateway while allowing NemoClaw to select its port-qualified gateway')
|
||||||
assert.match(createRouteSource, /NEMOCLAW_AGENT: agent/, 'NemoClaw onboard must receive the selected dashboard agent')
|
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, /env: hostCommandEnv\(\{[\s\S]*OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'delete route must pass the shared host command environment without forcing a gateway')
|
||||||
assert.match(deleteRouteSource, /waitForSandboxDeleted/, 'delete route must poll authoritative inventory until the sandbox is gone')
|
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')
|
assert.doesNotMatch(deleteRouteSource, /cleanupNemoClawSandbox/, 'delete route must not run NemoClaw destroy cleanup after OpenShell deletion')
|
||||||
assert.doesNotMatch(deleteRouteSource, /isNemoClawSandboxNotRegistered/, 'delete route must not keep NemoClaw registry cleanup helpers')
|
assert.doesNotMatch(deleteRouteSource, /isNemoClawSandboxNotRegistered/, 'delete route must not keep NemoClaw registry cleanup helpers')
|
||||||
@@ -190,7 +175,7 @@ assert.doesNotMatch(deleteRouteSource, /Pruned NemoClaw registry entry without d
|
|||||||
assert.match(deleteRouteSource, /openShellAlreadyGone/, 'delete route must tolerate sandboxes that OpenShell already deleted while NemoClaw still has registry state')
|
assert.match(deleteRouteSource, /openShellAlreadyGone/, 'delete route must tolerate sandboxes that OpenShell already deleted while NemoClaw still has registry state')
|
||||||
assert.doesNotMatch(deleteRouteSource, /isGatewayRecoverable|recoverableGateway/, 'delete route must not include the later gateway-repair branching')
|
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, /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, /names\.length > 0[\s\S]*execNemoclaw\(\["status"\]\)[\s\S]*execNemoclaw\(\["list", "--json"\]\)/, 'telemetry must skip NemoClaw list/status when OpenShell reports zero live sandboxes and prefer nemoclaw list --json when sandboxes exist')
|
||||||
assert.match(telemetryRouteSource, /readNemoClawRegistry/, 'telemetry must read the NemoClaw registry for agent metadata')
|
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, /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(telemetryRouteSource, /"nemoclaw\.ai\/agent": agent/, 'telemetry pod labels must include the selected NemoClaw agent')
|
||||||
@@ -200,7 +185,7 @@ assert.match(sandboxListSource, /function displaySandboxAgent\(agent\?: string\)
|
|||||||
assert.match(sandboxListSource, /function SandboxTypeLogo\(\{ agent \}/, 'sandbox list must render per-agent sandbox logos')
|
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 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 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.match(sandboxListSource, /const logoSrc = isHermes \? HERMES_SANDBOX_LOGO : isOpenClaw \? OPENCLAW_SANDBOX_LOGO : null/, 'sandbox type logo must avoid misclassifying unknown agents as OpenClaw')
|
||||||
assert.ok(openClawLogoStat.size > 0, 'OpenClaw favicon asset must be vendored locally')
|
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.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, /selectedSandbox\?\.agent === 'hermes'/, 'sandbox operations must detect Hermes sandboxes')
|
||||||
@@ -297,17 +282,21 @@ assert.match(sandboxInferencePanelSource, /\/api\/sandbox\/\$\{encodeURIComponen
|
|||||||
assert.match(sandboxInferencePanelSource, /\/api\/ollama\/models/, 'selected sandbox UI must offer Ollama model selection')
|
assert.match(sandboxInferencePanelSource, /\/api\/ollama\/models/, 'selected sandbox UI must offer Ollama model selection')
|
||||||
assert.match(sandboxInferencePanelSource, /Enabled Routes/, 'selected sandbox UI must show multiple enabled inference routes')
|
assert.match(sandboxInferencePanelSource, /Enabled Routes/, 'selected sandbox UI must show multiple enabled inference routes')
|
||||||
assert.match(sandboxInferencePanelSource, /Add Route/, 'selected sandbox UI must allow adding provider/model routes')
|
assert.match(sandboxInferencePanelSource, /Add Route/, 'selected sandbox UI must allow adding provider/model routes')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /\/sandbox\/\.openclaw\/openclaw\.json/, 'live apply must patch OpenClaw config inside the running sandbox')
|
assert.match(sandboxInferenceApplyLibSource, /writeNativeOpenClawConfigPatch/, 'live apply must use OpenClaw native config ownership')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /sha256sum \/sandbox\/\.openclaw\/openclaw\.json > \/sandbox\/\.openclaw\/\.config-hash/, 'live apply must refresh the immutable OpenClaw config hash')
|
assert.doesNotMatch(sandboxInferenceApplyLibSource, /config-hash|cat > .*openclaw\.json|chmod .*openclaw\.json/, 'live apply must not replace OpenClaw native config or recreate retired ownership metadata')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /spawn\(OPENSHELL_BIN, \["sandbox", "exec", "-n", sandboxName/, 'live apply must use the supported OpenShell sandbox exec boundary')
|
assert.match(openClawNativeConfigSource, /\[\s*"sandbox",[\s\S]*"exec",[\s\S]*"-n",[\s\S]*sandboxName,[\s\S]*"--env",[\s\S]*"HOME=\/sandbox",[\s\S]*"openclaw",[\s\S]*"config",[\s\S]*"patch",[\s\S]*"--stdin"/, 'native config writes must use OpenShell sandbox exec and OpenClaw config patch stdin')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'live apply must respect the active gateway unless explicitly configured')
|
assert.match(openClawNativeConfigSource, /OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY\?\.trim\(\) \|\| undefined/, 'live apply must respect the active gateway unless explicitly configured')
|
||||||
assert.doesNotMatch(sandboxInferenceApplyLibSource, /docker[\s\S]*kubectl|OPENSHELL_CLUSTER_CONTAINER/, 'live apply must not depend on obsolete cluster containers or in-container kubectl')
|
assert.doesNotMatch(sandboxInferenceApplyLibSource, /docker[\s\S]*kubectl|OPENSHELL_CLUSTER_CONTAINER/, 'live apply must not depend on obsolete cluster containers or in-container kubectl')
|
||||||
assert.doesNotMatch(sandboxInferenceApplyLibSource, /chmod 444|chown root:root/, 'live apply must leave OpenClaw config writable by the sandbox owner for subsequent updates')
|
assert.doesNotMatch(sandboxInferenceApplyLibSource, /chmod 444|chown root:root/, 'live apply must leave OpenClaw config writable by the sandbox owner for subsequent updates')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /\["inference", "set", "--no-verify", "--provider", primary\.provider, "--model", primary\.model\]/, 'live apply must point OpenShell inference at the primary route')
|
assert.match(sandboxInferenceApplyLibSource, /\["inference", "set", "--no-verify", "--provider", primary\.provider, "--model", primary\.model\]/, 'live apply must point OpenShell inference at the primary route')
|
||||||
|
assert.match(sandboxInferenceApplyLibSource, /restartSandboxGatewayWithNemoClaw\(sandboxName\)/, 'live apply must restart through NemoClaw native agent lifecycle after config and route updates')
|
||||||
|
assert.match(sandboxInferenceApplyLibSource, /gatewayRestart: "nemoclaw-native-gateway"/, 'live apply must report its verified native restart mode')
|
||||||
|
assert.doesNotMatch(sandboxInferenceApplyLibSource, /\/proc\/[[]0-9[]][*]|openclaw gateway run/, 'live apply must not kill or launch OpenClaw processes outside NemoClaw lifecycle ownership')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /resolveInferenceModelIdentity/, 'live apply must normalize provider/model identities for OpenClaw inference routes')
|
assert.match(sandboxInferenceApplyLibSource, /resolveInferenceModelIdentity/, 'live apply must normalize provider/model identities for OpenClaw inference routes')
|
||||||
assert.match(sandboxInferenceApplyLibSource, /providerKey: "nvidia"[\s\S]*modelRef: route\.model/, 'live apply must preserve nvidia/... model refs without wrapping them as inference/...')
|
assert.match(sandboxInferenceApplyLibSource, /providerKey: "nvidia"[\s\S]*modelRef: route\.model/, 'live apply must preserve nvidia/... model refs without wrapping them as inference/...')
|
||||||
assert.doesNotMatch(sandboxRestartRouteSource, /delete", "pod"|kubectl delete/, 'restart route must not delete the backing sandbox pod')
|
assert.doesNotMatch(sandboxRestartRouteSource, /delete", "pod"|kubectl delete/, 'restart route must not delete the backing sandbox pod')
|
||||||
assert.match(sandboxRestartRouteSource, /restartMode: "openclaw-runtime"/, 'restart route must restart only the in-sandbox OpenClaw runtime')
|
assert.match(sandboxRestartRouteSource, /restartMode: "nemoclaw-native-gateway"/, 'restart route must use NemoClaw native agent gateway lifecycle')
|
||||||
|
assert.doesNotMatch(sandboxRestartRouteSource, /openclaw gateway run|runSandboxShell/, 'restart route must not bypass the native agent lifecycle with a manual OpenClaw launch')
|
||||||
assert.match(sandboxRestartRouteSource, /waitForSandboxReady\(sandboxName, 15000, 1000\)/, 'restart route must verify OpenShell reports the sandbox ready before runtime restart')
|
assert.match(sandboxRestartRouteSource, /waitForSandboxReady\(sandboxName, 15000, 1000\)/, 'restart route must verify OpenShell reports the sandbox ready before runtime restart')
|
||||||
assert.match(sandboxListSource, /Restart Sandbox/, 'sandbox details must expose the Monday-era sandbox restart button')
|
assert.match(sandboxListSource, /Restart Sandbox/, 'sandbox details must expose the Monday-era sandbox restart button')
|
||||||
assert.match(sandboxListSource, /\/api\/sandbox\/\$\{encodeURIComponent\(selectedSandbox\.id\)\}\/restart/, 'restart button must call the sandbox restart endpoint')
|
assert.match(sandboxListSource, /\/api\/sandbox\/\$\{encodeURIComponent\(selectedSandbox\.id\)\}\/restart/, 'restart button must call the sandbox restart endpoint')
|
||||||
@@ -345,6 +334,11 @@ assert.match(configPanelSource, /createInference/, 'create panel must send creat
|
|||||||
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-blueprint' \|\| selectedBlueprint === 'nemoclaw-hermes' \|\| selectedBlueprint === 'nemoclaw-deepagents-code'/, 'create panel must treat NemoClaw managed agents as onboard blueprints')
|
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-blueprint' \|\| selectedBlueprint === 'nemoclaw-hermes' \|\| selectedBlueprint === 'nemoclaw-deepagents-code'/, 'create panel must treat NemoClaw managed agents as onboard blueprints')
|
||||||
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-hermes' \? 'my-hermes'/, 'create panel must provide a Hermes-specific sandbox name placeholder')
|
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-hermes' \? 'my-hermes'/, 'create panel must provide a Hermes-specific sandbox name placeholder')
|
||||||
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-deepagents-code' \? 'my-deepagents-code'/, 'create panel must provide a Deep Agents Code-specific sandbox name placeholder')
|
assert.match(configPanelSource, /selectedBlueprint === 'nemoclaw-deepagents-code' \? 'my-deepagents-code'/, 'create panel must provide a Deep Agents Code-specific sandbox name placeholder')
|
||||||
|
assert.match(configPanelSource, /maxLength=\{19\}/, 'create panel must expose NemoClaw\'s 19-character sandbox-name limit')
|
||||||
|
assert.match(configPanelSource, /single internal hyphens only/, 'create panel must explain the canonical sandbox-name grammar')
|
||||||
|
assert.match(wizardPanelSource, /targetName\.length <= 19/, 'clone wizard must enforce NemoClaw\'s 19-character sandbox-name limit')
|
||||||
|
assert.match(wizardPanelSource, /\^\(\?!\.\*--\)\[a-z\]/, 'clone wizard must reject leading digits and consecutive hyphens')
|
||||||
|
assert.match(wizardPanelSource, /\.slice\(0, 13\)[\s\S]*-clone/, 'clone wizard must keep generated clone names within the 19-character limit')
|
||||||
assert.match(configPanelSource, /useState<string>\('redeploy-image'\)/, 'create panel must default to quick deploy')
|
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')
|
assert.doesNotMatch(configPanelSource, /Source Sandbox|sourceSandboxName/, 'basic create panel must not require choosing a source image')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user