@tangle-network/agent-runtime 0.225.0 → 0.225.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{activation-CKlpXoDU.js → activation-C7i-w3kS.js} +2 -2
  2. package/dist/{activation-CKlpXoDU.js.map → activation-C7i-w3kS.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{coordination-driver-GFI-HzJX.js → coordination-driver-DcwOMS5C.js} +2 -2
  6. package/dist/{coordination-driver-GFI-HzJX.js.map → coordination-driver-DcwOMS5C.js.map} +1 -1
  7. package/dist/{delegate-DiH4-45Z.js → delegate-C9B_prgp.js} +2 -2
  8. package/dist/{delegate-DiH4-45Z.js.map → delegate-C9B_prgp.js.map} +1 -1
  9. package/dist/durable.d.ts +1 -1
  10. package/dist/durable.js +2 -2
  11. package/dist/{graph-CiGsa580.js → graph-B_6SZzlE.js} +4 -4
  12. package/dist/{graph-CiGsa580.js.map → graph-B_6SZzlE.js.map} +1 -1
  13. package/dist/{improvement-cycle-BFdb4lCd.js → improvement-cycle-DmuqSX6_.js} +4 -4
  14. package/dist/{improvement-cycle-BFdb4lCd.js.map → improvement-cycle-DmuqSX6_.js.map} +1 -1
  15. package/dist/{index-C2T1Z3jZ.d.ts → index-ClXIBpKe.d.ts} +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +8 -8
  18. package/dist/intelligence.js +3 -3
  19. package/dist/kernel.d.ts +1 -1
  20. package/dist/kernel.js +9 -9
  21. package/dist/{loop-runner-bin-BMCpT2i0.d.ts → loop-runner-bin-BRfsk-9d.d.ts} +2 -2
  22. package/dist/{loop-runner-bin-3ERWSHxx.js → loop-runner-bin-Jxq-BUGo.js} +3 -3
  23. package/dist/{loop-runner-bin-3ERWSHxx.js.map → loop-runner-bin-Jxq-BUGo.js.map} +1 -1
  24. package/dist/loop-runner-bin.d.ts +1 -1
  25. package/dist/loop-runner-bin.js +1 -1
  26. package/dist/mcp/bin.js +3 -3
  27. package/dist/mcp/index.d.ts +1 -1
  28. package/dist/mcp/index.js +5 -5
  29. package/dist/{model-policy-DKDyr-fc.js → model-policy-BbSCSak0.js} +4 -4
  30. package/dist/model-policy-BbSCSak0.js.map +1 -0
  31. package/dist/profiles.js +1 -1
  32. package/dist/{provision-supervisor-DD9Xc1as.js → provision-supervisor-ChEnL5xX.js} +8 -35
  33. package/dist/provision-supervisor-ChEnL5xX.js.map +1 -0
  34. package/dist/{runtime-CL6nVSEt.js → runtime-BVV9PbmE.js} +24 -24
  35. package/dist/runtime-BVV9PbmE.js.map +1 -0
  36. package/dist/{server-BWDo2UNM.js → server-Cf0_J9nZ.js} +3 -3
  37. package/dist/{server-BWDo2UNM.js.map → server-Cf0_J9nZ.js.map} +1 -1
  38. package/dist/{structural-rollout-Bs6IfZ8d.js → structural-rollout-C_tpSY6Y.js} +6 -7
  39. package/dist/structural-rollout-C_tpSY6Y.js.map +1 -0
  40. package/dist/{supervise-DYZVP44H.js → supervise-Ah7kMn2p.js} +9 -15
  41. package/dist/supervise-Ah7kMn2p.js.map +1 -0
  42. package/dist/{supervisor-DBzsb6Qt.js → supervisor-0ksHf44Z.js} +230 -172
  43. package/dist/supervisor-0ksHf44Z.js.map +1 -0
  44. package/dist/testing.d.ts +1 -1
  45. package/dist/testing.js +12 -12
  46. package/dist/tui/index.d.ts +1 -1
  47. package/dist/tui/index.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/model-policy-DKDyr-fc.js.map +0 -1
  50. package/dist/provision-supervisor-DD9Xc1as.js.map +0 -1
  51. package/dist/runtime-CL6nVSEt.js.map +0 -1
  52. package/dist/structural-rollout-Bs6IfZ8d.js.map +0 -1
  53. package/dist/supervise-DYZVP44H.js.map +0 -1
  54. package/dist/supervisor-DBzsb6Qt.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  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";
2
- import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-DKDyr-fc.js";
2
+ import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, l as profileProviderModel, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-BbSCSak0.js";
3
3
  import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
4
4
  import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-D24y9zg7.js";
5
5
  import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, AgentTurnResultSchema, CanonicalStreamEventSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, WorkspaceRequestSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, exactAgentInteractiveSessionStart, harnessSystemPromptIntents, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema, workspaceCwdPathForBase } from "@tangle-network/agent-interface";
@@ -94,6 +94,72 @@ function promptPartFromInputPart(part) {
94
94
  };
95
95
  }
96
96
  //#endregion
97
+ //#region src/runtime/supervise/deadline.ts
98
+ const MAX_TIMER_DELAY_MS = 2147483647;
99
+ const DEFAULT_SUCCESSFUL_SHUTDOWN_MS = 5e3;
100
+ const TEARDOWN_ACKNOWLEDGEMENT_MS = 250;
101
+ /** Arm a finite wall-clock deadline in safe chunks. Resource deadlines unref by default;
102
+ * a standalone wait opts into keeping the process alive until it settles or is cancelled. */
103
+ function armDeadlineTimer(delayMs, onDeadline, keepAlive = false) {
104
+ const deadlineAtMs = Date.now() + Math.max(0, delayMs);
105
+ if (!Number.isFinite(delayMs) || !Number.isSafeInteger(Math.ceil(deadlineAtMs))) throw new ValidationError$1("timer delay must produce a finite safe deadline");
106
+ let cleared = false;
107
+ let timer;
108
+ const arm = () => {
109
+ if (cleared) return;
110
+ const remainingMs = Math.max(0, deadlineAtMs - Date.now());
111
+ timer = setTimeout(() => {
112
+ if (cleared) return;
113
+ if (Date.now() >= deadlineAtMs) onDeadline();
114
+ else arm();
115
+ }, Math.min(remainingMs, MAX_TIMER_DELAY_MS));
116
+ if (!keepAlive && typeof timer.unref === "function") timer.unref();
117
+ };
118
+ arm();
119
+ return () => {
120
+ cleared = true;
121
+ if (timer !== void 0) clearTimeout(timer);
122
+ };
123
+ }
124
+ /**
125
+ * Resolve a spawned child's duration into one absolute cutoff. An omitted child deadline inherits
126
+ * the parent cutoff; an explicit child duration may shorten, but never extend, that cutoff.
127
+ */
128
+ function boundedChildDeadlineAt(parentDeadlineAtMs, childDeadlineMs, nowMs) {
129
+ const parent = parentDeadlineAtMs > 0 ? parentDeadlineAtMs : void 0;
130
+ const child = childDeadlineMs === void 0 ? void 0 : nowMs + childDeadlineMs;
131
+ if (parent === void 0) return child;
132
+ if (child === void 0) return parent;
133
+ return Math.min(parent, child);
134
+ }
135
+ /** Invoke teardown once and bound how long the runtime waits for its acknowledgement. A hard
136
+ * execution deadline always wins; without one, numeric grace gets a short acknowledgement
137
+ * allowance and a brutal kill gets only that allowance. Explicit `infinity` remains unbounded
138
+ * only when no execution deadline exists. The losing promise stays observed. */
139
+ async function teardownExecutor(executor, grace, deadlineAtMs, now) {
140
+ const work = Promise.resolve(executor.teardown(grace));
141
+ const requestedWaitMs = grace === "infinity" ? void 0 : grace === "brutalKill" ? executor.teardownTimeoutMs ?? TEARDOWN_ACKNOWLEDGEMENT_MS : grace + TEARDOWN_ACKNOWLEDGEMENT_MS;
142
+ const deadlineWaitMs = deadlineAtMs === void 0 ? void 0 : Math.max(0, deadlineAtMs - now()) + TEARDOWN_ACKNOWLEDGEMENT_MS;
143
+ const waitMs = requestedWaitMs === void 0 ? deadlineWaitMs : deadlineWaitMs === void 0 ? requestedWaitMs : Math.min(requestedWaitMs, deadlineWaitMs);
144
+ let receipt;
145
+ if (waitMs === void 0) receipt = await work;
146
+ else if (waitMs <= 0) {
147
+ work.catch(() => void 0);
148
+ throw new ValidationError$1("executor teardown did not acknowledge before its deadline");
149
+ } else {
150
+ let clearTimer;
151
+ const timedOut = new Promise((_resolve, reject) => {
152
+ clearTimer = armDeadlineTimer(waitMs, () => reject(new ValidationError$1(`executor teardown did not acknowledge within ${waitMs}ms`)), true);
153
+ });
154
+ try {
155
+ receipt = await Promise.race([work, timedOut]);
156
+ } finally {
157
+ clearTimer?.();
158
+ }
159
+ }
160
+ if (!receipt.destroyed) throw new ValidationError$1(`executor teardown reported destroyed=false${receipt.detail ? `: ${receipt.detail}` : ""}`);
161
+ }
162
+ //#endregion
97
163
  //#region src/runtime/retained-run-binding.ts
98
164
  function exactSession(environment, controlRef) {
99
165
  if (environment.id !== controlRef.environmentId || environment.provider !== controlRef.provider) throw new Error("provider reconstructed a different retained environment");
@@ -296,13 +362,13 @@ function isTerminalSessionStatus(status) {
296
362
  function delay(ms, signal) {
297
363
  if (signal?.aborted) return Promise.reject(abortError$2(signal.reason));
298
364
  return new Promise((resolveDelay, rejectDelay) => {
299
- const timer = setTimeout(finish, ms);
365
+ const clearTimer = armDeadlineTimer(ms, finish, true);
300
366
  function finish() {
301
367
  signal?.removeEventListener("abort", onAbort);
302
368
  resolveDelay();
303
369
  }
304
370
  function onAbort() {
305
- clearTimeout(timer);
371
+ clearTimer();
306
372
  signal?.removeEventListener("abort", onAbort);
307
373
  rejectDelay(abortError$2(signal?.reason));
308
374
  }
@@ -638,24 +704,16 @@ function isAbortError$2(err) {
638
704
  * keeps the event loop alive. Resolves (does not reject) on abort — callers
639
705
  * re-check the signal explicitly after the sleep.
640
706
  */
641
- function sleep(ms, signal) {
707
+ function sleep(ms, signal, keepAlive = true) {
708
+ if (signal?.aborted) return Promise.resolve();
642
709
  return new Promise((resolve) => {
643
- if (signal?.aborted) {
644
- resolve();
645
- return;
646
- }
647
- let onAbort;
648
- const timer = setTimeout(() => {
649
- if (onAbort && signal) signal.removeEventListener("abort", onAbort);
710
+ const done = () => {
711
+ clearTimer();
712
+ signal?.removeEventListener("abort", done);
650
713
  resolve();
651
- }, ms);
652
- if (signal) {
653
- onAbort = () => {
654
- clearTimeout(timer);
655
- resolve();
656
- };
657
- signal.addEventListener("abort", onAbort, { once: true });
658
- }
714
+ };
715
+ const clearTimer = armDeadlineTimer(ms, done, keepAlive);
716
+ signal?.addEventListener("abort", done, { once: true });
659
717
  });
660
718
  }
661
719
  /**
@@ -664,12 +722,12 @@ function sleep(ms, signal) {
664
722
  */
665
723
  function withTimeout(promise, ms) {
666
724
  return new Promise((resolve) => {
667
- const timer = setTimeout(() => resolve(void 0), ms);
725
+ const clearTimer = armDeadlineTimer(ms, () => resolve(void 0), true);
668
726
  promise.then((value) => {
669
- clearTimeout(timer);
727
+ clearTimer();
670
728
  resolve(value);
671
729
  }, () => {
672
- clearTimeout(timer);
730
+ clearTimer();
673
731
  resolve(void 0);
674
732
  });
675
733
  });
@@ -1254,10 +1312,14 @@ function createSandboxUsageLedger(harness) {
1254
1312
  }
1255
1313
  };
1256
1314
  }
1315
+ /** Shared receipt semantics; an undeclared nonterminal observation is not a cumulative total. */
1316
+ function canonicalSandboxUsageMode(event) {
1317
+ const declaredMode = plainRecord$1(event.data)?.usageMode;
1318
+ return declaredMode === "delta" || declaredMode === "cumulative" ? declaredMode : declaredMode === void 0 && event.type === "llm_call" ? "delta" : declaredMode === void 0 && (event.type === "error" || isSandboxTerminalEvent(String(event.type))) ? "cumulative" : void 0;
1319
+ }
1257
1320
  /** Terminal totals replace already credited usage; only per-call receipts add to it. */
1258
1321
  function creditCanonicalUsage(event, call, credited, receipts, onCredit) {
1259
- const declaredMode = plainRecord$1(event.data)?.usageMode;
1260
- const mode = declaredMode === "delta" || declaredMode === "cumulative" ? declaredMode : declaredMode === void 0 && event.type === "llm_call" ? "delta" : declaredMode === void 0 && (event.type === "error" || isSandboxTerminalEvent(String(event.type))) ? "cumulative" : void 0;
1322
+ const mode = canonicalSandboxUsageMode(event);
1261
1323
  const result = { ...call };
1262
1324
  const data = plainRecord$1(event.data) ?? {};
1263
1325
  const explicitTokensUnknown = [
@@ -2330,26 +2392,60 @@ async function writeAllBytes(handle, value) {
2330
2392
  offset += bytesWritten;
2331
2393
  }
2332
2394
  }
2333
- /** Prepare a recovered JSONL file for its next append. A valid unterminated final value is retained
2334
- * and needs a separator; an invalid unterminated tail was never committed and is truncated. */
2395
+ /** Prepare the tail under the journal owner's existing single-writer discipline.
2396
+ * Healthy appends read one byte, regardless of history size. Only recovery scans backward,
2397
+ * retaining a valid unterminated value or truncating an uncommitted torn tail. */
2335
2398
  async function prepareJsonlAppend(path) {
2336
2399
  const fs = await import("node:fs/promises");
2337
- let bytes;
2400
+ let handle;
2338
2401
  try {
2339
- bytes = await fs.readFile(path);
2402
+ handle = await fs.open(path, "r+");
2340
2403
  } catch (error) {
2341
2404
  if (isNoEntError(error)) return false;
2342
2405
  throw error;
2343
2406
  }
2344
- if (bytes.byteLength === 0 || bytes[bytes.byteLength - 1] === 10) return false;
2345
- const lastNewline = bytes.lastIndexOf(10);
2346
- const tail = bytes.subarray(lastNewline + 1).toString("utf8");
2347
2407
  try {
2348
- JSON.parse(tail);
2349
- return true;
2350
- } catch {
2351
- await fs.truncate(path, lastNewline + 1);
2352
- return false;
2408
+ const size = (await handle.stat()).size;
2409
+ if (size === 0) return false;
2410
+ const lastByte = Buffer.allocUnsafe(1);
2411
+ await readAt(handle, lastByte, size - 1);
2412
+ if (lastByte[0] === 10) return false;
2413
+ const chunks = [];
2414
+ let end = size;
2415
+ let tailStart = 0;
2416
+ while (end > 0) {
2417
+ const start = Math.max(0, end - 65536);
2418
+ const chunk = Buffer.allocUnsafe(end - start);
2419
+ await readAt(handle, chunk, start);
2420
+ const newline = chunk.lastIndexOf(10);
2421
+ chunks.push(chunk.subarray(newline + 1));
2422
+ if (newline >= 0) {
2423
+ tailStart = start + newline + 1;
2424
+ break;
2425
+ }
2426
+ end = start;
2427
+ }
2428
+ const tail = Buffer.concat(chunks.reverse()).toString("utf8");
2429
+ try {
2430
+ JSON.parse(tail);
2431
+ return true;
2432
+ } catch (error) {
2433
+ if (!(error instanceof SyntaxError)) throw error;
2434
+ await handle.truncate(tailStart);
2435
+ await handle.sync();
2436
+ return false;
2437
+ }
2438
+ } finally {
2439
+ await handle.close();
2440
+ }
2441
+ }
2442
+ /** A short read is legal; an unexpected EOF means the owner's snapshot changed. */
2443
+ async function readAt(handle, buffer, position) {
2444
+ let offset = 0;
2445
+ while (offset < buffer.length) {
2446
+ const { bytesRead } = await handle.read(buffer, offset, buffer.length - offset, position + offset);
2447
+ if (bytesRead === 0) throw new Error("journal changed while preparing its append tail");
2448
+ offset += bytesRead;
2353
2449
  }
2354
2450
  }
2355
2451
  /** True for a filesystem error meaning "the file is not there yet" — the one condition an
@@ -7502,6 +7598,12 @@ async function* streamProviderExecutor(args) {
7502
7598
  const usageLedger = createSandboxUsageLedger(args.profile.harness);
7503
7599
  let sawCompleteTokenReceipt = false;
7504
7600
  let sawIncompleteTokenReceipt = false;
7601
+ let sawCostReceipt = false;
7602
+ let sawUnknownCostReceipt = false;
7603
+ let sawCostEstimate = false;
7604
+ let pendingUnpricedWork = false;
7605
+ let pendingEstimate;
7606
+ let usdEstimated = 0;
7505
7607
  let usd = 0;
7506
7608
  let text = "";
7507
7609
  let terminal = false;
@@ -7535,11 +7637,27 @@ async function* streamProviderExecutor(args) {
7535
7637
  progress
7536
7638
  };
7537
7639
  const usageEvent = usageSandboxEvent(event);
7538
- if (usageEvent) yield* creditUsage(usageLedger.observe(usageEvent, args.profile.name ?? "agent"));
7539
- yield* creditUsage(usageLedger.observe(sandboxEvent, args.profile.name ?? "agent"));
7640
+ if (usageEvent) yield* creditUsage(usageLedger.observe(usageEvent, args.profile.name ?? "agent"), usageEvent);
7641
+ yield* creditUsage(usageLedger.observe(sandboxEvent, args.profile.name ?? "agent"), sandboxEvent);
7540
7642
  if (isTerminalEnvironmentEvent(event)) terminal = true;
7541
7643
  }
7542
7644
  yield* creditUsage(usageLedger.settleTurn(args.profile.name ?? "agent"));
7645
+ if (pendingUnpricedWork) {
7646
+ const estimate = pendingEstimate ?? 0;
7647
+ sawUnknownCostReceipt = true;
7648
+ usd += estimate;
7649
+ if (pendingEstimate !== void 0) {
7650
+ sawCostEstimate = true;
7651
+ usdEstimated += estimate;
7652
+ }
7653
+ yield {
7654
+ kind: "cost",
7655
+ usd: estimate,
7656
+ usdKnown: false,
7657
+ ...pendingEstimate === void 0 ? {} : { usdEstimated: estimate },
7658
+ provenance: pendingEstimate === void 0 ? "uncaptured" : "catalog-estimate"
7659
+ };
7660
+ }
7543
7661
  if ((args.options.requireTerminalEvent ?? true) && !terminal) throw new ValidationError(`providerAsExecutor(${args.provider.name}): stream ended without a terminal result/done/status event`);
7544
7662
  yield { kind: "iteration" };
7545
7663
  const result = {
@@ -7552,8 +7670,8 @@ async function* streamProviderExecutor(args) {
7552
7670
  tokens,
7553
7671
  ...sawCompleteTokenReceipt && !sawIncompleteTokenReceipt ? {} : { tokensKnown: false },
7554
7672
  usd,
7555
- usdKnown: false,
7556
- ...usd > 0 ? { usdEstimated: usd } : {},
7673
+ usdKnown: sawCostReceipt && !sawUnknownCostReceipt,
7674
+ ...sawCostEstimate ? { usdEstimated } : {},
7557
7675
  ms: Date.now() - started
7558
7676
  };
7559
7677
  const verdict = await args.options.validator?.validate(result, {
@@ -7597,7 +7715,7 @@ async function* streamProviderExecutor(args) {
7597
7715
  }
7598
7716
  }
7599
7717
  if (failed) throw failure;
7600
- function* creditUsage(receipt) {
7718
+ function* creditUsage(receipt, event) {
7601
7719
  if (receipt === void 0) return;
7602
7720
  const hasTokens = receipt.tokensIn !== void 0 || receipt.tokensOut !== void 0;
7603
7721
  if (hasTokens && receipt.tokensIn !== void 0 && receipt.tokensOut !== void 0 && receipt.tokensKnown !== false) sawCompleteTokenReceipt = true;
@@ -7613,16 +7731,37 @@ async function* streamProviderExecutor(args) {
7613
7731
  ...receipt.tokensKnown === false ? { tokensKnown: false } : {}
7614
7732
  };
7615
7733
  }
7616
- if (receipt.costUsd) {
7617
- usd += receipt.costUsd;
7618
- yield {
7619
- kind: "cost",
7620
- usdKnown: false,
7621
- usd: receipt.costUsd,
7622
- usdEstimated: receipt.costUsd,
7623
- provenance: "uncaptured"
7624
- };
7625
- }
7734
+ const amount = receipt.costUsd;
7735
+ if (amount !== void 0) {
7736
+ sawCostReceipt = true;
7737
+ usd += amount;
7738
+ if (receipt.usdKnown === false) {
7739
+ sawUnknownCostReceipt = true;
7740
+ sawCostEstimate = true;
7741
+ usdEstimated += amount;
7742
+ yield {
7743
+ kind: "cost",
7744
+ usdKnown: false,
7745
+ usd: amount,
7746
+ usdEstimated: amount,
7747
+ provenance: "uncaptured"
7748
+ };
7749
+ } else {
7750
+ if (event && canonicalSandboxUsageMode(event) === "cumulative") {
7751
+ pendingUnpricedWork = false;
7752
+ pendingEstimate = void 0;
7753
+ }
7754
+ yield {
7755
+ kind: "cost",
7756
+ usdKnown: true,
7757
+ usd: amount,
7758
+ provenance: "provider-receipt"
7759
+ };
7760
+ }
7761
+ } else if (receipt.estimatedCostUsd !== void 0) {
7762
+ pendingUnpricedWork = true;
7763
+ pendingEstimate = (pendingEstimate ?? 0) + receipt.estimatedCostUsd;
7764
+ } else if (input > 0 || output > 0 || receipt.tokensKnown === false) pendingUnpricedWork = true;
7626
7765
  }
7627
7766
  }
7628
7767
  /** One retained dispatch owns creation, replay, result identity, and cancellation. */
@@ -8228,12 +8367,19 @@ function sandboxEventFromEnvironmentEvent(event) {
8228
8367
  };
8229
8368
  return baseData;
8230
8369
  })();
8370
+ const costProvenance = data.costProvenance ?? data.cost_provenance;
8371
+ const nestedUsage = data.usage ?? data.tokenUsage;
8372
+ const nestedCost = nestedUsage && typeof nestedUsage === "object" ? nestedUsage.cost ?? nestedUsage.costUsd ?? nestedUsage.totalCostUsd : void 0;
8373
+ const normalizedData = (event.usage?.cost !== void 0 || data.costUsd !== void 0 || data.totalCostUsd !== void 0 || nestedCost !== void 0) && costProvenance === void 0 ? {
8374
+ ...data,
8375
+ costProvenance: "uncaptured"
8376
+ } : data;
8231
8377
  return {
8232
8378
  type,
8233
8379
  data: "usageMode" in event ? {
8234
- ...data,
8380
+ ...normalizedData,
8235
8381
  usageMode: event.usageMode
8236
- } : data,
8382
+ } : normalizedData,
8237
8383
  ...event.id ? { id: event.id } : {}
8238
8384
  };
8239
8385
  }
@@ -9548,14 +9694,14 @@ function withRouterRequestTimeout(callerSignal, timeoutMs) {
9548
9694
  dispose: () => void 0
9549
9695
  };
9550
9696
  const controller = new AbortController();
9551
- const timeout = setTimeout(() => controller.abort(/* @__PURE__ */ new Error(`router request timeout after ${timeoutMs}ms`)), timeoutMs);
9697
+ const clearTimeout = armDeadlineTimer(timeoutMs, () => controller.abort(/* @__PURE__ */ new Error(`router request timeout after ${timeoutMs}ms`)), true);
9552
9698
  const onCallerAbort = () => controller.abort(callerSignal?.reason ?? /* @__PURE__ */ new Error("aborted"));
9553
9699
  if (callerSignal?.aborted) onCallerAbort();
9554
9700
  else callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
9555
9701
  return {
9556
9702
  signal: controller.signal,
9557
9703
  dispose: () => {
9558
- clearTimeout(timeout);
9704
+ clearTimeout();
9559
9705
  callerSignal?.removeEventListener("abort", onCallerAbort);
9560
9706
  }
9561
9707
  };
@@ -12304,16 +12450,7 @@ const BRIDGE_RECONNECT_MAX_BACKOFF_MS = 2e3;
12304
12450
  async function reconnectBackoff(attempt, signal) {
12305
12451
  const ms = Math.min(BRIDGE_RECONNECT_MAX_BACKOFF_MS, 200 * 2 ** Math.max(0, attempt - 1));
12306
12452
  if (ms <= 0 || signal.aborted) return;
12307
- await new Promise((resolve) => {
12308
- const done = () => {
12309
- clearTimeout(timer);
12310
- signal.removeEventListener("abort", done);
12311
- resolve();
12312
- };
12313
- const timer = setTimeout(done, ms);
12314
- if (typeof timer === "object" && timer !== null && "unref" in timer) timer.unref();
12315
- signal.addEventListener("abort", done, { once: true });
12316
- });
12453
+ await sleep(ms, signal, false);
12317
12454
  }
12318
12455
  async function* streamDurableBridgeRun(args) {
12319
12456
  let reconnects = 0;
@@ -13738,13 +13875,14 @@ async function* streamBridgeSession(args) {
13738
13875
  else external.addEventListener("abort", abortTurn);
13739
13876
  interruptSig.addEventListener("abort", abortTurn, { once: true });
13740
13877
  let timedOut = false;
13741
- const timer = seam.timeoutMs !== void 0 ? setTimeout(() => {
13878
+ const clearTimer = seam.timeoutMs !== void 0 ? armDeadlineTimer(seam.timeoutMs, () => {
13742
13879
  timedOut = true;
13743
13880
  abortTurn();
13744
- }, seam.timeoutMs) : void 0;
13881
+ }, true) : void 0;
13745
13882
  const cleanup = () => {
13746
13883
  external.removeEventListener("abort", abortTurn);
13747
- if (timer) clearTimeout(timer);
13884
+ interruptSig.removeEventListener("abort", abortTurn);
13885
+ clearTimer?.();
13748
13886
  };
13749
13887
  let initialModelCredential;
13750
13888
  const preflightSignal = args.stopSignal === void 0 ? turnController.signal : AbortSignal.any([turnController.signal, args.stopSignal]);
@@ -16071,11 +16209,12 @@ function createSteerableSandboxSession(args) {
16071
16209
  args.controller.signal.addEventListener("abort", abortTurn);
16072
16210
  }
16073
16211
  interruptSig.addEventListener("abort", abortTurn, { once: true });
16074
- const timer = args.options?.turnTimeoutMs ? setTimeout(abortTurn, args.options.turnTimeoutMs) : void 0;
16212
+ const clearTimer = args.options?.turnTimeoutMs ? armDeadlineTimer(args.options.turnTimeoutMs, abortTurn, true) : void 0;
16075
16213
  const cleanup = () => {
16076
16214
  signal.removeEventListener("abort", abortTurn);
16077
16215
  args.controller.signal.removeEventListener("abort", abortTurn);
16078
- if (timer) clearTimeout(timer);
16216
+ interruptSig.removeEventListener("abort", abortTurn);
16217
+ clearTimer?.();
16079
16218
  };
16080
16219
  let events;
16081
16220
  let sawLlmCall = false;
@@ -17333,9 +17472,13 @@ const cliExecutor = (_spec, ctx) => {
17333
17472
  });
17334
17473
  },
17335
17474
  async teardown(grace) {
17475
+ if (!proc) {
17476
+ controller.abort();
17477
+ return { destroyed: true };
17478
+ }
17479
+ const receipt = await killWithGrace(proc, grace);
17336
17480
  controller.abort();
17337
- if (!proc || proc.exitCode !== null || proc.killed) return { destroyed: true };
17338
- return killWithGrace(proc, grace);
17481
+ return receipt;
17339
17482
  },
17340
17483
  resultArtifact() {
17341
17484
  if (!artifact) throw new ValidationError$1("cliExecutor: resultArtifact() read before stream drained");
@@ -17429,11 +17572,11 @@ async function* streamCliLeaf(args) {
17429
17572
  /** SIGTERM, then SIGKILL after `grace` ms (`'brutalKill'` = immediate SIGKILL,
17430
17573
  * `'infinity'` = await clean exit, never escalate). */
17431
17574
  function killWithGrace(proc, grace) {
17432
- if (proc.exitCode !== null || proc.killed) return Promise.resolve({ destroyed: true });
17575
+ if (proc.pid === void 0 || proc.exitCode !== null || proc.signalCode !== null) return Promise.resolve({ destroyed: true });
17433
17576
  return new Promise((resolve) => {
17434
- let timer;
17577
+ let clearTimer;
17435
17578
  proc.once("close", () => {
17436
- if (timer) clearTimeout(timer);
17579
+ clearTimer?.();
17437
17580
  resolve({ destroyed: true });
17438
17581
  });
17439
17582
  if (grace === "brutalKill") {
@@ -17442,9 +17585,9 @@ function killWithGrace(proc, grace) {
17442
17585
  }
17443
17586
  proc.kill("SIGTERM");
17444
17587
  if (grace === "infinity") return;
17445
- timer = setTimeout(() => {
17446
- if (proc.exitCode === null && !proc.killed) proc.kill("SIGKILL");
17447
- }, grace);
17588
+ clearTimer = armDeadlineTimer(grace, () => {
17589
+ if (proc.exitCode === null && proc.signalCode === null) proc.kill("SIGKILL");
17590
+ }, true);
17448
17591
  });
17449
17592
  }
17450
17593
  function bridgeWorktreeExecutor(spec, ctx, seam) {
@@ -18166,70 +18309,6 @@ function singleShotDriver(maxIterations) {
18166
18309
  };
18167
18310
  }
18168
18311
  //#endregion
18169
- //#region src/runtime/supervise/deadline.ts
18170
- const MAX_TIMER_DELAY_MS = 2147483647;
18171
- const DEFAULT_SUCCESSFUL_SHUTDOWN_MS = 5e3;
18172
- const TEARDOWN_ACKNOWLEDGEMENT_MS = 250;
18173
- /** Arm one wall-clock deadline without keeping the Node.js process alive. */
18174
- function armDeadlineTimer(delayMs, onDeadline) {
18175
- const deadlineAtMs = Date.now() + Math.max(0, delayMs);
18176
- let cleared = false;
18177
- let timer;
18178
- const arm = () => {
18179
- if (cleared) return;
18180
- const remainingMs = Math.max(0, deadlineAtMs - Date.now());
18181
- timer = setTimeout(() => {
18182
- if (cleared) return;
18183
- if (Date.now() >= deadlineAtMs) onDeadline();
18184
- else arm();
18185
- }, Math.min(remainingMs, MAX_TIMER_DELAY_MS));
18186
- if (typeof timer.unref === "function") timer.unref();
18187
- };
18188
- arm();
18189
- return () => {
18190
- cleared = true;
18191
- if (timer !== void 0) clearTimeout(timer);
18192
- };
18193
- }
18194
- /**
18195
- * Resolve a spawned child's duration into one absolute cutoff. An omitted child deadline inherits
18196
- * the parent cutoff; an explicit child duration may shorten, but never extend, that cutoff.
18197
- */
18198
- function boundedChildDeadlineAt(parentDeadlineAtMs, childDeadlineMs, nowMs) {
18199
- const parent = parentDeadlineAtMs > 0 ? parentDeadlineAtMs : void 0;
18200
- const child = childDeadlineMs === void 0 ? void 0 : nowMs + childDeadlineMs;
18201
- if (parent === void 0) return child;
18202
- if (child === void 0) return parent;
18203
- return Math.min(parent, child);
18204
- }
18205
- /** Invoke teardown once and bound how long the runtime waits for its acknowledgement. A hard
18206
- * execution deadline always wins; without one, numeric grace gets a short acknowledgement
18207
- * allowance and a brutal kill gets only that allowance. Explicit `infinity` remains unbounded
18208
- * only when no execution deadline exists. The losing promise stays observed. */
18209
- async function teardownExecutor(executor, grace, deadlineAtMs, now) {
18210
- const work = Promise.resolve(executor.teardown(grace));
18211
- const requestedWaitMs = grace === "infinity" ? void 0 : grace === "brutalKill" ? executor.teardownTimeoutMs ?? TEARDOWN_ACKNOWLEDGEMENT_MS : grace + TEARDOWN_ACKNOWLEDGEMENT_MS;
18212
- const deadlineWaitMs = deadlineAtMs === void 0 ? void 0 : Math.max(0, deadlineAtMs - now()) + TEARDOWN_ACKNOWLEDGEMENT_MS;
18213
- const waitMs = requestedWaitMs === void 0 ? deadlineWaitMs : deadlineWaitMs === void 0 ? requestedWaitMs : Math.min(requestedWaitMs, deadlineWaitMs);
18214
- let receipt;
18215
- if (waitMs === void 0) receipt = await work;
18216
- else if (waitMs <= 0) {
18217
- work.catch(() => void 0);
18218
- throw new ValidationError$1("executor teardown did not acknowledge before its deadline");
18219
- } else {
18220
- let timer;
18221
- const timedOut = new Promise((_resolve, reject) => {
18222
- timer = setTimeout(() => reject(new ValidationError$1(`executor teardown did not acknowledge within ${waitMs}ms`)), waitMs);
18223
- });
18224
- try {
18225
- receipt = await Promise.race([work, timedOut]);
18226
- } finally {
18227
- if (timer !== void 0) clearTimeout(timer);
18228
- }
18229
- }
18230
- if (!receipt.destroyed) throw new ValidationError$1(`executor teardown reported destroyed=false${receipt.detail ? `: ${receipt.detail}` : ""}`);
18231
- }
18232
- //#endregion
18233
18312
  //#region src/runtime/supervise/dispatch.ts
18234
18313
  /**
18235
18314
  *
@@ -19890,18 +19969,8 @@ function outcome(kind, settled, label, untilMs, armedAt, wokenAt, polls, probeEr
19890
19969
  /** `setTimeout` that resolves early (and clears) when the scope aborts, so a cancelled wait
19891
19970
  * releases the event loop immediately instead of holding the process to its deadline. */
19892
19971
  function defaultSleep$1(ms, signal) {
19893
- if (ms <= 0 || signal.aborted) return Promise.resolve();
19894
- return new Promise((resolve) => {
19895
- const timer = setTimeout(() => {
19896
- signal.removeEventListener("abort", onAbort);
19897
- resolve();
19898
- }, ms);
19899
- function onAbort() {
19900
- clearTimeout(timer);
19901
- resolve();
19902
- }
19903
- signal.addEventListener("abort", onAbort, { once: true });
19904
- });
19972
+ if (ms <= 0 || signal?.aborted) return Promise.resolve();
19973
+ return sleep(ms, signal);
19905
19974
  }
19906
19975
  //#endregion
19907
19976
  //#region src/runtime/supervise/scope.ts
@@ -22526,16 +22595,7 @@ var DriverAttemptsExhaustedError = class extends RuntimeRunStateError {
22526
22595
  };
22527
22596
  async function defaultSleep(ms, signal) {
22528
22597
  if (ms <= 0 || signal.aborted) return;
22529
- await new Promise((resolve) => {
22530
- const done = () => {
22531
- clearTimeout(timer);
22532
- signal.removeEventListener("abort", done);
22533
- resolve();
22534
- };
22535
- const timer = setTimeout(done, ms);
22536
- if (typeof timer === "object" && timer !== null && "unref" in timer) timer.unref();
22537
- signal.addEventListener("abort", done, { once: true });
22538
- });
22598
+ await sleep(ms, signal, false);
22539
22599
  }
22540
22600
  /**
22541
22601
  * Run the driver until it completes WITH ITS CONTRACT MET, or until the budget, the deadline, an
@@ -23373,15 +23433,13 @@ async function drainLiveChildren(scope, controller, settleGraceMs = 0) {
23373
23433
  await drainCursor(scope);
23374
23434
  return unconfirmedTeardowns(scope);
23375
23435
  }
23376
- let graceTimer;
23377
- if (settleGraceMs !== null && settleGraceMs > 0 && !controller.signal.aborted) {
23378
- graceTimer = setTimeout(() => controller.abort("root driver failed; child settle grace expired"), settleGraceMs);
23379
- graceTimer.unref?.();
23380
- } else if (settleGraceMs !== null && !controller.signal.aborted) controller.abort("root driver failed; no child settle grace configured");
23436
+ let clearGraceTimer;
23437
+ if (settleGraceMs !== null && settleGraceMs > 0 && !controller.signal.aborted) clearGraceTimer = armDeadlineTimer(settleGraceMs, () => controller.abort("root driver failed; child settle grace expired"));
23438
+ else if (settleGraceMs !== null && !controller.signal.aborted) controller.abort("root driver failed; no child settle grace configured");
23381
23439
  try {
23382
23440
  await drainCursor(scope);
23383
23441
  } finally {
23384
- if (graceTimer !== void 0) clearTimeout(graceTimer);
23442
+ clearGraceTimer?.();
23385
23443
  }
23386
23444
  const after = scope.view;
23387
23445
  if (after.inFlight > 0 || after.waiting > 0) throw new RuntimeRunStateError(`supervisor: cleanup ended with ${after.inFlight} running, ${after.waiting} waiting, and ` + describeUnconfirmed(scope));
@@ -23542,6 +23600,6 @@ function isNonEmptySpend(s) {
23542
23600
  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);
23543
23601
  }
23544
23602
  //#endregion
23545
- export { bindReusableExecutorExecutionId as $, exportEvalRuns as $n, runtimeOwnedExecutorExecutionBinding as $r, bridgeModelRouteRefusal as $t, waitUntil as A, promptCacheTokenClasses as Ai, retainedExecutorSeamKey as An, promptOnlyProfileMaterialization as Ar, spendFromUsageEvents as At, readWorkerInteractiveBinding as B, resourceTelemetry as Bi, defaultRedactor as Bn, prepareJsonlAppend as Br, readWorkerProgress as Bt, scopeOwnerExecutorNodeContext as C, sumSandboxUsage as Ci, providerAsSandboxClient as Cn, assertProfileMaterialization as Cr, workerTraceAnalysisStore as Ct, pollFor as D, deleteBoxSafe as Di, decodeToolPart as Dn, profileMaterializationAxes$1 as Dr, createBudgetPool as Dt, isWaitOutcome as E, cloneSpend as Ei, createPushTraceSource as En, fullProfileMaterialization as Er, assertValidBudget as Et, scopeRetainedOwnerResult as F, throwIfAborted as Fi, reconnectRetainedRun as Fn, unsupportedProfileDimensions as Fr, workerTraceHeaders as Ft, startRetainedInteractiveRun as G, promptFromAgentTurnInput as Gi, readTraceContextFromEnv as Gn, finalizeRuntimeOwnedPendingExecutor as Gr, claimsAuthority as Gt, workerInteractiveBindingsDir as H, decodeHarnessUsage as Hi, resolveRedactor as Hn, attestRuntimeOwnedPendingExecutor as Hr, AUTHORITY_MARKERS as Ht, interactiveAdmissionSeamKey as I, unmeteredSpend as Ii, recoverRetainedRun as In, validateProfileMaterialization as Ir, workerTraceSeamKey as It, freeSlots as J, buildLoopOtelSpans as Jn, knownMaterializationReceipt as Jr, peerMailTools as Jt, destroyInteractiveEnvironment as K, promptOptionsFromAgentTurnInput as Ki, traceContextToEnv as Kn, inheritRuntimeOwnedExecutorAttestation as Kr, createPeerMailbox as Kt, readWorkerInteractiveAdmissions as L, withTimeout as Li, startRetainedRun as Ln, worktreeCliProfileMaterialization as Lr, taskToPrompt as Lt, prepareScopeRetainedOwnerTask as M, sleep as Mi, abortError as Mn, renderProfileMaterializationIssues as Mr, WORKER_TRACE_PROPAGATION as Mt, scopeRetainedOwnerContext as N, stringifySafe as Ni, linkAbort as Nn, renderUnsupported as Nr, readWorkerTraceContext as Nt, timerAt as O, hasCompleteCacheBreakdown as Oi, sandboxSessionTraceSource as On, promptControlProfileMaterialization as Or, meterUsageEvent as Ot, scopeRetainedOwnerPriorSpend as P, throwAbort as Pi, runAbortable as Pn, sandboxActProfileMaterialization as Pr, workerTraceEnv as Pt, teardownExecutor as Q, createOtelExporter as Qn, runtimeOwnedDriveHarnessProviderEvidence as Qr, bridgeAdmissionRefusal as Qt, workerInteractiveAdmissionFile as R, zeroSpend as Ri, startRetainedRunInEnvironment as Rn, isNoEntError as Rr, DEFAULT_STALL_AFTER_MS as Rt, restoreScopeOwnerAcceptedExecution as S, sandboxProgressEvents as Si, providerAsExecutor as Sn, AGENT_PROFILE_MATERIALIZATION_AXES as Sr, parseWorkerToolTraceArtifact as St, createWaitProbes as T, chargedTokens as Ti, sandboxClientAsProvider as Tn, defineProfileMaterializationContract as Tr, BudgetReconcileFault as Tt, reconnectRetainedInteractiveRun as U, abortError$2 as Ui, createPropagatingTraceEmitter as Un, attestRuntimeOwnedScopeOwner as Ur, DEFAULT_PEER_MAIL_LIMITS as Ut, workerInteractiveBindingFile as V, withBudgetResources as Vi, defaultRedactorIdentityMaterial as Vn, writeAllBytes as Vr, createInbox as Vt, recoverRetainedInteractiveRun as W, awaitAbortable$1 as Wi, mergeTraceEnv as Wn, authoredProfileDigest as Wr, PEER_MAIL_WIRE_KEY as Wt, rollingDispatch as X, buildRuntimeEventOtelSpans as Xn, providerAttemptEvidence as Xr, isLiveNodeStatus as Xt, queueOf as Y, buildLoopSpanNodes as Yn, newExecutionAttemptId as Yr, peerMailVerbNames as Yt, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Z, createOpenInferenceFileExporter as Zn, recordRuntimeOwnedDriveHarnessProviderEvidence as Zr, isTerminalNodeStatus as Zt, createScope as _, isSandboxTerminalEvent as _i, runBrainLoop as _n, LOCAL_HARNESSES as _r, pendingWaits as _t, pickBestDelivered as a, unknownMaterializationReceipt as ai, bridgeStopSignalKey as an, toOtelAttributes as ar, snapshotExecutorConfig as at, meterRuntimeOwnedProviderAttempt as b, notifySandboxEventObserver as bi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as bn, parseCodexTokenUsage as br, captureWorkerTraceEvidence as bt, DriverAttemptsExhaustedError as c, detachedFrozen as ci, defaultSelectWinner as cn, sanitizeAgentRuntimeEvent as cr, createSteerableSandboxSession as ct, runDriverWithRetry as d, readSandboxOutcome as di, createSandboxLineage as dn, runSettledCommand as dr, FileSpawnJournal as dt, runtimeOwnedExecutorMaterialization as ei, addHarnessUsage as en, flatOtelSpan as er, captureReusableExecutorConfig as et, driverChild as f, assertSandboxServedModel as fi, probeSandboxCapabilities as fn, runWorktreeHarness as fr, InMemoryResultBlobStore as ft, beginScopeOwnerAttempt as g, extractLlmCallEvent as gi, routerBrain as gn, DEFAULT_LOCAL_HARNESS as gr, materializeTreeView as gt, withDriverExecutor as h, createSandboxUsageLedger as hi, readPromptOptions as hn, removeWorktree as hr, loadSpawnForest as ht, collectDelivered as i, unknownExecutionBindingReceipt as ii, bridgeRuntimeAttachmentsKey as in, padTraceId as ir, createExecutorRegistry as it, consumeScopeRetainedOwnerResult as j, randomSuffix as ji, RunCancellationReason as jn, promptResourceProfileMaterialization as jr, spendFromUsageTotals as jt, validateWaitSpec as k, isAbortError$2 as ki, registerRetainedExecutorPreparation as kn, promptModelProfileMaterialization as kr, newUsageTotals as kt, classifyDriverFailure as l, detachedSnapshot as li, isTerminalDecision as ln, sanitizeKnowledgeReadinessReport as lr, createInPlaceCliExecutor as lt, isDriverSpec as m, createSandboxToolPartState as mi, assertBoxlessPromptOptions as mn, createWorktree as mr, insideCursorNamespace as mt, createSupervisor as n, runtimeOwnedPendingExecutorMaterialization as ni, harnessUsageIsEmpty as nn, loopEventToOtelSpan as nr, cliWorktreeExecutor as nt, runFinalizer as o, executableAgentProfileSnapshot as oi, TERMINAL_DECISIONS as on, createRuntimeEventCollector as or, createWorktreeCliExecutor as ot, driverExecutorFactory as p, canonicalStreamEventFromSandboxEvent as pi, acquireSandbox as pn, captureWorktreeDiff as pr, InMemorySpawnJournal as pt, effectiveConcurrency as q, providerMessageText as qi, INTELLIGENCE_WIRE_VERSION as qn, knownExecutionBindingReceipt as qr, isPeerMailEnvelope as qt, bestDelivered as r, runtimeOwnedScopeOwnerRuntime as ri, readCodexRolloutSession as rn, padSpanId as rr, createExecutor as rt, runTree as s, executableAgentSpecSnapshot as si, createSandboxForSpec as sn, createRuntimeStreamEventCollector as sr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as st, createRootHandle as t, runtimeOwnedExecutorProviderEvidence as ti, createCodexRolloutStoreReader as tn, generateSpanId as tr, cliInPlaceExecutor as tt, defaultUnmetContractSteer as u, projectSandboxOutcome as ui, runAgentRounds as un, sanitizeRuntimeStreamEvent as ur, FileResultBlobStore as ut, deriveNodeExecutionIdentity as v, mapSandboxEvent as vi, canonicalObservedModelParts as vn, harnessSupportsReasoningEffort as vr, replaySpawnTree as vt, settledToIteration as w, addSpend as wi, resolveAgentEnvironmentProvider as wn, controlProfileMaterialization as wr, contentAddress as wt, recordScopeOwnerMaterialization as x, sandboxEventServedBackend as xi, createAgentEnvironmentProviderRegistry as xn, CodexExecutionDiagnosticError as xr, isTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, mapSandboxToolEvent as yi, observedModelMatchesDeclared as yn, localHarnessExecutable as yr, WORKER_TOOL_TRACE_SCHEMA_VERSION as yt, attachWorker as z, addResourceSpend as zi, retainedCreateMaterial as zn, parseCommittedJsonLines as zr, createActivityLog as zt };
23603
+ export { cliInPlaceExecutor as $, generateSpanId as $n, runtimeOwnedExecutorProviderEvidence as $r, createCodexRolloutStoreReader as $t, waitUntil as A, sleep as Ai, abortError as An, renderProfileMaterializationIssues as Ar, WORKER_TRACE_PROPAGATION as At, readWorkerInteractiveBinding as B, decodeHarnessUsage as Bi, resolveRedactor as Bn, attestRuntimeOwnedPendingExecutor as Br, AUTHORITY_MARKERS as Bt, scopeOwnerExecutorNodeContext as C, chargedTokens as Ci, sandboxClientAsProvider as Cn, defineProfileMaterializationContract as Cr, BudgetReconcileFault as Ct, pollFor as D, isAbortError$2 as Di, registerRetainedExecutorPreparation as Dn, promptModelProfileMaterialization as Dr, newUsageTotals as Dt, isWaitOutcome as E, hasCompleteCacheBreakdown as Ei, sandboxSessionTraceSource as En, promptControlProfileMaterialization as Er, meterUsageEvent as Et, scopeRetainedOwnerResult as F, withTimeout as Fi, startRetainedRun as Fn, worktreeCliProfileMaterialization as Fr, taskToPrompt as Ft, startRetainedInteractiveRun as G, teardownExecutor as Gi, INTELLIGENCE_WIRE_VERSION as Gn, knownExecutionBindingReceipt as Gr, isPeerMailEnvelope as Gt, workerInteractiveBindingsDir as H, awaitAbortable$1 as Hi, mergeTraceEnv as Hn, authoredProfileDigest as Hr, PEER_MAIL_WIRE_KEY as Ht, interactiveAdmissionSeamKey as I, zeroSpend as Ii, startRetainedRunInEnvironment as In, isNoEntError as Ir, DEFAULT_STALL_AFTER_MS as It, freeSlots as J, providerMessageText as Ji, buildRuntimeEventOtelSpans as Jn, providerAttemptEvidence as Jr, isLiveNodeStatus as Jt, destroyInteractiveEnvironment as K, promptFromAgentTurnInput as Ki, buildLoopOtelSpans as Kn, knownMaterializationReceipt as Kr, peerMailTools as Kt, readWorkerInteractiveAdmissions as L, addResourceSpend as Li, retainedCreateMaterial as Ln, parseCommittedJsonLines as Lr, createActivityLog as Lt, prepareScopeRetainedOwnerTask as M, throwAbort as Mi, runAbortable as Mn, sandboxActProfileMaterialization as Mr, workerTraceEnv as Mt, scopeRetainedOwnerContext as N, throwIfAborted as Ni, reconnectRetainedRun as Nn, unsupportedProfileDimensions as Nr, workerTraceHeaders as Nt, timerAt as O, promptCacheTokenClasses as Oi, retainedExecutorSeamKey as On, promptOnlyProfileMaterialization as Or, spendFromUsageEvents as Ot, scopeRetainedOwnerPriorSpend as P, unmeteredSpend as Pi, recoverRetainedRun as Pn, validateProfileMaterialization as Pr, workerTraceSeamKey as Pt, captureReusableExecutorConfig as Q, flatOtelSpan as Qn, runtimeOwnedExecutorMaterialization as Qr, addHarnessUsage as Qt, workerInteractiveAdmissionFile as R, resourceTelemetry as Ri, defaultRedactor as Rn, prepareJsonlAppend as Rr, readWorkerProgress as Rt, restoreScopeOwnerAcceptedExecution as S, addSpend as Si, resolveAgentEnvironmentProvider as Sn, controlProfileMaterialization as Sr, contentAddress as St, createWaitProbes as T, deleteBoxSafe as Ti, decodeToolPart as Tn, profileMaterializationAxes$1 as Tr, createBudgetPool as Tt, reconnectRetainedInteractiveRun as U, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ui, readTraceContextFromEnv as Un, finalizeRuntimeOwnedPendingExecutor as Ur, claimsAuthority as Ut, workerInteractiveBindingFile as V, abortError$2 as Vi, createPropagatingTraceEmitter as Vn, attestRuntimeOwnedScopeOwner as Vr, DEFAULT_PEER_MAIL_LIMITS as Vt, recoverRetainedInteractiveRun as W, armDeadlineTimer as Wi, traceContextToEnv as Wn, inheritRuntimeOwnedExecutorAttestation as Wr, createPeerMailbox as Wt, rollingDispatch as X, createOtelExporter as Xn, runtimeOwnedDriveHarnessProviderEvidence as Xr, bridgeAdmissionRefusal as Xt, queueOf as Y, createOpenInferenceFileExporter as Yn, recordRuntimeOwnedDriveHarnessProviderEvidence as Yr, isTerminalNodeStatus as Yt, bindReusableExecutorExecutionId as Z, exportEvalRuns as Zn, runtimeOwnedExecutorExecutionBinding as Zr, bridgeModelRouteRefusal as Zt, createScope as _, mapSandboxToolEvent as _i, observedModelMatchesDeclared as _n, localHarnessExecutable as _r, WORKER_TOOL_TRACE_SCHEMA_VERSION as _t, pickBestDelivered as a, executableAgentSpecSnapshot as ai, createSandboxForSpec as an, createRuntimeStreamEventCollector as ar, DEFAULT_SANDBOX_STEERING_MAX_TURNS as at, meterRuntimeOwnedProviderAttempt as b, sandboxProgressEvents as bi, providerAsExecutor as bn, AGENT_PROFILE_MATERIALIZATION_AXES as br, parseWorkerToolTraceArtifact as bt, DriverAttemptsExhaustedError as c, projectSandboxOutcome as ci, runAgentRounds as cn, sanitizeRuntimeStreamEvent as cr, FileResultBlobStore as ct, runDriverWithRetry as d, canonicalStreamEventFromSandboxEvent as di, acquireSandbox as dn, captureWorktreeDiff as dr, InMemorySpawnJournal as dt, runtimeOwnedPendingExecutorMaterialization as ei, harnessUsageIsEmpty as en, loopEventToOtelSpan as er, cliWorktreeExecutor as et, driverChild as f, createSandboxToolPartState as fi, assertBoxlessPromptOptions as fn, createWorktree as fr, insideCursorNamespace as ft, beginScopeOwnerAttempt as g, mapSandboxEvent as gi, canonicalObservedModelParts as gn, harnessSupportsReasoningEffort as gr, replaySpawnTree as gt, withDriverExecutor as h, isSandboxTerminalEvent as hi, runBrainLoop as hn, LOCAL_HARNESSES as hr, pendingWaits as ht, collectDelivered as i, executableAgentProfileSnapshot as ii, TERMINAL_DECISIONS as in, createRuntimeEventCollector as ir, createWorktreeCliExecutor as it, consumeScopeRetainedOwnerResult as j, stringifySafe as ji, linkAbort as jn, renderUnsupported as jr, readWorkerTraceContext as jt, validateWaitSpec as k, randomSuffix as ki, RunCancellationReason as kn, promptResourceProfileMaterialization as kr, spendFromUsageTotals as kt, classifyDriverFailure as l, readSandboxOutcome as li, createSandboxLineage as ln, runSettledCommand as lr, FileSpawnJournal as lt, isDriverSpec as m, extractLlmCallEvent as mi, routerBrain as mn, DEFAULT_LOCAL_HARNESS as mr, materializeTreeView as mt, createSupervisor as n, unknownExecutionBindingReceipt as ni, bridgeRuntimeAttachmentsKey as nn, padTraceId as nr, createExecutorRegistry as nt, runFinalizer as o, detachedFrozen as oi, defaultSelectWinner as on, sanitizeAgentRuntimeEvent as or, createSteerableSandboxSession as ot, driverExecutorFactory as p, createSandboxUsageLedger as pi, readPromptOptions as pn, removeWorktree as pr, loadSpawnForest as pt, effectiveConcurrency as q, promptOptionsFromAgentTurnInput as qi, buildLoopSpanNodes as qn, newExecutionAttemptId as qr, peerMailVerbNames as qt, bestDelivered as r, unknownMaterializationReceipt as ri, bridgeStopSignalKey as rn, toOtelAttributes as rr, snapshotExecutorConfig as rt, runTree as s, detachedSnapshot as si, isTerminalDecision as sn, sanitizeKnowledgeReadinessReport as sr, createInPlaceCliExecutor as st, createRootHandle as t, runtimeOwnedScopeOwnerRuntime as ti, readCodexRolloutSession as tn, padSpanId as tr, createExecutor as tt, defaultUnmetContractSteer as u, assertSandboxServedModel as ui, probeSandboxCapabilities as un, runWorktreeHarness as ur, InMemoryResultBlobStore as ut, deriveNodeExecutionIdentity as v, notifySandboxEventObserver as vi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as vn, parseCodexTokenUsage as vr, captureWorkerTraceEvidence as vt, settledToIteration as w, cloneSpend as wi, createPushTraceSource as wn, fullProfileMaterialization as wr, assertValidBudget as wt, recordScopeOwnerMaterialization as x, sumSandboxUsage as xi, providerAsSandboxClient as xn, assertProfileMaterialization as xr, workerTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, sandboxEventServedBackend as yi, createAgentEnvironmentProviderRegistry as yn, CodexExecutionDiagnosticError as yr, isTraceAnalysisStore as yt, attachWorker as z, withBudgetResources as zi, defaultRedactorIdentityMaterial as zn, writeAllBytes as zr, createInbox as zt };
23546
23604
 
23547
- //# sourceMappingURL=supervisor-DBzsb6Qt.js.map
23605
+ //# sourceMappingURL=supervisor-0ksHf44Z.js.map