@orion-agents/orion-code 0.1.2 → 0.1.3

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 (113) hide show
  1. package/README.md +75 -3
  2. package/README.zh-CN.md +79 -4
  3. package/dist/commands/index.d.ts.map +1 -1
  4. package/dist/commands/index.js +168 -54
  5. package/dist/commands/index.js.map +1 -1
  6. package/dist/commands/types.d.ts +3 -1
  7. package/dist/commands/types.d.ts.map +1 -1
  8. package/dist/commands/types.js.map +1 -1
  9. package/dist/framework/query.d.ts +3 -0
  10. package/dist/framework/query.d.ts.map +1 -1
  11. package/dist/framework/query.js +1 -0
  12. package/dist/framework/query.js.map +1 -1
  13. package/dist/framework/tool-scheduler.d.ts +61 -1
  14. package/dist/framework/tool-scheduler.d.ts.map +1 -1
  15. package/dist/framework/tool-scheduler.js +165 -47
  16. package/dist/framework/tool-scheduler.js.map +1 -1
  17. package/dist/framework/tool.d.ts +6 -0
  18. package/dist/framework/tool.d.ts.map +1 -1
  19. package/dist/framework/tool.js +2 -0
  20. package/dist/framework/tool.js.map +1 -1
  21. package/dist/ink-ui/screens/ReplScreen.d.ts +2 -1
  22. package/dist/ink-ui/screens/ReplScreen.d.ts.map +1 -1
  23. package/dist/ink-ui/screens/ReplScreen.js +65 -0
  24. package/dist/ink-ui/screens/ReplScreen.js.map +1 -1
  25. package/dist/print-ui/launch.d.ts +2 -1
  26. package/dist/print-ui/launch.d.ts.map +1 -1
  27. package/dist/print-ui/launch.js +7 -0
  28. package/dist/print-ui/launch.js.map +1 -1
  29. package/dist/runtime/agent-runtime-controller.d.ts +1 -0
  30. package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
  31. package/dist/runtime/agent-runtime-controller.js +24 -3
  32. package/dist/runtime/agent-runtime-controller.js.map +1 -1
  33. package/dist/runtime/agent-runtime-protocol.d.ts +13 -1
  34. package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
  35. package/dist/runtime/agent-runtime-protocol.js +6 -0
  36. package/dist/runtime/agent-runtime-protocol.js.map +1 -1
  37. package/dist/runtime/chat-controller.d.ts +6 -0
  38. package/dist/runtime/chat-controller.d.ts.map +1 -1
  39. package/dist/runtime/chat-controller.js +13 -0
  40. package/dist/runtime/chat-controller.js.map +1 -1
  41. package/dist/runtime/goals/tools.d.ts.map +1 -1
  42. package/dist/runtime/goals/tools.js +14 -14
  43. package/dist/runtime/goals/tools.js.map +1 -1
  44. package/dist/runtime/goals/types.d.ts +6 -0
  45. package/dist/runtime/goals/types.d.ts.map +1 -1
  46. package/dist/runtime/goals/types.js.map +1 -1
  47. package/dist/runtime/turn-controller.d.ts.map +1 -1
  48. package/dist/runtime/turn-controller.js +3 -1
  49. package/dist/runtime/turn-controller.js.map +1 -1
  50. package/dist/runtime/ui-events.d.ts +17 -0
  51. package/dist/runtime/ui-events.d.ts.map +1 -1
  52. package/dist/runtime/ui-events.js.map +1 -1
  53. package/dist/services/config.d.ts.map +1 -1
  54. package/dist/services/config.js +2 -1
  55. package/dist/services/config.js.map +1 -1
  56. package/dist/services/global-config.d.ts +31 -0
  57. package/dist/services/global-config.d.ts.map +1 -1
  58. package/dist/services/global-config.js.map +1 -1
  59. package/dist/services/model-catalog.d.ts +2 -0
  60. package/dist/services/model-catalog.d.ts.map +1 -1
  61. package/dist/services/model-catalog.js +25 -15
  62. package/dist/services/model-catalog.js.map +1 -1
  63. package/dist/services/model-context.d.ts.map +1 -1
  64. package/dist/services/model-context.js +36 -0
  65. package/dist/services/model-context.js.map +1 -1
  66. package/dist/services/model-registry.d.ts.map +1 -1
  67. package/dist/services/model-registry.js +32 -0
  68. package/dist/services/model-registry.js.map +1 -1
  69. package/dist/services/tool-allowlist.d.ts +100 -0
  70. package/dist/services/tool-allowlist.d.ts.map +1 -0
  71. package/dist/services/tool-allowlist.js +250 -0
  72. package/dist/services/tool-allowlist.js.map +1 -0
  73. package/dist/terminal-ui/launch.d.ts +22 -2
  74. package/dist/terminal-ui/launch.d.ts.map +1 -1
  75. package/dist/terminal-ui/launch.js +145 -1
  76. package/dist/terminal-ui/launch.js.map +1 -1
  77. package/dist/tools/git.d.ts +4 -0
  78. package/dist/tools/git.d.ts.map +1 -1
  79. package/dist/tools/git.js +310 -3
  80. package/dist/tools/git.js.map +1 -1
  81. package/dist/tools/index.d.ts.map +1 -1
  82. package/dist/tools/index.js +56 -7
  83. package/dist/tools/index.js.map +1 -1
  84. package/dist/tools/sandbox.d.ts +139 -0
  85. package/dist/tools/sandbox.d.ts.map +1 -0
  86. package/dist/tools/sandbox.js +485 -0
  87. package/dist/tools/sandbox.js.map +1 -0
  88. package/dist/tools/web.d.ts.map +1 -1
  89. package/dist/tools/web.js +113 -42
  90. package/dist/tools/web.js.map +1 -1
  91. package/dist/tui-ui/launch.d.ts.map +1 -1
  92. package/dist/tui-ui/launch.js +46 -8
  93. package/dist/tui-ui/launch.js.map +1 -1
  94. package/dist/tui-ui/layout.d.ts.map +1 -1
  95. package/dist/tui-ui/layout.js +62 -0
  96. package/dist/tui-ui/layout.js.map +1 -1
  97. package/dist/tui-ui/runner.d.ts +6 -0
  98. package/dist/tui-ui/runner.d.ts.map +1 -1
  99. package/dist/tui-ui/runner.js +81 -1
  100. package/dist/tui-ui/runner.js.map +1 -1
  101. package/dist/tui-ui/state.d.ts +19 -1
  102. package/dist/tui-ui/state.d.ts.map +1 -1
  103. package/dist/tui-ui/state.js +35 -7
  104. package/dist/tui-ui/state.js.map +1 -1
  105. package/dist/tui-ui/terminal-image.d.ts +3 -13
  106. package/dist/tui-ui/terminal-image.d.ts.map +1 -1
  107. package/dist/tui-ui/terminal-image.js +5 -160
  108. package/dist/tui-ui/terminal-image.js.map +1 -1
  109. package/dist/utils/mask.d.ts +28 -0
  110. package/dist/utils/mask.d.ts.map +1 -0
  111. package/dist/utils/mask.js +54 -0
  112. package/dist/utils/mask.js.map +1 -0
  113. package/package.json +2 -1
@@ -0,0 +1,485 @@
1
+ "use strict";
2
+ /**
3
+ * Orion Code - OS-level sandbox planning for shell command execution.
4
+ *
5
+ * Contract (v0.1.3-2 §1.2 / P1-B / P1-E)
6
+ * ======================================
7
+ *
8
+ * Why this module exists
9
+ * ----------------------
10
+ * `bash_security.wrapForSandbox()` built a *shell string* (`docker exec ... sh -c
11
+ * '<cmd>'`). That is unsafe to claim as isolation: every layer re-parses the
12
+ * command, so quoting bugs become escapes. This module instead produces an
13
+ * **argv array** that is handed straight to `spawn()`, so the user command is a
14
+ * single opaque argument that no intermediate shell re-parses.
15
+ *
16
+ * Profiles (what the user asks for) vs backends (how we deliver it)
17
+ * ----------------------------------------------------------------
18
+ * profile none -> run exactly as before (no wrapper at all)
19
+ * profile read-only -> no filesystem writes anywhere, no network
20
+ * profile workspace-write -> writes confined to the workspace roots + temp,
21
+ * no network unless explicitly allowed
22
+ *
23
+ * backend seatbelt -> macOS `sandbox-exec` with a generated SBPL policy
24
+ * backend bubblewrap -> Linux `bwrap` with read-only binds
25
+ * backend docker -> `docker run --rm` into a configured image
26
+ *
27
+ * Availability must be PROBED, never inferred
28
+ * -------------------------------------------
29
+ * `which sandbox-exec` succeeding proves nothing: when Orion itself runs inside
30
+ * an application sandbox, every nested `sandbox_apply` fails with
31
+ * `Operation not permitted` (exit 71) even for a trivial `(allow default)`
32
+ * policy. Likewise `docker` on PATH says nothing about the daemon. So each
33
+ * backend is validated with a real, cheap execution probe whose result is
34
+ * cached for the process lifetime.
35
+ *
36
+ * Fail closed
37
+ * -----------
38
+ * If a profile other than `none` is requested and no backend passes its probe,
39
+ * {@link planSandboxedCommand} returns a failure. Callers must refuse to run the
40
+ * command. Falling back to an unsandboxed execution would turn a security
41
+ * setting into a silent no-op, which is the exact failure mode this module
42
+ * exists to prevent. An unrecognised profile value (e.g. written by a newer
43
+ * Orion) is also a failure rather than a downgrade to `none`.
44
+ *
45
+ * Configuration ownership (P1-E)
46
+ * ------------------------------
47
+ * GlobalConfig.sandbox user-wide default
48
+ * ProjectConfig.sandbox per-project override, shallow-merged on top
49
+ *
50
+ * Default is `{ profile: 'none' }`, so configs written before this module
51
+ * existed keep their exact previous behaviour. Nothing here is secret, so no
52
+ * redaction is required; rolling back is "delete the `sandbox` key", and an
53
+ * older Orion simply ignores the unknown field.
54
+ *
55
+ * Known limitations (recorded, not hidden)
56
+ * ----------------------------------------
57
+ * - seatbelt cannot be applied from inside another sandbox (see above);
58
+ * - `docker` runs the command in a *different* process tree, so Orion's
59
+ * process-group SIGTERM/SIGKILL only reaches the client. `--rm` bounds the
60
+ * leak, but abort semantics are weaker than the in-process backends;
61
+ * - none of the backends attempt to constrain CPU/memory.
62
+ */
63
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
64
+ if (k2 === undefined) k2 = k;
65
+ var desc = Object.getOwnPropertyDescriptor(m, k);
66
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
67
+ desc = { enumerable: true, get: function() { return m[k]; } };
68
+ }
69
+ Object.defineProperty(o, k2, desc);
70
+ }) : (function(o, m, k, k2) {
71
+ if (k2 === undefined) k2 = k;
72
+ o[k2] = m[k];
73
+ }));
74
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
75
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
76
+ }) : function(o, v) {
77
+ o["default"] = v;
78
+ });
79
+ var __importStar = (this && this.__importStar) || (function () {
80
+ var ownKeys = function(o) {
81
+ ownKeys = Object.getOwnPropertyNames || function (o) {
82
+ var ar = [];
83
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
84
+ return ar;
85
+ };
86
+ return ownKeys(o);
87
+ };
88
+ return function (mod) {
89
+ if (mod && mod.__esModule) return mod;
90
+ var result = {};
91
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
92
+ __setModuleDefault(result, mod);
93
+ return result;
94
+ };
95
+ })();
96
+ Object.defineProperty(exports, "__esModule", { value: true });
97
+ exports.SANDBOX_BACKENDS = exports.SANDBOX_PROFILES = void 0;
98
+ exports.mergeSandboxConfig = mergeSandboxConfig;
99
+ exports.resolveSandboxSettings = resolveSandboxSettings;
100
+ exports.resetSandboxCapabilityCache = resetSandboxCapabilityCache;
101
+ exports.detectSandboxCapabilities = detectSandboxCapabilities;
102
+ exports.formatSandboxCapabilities = formatSandboxCapabilities;
103
+ exports.buildSeatbeltPolicy = buildSeatbeltPolicy;
104
+ exports.planSandboxedCommand = planSandboxedCommand;
105
+ exports.describeSandboxPlan = describeSandboxPlan;
106
+ const child_process_1 = require("child_process");
107
+ const fs = __importStar(require("fs"));
108
+ const os = __importStar(require("os"));
109
+ const path = __importStar(require("path"));
110
+ const global_config_1 = require("../services/global-config");
111
+ exports.SANDBOX_PROFILES = [
112
+ 'none',
113
+ 'read-only',
114
+ 'workspace-write',
115
+ ];
116
+ exports.SANDBOX_BACKENDS = ['seatbelt', 'bubblewrap', 'docker'];
117
+ // ============================================================================
118
+ // Settings resolution
119
+ // ============================================================================
120
+ /** Shell used inside every backend. Kept explicit so policies can reference it. */
121
+ const INNER_SHELL = '/bin/sh';
122
+ function isSandboxProfile(value) {
123
+ return typeof value === 'string' && exports.SANDBOX_PROFILES.includes(value);
124
+ }
125
+ function sanitizeRoots(roots) {
126
+ if (!Array.isArray(roots))
127
+ return undefined;
128
+ const out = roots.filter((r) => typeof r === 'string' && r.trim().length > 0);
129
+ return out.length > 0 ? out : undefined;
130
+ }
131
+ /**
132
+ * Merge global and project sandbox settings.
133
+ * Project keys win individually; absent keys inherit the global value.
134
+ */
135
+ function mergeSandboxConfig(global, project) {
136
+ return {
137
+ profile: project?.profile ?? global?.profile,
138
+ backend: project?.backend ?? global?.backend,
139
+ allowNetwork: project?.allowNetwork ?? global?.allowNetwork,
140
+ writableRoots: sanitizeRoots(project?.writableRoots) ?? sanitizeRoots(global?.writableRoots),
141
+ image: project?.image ?? global?.image,
142
+ };
143
+ }
144
+ /** Read the effective settings for a project path. Never throws. */
145
+ function resolveSandboxSettings(projectPath) {
146
+ let global;
147
+ let project;
148
+ try {
149
+ global = (0, global_config_1.loadGlobalConfig)().sandbox;
150
+ }
151
+ catch {
152
+ global = undefined;
153
+ }
154
+ try {
155
+ project = (0, global_config_1.getProjectConfig)(projectPath).sandbox;
156
+ }
157
+ catch {
158
+ project = undefined;
159
+ }
160
+ return mergeSandboxConfig(global, project);
161
+ }
162
+ // ============================================================================
163
+ // Capability probing
164
+ // ============================================================================
165
+ let capabilityCache;
166
+ /** Drop the cached probe result. Test-only; capabilities do not change at runtime. */
167
+ function resetSandboxCapabilityCache() {
168
+ capabilityCache = undefined;
169
+ }
170
+ function probe(file, args, timeoutMs = 5000) {
171
+ try {
172
+ const res = (0, child_process_1.spawnSync)(file, args, { timeout: timeoutMs, encoding: 'utf8' });
173
+ if (res.error)
174
+ return { ok: false, detail: res.error.message };
175
+ if (res.status !== 0) {
176
+ const stderr = (res.stderr || '').trim().split('\n')[0];
177
+ return { ok: false, detail: stderr || `exit ${res.status}` };
178
+ }
179
+ return { ok: true, detail: (res.stdout || '').trim().split('\n')[0] || undefined };
180
+ }
181
+ catch (err) {
182
+ return { ok: false, detail: err instanceof Error ? err.message : String(err) };
183
+ }
184
+ }
185
+ function probeSeatbelt(platform) {
186
+ if (platform !== 'darwin') {
187
+ return { backend: 'seatbelt', available: false, reason: 'seatbelt requires macOS' };
188
+ }
189
+ // A trivial policy is enough: if `sandbox_apply` is refused (e.g. Orion is
190
+ // itself running inside an app sandbox) it fails here too.
191
+ const res = probe('/usr/bin/sandbox-exec', [
192
+ '-p',
193
+ '(version 1)(allow default)',
194
+ '/usr/bin/true',
195
+ ]);
196
+ if (!res.ok) {
197
+ return {
198
+ backend: 'seatbelt',
199
+ available: false,
200
+ reason: `sandbox-exec probe failed: ${res.detail ?? 'unknown error'}`,
201
+ };
202
+ }
203
+ return { backend: 'seatbelt', available: true, detail: '/usr/bin/sandbox-exec' };
204
+ }
205
+ function probeBubblewrap(platform) {
206
+ if (platform !== 'linux') {
207
+ return { backend: 'bubblewrap', available: false, reason: 'bubblewrap requires Linux' };
208
+ }
209
+ const res = probe('bwrap', ['--version']);
210
+ if (!res.ok) {
211
+ return {
212
+ backend: 'bubblewrap',
213
+ available: false,
214
+ reason: `bwrap unavailable: ${res.detail ?? 'not found'}`,
215
+ };
216
+ }
217
+ return { backend: 'bubblewrap', available: true, detail: res.detail };
218
+ }
219
+ function probeDocker() {
220
+ // `docker` on PATH says nothing about the daemon, so query the daemon.
221
+ const res = probe('docker', ['info', '--format', '{{.ServerVersion}}'], 8000);
222
+ if (!res.ok) {
223
+ return {
224
+ backend: 'docker',
225
+ available: false,
226
+ reason: `docker daemon unreachable: ${res.detail ?? 'not found'}`,
227
+ };
228
+ }
229
+ return { backend: 'docker', available: true, detail: `server ${res.detail ?? 'unknown'}` };
230
+ }
231
+ /** Probe every backend once and cache the matrix for this process. */
232
+ function detectSandboxCapabilities(force = false) {
233
+ if (capabilityCache && !force)
234
+ return capabilityCache;
235
+ const platform = process.platform;
236
+ const backends = [probeSeatbelt(platform), probeBubblewrap(platform), probeDocker()];
237
+ capabilityCache = {
238
+ platform,
239
+ backends,
240
+ preferred: backends.find(b => b.available)?.backend,
241
+ };
242
+ return capabilityCache;
243
+ }
244
+ /** Render the capability matrix for `/config` and diagnostics. */
245
+ function formatSandboxCapabilities(caps) {
246
+ return caps.backends.map(b => b.available
247
+ ? `${b.backend}: available${b.detail ? ` (${b.detail})` : ''}`
248
+ : `${b.backend}: unavailable${b.reason ? ` (${b.reason})` : ''}`);
249
+ }
250
+ // ============================================================================
251
+ // Policy generation
252
+ // ============================================================================
253
+ /** Resolve symlinks so a policy cannot be sidestepped via an aliased path. */
254
+ function realpathOrSelf(p) {
255
+ try {
256
+ return fs.realpathSync(p);
257
+ }
258
+ catch {
259
+ return path.resolve(p);
260
+ }
261
+ }
262
+ function uniquePaths(paths) {
263
+ const seen = new Set();
264
+ const out = [];
265
+ for (const p of paths) {
266
+ if (!p)
267
+ continue;
268
+ const resolved = realpathOrSelf(p);
269
+ if (seen.has(resolved))
270
+ continue;
271
+ seen.add(resolved);
272
+ out.push(resolved);
273
+ }
274
+ return out;
275
+ }
276
+ /** Escape a path for an SBPL string literal. */
277
+ function sbplString(value) {
278
+ return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
279
+ }
280
+ /**
281
+ * Build the seatbelt policy.
282
+ *
283
+ * Uses `(allow default)` plus targeted denies rather than `(deny default)` plus
284
+ * an allow-list: a deny-by-default policy has to enumerate every syscall a
285
+ * developer toolchain needs, and each omission looks like a mysterious crash
286
+ * rather than a security decision.
287
+ */
288
+ function buildSeatbeltPolicy(writableRoots, allowNetwork) {
289
+ const lines = ['(version 1)', '(allow default)', '(deny file-write*)'];
290
+ for (const root of writableRoots) {
291
+ lines.push(`(allow file-write* (subpath ${sbplString(root)}))`);
292
+ }
293
+ // Writing to the standard character devices is not a filesystem escape and is
294
+ // required for ordinary shell redirection to keep working.
295
+ lines.push('(allow file-write-data (literal "/dev/null") (literal "/dev/stdout") (literal "/dev/stderr") (literal "/dev/tty") (literal "/dev/dtracehelper"))');
296
+ lines.push(allowNetwork ? '(allow network*)' : '(deny network*)');
297
+ return lines.join('\n');
298
+ }
299
+ // ============================================================================
300
+ // Planning
301
+ // ============================================================================
302
+ /**
303
+ * Extra requirements a backend has beyond "the probe passed".
304
+ * Returns the blocking reason, or undefined when the backend is usable as-is.
305
+ */
306
+ function missingRequirement(backend, settings) {
307
+ if (backend === 'docker' && !settings.image?.trim()) {
308
+ return 'the docker sandbox backend requires `sandbox.image` to be configured';
309
+ }
310
+ return undefined;
311
+ }
312
+ function selectBackend(settings, caps) {
313
+ const requested = settings.backend;
314
+ if (requested && requested !== 'auto') {
315
+ const status = caps.backends.find(b => b.backend === requested);
316
+ if (!status) {
317
+ return { reason: `unknown sandbox backend "${requested}"` };
318
+ }
319
+ if (!status.available) {
320
+ return { reason: status.reason ?? `sandbox backend "${requested}" is unavailable` };
321
+ }
322
+ // An explicit choice reports its own configuration gap verbatim.
323
+ const missing = missingRequirement(requested, settings);
324
+ return missing ? { reason: missing } : { backend: requested };
325
+ }
326
+ // Auto-selection must skip backends that are installed but not yet usable,
327
+ // otherwise a host with an idle Docker daemon would report "image missing"
328
+ // and hide the real reason the preferred backend was unavailable.
329
+ for (const status of caps.backends) {
330
+ if (!status.available)
331
+ continue;
332
+ if (!missingRequirement(status.backend, settings))
333
+ return { backend: status.backend };
334
+ }
335
+ const detail = caps.backends
336
+ .map(b => {
337
+ if (!b.available)
338
+ return `${b.backend} (${b.reason ?? 'unavailable'})`;
339
+ return `${b.backend} (${missingRequirement(b.backend, settings)})`;
340
+ })
341
+ .join('; ');
342
+ return { reason: `no sandbox backend is available on ${caps.platform}: ${detail}` };
343
+ }
344
+ function plainPlan(command) {
345
+ return {
346
+ ok: true,
347
+ profile: 'none',
348
+ backend: 'none',
349
+ file: 'sh',
350
+ args: ['-c', command],
351
+ network: 'allowed',
352
+ writableRoots: [],
353
+ };
354
+ }
355
+ /**
356
+ * Turn a shell command into a spawnable argv under the configured profile.
357
+ *
358
+ * The returned `args` always end with the untouched user command as one
359
+ * element, so no intermediate shell re-parses it.
360
+ */
361
+ function planSandboxedCommand(command, options) {
362
+ const settings = options.settings ?? {};
363
+ const rawProfile = settings.profile ?? 'none';
364
+ if (!isSandboxProfile(rawProfile)) {
365
+ // Do not silently downgrade: an unknown value most likely comes from a
366
+ // newer Orion that meant something stricter than `none`.
367
+ return {
368
+ ok: false,
369
+ profile: String(rawProfile),
370
+ reason: `unknown sandbox profile "${String(rawProfile)}"; expected one of ${exports.SANDBOX_PROFILES.join(', ')}`,
371
+ capabilities: options.capabilities ?? detectSandboxCapabilities(),
372
+ };
373
+ }
374
+ if (rawProfile === 'none')
375
+ return plainPlan(command);
376
+ const caps = options.capabilities ?? detectSandboxCapabilities();
377
+ const selected = selectBackend(settings, caps);
378
+ if (!selected.backend) {
379
+ return {
380
+ ok: false,
381
+ profile: rawProfile,
382
+ reason: selected.reason ?? 'no sandbox backend available',
383
+ capabilities: caps,
384
+ };
385
+ }
386
+ const allowNetwork = settings.allowNetwork === true;
387
+ const writableRoots = rawProfile === 'workspace-write'
388
+ ? uniquePaths([options.cwd, os.tmpdir(), ...(settings.writableRoots ?? [])])
389
+ : [];
390
+ if (selected.backend === 'seatbelt') {
391
+ const policy = buildSeatbeltPolicy(writableRoots, allowNetwork);
392
+ return {
393
+ ok: true,
394
+ profile: rawProfile,
395
+ backend: 'seatbelt',
396
+ file: '/usr/bin/sandbox-exec',
397
+ args: ['-p', policy, INNER_SHELL, '-c', command],
398
+ network: allowNetwork ? 'allowed' : 'blocked',
399
+ writableRoots,
400
+ policy,
401
+ };
402
+ }
403
+ if (selected.backend === 'bubblewrap') {
404
+ const args = ['--die-with-parent', '--proc', '/proc', '--dev', '/dev'];
405
+ if (!allowNetwork)
406
+ args.push('--unshare-net');
407
+ for (const ro of ['/usr', '/bin', '/sbin', '/lib', '/lib64', '/etc', '/opt']) {
408
+ if (fs.existsSync(ro))
409
+ args.push('--ro-bind', ro, ro);
410
+ }
411
+ // Read-only view of the workspace, upgraded to read-write only when the
412
+ // profile asks for it.
413
+ const workspace = realpathOrSelf(options.cwd);
414
+ args.push(writableRoots.length > 0 ? '--bind' : '--ro-bind', workspace, workspace);
415
+ for (const root of writableRoots) {
416
+ if (root === workspace)
417
+ continue;
418
+ args.push('--bind', root, root);
419
+ }
420
+ args.push('--chdir', workspace, INNER_SHELL, '-c', command);
421
+ return {
422
+ ok: true,
423
+ profile: rawProfile,
424
+ backend: 'bubblewrap',
425
+ file: 'bwrap',
426
+ args,
427
+ network: allowNetwork ? 'allowed' : 'blocked',
428
+ writableRoots,
429
+ };
430
+ }
431
+ // docker
432
+ const image = settings.image?.trim();
433
+ if (!image) {
434
+ return {
435
+ ok: false,
436
+ profile: rawProfile,
437
+ reason: 'the docker sandbox backend requires `sandbox.image` to be configured',
438
+ capabilities: caps,
439
+ };
440
+ }
441
+ // Docker runs in a separate VM (Docker Desktop on macOS). The host path we
442
+ // pass to `-v` must be in the form Docker Desktop actually shares; resolving
443
+ // symlinks (e.g. macOS `/var` -> `/private/var`) points at a path Docker
444
+ // Desktop does not map, so the bind mount silently creates an empty
445
+ // directory and writes land somewhere the caller cannot see. We therefore
446
+ // mount `options.cwd` exactly as supplied. Per-directory write confinement
447
+ // for docker comes from `--read-only` (immutable image rootfs) plus the
448
+ // explicit rw bind mounts below — not from path-text matching.
449
+ const workspace = options.cwd;
450
+ const args = ['run', '--rm', '-i', '--read-only'];
451
+ if (!allowNetwork)
452
+ args.push('--network', 'none');
453
+ if (writableRoots.length > 0) {
454
+ args.push('-v', `${workspace}:${workspace}:rw`);
455
+ const seen = new Set([workspace]);
456
+ // Raw (non-realpathed) extra roots so Docker Desktop can resolve them.
457
+ for (const raw of [os.tmpdir(), ...(settings.writableRoots ?? [])]) {
458
+ if (!raw || seen.has(raw))
459
+ continue;
460
+ seen.add(raw);
461
+ args.push('-v', `${raw}:${raw}:rw`);
462
+ }
463
+ }
464
+ else {
465
+ args.push('-v', `${workspace}:${workspace}:ro`);
466
+ }
467
+ args.push('-w', workspace, image, INNER_SHELL, '-c', command);
468
+ return {
469
+ ok: true,
470
+ profile: rawProfile,
471
+ backend: 'docker',
472
+ file: 'docker',
473
+ args,
474
+ network: allowNetwork ? 'allowed' : 'blocked',
475
+ writableRoots,
476
+ };
477
+ }
478
+ /** One-line audit description of an active plan. */
479
+ function describeSandboxPlan(plan) {
480
+ if (plan.backend === 'none')
481
+ return 'sandbox: none';
482
+ const roots = plan.writableRoots.length > 0 ? plan.writableRoots.join(', ') : '(none)';
483
+ return `sandbox: ${plan.profile} via ${plan.backend}, network ${plan.network}, writable ${roots}`;
484
+ }
485
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../src/tools/sandbox.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C"}
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/tools/web.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAsDlE;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CA+DzE;AAoED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AA+Q5B,sDAAsD;AACtD,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AA0BD,eAAO,MAAM,YAAY,EAAE,aA4GzB,CAAC;AAkCH,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAED,eAAO,MAAM,aAAa,EAAE,aAkI1B,CAAC;AAMH,eAAO,MAAM,SAAS,EAAE,aAAa,EAAkC,CAAC"}