@tangle-network/agent-runtime 0.348.1 → 0.349.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/{activation-BEGalhOL.js → activation-tNGW73Y9.js} +4 -4
  2. package/dist/{activation-BEGalhOL.js.map → activation-tNGW73Y9.js.map} +1 -1
  3. package/dist/{activation-NQZP_mdI.d.ts → activation-wBipBkCf.d.ts} +2 -2
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{bundle-DKQtOO9d.js → bundle-1xaJEgjq.js} +2 -2
  7. package/dist/{bundle-DKQtOO9d.js.map → bundle-1xaJEgjq.js.map} +1 -1
  8. package/dist/candidate-execution/index.js +4 -4
  9. package/dist/{coordination-manager-Bm6leXc6.js → coordination-manager-B2Z_MmL9.js} +2 -2
  10. package/dist/coordination-manager-B2Z_MmL9.js.map +1 -0
  11. package/dist/{delegate-Cp5-PsaX.js → delegate-Dr-63jFl.js} +2 -2
  12. package/dist/{delegate-Cp5-PsaX.js.map → delegate-Dr-63jFl.js.map} +1 -1
  13. package/dist/durable.d.ts +1 -1
  14. package/dist/durable.js +5 -5
  15. package/dist/durable.js.map +1 -1
  16. package/dist/{graph-CE_pzU31.js → graph-DPejYB3C.js} +5 -5
  17. package/dist/{graph-CE_pzU31.js.map → graph-DPejYB3C.js.map} +1 -1
  18. package/dist/{improve-wT11zteg.js → improve-DwSahPi1.js} +6 -6
  19. package/dist/{improve-wT11zteg.js.map → improve-DwSahPi1.js.map} +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +9 -9
  22. package/dist/intelligence.d.ts +2 -2
  23. package/dist/intelligence.js +6 -6
  24. package/dist/kernel.d.ts +2 -2
  25. package/dist/kernel.js +10 -10
  26. package/dist/{loop-runner-CY5HHhtR.d.ts → loop-runner-C6pGq-2l.d.ts} +2 -2
  27. package/dist/{loop-runner-CZzeeJTG.js → loop-runner-CP6MfO1b.js} +2 -2
  28. package/dist/{loop-runner-CZzeeJTG.js.map → loop-runner-CP6MfO1b.js.map} +1 -1
  29. package/dist/loop-runner-bin.d.ts +1 -1
  30. package/dist/loop-runner-bin.js +1 -1
  31. package/dist/mcp/bin.js +3 -3
  32. package/dist/mcp/index.d.ts +1 -1
  33. package/dist/mcp/index.js +5 -5
  34. package/dist/model-policy-CyCUwHed.js.map +1 -1
  35. package/dist/{prepare-TEEHSJwq.js → prepare-B9wWffjO.js} +3 -3
  36. package/dist/{prepare-TEEHSJwq.js.map → prepare-B9wWffjO.js.map} +1 -1
  37. package/dist/{profile-6OLpbjvV.js → profile-JLJd2wFG.js} +2 -2
  38. package/dist/{profile-6OLpbjvV.js.map → profile-JLJd2wFG.js.map} +1 -1
  39. package/dist/profiles.d.ts +1 -1
  40. package/dist/{provision-supervisor-CC0HdOHo.js → provision-supervisor-C4v2vqDo.js} +4 -4
  41. package/dist/{provision-supervisor-CC0HdOHo.js.map → provision-supervisor-C4v2vqDo.js.map} +1 -1
  42. package/dist/{runtime-B_40dXlF.js → runtime-CsvGCQpl.js} +200 -15
  43. package/dist/runtime-CsvGCQpl.js.map +1 -0
  44. package/dist/{sandbox-profile-compat-_fEtHPCj.js → sandbox-profile-compat-DtuJWFrM.js} +2 -2
  45. package/dist/sandbox-profile-compat-DtuJWFrM.js.map +1 -0
  46. package/dist/{search-executor-COd2F2wp.js → search-executor-CCb82Umc.js} +5 -5
  47. package/dist/search-executor-CCb82Umc.js.map +1 -0
  48. package/dist/{server-BGB4R4wQ.js → server-CKPwZU-I.js} +4 -4
  49. package/dist/{server-BGB4R4wQ.js.map → server-CKPwZU-I.js.map} +1 -1
  50. package/dist/{structural-rollout-Wl_rCuzM.js → structural-rollout-DylC_fwU.js} +3 -3
  51. package/dist/{structural-rollout-Wl_rCuzM.js.map → structural-rollout-DylC_fwU.js.map} +1 -1
  52. package/dist/{supervise-BUOeThuB.js → supervise-BGfm2GlY.js} +174 -27
  53. package/dist/supervise-BGfm2GlY.js.map +1 -0
  54. package/dist/{supervisor-DDy0aEtR.js → supervisor-wS9Ehz_x.js} +17 -18
  55. package/dist/supervisor-wS9Ehz_x.js.map +1 -0
  56. package/dist/testing.d.ts +2 -2
  57. package/dist/testing.js +13 -13
  58. package/dist/tui/index.d.ts +1 -1
  59. package/dist/tui/index.js +1 -1
  60. package/dist/{types-hc4cmSc7.d.ts → types-C8BGOCBn.d.ts} +196 -25
  61. package/package.json +2 -2
  62. package/skills/agent-graphs/SKILL.md +2 -0
  63. package/skills/graph-designer/SKILL.md +6 -0
  64. package/skills/profile-authoring/SKILL.md +1 -1
  65. package/dist/coordination-manager-Bm6leXc6.js.map +0 -1
  66. package/dist/runtime-B_40dXlF.js.map +0 -1
  67. package/dist/sandbox-profile-compat-_fEtHPCj.js.map +0 -1
  68. package/dist/search-executor-COd2F2wp.js.map +0 -1
  69. package/dist/supervise-BUOeThuB.js.map +0 -1
  70. package/dist/supervisor-DDy0aEtR.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  import { c as captureRunWriteContext, l as fenceRunWrite, m as __exportAll, p as sha256, r as assertNoSymlinkDescendant, s as writeAtomicDurableFile } from "./record-events-D93DkpAx.js";
2
- import { $n as HarnessTurnFailedError, $r as sandboxProfileMaterialization, A as beginScopeOwnerAttempt, Ai as cappedDoublingMs, An as toOtelAttributes, At as createExecutor, B as assertRecursiveReservationPolicy, Bi as executorFailure, Bn as PEER_MAIL_WIRE_KEY, Cr as bridgeAdmissionRefusal, Ct as readCommittedJsonLines, Di as RetainedExecutionPendingError, En as generateSpanId, F as coordinationMcpAlias, Fn as INBOX_RECEIPT_KEY, G as meterRuntimeOwnedAccounting, Gr as controlProfileMaterialization, Ht as codeModeArguments, I as coordinationProfileToolPrefix, In as createInbox, Ir as bridgeRuntimeAttachmentsKey, J as recordScopeOwnerDriverAttempt, Jn as createActivityLog, Jr as profileMaterializationAxes$1, Jt as routerBrain, K as meterRuntimeOwnedProviderAttempt, Ki as spendFromUsageTotals, Kr as defineProfileMaterializationContract, Kt as toolResultText, L as providerVisibleProfile, Lr as bridgeStopSignalKey, M as recordScopeOwnerMaterialization, Mi as unavailablePauseMs, Mr as RunCancellationReason, N as restoreScopeOwnerAcceptedExecution, Ni as unavailableResumeAt, Nr as linkAbort, Oi as registerRetainedExecutorPreparation, Ot as bindReusableExecutorExecutionId, P as scopeOwnerExecutorNodeContext, Pr as runAbortable, Qn as DriverAttemptsExhaustedError, R as runtimeGraphMetadataKey, Ri as detachedSnapshot, St as readCommittedJsonFile, Tt as withJsonlFileLock, Ui as meterUsageEvent, Un as isPeerMailEnvelope, Ur as assertProfileMaterialization, Ut as codeModeModelOutput, V as deriveNodeExecutionIdentity, Vi as errMessage, Wi as newUsageTotals, Wt as createCodeModeTools, X as prepareScopeRetainedOwnerSeatSwitch, Xn as isLiveNodeStatus, Xr as promptModelProfileMaterialization, Xt as resolveAgentEnvironmentProvider, Y as recordScopeOwnerPause, Yr as promptControlProfileMaterialization, Z as scopeRetainedOwnerResourceReader, Zn as isTerminalNodeStatus, Zr as renderUnsupported, _i as runtimeOwnedPendingExecutorMaterialization, _n as WORKER_TRACE_PROPAGATION, _r as admitContinuationPolicy, a as assertRunParking, ar as upstreamUnavailableSignal, at as beginScopeRetainedOwnerDrive, br as createContinuationKeeper, bt as isNoEntError, c as sleepScopeWait, cr as authoredSeatStages, ct as scopeRetainedOwnerRestorePoint, d as runFinalizer, di as providerAttemptEvidence, dr as CheckUnavailableError, dt as bindScopeRetainedOwnerProvider, ei as unsupportedProfileDimensions, er as abandonablePending, et as abandonScopeRetainedOwnerInvocation, f as runTree, fi as recordRuntimeOwnedDriveHarnessProviderEvidence, fr as gateFactoryOnDeliverable, ft as scopeRetainedOwnerContext, g as isDriverSpec, gi as runtimeOwnedExecutorProviderEvidence, gr as CONTINUATIONS_DIR, h as driverExecutorFactory, hi as runtimeOwnedExecutorMaterialization, i as RunParkedError, ii as authoredAgentIdentity, ir as undispatchedCredentialExit, it as scopeRetainedOwnerResult, j as noteScopeOwnerPlannedExecution, ji as jitteredMs, jt as snapshotExecutorConfig, ki as retainedExecutorSeamKey, kt as captureReusableExecutorConfig, l as withRunParking, ln as persistHarnessTranscript, lr as seatExecutionProfile, lt as noteScopeRetainedOwnerCoordination, m as driverChild, mi as runtimeOwnedExecutorExecutionBinding, n as createSupervisor, nr as classifyDriverFailure, nt as prepareScopeRetainedOwnerTask, o as bindScopeParkingDrain, or as SeatChain, ot as scopeRetainedOwnerTurnEnded, p as createRootHandle, pi as runtimeOwnedDriveHarnessProviderEvidence, pt as scopeRetainedOwnerJournalRoot, q as recordScopeOwnerBarrenPause, qi as assertValidBudget, qr as fullProfileMaterialization, qt as createRouterTranscript, ri as attestRuntimeOwnedScopeOwner, rr as summarizeDriverAttempts, rt as scopeRetainedOwnerPriorSpend, si as inheritRuntimeOwnedExecutorAttestation, sr as SeatChainExhaustedError, st as reconcileScopeRetainedOwnerEnvironment, ti as worktreeCliProfileMaterialization, tr as causedByPartialFailure, tt as consumeScopeRetainedOwnerResult, u as bestDelivered, un as readHarnessTranscript, ut as bindScopeRetainedOwnerEnvironmentId, vi as runtimeOwnedScopeOwnerRuntime, vr as bestComposite, wn as createOtelExporter, wr as bridgeModelRouteRefusal, wt as upsertCommittedJsonLine, x as parseWorkerToolTraceArtifact, xt as prepareJsonlAppend, yr as checkVerdictOf, zi as contentAddress } from "./supervisor-DDy0aEtR.js";
2
+ import { $n as HarnessTurnFailedError, $r as sandboxProfileMaterialization, A as beginScopeOwnerAttempt, Ai as cappedDoublingMs, An as toOtelAttributes, At as createExecutor, B as assertRecursiveReservationPolicy, Bi as executorFailure, Bn as PEER_MAIL_WIRE_KEY, Cr as bridgeAdmissionRefusal, Ct as readCommittedJsonLines, Di as RetainedExecutionPendingError, En as generateSpanId, F as coordinationMcpAlias, Fn as INBOX_RECEIPT_KEY, G as meterRuntimeOwnedAccounting, Gr as controlProfileMaterialization, Ht as codeModeArguments, I as coordinationProfileToolPrefix, In as createInbox, Ir as bridgeRuntimeAttachmentsKey, J as recordScopeOwnerDriverAttempt, Jn as createActivityLog, Jr as profileMaterializationAxes$1, Jt as routerBrain, K as meterRuntimeOwnedProviderAttempt, Ki as spendFromUsageTotals, Kr as defineProfileMaterializationContract, Kt as toolResultText, L as providerVisibleProfile, Lr as bridgeStopSignalKey, M as recordScopeOwnerMaterialization, Mi as unavailablePauseMs, Mr as RunCancellationReason, N as restoreScopeOwnerAcceptedExecution, Ni as unavailableResumeAt, Nr as linkAbort, Oi as registerRetainedExecutorPreparation, Ot as bindReusableExecutorExecutionId, P as scopeOwnerExecutorNodeContext, Pr as runAbortable, Qn as DriverAttemptsExhaustedError, R as runtimeGraphMetadataKey, Ri as detachedSnapshot, St as readCommittedJsonFile, Tt as withJsonlFileLock, Ui as meterUsageEvent, Un as isPeerMailEnvelope, Ur as assertProfileMaterialization, Ut as codeModeModelOutput, V as deriveNodeExecutionIdentity, Vi as errMessage, Wi as newUsageTotals, Wt as createCodeModeTools, X as prepareScopeRetainedOwnerSeatSwitch, Xn as isLiveNodeStatus, Xr as promptModelProfileMaterialization, Xt as resolveAgentEnvironmentProvider, Y as recordScopeOwnerPause, Yr as promptControlProfileMaterialization, Z as scopeRetainedOwnerResourceReader, Zn as isTerminalNodeStatus, Zr as renderUnsupported, _i as runtimeOwnedPendingExecutorMaterialization, _n as WORKER_TRACE_PROPAGATION, _r as admitContinuationPolicy, a as assertRunParking, ar as upstreamUnavailableSignal, at as beginScopeRetainedOwnerDrive, br as createContinuationKeeper, bt as isNoEntError, c as sleepScopeWait, cr as authoredSeatStages, ct as scopeRetainedOwnerRestorePoint, d as runFinalizer, di as providerAttemptEvidence, dr as CheckUnavailableError, dt as bindScopeRetainedOwnerProvider, ei as unsupportedProfileDimensions, er as abandonablePending, et as abandonScopeRetainedOwnerInvocation, f as runTree, fi as recordRuntimeOwnedDriveHarnessProviderEvidence, fr as gateFactoryOnDeliverable, ft as scopeRetainedOwnerContext, g as isDriverSpec, gi as runtimeOwnedExecutorProviderEvidence, gr as CONTINUATIONS_DIR, h as driverExecutorFactory, hi as runtimeOwnedExecutorMaterialization, i as RunParkedError, ii as authoredAgentIdentity, ir as undispatchedCredentialExit, it as scopeRetainedOwnerResult, j as noteScopeOwnerPlannedExecution, ji as jitteredMs, jt as snapshotExecutorConfig, ki as retainedExecutorSeamKey, kt as captureReusableExecutorConfig, l as withRunParking, ln as persistHarnessTranscript, lr as seatExecutionProfile, lt as noteScopeRetainedOwnerCoordination, m as driverChild, mi as runtimeOwnedExecutorExecutionBinding, n as createSupervisor, nr as classifyDriverFailure, nt as prepareScopeRetainedOwnerTask, o as bindScopeParkingDrain, or as SeatChain, ot as scopeRetainedOwnerTurnEnded, p as createRootHandle, pi as runtimeOwnedDriveHarnessProviderEvidence, pt as scopeRetainedOwnerJournalRoot, q as recordScopeOwnerBarrenPause, qi as assertValidBudget, qr as fullProfileMaterialization, qt as createRouterTranscript, ri as attestRuntimeOwnedScopeOwner, rr as summarizeDriverAttempts, rt as scopeRetainedOwnerPriorSpend, si as inheritRuntimeOwnedExecutorAttestation, sr as SeatChainExhaustedError, st as reconcileScopeRetainedOwnerEnvironment, ti as worktreeCliProfileMaterialization, tr as causedByPartialFailure, tt as consumeScopeRetainedOwnerResult, u as bestDelivered, un as readHarnessTranscript, ut as bindScopeRetainedOwnerEnvironmentId, vi as runtimeOwnedScopeOwnerRuntime, vr as bestComposite, wn as createOtelExporter, wr as bridgeModelRouteRefusal, wt as upsertCommittedJsonLine, x as parseWorkerToolTraceArtifact, xt as prepareJsonlAppend, yr as checkVerdictOf, zi as contentAddress } from "./supervisor-wS9Ehz_x.js";
3
3
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
4
- import { Et as isDeadlineAbortReason, K as chargedTokens, Ot as teardownExecutor, W as addSpend, X as errorMessage, _t as withBudgetResources, dt as withTimeout, et as isAsyncIterable, ft as zeroSpend, gt as resourceTelemetry, kt as teardownSurfaces, mt as addResourceSpend, nt as promptCacheTokenClasses, ot as sleep, ut as unmeteredSpend, xt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS } from "./sandbox-profile-compat-_fEtHPCj.js";
4
+ import { Et as isDeadlineAbortReason, K as chargedTokens, Ot as teardownExecutor, W as addSpend, X as errorMessage, _t as withBudgetResources, dt as withTimeout, et as isAsyncIterable, ft as zeroSpend, gt as resourceTelemetry, kt as teardownSurfaces, mt as addResourceSpend, nt as promptCacheTokenClasses, ot as sleep, ut as unmeteredSpend, xt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS } from "./sandbox-profile-compat-DtuJWFrM.js";
5
5
  import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, l as profileProviderModel, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-CyCUwHed.js";
6
6
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
7
- import { c as budgetOverspendText, d as safeJsonText, f as createFileRunContext, l as normalizeAnalyzeOnSettle, m as withRunContext, n as createCoordinationToolsForManager, o as createCancelAcknowledger, p as createInMemoryRunContext, s as createSteerAcknowledger, t as createCoordinationTools, u as coordinationVerbNames } from "./coordination-manager-Bm6leXc6.js";
7
+ import { c as budgetOverspendText, d as safeJsonText, f as createFileRunContext, l as normalizeAnalyzeOnSettle, m as withRunContext, n as createCoordinationToolsForManager, o as createCancelAcknowledger, p as createInMemoryRunContext, s as createSteerAcknowledger, t as createCoordinationTools, u as coordinationVerbNames } from "./coordination-manager-B2Z_MmL9.js";
8
8
  import { c as writeRunCancellation, i as readRunCancellation, r as readRunCancelRequest, s as watchRunCancellation, t as applyRunCancellation } from "./run-cancellation-CzFhQGMa.js";
9
9
  import { n as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-XV4aJwoQ.js";
10
10
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
@@ -756,7 +756,7 @@ function truncate(value) {
756
756
  /**
757
757
  * The root manager's own provider stream, retained where Runtime owns it.
758
758
  *
759
- * Measured motive (agent-runtime#1233, 2026-09-15): a CHILD's full event stream — reasoning, text,
759
+ * Measured motive (agent-runtime#1233): a CHILD's full event stream — reasoning, text,
760
760
  * and tool parts, 28k to 76k reasoning characters per child — is retained in the blob its
761
761
  * `settled` record names as `outRef`. The ROOT's stream reached nobody: `driveHarnessFromBackend`
762
762
  * drained the root executor for accounting and discarded every `progress` event, and on a
@@ -773,7 +773,7 @@ function truncate(value) {
773
773
  *
774
774
  * Durability boundary: each line is written synchronously to an `O_APPEND` descriptor before the
775
775
  * next event is drained, and the file is fsynced at every drive-attempt boundary and at close, not
776
- * per line. Measured 2026-09-15 on this host's APFS: an fsync per line cost 7.1 ms per event over
776
+ * per line. An fsync per line cost 7.1 ms per event over
777
777
  * 1,000 events and 8.1 ms over 5,000 (~80 s for a root emitting ten thousand text deltas, all of
778
778
  * it serialized inside the drain loop that also meters the budget); an async `FileHandle.write`
779
779
  * still cost 0.9 to 1.1 ms per line in the thread pool the children's journal writes share; a
@@ -3707,12 +3707,12 @@ function driverInitialMessages(opts, system, task, scope) {
3707
3707
  * that assigned the task. The run's own check judges the run's result, never a child's narrower
3708
3708
  * assignment. Held to the run's check, a child's submission is refused for as long as the run's
3709
3709
  * is: every node of test-canary-graph-tools-20261017a, and the `delay` child of
3710
- * test-retained-root-wake-20261018b (2026-10-18: "Expected: the canary runs to its deadline"), was
3710
+ * test-retained-root-wake-20261018b ("Expected: the canary runs to its deadline"), was
3711
3711
  * refused at submit_result, never settled, and its manager was never woken with it.
3712
3712
  *
3713
3713
  * It is the one check a harness manager may hold without a continuation policy: it accepts every
3714
3714
  * submission, so there is nothing to send the child back for. test-canary-graph-tools-20261018c and
3715
- * -d (2026-10-18) had every harness-run graph lead refused at spawn until this exemption.
3715
+ * -d had every harness-run graph lead refused at spawn until this exemption.
3716
3716
  */
3717
3717
  const ownSubmissionDeliverable = Object.freeze({
3718
3718
  describe: "the result your task asks for; it goes to the manager that assigned the task, and the run's own check judges that manager's result",
@@ -5131,7 +5131,7 @@ const SAME_PARTIAL_FAILURE_LIMIT = 2;
5131
5131
  /**
5132
5132
  * Why an aborted run stopped: `deadline` when the root's or the node's own deadline cut it, else
5133
5133
  * `aborted`. Read before any failure classification, which calls every failure after an abort
5134
- * terminal: measured 2026-10-21, 61 of 62 runs that ended `terminal-error` were a deadline that cut
5134
+ * terminal: 61 of 62 runs that ended `terminal-error` were a deadline that cut
5135
5135
  * a turn.
5136
5136
  */
5137
5137
  function abortStop(signal) {
@@ -5672,7 +5672,7 @@ var DriverRetryLoop = class {
5672
5672
  *
5673
5673
  * WHAT COUNTS AS PROGRESS was got wrong first. Reading metered spend, settled children and an
5674
5674
  * accepted submission measured the filesystem and the meter, never the goal: across 1,422 settled
5675
- * discovery-lab runs (2026-09-01) it retried the runs that produced NOTHING 629 of 827 times
5675
+ * discovery-lab runs it retried the runs that produced NOTHING 629 of 827 times
5676
5676
  * (76.1%) and the runs that HAD left an artifact 21 of 399 times (5.3%). So when the caller
5677
5677
  * declares a completion check, spend and settlements alone are NOT progress while it is unmet; only
5678
5678
  * a delivery (an accepted submission, a child that passed the check, the contract turning met, or a
@@ -5690,7 +5690,7 @@ var DriverRetryLoop = class {
5690
5690
  * `barren-pause` row per pause for an operator alarm, and re-enters. A barren streak never ends the
5691
5691
  * run: the check, the deadline, the budget and cancellation do. Progress resets the streak and the
5692
5692
  * backoff. There is no count cap and no caller veto (the old prompt-owned loop logged 896 of 1,011
5693
- * rounds with no progress). Measured 2026-10-21 on magnetar-rust-20261021a: the barren bound
5693
+ * rounds with no progress). The barren bound
5694
5694
  * settled a 48-hour run `no-winner` after 14.3 hours, while its last two turns updated its pages
5695
5695
  * and waited on its own 2^20 prove.
5696
5696
  *
@@ -5713,7 +5713,7 @@ var DriverRetryLoop = class {
5713
5713
  * created and then failed its setup (Sandbox's `PartialFailureError`): it meets the same failure on
5714
5714
  * every re-entry, so a second identical attempt with no progress stops with `repeated-failure`
5715
5715
  * (`SAME_PARTIAL_FAILURE_LIMIT`). A failure that spent tokens without delivering keeps the bounds.
5716
- * Measured 2026-10-04 on Discovery run research-nqs-20261003system2: a Platform restart answered
5716
+ * A Platform restart answered
5717
5717
  * `HTTP 502 ... Platform key verification unavailable` from 03:04:34 to 03:09:41Z, and the
5718
5718
  * coordinator's twelve attempts ran out at 03:07:12Z with no token spent.
5719
5719
  *
@@ -5731,8 +5731,7 @@ var DriverRetryLoop = class {
5731
5731
  * still spent pauses again with its own row, and the steer stays queued until a turn reads it.
5732
5732
  * After the pause the per-window counters start over and the driver is re-entered: after
5733
5733
  * a failure as `driver-failure` with `pausedMs`, after an admission or continuation refusal as the
5734
- * re-entry it was about to use. Drew, 2026-10-21: "why do these runs keep failing early its
5735
- * unacceptable!" Measured 2026-10-21 over 259 runs since 10-14: 8 of the 10 stops settled runs that
5734
+ * re-entry it was about to use. Runs must not fail early: over 259 runs, 8 of the 10 stops settled runs that
5736
5735
  * nobody solved or stopped, including 17 roots whose harness never streamed.
5737
5736
  */
5738
5737
  function assertContinuationPolicy(continuation) {
@@ -5842,7 +5841,7 @@ function composeReentryTask(input) {
5842
5841
  }
5843
5842
  /**
5844
5843
  * Why the driver is back, in one clause. The failure's own text stays in the attempt records and
5845
- * never reaches the driver: measured 2026-09-11, a continuation told the details of a provider
5844
+ * never reaches the driver: a continuation told the details of a provider
5846
5845
  * failure spent two of its first four children probing the infrastructure, while its peer, told
5847
5846
  * only what to continue, spent all forty-five on the research.
5848
5847
  */
@@ -7164,7 +7163,7 @@ async function providerAcceptsCoordinationAttachments(backend) {
7164
7163
  * A manager waits between turns, and a wake can come much later than five minutes after its last
7165
7164
  * turn. Claude Code 2.1.289 writes its prompt cache with a five-minute lifetime unless this variable
7166
7165
  * is set; a wake after the cache expired re-writes the manager's whole context, about 140K tokens
7167
- * per turn on a Discovery root measured 2026-10-05. That root ran on a subscription and already
7166
+ * per turn on a Discovery root. That root ran on a subscription and already
7168
7167
  * wrote one-hour entries; the variable makes the hour hold for every claude-code manager, whatever
7169
7168
  * its credential. A value the caller set wins.
7170
7169
  */
@@ -7415,6 +7414,7 @@ function admitSpawn(env, seat, authoredProfile, spawnContext, recovering) {
7415
7414
  */
7416
7415
  var graph_registry_exports = /* @__PURE__ */ __exportAll({
7417
7416
  digestOfGraph: () => digestOfGraph,
7417
+ graphCorpusSummary: () => graphCorpusSummary,
7418
7418
  graphDigest: () => graphDigest,
7419
7419
  graphFromStored: () => graphFromStored,
7420
7420
  graphRegistry: () => graphRegistry,
@@ -7424,6 +7424,7 @@ var graph_registry_exports = /* @__PURE__ */ __exportAll({
7424
7424
  lookupGraph: () => lookupGraph,
7425
7425
  pickBestGraph: () => pickBestGraph,
7426
7426
  recordGraphRun: () => recordGraphRun,
7427
+ recordStoredGraphRun: () => recordStoredGraphRun,
7427
7428
  storedGraphDigests: () => storedGraphDigests,
7428
7429
  taskShapeDigest: () => taskShapeDigest
7429
7430
  });
@@ -7468,10 +7469,26 @@ function storeGraph(graph) {
7468
7469
  function assertRecord(record) {
7469
7470
  if (typeof record.graphDigest !== "string" || record.graphDigest.length === 0) throw new ValidationError("graph-registry: record.graphDigest is required");
7470
7471
  if (typeof record.taskDigest !== "string" || record.taskDigest.length === 0) throw new ValidationError("graph-registry: record.taskDigest is required");
7471
- if (record.outcome.kind !== "delivered" && record.outcome.kind !== "no-winner") throw new ValidationError("graph-registry: record.outcome.kind must be 'delivered' | 'no-winner'");
7472
+ if (!Number.isFinite(Date.parse(record.startedAt))) throw new ValidationError("graph-registry: record.startedAt must be a timestamp");
7473
+ if (![
7474
+ "delivered",
7475
+ "no-winner",
7476
+ "unknown",
7477
+ "running"
7478
+ ].includes(record.outcome.kind)) throw new ValidationError("graph-registry: invalid record.outcome.kind");
7479
+ if ((record.outcome.kind === "delivered" || record.outcome.kind === "no-winner") && (!record.finishedAt || !Number.isFinite(Date.parse(record.finishedAt)))) throw new ValidationError("graph-registry: terminal outcomes require record.finishedAt");
7480
+ if ((record.outcome.kind === "unknown" || record.outcome.kind === "running") && !record.outcome.reason) throw new ValidationError("graph-registry: incomplete outcomes require a reason");
7481
+ if (record.source && (!record.source.kind || !record.source.id)) throw new ValidationError("graph-registry: source.kind and source.id are required");
7482
+ if (record.finishedAt && (!Number.isFinite(Date.parse(record.finishedAt)) || Date.parse(record.finishedAt) < Date.parse(record.startedAt))) throw new ValidationError("graph-registry: finishedAt precedes startedAt or is invalid");
7483
+ for (const [channel, value] of Object.entries(record.cost)) if (value !== void 0 && (typeof value !== "number" || !Number.isFinite(value) || value < 0)) throw new ValidationError(`graph-registry: invalid cost.${channel}`);
7472
7484
  }
7473
7485
  function recordKey(record) {
7474
7486
  assertRecord(record);
7487
+ if (record.source) return JSON.stringify([
7488
+ "source",
7489
+ record.source.kind,
7490
+ record.source.id
7491
+ ]);
7475
7492
  return JSON.stringify([
7476
7493
  record.taskDigest,
7477
7494
  record.graphDigest,
@@ -7488,13 +7505,58 @@ function graphRegistry(root) {
7488
7505
  * Idempotent per (taskDigest, graphDigest, startedAt): a replayed append with
7489
7506
  * the same key replaces the prior row rather than duplicating it. */
7490
7507
  async function recordGraphRun(reg, graph, record) {
7508
+ return recordStoredGraphRun(reg, storeGraph(graph), record);
7509
+ }
7510
+ /** Store an executable graph or an observed external topology in the same registry.
7511
+ * Imported observations retain their source identity and never authorize replay.
7512
+ * A reader refreshing facts can preserve independently joined labels; an explicit
7513
+ * correction leaves preserveLabels unset and replaces the record. */
7514
+ async function recordStoredGraphRun(reg, stored, record, options = {}) {
7491
7515
  assertRecord(record);
7492
- const stored = storeGraph(graph);
7516
+ if (stored.observed && !record.source) throw new ValidationError("graph-registry: observed graphs require a source run identity");
7517
+ if (!stored.observed && !record.finishedAt) throw new ValidationError("graph-registry: native graph runs require a completion timestamp");
7518
+ if ((!stored.observed || record.traversals !== void 0) && (!Number.isSafeInteger(record.traversals) || record.traversals < 0)) throw new ValidationError("graph-registry: native graphs require metered traversals; observed counts must be non-negative integers");
7519
+ const { digest, ...content } = stored;
7520
+ if (graphDigest(content) !== digest) throw new ValidationError("graph-registry: stored graph content does not match its digest");
7493
7521
  if (stored.digest !== record.graphDigest) throw new ValidationError(`graph-registry: record.graphDigest ${record.graphDigest} does not match the supplied graph (${stored.digest}) — record the graph that actually ran`);
7494
7522
  await mkdir(join(reg.root, GRAPHS_DIR), { recursive: true });
7495
7523
  return withJsonlFileLock(join(reg.root, RECORDS_FILE), async (canonicalPath) => {
7496
- writeAtomicDurableFile(join(reg.root, GRAPHS_DIR, `${stored.digest}.json`), JSON.stringify(stored), { preserveMode: true });
7497
- await upsertCommittedJsonLine(canonicalPath, record, recordKey);
7524
+ let persisted = record;
7525
+ if (options.preserveLabels && record.source) {
7526
+ const prior = (await readCommittedJsonFile(canonicalPath)).find((row) => row.source?.kind === record.source.kind && row.source.id === record.source.id);
7527
+ if (prior) {
7528
+ const taskType = record.taskType ?? prior.taskType;
7529
+ const priorTerminal = prior.outcome.kind === "delivered" || prior.outcome.kind === "no-winner";
7530
+ const incomingUnassessed = record.outcome.kind === "unknown" || record.outcome.kind === "running";
7531
+ if (priorTerminal && incomingUnassessed && prior.startedAt !== record.startedAt) throw new ValidationError("graph-registry: preserving labels requires the same task start and source identity");
7532
+ const evidence = [...prior.evidence ?? [], ...record.evidence ?? []];
7533
+ persisted = {
7534
+ ...record,
7535
+ ...taskType ? { taskType } : {},
7536
+ ...record.unknowns ? { unknowns: record.unknowns.filter((reason) => !(taskType && reason === "task type not explicitly labeled")) } : {},
7537
+ ...evidence.length ? { evidence: [...new Map(evidence.map((entry) => [canonicalJson$1(entry), entry])).values()] } : {},
7538
+ ...priorTerminal && incomingUnassessed ? {
7539
+ outcome: prior.outcome,
7540
+ finishedAt: prior.finishedAt,
7541
+ cost: {
7542
+ ...record.cost,
7543
+ ...prior.cost.ms === void 0 ? {} : { ms: prior.cost.ms },
7544
+ ...prior.cost.mergeMs === void 0 ? {} : { mergeMs: prior.cost.mergeMs }
7545
+ }
7546
+ } : {}
7547
+ };
7548
+ }
7549
+ }
7550
+ assertRecord(persisted);
7551
+ const revisionPath = join(reg.root, GRAPHS_DIR, `${stored.digest}.json`);
7552
+ try {
7553
+ const { digest: existingDigest, ...existing } = JSON.parse(await readFile(revisionPath, "utf8"));
7554
+ if (existingDigest !== stored.digest || graphDigest(existing) !== stored.digest) throw new ValidationError("graph-registry: stored graph revision is immutable but its content differs");
7555
+ } catch (error) {
7556
+ if (!isNoEntError(error)) throw error;
7557
+ writeAtomicDurableFile(revisionPath, JSON.stringify(stored), { preserveMode: true });
7558
+ }
7559
+ await upsertCommittedJsonLine(canonicalPath, persisted, recordKey);
7498
7560
  return stored;
7499
7561
  });
7500
7562
  }
@@ -7502,13 +7564,87 @@ async function recordGraphRun(reg, graph, record) {
7502
7564
  async function listGraphRuns(reg) {
7503
7565
  return readCommittedJsonFile(join(reg.root, RECORDS_FILE));
7504
7566
  }
7505
- /** Records for one task shape, newest last. */
7506
- async function graphRunsFor(reg, taskDigest) {
7507
- return (await listGraphRuns(reg)).filter((row) => row.taskDigest === taskDigest);
7567
+ function observedTopology(record) {
7568
+ return record.topologyDigest ?? (record.source ? "unknown" : record.graphDigest);
7569
+ }
7570
+ /** Records for one task shape or deterministic label query, newest last. */
7571
+ async function graphRunsFor(reg, query = {}) {
7572
+ const filters = typeof query === "string" ? { taskDigest: query } : query;
7573
+ return (await listGraphRuns(reg)).filter((row) => (filters.taskDigest === void 0 || row.taskDigest === filters.taskDigest) && (filters.taskType === void 0 || (row.taskType ?? "unknown") === filters.taskType) && (filters.topologyDigest === void 0 || observedTopology(row) === filters.topologyDigest) && (filters.sourceKind === void 0 || (row.source?.kind ?? "native") === filters.sourceKind));
7574
+ }
7575
+ function medianKnown(values) {
7576
+ const known = values.filter((value) => value !== void 0 && Number.isFinite(value) && value >= 0).sort((a, b) => a - b);
7577
+ const middle = Math.floor(known.length / 2);
7578
+ return {
7579
+ count: known.length,
7580
+ median: known.length === 0 ? null : known.length % 2 ? known[middle] : (known[middle - 1] + known[middle]) / 2
7581
+ };
7582
+ }
7583
+ function observedGraphSummary(records) {
7584
+ const groups = /* @__PURE__ */ new Map();
7585
+ for (const record of records) {
7586
+ const key = JSON.stringify([record.taskType ?? "unknown", observedTopology(record)]);
7587
+ const rows = groups.get(key);
7588
+ if (rows) rows.push(record);
7589
+ else groups.set(key, [record]);
7590
+ }
7591
+ const summaries = [...groups.values()].map((runs) => {
7592
+ const assessed = runs.filter((run) => run.outcome.kind === "delivered" || run.outcome.kind === "no-winner");
7593
+ const delivered = assessed.filter((run) => run.outcome.kind === "delivered");
7594
+ const wall = medianKnown(assessed.map((run) => run.cost.ms));
7595
+ const merge = medianKnown(delivered.filter((run) => run.evidence?.some((entry) => entry.kind === "pr-merged")).map((run) => run.cost.mergeMs));
7596
+ const tokens = medianKnown(assessed.map((run) => run.cost.tokens));
7597
+ const human = medianKnown(assessed.map((run) => run.cost.humanMessages));
7598
+ return {
7599
+ taskType: runs[0].taskType ?? "unknown",
7600
+ topologyDigest: observedTopology(runs[0]),
7601
+ delivered: delivered.length,
7602
+ assessed: assessed.length,
7603
+ unknown: runs.length - assessed.length,
7604
+ deliveredRate: assessed.length ? delivered.length / assessed.length : null,
7605
+ medianWallMs: wall.median,
7606
+ wallMsCount: wall.count,
7607
+ medianMergeMs: merge.median,
7608
+ mergeMsCount: merge.count,
7609
+ medianTokens: tokens.median,
7610
+ tokenCount: tokens.count,
7611
+ medianHumanMessages: human.median,
7612
+ humanMessageCount: human.count,
7613
+ runs
7614
+ };
7615
+ });
7616
+ summaries.sort((a, b) => {
7617
+ const delivered = (b.deliveredRate ?? -1) - (a.deliveredRate ?? -1);
7618
+ if (delivered) return delivered;
7619
+ for (const key of [
7620
+ "medianWallMs",
7621
+ "medianTokens",
7622
+ "medianHumanMessages"
7623
+ ]) {
7624
+ if (a[key] === b[key]) continue;
7625
+ if (a[key] === null) return 1;
7626
+ if (b[key] === null) return -1;
7627
+ return a[key] - b[key];
7628
+ }
7629
+ return a.taskType.localeCompare(b.taskType) || a.topologyDigest.localeCompare(b.topologyDigest);
7630
+ });
7631
+ return {
7632
+ recordCount: records.length,
7633
+ groups: summaries
7634
+ };
7635
+ }
7636
+ /** Query and rank the same registry records using the opt-in observational
7637
+ * policy: delivery rate, wall time, tokens, then human messages; unknowns last. */
7638
+ async function graphCorpusSummary(reg, query = {}) {
7639
+ return observedGraphSummary(await graphRunsFor(reg, query));
7508
7640
  }
7509
7641
  /** The documented heuristic: delivered beats failed; among delivered, cheaper
7510
7642
  * (tokens, then iterations) wins; ties go to the most recent. */
7511
- function pickBestGraph(records) {
7643
+ function pickBestGraph(records, options = {}) {
7644
+ if (options.policy === "observed") {
7645
+ const group = observedGraphSummary(records).groups[0];
7646
+ return group && pickBestGraph(group.runs);
7647
+ }
7512
7648
  const delivered = records.filter((row) => row.outcome.kind === "delivered");
7513
7649
  if (delivered.length === 0) return void 0;
7514
7650
  const better = (a, b) => {
@@ -7534,7 +7670,17 @@ async function loadGraph(reg, digest) {
7534
7670
  * author a new one — with the reason stated either way (the decision is data). */
7535
7671
  async function lookupGraph(reg, taskDigest) {
7536
7672
  const records = await graphRunsFor(reg, taskDigest);
7537
- const best = pickBestGraph(records);
7673
+ const candidates = [];
7674
+ const loaded = /* @__PURE__ */ new Map();
7675
+ for (const record of records) {
7676
+ if (!loaded.has(record.graphDigest)) loaded.set(record.graphDigest, await loadGraph(reg, record.graphDigest));
7677
+ if (!loaded.get(record.graphDigest)?.observed) candidates.push(record);
7678
+ }
7679
+ if (records.length && !candidates.length) return {
7680
+ kind: "author",
7681
+ reason: "only observed topologies are available; author an executable graph"
7682
+ };
7683
+ const best = pickBestGraph(candidates);
7538
7684
  if (best) {
7539
7685
  const graph = await loadGraph(reg, best.graphDigest);
7540
7686
  if (graph) return {
@@ -7555,6 +7701,7 @@ async function lookupGraph(reg, taskDigest) {
7555
7701
  /** Rehydrate a stored graph into a runnable one. The check comes from the
7556
7702
  * CALLER's environment (oracles are environment, never stored). */
7557
7703
  function graphFromStored(stored, check) {
7704
+ if (stored.observed) throw new ValidationError("graphFromStored: observed topology cannot be replayed");
7558
7705
  return {
7559
7706
  nodes: stored.nodes,
7560
7707
  edges: stored.edges,
@@ -7754,7 +7901,7 @@ function registerRecovery(env, makeRecursiveWorker) {
7754
7901
  * bridgeExecutor: bridge stream error: host-executor: acquire timeout after 60000ms
7755
7902
  * (in_flight=4/4, queued=1)
7756
7903
  *
7757
- * Measured 2026-08-22 on discovery-lab cells oscnp s2/s3: two live cells held 2 leads and up to 8
7904
+ * Two live cells held 2 leads and up to 8
7758
7905
  * workers on one bridge whose host executor caps live harness children at 4. A worker spawn that
7759
7906
  * queued past the bridge's single 60 s acquire deadline died there, and the run lost that worker
7760
7907
  * permanently even though a slot freed seconds later. The bridge retries nothing.
@@ -9796,6 +9943,6 @@ function superviseWithContext(profile, task, opts, brain) {
9796
9943
  }, brain));
9797
9944
  }
9798
9945
  //#endregion
9799
- export { noProgressFor as $, runBrainLoop as A, graphRootProfile as B, workerFromBackend as C, composeReentryTask as D, UNPROVEN_CONTINUITY as E, flowRootProfile as F, dumbContinuationFailPrompt as G, analyzesFindingsReportPrompt as H, journaledGateDecider as I, kernelPromptRegistry as J, dumbContinuationPassPrompt as K, routeFlowOf as L, createGraphOverlay as M, GraphRouteError as N, serveCoordinationMcp as O, createFlowRun as P, anyOf as Q, validateFlowGraph as R, taskShapeDigest as S, supervisorAgentWithTestBrain as T, createPromptRegistry as U, validateGraphTopology as V, delegatesWorkerBriefPrompt as W, promptHandle as X, naiveContinuationPrompt as Y, allWorkersStalled as Z, loadGraph as _, superviseRootProfile as a, renderAnytimeTable as at, recordGraphRun as b, retryPreSpawnRefusals as c, createSupervisorSpanRecorder as ct, graphDigest as d, plateau as et, graphFromStored as f, listGraphRuns as g, graph_registry_exports as h, profileGuidanceComposer as i, plateauLength as it, runtimeFlowBrain as j, driverAgent as k, withWorkerSpawnRetry as l, graphRunsFor as m, superviseFleetCapabilities as n, areaUnderCurve as nt, isPreSpawnExecutorFailure as o, readRootStream as ot, graphRegistry as p, formatPromptHandle as q, superviseWithTestBrain as r, bestSoFar as rt, resolveWorkerSpawnRetry as s, readRootStreamReceipt as st, supervise as t, anytimeReport as tt, digestOfGraph as u, lookupGraph as v, supervisorAgent as w, storedGraphDigests as x, pickBestGraph as y, defaultEdgeTraversalCap as z };
9946
+ export { allWorkersStalled as $, serveCoordinationMcp as A, validateFlowGraph as B, storedGraphDigests as C, supervisorAgentWithTestBrain as D, supervisorAgent as E, GraphRouteError as F, createPromptRegistry as G, graphRootProfile as H, createFlowRun as I, dumbContinuationPassPrompt as J, delegatesWorkerBriefPrompt as K, flowRootProfile as L, runBrainLoop as M, runtimeFlowBrain as N, UNPROVEN_CONTINUITY as O, createGraphOverlay as P, promptHandle as Q, journaledGateDecider as R, recordStoredGraphRun as S, workerFromBackend as T, validateGraphTopology as U, defaultEdgeTraversalCap as V, analyzesFindingsReportPrompt as W, kernelPromptRegistry as X, formatPromptHandle as Y, naiveContinuationPrompt as Z, listGraphRuns as _, superviseRootProfile as a, bestSoFar as at, pickBestGraph as b, retryPreSpawnRefusals as c, readRootStream as ct, graphCorpusSummary as d, anyOf as et, graphDigest as f, graph_registry_exports as g, graphRunsFor as h, profileGuidanceComposer as i, areaUnderCurve as it, driverAgent as j, composeReentryTask as k, withWorkerSpawnRetry as l, readRootStreamReceipt as lt, graphRegistry as m, superviseFleetCapabilities as n, plateau as nt, isPreSpawnExecutorFailure as o, plateauLength as ot, graphFromStored as p, dumbContinuationFailPrompt as q, superviseWithTestBrain as r, anytimeReport as rt, resolveWorkerSpawnRetry as s, renderAnytimeTable as st, supervise as t, noProgressFor as tt, digestOfGraph as u, createSupervisorSpanRecorder as ut, loadGraph as v, taskShapeDigest as w, recordGraphRun as x, lookupGraph as y, routeFlowOf as z };
9800
9947
 
9801
- //# sourceMappingURL=supervise-BUOeThuB.js.map
9948
+ //# sourceMappingURL=supervise-BGfm2GlY.js.map