@tangle-network/agent-runtime 0.231.1 → 0.232.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{activation-DVqSBfe1.js → activation-BXjgjus6.js} +2 -2
  2. package/dist/{activation-DVqSBfe1.js.map → activation-BXjgjus6.js.map} +1 -1
  3. package/dist/{activation-Dltkq5S8.d.ts → activation-LJ33ygpS.d.ts} +2 -2
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-CUdEC2Qh.js → coordination-driver-hXWuo-1n.js} +14 -13
  7. package/dist/{coordination-driver-CUdEC2Qh.js.map → coordination-driver-hXWuo-1n.js.map} +1 -1
  8. package/dist/{delegate-BN0cSSUT.js → delegate-B8b6oHnj.js} +2 -2
  9. package/dist/{delegate-BN0cSSUT.js.map → delegate-B8b6oHnj.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +9 -3
  12. package/dist/durable.js.map +1 -1
  13. package/dist/{graph-D4wgK3ns.js → graph-Ce7g744w.js} +3 -3
  14. package/dist/{graph-D4wgK3ns.js.map → graph-Ce7g744w.js.map} +1 -1
  15. package/dist/{improvement-cycle-CjIeWuyB.js → improvement-cycle-CGAPVMst.js} +3 -3
  16. package/dist/{improvement-cycle-CjIeWuyB.js.map → improvement-cycle-CGAPVMst.js.map} +1 -1
  17. package/dist/{index-BW6lJXnH.d.ts → index-BnEWL76W.d.ts} +26 -20
  18. package/dist/index.d.ts +6 -6
  19. package/dist/index.js +7 -7
  20. package/dist/intelligence.d.ts +3 -3
  21. package/dist/intelligence.js +3 -3
  22. package/dist/kernel.d.ts +4 -4
  23. package/dist/kernel.js +9 -9
  24. package/dist/{loop-runner-bin-BcqlGNW-.d.ts → loop-runner-bin-BdobVmHx.d.ts} +3 -3
  25. package/dist/{loop-runner-bin-BodmUPOf.js → loop-runner-bin-Q47flacp.js} +3 -3
  26. package/dist/{loop-runner-bin-BodmUPOf.js.map → loop-runner-bin-Q47flacp.js.map} +1 -1
  27. package/dist/loop-runner-bin.d.ts +1 -1
  28. package/dist/loop-runner-bin.js +1 -1
  29. package/dist/mcp/bin.js +3 -3
  30. package/dist/mcp/index.d.ts +5 -5
  31. package/dist/mcp/index.js +4 -4
  32. package/dist/{openai-tools-avHT8eq3.d.ts → openai-tools-Dl5AKEtq.d.ts} +2 -2
  33. package/dist/profiles.d.ts +2 -2
  34. package/dist/{provision-supervisor-DyNDlA2I.js → provision-supervisor-BXnC4uwd.js} +3 -3
  35. package/dist/{provision-supervisor-DyNDlA2I.js.map → provision-supervisor-BXnC4uwd.js.map} +1 -1
  36. package/dist/{runtime-BxZHapmG.js → runtime-CcMvprwa.js} +8 -8
  37. package/dist/{runtime-BxZHapmG.js.map → runtime-CcMvprwa.js.map} +1 -1
  38. package/dist/{server-C9pa2tSq.js → server-ClTO4X79.js} +3 -3
  39. package/dist/{server-C9pa2tSq.js.map → server-ClTO4X79.js.map} +1 -1
  40. package/dist/{stream-agent-turn-hiU4vgGX.d.ts → stream-agent-turn-nAvemLZR.d.ts} +2 -11
  41. package/dist/{structural-rollout-DQoLyth9.js → structural-rollout-C9z5pjxN.js} +2 -2
  42. package/dist/{structural-rollout-DQoLyth9.js.map → structural-rollout-C9z5pjxN.js.map} +1 -1
  43. package/dist/{substrate-CBo6TWOl.d.ts → substrate-ijm9h_79.d.ts} +2 -2
  44. package/dist/{supervise-Cl_-IsVc.js → supervise-CLkM45VY.js} +13 -10
  45. package/dist/supervise-CLkM45VY.js.map +1 -0
  46. package/dist/{supervisor-DFsXULnE.js → supervisor-BVAM5glY.js} +379 -168
  47. package/dist/supervisor-BVAM5glY.js.map +1 -0
  48. package/dist/testing.d.ts +2 -2
  49. package/dist/testing.js +12 -12
  50. package/dist/tui/index.d.ts +1 -1
  51. package/dist/tui/index.js +1 -1
  52. package/dist/{types-DBovefLD.d.ts → types-C8Fj6hNL.d.ts} +136 -24
  53. package/package.json +1 -1
  54. package/dist/supervise-Cl_-IsVc.js.map +0 -1
  55. package/dist/supervisor-DFsXULnE.js.map +0 -1
@@ -5754,7 +5754,18 @@ function generateTraceId() {
5754
5754
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
5755
5755
  }
5756
5756
  //#endregion
5757
- //#region src/runtime/native-session-evidence.ts
5757
+ //#region src/durable/content-address.ts
5758
+ /** Stable content address shared by result and trace artifacts. */
5759
+ function contentAddress(artifact) {
5760
+ return `sha256:${createHash("sha256").update(stableStringify(artifact), "utf-8").digest("hex")}`;
5761
+ }
5762
+ function stableStringify(value) {
5763
+ if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
5764
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
5765
+ return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
5766
+ }
5767
+ //#endregion
5768
+ //#region src/runtime/harness-transcript.ts
5758
5769
  /**
5759
5770
  * Read a sandbox child's own harness transcript out of its environment before the
5760
5771
  * environment is destroyed, and persist it beside the tool-span `trace` receipt.
@@ -5777,9 +5788,11 @@ function generateTraceId() {
5777
5788
  * `exec`. An environment with `read` but no `exec` cannot be enumerated and is also
5778
5789
  * reported, not guessed at.
5779
5790
  *
5780
- * Storage is NOT this module's business. The executor returns the artifact inside the result
5781
- * it already settles with, and supervise puts that under the child's `outRef` in its own
5782
- * `ResultBlobStore`. No destroy site learns about storage, and replay rehydrates it for free.
5791
+ * Storage is NOT the executor's business. The executor holds the in-memory capture and hands it
5792
+ * to the scope through `Executor.harnessTranscript()`; the scope persists it under its own
5793
+ * content ref with `persistHarnessTranscript` and settles the receipt. No provider or destroy
5794
+ * site learns about storage, the result blob never carries the files, and replay rehydrates a
5795
+ * pointer — the bytes are read only by `harnessTranscriptArtifact`, when someone opens them.
5783
5796
  *
5784
5797
  * Credentials are excluded by construction: enumeration lists only the transcript globs
5785
5798
  * for the harness, and any path matching DENY is dropped even if a producer moved a
@@ -5805,9 +5818,15 @@ const HARNESS_ROOTS = Object.freeze({
5805
5818
  */
5806
5819
  const DENY = /(^|\/)(auth\.json|\.credentials\.json|credentials|\.netrc|\.env(\..*)?|secrets?(\.|$)|.*\.(pem|key|p12|pfx)|id_[a-z0-9_]+)$/iu;
5807
5820
  /**
5808
- * Bounds per file and in total. These are deliberately modest: the artifact rides inside the
5809
- * settled result that supervise blobs under one `outRef`, so an unbounded transcript would
5810
- * bloat every replay of that child, not just the capture.
5821
+ * Bounds per file and in total, PER CHILD. They multiply by fleet width, and the next person
5822
+ * sizing a fleet must find that here: a 132-child pursuit (mech-interp-foundations-astra-20260911f,
5823
+ * the widest retained on one operator host) at the ceiling is 132 x 16 MiB = 2.1 GiB of transcript
5824
+ * for one run (#1248).
5825
+ *
5826
+ * That figure is a DISK number, not a replay number. The artifact is persisted under its own
5827
+ * content ref in the `ResultBlobStore` and the settlement carries only the receipt, so replay and
5828
+ * resume rehydrate a ref, never the files; nothing pays for a transcript until someone opens it.
5829
+ * The bound is enforced exactly, after each read, so a child settles at or under MAX_TOTAL_BYTES.
5811
5830
  */
5812
5831
  const MAX_FILE_BYTES = 2 * 1024 * 1024;
5813
5832
  const MAX_TOTAL_BYTES = 16 * 1024 * 1024;
@@ -5818,17 +5837,53 @@ function unavailable$2(reason) {
5818
5837
  reason
5819
5838
  });
5820
5839
  }
5840
+ /** The one place an absent transcript is spelled, so every settlement reads the same — the
5841
+ * settle path needs it for the reasons only IT can know (an executor that offers no transcript,
5842
+ * a child that never started), which the capture itself never sees. */
5843
+ function harnessTranscriptUnavailable(reason) {
5844
+ return unavailable$2(reason);
5845
+ }
5821
5846
  /**
5822
5847
  * Enumerate candidate transcript paths inside the environment.
5823
5848
  *
5824
- * `find` is given the roots and prints one path per line. A missing root is not an error:
5825
- * a child that never used a harness has no directory for it.
5849
+ * `find` is given the roots and prints one `size<TAB>path` line per file. A missing root is not
5850
+ * an error: a child that never used a harness has no directory for it. A line with no size (an
5851
+ * environment whose `find` lacks `-printf`) is read and bounded after the read, as before.
5852
+ *
5853
+ * Two omissions used to be silent, so `skippedCount` could read 0 on an incomplete capture: a
5854
+ * `-size` filter dropped oversized files before they were ever listed, and `head` cut the listing
5855
+ * at MAX_FILES with nothing saying so. Both are reported now: an oversized file is skipped by its
5856
+ * listed size WITHOUT being read, and a listing that overflows carries one
5857
+ * `enumeration-truncated` entry naming the bound.
5826
5858
  */
5827
5859
  async function enumerate(environment, roots, signal) {
5828
5860
  if (!environment.exec) return void 0;
5829
- const command = `find ${roots.map((r) => `"$HOME/${r}"`).join(" ")} -type f -size -${Math.floor(MAX_FILE_BYTES / 1024)}k 2>/dev/null | head -${MAX_FILES}`;
5861
+ const command = `find ${roots.map((r) => `"$HOME/${r}"`).join(" ")} -type f -printf '%s\\t%p\\n' 2>/dev/null | head -1001`;
5830
5862
  try {
5831
- return ((await environment.exec(command, signal ? { signal } : void 0)).stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
5863
+ const lines = ((await environment.exec(command, signal ? { signal } : void 0)).stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
5864
+ const omitted = [];
5865
+ const paths = [];
5866
+ for (const line of lines.slice(0, MAX_FILES)) {
5867
+ const tab = line.indexOf(" ");
5868
+ const path = tab === -1 ? line : line.slice(tab + 1);
5869
+ const size = tab === -1 ? void 0 : Number(line.slice(0, tab));
5870
+ if (size !== void 0 && Number.isFinite(size) && size > MAX_FILE_BYTES) {
5871
+ omitted.push({
5872
+ path,
5873
+ reason: "file-exceeds-byte-bound"
5874
+ });
5875
+ continue;
5876
+ }
5877
+ paths.push(path);
5878
+ }
5879
+ if (lines.length > MAX_FILES) omitted.push({
5880
+ path: roots.join(" "),
5881
+ reason: `enumeration-truncated-at-${MAX_FILES}`
5882
+ });
5883
+ return {
5884
+ paths,
5885
+ omitted
5886
+ };
5832
5887
  } catch {
5833
5888
  return;
5834
5889
  }
@@ -5841,16 +5896,17 @@ async function enumerate(environment, roots, signal) {
5841
5896
  * must not fail because evidence could not be collected, and every failure mode is a named
5842
5897
  * `reason` the settled receipt carries instead of an empty artifact that reads as coverage.
5843
5898
  */
5844
- async function captureNativeSessionEvidence(environment, harness, signal) {
5899
+ async function captureHarnessTranscript(environment, harness, signal) {
5845
5900
  if (!environment?.read) return unavailable$2("unsupported-environment");
5846
5901
  if (harness === void 0) return unavailable$2("unknown-harness");
5847
5902
  const roots = HARNESS_ROOTS[harness];
5848
5903
  if (!roots) return unavailable$2("unknown-harness");
5849
- const paths = await enumerate(environment, roots, signal);
5850
- if (paths === void 0) return unavailable$2("enumeration-failed");
5851
- if (paths.length === 0) return unavailable$2("no-transcript");
5904
+ const enumerated = await enumerate(environment, roots, signal);
5905
+ if (enumerated === void 0) return unavailable$2("enumeration-failed");
5906
+ const { paths } = enumerated;
5907
+ if (paths.length === 0 && enumerated.omitted.length === 0) return unavailable$2("no-transcript");
5852
5908
  const files = [];
5853
- const skipped = [];
5909
+ const skipped = [...enumerated.omitted];
5854
5910
  let total = 0;
5855
5911
  for (const path of paths) {
5856
5912
  if (signal?.aborted) {
@@ -5884,6 +5940,13 @@ async function captureNativeSessionEvidence(environment, harness, signal) {
5884
5940
  });
5885
5941
  continue;
5886
5942
  }
5943
+ if (total + bytes > MAX_TOTAL_BYTES) {
5944
+ skipped.push({
5945
+ path,
5946
+ reason: "total-byte-budget-exhausted"
5947
+ });
5948
+ continue;
5949
+ }
5887
5950
  files.push(Object.freeze({
5888
5951
  path,
5889
5952
  bytes,
@@ -5897,7 +5960,11 @@ async function captureNativeSessionEvidence(environment, harness, signal) {
5897
5960
  });
5898
5961
  }
5899
5962
  }
5900
- if (files.length === 0) return unavailable$2("no-transcript");
5963
+ if (files.length === 0) return Object.freeze({
5964
+ status: "unavailable",
5965
+ reason: "nothing-carried",
5966
+ skipped: Object.freeze(skipped)
5967
+ });
5901
5968
  const artifact = Object.freeze({
5902
5969
  schemaVersion: 1,
5903
5970
  harness,
@@ -5905,13 +5972,54 @@ async function captureNativeSessionEvidence(environment, harness, signal) {
5905
5972
  skipped: Object.freeze(skipped)
5906
5973
  });
5907
5974
  return Object.freeze({
5908
- status: "available",
5975
+ status: "captured",
5909
5976
  artifact,
5910
5977
  fileCount: files.length,
5911
5978
  totalBytes: total,
5912
5979
  skippedCount: skipped.length
5913
5980
  });
5914
5981
  }
5982
+ /**
5983
+ * Persist a capture under its own content ref and return the receipt a settlement carries.
5984
+ *
5985
+ * The scope calls this, not the executor: storage stays out of every provider and destroy site,
5986
+ * exactly as the tool-span trace is persisted by `captureWorkerTraceEvidence` and not by the
5987
+ * source that collected it. A capture that is already unavailable passes through untouched.
5988
+ */
5989
+ async function persistHarnessTranscript(capture, blobs) {
5990
+ if (capture.status !== "captured") return capture;
5991
+ const transcriptRef = contentAddress(capture.artifact);
5992
+ try {
5993
+ await blobs.put(transcriptRef, capture.artifact);
5994
+ } catch {
5995
+ return unavailable$2("transcript-persistence-failed");
5996
+ }
5997
+ return Object.freeze({
5998
+ status: "available",
5999
+ transcriptRef,
6000
+ harness: capture.artifact.harness,
6001
+ fileCount: capture.fileCount,
6002
+ totalBytes: capture.totalBytes,
6003
+ skippedCount: capture.skippedCount
6004
+ });
6005
+ }
6006
+ /**
6007
+ * Rehydrate the exact persisted transcript a receipt points at, or `undefined` when the receipt
6008
+ * says there is none. Throws only when the receipt claims a blob the store does not hold — that
6009
+ * is corruption, not absence, and must not read as "no transcript".
6010
+ */
6011
+ async function harnessTranscriptArtifact(evidence, blobs) {
6012
+ if (evidence.status !== "available") return void 0;
6013
+ const raw = await blobs.get(evidence.transcriptRef);
6014
+ if (!isHarnessTranscriptArtifact(raw)) throw new ValidationError$1(`harnessTranscriptArtifact: blob store has no transcript artifact for '${evidence.transcriptRef}'`);
6015
+ return raw;
6016
+ }
6017
+ /** Every entry, not just the arrays: a blob with `files: [null]` is corruption, not a transcript. */
6018
+ function isHarnessTranscriptArtifact(value) {
6019
+ if (value === null || typeof value !== "object") return false;
6020
+ const artifact = value;
6021
+ return artifact.schemaVersion === 1 && typeof artifact.harness === "string" && Array.isArray(artifact.files) && artifact.files.every((file) => file !== null && typeof file === "object" && typeof file.path === "string" && typeof file.content === "string" && Number.isSafeInteger(file.bytes) && file.bytes >= 0) && Array.isArray(artifact.skipped) && artifact.skipped.every((entry) => entry !== null && typeof entry === "object" && typeof entry.path === "string" && typeof entry.reason === "string");
6022
+ }
5915
6023
  //#endregion
5916
6024
  //#region src/runtime/provider-placement.ts
5917
6025
  const placementMetadataKey = "runtimeProviderPlacement";
@@ -7563,6 +7671,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7563
7671
  let artifact;
7564
7672
  let retained;
7565
7673
  let pending = false;
7674
+ let harnessTranscript = harnessTranscriptUnavailable("execution-never-started");
7566
7675
  const retention = retainedExecutorContext(ctx);
7567
7676
  let destroyed = false;
7568
7677
  const runtime = options.runtime ?? provider.name;
@@ -7639,6 +7748,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7639
7748
  },
7640
7749
  onEnvironment: (env) => {
7641
7750
  environment = env;
7751
+ if (harnessTranscript.status === "unavailable" && harnessTranscript.reason === "execution-never-started") harnessTranscript = harnessTranscriptUnavailable("capture-did-not-run");
7642
7752
  finalizeRuntimeOwnedPendingExecutor(executor, {
7643
7753
  ...plannedDeclaration,
7644
7754
  execution: {
@@ -7650,6 +7760,9 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7650
7760
  onArtifact: (next) => {
7651
7761
  artifact = next;
7652
7762
  },
7763
+ onHarnessTranscript: (next) => {
7764
+ harnessTranscript = next;
7765
+ },
7653
7766
  onDestroyed: () => {
7654
7767
  destroyed = true;
7655
7768
  }
@@ -7735,7 +7848,8 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
7735
7848
  if (!artifact) throw new ValidationError(`providerAsExecutor(${provider.name}): resultArtifact() read before stream drained`);
7736
7849
  return artifact;
7737
7850
  },
7738
- traceSource: () => trace.source
7851
+ traceSource: () => trace.source,
7852
+ harnessTranscript: () => harnessTranscript
7739
7853
  };
7740
7854
  return attestRuntimeOwnedPendingExecutor(executor, runtime, plannedDeclaration, plannedBinding);
7741
7855
  }
@@ -7832,10 +7946,10 @@ async function* streamProviderExecutor(args) {
7832
7946
  }
7833
7947
  if ((args.options.requireTerminalEvent ?? true) && !terminal) throw new ValidationError(`providerAsExecutor(${args.provider.name}): stream ended without a terminal result/done/status event`);
7834
7948
  yield { kind: "iteration" };
7835
- const nativeSession = await captureNativeSessionEvidence(environment, args.profile.harness, linked);
7949
+ const harnessTranscript = await captureHarnessTranscript(environment, args.profile.harness, linked);
7950
+ args.onHarnessTranscript(harnessTranscript);
7836
7951
  const result = {
7837
7952
  ...resultFromEvents(archive.events(), text),
7838
- nativeSession,
7839
7953
  ...archive.superseded > 0 ? { supersededPartUpdates: archive.superseded } : {},
7840
7954
  ...explicitFailure ? { outcome: outcomeTracker.finish() } : {}
7841
7955
  };
@@ -7870,6 +7984,7 @@ async function* streamProviderExecutor(args) {
7870
7984
  } catch (error) {
7871
7985
  failure = source.retained ? new RetainedExecutionPendingError(error) : error;
7872
7986
  failed = true;
7987
+ args.onHarnessTranscript(await captureHarnessTranscript(environment, args.profile.harness, linked));
7873
7988
  } finally {
7874
7989
  if ((!source.retained || settled !== void 0 && !failed) && !(source.retained && args.retention?.preserveEnvironment) && (args.options.destroyOnSettle ?? true)) try {
7875
7990
  await environment.destroy?.();
@@ -15074,17 +15189,6 @@ function describeLeakedReservation(leak) {
15074
15189
  return parts.join(", ");
15075
15190
  }
15076
15191
  //#endregion
15077
- //#region src/durable/content-address.ts
15078
- /** Stable content address shared by result and trace artifacts. */
15079
- function contentAddress(artifact) {
15080
- return `sha256:${createHash("sha256").update(stableStringify(artifact), "utf-8").digest("hex")}`;
15081
- }
15082
- function stableStringify(value) {
15083
- if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
15084
- if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
15085
- return `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
15086
- }
15087
- //#endregion
15088
15192
  //#region src/runtime/supervise/trace-evidence.ts
15089
15193
  /**
15090
15194
  * Durable structured tool evidence for supervised workers.
@@ -15204,27 +15308,6 @@ function runtimeOwnedNestedDriverTreeRoot(owner, parentTreeRoot, driverNodeId) {
15204
15308
  //#endregion
15205
15309
  //#region src/durable/spawn-journal.ts
15206
15310
  /**
15207
- *
15208
- * Event-sourced spawn journal for the recursive execution atom (build steps 3 + 7).
15209
- *
15210
- * The supervision tree is journaled as an append-only event log: every `spawned`,
15211
- * `settled`, and `cancelled` is recorded AFTER it is observed-committed (never
15212
- * speculative), mirroring `ConversationJournal`'s begin/append/load shape. The log
15213
- * holds only the THIN decision record — ids, parentage, budget, the spend a decision
15214
- * consumed, and a content-addressed `outRef`. The payloads the driver branched on
15215
- * (the `out` artifacts) live in a separate `ResultBlobStore`, keyed by `outRef`, so
15216
- * the journal stays small (decisions) and replay rehydrates the exact `Settled` from
15217
- * the blob store (evidence). This is the decision/payload split the replay argument
15218
- * rests on (B1/B2).
15219
- *
15220
- * Replay determinism (B2): `seq` is the monotonic cursor order `scope.next()` yielded
15221
- * each settlement — NOT wall-clock. `replaySpawnTree` sorts strictly by `seq` before
15222
- * touching the blob store, so the order in which rehydration `get`s resolve can never
15223
- * reorder the replayed `Settled[]`; the result is identical regardless of blob latency.
15224
- *
15225
- * @stable
15226
- */
15227
- /**
15228
15311
  * Mint the content-addressed `outRef` for a result artifact: `sha256:<hex>` over a
15229
15312
  * stable JSON encoding. Producers call this to derive the `outRef` they journal and
15230
15313
  * `put`; the FS/in-mem stores re-derive it on `put` to verify the supplied ref
@@ -15337,14 +15420,17 @@ var InMemorySpawnJournal = class {
15337
15420
  }
15338
15421
  this.trees.set(root, {
15339
15422
  begunAt: at,
15340
- events: []
15423
+ events: [],
15424
+ index: new SpawnEventIndex(root)
15341
15425
  });
15342
15426
  }
15343
15427
  async appendEvent(root, ev) {
15344
15428
  const tree = this.trees.get(root);
15345
15429
  if (!tree) throw new Error(`appendEvent called for unknown spawn tree '${root}'; call beginTree first`);
15346
- assertSeqUnique(root, tree.events, ev);
15347
- tree.events.push(detachedSnapshot(ev, "spawn event"));
15430
+ const event = detachedSnapshot(ev, "spawn event");
15431
+ tree.index.assert(event);
15432
+ tree.events.push(event);
15433
+ tree.index.add(event);
15348
15434
  }
15349
15435
  };
15350
15436
  /**
@@ -15359,6 +15445,7 @@ var InMemorySpawnJournal = class {
15359
15445
  var FileSpawnJournal = class {
15360
15446
  path;
15361
15447
  appendTail = Promise.resolve();
15448
+ appendIndex;
15362
15449
  constructor(path) {
15363
15450
  this.path = path;
15364
15451
  }
@@ -15373,12 +15460,14 @@ var FileSpawnJournal = class {
15373
15460
  }
15374
15461
  let begun = false;
15375
15462
  const events = [];
15463
+ const index = new SpawnEventIndex(root);
15376
15464
  for (const record of parseCommittedJsonLines(text, this.path)) {
15377
15465
  if (record.root !== root) continue;
15378
15466
  if (record.kind === "begin") begun = true;
15379
15467
  else {
15380
15468
  if (!begun) throw new Error(`spawn journal corrupted: event for tree '${root}' precedes its begin record`);
15381
- assertSeqUnique(root, events, record.event);
15469
+ index.assert(record.event);
15470
+ index.add(record.event);
15382
15471
  events.push(record.event);
15383
15472
  }
15384
15473
  }
@@ -15386,41 +15475,73 @@ var FileSpawnJournal = class {
15386
15475
  }
15387
15476
  async beginTree(root, at) {
15388
15477
  return this.serializeAppend(async () => {
15389
- const existing = await this.loadTreeBegin(root);
15478
+ const state = await this.validationIndex();
15479
+ const existing = state.trees.get(root);
15390
15480
  if (existing) {
15391
- if (existing !== at) throw new Error(`spawn tree '${root}' already begun in ${this.path} at ${existing}; refusing to overwrite with ${at}`);
15481
+ if (existing.begunAt !== at) throw new Error(`spawn tree '${root}' already begun in ${this.path} at ${existing.begunAt}; refusing to overwrite with ${at}`);
15392
15482
  return;
15393
15483
  }
15394
- await this.writeRecord({
15484
+ state.stamp = await this.writeRecord({
15395
15485
  kind: "begin",
15396
15486
  root,
15397
15487
  at
15398
15488
  });
15489
+ state.trees.set(root, {
15490
+ begunAt: at,
15491
+ index: new SpawnEventIndex(root)
15492
+ });
15399
15493
  });
15400
15494
  }
15401
15495
  async appendEvent(root, ev) {
15402
15496
  const event = detachedSnapshot(ev, "spawn event");
15403
15497
  return this.serializeAppend(async () => {
15404
- const events = await this.loadTree(root);
15405
- if (events === void 0) throw new Error(`appendEvent called for unknown spawn tree '${root}'; call beginTree first`);
15406
- assertSeqUnique(root, events, event);
15407
- await this.writeRecord({
15498
+ const state = await this.validationIndex();
15499
+ const tree = state.trees.get(root);
15500
+ if (tree === void 0) throw new Error(`appendEvent called for unknown spawn tree '${root}'; call beginTree first`);
15501
+ tree.index.assert(event);
15502
+ state.stamp = await this.writeRecord({
15408
15503
  kind: "event",
15409
15504
  root,
15410
15505
  event
15411
15506
  });
15507
+ tree.index.add(event);
15412
15508
  });
15413
15509
  }
15414
- async loadTreeBegin(root) {
15510
+ async validationIndex() {
15511
+ const fs = await import("node:fs/promises");
15512
+ const stamp = await this.fileStamp();
15513
+ if (this.appendIndex && this.appendIndex.stamp === stamp) return this.appendIndex;
15514
+ this.appendIndex = void 0;
15515
+ const trees = /* @__PURE__ */ new Map();
15516
+ if (stamp !== void 0) {
15517
+ const text = await fs.readFile(this.path, "utf8");
15518
+ if (await this.fileStamp() !== stamp) throw new Error("spawn journal changed while rebuilding its append index");
15519
+ for (const record of parseCommittedJsonLines(text, this.path)) if (record.kind === "begin") {
15520
+ if (!trees.has(record.root)) trees.set(record.root, {
15521
+ begunAt: record.at,
15522
+ index: new SpawnEventIndex(record.root)
15523
+ });
15524
+ } else {
15525
+ const tree = trees.get(record.root);
15526
+ if (!tree) throw new Error(`spawn journal corrupted: event for tree '${record.root}' precedes its begin record`);
15527
+ tree.index.assert(record.event);
15528
+ tree.index.add(record.event);
15529
+ }
15530
+ }
15531
+ this.appendIndex = {
15532
+ stamp,
15533
+ trees
15534
+ };
15535
+ return this.appendIndex;
15536
+ }
15537
+ async fileStamp() {
15415
15538
  const fs = await import("node:fs/promises");
15416
- let text;
15417
15539
  try {
15418
- text = await fs.readFile(this.path, "utf8");
15419
- } catch (err) {
15420
- if (isNoEntError(err)) return void 0;
15421
- throw err;
15540
+ return journalFileStamp(await fs.stat(this.path, { bigint: true }));
15541
+ } catch (error) {
15542
+ if (isNoEntError(error)) return void 0;
15543
+ throw error;
15422
15544
  }
15423
- for (const record of parseCommittedJsonLines(text, this.path)) if (record.root === root && record.kind === "begin") return record.at;
15424
15545
  }
15425
15546
  async serializeAppend(operation) {
15426
15547
  const append = this.appendTail.then(operation);
@@ -15430,17 +15551,29 @@ var FileSpawnJournal = class {
15430
15551
  async writeRecord(record) {
15431
15552
  const fs = await import("node:fs/promises");
15432
15553
  const path = await import("node:path");
15433
- await fs.mkdir(path.dirname(this.path), { recursive: true });
15434
- const needsSeparator = await prepareJsonlAppend(this.path);
15435
- const fh = await fs.open(this.path, "a");
15436
15554
  try {
15437
- await writeAllBytes(fh, `${needsSeparator ? "\n" : ""}${JSON.stringify(record)}\n`);
15438
- await fh.sync();
15439
- } finally {
15440
- await fh.close();
15555
+ await fs.mkdir(path.dirname(this.path), { recursive: true });
15556
+ const needsSeparator = await prepareJsonlAppend(this.path);
15557
+ const fh = await fs.open(this.path, "a");
15558
+ try {
15559
+ await writeAllBytes(fh, `${needsSeparator ? "\n" : ""}${JSON.stringify(record)}\n`);
15560
+ await fh.sync();
15561
+ const stamp = journalFileStamp(await fh.stat({ bigint: true }));
15562
+ if (await this.fileStamp() !== stamp) throw new Error("spawn journal changed while acknowledging its append");
15563
+ return stamp;
15564
+ } finally {
15565
+ await fh.close();
15566
+ }
15567
+ } catch (error) {
15568
+ this.appendIndex = void 0;
15569
+ throw error;
15441
15570
  }
15442
15571
  }
15443
15572
  };
15573
+ /** Detect replacement, truncation, and same-size edits; this is not a cross-process write lock. */
15574
+ function journalFileStamp(stat) {
15575
+ return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
15576
+ }
15444
15577
  /**
15445
15578
  * Load every journal tree owned by one recursive supervision run and flatten its nodes/events.
15446
15579
  *
@@ -15707,79 +15840,104 @@ function servedIdentityParts(model) {
15707
15840
  snapshot
15708
15841
  };
15709
15842
  }
15710
- /** Retained records form one ordered admission chain; older journals need no such chain. */
15711
- function assertRetainedExecutionOrder(events, event) {
15712
- if (event.kind !== "execution-input" && event.kind !== "execution-admitted" && event.kind !== "execution-result") return;
15713
- const nodeEvents = events.filter((item) => item.id === event.id);
15714
- let inputIndex = -1;
15715
- for (let index = 0; index < nodeEvents.length; index++) if (nodeEvents[index].kind === "execution-input") inputIndex = index;
15716
- const prior = inputIndex < 0 ? nodeEvents : nodeEvents.slice(inputIndex);
15717
- function fail(reason) {
15718
- throw new Error(`spawn journal corrupted: retained execution '${event.id}' ${reason}`);
15719
- }
15720
- if (!nodeEvents.some((item) => item.kind === "spawned")) fail("precedes its spawn");
15721
- if (nodeEvents.some(closesCursorSlot)) fail("follows its terminal settlement");
15722
- if (event.kind === "execution-input") {
15723
- if (!/^sha256:[0-9a-f]{64}$/.test(event.taskRef)) fail("has an invalid task reference");
15724
- if (nodeEvents.some((item) => item.kind === "execution-input" && item.seq === event.seq)) fail("has duplicate input sequence");
15725
- if (inputIndex >= 0 && !prior.some((item) => item.kind === "execution-result")) fail("input replaces an unfinished invocation");
15726
- return;
15727
- }
15728
- const admissions = prior.flatMap((item) => item.kind === "execution-admitted" ? [item.admission] : []);
15729
- if (event.kind === "execution-result") {
15730
- if (prior.some((item) => item.kind === "execution-result")) fail("has duplicate result");
15731
- if (!admissions.some((item) => item.phase === "dispatched")) fail("result precedes dispatch");
15732
- if (!/^sha256:[0-9a-f]{64}$/.test(event.outRef)) fail("has an invalid result reference");
15733
- assertValidSpend(event.spent, "retained execution result");
15734
- executorFailureReason(event);
15735
- return;
15736
- }
15737
- const admission = event.admission;
15738
- if (!admission || ![
15739
- "intent",
15740
- "environment",
15741
- "dispatched"
15742
- ].includes(admission.phase)) fail("has an invalid admission phase");
15743
- if (admissions.some((item) => item.phase === admission.phase)) fail("has duplicate admission phase");
15744
- if (prior.some((item) => item.kind === "execution-result")) fail("admission follows result");
15745
- if (!prior.some((item) => item.kind === "execution-input")) fail("admission precedes input");
15746
- if (admission.phase === "intent") {
15747
- if (admissions.length !== 0) fail("intent follows another admission");
15748
- return;
15749
- }
15750
- const intent = admissions.find((item) => item.phase === "intent");
15751
- if (intent?.phase !== "intent") fail("admission precedes intent");
15752
- if (admission.idempotencyKey !== intent.idempotencyKey || admission.turnId !== intent.turnId) fail("changes its admitted request identity");
15753
- if (admission.phase === "environment") {
15754
- if (admission.provider !== intent.provider || admission.sessionId !== intent.sessionId || admission.executionId !== intent.executionId) fail("changes its admitted execution identity");
15755
- return;
15756
- }
15757
- const environment = admissions.find((item) => item.phase === "environment");
15758
- if (environment?.phase !== "environment") fail("dispatch precedes environment");
15759
- const control = admission.controlRef;
15760
- if (!control || control.provider !== intent.provider || control.environmentId !== environment.environmentId || control.sessionId !== intent.sessionId || control.executionId !== intent.executionId) fail("dispatch changes its admitted execution identity");
15761
- }
15762
- /**
15763
- * Two `seq` namespaces share the journal: a `spawned` event's `seq` is the spawn ordinal
15764
- * (the order children were created), and a `settled`/`cancelled` event's `seq` is the
15765
- * monotonic CURSOR order `scope.next()` yielded that settlement (B2). The uniqueness
15766
- * replay rests on is the cursor namespace — two settlements cannot share the position
15767
- * replay orders by so the guard checks only settled/cancelled events. A `spawned`
15768
- * ordinal legitimately equals a later `settled` cursor seq and is not a collision.
15769
- */
15770
- function assertSeqUnique(root, events, ev) {
15771
- assertRetainedExecutionOrder(events, ev);
15772
- if (ev.kind === "materialized") {
15773
- if (events.some((event) => event.kind === "materialized" && event.id === ev.id)) throw new Error(`spawn journal corrupted: duplicate materialization receipt for node '${ev.id}' in tree '${root}'`);
15774
- if (!events.some((event) => event.kind === "spawned" && event.id === ev.id)) throw new Error(`spawn journal corrupted: materialization for node '${ev.id}' precedes its spawn in tree '${root}'`);
15775
- }
15776
- if (ev.kind === "execution-bound") {
15777
- if (events.some((event) => event.kind === "execution-bound" && event.id === ev.id && event.binding.attemptId === ev.binding.attemptId)) throw new Error(`spawn journal corrupted: duplicate execution binding for node '${ev.id}' attempt '${ev.binding.attemptId}' in tree '${root}'`);
15778
- if (!events.some((event) => event.kind === "materialized" && event.id === ev.id)) throw new Error(`spawn journal corrupted: execution binding for node '${ev.id}' precedes materialization in tree '${root}'`);
15843
+ /** One validation implementation for memory, durable append, and cold replay. */
15844
+ var SpawnEventIndex = class {
15845
+ root;
15846
+ nodes = /* @__PURE__ */ new Map();
15847
+ cursors = /* @__PURE__ */ new Set();
15848
+ constructor(root) {
15849
+ this.root = root;
15850
+ }
15851
+ assert(event) {
15852
+ const node = this.nodes.get(event.id);
15853
+ this.assertRetained(node, event);
15854
+ if (event.kind === "materialized") {
15855
+ if (node?.materialized) throw new Error(`spawn journal corrupted: duplicate materialization receipt for node '${event.id}' in tree '${this.root}'`);
15856
+ if (!node?.spawned) throw new Error(`spawn journal corrupted: materialization for node '${event.id}' precedes its spawn in tree '${this.root}'`);
15857
+ }
15858
+ if (event.kind === "execution-bound") {
15859
+ if (node?.bindings.has(event.binding.attemptId)) throw new Error(`spawn journal corrupted: duplicate execution binding for node '${event.id}' attempt '${event.binding.attemptId}' in tree '${this.root}'`);
15860
+ if (!node?.materialized) throw new Error(`spawn journal corrupted: execution binding for node '${event.id}' precedes materialization in tree '${this.root}'`);
15861
+ }
15862
+ 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`);
15863
+ }
15864
+ /** Called only after validation and, for the file writer, a successful durable append. */
15865
+ add(event) {
15866
+ if (!outsideCursorNamespace(event)) this.cursors.add(event.seq);
15867
+ if (event.kind !== "spawned" && event.kind !== "materialized" && event.kind !== "execution-bound" && event.kind !== "execution-input" && event.kind !== "execution-admitted" && event.kind !== "execution-result" && !closesCursorSlot(event)) return;
15868
+ let node = this.nodes.get(event.id);
15869
+ if (!node) {
15870
+ node = {
15871
+ spawned: false,
15872
+ closed: false,
15873
+ materialized: false,
15874
+ bindings: /* @__PURE__ */ new Set(),
15875
+ inputs: /* @__PURE__ */ new Set(),
15876
+ input: false,
15877
+ result: false,
15878
+ admissions: /* @__PURE__ */ new Map()
15879
+ };
15880
+ this.nodes.set(event.id, node);
15881
+ }
15882
+ if (event.kind === "spawned") node.spawned = true;
15883
+ else if (event.kind === "materialized") node.materialized = true;
15884
+ else if (event.kind === "execution-bound") node.bindings.add(event.binding.attemptId);
15885
+ else if (event.kind === "execution-input") {
15886
+ node.inputs.add(event.seq);
15887
+ node.input = true;
15888
+ node.result = false;
15889
+ node.admissions.clear();
15890
+ } else if (event.kind === "execution-admitted") node.admissions.set(event.admission.phase, event.admission);
15891
+ else if (event.kind === "execution-result") node.result = true;
15892
+ if (closesCursorSlot(event)) node.closed = true;
15893
+ }
15894
+ assertRetained(node, event) {
15895
+ if (event.kind !== "execution-input" && event.kind !== "execution-admitted" && event.kind !== "execution-result") return;
15896
+ function fail(reason) {
15897
+ throw new Error(`spawn journal corrupted: retained execution '${event.id}' ${reason}`);
15898
+ }
15899
+ if (!node?.spawned) fail("precedes its spawn");
15900
+ if (node.closed) fail("follows its terminal settlement");
15901
+ if (event.kind === "execution-input") {
15902
+ if (!/^sha256:[0-9a-f]{64}$/.test(event.taskRef)) fail("has an invalid task reference");
15903
+ if (node.inputs.has(event.seq)) fail("has duplicate input sequence");
15904
+ if (node.input && !node.result) fail("input replaces an unfinished invocation");
15905
+ return;
15906
+ }
15907
+ if (event.kind === "execution-result") {
15908
+ if (node.result) fail("has duplicate result");
15909
+ if (!node.admissions.has("dispatched")) fail("result precedes dispatch");
15910
+ if (!/^sha256:[0-9a-f]{64}$/.test(event.outRef)) fail("has an invalid result reference");
15911
+ assertValidSpend(event.spent, "retained execution result");
15912
+ executorFailureReason(event);
15913
+ return;
15914
+ }
15915
+ const admission = event.admission;
15916
+ if (!admission || ![
15917
+ "intent",
15918
+ "environment",
15919
+ "dispatched"
15920
+ ].includes(admission.phase)) fail("has an invalid admission phase");
15921
+ if (node.admissions.has(admission.phase)) fail("has duplicate admission phase");
15922
+ if (node.result) fail("admission follows result");
15923
+ if (!node.input) fail("admission precedes input");
15924
+ if (admission.phase === "intent") {
15925
+ if (node.admissions.size !== 0) fail("intent follows another admission");
15926
+ return;
15927
+ }
15928
+ const intent = node.admissions.get("intent");
15929
+ if (intent?.phase !== "intent") fail("admission precedes intent");
15930
+ if (admission.idempotencyKey !== intent.idempotencyKey || admission.turnId !== intent.turnId) fail("changes its admitted request identity");
15931
+ if (admission.phase === "environment") {
15932
+ if (admission.provider !== intent.provider || admission.sessionId !== intent.sessionId || admission.executionId !== intent.executionId) fail("changes its admitted execution identity");
15933
+ return;
15934
+ }
15935
+ const environment = node.admissions.get("environment");
15936
+ if (environment?.phase !== "environment") fail("dispatch precedes environment");
15937
+ const control = admission.controlRef;
15938
+ if (!control || control.provider !== intent.provider || control.environmentId !== environment.environmentId || control.sessionId !== intent.sessionId || control.executionId !== intent.executionId) fail("dispatch changes its admitted execution identity");
15779
15939
  }
15780
- if (outsideCursorNamespace(ev)) return;
15781
- if (events.some((e) => !outsideCursorNamespace(e) && e.seq === ev.seq)) throw new Error(`spawn journal corrupted: duplicate cursor seq ${ev.seq} in tree '${root}'; the cursor order replay relies on is not unique`);
15782
- }
15940
+ };
15783
15941
  /**
15784
15942
  * The records that CLOSE a node's cursor slot: a settlement, a cancellation, or a wait being
15785
15943
  * woken. The complement question to {@link outsideCursorNamespace}, and the one a resume needs —
@@ -15939,6 +16097,7 @@ async function replaySpawnTree(journal, blobs, root) {
15939
16097
  ...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
15940
16098
  ...budgetViolationOf(ev),
15941
16099
  trace,
16100
+ ...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
15942
16101
  ...settlementTime(ev.at),
15943
16102
  seq: ev.seq
15944
16103
  });
@@ -15959,6 +16118,7 @@ async function replaySpawnTree(journal, blobs, root) {
15959
16118
  ...ev.providerModel === void 0 ? {} : { providerModel: copyProviderModelEvidence(ev.providerModel) },
15960
16119
  ...budgetViolationOf(ev),
15961
16120
  trace,
16121
+ ...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
15962
16122
  ...settlementTime(ev.at),
15963
16123
  seq: ev.seq
15964
16124
  });
@@ -20971,7 +21131,7 @@ function createScope(args) {
20971
21131
  try {
20972
21132
  await interactiveBindingCommitted;
20973
21133
  } catch {
20974
- resolution = downRecord("interactive worker binding persistence failed", true, s.trace, s.metered, s.providerModel, s.outRef);
21134
+ resolution = downRecord("interactive worker binding persistence failed", true, s.trace, s.metered, s.providerModel, s.outRef, s.harnessTranscript);
20975
21135
  }
20976
21136
  live.resolved = resolution;
20977
21137
  return resolution;
@@ -21696,12 +21856,14 @@ async function appendSettlementMetering(journal, root, id, spend, at) {
21696
21856
  /** An open node's reconciled floor has the same per-child sequence discipline as its metering:
21697
21857
  * outside the cursor namespace, monotonic per node, so a node reconciled once per process (a
21698
21858
  * retained failure, a recovery, a second retained failure) keeps its records ordered. */
21699
- async function appendReconciledFloor(journal, root, id, spent, at) {
21859
+ async function appendReconciledFloor(journal, root, id, spent, at, harnessTranscript) {
21860
+ const seq = await nextPerNodeSeq(journal, root, "reconciled", id);
21700
21861
  await appendAcknowledged(journal, root, {
21701
21862
  kind: "reconciled",
21702
21863
  id,
21703
21864
  spent,
21704
- seq: await nextPerNodeSeq(journal, root, "reconciled", id),
21865
+ ...harnessTranscript ? { harnessTranscript } : {},
21866
+ seq,
21705
21867
  at
21706
21868
  });
21707
21869
  }
@@ -21761,10 +21923,11 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
21761
21923
  ...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
21762
21924
  ...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
21763
21925
  trace: settlement.trace,
21926
+ ...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
21764
21927
  seq,
21765
21928
  at
21766
21929
  });
21767
- else if (settlement.reconciled !== void 0) await appendReconciledFloor(args.journal, args.root, child.id, settlement.reconciled, at);
21930
+ else if (settlement.reconciled !== void 0) await appendReconciledFloor(args.journal, args.root, child.id, settlement.reconciled, at, settlement.harnessTranscript);
21768
21931
  notifyRuntimeHookEvent(args.hooks, {
21769
21932
  id: `${child.id}:settled`,
21770
21933
  runId: args.root,
@@ -21792,6 +21955,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
21792
21955
  ...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
21793
21956
  ...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
21794
21957
  trace: settlement.trace,
21958
+ ...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
21795
21959
  settledAt,
21796
21960
  seq
21797
21961
  };
@@ -21811,6 +21975,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
21811
21975
  ...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
21812
21976
  ...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
21813
21977
  trace: settlement.trace,
21978
+ ...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
21814
21979
  seq,
21815
21980
  at
21816
21981
  });
@@ -21842,6 +22007,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
21842
22007
  ...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
21843
22008
  ...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
21844
22009
  trace: settlement.trace,
22010
+ ...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
21845
22011
  settledAt,
21846
22012
  seq
21847
22013
  };
@@ -21974,6 +22140,11 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
21974
22140
  traceEvidence ??= await captureWorkerTraceEvidence(live.readTraceSource, blobs, started);
21975
22141
  return traceEvidence;
21976
22142
  };
22143
+ let transcriptEvidence;
22144
+ const persistTranscriptOnce = async () => {
22145
+ transcriptEvidence ??= await persistHarnessTranscript(readHarnessTranscript(executor), blobs);
22146
+ return transcriptEvidence;
22147
+ };
21977
22148
  const teardownOnce = async (grace) => {
21978
22149
  if (teardownStarted) return;
21979
22150
  teardownStarted = true;
@@ -22060,16 +22231,17 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22060
22231
  live.executorDone = true;
22061
22232
  const ownMetered = executor.metered?.();
22062
22233
  const trace = await captureTraceOnce();
22234
+ const childHarnessTranscript = await persistTranscriptOnce();
22063
22235
  if (childAbort.signal.aborted && live.acceptedResult === void 0) {
22064
22236
  await teardownOnce(opts.shutdown ?? "brutalKill");
22065
- return downRecord("aborted before settle", true, trace, ownMetered, runtimeOwnedExecutorProviderEvidence(executor), retainedOutputRef);
22237
+ return downRecord("aborted before settle", true, trace, ownMetered, runtimeOwnedExecutorProviderEvidence(executor), retainedOutputRef, childHarnessTranscript);
22066
22238
  }
22067
22239
  const outRef = artifact.outRef;
22068
22240
  const failureReason = executorFailureReason(artifact);
22069
22241
  if (failureReason !== void 0) {
22070
22242
  await teardownOnce(opts.shutdown ?? 5e3).catch(() => void 0);
22071
22243
  return {
22072
- ...downRecord(failureReason, false, trace, ownMetered, runtimeOwnedExecutorProviderEvidence(executor)),
22244
+ ...downRecord(failureReason, false, trace, ownMetered, runtimeOwnedExecutorProviderEvidence(executor), void 0, childHarnessTranscript),
22073
22245
  outRef
22074
22246
  };
22075
22247
  }
@@ -22081,6 +22253,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22081
22253
  ...artifact.verdict ? { verdict: artifact.verdict } : {},
22082
22254
  spent: live.spent,
22083
22255
  trace,
22256
+ harnessTranscript: childHarnessTranscript,
22084
22257
  providerModel: runtimeOwnedExecutorProviderEvidence(executor),
22085
22258
  ...ownMetered ? { metered: ownMetered } : {}
22086
22259
  };
@@ -22100,7 +22273,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22100
22273
  const metered = executor.metered?.();
22101
22274
  const failureReason = executorFailureReason(accepted);
22102
22275
  if (failureReason !== void 0) return {
22103
- ...downRecord(failureReason, false, trace, metered, runtimeOwnedExecutorProviderEvidence(executor)),
22276
+ ...downRecord(failureReason, false, trace, metered, runtimeOwnedExecutorProviderEvidence(executor), void 0, await persistTranscriptOnce()),
22104
22277
  outRef: accepted.outRef
22105
22278
  };
22106
22279
  return {
@@ -22110,6 +22283,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22110
22283
  ...accepted.verdict ? { verdict: accepted.verdict } : {},
22111
22284
  spent: live.spent,
22112
22285
  trace,
22286
+ harnessTranscript: await persistTranscriptOnce(),
22113
22287
  providerModel: runtimeOwnedExecutorProviderEvidence(executor),
22114
22288
  ...metered ? { metered } : {}
22115
22289
  };
@@ -22135,7 +22309,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22135
22309
  }
22136
22310
  live.budgetViolation = void 0;
22137
22311
  return {
22138
- ...downRecord(errMessage(err), true, trace, executor.metered?.(), void 0, retainedOutputRef),
22312
+ ...downRecord(errMessage(err), true, trace, executor.metered?.(), void 0, retainedOutputRef, await persistTranscriptOnce()),
22139
22313
  reconciled: live.spent
22140
22314
  };
22141
22315
  }
@@ -22159,7 +22333,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
22159
22333
  const aborted = childAbort.signal.aborted || isAbortError(err);
22160
22334
  if (started && !terminalTelemetryCaptured && accounting === void 0) live.spent = unknownFloor(live.spent);
22161
22335
  const reconcileError = reconcileOnce(accounting?.reservation ?? live.spent);
22162
- return downRecord(errMessage(err), evidenceError !== void 0 || teardownError !== void 0 || reconcileError !== void 0 || aborted || isInfraError(err), trace, executor.metered?.(), providerModel, retainedOutputRef);
22336
+ return downRecord(errMessage(err), evidenceError !== void 0 || teardownError !== void 0 || reconcileError !== void 0 || aborted || isInfraError(err), trace, executor.metered?.(), providerModel, retainedOutputRef, await persistTranscriptOnce());
22163
22337
  } finally {
22164
22338
  await closeRetainedWrites();
22165
22339
  }
@@ -22397,17 +22571,47 @@ function unknownFloor(spend) {
22397
22571
  }])) }
22398
22572
  };
22399
22573
  }
22400
- function downRecord(reason, infra, trace, metered, providerModel, outRef) {
22574
+ function downRecord(reason, infra, trace, metered, providerModel, outRef, harnessTranscript) {
22401
22575
  return {
22402
22576
  kind: "down",
22403
22577
  reason,
22404
22578
  infra,
22405
22579
  trace,
22580
+ ...harnessTranscript ? { harnessTranscript } : {},
22406
22581
  ...providerModel ? { providerModel } : {},
22407
22582
  ...metered ? { metered } : {},
22408
22583
  ...outRef === void 0 ? {} : { outRef }
22409
22584
  };
22410
22585
  }
22586
+ /**
22587
+ * Read one executor's harness-transcript receipt without letting a broken port escape.
22588
+ *
22589
+ * The three answers this has to keep apart, because #1214 and #1244 are both about an artifact
22590
+ * that reads as coverage without being coverage:
22591
+ * - `available` the transcript survived;
22592
+ * - a reason the CAPTURE produced a box existed and could not be read;
22593
+ * - `executor-exposes-no-transcript` this runtime has no transcript to offer at all;
22594
+ * - `execution-never-started` no environment was ever created (the executor's
22595
+ * own seed, set before `create`);
22596
+ * - `capture-did-not-run` the port answered nothing, so the capture was
22597
+ * skipped rather than attempted and failed.
22598
+ *
22599
+ * Mirrors `readInteractiveSession` above: an absence is always a named reason, never `undefined`.
22600
+ */
22601
+ function readHarnessTranscript(executor) {
22602
+ if (!executor.harnessTranscript) return harnessTranscriptUnavailable("executor-exposes-no-transcript");
22603
+ let reported;
22604
+ try {
22605
+ reported = executor.harnessTranscript();
22606
+ } catch {
22607
+ return harnessTranscriptUnavailable("executor-exposes-no-transcript");
22608
+ }
22609
+ if (reported === void 0) return harnessTranscriptUnavailable("capture-did-not-run");
22610
+ const capture = reported;
22611
+ if (capture.status === "captured" && capture.artifact) return capture;
22612
+ if (capture.status === "unavailable" && capture.reason) return capture;
22613
+ return harnessTranscriptUnavailable("executor-exposes-no-transcript");
22614
+ }
22411
22615
  /** The one place an absent interactive process is spelled, so every refusal reads the same. */
22412
22616
  function noInteractiveSession(reason) {
22413
22617
  return Object.freeze({
@@ -22866,7 +23070,8 @@ function unreportedSpend(total, prior) {
22866
23070
  * ended on this loop's own `stop: 'completed'`, with the completion gate left to label the result
22867
23071
  * rather than to change it. A completed drive whose contract is unmet is now a first-class moment:
22868
23072
  * `reprompt.maxReprompts` re-enters the SAME live session with the unmet items, and every re-entry
22869
- * crosses the same budget, deadline, abort, and attempt bounds a retry crosses.
23073
+ * crosses the same budget, deadline, and abort bounds. Successful continuations do not consume
23074
+ * the failure retry allowance.
22870
23075
  */
22871
23076
  /**
22872
23077
  * The instruction a completed-but-undelivered drive is re-entered with when the caller supplies no
@@ -22983,9 +23188,14 @@ async function runDriverWithRetry(run) {
22983
23188
  const maxAttempts = Math.max(1, policy.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
22984
23189
  const initialBackoff = Math.max(0, policy.initialBackoffMs ?? DEFAULT_INITIAL_BACKOFF_MS);
22985
23190
  const maxBackoff = Math.max(initialBackoff, policy.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS);
22986
- const maxReprompts = Math.max(0, run.reprompt?.maxReprompts ?? 0);
23191
+ const maxReprompts = run.reprompt?.maxReprompts ?? 0;
23192
+ if (maxReprompts === "until-complete") {
23193
+ const deadline = run.budget().deadlineMs;
23194
+ if (!Number.isFinite(deadline) || deadline <= 0) throw new ValidationError$1("runDriverWithRetry: until-complete requires a finite positive deadline");
23195
+ }
22987
23196
  const attempts = [];
22988
23197
  let consecutiveBarren = 0;
23198
+ let failures = 0;
22989
23199
  let reprompts = 0;
22990
23200
  let reentry;
22991
23201
  const emit = async (record) => {
@@ -22998,11 +23208,10 @@ async function runDriverWithRetry(run) {
22998
23208
  * the caller's hook is consulted last, so no hook can talk the loop past a deadline.
22999
23209
  */
23000
23210
  const decideReprompt = async (attempt, after) => {
23001
- if (reprompts >= maxReprompts) return { refusedBy: "reprompts-exhausted" };
23211
+ if (maxReprompts !== "until-complete" && reprompts >= maxReprompts) return { refusedBy: "reprompts-exhausted" };
23002
23212
  if (run.signal.aborted) return { refusedBy: "aborted" };
23003
23213
  const byBudget = budgetStop(run.budget(), now());
23004
23214
  if (byBudget === "deadline" || byBudget === "budget-exhausted") return { refusedBy: byBudget };
23005
- if (attempt >= maxAttempts) return { refusedBy: "max-attempts" };
23006
23215
  const context = {
23007
23216
  attempt,
23008
23217
  reprompts,
@@ -23031,6 +23240,7 @@ async function runDriverWithRetry(run) {
23031
23240
  try {
23032
23241
  await run.drive(attempt, reentry);
23033
23242
  } catch (error) {
23243
+ failures += 1;
23034
23244
  const durationMs = now() - startedAt;
23035
23245
  const classification = classifyDriverFailure(error, run.signal);
23036
23246
  const progressed = madeProgress(before, run.progress());
@@ -23040,7 +23250,7 @@ async function runDriverWithRetry(run) {
23040
23250
  if (run.signal.aborted) return "aborted";
23041
23251
  const byBudget = budgetStop(run.budget(), now());
23042
23252
  if (byBudget) return byBudget;
23043
- if (attempt >= maxAttempts) return "max-attempts";
23253
+ if (failures >= maxAttempts) return "max-attempts";
23044
23254
  if (progressed) return void 0;
23045
23255
  return consecutiveBarren + 1 >= maxConsecutive ? "no-progress" : void 0;
23046
23256
  })();
@@ -23072,12 +23282,13 @@ async function runDriverWithRetry(run) {
23072
23282
  if (afterWait) throw new DriverAttemptsExhaustedError(error, attempts, afterWait);
23073
23283
  continue;
23074
23284
  }
23285
+ consecutiveBarren = 0;
23075
23286
  const durationMs = now() - startedAt;
23076
23287
  const after = run.progress();
23077
23288
  const progressed = madeProgress(before, after);
23078
23289
  const contract = contractOf(after);
23079
23290
  const contractField = contract === "none" ? {} : { contract };
23080
- if (contract === "unmet" && maxReprompts > 0) {
23291
+ if (contract === "unmet" && (maxReprompts === "until-complete" || maxReprompts > 0)) {
23081
23292
  const decision = await decideReprompt(attempt, after);
23082
23293
  if ("steer" in decision) {
23083
23294
  reprompts += 1;
@@ -23986,6 +24197,6 @@ function isNonEmptySpend(s) {
23986
24197
  return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
23987
24198
  }
23988
24199
  //#endregion
23989
- export { captureReusableExecutorConfig as $, flatOtelSpan as $n, runtimeOwnedExecutorMaterialization as $r, addHarnessUsage as $t, waitUntil as A, randomSuffix as Ai, RunCancellationReason as An, promptResourceProfileMaterialization as Ar, spendFromUsageTotals as At, attachWorker as B, withBudgetResources as Bi, defaultRedactorIdentityMaterial as Bn, writeAllBytes as Br, createInbox as Bt, scopeOwnerExecutorNodeContext as C, addSpend as Ci, resolveAgentEnvironmentProvider as Cn, controlProfileMaterialization as Cr, contentAddress as Ct, pollFor as D, hasCompleteCacheBreakdown as Di, sandboxSessionTraceSource as Dn, promptControlProfileMaterialization as Dr, meterUsageEvent as Dt, isWaitOutcome as E, deleteBoxSafe as Ei, decodeToolPart as En, profileMaterializationAxes$1 as Er, createBudgetPool as Et, scopeRetainedOwnerPriorSpend as F, unmeteredSpend as Fi, recoverRetainedRun as Fn, validateProfileMaterialization as Fr, workerTraceSeamKey as Ft, recoverRetainedInteractiveRun as G, armDeadlineTimer as Gi, traceContextToEnv as Gn, inheritRuntimeOwnedExecutorAttestation as Gr, createPeerMailbox as Gt, workerInteractiveBindingFile as H, abortError$2 as Hi, createPropagatingTraceEmitter as Hn, attestRuntimeOwnedScopeOwner as Hr, DEFAULT_PEER_MAIL_LIMITS as Ht, scopeRetainedOwnerResult as I, withTimeout as Ii, startRetainedRun as In, worktreeCliProfileMaterialization as Ir, taskToPrompt as It, effectiveConcurrency as J, promptOptionsFromAgentTurnInput as Ji, buildLoopSpanNodes as Jn, newExecutionAttemptId as Jr, peerMailVerbNames as Jt, startRetainedInteractiveRun as K, teardownExecutor as Ki, INTELLIGENCE_WIRE_VERSION as Kn, knownExecutionBindingReceipt as Kr, isPeerMailEnvelope as Kt, interactiveAdmissionSeamKey as L, zeroSpend as Li, startRetainedRunInEnvironment as Ln, isNoEntError as Lr, DEFAULT_STALL_AFTER_MS as Lt, consumeScopeRetainedOwnerResult as M, stringifySafe as Mi, linkAbort as Mn, renderUnsupported as Mr, readWorkerTraceContext as Mt, prepareScopeRetainedOwnerTask as N, throwAbort as Ni, runAbortable as Nn, sandboxActProfileMaterialization as Nr, workerTraceEnv as Nt, timerAt as O, isAbortError$2 as Oi, registerRetainedExecutorPreparation as On, promptModelProfileMaterialization as Or, newUsageTotals as Ot, scopeRetainedOwnerContext as P, throwIfAborted as Pi, reconnectRetainedRun as Pn, unsupportedProfileDimensions as Pr, workerTraceHeaders as Pt, bindReusableExecutorExecutionId as Q, exportEvalRuns as Qn, runtimeOwnedExecutorExecutionBinding as Qr, bridgeModelRouteRefusal as Qt, readWorkerInteractiveAdmissions as R, addResourceSpend as Ri, retainedCreateMaterial as Rn, parseCommittedJsonLines as Rr, createActivityLog as Rt, restoreScopeOwnerAcceptedExecution as S, sumSandboxUsage as Si, providerAsSandboxClient as Sn, assertProfileMaterialization as Sr, workerTraceAnalysisStore as St, createWaitProbes as T, cloneSpend as Ti, createPushTraceSource as Tn, fullProfileMaterialization as Tr, assertValidBudget as Tt, workerInteractiveBindingsDir as U, awaitAbortable$1 as Ui, mergeTraceEnv as Un, authoredProfileDigest as Ur, PEER_MAIL_WIRE_KEY as Ut, readWorkerInteractiveBinding as V, decodeHarnessUsage as Vi, resolveRedactor as Vn, attestRuntimeOwnedPendingExecutor as Vr, AUTHORITY_MARKERS as Vt, reconnectRetainedInteractiveRun as W, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Wi, readTraceContextFromEnv as Wn, finalizeRuntimeOwnedPendingExecutor as Wr, claimsAuthority as Wt, queueOf as X, createOpenInferenceFileExporter as Xn, recordRuntimeOwnedDriveHarnessProviderEvidence as Xr, isTerminalNodeStatus as Xt, freeSlots as Y, providerMessageText as Yi, buildRuntimeEventOtelSpans as Yn, providerAttemptEvidence as Yr, isLiveNodeStatus as Yt, rollingDispatch as Z, createOtelExporter as Zn, runtimeOwnedDriveHarnessProviderEvidence as Zr, bridgeAdmissionRefusal as Zt, createScope as _, mapSandboxEvent as _i, canonicalObservedModelParts as _n, harnessSupportsReasoningEffort as _r, replaySpawnTree as _t, pickBestDelivered as a, executableAgentProfileSnapshot as ai, TERMINAL_DECISIONS as an, createRuntimeEventCollector as ar, createWorktreeCliExecutor as at, meterRuntimeOwnedProviderAttempt as b, sandboxEventServedBackend as bi, createAgentEnvironmentProviderRegistry as bn, CodexExecutionDiagnosticError as br, isTraceAnalysisStore as bt, DriverAttemptsExhaustedError as c, detachedSnapshot as ci, isTerminalDecision as cn, sanitizeKnowledgeReadinessReport as cr, createInPlaceCliExecutor as ct, runDriverWithRetry as d, assertSandboxServedModel as di, probeSandboxCapabilities as dn, runWorktreeHarness as dr, InMemoryResultBlobStore as dt, runtimeOwnedExecutorProviderEvidence as ei, createCodexRolloutStoreReader as en, generateSpanId as er, cliInPlaceExecutor as et, driverChild as f, canonicalStreamEventFromSandboxEvent as fi, acquireSandbox as fn, captureWorktreeDiff as fr, InMemorySpawnJournal as ft, beginScopeOwnerAttempt as g, isSandboxTerminalEvent as gi, runBrainLoop as gn, LOCAL_HARNESSES as gr, pendingWaits as gt, withDriverExecutor as h, extractLlmCallEvent as hi, routerBrain as hn, DEFAULT_LOCAL_HARNESS as hr, materializeTreeView as ht, collectDelivered as i, unknownMaterializationReceipt as ii, bridgeStopSignalKey as in, toOtelAttributes as ir, snapshotExecutorConfig as it, bindScopeRetainedOwnerProvider as j, sleep as ji, abortError as jn, renderProfileMaterializationIssues as jr, WORKER_TRACE_PROPAGATION as jt, validateWaitSpec as k, promptCacheTokenClasses as ki, retainedExecutorSeamKey as kn, promptOnlyProfileMaterialization as kr, spendFromUsageEvents as kt, classifyDriverFailure as l, projectSandboxOutcome as li, runAgentRounds as ln, sanitizeRuntimeStreamEvent as lr, FileResultBlobStore as lt, isDriverSpec as m, createSandboxUsageLedger as mi, readPromptOptions as mn, removeWorktree as mr, loadSpawnForest as mt, createSupervisor as n, runtimeOwnedScopeOwnerRuntime as ni, readCodexRolloutSession as nn, padSpanId as nr, createExecutor as nt, runFinalizer as o, executableAgentSpecSnapshot as oi, createSandboxForSpec as on, createRuntimeStreamEventCollector as or, DEFAULT_SANDBOX_STEERING_MAX_TURNS as ot, driverExecutorFactory as p, createSandboxToolPartState as pi, assertBoxlessPromptOptions as pn, createWorktree as pr, insideCursorNamespace as pt, destroyInteractiveEnvironment as q, promptFromAgentTurnInput as qi, buildLoopOtelSpans as qn, knownMaterializationReceipt as qr, peerMailTools as qt, bestDelivered as r, unknownExecutionBindingReceipt as ri, bridgeRuntimeAttachmentsKey as rn, padTraceId as rr, createExecutorRegistry as rt, runTree as s, detachedFrozen as si, defaultSelectWinner as sn, sanitizeAgentRuntimeEvent as sr, createSteerableSandboxSession as st, createRootHandle as t, runtimeOwnedPendingExecutorMaterialization as ti, harnessUsageIsEmpty as tn, loopEventToOtelSpan as tr, cliWorktreeExecutor as tt, defaultUnmetContractSteer as u, readSandboxOutcome as ui, createSandboxLineage as un, runSettledCommand as ur, FileSpawnJournal as ut, deriveNodeExecutionIdentity as v, mapSandboxToolEvent as vi, observedModelMatchesDeclared as vn, localHarnessExecutable as vr, WORKER_TOOL_TRACE_SCHEMA_VERSION as vt, settledToIteration as w, chargedTokens as wi, sandboxClientAsProvider as wn, defineProfileMaterializationContract as wr, BudgetReconcileFault as wt, recordScopeOwnerMaterialization as x, sandboxProgressEvents as xi, providerAsExecutor as xn, AGENT_PROFILE_MATERIALIZATION_AXES as xr, parseWorkerToolTraceArtifact as xt, meterRuntimeOwnedAccounting as y, notifySandboxEventObserver as yi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as yn, parseCodexTokenUsage as yr, captureWorkerTraceEvidence as yt, workerInteractiveAdmissionFile as z, resourceTelemetry as zi, defaultRedactor as zn, prepareJsonlAppend as zr, readWorkerProgress as zt };
24200
+ export { bindReusableExecutorExecutionId as $, providerMessageText as $i, buildRuntimeEventOtelSpans as $n, providerAttemptEvidence as $r, addHarnessUsage as $t, waitUntil as A, deleteBoxSafe as Ai, RunCancellationReason as An, profileMaterializationAxes$1 as Ar, spendFromUsageTotals as At, attachWorker as B, withTimeout as Bi, defaultRedactorIdentityMaterial as Bn, worktreeCliProfileMaterialization as Br, createInbox as Bt, scopeOwnerExecutorNodeContext as C, notifySandboxEventObserver as Ci, resolveAgentEnvironmentProvider as Cn, parseCodexTokenUsage as Cr, workerTraceAnalysisStore as Ct, pollFor as D, addSpend as Di, sandboxSessionTraceSource as Dn, controlProfileMaterialization as Dr, meterUsageEvent as Dt, isWaitOutcome as E, sumSandboxUsage as Ei, decodeToolPart as En, assertProfileMaterialization as Er, createBudgetPool as Et, scopeRetainedOwnerPriorSpend as F, sleep as Fi, recoverRetainedRun as Fn, renderProfileMaterializationIssues as Fr, workerTraceSeamKey as Ft, recoverRetainedInteractiveRun as G, decodeHarnessUsage as Gi, contentAddress as Gn, attestRuntimeOwnedPendingExecutor as Gr, createPeerMailbox as Gt, workerInteractiveBindingFile as H, addResourceSpend as Hi, captureHarnessTranscript as Hn, parseCommittedJsonLines as Hr, DEFAULT_PEER_MAIL_LIMITS as Ht, scopeRetainedOwnerResult as I, stringifySafe as Ii, startRetainedRun as In, renderUnsupported as Ir, taskToPrompt as It, errMessage as J, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ji, readTraceContextFromEnv as Jn, finalizeRuntimeOwnedPendingExecutor as Jr, peerMailVerbNames as Jt, startRetainedInteractiveRun as K, abortError$2 as Ki, createPropagatingTraceEmitter as Kn, attestRuntimeOwnedScopeOwner as Kr, isPeerMailEnvelope as Kt, interactiveAdmissionSeamKey as L, throwAbort as Li, startRetainedRunInEnvironment as Ln, sandboxActProfileMaterialization as Lr, DEFAULT_STALL_AFTER_MS as Lt, consumeScopeRetainedOwnerResult as M, isAbortError$2 as Mi, linkAbort as Mn, promptModelProfileMaterialization as Mr, readWorkerTraceContext as Mt, prepareScopeRetainedOwnerTask as N, promptCacheTokenClasses as Ni, runAbortable as Nn, promptOnlyProfileMaterialization as Nr, workerTraceEnv as Nt, timerAt as O, chargedTokens as Oi, registerRetainedExecutorPreparation as On, defineProfileMaterializationContract as Or, newUsageTotals as Ot, scopeRetainedOwnerContext as P, randomSuffix as Pi, reconnectRetainedRun as Pn, promptResourceProfileMaterialization as Pr, workerTraceHeaders as Pt, rollingDispatch as Q, promptOptionsFromAgentTurnInput as Qi, buildLoopSpanNodes as Qn, newExecutionAttemptId as Qr, bridgeModelRouteRefusal as Qt, readWorkerInteractiveAdmissions as R, throwIfAborted as Ri, retainedCreateMaterial as Rn, unsupportedProfileDimensions as Rr, createActivityLog as Rt, restoreScopeOwnerAcceptedExecution as S, mapSandboxToolEvent as Si, providerAsSandboxClient as Sn, localHarnessExecutable as Sr, parseWorkerToolTraceArtifact as St, createWaitProbes as T, sandboxProgressEvents as Ti, createPushTraceSource as Tn, AGENT_PROFILE_MATERIALIZATION_AXES as Tr, assertValidBudget as Tt, workerInteractiveBindingsDir as U, resourceTelemetry as Ui, harnessTranscriptArtifact as Un, prepareJsonlAppend as Ur, PEER_MAIL_WIRE_KEY as Ut, readWorkerInteractiveBinding as V, zeroSpend as Vi, resolveRedactor as Vn, isNoEntError as Vr, AUTHORITY_MARKERS as Vt, reconnectRetainedInteractiveRun as W, withBudgetResources as Wi, persistHarnessTranscript as Wn, writeAllBytes as Wr, claimsAuthority as Wt, freeSlots as X, teardownExecutor as Xi, INTELLIGENCE_WIRE_VERSION as Xn, knownExecutionBindingReceipt as Xr, isTerminalNodeStatus as Xt, effectiveConcurrency as Y, armDeadlineTimer as Yi, traceContextToEnv as Yn, inheritRuntimeOwnedExecutorAttestation as Yr, isLiveNodeStatus as Yt, queueOf as Z, promptFromAgentTurnInput as Zi, buildLoopOtelSpans as Zn, knownMaterializationReceipt as Zr, bridgeAdmissionRefusal as Zt, createScope as _, createSandboxToolPartState as _i, canonicalObservedModelParts as _n, createWorktree as _r, pendingWaits as _t, pickBestDelivered as a, runtimeOwnedPendingExecutorMaterialization as ai, TERMINAL_DECISIONS as an, loopEventToOtelSpan as ar, snapshotExecutorConfig as at, meterRuntimeOwnedProviderAttempt as b, isSandboxTerminalEvent as bi, createAgentEnvironmentProviderRegistry as bn, LOCAL_HARNESSES as br, captureWorkerTraceEvidence as bt, DriverAttemptsExhaustedError as c, unknownMaterializationReceipt as ci, isTerminalDecision as cn, toOtelAttributes as cr, createSteerableSandboxSession as ct, runDriverWithRetry as d, detachedFrozen as di, probeSandboxCapabilities as dn, sanitizeAgentRuntimeEvent as dr, FileSpawnJournal as dt, recordRuntimeOwnedDriveHarnessProviderEvidence as ei, createCodexRolloutStoreReader as en, createOpenInferenceFileExporter as er, captureReusableExecutorConfig as et, driverChild as f, detachedSnapshot as fi, acquireSandbox as fn, sanitizeKnowledgeReadinessReport as fr, InMemoryResultBlobStore as ft, beginScopeOwnerAttempt as g, canonicalStreamEventFromSandboxEvent as gi, runBrainLoop as gn, captureWorktreeDiff as gr, materializeTreeView as gt, withDriverExecutor as h, assertSandboxServedModel as hi, routerBrain as hn, runWorktreeHarness as hr, loadSpawnForest as ht, collectDelivered as i, runtimeOwnedExecutorProviderEvidence as ii, bridgeStopSignalKey as in, generateSpanId as ir, createExecutorRegistry as it, bindScopeRetainedOwnerProvider as j, hasCompleteCacheBreakdown as ji, abortError as jn, promptControlProfileMaterialization as jr, WORKER_TRACE_PROPAGATION as jt, validateWaitSpec as k, cloneSpend as ki, retainedExecutorSeamKey as kn, fullProfileMaterialization as kr, spendFromUsageEvents as kt, classifyDriverFailure as l, executableAgentProfileSnapshot as li, runAgentRounds as ln, createRuntimeEventCollector as lr, createInPlaceCliExecutor as lt, isDriverSpec as m, readSandboxOutcome as mi, readPromptOptions as mn, runSettledCommand as mr, insideCursorNamespace as mt, createSupervisor as n, runtimeOwnedExecutorExecutionBinding as ni, readCodexRolloutSession as nn, exportEvalRuns as nr, cliWorktreeExecutor as nt, runFinalizer as o, runtimeOwnedScopeOwnerRuntime as oi, createSandboxForSpec as on, padSpanId as or, createWorktreeCliExecutor as ot, driverExecutorFactory as p, projectSandboxOutcome as pi, assertBoxlessPromptOptions as pn, sanitizeRuntimeStreamEvent as pr, InMemorySpawnJournal as pt, destroyInteractiveEnvironment as q, awaitAbortable$1 as qi, mergeTraceEnv as qn, authoredProfileDigest as qr, peerMailTools as qt, bestDelivered as r, runtimeOwnedExecutorMaterialization as ri, bridgeRuntimeAttachmentsKey as rn, flatOtelSpan as rr, createExecutor as rt, runTree as s, unknownExecutionBindingReceipt as si, defaultSelectWinner as sn, padTraceId as sr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as st, createRootHandle as t, runtimeOwnedDriveHarnessProviderEvidence as ti, harnessUsageIsEmpty as tn, createOtelExporter as tr, cliInPlaceExecutor as tt, defaultUnmetContractSteer as u, executableAgentSpecSnapshot as ui, createSandboxLineage as un, createRuntimeStreamEventCollector as ur, FileResultBlobStore as ut, deriveNodeExecutionIdentity as v, createSandboxUsageLedger as vi, observedModelMatchesDeclared as vn, removeWorktree as vr, replaySpawnTree as vt, settledToIteration as w, sandboxEventServedBackend as wi, sandboxClientAsProvider as wn, CodexExecutionDiagnosticError as wr, BudgetReconcileFault as wt, recordScopeOwnerMaterialization as x, mapSandboxEvent as xi, providerAsExecutor as xn, harnessSupportsReasoningEffort as xr, isTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, extractLlmCallEvent as yi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as yn, DEFAULT_LOCAL_HARNESS as yr, WORKER_TOOL_TRACE_SCHEMA_VERSION as yt, workerInteractiveAdmissionFile as z, unmeteredSpend as zi, defaultRedactor as zn, validateProfileMaterialization as zr, readWorkerProgress as zt };
23990
24201
 
23991
- //# sourceMappingURL=supervisor-DFsXULnE.js.map
24202
+ //# sourceMappingURL=supervisor-BVAM5glY.js.map