@tangle-network/agent-runtime 0.343.4 → 0.348.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.
Files changed (68) hide show
  1. package/dist/{activation-C5rFWXGj.js → activation-BEGalhOL.js} +2 -2
  2. package/dist/{activation-C5rFWXGj.js.map → activation-BEGalhOL.js.map} +1 -1
  3. package/dist/{activation-NJiV0MHb.d.ts → activation-NQZP_mdI.d.ts} +2 -2
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +3 -3
  6. package/dist/{coordination-manager-T98ZbsEt.js → coordination-manager-Bm6leXc6.js} +22 -19
  7. package/dist/coordination-manager-Bm6leXc6.js.map +1 -0
  8. package/dist/{delegate-CjdtLf1v.js → delegate-Cp5-PsaX.js} +2 -2
  9. package/dist/{delegate-CjdtLf1v.js.map → delegate-Cp5-PsaX.js.map} +1 -1
  10. package/dist/durable.d.ts +7 -2
  11. package/dist/durable.js +127 -115
  12. package/dist/durable.js.map +1 -1
  13. package/dist/{graph-kgzTaNMA.js → graph-CE_pzU31.js} +5 -4
  14. package/dist/graph-CE_pzU31.js.map +1 -0
  15. package/dist/{improve-DevAd83a.js → improve-wT11zteg.js} +6 -6
  16. package/dist/{improve-DevAd83a.js.map → improve-wT11zteg.js.map} +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.d.ts +2 -2
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +2 -2
  22. package/dist/kernel.js +11 -11
  23. package/dist/{loop-runner-D56Rpd2z.d.ts → loop-runner-CY5HHhtR.d.ts} +2 -2
  24. package/dist/{loop-runner-CyUoVMkv.js → loop-runner-CZzeeJTG.js} +2 -2
  25. package/dist/{loop-runner-CyUoVMkv.js.map → loop-runner-CZzeeJTG.js.map} +1 -1
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +1 -1
  30. package/dist/mcp/index.js +5 -5
  31. package/dist/mcp/index.js.map +1 -1
  32. package/dist/profiles.d.ts +1 -1
  33. package/dist/{provision-supervisor-CysVhSqV.js → provision-supervisor-CC0HdOHo.js} +5 -5
  34. package/dist/{provision-supervisor-CysVhSqV.js.map → provision-supervisor-CC0HdOHo.js.map} +1 -1
  35. package/dist/{durable-file-DLcrzrjL.js → record-events-D93DkpAx.js} +100 -3
  36. package/dist/record-events-D93DkpAx.js.map +1 -0
  37. package/dist/{run-cancellation-CEDiqfhC.js → run-cancellation-CzFhQGMa.js} +11 -9
  38. package/dist/run-cancellation-CzFhQGMa.js.map +1 -0
  39. package/dist/{runtime-CefFtXC2.js → runtime-B_40dXlF.js} +270 -57
  40. package/dist/runtime-B_40dXlF.js.map +1 -0
  41. package/dist/{search-executor-t05_9Wwk.js → search-executor-COd2F2wp.js} +2 -2
  42. package/dist/{search-executor-t05_9Wwk.js.map → search-executor-COd2F2wp.js.map} +1 -1
  43. package/dist/{server-DjrVWzH2.js → server-BGB4R4wQ.js} +3 -3
  44. package/dist/{server-DjrVWzH2.js.map → server-BGB4R4wQ.js.map} +1 -1
  45. package/dist/{structural-rollout-CpJknIaL.js → structural-rollout-Wl_rCuzM.js} +2 -2
  46. package/dist/{structural-rollout-CpJknIaL.js.map → structural-rollout-Wl_rCuzM.js.map} +1 -1
  47. package/dist/{supervise-BuVVC7Bl.js → supervise-BUOeThuB.js} +122 -63
  48. package/dist/supervise-BUOeThuB.js.map +1 -0
  49. package/dist/{supervisor-D3M9ab1v.js → supervisor-DDy0aEtR.js} +438 -170
  50. package/dist/supervisor-DDy0aEtR.js.map +1 -0
  51. package/dist/testing.d.ts +1 -1
  52. package/dist/testing.js +11 -11
  53. package/dist/{top-snapshot-BGYI6G6K.js → top-snapshot-CflmaDgk.js} +6 -4
  54. package/dist/top-snapshot-CflmaDgk.js.map +1 -0
  55. package/dist/tui/bin.js +2 -2
  56. package/dist/tui/index.d.ts +1 -1
  57. package/dist/tui/index.js +2 -2
  58. package/dist/{types-D0ZRqIJh.d.ts → types-hc4cmSc7.d.ts} +102 -13
  59. package/package.json +11 -11
  60. package/skills/agent-graphs/SKILL.md +38 -2
  61. package/dist/coordination-manager-T98ZbsEt.js.map +0 -1
  62. package/dist/durable-file-DLcrzrjL.js.map +0 -1
  63. package/dist/graph-kgzTaNMA.js.map +0 -1
  64. package/dist/run-cancellation-CEDiqfhC.js.map +0 -1
  65. package/dist/runtime-CefFtXC2.js.map +0 -1
  66. package/dist/supervise-BuVVC7Bl.js.map +0 -1
  67. package/dist/supervisor-D3M9ab1v.js.map +0 -1
  68. package/dist/top-snapshot-BGYI6G6K.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { i as publishExclusiveDurableFile, n as assertNoSymlinkDescendant, s as sha256 } from "./durable-file-DLcrzrjL.js";
1
+ import { a as publishExclusiveDurableFile, c as captureRunWriteContext, l as fenceRunWrite, p as sha256, r as assertNoSymlinkDescendant, s as writeAtomicDurableFile, t as spawnJournalRecordEvents } from "./record-events-D93DkpAx.js";
2
2
  import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-DodWX-cb.js";
3
3
  import { $ as isAbortError$1, B as sha256Bytes$1, Ct as armDeadlineTimer, Dt as singleFlightTeardown, Et as isDeadlineAbortReason, G as addTokenUsage, H as hasControlCharacter, I as deepFreezeCandidate, J as cloneTokenUsage, K as chargedTokens, M as verifyWorkspaceSnapshotArtifacts, Ot as teardownExecutor, Q as hasCompleteCacheBreakdown, St as ROOT_DEADLINE_REASON, Tt as checkInIdleMs, U as abortError, W as addSpend, X as errorMessage, Y as deleteBoxSafe, Z as fnv1a32Hex, _t as withBudgetResources, at as roundBoxMinutes, c as verifyAgentCandidateWorkspaceTree, ct as throwAbort, dt as withTimeout, et as isAsyncIterable, ft as zeroSpend, g as verifiedArtifactChunks, gt as resourceTelemetry, ht as assertResources, it as randomUuid, kt as teardownSurfaces, lt as throwIfAborted, mt as addResourceSpend, nt as promptCacheTokenClasses, o as readAgentCandidateWorkspaceArtifactFiles, ot as sleep, pt as zeroTokenUsage, q as cloneSpend, rt as randomSuffix, s as verifyAgentCandidateWorkspaceArtifacts, st as stringifySafe, t as assertSandboxProfileCompatibility, tt as mapWithConcurrency, ut as unmeteredSpend, v as verifyAgentCandidateWorkspaceArchive, vt as ACCEPTED_RESULT_GRACE_MS, wt as boundedChildDeadlineAt, yt as CHILD_DEADLINE_REASON } from "./sandbox-profile-compat-_fEtHPCj.js";
4
4
  import { runTaskQueue } from "./task-queue.js";
@@ -13,7 +13,7 @@ import { REDACTION_VERSION as REDACTION_VERSION$1, redact } from "@tangle-networ
13
13
  import { z } from "zod";
14
14
  import { createHash, randomBytes, randomUUID } from "node:crypto";
15
15
  import { LedgerCanonicalizationError, canonicalString, jsonDocument, merkleLeafHash, merkleRoot, merkleSalt } from "@tangle-network/agent-eval/ledger-core";
16
- import { appendFileSync, closeSync, constants, createReadStream, existsSync, mkdirSync, openSync, readFileSync } from "node:fs";
16
+ import { appendFileSync, closeSync, constants, createReadStream, existsSync, fstatSync, fsyncSync, ftruncateSync, mkdirSync, openSync, readFileSync, readSync, statSync, writeSync } from "node:fs";
17
17
  import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
18
18
  import { spawn } from "node:child_process";
19
19
  import { access, chmod, copyFile, mkdir, mkdtemp, open, readFile, readdir, realpath, rm, rmdir, stat, symlink, writeFile } from "node:fs/promises";
@@ -23,6 +23,7 @@ import { homedir, hostname, tmpdir } from "node:os";
23
23
  import { request } from "node:http";
24
24
  import { request as request$1 } from "node:https";
25
25
  import { Readable } from "node:stream";
26
+ import { AsyncLocalStorage } from "node:async_hooks";
26
27
  import { ATTR, deriveHexId, isW3CSpanId, isW3CTraceId } from "@tangle-network/agent-trace-contract";
27
28
  import { clearImmediate, setImmediate as setImmediate$1 } from "node:timers";
28
29
  //#region src/runtime/turn-input.ts
@@ -3164,7 +3165,7 @@ function leafContinuationExecutionId(nodeId, inputSeq) {
3164
3165
  return `${nodeId}:input:${inputSeq}`;
3165
3166
  }
3166
3167
  const retainedPreparations = /* @__PURE__ */ new WeakMap();
3167
- /** Reconstruct an admitted manager through its original composition boundary. @internal */
3168
+ /** Reconstruct an admitted worker through its original composition boundary. @internal */
3168
3169
  function registerRetainedExecutorPreparation(factory, prepare) {
3169
3170
  retainedPreparations.set(factory, prepare);
3170
3171
  return factory;
@@ -4235,8 +4236,8 @@ const CODEX_PERMISSION_PROFILE = "agent_runtime_reproducible";
4235
4236
  * Default per-harness command + arg shape. `buildArgs` takes ONLY the task prompt and
4236
4237
  * emits the prompt-only invocation (no model, no system prompt) — the safe default shape
4237
4238
  * the in-process executor's `streamPrompt` drives. `modelArgs` maps a resolved model to
4238
- * the harness's selector flag, which each harness spells for itself: codex and opencode
4239
- * take `-m <model>`, claude-code and pi take `--model <model>`. The §1.5
4239
+ * the harness's selector flag, which each harness spells for itself: codex, kimi-code and
4240
+ * opencode take `-m <model>`, claude-code and pi take `--model <model>`. The §1.5
4240
4241
  * profile-aware mapper `harnessInvocation` composes these to thread the full
4241
4242
  * supervisor-authored profile (systemPrompt + model) into argv.
4242
4243
  *
@@ -4259,7 +4260,8 @@ const HARNESS_INVOCATIONS = {
4259
4260
  },
4260
4261
  args: (level) => ["--effort", level]
4261
4262
  },
4262
- permissionBypassArgs: () => ["--dangerously-skip-permissions"]
4263
+ permissionBypassArgs: () => ["--dangerously-skip-permissions"],
4264
+ profileMcp: true
4263
4265
  },
4264
4266
  codex: {
4265
4267
  command: "codex",
@@ -4283,7 +4285,8 @@ const HARNESS_INVOCATIONS = {
4283
4285
  "-c",
4284
4286
  "approval_policy=\"never\""
4285
4287
  ],
4286
- fullAccessArgs: () => ["--dangerously-bypass-approvals-and-sandbox"]
4288
+ fullAccessArgs: () => ["--dangerously-bypass-approvals-and-sandbox"],
4289
+ profileMcp: true
4287
4290
  },
4288
4291
  opencode: {
4289
4292
  command: "opencode",
@@ -4300,7 +4303,8 @@ const HARNESS_INVOCATIONS = {
4300
4303
  },
4301
4304
  args: (level) => ["--variant", level]
4302
4305
  },
4303
- permissionBypassArgs: () => ["--auto"]
4306
+ permissionBypassArgs: () => ["--auto"],
4307
+ profileMcp: true
4304
4308
  },
4305
4309
  pi: {
4306
4310
  command: "pi",
@@ -4317,7 +4321,14 @@ const HARNESS_INVOCATIONS = {
4317
4321
  },
4318
4322
  args: (level) => ["--thinking", level]
4319
4323
  },
4320
- permissionBypassArgs: () => ["--approve"]
4324
+ permissionBypassArgs: () => ["--approve"],
4325
+ profileMcp: true
4326
+ },
4327
+ "kimi-code": {
4328
+ command: "kimi",
4329
+ buildArgs: (taskPrompt) => ["-p", taskPrompt],
4330
+ modelArgs: (model) => ["-m", model],
4331
+ profileMcp: true
4321
4332
  }
4322
4333
  };
4323
4334
  /** Every local harness, in table order — the one list `AGENT_RUNTIME_LOCAL_HARNESSES` and any
@@ -4331,6 +4342,15 @@ const LOCAL_HARNESSES = Object.keys(HARNESS_INVOCATIONS);
4331
4342
  function harnessSupportsReasoningEffort(harness, reasoningEffort) {
4332
4343
  return HARNESS_INVOCATIONS[harness].reasoning?.levels[reasoningEffort] !== void 0;
4333
4344
  }
4345
+ /**
4346
+ * Whether a profile's MCP servers reach this harness on the local-harness path — the row's
4347
+ * `profileMcp` claim that the shared materializer's plan names a config surface the installed
4348
+ * CLI reads. Admission checks read this so a profile the spawn would silently disarm is
4349
+ * rejected BEFORE any workspace state is created, against the same table that emits the argv.
4350
+ */
4351
+ function harnessMaterializesProfileMcp(harness) {
4352
+ return HARNESS_INVOCATIONS[harness].profileMcp === true;
4353
+ }
4334
4354
  function harnessReasoningArgs(harness, reasoningEffort) {
4335
4355
  const reasoning = HARNESS_INVOCATIONS[harness].reasoning;
4336
4356
  const level = reasoning?.levels[reasoningEffort];
@@ -4399,6 +4419,7 @@ function harnessProfileModel(harness, profile) {
4399
4419
  const provider = profile.model?.provider?.trim();
4400
4420
  if (!provider) return model;
4401
4421
  if (harness === "opencode") return model.includes("/") ? model : `${provider}/${model}`;
4422
+ if (harness === "kimi-code") return model;
4402
4423
  const nativeProvider = harness === "codex" ? "openai" : "anthropic";
4403
4424
  if (provider !== nativeProvider) throw new Error(`harnessInvocation: ${harness} cannot materialize model provider ${JSON.stringify(provider)}; expected ${nativeProvider}`);
4404
4425
  return model;
@@ -5377,7 +5398,7 @@ async function runLocalHarness(options) {
5377
5398
  *
5378
5399
  * Git worktree helpers for the in-process delegation executor. Each
5379
5400
  * delegation runs in its own worktree so multiple parallel harness
5380
- * subprocesses (claude / codex / opencode in a 3-way fanout) don't clobber
5401
+ * subprocesses (claude / codex / opencode / pi / kimi-code in an N-way fanout) don't clobber
5381
5402
  * each other's edits on the shared workspace.
5382
5403
  *
5383
5404
  * Worktrees live under `<repoRoot>/.agent-worktrees/<runId>/`. After the
@@ -5534,7 +5555,7 @@ async function removeWorktree(options) {
5534
5555
  /**
5535
5556
  *
5536
5557
  * The ONE worktree-harness execution core. The physical act — run a supervisor-authored
5537
- * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode) against a fresh git
5558
+ * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode / pi / kimi-code) against a fresh git
5538
5559
  * worktree off `repoRoot`, capture the diff, derive the test/typecheck PASS signals, then clean
5539
5560
  * up — lives here ONCE. Two executors adapt it to two ports without re-implementing it:
5540
5561
  * - `createWorktreeCliExecutor` — the `Scope`/`Supervisor` leaf `Executor`.
@@ -5871,6 +5892,7 @@ function assertSupportedWorktreeProfile(profile, harness) {
5871
5892
  const unsupportedAxes = [];
5872
5893
  const reasoningEffort = profile.model?.reasoningEffort;
5873
5894
  if (reasoningEffort !== void 0 && !harnessSupportsReasoningEffort(harness, reasoningEffort)) unsupportedAxes.push("model.reasoningEffort");
5895
+ if (hasEnabledProfileMcpServer(profile) && !harnessMaterializesProfileMcp(harness)) unsupportedAxes.push("mcp");
5874
5896
  if (unsupportedAxes.length > 0) throw new Error(`runWorktreeHarness: profile requests unsupported worktree behavior: ${unsupportedAxes.join(", ")}`);
5875
5897
  }
5876
5898
  function assertSafeMaterializedPaths(plan) {
@@ -5883,6 +5905,9 @@ function isGitMetadataSegment(segment) {
5883
5905
  const windowsCanonical = segment.replace(/[ .]+$/u, "").toLowerCase();
5884
5906
  return windowsCanonical === ".git" || windowsCanonical.startsWith(".git:");
5885
5907
  }
5908
+ function hasEnabledProfileMcpServer(profile) {
5909
+ return Object.values(profile.mcp ?? {}).some((server) => server.enabled !== false);
5910
+ }
5886
5911
  function profileMaterializationReceipt(applied, resourceInstructions) {
5887
5912
  return {
5888
5913
  workspacePlanDigest: applied.workspacePlanDigest,
@@ -9037,9 +9062,9 @@ const CONTINUATIONS_DIR = "continuations";
9037
9062
  async function writeContinuationFiles(dir, continuation, files) {
9038
9063
  const at = join(dir, String(continuation));
9039
9064
  await mkdir(at, { recursive: true });
9040
- await writeFile(join(at, "note.md"), `${files.note}\n`, "utf8");
9041
- await writeFile(join(at, "verdict.json"), `${JSON.stringify(files.verdict ?? null, null, 2)}\n`, "utf8");
9042
- if (files.panel !== void 0) await writeFile(join(at, "panel.jsonl"), files.panel.map((line) => JSON.stringify(line)).join("\n") + (files.panel.length ? "\n" : ""), "utf8");
9065
+ writeAtomicDurableFile(join(at, "note.md"), `${files.note}\n`);
9066
+ writeAtomicDurableFile(join(at, "verdict.json"), `${JSON.stringify(files.verdict ?? null, null, 2)}\n`);
9067
+ if (files.panel !== void 0) writeAtomicDurableFile(join(at, "panel.jsonl"), files.panel.map((line) => JSON.stringify(line)).join("\n") + (files.panel.length ? "\n" : ""));
9043
9068
  }
9044
9069
  /** The best composite across `reads`, or `undefined` when no read scored. */
9045
9070
  function bestComposite(reads) {
@@ -9249,19 +9274,53 @@ function createContinuationKeeper(input) {
9249
9274
  * executor has produced its output. The inner `score` is preserved; only `valid` is gated.
9250
9275
  */
9251
9276
  function gateOnDeliverable(inner, deliverable) {
9252
- let gated;
9253
- const check = async (out, baseScore) => {
9254
- let delivered;
9255
- try {
9256
- delivered = checkVerdictOf(await deliverable.check(out)).pass;
9257
- } catch {
9258
- delivered = false;
9259
- }
9260
- return {
9261
- valid: delivered,
9262
- score: baseScore ?? (delivered ? 1 : 0)
9277
+ return wrapCompletionGate(inner, (result) => checkDeliverable(deliverable, result));
9278
+ }
9279
+ /** Build a worker with the same check on durable acceptance and normal completion. @internal */
9280
+ function gateFactoryOnDeliverable(factory, deliverable) {
9281
+ return (spec, ctx) => {
9282
+ const retention = retainedExecutorContext(ctx);
9283
+ if (retention === void 0) return gateOnDeliverable(factory(spec, ctx), deliverable);
9284
+ const verdicts = /* @__PURE__ */ new WeakMap();
9285
+ const check = (result) => {
9286
+ let verdict = verdicts.get(result);
9287
+ if (verdict === void 0) {
9288
+ verdict = checkDeliverable(deliverable, result);
9289
+ verdicts.set(result, verdict);
9290
+ }
9291
+ return verdict;
9263
9292
  };
9293
+ const checkedRetention = (source) => ({
9294
+ ...source,
9295
+ onResult: async (result) => source.onResult({
9296
+ ...result,
9297
+ verdict: await check(result)
9298
+ }),
9299
+ ...source.continueInvocation === void 0 ? {} : { continueInvocation: async (task) => checkedRetention(await source.continueInvocation(task)) }
9300
+ });
9301
+ return wrapCompletionGate(factory(spec, {
9302
+ ...ctx,
9303
+ seams: {
9304
+ ...ctx.seams,
9305
+ [retainedExecutorSeamKey]: checkedRetention(retention)
9306
+ }
9307
+ }), check);
9308
+ };
9309
+ }
9310
+ async function checkDeliverable(deliverable, result) {
9311
+ let delivered;
9312
+ try {
9313
+ delivered = checkVerdictOf(await deliverable.check(result.out)).pass;
9314
+ } catch {
9315
+ delivered = false;
9316
+ }
9317
+ return {
9318
+ valid: delivered,
9319
+ score: result.verdict?.score ?? (delivered ? 1 : 0)
9264
9320
  };
9321
+ }
9322
+ function wrapCompletionGate(inner, check) {
9323
+ let gated;
9265
9324
  /**
9266
9325
  * Ask the delivery question once, from whatever the inner executor managed to produce.
9267
9326
  *
@@ -9275,7 +9334,7 @@ function gateOnDeliverable(inner, deliverable) {
9275
9334
  } catch {
9276
9335
  return;
9277
9336
  }
9278
- gated = await check(art.out, art.verdict?.score);
9337
+ gated = await check(art);
9279
9338
  };
9280
9339
  const gateExecution = (r) => {
9281
9340
  if (isAsyncIterable(r)) return (async function* () {
@@ -9293,7 +9352,7 @@ function gateOnDeliverable(inner, deliverable) {
9293
9352
  await settleVerdict();
9294
9353
  throw error;
9295
9354
  }
9296
- gated = await check(res.out, res.verdict?.score);
9355
+ gated = await check(res);
9297
9356
  return {
9298
9357
  ...res,
9299
9358
  verdict: gated
@@ -9308,6 +9367,7 @@ function gateOnDeliverable(inner, deliverable) {
9308
9367
  ...inner.traceSource ? { traceSource: () => inner.traceSource?.() } : {},
9309
9368
  ...inner.metered ? { metered: () => inner.metered?.() } : {},
9310
9369
  ...inner.accounting ? { accounting: () => inner.accounting?.() } : {},
9370
+ ...inner.resultAccepted ? { resultAccepted: () => inner.resultAccepted?.() === true } : {},
9311
9371
  ...inner.harnessTranscript ? { harnessTranscript: () => inner.harnessTranscript?.() } : {},
9312
9372
  ...inner.harnessTranscriptSettled ? { harnessTranscriptSettled: () => inner.harnessTranscriptSettled?.() ?? Promise.resolve() } : {},
9313
9373
  execute: (task, signal) => gateExecution(inner.execute(task, signal)),
@@ -11078,13 +11138,15 @@ function recordLaunch(env, ids, options) {
11078
11138
  dst: ids.TANGLE_RUN_ID,
11079
11139
  attrs: {}
11080
11140
  });
11081
- const fd = openSync(join(dir, `${host}.jsonl`), "a", 384);
11082
- try {
11083
- appendFileSync(fd, node);
11084
- appendFileSync(fd, edge);
11085
- } finally {
11086
- closeSync(fd);
11087
- }
11141
+ fenceRunWrite(() => {
11142
+ const fd = openSync(join(dir, `${host}.jsonl`), "a", 384);
11143
+ try {
11144
+ appendFileSync(fd, node);
11145
+ appendFileSync(fd, edge);
11146
+ } finally {
11147
+ closeSync(fd);
11148
+ }
11149
+ });
11088
11150
  } catch {}
11089
11151
  }
11090
11152
  //#endregion
@@ -12925,7 +12987,7 @@ function bridgeOutputText(out) {
12925
12987
  }
12926
12988
  /**
12927
12989
  * The leaf `createWorktreeCliExecutor` as a backend-as-data factory: a supervisor-authored
12928
- * `AgentProfile` driving claude / codex / opencode on its own worktree. `budgetExempt` like
12990
+ * `AgentProfile` driving claude / codex / opencode / pi / kimi-code on its own worktree. `budgetExempt` like
12929
12991
  * the other CLI leaves; the authored systemPrompt + model reach the harness via §1.5.
12930
12992
  */
12931
12993
  //#endregion
@@ -13085,7 +13147,7 @@ const routerToolsSeamKey = "router-tools";
13085
13147
  /**
13086
13148
  *
13087
13149
  * The worktree-CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
13088
- * coding-harness CLI (claude / codex / opencode) on its OWN git worktree, surfaced as the open
13150
+ * coding-harness CLI (claude / codex / opencode / pi / kimi-code) on its OWN git worktree, surfaced as the open
13089
13151
  * `Executor<Out>` port (`./types`). It is a LEAF executor: it plugs straight into the
13090
13152
  * `Scope`/`Supervisor` recursion and `gateOnDeliverable`, so it IS the canonical recursive path
13091
13153
  * (no `runAgentRounds`/virtual-SandboxInstance shim in between).
@@ -23649,7 +23711,7 @@ var SpawnEventIndex = class {
23649
23711
  }
23650
23712
  if (!outsideCursorNamespace(event) && this.cursors.has(event.seq)) throw new Error(`spawn journal corrupted: duplicate cursor seq ${event.seq} in tree '${this.root}'; the cursor order replay relies on is not unique`);
23651
23713
  }
23652
- /** Called only after validation and, for the file writer, a successful durable append. */
23714
+ /** Called after validation; a file writer discards staged state if grouped publication fails. */
23653
23715
  add(event) {
23654
23716
  if (!outsideCursorNamespace(event)) this.cursors.add(event.seq);
23655
23717
  if (event.kind !== "spawned" && event.kind !== "materialized" && event.kind !== "seat-materialized" && event.kind !== "execution-bound" && event.kind !== "execution-input" && event.kind !== "execution-admitted" && event.kind !== "execution-result" && event.kind !== "execution-abandoned" && event.kind !== "environment-teardown" && event.kind !== "environment-terminal" && !closesCursorSlot(event)) return;
@@ -23796,6 +23858,7 @@ const outsideKinds = /* @__PURE__ */ new Set([
23796
23858
  "seat-segment",
23797
23859
  "seat-materialized",
23798
23860
  "seat-paused",
23861
+ "run-parked",
23799
23862
  "root-segment",
23800
23863
  "root-reentered",
23801
23864
  "reopened",
@@ -23815,6 +23878,81 @@ function insideCursorNamespace(ev) {
23815
23878
  return !outsideKinds.has(ev.kind);
23816
23879
  }
23817
23880
  //#endregion
23881
+ //#region src/durable/jsonl-append.ts
23882
+ /** Commit JSONL bytes and validate their descriptor under one generation fence. @internal */
23883
+ function commitJsonLine(path, record, acknowledge) {
23884
+ const encoded = JSON.stringify(record);
23885
+ if (encoded === void 0) throw new TypeError("JSONL records must be JSON serializable");
23886
+ return fenceRunWrite(() => {
23887
+ const separator = prepareJsonlTail(path);
23888
+ const fd = openSync(path, "a");
23889
+ try {
23890
+ const bytes = Buffer.from(`${separator ? "\n" : ""}${encoded}\n`);
23891
+ let offset = 0;
23892
+ while (offset < bytes.length) {
23893
+ const written = writeSync(fd, bytes, offset, bytes.length - offset);
23894
+ if (written <= 0) throw new Error(`append-only file write made no progress at byte ${offset}`);
23895
+ offset += written;
23896
+ }
23897
+ fsyncSync(fd);
23898
+ return acknowledge?.(fd);
23899
+ } finally {
23900
+ closeSync(fd);
23901
+ }
23902
+ });
23903
+ }
23904
+ /** Recover only an uncommitted tail. Caller holds the generation fence. @internal */
23905
+ function prepareJsonlTail(path) {
23906
+ let fd;
23907
+ try {
23908
+ fd = openSync(path, "r+");
23909
+ } catch (error) {
23910
+ if (error.code === "ENOENT") return false;
23911
+ throw error;
23912
+ }
23913
+ try {
23914
+ const size = fstatSync(fd).size;
23915
+ if (size === 0) return false;
23916
+ const last = Buffer.allocUnsafe(1);
23917
+ readAt(fd, last, size - 1);
23918
+ if (last[0] === 10) return false;
23919
+ const chunks = [];
23920
+ let end = size;
23921
+ let tailStart = 0;
23922
+ while (end > 0) {
23923
+ const start = Math.max(0, end - 65536);
23924
+ const chunk = Buffer.allocUnsafe(end - start);
23925
+ readAt(fd, chunk, start);
23926
+ const newline = chunk.lastIndexOf(10);
23927
+ chunks.push(chunk.subarray(newline + 1));
23928
+ if (newline >= 0) {
23929
+ tailStart = start + newline + 1;
23930
+ break;
23931
+ }
23932
+ end = start;
23933
+ }
23934
+ try {
23935
+ JSON.parse(Buffer.concat(chunks.reverse()).toString("utf8"));
23936
+ return true;
23937
+ } catch (error) {
23938
+ if (!(error instanceof SyntaxError)) throw error;
23939
+ ftruncateSync(fd, tailStart);
23940
+ fsyncSync(fd);
23941
+ return false;
23942
+ }
23943
+ } finally {
23944
+ closeSync(fd);
23945
+ }
23946
+ }
23947
+ function readAt(fd, buffer, position) {
23948
+ let offset = 0;
23949
+ while (offset < buffer.length) {
23950
+ const read = readSync(fd, buffer, offset, buffer.length - offset, position + offset);
23951
+ if (read === 0) throw new Error("journal changed while preparing its append tail");
23952
+ offset += read;
23953
+ }
23954
+ }
23955
+ //#endregion
23818
23956
  //#region src/durable/jsonl-file.ts
23819
23957
  /** Read a fixed file prefix one record at a time, never allocating the whole journal as a string.
23820
23958
  * A reader cannot chase concurrent appends forever. Missing files are empty only when requested;
@@ -23878,16 +24016,7 @@ function parseRecord(line, source, lineNumber, terminated, allowWhitespaceLines
23878
24016
  }
23879
24017
  }
23880
24018
  async function appendCommittedJsonLine(path, record, acknowledge) {
23881
- const fs = await import("node:fs/promises");
23882
- const needsSeparator = await prepareJsonlAppend(path);
23883
- const handle = await fs.open(path, "a");
23884
- try {
23885
- await writeAllBytes(handle, `${needsSeparator ? "\n" : ""}${JSON.stringify(record)}\n`);
23886
- await handle.sync();
23887
- return await acknowledge?.(handle);
23888
- } finally {
23889
- await handle.close();
23890
- }
24019
+ return commitJsonLine(path, record, acknowledge);
23891
24020
  }
23892
24021
  /** Serialize JSONL file updates across processes and aliases using Eval's existing file lock.
23893
24022
  * The caller owns validation and the record format. The lock path names the canonical file,
@@ -23943,74 +24072,12 @@ async function upsertCommittedJsonLine(path, record, key) {
23943
24072
  allowWhitespaceLines: true
23944
24073
  })) if (key(prior) !== id) updated.push(prior);
23945
24074
  updated.push(snapshot);
23946
- const { writeAtomicDurableFile } = await import("./durable-file-DLcrzrjL.js").then((n) => n.r);
24075
+ const { writeAtomicDurableFile } = await import("./record-events-D93DkpAx.js").then((n) => n.i);
23947
24076
  writeAtomicDurableFile(path, `${updated.map((row) => JSON.stringify(row)).join("\n")}\n`, { preserveMode: true });
23948
24077
  }
23949
- /** FileHandle.write may legally make a short write. Loop until every byte is appended. */
23950
- async function writeAllBytes(handle, value) {
23951
- const bytes = typeof value === "string" ? Buffer.from(value) : Buffer.from(value);
23952
- let offset = 0;
23953
- while (offset < bytes.byteLength) {
23954
- const { bytesWritten } = await handle.write(bytes, offset, bytes.byteLength - offset, null);
23955
- if (bytesWritten <= 0) throw new Error(`append-only file write made no progress at byte ${offset}`);
23956
- offset += bytesWritten;
23957
- }
23958
- }
23959
- /** Prepare the tail under the journal owner's existing single-writer discipline.
23960
- * Healthy appends read one byte, regardless of history size. Only recovery scans backward,
23961
- * retaining a valid unterminated value or truncating an uncommitted torn tail. */
24078
+ /** Recover a torn tail under the same generation fence as durable publications. @internal */
23962
24079
  async function prepareJsonlAppend(path) {
23963
- const fs = await import("node:fs/promises");
23964
- let handle;
23965
- try {
23966
- handle = await fs.open(path, "r+");
23967
- } catch (error) {
23968
- if (isNoEntError(error)) return false;
23969
- throw error;
23970
- }
23971
- try {
23972
- const size = (await handle.stat()).size;
23973
- if (size === 0) return false;
23974
- const lastByte = Buffer.allocUnsafe(1);
23975
- await readAt(handle, lastByte, size - 1);
23976
- if (lastByte[0] === 10) return false;
23977
- const chunks = [];
23978
- let end = size;
23979
- let tailStart = 0;
23980
- while (end > 0) {
23981
- const start = Math.max(0, end - 65536);
23982
- const chunk = Buffer.allocUnsafe(end - start);
23983
- await readAt(handle, chunk, start);
23984
- const newline = chunk.lastIndexOf(10);
23985
- chunks.push(chunk.subarray(newline + 1));
23986
- if (newline >= 0) {
23987
- tailStart = start + newline + 1;
23988
- break;
23989
- }
23990
- end = start;
23991
- }
23992
- const tail = Buffer.concat(chunks.reverse()).toString("utf8");
23993
- try {
23994
- JSON.parse(tail);
23995
- return true;
23996
- } catch (error) {
23997
- if (!(error instanceof SyntaxError)) throw error;
23998
- await handle.truncate(tailStart);
23999
- await handle.sync();
24000
- return false;
24001
- }
24002
- } finally {
24003
- await handle.close();
24004
- }
24005
- }
24006
- /** A short read is legal; an unexpected EOF means the owner's snapshot changed. */
24007
- async function readAt(handle, buffer, position) {
24008
- let offset = 0;
24009
- while (offset < buffer.length) {
24010
- const { bytesRead } = await handle.read(buffer, offset, buffer.length - offset, position + offset);
24011
- if (bytesRead === 0) throw new Error("journal changed while preparing its append tail");
24012
- offset += bytesRead;
24013
- }
24080
+ return fenceRunWrite(() => prepareJsonlTail(path));
24014
24081
  }
24015
24082
  /** True for a filesystem error meaning "the file is not there yet" — the one condition an
24016
24083
  * append-only reader treats as an empty log rather than a fault. */
@@ -24028,16 +24095,19 @@ function isNoEntError(error) {
24028
24095
  */
24029
24096
  var FileResultBlobStore = class {
24030
24097
  dir;
24098
+ writeContext = captureRunWriteContext();
24031
24099
  constructor(dir) {
24032
24100
  this.dir = dir;
24033
24101
  }
24034
24102
  async put(outRef, artifact) {
24035
- const { text } = encodeResultBlob(outRef, artifact);
24036
- const filePath = this.blobPath(outRef);
24037
- assertNoSymlinkDescendant(this.dir, filePath, "result blob");
24038
- await (await import("node:fs/promises")).mkdir(this.dir, { recursive: true });
24039
- assertNoSymlinkDescendant(this.dir, filePath, "result blob");
24040
- if (!publishExclusiveDurableFile(filePath, text, { mode: 384 })) assertContentAddress(outRef, await this.get(outRef));
24103
+ return this.writeContext(async () => {
24104
+ const { text } = encodeResultBlob(outRef, artifact);
24105
+ const filePath = this.blobPath(outRef);
24106
+ assertNoSymlinkDescendant(this.dir, filePath, "result blob");
24107
+ await (await import("node:fs/promises")).mkdir(this.dir, { recursive: true });
24108
+ assertNoSymlinkDescendant(this.dir, filePath, "result blob");
24109
+ if (!publishExclusiveDurableFile(filePath, text, { mode: 384 })) assertContentAddress(outRef, await this.get(outRef));
24110
+ });
24041
24111
  }
24042
24112
  async get(outRef) {
24043
24113
  const filePath = this.blobPath(outRef);
@@ -24833,6 +24903,10 @@ function noteScopeRetainedOwnerCoordination(scope) {
24833
24903
  delete state.checkpointing;
24834
24904
  });
24835
24905
  }
24906
+ /** @internal The checkpoint in progress for this owner, for a test or a release to wait on. */
24907
+ function scopeRetainedOwnerCheckpointing(scope) {
24908
+ return owners.get(scope)?.checkpointing;
24909
+ }
24836
24910
  async function checkpointOwnerWorkspace(scope, state) {
24837
24911
  const { provider, args } = state;
24838
24912
  if (provider === void 0) return;
@@ -25677,10 +25751,11 @@ const ABANDON_STOP_TIMEOUT_MS = 3e4;
25677
25751
  * Abandon the owner's in-flight invocation, which the driver retry loop asks for when the same
25678
25752
  * reconciliation keeps failing the same way (`DriverRetryRun.resolvePending`).
25679
25753
  *
25680
- * Runtime stops the invocation at the provider when it had dispatched, then journals what the
25681
- * provider confirmed. The journal refuses every later admission or result of the invocation, so
25682
- * only the replacement the next {@link prepareScopeRetainedOwnerTask} starts can commit a result.
25683
- * Answers `false`, journaling nothing, when this owner has no unfinished invocation to abandon.
25754
+ * Runtime abandons only after the provider confirms the dispatched execution stopped or is no
25755
+ * longer live. An intent without a dispatch reference, or an unconfirmed stop, keeps the original
25756
+ * invocation recoverable under the same identity. The journal refuses every later admission or
25757
+ * result of an abandoned invocation, so only its replacement can commit a result. Answers `false`,
25758
+ * journaling nothing, when there is no unfinished invocation or its native stop is unconfirmed.
25684
25759
  */
25685
25760
  async function abandonScopeRetainedOwnerInvocation(scope, failure, failures) {
25686
25761
  const state = owners.get(scope);
@@ -25699,7 +25774,7 @@ async function abandonScopeRetainedOwnerInvocation(scope, failure, failures) {
25699
25774
  now: args.now
25700
25775
  });
25701
25776
  scope.signal.throwIfAborted();
25702
- const stopped = stop?.effect === "cancelled" || stop?.effect === "not_live";
25777
+ if (!(stop?.effect === "cancelled" || stop?.effect === "not_live")) return false;
25703
25778
  await args.journal.appendEvent(args.rootId, {
25704
25779
  kind: "execution-abandoned",
25705
25780
  id: args.nodeId,
@@ -25707,7 +25782,7 @@ async function abandonScopeRetainedOwnerInvocation(scope, failure, failures) {
25707
25782
  pendingCause: failure.pendingCause,
25708
25783
  failures,
25709
25784
  detail: errorText(errMessage(failure)).slice(0, 2048),
25710
- outcome: stopped ? "stopped" : "uncertain",
25785
+ outcome: "stopped",
25711
25786
  ...stop === void 0 ? {} : { stop: {
25712
25787
  executionId: stop.executionId,
25713
25788
  effect: stop.effect,
@@ -25740,8 +25815,8 @@ async function prepareScopeRetainedOwnerTask(scope, task, session = "native") {
25740
25815
  }
25741
25816
  if (state.taskRef !== void 0 && state.acceptedRef === void 0) await abandonInputAdmittedIntoDebt(state, await reconcileOwnerWorkspaceBeforeReuse(state, scope.signal));
25742
25817
  const unusable = unusableEnvironmentIds(owned);
25743
- const inFlight = continuedEnvironment(owned);
25744
- if (inFlight?.inFlight && unusable.has(inFlight.admission.environmentId)) {
25818
+ const currentEnvironment = state.admissions.find((admission) => admission.phase === "environment");
25819
+ if (state.acceptedRef === void 0 && currentEnvironment?.phase === "environment" && unusable.has(currentEnvironment.environmentId)) {
25745
25820
  delete state.inputSequence;
25746
25821
  delete state.taskRef;
25747
25822
  state.admissions.length = 0;
@@ -28216,7 +28291,7 @@ async function appendSpawnEvents(journal, root, events) {
28216
28291
  }
28217
28292
  /**
28218
28293
  * JSONL on disk. One line per record: the first record is `begin`, subsequent records
28219
- * are `event` envelopes wrapping a `SpawnEvent`. `loadTree` replays the whole file,
28294
+ * are `event` or atomic `events` envelopes. `loadTree` replays the whole file,
28220
28295
  * filtering by `root`, and applies the same begin-precedes-events + unique-seq
28221
28296
  * corruption guards as the in-memory impl. Each append fsyncs so a crash between
28222
28297
  * writes never loses an acknowledged event.
@@ -28225,6 +28300,7 @@ async function appendSpawnEvents(journal, root, events) {
28225
28300
  */
28226
28301
  var FileSpawnJournal = class {
28227
28302
  path;
28303
+ writeContext = captureRunWriteContext();
28228
28304
  appendTail = Promise.resolve();
28229
28305
  appendIndex;
28230
28306
  constructor(path) {
@@ -28239,9 +28315,11 @@ var FileSpawnJournal = class {
28239
28315
  if (record.kind === "begin") begun = true;
28240
28316
  else {
28241
28317
  if (!begun) throw new Error(`spawn journal corrupted: event for tree '${root}' precedes its begin record`);
28242
- index.assert(record.event);
28243
- index.add(record.event);
28244
- events.push(record.event);
28318
+ for (const event of spawnJournalRecordEvents(record)) {
28319
+ index.assert(event);
28320
+ index.add(event);
28321
+ events.push(event);
28322
+ }
28245
28323
  }
28246
28324
  }
28247
28325
  return begun ? events : void 0;
@@ -28280,6 +28358,28 @@ var FileSpawnJournal = class {
28280
28358
  tree.index.add(event);
28281
28359
  });
28282
28360
  }
28361
+ async appendEvents(root, events) {
28362
+ const captured = detachedSnapshot(events, "spawn events");
28363
+ return this.serializeAppend(async () => {
28364
+ const state = await this.validationIndex();
28365
+ const tree = state.trees.get(root);
28366
+ if (tree === void 0) throw new Error(`appendEvents called for unknown spawn tree '${root}'; call beginTree first`);
28367
+ try {
28368
+ for (const event of captured) {
28369
+ tree.index.assert(event);
28370
+ tree.index.add(event);
28371
+ }
28372
+ state.stamp = await this.writeRecord({
28373
+ kind: "events",
28374
+ root,
28375
+ events: captured
28376
+ });
28377
+ } catch (error) {
28378
+ this.appendIndex = void 0;
28379
+ throw error;
28380
+ }
28381
+ });
28382
+ }
28283
28383
  async validationIndex() {
28284
28384
  const stamp = await this.fileStamp();
28285
28385
  if (this.appendIndex && this.appendIndex.stamp === stamp) return this.appendIndex;
@@ -28293,8 +28393,10 @@ var FileSpawnJournal = class {
28293
28393
  } else {
28294
28394
  const tree = trees.get(record.root);
28295
28395
  if (!tree) throw new Error(`spawn journal corrupted: event for tree '${record.root}' precedes its begin record`);
28296
- tree.index.assert(record.event);
28297
- tree.index.add(record.event);
28396
+ for (const event of spawnJournalRecordEvents(record)) {
28397
+ tree.index.assert(event);
28398
+ tree.index.add(event);
28399
+ }
28298
28400
  }
28299
28401
  if (await this.fileStamp() !== stamp) throw new Error("spawn journal changed while rebuilding its append index");
28300
28402
  this.appendIndex = {
@@ -28313,7 +28415,7 @@ var FileSpawnJournal = class {
28313
28415
  }
28314
28416
  }
28315
28417
  async serializeAppend(operation) {
28316
- const append = this.appendTail.then(operation);
28418
+ const append = this.appendTail.then(() => this.writeContext(operation));
28317
28419
  this.appendTail = append.catch(() => void 0);
28318
28420
  return append;
28319
28421
  }
@@ -28322,9 +28424,9 @@ var FileSpawnJournal = class {
28322
28424
  const { dirname } = await import("node:path");
28323
28425
  try {
28324
28426
  await fs.mkdir(dirname(this.path), { recursive: true });
28325
- return await appendCommittedJsonLine(this.path, record, async (handle) => {
28326
- const stamp = journalFileStamp(await handle.stat({ bigint: true }));
28327
- if (await this.fileStamp() !== stamp) throw new Error("spawn journal changed while acknowledging its append");
28427
+ return await appendCommittedJsonLine(this.path, record, (fd) => {
28428
+ const stamp = journalFileStamp(fstatSync(fd, { bigint: true }));
28429
+ if (journalFileStamp(statSync(this.path, { bigint: true })) !== stamp) throw new Error("spawn journal changed while acknowledging its append");
28328
28430
  return stamp;
28329
28431
  });
28330
28432
  } catch (error) {
@@ -28860,10 +28962,11 @@ function workerLifecycle(eventDir, workerId) {
28860
28962
  const text = line.trim();
28861
28963
  if (!text) continue;
28862
28964
  try {
28863
- const record = JSON.parse(text);
28864
- if (record.kind !== "event" || record.event?.id !== workerId) continue;
28865
- if (record.event.kind === "spawned") spawned = true;
28866
- if (record.event.kind === "settled" || record.event.kind === "cancelled") terminal = true;
28965
+ for (const event of spawnJournalRecordEvents(JSON.parse(text))) {
28966
+ if (event?.id !== workerId) continue;
28967
+ if (event.kind === "spawned") spawned = true;
28968
+ if (event.kind === "settled" || event.kind === "cancelled") terminal = true;
28969
+ }
28867
28970
  } catch {}
28868
28971
  }
28869
28972
  return {
@@ -29966,19 +30069,18 @@ async function prepareInterruptedExecutors(opts, events, signal, now, parentId =
29966
30069
  const profile = shareParsedStrings(agentProfileSchema.parse(await opts.blobs.get(node.profileRef)), parsedStrings);
29967
30070
  const task = shareParsedStrings(await opts.blobs.get(taskRef), parsedStrings);
29968
30071
  if (canonicalAgentProfileDigest(profile) !== node.identity.profileDigest || canonicalCandidateDigest(task) !== node.identity.taskDigest) throw new RuntimeRunStateError(`recovery inputs for '${node.id}' do not match its admitted identity`);
29969
- let prepared;
29970
30072
  if (node.ownedTreeRoot !== void 0) {
29971
30073
  if (node.ownedTreeRoot !== nestedDriverTreeRoot(opts.runId, node.id)) throw new RuntimeRunStateError(`retained manager '${node.id}' changed its owned tree`);
29972
30074
  const nested = await opts.journal.loadTree(node.ownedTreeRoot);
29973
30075
  const roots = nested?.filter((event) => event.kind === "spawned" && event.parent === void 0) ?? [];
29974
30076
  if (nested?.length && (roots.length !== 1 || contentAddress(roots[0]) !== contentAddress(ownedTreeRootSpawn(node)))) throw new RuntimeRunStateError(`retained manager '${node.id}' has conflicting subtree ownership`);
29975
- prepared = prepareRetainedExecutor(opts.recoverExecutor, {
29976
- spawned: node,
29977
- profile,
29978
- task
29979
- });
29980
- if (!prepared) continue;
29981
30077
  }
30078
+ const prepared = prepareRetainedExecutor(opts.recoverExecutor, {
30079
+ spawned: node,
30080
+ profile,
30081
+ task
30082
+ });
30083
+ if (node.ownedTreeRoot !== void 0 && !prepared) continue;
29982
30084
  const priorMaterialization = [...owned].reverse().find((event) => event.kind === "materialized" || event.kind === "seat-materialized")?.receipt;
29983
30085
  const continuation = latestInput !== void 0 && inputs.length > 1 && node.ownedTreeRoot === void 0 ? await leafContinuation(node, owned, latestInput, opts) : latestInput !== void 0 && node.continues !== void 0 && admissions.length === 0 && node.ownedTreeRoot === void 0 ? heldContinuation(node, events, latestInput) : void 0;
29984
30086
  recoveries.push({
@@ -31683,7 +31785,8 @@ const driverExecutorFactory = (rawSpec, ctx) => {
31683
31785
  accounting = partial?.accounting;
31684
31786
  const events = await journal.loadTree(nestedRoot).catch(() => void 0);
31685
31787
  const settledIds = new Set(events?.filter((event) => event.kind === "settled" || event.kind === "cancelled").map((event) => event.id));
31686
- if (events?.some((event) => event.kind === "execution-admitted" && event.id === seam.nodeId || event.kind === "spawned" && event.parent !== void 0 && event.runtime !== "inline" && !settledIds.has(event.id))) throw new RetainedExecutionPendingError(err, "nested-recovery");
31788
+ const terminalAdmissionRefusal = isTerminalAdmissionRefusal(err);
31789
+ if (driver.resultAccepted?.() === true || spec.acceptedSubmission?.() === true || events?.some((event) => event.kind === "execution-admitted" && (event.admission.phase === "dispatched" || event.id === seam.nodeId && (event.admission.phase !== "intent" || !terminalAdmissionRefusal)) || event.kind === "execution-result" || event.kind === "spawned" && event.parent !== void 0 && !settledIds.has(event.id))) throw new RetainedExecutionPendingError(err, "nested-recovery");
31687
31790
  if (cleanupError !== void 0) throw cleanupError;
31688
31791
  throw err;
31689
31792
  } finally {
@@ -31750,6 +31853,11 @@ function withDriverExecutor(base) {
31750
31853
  }
31751
31854
  };
31752
31855
  }
31856
+ /** Positive pre-dispatch refusal evidence; a missing dispatch record proves nothing by itself. */
31857
+ function isTerminalAdmissionRefusal(error) {
31858
+ const failure = error instanceof DriverAttemptsExhaustedError && error.stop === "terminal-error" ? error.cause : error;
31859
+ return (isCredentialRefusal(failure) || failure instanceof RetainedExecutionPendingError && failure.phase === "admission" && failure.pendingCause === "request-rejected") && classifyDriverFailure(failure) === "terminal";
31860
+ }
31753
31861
  async function closeNestedScope(scope, controller, reason) {
31754
31862
  if (!controller.signal.aborted) controller.abort(reason);
31755
31863
  for (;;) if (await scope.next() === null) break;
@@ -32046,6 +32154,156 @@ async function runFinalizer(finalizer, args) {
32046
32154
  return await accepted(candidate) ? candidate : void 0;
32047
32155
  }
32048
32156
  //#endregion
32157
+ //#region src/runtime/supervise/run-parking.ts
32158
+ /** Read the journal's bounded parking projection. Undefined means no current parking handoff. */
32159
+ async function readRunParking(runDir) {
32160
+ let raw;
32161
+ try {
32162
+ raw = await readFile(resolve(runDir, "parking.json"), "utf8");
32163
+ } catch (error) {
32164
+ if (error.code === "ENOENT") return void 0;
32165
+ throw error;
32166
+ }
32167
+ const record = JSON.parse(raw);
32168
+ if (record === null || typeof record !== "object") throw new Error("invalid run parking record");
32169
+ const data = record;
32170
+ if (data.status === "resuming") return void 0;
32171
+ if (data.status !== "parked" || typeof data.runId !== "string" || ![
32172
+ "seat-wait",
32173
+ "paused-root",
32174
+ "deadline"
32175
+ ].includes(String(data.reason)) || typeof data.since !== "string" || !Number.isFinite(Date.parse(data.since)) || typeof data.wakeAt !== "string" || !Number.isFinite(Date.parse(data.wakeAt))) throw new Error("invalid run parking record");
32176
+ return Object.freeze({
32177
+ runId: data.runId,
32178
+ reason: data.reason,
32179
+ since: data.since,
32180
+ wakeAt: data.wakeAt
32181
+ });
32182
+ }
32183
+ /** A resumable wait, with no terminal result or failure. Catch it and let the coordinator exit. */
32184
+ var RunParkedError = class extends Error {
32185
+ runId;
32186
+ parking;
32187
+ constructor(runId, parking) {
32188
+ super(`run '${runId}' parked (${parking.reason}) until ${parking.wakeAt}`);
32189
+ this.runId = runId;
32190
+ this.parking = parking;
32191
+ this.name = "RunParkedError";
32192
+ }
32193
+ };
32194
+ const DEFAULT_PARK_AFTER_MS = 6e4;
32195
+ const parkingContext = new AsyncLocalStorage();
32196
+ const parkingDrains = /* @__PURE__ */ new WeakMap();
32197
+ /** Drain committed child work through the existing manager ledger before testing root idleness. */
32198
+ function bindScopeParkingDrain(scope, drain, idle) {
32199
+ parkingDrains.set(scope, {
32200
+ drain,
32201
+ idle
32202
+ });
32203
+ }
32204
+ /** Validate at intake, before any execution or ownership acquisition. */
32205
+ function assertRunParking(policy, durable) {
32206
+ if (policy === void 0) return;
32207
+ if (!durable) throw new ValidationError$1("supervise: parking requires runDir");
32208
+ if (policy === null || typeof policy !== "object" || policy.afterMs !== void 0 && (!Number.isFinite(policy.afterMs) || policy.afterMs < 0)) throw new ValidationError$1("supervise: parking.afterMs must be a nonnegative finite number");
32209
+ }
32210
+ /** Scope the handoff to one execution, preserving the original wake time on an early re-entry. */
32211
+ async function withRunParking(policy, runDir, runId, journal, now, signal, run) {
32212
+ if (policy === void 0 || runDir === void 0) return run();
32213
+ const events = await journal.loadTree(runId) ?? [];
32214
+ const previous = [...events].reverse().find((event) => event.kind === "run-parked");
32215
+ const transition = [...events].reverse().find((event) => event.id === runId && (event.kind === "run-parked" || event.kind === "root-reentered" || event.kind === "reopened"));
32216
+ const current = transition?.kind === "run-parked" ? transition : void 0;
32217
+ if (current !== void 0 && Date.parse(current.wakeAt) > now() && !signal?.aborted) {
32218
+ await writeParkingProjection(runDir, runId, current);
32219
+ throw new RunParkedError(runId, parkingRecordOf(current));
32220
+ }
32221
+ if (previous !== void 0) await writeAtomicDurableFile(resolve(runDir, "parking.json"), JSON.stringify({
32222
+ status: "resuming",
32223
+ runId,
32224
+ ...parkingRecordOf(previous),
32225
+ resumedAt: new Date(now()).toISOString()
32226
+ }));
32227
+ return parkingContext.run({
32228
+ runDir,
32229
+ runId,
32230
+ journal,
32231
+ now,
32232
+ afterMs: policy.afterMs ?? DEFAULT_PARK_AFTER_MS
32233
+ }, run);
32234
+ }
32235
+ /**
32236
+ * Sleep through the existing wait path. A root with no live descendants may hand off after its
32237
+ * idle threshold; children and roots with active work keep their normal wait. No timer survives
32238
+ * the handoff, and no provider work is cancelled or terminal settlement written for parking.
32239
+ */
32240
+ async function sleepScopeWait(scope, ms, signal, reason) {
32241
+ if (ms <= 0 || signal.aborted) return;
32242
+ const context = parkingContext.getStore();
32243
+ const onlyRootWait = () => context !== void 0 && scope.view.root === context.runId && parkingDrains.get(scope)?.idle() !== false && scope.workerCapacity.unconfirmed.length === 0 && !(scope.observeTree?.() ?? scope.view).nodes.some((node) => node.id !== context.runId && isLiveNodeStatus(node.status));
32244
+ if (context === void 0 || scope.view.root !== context.runId || ms <= context.afterMs) return sleep(ms, signal, false);
32245
+ const since = context.now();
32246
+ const deadline = scope.budget.deadlineMs;
32247
+ const wakeAt = Math.min(since + ms, deadline > 0 ? deadline : Number.POSITIVE_INFINITY);
32248
+ if (wakeAt - since <= context.afterMs) return sleep(ms, signal, false);
32249
+ let idleSince = onlyRootWait() ? since : void 0;
32250
+ for (;;) {
32251
+ const remaining = Math.max(0, wakeAt - context.now());
32252
+ if (remaining <= context.afterMs) return sleep(remaining, signal, false);
32253
+ const checkMs = context.afterMs || (idleSince === void 0 ? DEFAULT_PARK_AFTER_MS : 0);
32254
+ await sleep(Math.min(checkMs, remaining), signal, false);
32255
+ if (signal.aborted) return;
32256
+ await parkingDrains.get(scope)?.drain();
32257
+ if (!onlyRootWait()) {
32258
+ idleSince = void 0;
32259
+ continue;
32260
+ }
32261
+ if (idleSince === void 0) {
32262
+ idleSince = context.now();
32263
+ continue;
32264
+ }
32265
+ if (context.now() - idleSince < context.afterMs) continue;
32266
+ const events = await context.journal.loadTree(context.runId) ?? [];
32267
+ if (signal.aborted) return;
32268
+ const ownerEvents = events.filter((event) => event.id === context.runId);
32269
+ const input = [...ownerEvents].reverse().find((event) => event.kind === "execution-input");
32270
+ const invocation = input === void 0 ? [] : ownerEvents.slice(ownerEvents.indexOf(input));
32271
+ if (invocation.some((event) => event.kind === "execution-admitted") && !invocation.some((event) => event.kind === "execution-result" || event.kind === "execution-abandoned" && event.outcome === "stopped") || !onlyRootWait()) {
32272
+ idleSince = void 0;
32273
+ continue;
32274
+ }
32275
+ const parking = {
32276
+ reason: deadline > 0 && wakeAt === deadline ? "deadline" : reason,
32277
+ since: new Date(idleSince).toISOString(),
32278
+ wakeAt: new Date(wakeAt).toISOString()
32279
+ };
32280
+ closeScopeAdmission(scope);
32281
+ await context.journal.appendEvent(context.runId, {
32282
+ kind: "run-parked",
32283
+ id: context.runId,
32284
+ ...parking,
32285
+ seq: events.filter((event) => event.kind === "run-parked").length,
32286
+ at: new Date(context.now()).toISOString()
32287
+ });
32288
+ await writeParkingProjection(context.runDir, context.runId, parking);
32289
+ throw new RunParkedError(context.runId, parking);
32290
+ }
32291
+ }
32292
+ async function writeParkingProjection(runDir, runId, parking) {
32293
+ await writeAtomicDurableFile(resolve(runDir, "parking.json"), JSON.stringify({
32294
+ status: "parked",
32295
+ runId,
32296
+ ...parkingRecordOf(parking)
32297
+ }));
32298
+ }
32299
+ function parkingRecordOf(record) {
32300
+ return {
32301
+ reason: record.reason,
32302
+ since: record.since,
32303
+ wakeAt: record.wakeAt
32304
+ };
32305
+ }
32306
+ //#endregion
32049
32307
  //#region src/durable/spawn-journal/provider-model-evidence.ts
32050
32308
  /**
32051
32309
  * Aggregate provider-served model evidence across one recursively owned journal forest.
@@ -33192,6 +33450,7 @@ async function executeRoot(root) {
33192
33450
  };
33193
33451
  let executionAborted = controller.signal.aborted;
33194
33452
  let allChildrenDownAtSettle = false;
33453
+ let parked = false;
33195
33454
  try {
33196
33455
  await startScopeRecoveries(scope);
33197
33456
  actOutcome = {
@@ -33199,6 +33458,10 @@ async function executeRoot(root) {
33199
33458
  out: await runAbortable(root.run, controller.signal, "supervisor aborted")
33200
33459
  };
33201
33460
  } catch (error) {
33461
+ if (error instanceof RunParkedError && error.runId === opts.runId) {
33462
+ parked = true;
33463
+ throw error;
33464
+ }
33202
33465
  actOutcome = {
33203
33466
  ok: false,
33204
33467
  error
@@ -33209,26 +33472,31 @@ async function executeRoot(root) {
33209
33472
  allChildrenDownAtSettle = allSpawnedChildrenDown(runTree(scope));
33210
33473
  if (!controller.signal.aborted && deadline.atMs > 0 && now() >= deadline.atMs) deadline.exceeded = true;
33211
33474
  deadline.clear();
33212
- const settleGraceMs = !controller.signal.aborted ? boundedSettleGrace(opts.childSettleGraceMs, deadline.atMs, now) : 0;
33213
- try {
33214
- await joinRunChildren(join, settleGraceMs);
33215
- } catch (error) {
33216
- if (actOutcome?.ok !== false) actOutcome = {
33217
- ok: false,
33218
- error
33219
- };
33220
- }
33221
- if (!persistence.failed) try {
33222
- await finalizeScopeOwnerMaterialization(scope);
33223
- } catch (error) {
33224
- if (actOutcome?.ok !== false) actOutcome = {
33225
- ok: false,
33226
- error
33227
- };
33228
- }
33229
- if (persistence.failed) {
33230
- await waitForScopeChildren(scope);
33231
- await persistence.drain();
33475
+ if (!parked) {
33476
+ const settleGraceMs = !controller.signal.aborted ? boundedSettleGrace(opts.childSettleGraceMs, deadline.atMs, now) : 0;
33477
+ try {
33478
+ await joinRunChildren(join, settleGraceMs);
33479
+ } catch (error) {
33480
+ if (actOutcome?.ok !== false) actOutcome = {
33481
+ ok: false,
33482
+ error
33483
+ };
33484
+ }
33485
+ if (!persistence.failed) try {
33486
+ await finalizeScopeOwnerMaterialization(scope);
33487
+ } catch (error) {
33488
+ if (actOutcome?.ok !== false) actOutcome = {
33489
+ ok: false,
33490
+ error
33491
+ };
33492
+ }
33493
+ if (persistence.failed) {
33494
+ await waitForScopeChildren(scope);
33495
+ await persistence.drain();
33496
+ }
33497
+ } else {
33498
+ await scopeRetainedOwnerCheckpointing(scope);
33499
+ await scopeRetainedOwnerSettled(scope);
33232
33500
  }
33233
33501
  executionAborted ||= cascade.aborted();
33234
33502
  cascade.detach();
@@ -33318,6 +33586,6 @@ async function noWinner(settled, rejection) {
33318
33586
  };
33319
33587
  }
33320
33588
  //#endregion
33321
- export { beginScopeRetainedOwnerDrive as $, sumSandboxUsage as $i, upstreamUnavailableSignal as $n, finalizeRuntimeOwnedPendingExecutor as $r, destroyInteractiveEnvironment as $t, coordinationProfileToolPrefix as A, detachedFrozen as Ai, createInbox as An, bridgeStopSignalKey as Ar, readPromptOptions as At, meterRuntimeOwnedProviderAttempt as B, assertValidBudget as Bi, taskToPrompt$1 as Bn, fullProfileMaterialization as Br, toolResultText as Bt, FileSpawnJournal as C, cappedDoublingMs as Ci, padTraceId as Cn, readCodexRolloutSession as Cr, captureReusableExecutorConfig as Ct, restoreScopeOwnerAcceptedExecution as D, unavailableSignalOfFailure as Di, sanitizeKnowledgeReadinessReport as Dn, runAbortable as Dr, createSteerableSandboxSession as Dt, recordScopeOwnerMaterialization as E, unavailableResumeAt as Ei, createRuntimeStreamEventCollector as En, linkAbort as Er, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Et, deriveNodeExecutionIdentity as F, createBudgetPool as Fi, claimsAuthority as Fn, terminateProcessTreeAndConfirm as Fr, defaultSelectWinner as Ft, scopeRetainedOwnerResourceReader as G, mapSandboxEvent as Gi, isTerminalNodeStatus as Gn, sandboxActProfileMaterialization as Gr, providerAsExecutor as Gt, recordScopeOwnerDriverAttempt as H, defaultRedactorIdentityMaterial as Hi, createActivityLog as Hn, promptControlProfileMaterialization as Hr, routerBrain as Ht, freeSlots as I, meterUsageEvent as Ii, createPeerMailbox as In, assertProfileMaterialization as Ir, codeModeArguments as It, abandonScopeRetainedOwnerInvocation as J, canonicalStreamEventFromSandboxEvent as Ji, abandonablePending as Jn, worktreeCliProfileMaterialization as Jr, reconnectRetainedRun as Jt, environmentReader as K, mapSandboxToolEvent as Ki, DriverAttemptsExhaustedError as Kn, sandboxProfileMaterialization as Kr, LEAF_CONTINUATION_TASK as Kt, queueOf as L, newUsageTotals as Li, isPeerMailEnvelope as Ln, assertProfileMaterializes as Lr, codeModeModelOutput as Lt, runtimeGraphMetadataKey as M, contentAddress as Mi, AUTHORITY_MARKERS as Mn, runWorktreeHarness as Mr, createSandboxLineage as Mt, settledToIteration as N, executorFailure as Ni, DEFAULT_PEER_MAIL_LIMITS as Nn, LOCAL_HARNESSES as Nr, acquireSandbox as Nt, scopeOwnerExecutorNodeContext as O, TRACE_ROOT_SCHEMA as Oi, sanitizeRuntimeStreamEvent as On, signalAbortError as Or, runAgentRounds as Ot, assertRecursiveReservationPolicy as P, errMessage as Pi, PEER_MAIL_WIRE_KEY as Pn, harnessInvocation as Pr, TERMINAL_DECISIONS as Pt, scopeRetainedOwnerResult as Q, notifySandboxEventObserver as Qi, undispatchedCredentialExit as Qn, authoredProfileDigest as Qr, retainedCreateMaterial as Qt, rollingDispatch as R, spendFromUsageEvents as Ri, peerMailTools as Rn, controlProfileMaterialization as Rr, createCodeModeTools as Rt, startRetainedInteractiveRun as S, retainedExecutorSeamKey as Si, padSpanId as Sn, harnessUsageIsEmpty as Sr, bindReusableExecutorExecutionId as St, noteScopeOwnerPlannedExecution as T, unavailablePauseMs as Ti, createRuntimeEventCollector as Tn, RunCancellationReason as Tr, snapshotExecutorConfig as Tt, recordScopeOwnerPause as U, resolveRedactor as Ui, readWorkerProgress as Un, promptModelProfileMaterialization as Ur, createAgentEnvironmentProviderRegistry as Ut, recordScopeOwnerBarrenPause as V, defaultRedactor as Vi, DEFAULT_STALL_AFTER_MS as Vn, profileMaterializationAxes$1 as Vr, createRouterTranscript as Vt, prepareScopeRetainedOwnerSeatSwitch as W, createSandboxToolPartState as Wi, isLiveNodeStatus as Wn, renderUnsupported as Wr, resolveAgentEnvironmentProvider as Wt, prepareScopeRetainedOwnerTask as X, createSandboxUsageLedger as Xi, classifyDriverFailure as Xn, attestRuntimeOwnedScopeOwner as Xr, startRetainedRun as Xt, consumeScopeRetainedOwnerResult as Y, createSandboxTurnEventCollector as Yi, causedByPartialFailure as Yn, attestRuntimeOwnedPendingExecutor as Yr, recoverRetainedRun as Yt, scopeRetainedOwnerPriorSpend as Z, extractLlmCallEvent as Zi, summarizeDriverAttempts as Zn, authoredAgentIdentity as Zr, startRetainedRunInEnvironment as Zt, interactiveAdmissionSeamKey as _, readSandboxOutcome as _i, createOpenInferenceFileExporter as _n, bridgeModelRouteRefusal as _r, readCommittedJsonLines as _t, runFinalizer as a, recordRuntimeOwnedDriveHarnessProviderEvidence as ai, resolveHarnessTranscriptCapture as an, CheckUnavailableError as ar, bindScopeRetainedOwnerProvider as at, reconnectRetainedInteractiveRun as b, RetainedExecutionPendingError as bi, generateSpanId as bn, addHarnessUsage as br, insideCursorNamespace as bt, driverChild as c, runtimeOwnedExecutorMaterialization as ci, openSlotGroup as cn, verdictFromJudgeScore as cr, loadSpawnForest as ct, withDriverExecutor as d, runtimeOwnedScopeOwnerRuntime as di, WORKER_TRACE_PROPAGATION as dn, bestComposite as dr, InMemorySpawnJournal as dt, decodeHarnessUsage as ea, inheritRuntimeOwnedExecutorAttestation as ei, environmentGone as en, SeatChain as er, scopeRetainedOwnerTurnEnded as et, createScope as f, unknownExecutionBindingReceipt as fi, createPropagatingTraceEmitter as fn, checkVerdictOf as fr, FileResultBlobStore as ft, workerTraceAnalysisStore as g, projectSandboxOutcome as gi, buildRuntimeEventOtelSpans as gn, bridgeAdmissionRefusal as gr, readCommittedJsonFile as gt, parseWorkerToolTraceArtifact as h, executableAgentSpecSnapshot as hi, buildLoopSpanNodes as hn, isFiniteNumber as hr, prepareJsonlAppend as ht, bestDelivered as i, providerMessageText as ia, providerAttemptEvidence as ii, readHarnessTranscript as in, subscriptionUsageLimitSignal as ir, bindScopeRetainedOwnerEnvironmentId as it, providerVisibleProfile as j, detachedSnapshot as ji, failPendingAfter as jn, runSettledCommand as jr, createSandboxForSpec as jt, coordinationMcpAlias as k, TRACE_SUMMARY_SCHEMA as ki, INBOX_RECEIPT_KEY as kn, bridgeRuntimeAttachmentsKey as kr, assertBoxlessPromptOptions as kt, driverExecutorFactory as l, runtimeOwnedExecutorProviderEvidence as li, createWorktreeCliExecutor as ln, CONTINUATIONS_DIR as lr, materializeTreeView as lt, isTraceAnalysisStore as m, executableAgentProfileSnapshot as mi, buildLoopOtelSpans as mn, failedItems as mr, isNoEntError as mt, createSupervisor as n, promptFromAgentTurnInput as na, knownMaterializationReceipt as ni, harnessTranscriptArtifact as nn, authoredSeatStages as nr, scopeRetainedOwnerRestorePoint as nt, runTree as o, runtimeOwnedDriveHarnessProviderEvidence as oi, retainHarnessTranscript as on, gateOnDeliverable as or, scopeRetainedOwnerContext as ot, replaySpawnTree as p, unknownMaterializationReceipt as pi, readTraceContextFromEnv as pn, createContinuationKeeper as pr, appendCommittedJsonLine as pt, resolveSpawnResourcePaths as q, terminalTextFromSandboxEvent as qi, HarnessTurnFailedError as qn, unsupportedProfileDimensions as qr, providerAsSandboxClient as qt, assertResumeLimits as r, promptOptionsFromAgentTurnInput as ra, newExecutionAttemptId as ri, persistHarnessTranscript as rn, seatExecutionProfile as rr, noteScopeRetainedOwnerCoordination as rt, createRootHandle as s, runtimeOwnedExecutorExecutionBinding as si, createWorkerSlots as sn, mapExecutorResult as sr, scopeRetainedOwnerJournalRoot as st, DEFAULT_MAX_DEPTH as t, awaitAbortable$1 as ta, knownExecutionBindingReceipt as ti, captureHarnessTranscript as tn, SeatChainExhaustedError as tr, reconcileScopeRetainedOwnerEnvironment as tt, isDriverSpec as u, runtimeOwnedPendingExecutorMaterialization as ui, createInPlaceCliExecutor as un, admitContinuationPolicy as ur, InMemoryResultBlobStore as ut, attachWorker as v, runtimeFailureCause as vi, createOtelExporter as vn, priceTokens as vr, upsertCommittedJsonLine as vt, beginScopeOwnerAttempt as w, jitteredMs as wi, toOtelAttributes as wn, createPushTraceSource as wr, createExecutor as wt, recoverRetainedInteractiveRun as x, registerRetainedExecutorPreparation as xi, loopEventToOtelSpan as xn, createCodexRolloutStoreReader as xr, createExecutorRegistry as xt, readWorkerInteractiveBinding as y, settlementFailureCause as yi, flatOtelSpan as yn, ROUTER_PRICE_SOURCE as yr, withJsonlFileLock as yt, meterRuntimeOwnedAccounting as z, spendFromUsageTotals as zi, peerMailVerbNames as zn, defineProfileMaterializationContract as zr, runCodeMode as zt };
33589
+ export { resolveSpawnResourcePaths as $, mapSandboxToolEvent as $i, HarnessTurnFailedError as $n, sandboxProfileMaterialization as $r, providerAsSandboxClient as $t, beginScopeOwnerAttempt as A, cappedDoublingMs as Ai, toOtelAttributes as An, readCodexRolloutSession as Ar, createExecutor as At, assertRecursiveReservationPolicy as B, executorFailure as Bi, PEER_MAIL_WIRE_KEY as Bn, LOCAL_HARNESSES as Br, TERMINAL_DECISIONS as Bt, interactiveAdmissionSeamKey as C, projectSandboxOutcome as Ci, createOpenInferenceFileExporter as Cn, bridgeAdmissionRefusal as Cr, readCommittedJsonLines as Ct, recoverRetainedInteractiveRun as D, RetainedExecutionPendingError as Di, loopEventToOtelSpan as Dn, addHarnessUsage as Dr, createExecutorRegistry as Dt, reconnectRetainedInteractiveRun as E, settlementFailureCause as Ei, generateSpanId as En, ROUTER_PRICE_SOURCE as Er, insideCursorNamespace as Et, coordinationMcpAlias as F, TRACE_ROOT_SCHEMA as Fi, INBOX_RECEIPT_KEY as Fn, signalAbortError as Fr, assertBoxlessPromptOptions as Ft, meterRuntimeOwnedAccounting as G, spendFromUsageEvents as Gi, peerMailVerbNames as Gn, controlProfileMaterialization as Gr, runCodeMode as Gt, freeSlots as H, createBudgetPool as Hi, createPeerMailbox as Hn, terminateProcessTreeAndConfirm as Hr, codeModeArguments as Ht, coordinationProfileToolPrefix as I, TRACE_SUMMARY_SCHEMA as Ii, createInbox as In, bridgeRuntimeAttachmentsKey as Ir, readPromptOptions as It, recordScopeOwnerDriverAttempt as J, defaultRedactor as Ji, createActivityLog as Jn, profileMaterializationAxes$1 as Jr, routerBrain as Jt, meterRuntimeOwnedProviderAttempt as K, spendFromUsageTotals as Ki, taskToPrompt$1 as Kn, defineProfileMaterializationContract as Kr, toolResultText as Kt, providerVisibleProfile as L, detachedFrozen as Li, failPendingAfter as Ln, bridgeStopSignalKey as Lr, createSandboxForSpec as Lt, recordScopeOwnerMaterialization as M, unavailablePauseMs as Mi, createRuntimeStreamEventCollector as Mn, RunCancellationReason as Mr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Mt, restoreScopeOwnerAcceptedExecution as N, unavailableResumeAt as Ni, sanitizeKnowledgeReadinessReport as Nn, linkAbort as Nr, createSteerableSandboxSession as Nt, startRetainedInteractiveRun as O, registerRetainedExecutorPreparation as Oi, padSpanId as On, createCodexRolloutStoreReader as Or, bindReusableExecutorExecutionId as Ot, scopeOwnerExecutorNodeContext as P, unavailableSignalOfFailure as Pi, sanitizeRuntimeStreamEvent as Pn, runAbortable as Pr, runAgentRounds as Pt, environmentReader as Q, mapSandboxEvent as Qi, DriverAttemptsExhaustedError as Qn, sandboxActProfileMaterialization as Qr, LEAF_CONTINUATION_TASK as Qt, runtimeGraphMetadataKey as R, detachedSnapshot as Ri, AUTHORITY_MARKERS as Rn, runSettledCommand as Rr, createSandboxLineage as Rt, workerTraceAnalysisStore as S, executableAgentSpecSnapshot as Si, buildRuntimeEventOtelSpans as Sn, isFiniteNumber as Sr, readCommittedJsonFile as St, readWorkerInteractiveBinding as T, runtimeFailureCause as Ti, flatOtelSpan as Tn, priceTokens as Tr, withJsonlFileLock as Tt, queueOf as U, meterUsageEvent as Ui, isPeerMailEnvelope as Un, assertProfileMaterialization as Ur, codeModeModelOutput as Ut, deriveNodeExecutionIdentity as V, errMessage as Vi, claimsAuthority as Vn, harnessInvocation as Vr, defaultSelectWinner as Vt, rollingDispatch as W, newUsageTotals as Wi, peerMailTools as Wn, assertProfileMaterializes as Wr, createCodeModeTools as Wt, prepareScopeRetainedOwnerSeatSwitch as X, resolveRedactor as Xi, isLiveNodeStatus as Xn, promptModelProfileMaterialization as Xr, resolveAgentEnvironmentProvider as Xt, recordScopeOwnerPause as Y, defaultRedactorIdentityMaterial as Yi, readWorkerProgress as Yn, promptControlProfileMaterialization as Yr, createAgentEnvironmentProviderRegistry as Yt, scopeRetainedOwnerResourceReader as Z, createSandboxToolPartState as Zi, isTerminalNodeStatus as Zn, renderUnsupported as Zr, providerAsExecutor as Zt, withDriverExecutor as _, runtimeOwnedPendingExecutorMaterialization as _i, WORKER_TRACE_PROPAGATION as _n, admitContinuationPolicy as _r, InMemorySpawnJournal as _t, assertRunParking as a, notifySandboxEventObserver as aa, authoredProfileDigest as ai, destroyInteractiveEnvironment as an, upstreamUnavailableSignal as ar, beginScopeRetainedOwnerDrive as at, isTraceAnalysisStore as b, unknownMaterializationReceipt as bi, buildLoopOtelSpans as bn, createContinuationKeeper as br, isNoEntError as bt, sleepScopeWait as c, awaitAbortable$1 as ca, knownExecutionBindingReceipt as ci, harnessTranscriptArtifact as cn, authoredSeatStages as cr, scopeRetainedOwnerRestorePoint as ct, runFinalizer as d, providerMessageText as da, providerAttemptEvidence as di, resolveHarnessTranscriptCapture as dn, CheckUnavailableError as dr, bindScopeRetainedOwnerProvider as dt, terminalTextFromSandboxEvent as ea, unsupportedProfileDimensions as ei, reconnectRetainedRun as en, abandonablePending as er, abandonScopeRetainedOwnerInvocation as et, runTree as f, recordRuntimeOwnedDriveHarnessProviderEvidence as fi, retainHarnessTranscript as fn, gateFactoryOnDeliverable as fr, scopeRetainedOwnerContext as ft, isDriverSpec as g, runtimeOwnedExecutorProviderEvidence as gi, createInPlaceCliExecutor as gn, CONTINUATIONS_DIR as gr, InMemoryResultBlobStore as gt, driverExecutorFactory as h, runtimeOwnedExecutorMaterialization as hi, createWorktreeCliExecutor as hn, verdictFromJudgeScore as hr, materializeTreeView as ht, RunParkedError as i, extractLlmCallEvent as ia, authoredAgentIdentity as ii, retainedCreateMaterial as in, undispatchedCredentialExit as ir, scopeRetainedOwnerResult as it, noteScopeOwnerPlannedExecution as j, jitteredMs as ji, createRuntimeEventCollector as jn, createPushTraceSource as jr, snapshotExecutorConfig as jt, FileSpawnJournal as k, retainedExecutorSeamKey as ki, padTraceId as kn, harnessUsageIsEmpty as kr, captureReusableExecutorConfig as kt, withRunParking as l, promptFromAgentTurnInput as la, knownMaterializationReceipt as li, persistHarnessTranscript as ln, seatExecutionProfile as lr, noteScopeRetainedOwnerCoordination as lt, driverChild as m, runtimeOwnedExecutorExecutionBinding as mi, openSlotGroup as mn, mapExecutorResult as mr, loadSpawnForest as mt, createSupervisor as n, createSandboxTurnEventCollector as na, attestRuntimeOwnedPendingExecutor as ni, startRetainedRun as nn, classifyDriverFailure as nr, prepareScopeRetainedOwnerTask as nt, bindScopeParkingDrain as o, sumSandboxUsage as oa, finalizeRuntimeOwnedPendingExecutor as oi, environmentGone as on, SeatChain as or, scopeRetainedOwnerTurnEnded as ot, createRootHandle as p, runtimeOwnedDriveHarnessProviderEvidence as pi, createWorkerSlots as pn, gateOnDeliverable as pr, scopeRetainedOwnerJournalRoot as pt, recordScopeOwnerBarrenPause as q, assertValidBudget as qi, DEFAULT_STALL_AFTER_MS as qn, fullProfileMaterialization as qr, createRouterTranscript as qt, assertResumeLimits as r, createSandboxUsageLedger as ra, attestRuntimeOwnedScopeOwner as ri, startRetainedRunInEnvironment as rn, summarizeDriverAttempts as rr, scopeRetainedOwnerPriorSpend as rt, readRunParking as s, decodeHarnessUsage as sa, inheritRuntimeOwnedExecutorAttestation as si, captureHarnessTranscript as sn, SeatChainExhaustedError as sr, reconcileScopeRetainedOwnerEnvironment as st, DEFAULT_MAX_DEPTH as t, canonicalStreamEventFromSandboxEvent as ta, worktreeCliProfileMaterialization as ti, recoverRetainedRun as tn, causedByPartialFailure as tr, consumeScopeRetainedOwnerResult as tt, bestDelivered as u, promptOptionsFromAgentTurnInput as ua, newExecutionAttemptId as ui, readHarnessTranscript as un, subscriptionUsageLimitSignal as ur, bindScopeRetainedOwnerEnvironmentId as ut, createScope as v, runtimeOwnedScopeOwnerRuntime as vi, createPropagatingTraceEmitter as vn, bestComposite as vr, FileResultBlobStore as vt, attachWorker as w, readSandboxOutcome as wi, createOtelExporter as wn, bridgeModelRouteRefusal as wr, upsertCommittedJsonLine as wt, parseWorkerToolTraceArtifact as x, executableAgentProfileSnapshot as xi, buildLoopSpanNodes as xn, failedItems as xr, prepareJsonlAppend as xt, replaySpawnTree as y, unknownExecutionBindingReceipt as yi, readTraceContextFromEnv as yn, checkVerdictOf as yr, appendCommittedJsonLine as yt, settledToIteration as z, contentAddress as zi, DEFAULT_PEER_MAIL_LIMITS as zn, runWorktreeHarness as zr, acquireSandbox as zt };
33322
33590
 
33323
- //# sourceMappingURL=supervisor-D3M9ab1v.js.map
33591
+ //# sourceMappingURL=supervisor-DDy0aEtR.js.map