@tangle-network/agent-runtime 0.72.0 → 0.74.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.
- package/dist/agent.d.ts +34 -2
- package/dist/agent.js +5 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +3 -2
- package/dist/{chunk-P5OKDSLB.js → chunk-IODKUOBA.js} +5 -3
- package/dist/{chunk-P5OKDSLB.js.map → chunk-IODKUOBA.js.map} +1 -1
- package/dist/chunk-JPURCA2O.js +266 -0
- package/dist/chunk-JPURCA2O.js.map +1 -0
- package/dist/{chunk-VYXBFWHZ.js → chunk-MRWXCFV5.js} +2 -2
- package/dist/chunk-NBV35BR6.js +68 -0
- package/dist/chunk-NBV35BR6.js.map +1 -0
- package/dist/chunk-O2UPHN7X.js +114 -0
- package/dist/chunk-O2UPHN7X.js.map +1 -0
- package/dist/{chunk-HXVMLRYU.js → chunk-QKNBYHMK.js} +7 -7
- package/dist/{chunk-PHKNOAOU.js → chunk-SA5GCF2X.js} +25 -7
- package/dist/chunk-SA5GCF2X.js.map +1 -0
- package/dist/{chunk-VLF5RHEQ.js → chunk-T2HVQVB4.js} +1 -66
- package/dist/chunk-T2HVQVB4.js.map +1 -0
- package/dist/{chunk-55WKGOGU.js → chunk-ZKMOIEOB.js} +123 -149
- package/dist/chunk-ZKMOIEOB.js.map +1 -0
- package/dist/{coordination-CFVF0OzX.d.ts → coordination-DEVknvQo.d.ts} +9 -2
- package/dist/generator-YkAQrOoD.d.ts +382 -0
- package/dist/index.d.ts +13 -167
- package/dist/index.js +21 -267
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +1 -1
- package/dist/lifecycle.d.ts +868 -0
- package/dist/lifecycle.js +979 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/local-harness-BE_h8szs.d.ts +93 -0
- package/dist/{loop-runner-bin-B7biH0Gk.d.ts → loop-runner-bin-BPthX22l.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +6 -5
- package/dist/loop-runner-bin.js +7 -5
- package/dist/loops.d.ts +47 -10
- package/dist/loops.js +7 -3
- package/dist/mcp/bin.js +7 -5
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -6
- package/dist/mcp/index.js +8 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp-serve-verifier-CT1KLTG_.d.ts +162 -0
- package/dist/{openai-tools-DOI5mKNw.d.ts → openai-tools-D-VCAEmw.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-K8-xkiw1.d.ts → types-YimN9PQP.d.ts} +80 -1
- package/dist/{worktree-JXGJ1MxQ.d.ts → worktree-CtuEQ7bZ.d.ts} +2 -93
- package/dist/{worktree-fanout-DJHQy7Ux.d.ts → worktree-fanout-Cdez8GR7.d.ts} +16 -5
- package/package.json +6 -1
- package/dist/chunk-55WKGOGU.js.map +0 -1
- package/dist/chunk-PHKNOAOU.js.map +0 -1
- package/dist/chunk-VLF5RHEQ.js.map +0 -1
- /package/dist/{chunk-VYXBFWHZ.js.map → chunk-MRWXCFV5.js.map} +0 -0
- /package/dist/{chunk-HXVMLRYU.js.map → chunk-QKNBYHMK.js.map} +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// src/mcp/local-harness.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
var HARNESS_INVOCATIONS = {
|
|
4
|
+
claude: {
|
|
5
|
+
command: "claude",
|
|
6
|
+
buildArgs: (taskPrompt) => ["--headless", "-p", taskPrompt],
|
|
7
|
+
modelArgs: (model) => ["-m", model]
|
|
8
|
+
},
|
|
9
|
+
codex: {
|
|
10
|
+
command: "codex",
|
|
11
|
+
buildArgs: (taskPrompt) => ["run", taskPrompt],
|
|
12
|
+
modelArgs: (model) => ["-m", model]
|
|
13
|
+
},
|
|
14
|
+
opencode: {
|
|
15
|
+
command: "opencode",
|
|
16
|
+
buildArgs: (taskPrompt) => ["run", taskPrompt],
|
|
17
|
+
modelArgs: (model) => ["-m", model]
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function harnessInvocation(harness, profile, taskPrompt) {
|
|
21
|
+
const invocation = HARNESS_INVOCATIONS[harness];
|
|
22
|
+
if (!invocation) {
|
|
23
|
+
throw new Error(`harnessInvocation: unknown harness ${String(harness)}`);
|
|
24
|
+
}
|
|
25
|
+
const systemPrompt = profile.prompt?.systemPrompt;
|
|
26
|
+
const composedPrompt = typeof systemPrompt === "string" && systemPrompt.trim().length > 0 ? `${systemPrompt}
|
|
27
|
+
|
|
28
|
+
${taskPrompt}` : taskPrompt;
|
|
29
|
+
const args = invocation.buildArgs(composedPrompt);
|
|
30
|
+
const model = profile.model?.default;
|
|
31
|
+
if (typeof model === "string" && model.length > 0) {
|
|
32
|
+
args.push(...invocation.modelArgs(model));
|
|
33
|
+
}
|
|
34
|
+
return { command: invocation.command, args };
|
|
35
|
+
}
|
|
36
|
+
var DEFAULT_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
37
|
+
function runLocalHarness(options) {
|
|
38
|
+
const { harness, cwd, taskPrompt } = options;
|
|
39
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
40
|
+
const env = options.env ?? process.env;
|
|
41
|
+
const spawnImpl = options.spawn ?? spawn;
|
|
42
|
+
const invocation = HARNESS_INVOCATIONS[harness];
|
|
43
|
+
if (!invocation) {
|
|
44
|
+
return Promise.reject(new Error(`runLocalHarness: unknown harness ${String(harness)}`));
|
|
45
|
+
}
|
|
46
|
+
const startedAt = Date.now();
|
|
47
|
+
const command = options.invocation?.command ?? invocation.command;
|
|
48
|
+
const args = options.invocation ? [...options.invocation.args] : invocation.buildArgs(taskPrompt);
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
let child;
|
|
51
|
+
try {
|
|
52
|
+
child = spawnImpl(command, args, { cwd, env, stdio: "pipe" });
|
|
53
|
+
} catch (err) {
|
|
54
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
child.stdin?.end();
|
|
58
|
+
let stdout = "";
|
|
59
|
+
let stderr = "";
|
|
60
|
+
let timedOut = false;
|
|
61
|
+
let settled = false;
|
|
62
|
+
const timer = timeoutMs > 0 ? setTimeout(() => {
|
|
63
|
+
timedOut = true;
|
|
64
|
+
if (!child.killed) child.kill("SIGTERM");
|
|
65
|
+
}, timeoutMs) : null;
|
|
66
|
+
if (timer && typeof timer.unref === "function") {
|
|
67
|
+
;
|
|
68
|
+
timer.unref();
|
|
69
|
+
}
|
|
70
|
+
const onAbort = () => {
|
|
71
|
+
if (!child.killed) child.kill("SIGTERM");
|
|
72
|
+
};
|
|
73
|
+
if (options.signal) {
|
|
74
|
+
if (options.signal.aborted) onAbort();
|
|
75
|
+
else options.signal.addEventListener("abort", onAbort, { once: true });
|
|
76
|
+
}
|
|
77
|
+
child.stdout?.on("data", (chunk) => {
|
|
78
|
+
stdout += String(chunk);
|
|
79
|
+
});
|
|
80
|
+
child.stderr?.on("data", (chunk) => {
|
|
81
|
+
stderr += String(chunk);
|
|
82
|
+
});
|
|
83
|
+
const finalize = (result) => {
|
|
84
|
+
if (settled) return;
|
|
85
|
+
settled = true;
|
|
86
|
+
if (timer) clearTimeout(timer);
|
|
87
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
88
|
+
resolve(result);
|
|
89
|
+
};
|
|
90
|
+
child.on("error", (err) => {
|
|
91
|
+
if (settled) return;
|
|
92
|
+
settled = true;
|
|
93
|
+
if (timer) clearTimeout(timer);
|
|
94
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
95
|
+
reject(err);
|
|
96
|
+
});
|
|
97
|
+
child.on("close", (code, signal) => {
|
|
98
|
+
finalize({
|
|
99
|
+
exitCode: code,
|
|
100
|
+
stdout,
|
|
101
|
+
stderr,
|
|
102
|
+
killedBySignal: signal,
|
|
103
|
+
durationMs: Date.now() - startedAt,
|
|
104
|
+
timedOut
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
harnessInvocation,
|
|
112
|
+
runLocalHarness
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=chunk-O2UPHN7X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/local-harness.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Subprocess wrappers for the local coding-harness CLIs installed in the\n * sandbox image (claude-code, codex, opencode). Used by the in-process\n * delegation executor (`createInProcessExecutor`) so a `delegate_code` call\n * spawns a real harness on a real git worktree instead of provisioning a\n * sibling sandbox.\n *\n * All harness invocations:\n * - run with `cwd` set to the worktree\n * - inherit env from the parent (the MCP server inside the sandbox has\n * the harness's auth already)\n * - capture stdout/stderr\n * - support cancellation via AbortSignal\n * - enforce a wall-clock timeout\n */\n\nimport { type ChildProcess, spawn } from 'node:child_process'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\n\n/** Local coding harness available inside the sandbox. */\nexport type LocalHarness = 'claude' | 'codex' | 'opencode'\n\n/**\n * Default per-harness command + arg shape. `buildArgs` takes ONLY the task prompt and\n * emits the prompt-only invocation (no model, no system prompt) — the historical shape\n * the in-process executor's `streamPrompt` drives. `modelArgs` maps a resolved model to\n * the harness's selector flag (every supported harness takes `-m <model>`). The §1.5\n * profile-aware mapper `harnessInvocation` composes these to thread the full\n * supervisor-authored profile (systemPrompt + model) into argv.\n */\nconst HARNESS_INVOCATIONS: Record<\n LocalHarness,\n {\n command: string\n buildArgs: (taskPrompt: string) => string[]\n /** Map a resolved model to the harness's model-selector flag. */\n modelArgs: (model: string) => string[]\n }\n> = {\n claude: {\n command: 'claude',\n buildArgs: (taskPrompt) => ['--headless', '-p', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n codex: {\n command: 'codex',\n buildArgs: (taskPrompt) => ['run', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n opencode: {\n command: 'opencode',\n buildArgs: (taskPrompt) => ['run', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n}\n\n/** Result of mapping an `AgentProfile` + task prompt onto a harness invocation. */\nexport interface HarnessInvocation {\n command: string\n args: string[]\n}\n\n/**\n * Map a supervisor-authored `AgentProfile` + the per-task prompt onto a concrete harness\n * `command` + `args` (the §1.5 fix). UNLIKE the prompt-only `HARNESS_INVOCATIONS.buildArgs`\n * — which drops both the authored model and the system prompt — this threads the FULL\n * profile payload into argv:\n *\n * - `profile.prompt.systemPrompt` → the PROMPT channel: a portable, harness-agnostic\n * default that prepends the system prompt above the task prompt (`<system>\\n\\n<task>`),\n * so the authored standing instructions reach EVERY harness (none of the three CLIs\n * expose a portable replace-system-prompt flag for a one-shot non-interactive run).\n * - `profile.model.default` → the harness's `-m <model>` selector.\n *\n * The task prompt alone is the floor; an empty/absent profile yields exactly the legacy\n * `buildArgs(taskPrompt)` shape so existing callers are byte-identical.\n */\nexport function harnessInvocation(\n harness: LocalHarness,\n profile: AgentProfile,\n taskPrompt: string,\n): HarnessInvocation {\n const invocation = HARNESS_INVOCATIONS[harness]\n if (!invocation) {\n throw new Error(`harnessInvocation: unknown harness ${String(harness)}`)\n }\n\n const systemPrompt = profile.prompt?.systemPrompt\n const composedPrompt =\n typeof systemPrompt === 'string' && systemPrompt.trim().length > 0\n ? `${systemPrompt}\\n\\n${taskPrompt}`\n : taskPrompt\n\n const args = invocation.buildArgs(composedPrompt)\n\n const model = profile.model?.default\n if (typeof model === 'string' && model.length > 0) {\n args.push(...invocation.modelArgs(model))\n }\n\n return { command: invocation.command, args }\n}\n\n/** @experimental */\nexport interface RunLocalHarnessOptions {\n harness: LocalHarness\n /** Working directory for the subprocess (typically a worktree path). */\n cwd: string\n /** Prompt forwarded as the harness CLI's task argument. */\n taskPrompt: string\n /**\n * Pre-built command + args (e.g. from `harnessInvocation` so the full authored\n * `AgentProfile` — systemPrompt + model — reaches the harness). When set it OVERRIDES the\n * default prompt-only `buildArgs(taskPrompt)` path; `command` defaults to the harness's\n * default binary when only `args` is supplied. When absent the legacy prompt-only shape\n * is used unchanged.\n */\n invocation?: { command?: string; args: ReadonlyArray<string> }\n /** Wall-clock kill deadline (ms). Default 5 min. Subprocess SIGTERMed on expiry. */\n timeoutMs?: number\n /** Caller cancellation. SIGTERM is sent on abort. */\n signal?: AbortSignal\n /** Override env (defaults to inheriting from the parent). */\n env?: NodeJS.ProcessEnv\n /**\n * Test seam — inject a custom spawner so unit tests can mock the\n * subprocess without touching the OS. Defaults to node's `child_process.spawn`.\n */\n spawn?: (\n command: string,\n args: ReadonlyArray<string>,\n opts: {\n cwd: string\n env: NodeJS.ProcessEnv\n stdio: 'pipe'\n },\n ) => ChildProcess\n}\n\n/** @experimental */\nexport interface LocalHarnessResult {\n /** OS exit code. `null` when killed before exit. */\n exitCode: number | null\n /** Concatenated stdout. */\n stdout: string\n /** Concatenated stderr. */\n stderr: string\n /** Set when the process exited via signal (timeout / abort). */\n killedBySignal: NodeJS.Signals | null\n /** Wall-clock duration ms (spawn → exit). */\n durationMs: number\n /** Set when timeoutMs elapsed before exit. */\n timedOut: boolean\n}\n\nconst DEFAULT_TIMEOUT_MS = 5 * 60 * 1000\n\n/**\n * Spawn a local coding harness CLI as a subprocess + collect its output.\n *\n * NOT responsible for parsing the harness's output or extracting a diff —\n * the in-process executor's `streamPrompt` orchestrates `git diff` against\n * the worktree after this resolves. This function is intentionally narrow:\n * spawn, wait, capture, return.\n *\n * Fails loud — throws when:\n * - `cwd` doesn't exist (subprocess emits ENOENT; surfaced as Error)\n * - the harness binary is not on PATH (ENOENT)\n *\n * Does NOT throw when:\n * - the subprocess exits non-zero (`result.exitCode` carries the code)\n * - the subprocess is aborted / timed out (`result.killedBySignal` /\n * `result.timedOut` carries the reason)\n *\n * @experimental\n */\nexport function runLocalHarness(options: RunLocalHarnessOptions): Promise<LocalHarnessResult> {\n const { harness, cwd, taskPrompt } = options\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS\n const env = options.env ?? process.env\n const spawnImpl = options.spawn ?? spawn\n\n const invocation = HARNESS_INVOCATIONS[harness]\n if (!invocation) {\n return Promise.reject(new Error(`runLocalHarness: unknown harness ${String(harness)}`))\n }\n\n const startedAt = Date.now()\n const command = options.invocation?.command ?? invocation.command\n const args = options.invocation ? [...options.invocation.args] : invocation.buildArgs(taskPrompt)\n\n return new Promise<LocalHarnessResult>((resolve, reject) => {\n let child: ChildProcess\n try {\n child = spawnImpl(command, args, { cwd, env, stdio: 'pipe' })\n } catch (err) {\n reject(err instanceof Error ? err : new Error(String(err)))\n return\n }\n\n // The harness takes its task as an argv arg, not on stdin. Leaving stdin\n // OPEN makes a non-TTY `opencode run` (and likely the other harnesses)\n // BLOCK forever waiting on input — zero output, SIGTERM at the wall cap,\n // empty patch -> \"no candidate passed validation\". Close stdin so the\n // subprocess sees EOF and proceeds (the `cliExecutor` leaf does the same).\n child.stdin?.end()\n\n let stdout = ''\n let stderr = ''\n let timedOut = false\n let settled = false\n\n const timer =\n timeoutMs > 0\n ? setTimeout(() => {\n timedOut = true\n if (!child.killed) child.kill('SIGTERM')\n }, timeoutMs)\n : null\n if (timer && typeof (timer as { unref?: () => void }).unref === 'function') {\n ;(timer as { unref: () => void }).unref()\n }\n\n const onAbort = () => {\n if (!child.killed) child.kill('SIGTERM')\n }\n if (options.signal) {\n if (options.signal.aborted) onAbort()\n else options.signal.addEventListener('abort', onAbort, { once: true })\n }\n\n child.stdout?.on('data', (chunk) => {\n stdout += String(chunk)\n })\n child.stderr?.on('data', (chunk) => {\n stderr += String(chunk)\n })\n\n const finalize = (result: LocalHarnessResult) => {\n if (settled) return\n settled = true\n if (timer) clearTimeout(timer)\n options.signal?.removeEventListener('abort', onAbort)\n resolve(result)\n }\n\n child.on('error', (err) => {\n if (settled) return\n settled = true\n if (timer) clearTimeout(timer)\n options.signal?.removeEventListener('abort', onAbort)\n reject(err)\n })\n\n child.on('close', (code, signal) => {\n finalize({\n exitCode: code,\n stdout,\n stderr,\n killedBySignal: signal,\n durationMs: Date.now() - startedAt,\n timedOut,\n })\n })\n })\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
runAnalystLoop
|
|
3
|
-
} from "./chunk-P5OKDSLB.js";
|
|
4
1
|
import {
|
|
5
2
|
createKbGate
|
|
6
3
|
} from "./chunk-FNMGYYSS.js";
|
|
@@ -8,13 +5,16 @@ import {
|
|
|
8
5
|
definePersona,
|
|
9
6
|
runPersonified,
|
|
10
7
|
worktreeFanout
|
|
11
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SA5GCF2X.js";
|
|
12
9
|
import {
|
|
13
10
|
createExecutorRegistry
|
|
14
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZKMOIEOB.js";
|
|
12
|
+
import {
|
|
13
|
+
runAnalystLoop
|
|
14
|
+
} from "./chunk-IODKUOBA.js";
|
|
15
15
|
import {
|
|
16
16
|
ConfigError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NBV35BR6.js";
|
|
18
18
|
|
|
19
19
|
// src/loop-runner.ts
|
|
20
20
|
import {
|
|
@@ -196,4 +196,4 @@ export {
|
|
|
196
196
|
runLoopRunnerCli,
|
|
197
197
|
parseLoopRunnerArgv
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-QKNBYHMK.js.map
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
createWorktreeCliExecutor,
|
|
9
9
|
defaultSelectWinner,
|
|
10
10
|
gateOnDeliverable,
|
|
11
|
+
isAbortError,
|
|
11
12
|
notifyRuntimeHookEvent,
|
|
12
13
|
probeSandboxCapabilities,
|
|
13
14
|
randomSuffix,
|
|
@@ -16,15 +17,14 @@ import {
|
|
|
16
17
|
settledToIteration,
|
|
17
18
|
sleep,
|
|
18
19
|
stringifySafe,
|
|
19
|
-
throwIfAborted,
|
|
20
20
|
withDriverExecutor,
|
|
21
21
|
zeroTokenUsage
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZKMOIEOB.js";
|
|
23
23
|
import {
|
|
24
24
|
AnalystError,
|
|
25
25
|
PlannerError,
|
|
26
26
|
ValidationError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-NBV35BR6.js";
|
|
28
28
|
|
|
29
29
|
// src/runtime/index.ts
|
|
30
30
|
import { computeFindingId, makeFinding as makeFinding2 } from "@tangle-network/agent-eval";
|
|
@@ -2515,6 +2515,18 @@ function printBenchmarkReport(report) {
|
|
|
2515
2515
|
}
|
|
2516
2516
|
|
|
2517
2517
|
// src/runtime/sandbox-run.ts
|
|
2518
|
+
var SandboxRunAbortError = class extends Error {
|
|
2519
|
+
name = "AbortError";
|
|
2520
|
+
/** Events drained from the stream before the abort interrupted the turn. */
|
|
2521
|
+
events;
|
|
2522
|
+
/** The last artifact read error, if the abort fired during the retry loop. */
|
|
2523
|
+
readError;
|
|
2524
|
+
constructor(events, readError) {
|
|
2525
|
+
super("aborted");
|
|
2526
|
+
this.events = events;
|
|
2527
|
+
if (readError !== void 0) this.readError = readError;
|
|
2528
|
+
}
|
|
2529
|
+
};
|
|
2518
2530
|
async function openSandboxRun(client, options, deliverable) {
|
|
2519
2531
|
const runId = options.runId ?? `sandbox-run-${randomSuffix()}`;
|
|
2520
2532
|
const now = options.now ?? Date.now;
|
|
@@ -2567,17 +2579,22 @@ async function openSandboxRun(client, options, deliverable) {
|
|
|
2567
2579
|
});
|
|
2568
2580
|
async function settle2(box, events) {
|
|
2569
2581
|
const collected = [];
|
|
2570
|
-
|
|
2582
|
+
try {
|
|
2583
|
+
for await (const ev of events) collected.push(ev);
|
|
2584
|
+
} catch (err) {
|
|
2585
|
+
if (isAbortError(err)) throw new SandboxRunAbortError(collected);
|
|
2586
|
+
throw err;
|
|
2587
|
+
}
|
|
2571
2588
|
if (deliverable.kind === "events") {
|
|
2572
2589
|
return { out: deliverable.fromEvents(collected), events: collected };
|
|
2573
2590
|
}
|
|
2574
|
-
|
|
2591
|
+
if (options.signal.aborted) throw new SandboxRunAbortError(collected);
|
|
2575
2592
|
let raw = "";
|
|
2576
2593
|
let readError;
|
|
2577
2594
|
const readAttempts = 4;
|
|
2578
2595
|
const readDelayMs = options.readRetryDelayMs ?? 1e3;
|
|
2579
2596
|
for (let attempt = 0; attempt < readAttempts; attempt += 1) {
|
|
2580
|
-
|
|
2597
|
+
if (options.signal.aborted) throw new SandboxRunAbortError(collected, readError);
|
|
2581
2598
|
try {
|
|
2582
2599
|
raw = await box.fs.read(deliverable.path);
|
|
2583
2600
|
readError = void 0;
|
|
@@ -3992,6 +4009,7 @@ export {
|
|
|
3992
4009
|
runAgentic,
|
|
3993
4010
|
runBenchmark,
|
|
3994
4011
|
printBenchmarkReport,
|
|
4012
|
+
SandboxRunAbortError,
|
|
3995
4013
|
openSandboxRun,
|
|
3996
4014
|
strategyAuthorContract,
|
|
3997
4015
|
assertStrategyContract,
|
|
@@ -4018,4 +4036,4 @@ export {
|
|
|
4018
4036
|
computeFindingId,
|
|
4019
4037
|
makeFinding2 as makeFinding
|
|
4020
4038
|
};
|
|
4021
|
-
//# sourceMappingURL=chunk-
|
|
4039
|
+
//# sourceMappingURL=chunk-SA5GCF2X.js.map
|