@tangle-network/agent-runtime 0.299.1 → 0.299.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-tUsWG3uJ.d.ts → activation-Bhp8dYV5.d.ts} +3 -3
  2. package/dist/{activation-hR2jeUaw.js → activation-DqWmWTyB.js} +2 -2
  3. package/dist/{activation-hR2jeUaw.js.map → activation-DqWmWTyB.js.map} +1 -1
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-DQqNlHNU.js → coordination-driver-DzTvehd6.js} +2 -2
  7. package/dist/{coordination-driver-DQqNlHNU.js.map → coordination-driver-DzTvehd6.js.map} +1 -1
  8. package/dist/{delegate-B2ux581r.js → delegate-qNq_wnQo.js} +2 -2
  9. package/dist/{delegate-B2ux581r.js.map → delegate-qNq_wnQo.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-CrK93Avw.js → graph-DN0lm24q.js} +4 -4
  13. package/dist/{graph-CrK93Avw.js.map → graph-DN0lm24q.js.map} +1 -1
  14. package/dist/{improvement-cycle-oKjGSbFV.js → improvement-cycle-D6cPLi6k.js} +3 -3
  15. package/dist/{improvement-cycle-oKjGSbFV.js.map → improvement-cycle-D6cPLi6k.js.map} +1 -1
  16. package/dist/{index-BXzfhVpx.d.ts → index-DonXCBsy.d.ts} +6 -4
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.d.ts +3 -3
  20. package/dist/intelligence.js +4 -4
  21. package/dist/kernel.d.ts +3 -3
  22. package/dist/kernel.js +8 -8
  23. package/dist/{loop-runner-bin-Cs0G7h8L.d.ts → loop-runner-bin-63H4stv1.d.ts} +3 -3
  24. package/dist/{loop-runner-bin-Du_SBPxW.js → loop-runner-bin-DKfdYEK-.js} +3 -3
  25. package/dist/{loop-runner-bin-Du_SBPxW.js.map → loop-runner-bin-DKfdYEK-.js.map} +1 -1
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +5 -5
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{openai-tools-JmKXlSR4.d.ts → openai-tools-DvR82zEo.d.ts} +2 -2
  32. package/dist/profiles.d.ts +2 -2
  33. package/dist/{provision-supervisor-vDXQxYFy.js → provision-supervisor-IXBlLHE0.js} +3 -3
  34. package/dist/{provision-supervisor-vDXQxYFy.js.map → provision-supervisor-IXBlLHE0.js.map} +1 -1
  35. package/dist/{runtime-CyQ8CLJf.js → runtime-CZR5n7Zy.js} +8 -8
  36. package/dist/{runtime-CyQ8CLJf.js.map → runtime-CZR5n7Zy.js.map} +1 -1
  37. package/dist/{search-method-BIhLTuQB.js → search-method-DvU-fc-f.js} +2 -2
  38. package/dist/{search-method-BIhLTuQB.js.map → search-method-DvU-fc-f.js.map} +1 -1
  39. package/dist/{server-BO0N9O7o.js → server-CSSopQyk.js} +3 -3
  40. package/dist/{server-BO0N9O7o.js.map → server-CSSopQyk.js.map} +1 -1
  41. package/dist/{stream-agent-turn-B9RXK3fv.d.ts → stream-agent-turn-I3bb0eqF.d.ts} +2 -2
  42. package/dist/{substrate-CLCPNwHP.d.ts → substrate-UjsxukjZ.d.ts} +2 -2
  43. package/dist/{supervise-CvPBOHpa.js → supervise-Bu2rNYsK.js} +11 -4
  44. package/dist/supervise-Bu2rNYsK.js.map +1 -0
  45. package/dist/{supervisor-DPXXMNZK.js → supervisor-CQSu5XGl.js} +105 -18
  46. package/dist/supervisor-CQSu5XGl.js.map +1 -0
  47. package/dist/testing.d.ts +2 -2
  48. package/dist/testing.js +12 -12
  49. package/dist/tui/index.d.ts +1 -1
  50. package/dist/tui/index.js +1 -1
  51. package/dist/{types-DLM0wytK.d.ts → types-C73caP0U.d.ts} +28 -6
  52. package/package.json +1 -1
  53. package/dist/supervise-CvPBOHpa.js.map +0 -1
  54. package/dist/supervisor-DPXXMNZK.js.map +0 -1
@@ -6437,6 +6437,27 @@ function harnessTranscriptUnavailable(reason) {
6437
6437
  * Mirrors the supervise scope's `readInteractiveSession`: an absence is always a named reason,
6438
6438
  * never `undefined`. The scope reads each child with it, and `supervise` reads the root with it.
6439
6439
  */
6440
+ /**
6441
+ * The longest a settle waits for an executor's final transcript. The provider executor's own
6442
+ * steps are bounded (the harness stop at 30 s, each native copy by its port's `nativeTimeoutMs`,
6443
+ * 120 s by default), so this guards only an executor that never answers.
6444
+ */
6445
+ const HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS = 6 * 6e4;
6446
+ /**
6447
+ * Wait, bounded, until the executor's transcript is final (`Executor.harnessTranscriptSettled`).
6448
+ * Never throws: on a timeout or a failure the read that follows reports what was kept.
6449
+ */
6450
+ async function settleHarnessTranscript(executor, timeoutMs = HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS) {
6451
+ if (!executor.harnessTranscriptSettled) return;
6452
+ let timer;
6453
+ try {
6454
+ await Promise.race([Promise.resolve().then(() => executor.harnessTranscriptSettled?.()), new Promise((resolve) => {
6455
+ timer = setTimeout(resolve, timeoutMs);
6456
+ })]);
6457
+ } catch {} finally {
6458
+ if (timer !== void 0) clearTimeout(timer);
6459
+ }
6460
+ }
6440
6461
  function readHarnessTranscript(executor) {
6441
6462
  if (!executor.harnessTranscript) return harnessTranscriptUnavailable("executor-exposes-no-transcript");
6442
6463
  let reported;
@@ -11012,9 +11033,20 @@ const DEFAULT_MAX_UNAVAILABLE_PAUSE_MS = 3e5;
11012
11033
  * continues in its environment, so an outage costs both the same number of turns.
11013
11034
  */
11014
11035
  function unavailablePauseMs(consecutive, policy = {}) {
11015
- const first = Math.max(0, policy.unavailablePauseMs ?? DEFAULT_UNAVAILABLE_PAUSE_MS);
11016
- const ceiling = Math.max(first, policy.maxUnavailablePauseMs ?? DEFAULT_MAX_UNAVAILABLE_PAUSE_MS);
11017
- return Math.min(ceiling, first * 2 ** Math.max(0, consecutive - 1));
11036
+ return cappedDoublingMs(consecutive, policy.unavailablePauseMs ?? DEFAULT_UNAVAILABLE_PAUSE_MS, policy.maxUnavailablePauseMs ?? DEFAULT_MAX_UNAVAILABLE_PAUSE_MS);
11037
+ }
11038
+ /** `first` doubled per earlier consecutive wait (`consecutive` is 1-based), up to `ceiling`. */
11039
+ function cappedDoublingMs(consecutive, first, ceiling) {
11040
+ const start = Math.max(0, first);
11041
+ return Math.min(Math.max(start, ceiling), start * 2 ** Math.max(0, consecutive - 1));
11042
+ }
11043
+ /**
11044
+ * Spread a wait over `[ms / 2, ms]`. Every driver a Platform restart cut off fails within the same
11045
+ * seconds; without jitter their doubling schedules stay aligned and they all re-enter together
11046
+ * when the service returns. `random` returns a value in `[0, 1)`; 0 keeps the full wait.
11047
+ */
11048
+ function jitteredMs(ms, random) {
11049
+ return ms - Math.floor(ms / 2 * Math.min(1, Math.max(0, random())));
11018
11050
  }
11019
11051
  //#endregion
11020
11052
  //#region src/runtime/supervise/workspace-checkpoint.ts
@@ -11273,6 +11305,9 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11273
11305
  let providerSessionId = null;
11274
11306
  let workspaceControlRef;
11275
11307
  let nativeStop;
11308
+ let harnessStopped = false;
11309
+ let transcriptSettled = Promise.resolve();
11310
+ let settleTranscript = () => {};
11276
11311
  let runSignal;
11277
11312
  const cancelledExplicitly = () => ctx.signal?.reason instanceof RunCancellationReason || runSignal?.reason instanceof RunCancellationReason;
11278
11313
  const runtime = options.runtime ?? provider.name;
@@ -11393,7 +11428,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11393
11428
  nativeTimer = void 0;
11394
11429
  await nativeInFlight;
11395
11430
  };
11396
- const captureNative = (next, phase, admitted) => {
11431
+ const captureNative = (next, phase, admitted, afterStop = false) => {
11397
11432
  if (nativePort === void 0 || createProfile.harness === void 0) return Promise.resolve();
11398
11433
  const harness = createProfile.harness;
11399
11434
  const tracked = (nativeInFlight ?? Promise.resolve()).then(async () => {
@@ -11402,7 +11437,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11402
11437
  if (workspaceSnapshot !== void 0 && !nativeHoldsTranscript) return;
11403
11438
  const invocationId = workspaceExecutionId;
11404
11439
  try {
11405
- const captured = await captureProviderWorkspaceSnapshot(nativePort, {
11440
+ const takeCopy = () => captureProviderWorkspaceSnapshot(nativePort, {
11406
11441
  environment: next,
11407
11442
  executionId: invocationId,
11408
11443
  ...controlRef === void 0 ? {} : { controlRef },
@@ -11412,6 +11447,12 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11412
11447
  profile: createProfile,
11413
11448
  phase
11414
11449
  }, "native");
11450
+ let captured = await takeCopy();
11451
+ const settleBy = Date.now() + NATIVE_SETTLE_WINDOW_MS;
11452
+ while (afterStop && captured.coverageComplete !== true && (captured.provenance.attempts ?? []).some((attempt) => attempt.outcome === "unknown") && Date.now() < settleBy) {
11453
+ await sleep(NATIVE_SETTLE_POLL_MS);
11454
+ captured = await takeCopy();
11455
+ }
11415
11456
  if (workspaceSnapshot !== void 0 && !nativeHoldsTranscript) return;
11416
11457
  const copy = retainHarnessTranscript(providerWorkspaceCaptureReceipt({
11417
11458
  executionId: invocationId,
@@ -11450,7 +11491,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11450
11491
  const finishNativeMirror = async (next, phase) => {
11451
11492
  await stopNativeMirror();
11452
11493
  if (workspaceSnapshot !== void 0 && !nativeHoldsTranscript) return;
11453
- await captureNative(next, phase);
11494
+ await captureNative(next, phase, void 0, harnessStopped);
11454
11495
  };
11455
11496
  const destroyEnvironment = async (cleanupSignal) => {
11456
11497
  if (workspaceCleanupPromise !== void 0) return await workspaceCleanupPromise;
@@ -11524,7 +11565,8 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11524
11565
  ...retained === void 0 ? {} : { handle: retained },
11525
11566
  signal: AbortSignal.timeout(NATIVE_STOP_TIMEOUT_MS)
11526
11567
  }).then((stop) => {
11527
- if (stop.effect !== "cancelled" && stop.effect !== "not_live" && nativeStop === stopping) nativeStop = void 0;
11568
+ if (stop.effect === "cancelled" || stop.effect === "not_live") harnessStopped = true;
11569
+ else if (nativeStop === stopping) nativeStop = void 0;
11528
11570
  return stop;
11529
11571
  });
11530
11572
  nativeStop = stopping;
@@ -11616,6 +11658,10 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11616
11658
  beginWorkspaceExecution();
11617
11659
  const linked = linkAbort(ctx.signal, signal, controller.signal);
11618
11660
  runSignal = linked.signal;
11661
+ harnessStopped = false;
11662
+ transcriptSettled = new Promise((resolve) => {
11663
+ settleTranscript = resolve;
11664
+ });
11619
11665
  try {
11620
11666
  const executionStartedAt = Date.now() - (retention?.priorSpent?.ms ?? 0);
11621
11667
  let invocation = {
@@ -11683,6 +11729,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11683
11729
  onHarnessTranscript: (next) => {
11684
11730
  harnessTranscript = next;
11685
11731
  },
11732
+ onTranscriptSettled: () => settleTranscript(),
11686
11733
  onUnsettledFailure: () => {
11687
11734
  workspacePreservationRequired = true;
11688
11735
  },
@@ -11730,6 +11777,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11730
11777
  } finally {
11731
11778
  linked.release();
11732
11779
  workspaceRunActive = false;
11780
+ settleTranscript();
11733
11781
  }
11734
11782
  };
11735
11783
  executor = {
@@ -11767,7 +11815,7 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11767
11815
  if (pending && cancelledExplicitly()) stopNativeExecution();
11768
11816
  if (options.workspaceRetention !== void 0 && workspaceRunActive) return {
11769
11817
  destroyed: false,
11770
- detail: "provider workspace retention: source preserved while the execution is still active"
11818
+ detail: harnessStopped ? "provider workspace retention: source preserved while the stopped execution writes its failure capture" : "provider workspace retention: source preserved while the execution is still active"
11771
11819
  };
11772
11820
  if (pending) return {
11773
11821
  destroyed: false,
@@ -11846,7 +11894,8 @@ function createProviderExecutor(provider, profile, ctx, options, placement) {
11846
11894
  return artifact;
11847
11895
  },
11848
11896
  traceSource: () => trace.source,
11849
- harnessTranscript: () => harnessTranscript
11897
+ harnessTranscript: () => harnessTranscript,
11898
+ harnessTranscriptSettled: () => transcriptSettled
11850
11899
  };
11851
11900
  return attestRuntimeOwnedPendingExecutor(executor, runtime, plannedDeclaration, plannedBinding);
11852
11901
  }
@@ -11856,6 +11905,9 @@ function admittedControlRef(retention) {
11856
11905
  }
11857
11906
  /** Bounds one provider stop: a reconnect, the exact cancellation and its status read. */
11858
11907
  const NATIVE_STOP_TIMEOUT_MS = 3e4;
11908
+ /** How long the final copy of a stopped harness waits for the provider to record how it ended. */
11909
+ const NATIVE_SETTLE_WINDOW_MS = 15e3;
11910
+ const NATIVE_SETTLE_POLL_MS = 1e3;
11859
11911
  /** The environment id the latest durable admission names, when creation got that far. */
11860
11912
  function admittedEnvironmentId(retention) {
11861
11913
  for (const admission of [...retention?.admissions ?? []].reverse()) {
@@ -12058,6 +12110,8 @@ async function* streamProviderExecutor(args) {
12058
12110
  ...linked.aborted ? { errorCode: "cancelled" } : {}
12059
12111
  };
12060
12112
  await stopEndedHarness();
12113
+ if (linked.aborted) await args.finishNativeMirror(environment, "failed");
12114
+ args.onTranscriptSettled();
12061
12115
  try {
12062
12116
  const retainedWorkspace = await args.captureWorkspace(environment, failureOutcome);
12063
12117
  if (retainedWorkspace !== void 0 && args.retention?.onEvidence !== void 0) await args.retention.onEvidence({
@@ -26248,6 +26302,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
26248
26302
  };
26249
26303
  } catch (cause) {
26250
26304
  let err = cause;
26305
+ await settleHarnessTranscript(executor);
26251
26306
  await closeRetainedWrites();
26252
26307
  if (live.acceptedResult !== void 0 && reconciliationError === void 0 && (isAbortError(err) || teardownFailure !== void 0 && err === teardownFailure || childAbort.signal.aborted && err === childAbort.signal.reason)) {
26253
26308
  const accepted = live.acceptedResult;
@@ -26743,6 +26798,7 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
26743
26798
  const traceSource = driver.traceSource;
26744
26799
  const progress = driver.progress;
26745
26800
  const harnessTranscript = driver.harnessTranscript?.bind(driver);
26801
+ const harnessTranscriptSettled = driver.harnessTranscriptSettled?.bind(driver);
26746
26802
  const spec = executableAgentSpecSnapshot({
26747
26803
  profile,
26748
26804
  harness: null,
@@ -26755,7 +26811,8 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
26755
26811
  ...recoverExecutor ? { recoverExecutor } : {},
26756
26812
  ...traceSource ? { traceSource } : {},
26757
26813
  ...progress ? { progress } : {},
26758
- ...harnessTranscript ? { harnessTranscript } : {}
26814
+ ...harnessTranscript ? { harnessTranscript } : {},
26815
+ ...harnessTranscriptSettled ? { harnessTranscriptSettled } : {}
26759
26816
  }, "driverChild");
26760
26817
  const deliver = driver.deliver?.bind(driver);
26761
26818
  return {
@@ -26821,6 +26878,7 @@ const driverExecutorFactory = (rawSpec, ctx) => {
26821
26878
  ...spec.traceSource ? { traceSource: spec.traceSource } : {},
26822
26879
  ...spec.progress ? { progress: spec.progress } : {},
26823
26880
  ...spec.harnessTranscript ? { harnessTranscript: spec.harnessTranscript } : {},
26881
+ ...spec.harnessTranscriptSettled ? { harnessTranscriptSettled: spec.harnessTranscriptSettled } : {},
26824
26882
  ...deliver ? { deliver(message) {
26825
26883
  return deliver(message) !== false;
26826
26884
  } } : {},
@@ -27615,8 +27673,9 @@ function createContinuationKeeper(input) {
27615
27673
  * The one loop the budget alone cannot bound is a driver that dies INSTANTLY and repeatedly — a
27616
27674
  * dead-on-arrival credential, a harness that refuses to start. Spending nothing, it would retry
27617
27675
  * until the deadline hours later. So progress is measured between attempts, and a run of attempts
27618
- * that changes nothing stops at `maxConsecutiveFailures`. A failure that made progress resets that
27619
- * counter: a long run may be rescued many times, a hopeless one gives up in seconds.
27676
+ * that changes nothing stops at `maxConsecutiveFailures` once it has outlasted the outage window
27677
+ * described below. A failure that made progress resets that counter: a long run may be rescued
27678
+ * many times, a hopeless one gives up after the window.
27620
27679
  *
27621
27680
  * WHAT COUNTS AS PROGRESS is the part this module got wrong first, and the correction is measured.
27622
27681
  * The original mark read metered spend, settled children, and an accepted submission — the
@@ -27658,11 +27717,26 @@ function createContinuationKeeper(input) {
27658
27717
  * five lead lanes ended `driver-failed` between minutes 101 and 118, after 12 to 13 attempts, while
27659
27718
  * the router answered some turns in between (one lead spent 1.7M and 3.3M input tokens on two of
27660
27719
  * them) and each run's budget and 8-hour deadline were almost untouched.
27720
+ *
27721
+ * A TRANSIENT failure that spent nothing, settled nothing, and made no progress is an
27722
+ * infrastructure outage until its streak has lasted `transientOutageMs`: nothing ran, so nothing
27723
+ * is being burned. Within that window it consumes neither `maxAttempts` nor the barren streak,
27724
+ * exactly like a pause, and only the deadline, the budget, and cancellation bound it. After the
27725
+ * window the failure bounds apply again, so a dead-on-arrival driver still stops, in minutes
27726
+ * rather than hours. A failure that spent tokens without delivering keeps the bounds above,
27727
+ * because that is the burn the progress rule exists to stop. Measured 2026-10-04 on Discovery run research-nqs-20261003system2: a Platform
27728
+ * restart answered `HTTP 502 ... Platform key verification unavailable` from 03:04:34 to 03:09:41Z,
27729
+ * and the coordinator's twelve attempts ran out at 03:07:12Z with no token spent, while a sibling
27730
+ * that kept retrying survived.
27731
+ *
27732
+ * Every wait, a failure backoff or a pause, is jittered over its upper half so drivers that one
27733
+ * outage cut off together do not re-enter together.
27661
27734
  */
27662
27735
  const DEFAULT_MAX_CONSECUTIVE_FAILURES = 3;
27663
27736
  const DEFAULT_MAX_ATTEMPTS = Number.POSITIVE_INFINITY;
27664
27737
  const DEFAULT_INITIAL_BACKOFF_MS = 2e3;
27665
27738
  const DEFAULT_MAX_BACKOFF_MS = 3e4;
27739
+ const DEFAULT_TRANSIENT_OUTAGE_MS = 9e5;
27666
27740
  /**
27667
27741
  * Bridge error classes the bridge itself never retries: a request that fails identically on
27668
27742
  * every attempt, mapped below 5xx on its HTTP path (`parse_error` 400, the other two 501). On the
@@ -27909,12 +27983,14 @@ async function defaultSleep(ms, signal) {
27909
27983
  async function runDriverWithRetry(run) {
27910
27984
  const now = run.now ?? Date.now;
27911
27985
  const sleep = run.sleep ?? defaultSleep;
27986
+ const random = run.random ?? Math.random;
27912
27987
  const policy = run.policy ?? {};
27913
27988
  const retryEnabled = policy.enabled !== false;
27914
27989
  const maxConsecutive = Math.max(0, policy.maxConsecutiveFailures ?? DEFAULT_MAX_CONSECUTIVE_FAILURES);
27915
27990
  const maxAttempts = Math.max(1, policy.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
27916
27991
  const initialBackoff = Math.max(0, policy.initialBackoffMs ?? DEFAULT_INITIAL_BACKOFF_MS);
27917
27992
  const maxBackoff = Math.max(initialBackoff, policy.maxBackoffMs ?? DEFAULT_MAX_BACKOFF_MS);
27993
+ const transientOutage = Math.max(0, policy.transientOutageMs ?? DEFAULT_TRANSIENT_OUTAGE_MS);
27918
27994
  const continuation = run.continuation;
27919
27995
  if (continuation !== void 0) {
27920
27996
  if (!Number.isFinite(continuation.deadlineMs) || continuation.deadlineMs <= 0) throw new ValidationError$1("runDriverWithRetry: a continuation needs a finite positive deadline");
@@ -27924,6 +28000,8 @@ async function runDriverWithRetry(run) {
27924
28000
  let consecutiveBarren = 0;
27925
28001
  let barrenReentries = 0;
27926
28002
  let failures = 0;
28003
+ let chargedFailures = 0;
28004
+ let outageSince;
27927
28005
  let consecutivePauses = 0;
27928
28006
  let pauses = 0;
27929
28007
  let continuations = 0;
@@ -27980,7 +28058,8 @@ async function runDriverWithRetry(run) {
27980
28058
  } catch (error) {
27981
28059
  const durationMs = now() - startedAt;
27982
28060
  const classification = classifyDriverFailure(error, run.signal);
27983
- const progressed = madeProgress(before, run.progress());
28061
+ const after = run.progress();
28062
+ const progressed = madeProgress(before, after);
27984
28063
  if (classification === "unavailable") {
27985
28064
  if (progressed) barrenReentries = 0;
27986
28065
  const stop = (() => {
@@ -28003,7 +28082,7 @@ async function runDriverWithRetry(run) {
28003
28082
  }
28004
28083
  pauses += 1;
28005
28084
  consecutivePauses = progressed ? 1 : consecutivePauses + 1;
28006
- const pause = unavailablePauseMs(consecutivePauses, policy);
28085
+ const pause = jitteredMs(unavailablePauseMs(consecutivePauses, policy), random);
28007
28086
  await emit({
28008
28087
  attempt,
28009
28088
  durationMs,
@@ -28026,13 +28105,20 @@ async function runDriverWithRetry(run) {
28026
28105
  }
28027
28106
  consecutivePauses = 0;
28028
28107
  failures += 1;
28108
+ const failedAt = now();
28109
+ const idle = classification === "transient" && !progressed && after.poolTokensSpent === before.poolTokensSpent && after.settledCount === before.settledCount;
28110
+ if (!idle) outageSince = void 0;
28111
+ else outageSince ??= failedAt;
28112
+ const inOutage = idle && failedAt - (outageSince ?? failedAt) < transientOutage;
28113
+ if (!inOutage) chargedFailures += 1;
28029
28114
  const stop = (() => {
28030
28115
  if (classification === "terminal") return "terminal-error";
28031
28116
  if (!retryEnabled) return "retry-disabled";
28032
28117
  if (run.signal.aborted) return "aborted";
28033
- const byBudget = budgetStop(run.budget(), now());
28118
+ const byBudget = budgetStop(run.budget(), failedAt);
28034
28119
  if (byBudget) return byBudget;
28035
- if (failures >= maxAttempts) return "max-attempts";
28120
+ if (inOutage) return void 0;
28121
+ if (chargedFailures >= maxAttempts) return "max-attempts";
28036
28122
  if (progressed) return void 0;
28037
28123
  return consecutiveBarren + 1 >= maxConsecutive ? "no-progress" : void 0;
28038
28124
  })();
@@ -28049,7 +28135,7 @@ async function runDriverWithRetry(run) {
28049
28135
  throw new DriverAttemptsExhaustedError(error, attempts, stop);
28050
28136
  }
28051
28137
  consecutiveBarren = progressed ? 0 : consecutiveBarren + 1;
28052
- const backoff = Math.min(maxBackoff, initialBackoff * 2 ** Math.max(0, consecutiveBarren - 1));
28138
+ const backoff = jitteredMs(cappedDoublingMs(consecutiveBarren, initialBackoff, maxBackoff), random);
28053
28139
  await emit({
28054
28140
  attempt,
28055
28141
  durationMs,
@@ -28071,6 +28157,7 @@ async function runDriverWithRetry(run) {
28071
28157
  }
28072
28158
  consecutiveBarren = 0;
28073
28159
  consecutivePauses = 0;
28160
+ outageSince = void 0;
28074
28161
  const durationMs = now() - startedAt;
28075
28162
  const after = run.progress();
28076
28163
  const progressed = madeProgress(before, after);
@@ -29230,4 +29317,4 @@ function isNonEmptySpend(s) {
29230
29317
  //#endregion
29231
29318
  export { bindScopeRetainedOwnerProvider as $, detachedFrozen as $i, parseWorkerToolTraceArtifact as $n, sanitizeRuntimeStreamEvent as $r, isPeerMailEnvelope as $t, driverExecutorFactory as A, addResourceSpend as Aa, prepareJsonlAppend as Ai, resolveAgentEnvironmentProvider as An, contentAddress as Ar, createExecutor as At, recordScopeOwnerDriverAttempt as B, promptFromAgentTurnInput as Ba, newExecutionAttemptId as Bi, InMemoryResultBlobStore as Bn, buildRuntimeEventOtelSpans as Br, workerTraceEnv as Bt, createContinuationKeeper as C, sleep as Ca, renderProfileMaterializationIssues as Ci, readPromptOptions as Cn, runAbortable as Cr, freeSlots as Ct, passedItems as D, unmeteredSpend as Da, validateProfileMaterialization as Di, createAgentEnvironmentProviderRegistry as Dn, readHarnessTranscript as Dr, captureReusableExecutorConfig as Dt, failedItems as E, throwIfAborted as Ea, unsupportedProfileDimensions as Ei, LEAF_CONTINUATION_TASK as En, persistHarnessTranscript as Er, bindReusableExecutorExecutionId as Et, beginScopeOwnerAttempt as F, awaitAbortable$1 as Fa, authoredProfileDigest as Fi, sandboxSessionTraceSource as Fn, defaultRedactor as Fr, createSteerableSandboxSession as Ft, settledToIteration as G, runtimeOwnedExecutorMaterialization as Gi, insideCursorNamespace as Gn, loopEventToOtelSpan as Gr, createActivityLog as Gt, recordScopeOwnerPause as H, providerMessageText as Ha, recordRuntimeOwnedDriveHarnessProviderEvidence as Hi, SpawnEventIndex as Hn, createOtelExporter as Hr, workerTraceSeamKey as Ht, createScope as I, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ia, finalizeRuntimeOwnedPendingExecutor as Ii, registerRetainedExecutorPreparation as In, defaultRedactorIdentityMaterial as Ir, createRouterTranscript as It, pollFor as J, runtimeOwnedScopeOwnerRuntime as Ji, pendingWaits as Jn, toOtelAttributes as Jr, AUTHORITY_MARKERS as Jt, createWaitProbes as K, runtimeOwnedExecutorProviderEvidence as Ki, loadSpawnForest as Kn, padSpanId as Kr, readWorkerProgress as Kt, deriveNodeExecutionIdentity as L, armDeadlineTimer as La, inheritRuntimeOwnedExecutorAttestation as Li, retainedExecutorSeamKey as Ln, resolveRedactor as Lr, createInPlaceCliExecutor as Lt, withDriverExecutor as M, withBudgetResources as Ma, writeAllBytes as Mi, unavailableSignalOfFailure as Mn, mergeTraceEnv as Mr, snapshotExecutorConfig as Mt, SUBTREE_RESULT_LIMIT as N, decodeHarnessUsage as Na, attestRuntimeOwnedPendingExecutor as Ni, createPushTraceSource as Nn, readTraceContextFromEnv as Nr, createWorktreeCliExecutor as Nt, verdictFromJudgeScore as O, withTimeout as Oa, worktreeCliProfileMaterialization as Oi, providerAsExecutor as On, resolveHarnessTranscriptCapture as Or, cliInPlaceExecutor as Ot, assertRecursiveReservationPolicy as P, abortError$2 as Pa, attestRuntimeOwnedScopeOwner as Pi, decodeToolPart as Pn, traceContextToEnv as Pr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Pt, bindScopeRetainedOwnerEnvironmentId as Q, executableAgentSpecSnapshot as Qi, isTraceAnalysisStore as Qn, sanitizeKnowledgeReadinessReport as Qr, createPeerMailbox as Qt, meterRuntimeOwnedAccounting as R, teardownExecutor as Ra, knownExecutionBindingReceipt as Ri, FileResultBlobStore as Rn, buildLoopOtelSpans as Rr, WORKER_TRACE_PROPAGATION as Rt, composeContinuationNote as S, randomSuffix as Sa, promptResourceProfileMaterialization as Si, assertBoxlessPromptOptions as Sn, linkAbort as Sr, startRetainedInteractiveRun as St, expandQuestions as T, throwAbort as Ta, sandboxActProfileMaterialization as Ti, runBrainLoop as Tn, harnessTranscriptArtifact as Tr, rollingDispatch as Tt, restoreScopeOwnerAcceptedExecution as U, runtimeOwnedDriveHarnessProviderEvidence as Ui, assertContentAddress as Un, flatOtelSpan as Ur, taskToPrompt as Ut, recordScopeOwnerMaterialization as V, promptOptionsFromAgentTurnInput as Va, providerAttemptEvidence as Vi, InMemorySpawnJournal as Vn, createOpenInferenceFileExporter as Vr, workerTraceHeaders as Vt, scopeOwnerExecutorNodeContext as W, runtimeOwnedExecutorExecutionBinding as Wi, encodeResultBlob as Wn, generateSpanId as Wr, DEFAULT_STALL_AFTER_MS as Wt, validateWaitSpec as X, unknownMaterializationReceipt as Xi, WORKER_TOOL_TRACE_SCHEMA_VERSION as Xn, createRuntimeStreamEventCollector as Xr, PEER_MAIL_WIRE_KEY as Xt, timerAt as Y, unknownExecutionBindingReceipt as Yi, replaySpawnTree as Yn, createRuntimeEventCollector as Yr, DEFAULT_PEER_MAIL_LIMITS as Yt, waitUntil as Z, executableAgentProfileSnapshot as Zi, captureWorkerTraceEvidence as Zn, sanitizeAgentRuntimeEvent as Zr, claimsAuthority as Zt, CheckUnavailableError as _, cloneSpend as _a, fullProfileMaterialization as _i, createSandboxLineage as _n, environmentGone as _r, readWorkerInteractiveBinding as _t, collectDelivered as a, createSandboxToolPartState as aa, DEFAULT_LOCAL_HARNESS as ai, bridgeModelRouteRefusal as an, createBudgetPool as ar, scopeRetainedOwnerPriorSpend as at, bestComposite as b, isAbortError$2 as ba, promptModelProfileMaterialization as bi, SandboxEvidenceRetentionError as bn, RunCancellationReason as br, reconnectRetainedInteractiveRun as bt, runTree as c, isSandboxTerminalEvent as ca, harnessSupportsReasoningEffort as ci, harnessUsageIsEmpty as cn, spendFromUsageEvents as cr, scopeRetainedOwnerResult as ct, classifyDriverFailure as d, notifySandboxEventObserver as da, CodexExecutionDiagnosticError as di, bridgeStopSignalKey as dn, reconnectRetainedRun as dr, hostDirectoryReader as dt, detachedSnapshot as ea, runSettledCommand as ei, peerMailTools as en, workerTraceAnalysisStore as er, consumeScopeRetainedOwnerResult as et, runDriverWithRetry as f, sandboxEventServedBackend as fa, terminateProcessTreeAndConfirm as fi, TERMINAL_DECISIONS as fn, recoverRetainedRun as fr, resolveSpawnResourcePaths as ft, CONTINUATION_FACTS as g, chargedTokens as ga, defineProfileMaterializationContract as gi, runAgentRounds as gn, destroyInteractiveEnvironment as gr, attachWorker as gt, CONTINUATIONS_DIR as h, addSpend as ha, controlProfileMaterialization as hi, isTerminalDecision as hn, retainedCreateMaterial as hr, workerInteractiveAdmissionFile as ht, bestDelivered as i, canonicalStreamEventFromSandboxEvent as ia, removeWorktree as ii, bridgeAdmissionRefusal as in, assertValidBudget as ir, scopeRetainedOwnerContext as it, isDriverSpec as j, resourceTelemetry as ja, readCommittedJsonLines as ji, unavailablePauseMs as jn, createPropagatingTraceEmitter as jr, createExecutorRegistry as jt, driverChild as k, zeroSpend as ka, isNoEntError as ki, providerAsSandboxClient as kn, retainHarnessTranscript as kr, cliWorktreeExecutor as kt, DriverAttemptsExhaustedError as l, mapSandboxEvent as la, localHarnessExecutable as li, readCodexRolloutSession as ln, spendFromUsageTotals as lr, SPAWN_RESOURCE_PATH_MAX_BYTES as lt, upstreamUnavailableSignal as m, sumSandboxUsage as ma, assertProfileMaterialization as mi, defaultSelectWinner as mn, startRetainedRunInEnvironment as mr, readWorkerInteractiveAdmissions as mt, createRootHandle as n, readSandboxOutcome as na, captureWorktreeDiff as ni, isLiveNodeStatus as nn, BudgetReconcileFault as nr, prepareScopeRetainedOwnerTask as nt, pickBestDelivered as o, createSandboxUsageLedger as oa, LOCAL_HARNESSES as oi, addHarnessUsage as on, meterUsageEvent as or, scopeRetainedOwnerResourceReader as ot, summarizeDriverAttempts as p, sandboxProgressEvents as pa, AGENT_PROFILE_MATERIALIZATION_AXES as pi, createSandboxForSpec as pn, startRetainedRun as pr, interactiveAdmissionSeamKey as pt, isWaitOutcome as q, runtimeOwnedPendingExecutorMaterialization as qi, materializeTreeView as qn, padTraceId as qr, createInbox as qt, createSupervisor as r, assertSandboxServedModel as ra, createWorktree as ri, isTerminalNodeStatus as rn, ReservationWaitRefused as rr, reconcileScopeRetainedOwnerEnvironment as rt, runFinalizer as s, extractLlmCallEvent as sa, harnessInvocation as si, createCodexRolloutStoreReader as sn, newUsageTotals as sr, scopeRetainedOwnerRestorePoint as st, DEFAULT_MAX_DEPTH as t, projectSandboxOutcome as ta, runWorktreeHarness as ti, peerMailVerbNames as tn, executorFailure as tr, noteScopeRetainedOwnerCoordination as tt, HarnessTurnFailedError as u, mapSandboxToolEvent as ua, parseCodexTokenUsage as ui, bridgeRuntimeAttachmentsKey as un, errMessage as ur, environmentReader as ut, admitContinuationPolicy as v, deleteBoxSafe as va, profileMaterializationAxes$1 as vi, probeSandboxCapabilities as vn, createWorkerSlots as vr, workerInteractiveBindingFile as vt, distillFindings as w, stringifySafe as wa, renderUnsupported as wi, routerBrain as wn, captureHarnessTranscript as wr, queueOf as wt, checkVerdictOf as x, promptCacheTokenClasses as xa, promptOnlyProfileMaterialization as xi, captureBeforeDestroy as xn, abortError as xr, recoverRetainedInteractiveRun as xt, admitFinding as y, hasCompleteCacheBreakdown as ya, promptControlProfileMaterialization as yi, acquireSandbox as yn, openSlotGroup as yr, workerInteractiveBindingsDir as yt, meterRuntimeOwnedProviderAttempt as z, teardownSurfaces as za, knownMaterializationReceipt as zi, FileSpawnJournal as zn, buildLoopSpanNodes as zr, readWorkerTraceContext as zt };
29232
29319
 
29233
- //# sourceMappingURL=supervisor-DPXXMNZK.js.map
29320
+ //# sourceMappingURL=supervisor-CQSu5XGl.js.map