@tangle-network/agent-runtime 10.0.3 → 10.0.4

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 (86) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/{activation-kitznAHo.js → activation-38MolXIP.js} +2 -2
  3. package/dist/{activation-kitznAHo.js.map → activation-38MolXIP.js.map} +1 -1
  4. package/dist/{activation-DbSxPRUW.d.ts → activation-Ckx0yHjT.d.ts} +2 -2
  5. package/dist/agent.d.ts +1 -1
  6. package/dist/agent.js +3 -3
  7. package/dist/{continuation-BDeKJgV3.js → continuation-CL4B1Y4M.js} +3 -3
  8. package/dist/{continuation-BDeKJgV3.js.map → continuation-CL4B1Y4M.js.map} +1 -1
  9. package/dist/{delegate-D8yX_2K7.js → delegate-dhNeiaH_.js} +2 -2
  10. package/dist/{delegate-D8yX_2K7.js.map → delegate-dhNeiaH_.js.map} +1 -1
  11. package/dist/{driver-control-acknowledgers-BTSr3Znq.js → driver-control-acknowledgers-C6GaGBf_.js} +98 -57
  12. package/dist/{driver-control-acknowledgers-BTSr3Znq.js.map → driver-control-acknowledgers-C6GaGBf_.js.map} +1 -1
  13. package/dist/durable-file-DJ3JsA4B.js +1 -0
  14. package/dist/{durable-file-DUcTDWJD.js → durable-file-lXnojyij.js} +15 -4
  15. package/dist/{durable-file-DUcTDWJD.js.map → durable-file-lXnojyij.js.map} +1 -1
  16. package/dist/durable-writer-thread.js +5 -5
  17. package/dist/durable.d.ts +1 -1
  18. package/dist/durable.js +13 -13
  19. package/dist/{graph-4ep9laIH.js → graph-CwLg3LGC.js} +7 -7
  20. package/dist/{graph-4ep9laIH.js.map → graph-CwLg3LGC.js.map} +1 -1
  21. package/dist/{graph-registry-B-EGvJ-3.js → graph-registry-Bs6mGKou.js} +1 -1
  22. package/dist/{graph-registry-BxEBeihr.js → graph-registry-DtGd03zk.js} +4 -4
  23. package/dist/{graph-registry-BxEBeihr.js.map → graph-registry-DtGd03zk.js.map} +1 -1
  24. package/dist/{improve-CJf87tBs.js → improve-C_LKfgH9.js} +7 -7
  25. package/dist/{improve-CJf87tBs.js.map → improve-C_LKfgH9.js.map} +1 -1
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +9 -9
  28. package/dist/intelligence.d.ts +2 -2
  29. package/dist/intelligence.js +4 -4
  30. package/dist/{jsonl-file-CVAWegN-.js → jsonl-file-DyzefaZ6.js} +3 -3
  31. package/dist/{jsonl-file-CVAWegN-.js.map → jsonl-file-DyzefaZ6.js.map} +1 -1
  32. package/dist/kernel.d.ts +2 -2
  33. package/dist/kernel.js +18 -18
  34. package/dist/{loop-runner-Ckj-Zz3-.js → loop-runner-BS3ru-yj.js} +2 -2
  35. package/dist/{loop-runner-Ckj-Zz3-.js.map → loop-runner-BS3ru-yj.js.map} +1 -1
  36. package/dist/{loop-runner-CayC8e9K.d.ts → loop-runner-LWqWf8FD.d.ts} +2 -2
  37. package/dist/loop-runner-bin.d.ts +1 -1
  38. package/dist/loop-runner-bin.js +1 -1
  39. package/dist/mcp/bin.js +3 -3
  40. package/dist/mcp/index.d.ts +1 -1
  41. package/dist/mcp/index.js +5 -5
  42. package/dist/profiles.d.ts +1 -1
  43. package/dist/{provision-supervisor-NjROV7AQ.js → provision-supervisor-D8N0l2DM.js} +6 -6
  44. package/dist/{provision-supervisor-NjROV7AQ.js.map → provision-supervisor-D8N0l2DM.js.map} +1 -1
  45. package/dist/{result-blob-store-BR-BVZrg.js → result-blob-store-DfTcyQ05.js} +3 -3
  46. package/dist/{result-blob-store-BR-BVZrg.js.map → result-blob-store-DfTcyQ05.js.map} +1 -1
  47. package/dist/{run-cancellation-C9V1lYhq.js → run-cancellation-D3qc9wAD.js} +3 -3
  48. package/dist/{run-cancellation-C9V1lYhq.js.map → run-cancellation-D3qc9wAD.js.map} +1 -1
  49. package/dist/{run-lock-Y3u9kwM0.js → run-lock-D1xnb9ve.js} +3 -3
  50. package/dist/{run-lock-Y3u9kwM0.js.map → run-lock-D1xnb9ve.js.map} +1 -1
  51. package/dist/{run-reopen-CHYTHk7x.js → run-reopen-DVM5AEKV.js} +6 -6
  52. package/dist/{run-reopen-CHYTHk7x.js.map → run-reopen-DVM5AEKV.js.map} +1 -1
  53. package/dist/{run-state-DgKo8_tO.js → run-state-tgQ-S9Ln.js} +7 -7
  54. package/dist/{run-state-DgKo8_tO.js.map → run-state-tgQ-S9Ln.js.map} +1 -1
  55. package/dist/{runtime-CdthBQUs.js → runtime-BTECV05R.js} +20 -20
  56. package/dist/{runtime-CdthBQUs.js.map → runtime-BTECV05R.js.map} +1 -1
  57. package/dist/{search-executor-Bb0WuI_Z.js → search-executor-Uco2_KTB.js} +3 -3
  58. package/dist/{search-executor-Bb0WuI_Z.js.map → search-executor-Uco2_KTB.js.map} +1 -1
  59. package/dist/{server-BCtyL7jH.js → server-BMp24-xn.js} +3 -3
  60. package/dist/{server-BCtyL7jH.js.map → server-BMp24-xn.js.map} +1 -1
  61. package/dist/{settle-record-Beh-sXBW.js → settle-record-au3w7bQG.js} +4 -4
  62. package/dist/{settle-record-Beh-sXBW.js.map → settle-record-au3w7bQG.js.map} +1 -1
  63. package/dist/{structural-rollout-BRfSDPkv.js → structural-rollout-D8wufVJI.js} +3 -3
  64. package/dist/{structural-rollout-BRfSDPkv.js.map → structural-rollout-D8wufVJI.js.map} +1 -1
  65. package/dist/{supervise-DTUYxnoJ.js → supervise-DtVdvZpr.js} +9 -9
  66. package/dist/{supervise-DTUYxnoJ.js.map → supervise-DtVdvZpr.js.map} +1 -1
  67. package/dist/{supervise-identity-eMF-h1uP.js → supervise-identity-S5XwgaF3.js} +4 -4
  68. package/dist/{supervise-identity-eMF-h1uP.js.map → supervise-identity-S5XwgaF3.js.map} +1 -1
  69. package/dist/{supervision-discovery-CAUsSDno.js → supervision-discovery-Cqu4NxPV.js} +3 -3
  70. package/dist/{supervision-discovery-CAUsSDno.js.map → supervision-discovery-Cqu4NxPV.js.map} +1 -1
  71. package/dist/{supervisor-BtRRFbgF.js → supervisor-CHgCAMjm.js} +7 -7
  72. package/dist/{supervisor-BtRRFbgF.js.map → supervisor-CHgCAMjm.js.map} +1 -1
  73. package/dist/{supervisor-accounting-Cuehs4te.js → supervisor-accounting-CZ7i4cd5.js} +117 -46
  74. package/dist/{supervisor-accounting-Cuehs4te.js.map → supervisor-accounting-CZ7i4cd5.js.map} +1 -1
  75. package/dist/{supervisor-root-contract-CmFKzPps.js → supervisor-root-contract-D70KTGXF.js} +2 -2
  76. package/dist/{supervisor-root-contract-CmFKzPps.js.map → supervisor-root-contract-D70KTGXF.js.map} +1 -1
  77. package/dist/testing.d.ts +1 -1
  78. package/dist/testing.js +11 -11
  79. package/dist/{top-web-D-wuEVdM.js → top-web-COrMqTRC.js} +7 -7
  80. package/dist/{top-web-D-wuEVdM.js.map → top-web-COrMqTRC.js.map} +1 -1
  81. package/dist/tui/bin.js +3 -3
  82. package/dist/tui/index.d.ts +1 -1
  83. package/dist/tui/index.js +2 -2
  84. package/dist/{types-PBoTtcbX.d.ts → types-9xsn2GGY.d.ts} +9 -2
  85. package/package.json +1 -1
  86. package/dist/durable-file-XqOyDf7q.js +0 -1
@@ -1,12 +1,12 @@
1
1
  import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-DG8yufqX.js";
2
- import { _ as runAbortable, c as withJsonlFileLock, d as journalFileStamp, f as sha256, h as deadlineSignal, l as appendCommittedJsonLine, o as readCommittedJsonLines, p as RunCancellationReason, r as prepareJsonlAppend, t as isNoEntError, v as signalAbortError } from "./jsonl-file-CVAWegN-.js";
2
+ import { _ as runAbortable, c as withJsonlFileLock, d as journalFileStamp, f as sha256, h as deadlineSignal, l as appendCommittedJsonLine, o as readCommittedJsonLines, p as RunCancellationReason, r as prepareJsonlAppend, t as isNoEntError, v as signalAbortError } from "./jsonl-file-DyzefaZ6.js";
3
3
  import { c as checkInIdleMs, d as teardownExecutor, n as CHILD_DEADLINE_REASON, o as armDeadlineTimer, s as boundedChildDeadlineAt, u as singleFlightTeardown } from "./deadline-CySmJ_0S.js";
4
4
  import { A as withBudgetResources, C as unreportedSpend, D as addResourceSpend, T as zeroSpend, a as cloneSpend, c as errorMessage, f as isAsyncIterable, i as chargedTokens, k as resourceTelemetry, n as addSpend, o as cloneTokenUsage, t as abortError, v as sleep } from "./util-qsH5cC9S.js";
5
5
  import { $ as newUsageTotals, F as executorFailureInfra, G as BudgetReconcileFault, I as executorFailureReason, J as budgetRecoverySeeds, K as budgetLeaseUpdates, M as contentAddress, Ot as recordValue, P as executorFailure, Q as meterUsageEvent, X as createBudgetPool, Y as completedLeafBacking, Z as refreshBudgetLease, a as settlementFailureCause, d as executorEvidenceWriter, ft as extractTransportEventIdentity, h as prepareRetainedExecutor, j as traceRootWriter, l as RetainedExecutionPendingError, m as leafContinuationExecutionId, n as runtimeFailureCause, nt as assertValidBudget, o as BUDGET_CONTINUATION_TASK, pt as parseCanonicalTransportEvent, q as budgetLeases, rt as assertValidSpend, t as reportedFailureCause, tt as spendFromUsageTotals, v as retainedExecutorSeamKey } from "./failure-cause-DoCCGLDH.js";
6
6
  import { a as errMessage, f as resolveRedactor, i as causeChain, l as errorText, n as detachedSnapshot, r as shareParsedStrings, u as defaultRedactor } from "./snapshot-BKI_w3JD.js";
7
7
  import { p as canonicalObservedModelParts, t as assertExecutableAgentProfile } from "./model-policy-DZnL8Yj9.js";
8
8
  import { b as verifiedArtifactChunks, g as workspaceLimits, h as safeArchivePath, i as readAgentCandidateWorkspaceArtifactFiles } from "./workspace-streams-C7PGLAUd.js";
9
- import { a as assertNoSymlinkDescendant, b as fenceRunWrite, n as appendDurableFile, o as publishExclusiveDurableFile, r as appendRunLines, u as writeAtomicDurableFile, v as runFencedAsync, y as captureRunWriteContext } from "./durable-file-DUcTDWJD.js";
9
+ import { S as fenceRunWrite, b as runFencedAsync, c as publishExclusiveDurableFileAsync, d as writeAtomicDurableFile, f as writeAtomicDurableFileAsync, i as appendRunLinesAsync, n as appendDurableFile, o as assertNoSymlinkDescendant, r as appendRunLines, s as publishExclusiveDurableFile, x as captureRunWriteContext } from "./durable-file-lXnojyij.js";
10
10
  import { b as sha256Bytes$1, g as deepFreezeCandidate } from "./output-artifacts-AqkZ8lO2.js";
11
11
  import { a as withPursuitContext, i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
12
12
  import * as traceContract from "@tangle-network/agent-trace-contract";
@@ -9490,6 +9490,19 @@ function readWorkerInteractiveBinding(eventDir, workerId) {
9490
9490
  * @internal
9491
9491
  */
9492
9492
  function writeWorkerInteractiveBinding(eventDir, workerId, label, journalRoot, session, now = Date.now) {
9493
+ const pending = prepareBinding(eventDir, workerId, label, journalRoot, session, now);
9494
+ if ("existing" in pending) return pending.existing;
9495
+ return settleBinding(eventDir, pending.binding, publishExclusiveDurableFile(pending.file, bindingText(pending.binding)));
9496
+ }
9497
+ /** `writeWorkerInteractiveBinding` without blocking the calling thread on the disk. @internal */
9498
+ async function writeWorkerInteractiveBindingAsync(eventDir, workerId, label, journalRoot, session, now = Date.now) {
9499
+ const pending = prepareBinding(eventDir, workerId, label, journalRoot, session, now);
9500
+ if ("existing" in pending) return pending.existing;
9501
+ return settleBinding(eventDir, pending.binding, await publishExclusiveDurableFileAsync(pending.file, bindingText(pending.binding)));
9502
+ }
9503
+ const bindingText = (binding) => `${JSON.stringify(binding, null, 2)}\n`;
9504
+ /** The binding to publish and its file, or the identical binding already published. */
9505
+ function prepareBinding(eventDir, workerId, label, journalRoot, session, now) {
9493
9506
  const id = stableText$1(workerId, "worker id");
9494
9507
  const workerLabel = stableText$1(label, "worker label");
9495
9508
  const root = stableText$1(journalRoot, "journal root");
@@ -9521,10 +9534,17 @@ function writeWorkerInteractiveBinding(eventDir, workerId, label, journalRoot, s
9521
9534
  const existing = readWorkerInteractiveBinding(eventDir, id);
9522
9535
  if (existing !== void 0) {
9523
9536
  assertSameBinding(existing, binding);
9524
- return existing;
9537
+ return { existing };
9525
9538
  }
9526
- if (publishExclusiveDurableFile(file, `${JSON.stringify(binding, null, 2)}\n`)) return binding;
9527
- const winner = readWorkerInteractiveBinding(eventDir, id);
9539
+ return {
9540
+ binding,
9541
+ file
9542
+ };
9543
+ }
9544
+ /** The published binding: this one, or the identical winner of a concurrent publication. */
9545
+ function settleBinding(eventDir, binding, published) {
9546
+ if (published) return binding;
9547
+ const winner = readWorkerInteractiveBinding(eventDir, binding.workerId);
9528
9548
  if (winner === void 0) throw new Error(`worker interactive binding publication lost its winner`);
9529
9549
  assertSameBinding(winner, binding);
9530
9550
  return winner;
@@ -11568,6 +11588,38 @@ function workerSteerAcknowledgementFile(eventDir, operationId) {
11568
11588
  * @stable
11569
11589
  */
11570
11590
  function writeWorkerSteer(rootDir, supervisorId, worker, options) {
11591
+ const steer = prepareWorkerSteer(rootDir, supervisorId, worker, options);
11592
+ const admitted = admitSteerRequest(steer.file, steer.request);
11593
+ if (admitted.replayed) return replayedSteer(steer, admitted);
11594
+ for (const projection of steerProjections(steer)) try {
11595
+ appendRunLines(projection.file, projection.lines, projection.options);
11596
+ } catch {}
11597
+ return {
11598
+ worker: steer.workerId,
11599
+ file: steer.file,
11600
+ request: steer.request,
11601
+ replayed: false
11602
+ };
11603
+ }
11604
+ /**
11605
+ * Admit one steer like `writeWorkerSteer`, without blocking the calling thread on the disk.
11606
+ * The request file is published by the durable writer, so an event loop that admits steers keeps
11607
+ * running while the file and its directory reach disk. Same admission, replay and conflict rules.
11608
+ * @stable
11609
+ */
11610
+ async function writeWorkerSteerAsync(rootDir, supervisorId, worker, options) {
11611
+ const steer = prepareWorkerSteer(rootDir, supervisorId, worker, options);
11612
+ const admitted = await admitSteerRequestAsync(steer.file, steer.request);
11613
+ if (admitted.replayed) return replayedSteer(steer, admitted);
11614
+ for (const projection of steerProjections(steer)) await appendRunLinesAsync(projection.file, projection.lines, projection.options).catch(() => {});
11615
+ return {
11616
+ worker: steer.workerId,
11617
+ file: steer.file,
11618
+ request: steer.request,
11619
+ replayed: false
11620
+ };
11621
+ }
11622
+ function prepareWorkerSteer(rootDir, supervisorId, worker, options) {
11571
11623
  const workerId = worker.trim();
11572
11624
  if (!workerId) throw new Error("writeWorkerSteer: worker id is empty");
11573
11625
  const operationId = options.operationId.trim();
@@ -11578,17 +11630,16 @@ function writeWorkerSteer(rootDir, supervisorId, worker, options) {
11578
11630
  const interrupt = options.interrupt === true;
11579
11631
  if (options.eventDir !== void 0 && !options.eventDir.trim()) throw new Error("writeWorkerSteer: eventDir is empty");
11580
11632
  const dir = options.eventDir === void 0 ? supervisorRunDir(rootDir, supervisorId) : resolve(options.eventDir);
11581
- const requestDigest = workerSteerRequestDigest({
11582
- operationId,
11583
- worker: workerId,
11584
- message: trimmed,
11585
- source,
11586
- interrupt
11587
- });
11588
11633
  const request = {
11589
11634
  schemaVersion: 1,
11590
11635
  operationId,
11591
- requestDigest,
11636
+ requestDigest: workerSteerRequestDigest({
11637
+ operationId,
11638
+ worker: workerId,
11639
+ message: trimmed,
11640
+ source,
11641
+ interrupt
11642
+ }),
11592
11643
  at: (/* @__PURE__ */ new Date()).toISOString(),
11593
11644
  source,
11594
11645
  worker: workerId,
@@ -11599,36 +11650,48 @@ function writeWorkerSteer(rootDir, supervisorId, worker, options) {
11599
11650
  assertNoSymlinkDescendant(dir, file, "steer request");
11600
11651
  mkdirSync(workerSteerRequestsDir(dir), { recursive: true });
11601
11652
  assertNoSymlinkDescendant(dir, file, "steer request");
11602
- const admitted = admitSteerRequest(file, request);
11603
- if (admitted.replayed) return {
11653
+ return {
11654
+ dir,
11655
+ file,
11656
+ operationId,
11657
+ workerId,
11658
+ request
11659
+ };
11660
+ }
11661
+ function replayedSteer({ dir, file, operationId }, admitted) {
11662
+ const acknowledgement = readWorkerSteerAcknowledgement(dir, operationId);
11663
+ return {
11604
11664
  worker: admitted.request.worker,
11605
11665
  file,
11606
11666
  request: admitted.request,
11607
- ...readWorkerSteerAcknowledgement(dir, operationId) === void 0 ? {} : { acknowledgement: readWorkerSteerAcknowledgement(dir, operationId) },
11667
+ ...acknowledgement === void 0 ? {} : { acknowledgement },
11608
11668
  replayed: true
11609
11669
  };
11670
+ }
11671
+ /** The readable projections the admission winner appends: the worker's inbox line and control event. */
11672
+ function steerProjections({ dir, operationId, workerId, request }) {
11610
11673
  mkdirSync(supervisorWorkersDir(dir), { recursive: true });
11611
- const projection = workerInboxFileFromEventDir(dir, workerId);
11612
- try {
11613
- appendRunLines(projection, [`${JSON.stringify(request)}\n`]);
11614
- } catch {}
11615
- appendWorkerControlEvent(dir, workerId, {
11674
+ const event = {
11675
+ at: (/* @__PURE__ */ new Date()).toISOString(),
11676
+ label: workerId,
11616
11677
  kind: "message",
11617
11678
  direction: "down",
11618
- source,
11679
+ source: request.source,
11619
11680
  operationId,
11620
- requestDigest,
11621
- message: trimmed,
11622
- interrupt,
11681
+ requestDigest: request.requestDigest,
11682
+ message: request.message,
11683
+ interrupt: request.interrupt,
11623
11684
  queued: true,
11624
11685
  delivered: false
11625
- });
11626
- return {
11627
- worker: workerId,
11628
- file,
11629
- request,
11630
- replayed: false
11631
11686
  };
11687
+ return [{
11688
+ file: workerInboxFileFromEventDir(dir, workerId),
11689
+ lines: [`${JSON.stringify(request)}\n`]
11690
+ }, {
11691
+ file: workerControlLogFile(dir, workerId),
11692
+ lines: [`${JSON.stringify(event)}\n`],
11693
+ options: { directory: supervisorWorkersDir(dir) }
11694
+ }];
11632
11695
  }
11633
11696
  /** Read every atomically admitted request for one exact worker id, in admission order. @stable */
11634
11697
  function readWorkerSteerRequests(eventDir, worker) {
@@ -11670,7 +11733,7 @@ function readWorkerSteerAcknowledgement(eventDir, operationId) {
11670
11733
  * Returns `true` only to the process that created the pre-delivery record.
11671
11734
  * @internal
11672
11735
  */
11673
- function claimWorkerSteerDelivery(eventDir, record) {
11736
+ async function claimWorkerSteerDelivery(eventDir, record) {
11674
11737
  const exact = parseWorkerSteerAcknowledgement(record);
11675
11738
  if (exact.effect !== "unknown") throw new Error("steer delivery claim must use effect unknown");
11676
11739
  const request = readWorkerSteerRequest(eventDir, exact.operationId);
@@ -11680,13 +11743,13 @@ function claimWorkerSteerDelivery(eventDir, record) {
11680
11743
  mkdirSync(dir, { recursive: true });
11681
11744
  assertNoSymlinkDescendant(eventDir, dir, "steer acknowledgement");
11682
11745
  const file = workerSteerAcknowledgementFile(eventDir, exact.operationId);
11683
- if (publishExclusiveDurableFile(file, `${JSON.stringify(exact, null, 2)}\n`)) return true;
11746
+ if (await publishExclusiveDurableFileAsync(file, `${JSON.stringify(exact, null, 2)}\n`)) return true;
11684
11747
  const winner = readWorkerSteerAcknowledgement(eventDir, exact.operationId);
11685
11748
  if (winner === void 0 || winner.operationId !== exact.operationId || winner.requestDigest !== exact.requestDigest) throw new Error("steer delivery claim conflicts with another operation");
11686
11749
  return false;
11687
11750
  }
11688
11751
  /** Atomically replace the runtime acknowledgement for one steer operation. @internal */
11689
- function writeWorkerSteerAcknowledgement(eventDir, record) {
11752
+ async function writeWorkerSteerAcknowledgement(eventDir, record) {
11690
11753
  const exact = parseWorkerSteerAcknowledgement(record);
11691
11754
  const request = readWorkerSteerRequest(eventDir, exact.operationId);
11692
11755
  if (request === void 0 || request.requestDigest !== exact.requestDigest) throw new Error("steer acknowledgement does not match an admitted request");
@@ -11697,7 +11760,7 @@ function writeWorkerSteerAcknowledgement(eventDir, record) {
11697
11760
  const file = workerSteerAcknowledgementFile(eventDir, exact.operationId);
11698
11761
  const prior = readWorkerSteerAcknowledgement(eventDir, exact.operationId);
11699
11762
  if (prior !== void 0 && prior.effect !== "unknown" && canonicalCandidateDigest(prior) !== canonicalCandidateDigest(exact)) throw new Error(`steer operation '${exact.operationId}' already has a terminal acknowledgement`);
11700
- writeAtomicDurableFile(file, `${JSON.stringify(exact, null, 2)}\n`);
11763
+ await writeAtomicDurableFileAsync(file, `${JSON.stringify(exact, null, 2)}\n`);
11701
11764
  }
11702
11765
  /** The directory holding every cancellation artifact of one run (request inbox + acknowledgements). */
11703
11766
  function workerCancellationsDir(eventDir) {
@@ -11896,15 +11959,23 @@ function operationFileHash(operationId) {
11896
11959
  return sha256(id);
11897
11960
  }
11898
11961
  function admitSteerRequest(file, request) {
11962
+ return replayedSteerRequest(file, request) ?? steerAdmission(file, request, publishExclusiveDurableFile(file, steerRequestText(request)));
11963
+ }
11964
+ async function admitSteerRequestAsync(file, request) {
11965
+ return replayedSteerRequest(file, request) ?? steerAdmission(file, request, await publishExclusiveDurableFileAsync(file, steerRequestText(request)));
11966
+ }
11967
+ const steerRequestText = (request) => `${JSON.stringify(request, null, 2)}\n`;
11968
+ function replayedSteerRequest(file, request) {
11899
11969
  const existing = readWorkerSteerRequestFile(file);
11900
- if (existing !== void 0) {
11901
- assertSameSteerRequest(existing, request);
11902
- return {
11903
- request: existing,
11904
- replayed: true
11905
- };
11906
- }
11907
- if (publishExclusiveDurableFile(file, `${JSON.stringify(request, null, 2)}\n`)) return {
11970
+ if (existing === void 0) return void 0;
11971
+ assertSameSteerRequest(existing, request);
11972
+ return {
11973
+ request: existing,
11974
+ replayed: true
11975
+ };
11976
+ }
11977
+ function steerAdmission(file, request, published) {
11978
+ if (published) return {
11908
11979
  request,
11909
11980
  replayed: false
11910
11981
  };
@@ -12561,7 +12632,7 @@ function bindInteractiveWorker(args, live, label, childRun, signal, spawnCommitt
12561
12632
  if (ready === void 0 || notStarted(ready)) return;
12562
12633
  session = ready;
12563
12634
  }
12564
- writeWorkerInteractiveBinding(args.interactiveBindingDir, live.id, label, args.root, session, now);
12635
+ await writeWorkerInteractiveBindingAsync(args.interactiveBindingDir, live.id, label, args.root, session, now);
12565
12636
  });
12566
12637
  }
12567
12638
  /**
@@ -14123,6 +14194,6 @@ function unknownChannels(spend) {
14123
14194
  function isNonEmptySpend(s) {
14124
14195
  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);
14125
14196
  }
14126
- export { settledToIteration as $, createRuntimeEventCollector as $n, unknownMaterializationReceipt as $r, noteScopeRetainedOwnerCoordination as $t, writeWorkerCancellation as A, acceptedInteractiveControl as An, attestRuntimeOwnedPendingExecutor as Ar, consumeScopeRetainedOwnerResult as At, workerTraceAnalysisStore as B, workerTraceEnv as Bn, recordRuntimeOwnedDriveHarnessProviderEvidence as Br, restoreScopeOwnerAcceptedExecution as Bt, safeWorkerFile as C, assertRetainedRunReplayMaterial as Cn, SeatChain as Cr, prepareScopeRetainedOwnerSeatSwitch as Ct, workerCancellationsDir as D, startRetainedRun as Dn, subscriptionUsageLimitSignal as Dr, resolveSpawnResourcePaths as Dt, workerCancelRequestsFile as E, recoverRetainedRun as En, seatExecutionProfile as Er, environmentReader as Et, resolveWorkerSlots as F, observerRecordDigest as Fn, inheritRuntimeOwnedExecutorAttestation as Fr, finalizeScopeOwnerMaterialization as Ft, reconnectRetainedInteractiveRun as G, buildLoopOtelSpans as Gn, runtimeOwnedDriveHarnessProviderEvidence as Gr, providerVisibleProfile as Gt, interactiveAdmissionSeamKey as H, createPropagatingTraceEmitter as Hn, recordRuntimeOwnedProviderDispatchNotStarted as Hr, scopeOwnerExecutorNodeContext as Ht, prepareScopeResume as I, verifyObserverRecords as In, knownExecutionBindingReceipt as Ir, holdScopeOwnerTranscript as It, FileSpawnJournal as J, createOpenInferenceFileExporter as Jn, runtimeOwnedExecutorProviderEvidence as Jr, scopeRetainedOwnerSettled as Jt, recoverRetainedInteractiveRun as K, buildLoopSpanNodes as Kn, runtimeOwnedExecutorExecutionBinding as Kr, runtimeGraphMetadataKey as Kt, replaySpawnTree as L, destroyInteractiveEnvironment as Ln, knownMaterializationReceipt as Lr, noteScopeOwnerPlannedExecution as Lt, writeWorkerSteerAcknowledgement as M, prepareInteractiveDelegation as Mn, authoredAgentIdentity as Mr, scopeRetainedOwnerPriorSpend as Mt, createWorkerSlots as N, FileObserverJournal as Nn, authoredProfileDigest as Nr, scopeRetainedOwnerResult as Nt, workerInboxFileFromEventDir as O, startRetainedRunInEnvironment as On, attestRuntimeOwnedDeferredExecutor as Or, RELEASE_DESTROY_MS as Ot, openSlotGroup as P, createFileObserverHooks as Pn, finalizeRuntimeOwnedPendingExecutor as Pr, beginScopeOwnerAttempt as Pt, reenteredWorkers as Q, loopEventToOtelSpan as Qn, unknownExecutionBindingReceipt as Qr, scopeRetainedOwnerRestorePoint as Qt, isTraceAnalysisStore as R, environmentGone as Rn, newExecutionAttemptId as Rr, recordScopeOwnerHarnessTranscript as Rt, readWorkerSteerRequests as S, RetainedMaterializationTimeoutError as Sn, SEAT_RECHECK_MS as Sr, waitForScopeChildren as St, supervisorRunsRoot as T, reconnectRetainedRun as Tn, authoredSeatStages as Tr, scopeRetainedOwnerResourceReader as Tt, attachWorker as U, mergeTraceEnv as Un, recordRuntimeOwnedProviderIdentityConflict as Ur, coordinationMcpAlias as Ut, nestedScopeSeamKey as V, workerTraceHeaders as Vn, recordRuntimeOwnedProviderAttemptStart as Vr, scopeOwnerExecutionObservation as Vt, readWorkerInteractiveBinding as W, readTraceContextFromEnv as Wn, recordRuntimeOwnedProviderModel as Wr, coordinationProfileToolPrefix as Wt, spawnJournalRecordEvents as X, flatOtelSpan as Xn, runtimeOwnedScopeOwnerControl as Xr, assertRetainedOwnerCoordinationRekey as Xt, appendSpawnEvents as Y, createOtelExporter as Yn, runtimeOwnedPendingExecutorMaterialization as Yr, scopeRetainedOwnerTurnEnded as Yt, appendTeardownConfirmation as Z, generateSpanId as Zn, runtimeOwnedScopeOwnerRuntime as Zr, reconcileScopeRetainedOwnerEnvironment as Zt, legacySupervisorRunDir as _, observeModelRequest as _n, createActivityLog as _r, releaseRetainedEnvironments as _t, closeStreamFile as a, runtimeFlowBrain as ai, scopeRetainedOwnerContext as an, captureHarnessTranscript as ar, boundRetainedReleases as at, readWorkerCancellation as b, stopRetainedNativeExecution as bn, isLiveNodeStatus as br, startScopeRecoveries as bt, openStreamFileFenced as c, awaitAbortable$1 as ci, ownedTreeRootSpawn as cn, harnessTranscriptUnavailable as cr, hasRetriableTeardowns as ct, syncStreamFileFenced as d, retainedSessionReplaced as di, driverRuntime as dn, settleHarnessTranscript as dr, pauseScopeSeatAdmission as dt, executableAgentProfileSnapshot as ei, scopeRetainedOwnerCheckpointing as en, createRuntimeStreamEventCollector as er, assertRecursiveReservationPolicy as et, writeStreamLinesFenced as f, sameControlCoordinates as fi, nestedDriverTreeRoot as fn, HARNESS_TRANSCRIPT_READ_LIMITS as fr, recordScopeOwnerBarrenPause as ft, fileEscalateQuestion as g, executorObservationSeamKey as gn, DEFAULT_STALL_AFTER_MS as gr, releaseHeldEnvironments as gt, claimWorkerSteerDelivery as h, providerMessageText as hi, executorObservation as hn, retainHarnessTranscript as hr, registerNestedTeardownScope as ht, ROOT_STREAM_FILE as i, runtimeFlowAgent as ii, scopeOwnerLiabilities as in, captureBoundHarnessTranscript as ir, rollingDispatch as it, writeWorkerSteer as j, offerInteractiveControl as jn, attestRuntimeOwnedScopeOwner as jr, prepareScopeRetainedOwnerTask as jt, workerSteerRequestsDir as k, retainedCreateMaterial as kn, attestRuntimeOwnedExecutor as kr, abandonScopeRetainedOwnerInvocation as kt, readRootStream as l, exactSession as li, materializeTreeView as ln, persistHarnessTranscript as lr, meterRuntimeOwnedAccounting as lt, cancelWorker as m, promptOptionsFromAgentTurnInput as mi, insideCursorNamespace as mn, resolveHarnessTranscriptCapture as mr, recordScopeOwnerPause as mt, terminalAccounting as n, isRuntimeFlowBrain as ni, bindScopeRetainedOwnerProvider as nn, sanitizeRuntimeStreamEvent as nr, freeSlots as nt, createRootStreamSink as o, RetainedRunProviderContractError as oi, scopeRetainedOwnerJournalRoot as on, harnessTranscriptArtifact as or, closeRetainedSlots as ot, appendWorkerControlEvent as p, promptFromAgentTurnInput as pi, SpawnEventIndex as pn, readBoundHarnessSessions$1 as pr, recordScopeOwnerDriverAttempt as pt, startRetainedInteractiveRun as q, buildRuntimeEventOtelSpans as qn, runtimeOwnedExecutorMaterialization as qr, beginScopeRetainedOwnerDrive as qt, createScope as r, runtimeCheckFactory as ri, owners as rn, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as rr, queueOf as rt, nodeStreamFile as s, assertEventBinding as si, loadSpawnForest as sn, harnessTranscriptFromLines as sr, closeScopeAdmission as st, isNonEmptySpend as t, executableAgentSpecSnapshot as ti, bindScopeRetainedOwnerEnvironmentId as tn, sanitizeKnowledgeReadinessReport as tr, deriveNodeExecutionIdentity as tt, readRootStreamReceipt as u, freezeControlRef as ui, attestNestedDriverTreeOwner as un, readHarnessTranscript as ur, meterRuntimeOwnedProviderAttempt as ut, legacySupervisorRunsRoot as v, NATIVE_STOP_UNCONFIRMED as vn, describeToolArgs as vr, retryUnconfirmedTeardowns as vt, supervisorRunDir as w, mintRetainedIdentity as wn, SeatPauseError as wr, releaseScopeRetainedOwnerForSeatPause as wt, readWorkerSteerAcknowledgement as x, verifyWorkspaceMarker as xn, isTerminalNodeStatus as xr, unconfirmedTeardowns as xt, readWorkerCancelRequests as y, describeRetainedNativeStops as yn, readWorkerProgress as yr, settleManagerWork as yt, parseWorkerToolTraceArtifact as z, WORKER_TRACE_PROPAGATION as zn, providerAttemptEvidence as zr, recordScopeOwnerMaterialization as zt };
14197
+ export { reenteredWorkers as $, loopEventToOtelSpan as $n, unknownExecutionBindingReceipt as $r, scopeRetainedOwnerRestorePoint as $t, writeWorkerCancellation as A, retainedCreateMaterial as An, attestRuntimeOwnedExecutor as Ar, abandonScopeRetainedOwnerInvocation as At, parseWorkerToolTraceArtifact as B, WORKER_TRACE_PROPAGATION as Bn, providerAttemptEvidence as Br, recordScopeOwnerMaterialization as Bt, safeWorkerFile as C, RetainedMaterializationTimeoutError as Cn, SEAT_RECHECK_MS as Cr, waitForScopeChildren as Ct, workerCancellationsDir as D, recoverRetainedRun as Dn, seatExecutionProfile as Dr, environmentReader as Dt, workerCancelRequestsFile as E, reconnectRetainedRun as En, authoredSeatStages as Er, scopeRetainedOwnerResourceReader as Et, openSlotGroup as F, createFileObserverHooks as Fn, finalizeRuntimeOwnedPendingExecutor as Fr, beginScopeOwnerAttempt as Ft, readWorkerInteractiveBinding as G, readTraceContextFromEnv as Gn, recordRuntimeOwnedProviderModel as Gr, coordinationProfileToolPrefix as Gt, nestedScopeSeamKey as H, workerTraceHeaders as Hn, recordRuntimeOwnedProviderAttemptStart as Hr, scopeOwnerExecutionObservation as Ht, resolveWorkerSlots as I, observerRecordDigest as In, inheritRuntimeOwnedExecutorAttestation as Ir, finalizeScopeOwnerMaterialization as It, startRetainedInteractiveRun as J, buildRuntimeEventOtelSpans as Jn, runtimeOwnedExecutorMaterialization as Jr, beginScopeRetainedOwnerDrive as Jt, reconnectRetainedInteractiveRun as K, buildLoopOtelSpans as Kn, runtimeOwnedDriveHarnessProviderEvidence as Kr, providerVisibleProfile as Kt, prepareScopeResume as L, verifyObserverRecords as Ln, knownExecutionBindingReceipt as Lr, holdScopeOwnerTranscript as Lt, writeWorkerSteerAcknowledgement as M, offerInteractiveControl as Mn, attestRuntimeOwnedScopeOwner as Mr, prepareScopeRetainedOwnerTask as Mt, writeWorkerSteerAsync as N, prepareInteractiveDelegation as Nn, authoredAgentIdentity as Nr, scopeRetainedOwnerPriorSpend as Nt, workerInboxFileFromEventDir as O, startRetainedRun as On, subscriptionUsageLimitSignal as Or, resolveSpawnResourcePaths as Ot, createWorkerSlots as P, FileObserverJournal as Pn, authoredProfileDigest as Pr, scopeRetainedOwnerResult as Pt, appendTeardownConfirmation as Q, generateSpanId as Qn, runtimeOwnedScopeOwnerRuntime as Qr, reconcileScopeRetainedOwnerEnvironment as Qt, replaySpawnTree as R, destroyInteractiveEnvironment as Rn, knownMaterializationReceipt as Rr, noteScopeOwnerPlannedExecution as Rt, readWorkerSteerRequests as S, verifyWorkspaceMarker as Sn, isTerminalNodeStatus as Sr, unconfirmedTeardowns as St, supervisorRunsRoot as T, mintRetainedIdentity as Tn, SeatPauseError as Tr, releaseScopeRetainedOwnerForSeatPause as Tt, interactiveAdmissionSeamKey as U, createPropagatingTraceEmitter as Un, recordRuntimeOwnedProviderDispatchNotStarted as Ur, scopeOwnerExecutorNodeContext as Ut, workerTraceAnalysisStore as V, workerTraceEnv as Vn, recordRuntimeOwnedDriveHarnessProviderEvidence as Vr, restoreScopeOwnerAcceptedExecution as Vt, attachWorker as W, mergeTraceEnv as Wn, recordRuntimeOwnedProviderIdentityConflict as Wr, coordinationMcpAlias as Wt, appendSpawnEvents as X, createOtelExporter as Xn, runtimeOwnedPendingExecutorMaterialization as Xr, scopeRetainedOwnerTurnEnded as Xt, FileSpawnJournal as Y, createOpenInferenceFileExporter as Yn, runtimeOwnedExecutorProviderEvidence as Yr, scopeRetainedOwnerSettled as Yt, spawnJournalRecordEvents as Z, flatOtelSpan as Zn, runtimeOwnedScopeOwnerControl as Zr, assertRetainedOwnerCoordinationRekey as Zt, legacySupervisorRunDir as _, executorObservationSeamKey as _n, DEFAULT_STALL_AFTER_MS as _r, releaseHeldEnvironments as _t, closeStreamFile as a, runtimeFlowAgent as ai, scopeOwnerLiabilities as an, captureBoundHarnessTranscript as ar, rollingDispatch as at, readWorkerCancellation as b, describeRetainedNativeStops as bn, readWorkerProgress as br, settleManagerWork as bt, openStreamFileFenced as c, assertEventBinding as ci, loadSpawnForest as cn, harnessTranscriptFromLines as cr, closeScopeAdmission as ct, syncStreamFileFenced as d, freezeControlRef as di, attestNestedDriverTreeOwner as dn, readHarnessTranscript as dr, meterRuntimeOwnedProviderAttempt as dt, unknownMaterializationReceipt as ei, noteScopeRetainedOwnerCoordination as en, createRuntimeEventCollector as er, settledToIteration as et, writeStreamLinesFenced as f, retainedSessionReplaced as fi, driverRuntime as fn, settleHarnessTranscript as fr, pauseScopeSeatAdmission as ft, fileEscalateQuestion as g, providerMessageText as gi, executorObservation as gn, retainHarnessTranscript as gr, registerNestedTeardownScope as gt, claimWorkerSteerDelivery as h, promptOptionsFromAgentTurnInput as hi, insideCursorNamespace as hn, resolveHarnessTranscriptCapture as hr, recordScopeOwnerPause as ht, ROOT_STREAM_FILE as i, runtimeCheckFactory as ii, owners as in, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as ir, queueOf as it, writeWorkerSteer as j, acceptedInteractiveControl as jn, attestRuntimeOwnedPendingExecutor as jr, consumeScopeRetainedOwnerResult as jt, workerSteerRequestsDir as k, startRetainedRunInEnvironment as kn, attestRuntimeOwnedDeferredExecutor as kr, RELEASE_DESTROY_MS as kt, readRootStream as l, awaitAbortable$1 as li, ownedTreeRootSpawn as ln, harnessTranscriptUnavailable as lr, hasRetriableTeardowns as lt, cancelWorker as m, promptFromAgentTurnInput as mi, SpawnEventIndex as mn, readBoundHarnessSessions$1 as mr, recordScopeOwnerDriverAttempt as mt, terminalAccounting as n, executableAgentSpecSnapshot as ni, bindScopeRetainedOwnerEnvironmentId as nn, sanitizeKnowledgeReadinessReport as nr, deriveNodeExecutionIdentity as nt, createRootStreamSink as o, runtimeFlowBrain as oi, scopeRetainedOwnerContext as on, captureHarnessTranscript as or, boundRetainedReleases as ot, appendWorkerControlEvent as p, sameControlCoordinates as pi, nestedDriverTreeRoot as pn, HARNESS_TRANSCRIPT_READ_LIMITS as pr, recordScopeOwnerBarrenPause as pt, recoverRetainedInteractiveRun as q, buildLoopSpanNodes as qn, runtimeOwnedExecutorExecutionBinding as qr, runtimeGraphMetadataKey as qt, createScope as r, isRuntimeFlowBrain as ri, bindScopeRetainedOwnerProvider as rn, sanitizeRuntimeStreamEvent as rr, freeSlots as rt, nodeStreamFile as s, RetainedRunProviderContractError as si, scopeRetainedOwnerJournalRoot as sn, harnessTranscriptArtifact as sr, closeRetainedSlots as st, isNonEmptySpend as t, executableAgentProfileSnapshot as ti, scopeRetainedOwnerCheckpointing as tn, createRuntimeStreamEventCollector as tr, assertRecursiveReservationPolicy as tt, readRootStreamReceipt as u, exactSession as ui, materializeTreeView as un, persistHarnessTranscript as ur, meterRuntimeOwnedAccounting as ut, legacySupervisorRunsRoot as v, observeModelRequest as vn, createActivityLog as vr, releaseRetainedEnvironments as vt, supervisorRunDir as w, assertRetainedRunReplayMaterial as wn, SeatChain as wr, prepareScopeRetainedOwnerSeatSwitch as wt, readWorkerSteerAcknowledgement as x, stopRetainedNativeExecution as xn, isLiveNodeStatus as xr, startScopeRecoveries as xt, readWorkerCancelRequests as y, NATIVE_STOP_UNCONFIRMED as yn, describeToolArgs as yr, retryUnconfirmedTeardowns as yt, isTraceAnalysisStore as z, environmentGone as zn, newExecutionAttemptId as zr, recordScopeOwnerHarnessTranscript as zt };
14127
14198
 
14128
- //# sourceMappingURL=supervisor-accounting-Cuehs4te.js.map
14199
+ //# sourceMappingURL=supervisor-accounting-CZ7i4cd5.js.map