@tangle-network/agent-runtime 3.0.40 → 3.0.42

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 (62) hide show
  1. package/dist/{activation-CCttbkSj.d.ts → activation-C1_GUwX8.d.ts} +2 -2
  2. package/dist/{activation-n22lMRhH.js → activation-CiM6hSrn.js} +2 -2
  3. package/dist/{activation-n22lMRhH.js.map → activation-CiM6hSrn.js.map} +1 -1
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +3 -3
  6. package/dist/{coordination-manager-C_ohXf63.js → coordination-manager-_PcKOR-S.js} +4 -4
  7. package/dist/{coordination-manager-C_ohXf63.js.map → coordination-manager-_PcKOR-S.js.map} +1 -1
  8. package/dist/{delegate-BYLjG7Ev.js → delegate--q1zCR-1.js} +2 -2
  9. package/dist/{delegate-BYLjG7Ev.js.map → delegate--q1zCR-1.js.map} +1 -1
  10. package/dist/durable.d.ts +1 -1
  11. package/dist/durable.js +6 -6
  12. package/dist/{graph-T1-PBhLx.js → graph-oFhKT5Ad.js} +5 -5
  13. package/dist/{graph-T1-PBhLx.js.map → graph-oFhKT5Ad.js.map} +1 -1
  14. package/dist/{improve-BqMfcxh1.js → improve-DhTBR1p-.js} +6 -6
  15. package/dist/{improve-BqMfcxh1.js.map → improve-DhTBR1p-.js.map} +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +8 -8
  18. package/dist/intelligence.d.ts +2 -2
  19. package/dist/intelligence.js +4 -4
  20. package/dist/kernel.d.ts +2 -2
  21. package/dist/kernel.js +11 -11
  22. package/dist/{loop-runner-CGa71-66.js → loop-runner-BmtOiAiq.js} +2 -2
  23. package/dist/{loop-runner-CGa71-66.js.map → loop-runner-BmtOiAiq.js.map} +1 -1
  24. package/dist/{loop-runner-CRZ3pF7w.d.ts → loop-runner-DMBWRkx0.d.ts} +2 -2
  25. package/dist/loop-runner-bin.d.ts +1 -1
  26. package/dist/loop-runner-bin.js +1 -1
  27. package/dist/mcp/bin.js +3 -3
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp/index.js +5 -5
  30. package/dist/profiles.d.ts +1 -1
  31. package/dist/{provision-supervisor-Dl6oYQDN.js → provision-supervisor-wJp8ECNK.js} +4 -4
  32. package/dist/{provision-supervisor-Dl6oYQDN.js.map → provision-supervisor-wJp8ECNK.js.map} +1 -1
  33. package/dist/{run-cancellation-BzmmqlM8.js → run-cancellation-Xh0hv_aO.js} +2 -2
  34. package/dist/{run-cancellation-BzmmqlM8.js.map → run-cancellation-Xh0hv_aO.js.map} +1 -1
  35. package/dist/{runtime-DoUb4SOs.js → runtime-BsXRlG8W.js} +11 -11
  36. package/dist/{runtime-DoUb4SOs.js.map → runtime-BsXRlG8W.js.map} +1 -1
  37. package/dist/{scope-BGWRFiYt.js → scope-D04GkJ6P.js} +21 -21
  38. package/dist/scope-D04GkJ6P.js.map +1 -0
  39. package/dist/{search-executor-DPBewC3S.js → search-executor-Dzhi0WRa.js} +3 -3
  40. package/dist/{search-executor-DPBewC3S.js.map → search-executor-Dzhi0WRa.js.map} +1 -1
  41. package/dist/{server-M9dG-WG9.js → server-WKv4YNcI.js} +3 -3
  42. package/dist/{server-M9dG-WG9.js.map → server-WKv4YNcI.js.map} +1 -1
  43. package/dist/{structural-rollout-BylGQ_wK.js → structural-rollout-xXWwKM4G.js} +3 -3
  44. package/dist/{structural-rollout-BylGQ_wK.js.map → structural-rollout-xXWwKM4G.js.map} +1 -1
  45. package/dist/{supervise-BfT708zt.js → supervise-BO9acmsB.js} +35 -32
  46. package/dist/supervise-BO9acmsB.js.map +1 -0
  47. package/dist/{supervision-discovery-C2Tjw6LX.js → supervision-discovery-CcTLSYff.js} +2 -2
  48. package/dist/{supervision-discovery-C2Tjw6LX.js.map → supervision-discovery-CcTLSYff.js.map} +1 -1
  49. package/dist/{supervisor-BDnqTl_R.js → supervisor-BQz8lkcd.js} +59 -63
  50. package/dist/supervisor-BQz8lkcd.js.map +1 -0
  51. package/dist/testing.d.ts +1 -1
  52. package/dist/testing.js +11 -11
  53. package/dist/{top-web-Ms-SgnGN.js → top-web-D-QEIh-x.js} +13 -6
  54. package/dist/{top-web-Ms-SgnGN.js.map → top-web-D-QEIh-x.js.map} +1 -1
  55. package/dist/tui/bin.js +3 -3
  56. package/dist/tui/index.d.ts +1 -1
  57. package/dist/tui/index.js +2 -2
  58. package/dist/{types-CQviVtZC.d.ts → types-CRCOBzGj.d.ts} +15581 -15578
  59. package/package.json +2 -2
  60. package/dist/scope-BGWRFiYt.js.map +0 -1
  61. package/dist/supervise-BfT708zt.js.map +0 -1
  62. package/dist/supervisor-BDnqTl_R.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { $i as awaitAbortable, $r as DISPATCH_NOT_ADMITTED_CODE, A as nestedScopeSeamKey, An as workerTraceEnv, Ar as recordRuntimeOwnedProviderDispatchNotStarted, Bi as createSandboxUsageLedger, Br as unknownMaterializationReceipt, Bt as retainedOwnerWorkspaceRetentionSeamKey, Cn as nativeCopyDelayMs, Cr as inheritRuntimeOwnedExecutorAttestation, Er as newExecutionAttemptId, Fr as runtimeOwnedExecutorMaterialization, Gi as sandboxEventServedBackend, Hi as isSandboxTerminalEvent, Hr as executableAgentSpecSnapshot, Ii as extractTransportEventIdentity, Jt as nestedDriverTreeRoot, Ki as sandboxTerminalUsageField, Kr as reportedFailureCause, Kt as attestNestedDriverTreeOwner, Li as assertSandboxServedModel, Lt as scopeRetainedOwnerCheckpointing, Mi as sandboxOutputMarker, Mr as recordRuntimeOwnedProviderModel, Ni as sandboxProgressEvents, Nn as mergeTraceEnv, Oi as createSandboxToolPartState, On as resolveWorkerSlots, Pr as runtimeOwnedExecutorExecutionBinding, Q as assertRecursiveReservationPolicy, Qi as assertEventBinding, Qn as harnessTranscriptUnavailable, Qr as DISPATCH_EXECUTION_CHANGED_CODE, Qt as closesCursorSlot, R as appendSpawnEvents, Ri as canonicalSandboxUsageMode, Rr as runtimeOwnedScopeOwnerRuntime, Si as createBudgetPool, Sn as captureProviderWorkspaceSnapshot, Sr as finalizeRuntimeOwnedPendingExecutor, T as sumSpendFromEvents, Tn as workspaceCaptureReceipt, Tr as knownMaterializationReceipt, Ui as notifySandboxEventObserver, Ut as loadSpawnForest, V as finalizeScopeOwnerMaterialization, Vr as executableAgentProfileSnapshot, Wi as sameModelId, Wt as ownedTreeRootSpawn, X as reenteredWorkers, Xi as recordValue, Xr as runtimeProviderCode, Xt as encodeResultBlob, Yi as parseCodexUsageRecord, Yn as captureHarnessTranscript, Yr as runtimeFailureRemediationSchema, Zi as RetainedRunProviderContractError, Zn as harnessTranscriptFromLines, Zt as SpawnEventIndex, _i as contentRef, _r as attestRuntimeOwnedExecutor, _t as startScopeRecoveries, aa as abortReason, ai as retainedExecutorContext, an as reconnectRetainedRun, at as hasRetriableTeardowns, bi as credentialCommandExit, bn as assertProviderWorkspaceRetentionPort, ci as UNAVAILABLE_STATUSES, di as unavailablePauseMs, dt as registerNestedTeardownScope, ea as exactSession, ei as RetainedExecutionPendingError, en as verifyWorkspaceMarker, ft as releaseHeldEnvironments, gi as contentAddress, gr as attestRuntimeOwnedDeferredExecutor, gt as settleManagerWork, hr as subscriptionUsageLimitSignal, ht as retryUnconfirmedTeardowns, ia as RunCancellationReason, in as mintRetainedIdentity, ir as retainHarnessTranscript, it as closeScopeAdmission, ji as sandboxLeafOutputFromEvents, jn as workerTraceHeaders, jr as recordRuntimeOwnedProviderIdentityConflict, jt as scopeRetainedOwnerSettled, kn as WORKER_TRACE_PROPAGATION, kr as recordRuntimeOwnedProviderAttemptStart, lr as isLiveNodeStatus, mt as releaseRetainedEnvironments, na as isTerminalSessionStatus, ni as isProvisioningRefusal, nn as stopRetainedNativeExecution, oa as linkAbort, oi as retainedExecutorSeamKey, on as recoverRetainedRun, or as createActivityLog, pi as unavailableSignalOfFailure, pt as releaseManagerEnvironment, qn as HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS, qr as runtimeFailureCause, qt as driverRuntime, ra as sameControlCoordinates, ri as isSchemaRejection, rn as assertRetainedRunReplayMaterial, rt as closeRetainedSlots, sa as runAbortable, si as UNAVAILABLE_CODES, sn as startRetainedRun, sr as describeToolArgs, t as createScope, ta as freezeControlRef, ti as TRANSPORT_ERROR_CODES, tn as describeRetainedNativeStops, ua as promptOptionsFromAgentTurnInput, vn as environmentGone, vr as attestRuntimeOwnedPendingExecutor, vt as unconfirmedTeardowns, w as prepareScopeResume, wn as openNativeMirror, wr as knownExecutionBindingReceipt, xi as isCredentialRefusal, xn as captureProviderLiveWorkspace, yi as hashJson, yt as waitForScopeChildren, zi as createSandboxTurnEventCollector, zr as unknownExecutionBindingReceipt } from "./scope-BGWRFiYt.js";
1
+ import { $i as awaitAbortable, $r as DISPATCH_NOT_ADMITTED_CODE, A as nestedScopeSeamKey, An as workerTraceEnv, Ar as recordRuntimeOwnedProviderDispatchNotStarted, Bi as createSandboxUsageLedger, Br as unknownMaterializationReceipt, Bt as retainedOwnerWorkspaceRetentionSeamKey, Cn as nativeCopyDelayMs, Cr as inheritRuntimeOwnedExecutorAttestation, Er as newExecutionAttemptId, Fr as runtimeOwnedExecutorMaterialization, Gi as sandboxEventServedBackend, Hi as isSandboxTerminalEvent, Hr as executableAgentSpecSnapshot, Ii as extractTransportEventIdentity, Jt as nestedDriverTreeRoot, Ki as sandboxTerminalUsageField, Kr as reportedFailureCause, Kt as attestNestedDriverTreeOwner, Li as assertSandboxServedModel, Lt as scopeRetainedOwnerCheckpointing, Mi as sandboxOutputMarker, Mr as recordRuntimeOwnedProviderModel, Ni as sandboxProgressEvents, Nn as mergeTraceEnv, Oi as createSandboxToolPartState, On as resolveWorkerSlots, Pr as runtimeOwnedExecutorExecutionBinding, Q as assertRecursiveReservationPolicy, Qi as assertEventBinding, Qn as harnessTranscriptUnavailable, Qr as DISPATCH_EXECUTION_CHANGED_CODE, Qt as closesCursorSlot, R as appendSpawnEvents, Ri as canonicalSandboxUsageMode, Rr as runtimeOwnedScopeOwnerRuntime, Si as createBudgetPool, Sn as captureProviderWorkspaceSnapshot, Sr as finalizeRuntimeOwnedPendingExecutor, T as sumSpendFromEvents, Tn as workspaceCaptureReceipt, Tr as knownMaterializationReceipt, Ui as notifySandboxEventObserver, Ut as loadSpawnForest, V as finalizeScopeOwnerMaterialization, Vr as executableAgentProfileSnapshot, Wi as sameModelId, Wt as ownedTreeRootSpawn, X as reenteredWorkers, Xi as recordValue, Xr as runtimeProviderCode, Xt as encodeResultBlob, Yi as parseCodexUsageRecord, Yn as captureHarnessTranscript, Yr as runtimeFailureRemediationSchema, Zi as RetainedRunProviderContractError, Zn as harnessTranscriptFromLines, Zt as SpawnEventIndex, _i as contentRef, _r as attestRuntimeOwnedExecutor, _t as startScopeRecoveries, aa as abortReason, ai as retainedExecutorContext, an as reconnectRetainedRun, at as hasRetriableTeardowns, bi as credentialCommandExit, bn as assertProviderWorkspaceRetentionPort, ci as UNAVAILABLE_STATUSES, di as unavailablePauseMs, dt as registerNestedTeardownScope, ea as exactSession, ei as RetainedExecutionPendingError, en as verifyWorkspaceMarker, ft as releaseHeldEnvironments, gi as contentAddress, gr as attestRuntimeOwnedDeferredExecutor, gt as settleManagerWork, hr as subscriptionUsageLimitSignal, ht as retryUnconfirmedTeardowns, ia as RunCancellationReason, in as mintRetainedIdentity, ir as retainHarnessTranscript, it as closeScopeAdmission, ji as sandboxLeafOutputFromEvents, jn as workerTraceHeaders, jr as recordRuntimeOwnedProviderIdentityConflict, jt as scopeRetainedOwnerSettled, kn as WORKER_TRACE_PROPAGATION, kr as recordRuntimeOwnedProviderAttemptStart, lr as isLiveNodeStatus, mt as releaseRetainedEnvironments, na as isTerminalSessionStatus, ni as isProvisioningRefusal, nn as stopRetainedNativeExecution, oa as linkAbort, oi as retainedExecutorSeamKey, on as recoverRetainedRun, or as createActivityLog, pi as unavailableSignalOfFailure, pt as releaseManagerEnvironment, qn as HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS, qr as runtimeFailureCause, qt as driverRuntime, ra as sameControlCoordinates, ri as isSchemaRejection, rn as assertRetainedRunReplayMaterial, rt as closeRetainedSlots, sa as runAbortable, si as UNAVAILABLE_CODES, sn as startRetainedRun, sr as describeToolArgs, t as createScope, ta as freezeControlRef, ti as TRANSPORT_ERROR_CODES, tn as describeRetainedNativeStops, ua as promptOptionsFromAgentTurnInput, vn as environmentGone, vr as attestRuntimeOwnedPendingExecutor, vt as unconfirmedTeardowns, w as prepareScopeResume, wn as openNativeMirror, wr as knownExecutionBindingReceipt, xi as isCredentialRefusal, xn as captureProviderLiveWorkspace, yi as hashJson, yt as waitForScopeChildren, zi as createSandboxTurnEventCollector, zr as unknownExecutionBindingReceipt } from "./scope-D04GkJ6P.js";
2
2
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError } from "./errors-AzSuGI23.js";
3
3
  import { $ as isAsyncIterable, J as deleteBoxSafe, Ot as teardownSurfaces, Q as isAbortError, St as armDeadlineTimer, Tt as isDeadlineAbortReason, U as addSpend, V as hasControlCharacter, W as addTokenUsage, Y as errorMessage, _t as ACCEPTED_RESULT_GRACE_MS, at as sleep, ct as throwIfAborted, dt as zeroSpend, et as mapWithConcurrency, ft as zeroTokenUsage, gt as withBudgetResources, it as roundBoxMinutes, lt as unmeteredSpend, nt as randomSuffix, ot as stringifySafe, pt as addResourceSpend, q as cloneTokenUsage, rt as randomUuid, st as throwAbort, tt as promptCacheTokenClasses, ut as withTimeout, xt as ROOT_DEADLINE_REASON } from "./workspace-streams-8ALHaZzx.js";
4
4
  import { t as runTaskQueue } from "./task-queue-DbpZAp6C.js";
@@ -5587,12 +5587,11 @@ function causedByPartialFailure(error) {
5587
5587
  return causeChain(error).some((cause) => cause instanceof Error && errorProperty(cause, "name") === "PartialFailureError");
5588
5588
  }
5589
5589
  /**
5590
- * The pending invocation a failure left, when abandoning it is the resolution: the provider
5591
- * answered and could not resolve the execution (`unobservable`), or a nested manager's recovery
5592
- * could not be rebuilt (`nested-recovery`). A lost transport waits for the provider instead, in
5593
- * the outage window: abandoning during a provider outage would start a second execution beside
5594
- * one that may still run. A request refused before it ran has nothing to abandon: a capacity
5595
- * refusal pauses and any other refusal is terminal. A contract violation stays terminal (#1204).
5590
+ * The pending invocation a failure left, when abandoning it is the resolution: the provider could
5591
+ * not resolve the execution (`unobservable`), or a nested manager's recovery could not be rebuilt
5592
+ * (`nested-recovery`). A lost transport waits in the outage window instead, and a capacity refusal
5593
+ * pauses, so neither starts a second execution beside one that may still run. A request refused
5594
+ * before it ran has nothing to abandon. A contract violation stays terminal (#1204).
5596
5595
  */
5597
5596
  function abandonablePending(error) {
5598
5597
  return error instanceof RetainedExecutionPendingError && (error.pendingCause === "unobservable" || error.pendingCause === "nested-recovery") ? error : void 0;
@@ -5621,10 +5620,8 @@ const isContentFilterRefusal = (error) => causeChain(error).some((cause) => caus
5621
5620
  /**
5622
5621
  * A driver's harness turn ran to its terminal result, and that result reported failure.
5623
5622
  *
5624
- * A provider executor reports a failed turn as a returned outcome, not a thrown error, so without
5625
- * this error a failed turn reads as a completed drive and never reaches the retry decision.
5626
- * A 53-minute turn ended `status code 524`, and another ended `Invalid API key` after a platform
5627
- * key expired mid-turn. A new turn succeeds in both cases.
5623
+ * A provider executor returns a failed turn as an outcome; without this error it reads as a
5624
+ * completed drive and never reaches the retry decision (a turn ended `status code 524`).
5628
5625
  *
5629
5626
  * `errorCode` is the provider's machine code when it reported one. The classifier reads the code;
5630
5627
  * text decides only a printed capacity code and a content-filter refusal, which have none.
@@ -5680,8 +5677,8 @@ function isDispatchExecutionChanged(value) {
5680
5677
  */
5681
5678
  function upstreamUnavailableSignal(error) {
5682
5679
  if (undispatchedCredentialExit(error) !== void 0) return "credential-unavailable";
5683
- const admission = retainedAdmissionCause(error);
5684
- if (admission !== void 0) return upstreamUnavailableSignal(admission);
5680
+ const refusal = retainedAdmissionCause(error) ?? reconciliationCapacityRefusal(error);
5681
+ if (refusal !== void 0) return upstreamUnavailableSignal(refusal);
5685
5682
  if (!(error instanceof Error)) return void 0;
5686
5683
  if (isCredentialRefusal(error)) return void 0;
5687
5684
  if (isProviderSchemaRejection(error)) return void 0;
@@ -5698,11 +5695,19 @@ function upstreamUnavailableSignal(error) {
5698
5695
  return (harness ? subscriptionUsageLimitSignal(failure) : void 0) ?? unavailableSignalOfFailure(failure);
5699
5696
  }
5700
5697
  /**
5701
- * An error's own `code` field, read without trusting its getter. A provider SDK names a capacity
5702
- * refusal with the router's code when no HTTP response exists to carry a status:
5703
- * agent-provider-tangle's `TangleCredentialCapacityError` (`provider_quota_exhausted`,
5704
- * `upstream_unavailable`) when the subscription account owner has no account with room.
5698
+ * The capacity refusal an admitted execution's reconciliation met: a cause with an upstream
5699
+ * capacity code or HTTP 429. The execution is unresolved, not failed, so the driver pauses and
5700
+ * reconciles it again, never abandoning it; a contract violation stays terminal (#1204).
5701
+ * magnetar-rust-sandbox-20261102a's managers met `TangleCredentialCapacityError: HTTP 429` on
5702
+ * 1,407 reconciliations, each classed transient.
5705
5703
  */
5704
+ function reconciliationCapacityRefusal(error) {
5705
+ if (!(error instanceof RetainedExecutionPendingError) || error.phase !== "execution") return void 0;
5706
+ if (error.pendingCause !== "unobservable" && error.pendingCause !== "transport") return void 0;
5707
+ return causeChain(error.cause).find((cause) => cause instanceof Error && (UNAVAILABLE_CODES.has(ownCode(cause)?.toLowerCase() ?? "") || errorHttpStatus(cause) === 429));
5708
+ }
5709
+ /** An error's own `code` field, read without trusting its getter: agent-provider-tangle's
5710
+ * `TangleCredentialCapacityError` carries the router's code even with no HTTP status. */
5706
5711
  function ownCode(error) {
5707
5712
  try {
5708
5713
  const code = Reflect.get(error, "code");
@@ -5789,19 +5794,10 @@ function retainedAdmissionCause(error) {
5789
5794
  }
5790
5795
  }
5791
5796
  /**
5792
- * A foreign error that still carries an HTTP status is a refusal we can read.
5793
- *
5794
- * A provider SDK throws its own error classes, so an environment `create` that the platform
5795
- * refused arrives here as neither a `BackendTransportError` nor an `AgentEvalError`, and the
5796
- * default sends it to `transient`. A Tangle Sandbox create refused
5797
- * `HTTP 400 {"code":"CONFIG_ERROR"}` for a key whose budget was fully reserved retried 14-22
5798
- * times per node while the run showed a durable intent and no other event, so eleven of twelve
5799
- * roots sat for 25 minutes with nothing to diagnose. The status was on the error the whole time.
5800
- *
5801
- * Reading it applies the same rule the transport branch already promises consumers: 408 and 5xx
5802
- * are the upstream having a bad moment, and any other 4xx is a request that will fail identically
5803
- * forever. The capacity statuses were answered before this point. Anything without a plain numeric
5804
- * status keeps the historical default.
5797
+ * A foreign error's HTTP status, read by the transport branch's rule: 408 and 5xx are a bad
5798
+ * moment, any other 4xx fails identically forever. A provider SDK's own classes reach here: a
5799
+ * Sandbox create refused `HTTP 400 {"code":"CONFIG_ERROR"}` for a fully reserved key was retried
5800
+ * 14-22 times per node as transient. Capacity statuses were answered before this point.
5805
5801
  */
5806
5802
  function foreignHttpStatusVerdict(error) {
5807
5803
  if (!(error instanceof Error)) return void 0;
@@ -8807,24 +8803,21 @@ function stringValue(value) {
8807
8803
  const RETAINED_AWAITING_RESULT_AFTER_MS = 48e4;
8808
8804
  const RETAINED_STATUS_READ_MS = 6e4;
8809
8805
  const RETAINED_OBSERVATION_BATCH_EVENTS = 1024;
8810
- /**
8811
- * After its exact result, a stream that still owes its terminal frame keeps reading only while
8812
- * each frame arrives within this long of the result or the last frame.
8813
- * A provider sends a turn's last frames and its result on two connections, and a burst that
8814
- * straddles the result is read whole.
8815
- */
8806
+ /** After its exact result, a stream owing its terminal frame reads on while each frame comes this
8807
+ * soon after the result or the last frame: a provider sends the two on separate connections. */
8816
8808
  const RETAINED_TAIL_FLOW_MS = 100;
8817
8809
  /** Why the event stream stopped short, as bounded redacted text for the settlement reason. */
8818
- function observationFailureText(failure) {
8819
- const error = failure.error;
8820
- return String(defaultRedactor(error instanceof Error ? error.message : String(error))).slice(0, 2048);
8810
+ function observationFailureText({ error }) {
8811
+ const text = error instanceof Error ? error.message : String(error);
8812
+ return String(defaultRedactor(text)).slice(0, 2048);
8821
8813
  }
8822
8814
  /** A result refused `provider_quota_exhausted` is the ended run's failed result, not one to reconcile. */
8823
8815
  function exactQuotaRefusal(error) {
8824
8816
  try {
8825
8817
  const refusal = causeChain(error).find((cause) => Reflect.get(cause, "name") === "TangleCredentialCapacityError" && Reflect.get(cause, "code") === "provider_quota_exhausted");
8826
- const resetAt = refusal && Reflect.get(refusal, "resetAt");
8827
- return refusal === void 0 ? void 0 : {
8818
+ if (refusal === void 0) return void 0;
8819
+ const resetAt = Reflect.get(refusal, "resetAt");
8820
+ return {
8828
8821
  text: "",
8829
8822
  success: false,
8830
8823
  error: `Subscription account capacity is unavailable${typeof resetAt === "string" ? ` until ${resetAt}` : ""}`,
@@ -8839,8 +8832,10 @@ function exactQuotaRefusal(error) {
8839
8832
  var RetainedObservation = class {
8840
8833
  handle;
8841
8834
  signal;
8835
+ position;
8842
8836
  failure;
8843
8837
  lastReplayPosition;
8838
+ resumedFrom;
8844
8839
  sawTerminal = false;
8845
8840
  lastObservedAt = 0;
8846
8841
  silenceHandledAt;
@@ -8849,21 +8844,25 @@ var RetainedObservation = class {
8849
8844
  observedFrames = 0;
8850
8845
  framesAfterResult = 0;
8851
8846
  exactWakers = /* @__PURE__ */ new Set();
8852
- exactWatched = false;
8853
8847
  seenEvents = /* @__PURE__ */ new Map();
8854
8848
  pendingRead;
8855
- constructor(handle, signal) {
8849
+ constructor(handle, signal, position) {
8856
8850
  this.handle = handle;
8857
8851
  this.signal = signal;
8852
+ this.position = position;
8853
+ const observed = position?.observed;
8854
+ if (observed?.executionId === handle.controlRef.executionId) this.lastReplayPosition = this.resumedFrom = observed.replayPosition;
8858
8855
  }
8859
8856
  /** Stream the provider's frames, resume once after a break, then yield the exact result. */
8860
8857
  async *observe(session) {
8861
8858
  this.lastObservedAt = Date.now();
8862
- if (!(yield* this.drain(session)) && !this.sawTerminal && this.lastReplayPosition !== void 0) {
8859
+ if (!(yield* this.drain(session, this.resumedFrom)) && !this.sawTerminal && this.lastReplayPosition !== void 0) {
8863
8860
  const firstFailure = this.failure;
8864
8861
  this.failure = void 0;
8865
8862
  if (!(yield* this.drain(session, this.lastReplayPosition))) this.failure = firstFailure;
8866
8863
  }
8864
+ const resumed = this.resumedFrom && `retained provider stream resumed after ${this.resumedFrom}`;
8865
+ if (resumed) this.failure ??= { error: new Error(resumed) };
8867
8866
  if (!this.sawTerminal && this.failure === void 0) this.failure = { error: /* @__PURE__ */ new Error("retained provider stream did not yield a terminal event") };
8868
8867
  if (!this.sawTerminal && !this.exactResultSettled && this.silenceHandledAt === void 0) yield this.awaitingResult(Date.now());
8869
8868
  while (!await this.exactOrQuiet()) await this.confirmRunLive(session);
@@ -8940,6 +8939,7 @@ var RetainedObservation = class {
8940
8939
  const settle = () => {
8941
8940
  if (this.observedFrames === 0) this.lastObservedAt = Date.now();
8942
8941
  this.exactResultSettled = true;
8942
+ for (const wake of [...this.exactWakers]) wake();
8943
8943
  };
8944
8944
  this.exactResult.then(settle, settle);
8945
8945
  }
@@ -8951,16 +8951,8 @@ var RetainedObservation = class {
8951
8951
  return () => {};
8952
8952
  }
8953
8953
  this.exactWakers.add(waker);
8954
- if (!this.exactWatched) {
8955
- this.exactWatched = true;
8956
- const fire = () => {
8957
- for (const wake of [...this.exactWakers]) wake();
8958
- };
8959
- this.readExactResult().then(fire, fire);
8960
- }
8961
- return () => {
8962
- this.exactWakers.delete(waker);
8963
- };
8954
+ this.readExactResult();
8955
+ return () => this.exactWakers.delete(waker);
8964
8956
  }
8965
8957
  awaitingResult(since) {
8966
8958
  this.silenceHandledAt = Date.now();
@@ -8977,10 +8969,7 @@ var RetainedObservation = class {
8977
8969
  wake = setImmediate(() => {
8978
8970
  const close = () => {
8979
8971
  const flowing = this.sawTerminal ? 0 : RETAINED_TAIL_FLOW_MS - (Date.now() - this.lastObservedAt);
8980
- if (flowing <= 0) {
8981
- resolve({ kind: "exact-result" });
8982
- return;
8983
- }
8972
+ if (flowing <= 0) return resolve({ kind: "exact-result" });
8984
8973
  grace = setTimeout(() => {
8985
8974
  wake = setImmediate(() => resolve({ kind: "exact-result" }));
8986
8975
  }, flowing);
@@ -9037,8 +9026,15 @@ var RetainedObservation = class {
9037
9026
  this.seenEvents.set(eventId, digest);
9038
9027
  }
9039
9028
  this.lastObservedAt = Date.now();
9040
- if (identity.cursor !== void 0) this.lastReplayPosition = identity.cursor;
9041
- else if (eventId !== void 0) this.lastReplayPosition = eventId;
9029
+ const replayPosition = identity.cursor ?? eventId;
9030
+ if (replayPosition !== void 0) {
9031
+ this.lastReplayPosition = replayPosition;
9032
+ const { executionId } = this.handle.controlRef;
9033
+ this.position?.onObserved?.({
9034
+ executionId,
9035
+ replayPosition
9036
+ });
9037
+ }
9042
9038
  if (isTerminalEnvironmentEvent(event)) this.sawTerminal = true;
9043
9039
  this.readExactResult();
9044
9040
  return true;
@@ -9065,7 +9061,7 @@ var RetainedObservation = class {
9065
9061
  this.failure ??= { error: /* @__PURE__ */ new Error(`retained provider stream sent ${RETAINED_OBSERVATION_BATCH_EVENTS} frames after its exact result; the rest were not read`) };
9066
9062
  break;
9067
9063
  }
9068
- if (this.observedFrames > 0 && this.observedFrames % RETAINED_OBSERVATION_BATCH_EVENTS === 0) await awaitAbortable(new Promise((resolve) => setImmediate(resolve)), this.signal);
9064
+ if (this.observedFrames % RETAINED_OBSERVATION_BATCH_EVENTS === 0 && this.observedFrames) await awaitAbortable(new Promise((resolve) => setImmediate(resolve)), this.signal);
9069
9065
  let observed;
9070
9066
  try {
9071
9067
  observed = await this.raceNextRead(iterator);
@@ -9311,7 +9307,7 @@ async function retainedExecution(args, retention, turn, selectedTurn, signal) {
9311
9307
  const session = exactSession(environment, handle.controlRef).session;
9312
9308
  return {
9313
9309
  environment,
9314
- events: new RetainedObservation(handle, signal).observe(session),
9310
+ events: new RetainedObservation(handle, signal, retention).observe(session),
9315
9311
  retained: true
9316
9312
  };
9317
9313
  } catch (error) {
@@ -17552,4 +17548,4 @@ async function noWinner(settled, rejection) {
17552
17548
  }
17553
17549
  export { DEFAULT_PEER_MAIL_LIMITS as $, promptModelProfileMaterialization as $t, createSandboxForSpec as A, bridgeModelRouteRefusal as At, createRouterTranscript as B, defaultRunCommand as Bt, createExecutor as C, admitContinuationPolicy as Ct, runAgentRounds as D, failedItems as Dt, createSteerableSandboxSession as E, createContinuationKeeper as Et, codeModeArguments as F, harnessUsageIsEmpty as Ft, LEAF_CONTINUATION_TASK as G, terminateProcessTreeAndConfirm as Gt, createAgentEnvironmentProviderRegistry as H, runWorktreeHarness as Ht, codeModeModelOutput as I, readCodexRolloutSession as It, createInPlaceCliExecutor as J, controlProfileMaterialization as Jt, providerAsSandboxClient as K, assertProfileMaterialization as Kt, createCodeModeTools as L, createPushTraceSource as Lt, acquireSandbox as M, ROUTER_PRICE_SOURCE as Mt, TERMINAL_DECISIONS as N, addHarnessUsage as Nt, assertBoxlessPromptOptions as O, isFiniteNumber as Ot, defaultSelectWinner as P, createCodexRolloutStoreReader as Pt, AUTHORITY_MARKERS as Q, promptControlProfileMaterialization as Qt, runCodeMode as R, bridgeRuntimeAttachmentsKey as Rt, captureReusableExecutorConfig as S, CONTINUATIONS_DIR as St, DEFAULT_SANDBOX_STEERING_MAX_TURNS as T, checkVerdictOf as Tt, resolveAgentEnvironmentProvider as U, LOCAL_HARNESSES as Ut, routerBrain as V, runSettledCommand as Vt, providerAsExecutor as W, harnessInvocation as Wt, createInbox as X, fullProfileMaterialization as Xt, INBOX_RECEIPT_KEY as Y, defineProfileMaterializationContract as Yt, failPendingAfter as Z, profileMaterializationAxes$1 as Zt, withDriverExecutor as _, CheckUnavailableError as _t, assertRunParking as a, projectSandboxOutcome as an, peerMailVerbNames as at, createExecutorRegistry as b, mapExecutorResult as bt, sleepScopeWait as c, HarnessTurnFailedError as ct, runFinalizer as d, classifyDriverFailure as dt, renderUnsupported as en, PEER_MAIL_WIRE_KEY as et, runTree as f, isContentFilterRefusal as ft, isDriverSpec as g, preflightPublicCoordination as gt, driverExecutorFactory as h, upstreamUnavailableSignal as ht, RunParkedError as i, worktreeCliProfileMaterialization as in, peerMailTools as it, createSandboxLineage as j, priceTokens as jt, readPromptOptions as k, bridgeAdmissionRefusal as kt, withRunParking as l, abandonablePending as lt, driverChild as m, undispatchedCredentialExit as mt, createSupervisor as n, sandboxProfileMaterialization as nn, createPeerMailbox as nt, bindScopeParkingDrain as o, readSandboxOutcome as on, taskToPrompt$1 as ot, createRootHandle as p, summarizeDriverAttempts as pt, createWorktreeCliExecutor as q, assertProfileMaterializes as qt, assertResumeLimits as r, unsupportedProfileDimensions as rn, isPeerMailEnvelope as rt, readRunParking as s, DriverAttemptsExhaustedError as st, DEFAULT_MAX_DEPTH as t, sandboxActProfileMaterialization as tn, claimsAuthority as tt, bestDelivered as u, causedByPartialFailure as ut, InMemoryResultBlobStore as v, gateFactoryOnDeliverable as vt, snapshotExecutorConfig as w, bestComposite as wt, bindReusableExecutorExecutionId as x, verdictFromJudgeScore as xt, InMemorySpawnJournal as y, gateOnDeliverable as yt, toolResultText as z, bridgeStopSignalKey as zt };
17554
17550
 
17555
- //# sourceMappingURL=supervisor-BDnqTl_R.js.map
17551
+ //# sourceMappingURL=supervisor-BQz8lkcd.js.map