effect-durable-agent 0.1.0-alpha.3 → 0.1.0-alpha.30

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 (221) hide show
  1. package/README.md +43 -41
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/{commands-Ce1ec6kH.d.ts → commands-3OD-p8dD.d.ts} +16 -9
  5. package/dist/compaction-63iEDHHl.js +523 -0
  6. package/dist/compaction-63iEDHHl.js.map +1 -0
  7. package/dist/context-projection-D_uRtK3r.d.ts +139 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-BcimKMIv.d.ts} +6 -4
  9. package/dist/delivery-2ZILvoRD.js +507 -0
  10. package/dist/delivery-2ZILvoRD.js.map +1 -0
  11. package/dist/{websocket-wire-D3tLrhe2.d.ts → delivery-RjM1_NAE.d.ts} +1019 -200
  12. package/dist/domain/command-queues.d.ts +81 -2
  13. package/dist/domain/command-queues.js +1 -1
  14. package/dist/domain/command-queues.js.map +1 -1
  15. package/dist/domain/context-projection.d.ts +2 -0
  16. package/dist/domain/context-projection.js +32 -0
  17. package/dist/domain/context-projection.js.map +1 -0
  18. package/dist/domain/message-transcript.d.ts +36 -2
  19. package/dist/domain/message-transcript.js +10 -2
  20. package/dist/domain/message-transcript.js.map +1 -1
  21. package/dist/domain/model-usage.d.ts +2 -0
  22. package/dist/domain/model-usage.js +59 -0
  23. package/dist/domain/model-usage.js.map +1 -0
  24. package/dist/domain/reduced-state-schema.d.ts +3 -996
  25. package/dist/domain/reduced-state-schema.js +121 -12
  26. package/dist/domain/reduced-state-schema.js.map +1 -1
  27. package/dist/domain/reduced-state.d.ts +3 -2
  28. package/dist/domain/reduced-state.js +937 -2
  29. package/dist/domain/reduced-state.js.map +1 -0
  30. package/dist/domain/run-scheduling.d.ts +2 -0
  31. package/dist/domain/run-scheduling.js +127 -0
  32. package/dist/domain/run-scheduling.js.map +1 -0
  33. package/dist/{durable-DlScwmCy.d.ts → durable-Cqv5ZRFA.d.ts} +8505 -2497
  34. package/dist/{durable-C3Rz7kg3.js → durable-D13w1Qr3.js} +253 -91
  35. package/dist/durable-D13w1Qr3.js.map +1 -0
  36. package/dist/envelope-BCzKUq_z.js +91 -0
  37. package/dist/envelope-BCzKUq_z.js.map +1 -0
  38. package/dist/envelope-Che6KatU.d.ts +254 -0
  39. package/dist/{keep-alive-p8dIcSVy.js → event-factory-_vF1bIJ7.js} +8 -10
  40. package/dist/event-factory-_vF1bIJ7.js.map +1 -0
  41. package/dist/{events-Bb9-Cu-7.d.ts → events-Dg0o5wWs.d.ts} +140 -324
  42. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
  43. package/dist/in-memory-CeODnZhE.js +150 -0
  44. package/dist/in-memory-CeODnZhE.js.map +1 -0
  45. package/dist/index.d.ts +8 -7
  46. package/dist/index.js +6 -5
  47. package/dist/interpreter-DKGJ1sSx.js +1452 -0
  48. package/dist/interpreter-DKGJ1sSx.js.map +1 -0
  49. package/dist/keep-alive-_zFCUvt3.d.ts +28 -0
  50. package/dist/model-resolver-D0vcDZsU.d.ts +24 -0
  51. package/dist/model-usage-0GeHwaaU.d.ts +54 -0
  52. package/dist/records--54mZEBx.js +675 -0
  53. package/dist/records--54mZEBx.js.map +1 -0
  54. package/dist/reduced-state-DU2ECOUp.d.ts +47821 -0
  55. package/dist/reduced-state-schema-B2t3cobf.d.ts +2187 -0
  56. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-JLU1yptN.d.ts} +24 -8
  57. package/dist/run-scheduling-wakeup-D_bGdicf.d.ts +24 -0
  58. package/dist/services/compaction.d.ts +2 -2
  59. package/dist/services/compaction.js +2 -426
  60. package/dist/services/id-generator.d.ts +1 -1
  61. package/dist/services/id-generator.js +4 -2
  62. package/dist/services/id-generator.js.map +1 -1
  63. package/dist/services/keep-alive.d.ts +2 -0
  64. package/dist/services/keep-alive.js +13 -0
  65. package/dist/services/keep-alive.js.map +1 -0
  66. package/dist/services/model-call.d.ts +15 -0
  67. package/dist/services/model-call.js +15 -0
  68. package/dist/services/model-call.js.map +1 -0
  69. package/dist/services/model-resolver.d.ts +2 -0
  70. package/dist/services/model-resolver.js +17 -0
  71. package/dist/services/model-resolver.js.map +1 -0
  72. package/dist/services/prompt-projector.d.ts +2 -2
  73. package/dist/services/prompt-projector.js +49 -5
  74. package/dist/services/prompt-projector.js.map +1 -1
  75. package/dist/services/reducer-registry.d.ts +2 -2
  76. package/dist/services/reducer-registry.js +21 -4
  77. package/dist/services/reducer-registry.js.map +1 -1
  78. package/dist/services/run-scheduler.d.ts +2 -0
  79. package/dist/services/run-scheduler.js +25 -0
  80. package/dist/services/run-scheduler.js.map +1 -0
  81. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  82. package/dist/services/run-scheduling-wakeup.js +13 -0
  83. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  84. package/dist/services/runtime-layer.d.ts +48 -0
  85. package/dist/services/runtime-layer.js +51 -0
  86. package/dist/services/runtime-layer.js.map +1 -0
  87. package/dist/services/runtime.d.ts +1 -1
  88. package/dist/services/runtime.js +34 -20
  89. package/dist/services/runtime.js.map +1 -1
  90. package/dist/services/session-event-observer.d.ts +2 -0
  91. package/dist/services/session-event-observer.js +13 -0
  92. package/dist/services/session-event-observer.js.map +1 -0
  93. package/dist/services/session-query.d.ts +2 -2
  94. package/dist/services/session-query.js +141 -2
  95. package/dist/services/session-query.js.map +1 -0
  96. package/dist/services/session-state.d.ts +2 -0
  97. package/dist/services/session-state.js +2 -0
  98. package/dist/services/session-store.d.ts +2 -2
  99. package/dist/services/session-store.js +272 -2
  100. package/dist/services/session-store.js.map +1 -0
  101. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  102. package/dist/services/sink-checkpoint-store.js +50 -0
  103. package/dist/services/sink-checkpoint-store.js.map +1 -0
  104. package/dist/services/sink-registry.d.ts +2 -2
  105. package/dist/services/sink-registry.js +1 -1
  106. package/dist/services/span-names.d.ts +1 -1
  107. package/dist/services/span-names.js +7 -1
  108. package/dist/services/span-names.js.map +1 -1
  109. package/dist/services/tool-registry.d.ts +2 -2
  110. package/dist/services/tool-registry.js +12 -3
  111. package/dist/services/tool-registry.js.map +1 -1
  112. package/dist/services/tracing.d.ts +3 -3
  113. package/dist/services/tracing.js +25 -4
  114. package/dist/services/tracing.js.map +1 -1
  115. package/dist/session-event-observer-HvrRckbC.d.ts +24 -0
  116. package/dist/{session-query-Cbf-e0rG.js → session-state-BQYsuBqi.js} +693 -251
  117. package/dist/session-state-BQYsuBqi.js.map +1 -0
  118. package/dist/session-store-CQxg9U82.d.ts +3302 -0
  119. package/dist/sink-checkpoint-store-DWGifxp0.d.ts +39 -0
  120. package/dist/sink-registry-DskRcyOS.js +345 -0
  121. package/dist/sink-registry-DskRcyOS.js.map +1 -0
  122. package/dist/subscription-DmO3BcdT.js +505 -0
  123. package/dist/subscription-DmO3BcdT.js.map +1 -0
  124. package/dist/subscription-rC35dAWn.d.ts +958 -0
  125. package/dist/testkit/layers.d.ts +34 -19
  126. package/dist/testkit/layers.js +30 -16
  127. package/dist/testkit/layers.js.map +1 -1
  128. package/dist/testkit/transcript.d.ts +226 -0
  129. package/dist/testkit/transcript.js +1475 -0
  130. package/dist/testkit/transcript.js.map +1 -0
  131. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BzlMhwzj.d.ts} +44 -8
  132. package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
  133. package/dist/transcript.d.ts +101 -0
  134. package/dist/transcript.js +107 -0
  135. package/dist/transcript.js.map +1 -0
  136. package/dist/types/commands.d.ts +2 -2
  137. package/dist/types/commands.js +8 -3
  138. package/dist/types/commands.js.map +1 -1
  139. package/dist/types/core.d.ts +2 -2
  140. package/dist/types/core.js +4 -2
  141. package/dist/types/core.js.map +1 -1
  142. package/dist/types/events/durable.d.ts +2 -2
  143. package/dist/types/events/durable.js +2 -2
  144. package/dist/types/events.d.ts +5 -4
  145. package/dist/types/events.js +3 -2
  146. package/dist/types/events.js.map +1 -1
  147. package/dist/types/tracing.d.ts +1 -1
  148. package/dist/types/tracing.js.map +1 -1
  149. package/dist/websocket/events.d.ts +2 -0
  150. package/dist/websocket/events.js +2 -0
  151. package/dist/websocket.d.ts +2201 -0
  152. package/dist/websocket.js +684 -0
  153. package/dist/websocket.js.map +1 -0
  154. package/dist/window-read-CBZEJ84M.d.ts +113 -0
  155. package/dist/window-read-DPFAA1hM.js +264 -0
  156. package/dist/window-read-DPFAA1hM.js.map +1 -0
  157. package/package.json +87 -46
  158. package/testing/offline-trace/README.md +2 -1
  159. package/CHANGELOG.md +0 -25
  160. package/CONTRIBUTING.md +0 -26
  161. package/SECURITY.md +0 -7
  162. package/dist/command-queues-CQ9cwRP7.d.ts +0 -468
  163. package/dist/compaction-1LSZR944.d.ts +0 -144
  164. package/dist/durable-C3Rz7kg3.js.map +0 -1
  165. package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
  166. package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
  167. package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
  168. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  169. package/dist/host/durable-object-runtime.d.ts +0 -2
  170. package/dist/host/durable-object-runtime.js +0 -2
  171. package/dist/host/durable-object-storage.d.ts +0 -2
  172. package/dist/host/durable-object-storage.js +0 -0
  173. package/dist/host/durable-object.d.ts +0 -83
  174. package/dist/host/durable-object.js +0 -191
  175. package/dist/host/durable-object.js.map +0 -1
  176. package/dist/host/websocket-wire.d.ts +0 -2
  177. package/dist/host/websocket-wire.js +0 -105
  178. package/dist/host/websocket-wire.js.map +0 -1
  179. package/dist/index-BVVgDSdq.d.ts +0 -1
  180. package/dist/keep-alive-DYDsH6qN.d.ts +0 -111
  181. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  182. package/dist/message-transcript-BCHdHAe2.d.ts +0 -32
  183. package/dist/prompt-projector-DimXJPOJ.d.ts +0 -39
  184. package/dist/reduced-state-C4nVVzz9.js +0 -910
  185. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  186. package/dist/runtime-DcdPOEuE.d.ts +0 -60
  187. package/dist/services/compaction.js.map +0 -1
  188. package/dist/session-query-Cbf-e0rG.js.map +0 -1
  189. package/dist/session-query-hxfujxUH.d.ts +0 -769
  190. package/dist/session-store-D2Ore1QC.d.ts +0 -295
  191. package/dist/session-store-pYxQW9qh.js +0 -214
  192. package/dist/session-store-pYxQW9qh.js.map +0 -1
  193. package/dist/sink-registry-BziFpxoE.d.ts +0 -158
  194. package/dist/sink-registry-CFC6xjsN.js +0 -312
  195. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  196. package/docs/assets/architecture.svg +0 -216
  197. package/docs/assets/event-sequence.svg +0 -133
  198. package/docs/assets/gcp-trace.png +0 -0
  199. package/docs/assets/hero.svg +0 -33
  200. package/docs/message-steering.md +0 -831
  201. package/docs/releasing.md +0 -96
  202. package/docs/spec.md +0 -777
  203. package/docs/subagents.md +0 -725
  204. package/docs/testing.md +0 -64
  205. package/docs/ui-projection.md +0 -742
  206. package/docs/websocket-protocol.md +0 -639
  207. package/examples/001-no-tools/README.md +0 -65
  208. package/examples/001-no-tools/worker.ts +0 -79
  209. package/examples/002-slack-bridge/README.md +0 -134
  210. package/examples/002-slack-bridge/events.ts +0 -115
  211. package/examples/002-slack-bridge/reducer.ts +0 -216
  212. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  213. package/examples/002-slack-bridge/sinks.ts +0 -109
  214. package/examples/002-slack-bridge/worker.ts +0 -140
  215. package/examples/003-sandbox-lifecycle/README.md +0 -78
  216. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  217. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  218. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  219. package/examples/_shared/event-id.ts +0 -12
  220. package/examples/_shared/http.ts +0 -27
  221. package/examples/_shared/openai.ts +0 -33
@@ -1,468 +0,0 @@
1
- import { _ as SummaryId, i as ContextVersion, l as InferenceId, m as SequenceNumber, n as CommandId, p as RunId, r as CompactionId, u as MessageId, v as ToolCallId, y as TurnId } from "./core-Hv3cFydL.js";
2
- import { r as EDACommand, u as UserMessageContent } from "./commands-Ce1ec6kH.js";
3
- import { n as EDARunTrace, t as EDAEventTrace } from "./tracing-BXHAkxkx.js";
4
- import { B as SystemPromptText, P as FailurePayload, R as ProviderPartId, U as UsagePayload, V as ToolName } from "./events-Bb9-Cu-7.js";
5
- import { r as AssistantMessageContent, tt as RecoveryContinuation } from "./durable-DlScwmCy.js";
6
- import { t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
7
- import * as Prompt from "effect/unstable/ai/Prompt";
8
-
9
- //#region src/domain/reduced-state.d.ts
10
- /** Failure payload paired with the durable sequence that recorded it. */
11
- type LifecycleFailure = {
12
- readonly seq: SequenceNumber;
13
- readonly error: FailurePayload;
14
- };
15
- /** Terminal command state folded from command lifecycle events. */
16
- type CommandTerminal = {
17
- readonly _tag: "Completed";
18
- readonly seq: SequenceNumber;
19
- } | {
20
- readonly _tag: "Failed";
21
- readonly seq: SequenceNumber;
22
- readonly error: FailurePayload;
23
- } | {
24
- readonly _tag: "Cancelled";
25
- readonly seq: SequenceNumber;
26
- readonly reason: string;
27
- };
28
- /** Durable command lifecycle projection used for scheduling and recovery. */
29
- interface CommandRecord {
30
- readonly commandId: CommandId;
31
- readonly command?: EDACommand;
32
- readonly admittedSeq?: SequenceNumber;
33
- readonly admissionTrace?: EDAEventTrace;
34
- readonly startedSeq?: SequenceNumber;
35
- readonly terminal?: CommandTerminal;
36
- }
37
- /** Terminal run state folded from run lifecycle events. */
38
- type RunTerminal = {
39
- readonly _tag: "Completed";
40
- readonly seq: SequenceNumber;
41
- } | {
42
- readonly _tag: "Failed";
43
- readonly seq: SequenceNumber;
44
- readonly error: FailurePayload;
45
- } | {
46
- readonly _tag: "Interrupted";
47
- readonly seq: SequenceNumber;
48
- readonly reason: string;
49
- };
50
- /** Common wall-clock lifecycle timing folded from durable event envelopes. */
51
- interface LifecycleTiming {
52
- readonly startedAtMs?: number;
53
- readonly terminalAtMs?: number;
54
- readonly durationMs?: number;
55
- }
56
- /** Durable run lifecycle projection tying one run to its owning command ids. */
57
- interface RunRecord extends LifecycleTiming {
58
- readonly runId: RunId;
59
- readonly commandIds: ReadonlyArray<CommandId>;
60
- readonly startedSeq: SequenceNumber;
61
- readonly trace: EDARunTrace;
62
- readonly terminal?: RunTerminal;
63
- }
64
- /** Terminal turn state folded from turn lifecycle events. */
65
- type TurnTerminal = {
66
- readonly _tag: "Completed";
67
- readonly seq: SequenceNumber;
68
- readonly usage?: UsagePayload;
69
- } | {
70
- readonly _tag: "Failed";
71
- readonly seq: SequenceNumber;
72
- readonly error: FailurePayload;
73
- } | {
74
- readonly _tag: "Stopped";
75
- readonly seq: SequenceNumber;
76
- readonly reason: string;
77
- };
78
- /** Durable turn lifecycle projection nested under a run. */
79
- interface TurnRecord extends LifecycleTiming {
80
- readonly runId: RunId;
81
- readonly turnId: TurnId;
82
- readonly startedSeq: SequenceNumber;
83
- readonly terminal?: TurnTerminal;
84
- }
85
- /** Terminal inference state folded from inference lifecycle events. */
86
- type InferenceTerminal = {
87
- readonly _tag: "Completed";
88
- readonly seq: SequenceNumber;
89
- readonly usage?: UsagePayload;
90
- } | {
91
- readonly _tag: "Failed";
92
- readonly seq: SequenceNumber;
93
- readonly error: FailurePayload;
94
- };
95
- /** Durable model-inference lifecycle projection nested under a turn. */
96
- interface InferenceRecord extends LifecycleTiming {
97
- readonly runId: RunId;
98
- readonly turnId: TurnId;
99
- readonly inferenceId: InferenceId;
100
- readonly startedSeq: SequenceNumber;
101
- readonly terminal?: InferenceTerminal;
102
- }
103
- /** Durable decision produced after a model inference seals final tool calls. */
104
- type ToolDecision = {
105
- readonly _tag: "Created";
106
- readonly seq: SequenceNumber;
107
- readonly runId: RunId;
108
- readonly turnId: TurnId;
109
- readonly inferenceId: InferenceId;
110
- readonly providerPartId: ProviderPartId;
111
- readonly toolName: ToolName;
112
- readonly params: unknown;
113
- readonly providerExecuted: boolean;
114
- readonly promptPart?: Prompt.ToolCallPart;
115
- } | {
116
- readonly _tag: "Rejected";
117
- readonly seq: SequenceNumber;
118
- readonly runId: RunId;
119
- readonly turnId: TurnId;
120
- readonly inferenceId: InferenceId;
121
- readonly providerPartId: ProviderPartId;
122
- readonly toolName: ToolName;
123
- readonly reason: "unknown-tool" | "invalid-params";
124
- readonly modelFeedback: string;
125
- readonly promptPart?: Prompt.ToolResultPart;
126
- };
127
- /** Terminal framework-owned tool-call execution state. */
128
- type ToolTerminal = {
129
- readonly _tag: "Completed";
130
- readonly seq: SequenceNumber;
131
- readonly result: unknown;
132
- readonly promptPart?: Prompt.ToolResultPart;
133
- } | {
134
- readonly _tag: "Failed";
135
- readonly seq: SequenceNumber;
136
- readonly error: FailurePayload;
137
- readonly promptPart?: Prompt.ToolResultPart;
138
- };
139
- /** Durable tool-call projection from decision through execution terminal. */
140
- interface ToolCallRecord extends LifecycleTiming {
141
- readonly toolCallId: ToolCallId;
142
- readonly decision?: ToolDecision;
143
- readonly startedSeq?: SequenceNumber;
144
- readonly terminal?: ToolTerminal;
145
- }
146
- /** Durable message-like facts folded from the event log. */
147
- type MessageRecord = {
148
- readonly _tag: "System";
149
- readonly messageId: MessageId;
150
- readonly content: SystemPromptText;
151
- readonly createdAtMs?: number;
152
- readonly seq: SequenceNumber;
153
- } | {
154
- readonly _tag: "User";
155
- readonly messageId: MessageId;
156
- readonly commandId: CommandId;
157
- readonly content: UserMessageContent;
158
- readonly createdAtMs?: number;
159
- readonly seq: SequenceNumber; /** Present for admission-time message entities; absent on legacy committed users. */
160
- readonly requestedDisposition?: "queue" | "steer";
161
- readonly disposition?: "queue" | "steer";
162
- readonly promotedSeq?: SequenceNumber;
163
- readonly pausedSeq?: SequenceNumber;
164
- readonly pausedByCommandId?: CommandId;
165
- readonly consumedSeq?: SequenceNumber;
166
- readonly consumedTurnId?: TurnId;
167
- readonly cancelledSeq?: SequenceNumber;
168
- readonly cancelledByCommandId?: CommandId;
169
- readonly cancellationReason?: string;
170
- } | {
171
- readonly _tag: "Steering";
172
- readonly messageId: MessageId;
173
- readonly commandId: CommandId;
174
- readonly runId: RunId;
175
- readonly content: UserMessageContent;
176
- readonly createdAtMs?: number;
177
- readonly seq: SequenceNumber;
178
- readonly promotedSeq?: SequenceNumber;
179
- readonly consumedSeq?: SequenceNumber;
180
- readonly consumedTurnId?: TurnId;
181
- readonly cancelledSeq?: SequenceNumber;
182
- readonly cancelledByCommandId?: CommandId;
183
- readonly cancellationReason?: string;
184
- readonly pausedSeq?: SequenceNumber;
185
- readonly pausedByCommandId?: CommandId;
186
- } | {
187
- readonly _tag: "Assistant";
188
- readonly messageId: MessageId;
189
- readonly runId: RunId;
190
- readonly turnId: TurnId;
191
- readonly inferenceId: InferenceId;
192
- readonly content: AssistantMessageContent;
193
- readonly createdAtMs?: number;
194
- readonly promptParts?: ReadonlyArray<Prompt.AssistantMessagePart>;
195
- readonly seq: SequenceNumber;
196
- } | {
197
- readonly _tag: "AssistantPartial";
198
- readonly messageId: MessageId;
199
- readonly runId: RunId;
200
- readonly turnId: TurnId;
201
- readonly inferenceId: InferenceId;
202
- readonly content: AssistantMessageContent;
203
- readonly createdAtMs?: number;
204
- readonly promptParts?: ReadonlyArray<Prompt.AssistantMessagePart>;
205
- readonly reason: string;
206
- readonly seq: SequenceNumber;
207
- };
208
- /** Terminal compaction state folded from compaction lifecycle events. */
209
- type CompactionTerminal = {
210
- readonly _tag: "Completed";
211
- readonly seq: SequenceNumber;
212
- } | {
213
- readonly _tag: "Failed";
214
- readonly seq: SequenceNumber;
215
- readonly error: FailurePayload;
216
- };
217
- /** Durable compaction lifecycle projection and its produced summary cursor. */
218
- interface CompactionRecord {
219
- readonly compactionId: CompactionId;
220
- readonly requestedSeq?: SequenceNumber;
221
- readonly startedSeq?: SequenceNumber;
222
- readonly summaryCreatedSeq?: SequenceNumber;
223
- readonly summaryId?: SummaryId;
224
- readonly sourceFromSeq?: SequenceNumber;
225
- readonly sourceToSeq?: SequenceNumber;
226
- readonly rebasedSeq?: SequenceNumber;
227
- readonly contextVersion?: ContextVersion;
228
- readonly terminal?: CompactionTerminal;
229
- }
230
- /** Current model-context version and summary selected by compaction. */
231
- interface ContextRecord {
232
- readonly version: ContextVersion;
233
- readonly currentSummaryId?: SummaryId;
234
- }
235
- /** Durable StopTurn request and the lifecycle boundary it eventually applied to. */
236
- interface StopRequestRecord {
237
- readonly commandId: CommandId;
238
- readonly requestedSeq: SequenceNumber;
239
- readonly requestedRunId?: RunId;
240
- readonly requestedTurnId?: TurnId;
241
- readonly appliedSeq?: SequenceNumber;
242
- readonly appliedRunId?: RunId;
243
- readonly appliedTurnId?: TurnId;
244
- readonly appliedInferenceId?: InferenceId;
245
- }
246
- /** Rolling session totals for provider-reported model token usage. */
247
- interface TokenUsageTotals {
248
- readonly inputTokens: number;
249
- readonly cachedInputTokens: number;
250
- readonly outputTokens: number;
251
- readonly textTokens: number;
252
- readonly reasoningTokens: number;
253
- }
254
- /** First-party token consumption metadata folded by the framework reducer. */
255
- interface TokenConsumptionState {
256
- readonly total: TokenUsageTotals;
257
- }
258
- /** Admitted command that has not yet crossed the `CommandStarted` boundary. */
259
- interface PendingCommand {
260
- /** Lifecycle ID for the admitted command. */
261
- readonly commandId: CommandId;
262
- /** Typed command payload admitted durably. */
263
- readonly command: EDACommand;
264
- /** Admission sequence used for deterministic FIFO/control ordering. */
265
- readonly admittedSeq: SequenceNumber;
266
- /** Trace context captured at the durable command admission boundary. */
267
- readonly admissionTrace?: EDAEventTrace;
268
- }
269
- /** Started command without a terminal command boundary, optionally tied to an open run. */
270
- interface ActiveCommandEvidence {
271
- readonly commandId: CommandId;
272
- readonly runId?: RunId;
273
- }
274
- /** Active run/turn/inference identity derived from unfinished lifecycle records. */
275
- type ActiveTurnIdentity = {
276
- readonly runId: RunId;
277
- readonly turnId: TurnId;
278
- readonly inferenceId?: InferenceId;
279
- };
280
- /** Canonical durable replay product used by queries, recovery, and scheduling. */
281
- interface ReducedState {
282
- readonly lastSeq: SequenceNumber;
283
- readonly commands: ReadonlyMap<CommandId, CommandRecord>;
284
- readonly runs: ReadonlyMap<RunId, RunRecord>;
285
- /** Explicit startup-recovery links keyed by replacement physical run id. */
286
- readonly recoveryContinuations: ReadonlyMap<RunId, RecoveryContinuationRecord>;
287
- readonly turns: ReadonlyMap<TurnId, TurnRecord>;
288
- readonly inferences: ReadonlyMap<InferenceId, InferenceRecord>;
289
- readonly toolCalls: ReadonlyMap<ToolCallId, ToolCallRecord>;
290
- readonly messages: ReadonlyMap<MessageId, MessageRecord>;
291
- readonly stopRequests: ReadonlyMap<CommandId, StopRequestRecord>;
292
- readonly compactions: ReadonlyMap<CompactionId, CompactionRecord>;
293
- readonly context: ContextRecord;
294
- /** Rolling model-token usage totals derived from completed provider inferences. */
295
- readonly tokenConsumption: TokenConsumptionState;
296
- /** Materialized scheduler queues derived from the maps above after every fold. */
297
- readonly commandQueues: CommandQueues;
298
- }
299
- /** Durable recovery continuation plus the sequence of its completion barrier. */
300
- interface RecoveryContinuationRecord extends RecoveryContinuation {
301
- readonly seq: SequenceNumber;
302
- }
303
- /** Unfinished lifecycle records requiring deterministic startup recovery. */
304
- interface RecoverableWork {
305
- readonly activeCommands: ReadonlyArray<CommandRecord>;
306
- readonly activeRuns: ReadonlyArray<RunRecord>;
307
- readonly activeTurns: ReadonlyArray<TurnRecord>;
308
- readonly activeInferences: ReadonlyArray<InferenceRecord>;
309
- readonly openToolCalls: ReadonlyArray<ToolCallRecord>;
310
- readonly runningToolCalls: ReadonlyArray<ToolCallRecord>;
311
- readonly pendingStopRequests: ReadonlyArray<StopRequestRecord>;
312
- readonly openCompactions: ReadonlyArray<CompactionRecord>;
313
- }
314
- /** Empty durable replay state before any session event has committed. */
315
- declare const initialReducedState: ReducedState;
316
- /** Reserved reducer checkpoint name for the framework-owned `ReducedState`. */
317
- declare const frameworkReducedStateReducerName = "_eda.framework.reduced-state";
318
- /** Schema version for the framework-owned `ReducedState` checkpoint payload. */
319
- declare const frameworkReducedStateReducerSchemaVersion = 4;
320
- /** JSON payload stored for the framework-owned reduced-state reducer checkpoint. */
321
- type ReducedStateCheckpointCommandRecord = Omit<CommandRecord, "command">;
322
- type SystemMessageRecord = Extract<MessageRecord, {
323
- readonly _tag: "System";
324
- }>;
325
- type UserMessageRecord = Extract<MessageRecord, {
326
- readonly _tag: "User";
327
- }>;
328
- type SteeringMessageRecord = Extract<MessageRecord, {
329
- readonly _tag: "Steering";
330
- }>;
331
- type AssistantMessageRecord = Extract<MessageRecord, {
332
- readonly _tag: "Assistant";
333
- }>;
334
- type AssistantPartialMessageRecord = Extract<MessageRecord, {
335
- readonly _tag: "AssistantPartial";
336
- }>;
337
- type ReducedStateCheckpointMessageRecord = Omit<SystemMessageRecord, "content"> | Omit<UserMessageRecord, "content"> | Omit<SteeringMessageRecord, "content"> | Omit<AssistantMessageRecord, "content" | "promptParts"> | Omit<AssistantPartialMessageRecord, "content" | "promptParts">;
338
- type CreatedToolDecision = Extract<ToolDecision, {
339
- readonly _tag: "Created";
340
- }>;
341
- type RejectedToolDecision = Extract<ToolDecision, {
342
- readonly _tag: "Rejected";
343
- }>;
344
- type CompletedToolTerminal = Extract<ToolTerminal, {
345
- readonly _tag: "Completed";
346
- }>;
347
- type FailedToolTerminal = Extract<ToolTerminal, {
348
- readonly _tag: "Failed";
349
- }>;
350
- type ReducedStateCheckpointToolDecision = Omit<CreatedToolDecision, "params" | "promptPart"> | Omit<RejectedToolDecision, "promptPart">;
351
- type ReducedStateCheckpointToolTerminal = Omit<CompletedToolTerminal, "result" | "promptPart"> | Omit<FailedToolTerminal, "error" | "promptPart">;
352
- interface ReducedStateCheckpointToolCallRecord extends Omit<ToolCallRecord, "decision" | "terminal"> {
353
- readonly decision?: ReducedStateCheckpointToolDecision;
354
- readonly terminal?: ReducedStateCheckpointToolTerminal;
355
- }
356
- interface ReducedStateCheckpointPayload {
357
- readonly lastSeq: SequenceNumber;
358
- readonly commands: ReadonlyArray<readonly [CommandId, ReducedStateCheckpointCommandRecord]>;
359
- readonly runs: ReadonlyArray<readonly [RunId, RunRecord]>;
360
- readonly recoveryContinuations?: ReadonlyArray<readonly [RunId, RecoveryContinuationRecord]>;
361
- readonly turns: ReadonlyArray<readonly [TurnId, TurnRecord]>;
362
- readonly inferences: ReadonlyArray<readonly [InferenceId, InferenceRecord]>;
363
- readonly toolCalls: ReadonlyArray<readonly [ToolCallId, ReducedStateCheckpointToolCallRecord]>;
364
- readonly messages: ReadonlyArray<readonly [MessageId, ReducedStateCheckpointMessageRecord]>;
365
- readonly stopRequests: ReadonlyArray<readonly [CommandId, StopRequestRecord]>;
366
- readonly compactions: ReadonlyArray<readonly [CompactionId, CompactionRecord]>;
367
- readonly context: ContextRecord;
368
- readonly tokenConsumption?: TokenConsumptionState;
369
- }
370
- /** Encode the framework reducer state into a pointer-based JSON-safe checkpoint payload. */
371
- declare const encodeReducedStateCheckpoint: (state: ReducedState) => ReducedStateCheckpointPayload;
372
- /** Event-log positions required to hydrate a pointer-based framework checkpoint. */
373
- declare const reducedStateCheckpointEventSeqs: (payload: unknown) => ReadonlyArray<SequenceNumber>;
374
- /** Decode the framework reducer checkpoint and rebuild derived scheduler queues. */
375
- declare const decodeReducedStateCheckpoint: (payload: unknown, referencedEvents: ReadonlyArray<CommittedDurableEvent>) => ReducedState;
376
- /** Fold newly committed durable events into the canonical replay state. */
377
- declare const foldReducedState: (state: ReducedState, committed: ReadonlyArray<CommittedDurableEvent>) => ReducedState;
378
- /** Fold committed events from genesis into a fresh `ReducedState`. */
379
- declare const reduceCommittedEvents: (committed: ReadonlyArray<CommittedDurableEvent>) => ReducedState;
380
- /** Pending admitted commands in deterministic scheduler order. */
381
- declare const pendingCommands: (state: ReducedState) => ReadonlyArray<PendingCommand>;
382
- /** First pending StopTurn control command, when one is waiting. */
383
- declare const pendingStopCommand: (state: ReducedState) => PendingCommand | undefined;
384
- /** Currently active command evidence, if any unfinished command is blocking FIFO work. */
385
- declare const activeCommand: (state: ReducedState) => ActiveCommandEvidence | undefined;
386
- /** Active run/turn/inference identity owned by a specific active command. */
387
- declare const activeTurnIdentityForCommand: (state: ReducedState, commandId: CommandId) => ActiveTurnIdentity | undefined;
388
- /** Classify unfinished durable lifecycles that recovery may need to repair. */
389
- declare const classifyRecoverableWork: (state: ReducedState) => RecoverableWork;
390
- //#endregion
391
- //#region src/domain/command-queues.d.ts
392
- /**
393
- * A steering message admitted for an active run but not necessarily consumed
394
- * by a later turn yet.
395
- */
396
- interface PendingSteeringMessage {
397
- /** Durable message identity used by `TurnStarted.inputMessageIds` when consumed. */
398
- readonly messageId: MessageId;
399
- /** Command that admitted this steering message. */
400
- readonly commandId: PendingCommand["commandId"];
401
- /** Active run this steering message may continue. */
402
- readonly runId: RunId;
403
- /** User content to append to the next continuation prompt when selected. */
404
- readonly content: UserMessageContent;
405
- /** Sequence where `SteeringMessageQueued` committed; used for one-by-one ordering. */
406
- readonly queuedSeq: SequenceNumber;
407
- /** Sequence where a later `TurnStarted` consumed this steering message. */
408
- readonly consumedSeq?: SequenceNumber;
409
- /** Turn that consumed this steering message. */
410
- readonly consumedTurnId?: TurnId;
411
- }
412
- /**
413
- * Materialized command scheduler view derived from durable `ReducedState`.
414
- *
415
- * `pendingCommands` means admitted commands with no `CommandStarted` yet.
416
- * `queuedCommands` is the FIFO subset that should wait for idle session work
417
- * (`SubmitMessage{disposition:"queue"}`). `activeControlCommands` is the
418
- * subset that may affect an active run (`StopTurn`, `steer`, `interrupt`).
419
- * `steeringByRun` is not a command queue; it is queued steering content already
420
- * admitted/completed as commands but not yet consumed by a turn.
421
- */
422
- interface CommandQueues {
423
- /** Started command without terminal command evidence, plus active run when known. */
424
- readonly active?: ActiveCommandEvidence;
425
- /** All admitted commands that have not yet crossed `CommandStarted`. */
426
- readonly pendingCommands: ReadonlyArray<PendingCommand>;
427
- /** FIFO user-message work that waits until no command/run is active. */
428
- readonly queuedCommands: ReadonlyArray<PendingCommand>;
429
- /** Stop/steer/interrupt work that can be interpreted while a run is active. */
430
- readonly activeControlCommands: ReadonlyArray<PendingCommand>;
431
- /** Unconsumed steering messages grouped by target run and sorted by queued seq. */
432
- readonly steeringByRun: ReadonlyMap<RunId, ReadonlyArray<PendingSteeringMessage>>;
433
- /** Admission-time queue messages eligible for separate work. */
434
- readonly pendingQueue: ReadonlyArray<PendingUserMessage>;
435
- /** Admission-time steer messages eligible at the next boundary. */
436
- readonly pendingSteers: ReadonlyArray<PendingUserMessage>;
437
- /** Queue messages held by an explicit interruption pause. */
438
- readonly pausedQueue: ReadonlyArray<PendingUserMessage>;
439
- }
440
- interface PendingUserMessage {
441
- readonly messageId: MessageId;
442
- readonly commandId: PendingCommand["commandId"];
443
- readonly content: UserMessageContent;
444
- readonly submittedSeq: SequenceNumber;
445
- readonly effectiveSeq: SequenceNumber;
446
- readonly disposition: "queue" | "steer";
447
- readonly targetRunId?: RunId;
448
- readonly pausedByCommandId?: PendingCommand["commandId"];
449
- }
450
- /** Durable records needed to derive `CommandQueues` without services or refs. */
451
- interface CommandQueueSource {
452
- readonly commands: ReadonlyMap<PendingCommand["commandId"], CommandRecord>;
453
- readonly runs: ReadonlyMap<RunId, RunRecord>;
454
- readonly messages: ReadonlyMap<MessageId, MessageRecord>;
455
- }
456
- /** Empty queue view for `initialReducedState` before any durable events exist. */
457
- declare const emptyCommandQueues: CommandQueues;
458
- /**
459
- * Derive scheduler queues from durable replay state.
460
- *
461
- * These queues are cached inside `ReducedState` for clarity and fast scheduler
462
- * reads, but durable command/message/run records remain the source of truth.
463
- * Never mutate a queue directly; fold durable events and derive again.
464
- */
465
- declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
466
- //#endregion
467
- export { RunTerminal as A, activeTurnIdentityForCommand as B, ReducedStateCheckpointCommandRecord as C, ReducedStateCheckpointToolDecision as D, ReducedStateCheckpointToolCallRecord as E, ToolDecision as F, frameworkReducedStateReducerName as G, decodeReducedStateCheckpoint as H, ToolTerminal as I, pendingCommands as J, frameworkReducedStateReducerSchemaVersion as K, TurnRecord as L, TokenConsumptionState as M, TokenUsageTotals as N, ReducedStateCheckpointToolTerminal as O, ToolCallRecord as P, TurnTerminal as R, ReducedState as S, ReducedStateCheckpointPayload as T, encodeReducedStateCheckpoint as U, classifyRecoverableWork as V, foldReducedState as W, reduceCommittedEvents as X, pendingStopCommand as Y, reducedStateCheckpointEventSeqs as Z, LifecycleTiming as _, deriveCommandQueues as a, RecoverableWork as b, ActiveTurnIdentity as c, CompactionRecord as d, CompactionTerminal as f, LifecycleFailure as g, InferenceTerminal as h, PendingUserMessage as i, StopRequestRecord as j, RunRecord as k, CommandRecord as l, InferenceRecord as m, CommandQueues as n, emptyCommandQueues as o, ContextRecord as p, initialReducedState as q, PendingSteeringMessage as r, ActiveCommandEvidence as s, CommandQueueSource as t, CommandTerminal as u, MessageRecord as v, ReducedStateCheckpointMessageRecord as w, RecoveryContinuationRecord as x, PendingCommand as y, activeCommand as z };
468
- //# sourceMappingURL=command-queues-CQ9cwRP7.d.ts.map
@@ -1,144 +0,0 @@
1
- import { f as CompactionExecutorId, m as ContextProjection, o as EDASessionStoreError, p as CompactionPolicyId, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
2
- import { S as ReducedState } from "./command-queues-CQ9cwRP7.js";
3
- import { t as IdGenerator } from "./id-generator-C2Q15uZM.js";
4
- import { n as EventFactory, t as EDAKeepAlive } from "./keep-alive-DYDsH6qN.js";
5
- import * as Context from "effect/Context";
6
- import * as Effect from "effect/Effect";
7
- import * as Layer from "effect/Layer";
8
- import * as Schema from "effect/Schema";
9
- import * as LanguageModel from "effect/unstable/ai/LanguageModel";
10
-
11
- //#region src/services/compaction.d.ts
12
- /** Candidate durable range and retained cursor selected by compaction policy. */
13
- declare const CompactionPlan: Schema.Struct<{
14
- readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
15
- readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
16
- readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
17
- readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
18
- }>;
19
- type CompactionPlan = typeof CompactionPlan.Type;
20
- /** Rough token heuristic used by the built-in compaction presets. */
21
- declare const defaultCompactionCharsPerToken = 4;
22
- /** Production-oriented context threshold for the built-in approximate-token policy. */
23
- declare const defaultCompactionThresholdTokens = 220000;
24
- /** Recent model-facing tail retained verbatim by the built-in approximate-token policy. */
25
- declare const defaultCompactionRetainTailTokens = 40000;
26
- /** Minimum newly summarizable prefix needed before the approximate-token policy plans work. */
27
- declare const defaultCompactionMinSummarizableTokens = 10000;
28
- /** Approximate-token policy options for common production compaction. */
29
- interface ApproximateTokenThresholdCompactionPolicyOptions {
30
- /** Stable policy id stored on summary artifacts. */
31
- readonly policyId?: string;
32
- /** Context-size threshold that triggers compaction. Defaults to 220k tokens. */
33
- readonly thresholdTokens?: number;
34
- /** Recent tail retained verbatim after compaction. Defaults to 40k tokens. */
35
- readonly retainTailTokens?: number;
36
- /** Smallest prefix worth summarizing. Defaults to 10k tokens. */
37
- readonly minSummarizableTokens?: number;
38
- /** Character-to-token divisor for the approximate estimator. Defaults to 4. */
39
- readonly charsPerToken?: number;
40
- }
41
- /** LanguageModel-backed summary executor options. */
42
- interface LanguageModelSummaryCompactionExecutorOptions {
43
- /** Stable executor id stored on summary artifacts. */
44
- readonly executorId?: string;
45
- /** Prefix used for the synthetic prompt message inserted into future context. */
46
- readonly summaryMessagePrefix?: string;
47
- }
48
- /** Input visible to policy decisions. */
49
- interface CompactionPolicyInput {
50
- readonly state: ReducedState;
51
- readonly context: ContextProjection;
52
- }
53
- /** Result produced by the summary executor before the framework commits it. */
54
- declare const CompactionOutput: Schema.Struct<{
55
- readonly text: Schema.NonEmptyString;
56
- readonly promptMessage: Schema.Struct<{
57
- readonly role: Schema.Literal<"user">;
58
- readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
59
- readonly type: Schema.Literal<"text">;
60
- readonly text: Schema.String;
61
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
62
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
63
- }>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
64
- readonly type: Schema.Literal<"text">;
65
- readonly text: Schema.String;
66
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
67
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
68
- }>, Schema.Struct<{
69
- readonly type: Schema.Literal<"file">;
70
- readonly mediaType: Schema.String;
71
- readonly fileName: Schema.optional<Schema.String>;
72
- readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
73
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
74
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
75
- }>]>>]>;
76
- readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
77
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
78
- }>;
79
- readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
80
- }>;
81
- type CompactionOutput = typeof CompactionOutput.Type;
82
- /** Executor input with framework-minted lifecycle identities. */
83
- interface CompactionExecutorInput extends CompactionPolicyInput {
84
- readonly plan: CompactionPlan;
85
- }
86
- declare const CompactionError_base: Schema.Class<CompactionError, Schema.TaggedStruct<"CompactionError", {
87
- readonly message: Schema.String;
88
- }>, import("effect/Cause").YieldableError>;
89
- /** Typed failure from policy planning or summary generation. */
90
- declare class CompactionError extends CompactionError_base {}
91
- /** Service contract for deciding whether the current context should be compacted. */
92
- interface CompactionPolicyShape {
93
- readonly id: CompactionPolicyId;
94
- readonly plan: (input: CompactionPolicyInput) => Effect.Effect<CompactionPlan | undefined, CompactionError>;
95
- }
96
- declare const CompactionPolicy_base: Context.ServiceClass<CompactionPolicy, "@effect-durable-agent/CompactionPolicy", CompactionPolicyShape>;
97
- /** Decides whether a safe prompt-context rebase should be attempted. */
98
- declare class CompactionPolicy extends CompactionPolicy_base {
99
- /** Default policy: compaction is disabled and commits no skip events. */
100
- static readonly Disabled: Layer.Layer<CompactionPolicy, never, never>;
101
- /** Test/app hook for replacing the policy with a concrete planner. */
102
- static readonly FromFunction: (id: string, plan: CompactionPolicyShape["plan"]) => Layer.Layer<CompactionPolicy>;
103
- /**
104
- * Common production policy: compact when approximate prompt context exceeds a token threshold.
105
- *
106
- * The policy keeps a recent tail verbatim, summarizes the older prefix, and advances from the
107
- * current summary cursor so repeated compactions behave like the first one.
108
- */
109
- static readonly ApproximateTokenThreshold: (options?: ApproximateTokenThresholdCompactionPolicyOptions) => Layer.Layer<CompactionPolicy>;
110
- }
111
- /** Service contract for turning a selected compaction range into a summary artifact. */
112
- interface CompactionExecutorShape {
113
- readonly id: CompactionExecutorId;
114
- readonly execute: (input: CompactionExecutorInput) => Effect.Effect<CompactionOutput, CompactionError>;
115
- }
116
- declare const CompactionExecutor_base: Context.ServiceClass<CompactionExecutor, "@effect-durable-agent/CompactionExecutor", CompactionExecutorShape>;
117
- /** Produces a cumulative summary artifact for a selected compaction plan. */
118
- declare class CompactionExecutor extends CompactionExecutor_base {
119
- /** Placeholder executor for the disabled default policy. It should never be called. */
120
- static readonly Disabled: Layer.Layer<CompactionExecutor, never, never>;
121
- /** Test/app hook for replacing summary generation. */
122
- static readonly FromFunction: (id: string, execute: CompactionExecutorShape["execute"]) => Layer.Layer<CompactionExecutor>;
123
- /** Summary executor backed by the configured Effect AI LanguageModel. */
124
- static readonly LanguageModelSummary: (options?: LanguageModelSummaryCompactionExecutorOptions) => Layer.Layer<CompactionExecutor, never, LanguageModel.LanguageModel>;
125
- }
126
- /** Inputs needed by the framework-owned compaction lifecycle runner. */
127
- interface CompactionRunnerInput {
128
- readonly state: ReducedState;
129
- readonly context: ContextProjection;
130
- readonly appendDurableEntries: (entries: ReadonlyArray<DurableAppendEntry>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
131
- }
132
- /** Runtime service that executes framework-owned compaction lifecycles. */
133
- interface CompactionRunnerShape {
134
- /** Evaluate policy and run one compaction if a plan is selected. */
135
- readonly maybeCompact: (input: CompactionRunnerInput) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
136
- }
137
- declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
138
- /** Framework-owned compaction lifecycle runner. */
139
- declare class CompactionRunner extends CompactionRunner_base {
140
- static readonly Live: Layer.Layer<CompactionRunner, never, CompactionPolicy | CompactionExecutor | EventFactory | IdGenerator | EDAKeepAlive>;
141
- }
142
- //#endregion
143
- export { defaultCompactionRetainTailTokens as _, CompactionExecutorShape as a, CompactionPolicy as c, CompactionRunner as d, CompactionRunnerInput as f, defaultCompactionMinSummarizableTokens as g, defaultCompactionCharsPerToken as h, CompactionExecutorInput as i, CompactionPolicyInput as l, LanguageModelSummaryCompactionExecutorOptions as m, CompactionError as n, CompactionOutput as o, CompactionRunnerShape as p, CompactionExecutor as r, CompactionPlan as s, ApproximateTokenThresholdCompactionPolicyOptions as t, CompactionPolicyShape as u, defaultCompactionThresholdTokens as v };
144
- //# sourceMappingURL=compaction-1LSZR944.d.ts.map