Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nemoclaw/dist/commands/status.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions nemoclaw/dist/commands/status.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nemoclaw/dist/commands/status.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions nemoclaw/src/commands/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
// SPDX-License-Identifier: Apache-2.0

import { exec } from "node:child_process";
import { existsSync } from "node:fs";
import { promisify } from "node:util";
import type { PluginLogger, NemoClawConfig } from "../index.js";
import { loadState } from "../blueprint/state.js";

const execAsync = promisify(exec);

/**
* Detect whether we are running inside an OpenShell sandbox.
* Inside the sandbox the filesystem is restricted to /sandbox and /tmp,
* and the openshell CLI cannot query its own container status.
*/
function isInsideSandbox(): boolean {
return existsSync("/sandbox") || process.env.OPENSHELL_SANDBOX === "1";
}

export interface StatusOptions {
json: boolean;
logger: PluginLogger;
Expand Down Expand Up @@ -96,6 +106,13 @@ interface SandboxStatusResponse {
}

async function getSandboxStatus(sandboxName: string): Promise<SandboxStatus> {
// When running inside the sandbox, openshell cannot query its own
// container. The fact that this code is executing proves the sandbox
// is running, so report that directly.
if (isInsideSandbox()) {
return { name: sandboxName, running: true, uptime: null };
}

try {
const { stdout } = await execAsync(`openshell sandbox status ${sandboxName} --json`, {
timeout: 5000,
Expand Down