@yielded/agent 0.1.0-beta.182 → 0.1.0-beta.183

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 (162) hide show
  1. package/dist/{Admin-C4mPa0M2.d.mts → Admin-BgCHCGSl.d.mts} +5 -5
  2. package/dist/{AgentRuntime-CVsnQBPe.d.mts → AgentRuntime-DhRchFzv.d.mts} +4 -1
  3. package/dist/{AgentRuntime-1OjlOCa9.mjs → AgentRuntime-ILtyHuQG.mjs} +52 -40
  4. package/dist/AgentRuntime-ILtyHuQG.mjs.map +1 -0
  5. package/dist/{Digest-DjUgS5PG.d.mts → Digest-1iVcDLVm.d.mts} +2 -2
  6. package/dist/{Digest-ft4ku9pj.mjs → Digest-CzLJcsWv.mjs} +2 -2
  7. package/dist/{Digest-ft4ku9pj.mjs.map → Digest-CzLJcsWv.mjs.map} +1 -1
  8. package/dist/{DurableAgentRuntime-D2I_T2Yt.mjs → DurableAgentRuntime-Cj263rW9.mjs} +20 -55
  9. package/dist/DurableAgentRuntime-Cj263rW9.mjs.map +1 -0
  10. package/dist/{EventSource-gc82d-f6.d.mts → EventSource-CaA6RAtC.d.mts} +3 -3
  11. package/dist/{MessageDelivery-DrQKvh93.d.mts → MessageDelivery-rlLpakO8.d.mts} +43 -43
  12. package/dist/{PreparedInputAdmission-CrqdFUd8.d.mts → PreparedInputAdmission-DjbWz2lW.d.mts} +4 -4
  13. package/dist/{RecordFormat-BNiLpe43.d.mts → RecordFormat-CjMl0uu8.d.mts} +2 -2
  14. package/dist/{Records-BTnGRdcf.d.mts → Records-BP67Yz6n.d.mts} +20 -8
  15. package/dist/{Records-CZRedCE7.mjs → Records-bbGVHprv.mjs} +14 -10
  16. package/dist/Records-bbGVHprv.mjs.map +1 -0
  17. package/dist/{RunContinuation-DMbA81sZ.d.mts → RunContinuation-CIJRN_vC.d.mts} +4 -4
  18. package/dist/{RunContinuation-DWiO2K9D.mjs → RunContinuation-DJ6kkbQG.mjs} +17 -58
  19. package/dist/RunContinuation-DJ6kkbQG.mjs.map +1 -0
  20. package/dist/{RunJournal-oJLo-pjS.mjs → RunJournal-DQr2dUgg.mjs} +4 -7
  21. package/dist/RunJournal-DQr2dUgg.mjs.map +1 -0
  22. package/dist/{RunStorage-DlfvMfHM.mjs → RunStorage-DblN-cmM.mjs} +2 -2
  23. package/dist/{RunStorage-DlfvMfHM.mjs.map → RunStorage-DblN-cmM.mjs.map} +1 -1
  24. package/dist/{Schedule-CDgTz0vj.d.mts → Schedule-CVLtl5rP.d.mts} +2 -2
  25. package/dist/{Scheduling-BebkRVc2.mjs → Scheduling-B6l0lWdr.mjs} +3 -3
  26. package/dist/{Scheduling-BebkRVc2.mjs.map → Scheduling-B6l0lWdr.mjs.map} +1 -1
  27. package/dist/{Subagent-BRiDyUS4.mjs → Subagent-Bm842K7J.mjs} +43 -17
  28. package/dist/Subagent-Bm842K7J.mjs.map +1 -0
  29. package/dist/{Subagent-FypBXZP1.d.mts → Subagent-CWWmA1UQ.d.mts} +15 -3
  30. package/dist/{Subscription-Bx0LiX3x.d.mts → Subscription-BRsNy0TA.d.mts} +4 -4
  31. package/dist/{SubscriptionInput-CBFCfuOF.d.mts → SubscriptionInput-ClCaW_kX.d.mts} +3 -3
  32. package/dist/{ThreadImport-DlCLjRHK.mjs → ThreadImport-CkPAxXU5.mjs} +7 -7
  33. package/dist/{ThreadImport-DlCLjRHK.mjs.map → ThreadImport-CkPAxXU5.mjs.map} +1 -1
  34. package/dist/{ThreadImport-DTV_ario.d.mts → ThreadImport-DtRNoHIr.d.mts} +5 -5
  35. package/dist/{ThreadStore-D2rqtt7k.mjs → ThreadStore-C_ofHc7h.mjs} +4 -4
  36. package/dist/{ThreadStore-D2rqtt7k.mjs.map → ThreadStore-C_ofHc7h.mjs.map} +1 -1
  37. package/dist/{ThreadTransfer-BFolkpEp.mjs → ThreadTransfer-C_TRuo_9.mjs} +4 -4
  38. package/dist/{ThreadTransfer-BFolkpEp.mjs.map → ThreadTransfer-C_TRuo_9.mjs.map} +1 -1
  39. package/dist/{WorkerAdmission-Cxg_REhE.mjs → WorkerAdmission-9Ka3edXj.mjs} +5 -5
  40. package/dist/{WorkerAdmission-Cxg_REhE.mjs.map → WorkerAdmission-9Ka3edXj.mjs.map} +1 -1
  41. package/dist/{agent-registration-C6tkQz8r.mjs → agent-registration-7kp1dHT0.mjs} +4 -4
  42. package/dist/{agent-registration-C6tkQz8r.mjs.map → agent-registration-7kp1dHT0.mjs.map} +1 -1
  43. package/dist/capabilities/Subagent.d.mts +1 -1
  44. package/dist/capabilities/Subagent.mjs +1 -1
  45. package/dist/capabilities/SubagentReservations.d.mts +4 -1
  46. package/dist/capabilities/SubagentReservations.mjs +4 -1
  47. package/dist/capabilities/SubagentReservations.mjs.map +1 -1
  48. package/dist/durable/ActivityStore.d.mts +1 -1
  49. package/dist/durable/ActivityStore.mjs +1 -1
  50. package/dist/durable/Admin.d.mts +1 -1
  51. package/dist/durable/Admin.mjs +1 -1
  52. package/dist/durable/AgentRegistration.d.mts +1 -1
  53. package/dist/durable/AgentRegistration.mjs +1 -1
  54. package/dist/durable/Certification.d.mts +1 -1
  55. package/dist/durable/CommittedActivity.d.mts +3 -3
  56. package/dist/durable/CommittedActivity.mjs +3 -3
  57. package/dist/durable/Digest.d.mts +1 -1
  58. package/dist/durable/Digest.mjs +1 -1
  59. package/dist/durable/DurableAgentRuntime.d.mts +1 -1
  60. package/dist/durable/DurableAgentRuntime.mjs +2 -2
  61. package/dist/durable/EventSource.d.mts +1 -1
  62. package/dist/durable/EventSource.mjs +1 -1
  63. package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
  64. package/dist/durable/LifecyclePublication.d.mts +1 -1
  65. package/dist/durable/LifecyclePublication.mjs +2 -2
  66. package/dist/durable/MessageDelivery.d.mts +1 -1
  67. package/dist/durable/MessageDelivery.mjs +2 -2
  68. package/dist/durable/MessageDeliveryStoreConformance.d.mts +4 -4
  69. package/dist/durable/MessageDeliveryStoreConformance.mjs +2 -2
  70. package/dist/durable/PersistentHistory.d.mts +1 -1
  71. package/dist/durable/PersistentHistory.mjs +4 -4
  72. package/dist/durable/PreparedInputAdmission.d.mts +1 -1
  73. package/dist/durable/RecordFormat.d.mts +1 -1
  74. package/dist/durable/RecordFormat.mjs +1 -1
  75. package/dist/durable/Records.d.mts +1 -1
  76. package/dist/durable/Records.mjs +1 -1
  77. package/dist/durable/Recovery.d.mts +1 -1
  78. package/dist/durable/Recovery.mjs +1 -1
  79. package/dist/durable/RunContinuation.d.mts +3 -3
  80. package/dist/durable/RunContinuation.mjs +3 -3
  81. package/dist/durable/RunJournal.d.mts +1 -1
  82. package/dist/durable/RunJournal.mjs +1 -1
  83. package/dist/durable/RunStorage.d.mts +1 -1
  84. package/dist/durable/RunStorage.mjs +1 -1
  85. package/dist/durable/Schedule.d.mts +1 -1
  86. package/dist/durable/Schedule.mjs +1 -1
  87. package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
  88. package/dist/durable/ScheduleStoreConformance.mjs +1 -1
  89. package/dist/durable/ScheduleTransition.d.mts +1 -1
  90. package/dist/durable/ScheduleTransition.mjs +1 -1
  91. package/dist/durable/Scheduling.d.mts +3 -3
  92. package/dist/durable/Scheduling.mjs +1 -1
  93. package/dist/durable/SettlementPublisher.d.mts +1 -1
  94. package/dist/durable/SettlementPublisher.mjs +3 -3
  95. package/dist/durable/SubmissionLedger.d.mts +1 -1
  96. package/dist/durable/SubmissionLedger.mjs +2 -2
  97. package/dist/durable/SubmissionLedgerConformance.d.mts +2 -2
  98. package/dist/durable/SubmissionLedgerConformance.mjs +5 -5
  99. package/dist/durable/SubmissionStatus.d.mts +1 -1
  100. package/dist/durable/Subscription.d.mts +1 -1
  101. package/dist/durable/Subscription.mjs +1 -1
  102. package/dist/durable/SubscriptionInput.d.mts +1 -1
  103. package/dist/durable/SubscriptionInput.mjs +2 -2
  104. package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
  105. package/dist/durable/SubscriptionStoreConformance.mjs +1 -1
  106. package/dist/durable/SubscriptionTools.d.mts +4 -4
  107. package/dist/durable/SubscriptionTransition.d.mts +1 -1
  108. package/dist/durable/SubscriptionTransition.mjs +1 -1
  109. package/dist/durable/Subscriptions.d.mts +6 -6
  110. package/dist/durable/Subscriptions.mjs +2 -2
  111. package/dist/durable/ThreadArchiveRange.d.mts +1 -1
  112. package/dist/durable/ThreadArchiveRange.mjs +1 -1
  113. package/dist/durable/ThreadContextHistory.d.mts +1 -1
  114. package/dist/durable/ThreadContextHistory.mjs +2 -2
  115. package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
  116. package/dist/durable/ThreadContextHistoryProjection.mjs +1 -1
  117. package/dist/durable/ThreadImport.d.mts +1 -1
  118. package/dist/durable/ThreadImport.mjs +1 -1
  119. package/dist/durable/ThreadInvariants.d.mts +3 -3
  120. package/dist/durable/ThreadInvariants.mjs +4 -4
  121. package/dist/durable/ThreadProjection.d.mts +1 -1
  122. package/dist/durable/ThreadProjection.mjs +1 -1
  123. package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
  124. package/dist/durable/ThreadReader.d.mts +1 -1
  125. package/dist/durable/ThreadReader.mjs +1 -1
  126. package/dist/durable/ThreadStore.d.mts +2 -2
  127. package/dist/durable/ThreadStore.mjs +2 -2
  128. package/dist/durable/ThreadStoreConformance.d.mts +2 -2
  129. package/dist/durable/ThreadStoreConformance.mjs +4 -4
  130. package/dist/durable/ThreadTransfer.d.mts +2 -2
  131. package/dist/durable/ThreadTransfer.mjs +1 -1
  132. package/dist/durable/ThreadWork.d.mts +1 -1
  133. package/dist/durable/ThreadWork.mjs +5 -5
  134. package/dist/durable/ToolReconciler.mjs +1 -1
  135. package/dist/durable/WorkerAdmission.d.mts +2 -2
  136. package/dist/durable/WorkerAdmission.mjs +1 -1
  137. package/dist/durable/WorkerHost.d.mts +2 -2
  138. package/dist/engine/AgentRuntime.d.mts +1 -1
  139. package/dist/engine/AgentRuntime.mjs +1 -1
  140. package/dist/index.d.mts +14 -14
  141. package/dist/index.mjs +12 -12
  142. package/dist/{run-context-reader-CIdG5tdJ.d.mts → run-context-reader-DEU4REfD.d.mts} +3 -3
  143. package/package.json +1 -1
  144. package/src/capabilities/Subagent.ts +83 -28
  145. package/src/capabilities/SubagentReservations.ts +4 -1
  146. package/src/capabilities/internal/subagent-contract.ts +23 -3
  147. package/src/durable/DurableAgentRuntime.ts +24 -10
  148. package/src/durable/Records.ts +21 -15
  149. package/src/durable/RunContinuation.ts +54 -125
  150. package/src/durable/RunJournal.ts +4 -12
  151. package/src/durable/internal/history-prompt.ts +10 -4
  152. package/src/durable/internal/initial-context.ts +1 -1
  153. package/src/durable/internal/prompt-history-cache.ts +8 -63
  154. package/src/engine/internal/agent-runtime.ts +379 -381
  155. package/dist/AgentRuntime-1OjlOCa9.mjs.map +0 -1
  156. package/dist/DurableAgentRuntime-D2I_T2Yt.mjs.map +0 -1
  157. package/dist/Records-CZRedCE7.mjs.map +0 -1
  158. package/dist/RunContinuation-DWiO2K9D.mjs.map +0 -1
  159. package/dist/RunJournal-oJLo-pjS.mjs.map +0 -1
  160. package/dist/Subagent-BRiDyUS4.mjs.map +0 -1
  161. package/dist/json-BlJVQZxN.mjs +0 -15
  162. package/dist/json-BlJVQZxN.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { K as PersistedJson } from "./Records-BTnGRdcf.mjs";
2
- import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-Bx0LiX3x.mjs";
1
+ import { K as PersistedJson } from "./Records-BP67Yz6n.mjs";
2
+ import { E as SubscriptionSourceError, b as SubscriptionRecord, i as EventSourceVersion, t as AcceptedEvent } from "./Subscription-BRsNy0TA.mjs";
3
3
  import { Context, Effect, Schema, Scope } from "effect";
4
4
  declare namespace EventSource_d_exports {
5
5
  export { EventSource, EventSources, NormalizedEvent, makeEventSource };
@@ -48,4 +48,4 @@ declare const makeEventSource: <Event extends Schema.Top, Parameters extends Sch
48
48
  }) => Effect.Effect<EventSource, never, Exclude<R, Scope.Scope> | Exclude<Event["DecodingServices"], Scope.Scope> | Exclude<Event["EncodingServices"], Scope.Scope> | Exclude<Parameters["DecodingServices"], Scope.Scope> | Exclude<Parameters["EncodingServices"], Scope.Scope>>;
49
49
  //#endregion
50
50
  export { makeEventSource as a, NormalizedEvent as i, EventSource_d_exports as n, EventSources as r, EventSource as t };
51
- //# sourceMappingURL=EventSource-gc82d-f6.d.mts.map
51
+ //# sourceMappingURL=EventSource-CaA6RAtC.d.mts.map
@@ -4,10 +4,10 @@ import { a as Receipt, t as IdempotencyKey } from "./Receipt-BkM21Qiu.mjs";
4
4
  import { r as Update } from "./AgentUpdates-DksV4D0A.mjs";
5
5
  import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-DvHruCSJ.mjs";
6
6
  import { t as AgentPolicy } from "./AgentPolicy-B4lbCU2T.mjs";
7
- import { b as DefinitionDigests } from "./Records-BTnGRdcf.mjs";
8
- import { fo as LifecyclePublicationStorage, sn as Settlement } from "./Admin-C4mPa0M2.mjs";
9
- import { a as PreparedInput } from "./Subscription-Bx0LiX3x.mjs";
10
- import { t as PreparedInputAdmission } from "./PreparedInputAdmission-CrqdFUd8.mjs";
7
+ import { b as DefinitionDigests } from "./Records-BP67Yz6n.mjs";
8
+ import { fo as LifecyclePublicationStorage, sn as Settlement } from "./Admin-BgCHCGSl.mjs";
9
+ import { a as PreparedInput } from "./Subscription-BRsNy0TA.mjs";
10
+ import { t as PreparedInputAdmission } from "./PreparedInputAdmission-DjbWz2lW.mjs";
11
11
  import { Context, Crypto, Effect, Layer, Result, Schema } from "effect";
12
12
  declare namespace MessageDelivery_d_exports {
13
13
  export { MessageDeliveryChange, MessageDeliveryCompletion, MessageDeliveryDriver, MessageDeliveryDriverLimits, MessageDeliveryError, MessageDeliveryFailpoint, MessageDeliveryFailpointError, MessageDeliveryFailure, MessageDeliveryKey, MessageDeliveryPage, MessageDeliveryPageRequest, MessageDeliveryPolicy, MessageDeliveryRecord, MessageDeliveryStore, MessageDeliveryStoreLimits, applyMessageDeliveryChange, defaultMessageDeliveryPolicy, defaultMessageDeliveryStoreLimits, isWorkerUpdateDelivery, messageDeliveryCapacity, messageDeliveryDeadline, messageDeliveryKeyString, messageDeliveryUsesCapacity, peerMessageRetentionDeadline, prepareMessageDelivery, readPending, sameMessageDeliveryIdentity, validateMessageDelivery };
@@ -633,6 +633,25 @@ declare const readPending: (request: Pick<{
633
633
  readonly reportKind?: "update" | undefined;
634
634
  } | undefined;
635
635
  readonly messageAdmission?: {
636
+ readonly schemaVersion: 1;
637
+ readonly message: {
638
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
639
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
640
+ };
641
+ readonly peerName: string;
642
+ readonly sender: {
643
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
644
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
645
+ };
646
+ readonly returnAddress: {
647
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
648
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
649
+ };
650
+ readonly inReplyTo?: {
651
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
652
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
653
+ } | undefined;
654
+ } | {
636
655
  readonly _tag: "WorkerCompletion";
637
656
  readonly budgetExhausted: boolean;
638
657
  readonly schemaVersion: 1;
@@ -673,25 +692,6 @@ declare const readPending: (request: Pick<{
673
692
  readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
674
693
  };
675
694
  readonly update: Update;
676
- } | {
677
- readonly schemaVersion: 1;
678
- readonly message: {
679
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
680
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
681
- };
682
- readonly peerName: string;
683
- readonly sender: {
684
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
685
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
686
- };
687
- readonly returnAddress: {
688
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
689
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
690
- };
691
- readonly inReplyTo?: {
692
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
693
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
694
- } | undefined;
695
695
  } | undefined;
696
696
  };
697
697
  readonly envelopeDigest: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
@@ -836,6 +836,25 @@ declare const prepareMessageDelivery: (options: {
836
836
  readonly reportKind?: "update" | undefined;
837
837
  } | undefined;
838
838
  readonly messageAdmission?: {
839
+ readonly schemaVersion: 1;
840
+ readonly message: {
841
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
842
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
843
+ };
844
+ readonly peerName: string;
845
+ readonly sender: {
846
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
847
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
848
+ };
849
+ readonly returnAddress: {
850
+ readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
851
+ readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
852
+ };
853
+ readonly inReplyTo?: {
854
+ readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
855
+ readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
856
+ } | undefined;
857
+ } | {
839
858
  readonly _tag: "WorkerCompletion";
840
859
  readonly budgetExhausted: boolean;
841
860
  readonly schemaVersion: 1;
@@ -876,25 +895,6 @@ declare const prepareMessageDelivery: (options: {
876
895
  readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
877
896
  };
878
897
  readonly update: Update;
879
- } | {
880
- readonly schemaVersion: 1;
881
- readonly message: {
882
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
883
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
884
- };
885
- readonly peerName: string;
886
- readonly sender: {
887
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
888
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
889
- };
890
- readonly returnAddress: {
891
- readonly threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
892
- readonly agentId: string & import("effect/Brand").Brand<"@effect-agent/core/AgentId">;
893
- };
894
- readonly inReplyTo?: {
895
- readonly ownerThreadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">;
896
- readonly messageId: string & import("effect/Brand").Brand<"@effect-agent/thread/IdempotencyKey">;
897
- } | undefined;
898
898
  } | undefined;
899
899
  };
900
900
  readonly envelopeDigest: string & import("effect/Brand").Brand<"@effect-agent/thread/Digest">;
@@ -950,4 +950,4 @@ declare class MessageDeliveryDriver extends MessageDeliveryDriver_base {
950
950
  }
951
951
  //#endregion
952
952
  export { messageDeliveryKeyString as C, readPending as D, prepareMessageDelivery as E, sameMessageDeliveryIdentity as O, messageDeliveryDeadline as S, peerMessageRetentionDeadline as T, applyMessageDeliveryChange as _, MessageDeliveryError as a, isWorkerUpdateDelivery as b, MessageDeliveryFailure as c, MessageDeliveryPageRequest as d, MessageDeliveryPolicy as f, MessageDelivery_d_exports as g, MessageDeliveryStoreLimits as h, MessageDeliveryDriverLimits as i, validateMessageDelivery as k, MessageDeliveryKey as l, MessageDeliveryStore as m, MessageDeliveryCompletion as n, MessageDeliveryFailpoint as o, MessageDeliveryRecord as p, MessageDeliveryDriver as r, MessageDeliveryFailpointError as s, MessageDeliveryChange as t, MessageDeliveryPage as u, defaultMessageDeliveryPolicy as v, messageDeliveryUsesCapacity as w, messageDeliveryCapacity as x, defaultMessageDeliveryStoreLimits as y };
953
- //# sourceMappingURL=MessageDelivery-DrQKvh93.d.mts.map
953
+ //# sourceMappingURL=MessageDelivery-rlLpakO8.d.mts.map
@@ -1,8 +1,8 @@
1
1
  import { a as Receipt } from "./Receipt-BkM21Qiu.mjs";
2
2
  import { a as FailureDiagnostic_d_exports, r as Diagnostic } from "./FailureDiagnostic-DvHruCSJ.mjs";
3
- import { kr as SubmissionStatus } from "./Admin-C4mPa0M2.mjs";
4
- import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-CDgTz0vj.mjs";
5
- import { a as PreparedInput } from "./Subscription-Bx0LiX3x.mjs";
3
+ import { kr as SubmissionStatus } from "./Admin-BgCHCGSl.mjs";
4
+ import { H as ScheduledInputRefused, V as ScheduledInputFailure, j as ScheduleStorageError } from "./Schedule-CVLtl5rP.mjs";
5
+ import { a as PreparedInput } from "./Subscription-BRsNy0TA.mjs";
6
6
  import { Context, Effect } from "effect";
7
7
  declare namespace PreparedInputAdmission_d_exports {
8
8
  export { PreparedInputAdmission, admitPreparedInput };
@@ -39,4 +39,4 @@ declare const admitPreparedInput: <R>(submit: Effect.Effect<Receipt, ScheduledIn
39
39
  }, ScheduleStorageError, R>;
40
40
  //#endregion
41
41
  export { PreparedInputAdmission_d_exports as n, admitPreparedInput as r, PreparedInputAdmission as t };
42
- //# sourceMappingURL=PreparedInputAdmission-CrqdFUd8.d.mts.map
42
+ //# sourceMappingURL=PreparedInputAdmission-DjbWz2lW.d.mts.map
@@ -1,4 +1,4 @@
1
- import { $ as RecordEnvelope, At as ToolStepSettled, B as ModelCompleted, Bt as WorkerOriginRecorded, Ct as ToolApprovalDecided, Dt as ToolCallSettled, Et as ToolCallResolved, G as PeerMessagePrepared, H as ModelResponseRecorded, Ht as WorkerReportRefused, It as WorkerInputCompleted, Lt as WorkerInputRefused, Mt as UserInputRecorded, Nt as WorkHandoffCompleted, Ot as ToolCallUnknown, Rt as WorkerInputRequested, St as ThreadCreated, V as ModelResponseInterrupted, Vt as WorkerReportPrepared, Wt as WorkerStopRequested, _t as SubagentRequested, at as RunCompleted, bt as SubmissionSettledRecord, ct as RunDurationExhausted, d as CanonicalRecordEnvelope, ft as RunStartedRecord, gt as SubagentLineageRecorded, ht as SubagentJoined, lt as RunFailed, m as CompactionCreated, ot as RunContextRecorded, r as AgentUpdateEmitted, rt as RepairAnnotated, st as RunContinuation, t as AbortRequested, ut as RunPolicyUsageReserved, vt as SubagentStarted, wt as ToolApprovalRequested, xt as SubtreeBudgetReserved, yt as SubmissionSettled, z as ModelCallAborted } from "./Records-BTnGRdcf.mjs";
1
+ import { $ as RecordEnvelope, At as ToolStepSettled, B as ModelCompleted, Bt as WorkerOriginRecorded, Ct as ToolApprovalDecided, Dt as ToolCallSettled, Et as ToolCallResolved, G as PeerMessagePrepared, H as ModelResponseRecorded, Ht as WorkerReportRefused, It as WorkerInputCompleted, Lt as WorkerInputRefused, Mt as UserInputRecorded, Nt as WorkHandoffCompleted, Ot as ToolCallUnknown, Rt as WorkerInputRequested, St as ThreadCreated, V as ModelResponseInterrupted, Vt as WorkerReportPrepared, Wt as WorkerStopRequested, _t as SubagentRequested, at as RunCompleted, bt as SubmissionSettledRecord, ct as RunDurationExhausted, d as CanonicalRecordEnvelope, ft as RunStartedRecord, gt as SubagentLineageRecorded, ht as SubagentJoined, lt as RunFailed, m as CompactionCreated, ot as RunContextRecorded, r as AgentUpdateEmitted, rt as RepairAnnotated, st as RunContinuation, t as AbortRequested, ut as RunPolicyUsageReserved, vt as SubagentStarted, wt as ToolApprovalRequested, xt as SubtreeBudgetReserved, yt as SubmissionSettled, z as ModelCallAborted } from "./Records-BP67Yz6n.mjs";
2
2
  import { Effect, Schema } from "effect";
3
3
  declare namespace RecordFormat_d_exports {
4
4
  export { ExportBatch, ExportRecord, ExportedRecord, ReadEnvelope, ReadRecord, RecordFormatError, decodeExportRecord, decodeExportRecordJson };
@@ -50,4 +50,4 @@ declare const ExportBatch: Schema.Struct<{
50
50
  }>;
51
51
  //#endregion
52
52
  export { ReadRecord as a, decodeExportRecord as c, ReadEnvelope as i, decodeExportRecordJson as l, ExportRecord as n, RecordFormatError as o, ExportedRecord as r, RecordFormat_d_exports as s, ExportBatch as t };
53
- //# sourceMappingURL=RecordFormat-BNiLpe43.d.mts.map
53
+ //# sourceMappingURL=RecordFormat-CjMl0uu8.d.mts.map
@@ -340,7 +340,7 @@ declare const ModelResponseRecorded_base: Schema.Class<ModelResponseRecorded, Sc
340
340
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
341
341
  readonly turnId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/TurnId">;
342
342
  readonly turn: Schema.Int;
343
- readonly messages: Schema.declare<Schema.Json, Schema.Json>;
343
+ readonly messages: Schema.refine<Schema.Json & Prompt.PromptEncoded, Schema.declare<Schema.Json, Schema.Json>>;
344
344
  readonly runScopedPrefixLength: Schema.optionalKey<Schema.Int>;
345
345
  readonly modelUsage: Schema.optionalKey<Schema.$Array<typeof ModelCallUsage>>;
346
346
  readonly unobservedModelCalls: Schema.optionalKey<Schema.Natural>;
@@ -1282,12 +1282,16 @@ declare const PromptRecordPayload: Schema.TaggedUnion<{
1282
1282
  }>;
1283
1283
  readonly ModelCompleted: Schema.TaggedStruct<"ModelCompleted", {
1284
1284
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1285
- readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>>;
1285
+ readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1286
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1287
+ }>, never, never>>;
1286
1288
  }>;
1287
1289
  readonly ModelResponseRecorded: Schema.TaggedStruct<"ModelResponseRecorded", {
1288
1290
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1289
1291
  readonly turn: Schema.Int;
1290
- readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>;
1292
+ readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1293
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1294
+ }>, never, never>;
1291
1295
  readonly runScopedPrefixLength: Schema.optionalKey<Schema.Int>;
1292
1296
  }>;
1293
1297
  readonly RunCompleted: Schema.TaggedStruct<"RunCompleted", {
@@ -1330,12 +1334,16 @@ declare const PromptRecord: Schema.Struct<{
1330
1334
  }>;
1331
1335
  readonly ModelCompleted: Schema.TaggedStruct<"ModelCompleted", {
1332
1336
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1333
- readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>>;
1337
+ readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1338
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1339
+ }>, never, never>>;
1334
1340
  }>;
1335
1341
  readonly ModelResponseRecorded: Schema.TaggedStruct<"ModelResponseRecorded", {
1336
1342
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1337
1343
  readonly turn: Schema.Int;
1338
- readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>;
1344
+ readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1345
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1346
+ }>, never, never>;
1339
1347
  readonly runScopedPrefixLength: Schema.optionalKey<Schema.Int>;
1340
1348
  }>;
1341
1349
  readonly RunCompleted: Schema.TaggedStruct<"RunCompleted", {
@@ -1382,12 +1390,16 @@ declare const PromptRecordEnvelope: Schema.Struct<{
1382
1390
  }>;
1383
1391
  readonly ModelCompleted: Schema.TaggedStruct<"ModelCompleted", {
1384
1392
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1385
- readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>>;
1393
+ readonly history: Schema.optionalKey<Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1394
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1395
+ }>, never, never>>;
1386
1396
  }>;
1387
1397
  readonly ModelResponseRecorded: Schema.TaggedStruct<"ModelResponseRecorded", {
1388
1398
  readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
1389
1399
  readonly turn: Schema.Int;
1390
- readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.toEncoded<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, never, never>;
1400
+ readonly messages: Schema.decodeTo<Schema.toType<Schema.Codec<Prompt.Prompt, Prompt.PromptEncoded, never, never>>, Schema.Struct<{
1401
+ readonly content: Schema.$Array<Schema.toEncoded<Schema.Codec<Prompt.Message, Prompt.MessageEncoded, never, never>>>;
1402
+ }>, never, never>;
1391
1403
  readonly runScopedPrefixLength: Schema.optionalKey<Schema.Int>;
1392
1404
  }>;
1393
1405
  readonly RunCompleted: Schema.TaggedStruct<"RunCompleted", {
@@ -1420,4 +1432,4 @@ type PromptRecordEnvelope = typeof PromptRecordEnvelope.Type;
1420
1432
  declare const CURRENT_CANONICAL_SCHEMA_VERSION: 1;
1421
1433
  //#endregion
1422
1434
  export { RecordEnvelope as $, MAX_PERSISTED_JSON_NODES as A, ToolStepSettled as At, ModelCompleted as B, WorkerOriginRecorded as Bt, EvidenceReference as C, ToolApprovalDecided as Ct, MAX_PERSISTED_JSON_BYTES as D, ToolCallSettled as Dt, MAX_CANONICAL_RECORD_BYTES as E, ToolCallResolved as Et, MAX_RUN_RECOVERY_SUFFIX_RECORDS as F, WorkerContinuation as Ft, PeerMessagePrepared as G, ModelResponseRecorded as H, WorkerReportRefused as Ht, MAX_RUN_TERMINAL_BYTES as I, WorkerInputCompleted as It, PromptRecord as J, PersistedJson as K, MAX_RUN_TOOL_CALL_IDENTITIES as L, WorkerInputRefused as Lt, MAX_RUN_EVIDENCE_BYTES as M, UserInputRecorded as Mt, MAX_RUN_EVIDENCE_RECORDS as N, WorkHandoffCompleted as Nt, MAX_PERSISTED_JSON_COLLECTION_LENGTH as O, ToolCallUnknown as Ot, MAX_RUN_RECOVERY_SUFFIX_BYTES as P, WorkerAdmission as Pt, RUN_TERMINAL_RESERVE_RECORDS as Q, MAX_TURN_CANONICAL_BYTES as R, WorkerInputRequested as Rt, Digest as S, ThreadCreated as St, KnownRecordPayload as T, ToolCallResolution as Tt, ObservationOffset as U, WorkerReportingIntent as Ut, ModelResponseInterrupted as V, WorkerReportPrepared as Vt, PROMPT_EVIDENCE_TAGS as W, WorkerStopRequested as Wt, PromptRecordPayload as X, PromptRecordEnvelope as Y, RUN_TERMINAL_RESERVE_BYTES as Z, ContinuationAccounting as _, SubagentRequested as _t, BatchId as a, RunCompleted as at, DefinitionDigests as b, SubmissionSettledRecord as bt, CURRENT_RECORD_VERSION as c, RunDurationExhausted as ct, CanonicalRecordEnvelope as d, RunPosition as dt, RecordId as et, CanonicalRecordPayload as f, RunStartedRecord as ft, ContextEvidenceReference as g, SubagentLineageRecorded as gt, CompletedSubmissionSettled as h, SubagentJoined as ht, ApprovalDecision as i, ReplayContract as it, MAX_RUN_CONTINUATION_BYTES as j, ToolUnavailable as jt, MAX_PERSISTED_JSON_DEPTH as k, ToolOperation as kt, CanonicalBatch as l, RunFailed as lt, CompactionCreated as m, SettlementOutcome as mt, AbortedSubmissionSettled as n, Records_d_exports as nt, CURRENT_CANONICAL_SCHEMA_VERSION as o, RunContextRecorded as ot, CanonicalSequence as p, SettlementFailureDiagnostic as pt, ProducerId as q, AgentUpdateEmitted as r, RepairAnnotated as rt, CURRENT_RECORD_FORMAT as s, RunContinuation as st, AbortRequested as t, RecordJson as tt, CanonicalRecord as u, RunPolicyUsageReserved as ut, DeclaredToolCall as v, SubagentStarted as vt, FailedSubmissionSettled as w, ToolApprovalRequested as wt, DeploymentId as x, SubtreeBudgetReserved as xt, DefinitionDigestInput as y, SubmissionSettled as yt, ModelCallAborted as z, WorkerOrigin as zt };
1423
- //# sourceMappingURL=Records-BTnGRdcf.d.mts.map
1435
+ //# sourceMappingURL=Records-BP67Yz6n.d.mts.map
@@ -35,7 +35,7 @@ function restorePart(part) {
35
35
  case "tool-approval-response": return Prompt.toolApprovalResponsePart(part);
36
36
  }
37
37
  }
38
- const restoreMessage = (message) => {
38
+ const restoreHistoryMessage = (message) => {
39
39
  switch (message.role) {
40
40
  case "system": return Prompt.makeMessage("system", message);
41
41
  case "user": return Prompt.makeMessage("user", {
@@ -53,11 +53,12 @@ const restoreMessage = (message) => {
53
53
  }
54
54
  };
55
55
  /**
56
- * Validate the upstream encoded history once, then restore native values with its constructors.
56
+ * Share the upstream encoded-message boundary between canonical history and checkpoint reads.
57
57
  * The canonical codec remains authoritative at append, import, recovery and explicit verification.
58
58
  */
59
- const HistoryPrompt = Schema.toEncoded(Prompt.Prompt).pipe(Schema.decodeTo(Schema.toType(Prompt.Prompt), SchemaTransformation.transformEffect({
60
- decode: (input) => Effect.succeed(Prompt.fromMessages(input.content.map(restoreMessage))),
59
+ const HistoryMessage = Schema.toEncoded(Prompt.Message);
60
+ const HistoryPrompt = Schema.Struct({ content: Schema.Array(HistoryMessage) }).pipe(Schema.decodeTo(Schema.toType(Prompt.Prompt), SchemaTransformation.transformEffect({
61
+ decode: (input) => Effect.succeed(Prompt.fromMessages(input.content.map(restoreHistoryMessage))),
61
62
  encode: SchemaParser.encodeEffect(Prompt.Prompt)
62
63
  })));
63
64
  //#endregion
@@ -319,6 +320,10 @@ var RunStartedRecord = class extends Schema.TaggedClass("@effect-agent/thread/Ru
319
320
  var RunDurationExhausted = class extends Schema.TaggedClass("@effect-agent/thread/RunDurationExhausted")("RunDurationExhausted", { runId: RunId }) {};
320
321
  const PersistedPromptMessages = Schema.toEncoded(Prompt.Prompt);
321
322
  const isPersistedPromptMessages = Schema.is(PersistedPromptMessages);
323
+ const PersistedResponseMessages = PersistedJson.pipe(Schema.refine((input) => isPersistedPromptMessages(input), {
324
+ identifier: "@effect-agent/thread/PersistedJson",
325
+ expected: "persisted Effect AI Prompt messages"
326
+ }));
322
327
  /**
323
328
  * Final model output. Immediate history records the successful Run's source messages for
324
329
  * recall and a full retained model-context snapshot for the next Run. Durable execution
@@ -388,7 +393,7 @@ const ModelResponseRecordedFields = Schema.Struct({
388
393
  runId: RunId,
389
394
  turnId: TurnId,
390
395
  turn: TurnNumber,
391
- messages: PersistedJson,
396
+ messages: PersistedResponseMessages,
392
397
  /**
393
398
  * Number of leading messages that belong only to this Run's evaluated instructions and wake
394
399
  * input. They remain canonical. An unfinished Run retains this exact evaluated prefix;
@@ -408,7 +413,6 @@ const ModelResponseRecordedFields = Schema.Struct({
408
413
  /** Estimated spend staged with the usage; recovery re-seeds the cost budget (RUN-023). */
409
414
  costMicrousd: Schema.optionalKey(Schema.Natural)
410
415
  }).check(Schema.makeFilter((response) => {
411
- if (!isPersistedPromptMessages(response.messages)) return false;
412
416
  const declarations = response.messages.content.flatMap((message) => message.role === "assistant" && typeof message.content !== "string" ? message.content.filter((part) => part.type === "tool-call" && part.providerExecuted !== true) : []);
413
417
  if (declarations.length !== response.toolOperations.length) return false;
414
418
  const seen = /* @__PURE__ */ new Set();
@@ -416,8 +420,8 @@ const ModelResponseRecordedFields = Schema.Struct({
416
420
  if (seen.has(operation.toolCallId) || !declarations.some((call) => call.type === "tool-call" && call.id === operation.toolCallId && call.name === operation.toolName)) return false;
417
421
  seen.add(operation.toolCallId);
418
422
  }
419
- return declarations.every((call) => call.type === "tool-call" && seen.has(call.id));
420
- }, { title: "Every application Tool declaration has unique original operation evidence" }), Schema.makeFilter((response) => response.runScopedPrefixLength === void 0 || isPersistedPromptMessages(response.messages) && response.runScopedPrefixLength < response.messages.content.length && response.messages.content.slice(0, response.runScopedPrefixLength).every((message) => message.role === "system" || message.role === "user"), { title: "Run-scoped Prompt prefix contains only instruction/wake messages and leaves one response" }));
423
+ return response.runScopedPrefixLength === void 0 || response.runScopedPrefixLength < response.messages.content.length && response.messages.content.slice(0, response.runScopedPrefixLength).every((message) => message.role === "system" || message.role === "user");
424
+ }, { title: "Model response has unique original Tool operation evidence and a valid instruction/wake prefix" }));
421
425
  var ModelResponseRecorded = class extends Schema.TaggedClass("@effect-agent/thread/ModelResponseRecorded")("ModelResponseRecorded", ModelResponseRecordedFields) {};
422
426
  /** Monotonic reservations charged before programmatic execution or grace finalization. */
423
427
  var RunPolicyUsageReserved = class extends Schema.TaggedClass()("RunPolicyUsageReserved", {
@@ -1128,6 +1132,6 @@ const PromptRecordEnvelope = Schema.Struct({
1128
1132
  });
1129
1133
  const CURRENT_CANONICAL_SCHEMA_VERSION = 1;
1130
1134
  //#endregion
1131
- export { Records_exports as $, MAX_RUN_EVIDENCE_RECORDS as A, WorkHandoffCompleted as At, ObservationOffset as B, WorkerReportingIntent as Bt, MAX_CANONICAL_RECORD_BYTES as C, ToolCallResolved as Ct, MAX_PERSISTED_JSON_NODES as D, ToolStepSettled as Dt, MAX_PERSISTED_JSON_DEPTH as E, ToolOperation as Et, MAX_TURN_CANONICAL_BYTES as F, WorkerInputRequested as Ft, PromptRecord as G, PeerMessagePrepared as H, ModelCallAborted as I, WorkerOrigin as It, RUN_TERMINAL_RESERVE_BYTES as J, PromptRecordEnvelope as K, ModelCompleted as L, WorkerOriginRecorded as Lt, MAX_RUN_RECOVERY_SUFFIX_RECORDS as M, WorkerContinuation as Mt, MAX_RUN_TERMINAL_BYTES as N, WorkerInputCompleted as Nt, MAX_RUN_CONTINUATION_BYTES as O, ToolUnavailable as Ot, MAX_RUN_TOOL_CALL_IDENTITIES as P, WorkerInputRefused as Pt, RecordJson as Q, ModelResponseInterrupted as R, WorkerReportPrepared as Rt, KnownRecordPayload as S, ToolCallResolution as St, MAX_PERSISTED_JSON_COLLECTION_LENGTH as T, ToolCallUnknown as Tt, PersistedJson as U, PROMPT_EVIDENCE_TAGS as V, WorkerStopRequested as Vt, ProducerId as W, RecordEnvelope as X, RUN_TERMINAL_RESERVE_RECORDS as Y, RecordId as Z, DefinitionDigestInput as _, SubmissionSettledRecord as _t, CURRENT_CANONICAL_SCHEMA_VERSION as a, RunDurationExhausted as at, Digest as b, ToolApprovalDecided as bt, CanonicalBatch as c, RunPosition as ct, CanonicalRecordPayload as d, SettlementOutcome as dt, RepairAnnotated as et, CanonicalSequence as f, SubagentJoined as ft, DeclaredToolCall as g, SubmissionSettled as gt, ContinuationAccounting as h, SubagentStarted as ht, BatchId as i, RunContinuation as it, MAX_RUN_RECOVERY_SUFFIX_BYTES as j, WorkerAdmission as jt, MAX_RUN_EVIDENCE_BYTES as k, UserInputRecorded as kt, CanonicalRecord as l, RunStartedRecord as lt, ContextEvidenceReference as m, SubagentRequested as mt, AgentUpdateEmitted as n, RunCompleted as nt, CURRENT_RECORD_FORMAT as o, RunFailed as ot, CompactionCreated as p, SubagentLineageRecorded as pt, PromptRecordPayload as q, ApprovalDecision as r, RunContextRecorded as rt, CURRENT_RECORD_VERSION as s, RunPolicyUsageReserved as st, AbortRequested as t, ReplayContract as tt, CanonicalRecordEnvelope as u, SettlementFailureDiagnostic as ut, DefinitionDigests as v, SubtreeBudgetReserved as vt, MAX_PERSISTED_JSON_BYTES as w, ToolCallSettled as wt, EvidenceReference as x, ToolApprovalRequested as xt, DeploymentId as y, ThreadCreated as yt, ModelResponseRecorded as z, WorkerReportRefused as zt };
1135
+ export { Records_exports as $, MAX_RUN_EVIDENCE_RECORDS as A, WorkHandoffCompleted as At, ObservationOffset as B, WorkerReportingIntent as Bt, MAX_CANONICAL_RECORD_BYTES as C, ToolCallResolved as Ct, MAX_PERSISTED_JSON_NODES as D, ToolStepSettled as Dt, MAX_PERSISTED_JSON_DEPTH as E, ToolOperation as Et, MAX_TURN_CANONICAL_BYTES as F, WorkerInputRequested as Ft, PromptRecord as G, PeerMessagePrepared as H, HistoryMessage as Ht, ModelCallAborted as I, WorkerOrigin as It, RUN_TERMINAL_RESERVE_BYTES as J, PromptRecordEnvelope as K, ModelCompleted as L, WorkerOriginRecorded as Lt, MAX_RUN_RECOVERY_SUFFIX_RECORDS as M, WorkerContinuation as Mt, MAX_RUN_TERMINAL_BYTES as N, WorkerInputCompleted as Nt, MAX_RUN_CONTINUATION_BYTES as O, ToolUnavailable as Ot, MAX_RUN_TOOL_CALL_IDENTITIES as P, WorkerInputRefused as Pt, RecordJson as Q, ModelResponseInterrupted as R, WorkerReportPrepared as Rt, KnownRecordPayload as S, ToolCallResolution as St, MAX_PERSISTED_JSON_COLLECTION_LENGTH as T, ToolCallUnknown as Tt, PersistedJson as U, restoreHistoryMessage as Ut, PROMPT_EVIDENCE_TAGS as V, WorkerStopRequested as Vt, ProducerId as W, RecordEnvelope as X, RUN_TERMINAL_RESERVE_RECORDS as Y, RecordId as Z, DefinitionDigestInput as _, SubmissionSettledRecord as _t, CURRENT_CANONICAL_SCHEMA_VERSION as a, RunDurationExhausted as at, Digest as b, ToolApprovalDecided as bt, CanonicalBatch as c, RunPosition as ct, CanonicalRecordPayload as d, SettlementOutcome as dt, RepairAnnotated as et, CanonicalSequence as f, SubagentJoined as ft, DeclaredToolCall as g, SubmissionSettled as gt, ContinuationAccounting as h, SubagentStarted as ht, BatchId as i, RunContinuation as it, MAX_RUN_RECOVERY_SUFFIX_BYTES as j, WorkerAdmission as jt, MAX_RUN_EVIDENCE_BYTES as k, UserInputRecorded as kt, CanonicalRecord as l, RunStartedRecord as lt, ContextEvidenceReference as m, SubagentRequested as mt, AgentUpdateEmitted as n, RunCompleted as nt, CURRENT_RECORD_FORMAT as o, RunFailed as ot, CompactionCreated as p, SubagentLineageRecorded as pt, PromptRecordPayload as q, ApprovalDecision as r, RunContextRecorded as rt, CURRENT_RECORD_VERSION as s, RunPolicyUsageReserved as st, AbortRequested as t, ReplayContract as tt, CanonicalRecordEnvelope as u, SettlementFailureDiagnostic as ut, DefinitionDigests as v, SubtreeBudgetReserved as vt, MAX_PERSISTED_JSON_BYTES as w, ToolCallSettled as wt, EvidenceReference as x, ToolApprovalRequested as xt, DeploymentId as y, ThreadCreated as yt, ModelResponseRecorded as z, WorkerReportRefused as zt };
1132
1136
 
1133
- //# sourceMappingURL=Records-CZRedCE7.mjs.map
1137
+ //# sourceMappingURL=Records-bbGVHprv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Records-bbGVHprv.mjs","names":[],"sources":["../src/durable/internal/history-prompt.ts","../src/durable/Records.ts"],"sourcesContent":["import { Effect, Schema, SchemaParser, SchemaTransformation } from \"effect\";\nimport { Prompt } from \"effect/ai\";\n\nfunction restorePart(part: Prompt.UserMessagePartEncoded): Prompt.UserMessagePart;\nfunction restorePart(part: Prompt.AssistantMessagePartEncoded): Prompt.AssistantMessagePart;\nfunction restorePart(part: Prompt.ToolMessagePartEncoded): Prompt.ToolMessagePart;\nfunction restorePart(part: Prompt.PartEncoded): Prompt.Part {\n switch (part.type) {\n case \"text\":\n return Prompt.textPart(part);\n case \"reasoning\":\n return Prompt.reasoningPart(part);\n case \"file\":\n return Prompt.filePart(part);\n case \"tool-call\":\n return Prompt.toolCallPart({ ...part, providerExecuted: part.providerExecuted ?? false });\n case \"tool-result\":\n return Prompt.toolResultPart({ ...part, providerExecuted: part.providerExecuted ?? false });\n case \"tool-approval-request\":\n return Prompt.toolApprovalRequestPart(part);\n case \"tool-approval-response\":\n return Prompt.toolApprovalResponsePart(part);\n }\n}\n\n// The encoded-message Schema has validated this value; constructors restore brands/defaults.\nexport const restoreHistoryMessage = (message: Prompt.MessageEncoded): Prompt.Message => {\n switch (message.role) {\n case \"system\":\n return Prompt.makeMessage(\"system\", message);\n case \"user\":\n return Prompt.makeMessage(\"user\", {\n ...message,\n content:\n typeof message.content === \"string\"\n ? [Prompt.textPart({ text: message.content })]\n : message.content.map((part) => restorePart(part)),\n });\n case \"assistant\":\n return Prompt.makeMessage(\"assistant\", {\n ...message,\n content:\n typeof message.content === \"string\"\n ? [Prompt.textPart({ text: message.content })]\n : message.content.map((part) => restorePart(part)),\n });\n case \"tool\":\n return Prompt.makeMessage(\"tool\", {\n ...message,\n content: message.content.map((part) => restorePart(part)),\n });\n }\n};\n\n/**\n * Share the upstream encoded-message boundary between canonical history and checkpoint reads.\n * The canonical codec remains authoritative at append, import, recovery and explicit verification.\n */\nexport const HistoryMessage = Schema.toEncoded(Prompt.Message);\n\nexport const HistoryPrompt = Schema.Struct({\n content: Schema.Array(HistoryMessage),\n}).pipe(\n Schema.decodeTo(\n Schema.toType(Prompt.Prompt),\n SchemaTransformation.transformEffect({\n decode: (input) =>\n Effect.succeed(Prompt.fromMessages(input.content.map(restoreHistoryMessage))),\n encode: SchemaParser.encodeEffect(Prompt.Prompt),\n }),\n ),\n);\n","import { Option, Schema, Struct } from \"effect\";\nimport { Prompt } from \"effect/ai\";\n\nimport { InputMessage } from \"../capabilities/Messaging.ts\";\nimport { PolicyLimit } from \"../core/AgentError.ts\";\nimport { AgentPolicy } from \"../core/AgentPolicy.ts\";\nimport { Update } from \"../core/AgentUpdates.ts\";\nimport * as FailureDiagnostic from \"../core/FailureDiagnostic.ts\";\nimport {\n AgentId,\n ThreadId,\n DelegationId,\n ReceiptId,\n RunId,\n SettlementId,\n SubmissionId,\n ToolCallId,\n TurnId,\n} from \"../core/Identifiers.ts\";\nimport { utf8ByteLength } from \"../core/internal/utf8.ts\";\nimport { IdempotencyKey, Principal, Receipt } from \"../core/Receipt.ts\";\nimport { ExhaustedLimit } from \"../core/RunEvent.ts\";\nimport { RunPolicyUsage } from \"../core/RunPolicyUsage.ts\";\nimport {\n DelegationDepth,\n SubagentBudgetReservation,\n SubagentGrant,\n SubagentParentLink,\n ToolExecutionKind,\n} from \"../core/SubagentContract.ts\";\nimport { Selection, Snapshot } from \"../core/ToolExposure.ts\";\nimport { ToolParameterRejection } from \"../core/ToolResult.ts\";\nimport { ModelCallUsage, RunUsageSummary, RunTotals } from \"../core/Usage.ts\";\nimport { WorkerBudgetScope, WorkerRef, WorkerSource, WorkerStop } from \"../core/Worker.ts\";\nimport { ContextHandoff } from \"../engine/ContextWindow.ts\";\nimport { HistoryPrompt } from \"./internal/history-prompt.ts\";\n\n/** Stable identity of one canonical record. */\nexport const RecordId = Schema.NonEmptyString.pipe(Schema.brand(\"@effect-agent/thread/RecordId\"));\n\nexport type RecordId = typeof RecordId.Type;\n\n/** Stable idempotency identity of one atomic append. */\nexport const BatchId = Schema.NonEmptyString.pipe(Schema.brand(\"@effect-agent/thread/BatchId\"));\n\nexport type BatchId = typeof BatchId.Type;\n\n/** Identity of the deployment that produced a record. */\nexport const DeploymentId = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/thread/DeploymentId\"),\n);\n\nexport type DeploymentId = typeof DeploymentId.Type;\n\n/** Identity of a canonical-log producer. */\nexport const ProducerId = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/thread/ProducerId\"),\n);\n\nexport type ProducerId = typeof ProducerId.Type;\n\n/** SHA-256 digest encoded as lowercase hexadecimal text. */\nexport const Digest = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)).pipe(\n Schema.brand(\"@effect-agent/thread/Digest\"),\n);\n\nexport type Digest = typeof Digest.Type;\n\n/** Adapter-owned resume cursor. Callers must not parse or synthesize it. */\nexport const ObservationOffset = Schema.NonEmptyString.pipe(\n Schema.brand(\"@effect-agent/thread/ObservationOffset\"),\n);\n\nexport type ObservationOffset = typeof ObservationOffset.Type;\n\n/** Gap-free position in one Thread's canonical sequence. */\nexport const CanonicalSequence = Schema.Natural.pipe(\n Schema.brand(\"@effect-agent/thread/CanonicalSequence\"),\n);\n\nexport type CanonicalSequence = typeof CanonicalSequence.Type;\n\nconst BoundedText = Schema.String.check(Schema.isMaxLength(64 * 1024));\nconst BoundedName = Schema.NonEmptyString.check(Schema.isMaxLength(256));\n\n/**\n * Private failed-Settlement evidence. The summary remains the safe public projection; diagnostic\n * and context preserve structured causal evidence for authorized operators, never model context.\n * Optional fields allow reading supported Settlements written before causal capture was available.\n */\nexport const SettlementFailureDiagnostic = FailureDiagnostic.Failure.pipe(\n Schema.annotate({\n identifier: \"@effect-agent/thread/SettlementFailureDiagnostic\",\n }),\n);\n\nexport type SettlementFailureDiagnostic = typeof SettlementFailureDiagnostic.Type;\n\n/** Positive canonical (Run-relative, Attempt-independent) Turn number. */\nconst TurnNumber = Schema.Int.check(Schema.isGreaterThan(0));\n\nexport const MAX_PERSISTED_JSON_DEPTH = 64;\nexport const MAX_PERSISTED_JSON_COLLECTION_LENGTH = 4_096;\nexport const MAX_PERSISTED_JSON_NODES = 65_536;\nexport const MAX_PERSISTED_JSON_BYTES = 1024 * 1024;\n/** Whole record wire includes bounded payloads and their canonical envelope. */\nexport const MAX_CANONICAL_RECORD_BYTES = 4 * 1024 * 1024;\n\n/**\n * Iteratively preflights an unknown value before Schema's recursive JSON validation. This is the\n * one narrow `Schema.declare` exception in the persistence model: Effect v4's `Unknown.decodeTo`\n * preserves `unknown` as the encoded type, which would leak through every nested record codec.\n * Schema.Json still owns the accepted value shape after this resource preflight succeeds.\n */\nconst isJson = Schema.is(Schema.Json);\n// No Unicode flag: match surrogate code units so astral characters take the UTF-8 path too.\nconst nonAscii = /[\\u0080-\\uFFFF]/;\n\nconst boundedJson =\n (limits: { readonly depth: number; readonly nodes: number; readonly bytes: number }) =>\n (input: unknown): input is Schema.Json => {\n const pending: Array<\n | { readonly _tag: \"visit\"; readonly value: unknown; readonly depth: number }\n | { readonly _tag: \"leave\"; readonly value: object }\n > = [{ _tag: \"visit\", value: input, depth: 0 }];\n\n // Only ancestors indicate a cycle. Shared acyclic values serialize once per occurrence,\n // so revisit them and charge every occurrence against the same resource limits.\n const ancestors = new WeakSet<object>();\n let nodes = 0;\n let textUnits = 0;\n\n try {\n while (pending.length > 0) {\n const current = pending.pop();\n\n if (current === undefined) return false;\n if (current._tag === \"leave\") {\n ancestors.delete(current.value);\n continue;\n }\n if (current.depth > limits.depth || ++nodes > limits.nodes) {\n return false;\n }\n\n const value = current.value;\n\n if (value === null || typeof value === \"boolean\") continue;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) return false;\n continue;\n }\n if (typeof value === \"string\") {\n textUnits += value.length;\n if (textUnits > limits.bytes) return false;\n continue;\n }\n if (typeof value !== \"object\" || ancestors.has(value)) return false;\n ancestors.add(value);\n pending.push({ _tag: \"leave\", value });\n\n const entries = Array.isArray(value)\n ? Array.from(value, (entry, index) => [index, entry] as const)\n : Object.entries(value);\n\n if (entries.length > MAX_PERSISTED_JSON_COLLECTION_LENGTH) return false;\n for (const [key, entry] of entries) {\n textUnits += typeof key === \"string\" ? key.length : 0;\n if (textUnits > limits.bytes) return false;\n pending.push({ _tag: \"visit\", value: entry, depth: current.depth + 1 });\n }\n }\n\n if (!isJson(input)) return false;\n const encoded = JSON.stringify(input);\n\n // Escaping is already reflected in the serialized text. UTF-8 uses one to three bytes per\n // UTF-16 code unit; ASCII uses exactly one. Only ambiguous Unicode needs the exact count.\n return (\n encoded !== undefined &&\n encoded.length <= limits.bytes &&\n (encoded.length <= limits.bytes / 3 ||\n !nonAscii.test(encoded) ||\n utf8ByteLength(encoded) <= limits.bytes)\n );\n } catch {\n return false;\n }\n };\n\nconst isPersistedJson = boundedJson({\n depth: MAX_PERSISTED_JSON_DEPTH,\n nodes: MAX_PERSISTED_JSON_NODES,\n bytes: MAX_PERSISTED_JSON_BYTES,\n});\n\n/** Canonical JSON admitted to persisted records and checkpoints under explicit resource limits. */\nexport const PersistedJson = Schema.declare(isPersistedJson, {\n identifier: \"@effect-agent/thread/PersistedJson\",\n description: \"JSON bounded by canonical persistence depth, collection, node, and byte limits\",\n});\n\nexport type PersistedJson = typeof PersistedJson.Type;\n\n/** Whole record wire reserves room for the payload's envelope and additional bounded fields. */\nexport const RecordJson = Schema.declare(\n boundedJson({\n depth: MAX_PERSISTED_JSON_DEPTH + 4,\n nodes: MAX_PERSISTED_JSON_NODES * 4,\n bytes: MAX_CANONICAL_RECORD_BYTES,\n }),\n {\n identifier: \"@effect-agent/thread/RecordJson\",\n description: \"Canonical record JSON bounded by depth, collection, node, and 4 MiB byte limits\",\n },\n);\n\nexport type RecordJson = typeof RecordJson.Type;\n\n/** Schema-owned replay inputs whose individual definitions are incorporated into digests. */\nexport class DefinitionDigestInput extends Schema.Class<DefinitionDigestInput>(\n \"@effect-agent/thread/DefinitionDigestInput\",\n)({\n agent: PersistedJson,\n model: PersistedJson,\n tools: PersistedJson,\n}) {}\n\n/** Admission-time operation fingerprints. Agent fingerprints remain immutable evidence only. */\nexport class ReplayContract extends Schema.Class<ReplayContract>(\n \"@effect-agent/thread/ReplayContract\",\n)({\n agent: Digest,\n /** Retained for reading earlier admissions; never selects executable code. */\n agentBehavior: Schema.optionalKey(Digest),\n tools: Schema.Record(Schema.String, Digest),\n}) {}\n\n/** Digests identify admission exactly; only an unfinished operation needs replay compatibility. */\nexport class DefinitionDigests extends Schema.Class<DefinitionDigests>(\n \"@effect-agent/thread/DefinitionDigests\",\n)({\n agent: Digest,\n model: Digest,\n tools: Digest,\n replay: Schema.optionalKey(ReplayContract),\n}) {}\n\nexport class ThreadCreated extends Schema.TaggedClass<ThreadCreated>(\n \"@effect-agent/thread/ThreadCreated\",\n)(\"ThreadCreated\", {\n agentId: AgentId,\n definitions: DefinitionDigests,\n}) {}\n\n/**\n * One recorded Thread input. `submissionId` is present only for durably accepted work;\n * retained history has no admission or settlement obligation. `kind` identifies the input seam.\n */\nexport class UserInputRecorded extends Schema.TaggedClass<UserInputRecorded>(\n \"@effect-agent/thread/UserInputRecorded\",\n)(\"UserInputRecorded\", {\n submissionId: Schema.optionalKey(SubmissionId),\n kind: Schema.Literals([\"user\", \"steering\", \"follow-up\"]),\n runId: Schema.optionalKey(RunId),\n input: PersistedJson,\n messageAdmission: Schema.optionalKey(InputMessage),\n}) {}\n\n/** Immutable Run start and per-Attempt duration allowance, before any agent execution. */\nexport class RunStartedRecord extends Schema.TaggedClass<RunStartedRecord>(\n \"@effect-agent/thread/RunStartedRecord\",\n)(\"RunStarted\", {\n runId: RunId,\n /** Older private histories cannot prove programmatic accounting and must be reset. */\n policyAccountingVersion: Schema.Literal(1),\n maxDurationMillis: Schema.Finite.check(Schema.isGreaterThan(0)),\n}) {}\n\n/** An active Attempt exhausted its execution allowance; downtime alone never writes this. */\nexport class RunDurationExhausted extends Schema.TaggedClass<RunDurationExhausted>(\n \"@effect-agent/thread/RunDurationExhausted\",\n)(\"RunDurationExhausted\", { runId: RunId }) {}\n\nconst PersistedPromptMessages = Schema.toEncoded(Prompt.Prompt);\nconst isPersistedPromptMessages = Schema.is(PersistedPromptMessages);\n\n// Carry the native Prompt proof while preserving the existing JSON wire identity.\nconst PersistedResponseMessages = PersistedJson.pipe(\n Schema.refine(\n (input): input is Schema.Json & Prompt.PromptEncoded => isPersistedPromptMessages(input),\n {\n identifier: \"@effect-agent/thread/PersistedJson\",\n expected: \"persisted Effect AI Prompt messages\",\n },\n ),\n);\n\n/**\n * Final model output. Immediate history records the successful Run's source messages for\n * recall and a full retained model-context snapshot for the next Run. Durable execution\n * instead journals individual ModelResponseRecorded Turns and exact context references.\n */\nexport class ModelCompleted extends Schema.TaggedClass<ModelCompleted>(\n \"@effect-agent/thread/ModelCompleted\",\n)(\n \"ModelCompleted\",\n Schema.Struct({\n runId: RunId,\n output: PersistedJson,\n messages: Schema.optionalKey(PersistedJson),\n history: Schema.optionalKey(PersistedJson),\n }).check(\n Schema.makeFilter(\n (record) =>\n (record.messages === undefined && record.history === undefined) ||\n (record.messages !== undefined &&\n record.history !== undefined &&\n isPersistedPromptMessages(record.messages) &&\n isPersistedPromptMessages(record.history)),\n { title: \"Retained source messages and model context are paired encoded Effect AI Prompts\" },\n ),\n ),\n) {}\n\nexport class ToolCallSettled extends Schema.TaggedClass<ToolCallSettled>(\n \"@effect-agent/thread/ToolCallSettled\",\n)(\"ToolCallSettled\", {\n toolSelection: Schema.optionalKey(Selection),\n runId: RunId,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n result: PersistedJson,\n isFailure: Schema.Boolean,\n /** Explicit engine evidence, never inferred from Tool result data. */\n budgetRejected: Schema.optionalKey(Schema.Literal(true)),\n}) {}\n\n/** Compact execution evidence committed with a declaration, before any handler can start. */\nexport class ToolOperation extends Schema.Class<ToolOperation>(\n \"@effect-agent/thread/ToolOperation\",\n)({\n toolCallId: ToolCallId,\n toolName: BoundedName,\n executionClass: Schema.Literals([\"readonly\", \"idempotent\", \"uncertain\"]),\n executionKind: ToolExecutionKind,\n replay: Digest,\n}) {}\n\n/** Derived recovery input from one committed response; never a separate canonical record. */\nexport class DeclaredToolCall extends Schema.Class<DeclaredToolCall>(\n \"@effect-agent/thread/DeclaredToolCall\",\n)({\n ...ToolOperation.fields,\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n parameters: PersistedJson,\n parametersDigest: Digest,\n}) {}\n\n/** A retired call's runtime result. Unavailable readonly work may already have been observed. */\nexport class ToolUnavailable extends Schema.TaggedClass<ToolUnavailable>()(\"ToolUnavailable\", {\n toolName: BoundedName,\n execution: Schema.Literals([\"not-executed\", \"unavailable\"]),\n message: BoundedText,\n}) {}\n\n/**\n * One committed model Turn. `messages` carries the Schema-encoded Effect AI Prompt messages this\n * Turn appended (assistant response plus any tool-call declarations), committed atomically at the\n * Turn boundary so a recovering Attempt can rebuild the next Prompt from canonical records alone.\n */\nconst ModelResponseRecordedFields = Schema.Struct({\n /** Original bound for each application result; replacement Bindings cannot enlarge it. */\n toolResultMaxBytes: Schema.Int.check(\n Schema.isBetween({ minimum: 256, maximum: MAX_PERSISTED_JSON_BYTES }),\n ),\n /** Maximum encoded selection metadata from the native catalog at declaration time. */\n toolSelectionMaxBytes: Schema.Natural.check(\n Schema.isLessThanOrEqualTo(MAX_CANONICAL_RECORD_BYTES),\n ),\n /** Exactly one entry per application call, including rejected calls; none for provider execution. */\n toolOperations: Schema.Array(ToolOperation),\n /** Explicit pre-execution failures, committed with the original arguments before any approval. */\n toolParameterRejections: Schema.optionalKey(Schema.Array(ToolParameterRejection)),\n toolExposure: Schema.optionalKey(Snapshot),\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n messages: PersistedResponseMessages,\n /**\n * Number of leading messages that belong only to this Run's evaluated instructions and wake\n * input. They remain canonical. An unfinished Run retains this exact evaluated prefix;\n * subsequent Runs retain its original user intent in conversation history.\n */\n runScopedPrefixLength: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n /**\n * Exact normalized usage for every model call staged into this Turn. A\n * summarizer and the Turn response are distinct entries. Unmetered responses can omit it.\n */\n modelUsage: Schema.optionalKey(Schema.Array(ModelCallUsage)),\n /** Observed invocations without retained accounting before this Turn committed. */\n unobservedModelCalls: Schema.optionalKey(Schema.Natural),\n /** Aggregate observed usage when per-call accounting is unavailable. */\n inputTokens: Schema.optionalKey(Schema.Natural),\n outputTokens: Schema.optionalKey(Schema.Natural),\n /** Estimated spend staged with the usage; recovery re-seeds the cost budget (RUN-023). */\n costMicrousd: Schema.optionalKey(Schema.Natural),\n}).check(\n Schema.makeFilter(\n (response) => {\n const declarations = response.messages.content.flatMap((message) =>\n message.role === \"assistant\" && typeof message.content !== \"string\"\n ? message.content.filter(\n (part) => part.type === \"tool-call\" && part.providerExecuted !== true,\n )\n : [],\n );\n\n if (declarations.length !== response.toolOperations.length) return false;\n const seen = new Set<string>();\n\n for (const operation of response.toolOperations) {\n if (\n seen.has(operation.toolCallId) ||\n !declarations.some(\n (call) =>\n call.type === \"tool-call\" &&\n call.id === operation.toolCallId &&\n call.name === operation.toolName,\n )\n )\n return false;\n seen.add(operation.toolCallId);\n }\n\n // Equal counts and unique matching operation IDs already cover every declaration.\n return (\n response.runScopedPrefixLength === undefined ||\n (response.runScopedPrefixLength < response.messages.content.length &&\n response.messages.content\n .slice(0, response.runScopedPrefixLength)\n .every((message) => message.role === \"system\" || message.role === \"user\"))\n );\n },\n {\n title:\n \"Model response has unique original Tool operation evidence and a valid instruction/wake prefix\",\n },\n ),\n);\n\nexport class ModelResponseRecorded extends Schema.TaggedClass<ModelResponseRecorded>(\n \"@effect-agent/thread/ModelResponseRecorded\",\n)(\"ModelResponseRecorded\", ModelResponseRecordedFields) {}\n\n/** Monotonic reservations charged before programmatic execution or grace finalization. */\nexport class RunPolicyUsageReserved extends Schema.TaggedClass<RunPolicyUsageReserved>()(\n \"RunPolicyUsageReserved\",\n {\n runId: RunId,\n programmaticToolCalls: RunPolicyUsage.fields.programmaticToolCalls,\n finalizationUsed: RunPolicyUsage.fields.finalizationUsed,\n },\n) {}\n\n/**\n * A durable Unknown Outcome: the external effect of one declared ordinary Tool Call may have\n * happened but was not confirmed canonically (DUR-009/DUR-017). It is neither success nor\n * ordinary failure; automatic continuation stops until an authorized resolution arrives.\n */\nexport class ToolCallUnknown extends Schema.TaggedClass<ToolCallUnknown>(\n \"@effect-agent/thread/ToolCallUnknown\",\n)(\"ToolCallUnknown\", {\n runId: RunId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n reason: BoundedText,\n}) {}\n\n/** How one open/unknown Tool Call was authoritatively closed (DUR-017 resolution audit). */\nexport const ToolCallResolution = Schema.Literals([\n \"completed-with-result\",\n \"failed-with-error\",\n \"never-started\",\n \"safe-retry\",\n]);\n\nexport type ToolCallResolution = typeof ToolCallResolution.Type;\n\n/**\n * The canonical audit record closing one open or unknown Tool Call: reconciler-recovered supplier\n * truth or an authorized `resolveUnknown` command. `author`/`reason` make every resolution an\n * attributable decision (DUR-017); a `completed-with-result` resolution is accompanied by the\n * per-call `ToolCallSettled` record carrying the recovered result.\n */\nexport class ToolCallResolved extends Schema.TaggedClass<ToolCallResolved>(\n \"@effect-agent/thread/ToolCallResolved\",\n)(\"ToolCallResolved\", {\n runId: RunId,\n toolCallId: ToolCallId,\n resolution: ToolCallResolution,\n author: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * One accepted Durable Step result (durability §11): exactly-once-recorded while the Step's\n * external side effect stays honestly at-least-once-executed. Only success is recorded — a failing\n * Step body fails into the handler's error channel and re-executes on re-entry. `output` is the\n * Schema-encoded Step output; `outputDigest` pins it for replay-divergence detection.\n */\nexport class ToolStepSettled extends Schema.TaggedClass<ToolStepSettled>(\n \"@effect-agent/thread/ToolStepSettled\",\n)(\"ToolStepSettled\", {\n runId: RunId,\n toolCallId: ToolCallId,\n stepName: BoundedName,\n output: PersistedJson,\n outputDigest: Digest,\n}) {}\n\n/**\n * A canonical approval request for one declared Tool Call (CAP-006, durability §8): with this\n * record durable, \"waiting for explicit approval\" is a safe suspension boundary — the resumed\n * Attempt replays the declared batch instead of re-invoking the model.\n */\nexport class ToolApprovalRequested extends Schema.TaggedClass<ToolApprovalRequested>(\n \"@effect-agent/thread/ToolApprovalRequested\",\n)(\"ToolApprovalRequested\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n parametersDigest: Digest,\n /** This request preceded every possible dispatch of the original response. */\n blocksInitialDispatch: Schema.Boolean,\n}) {}\n\n/** The two-valued approval decision family shared by canonical records and ledger intents. */\nexport const ApprovalDecision = Schema.Literals([\"approved\", \"denied\"]);\n\nexport type ApprovalDecision = typeof ApprovalDecision.Type;\n\n/**\n * The canonical decision for one requested approval. Appended by the deciding Attempt (policy\n * auto-decisions) or by the resuming Attempt after a durable `resolveApproval` intent; it is the\n * deterministic decision authority for every later Attempt of the same Run.\n */\nexport class ToolApprovalDecided extends Schema.TaggedClass<ToolApprovalDecided>(\n \"@effect-agent/thread/ToolApprovalDecided\",\n)(\"ToolApprovalDecided\", {\n runId: RunId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n decision: ApprovalDecision,\n resolver: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * A Run resumed inference without a retained response. One marker makes usage coverage\n * incomplete; it does not count missing provider calls or retain Attempt history.\n */\nexport class ModelResponseInterrupted extends Schema.TaggedClass<ModelResponseInterrupted>(\n \"@effect-agent/thread/ModelResponseInterrupted\",\n)(\"ModelResponseInterrupted\", {\n runId: RunId,\n}) {}\n\n/** Disposable call cancellation: no response or Tool declaration is canonical. */\nexport class ModelCallAborted extends Schema.TaggedClass<ModelCallAborted>()(\"ModelCallAborted\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n restart: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 2 })),\n reason: Schema.Literal(\"joined-input\"),\n modelUsage: Schema.Array(ModelCallUsage),\n unobservedModelCalls: Schema.Natural,\n}) {}\n\n/**\n * One engine-native compaction committed before the pre-Turn view changes (RUN-026).\n * `coversThrough` is a Thread record sequence: the projection\n * renders records at or below it as a summary (`summarize`), a fresh window (`rollover`), or with\n * cleared tool results (kind `clear-tool-results`), never erasing source\n * history. The record carries no digest by decision: it is appended by the\n * fenced owner into the very log it covers, and re-verifying a digest would\n * re-read the covered range on every wake — the O(history) work compaction\n * exists to remove. Host-supplied ContextCompactor decisions use this same commit path.\n * Summaries exceeding BoundedText are rejected before append, never truncated.\n * `summary` is present exactly for `summarize` records; the projection\n * treats a summarize record without one as invalid and ignores it fail-safe.\n */\nexport class CompactionCreated extends Schema.TaggedClass<CompactionCreated>(\n \"@effect-agent/thread/CompactionCreated\",\n)(\"CompactionCreated\", {\n runId: RunId,\n turn: TurnNumber,\n kind: Schema.Literals([\"clear-tool-results\", \"summarize\", \"rollover\"]),\n coversThrough: CanonicalSequence,\n summary: Schema.optionalKey(BoundedText),\n handoff: Schema.optionalKey(ContextHandoff),\n}) {}\n\nexport class RunFailed extends Schema.TaggedClass<RunFailed>(\"@effect-agent/thread/RunFailed\")(\n \"RunFailed\",\n {\n runId: RunId,\n failure: PersistedJson,\n },\n) {}\n\nconst RunCompletedFields = Schema.Struct({\n runId: RunId,\n output: PersistedJson,\n /** Integrity of validated terminal values, independent of future application codecs. */\n /** Application disposition captured with an ordinary completion. */\n runDisposition: Schema.optionalKey(PersistedJson),\n /** Honest soft-landing marker, present exactly when `exhausted` is present. */\n finishReason: Schema.optionalKey(Schema.Literal(\"budget-exhausted\")),\n /** Budget dimension paired with `finishReason` on a soft landing. */\n exhausted: Schema.optionalKey(ExhaustedLimit),\n}).check(\n Schema.makeFilter(\n (completed) =>\n (completed.finishReason === undefined) === (completed.exhausted === undefined) &&\n (completed.runDisposition === undefined || completed.finishReason === undefined),\n { title: \"Run completion metadata matches its terminal family\" },\n ),\n);\n\nexport class RunCompleted extends Schema.TaggedClass<RunCompleted>(\n \"@effect-agent/thread/RunCompleted\",\n)(\"RunCompleted\", RunCompletedFields) {}\n\nexport class RepairAnnotated extends Schema.TaggedClass<RepairAnnotated>(\n \"@effect-agent/thread/RepairAnnotated\",\n)(\"RepairAnnotated\", {\n reason: BoundedText,\n details: PersistedJson,\n}) {}\n\n/** Terminal outcome family for one accepted Submission (DUR-002). */\nexport const SettlementOutcome = Schema.Literals([\"completed\", \"failed\", \"aborted\"]);\n\nexport type SettlementOutcome = typeof SettlementOutcome.Type;\n\n/**\n * A durable abort command made canonical before the active worker is interrupted (DUR-012).\n * Repeating the same abort command is idempotent; abort never rewrites a prior terminal outcome.\n */\nexport class AbortRequested extends Schema.TaggedClass<AbortRequested>(\n \"@effect-agent/thread/AbortRequested\",\n)(\"AbortRequested\", {\n submissionId: SubmissionId,\n author: BoundedName,\n reason: BoundedText,\n}) {}\n\n/**\n * The single canonical settlement record owed to one accepted Submission (DUR-002, DUR-011).\n * Canonical history is the outcome authority: the ledger row is finalized from this record and\n * never the other way around (DUR-015).\n */\nconst RawSubmissionSettled = Schema.Struct({\n submissionId: SubmissionId,\n settlementId: SettlementId,\n receiptId: ReceiptId,\n outcome: SettlementOutcome,\n runId: Schema.optionalKey(RunId),\n /** Number of retained owning facts through this terminal commit, excluding mutable progress. */\n historyRecordCount: Schema.optionalKey(Schema.Natural),\n result: Schema.optionalKey(PersistedJson),\n /**\n * Application-defined, Schema-encoded disposition for an ordinary completed\n * Run. Absent for budget exhaustion and every non-completed or run-less\n * settlement; consumers decode it with the application definition's Schema.\n */\n runDisposition: Schema.optionalKey(PersistedJson),\n /**\n * Present only when a `completed` Run settled through the final-answer\n * exhaustion resolution (RUN-011, RUN-018): the durable log must be able to\n * distinguish honest-exhaustion completion from ordinary completion without\n * the live event stream. Absent for every ordinary settlement, keeping\n * existing histories and goldens byte-stable (additive, schemaVersion 1).\n */\n finishReason: Schema.optionalKey(Schema.Literal(\"budget-exhausted\")),\n /**\n * The dimension that bound a budget-exhausted completion (RUN-011,\n * RUN-025), carried verbatim from the live `RunCompleted` event so\n * consumers never reconstruct it from message text. Valid only alongside\n * `finishReason: \"budget-exhausted\"`; absent on histories persisted before\n * the dimension became durable (additive, schemaVersion 1).\n */\n exhausted: Schema.optionalKey(ExhaustedLimit),\n /**\n * The typed `AgentPolicyError.limit` of a `failed` hard-rail settlement\n * (RUN-011): which finite policy dimension failed the Run, preserved\n * alongside the bounded `{errorTag, message}` failure projection in\n * `result`. Absent for every non-policy failure and on histories persisted\n * before the limit became durable (additive, schemaVersion 1).\n */\n policyLimit: Schema.optionalKey(PolicyLimit),\n /** Canonical aggregate of all priced model calls made by this Run. */\n usageSummary: Schema.optionalKey(RunUsageSummary),\n /** Calls included in usageSummary but not in any ModelResponseRecorded, retained on failure. */\n uncommittedModelUsage: Schema.optionalKey(Schema.Array(ModelCallUsage)),\n});\n\nconst isPolicyFailureProjection = Schema.is(\n Schema.Struct({ errorTag: Schema.Literal(\"AgentPolicyError\") }),\n);\n\nconst decodeSettlementFailureDiagnostic = Schema.decodeUnknownOption(SettlementFailureDiagnostic, {\n onExcessProperty: \"error\",\n});\n\nconst hasValidSettlementFamily = (settled: typeof RawSubmissionSettled.Type): boolean =>\n (settled.finishReason === undefined || settled.outcome === \"completed\") &&\n (settled.finishReason === undefined) === (settled.exhausted === undefined) &&\n (settled.usageSummary === undefined || settled.runId !== undefined) &&\n (settled.uncommittedModelUsage === undefined ||\n (settled.runId !== undefined && settled.usageSummary !== undefined)) &&\n (settled.runDisposition === undefined ||\n (settled.outcome === \"completed\" &&\n settled.finishReason === undefined &&\n settled.runId !== undefined &&\n settled.result !== undefined)) &&\n (settled.outcome !== \"failed\" ||\n Option.isSome(decodeSettlementFailureDiagnostic(settled.result))) &&\n (settled.outcome !== \"aborted\" || settled.result === undefined) &&\n (settled.policyLimit === undefined ||\n (settled.outcome === \"failed\" && isPolicyFailureProjection(settled.result)));\n\nconst SubmissionSettledFields = RawSubmissionSettled.check(\n Schema.makeFilter(hasValidSettlementFamily, {\n title:\n \"failed settlements require a bounded diagnostic; aborted settlements carry no result; budget metadata must match its settlement family\",\n }),\n);\n\nexport class SubmissionSettled extends Schema.TaggedClass<SubmissionSettled>(\n \"@effect-agent/thread/SubmissionSettled\",\n)(\"SubmissionSettled\", SubmissionSettledFields) {}\n\n/** Canonical completed settlement; joined completion may legitimately carry no independent result. */\nexport type CompletedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"completed\";\n};\n\n/** Canonical failed settlement; its bounded diagnostic is required and typed. */\nexport type FailedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"failed\";\n readonly result: SettlementFailureDiagnostic;\n};\n\n/** Canonical aborted settlement; abort records intent rather than fabricating a terminal result. */\nexport type AbortedSubmissionSettled = SubmissionSettled & {\n readonly outcome: \"aborted\";\n readonly result?: never;\n};\n\nexport type SubmissionSettledRecord =\n | CompletedSubmissionSettled\n | FailedSubmissionSettled\n | AbortedSubmissionSettled;\n\n/**\n * Canonical-boundary view of `SubmissionSettled`: `finishReason` is valid\n * only on a `completed` outcome, `exhausted` only alongside\n * `finishReason: \"budget-exhausted\"`, every `failed` outcome requires the exact bounded\n * `SettlementFailureDiagnostic`, aborted outcomes carry no result, and `policyLimit` only occurs\n * on a `failed` outcome whose diagnostic carries the `AgentPolicyError` tag. `runDisposition`\n * occurs only on an ordinary completed settlement with a Run —\n * so a malformed persisted combination such as\n * `{ outcome: \"failed\", finishReason: \"budget-exhausted\" }` or a\n * `policyLimit` contradicting `result.errorTag` fails closed at decode\n * instead of becoming trusted audit history (STORE-006, RUN-011).\n */\nexport const SubmissionSettledRecord = SubmissionSettled.pipe(\n Schema.refine(\n (settled): settled is SubmissionSettledRecord => hasValidSettlementFamily(settled),\n {\n expected:\n \"failed settlements require a bounded diagnostic, aborted settlements carry no result, finishReason only occurs on completed settlements, exhausted only occurs with finishReason budget-exhausted, runDisposition only occurs on an ordinary completed settlement with a Run result, and policyLimit only occurs on a failed AgentPolicyError settlement\",\n },\n ),\n);\n\n/**\n * PARENT-log record of one durable child establishment request:\n * the exact parent Tool Call, delegation and target identity, the digests that pin the child's\n * Binding/input/grant, the fenced budget reservation, and the INTENDED child identity derived\n * deterministically from the parent Run and Tool Call pair (D4). `childInput` carries the\n * prepared child input in encoded form (D3) so recovery can complete child admission from this\n * record alone — no live delegation handler is required. `childPrincipal`/`childIdempotencyKey`\n * carry the ledger admission scope with the ledger's exact bounds; the layering keeps their\n * branded Schemas in the ledger port.\n */\nexport class SubagentRequested extends Schema.TaggedClass<SubagentRequested>(\n \"@effect-agent/thread/SubagentRequested\",\n)(\"SubagentRequested\", {\n runId: RunId,\n turnId: TurnId,\n turn: TurnNumber,\n toolCallId: ToolCallId,\n delegationId: DelegationId,\n targetAgentId: AgentId,\n targetDigests: DefinitionDigests,\n childInput: PersistedJson,\n childInputDigest: Digest,\n grantDigest: Digest,\n reservationId: BoundedName,\n reservationDigest: Digest,\n childThreadId: ThreadId,\n childPrincipal: BoundedName,\n childIdempotencyKey: BoundedName,\n /** Effective invocation bound, already clamped to the delegation and child Definition. */\n toolCallAllowance: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n policy: Schema.optionalKey(Schema.toCodecJson(AgentPolicy)),\n budget: Schema.optionalKey(SubagentBudgetReservation),\n grant: Schema.optionalKey(SubagentGrant),\n depth: Schema.optionalKey(DelegationDepth),\n}) {}\n\n/**\n * PARENT-log record that the intended child exists as accepted work:\n * the full established child identity. It is appended only after the child Receipt\n * exists — SUB-017 holds by construction because `childReceiptId` is a required field.\n */\nexport class SubagentStarted extends Schema.TaggedClass<SubagentStarted>(\n \"@effect-agent/thread/SubagentStarted\",\n)(\"SubagentStarted\", {\n runId: RunId,\n toolCallId: ToolCallId,\n childThreadId: ThreadId,\n childSubmissionId: SubmissionId,\n childReceiptId: ReceiptId,\n childRunId: RunId,\n}) {}\n\n/**\n * PARENT-log record of one verified child settlement join:\n * the child's canonical Settlement identity and outcome, the child usage summary, and the FINAL\n * consumed/released accounting decision for the reservation. It commits in ONE atomic batch with\n * the parent `ToolCallSettled` record (SUB-019); `beginChildBudgetRelease` replays\n * `finalAccounting` from this record, so canonical history authorizes the release (DUR-015).\n */\nexport class SubagentJoined extends Schema.TaggedClass<SubagentJoined>(\n \"@effect-agent/thread/SubagentJoined\",\n)(\"SubagentJoined\", {\n runId: RunId,\n toolCallId: ToolCallId,\n childSubmissionId: SubmissionId,\n childSettlementId: SettlementId,\n childOutcome: SettlementOutcome,\n usageSummary: PersistedJson,\n usage: Schema.optionalKey(RunTotals),\n delegatedUsage: Schema.optionalKey(RunTotals),\n reservationId: BoundedName,\n finalAccounting: PersistedJson,\n}) {}\n\n/**\n * CHILD-log immutable lineage: the Parent Link plus the digests that pin\n * the child's definition, input, and authority grant. It is the first record after the child's\n * `ThreadCreated` (its own single-record batch, so the generic `thread-created:{cid}`\n * batch identity is never contradicted) and the join path verifies it fail-closed — a fabricated\n * child or parent identity fails Parent Link verification (SUB-004, D10).\n */\nexport class SubagentLineageRecorded extends Schema.TaggedClass<SubagentLineageRecorded>(\n \"@effect-agent/thread/SubagentLineageRecorded\",\n)(\"SubagentLineageRecorded\", {\n parentLink: SubagentParentLink,\n parentSubmissionId: SubmissionId,\n childDefinitionDigests: DefinitionDigests,\n childInputDigest: Digest,\n grantDigest: Digest,\n /** Copied from the canonical request before readiness; restored for every child Attempt. */\n toolCallAllowance: SubagentRequested.fields.toolCallAllowance,\n policy: SubagentRequested.fields.policy,\n budget: SubagentRequested.fields.budget,\n grant: SubagentRequested.fields.grant,\n}) {}\n\nexport const WorkerReportingIntent = Schema.Struct({\n /** Absent only in historical custom-report origins; these remain readable as evidence. */\n mode: Schema.optionalKey(Schema.Literal(\"standard\")),\n sourceDigests: DefinitionDigests,\n /** Historical custom destination evidence. New worker origins never write this field. */\n destinationDelegationId: Schema.optionalKey(DelegationId),\n /** Frozen by the sender before acceptance. Standard emission never reads the source runtime. */\n returnAddress: Schema.optionalKey(\n Schema.Struct({\n input: PersistedJson,\n principal: Principal,\n policy: Schema.toCodecJson(AgentPolicy),\n depth: Schema.Natural,\n grant: Schema.optionalKey(SubagentGrant),\n /** Encoded to bound recursive worker origins at the admission boundary. */\n workerAdmission: Schema.optionalKey(PersistedJson),\n }),\n ),\n}).check(\n Schema.makeFilter((value) => (value.mode === \"standard\") === (value.returnAddress !== undefined)),\n);\n\n/** Exact successful predecessor evidence; a locator alone grants no authority. */\nexport const WorkerContinuation = Schema.Struct({\n worker: WorkerRef,\n receipt: Receipt,\n settlementId: SettlementId,\n}).check(Schema.makeFilter((value) => value.worker.threadId === value.receipt.threadId));\n\nexport type WorkerContinuation = typeof WorkerContinuation.Type;\n\n/** Immutable worker Thread origin. Each input has its own digest and parameters separately. */\nexport const WorkerOrigin = Schema.Struct({\n worker: WorkerRef,\n source: WorkerSource,\n /** A new assignment may continue this completed, immutable predecessor. */\n continuationOf: Schema.optionalKey(WorkerContinuation),\n /** Frozen funding owner; worker-run renews only for a new native Run. */\n budgetScope: WorkerBudgetScope,\n /** Frozen at worker creation; older origins remain reusable. */\n lifecycle: Schema.optionalKey(Schema.Literal(\"assignment\")),\n targetDigests: DefinitionDigests,\n policy: Schema.toCodecJson(AgentPolicy),\n budget: SubagentBudgetReservation,\n grant: SubagentGrant,\n depth: DelegationDepth,\n toolCallAllowance: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThan(0))),\n firstMessageId: IdempotencyKey,\n createdAtMillis: Schema.Natural,\n expiresAtMillis: Schema.Natural,\n /** Exact source registration owns projection; absence means reporting was not declared. */\n reporting: Schema.optionalKey(WorkerReportingIntent),\n}).check(Schema.makeFilter((value) => value.expiresAtMillis > value.createdAtMillis));\n\nexport type WorkerOrigin = typeof WorkerOrigin.Type;\n\n/** Frozen per-input metadata; it grants no attached-child or parent-abort semantics. */\nexport const WorkerAdmission = Schema.Struct({\n origin: WorkerOrigin,\n /** Run executing this handoff, independently of immutable lineage and subtree funding. */\n executionRunId: Schema.NullOr(RunId),\n messageId: IdempotencyKey,\n parameters: PersistedJson,\n createdAtMillis: Schema.Natural,\n /** Host-bound source input whose subtree funds this input; never chosen by a model. */\n sourceSubmissionId: Schema.optionalKey(SubmissionId),\n /** Enables routed receipt lookup when the delivery is owned by a reporting child. */\n deliveryPrincipal: Schema.optionalKey(Principal),\n /** Proven framework updates use a separate bounded input-capacity partition. */\n reportKind: Schema.optionalKey(Schema.Literal(\"update\")),\n});\n\nexport type WorkerAdmission = typeof WorkerAdmission.Type;\n\n/** Owner command retained before the destination inbox is sealed. */\nexport class WorkerStopRequested extends Schema.TaggedClass<WorkerStopRequested>()(\n \"WorkerStopRequested\",\n {\n command: WorkerStop,\n principal: Principal,\n sourceSubmissionId: Schema.optionalKey(SubmissionId),\n },\n) {}\n\n/** The named canonical obligation closed only after its owning state durably completes. */\nexport class WorkHandoffCompleted extends Schema.TaggedClass<WorkHandoffCompleted>()(\n \"WorkHandoffCompleted\",\n { preparationId: RecordId, ownerId: Schema.NonEmptyString.check(Schema.isMaxLength(4096)) },\n) {}\n\n/** Source-log capacity reservation, retained independently of the source Run's settlement. */\nexport class WorkerInputRequested extends Schema.TaggedClass<WorkerInputRequested>()(\n \"WorkerInputRequested\",\n { admission: WorkerAdmission, inputDigest: Digest },\n) {}\n\n/** Child-log origin, reconstructed from a retained delivery before the child becomes ready. */\nexport class WorkerOriginRecorded extends Schema.TaggedClass<WorkerOriginRecorded>()(\n \"WorkerOriginRecorded\",\n { origin: WorkerOrigin },\n) {}\n\n/** Canonical child completion acknowledgement releases only this input's active capacity. */\nexport class WorkerInputCompleted extends Schema.TaggedClass<WorkerInputCompleted>()(\n \"WorkerInputCompleted\",\n {\n messageId: IdempotencyKey,\n workerThreadId: ThreadId,\n submissionId: SubmissionId,\n receiptId: ReceiptId,\n settlementId: SettlementId,\n completedAtMillis: Schema.Natural,\n /** New acknowledgements prove that this input's external effects are resolved. */\n effectsResolved: Schema.optionalKey(Schema.Literal(true)),\n },\n) {}\n\n/**\n * Frozen report decision for one actual Run, shared by every joined Receipt. The envelope is\n * a Schema-encoded PreparedInput, validated before append and decoded again on recovery.\n * Keeping the encoded value here avoids a Records/PreparedInput schema dependency cycle.\n */\nexport class WorkerReportPrepared extends Schema.TaggedClass<WorkerReportPrepared>()(\n \"WorkerReportPrepared\",\n {\n runId: RunId,\n messageId: IdempotencyKey,\n envelope: PersistedJson,\n createdAtMillis: Schema.Natural,\n deadlineAtMillis: Schema.Natural,\n predecessor: Schema.optionalKey(IdempotencyKey),\n },\n) {}\n\n/** Accepted update and its optional frozen parent delivery are one atomic canonical fact. */\nexport class AgentUpdateEmitted extends Schema.TaggedClass<AgentUpdateEmitted>()(\n \"AgentUpdateEmitted\",\n {\n update: Update,\n definitions: DefinitionDigests,\n delivery: Schema.optionalKey(\n Schema.Struct({\n messageId: IdempotencyKey,\n envelope: PersistedJson,\n createdAtMillis: Schema.Natural,\n deadlineAtMillis: Schema.Natural,\n predecessor: Schema.optionalKey(IdempotencyKey),\n }),\n ),\n },\n) {}\n\n/** Permanent bounded report refusal. Application errors and raw Run dispositions stay private. */\nexport class WorkerReportRefused extends Schema.TaggedClass<WorkerReportRefused>()(\n \"WorkerReportRefused\",\n {\n runId: RunId,\n messageId: IdempotencyKey,\n reason: Schema.Literals([\n \"filtered\",\n \"declaration-unavailable\",\n \"destination\",\n \"projection\",\n \"input\",\n \"preparation\",\n \"timeout\",\n \"defect\",\n \"expired\",\n \"denied\",\n \"capacity\",\n ]),\n },\n) {}\n\n/** Frozen source proof of peer provenance, readable through routed canonical storage. */\nexport class PeerMessagePrepared extends Schema.TaggedClass<PeerMessagePrepared>()(\n \"PeerMessagePrepared\",\n {\n messageId: IdempotencyKey,\n source: WorkerSource,\n sourcePrincipal: Principal,\n operation: Schema.Literals([\"send\", \"reply\"]),\n deadlineAtMillis: Schema.Int.check(Schema.isGreaterThan(0)),\n encodedEnvelope: PersistedJson,\n },\n) {}\n\n/**\n * One disjoint subtree slice shared by attached and background children of a source input.\n * The source keeps its own execution ceiling; descendants spend only the remaining allocation.\n * Reservations include future descendant slots and never refund, including after interruption.\n * resultBytes reserves the terminal/projection result, not cumulative Tool output bytes.\n */\nexport class SubtreeBudgetReserved extends Schema.TaggedClass<SubtreeBudgetReserved>()(\n \"SubtreeBudgetReserved\",\n {\n reservationId: BoundedName,\n /** Run executing this reservation; null for host-owned follow-ups. Grants no authority. */\n executionRunId: Schema.NullOr(RunId),\n sourceSubmissionId: Schema.optionalKey(SubmissionId),\n childThreadId: ThreadId,\n lifetime: Schema.Literals([\"attached\", \"background\"]),\n depth: DelegationDepth,\n policy: Schema.toCodecJson(AgentPolicy),\n grant: SubagentGrant,\n budget: SubagentBudgetReservation,\n },\n) {}\n\n/** Fact identity; active-only references resolve inside their Run checkpoint. */\nexport const EvidenceReference = Schema.Struct({ recordId: RecordId });\nexport type EvidenceReference = typeof EvidenceReference.Type;\n\n/**\n * Receipt-free factual closure. The receiver's irreversible inbox seal precedes its exact-key\n * NotAdmitted observation; a refusal or an absent lookup alone cannot close reserved work.\n * Invocation and allocation charges remain with the original funding Run.\n */\nexport class WorkerInputRefused extends Schema.TaggedClass<WorkerInputRefused>()(\n \"WorkerInputRefused\",\n Schema.Struct({\n messageId: IdempotencyKey,\n workerThreadId: ThreadId,\n reservation: EvidenceReference,\n stop: EvidenceReference,\n deliveryVersion: Schema.Int.check(Schema.isGreaterThan(0)),\n envelopeDigest: Digest,\n receiver: Schema.Struct({\n threadId: ThreadId,\n principal: Principal,\n idempotencyKey: IdempotencyKey,\n inputDigest: Digest,\n stopped: Schema.Literal(true),\n resolution: Schema.Literal(\"NotAdmitted\"),\n }),\n }).check(Schema.makeFilter((value) => value.receiver.threadId === value.workerThreadId)),\n) {}\n\nexport const MAX_RUN_CONTINUATION_BYTES = 8_192;\n/** Incremental record JSON per Turn, including progress and the first Turn's initial context. */\nexport const MAX_TURN_CANONICAL_BYTES = MAX_CANONICAL_RECORD_BYTES;\n/** Room retained for a bounded terminal failure and its atomic progress publication. */\nexport const RUN_TERMINAL_RESERVE_BYTES = 256 * 1024;\n/** Bounded closing facts remain publishable even after dispatch capacity is exhausted. */\nexport const MAX_RUN_TERMINAL_BYTES = 2 * MAX_CANONICAL_RECORD_BYTES + RUN_TERMINAL_RESERVE_BYTES;\nexport const RUN_TERMINAL_RESERVE_RECORDS = 4;\nexport const MAX_RUN_EVIDENCE_RECORDS = 16_384;\nexport const MAX_RUN_EVIDENCE_BYTES = 32 * 1024 * 1024;\nexport const MAX_RUN_RECOVERY_SUFFIX_RECORDS = 64;\nexport const MAX_RUN_RECOVERY_SUFFIX_BYTES = 2 * 1024 * 1024;\nexport const MAX_RUN_TOOL_CALL_IDENTITIES = 4_096;\n\nexport const ContextEvidenceReference = Schema.Struct({\n ...EvidenceReference.fields,\n sequence: CanonicalSequence,\n});\n\nexport class RunContextRecorded extends Schema.TaggedClass<RunContextRecorded>()(\n \"RunContextRecorded\",\n Schema.Struct({\n version: Schema.Literal(1),\n runId: RunId,\n /** Only evaluated instructions and this Run's input; prior history remains in its facts. */\n runScopedInput: PersistedJson,\n /** Inclusive range; historyThrough + 1 denotes an empty range. */\n historyFrom: CanonicalSequence.check(Schema.isGreaterThan(0)),\n /** Fixed prior-history boundary, immediately before the original accepted input. */\n historyThrough: CanonicalSequence,\n /** Facts below historyFrom still needed after summarize or rollover coverage. */\n retained: Schema.Array(ContextEvidenceReference).check(Schema.isMaxLength(4_096)),\n /** Pins the projected prior Prompt, not a second copy or a per-record manifest. */\n historyDigest: Digest,\n priorHistoryLength: Schema.Natural,\n contextWindowId: Schema.optionalKey(BoundedName),\n }).check(\n Schema.makeFilter(\n (context) =>\n context.historyFrom <= context.historyThrough + 1 &&\n context.retained.every(\n (ref, index) =>\n ref.sequence > (context.retained[index - 1]?.sequence ?? 0) &&\n ref.sequence < context.historyFrom,\n ),\n { title: \"Saved context retains an ordered prefix below its original history range\" },\n ),\n ),\n) {}\n\n/** Accumulated charges; replacement Attempts never replenish or charge these again. */\nexport const ContinuationAccounting = Schema.Struct({\n ...RunPolicyUsage.fields,\n modelRestarts: Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 2 })),\n modelCalls: Schema.Natural,\n unobservedModelCalls: Schema.Natural,\n inputTokens: Schema.Natural,\n outputTokens: Schema.Natural,\n lastInputTokens: Schema.Natural,\n lastOutputTokens: Schema.Natural,\n costMicrousd: Schema.Natural,\n /** The last complete operation batch whose declaration-ordered failure streak was charged. */\n accountedToolTurn: Schema.Natural,\n});\n\nexport type ContinuationAccounting = typeof ContinuationAccounting.Type;\n\n/** Semantic execution boundaries, never engine stacks, fibers, or program counters. */\nexport const RunPosition = Schema.Literals([\n \"starting\",\n \"awaiting-model\",\n \"processing-operations\",\n \"waiting-approval\",\n \"waiting-dependency\",\n \"unknown\",\n \"settling\",\n \"settled\",\n]);\n\n/**\n * Current interpreter progress, replaced atomically with lastFact under the Thread fence.\n * lastFact is the exact accounted frontier of the same commit. References resolve within this\n * Thread's history or its authoritative active checkpoint. Results, operation declarations,\n * approvals and delivery obligations remain canonical; evaluated context and validated completion\n * belong to active state. Neither the checkpoint nor its revision grants execution authority.\n * Retired intermediate revisions are not historical verification evidence.\n */\nexport class RunContinuation extends Schema.TaggedClass<RunContinuation>()(\n \"RunContinuation\",\n Schema.Struct({\n version: Schema.Literal(1),\n runId: RunId,\n submissionId: SubmissionId,\n revision: Schema.Natural.check(Schema.isGreaterThan(0)),\n /** Number of this Run's non-continuation facts accounted for at the frontier. */\n recordCount: Schema.Natural.check(\n Schema.isLessThanOrEqualTo(MAX_RUN_EVIDENCE_RECORDS + RUN_TERMINAL_RESERVE_RECORDS),\n ),\n /** Cumulative committed owning fact bytes, excluding progress; deletion never refunds them. */\n recordBytes: Schema.Natural.check(\n Schema.isLessThanOrEqualTo(MAX_RUN_EVIDENCE_BYTES + MAX_RUN_TERMINAL_BYTES),\n ),\n /** Logical Turn whose incremental durable commit bytes are currently being charged. */\n turn: Schema.Natural,\n turnBytes: Schema.Natural.check(\n Schema.isLessThanOrEqualTo(MAX_TURN_CANONICAL_BYTES + MAX_RUN_TERMINAL_BYTES),\n ),\n /** Closing facts consume the terminal reserve, rather than reserving it again. */\n terminalBytes: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_RUN_TERMINAL_BYTES)),\n terminalRecords: Schema.Natural.check(Schema.isLessThanOrEqualTo(RUN_TERMINAL_RESERVE_RECORDS)),\n /** Conservative room for terminal usage grouping; derived only from canonical model usage. */\n terminalUsageBytes: Schema.Natural.check(Schema.isLessThanOrEqualTo(MAX_RUN_EVIDENCE_BYTES)),\n originalInput: EvidenceReference,\n savedContext: Schema.optionalKey(EvidenceReference),\n latestResponse: Schema.optionalKey(EvidenceReference),\n terminal: Schema.optionalKey(EvidenceReference),\n lastFact: EvidenceReference,\n position: RunPosition,\n accounting: ContinuationAccounting,\n }),\n) {}\n\n/** Bump only when the meaning of an existing record changes, independently of SQL layout. */\nexport const CURRENT_RECORD_VERSION = 6;\nexport const CURRENT_RECORD_FORMAT = \"effect-agent/thread@6\";\n\n/** Durable fact and execution-command schemas. Unsupported controls fail before execution. */\nexport const KnownRecordPayload = Schema.Union([\n ThreadCreated,\n UserInputRecorded,\n RunStartedRecord,\n RunDurationExhausted,\n RunPolicyUsageReserved,\n ModelCompleted,\n ModelResponseRecorded,\n ToolCallSettled,\n ToolCallUnknown,\n ToolCallResolved,\n ToolStepSettled,\n ToolApprovalRequested,\n ToolApprovalDecided,\n ModelResponseInterrupted,\n ModelCallAborted,\n CompactionCreated,\n RunFailed,\n RunCompleted,\n AbortRequested,\n SubmissionSettledRecord,\n SubagentRequested,\n SubagentStarted,\n SubagentJoined,\n SubagentLineageRecorded,\n WorkerInputRequested,\n WorkerStopRequested,\n WorkHandoffCompleted,\n WorkerOriginRecorded,\n WorkerInputCompleted,\n WorkerInputRefused,\n WorkerReportPrepared,\n AgentUpdateEmitted,\n WorkerReportRefused,\n PeerMessagePrepared,\n SubtreeBudgetReserved,\n RepairAnnotated,\n RunContextRecorded,\n RunContinuation,\n]);\n\n/** This format accepts only understood facts; unknown control cannot grant permission. */\nexport const CanonicalRecordPayload = KnownRecordPayload;\n\nexport type CanonicalRecordPayload = typeof CanonicalRecordPayload.Type;\n\n/**\n * Versioned durable fact. Retained history acquires Thread ordering at its atomic commit;\n * active operational facts keep their identities without a canonical sequence.\n */\nexport class RecordEnvelope extends Schema.Class<RecordEnvelope>(\n \"@effect-agent/thread/RecordEnvelope\",\n)({\n recordId: RecordId,\n family: Schema.Literal(\"thread\"),\n schemaVersion: Schema.Literal(1),\n createdAt: Schema.DateTimeUtcFromString,\n deploymentId: DeploymentId,\n payload: CanonicalRecordPayload,\n}) {}\n\n/** Backward-compatible domain name for a canonical record. */\nexport const CanonicalRecord = RecordEnvelope;\nexport type CanonicalRecord = RecordEnvelope;\n\n/** One non-empty, bounded, idempotent atomic append unit. */\nexport class CanonicalBatch extends Schema.Class<CanonicalBatch>(\n \"@effect-agent/thread/CanonicalBatch\",\n)({\n batchId: BatchId,\n producerId: ProducerId,\n records: Schema.NonEmptyArray(RecordEnvelope).check(Schema.isMaxLength(256)),\n}) {}\n\n/**\n * A committed record with its Thread ordering and opaque resumable observation cursor.\n */\nexport class CanonicalRecordEnvelope extends Schema.Class<CanonicalRecordEnvelope>(\n \"@effect-agent/thread/CanonicalRecordEnvelope\",\n)({\n threadId: ThreadId,\n batchId: BatchId,\n sequence: CanonicalSequence,\n offset: ObservationOffset,\n record: RecordEnvelope,\n}) {}\n\n/** Read-only history of validated facts. Original inputs establish Run view boundaries. */\nexport const PromptRecordPayload = Schema.TaggedUnion({\n UserInputRecorded: {\n runId: UserInputRecorded.fields.runId,\n kind: UserInputRecorded.fields.kind,\n submissionId: UserInputRecorded.fields.submissionId,\n },\n ModelCompleted: {\n runId: RunId,\n history: Schema.optionalKey(HistoryPrompt),\n },\n ModelResponseRecorded: {\n runId: RunId,\n turn: TurnNumber,\n messages: HistoryPrompt,\n runScopedPrefixLength: ModelResponseRecorded.fields.runScopedPrefixLength,\n },\n ToolCallSettled: {\n runId: RunId,\n toolCallId: ToolCallId,\n toolName: BoundedName,\n result: Schema.Json,\n isFailure: Schema.Boolean,\n },\n CompactionCreated: CompactionCreated.fields,\n RunCompleted: { runId: RunId },\n RunFailed: { runId: RunId },\n SubmissionSettled: {\n runId: Schema.optionalKey(RunId),\n submissionId: SubmissionId,\n outcome: SettlementOutcome,\n },\n});\n\n/** Native selections and the projection decoder share this single list of supported facts. */\nexport const PROMPT_EVIDENCE_TAGS: ReadonlyArray<keyof typeof PromptRecordPayload.cases> =\n Struct.keys(PromptRecordPayload.cases);\n\nexport const PromptRecord = Schema.Struct({ recordId: RecordId, payload: PromptRecordPayload });\nexport type PromptRecord = typeof PromptRecord.Type;\n\n/** Not integrity evidence: omitted canonical wire must be read through the full record port. */\nexport const PromptRecordEnvelope = Schema.Struct({\n threadId: ThreadId,\n sequence: CanonicalSequence,\n record: PromptRecord,\n});\n\nexport type PromptRecordEnvelope = typeof PromptRecordEnvelope.Type;\n\nexport const CURRENT_CANONICAL_SCHEMA_VERSION = 1 as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,SAAS,YAAY,MAAuC;CAC1D,QAAQ,KAAK,MAAb;EACE,KAAK,QACH,OAAO,OAAO,SAAS,IAAI;EAC7B,KAAK,aACH,OAAO,OAAO,cAAc,IAAI;EAClC,KAAK,QACH,OAAO,OAAO,SAAS,IAAI;EAC7B,KAAK,aACH,OAAO,OAAO,aAAa;GAAE,GAAG;GAAM,kBAAkB,KAAK,oBAAoB;EAAM,CAAC;EAC1F,KAAK,eACH,OAAO,OAAO,eAAe;GAAE,GAAG;GAAM,kBAAkB,KAAK,oBAAoB;EAAM,CAAC;EAC5F,KAAK,yBACH,OAAO,OAAO,wBAAwB,IAAI;EAC5C,KAAK,0BACH,OAAO,OAAO,yBAAyB,IAAI;CAC/C;AACF;AAGA,MAAa,yBAAyB,YAAmD;CACvF,QAAQ,QAAQ,MAAhB;EACE,KAAK,UACH,OAAO,OAAO,YAAY,UA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AU;CACV,QAAQ;CACR,QAAQ;AACV,CAAC,CAAC,CAAC,CAAC;;AAGJ,MAAa,sBAAsB,OAAO,YAAY;CACpD,mBAAmB;EACjB,OAAO,kBAAkB,OAAO;EAChC,MAAM,kBAAkB,OAAO;EAC/B,cAAc,kBAAkB,OAAO;CACzC;CACA,gBAAgB;EACd,OAAO;EACP,SAAS,OAAO,YAAY,aAAa;CAC3C;CACA,uBAAuB;EACrB,OAAO;EACP,MAAM;EACN,UAAU;EACV,uBAAuB,sBAAsB,OAAO;CACtD;CACA,iBAAiB;EACf,OAAO;EACP,YAAY;EACZ,UAAU;EACV,QAAQ,OAAO;EACf,WAAW,OAAO;CACpB;CACA,mBAAmB,kBAAkB;CACrC,cAAc,EAAE,OAAO,MAAM;CAC7B,WAAW,EAAE,OAAO,MAAM;CAC1B,mBAAmB;EACjB,OAAO,OAAO,YAAY,KAAK;EAC/B,cAAc;EACd,SAAS;CACX;AACF,CAAC;;AAGD,MAAa,uBACX,OAAO,KAAK,oBAAoB,KAAK;AAEvC,MAAa,eAAe,OAAO,OAAO;CAAE,UAAU;CAAU,SAAS;AAAoB,CAAC;;AAI9F,MAAa,uBAAuB,OAAO,OAAO;CAChD,UAAU;CACV,UAAU;CACV,QAAQ;AACV,CAAC;AAID,MAAa,mCAAmC"}
@@ -1,8 +1,8 @@
1
1
  import { l as SubmissionId, s as RunId, u as ThreadId } from "./Identifiers-CN2s30fF.mjs";
2
2
  import { r as ModelCallUsage } from "./Usage-CzZJ6A2n.mjs";
3
- import { $ as RecordEnvelope, C as EvidenceReference, d as CanonicalRecordEnvelope, l as CanonicalBatch, ot as RunContextRecorded, p as CanonicalSequence, st as RunContinuation } from "./Records-BTnGRdcf.mjs";
4
- import { $r as ExecutionCheckpoint, Fr as RunStorageSession, Gt as LedgerError, Ki as ThreadStoreError, Ni as ThreadNotMaterialized, Qr as CommitBatch, Ur as SettlementPublicationResult, Xr as AppendResult, _o as ProgressAppendRecord, cn as SettlementConflict, qi as ThreadStoreFailure, ti as ExecutionUpdate, zi as ThreadReader } from "./Admin-C4mPa0M2.mjs";
5
- import { t as RunContextReader } from "./run-context-reader-CIdG5tdJ.mjs";
3
+ import { $ as RecordEnvelope, C as EvidenceReference, d as CanonicalRecordEnvelope, l as CanonicalBatch, ot as RunContextRecorded, p as CanonicalSequence, st as RunContinuation } from "./Records-BP67Yz6n.mjs";
4
+ import { $r as ExecutionCheckpoint, Fr as RunStorageSession, Gt as LedgerError, Ki as ThreadStoreError, Ni as ThreadNotMaterialized, Qr as CommitBatch, Ur as SettlementPublicationResult, Xr as AppendResult, _o as ProgressAppendRecord, cn as SettlementConflict, qi as ThreadStoreFailure, ti as ExecutionUpdate, zi as ThreadReader } from "./Admin-BgCHCGSl.mjs";
5
+ import { t as RunContextReader } from "./run-context-reader-DEU4REfD.mjs";
6
6
  import { Context, Effect, Option, Stream } from "effect";
7
7
  //#region src/durable/internal/evidence.d.ts
8
8
  /** References identify immutable facts; schema and owning readers validate their meaning. */
@@ -126,4 +126,4 @@ declare const makeProgressWriter: (threadId: string & import("effect/Brand").Bra
126
126
  }, never, ThreadReader>;
127
127
  //#endregion
128
128
  export { resolveEvidence as S, executionRunIds as _, canonicalRecordBytes as a, terminalUsageCharge as b, prepareProgressAppend as c, resolveExecutionEvidence as d, runEvidence as f, canonicalRunIds as g, verifyRunContinuations as h, RunContinuation_d_exports as i, readContinuation as l, validateSuffix as m, CurrentRunWriter as n, isOperationalRecord as o, validateProgressAppend as p, ProgressAppendReader as r, makeProgressWriter as s, CurrentRunSettlement as t, readRunEvidenceSnapshot as u, isPreContinuationFact as v, reference as x, isWorkHandoff as y };
129
- //# sourceMappingURL=RunContinuation-DMbA81sZ.d.mts.map
129
+ //# sourceMappingURL=RunContinuation-CIJRN_vC.d.mts.map