Use OpenShell config home for host commands

This commit is contained in:
Codex
2026-04-28 16:24:51 +00:00
parent 33510bba85
commit 476d3a96bb
13 changed files with 82 additions and 97 deletions
+6 -18
View File
@@ -12,6 +12,7 @@ import {
NEMOCLAW_SETUP_CANDIDATES,
NODE_BIN,
OPENSHELL_BIN,
hostCommandEnv,
} from "@/app/lib/hostCommands"
const execFileAsync = promisify(execFile)
@@ -240,14 +241,9 @@ async function approveOpenClawDeviceRequests(sandboxName: string) {
"sh",
"-lc",
"openclaw devices approve --latest --json --timeout 10000",
], {
...process.env,
PATH: HOST_PATH,
], hostCommandEnv({
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
NO_COLOR: "1",
CLICOLOR: "0",
CLICOLOR_FORCE: "0",
}, 15000)
}), 15000)
const combinedOutput = `${result.stdout}\n${result.stderr}`.trim()
const noPending = NO_PENDING_DEVICE_REQUESTS.test(combinedOutput)
@@ -339,15 +335,13 @@ export async function POST(request: Request) {
if (blueprint === "nemoclaw-blueprint") {
const createCommand = buildNemoClawCreateCommand()
const env: NodeJS.ProcessEnv = {
...process.env,
PATH: HOST_PATH,
const env: NodeJS.ProcessEnv = hostCommandEnv({
NEMOCLAW_SANDBOX_NAME: sandboxName,
NEMOCLAW_NON_INTERACTIVE: "1",
NEMOCLAW_RECREATE_SANDBOX: "1",
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1",
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
}
})
if (!enableTailscale) {
env.NVIDIA_API_KEY = env.NVIDIA_API_KEY || "optional-local-mode"
@@ -414,13 +408,7 @@ export async function POST(request: Request) {
}
if (blueprint === "custom-sandbox") {
const env: NodeJS.ProcessEnv = {
...process.env,
PATH: HOST_PATH,
NO_COLOR: "1",
CLICOLOR: "0",
CLICOLOR_FORCE: "0",
}
const env: NodeJS.ProcessEnv = hostCommandEnv()
const createAttempt = await runCreateCommandBounded(OPENSHELL_BIN, ["sandbox", "create", "--name", sandboxName], env, 15000)
if (createAttempt.completed && createAttempt.exitCode !== 0) {
+5 -15
View File
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server"
import { execFile } from "node:child_process"
import { promisify } from "node:util"
import { resolveSandboxRef } from "@/app/lib/openshellHost"
import { HOST_PATH, NEMOCLAW_BIN, NEMOCLAW_CWD, OPENSHELL_BIN } from "@/app/lib/hostCommands"
import { NEMOCLAW_BIN, NEMOCLAW_CWD, OPENSHELL_BIN, hostCommandEnv } from "@/app/lib/hostCommands"
const execFileAsync = promisify(execFile)
@@ -54,14 +54,9 @@ async function deleteSandbox(sandboxName: string) {
console.log(`[sandbox/delete] command:start sandbox=${sandboxName}`)
try {
const { stdout, stderr } = await execFileAsync(OPENSHELL_BIN, ["sandbox", "delete", sandboxName], {
env: {
...process.env,
PATH: HOST_PATH,
env: hostCommandEnv({
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
NO_COLOR: "1",
CLICOLOR: "0",
CLICOLOR_FORCE: "0",
},
}),
timeout: 60000,
maxBuffer: 20 * 1024 * 1024,
})
@@ -93,14 +88,9 @@ async function cleanupNemoClawSandbox(sandboxName: string) {
try {
const { stdout, stderr } = await execFileAsync(NEMOCLAW_BIN, [sandboxName, "destroy", "--yes"], {
cwd: NEMOCLAW_CWD,
env: {
...process.env,
PATH: HOST_PATH,
env: hostCommandEnv({
OPENSHELL_GATEWAY: process.env.OPENSHELL_GATEWAY || "nemoclaw",
NO_COLOR: "1",
CLICOLOR: "0",
CLICOLOR_FORCE: "0",
},
}),
timeout: 90000,
maxBuffer: 20 * 1024 * 1024,
})