@openclaw/openshell-sandbox 2026.5.20-beta.1 → 2026.5.20-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -20
- package/openclaw.plugin.json +2 -2
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
2
|
import { buildExecRemoteCommand, createRemoteShellSandboxFsBridge, createSshSandboxSessionFromConfigText, createWritableRenameTargetResolver, disposeSshSandboxSession, registerSandboxBackend, resolvePreferredOpenClawTmpDir, runPluginCommandWithTimeout, runSshSandboxCommand, sanitizeEnvVars, shellEscape, withTempWorkspace } from "openclaw/plugin-sdk/sandbox";
|
|
4
3
|
import fs from "node:fs/promises";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import { loadJsonFile } from "openclaw/plugin-sdk/json-store";
|
|
8
6
|
import { buildPluginConfigSchema } from "openclaw/plugin-sdk/core";
|
|
9
7
|
import { formatPluginConfigIssue, mapPluginConfigIssues } from "openclaw/plugin-sdk/extension-shared";
|
|
10
8
|
import { z } from "zod";
|
|
11
9
|
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
12
10
|
import { isPathInside, movePathWithCopyFallback } from "openclaw/plugin-sdk/security-runtime";
|
|
13
11
|
//#region extensions/openshell/src/cli.ts
|
|
14
|
-
const require = createRequire(import.meta.url);
|
|
15
|
-
let cachedBundledOpenShellCommand;
|
|
16
|
-
function resolveBundledOpenShellCommand() {
|
|
17
|
-
if (cachedBundledOpenShellCommand !== void 0) return cachedBundledOpenShellCommand;
|
|
18
|
-
try {
|
|
19
|
-
const packageJsonPath = require.resolve("openshell/package.json");
|
|
20
|
-
const packageJson = loadJsonFile(packageJsonPath);
|
|
21
|
-
const relativeBin = typeof packageJson?.bin === "string" ? packageJson.bin : packageJson?.bin?.openshell;
|
|
22
|
-
cachedBundledOpenShellCommand = relativeBin ? path.resolve(path.dirname(packageJsonPath), relativeBin) : null;
|
|
23
|
-
} catch {
|
|
24
|
-
cachedBundledOpenShellCommand = null;
|
|
25
|
-
}
|
|
26
|
-
return cachedBundledOpenShellCommand;
|
|
27
|
-
}
|
|
28
12
|
function resolveOpenShellCommand(command) {
|
|
29
|
-
|
|
30
|
-
return resolveBundledOpenShellCommand() ?? command;
|
|
13
|
+
return command;
|
|
31
14
|
}
|
|
32
15
|
function buildOpenShellBaseArgv(config) {
|
|
33
16
|
const argv = [resolveOpenShellCommand(config.command)];
|
|
@@ -38,6 +21,15 @@ function buildOpenShellBaseArgv(config) {
|
|
|
38
21
|
function buildRemoteCommand(argv) {
|
|
39
22
|
return argv.map((entry) => shellEscape(entry)).join(" ");
|
|
40
23
|
}
|
|
24
|
+
function applyGatewayEndpointToSshConfig(params) {
|
|
25
|
+
const endpoint = params.gatewayEndpoint?.trim();
|
|
26
|
+
if (!endpoint) return params.configText;
|
|
27
|
+
return params.configText.replace(/^(\s*ProxyCommand\s+)(.*)$/m, (line, prefix, command) => {
|
|
28
|
+
if (!command.includes("ssh-proxy")) return line;
|
|
29
|
+
if (/(^|\s)--server(\s|=)|(^|\s)--gateway-endpoint(\s|=)/.test(command)) return line;
|
|
30
|
+
return `${prefix}${command} --server ${shellEscape(endpoint)}`;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
41
33
|
async function runOpenShellCli(params) {
|
|
42
34
|
return await runPluginCommandWithTimeout({
|
|
43
35
|
argv: [...buildOpenShellBaseArgv(params.context.config), ...params.args],
|
|
@@ -56,7 +48,10 @@ async function createOpenShellSshSession(params) {
|
|
|
56
48
|
]
|
|
57
49
|
});
|
|
58
50
|
if (result.code !== 0) throw new Error(result.stderr.trim() || "openshell sandbox ssh-config failed");
|
|
59
|
-
return await createSshSandboxSessionFromConfigText({ configText:
|
|
51
|
+
return await createSshSandboxSessionFromConfigText({ configText: applyGatewayEndpointToSshConfig({
|
|
52
|
+
configText: result.stdout,
|
|
53
|
+
gatewayEndpoint: params.context.config.gatewayEndpoint
|
|
54
|
+
}) });
|
|
60
55
|
}
|
|
61
56
|
//#endregion
|
|
62
57
|
//#region extensions/openshell/src/config.ts
|
|
@@ -857,7 +852,7 @@ function resolveOpenShellPluginConfigFromConfig(config, fallback) {
|
|
|
857
852
|
}
|
|
858
853
|
function buildOpenShellSandboxName(scopeKey) {
|
|
859
854
|
const trimmed = scopeKey.trim() || "session";
|
|
860
|
-
const safe = normalizeLowercaseStringOrEmpty(trimmed).replace(/[^a-z0-9
|
|
855
|
+
const safe = normalizeLowercaseStringOrEmpty(trimmed).replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
861
856
|
const hash = Array.from(trimmed).reduce((acc, char) => (acc * 33 ^ char.charCodeAt(0)) >>> 0, 5381);
|
|
862
857
|
return `openclaw-${safe || "session"}-${hash.toString(16).slice(0, 8)}`;
|
|
863
858
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"onStartup": true
|
|
5
5
|
},
|
|
6
6
|
"name": "OpenShell Sandbox",
|
|
7
|
-
"description": "Sandbox backend powered by OpenShell with mirrored local workspaces and SSH-based command execution.",
|
|
7
|
+
"description": "Sandbox backend powered by the NVIDIA OpenShell CLI with mirrored local workspaces and SSH-based command execution.",
|
|
8
8
|
"configSchema": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"additionalProperties": false,
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"command": {
|
|
69
69
|
"label": "OpenShell Command",
|
|
70
|
-
"help": "Path or command name for the
|
|
70
|
+
"help": "Path or command name for the NVIDIA OpenShell CLI."
|
|
71
71
|
},
|
|
72
72
|
"gateway": {
|
|
73
73
|
"label": "Gateway Name",
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/openshell-sandbox",
|
|
3
|
-
"version": "2026.5.20-beta.
|
|
4
|
-
"description": "OpenClaw
|
|
3
|
+
"version": "2026.5.20-beta.2",
|
|
4
|
+
"description": "OpenClaw sandbox backend for the NVIDIA OpenShell CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/openclaw/openclaw"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"openshell": "0.1.0",
|
|
12
11
|
"zod": "4.4.3"
|
|
13
12
|
},
|
|
14
13
|
"devDependencies": {
|
|
@@ -24,10 +23,10 @@
|
|
|
24
23
|
"minHostVersion": ">=2026.5.12-beta.1"
|
|
25
24
|
},
|
|
26
25
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.5.20-beta.
|
|
26
|
+
"pluginApi": ">=2026.5.20-beta.2"
|
|
28
27
|
},
|
|
29
28
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.5.20-beta.
|
|
29
|
+
"openclawVersion": "2026.5.20-beta.2",
|
|
31
30
|
"bundledDist": false
|
|
32
31
|
},
|
|
33
32
|
"release": {
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
"openclaw.plugin.json"
|
|
44
43
|
],
|
|
45
44
|
"peerDependencies": {
|
|
46
|
-
"openclaw": ">=2026.5.20-beta.
|
|
45
|
+
"openclaw": ">=2026.5.20-beta.2"
|
|
47
46
|
},
|
|
48
47
|
"peerDependenciesMeta": {
|
|
49
48
|
"openclaw": {
|