@theokit/sdk 5.12.1 → 5.14.0

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.
Files changed (193) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/{agent-Cn0sphpA.d.cts → agent-DExqjqYy.d.cts} +18 -3
  3. package/dist/{agent-CVzDy_Oj.d.ts → agent-Dfw3VsIX.d.ts} +18 -3
  4. package/dist/{agent-IG7BP6GN.js → agent-T34LCGQM.js} +11 -11
  5. package/dist/{agent-IG7BP6GN.js.map → agent-T34LCGQM.js.map} +1 -1
  6. package/dist/{agent-BVKIUP7F.cjs → agent-TL4K7BTG.cjs} +12 -12
  7. package/dist/{agent-BVKIUP7F.cjs.map → agent-TL4K7BTG.cjs.map} +1 -1
  8. package/dist/auth/index.cjs +17 -16
  9. package/dist/auth/index.cjs.map +1 -1
  10. package/dist/auth/index.js +5 -4
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
  13. package/dist/chunk-2HXTNVLM.js.map +1 -0
  14. package/dist/{chunk-Q6WT5535.cjs → chunk-2WY2OFSC.cjs} +259 -79
  15. package/dist/chunk-2WY2OFSC.cjs.map +1 -0
  16. package/dist/{chunk-HN4IKB6X.cjs → chunk-2XWAYCFM.cjs} +15 -13
  17. package/dist/chunk-2XWAYCFM.cjs.map +1 -0
  18. package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
  19. package/dist/chunk-3GTN4HOO.js.map +1 -0
  20. package/dist/{chunk-VVGFZQZC.js → chunk-3LMVJTNJ.js} +9 -5
  21. package/dist/chunk-3LMVJTNJ.js.map +1 -0
  22. package/dist/{chunk-4GUFNDZR.js → chunk-3ONIVO2I.js} +3 -3
  23. package/dist/{chunk-4GUFNDZR.js.map → chunk-3ONIVO2I.js.map} +1 -1
  24. package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
  25. package/dist/chunk-3UMPP553.cjs.map +1 -0
  26. package/dist/{chunk-NWWTYBD3.cjs → chunk-4KBI37F3.cjs} +5 -5
  27. package/dist/{chunk-NWWTYBD3.cjs.map → chunk-4KBI37F3.cjs.map} +1 -1
  28. package/dist/{chunk-S46WJTDL.cjs → chunk-4TEGFMSP.cjs} +6 -6
  29. package/dist/{chunk-S46WJTDL.cjs.map → chunk-4TEGFMSP.cjs.map} +1 -1
  30. package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
  31. package/dist/chunk-5645PMVU.cjs.map +1 -0
  32. package/dist/{chunk-ZLFFDPXC.js → chunk-73IITAF7.js} +36 -14
  33. package/dist/chunk-73IITAF7.js.map +1 -0
  34. package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
  35. package/dist/chunk-A77UMVMD.cjs.map +1 -0
  36. package/dist/{chunk-IO4RI5ZJ.cjs → chunk-BZK5QL3N.cjs} +4 -4
  37. package/dist/{chunk-IO4RI5ZJ.cjs.map → chunk-BZK5QL3N.cjs.map} +1 -1
  38. package/dist/{chunk-5HSMH2ZZ.js → chunk-CJN5CEI3.js} +4 -4
  39. package/dist/{chunk-5HSMH2ZZ.js.map → chunk-CJN5CEI3.js.map} +1 -1
  40. package/dist/{chunk-XRPMZ7TO.js → chunk-CYWOJA6B.js} +6 -4
  41. package/dist/chunk-CYWOJA6B.js.map +1 -0
  42. package/dist/{chunk-AQW54OWQ.js → chunk-DFBWYETS.js} +5 -3
  43. package/dist/chunk-DFBWYETS.js.map +1 -0
  44. package/dist/{chunk-EPANMGH7.cjs → chunk-FLDHYF5C.cjs} +11 -2
  45. package/dist/chunk-FLDHYF5C.cjs.map +1 -0
  46. package/dist/{chunk-BJ7BPLQK.js → chunk-GARVAUCU.js} +209 -29
  47. package/dist/chunk-GARVAUCU.js.map +1 -0
  48. package/dist/{chunk-YOVZMN4P.cjs → chunk-LXG6VL6R.cjs} +3 -3
  49. package/dist/{chunk-YOVZMN4P.cjs.map → chunk-LXG6VL6R.cjs.map} +1 -1
  50. package/dist/{chunk-NJBJ3CUG.js → chunk-NAVUTK6X.js} +3 -3
  51. package/dist/{chunk-NJBJ3CUG.js.map → chunk-NAVUTK6X.js.map} +1 -1
  52. package/dist/{chunk-2SFLLOMN.js → chunk-NVQSBRG6.js} +3 -3
  53. package/dist/{chunk-2SFLLOMN.js.map → chunk-NVQSBRG6.js.map} +1 -1
  54. package/dist/{chunk-FEAWEBWN.cjs → chunk-PDOXYXWX.cjs} +6 -4
  55. package/dist/chunk-PDOXYXWX.cjs.map +1 -0
  56. package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
  57. package/dist/chunk-QD6B6W6I.js.map +1 -0
  58. package/dist/{chunk-NBNRQN6T.js → chunk-QGDPMM3C.js} +11 -2
  59. package/dist/chunk-QGDPMM3C.js.map +1 -0
  60. package/dist/{chunk-ZWLFHSON.cjs → chunk-R35ZJAYT.cjs} +38 -15
  61. package/dist/chunk-R35ZJAYT.cjs.map +1 -0
  62. package/dist/{chunk-4YD2WI57.cjs → chunk-R427EOZE.cjs} +19 -15
  63. package/dist/chunk-R427EOZE.cjs.map +1 -0
  64. package/dist/chunk-R5UQL2R5.cjs +18 -0
  65. package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-R5UQL2R5.cjs.map} +1 -1
  66. package/dist/{chunk-TLVI2OQK.cjs → chunk-SETHRLQS.cjs} +18 -2
  67. package/dist/chunk-SETHRLQS.cjs.map +1 -0
  68. package/dist/{chunk-LSWHDOCL.cjs → chunk-SNVYOX46.cjs} +88 -72
  69. package/dist/chunk-SNVYOX46.cjs.map +1 -0
  70. package/dist/{chunk-BO3PV3OP.js → chunk-TDED5XES.js} +18 -3
  71. package/dist/chunk-TDED5XES.js.map +1 -0
  72. package/dist/{chunk-NKQVLWDF.js → chunk-ULEK4OM4.js} +3 -3
  73. package/dist/{chunk-NKQVLWDF.js.map → chunk-ULEK4OM4.js.map} +1 -1
  74. package/dist/{chunk-XJ4C4NFX.js → chunk-ZOL3L4EH.js} +63 -49
  75. package/dist/chunk-ZOL3L4EH.js.map +1 -0
  76. package/dist/{compact-session-NM56BREJ.cjs → compact-session-D2MQDB6G.cjs} +15 -15
  77. package/dist/{compact-session-NM56BREJ.cjs.map → compact-session-D2MQDB6G.cjs.map} +1 -1
  78. package/dist/{compact-session-3U2JYTVG.js → compact-session-N2PPHQO6.js} +6 -6
  79. package/dist/{compact-session-3U2JYTVG.js.map → compact-session-N2PPHQO6.js.map} +1 -1
  80. package/dist/{cron-CHn-F0fC.d.ts → cron-BubDpFJG.d.ts} +2 -2
  81. package/dist/{cron-BWDYetbq.d.cts → cron-CK2v0VWA.d.cts} +2 -2
  82. package/dist/cron.cjs +11 -11
  83. package/dist/cron.d.cts +3 -3
  84. package/dist/cron.d.ts +3 -3
  85. package/dist/cron.js +10 -10
  86. package/dist/eval.cjs +15 -15
  87. package/dist/eval.js +10 -10
  88. package/dist/{executor-HKHT4CWS.cjs → executor-5QL5AXIZ.cjs} +18 -15
  89. package/dist/executor-5QL5AXIZ.cjs.map +1 -0
  90. package/dist/{executor-3D2UDJHW.js → executor-THUXNAFR.js} +6 -3
  91. package/dist/executor-THUXNAFR.js.map +1 -0
  92. package/dist/generate-object-A5F576IT.cjs +20 -0
  93. package/dist/{generate-object-XBWD2PU7.cjs.map → generate-object-A5F576IT.cjs.map} +1 -1
  94. package/dist/{generate-object-S7MNVF2V.js → generate-object-TBDOBBYW.js} +4 -4
  95. package/dist/{generate-object-S7MNVF2V.js.map → generate-object-TBDOBBYW.js.map} +1 -1
  96. package/dist/generate-object.d.ts +14 -1
  97. package/dist/index.cjs +81 -65
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.cts +36 -7
  100. package/dist/index.d.ts +36 -7
  101. package/dist/index.js +44 -28
  102. package/dist/index.js.map +1 -1
  103. package/dist/{inject-session-JVTZNQF6.cjs → inject-session-3ICZIJ2N.cjs} +4 -4
  104. package/dist/{inject-session-JVTZNQF6.cjs.map → inject-session-3ICZIJ2N.cjs.map} +1 -1
  105. package/dist/{inject-session-THABTKJY.js → inject-session-J26SHHIO.js} +3 -3
  106. package/dist/{inject-session-THABTKJY.js.map → inject-session-J26SHHIO.js.map} +1 -1
  107. package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
  108. package/dist/internal/auth/credential-store.d.ts +1 -1
  109. package/dist/internal/auth/types.d.ts +4 -0
  110. package/dist/internal/providers/discovery.d.ts +2 -2
  111. package/dist/internal/providers/trust-gate.d.ts +35 -0
  112. package/dist/internal/runtime/plugin-loader/manifest-entry-import.d.ts +17 -0
  113. package/dist/internal/runtime/plugin-loader/workspace-plugin-trust.d.ts +16 -0
  114. package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
  115. package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
  116. package/dist/internal/structured-output-helpers.d.ts +5 -2
  117. package/dist/mcp-auth.cjs +2 -2
  118. package/dist/mcp-auth.js +1 -1
  119. package/dist/models.cjs +11 -11
  120. package/dist/models.js +4 -4
  121. package/dist/providers.cjs +6 -6
  122. package/dist/providers.js +4 -4
  123. package/dist/sandbox/bwrap.d.cts +10 -8
  124. package/dist/sandbox/bwrap.d.ts +10 -8
  125. package/dist/sandbox/deny-read.d.cts +24 -0
  126. package/dist/sandbox/deny-read.d.ts +24 -0
  127. package/dist/sandbox/index.cjs +114 -35
  128. package/dist/sandbox/index.cjs.map +1 -1
  129. package/dist/sandbox/index.d.cts +2 -1
  130. package/dist/sandbox/index.d.ts +2 -1
  131. package/dist/sandbox/index.js +96 -21
  132. package/dist/sandbox/index.js.map +1 -1
  133. package/dist/sandbox/linux-sandbox.d.cts +16 -1
  134. package/dist/sandbox/linux-sandbox.d.ts +16 -1
  135. package/dist/sandbox/local-sandbox.d.cts +3 -1
  136. package/dist/sandbox/local-sandbox.d.ts +3 -1
  137. package/dist/sandbox/seccomp-delivery.d.cts +3 -0
  138. package/dist/sandbox/seccomp-delivery.d.ts +3 -0
  139. package/dist/sandbox/shell-escape.d.cts +14 -2
  140. package/dist/sandbox/shell-escape.d.ts +14 -2
  141. package/dist/sandbox/types.d.cts +45 -0
  142. package/dist/sandbox/types.d.ts +45 -0
  143. package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-DwzHcuxy.d.cts} +28 -3
  144. package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-a3fW1xUK.d.ts} +28 -3
  145. package/dist/skills.cjs +4 -4
  146. package/dist/skills.js +1 -1
  147. package/dist/stream-object-AS4YYM4B.cjs +20 -0
  148. package/dist/{stream-object-TEEK3CAX.cjs.map → stream-object-AS4YYM4B.cjs.map} +1 -1
  149. package/dist/stream-object-EKM4WGTI.js +7 -0
  150. package/dist/{stream-object-R6SMYV4R.js.map → stream-object-EKM4WGTI.js.map} +1 -1
  151. package/dist/stream-object.d.ts +14 -1
  152. package/dist/subagents-loader.d.cts +2 -2
  153. package/dist/subagents-loader.d.ts +2 -2
  154. package/dist/types/agent.d.ts +14 -1
  155. package/dist/types/run.d.ts +27 -2
  156. package/dist/workflow-as-tool.d.ts +39 -5
  157. package/dist/workflow-errors.d.ts +16 -0
  158. package/dist/workflow.cjs +31 -23
  159. package/dist/workflow.d.cts +55 -5
  160. package/dist/workflow.d.ts +55 -5
  161. package/dist/workflow.js +2 -2
  162. package/docs/adr/mutation-testing-scope.md +56 -0
  163. package/docs/error-codes.md +23 -18
  164. package/docs/harness-capability-map.md +78 -4
  165. package/package.json +1 -1
  166. package/dist/chunk-3FSBE4PS.js.map +0 -1
  167. package/dist/chunk-4YD2WI57.cjs.map +0 -1
  168. package/dist/chunk-5A4UFBHW.cjs.map +0 -1
  169. package/dist/chunk-7WARNHWW.cjs.map +0 -1
  170. package/dist/chunk-AQW54OWQ.js.map +0 -1
  171. package/dist/chunk-BJ7BPLQK.js.map +0 -1
  172. package/dist/chunk-BO3PV3OP.js.map +0 -1
  173. package/dist/chunk-EPANMGH7.cjs.map +0 -1
  174. package/dist/chunk-FEAWEBWN.cjs.map +0 -1
  175. package/dist/chunk-HN4IKB6X.cjs.map +0 -1
  176. package/dist/chunk-LO6LIUZ6.cjs +0 -18
  177. package/dist/chunk-LSWHDOCL.cjs.map +0 -1
  178. package/dist/chunk-MS3TQSXU.js.map +0 -1
  179. package/dist/chunk-NBNRQN6T.js.map +0 -1
  180. package/dist/chunk-NHOEXFZT.js.map +0 -1
  181. package/dist/chunk-Q6WT5535.cjs.map +0 -1
  182. package/dist/chunk-QISSETTG.cjs.map +0 -1
  183. package/dist/chunk-TLVI2OQK.cjs.map +0 -1
  184. package/dist/chunk-VVGFZQZC.js.map +0 -1
  185. package/dist/chunk-XJ4C4NFX.js.map +0 -1
  186. package/dist/chunk-XRPMZ7TO.js.map +0 -1
  187. package/dist/chunk-ZLFFDPXC.js.map +0 -1
  188. package/dist/chunk-ZWLFHSON.cjs.map +0 -1
  189. package/dist/executor-3D2UDJHW.js.map +0 -1
  190. package/dist/executor-HKHT4CWS.cjs.map +0 -1
  191. package/dist/generate-object-XBWD2PU7.cjs +0 -20
  192. package/dist/stream-object-R6SMYV4R.js +0 -7
  193. package/dist/stream-object-TEEK3CAX.cjs +0 -20
@@ -1,13 +1,71 @@
1
- import { shellEscapePosix, LocalSandbox } from '../chunk-NBNRQN6T.js';
2
- export { LocalSandbox, SandboxBackend, SandboxNotAvailableError, SandboxSecurityError, resolveSandbox } from '../chunk-NBNRQN6T.js';
1
+ import { shellEscapePosix, LocalSandbox, SandboxNotAvailableError } from '../chunk-QGDPMM3C.js';
2
+ export { LocalSandbox, SandboxBackend, SandboxNotAvailableError, SandboxSecurityError, resolveSandbox, shellEscapePosix } from '../chunk-QGDPMM3C.js';
3
3
  import '../chunk-HKCKOAIO.js';
4
4
  import { TheokitAgentError } from '../chunk-TNFOU6SB.js';
5
5
  import { redactSecrets } from '../chunk-3OY6H3I7.js';
6
6
  import { execFileSync } from 'child_process';
7
- import { existsSync, mkdtempSync, writeFileSync, rmSync } from 'fs';
7
+ import { existsSync, mkdtempSync, writeFileSync, statSync, realpathSync, rmSync } from 'fs';
8
8
  import path, { dirname, join, resolve } from 'path';
9
9
  import { tmpdir } from 'os';
10
10
 
11
+ var KEPT_ROOTS_ALWAYS = ["/tmp"];
12
+ function isSameOrInside(outer, inner) {
13
+ const rel = path.relative(outer, inner);
14
+ return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
15
+ }
16
+ function resolveEntry(entry) {
17
+ if (!path.isAbsolute(entry)) {
18
+ throw new TypeError(`denyReadPaths: "${entry}" is not an absolute path`);
19
+ }
20
+ try {
21
+ return realpathSync(entry);
22
+ } catch (cause) {
23
+ throw new TypeError(`denyReadPaths: "${entry}" cannot be resolved: ${String(cause)}`);
24
+ }
25
+ }
26
+ function keptRoots(cwd) {
27
+ let real = cwd;
28
+ try {
29
+ real = realpathSync(cwd);
30
+ } catch {
31
+ }
32
+ return [.../* @__PURE__ */ new Set([cwd, real, ...KEPT_ROOTS_ALWAYS])];
33
+ }
34
+ function denyReadFlags(paths, policy) {
35
+ if (paths === void 0 || paths.length === 0) return [];
36
+ if (policy.mode === "danger-full-access") {
37
+ throw new TypeError(
38
+ "denyReadPaths cannot be honoured under danger-full-access: no sandbox is applied"
39
+ );
40
+ }
41
+ const roots = keptRoots(policy.cwd);
42
+ const resolved = /* @__PURE__ */ new Set();
43
+ for (const entry of paths) {
44
+ const target = resolveEntry(entry);
45
+ const covered = roots.find((root) => isSameOrInside(target, root));
46
+ if (covered !== void 0) {
47
+ throw new TypeError(
48
+ `denyReadPaths: "${entry}" would hide "${covered}", which the command needs`
49
+ );
50
+ }
51
+ resolved.add(target);
52
+ }
53
+ return [...resolved].flatMap(
54
+ (target) => statSync(target).isDirectory() ? ["--tmpfs", target] : ["--ro-bind", "/dev/null", target]
55
+ );
56
+ }
57
+ function refuseUnhonourableDenyRead(paths, mode, detect) {
58
+ if (paths === void 0 || paths.length === 0) return;
59
+ if (mode === "danger-full-access") denyReadFlags(paths, { mode, cwd: "/" });
60
+ const detection = detect();
61
+ if (!detection.ok) {
62
+ throw new SandboxNotAvailableError(
63
+ `denyReadPaths needs kernel confinement and it is unavailable (${detection.reason}); refusing to run unconfined`
64
+ );
65
+ }
66
+ }
67
+
68
+ // src/sandbox/bwrap.ts
11
69
  function pushWorkspaceBinds(argv, cwd, hasGit, gitDir) {
12
70
  for (const root of workspaceWriteRoots(cwd)) argv.push("--bind", root, root);
13
71
  if (hasGit) argv.push("--ro-bind", gitDir, gitDir);
@@ -26,8 +84,9 @@ function writableRootsFor(mode, cwd) {
26
84
  }
27
85
  }
28
86
  function buildBwrapArgv(mode, opts) {
29
- if (mode === "danger-full-access") return null;
30
87
  const cwd = path.resolve(opts.cwd);
88
+ const denyFlags = denyReadFlags(opts.denyReadPaths, { mode, cwd });
89
+ if (mode === "danger-full-access") return null;
31
90
  const gitDir = path.join(cwd, ".git");
32
91
  const hasGit = opts.gitDirExists ?? existsSync(gitDir);
33
92
  const argv = [
@@ -54,6 +113,7 @@ function buildBwrapArgv(mode, opts) {
54
113
  };
55
114
  for (const [k, v] of Object.entries(setenv)) argv.push("--setenv", k, v);
56
115
  if (mode === "workspace-write") pushWorkspaceBinds(argv, cwd, hasGit, gitDir);
116
+ argv.push(...denyFlags);
57
117
  argv.push("--chdir", cwd, "--");
58
118
  return argv;
59
119
  }
@@ -241,14 +301,14 @@ function wrapWithSeccompProgram(bwrapArgv, command, program) {
241
301
  return `exec /bin/sh -c ${shellEscapePosix(PIPE_SCRIPT)} sh ${[...words, command].map(shellEscapePosix).join(" ")}`;
242
302
  }
243
303
  var programsWritten = /* @__PURE__ */ new Map();
244
- function rememberSeccompFile(path2, program) {
245
- programsWritten.set(resolve(path2), Buffer.from(program));
304
+ function rememberSeccompFile(path3, program) {
305
+ programsWritten.set(resolve(path3), Buffer.from(program));
246
306
  }
247
307
  function removeDirOnExit(dir) {
248
308
  const cleanup = () => rmSync(dir, { recursive: true, force: true });
249
309
  process.once("exit", cleanup);
250
310
  for (const signal of ["SIGINT", "SIGTERM"]) {
251
- process.once(signal, () => {
311
+ process.prependOnceListener(signal, () => {
252
312
  cleanup();
253
313
  if (process.listenerCount(signal) === 0) process.kill(process.pid, signal);
254
314
  });
@@ -276,7 +336,7 @@ function readOnlyBindForSeccompPath(mode, cwd, seccompPath, bind) {
276
336
 
277
337
  // src/sandbox/linux-sandbox.ts
278
338
  function wrapCommandForSandbox(mode, opts, command) {
279
- const argv = buildBwrapArgv(mode, { cwd: opts.cwd, network: opts.network, env: opts.env });
339
+ const argv = buildBwrapArgv(mode, opts);
280
340
  if (argv === null) return null;
281
341
  const bin = opts.bin ?? "bwrap";
282
342
  if (opts.seccompProgram !== void 0) {
@@ -316,14 +376,25 @@ var LinuxSandbox = class extends LocalSandbox {
316
376
  * confined command could replace). `undefined` when the network is unrestricted or the arch is not
317
377
  * x86_64 (honest fallback). */
318
378
  seccompProgram;
379
+ denyReadPaths;
380
+ /**
381
+ * `"none"` exactly when the wrap passes `--unshare-net` (see `buildBwrapArgv`): a confined mode and
382
+ * `network` not set. With `network: true`, or under `danger-full-access` where nothing is wrapped,
383
+ * the command reaches whatever the host does.
384
+ */
385
+ networkPolicy;
386
+ /** `denyReadPaths`: see `BwrapArgvOptions`; a list that cannot be honoured throws `TypeError` here. */
319
387
  constructor(config, opts) {
320
388
  super(config);
321
389
  this.mode = opts.mode;
322
390
  this.network = opts.network ?? false;
391
+ this.networkPolicy = this.network || this.mode === "danger-full-access" ? { mode: "unrestricted" } : { mode: "none" };
323
392
  this.cwd = config.workDir ?? process.cwd();
324
393
  this.bin = opts.bin ?? "bwrap";
325
394
  this.env = opts.env ?? allowlistedEnv();
326
395
  this.seccompProgram = seccompProgramForNetwork(this.network);
396
+ this.denyReadPaths = opts.denyReadPaths;
397
+ denyReadFlags(this.denyReadPaths, { mode: this.mode, cwd: this.cwd });
327
398
  }
328
399
  /** Extracted for test visibility — delegates to the pure `wrapCommandForSandbox` (M57, single wrap SoT). */
329
400
  wrapCommand(command) {
@@ -334,7 +405,8 @@ var LinuxSandbox = class extends LocalSandbox {
334
405
  network: this.network,
335
406
  env: this.env,
336
407
  bin: this.bin,
337
- seccompProgram: this.seccompProgram
408
+ seccompProgram: this.seccompProgram,
409
+ denyReadPaths: this.denyReadPaths
338
410
  },
339
411
  command
340
412
  );
@@ -352,9 +424,9 @@ var LinuxSandbox = class extends LocalSandbox {
352
424
  * policy as everything else — if bwrap denies the path, the write fails, as it should. The content
353
425
  * goes over stdin (not argv) because argv has a size limit and file content does not.
354
426
  */
355
- async uploadFile(path2, content) {
356
- if (this.mode === "danger-full-access") return super.uploadFile(path2, content);
357
- const target = path2.startsWith("/") ? path2 : `${this.cwd}/${path2}`;
427
+ async uploadFile(path3, content) {
428
+ if (this.mode === "danger-full-access") return super.uploadFile(path3, content);
429
+ const target = path3.startsWith("/") ? path3 : `${this.cwd}/${path3}`;
358
430
  const b64 = Buffer.from(content).toString("base64");
359
431
  const r = await this.execute(
360
432
  `mkdir -p ${shellEscapePosix(dirname(target))} && printf %s ${shellEscapePosix(b64)} | base64 -d > ${shellEscapePosix(target)}`
@@ -382,12 +454,12 @@ function seccompPathForArch(arch, warn) {
382
454
  }
383
455
  try {
384
456
  const dir = mkdtempSync(join(tmpdir(), "ab-seccomp-"));
385
- const path2 = join(dir, "filter.bpf");
457
+ const path3 = join(dir, "filter.bpf");
386
458
  const program = buildSeccompFilter({ networkRestricted: true });
387
- writeFileSync(path2, program);
388
- rememberSeccompFile(path2, program);
459
+ writeFileSync(path3, program);
460
+ rememberSeccompFile(path3, program);
389
461
  removeDirOnExit(dir);
390
- return path2;
462
+ return path3;
391
463
  } catch (err) {
392
464
  warn(
393
465
  `[sandbox] seccomp filter unavailable (${err instanceof Error ? err.message : String(err)}) \u2014 running without syscall filter (bwrap FS/network confinement still applies).`
@@ -398,9 +470,9 @@ function seccompPathForArch(arch, warn) {
398
470
  var seccompFilterPath;
399
471
  function restrictedSeccompPath() {
400
472
  if (seccompFilterPath !== void 0) return seccompFilterPath ?? void 0;
401
- const path2 = seccompPathForArch(process.arch, (m) => console.warn(redactSecrets(m)));
402
- seccompFilterPath = path2 ?? null;
403
- return path2;
473
+ const path3 = seccompPathForArch(process.arch, (m) => console.warn(redactSecrets(m)));
474
+ seccompFilterPath = path3 ?? null;
475
+ return path3;
404
476
  }
405
477
  var warnedUnavailable = false;
406
478
  function __resetSandboxWarnLatchForTests() {
@@ -418,6 +490,7 @@ function resolveSandboxPosture(opts) {
418
490
  }
419
491
  function createSandboxBackend(opts) {
420
492
  const config = { workDir: opts.workDir, timeoutMs: opts.timeoutMs };
493
+ refuseUnhonourableDenyRead(opts.denyReadPaths, opts.mode, opts.detect ?? detectBwrapMemoized);
421
494
  if (opts.mode === "danger-full-access") return new LocalSandbox(config);
422
495
  const detection = (opts.detect ?? detectBwrapMemoized)();
423
496
  if (!detection.ok) {
@@ -430,7 +503,7 @@ function createSandboxBackend(opts) {
430
503
  }
431
504
  return new LocalSandbox(config);
432
505
  }
433
- return new LinuxSandbox(config, { mode: opts.mode, network: opts.network, bin: detection.bin });
506
+ return new LinuxSandbox(config, { ...opts, bin: detection.bin });
434
507
  }
435
508
  var interactiveWarned = false;
436
509
  function __resetInteractiveWarnLatchForTests() {
@@ -440,6 +513,7 @@ function seccompProgramForNetwork(networkOpen) {
440
513
  return networkOpen ? void 0 : restrictedSeccompProgram((m) => console.warn(redactSecrets(m)));
441
514
  }
442
515
  function decideConfinement(opts) {
516
+ refuseUnhonourableDenyRead(opts.denyReadPaths, opts.mode, opts.detect ?? detectBwrapMemoized);
443
517
  if (opts.mode === "danger-full-access") return null;
444
518
  const detection = (opts.detect ?? detectBwrapMemoized)();
445
519
  if (detection.ok) return detection.bin;
@@ -463,7 +537,8 @@ function interactiveWrapCommand(opts) {
463
537
  network: opts.network ?? false,
464
538
  env: allowlistedEnv(),
465
539
  bin,
466
- seccompProgram: seccompProgramForNetwork(opts.network ?? false)
540
+ seccompProgram: seccompProgramForNetwork(opts.network ?? false),
541
+ denyReadPaths: opts.denyReadPaths
467
542
  },
468
543
  command
469
544
  );