effect-agent 0.1.0-beta.97 → 0.1.0-beta.99

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 (143) hide show
  1. package/dist/{AgentRuntime-B64362Id.d.mts → AgentRuntime-BMzrJos6.d.mts} +2 -2
  2. package/dist/{AgentRuntime-Cdvqw7l_.mjs → AgentRuntime-BWOnNc0d.mjs} +78 -42
  3. package/dist/AgentRuntime-BWOnNc0d.mjs.map +1 -0
  4. package/dist/{DurableAgentRuntime-DbUvZHDZ.mjs → DurableAgentRuntime-BE_OjQjz.mjs} +471 -252
  5. package/dist/DurableAgentRuntime-BE_OjQjz.mjs.map +1 -0
  6. package/dist/{DurableFailpoint-DQJet828.d.mts → DurableFailpoint-mx3-nsxU.d.mts} +3 -3
  7. package/dist/{EventSource-D6PAAEyK.d.mts → EventSource-BZ73J0s5.d.mts} +3 -3
  8. package/dist/{PreparedInputAdmission-omMbwd--.d.mts → PreparedInputAdmission-BkeI-Xvr.d.mts} +4 -4
  9. package/dist/{Records-CV49DgQK.d.mts → Records-BIiRLqlz.d.mts} +92 -128
  10. package/dist/{Records-BAutSSnJ.mjs → Records-DR1xtbXY.mjs} +35 -8
  11. package/dist/Records-DR1xtbXY.mjs.map +1 -0
  12. package/dist/{RunJournal-DRRRZmG7.mjs → RunJournal-DNs3PM4K.mjs} +80 -23
  13. package/dist/RunJournal-DNs3PM4K.mjs.map +1 -0
  14. package/dist/{RunOptions-Clj8cLsp.d.mts → RunOptions-Bruk54SE.d.mts} +13 -4
  15. package/dist/{Schedule-DePbGfgd.d.mts → Schedule-BNFlluAl.d.mts} +2 -2
  16. package/dist/{Scheduling-C3QpYn0W.mjs → Scheduling-HFH0pST1.mjs} +2 -2
  17. package/dist/{Scheduling-C3QpYn0W.mjs.map → Scheduling-HFH0pST1.mjs.map} +1 -1
  18. package/dist/{Subagent-Cbfzylz1.mjs → Subagent-C2s8PFrd.mjs} +2 -2
  19. package/dist/{Subagent-Cbfzylz1.mjs.map → Subagent-C2s8PFrd.mjs.map} +1 -1
  20. package/dist/{Subagent-Bm1dRecN.d.mts → Subagent-m7ywTCe4.d.mts} +3 -3
  21. package/dist/{Subscription-BR_8Cxh3.d.mts → Subscription-BCQ3L9Zp.d.mts} +3 -3
  22. package/dist/{SubscriptionInput-B95sQbuk.d.mts → SubscriptionInput-Cqu4_RW3.d.mts} +3 -3
  23. package/dist/{ToolReconciler-DQVaJfpE.d.mts → ToolReconciler-BmVRAHKs.d.mts} +8 -4
  24. package/dist/agent-registration-cXpB8cBU.mjs +199 -0
  25. package/dist/agent-registration-cXpB8cBU.mjs.map +1 -0
  26. package/dist/capabilities/Commands.d.mts +1 -1
  27. package/dist/capabilities/RunHooks.d.mts +1 -1
  28. package/dist/capabilities/Subagent.d.mts +1 -1
  29. package/dist/capabilities/Subagent.mjs +1 -1
  30. package/dist/durable/ActivityStore.d.mts +1 -1
  31. package/dist/durable/ActivityStore.mjs +1 -1
  32. package/dist/durable/Admin.d.mts +1 -1
  33. package/dist/durable/Admin.mjs +12 -10
  34. package/dist/durable/Admin.mjs.map +1 -1
  35. package/dist/durable/AgentRegistration.d.mts +2 -2
  36. package/dist/durable/AgentRegistration.mjs +4 -8
  37. package/dist/durable/AgentRegistration.mjs.map +1 -1
  38. package/dist/durable/Certification.d.mts +2 -2
  39. package/dist/durable/CommittedActivity.d.mts +1 -1
  40. package/dist/durable/CommittedActivity.mjs +1 -1
  41. package/dist/durable/Digest.d.mts +1 -1
  42. package/dist/durable/Digest.mjs +1 -1
  43. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  44. package/dist/durable/DurableAgentRuntime.mjs +1 -1
  45. package/dist/durable/DurableFailpoint.d.mts +1 -1
  46. package/dist/durable/DurableFailpoint.mjs +2 -0
  47. package/dist/durable/DurableFailpoint.mjs.map +1 -1
  48. package/dist/durable/DurableFailpointTestControl.d.mts +1 -1
  49. package/dist/durable/EventSource.d.mts +1 -1
  50. package/dist/durable/EventSource.mjs +1 -1
  51. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  52. package/dist/durable/GitHubWorkflowSource.mjs +1 -1
  53. package/dist/durable/MessageDelivery.d.mts +3 -3
  54. package/dist/durable/MessageDelivery.mjs +1 -1
  55. package/dist/durable/MessageDeliveryStoreConformance.d.mts +39 -39
  56. package/dist/durable/MessageDeliveryStoreConformance.mjs +1 -1
  57. package/dist/durable/PersistentHistory.d.mts +1 -1
  58. package/dist/durable/PersistentHistory.mjs +2 -2
  59. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  60. package/dist/durable/Records.d.mts +2 -2
  61. package/dist/durable/Records.mjs +2 -2
  62. package/dist/durable/Recovery.d.mts +1 -1
  63. package/dist/durable/Recovery.mjs +9 -9
  64. package/dist/durable/Recovery.mjs.map +1 -1
  65. package/dist/durable/RunJournal.d.mts +2 -2
  66. package/dist/durable/RunJournal.mjs +2 -2
  67. package/dist/durable/Schedule.d.mts +1 -1
  68. package/dist/durable/Schedule.mjs +1 -1
  69. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  70. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  71. package/dist/durable/ScheduleTransition.d.mts +1 -1
  72. package/dist/durable/ScheduleTransition.mjs +1 -1
  73. package/dist/durable/Scheduling.d.mts +2 -2
  74. package/dist/durable/Scheduling.mjs +1 -1
  75. package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
  76. package/dist/durable/SqlStorageV2Upgrade.mjs +1 -1
  77. package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
  78. package/dist/durable/SqlSubscriptionStore.mjs +1 -1
  79. package/dist/durable/SubmissionLedger.d.mts +1 -1
  80. package/dist/durable/SubmissionLedger.mjs +14 -13
  81. package/dist/durable/SubmissionLedger.mjs.map +1 -1
  82. package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
  83. package/dist/durable/SubmissionLedgerConformance.mjs +9 -2
  84. package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
  85. package/dist/durable/SubmissionStatus.d.mts +1 -1
  86. package/dist/durable/Subscription.d.mts +1 -1
  87. package/dist/durable/Subscription.mjs +1 -1
  88. package/dist/durable/SubscriptionInput.d.mts +1 -1
  89. package/dist/durable/SubscriptionInput.mjs +2 -2
  90. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  91. package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
  92. package/dist/durable/SubscriptionTools.d.mts +3 -3
  93. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  94. package/dist/durable/SubscriptionTransition.mjs +1 -1
  95. package/dist/durable/Subscriptions.d.mts +5 -5
  96. package/dist/durable/Subscriptions.mjs +1 -1
  97. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  98. package/dist/durable/ThreadContextHistory.mjs +1 -1
  99. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  100. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  101. package/dist/durable/ThreadInvariants.d.mts +4 -2
  102. package/dist/durable/ThreadInvariants.mjs +49 -3
  103. package/dist/durable/ThreadInvariants.mjs.map +1 -1
  104. package/dist/durable/ThreadProjection.d.mts +1 -1
  105. package/dist/durable/ThreadProjection.mjs +1 -1
  106. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  107. package/dist/durable/ThreadStore.d.mts +1 -1
  108. package/dist/durable/ThreadStore.mjs +1 -1
  109. package/dist/durable/ThreadStoreConformance.d.mts +1 -1
  110. package/dist/durable/ThreadStoreConformance.mjs +1 -1
  111. package/dist/durable/ToolReconciler.d.mts +1 -1
  112. package/dist/durable/ToolReconciler.mjs +9 -5
  113. package/dist/durable/ToolReconciler.mjs.map +1 -1
  114. package/dist/durable/WorkerHost.d.mts +1 -1
  115. package/dist/engine/AgentRuntime.d.mts +1 -1
  116. package/dist/engine/AgentRuntime.mjs +1 -1
  117. package/dist/engine/RunOptions.d.mts +1 -1
  118. package/dist/engine/RunOptions.mjs.map +1 -1
  119. package/dist/index.d.mts +11 -11
  120. package/dist/index.mjs +6 -6
  121. package/package.json +1 -1
  122. package/src/durable/Admin.ts +20 -11
  123. package/src/durable/AgentRegistration.ts +1 -5
  124. package/src/durable/DurableAgentRuntime.ts +947 -464
  125. package/src/durable/DurableFailpoint.ts +2 -0
  126. package/src/durable/Records.ts +30 -5
  127. package/src/durable/Recovery.ts +8 -8
  128. package/src/durable/RunJournal.ts +128 -51
  129. package/src/durable/SubmissionLedger.ts +13 -12
  130. package/src/durable/SubmissionLedgerConformance.ts +13 -2
  131. package/src/durable/ThreadInvariants.ts +70 -5
  132. package/src/durable/ToolReconciler.ts +7 -3
  133. package/src/durable/internal/agent-registration.ts +65 -414
  134. package/src/durable/internal/messaging-host.ts +0 -2
  135. package/src/durable/internal/worker-host.ts +34 -96
  136. package/src/engine/RunOptions.ts +13 -3
  137. package/src/engine/internal/agent-runtime.ts +160 -106
  138. package/dist/AgentRuntime-Cdvqw7l_.mjs.map +0 -1
  139. package/dist/DurableAgentRuntime-DbUvZHDZ.mjs.map +0 -1
  140. package/dist/Records-BAutSSnJ.mjs.map +0 -1
  141. package/dist/RunJournal-DRRRZmG7.mjs.map +0 -1
  142. package/dist/agent-registration-CXGDwvJH.mjs +0 -379
  143. package/dist/agent-registration-CXGDwvJH.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Admin.mjs","names":[],"sources":["../../src/durable/Admin.ts"],"sourcesContent":["import { DateTime, Schema } from \"effect\";\n\nimport { ThreadId, SubmissionId, ToolCallId } from \"../core/Identifiers.ts\";\nimport { CanonicalSequence, SettlementOutcome, ToolCallUnknown } from \"./Records.ts\";\nimport {\n OpenDelegationCallEvidence,\n OpenToolCallEvidence,\n PendingApprovalEvidence,\n RecoveryDecision,\n} from \"./Recovery.ts\";\nimport {\n AbortIntent,\n AbortCommand,\n ApprovalDecisionIntent,\n ChildAttachmentSnapshot,\n JoinSnapshot,\n ParentLinkage,\n QueueSequence,\n SubmissionState,\n SuspensionSnapshot,\n UnknownResolutionIntent,\n type RecoverySnapshot,\n} from \"./SubmissionLedger.ts\";\n\n/**\n * Pure report logic for the P7 administrative operations (plan §3): the Schema classes carried\n * by `DurableAgentRuntime.explain`/`verify`/`scanObligations`, the operator meaning table for\n * every recovery decision tag, and the text renderer. Everything here is pure — no port access,\n * no clocks, no writes — so hosts, CLIs, and wire envelopes share one report vocabulary.\n */\n\nconst BoundedDetail = Schema.String.check(Schema.isMaxLength(4_096));\n\n/** Non-negative whole seconds derived from the Effect Clock. */\nconst AgeSeconds = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n// ---------------------------------------------------------------------------\n// explain — RecoveryExplanation\n// ---------------------------------------------------------------------------\n\n/**\n * The disposition family of `RecoveryReport`, reused verbatim so an explanation predicts exactly\n * what `runRecovery`/`retry` would report for the same decision.\n */\nexport const RecoveryDisposition = Schema.Literals([\"repaired\", \"deferred\", \"none\", \"unknown\"]);\nexport type RecoveryDisposition = typeof RecoveryDisposition.Type;\n\n/** Submission identity, lane position, and Clock-derived ages (DUR-017 obligation visibility). */\nexport class ExplainedSubmission extends Schema.Class<ExplainedSubmission>(\n \"@effect-agent/thread/ExplainedSubmission\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n queueSequence: QueueSequence,\n createdAt: Schema.DateTimeUtcFromString,\n readyAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n /** Whole seconds since admission (`createdAt`). */\n ageSeconds: AgeSeconds,\n /** Whole seconds since readiness, present exactly when `readyAt` is recorded. */\n readyAgeSeconds: Schema.optionalKey(AgeSeconds),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n}) {}\n\n/** One durable Unknown Outcome and whether a covering resolution intent exists (DUR-017). */\nexport class ExplainedUnknownCall extends Schema.Class<ExplainedUnknownCall>(\n \"@effect-agent/thread/ExplainedUnknownCall\",\n)({\n toolCallId: ToolCallId,\n toolName: ToolCallUnknown.fields.toolName,\n reason: ToolCallUnknown.fields.reason,\n recordedAt: Schema.DateTimeUtcFromString,\n /** A durable `resolveUnknown` intent covers this call. */\n resolved: Schema.Boolean,\n}) {}\n\n/**\n * The evidence summary of one explanation: the classifier's canonical-history inputs plus the\n * durable intents and subagent attachments the ledger snapshot carries. Everything is read-only\n * observation — assembling this value performs zero writes.\n */\nexport class ExplainedEvidence extends Schema.Class<ExplainedEvidence>(\n \"@effect-agent/thread/ExplainedEvidence\",\n)({\n threadMaterialized: Schema.Boolean,\n inputRecorded: Schema.Boolean,\n abortRecorded: Schema.Boolean,\n recordedSettlementOutcome: Schema.optionalKey(SettlementOutcome),\n /** Prepared ordinary Tool Calls without a canonical outcome (DUR-009). */\n openToolCalls: Schema.Array(OpenToolCallEvidence),\n /** Delegation Tool Calls with an open parent-side obligation. */\n openDelegationCalls: Schema.Array(OpenDelegationCallEvidence),\n /** Canonically requested approvals without a canonical decision. */\n approvalsPending: Schema.Array(PendingApprovalEvidence),\n /** Durable Unknown Outcomes with their resolution coverage (DUR-017). */\n unknownCalls: Schema.Array(ExplainedUnknownCall),\n /** Durable approval decisions recorded against this Submission. */\n approvalDecisions: Schema.Array(ApprovalDecisionIntent),\n /** Durable unknown-outcome resolutions recorded against this Submission. */\n unknownResolutions: Schema.Array(UnknownResolutionIntent),\n /** Parent-side child attachments. */\n childAttachments: Schema.Array(ChildAttachmentSnapshot),\n /** Host-side joined/joining members of this Submission's Run (DUR-016). */\n joins: Schema.Array(JoinSnapshot),\n /** Joined-side host identity, when this Submission is joined to a host Run. */\n hostSubmissionId: Schema.optionalKey(SubmissionId),\n suspension: Schema.optionalKey(SuspensionSnapshot),\n abortIntent: Schema.optionalKey(AbortIntent),\n}) {}\n\n/**\n * The read-only recovery explanation of one Submission (P7 exit gate \"operators can explain\n * recovery state without editing storage\"): the submission summary, the evidence the pure\n * classifier consumed, the exact `RecoveryDecision` it selected, that decision's operator\n * meaning, and the disposition the recovery pass would report for it.\n */\nexport class RecoveryExplanation extends Schema.Class<RecoveryExplanation>(\n \"@effect-agent/thread/RecoveryExplanation\",\n)({\n submission: ExplainedSubmission,\n evidence: ExplainedEvidence,\n decision: RecoveryDecision,\n /** Static operator meaning of `decision._tag` (see `RECOVERY_DECISION_MEANINGS`). */\n decisionMeaning: BoundedDetail,\n /**\n * The disposition `runRecovery` would report when this decision executes without claim\n * contention (see `predictRecoveryDisposition`): `repaired` = the recovery pass itself fixes\n * it; `deferred` = a claiming worker must finish it; `unknown` = durably blocked on the\n * authorized DUR-017 resolution path; `none` = settled, nothing owed.\n */\n disposition: RecoveryDisposition,\n explainedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/**\n * Operator meaning of every recovery decision tag, matching the classifier docstrings in\n * `recovery.ts` (the classifier remains the semantic authority; this table is its operator\n * rendering). Exhaustive over `RecoveryDecision` — adding a decision without a meaning is a\n * compile error here.\n */\nexport const RECOVERY_DECISION_MEANINGS: Readonly<Record<RecoveryDecision[\"_tag\"], string>> = {\n CompleteMaterialization:\n \"Ledger admission committed but the Thread is not durable: recovery finishes materialization, appends ThreadCreated, and marks readiness.\",\n RepairReadiness:\n \"The Thread is durable but the readiness marker is missing: recovery replays the idempotent markReady.\",\n ApplyInput:\n \"No canonical input record exists yet: recovery appends the deterministic UserInputRecorded record and marks it applied.\",\n RepairInputMarker:\n \"The canonical input record exists but the ledger marker was lost: recovery repairs the marker from history, never the reverse (DUR-015).\",\n ResumeFromTurnBoundary:\n \"Input is applied and no terminal work is reserved: a claiming worker resumes the Run from the last committed Turn boundary; the model may be re-invoked and any duplicate cost is observable (durability §9).\",\n AppendReservedSettlement:\n \"A settlement is reserved but not canonical: recovery appends the EXACT reserved record, then finalizes (DUR-011).\",\n FinalizeLedgerFromHistory:\n \"The canonical settlement record exists: recovery rebuilds/finalizes the ledger from history and never rewrites history from the cached ledger status (DUR-011, DUR-015).\",\n SettleAborted:\n \"A durable abort intent exists with no reserved outcome and no open attached-child obligation: recovery settles aborted, first recording ToolCallUnknown audits for open ordinary calls — abort never asserts external rollback (durability §13).\",\n MarkUnknown:\n \"Prepared ordinary Tool Calls have no canonical outcome: recovery reconciles each open call and marks the remainder Unknown — never an automatic replay (DUR-009/DUR-017).\",\n ResumePendingToolBatch:\n \"A committed tool-declaring response has zero prepared and zero settled records: a claiming worker resumes the declared batch without model re-invocation and without Unknown (durability §15).\",\n AwaitApprovalDecision:\n \"Canonically requested approvals lack decisions: the lane waits durably for the authorized resolveApproval path (recovery repairs a lost suspend transition from history).\",\n ResumeSuspended:\n \"Every pending approval has a durable decision: a claiming worker resumes the declared batch, appending the canonical ToolApprovalDecided records first.\",\n AwaitUnknownResolution:\n \"Unknown Outcomes lack covering resolutions: the lane stays blocked awaiting the authorized DUR-017 resolveUnknown path; the obligation stays visible, nothing replays.\",\n ApplyUnknownResolutions:\n \"Durable resolution intents cover every open call: recovery applies them canonically and reopens the lane.\",\n RevertJoining:\n \"The Submission is joining without a canonical input record: recovery reverts it to ready — the input was never consumed and will be delivered exactly once later (DUR-016).\",\n RepairJoinMarker:\n \"The canonical joined input exists but the joined marker was lost: recovery repairs the marker only; the input reattaches, never duplicates (DUR-015/DUR-016).\",\n SettleJoinedWithHost:\n \"The host Run settled canonically: recovery settles this joined Submission with the host outcome — each joined Submission is owed its own settlement (DUR-002).\",\n AwaitHostSettlement:\n \"The Submission is joined and its host Run is still live: nothing to repair — the input reattaches through the host's resume and the Submission settles with the host.\",\n CompleteChildAdmission:\n \"A canonical SubagentRequested exists and the authoritative lookup proved not-admitted: recovery idempotently admits the intended child from the canonical request payload alone.\",\n AwaitChildAdmissionResolution:\n \"The authoritative child-admission lookup answered indeterminate (or was not performed): recovery waits and retries the authoritative owner; a second admission never occurs (SUB-031).\",\n RepairSubagentStartLink:\n \"The child is admitted but the parent's SubagentStarted link (or reservation attachment) is missing: recovery resolves the SAME child by its deterministic key and appends the exact link (SUB-016/SUB-017).\",\n EnsureWaitingForChild:\n \"Children are established and at least one is nonterminal while the parent lane is not durably suspended: recovery restores the waitingForChild suspension; it reattaches the one existing child and never spawns a replacement (SUB-018/SUB-030).\",\n AwaitChildSettlement:\n \"The parent is durably suspended waitingForChild and a listed child is not yet provably settled: the lane stays dormant, consumes no worker permit, and the child's Settlement wakes it durably (SUB-021/SUB-030).\",\n ResumeWaitingParent:\n \"Every relevant child is provably settled but the parent has not joined: recovery replays the idempotent wake so a claiming worker resumes the declared batch and joins each child's canonical Settlement.\",\n ApplyJoinAccounting:\n \"The canonical SubagentJoined record exists but the reservation release is incomplete: recovery replays the accounting decision FROM the canonical record — budget stays unavailable until repair, never available twice (DUR-015).\",\n PropagateChildAbort:\n \"Parent abort is canonical while attached children are nonterminal: recovery idempotently issues each child's durable abort command and keeps the parent waiting for the joins — request-abort-and-join is the only close behavior.\",\n ReleaseOrphanChildReservation:\n \"A child budget reservation can no longer bind a child: recovery freezes the deterministic zero-consumed accounting decision and releases the unused allocation exactly once.\",\n AwaitParentEstablishment:\n \"The Submission is a parent-linked child whose Thread lacks the canonical lineage record: the child lane defers its own readiness repair — the parent's idempotent establishment completes it, so a child never runs a Turn before its lineage is canonical (P7 §7(a), SUB-016).\",\n NoAction: \"The Submission is settled; nothing is owed.\",\n};\n\n/** The operator meaning of one recovery decision tag. */\nexport const recoveryDecisionMeaning = (tag: RecoveryDecision[\"_tag\"]): string =>\n RECOVERY_DECISION_MEANINGS[tag];\n\n/**\n * The disposition the recovery executor reports for a decision when its repair executes without\n * claim contention (pure prediction; `executeRecoveryDecision` in the coordinator remains the\n * execution authority — a lane concurrently claimed by a worker can always defer instead).\n * `AwaitApprovalDecision` depends on the snapshot: an already-suspended lane waits (`deferred`),\n * while a claimable lane with a lost suspend transition is repaired.\n */\nexport const predictRecoveryDisposition = (\n decision: RecoveryDecision,\n snapshot: RecoverySnapshot,\n): RecoveryDisposition => {\n switch (decision._tag) {\n case \"NoAction\":\n return \"none\";\n case \"AwaitUnknownResolution\":\n case \"MarkUnknown\":\n return \"unknown\";\n case \"ResumeFromTurnBoundary\":\n case \"ResumePendingToolBatch\":\n case \"ResumeSuspended\":\n case \"AwaitHostSettlement\":\n case \"AwaitChildAdmissionResolution\":\n case \"AwaitChildSettlement\":\n case \"AwaitParentEstablishment\":\n return \"deferred\";\n case \"AwaitApprovalDecision\":\n return snapshot.submission.state === \"suspended\" ? \"deferred\" : \"repaired\";\n default:\n return \"repaired\";\n }\n};\n\nconst formatUtc = (value: DateTime.Utc): string => DateTime.formatIso(value);\n\n/** Pure operator text for one explanation (the CLI's `explain` output body). */\nexport const renderRecoveryExplanation = (explanation: RecoveryExplanation): string => {\n const submission = explanation.submission;\n const evidence = explanation.evidence;\n\n const lines: Array<string> = [\n `Submission ${submission.submissionId} (thread ${submission.threadId})`,\n ` state: ${submission.state} queue: ${submission.queueSequence} age: ${submission.ageSeconds}s`,\n ` admitted: ${formatUtc(submission.createdAt)}${\n submission.readyAt === undefined ? \"\" : ` ready: ${formatUtc(submission.readyAt)}`\n }`,\n ];\n\n if (submission.parentLinkage !== undefined) {\n lines.push(\n ` attached child of ${submission.parentLinkage.parentSubmissionId} (tool call ${submission.parentLinkage.parentToolCallId})`,\n );\n }\n lines.push(\n ` evidence: input=${evidence.inputRecorded ? \"recorded\" : \"missing\"}` +\n ` settlement=${evidence.recordedSettlementOutcome ?? \"none\"}` +\n ` abort=${evidence.abortRecorded ? \"recorded\" : \"none\"}` +\n ` materialized=${evidence.threadMaterialized ? \"yes\" : \"no\"}`,\n );\n if (evidence.openToolCalls.length > 0) {\n lines.push(\n ` open ordinary tool calls: ${evidence.openToolCalls\n .map((call) => `${call.toolName}#${call.toolCallId}`)\n .join(\", \")}`,\n );\n }\n if (evidence.openDelegationCalls.length > 0) {\n lines.push(\n ` open delegation calls: ${evidence.openDelegationCalls\n .map(\n (call) =>\n `${call.toolName}#${call.toolCallId}(requested=${call.requested} started=${call.started} joined=${call.joined})`,\n )\n .join(\", \")}`,\n );\n }\n if (evidence.approvalsPending.length > 0) {\n lines.push(\n ` approvals pending: ${evidence.approvalsPending\n .map((pending) => pending.toolCallId)\n .join(\", \")}`,\n );\n }\n for (const unknown of evidence.unknownCalls) {\n lines.push(\n ` unknown outcome: ${unknown.toolName}#${unknown.toolCallId} recorded ${formatUtc(unknown.recordedAt)} ${\n unknown.resolved ? \"(resolution intent recorded)\" : \"(awaiting resolveUnknown)\"\n }`,\n );\n }\n if (evidence.childAttachments.length > 0) {\n lines.push(\n ` attached children: ${evidence.childAttachments\n .map((child) => `${child.childSubmissionId}(${child.childState})`)\n .join(\", \")}`,\n );\n }\n if (evidence.joins.length > 0) {\n lines.push(\n ` joined members: ${evidence.joins\n .map((join) => `${join.submissionId}(${join.state})`)\n .join(\", \")}`,\n );\n }\n if (evidence.hostSubmissionId !== undefined) {\n lines.push(` joined to host: ${evidence.hostSubmissionId}`);\n }\n if (evidence.suspension !== undefined) {\n lines.push(\n ` suspended (${evidence.suspension.reason._tag}) since ${formatUtc(evidence.suspension.suspendedAt)}`,\n );\n }\n if (evidence.abortIntent !== undefined) {\n lines.push(\n ` abort intent by ${evidence.abortIntent.author} at ${formatUtc(evidence.abortIntent.requestedAt)}`,\n );\n }\n lines.push(\n ` decision: ${explanation.decision._tag} → disposition ${explanation.disposition}`,\n ` meaning: ${explanation.decisionMeaning}`,\n );\n\n return lines.join(\"\\n\");\n};\n\n// ---------------------------------------------------------------------------\n// verify — IntegrityReport\n// ---------------------------------------------------------------------------\n\n/** The named integrity checks `verifyThreadInvariants` performs. */\nexport const IntegrityCheckName = Schema.Literals([\n /** Every exported envelope round-trips its canonical Schema. */\n \"schema-round-trip\",\n /** No canonical record identity appears twice (DUR-007). */\n \"record-identity\",\n /** Canonical sequences are gap-free from 1 through the exported tail. */\n \"sequence-contiguity\",\n /** The tail digest chain recomputes from EMPTY_TAIL_DIGEST over every batch (DUR-006/DUR-007). */\n \"digest-chain\",\n /** Canonical `input:{sid}` records follow the admitted FIFO order (DUR-004). */\n \"fifo-input-order\",\n /** Canonical settlement records follow the admitted FIFO order (DUR-004); aborted\n * settlements of never-run work are exempt by design (P7 §7(c)). */\n \"fifo-settlement-order\",\n /** At most one canonical terminal record per Submission; exactly one per settled row (DUR-002). */\n \"terminal-uniqueness\",\n /** Ledger terminal state agrees with the canonical settlement record (DUR-015). */\n \"ledger-canonical-agreement\",\n /** The stored checkpoint binds to the recomputed digest chain at its sequence. */\n \"checkpoint-binding\",\n /** Convergence mode only: every known Submission is settled. */\n \"all-settled\",\n]);\n\nexport type IntegrityCheckName = typeof IntegrityCheckName.Type;\n\nexport const IntegrityCheckStatus = Schema.Literals([\"passed\", \"failed\", \"skipped\"]);\nexport type IntegrityCheckStatus = typeof IntegrityCheckStatus.Type;\n\n/** One typed check result; `detail` explains a failure or the honest reason for a skip. */\nexport class IntegrityCheck extends Schema.Class<IntegrityCheck>(\n \"@effect-agent/thread/IntegrityCheck\",\n)({\n name: IntegrityCheckName,\n status: IntegrityCheckStatus,\n detail: Schema.optionalKey(BoundedDetail),\n}) {}\n\n/**\n * The read-only integrity verdict for one Thread (plan §3 `verify`): typed per-check\n * results, never a repair. `ok` is true exactly when no check failed — skipped checks are\n * honest scope statements, not silent passes.\n */\nexport class IntegrityReport extends Schema.Class<IntegrityReport>(\n \"@effect-agent/thread/IntegrityReport\",\n)({\n threadId: ThreadId,\n tailSequence: CanonicalSequence,\n recordCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n submissionCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n checks: Schema.Array(IntegrityCheck),\n ok: Schema.Boolean,\n}) {}\n\n// ---------------------------------------------------------------------------\n// scanObligations — ObligationReport\n// ---------------------------------------------------------------------------\n\n/**\n * What one nonterminal Submission is visibly blocked on (DUR-017 operator surface; OPS-001).\n * `ready-aged`/`running-aged` are not blocks — they are accepted work whose settlement age is\n * measurable and alertable.\n */\nexport const ObligationBlockedOn = Schema.Literals([\n \"unknown\",\n \"approval\",\n \"waitingForChild\",\n \"ready-aged\",\n \"running-aged\",\n]);\n\nexport type ObligationBlockedOn = typeof ObligationBlockedOn.Type;\n\nexport const ObligationSeverity = Schema.Literals([\"ok\", \"aging\", \"overdue\"]);\nexport type ObligationSeverity = typeof ObligationSeverity.Type;\n\n/** Host-supplied age thresholds; the framework deliberately does not own the alert loop. */\nexport class ObligationThresholds extends Schema.Class<ObligationThresholds>(\n \"@effect-agent/thread/ObligationThresholds\",\n)({\n /** Age (whole seconds) at which an obligation is reported `aging`. */\n agingSeconds: AgeSeconds,\n /** Age (whole seconds) at which an obligation is reported `overdue`. */\n overdueSeconds: AgeSeconds,\n}) {}\n\n/** One nonterminal accepted-work obligation with its age and severity. */\nexport class ObligationEntry extends Schema.Class<ObligationEntry>(\n \"@effect-agent/thread/ObligationEntry\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n blockedOn: ObligationBlockedOn,\n ageSeconds: AgeSeconds,\n severity: ObligationSeverity,\n}) {}\n\n/**\n * The scan-based DUR-017/OPS-001 operator surface (plan §3): a fold of the ledger's nonterminal\n * scan into aged, severity-classified rows. Scan-based, never a daemon — hosts run it\n * periodically and export logs/metrics; ages need no storage-version bump because every source\n * timestamp already exists (`createdAt`/`readyAt`, `suspendedAt`, the canonical\n * `ToolCallUnknown` record's `createdAt`).\n */\nexport class ObligationReport extends Schema.Class<ObligationReport>(\n \"@effect-agent/thread/ObligationReport\",\n)({\n thresholds: ObligationThresholds,\n entries: Schema.Array(ObligationEntry),\n generatedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/** Severity of one obligation age under the supplied thresholds. */\nexport const obligationSeverityOf = (\n ageSeconds: number,\n thresholds: ObligationThresholds,\n): ObligationSeverity =>\n ageSeconds >= thresholds.overdueSeconds\n ? \"overdue\"\n : ageSeconds >= thresholds.agingSeconds\n ? \"aging\"\n : \"ok\";\n\n// ---------------------------------------------------------------------------\n// retry — typed command and refusals\n// ---------------------------------------------------------------------------\n\n/**\n * The mandatory-audit retry command (SEC-011): `author`/`reason` carry the same bounds as the\n * canonical abort command so every mutating administrative operation stays attributable. The\n * executed repair itself appends the deterministic `RepairAnnotated` audit record (DUR-013) —\n * retry adds no new canonical record type.\n */\nexport class RetryCommand extends Schema.Class<RetryCommand>(\"@effect-agent/thread/RetryCommand\")({\n submissionId: SubmissionId,\n author: AbortCommand.fields.author,\n reason: AbortCommand.fields.reason,\n}) {}\n\n/** Why a retry was refused without executing anything. */\nexport const RetryRefusalReason = Schema.Literals([\n /** The Submission is settled; terminal outcomes are never revisited (DUR-002). */\n \"settled\",\n /** The lane is durably blocked on Unknown Outcomes; use `resolveUnknown` (DUR-017). */\n \"await-unknown-resolution\",\n /** The lane is durably waiting for approval decisions; use `resolveApproval`. */\n \"await-approval-decision\",\n]);\n\nexport type RetryRefusalReason = typeof RetryRefusalReason.Type;\n\n/**\n * Typed refusal of `retry` (plan §3): lanes blocked on `AwaitUnknownResolution` or\n * `AwaitApprovalDecision` have their own authorized operations, and settled work is never\n * re-driven. The refusal names the classifier decision so the operator sees WHY.\n */\nexport class RetryRefused extends Schema.TaggedError<RetryRefused>()(\"RetryRefused\", {\n submissionId: SubmissionId,\n refusal: RetryRefusalReason,\n decisionTag: Schema.String.check(Schema.isMaxLength(256)),\n message: Schema.String.check(Schema.isMaxLength(4_096)),\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gBAAgB,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;;AAGnE,MAAM,aAAa,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;;;;AAUpE,MAAa,sBAAsB,OAAO,SAAS;CAAC;CAAY;CAAY;CAAQ;AAAS,CAAC;;AAI9F,IAAa,sBAAb,cAAyC,OAAO,MAC9C,0CACF,CAAC,CAAC;CACA,cAAc;CACd,UAAU;CACV,OAAO;CACP,eAAe;CACf,WAAW,OAAO;CAClB,SAAS,OAAO,YAAY,OAAO,qBAAqB;;CAExD,YAAY;;CAEZ,iBAAiB,OAAO,YAAY,UAAU;CAC9C,eAAe,OAAO,YAAY,aAAa;AACjD,CAAC,CAAC,CAAC,CA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QAAQ,aAAa,OAAO;CAC5B,QAAQ,aAAa,OAAO;AAC9B,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,qBAAqB,OAAO,SAAS;CAEhD;CAEA;CAEA;AACF,CAAC;;;;;;AASD,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,cAAc;CACd,SAAS;CACT,aAAa,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;CACxD,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;AACxD,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Admin.mjs","names":[],"sources":["../../src/durable/Admin.ts"],"sourcesContent":["import { DateTime, Effect, Schema } from \"effect\";\n\nimport { ThreadId, SubmissionId, ToolCallId } from \"../core/Identifiers.ts\";\nimport {\n CanonicalSequence,\n SettlementOutcome,\n ToolCallPrepared,\n ToolCallUnknown,\n} from \"./Records.ts\";\nimport {\n OpenDelegationCallEvidence,\n OpenToolCallEvidence,\n PendingApprovalEvidence,\n RecoveryDecision,\n} from \"./Recovery.ts\";\nimport {\n AbortIntent,\n AbortCommand,\n ApprovalDecisionIntent,\n ChildAttachmentSnapshot,\n JoinSnapshot,\n ParentLinkage,\n QueueSequence,\n SubmissionState,\n SuspensionSnapshot,\n UnknownResolutionIntent,\n type RecoverySnapshot,\n} from \"./SubmissionLedger.ts\";\n\n/**\n * Pure report logic for the P7 administrative operations (plan §3): the Schema classes carried\n * by `DurableAgentRuntime.explain`/`verify`/`scanObligations`, the operator meaning table for\n * every recovery decision tag, and the text renderer. Everything here is pure — no port access,\n * no clocks, no writes — so hosts, CLIs, and wire envelopes share one report vocabulary.\n */\n\nconst BoundedDetail = Schema.String.check(Schema.isMaxLength(4_096));\n\n/** Non-negative whole seconds derived from the Effect Clock. */\nconst AgeSeconds = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n// ---------------------------------------------------------------------------\n// explain — RecoveryExplanation\n// ---------------------------------------------------------------------------\n\n/**\n * The disposition family of `RecoveryReport`, reused verbatim so an explanation predicts exactly\n * what `runRecovery`/`retry` would report for the same decision.\n */\nexport const RecoveryDisposition = Schema.Literals([\"repaired\", \"deferred\", \"none\", \"unknown\"]);\nexport type RecoveryDisposition = typeof RecoveryDisposition.Type;\n\n/** Submission identity, lane position, and Clock-derived ages (DUR-017 obligation visibility). */\nexport class ExplainedSubmission extends Schema.Class<ExplainedSubmission>(\n \"@effect-agent/thread/ExplainedSubmission\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n queueSequence: QueueSequence,\n createdAt: Schema.DateTimeUtcFromString,\n readyAt: Schema.optionalKey(Schema.DateTimeUtcFromString),\n /** Whole seconds since admission (`createdAt`). */\n ageSeconds: AgeSeconds,\n /** Whole seconds since readiness, present exactly when `readyAt` is recorded. */\n readyAgeSeconds: Schema.optionalKey(AgeSeconds),\n parentLinkage: Schema.optionalKey(ParentLinkage),\n}) {}\n\n/** One durable Unknown Outcome and whether its result is canonical (DUR-017). */\nexport class ExplainedUnknownCall extends Schema.Class<ExplainedUnknownCall>(\n \"@effect-agent/thread/ExplainedUnknownCall\",\n)({\n toolCallId: ToolCallId,\n toolName: ToolCallUnknown.fields.toolName,\n reason: ToolCallUnknown.fields.reason,\n recordedAt: Schema.DateTimeUtcFromString,\n /** A real canonical ToolCallSettled closes this call; an intent alone is not an outcome. */\n resolved: Schema.Boolean,\n}) {}\n\n/**\n * The evidence summary of one explanation: the classifier's canonical-history inputs plus the\n * durable intents and subagent attachments the ledger snapshot carries. Everything is read-only\n * observation — assembling this value performs zero writes.\n */\nexport class ExplainedEvidence extends Schema.Class<ExplainedEvidence>(\n \"@effect-agent/thread/ExplainedEvidence\",\n)({\n threadMaterialized: Schema.Boolean,\n inputRecorded: Schema.Boolean,\n abortRecorded: Schema.Boolean,\n recordedSettlementOutcome: Schema.optionalKey(SettlementOutcome),\n /** Prepared ordinary Tool Calls without a canonical outcome (DUR-009). */\n openToolCalls: Schema.Array(OpenToolCallEvidence),\n /** Original prepared operation identities, arguments and recovery contracts; settled calls are excluded. */\n pendingOperations: Schema.Array(ToolCallPrepared).pipe(\n Schema.withConstructorDefault(Effect.succeed([])),\n ),\n /** Delegation Tool Calls with an open parent-side obligation. */\n openDelegationCalls: Schema.Array(OpenDelegationCallEvidence),\n /** Canonically requested approvals without a canonical decision. */\n approvalsPending: Schema.Array(PendingApprovalEvidence),\n /** Durable Unknown Outcomes with their resolution coverage (DUR-017). */\n unknownCalls: Schema.Array(ExplainedUnknownCall),\n /** Durable approval decisions recorded against this Submission. */\n approvalDecisions: Schema.Array(ApprovalDecisionIntent),\n /** Durable unknown-outcome resolutions recorded against this Submission. */\n unknownResolutions: Schema.Array(UnknownResolutionIntent),\n /** Parent-side child attachments. */\n childAttachments: Schema.Array(ChildAttachmentSnapshot),\n /** Host-side joined/joining members of this Submission's Run (DUR-016). */\n joins: Schema.Array(JoinSnapshot),\n /** Joined-side host identity, when this Submission is joined to a host Run. */\n hostSubmissionId: Schema.optionalKey(SubmissionId),\n suspension: Schema.optionalKey(SuspensionSnapshot),\n abortIntent: Schema.optionalKey(AbortIntent),\n}) {}\n\n/**\n * The read-only recovery explanation of one Submission (P7 exit gate \"operators can explain\n * recovery state without editing storage\"): the submission summary, the evidence the pure\n * classifier consumed, the exact `RecoveryDecision` it selected, that decision's operator\n * meaning, and the disposition the recovery pass would report for it.\n */\nexport class RecoveryExplanation extends Schema.Class<RecoveryExplanation>(\n \"@effect-agent/thread/RecoveryExplanation\",\n)({\n submission: ExplainedSubmission,\n evidence: ExplainedEvidence,\n decision: RecoveryDecision,\n /** Static operator meaning of `decision._tag` (see `RECOVERY_DECISION_MEANINGS`). */\n decisionMeaning: BoundedDetail,\n /**\n * The disposition `runRecovery` would report when this decision executes without claim\n * contention (see `predictRecoveryDisposition`): `repaired` = the recovery pass itself fixes\n * it; `deferred` = a claiming worker must finish it; `unknown` = durably blocked on the\n * authorized DUR-017 resolution path; `none` = settled, nothing owed.\n */\n disposition: RecoveryDisposition,\n explainedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/**\n * Operator meaning of every recovery decision tag, matching the classifier docstrings in\n * `recovery.ts` (the classifier remains the semantic authority; this table is its operator\n * rendering). Exhaustive over `RecoveryDecision` — adding a decision without a meaning is a\n * compile error here.\n */\nexport const RECOVERY_DECISION_MEANINGS: Readonly<Record<RecoveryDecision[\"_tag\"], string>> = {\n CompleteMaterialization:\n \"Ledger admission committed but the Thread is not durable: recovery finishes materialization, appends ThreadCreated, and marks readiness.\",\n RepairReadiness:\n \"The Thread is durable but the readiness marker is missing: recovery replays the idempotent markReady.\",\n ApplyInput:\n \"No canonical input record exists yet: recovery appends the deterministic UserInputRecorded record and marks it applied.\",\n RepairInputMarker:\n \"The canonical input record exists but the ledger marker was lost: recovery repairs the marker from history, never the reverse (DUR-015).\",\n ResumeFromTurnBoundary:\n \"Input is applied and no terminal work is reserved: a claiming worker resumes the Run from the last committed Turn boundary; the model may be re-invoked and any duplicate cost is observable (durability §9).\",\n AppendReservedSettlement:\n \"A settlement is reserved but not canonical: recovery appends the EXACT reserved record, then finalizes (DUR-011).\",\n FinalizeLedgerFromHistory:\n \"The canonical settlement record exists: recovery rebuilds/finalizes the ledger from history and never rewrites history from the cached ledger status (DUR-011, DUR-015).\",\n SettleAborted:\n \"A durable abort intent exists with no reserved outcome and no open attached-child obligation: recovery settles aborted, first recording ToolCallUnknown audits for open ordinary calls — abort never asserts external rollback (durability §13).\",\n MarkUnknown:\n \"Prepared ordinary Tool Calls have no canonical outcome: recovery reconciles each open call and marks the remainder Unknown — never an automatic replay (DUR-009/DUR-017).\",\n ResumePendingToolBatch:\n \"A committed tool-declaring response has zero prepared and zero settled records: a claiming worker checks unfinished operation contracts and resumes the declared batch without model re-invocation (durability §15).\",\n AwaitApprovalDecision:\n \"Canonically requested approvals lack decisions: the lane waits durably for the authorized resolveApproval path (recovery repairs a lost suspend transition from history).\",\n ResumeSuspended:\n \"Every pending approval has a durable decision: a claiming worker resumes the declared batch, appending the canonical ToolApprovalDecided records first.\",\n AwaitUnknownResolution:\n \"Unknown Outcomes lack covering resolutions: this Submission stays parked awaiting the authorized DUR-017 resolveUnknown path; later eligible input may run, and the original obligation stays visible.\",\n ApplyUnknownResolutions:\n \"Durable resolution intents cover every open call: recovery wakes the original Submission when required retry contracts are supported; its next claim applies canonical outcomes.\",\n RevertJoining:\n \"The Submission is joining without a canonical input record: recovery reverts it to ready — the input was never consumed and will be delivered exactly once later (DUR-016).\",\n RepairJoinMarker:\n \"The canonical joined input exists but the joined marker was lost: recovery repairs the marker only; the input reattaches, never duplicates (DUR-015/DUR-016).\",\n SettleJoinedWithHost:\n \"The host Run settled canonically: recovery settles this joined Submission with the host outcome — each joined Submission is owed its own settlement (DUR-002).\",\n AwaitHostSettlement:\n \"The Submission is joined and its host Run is still live: nothing to repair — the input reattaches through the host's resume and the Submission settles with the host.\",\n CompleteChildAdmission:\n \"A canonical SubagentRequested exists and the authoritative lookup proved not-admitted: recovery idempotently admits the intended child from the canonical request payload alone.\",\n AwaitChildAdmissionResolution:\n \"The authoritative child-admission lookup answered indeterminate (or was not performed): recovery waits and retries the authoritative owner; a second admission never occurs (SUB-031).\",\n RepairSubagentStartLink:\n \"The child is admitted but the parent's SubagentStarted link (or reservation attachment) is missing: recovery resolves the SAME child by its deterministic key and appends the exact link (SUB-016/SUB-017).\",\n EnsureWaitingForChild:\n \"Children are established and at least one is nonterminal while the parent lane is not durably suspended: recovery restores the waitingForChild suspension; it reattaches the one existing child and never spawns a replacement (SUB-018/SUB-030).\",\n AwaitChildSettlement:\n \"The parent is durably suspended waitingForChild and a listed child is not yet provably settled: the lane stays dormant, consumes no worker permit, and the child's Settlement wakes it durably (SUB-021/SUB-030).\",\n ResumeWaitingParent:\n \"Every relevant child is provably settled but the parent has not joined: recovery replays the idempotent wake so a claiming worker resumes the declared batch and joins each child's canonical Settlement.\",\n ApplyJoinAccounting:\n \"The canonical SubagentJoined record exists but the reservation release is incomplete: recovery replays the accounting decision FROM the canonical record — budget stays unavailable until repair, never available twice (DUR-015).\",\n PropagateChildAbort:\n \"Parent abort is canonical while attached children are nonterminal: recovery idempotently issues each child's durable abort command and keeps the parent waiting for the joins — request-abort-and-join is the only close behavior.\",\n ReleaseOrphanChildReservation:\n \"A child budget reservation can no longer bind a child: recovery freezes the deterministic zero-consumed accounting decision and releases the unused allocation exactly once.\",\n AwaitParentEstablishment:\n \"The Submission is a parent-linked child whose Thread lacks the canonical lineage record: the child lane defers its own readiness repair — the parent's idempotent establishment completes it, so a child never runs a Turn before its lineage is canonical (P7 §7(a), SUB-016).\",\n NoAction: \"The Submission is settled; nothing is owed.\",\n};\n\n/** The operator meaning of one recovery decision tag. */\nexport const recoveryDecisionMeaning = (tag: RecoveryDecision[\"_tag\"]): string =>\n RECOVERY_DECISION_MEANINGS[tag];\n\n/**\n * The disposition the recovery executor reports for a decision when its repair executes without\n * claim contention (pure prediction; `executeRecoveryDecision` in the coordinator remains the\n * execution authority — a lane concurrently claimed by a worker can always defer instead).\n * `AwaitApprovalDecision` depends on the snapshot: an already-suspended lane waits (`deferred`),\n * while a claimable lane with a lost suspend transition is repaired.\n */\nexport const predictRecoveryDisposition = (\n decision: RecoveryDecision,\n snapshot: RecoverySnapshot,\n): RecoveryDisposition => {\n switch (decision._tag) {\n case \"NoAction\":\n return \"none\";\n case \"AwaitUnknownResolution\":\n case \"MarkUnknown\":\n return \"unknown\";\n case \"ResumeFromTurnBoundary\":\n case \"ResumePendingToolBatch\":\n case \"ResumeSuspended\":\n case \"AwaitHostSettlement\":\n case \"AwaitChildAdmissionResolution\":\n case \"AwaitChildSettlement\":\n case \"AwaitParentEstablishment\":\n return \"deferred\";\n case \"AwaitApprovalDecision\":\n return snapshot.submission.state === \"suspended\" ? \"deferred\" : \"repaired\";\n default:\n return \"repaired\";\n }\n};\n\nconst formatUtc = (value: DateTime.Utc): string => DateTime.formatIso(value);\n\n/** Pure operator text for one explanation (the CLI's `explain` output body). */\nexport const renderRecoveryExplanation = (explanation: RecoveryExplanation): string => {\n const submission = explanation.submission;\n const evidence = explanation.evidence;\n\n const lines: Array<string> = [\n `Submission ${submission.submissionId} (thread ${submission.threadId})`,\n ` state: ${submission.state} queue: ${submission.queueSequence} age: ${submission.ageSeconds}s`,\n ` admitted: ${formatUtc(submission.createdAt)}${\n submission.readyAt === undefined ? \"\" : ` ready: ${formatUtc(submission.readyAt)}`\n }`,\n ];\n\n if (submission.parentLinkage !== undefined) {\n lines.push(\n ` attached child of ${submission.parentLinkage.parentSubmissionId} (tool call ${submission.parentLinkage.parentToolCallId})`,\n );\n }\n lines.push(\n ` evidence: input=${evidence.inputRecorded ? \"recorded\" : \"missing\"}` +\n ` settlement=${evidence.recordedSettlementOutcome ?? \"none\"}` +\n ` abort=${evidence.abortRecorded ? \"recorded\" : \"none\"}` +\n ` materialized=${evidence.threadMaterialized ? \"yes\" : \"no\"}`,\n );\n if (evidence.openToolCalls.length > 0) {\n lines.push(\n ` open ordinary tool calls: ${evidence.openToolCalls\n .map((call) => `${call.toolName}#${call.toolCallId}`)\n .join(\", \")}`,\n );\n }\n if (evidence.openDelegationCalls.length > 0) {\n lines.push(\n ` open delegation calls: ${evidence.openDelegationCalls\n .map(\n (call) =>\n `${call.toolName}#${call.toolCallId}(requested=${call.requested} started=${call.started} joined=${call.joined})`,\n )\n .join(\", \")}`,\n );\n }\n if (evidence.approvalsPending.length > 0) {\n lines.push(\n ` approvals pending: ${evidence.approvalsPending\n .map((pending) => pending.toolCallId)\n .join(\", \")}`,\n );\n }\n for (const unknown of evidence.unknownCalls) {\n lines.push(\n ` unknown outcome: ${unknown.toolName}#${unknown.toolCallId} recorded ${formatUtc(unknown.recordedAt)} ${\n unknown.resolved ? \"(resolution intent recorded)\" : \"(awaiting resolveUnknown)\"\n }`,\n );\n }\n if (evidence.childAttachments.length > 0) {\n lines.push(\n ` attached children: ${evidence.childAttachments\n .map((child) => `${child.childSubmissionId}(${child.childState})`)\n .join(\", \")}`,\n );\n }\n if (evidence.joins.length > 0) {\n lines.push(\n ` joined members: ${evidence.joins\n .map((join) => `${join.submissionId}(${join.state})`)\n .join(\", \")}`,\n );\n }\n if (evidence.hostSubmissionId !== undefined) {\n lines.push(` joined to host: ${evidence.hostSubmissionId}`);\n }\n if (evidence.suspension !== undefined) {\n lines.push(\n ` suspended (${evidence.suspension.reason._tag}) since ${formatUtc(evidence.suspension.suspendedAt)}`,\n );\n }\n if (evidence.abortIntent !== undefined) {\n lines.push(\n ` abort intent by ${evidence.abortIntent.author} at ${formatUtc(evidence.abortIntent.requestedAt)}`,\n );\n }\n lines.push(\n ` decision: ${explanation.decision._tag} → disposition ${explanation.disposition}`,\n ` meaning: ${explanation.decisionMeaning}`,\n );\n\n return lines.join(\"\\n\");\n};\n\n// ---------------------------------------------------------------------------\n// verify — IntegrityReport\n// ---------------------------------------------------------------------------\n\n/** The named integrity checks `verifyThreadInvariants` performs. */\nexport const IntegrityCheckName = Schema.Literals([\n /** Every exported envelope round-trips its canonical Schema. */\n \"schema-round-trip\",\n /** No canonical record identity appears twice (DUR-007). */\n \"record-identity\",\n /** Canonical sequences are gap-free from 1 through the exported tail. */\n \"sequence-contiguity\",\n /** The tail digest chain recomputes from EMPTY_TAIL_DIGEST over every batch (DUR-006/DUR-007). */\n \"digest-chain\",\n /** Canonical `input:{sid}` records follow the admitted FIFO order (DUR-004). */\n \"fifo-input-order\",\n /** Canonical settlement records follow the admitted FIFO order (DUR-004); aborted\n * settlements of never-run work are exempt by design (P7 §7(c)). */\n \"fifo-settlement-order\",\n /** At most one canonical terminal record per Submission; exactly one per settled row (DUR-002). */\n \"terminal-uniqueness\",\n /** Ledger terminal state agrees with the canonical settlement record (DUR-015). */\n \"ledger-canonical-agreement\",\n /** The stored checkpoint binds to the recomputed digest chain at its sequence. */\n \"checkpoint-binding\",\n /** Convergence mode only: every known Submission is settled. */\n \"all-settled\",\n]);\n\nexport type IntegrityCheckName = typeof IntegrityCheckName.Type;\n\nexport const IntegrityCheckStatus = Schema.Literals([\"passed\", \"failed\", \"skipped\"]);\nexport type IntegrityCheckStatus = typeof IntegrityCheckStatus.Type;\n\n/** One typed check result; `detail` explains a failure or the honest reason for a skip. */\nexport class IntegrityCheck extends Schema.Class<IntegrityCheck>(\n \"@effect-agent/thread/IntegrityCheck\",\n)({\n name: IntegrityCheckName,\n status: IntegrityCheckStatus,\n detail: Schema.optionalKey(BoundedDetail),\n}) {}\n\n/**\n * The read-only integrity verdict for one Thread (plan §3 `verify`): typed per-check\n * results, never a repair. `ok` is true exactly when no check failed — skipped checks are\n * honest scope statements, not silent passes.\n */\nexport class IntegrityReport extends Schema.Class<IntegrityReport>(\n \"@effect-agent/thread/IntegrityReport\",\n)({\n threadId: ThreadId,\n tailSequence: CanonicalSequence,\n recordCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n submissionCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n checks: Schema.Array(IntegrityCheck),\n ok: Schema.Boolean,\n}) {}\n\n// ---------------------------------------------------------------------------\n// scanObligations — ObligationReport\n// ---------------------------------------------------------------------------\n\n/**\n * What one nonterminal Submission is visibly blocked on (DUR-017 operator surface; OPS-001).\n * `ready-aged`/`running-aged` are not blocks — they are accepted work whose settlement age is\n * measurable and alertable.\n */\nexport const ObligationBlockedOn = Schema.Literals([\n \"unknown\",\n \"approval\",\n \"waitingForChild\",\n \"ready-aged\",\n \"running-aged\",\n]);\n\nexport type ObligationBlockedOn = typeof ObligationBlockedOn.Type;\n\nexport const ObligationSeverity = Schema.Literals([\"ok\", \"aging\", \"overdue\"]);\nexport type ObligationSeverity = typeof ObligationSeverity.Type;\n\n/** Host-supplied age thresholds; the framework deliberately does not own the alert loop. */\nexport class ObligationThresholds extends Schema.Class<ObligationThresholds>(\n \"@effect-agent/thread/ObligationThresholds\",\n)({\n /** Age (whole seconds) at which an obligation is reported `aging`. */\n agingSeconds: AgeSeconds,\n /** Age (whole seconds) at which an obligation is reported `overdue`. */\n overdueSeconds: AgeSeconds,\n}) {}\n\n/** One nonterminal accepted-work obligation with its age and severity. */\nexport class ObligationEntry extends Schema.Class<ObligationEntry>(\n \"@effect-agent/thread/ObligationEntry\",\n)({\n submissionId: SubmissionId,\n threadId: ThreadId,\n state: SubmissionState,\n blockedOn: ObligationBlockedOn,\n ageSeconds: AgeSeconds,\n severity: ObligationSeverity,\n}) {}\n\n/**\n * The scan-based DUR-017/OPS-001 operator surface (plan §3): a fold of the ledger's nonterminal\n * scan into aged, severity-classified rows. Scan-based, never a daemon — hosts run it\n * periodically and export logs/metrics; ages need no storage-version bump because every source\n * timestamp already exists (`createdAt`/`readyAt`, `suspendedAt`, the canonical\n * `ToolCallUnknown` record's `createdAt`).\n */\nexport class ObligationReport extends Schema.Class<ObligationReport>(\n \"@effect-agent/thread/ObligationReport\",\n)({\n thresholds: ObligationThresholds,\n entries: Schema.Array(ObligationEntry),\n generatedAt: Schema.DateTimeUtcFromString,\n}) {}\n\n/** Severity of one obligation age under the supplied thresholds. */\nexport const obligationSeverityOf = (\n ageSeconds: number,\n thresholds: ObligationThresholds,\n): ObligationSeverity =>\n ageSeconds >= thresholds.overdueSeconds\n ? \"overdue\"\n : ageSeconds >= thresholds.agingSeconds\n ? \"aging\"\n : \"ok\";\n\n// ---------------------------------------------------------------------------\n// retry — typed command and refusals\n// ---------------------------------------------------------------------------\n\n/**\n * The mandatory-audit retry command (SEC-011): `author`/`reason` carry the same bounds as the\n * canonical abort command so every mutating administrative operation stays attributable. The\n * operator and decision are logged. A repair with a claim also appends a best-effort\n * `RepairAnnotated` attempt using that claim's epoch; state-only repairs do not append audits.\n */\nexport class RetryCommand extends Schema.Class<RetryCommand>(\"@effect-agent/thread/RetryCommand\")({\n submissionId: SubmissionId,\n author: AbortCommand.fields.author,\n reason: AbortCommand.fields.reason,\n}) {}\n\n/** Why a retry was refused without executing anything. */\nexport const RetryRefusalReason = Schema.Literals([\n /** The Submission is settled; terminal outcomes are never revisited (DUR-002). */\n \"settled\",\n /** The Submission is parked on Unknown Outcomes; use `resolveUnknown` (DUR-017). */\n \"await-unknown-resolution\",\n /** The lane is durably waiting for approval decisions; use `resolveApproval`. */\n \"await-approval-decision\",\n]);\n\nexport type RetryRefusalReason = typeof RetryRefusalReason.Type;\n\n/**\n * Typed refusal of `retry` (plan §3): Submissions waiting on `AwaitUnknownResolution` or\n * `AwaitApprovalDecision` have their own authorized operations, and settled work is never\n * re-driven. The refusal names the classifier decision so the operator sees WHY.\n */\nexport class RetryRefused extends Schema.TaggedError<RetryRefused>()(\"RetryRefused\", {\n submissionId: SubmissionId,\n refusal: RetryRefusalReason,\n decisionTag: Schema.String.check(Schema.isMaxLength(256)),\n message: Schema.String.check(Schema.isMaxLength(4_096)),\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,gBAAgB,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;;AAGnE,MAAM,aAAa,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;;;;AAUpE,MAAa,sBAAsB,OAAO,SAAS;CAAC;CAAY;CAAY;CAAQ;AAAS,CAAC;;AAI9F,IAAa,sBAAb,cAAyC,OAAO,MAC9C,0CACF,CAAC,CAAC;CACA,cAAc;CACd,UAAU;CACV,OAAO;CACP,eAAe;CACf,WAAW,OAAO;CAClB,SAAS,OAAO,YAAY,OAAO,qBAAqB;;CAExD,YAAY;;CAEZ,iBAAiB,OAAO,YAAY,UAAU;CAC9C,eAAe,OAAO,YAAY,aAAa;AACjD,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,uBAAb,cAA0C,OAAO,MAC/C,2CACF,CAAC,CAAC;CACA,YAAY;CACZ,UAAU,gBAAgB,OAAO;CACjC,QAAQ,gBAAgB,OAAO;CAC/B,YAAY,OAAO;;CAEnB,UAAU,OAAO;AACnB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,oBAAb,cAAuC,OAAO,MAC5C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AC;;;;;;AASD,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,cAAc;CACd,SAAS;CACT,aAAa,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;CACxD,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAK,CAAC;AACxD,CAAC,CAAC,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { Br as DurableBindingFailure, Fr as AgentAttemptContext, Gr as bindingSupports, Hr as ExecutableAgentBinding, Ir as AgentRegistration, Jr as definitionDigestsEqual, Kr as compileBindingManifest, Lr as BindingDigestMismatch, Rr as BindingManifest, Ur as ReplayVersions, Vr as DurableWorkerBinding, Wr as ResolvedBinding, Yr as makeBindingManifest, qr as compileRegistrations, zr as BindingUnavailable } from "../Records-CV49DgQK.mjs";
2
- export { type AgentAttemptContext, type AgentRegistration, BindingDigestMismatch, BindingManifest, BindingUnavailable, type DurableBindingFailure, DurableWorkerBinding, type ExecutableAgentBinding, type ReplayVersions, type ResolvedBinding, bindingSupports, compileBindingManifest, compileRegistrations, definitionDigestsEqual, makeBindingManifest };
1
+ import { Br as BindingUnavailable, Gr as ResolvedBinding, Hr as DurableWorkerBinding, Jr as definitionDigestsEqual, Kr as compileBindingContracts, Rr as AgentAttemptContext, Ur as ExecutableAgentBinding, Vr as DurableBindingFailure, Wr as ReplayVersions, qr as compileRegistrations, zr as AgentRegistration } from "../Records-BIiRLqlz.mjs";
2
+ export { type AgentAttemptContext, type AgentRegistration, BindingUnavailable, type DurableBindingFailure, DurableWorkerBinding, type ExecutableAgentBinding, type ReplayVersions, type ResolvedBinding, compileBindingContracts, compileRegistrations, definitionDigestsEqual };
@@ -1,18 +1,14 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { a as bindingSupports, c as definitionDigestsEqual, i as DurableWorkerBinding, l as makeBindingManifest, n as BindingManifest, o as compileBindingManifest, r as BindingUnavailable, s as compileRegistrations, t as BindingDigestMismatch } from "../agent-registration-CXGDwvJH.mjs";
2
+ import { a as definitionDigestsEqual, i as compileRegistrations, n as DurableWorkerBinding, r as compileBindingContracts, t as BindingUnavailable } from "../agent-registration-cXpB8cBU.mjs";
3
3
  //#region src/durable/AgentRegistration.ts
4
4
  var AgentRegistration_exports = /* @__PURE__ */ __exportAll({
5
- BindingDigestMismatch: () => BindingDigestMismatch,
6
- BindingManifest: () => BindingManifest,
7
5
  BindingUnavailable: () => BindingUnavailable,
8
6
  DurableWorkerBinding: () => DurableWorkerBinding,
9
- bindingSupports: () => bindingSupports,
10
- compileBindingManifest: () => compileBindingManifest,
7
+ compileBindingContracts: () => compileBindingContracts,
11
8
  compileRegistrations: () => compileRegistrations,
12
- definitionDigestsEqual: () => definitionDigestsEqual,
13
- makeBindingManifest: () => makeBindingManifest
9
+ definitionDigestsEqual: () => definitionDigestsEqual
14
10
  });
15
11
  //#endregion
16
- export { BindingDigestMismatch, BindingManifest, BindingUnavailable, DurableWorkerBinding, bindingSupports, compileBindingManifest, compileRegistrations, definitionDigestsEqual, makeBindingManifest, AgentRegistration_exports as t };
12
+ export { BindingUnavailable, DurableWorkerBinding, compileBindingContracts, compileRegistrations, definitionDigestsEqual, AgentRegistration_exports as t };
17
13
 
18
14
  //# sourceMappingURL=AgentRegistration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentRegistration.mjs","names":[],"sources":["../../src/durable/AgentRegistration.ts"],"sourcesContent":["/** Public AgentRegistration API. Implementation helpers remain private. */\nexport {\n BindingUnavailable,\n BindingDigestMismatch,\n DurableWorkerBinding,\n compileRegistrations,\n definitionDigestsEqual,\n bindingSupports,\n BindingManifest,\n makeBindingManifest,\n compileBindingManifest,\n type ReplayVersions,\n type AgentRegistration,\n type AgentAttemptContext,\n type ExecutableAgentBinding,\n type DurableBindingFailure,\n type ResolvedBinding,\n} from \"./internal/agent-registration.ts\";\n"],"mappings":""}
1
+ {"version":3,"file":"AgentRegistration.mjs","names":[],"sources":["../../src/durable/AgentRegistration.ts"],"sourcesContent":["/** Public AgentRegistration API. Implementation helpers remain private. */\nexport {\n BindingUnavailable,\n DurableWorkerBinding,\n compileRegistrations,\n definitionDigestsEqual,\n compileBindingContracts,\n type ReplayVersions,\n type AgentRegistration,\n type AgentAttemptContext,\n type ExecutableAgentBinding,\n type DurableBindingFailure,\n type ResolvedBinding,\n} from \"./internal/agent-registration.ts\";\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { Xa as SubmissionLedger, in as ThreadStore } from "../Records-CV49DgQK.mjs";
1
+ import { Ya as SubmissionLedger, on as ThreadStore } from "../Records-BIiRLqlz.mjs";
2
2
  import { Crypto, Effect, Schema } from "effect";
3
3
  //#region src/durable/Certification.d.ts
4
4
  declare const CertifiedAdapterIdentity_base: Schema.Class<CertifiedAdapterIdentity, Schema.Struct<{
@@ -43,7 +43,7 @@ declare const CertificationSweepStatus: Schema.Literals<readonly ["converged", "
43
43
  type CertificationSweepStatus = typeof CertificationSweepStatus.Type;
44
44
  declare const CertificationSweepResult_base: Schema.Class<CertificationSweepResult, Schema.Struct<{
45
45
  readonly scenario: Schema.Literals<readonly ["plain", "uncertain-tool", "durable-steps", "approval", "join", "delegation"]>;
46
- readonly location: Schema.Literals<readonly ["submit:after-admit", "submit:after-materialize", "claim:after-claim", "input:after-canonical-append", "run:before-start-append", "run:after-start-append", "run:before-duration-append", "run:after-duration-append", "turn:after-canonical-append", "turn:after-response-append", "turn:after-results-append", "compaction:before-canonical-append", "compaction:after-canonical-append", "checkpoint:before-save", "checkpoint:after-save", "tools:after-prepared-append", "tools:before-prepared-append", "policy:before-reservation-append", "policy:after-reservation-append", "step:after-step-append", "approval:after-request-append", "approval:after-suspend", "join:after-claim", "join:after-canonical-append", "resolve:after-intent", "terminalize:after-reserve", "terminalize:after-canonical-append", "abort:after-intent", "subagent:after-reserve", "subagent:after-request-append", "subagent:after-admit", "subagent:after-child-ready", "subagent:after-start-append", "subagent:after-sibling-settle", "subagent:after-suspend", "subagent:after-child-abort-intent", "subagent:before-join-append", "subagent:after-join-append", "subagent:after-release-pending", "subagent:after-release", "worker:before-source-append", "worker:after-source-append", "worker:before-origin-append", "worker:after-origin-append", "worker:before-completion-append", "worker:after-completion-append", "worker:before-subtree-append", "worker:after-subtree-append", "worker:before-report-append", "worker:after-report-append", "worker:before-report-delivery", "worker:after-report-delivery", "update:before-canonical-append", "update:after-canonical-append", "update:before-delivery-insert", "update:after-delivery-insert"]>;
46
+ readonly location: Schema.Literals<readonly ["submit:after-admit", "submit:after-materialize", "claim:after-claim", "input:after-canonical-append", "run:before-start-append", "run:after-start-append", "run:before-duration-append", "run:after-duration-append", "turn:after-canonical-append", "turn:after-response-append", "turn:after-results-append", "compaction:before-canonical-append", "compaction:after-canonical-append", "checkpoint:before-save", "checkpoint:after-save", "tools:after-prepared-append", "tools:before-prepared-append", "tools:before-unavailable-append", "tools:after-unavailable-append", "policy:before-reservation-append", "policy:after-reservation-append", "step:after-step-append", "approval:after-request-append", "approval:after-suspend", "join:after-claim", "join:after-canonical-append", "resolve:after-intent", "terminalize:after-reserve", "terminalize:after-canonical-append", "abort:after-intent", "subagent:after-reserve", "subagent:after-request-append", "subagent:after-admit", "subagent:after-child-ready", "subagent:after-start-append", "subagent:after-sibling-settle", "subagent:after-suspend", "subagent:after-child-abort-intent", "subagent:before-join-append", "subagent:after-join-append", "subagent:after-release-pending", "subagent:after-release", "worker:before-source-append", "worker:after-source-append", "worker:before-origin-append", "worker:after-origin-append", "worker:before-completion-append", "worker:after-completion-append", "worker:before-subtree-append", "worker:after-subtree-append", "worker:before-report-append", "worker:after-report-append", "worker:before-report-delivery", "worker:after-report-delivery", "update:before-canonical-append", "update:after-canonical-append", "update:before-delivery-insert", "update:after-delivery-insert"]>;
47
47
  /** The armed fault actually fired (one-shot) somewhere in the cell's drive or re-drive. */
48
48
  readonly failpointFired: Schema.Boolean;
49
49
  readonly status: Schema.Literals<readonly ["converged", "not-triggered", "failed"]>;
@@ -1,4 +1,4 @@
1
- import { O as PersistedJson, Xr as DigestError, an as ThreadStoreError, en as ThreadNotMaterialized, in as ThreadStore, l as CanonicalRecordEnvelope } from "../Records-CV49DgQK.mjs";
1
+ import { O as PersistedJson, Yr as DigestError, l as CanonicalRecordEnvelope, nn as ThreadNotMaterialized, on as ThreadStore, sn as ThreadStoreError } from "../Records-BIiRLqlz.mjs";
2
2
  import { ActivityProcessorKey, ActivityProcessorStore, ActivityStoreFailure, PreparedActivity } from "./ActivityStore.mjs";
3
3
  import { Crypto, Effect, Schema, Scope } from "effect";
4
4
  declare namespace CommittedActivity_d_exports {
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { O as RecordEnvelope, T as PersistedJson, c as CanonicalRecordEnvelope, u as CanonicalSequence } from "../Records-BAutSSnJ.mjs";
2
+ import { O as RecordEnvelope, T as PersistedJson, c as CanonicalRecordEnvelope, u as CanonicalSequence } from "../Records-DR1xtbXY.mjs";
3
3
  import { ActivityClaim, ActivityClaimRequest, ActivityProcessorKey, ActivityProcessorStore, PreparedActivity } from "./ActivityStore.mjs";
4
4
  import { digestJson } from "./Digest.mjs";
5
5
  import { ThreadRead, ThreadStore, ThreadTail, ThreadTailRequest } from "./ThreadStore.mjs";
@@ -1,2 +1,2 @@
1
- import { $r as digestCanonicalBatch, Qr as EMPTY_TAIL_DIGEST, Xr as DigestError, ei as digestDefinition, ni as digestJson, ti as digestDefinitions } from "../Records-CV49DgQK.mjs";
1
+ import { $r as digestDefinition, Qr as digestCanonicalBatch, Yr as DigestError, Zr as EMPTY_TAIL_DIGEST, ei as digestDefinitions, ti as digestJson } from "../Records-BIiRLqlz.mjs";
2
2
  export { DigestError, EMPTY_TAIL_DIGEST, digestCanonicalBatch, digestDefinition, digestDefinitions, digestJson };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { h as Digest, o as CanonicalBatch, p as DefinitionDigests } from "../Records-BAutSSnJ.mjs";
2
+ import { h as Digest, o as CanonicalBatch, p as DefinitionDigests } from "../Records-DR1xtbXY.mjs";
3
3
  import { Array, Crypto, Effect, Encoding, Schema } from "effect";
4
4
  //#region src/durable/Digest.ts
5
5
  var Digest_exports = /* @__PURE__ */ __exportAll({
@@ -1,3 +1,3 @@
1
1
  import { a as Receipt } from "../Receipt-BAHyigAF.mjs";
2
- import { At as DurableSubmitOptions, Ct as DurableProgressFailure, Dt as DurableRuntimeConfigOptions, Et as DurableRuntimeConfig, Ft as childReservationIdFor, It as recoveryRepairBatchId, Lt as recoveryRepairRecordId, Mt as DurableWorkerFailure, Nt as DurableWorkerRequirements, Ot as DurableSubmitAgent, Pt as RecoveryReport, Rt as threadCreatedBatchId, St as DurableObserveOptions, Tt as DurableRetryFailure, _t as DurableApprovalFailure, bt as DurableExplainFailure, ht as DurableAgentRuntime, jt as DurableVerifyFailure, kt as DurableSubmitFailure, mt as DurableAbortFailure, vt as DurableApprovalResolver, wt as DurableResolveFailure, xt as DurableObligationFailure, yt as DurableAwaitFailure, zt as threadCreatedRecordId } from "../Records-CV49DgQK.mjs";
2
+ import { At as DurableSubmitAgent, Bt as threadCreatedBatchId, Ct as DurableObligationFailure, Dt as DurableRetryFailure, Et as DurableResolveFailure, Ft as DurableWorkerRequirements, It as RecoveryReport, Lt as childReservationIdFor, Mt as DurableSubmitOptions, Nt as DurableVerifyFailure, Ot as DurableRuntimeConfig, Pt as DurableWorkerFailure, Rt as recoveryRepairBatchId, St as DurableExplainFailure, Tt as DurableProgressFailure, Vt as threadCreatedRecordId, _t as DurableAgentRuntime, bt as DurableApprovalResolver, gt as DurableAbortFailure, jt as DurableSubmitFailure, kt as DurableRuntimeConfigOptions, wt as DurableObserveOptions, xt as DurableAwaitFailure, yt as DurableApprovalFailure, zt as recoveryRepairRecordId } from "../Records-BIiRLqlz.mjs";
3
3
  export { DurableAbortFailure, DurableAgentRuntime, DurableApprovalFailure, DurableApprovalResolver, DurableAwaitFailure, DurableExplainFailure, DurableObligationFailure, DurableObserveOptions, DurableProgressFailure, DurableResolveFailure, DurableRetryFailure, DurableRuntimeConfig, DurableRuntimeConfigOptions, DurableSubmitAgent, DurableSubmitFailure, DurableSubmitOptions, DurableVerifyFailure, DurableWorkerFailure, DurableWorkerRequirements, Receipt, RecoveryReport, childReservationIdFor, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
@@ -1,3 +1,3 @@
1
1
  import { Receipt } from "../core/Receipt.mjs";
2
- import { a as RecoveryReport, c as recoveryRepairRecordId, i as DurableRuntimeConfig, l as threadCreatedBatchId, o as childReservationIdFor, r as DurableApprovalResolver, s as recoveryRepairBatchId, t as DurableAgentRuntime, u as threadCreatedRecordId } from "../DurableAgentRuntime-DbUvZHDZ.mjs";
2
+ import { a as RecoveryReport, c as recoveryRepairRecordId, i as DurableRuntimeConfig, l as threadCreatedBatchId, o as childReservationIdFor, r as DurableApprovalResolver, s as recoveryRepairBatchId, t as DurableAgentRuntime, u as threadCreatedRecordId } from "../DurableAgentRuntime-BE_OjQjz.mjs";
3
3
  export { DurableAgentRuntime, DurableApprovalResolver, DurableRuntimeConfig, Receipt, RecoveryReport, childReservationIdFor, recoveryRepairBatchId, recoveryRepairRecordId, threadCreatedBatchId, threadCreatedRecordId };
@@ -1,2 +1,2 @@
1
- import { a as DurableRuntimeFailpointLocation, i as DurableRuntimeFailpointHandler, n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "../DurableFailpoint-DQJet828.mjs";
1
+ import { a as DurableRuntimeFailpointLocation, i as DurableRuntimeFailpointHandler, n as DurableRuntimeFailpoint, r as DurableRuntimeFailpointError } from "../DurableFailpoint-mx3-nsxU.mjs";
2
2
  export { DurableRuntimeFailpoint, DurableRuntimeFailpointError, DurableRuntimeFailpointHandler, DurableRuntimeFailpointLocation };
@@ -38,6 +38,8 @@ const DurableRuntimeFailpointLocation = Schema.Literals([
38
38
  "checkpoint:after-save",
39
39
  "tools:after-prepared-append",
40
40
  "tools:before-prepared-append",
41
+ "tools:before-unavailable-append",
42
+ "tools:after-unavailable-append",
41
43
  "policy:before-reservation-append",
42
44
  "policy:after-reservation-append",
43
45
  "step:after-step-append",
@@ -1 +1 @@
1
- {"version":3,"file":"DurableFailpoint.mjs","names":[],"sources":["../../src/durable/DurableFailpoint.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\n/**\n * Coordinator-owned failpoint locations (plan §Failpoints). Locations normally sit immediately\n * AFTER one durable mutation of the six-step coordinator flow, so a fault injected there\n * simulates a crash between two durable steps; the matching BEFORE boundary of each mutation is\n * owned by the storage adapters (`ledger:*:before`, `append:before`, ...), giving every durable\n * mutation a failpoint on both sides (change discipline). Run-start append also exposes its\n * BEFORE boundary here to distinguish a fresh clock from a committed clock in crash tests.\n *\n * The `subagent:*` family covers every durable mutation of the S2 establishment/join protocol\n * including reservation, request append, child admission, child readiness,\n * start-link append, sibling per-call settles at the suspension seam, the `waitingForChild`\n * suspension, child abort propagation, the atomic join batch, and both reservation-release\n * transitions.\n */\nexport const DurableRuntimeFailpointLocation = Schema.Literals([\n \"submit:after-admit\",\n \"submit:after-materialize\",\n \"claim:after-claim\",\n \"input:after-canonical-append\",\n \"run:before-start-append\",\n \"run:after-start-append\",\n \"run:before-duration-append\",\n \"run:after-duration-append\",\n \"turn:after-canonical-append\",\n \"turn:after-response-append\",\n \"turn:after-results-append\",\n \"compaction:before-canonical-append\",\n \"compaction:after-canonical-append\",\n \"checkpoint:before-save\",\n \"checkpoint:after-save\",\n \"tools:after-prepared-append\",\n \"tools:before-prepared-append\",\n \"policy:before-reservation-append\",\n \"policy:after-reservation-append\",\n \"step:after-step-append\",\n \"approval:after-request-append\",\n \"approval:after-suspend\",\n \"join:after-claim\",\n \"join:after-canonical-append\",\n \"resolve:after-intent\",\n \"terminalize:after-reserve\",\n \"terminalize:after-canonical-append\",\n \"abort:after-intent\",\n \"subagent:after-reserve\",\n \"subagent:after-request-append\",\n \"subagent:after-admit\",\n \"subagent:after-child-ready\",\n \"subagent:after-start-append\",\n \"subagent:after-sibling-settle\",\n \"subagent:after-suspend\",\n \"subagent:after-child-abort-intent\",\n \"subagent:before-join-append\",\n \"subagent:after-join-append\",\n \"subagent:after-release-pending\",\n \"subagent:after-release\",\n \"worker:before-source-append\",\n \"worker:after-source-append\",\n \"worker:before-origin-append\",\n \"worker:after-origin-append\",\n \"worker:before-completion-append\",\n \"worker:after-completion-append\",\n \"worker:before-subtree-append\",\n \"worker:after-subtree-append\",\n \"worker:before-report-append\",\n \"worker:after-report-append\",\n \"worker:before-report-delivery\",\n \"worker:after-report-delivery\",\n \"update:before-canonical-append\",\n \"update:after-canonical-append\",\n \"update:before-delivery-insert\",\n \"update:after-delivery-insert\",\n]);\n\nexport type DurableRuntimeFailpointLocation = typeof DurableRuntimeFailpointLocation.Type;\n\n/** Injected coordinator fault. Reaching the caller means the preceding durable step committed. */\nexport class DurableRuntimeFailpointError extends Schema.TaggedError<DurableRuntimeFailpointError>()(\n \"DurableRuntimeFailpointError\",\n {\n location: DurableRuntimeFailpointLocation,\n },\n) {}\n\nexport type DurableRuntimeFailpointHandler = (\n location: DurableRuntimeFailpointLocation,\n) => Effect.Effect<void, DurableRuntimeFailpointError>;\n\nconst noFailpoint: DurableRuntimeFailpointHandler = () => Effect.void;\n\n/**\n * Explicit fault-injection authority used at durable coordinator step boundaries. The process\n * crash harness (WP5) maps a hit to `process.exit`; in-process tests fail the step with the\n * typed `DurableRuntimeFailpointError` instead.\n */\nexport class DurableRuntimeFailpoint extends Context.Service<\n DurableRuntimeFailpoint,\n {\n readonly hit: DurableRuntimeFailpointHandler;\n }\n>()(\"@effect-agent/thread/DurableRuntimeFailpoint\") {\n /** Production default: no fault injection. */\n static readonly layer = Layer.succeed(this)({ hit: noFailpoint });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,kCAAkC,OAAO,SAAS;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAKD,IAAa,+BAAb,cAAkD,OAAO,YAA0C,CAAC,CAClG,gCACA,EACE,UAAU,gCACZ,CACF,CAAC,CAAC,CAAC;AAMH,MAAM,oBAAoD,OAAO;;;;;;AAOjE,IAAa,0BAAb,cAA6C,QAAQ,QAKnD,CAAC,CAAC,8CAA8C,CAAC,CAAC;;CAElD,OAAgB,QAAQ,MAAM,QAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC;AAClE"}
1
+ {"version":3,"file":"DurableFailpoint.mjs","names":[],"sources":["../../src/durable/DurableFailpoint.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\n/**\n * Coordinator-owned failpoint locations (plan §Failpoints). Locations normally sit immediately\n * AFTER one durable mutation of the six-step coordinator flow, so a fault injected there\n * simulates a crash between two durable steps; the matching BEFORE boundary of each mutation is\n * owned by the storage adapters (`ledger:*:before`, `append:before`, ...), giving every durable\n * mutation a failpoint on both sides (change discipline). Run-start append also exposes its\n * BEFORE boundary here to distinguish a fresh clock from a committed clock in crash tests.\n *\n * The `subagent:*` family covers every durable mutation of the S2 establishment/join protocol\n * including reservation, request append, child admission, child readiness,\n * start-link append, sibling per-call settles at the suspension seam, the `waitingForChild`\n * suspension, child abort propagation, the atomic join batch, and both reservation-release\n * transitions.\n */\nexport const DurableRuntimeFailpointLocation = Schema.Literals([\n \"submit:after-admit\",\n \"submit:after-materialize\",\n \"claim:after-claim\",\n \"input:after-canonical-append\",\n \"run:before-start-append\",\n \"run:after-start-append\",\n \"run:before-duration-append\",\n \"run:after-duration-append\",\n \"turn:after-canonical-append\",\n \"turn:after-response-append\",\n \"turn:after-results-append\",\n \"compaction:before-canonical-append\",\n \"compaction:after-canonical-append\",\n \"checkpoint:before-save\",\n \"checkpoint:after-save\",\n \"tools:after-prepared-append\",\n \"tools:before-prepared-append\",\n \"tools:before-unavailable-append\",\n \"tools:after-unavailable-append\",\n \"policy:before-reservation-append\",\n \"policy:after-reservation-append\",\n \"step:after-step-append\",\n \"approval:after-request-append\",\n \"approval:after-suspend\",\n \"join:after-claim\",\n \"join:after-canonical-append\",\n \"resolve:after-intent\",\n \"terminalize:after-reserve\",\n \"terminalize:after-canonical-append\",\n \"abort:after-intent\",\n \"subagent:after-reserve\",\n \"subagent:after-request-append\",\n \"subagent:after-admit\",\n \"subagent:after-child-ready\",\n \"subagent:after-start-append\",\n \"subagent:after-sibling-settle\",\n \"subagent:after-suspend\",\n \"subagent:after-child-abort-intent\",\n \"subagent:before-join-append\",\n \"subagent:after-join-append\",\n \"subagent:after-release-pending\",\n \"subagent:after-release\",\n \"worker:before-source-append\",\n \"worker:after-source-append\",\n \"worker:before-origin-append\",\n \"worker:after-origin-append\",\n \"worker:before-completion-append\",\n \"worker:after-completion-append\",\n \"worker:before-subtree-append\",\n \"worker:after-subtree-append\",\n \"worker:before-report-append\",\n \"worker:after-report-append\",\n \"worker:before-report-delivery\",\n \"worker:after-report-delivery\",\n \"update:before-canonical-append\",\n \"update:after-canonical-append\",\n \"update:before-delivery-insert\",\n \"update:after-delivery-insert\",\n]);\n\nexport type DurableRuntimeFailpointLocation = typeof DurableRuntimeFailpointLocation.Type;\n\n/** Injected coordinator fault. Reaching the caller means the preceding durable step committed. */\nexport class DurableRuntimeFailpointError extends Schema.TaggedError<DurableRuntimeFailpointError>()(\n \"DurableRuntimeFailpointError\",\n {\n location: DurableRuntimeFailpointLocation,\n },\n) {}\n\nexport type DurableRuntimeFailpointHandler = (\n location: DurableRuntimeFailpointLocation,\n) => Effect.Effect<void, DurableRuntimeFailpointError>;\n\nconst noFailpoint: DurableRuntimeFailpointHandler = () => Effect.void;\n\n/**\n * Explicit fault-injection authority used at durable coordinator step boundaries. The process\n * crash harness (WP5) maps a hit to `process.exit`; in-process tests fail the step with the\n * typed `DurableRuntimeFailpointError` instead.\n */\nexport class DurableRuntimeFailpoint extends Context.Service<\n DurableRuntimeFailpoint,\n {\n readonly hit: DurableRuntimeFailpointHandler;\n }\n>()(\"@effect-agent/thread/DurableRuntimeFailpoint\") {\n /** Production default: no fault injection. */\n static readonly layer = Layer.succeed(this)({ hit: noFailpoint });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,kCAAkC,OAAO,SAAS;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAKD,IAAa,+BAAb,cAAkD,OAAO,YAA0C,CAAC,CAClG,gCACA,EACE,UAAU,gCACZ,CACF,CAAC,CAAC,CAAC;AAMH,MAAM,oBAAoD,OAAO;;;;;;AAOjE,IAAa,0BAAb,cAA6C,QAAQ,QAKnD,CAAC,CAAC,8CAA8C,CAAC,CAAC;;CAElD,OAAgB,QAAQ,MAAM,QAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC;AAClE"}
@@ -1,4 +1,4 @@
1
- import { i as DurableRuntimeFailpointHandler, n as DurableRuntimeFailpoint } from "../DurableFailpoint-DQJet828.mjs";
1
+ import { i as DurableRuntimeFailpointHandler, n as DurableRuntimeFailpoint } from "../DurableFailpoint-mx3-nsxU.mjs";
2
2
  import { Context, Effect, Layer } from "effect";
3
3
  //#region src/durable/DurableFailpointTestControl.d.ts
4
4
  declare const DurableRuntimeFailpointTestControl_base: Context.ServiceClass<DurableRuntimeFailpointTestControl, "@effect-agent/thread/DurableRuntimeFailpointTestControl", {
@@ -1,2 +1,2 @@
1
- import { a as makeEventSource, i as NormalizedEvent, r as EventSources, t as EventSource } from "../EventSource-D6PAAEyK.mjs";
1
+ import { a as makeEventSource, i as NormalizedEvent, r as EventSources, t as EventSource } from "../EventSource-BZ73J0s5.mjs";
2
2
  export { EventSource, EventSources, NormalizedEvent, makeEventSource };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
- import { T as PersistedJson } from "../Records-BAutSSnJ.mjs";
2
+ import { T as PersistedJson } from "../Records-DR1xtbXY.mjs";
3
3
  import { SubscriptionSourceError } from "./Subscription.mjs";
4
4
  import { Context, Effect, Schema } from "effect";
5
5
  //#region src/durable/EventSource.ts
@@ -1,7 +1,7 @@
1
1
  import { r as Principal } from "../Receipt-BAHyigAF.mjs";
2
- import "../Records-CV49DgQK.mjs";
3
- import { E as SubscriptionSourceError } from "../Subscription-BR_8Cxh3.mjs";
4
- import { t as EventSource } from "../EventSource-D6PAAEyK.mjs";
2
+ import "../Records-BIiRLqlz.mjs";
3
+ import { E as SubscriptionSourceError } from "../Subscription-BCQ3L9Zp.mjs";
4
+ import { t as EventSource } from "../EventSource-BZ73J0s5.mjs";
5
5
  import { SubscriptionFailure, SubscriptionIntake } from "./Subscriptions.mjs";
6
6
  import { Context, Effect, Layer, Redacted, Schema } from "effect";
7
7
  import { HttpClient } from "effect/unstable/http";
@@ -1,4 +1,4 @@
1
- import { dt as strictSchema } from "../Records-BAutSSnJ.mjs";
1
+ import { pt as strictSchema } from "../Records-DR1xtbXY.mjs";
2
2
  import { SubscriptionSourceError } from "./Subscription.mjs";
3
3
  import { makeEventSource } from "./EventSource.mjs";
4
4
  import { SubscriptionIntake } from "./Subscriptions.mjs";
@@ -3,9 +3,9 @@ import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDeleg
3
3
  import { a as Receipt, t as IdempotencyKey } from "../Receipt-BAHyigAF.mjs";
4
4
  import { r as Update } from "../AgentUpdates-DMJ-_xow.mjs";
5
5
  import { t as AgentPolicy } from "../AgentPolicy-BqDoSXO6.mjs";
6
- import { Wa as Settlement, h as DefinitionDigests } from "../Records-CV49DgQK.mjs";
7
- import { a as PreparedInput } from "../Subscription-BR_8Cxh3.mjs";
8
- import { t as PreparedInputAdmission } from "../PreparedInputAdmission-omMbwd--.mjs";
6
+ import { Ua as Settlement, h as DefinitionDigests } from "../Records-BIiRLqlz.mjs";
7
+ import { a as PreparedInput } from "../Subscription-BCQ3L9Zp.mjs";
8
+ import { t as PreparedInputAdmission } from "../PreparedInputAdmission-BkeI-Xvr.mjs";
9
9
  import { Context, Crypto, Effect, Layer, Result, Schema } from "effect";
10
10
  declare namespace MessageDelivery_d_exports {
11
11
  export { MessageDeliveryChange, MessageDeliveryDriver, MessageDeliveryDriverLimits, MessageDeliveryError, MessageDeliveryFailpoint, MessageDeliveryFailpointError, MessageDeliveryFailure, MessageDeliveryKey, MessageDeliveryPage, MessageDeliveryPageRequest, MessageDeliveryPolicy, MessageDeliveryRecord, MessageDeliveryStore, MessageDeliveryStoreLimits, applyMessageDeliveryChange, defaultMessageDeliveryPolicy, defaultMessageDeliveryStoreLimits, isWorkerUpdateDelivery, messageDeliveryCapacity, messageDeliveryDeadline, messageDeliveryKeyString, messageDeliveryUsesCapacity, prepareMessageDelivery, sameMessageDeliveryIdentity, validateMessageDelivery };
@@ -2,7 +2,7 @@ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { ThreadId } from "../core/Identifiers.mjs";
3
3
  import { IdempotencyKey, Receipt } from "../core/Receipt.mjs";
4
4
  import { WorkerUpdate } from "../core/Worker.mjs";
5
- import { h as Digest } from "../Records-BAutSSnJ.mjs";
5
+ import { h as Digest } from "../Records-DR1xtbXY.mjs";
6
6
  import { Settlement } from "./SubmissionLedger.mjs";
7
7
  import { digestJson } from "./Digest.mjs";
8
8
  import { ScheduleInstant, ScheduleRetry, ScheduleRetryReason } from "./Schedule.mjs";
@@ -2,7 +2,7 @@ import { d as SubagentReservationAmounts, l as SubagentGrant, o as SubagentDeleg
2
2
  import { a as Receipt } from "../Receipt-BAHyigAF.mjs";
3
3
  import { r as Update } from "../AgentUpdates-DMJ-_xow.mjs";
4
4
  import { t as AgentPolicy } from "../AgentPolicy-BqDoSXO6.mjs";
5
- import { Wa as Settlement, Xr as DigestError, h as DefinitionDigests } from "../Records-CV49DgQK.mjs";
5
+ import { Ua as Settlement, Yr as DigestError, h as DefinitionDigests } from "../Records-BIiRLqlz.mjs";
6
6
  import { MessageDeliveryError, MessageDeliveryFailure, MessageDeliveryStore } from "./MessageDelivery.mjs";
7
7
  import { Effect, Schema } from "effect";
8
8
  //#region src/durable/MessageDeliveryStoreConformance.d.ts
@@ -83,6 +83,25 @@ declare const makeMessageDeliveryFixture: (messageId?: any, owner?: any, text?:
83
83
  readonly reportKind?: "update" | undefined;
84
84
  } | undefined;
85
85
  readonly messageAdmission?: {
86
+ readonly schemaVersion: 1;
87
+ readonly message: {
88
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
89
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
90
+ };
91
+ readonly peerName: string;
92
+ readonly sender: {
93
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
94
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
95
+ };
96
+ readonly returnAddress: {
97
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
98
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
99
+ };
100
+ readonly inReplyTo?: {
101
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
102
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
103
+ } | undefined;
104
+ } | {
86
105
  readonly _tag: "WorkerCompletion";
87
106
  readonly budgetExhausted: boolean;
88
107
  readonly schemaVersion: 1;
@@ -123,25 +142,6 @@ declare const makeMessageDeliveryFixture: (messageId?: any, owner?: any, text?:
123
142
  readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
124
143
  };
125
144
  readonly update: Update;
126
- } | {
127
- readonly schemaVersion: 1;
128
- readonly message: {
129
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
130
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
131
- };
132
- readonly peerName: string;
133
- readonly sender: {
134
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
135
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
136
- };
137
- readonly returnAddress: {
138
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
139
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
140
- };
141
- readonly inReplyTo?: {
142
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
143
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
144
- } | undefined;
145
145
  } | undefined;
146
146
  };
147
147
  readonly envelopeDigest: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
@@ -246,6 +246,25 @@ declare const makeWorkerUpdateDeliveryFixture: (id: string) => Effect.Effect<{
246
246
  readonly reportKind?: "update" | undefined;
247
247
  } | undefined;
248
248
  readonly messageAdmission?: {
249
+ readonly schemaVersion: 1;
250
+ readonly message: {
251
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
252
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
253
+ };
254
+ readonly peerName: string;
255
+ readonly sender: {
256
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
257
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
258
+ };
259
+ readonly returnAddress: {
260
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
261
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
262
+ };
263
+ readonly inReplyTo?: {
264
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
265
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
266
+ } | undefined;
267
+ } | {
249
268
  readonly _tag: "WorkerCompletion";
250
269
  readonly budgetExhausted: boolean;
251
270
  readonly schemaVersion: 1;
@@ -286,25 +305,6 @@ declare const makeWorkerUpdateDeliveryFixture: (id: string) => Effect.Effect<{
286
305
  readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
287
306
  };
288
307
  readonly update: Update;
289
- } | {
290
- readonly schemaVersion: 1;
291
- readonly message: {
292
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
293
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
294
- };
295
- readonly peerName: string;
296
- readonly sender: {
297
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
298
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
299
- };
300
- readonly returnAddress: {
301
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
302
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
303
- };
304
- readonly inReplyTo?: {
305
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
306
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
307
- } | undefined;
308
308
  } | undefined;
309
309
  };
310
310
  readonly envelopeDigest: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
@@ -2,7 +2,7 @@ import { AgentId, DelegationId, ReceiptId, RunId, SettlementId, SubmissionId, Th
2
2
  import { IdempotencyKey, Principal, QueueSequence, Receipt } from "../core/Receipt.mjs";
3
3
  import { Update } from "../core/AgentUpdates.mjs";
4
4
  import { WorkerUpdate } from "../core/Worker.mjs";
5
- import { h as Digest, p as DefinitionDigests } from "../Records-BAutSSnJ.mjs";
5
+ import { h as Digest, p as DefinitionDigests } from "../Records-DR1xtbXY.mjs";
6
6
  import { Settlement } from "./SubmissionLedger.mjs";
7
7
  import { digestJson } from "./Digest.mjs";
8
8
  import { MessageDeliveryStore, messageDeliveryCapacity, prepareMessageDelivery } from "./MessageDelivery.mjs";
@@ -1,5 +1,5 @@
1
1
  import { t as ThreadHistory } from "../ThreadHistory-tS1KwxHR.mjs";
2
- import { in as ThreadStore } from "../Records-CV49DgQK.mjs";
2
+ import { on as ThreadStore } from "../Records-BIiRLqlz.mjs";
3
3
  import { Layer } from "effect";
4
4
  declare namespace PersistentHistory_d_exports {
5
5
  export { layer };
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
2
  import { ThreadHistory, ThreadHistoryError } from "../engine/ThreadHistory.mjs";
3
- import { D as ProducerId, E as ProducerEpoch, N as RunCompleted, O as RecordEnvelope, T as PersistedJson, b as ModelCompleted, i as BatchId, k as RecordId, m as DeploymentId, nt as UserInputRecorded, o as CanonicalBatch } from "../Records-BAutSSnJ.mjs";
3
+ import { D as ProducerId, E as ProducerEpoch, N as RunCompleted, O as RecordEnvelope, T as PersistedJson, b as ModelCompleted, i as BatchId, it as UserInputRecorded, k as RecordId, m as DeploymentId, o as CanonicalBatch } from "../Records-DR1xtbXY.mjs";
4
4
  import { FencedAppendRequest, MAX_THREAD_EXPORT_RECORDS, ThreadExportRequest, ThreadMaterialization, ThreadStore } from "./ThreadStore.mjs";
5
- import { m as promptFromCanonicalRecords } from "../RunJournal-DRRRZmG7.mjs";
5
+ import { m as promptFromCanonicalRecords } from "../RunJournal-DNs3PM4K.mjs";
6
6
  import { Prompt } from "effect/unstable/ai";
7
7
  import { DateTime, Effect, Layer, Schema } from "effect";
8
8
  //#region src/durable/PersistentHistory.ts
@@ -1,2 +1,2 @@
1
- import { r as admitPreparedInput, t as PreparedInputAdmission } from "../PreparedInputAdmission-omMbwd--.mjs";
1
+ import { r as admitPreparedInput, t as PreparedInputAdmission } from "../PreparedInputAdmission-BkeI-Xvr.mjs";
2
2
  export { PreparedInputAdmission, admitPreparedInput };
@@ -1,2 +1,2 @@
1
- import { $ as ToolCallPrepared, A as ProducerId, B as RunStartedRecord, C as ModelCompleted, D as PeerMessagePrepared, E as ObservationOffset, F as ReplayContract, G as SubagentRequested, H as SettlementOutcome, I as RunCompleted, J as SubmissionSettledRecord, K as SubagentStarted, L as RunDurationExhausted, M as RecordId, O as PersistedJson, P as RepairAnnotated, Q as ToolApprovalRequested, R as RunFailed, S as MAX_PERSISTED_JSON_NODES, T as ModelResponseRecorded, U as SubagentJoined, V as SettlementFailureDiagnostic, W as SubagentLineageRecorded, X as ThreadCreated, Y as SubtreeBudgetReserved, Z as ToolApprovalDecided, _ as Digest, a as BatchId, at as UserInputRecorded, b as MAX_PERSISTED_JSON_COLLECTION_LENGTH, c as CanonicalRecord, ct as WorkerInputRequested, d as CanonicalSequence, dt as WorkerReportPrepared, et as ToolCallResolution, f as CompactionCreated, ft as WorkerReportRefused, g as DeploymentId, h as DefinitionDigests, i as ApprovalDecision, it as ToolStepSettled, j as RecordEnvelope, k as ProducerEpoch, l as CanonicalRecordEnvelope, lt as WorkerOrigin, m as DefinitionDigestInput, n as AbortedSubmissionSettled, nt as ToolCallSettled, o as CURRENT_CANONICAL_SCHEMA_VERSION, ot as WorkerAdmission, p as CompletedSubmissionSettled, pt as WorkerReportingIntent, q as SubmissionSettled, r as AgentUpdateEmitted, rt as ToolCallUnknown, s as CanonicalBatch, st as WorkerInputCompleted, t as AbortRequested, tt as ToolCallResolved, u as CanonicalRecordPayload, ut as WorkerOriginRecorded, v as FailedSubmissionSettled, w as ModelResponseInterrupted, x as MAX_PERSISTED_JSON_DEPTH, y as MAX_PERSISTED_JSON_BYTES, z as RunPolicyUsageReserved } from "../Records-CV49DgQK.mjs";
2
- export { AbortRequested, AbortedSubmissionSettled, AgentUpdateEmitted, ApprovalDecision, BatchId, CURRENT_CANONICAL_SCHEMA_VERSION, CanonicalBatch, CanonicalRecord, CanonicalRecordEnvelope, CanonicalRecordPayload, CanonicalSequence, CompactionCreated, CompletedSubmissionSettled, DefinitionDigestInput, DefinitionDigests, DeploymentId, Digest, FailedSubmissionSettled, MAX_PERSISTED_JSON_BYTES, MAX_PERSISTED_JSON_COLLECTION_LENGTH, MAX_PERSISTED_JSON_DEPTH, MAX_PERSISTED_JSON_NODES, ModelCompleted, ModelResponseInterrupted, ModelResponseRecorded, ObservationOffset, PeerMessagePrepared, PersistedJson, ProducerEpoch, ProducerId, RecordEnvelope, RecordId, RepairAnnotated, ReplayContract, RunCompleted, RunDurationExhausted, RunFailed, RunPolicyUsageReserved, RunStartedRecord, SettlementFailureDiagnostic, SettlementOutcome, SubagentJoined, SubagentLineageRecorded, SubagentRequested, SubagentStarted, SubmissionSettled, SubmissionSettledRecord, SubtreeBudgetReserved, ThreadCreated, ToolApprovalDecided, ToolApprovalRequested, ToolCallPrepared, ToolCallResolution, ToolCallResolved, ToolCallSettled, ToolCallUnknown, ToolStepSettled, UserInputRecorded, WorkerAdmission, WorkerInputCompleted, WorkerInputRequested, WorkerOrigin, WorkerOriginRecorded, WorkerReportPrepared, WorkerReportRefused, WorkerReportingIntent };
1
+ import { $ as ToolCallPrepared, A as ProducerId, B as RunStartedRecord, C as ModelCompleted, D as PeerMessagePrepared, E as ObservationOffset, F as ReplayContract, G as SubagentRequested, H as SettlementOutcome, I as RunCompleted, J as SubmissionSettledRecord, K as SubagentStarted, L as RunDurationExhausted, M as RecordId, O as PersistedJson, P as RepairAnnotated, Q as ToolApprovalRequested, R as RunFailed, S as MAX_PERSISTED_JSON_NODES, T as ModelResponseRecorded, U as SubagentJoined, V as SettlementFailureDiagnostic, W as SubagentLineageRecorded, X as ThreadCreated, Y as SubtreeBudgetReserved, Z as ToolApprovalDecided, _ as Digest, a as BatchId, at as ToolStepSettled, b as MAX_PERSISTED_JSON_COLLECTION_LENGTH, c as CanonicalRecord, ct as WorkerAdmission, d as CanonicalSequence, dt as WorkerOrigin, et as ToolCallResolution, f as CompactionCreated, ft as WorkerOriginRecorded, g as DeploymentId, h as DefinitionDigests, ht as WorkerReportingIntent, i as ApprovalDecision, it as ToolOperation, j as RecordEnvelope, k as ProducerEpoch, l as CanonicalRecordEnvelope, lt as WorkerInputCompleted, m as DefinitionDigestInput, mt as WorkerReportRefused, n as AbortedSubmissionSettled, nt as ToolCallSettled, o as CURRENT_CANONICAL_SCHEMA_VERSION, ot as ToolUnavailable, p as CompletedSubmissionSettled, pt as WorkerReportPrepared, q as SubmissionSettled, r as AgentUpdateEmitted, rt as ToolCallUnknown, s as CanonicalBatch, st as UserInputRecorded, t as AbortRequested, tt as ToolCallResolved, u as CanonicalRecordPayload, ut as WorkerInputRequested, v as FailedSubmissionSettled, w as ModelResponseInterrupted, x as MAX_PERSISTED_JSON_DEPTH, y as MAX_PERSISTED_JSON_BYTES, z as RunPolicyUsageReserved } from "../Records-BIiRLqlz.mjs";
2
+ export { AbortRequested, AbortedSubmissionSettled, AgentUpdateEmitted, ApprovalDecision, BatchId, CURRENT_CANONICAL_SCHEMA_VERSION, CanonicalBatch, CanonicalRecord, CanonicalRecordEnvelope, CanonicalRecordPayload, CanonicalSequence, CompactionCreated, CompletedSubmissionSettled, DefinitionDigestInput, DefinitionDigests, DeploymentId, Digest, FailedSubmissionSettled, MAX_PERSISTED_JSON_BYTES, MAX_PERSISTED_JSON_COLLECTION_LENGTH, MAX_PERSISTED_JSON_DEPTH, MAX_PERSISTED_JSON_NODES, ModelCompleted, ModelResponseInterrupted, ModelResponseRecorded, ObservationOffset, PeerMessagePrepared, PersistedJson, ProducerEpoch, ProducerId, RecordEnvelope, RecordId, RepairAnnotated, ReplayContract, RunCompleted, RunDurationExhausted, RunFailed, RunPolicyUsageReserved, RunStartedRecord, SettlementFailureDiagnostic, SettlementOutcome, SubagentJoined, SubagentLineageRecorded, SubagentRequested, SubagentStarted, SubmissionSettled, SubmissionSettledRecord, SubtreeBudgetReserved, ThreadCreated, ToolApprovalDecided, ToolApprovalRequested, ToolCallPrepared, ToolCallResolution, ToolCallResolved, ToolCallSettled, ToolCallUnknown, ToolOperation, ToolStepSettled, ToolUnavailable, UserInputRecorded, WorkerAdmission, WorkerInputCompleted, WorkerInputRequested, WorkerOrigin, WorkerOriginRecorded, WorkerReportPrepared, WorkerReportRefused, WorkerReportingIntent };
@@ -1,2 +1,2 @@
1
- import { $ as ToolCallSettled, B as SubagentJoined, C as ObservationOffset, D as ProducerId, E as ProducerEpoch, F as RunFailed, G as SubmissionSettledRecord, H as SubagentRequested, I as RunPolicyUsageReserved, J as ToolApprovalDecided, K as SubtreeBudgetReserved, L as RunStartedRecord, M as ReplayContract, N as RunCompleted, O as RecordEnvelope, P as RunDurationExhausted, Q as ToolCallResolved, R as SettlementFailureDiagnostic, S as ModelResponseRecorded, T as PersistedJson, U as SubagentStarted, V as SubagentLineageRecorded, W as SubmissionSettled, X as ToolCallPrepared, Y as ToolApprovalRequested, Z as ToolCallResolution, _ as MAX_PERSISTED_JSON_COLLECTION_LENGTH, a as CURRENT_CANONICAL_SCHEMA_VERSION, at as WorkerInputRequested, b as ModelCompleted, c as CanonicalRecordEnvelope, ct as WorkerReportPrepared, d as CompactionCreated, et as ToolCallUnknown, f as DefinitionDigestInput, g as MAX_PERSISTED_JSON_BYTES, h as Digest, i as BatchId, it as WorkerInputCompleted, j as RepairAnnotated, k as RecordId, l as CanonicalRecordPayload, lt as WorkerReportRefused, m as DeploymentId, n as AgentUpdateEmitted, nt as UserInputRecorded, o as CanonicalBatch, ot as WorkerOrigin, p as DefinitionDigests, q as ThreadCreated, r as ApprovalDecision, rt as WorkerAdmission, s as CanonicalRecord, st as WorkerOriginRecorded, t as AbortRequested, tt as ToolStepSettled, u as CanonicalSequence, ut as WorkerReportingIntent, v as MAX_PERSISTED_JSON_DEPTH, w as PeerMessagePrepared, x as ModelResponseInterrupted, y as MAX_PERSISTED_JSON_NODES, z as SettlementOutcome } from "../Records-BAutSSnJ.mjs";
2
- export { AbortRequested, AgentUpdateEmitted, ApprovalDecision, BatchId, CURRENT_CANONICAL_SCHEMA_VERSION, CanonicalBatch, CanonicalRecord, CanonicalRecordEnvelope, CanonicalRecordPayload, CanonicalSequence, CompactionCreated, DefinitionDigestInput, DefinitionDigests, DeploymentId, Digest, MAX_PERSISTED_JSON_BYTES, MAX_PERSISTED_JSON_COLLECTION_LENGTH, MAX_PERSISTED_JSON_DEPTH, MAX_PERSISTED_JSON_NODES, ModelCompleted, ModelResponseInterrupted, ModelResponseRecorded, ObservationOffset, PeerMessagePrepared, PersistedJson, ProducerEpoch, ProducerId, RecordEnvelope, RecordId, RepairAnnotated, ReplayContract, RunCompleted, RunDurationExhausted, RunFailed, RunPolicyUsageReserved, RunStartedRecord, SettlementFailureDiagnostic, SettlementOutcome, SubagentJoined, SubagentLineageRecorded, SubagentRequested, SubagentStarted, SubmissionSettled, SubmissionSettledRecord, SubtreeBudgetReserved, ThreadCreated, ToolApprovalDecided, ToolApprovalRequested, ToolCallPrepared, ToolCallResolution, ToolCallResolved, ToolCallSettled, ToolCallUnknown, ToolStepSettled, UserInputRecorded, WorkerAdmission, WorkerInputCompleted, WorkerInputRequested, WorkerOrigin, WorkerOriginRecorded, WorkerReportPrepared, WorkerReportRefused, WorkerReportingIntent };
1
+ import { $ as ToolCallSettled, B as SubagentJoined, C as ObservationOffset, D as ProducerId, E as ProducerEpoch, F as RunFailed, G as SubmissionSettledRecord, H as SubagentRequested, I as RunPolicyUsageReserved, J as ToolApprovalDecided, K as SubtreeBudgetReserved, L as RunStartedRecord, M as ReplayContract, N as RunCompleted, O as RecordEnvelope, P as RunDurationExhausted, Q as ToolCallResolved, R as SettlementFailureDiagnostic, S as ModelResponseRecorded, T as PersistedJson, U as SubagentStarted, V as SubagentLineageRecorded, W as SubmissionSettled, X as ToolCallPrepared, Y as ToolApprovalRequested, Z as ToolCallResolution, _ as MAX_PERSISTED_JSON_COLLECTION_LENGTH, a as CURRENT_CANONICAL_SCHEMA_VERSION, at as WorkerAdmission, b as ModelCompleted, c as CanonicalRecordEnvelope, ct as WorkerOrigin, d as CompactionCreated, dt as WorkerReportRefused, et as ToolCallUnknown, f as DefinitionDigestInput, ft as WorkerReportingIntent, g as MAX_PERSISTED_JSON_BYTES, h as Digest, i as BatchId, it as UserInputRecorded, j as RepairAnnotated, k as RecordId, l as CanonicalRecordPayload, lt as WorkerOriginRecorded, m as DeploymentId, n as AgentUpdateEmitted, nt as ToolStepSettled, o as CanonicalBatch, ot as WorkerInputCompleted, p as DefinitionDigests, q as ThreadCreated, r as ApprovalDecision, rt as ToolUnavailable, s as CanonicalRecord, st as WorkerInputRequested, t as AbortRequested, tt as ToolOperation, u as CanonicalSequence, ut as WorkerReportPrepared, v as MAX_PERSISTED_JSON_DEPTH, w as PeerMessagePrepared, x as ModelResponseInterrupted, y as MAX_PERSISTED_JSON_NODES, z as SettlementOutcome } from "../Records-DR1xtbXY.mjs";
2
+ export { AbortRequested, AgentUpdateEmitted, ApprovalDecision, BatchId, CURRENT_CANONICAL_SCHEMA_VERSION, CanonicalBatch, CanonicalRecord, CanonicalRecordEnvelope, CanonicalRecordPayload, CanonicalSequence, CompactionCreated, DefinitionDigestInput, DefinitionDigests, DeploymentId, Digest, MAX_PERSISTED_JSON_BYTES, MAX_PERSISTED_JSON_COLLECTION_LENGTH, MAX_PERSISTED_JSON_DEPTH, MAX_PERSISTED_JSON_NODES, ModelCompleted, ModelResponseInterrupted, ModelResponseRecorded, ObservationOffset, PeerMessagePrepared, PersistedJson, ProducerEpoch, ProducerId, RecordEnvelope, RecordId, RepairAnnotated, ReplayContract, RunCompleted, RunDurationExhausted, RunFailed, RunPolicyUsageReserved, RunStartedRecord, SettlementFailureDiagnostic, SettlementOutcome, SubagentJoined, SubagentLineageRecorded, SubagentRequested, SubagentStarted, SubmissionSettled, SubmissionSettledRecord, SubtreeBudgetReserved, ThreadCreated, ToolApprovalDecided, ToolApprovalRequested, ToolCallPrepared, ToolCallResolution, ToolCallResolved, ToolCallSettled, ToolCallUnknown, ToolOperation, ToolStepSettled, ToolUnavailable, UserInputRecorded, WorkerAdmission, WorkerInputCompleted, WorkerInputRequested, WorkerOrigin, WorkerOriginRecorded, WorkerReportPrepared, WorkerReportRefused, WorkerReportingIntent };
@@ -1,2 +1,2 @@
1
- import { Ai as RepairJoinMarker, Bi as classifyRecovery, Ci as PendingApprovalEvidence, Ei as RecoveryEvidence, Fi as ResumeSuspended, Ii as ResumeWaitingParent, Li as RevertJoining, Mi as RepairSubagentStartLink, Ni as ResumeFromTurnBoundary, Oi as ReleaseOrphanChildReservation, Pi as ResumePendingToolBatch, Ri as SettleAborted, Si as OpenToolCallEvidence, Ti as RecoveryDecision, _i as EnsureWaitingForChild, ai as ApplyJoinAccounting, bi as NoAction, ci as AwaitChildAdmissionResolution, di as AwaitParentEstablishment, fi as AwaitUnknownResolution, gi as DelegationAdmissionEvidence, hi as DeclaredPendingBatchEvidence, ii as ApplyInput, ji as RepairReadiness, ki as RepairInputMarker, li as AwaitChildSettlement, mi as CompleteMaterialization, oi as ApplyUnknownResolutions, pi as CompleteChildAdmission, ri as AppendReservedSettlement, si as AwaitApprovalDecision, ui as AwaitHostSettlement, vi as FinalizeLedgerFromHistory, wi as PropagateChildAbort, xi as OpenDelegationCallEvidence, yi as MarkUnknown, zi as SettleJoinedWithHost } from "../Records-CV49DgQK.mjs";
1
+ import { Ai as RepairReadiness, Ci as PropagateChildAbort, Di as ReleaseOrphanChildReservation, Fi as ResumeWaitingParent, Ii as RevertJoining, Li as SettleAborted, Mi as ResumeFromTurnBoundary, Ni as ResumePendingToolBatch, Oi as RepairInputMarker, Pi as ResumeSuspended, Ri as SettleJoinedWithHost, Si as PendingApprovalEvidence, Ti as RecoveryEvidence, _i as FinalizeLedgerFromHistory, ai as ApplyUnknownResolutions, bi as OpenDelegationCallEvidence, ci as AwaitChildSettlement, di as AwaitUnknownResolution, fi as CompleteChildAdmission, gi as EnsureWaitingForChild, hi as DelegationAdmissionEvidence, ii as ApplyJoinAccounting, ji as RepairSubagentStartLink, ki as RepairJoinMarker, li as AwaitHostSettlement, mi as DeclaredPendingBatchEvidence, ni as AppendReservedSettlement, oi as AwaitApprovalDecision, pi as CompleteMaterialization, ri as ApplyInput, si as AwaitChildAdmissionResolution, ui as AwaitParentEstablishment, vi as MarkUnknown, wi as RecoveryDecision, xi as OpenToolCallEvidence, yi as NoAction, zi as classifyRecovery } from "../Records-BIiRLqlz.mjs";
2
2
  export { AppendReservedSettlement, ApplyInput, ApplyJoinAccounting, ApplyUnknownResolutions, AwaitApprovalDecision, AwaitChildAdmissionResolution, AwaitChildSettlement, AwaitHostSettlement, AwaitParentEstablishment, AwaitUnknownResolution, CompleteChildAdmission, CompleteMaterialization, DeclaredPendingBatchEvidence, DelegationAdmissionEvidence, EnsureWaitingForChild, FinalizeLedgerFromHistory, MarkUnknown, NoAction, OpenDelegationCallEvidence, OpenToolCallEvidence, PendingApprovalEvidence, PropagateChildAbort, RecoveryDecision, RecoveryEvidence, ReleaseOrphanChildReservation, RepairInputMarker, RepairJoinMarker, RepairReadiness, RepairSubagentStartLink, ResumeFromTurnBoundary, ResumePendingToolBatch, ResumeSuspended, ResumeWaitingParent, RevertJoining, SettleAborted, SettleJoinedWithHost, classifyRecovery };