Add gateway overrides and quick sandbox deploy
This commit is contained in:
@@ -115,6 +115,8 @@ assert.match(manifestSource, /syncSandboxMcpManifest/, 'MCP sandbox manifest mus
|
||||
assert.match(manifestSource, /writeSandboxFilePrivileged/, 'MCP sandbox manifest must use a privileged write path for root-owned /sandbox mounts')
|
||||
assert.match(manifestSource, /syncSandboxOpenClawMcpConfig/, 'MCP sandbox manifest sync must also configure OpenClaw MCP')
|
||||
assert.match(manifestSource, /\/mcp/, 'MCP sandbox handoff must include the protocol-compatible MCP endpoint')
|
||||
assert.match(manifestSource, /Quick Check/, 'MCP sandbox handoff must include a token-safe local verification snippet')
|
||||
assert.match(manifestSource, /tools\/list/, 'MCP sandbox handoff quick check should verify tool discovery')
|
||||
assert.match(privilegedFilesSource, /kubectl/, 'privileged sandbox file writes must use the OpenShell cluster control path')
|
||||
assert.doesNotMatch(manifestSource, /allowedServers|renderServer|commandLine/, 'MCP sandbox handoff must not disclose server inventory or launch specs')
|
||||
assert.match(manifestSource, /control plane enforces/, 'MCP sandbox handoff must explain broker-side enforcement')
|
||||
@@ -135,6 +137,8 @@ assert.match(sandboxMcpRouteSource, /brokerBaseUrlForSandbox/, 'Sandbox MCP brok
|
||||
assert.match(sandboxMcpRouteSource, /synced\.openClaw\.path/, 'Sandbox MCP sync response must report the OpenClaw config write')
|
||||
assert.match(brokerUrlSource, /discoverOpenShellDockerGateway/, 'Sandbox MCP broker handoff must discover the active OpenShell network gateway')
|
||||
assert.match(brokerUrlSource, /LOCAL_HOSTNAMES/, 'Sandbox MCP broker handoff must rewrite local-only browser origins')
|
||||
assert.match(brokerUrlSource, /shouldUseProxyWrappedBrokerUrl/, 'Sandbox MCP broker handoff must make proxy-wrapped URLs opt-in')
|
||||
assert.match(brokerUrlSource, /if \(!shouldUseProxyWrappedBrokerUrl\(\)\) return hostBrokerUrl/, 'Sandbox MCP broker handoff must prefer the direct gateway URL by default')
|
||||
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, /FALLBACK_SANDBOX_PROXY_ORIGIN/, 'Sandbox MCP broker handoff may keep a fallback for older OpenShell layouts')
|
||||
@@ -143,6 +147,11 @@ assert.match(sandboxOpenClawMcpConfigSource, /streamable-http/, 'OpenClaw MCP br
|
||||
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(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, /await fetch\(/, 'MCP broker network sync probe must wait for the policy-generating request')
|
||||
assert.match(sandboxPermissionsSource, /extractProxiedTargetUrl/, 'MCP broker network sync must inspect proxy-wrapped target URLs')
|
||||
assert.match(sandboxPermissionsSource, /const proxiedTarget = extractProxiedTargetUrl\(brokerBaseUrl\)/, 'MCP broker network sync must derive the target host behind the sandbox HTTP proxy')
|
||||
assert.match(sandboxPermissionsSource, /if \(proxiedTarget\) addEndpointCandidate\(candidates, proxiedTarget\)/, 'MCP broker network sync must approve the proxied broker target host')
|
||||
assert.match(middlewareSource, /\/api\/mcp\/broker/, 'MCP broker endpoints must bypass dashboard cookie auth and rely on broker token auth')
|
||||
assert.match(routeSource, /export async function GET/, 'MCP API must list server configuration')
|
||||
assert.match(routeSource, /export async function POST/, 'MCP API must install and update server configuration')
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
const root = process.cwd()
|
||||
const proxyPath = path.join(root, 'app/api/openshell/dashboard/proxy/shared.ts')
|
||||
const proxySource = await readFile(proxyPath, 'utf8')
|
||||
|
||||
assert.match(
|
||||
proxySource,
|
||||
/const pageGatewayUrl = protocol \+ '\/\/' \+ window\.location\.host \+ proxyPrefix/,
|
||||
'dashboard bootstrap should know the same-origin websocket gateway scope'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/const sidecarGatewayUrl = protocol \+ '\/\/' \+ sidecarHost \+ proxyPrefix/,
|
||||
'dashboard bootstrap should know the dedicated websocket sidecar gateway scope'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/const gatewayUrl = \(hashParams\.get\('gatewayUrl'\) \|\| ''\)\.trim\(\) \|\| sidecarGatewayUrl/,
|
||||
'dashboard bootstrap should honor the tokenized launch gateway URL'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/const settingsPrefix = 'openclaw\.control\.settings\.v1:';/,
|
||||
'dashboard bootstrap should write OpenClaw scoped settings'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/const gatewayScopes = uniqueScopes\(\[gatewayUrl, sidecarGatewayUrl, pageGatewayUrl\]\)/,
|
||||
'dashboard bootstrap should seed token scopes for launch, sidecar, and page gateways'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/for \(const key of settingsKeys\) window\.localStorage\.setItem\(key, serializedSettings\)/,
|
||||
'dashboard bootstrap should write settings to all gateway-scoped keys'
|
||||
)
|
||||
assert.match(
|
||||
proxySource,
|
||||
/for \(const scope of gatewayScopes\) window\.sessionStorage\.setItem\(tokenPrefix \+ scope, token\)/,
|
||||
'dashboard bootstrap should write the OpenClaw token to every gateway scope'
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
proxySource,
|
||||
/const tokenScope = gatewayUrl/,
|
||||
'dashboard bootstrap must not restrict the token to only one gateway scope'
|
||||
)
|
||||
|
||||
console.log('openclaw-dashboard-bootstrap-token-scope-check: PASS dashboard bootstrap token scope assertions')
|
||||
@@ -95,7 +95,8 @@ assert.match(createRouteSource, /mode: "legacy-setup"/, 'NemoClaw blueprint crea
|
||||
assert.match(createRouteSource, /NemoClaw CLI was not found/, 'missing current CLI must produce an actionable error')
|
||||
assert.match(createRouteSource, /NEMOCLAW_BIN_CANDIDATES\.join/, 'missing current CLI error must list searched candidates')
|
||||
assert.match(createRouteSource, /from "@\/app\/lib\/hostCommands"/, 'create route must use shared command resolution')
|
||||
assert.match(deleteRouteSource, /NEMOCLAW_CWD/, 'delete route must use resolved NemoClaw working directory')
|
||||
assert.match(deleteRouteSource, /hostCommandEnv/, 'delete route must use shared host command environment')
|
||||
assert.doesNotMatch(deleteRouteSource, /NEMOCLAW_CWD|NEMOCLAW_BIN/, 'delete route must not launch NemoClaw cleanup after OpenShell deletion')
|
||||
|
||||
for (const [label, source] of [
|
||||
['telemetry', telemetrySource],
|
||||
|
||||
@@ -60,8 +60,17 @@ assert.match(
|
||||
'blueprint create response must expose readiness polling metadata',
|
||||
)
|
||||
assert.match(createRouteSource, /"onboard", "--non-interactive", "--recreate-sandbox"/, 'blueprint create must use the Monday-era normal NemoClaw onboard flow')
|
||||
assert.doesNotMatch(createRouteSource, /"--from"|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, /id: "redeploy-image"/, 'create API must expose image redeploy as a sandbox creation path')
|
||||
assert.match(createRouteSource, /label: "Quick Deploy New NemoClaw Sandbox"/, 'image redeploy must be labeled as the quick deploy default path')
|
||||
assert.match(createRouteSource, /label: "Fresh NemoClaw Image"/, 'full rebuild path must be labeled as fresh image creation')
|
||||
assert.match(createRouteSource, /readNemoClawRegistry/, 'image redeploy must discover the default NemoClaw sandbox image automatically')
|
||||
assert.match(createRouteSource, /listOpenShellSandboxNames/, 'image redeploy must fall back to live OpenShell inventory when registry entries are stale')
|
||||
assert.match(createRouteSource, /resolveSourcePodImage\(sourceSandboxName, sandboxName\)/, 'image redeploy must allow optional explicit source while defaulting automatically')
|
||||
assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must pass the resolved image to openshell sandbox create')
|
||||
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
|
||||
assert.match(createRouteSource, /registerNemoClawImageRedeploy/, 'image redeploy must register the new sandbox without a full NemoClaw rebuild')
|
||||
assert.match(createRouteSource, /const requestedMode = typeof raw\.mode === "string" \? raw\.mode : "vllm"/, 'blueprint create must default to vLLM experimental onboarding when the UI payload is absent')
|
||||
assert.match(createRouteSource, /NEMOCLAW_EXPERIMENTAL = "1"/, 'blueprint create must support NemoClaw experimental provider onboarding')
|
||||
assert.match(createRouteSource, /NEMOCLAW_PROVIDER = "vllm"/, 'blueprint create must support the vLLM onboarding provider')
|
||||
@@ -105,9 +114,20 @@ assert.match(deleteRouteSource, /resolveSandboxRef/, 'delete route must resolve
|
||||
assert.match(deleteRouteSource, /OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY \|\| "nemoclaw"/, 'delete route must use the NemoClaw gateway context')
|
||||
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, /export function openshellGatewayAddressEnv/, 'shared host command environment must expose gateway address override variables')
|
||||
assert.match(hostCommandsSource, /OPENSHELL_GATEWAY_HOST/, 'shared host command environment must pass a configurable gateway host to child processes')
|
||||
assert.match(hostCommandsSource, /OPENSHELL_GATEWAY_PORT/, 'shared host command environment must pass a configurable gateway port to child processes')
|
||||
assert.match(hostCommandsSource, /OPENSHELL_GATEWAY_URL/, 'shared host command environment must pass or synthesize a gateway URL for child processes')
|
||||
assert.match(hostCommandsSource, /gateway\.json/, 'shared host command environment must read gateway address config from the OpenShell config directory')
|
||||
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, /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(deleteRouteSource, /env: hostCommandEnv\(\{[\s\S]*OPENSHELL_GATEWAY: process\.env\.OPENSHELL_GATEWAY \|\| "nemoclaw"/, 'delete route must pass the shared host command environment to OpenShell')
|
||||
assert.match(deleteRouteSource, /waitForSandboxDeleted/, 'delete route must poll authoritative inventory until the sandbox is gone')
|
||||
assert.match(deleteRouteSource, /cleanupNemoClawSandbox/, 'delete route must clean up NemoClaw registry state after deleting from OpenShell')
|
||||
assert.match(deleteRouteSource, /\[sandboxName, "destroy", "--yes"\]/, 'delete route must match the Monday-era NemoClaw destroy cleanup path')
|
||||
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, /\[sandboxName, "destroy", "--yes"\]/, 'delete route must not call nemoclaw destroy because it can delete the gateway')
|
||||
assert.doesNotMatch(deleteRouteSource, /Pruned NemoClaw registry entry without destroying the shared OpenShell gateway|cleanupGatewayAfterLastSandbox/, 'delete route must not include the later registry-prune rewrite')
|
||||
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')
|
||||
@@ -181,5 +201,7 @@ assert.doesNotMatch(configPanelSource, /onInventoryRefresh/, 'create panel must
|
||||
assert.match(configPanelSource, /Use vLLM in experimental mode/, 'create panel must expose vLLM experimental onboarding')
|
||||
assert.match(configPanelSource, /Use NVIDIA NIM/, 'create panel must expose NVIDIA NIM onboarding')
|
||||
assert.match(configPanelSource, /createInference/, 'create panel must send create-time inference settings')
|
||||
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')
|
||||
|
||||
console.log('sandbox-lifecycle-check: PASS create/destroy lifecycle assertions')
|
||||
|
||||
Reference in New Issue
Block a user