@clearideas/agent-runtime-sandbox 0.6.0 → 0.6.1

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.
@@ -11,7 +11,7 @@ prints exactly one JSON document on stdout and exits with:
11
11
  4 limit exceeded
12
12
  5 read-only mount
13
13
 
14
- Paths are relative POSIX paths whose segments match [A-Za-z0-9][A-Za-z0-9._-]*.
14
+ Paths are relative POSIX paths whose segments match [A-Za-z0-9_][A-Za-z0-9._-]*.
15
15
  Symbolic links are never followed. Content is never interpreted beyond UTF-8
16
16
  decoding for text windows and literal substring search.
17
17
  """
@@ -27,7 +27,7 @@ import tempfile
27
27
 
28
28
  PROTOCOL_VERSION = 1
29
29
  HELPER_VERSION = "1.0.0"
30
- SEGMENT = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*$")
30
+ SEGMENT = re.compile(r"^[A-Za-z0-9_][A-Za-z0-9._-]*$")
31
31
  MAX_PATH_LENGTH = 1024
32
32
  MAX_PATH_DEPTH = 64
33
33
  TEXT_SNIFF_BYTES = 8192
@@ -2,7 +2,8 @@ import { type SandboxCommand, type SandboxFileInfo, type SandboxHandle, type San
2
2
  /**
3
3
  * TEST-ONLY provider that runs commands as ordinary host processes inside a
4
4
  * temporary directory, rewriting `/workspace` paths in arguments and
5
- * environment to that directory. It provides no isolation whatsoever and
5
+ * environment and the runtime-owned workspace index to that directory.
6
+ * It provides no isolation whatsoever and
6
7
  * exists so the run sandbox can be exercised end to end (including the real
7
8
  * helper script) on hosts without bubblewrap or Docker. It is deliberately not
8
9
  * exported from the package entry point.
@@ -4,10 +4,12 @@ import { chmod, lstat, mkdir, mkdtemp, readdir, readFile, rm, writeFile, } from
4
4
  import { tmpdir } from "node:os";
5
5
  import path from "node:path";
6
6
  import { assertSandboxPath, } from "../contracts.js";
7
+ import { SANDBOX_WORKSPACES_FILE } from "../policy.js";
7
8
  /**
8
9
  * TEST-ONLY provider that runs commands as ordinary host processes inside a
9
10
  * temporary directory, rewriting `/workspace` paths in arguments and
10
- * environment to that directory. It provides no isolation whatsoever and
11
+ * environment and the runtime-owned workspace index to that directory.
12
+ * It provides no isolation whatsoever and
11
13
  * exists so the run sandbox can be exercised end to end (including the real
12
14
  * helper script) on hosts without bubblewrap or Docker. It is deliberately not
13
15
  * exported from the package entry point.
@@ -45,7 +47,20 @@ export class HostProcessTestProvider {
45
47
  const existing = await lstat(target).catch(() => undefined);
46
48
  if (existing)
47
49
  await chmod(target, 0o600);
48
- await writeFile(target, file.content);
50
+ let content = file.content;
51
+ // This runtime-owned index must describe the same host paths as argv
52
+ // and environment. Never rewrite workspace files or arbitrary JSON.
53
+ if (file.path === SANDBOX_WORKSPACES_FILE) {
54
+ const index = JSON.parse(typeof content === "string"
55
+ ? content
56
+ : new TextDecoder().decode(content));
57
+ for (const mount of Object.values(index.mounts)) {
58
+ mount.path = this.translate(handle, mount.path);
59
+ }
60
+ index.output = this.translate(handle, index.output);
61
+ content = JSON.stringify(index);
62
+ }
63
+ await writeFile(target, content);
49
64
  await chmod(target, file.mode ?? 0o600);
50
65
  }
51
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearideas/agent-runtime-sandbox",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Provider-neutral sandbox lifecycle and code execution adapters for Clear Ideas Agent Runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Clear Ideas Incorporated",
@@ -41,8 +41,8 @@
41
41
  "postpack": "node ../../scripts/cleanup-package-license.mjs"
42
42
  },
43
43
  "dependencies": {
44
- "@clearideas/agent-runtime-contracts": "0.6.0",
45
- "@clearideas/agent-runtime-core": "0.6.0"
44
+ "@clearideas/agent-runtime-contracts": "0.6.1",
45
+ "@clearideas/agent-runtime-core": "0.6.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^26.4.0",