effect-durable-agent 0.1.0-alpha.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +5 -5
  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-BUquEZVP.d.ts} +31 -12
  5. package/dist/{compaction-BgDr5VJy.js → compaction-63iEDHHl.js} +63 -13
  6. package/dist/compaction-63iEDHHl.js.map +1 -0
  7. package/dist/{context-projection-n6Rdup0N.d.ts → context-projection-Bezx3drD.d.ts} +16 -40
  8. package/dist/{core-CYT6DBaS.d.ts → core-BcimKMIv.d.ts} +5 -3
  9. package/dist/delivery-2ZILvoRD.js +507 -0
  10. package/dist/delivery-2ZILvoRD.js.map +1 -0
  11. package/dist/delivery-D3MxW4wg.d.ts +3026 -0
  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 +1 -1
  16. package/dist/domain/context-projection.js +1 -1
  17. package/dist/domain/context-projection.js.map +1 -1
  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 +1 -1
  22. package/dist/domain/model-usage.js +1 -1
  23. package/dist/domain/reduced-state-schema.d.ts +3 -992
  24. package/dist/domain/reduced-state-schema.js +126 -7
  25. package/dist/domain/reduced-state-schema.js.map +1 -1
  26. package/dist/domain/reduced-state.d.ts +2 -2
  27. package/dist/domain/reduced-state.js +936 -2
  28. package/dist/domain/reduced-state.js.map +1 -0
  29. package/dist/domain/run-scheduling.d.ts +2 -0
  30. package/dist/domain/run-scheduling.js +127 -0
  31. package/dist/domain/run-scheduling.js.map +1 -0
  32. package/dist/{durable-br2C1bWK.d.ts → durable-168Womqp.d.ts} +8535 -2859
  33. package/dist/{durable-BGFvX7Mh.js → durable-D13w1Qr3.js} +229 -15
  34. package/dist/durable-D13w1Qr3.js.map +1 -0
  35. package/dist/{envelope-DxQzo5rN.js → envelope-BCzKUq_z.js} +12 -3
  36. package/dist/envelope-BCzKUq_z.js.map +1 -0
  37. package/dist/{envelope-DkZyMIgp.d.ts → envelope-Che6KatU.d.ts} +70 -7
  38. package/dist/{event-factory-DTFdy0Cb.js → event-factory-_vF1bIJ7.js} +7 -3
  39. package/dist/event-factory-_vF1bIJ7.js.map +1 -0
  40. package/dist/{events-LZFNoESe.d.ts → events-DwTARLMv.d.ts} +139 -137
  41. package/dist/{id-generator-Ckl8_XWW.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
  42. package/dist/in-memory-CeODnZhE.js +150 -0
  43. package/dist/in-memory-CeODnZhE.js.map +1 -0
  44. package/dist/index.d.ts +8 -8
  45. package/dist/index.js +6 -6
  46. package/dist/interpreter-DKGJ1sSx.js +1452 -0
  47. package/dist/interpreter-DKGJ1sSx.js.map +1 -0
  48. package/dist/{keep-alive-Chl5SJxy.d.ts → keep-alive-_zFCUvt3.d.ts} +1 -2
  49. package/dist/{model-resolver-BPPJAsuh.d.ts → model-resolver-DeBDK8XO.d.ts} +11 -5
  50. package/dist/{model-usage-CdBEkTwU.d.ts → model-usage-0GeHwaaU.d.ts} +2 -3
  51. package/dist/records--54mZEBx.js +675 -0
  52. package/dist/records--54mZEBx.js.map +1 -0
  53. package/dist/reduced-state-B1cvy8N_.d.ts +51110 -0
  54. package/dist/reduced-state-schema-B98exWxQ.d.ts +2338 -0
  55. package/dist/{reducer-registry-aFjz_ZLT.d.ts → reducer-registry-DhGVzHBV.d.ts} +12 -6
  56. package/dist/run-scheduling-wakeup-Mjic4tb_.d.ts +24 -0
  57. package/dist/services/compaction.d.ts +2 -2
  58. package/dist/services/compaction.js +2 -2
  59. package/dist/services/id-generator.d.ts +1 -1
  60. package/dist/services/id-generator.js +6 -12
  61. package/dist/services/id-generator.js.map +1 -1
  62. package/dist/services/keep-alive.d.ts +1 -1
  63. package/dist/services/keep-alive.js.map +1 -1
  64. package/dist/services/model-call.d.ts +15 -0
  65. package/dist/services/model-call.js +15 -0
  66. package/dist/services/model-call.js.map +1 -0
  67. package/dist/services/model-resolver.d.ts +1 -1
  68. package/dist/services/model-resolver.js +1 -1
  69. package/dist/services/model-resolver.js.map +1 -1
  70. package/dist/services/prompt-projector.d.ts +2 -2
  71. package/dist/services/prompt-projector.js +49 -5
  72. package/dist/services/prompt-projector.js.map +1 -1
  73. package/dist/services/reducer-registry.d.ts +1 -1
  74. package/dist/services/reducer-registry.js +19 -6
  75. package/dist/services/reducer-registry.js.map +1 -1
  76. package/dist/services/run-scheduler.d.ts +2 -0
  77. package/dist/services/run-scheduler.js +25 -0
  78. package/dist/services/run-scheduler.js.map +1 -0
  79. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  80. package/dist/services/run-scheduling-wakeup.js +13 -0
  81. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  82. package/dist/services/runtime-layer.d.ts +18 -31
  83. package/dist/services/runtime-layer.js +19 -13
  84. package/dist/services/runtime-layer.js.map +1 -1
  85. package/dist/services/runtime.d.ts +1 -1
  86. package/dist/services/runtime.js +31 -20
  87. package/dist/services/runtime.js.map +1 -1
  88. package/dist/services/session-event-observer.d.ts +1 -1
  89. package/dist/services/session-event-observer.js.map +1 -1
  90. package/dist/services/session-query.d.ts +1 -1
  91. package/dist/services/session-query.js +57 -10
  92. package/dist/services/session-query.js.map +1 -1
  93. package/dist/services/session-state.d.ts +1 -1
  94. package/dist/services/session-state.js +1 -1
  95. package/dist/services/session-store.d.ts +2 -2
  96. package/dist/services/session-store.js +127 -37
  97. package/dist/services/session-store.js.map +1 -1
  98. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  99. package/dist/services/sink-checkpoint-store.js +2 -1
  100. package/dist/services/sink-checkpoint-store.js.map +1 -1
  101. package/dist/services/sink-registry.d.ts +2 -2
  102. package/dist/services/sink-registry.js +1 -1
  103. package/dist/services/span-names.d.ts +1 -1
  104. package/dist/services/span-names.js +6 -1
  105. package/dist/services/span-names.js.map +1 -1
  106. package/dist/services/tool-registry.d.ts +2 -2
  107. package/dist/services/tool-registry.js +12 -3
  108. package/dist/services/tool-registry.js.map +1 -1
  109. package/dist/services/tracing.d.ts +3 -3
  110. package/dist/services/tracing.js +2 -2
  111. package/dist/services/tracing.js.map +1 -1
  112. package/dist/{session-event-observer-DaFMKKNc.d.ts → session-event-observer-DlP9ITB2.d.ts} +3 -3
  113. package/dist/{session-state-aIqe9CLa.js → session-state-BehvUVyq.js} +669 -160
  114. package/dist/session-state-BehvUVyq.js.map +1 -0
  115. package/dist/session-store-BL6sfrnn.d.ts +3326 -0
  116. package/dist/{sink-checkpoint-store-M7qIxoSH.d.ts → sink-checkpoint-store-DvuHwvx_.d.ts} +3 -4
  117. package/dist/sink-registry-DskRcyOS.js +345 -0
  118. package/dist/sink-registry-DskRcyOS.js.map +1 -0
  119. package/dist/subscription-DZNWFDTV.d.ts +966 -0
  120. package/dist/subscription-DmO3BcdT.js +505 -0
  121. package/dist/subscription-DmO3BcdT.js.map +1 -0
  122. package/dist/testkit/layers.d.ts +31 -22
  123. package/dist/testkit/layers.js +23 -14
  124. package/dist/testkit/layers.js.map +1 -1
  125. package/dist/testkit/transcript.d.ts +226 -0
  126. package/dist/testkit/transcript.js +1475 -0
  127. package/dist/testkit/transcript.js.map +1 -0
  128. package/dist/{tool-registry-BJaVNtw4.d.ts → tool-registry-CHHUU9BN.d.ts} +44 -8
  129. package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
  130. package/dist/transcript.d.ts +101 -0
  131. package/dist/transcript.js +107 -0
  132. package/dist/transcript.js.map +1 -0
  133. package/dist/types/commands.d.ts +2 -2
  134. package/dist/types/commands.js +8 -3
  135. package/dist/types/commands.js.map +1 -1
  136. package/dist/types/core.d.ts +2 -2
  137. package/dist/types/core.js +3 -1
  138. package/dist/types/core.js.map +1 -1
  139. package/dist/types/events/durable.d.ts +2 -2
  140. package/dist/types/events/durable.js +2 -2
  141. package/dist/types/events.d.ts +5 -5
  142. package/dist/types/events.js +3 -3
  143. package/dist/types/tracing.d.ts +1 -1
  144. package/dist/types/tracing.js.map +1 -1
  145. package/dist/websocket/events.d.ts +2 -0
  146. package/dist/websocket/events.js +2 -0
  147. package/dist/websocket.d.ts +2123 -2552
  148. package/dist/websocket.js +628 -442
  149. package/dist/websocket.js.map +1 -1
  150. package/dist/window-read-Brov9VdQ.d.ts +113 -0
  151. package/dist/window-read-DPFAA1hM.js +264 -0
  152. package/dist/window-read-DPFAA1hM.js.map +1 -0
  153. package/package.json +42 -14
  154. package/dist/command-queues-DdDB_aYM.d.ts +0 -462
  155. package/dist/compaction-BEor3jKv.d.ts +0 -165
  156. package/dist/compaction-BgDr5VJy.js.map +0 -1
  157. package/dist/durable-BGFvX7Mh.js.map +0 -1
  158. package/dist/envelope-DxQzo5rN.js.map +0 -1
  159. package/dist/event-factory-DTFdy0Cb.js.map +0 -1
  160. package/dist/event-factory-pFzsPlDs.d.ts +0 -87
  161. package/dist/index-BVVgDSdq.d.ts +0 -1
  162. package/dist/message-transcript-DQNlzxle.d.ts +0 -32
  163. package/dist/prompt-projector-f4ElyXCE.d.ts +0 -39
  164. package/dist/reduced-state-DF0-6mbR.js +0 -921
  165. package/dist/reduced-state-DF0-6mbR.js.map +0 -1
  166. package/dist/runtime-DbTCb32-.d.ts +0 -63
  167. package/dist/session-query-l8xpJYp8.d.ts +0 -45
  168. package/dist/session-state-YHFzOGDf.d.ts +0 -861
  169. package/dist/session-state-aIqe9CLa.js.map +0 -1
  170. package/dist/session-store-Cpi_NwTR.d.ts +0 -206
  171. package/dist/sink-registry-NDgeyzO0.js +0 -272
  172. package/dist/sink-registry-NDgeyzO0.js.map +0 -1
  173. package/dist/sink-registry-T1wOUuzq.d.ts +0 -133
@@ -1,165 +0,0 @@
1
- import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-n6Rdup0N.js";
2
- import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-Cpi_NwTR.js";
3
- import { S as ReducedState } from "./command-queues-DdDB_aYM.js";
4
- import { t as ModelResolver } from "./model-resolver-BPPJAsuh.js";
5
- import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
6
- import { t as EventFactory } from "./event-factory-pFzsPlDs.js";
7
- import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
8
- import * as Context from "effect/Context";
9
- import * as Effect from "effect/Effect";
10
- import * as Layer from "effect/Layer";
11
- import * as LanguageModel from "effect/unstable/ai/LanguageModel";
12
- import * as Schema from "effect/Schema";
13
-
14
- //#region src/services/compaction.d.ts
15
- /** Candidate durable range and retained cursor selected by compaction policy. */
16
- declare const CompactionPlan: Schema.Struct<{
17
- readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
18
- readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
19
- readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
20
- readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
21
- }>;
22
- type CompactionPlan = typeof CompactionPlan.Type;
23
- /** Rough token heuristic used by the built-in compaction presets. */
24
- declare const defaultCompactionCharsPerToken = 4;
25
- /** Production-oriented context threshold for the built-in approximate-token policy. */
26
- declare const defaultCompactionThresholdTokens = 220000;
27
- /** Recent model-facing tail retained verbatim by the built-in approximate-token policy. */
28
- declare const defaultCompactionRetainTailTokens = 40000;
29
- /** Minimum newly summarizable prefix needed before the approximate-token policy plans work. */
30
- declare const defaultCompactionMinSummarizableTokens = 10000;
31
- /** Approximate-token policy options for common production compaction. */
32
- interface ApproximateTokenThresholdCompactionPolicyOptions {
33
- /** Stable policy id stored on summary artifacts. */
34
- readonly policyId?: string;
35
- /** Context-size threshold that triggers compaction. Defaults to 220k tokens. */
36
- readonly thresholdTokens?: number;
37
- /** Recent tail retained verbatim after compaction. Defaults to 40k tokens. */
38
- readonly retainTailTokens?: number;
39
- /** Smallest prefix worth summarizing. Defaults to 10k tokens. */
40
- readonly minSummarizableTokens?: number;
41
- /** Character-to-token divisor for the approximate estimator. Defaults to 4. */
42
- readonly charsPerToken?: number;
43
- }
44
- /** LanguageModel-backed summary executor options. */
45
- interface LanguageModelSummaryCompactionExecutorOptions {
46
- /** Stable executor id stored on summary artifacts. */
47
- readonly executorId?: string;
48
- /** Prefix used for the synthetic prompt message inserted into future context. */
49
- readonly summaryMessagePrefix?: string;
50
- }
51
- /** Input visible to policy decisions. */
52
- interface CompactionPolicyInput {
53
- readonly state: ReducedState;
54
- readonly context: ContextProjection;
55
- }
56
- /** Result produced by the summary executor before the framework commits it. */
57
- declare const CompactionOutput: Schema.Struct<{
58
- readonly text: Schema.NonEmptyString;
59
- readonly promptMessage: Schema.Struct<{
60
- readonly role: Schema.Literal<"user">;
61
- readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
62
- readonly type: Schema.Literal<"text">;
63
- readonly text: Schema.String;
64
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
65
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
66
- }>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
67
- readonly type: Schema.Literal<"text">;
68
- readonly text: Schema.String;
69
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
70
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
71
- }>, Schema.Struct<{
72
- readonly type: Schema.Literal<"file">;
73
- readonly mediaType: Schema.String;
74
- readonly fileName: Schema.optional<Schema.String>;
75
- readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
76
- readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
77
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
78
- }>]>>]>;
79
- readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
80
- readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
81
- }>;
82
- readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
83
- readonly usage: Schema.optionalKey<Schema.Struct<{
84
- readonly inputTokens: Schema.optionalKey<Schema.Int>;
85
- readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
86
- readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
87
- readonly outputTokens: Schema.optionalKey<Schema.Int>;
88
- readonly textTokens: Schema.optionalKey<Schema.Int>;
89
- readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
90
- }>>;
91
- }>;
92
- type CompactionOutput = typeof CompactionOutput.Type;
93
- /** Executor input with framework-minted lifecycle identities. */
94
- interface CompactionExecutorInput extends CompactionPolicyInput {
95
- readonly plan: CompactionPlan;
96
- /** Provider service resolved from the same durable selection used for accounting. */
97
- readonly model: LanguageModel.Service;
98
- }
99
- declare const CompactionError_base: Schema.Class<CompactionError, Schema.TaggedStruct<"CompactionError", {
100
- readonly message: Schema.String;
101
- readonly usage: Schema.optionalKey<Schema.Struct<{
102
- readonly inputTokens: Schema.optionalKey<Schema.Int>;
103
- readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
104
- readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
105
- readonly outputTokens: Schema.optionalKey<Schema.Int>;
106
- readonly textTokens: Schema.optionalKey<Schema.Int>;
107
- readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
108
- }>>;
109
- }>, import("effect/Cause").YieldableError>;
110
- /** Typed failure from policy planning or summary generation. */
111
- declare class CompactionError extends CompactionError_base {}
112
- /** Service contract for deciding whether the current context should be compacted. */
113
- interface CompactionPolicyShape {
114
- readonly id: CompactionPolicyId;
115
- readonly plan: (input: CompactionPolicyInput) => Effect.Effect<CompactionPlan | undefined, CompactionError>;
116
- }
117
- declare const CompactionPolicy_base: Context.ServiceClass<CompactionPolicy, "@effect-durable-agent/CompactionPolicy", CompactionPolicyShape>;
118
- /** Decides whether a safe prompt-context rebase should be attempted. */
119
- declare class CompactionPolicy extends CompactionPolicy_base {
120
- /** Default policy: compaction is disabled and commits no skip events. */
121
- static readonly Disabled: Layer.Layer<CompactionPolicy, never, never>;
122
- /** Test/app hook for replacing the policy with a concrete planner. */
123
- static readonly FromFunction: (id: string, plan: CompactionPolicyShape["plan"]) => Layer.Layer<CompactionPolicy>;
124
- /**
125
- * Common production policy: compact when approximate prompt context exceeds a token threshold.
126
- *
127
- * The policy keeps a recent tail verbatim, summarizes the older prefix, and advances from the
128
- * current summary cursor so repeated compactions behave like the first one.
129
- */
130
- static readonly ApproximateTokenThreshold: (options?: ApproximateTokenThresholdCompactionPolicyOptions) => Layer.Layer<CompactionPolicy>;
131
- }
132
- /** Service contract for turning a selected compaction range into a summary artifact. */
133
- interface CompactionExecutorShape {
134
- readonly id: CompactionExecutorId;
135
- readonly execute: (input: CompactionExecutorInput) => Effect.Effect<CompactionOutput, CompactionError>;
136
- }
137
- declare const CompactionExecutor_base: Context.ServiceClass<CompactionExecutor, "@effect-durable-agent/CompactionExecutor", CompactionExecutorShape>;
138
- /** Produces a cumulative summary artifact for a selected compaction plan. */
139
- declare class CompactionExecutor extends CompactionExecutor_base {
140
- /** Placeholder executor for the disabled default policy. It should never be called. */
141
- static readonly Disabled: Layer.Layer<CompactionExecutor, never, never>;
142
- /** Test/app hook for replacing summary generation. */
143
- static readonly FromFunction: (id: string, execute: CompactionExecutorShape["execute"]) => Layer.Layer<CompactionExecutor>;
144
- /** Summary executor backed by the configured Effect AI LanguageModel. */
145
- static readonly LanguageModelSummary: (options?: LanguageModelSummaryCompactionExecutorOptions) => Layer.Layer<CompactionExecutor>;
146
- }
147
- /** Inputs needed by the framework-owned compaction lifecycle runner. */
148
- interface CompactionRunnerInput {
149
- readonly state: ReducedState;
150
- readonly context: ContextProjection;
151
- readonly appendDurableEntries: (entries: ReadonlyArray<DurableAppendEntry>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
152
- }
153
- /** Runtime service that executes framework-owned compaction lifecycles. */
154
- interface CompactionRunnerShape {
155
- /** Evaluate policy and run one compaction if a plan is selected. */
156
- readonly maybeCompact: (input: CompactionRunnerInput) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
157
- }
158
- declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
159
- /** Framework-owned compaction lifecycle runner. */
160
- declare class CompactionRunner extends CompactionRunner_base {
161
- static readonly Live: Layer.Layer<CompactionRunner, never, CompactionExecutor | CompactionPolicy | EDAKeepAlive | ModelResolver | EventFactory | IdGenerator>;
162
- }
163
- //#endregion
164
- 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 };
165
- //# sourceMappingURL=compaction-BEor3jKv.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compaction-BgDr5VJy.js","names":[],"sources":["../src/services/provider-usage.ts","../src/services/compaction.ts"],"sourcesContent":["import type * as Response from \"effect/unstable/ai/Response\";\nimport { UsagePayload } from \"../types/events\";\n\n/** Normalizes provider usage for both conversation and compaction calls. */\nexport const makeUsagePayload = (usage: Response.Usage) => {\n const uncachedInputTokens = nonNegativeInt(usage.inputTokens.uncached);\n const cachedInputTokens = nonNegativeInt(usage.inputTokens.cacheRead);\n const cacheWriteInputTokens = nonNegativeInt(usage.inputTokens.cacheWrite);\n const inputTokens =\n nonNegativeInt(usage.inputTokens.total) ??\n sumDefined([uncachedInputTokens, cachedInputTokens, cacheWriteInputTokens]);\n const textTokens = nonNegativeInt(usage.outputTokens.text);\n const reasoningTokens = nonNegativeInt(usage.outputTokens.reasoning);\n const outputTokens =\n nonNegativeInt(usage.outputTokens.total) ?? sumDefined([textTokens, reasoningTokens]);\n\n return UsagePayload.make({\n ...(inputTokens === undefined ? {} : { inputTokens }),\n ...(cachedInputTokens === undefined ? {} : { cachedInputTokens }),\n ...(cacheWriteInputTokens === undefined ? {} : { cacheWriteInputTokens }),\n ...(outputTokens === undefined ? {} : { outputTokens }),\n ...(textTokens === undefined ? {} : { textTokens }),\n ...(reasoningTokens === undefined ? {} : { reasoningTokens }),\n });\n};\n\nconst sumDefined = (values: ReadonlyArray<number | undefined>) => {\n const present = values.filter((value): value is number => value !== undefined);\n return present.length === 0 ? undefined : present.reduce((sum, value) => sum + value, 0);\n};\n\nconst nonNegativeInt = (value: number | undefined) =>\n value === undefined || !Number.isFinite(value) ? undefined : Math.max(0, Math.trunc(value));\n","import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\nimport type * as LanguageModel from \"effect/unstable/ai/LanguageModel\";\nimport { ModelResolver } from \"./model-resolver\";\nimport { makeUsagePayload } from \"./provider-usage\";\n\nimport type { ContextProjection } from \"../domain/context-projection\";\nimport {\n durableMessageTranscript,\n type DurableTranscriptMessage,\n} from \"../domain/message-transcript\";\nimport {\n CompactionExecutorId,\n CompactionPolicyId,\n CompactionSummaryArtifact,\n} from \"../domain/context-projection\";\nimport type { ReducedState } from \"../domain/reduced-state\";\nimport { InferenceId, ContextVersion, SequenceNumber } from \"../types/core\";\nimport { FailurePayload, UsagePayload, type AssistantMessageContent } from \"../types/events\";\nimport { CommittedDurableEvent, DurableAppendEntry, EDASessionStoreError } from \"./session-store\";\nimport { EventFactory } from \"./event-factory\";\nimport { IdGenerator } from \"./id-generator\";\nimport { EDAKeepAlive } from \"./keep-alive\";\nimport { annotateEdaSpan, committedBatchAttributes } from \"./tracing\";\n\n/** Candidate durable range and retained cursor selected by compaction policy. */\nexport const CompactionPlan = Schema.Struct({\n policyId: CompactionPolicyId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n retainedFromContextSeq: SequenceNumber,\n});\nexport type CompactionPlan = typeof CompactionPlan.Type;\n\n/** Rough token heuristic used by the built-in compaction presets. */\nexport const defaultCompactionCharsPerToken = 4;\n\n/** Production-oriented context threshold for the built-in approximate-token policy. */\nexport const defaultCompactionThresholdTokens = 220_000;\n\n/** Recent model-facing tail retained verbatim by the built-in approximate-token policy. */\nexport const defaultCompactionRetainTailTokens = 40_000;\n\n/** Minimum newly summarizable prefix needed before the approximate-token policy plans work. */\nexport const defaultCompactionMinSummarizableTokens = 10_000;\n\n/** Approximate-token policy options for common production compaction. */\nexport interface ApproximateTokenThresholdCompactionPolicyOptions {\n /** Stable policy id stored on summary artifacts. */\n readonly policyId?: string;\n /** Context-size threshold that triggers compaction. Defaults to 220k tokens. */\n readonly thresholdTokens?: number;\n /** Recent tail retained verbatim after compaction. Defaults to 40k tokens. */\n readonly retainTailTokens?: number;\n /** Smallest prefix worth summarizing. Defaults to 10k tokens. */\n readonly minSummarizableTokens?: number;\n /** Character-to-token divisor for the approximate estimator. Defaults to 4. */\n readonly charsPerToken?: number;\n}\n\n/** LanguageModel-backed summary executor options. */\nexport interface LanguageModelSummaryCompactionExecutorOptions {\n /** Stable executor id stored on summary artifacts. */\n readonly executorId?: string;\n /** Prefix used for the synthetic prompt message inserted into future context. */\n readonly summaryMessagePrefix?: string;\n}\n\n/** Input visible to policy decisions. */\nexport interface CompactionPolicyInput {\n readonly state: ReducedState;\n readonly context: ContextProjection;\n}\n\n/** Result produced by the summary executor before the framework commits it. */\nexport const CompactionOutput = Schema.Struct({\n text: Schema.NonEmptyString,\n promptMessage: Prompt.UserMessage,\n executorId: Schema.optionalKey(CompactionExecutorId),\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type CompactionOutput = typeof CompactionOutput.Type;\n\n/** Executor input with framework-minted lifecycle identities. */\nexport interface CompactionExecutorInput extends CompactionPolicyInput {\n readonly plan: CompactionPlan;\n /** Provider service resolved from the same durable selection used for accounting. */\n readonly model: LanguageModel.Service;\n}\n\n/** Typed failure from policy planning or summary generation. */\nexport class CompactionError extends Schema.TaggedErrorClass<CompactionError>()(\"CompactionError\", {\n message: Schema.String,\n usage: Schema.optionalKey(UsagePayload),\n}) {}\n\n/** Service contract for deciding whether the current context should be compacted. */\nexport interface CompactionPolicyShape {\n readonly id: CompactionPolicyId;\n readonly plan: (\n input: CompactionPolicyInput,\n ) => Effect.Effect<CompactionPlan | undefined, CompactionError>;\n}\n\n/** Decides whether a safe prompt-context rebase should be attempted. */\nexport class CompactionPolicy extends Context.Service<CompactionPolicy, CompactionPolicyShape>()(\n \"@effect-durable-agent/CompactionPolicy\",\n) {\n /** Default policy: compaction is disabled and commits no skip events. */\n static readonly Disabled = Layer.succeed(CompactionPolicy, {\n id: CompactionPolicyId.make(\"disabled\"),\n plan: () => Effect.succeed(undefined),\n } satisfies CompactionPolicyShape);\n\n /** Test/app hook for replacing the policy with a concrete planner. */\n static readonly FromFunction = (\n id: string,\n plan: CompactionPolicyShape[\"plan\"],\n ): Layer.Layer<CompactionPolicy> =>\n Layer.succeed(CompactionPolicy, {\n id: CompactionPolicyId.make(id),\n plan,\n });\n\n /**\n * Common production policy: compact when approximate prompt context exceeds a token threshold.\n *\n * The policy keeps a recent tail verbatim, summarizes the older prefix, and advances from the\n * current summary cursor so repeated compactions behave like the first one.\n */\n static readonly ApproximateTokenThreshold = (\n options: ApproximateTokenThresholdCompactionPolicyOptions = {},\n ): Layer.Layer<CompactionPolicy> => {\n const normalized = normalizeApproximateTokenPolicyOptions(options);\n return Layer.succeed(CompactionPolicy, {\n id: normalized.policyId,\n plan: ({ state, context }) =>\n Effect.sync(() => planApproximateTokenCompaction(state, context, normalized)),\n });\n };\n}\n\n/** Service contract for turning a selected compaction range into a summary artifact. */\nexport interface CompactionExecutorShape {\n readonly id: CompactionExecutorId;\n readonly execute: (\n input: CompactionExecutorInput,\n ) => Effect.Effect<CompactionOutput, CompactionError>;\n}\n\n/** Produces a cumulative summary artifact for a selected compaction plan. */\nexport class CompactionExecutor extends Context.Service<\n CompactionExecutor,\n CompactionExecutorShape\n>()(\"@effect-durable-agent/CompactionExecutor\") {\n /** Placeholder executor for the disabled default policy. It should never be called. */\n static readonly Disabled = Layer.succeed(CompactionExecutor, {\n id: CompactionExecutorId.make(\"disabled\"),\n execute: () => Effect.die(new Error(\"CompactionExecutor.Disabled was called\")),\n } satisfies CompactionExecutorShape);\n\n /** Test/app hook for replacing summary generation. */\n static readonly FromFunction = (\n id: string,\n execute: CompactionExecutorShape[\"execute\"],\n ): Layer.Layer<CompactionExecutor> =>\n Layer.succeed(CompactionExecutor, {\n id: CompactionExecutorId.make(id),\n execute,\n });\n\n /** Summary executor backed by the configured Effect AI LanguageModel. */\n static readonly LanguageModelSummary = (\n options: LanguageModelSummaryCompactionExecutorOptions = {},\n ): Layer.Layer<CompactionExecutor> =>\n Layer.effect(\n CompactionExecutor,\n Effect.sync(() => {\n const executorId = CompactionExecutorId.make(\n options.executorId ?? \"language-model-summary\",\n );\n const summaryMessagePrefix = options.summaryMessagePrefix ?? \"Conversation summary:\";\n return {\n id: executorId,\n execute: Effect.fn(\"agent.compaction\")(function* (input) {\n yield* annotateEdaSpan({\n \"eda.compaction.policy_id\": input.plan.policyId,\n \"eda.compaction.source_from_seq\": input.plan.sourceFromSeq,\n \"eda.compaction.source_to_seq\": input.plan.sourceToSeq,\n \"eda.compaction.retained_from_context_seq\": input.plan.retainedFromContextSeq,\n \"eda.compaction.executor_id\": executorId,\n });\n const promptText = buildSummaryPrompt(input);\n if (promptText === undefined) {\n return yield* new CompactionError({\n message: \"compaction plan selected no source messages\",\n });\n }\n const response = yield* input.model\n .generateText({\n prompt: Prompt.fromMessages([\n Prompt.makeMessage(\"system\", { content: summarizationSystemPrompt }),\n Prompt.makeMessage(\"user\", {\n content: [Prompt.textPart({ text: promptText })],\n }),\n ]),\n toolChoice: \"none\",\n })\n .pipe(\n Effect.mapError(\n (error) =>\n new CompactionError({\n message: `summary model failed: ${formatUnknownError(error)}`,\n }),\n ),\n );\n const text = response.text.trim();\n if (text.length === 0) {\n return yield* new CompactionError({\n message: \"summary model returned no text\",\n usage: makeUsagePayload(response.usage),\n });\n }\n return CompactionOutput.make({\n usage: makeUsagePayload(response.usage),\n text,\n promptMessage: Prompt.makeMessage(\"user\", {\n content: [Prompt.textPart({ text: `${summaryMessagePrefix}\\n\\n${text}` })],\n }),\n executorId,\n });\n }),\n } satisfies CompactionExecutorShape;\n }),\n );\n}\n\n/** Inputs needed by the framework-owned compaction lifecycle runner. */\nexport interface CompactionRunnerInput {\n readonly state: ReducedState;\n readonly context: ContextProjection;\n readonly appendDurableEntries: (\n entries: ReadonlyArray<DurableAppendEntry>,\n ) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;\n}\n\n/** Runtime service that executes framework-owned compaction lifecycles. */\nexport interface CompactionRunnerShape {\n /** Evaluate policy and run one compaction if a plan is selected. */\n readonly maybeCompact: (\n input: CompactionRunnerInput,\n ) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;\n}\n\n/** Framework-owned compaction lifecycle runner. */\nexport class CompactionRunner extends Context.Service<CompactionRunner, CompactionRunnerShape>()(\n \"@effect-durable-agent/CompactionRunner\",\n) {\n static readonly Live = Layer.effect(\n CompactionRunner,\n Effect.suspend(() => makeLiveCompactionRunner),\n );\n}\n\ninterface NormalizedApproximateTokenPolicyOptions {\n readonly policyId: CompactionPolicyId;\n readonly thresholdTokens: number;\n readonly retainTailTokens: number;\n readonly minSummarizableTokens: number;\n readonly charsPerToken: number;\n}\n\ninterface EstimatedContextMessage {\n readonly chars: number;\n readonly message: DurableTranscriptMessage;\n readonly seq: SequenceNumber;\n}\n\nconst makeLiveCompactionRunner = Effect.gen(function* () {\n const ids = yield* IdGenerator;\n const events = yield* EventFactory;\n const policy = yield* CompactionPolicy;\n const executor = yield* CompactionExecutor;\n const keepAlive = yield* EDAKeepAlive;\n const models = yield* ModelResolver;\n\n const maybeCompact = Effect.fnUntraced(function* (input: CompactionRunnerInput) {\n const plan = yield* policy\n .plan({ state: input.state, context: input.context })\n .pipe(\n Effect.catchTag(\"CompactionError\", (error) =>\n Effect.logError(\"compaction policy failed\", { error }).pipe(Effect.as(undefined)),\n ),\n );\n if (plan === undefined) {\n yield* annotateEdaSpan({ \"eda.compaction.selected\": false });\n return [];\n }\n yield* annotateEdaSpan({\n \"eda.compaction.selected\": true,\n \"eda.compaction.policy_id\": plan.policyId,\n \"eda.compaction.source_from_seq\": plan.sourceFromSeq,\n \"eda.compaction.source_to_seq\": plan.sourceToSeq,\n \"eda.compaction.retained_from_context_seq\": plan.retainedFromContextSeq,\n });\n const invalidPlan = validatePlan(plan, input.state, input.context);\n if (invalidPlan !== undefined) {\n yield* Effect.logError(\"compaction policy returned invalid plan\", { reason: invalidPlan });\n return [];\n }\n\n const compactionId = yield* ids.makeCompactionId();\n const summaryId = yield* ids.makeSummaryId();\n yield* annotateEdaSpan({\n \"eda.compaction.id\": compactionId,\n \"eda.summary.id\": summaryId,\n });\n const requested = yield* events.compactionRequested({\n compactionId,\n sourceFromSeq: plan.sourceFromSeq,\n sourceToSeq: plan.sourceToSeq,\n });\n const started = yield* events.compactionStarted({ compactionId });\n const startedEvents = yield* input.appendDurableEntries([\n { event: requested },\n { event: started },\n ]);\n\n const model = yield* models.resolve(input.state.modelSelection);\n const output = yield* keepAlive\n .withActiveWork(\n `compaction:${compactionId}`,\n executor.execute({ plan, state: input.state, context: input.context, model }),\n )\n .pipe(\n Effect.catchTag(\"CompactionError\", (error) =>\n Effect.gen(function* () {\n const failed = yield* events.compactionFailed({\n compactionId,\n ...(input.state.modelSelection === undefined\n ? {}\n : { modelSelection: input.state.modelSelection }),\n ...(error.usage === undefined ? {} : { usage: error.usage }),\n error: FailurePayload.make({ message: error.message }),\n });\n const committed = yield* input.appendDurableEntries([{ event: failed }]);\n return { _tag: \"Failed\" as const, committed };\n }),\n ),\n Effect.map((result) =>\n \"_tag\" in result ? result : { _tag: \"Output\" as const, output: result },\n ),\n );\n\n if (output._tag === \"Failed\") {\n return [...startedEvents, ...output.committed];\n }\n\n const artifact = CompactionSummaryArtifact.make({\n compactionId,\n summaryId,\n ...(input.context.currentSummary === undefined\n ? {}\n : { previousSummaryId: input.context.currentSummary.summaryId }),\n sourceFromSeq: plan.sourceFromSeq,\n sourceToSeq: plan.sourceToSeq,\n retainedFromContextSeq: plan.retainedFromContextSeq,\n text: output.output.text,\n promptMessage: output.output.promptMessage,\n policyId: plan.policyId,\n ...(output.output.executorId === undefined ? {} : { executorId: output.output.executorId }),\n });\n const summaryCreated = yield* events.summaryCreated({\n compactionId,\n summaryId,\n sourceFromSeq: plan.sourceFromSeq,\n sourceToSeq: plan.sourceToSeq,\n summary: artifact,\n });\n const contextRebased = yield* events.contextRebased({\n compactionId,\n summaryId,\n contextVersion: ContextVersion.make(input.context.contextVersion + 1),\n retainedFromContextSeq: plan.retainedFromContextSeq,\n });\n const completed = yield* events.compactionCompleted({\n compactionId,\n ...(input.state.modelSelection === undefined\n ? {}\n : { modelSelection: input.state.modelSelection }),\n ...(output.output.usage === undefined ? {} : { usage: output.output.usage }),\n });\n const committed = yield* input.appendDurableEntries([\n { event: summaryCreated },\n { event: contextRebased },\n { event: completed },\n ]);\n yield* annotateEdaSpan(committedBatchAttributes([...startedEvents, ...committed]));\n return [...startedEvents, ...committed];\n });\n\n return { maybeCompact } satisfies CompactionRunnerShape;\n});\n\nconst validatePlan = (\n plan: CompactionPlan,\n state: ReducedState,\n context: ContextProjection,\n): string | undefined => {\n const currentRetainedFromSeq =\n context.currentSummary?.retainedFromContextSeq ?? SequenceNumber.make(0);\n if (plan.retainedFromContextSeq <= currentRetainedFromSeq) {\n return \"retainedFromContextSeq must advance beyond the current summary cursor\";\n }\n if (plan.sourceToSeq > state.lastSeq) {\n return \"sourceToSeq must not exceed the current durable head\";\n }\n if (plan.retainedFromContextSeq > state.lastSeq + 1) {\n return \"retainedFromContextSeq must not skip unsummarized future context\";\n }\n if (plan.sourceFromSeq > plan.sourceToSeq) {\n return \"sourceFromSeq must be less than or equal to sourceToSeq\";\n }\n if (plan.retainedFromContextSeq <= plan.sourceToSeq) {\n return \"retainedFromContextSeq must start after the summarized source range\";\n }\n return undefined;\n};\n\nconst normalizeApproximateTokenPolicyOptions = (\n options: ApproximateTokenThresholdCompactionPolicyOptions,\n): NormalizedApproximateTokenPolicyOptions => ({\n policyId: CompactionPolicyId.make(options.policyId ?? \"approximate-token-threshold\"),\n thresholdTokens: positiveNumber(\n options.thresholdTokens ?? defaultCompactionThresholdTokens,\n \"thresholdTokens\",\n ),\n retainTailTokens: nonNegativeNumber(\n options.retainTailTokens ?? defaultCompactionRetainTailTokens,\n \"retainTailTokens\",\n ),\n minSummarizableTokens: nonNegativeNumber(\n options.minSummarizableTokens ?? defaultCompactionMinSummarizableTokens,\n \"minSummarizableTokens\",\n ),\n charsPerToken: positiveNumber(\n options.charsPerToken ?? defaultCompactionCharsPerToken,\n \"charsPerToken\",\n ),\n});\n\nconst positiveNumber = (value: number, name: string): number => {\n if (!Number.isFinite(value) || value <= 0) {\n throw new Error(`${name} must be a positive finite number`);\n }\n return value;\n};\n\nconst nonNegativeNumber = (value: number, name: string): number => {\n if (!Number.isFinite(value) || value < 0) {\n throw new Error(`${name} must be a non-negative finite number`);\n }\n return value;\n};\n\n/** Plan one Pi-style approximate-token compaction while keeping a recent tail verbatim. */\nconst planApproximateTokenCompaction = (\n state: ReducedState,\n context: ContextProjection,\n options: NormalizedApproximateTokenPolicyOptions,\n): CompactionPlan | undefined => {\n const messages = estimatedContextMessages(state);\n const totalChars = estimateCurrentPromptChars(state, context, messages);\n if (totalChars <= options.thresholdTokens * options.charsPerToken) {\n return undefined;\n }\n\n const currentRetainedFromSeq =\n context.currentSummary?.retainedFromContextSeq ?? SequenceNumber.make(0);\n const retainedFromSeq = selectRetainedFromSeq(messages, state.lastSeq, options);\n if (retainedFromSeq <= currentRetainedFromSeq) {\n return undefined;\n }\n\n const sourceMessages = messages.filter((message) => message.seq < retainedFromSeq);\n if (sourceMessages.length === 0) {\n return undefined;\n }\n\n const summarizableTokens = charsToTokens(\n sourceMessages.reduce((sum, message) => sum + message.chars, 0),\n options.charsPerToken,\n );\n if (summarizableTokens < options.minSummarizableTokens) {\n return undefined;\n }\n\n const sourceFromSeq =\n currentRetainedFromSeq > 0 ? currentRetainedFromSeq : sourceMessages[0]!.seq;\n const sourceToSeq = SequenceNumber.make(retainedFromSeq - 1);\n if (sourceFromSeq > sourceToSeq) {\n return undefined;\n }\n\n return CompactionPlan.make({\n policyId: options.policyId,\n sourceFromSeq,\n sourceToSeq,\n retainedFromContextSeq: retainedFromSeq,\n });\n};\n\nconst selectRetainedFromSeq = (\n messages: ReadonlyArray<EstimatedContextMessage>,\n lastSeq: SequenceNumber,\n options: NormalizedApproximateTokenPolicyOptions,\n): SequenceNumber => {\n if (options.retainTailTokens === 0) {\n return SequenceNumber.make(lastSeq + 1);\n }\n\n const retainTailChars = options.retainTailTokens * options.charsPerToken;\n let tailChars = 0;\n let retainedIndex = messages.length;\n for (let index = messages.length - 1; index >= 0; index--) {\n tailChars += messages[index]!.chars;\n retainedIndex = index;\n if (tailChars >= retainTailChars) {\n break;\n }\n }\n return retainedIndex >= messages.length\n ? SequenceNumber.make(lastSeq + 1)\n : messages[retainedIndex]!.seq;\n};\n\nconst estimateCurrentPromptChars = (\n state: ReducedState,\n context: ContextProjection,\n messages: ReadonlyArray<EstimatedContextMessage>,\n): number => {\n const systemChars = Array.from(state.messages.values()).reduce(\n (sum, message) => (message._tag === \"System\" ? sum + message.content.length : sum),\n 0,\n );\n const summaryChars =\n context.currentSummary === undefined\n ? 0\n : estimatePromptMessageChars(context.currentSummary.promptMessage);\n const messageChars = messages.reduce((sum, message) => sum + message.chars, 0);\n return systemChars + summaryChars + messageChars;\n};\n\nconst estimatedContextMessages = (state: ReducedState): ReadonlyArray<EstimatedContextMessage> =>\n durableMessageTranscript(state).map((message) => ({\n message,\n seq: messageSeq(message),\n chars: estimateDurableMessageChars(message) + estimateAssociatedToolChars(message, state),\n }));\n\nconst estimateDurableMessageChars = (message: DurableTranscriptMessage): number => {\n switch (message._tag) {\n case \"User\":\n case \"Steering\":\n return estimateUserContentChars(message.content);\n case \"Assistant\":\n case \"AssistantPartial\":\n return estimateAssistantPromptChars(message.promptParts, message.content);\n }\n};\n\nconst estimateAssociatedToolChars = (\n message: DurableTranscriptMessage,\n state: ReducedState,\n): number => {\n if (message._tag !== \"Assistant\" && message._tag !== \"AssistantPartial\") {\n return 0;\n }\n return toolPromptPartsForInference(message.inferenceId, state.toolCalls).reduce(\n (sum, part) => sum + estimatePromptPartChars(part),\n 0,\n );\n};\n\nconst messageSeq = (message: DurableTranscriptMessage): SequenceNumber =>\n message._tag === \"Steering\" ? message.consumedSeq : message.seq;\n\nconst charsToTokens = (chars: number, charsPerToken: number): number =>\n Math.ceil(chars / charsPerToken);\n\nconst buildSummaryPrompt = (input: CompactionExecutorInput): string | undefined => {\n const sourceText = serializeCompactionSource(input);\n if (sourceText.trim().length === 0) {\n return undefined;\n }\n\n const previousSummary =\n input.context.currentSummary === undefined\n ? \"\"\n : `<previous-summary>\\n${input.context.currentSummary.text}\\n</previous-summary>\\n\\n`;\n return `${previousSummary}<conversation>\\n${sourceText}\\n</conversation>\\n\\n${summaryPromptText}`;\n};\n\nconst serializeCompactionSource = (input: CompactionExecutorInput): string => {\n const lines: Array<string> = [];\n for (const message of durableMessageTranscript(input.state)) {\n const seq = messageSeq(message);\n if (seq < input.plan.sourceFromSeq || seq > input.plan.sourceToSeq) {\n continue;\n }\n lines.push(serializeDurableMessage(message));\n if (message._tag === \"Assistant\" || message._tag === \"AssistantPartial\") {\n for (const part of toolPromptPartsForInference(message.inferenceId, input.state.toolCalls)) {\n lines.push(serializeToolResultPart(part));\n }\n }\n }\n return lines.filter((line) => line.trim().length > 0).join(\"\\n\\n\");\n};\n\nconst serializeDurableMessage = (message: DurableTranscriptMessage): string => {\n switch (message._tag) {\n case \"User\":\n return `[User]: ${userContentText(message.content)}`;\n case \"Steering\":\n return `[User steering]: ${userContentText(message.content)}`;\n case \"Assistant\":\n case \"AssistantPartial\":\n return serializeAssistantMessage(message.promptParts, message.content);\n }\n};\n\nconst serializeAssistantMessage = (\n promptParts: ReadonlyArray<Prompt.AssistantMessagePart> | undefined,\n content: AssistantMessageContent,\n): string => {\n const parts = promptParts ?? assistantContentToPromptParts(content);\n const text: Array<string> = [];\n const reasoning: Array<string> = [];\n const toolCalls: Array<string> = [];\n const sideband: Array<string> = [];\n for (const part of parts) {\n switch (part.type) {\n case \"text\":\n text.push(part.text);\n break;\n case \"reasoning\":\n reasoning.push(part.text);\n break;\n case \"tool-call\":\n toolCalls.push(`${part.name}(${safeJsonStringify(part.params)})`);\n break;\n case \"file\":\n sideband.push(`file(${part.fileName ?? \"unnamed\"}, ${part.mediaType})`);\n break;\n case \"tool-result\":\n sideband.push(\n `tool-result(${part.name}, ${truncateForSummary(safeJsonStringify(part.result))})`,\n );\n break;\n case \"tool-approval-request\":\n sideband.push(`tool-approval-request(${part.approvalId}, ${part.toolCallId})`);\n break;\n }\n }\n return [\n reasoning.length === 0 ? \"\" : `[Assistant reasoning]: ${reasoning.join(\"\\n\")}`,\n text.length === 0 ? \"\" : `[Assistant]: ${text.join(\"\\n\")}`,\n toolCalls.length === 0 ? \"\" : `[Assistant tool calls]: ${toolCalls.join(\"; \")}`,\n sideband.length === 0 ? \"\" : `[Assistant context]: ${sideband.join(\"; \")}`,\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\");\n};\n\nconst serializeToolResultPart = (part: Prompt.ToolResultPart): string =>\n `[Tool result ${part.name}${part.isFailure ? \" failed\" : \"\"}]: ${truncateForSummary(\n safeJsonStringify(part.result),\n )}`;\n\nconst toolPromptPartsForInference = (\n inferenceId: InferenceId,\n toolCalls: ReducedState[\"toolCalls\"],\n): ReadonlyArray<Prompt.ToolResultPart> =>\n Array.from(toolCalls.values()).flatMap((tool): ReadonlyArray<Prompt.ToolResultPart> => {\n const { decision } = tool;\n if (decision === undefined || decision.inferenceId !== inferenceId) {\n return [];\n }\n if (decision._tag === \"Rejected\") {\n return decision.promptPart === undefined ? [] : [decision.promptPart];\n }\n const terminal = tool.terminal;\n if (terminal === undefined || terminal.promptPart === undefined) {\n return [];\n }\n return [terminal.promptPart];\n });\n\nconst assistantContentToPromptParts = (\n content: AssistantMessageContent,\n): ReadonlyArray<Prompt.AssistantMessagePart> => [\n ...(content.reasoning === undefined ? [] : [Prompt.reasoningPart({ text: content.reasoning })]),\n ...(content.text.length === 0 ? [] : [Prompt.textPart({ text: content.text })]),\n];\n\nconst estimateAssistantPromptChars = (\n promptParts: ReadonlyArray<Prompt.AssistantMessagePart> | undefined,\n content: AssistantMessageContent,\n): number =>\n (promptParts ?? assistantContentToPromptParts(content)).reduce(\n (sum, part) => sum + estimatePromptPartChars(part),\n 0,\n );\n\nconst estimateUserContentChars = (\n content: string | ReadonlyArray<Prompt.UserMessagePart>,\n): number =>\n typeof content === \"string\"\n ? content.length\n : content.reduce((sum, part) => sum + estimatePromptPartChars(part), 0);\n\nconst estimatePromptMessageChars = (message: Prompt.Message): number => {\n if (!(\"content\" in message)) {\n return 0;\n }\n const { content } = message;\n return typeof content === \"string\"\n ? content.length\n : content.reduce((sum, part) => sum + estimatePromptPartChars(part), 0);\n};\n\ntype PromptContentPart =\n | Prompt.UserMessagePart\n | Prompt.AssistantMessagePart\n | Prompt.ToolMessagePart;\n\nconst estimatePromptPartChars = (part: PromptContentPart): number => {\n switch (part.type) {\n case \"text\":\n return part.text.length;\n case \"reasoning\":\n return part.text.length;\n case \"file\":\n return (\n part.mediaType.length +\n (part.fileName?.length ?? 0) +\n (typeof part.data === \"string\"\n ? part.data.length\n : part.data instanceof URL\n ? part.data.toString().length\n : estimatedBinaryFileChars)\n );\n case \"tool-call\":\n return part.name.length + safeJsonStringify(part.params).length;\n case \"tool-result\":\n return part.name.length + safeJsonStringify(part.result).length;\n case \"tool-approval-response\":\n return part.approvalId.length + (part.reason?.length ?? 0) + 8;\n case \"tool-approval-request\":\n return part.approvalId.length + part.toolCallId.length;\n default:\n return safeJsonStringify(part).length;\n }\n};\n\nconst userContentText = (content: string | ReadonlyArray<Prompt.UserMessagePart>): string =>\n typeof content === \"string\"\n ? content\n : content\n .map((part) => {\n switch (part.type) {\n case \"text\":\n return part.text;\n case \"file\":\n return `[file ${part.fileName ?? \"unnamed\"} ${part.mediaType}]`;\n }\n })\n .join(\"\\n\");\n\nconst safeJsonStringify = (value: unknown): string => {\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n};\n\nconst truncateForSummary = (text: string, maxChars = 2_000): string => {\n if (text.length <= maxChars) {\n return text;\n }\n return `${text.slice(0, maxChars)}\\n\\n[... ${text.length - maxChars} more characters truncated]`;\n};\n\nconst formatUnknownError = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst estimatedBinaryFileChars = 4_800;\n\nconst summarizationSystemPrompt =\n \"You are a context summarization assistant. Do not continue the conversation. Only output the requested structured summary.\";\n\nconst summaryPromptText = `The messages above are conversation history selected for compaction. Create a cumulative context checkpoint summary that another LLM will use to continue the work.\n\nUse this exact structure:\n\n## Goal\n[What the user is trying to accomplish]\n\n## Constraints & Preferences\n- [Requirements, constraints, and preferences]\n\n## Progress\n### Done\n- [x] [Completed work]\n\n### In Progress\n- [ ] [Current unfinished work]\n\n### Blocked\n- [Current blockers, or \"(none)\"]\n\n## Key Decisions\n- **[Decision]**: [Rationale]\n\n## Next Steps\n1. [Concrete next step]\n\n## Critical Context\n- [Important facts, data, IDs, file paths, function names, and exact errors needed to continue]\n\nRules:\n- If <previous-summary> is present, preserve important existing facts and update it with the new conversation.\n- Keep the summary concise but sufficient to replace the compacted history.\n- Preserve exact file paths, tool names, identifiers, and error messages.\n- Do not answer questions from the conversation.`;\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,MAAa,oBAAoB,UAA0B;CACzD,MAAM,sBAAsB,eAAe,MAAM,YAAY,QAAQ;CACrE,MAAM,oBAAoB,eAAe,MAAM,YAAY,SAAS;CACpE,MAAM,wBAAwB,eAAe,MAAM,YAAY,UAAU;CACzE,MAAM,cACJ,eAAe,MAAM,YAAY,KAAK,KACtC,WAAW;EAAC;EAAqB;EAAmB;CAAqB,CAAC;CAC5E,MAAM,aAAa,eAAe,MAAM,aAAa,IAAI;CACzD,MAAM,kBAAkB,eAAe,MAAM,aAAa,SAAS;CACnE,MAAM,eACJ,eAAe,MAAM,aAAa,KAAK,KAAK,WAAW,CAAC,YAAY,eAAe,CAAC;CAEtF,OAAO,aAAa,KAAK;EACvB,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;EACnD,GAAI,sBAAsB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAkB;EAC/D,GAAI,0BAA0B,KAAA,IAAY,CAAC,IAAI,EAAE,sBAAsB;EACvE,GAAI,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa;EACrD,GAAI,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW;EACjD,GAAI,oBAAoB,KAAA,IA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AK;EACnB,KAAK,aACH,OAAO,KAAK,KAAK;EACnB,KAAK,QACH,OACE,KAAK,UAAU,UACd,KAAK,UAAU,UAAU,MACzB,OAAO,KAAK,SAAS,WAClB,KAAK,KAAK,SACV,KAAK,gBAAgB,MACnB,KAAK,KAAK,SAAS,EAAE,SACrB;EAEV,KAAK,aACH,OAAO,KAAK,KAAK,SAAS,kBAAkB,KAAK,MAAM,EAAE;EAC3D,KAAK,eACH,OAAO,KAAK,KAAK,SAAS,kBAAkB,KAAK,MAAM,EAAE;EAC3D,KAAK,0BACH,OAAO,KAAK,WAAW,UAAU,KAAK,QAAQ,UAAU,KAAK;EAC/D,KAAK,yBACH,OAAO,KAAK,WAAW,SAAS,KAAK,WAAW;EAClD,SACE,OAAO,kBAAkB,IAAI,EAAE;CACnC;AACF;AAEA,MAAM,mBAAmB,YACvB,OAAO,YAAY,WACf,UACA,QACG,KAAK,SAAS;CACb,QAAQ,KAAK,MAAb;EACE,KAAK,QACH,OAAO,KAAK;EACd,KAAK,QACH,OAAO,SAAS,KAAK,YAAY,UAAU,GAAG,KAAK,UAAU;CACjE;AACF,CAAC,EACA,KAAK,IAAI;AAElB,MAAM,qBAAqB,UAA2B;CACpD,IAAI;EACF,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAC9C,QAAQ;EACN,OAAO,OAAO,KAAK;CACrB;AACF;AAEA,MAAM,sBAAsB,MAAc,WAAW,QAAkB;CACrE,IAAI,KAAK,UAAU,UACjB,OAAO;CAET,OAAO,GAAG,KAAK,MAAM,GAAG,QAAQ,EAAE,WAAW,KAAK,SAAS,SAAS;AACtE;AAEA,MAAM,sBAAsB,UAC1B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAEvD,MAAM,2BAA2B;AAEjC,MAAM,4BACJ;AAEF,MAAM,oBAAoB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"durable-BGFvX7Mh.js","names":[],"sources":["../src/types/events/internal.ts","../src/types/events/durable.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nimport {\n DurableEventEnvelope,\n EphemeralEventEnvelope,\n EventType,\n effectDurableAgentNamespace,\n schemaV1,\n} from \"./envelope\";\n\n/** Build a built-in durable event schema from its fixed event type and payload schema. */\nexport const durableEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...DurableEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n\n/** Build a built-in ephemeral event schema from its fixed event type and payload schema. */\nexport const ephemeralEventSchema = <const Type extends EventType, Payload extends Schema.Top>(\n type: Type,\n payload: Payload,\n) =>\n Schema.Struct({\n ...EphemeralEventEnvelope.fields,\n namespace: Schema.Literal(effectDurableAgentNamespace),\n type: Schema.Literal(type),\n schemaVersion: Schema.Literal(schemaV1),\n payload,\n });\n","import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport * as Prompt from \"effect/unstable/ai/Prompt\";\n\nimport { EDACommand, UserMessageContent } from \"../commands\";\nimport {\n BaseStateId,\n CommandId,\n CompactionId,\n ContextVersion,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n SummaryId,\n ToolCallId,\n TurnId,\n} from \"../core\";\nimport {\n DurableEventEnvelope,\n FailurePayload,\n ModelSelectionPayload,\n ProviderPartId,\n SystemPromptText,\n ToolName,\n UsagePayload,\n effectDurableAgentNamespace,\n makeEventType,\n schemaV1,\n} from \"./envelope\";\nimport { durableEventSchema } from \"./internal\";\nimport { EDARunTrace, makeEDARunTrace } from \"../tracing\";\n\n/** Establishes a session's execution policy before its first run; not a model-switch operation. */\nexport const sessionConfiguredEventType = makeEventType(\"SessionConfigured\");\nexport const SessionConfiguredEvent = durableEventSchema(\n sessionConfiguredEventType,\n Schema.Struct({ modelSelection: ModelSelectionPayload }),\n);\nexport type SessionConfiguredEvent = typeof SessionConfiguredEvent.Type;\n\n/** Event type values for durable command lifecycle events. */\nexport const commandAdmittedEventType = makeEventType(\"CommandAdmitted\");\nexport const commandStartedEventType = makeEventType(\"CommandStarted\");\nexport const commandCompletedEventType = makeEventType(\"CommandCompleted\");\nexport const commandFailedEventType = makeEventType(\"CommandFailed\");\nexport const commandCancelledEventType = makeEventType(\"CommandCancelled\");\n\n/** Payload recorded when a command enters the durable session log. */\nexport const CommandAdmittedPayload = Schema.Struct({ command: EDACommand });\nexport type CommandAdmittedPayload = typeof CommandAdmittedPayload.Type;\nexport const CommandAdmittedEvent = durableEventSchema(\n commandAdmittedEventType,\n CommandAdmittedPayload,\n);\nexport type CommandAdmittedEvent = typeof CommandAdmittedEvent.Type;\n\n/** Payload recorded when command execution starts. */\nexport const CommandStartedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandStartedPayload = typeof CommandStartedPayload.Type;\nexport const CommandStartedEvent = durableEventSchema(\n commandStartedEventType,\n CommandStartedPayload,\n);\nexport type CommandStartedEvent = typeof CommandStartedEvent.Type;\n\n/** Payload recorded when command execution completes normally. */\nexport const CommandCompletedPayload = Schema.Struct({ commandId: CommandId });\nexport type CommandCompletedPayload = typeof CommandCompletedPayload.Type;\nexport const CommandCompletedEvent = durableEventSchema(\n commandCompletedEventType,\n CommandCompletedPayload,\n);\nexport type CommandCompletedEvent = typeof CommandCompletedEvent.Type;\n\n/** Payload recorded when command execution fails. */\nexport const CommandFailedPayload = Schema.Struct({ commandId: CommandId, error: FailurePayload });\nexport type CommandFailedPayload = typeof CommandFailedPayload.Type;\nexport const CommandFailedEvent = durableEventSchema(commandFailedEventType, CommandFailedPayload);\nexport type CommandFailedEvent = typeof CommandFailedEvent.Type;\n\n/** Payload recorded when a command is cancelled before completion. */\nexport const CommandCancelledPayload = Schema.Struct({\n commandId: CommandId,\n reason: Schema.String,\n});\nexport type CommandCancelledPayload = typeof CommandCancelledPayload.Type;\nexport const CommandCancelledEvent = durableEventSchema(\n commandCancelledEventType,\n CommandCancelledPayload,\n);\nexport type CommandCancelledEvent = typeof CommandCancelledEvent.Type;\n\n/** Durable event union for the command lifecycle. */\nexport const CommandEvent = Schema.Union([\n CommandAdmittedEvent,\n CommandStartedEvent,\n CommandCompletedEvent,\n CommandFailedEvent,\n CommandCancelledEvent,\n]);\nexport type CommandEvent = typeof CommandEvent.Type;\n\n/** Event type values for durable message lifecycle events. */\nexport const systemMessageCommittedEventType = makeEventType(\"SystemMessageCommitted\");\nexport const userMessageCommittedEventType = makeEventType(\"UserMessageCommitted\");\nexport const steeringMessageQueuedEventType = makeEventType(\"SteeringMessageQueued\");\nexport const steeringMessageCancelledEventType = makeEventType(\"SteeringMessageCancelled\");\nexport const userMessageSubmittedEventType = makeEventType(\"UserMessageSubmitted\");\nexport const userMessagePromotedEventType = makeEventType(\"UserMessagePromoted\");\nexport const userMessageCancelledEventType = makeEventType(\"UserMessageCancelled\");\nexport const messageQueuePausedEventType = makeEventType(\"MessageQueuePaused\");\nexport const pendingMessagesPausedEventType = makeEventType(\"PendingMessagesPaused\");\nexport const assistantMessageCommittedEventType = makeEventType(\"AssistantMessageCommitted\");\nexport const assistantMessageImportedEventType = makeEventType(\"AssistantMessageImported\");\nexport const assistantPartialCommittedEventType = makeEventType(\"AssistantPartialCommitted\");\n\n/** Semantic assistant content derived from canonical prompt parts for query convenience. */\nexport const AssistantMessageContent = Schema.Struct({\n text: Schema.String,\n reasoning: Schema.optionalKey(Schema.String),\n});\nexport type AssistantMessageContent = typeof AssistantMessageContent.Type;\n\n/** Exact assistant-role prompt parts sent to the model for cache-faithful replay. */\nexport const AssistantPromptPart = Schema.Union([\n Prompt.TextPart,\n Prompt.FilePart,\n Prompt.ReasoningPart,\n Prompt.ToolCallPart,\n Prompt.ToolResultPart,\n Prompt.ToolApprovalRequestPart,\n]);\nexport type AssistantPromptPart = typeof AssistantPromptPart.Type;\n\n/** Exact non-empty assistant-role prompt content sent to the model. */\nexport const AssistantPromptParts = Schema.NonEmptyArray(AssistantPromptPart);\nexport type AssistantPromptParts = typeof AssistantPromptParts.Type;\n\n/** Exact assistant tool-call prompt part with EDA-branded provider identity. */\nexport const ToolCallPromptPart = Schema.Struct({\n ...Prompt.ToolCallPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolCallPromptPart = typeof ToolCallPromptPart.Type;\n\n/** Exact tool-role prompt part sent to the model with EDA-branded provider identity. */\nexport const ToolPromptPart = Schema.Struct({\n ...Prompt.ToolResultPart.fields,\n id: ProviderPartId,\n name: ToolName,\n});\nexport type ToolPromptPart = typeof ToolPromptPart.Type;\n\n/** Payload recorded when app instructions become durable system-message context. */\nexport const SystemMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n content: SystemPromptText,\n});\nexport type SystemMessageCommittedPayload = typeof SystemMessageCommittedPayload.Type;\nexport const SystemMessageCommittedEvent = durableEventSchema(\n systemMessageCommittedEventType,\n SystemMessageCommittedPayload,\n);\nexport type SystemMessageCommittedEvent = typeof SystemMessageCommittedEvent.Type;\n\n/** Payload recorded when a user message becomes durable session context. */\nexport const UserMessageCommittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n content: UserMessageContent,\n});\nexport type UserMessageCommittedPayload = typeof UserMessageCommittedPayload.Type;\nexport const UserMessageCommittedEvent = durableEventSchema(\n userMessageCommittedEventType,\n UserMessageCommittedPayload,\n);\nexport type UserMessageCommittedEvent = typeof UserMessageCommittedEvent.Type;\n\n/** Payload recorded when steering context is queued for a future turn. */\nexport const SteeringMessageQueuedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n runId: RunId,\n content: UserMessageContent,\n});\nexport type SteeringMessageQueuedPayload = typeof SteeringMessageQueuedPayload.Type;\nexport const SteeringMessageQueuedEvent = durableEventSchema(\n steeringMessageQueuedEventType,\n SteeringMessageQueuedPayload,\n);\nexport type SteeringMessageQueuedEvent = typeof SteeringMessageQueuedEvent.Type;\n\n/** Payload recorded when queued steering will never be consumed by its target run. */\nexport const SteeringMessageCancelledPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n reason: Schema.String,\n});\nexport type SteeringMessageCancelledPayload = typeof SteeringMessageCancelledPayload.Type;\nexport const SteeringMessageCancelledEvent = durableEventSchema(\n steeringMessageCancelledEventType,\n SteeringMessageCancelledPayload,\n);\nexport type SteeringMessageCancelledEvent = typeof SteeringMessageCancelledEvent.Type;\n\nexport const UserMessageDisposition = Schema.Literals([\"queue\", \"steer\"]);\nexport type UserMessageDisposition = typeof UserMessageDisposition.Type;\n\nexport const UserMessageSubmittedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n disposition: UserMessageDisposition,\n content: UserMessageContent,\n});\nexport type UserMessageSubmittedPayload = typeof UserMessageSubmittedPayload.Type;\nexport const UserMessageSubmittedEvent = durableEventSchema(\n userMessageSubmittedEventType,\n UserMessageSubmittedPayload,\n);\nexport type UserMessageSubmittedEvent = typeof UserMessageSubmittedEvent.Type;\n\nexport const UserMessagePromotedPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n from: Schema.Literal(\"queue\"),\n to: Schema.Literal(\"steer\"),\n});\nexport type UserMessagePromotedPayload = typeof UserMessagePromotedPayload.Type;\nexport const UserMessagePromotedEvent = durableEventSchema(\n userMessagePromotedEventType,\n UserMessagePromotedPayload,\n);\nexport type UserMessagePromotedEvent = typeof UserMessagePromotedEvent.Type;\n\nexport const UserMessageCancellationReason = Schema.Literals([\n \"edit\",\n \"user-cancel\",\n \"clear-paused-queue\",\n]);\nexport type UserMessageCancellationReason = typeof UserMessageCancellationReason.Type;\nexport const UserMessageCancelledPayload = Schema.Struct({\n commandId: CommandId,\n messageId: MessageId,\n reason: UserMessageCancellationReason,\n});\nexport type UserMessageCancelledPayload = typeof UserMessageCancelledPayload.Type;\nexport const UserMessageCancelledEvent = durableEventSchema(\n userMessageCancelledEventType,\n UserMessageCancelledPayload,\n);\nexport type UserMessageCancelledEvent = typeof UserMessageCancelledEvent.Type;\n\n/** Legacy V1 pause fact retained for replay compatibility. */\nexport const MessageQueuePausedPayload = Schema.Struct({\n stopCommandId: CommandId,\n runId: RunId,\n messageIds: Schema.Array(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n});\nexport type MessageQueuePausedPayload = typeof MessageQueuePausedPayload.Type;\nexport const MessageQueuePausedEvent = durableEventSchema(\n messageQueuePausedEventType,\n MessageQueuePausedPayload,\n);\nexport type MessageQueuePausedEvent = typeof MessageQueuePausedEvent.Type;\n\nexport const PendingMessagesPausedPayload = Schema.Struct({\n interruptionCommandId: CommandId,\n runId: RunId,\n messageIds: Schema.NonEmptyArray(MessageId),\n reason: Schema.Literal(\"user-interrupted\"),\n});\nexport type PendingMessagesPausedPayload = typeof PendingMessagesPausedPayload.Type;\nexport const PendingMessagesPausedEvent = durableEventSchema(\n pendingMessagesPausedEventType,\n PendingMessagesPausedPayload,\n);\nexport type PendingMessagesPausedEvent = typeof PendingMessagesPausedEvent.Type;\n\n/** Payload recorded when an assistant message is durably finalized. */\nexport const AssistantMessageCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n});\nexport type AssistantMessageCommittedPayload = typeof AssistantMessageCommittedPayload.Type;\nexport const AssistantMessageCommittedEvent = durableEventSchema(\n assistantMessageCommittedEventType,\n AssistantMessageCommittedPayload,\n);\nexport type AssistantMessageCommittedEvent = typeof AssistantMessageCommittedEvent.Type;\n\n/** Payload recorded when pre-existing assistant context is imported from an external transport. */\nexport const AssistantMessageImportedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n});\nexport type AssistantMessageImportedPayload = typeof AssistantMessageImportedPayload.Type;\nexport const AssistantMessageImportedEvent = durableEventSchema(\n assistantMessageImportedEventType,\n AssistantMessageImportedPayload,\n);\nexport type AssistantMessageImportedEvent = typeof AssistantMessageImportedEvent.Type;\n\n/** Payload recorded when a partial assistant message is preserved durably. */\nexport const AssistantPartialCommittedPayload = Schema.Struct({\n messageId: MessageId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n promptParts: AssistantPromptParts,\n reason: Schema.String,\n});\nexport type AssistantPartialCommittedPayload = typeof AssistantPartialCommittedPayload.Type;\nexport const AssistantPartialCommittedEvent = durableEventSchema(\n assistantPartialCommittedEventType,\n AssistantPartialCommittedPayload,\n);\nexport type AssistantPartialCommittedEvent = typeof AssistantPartialCommittedEvent.Type;\n\n/** Durable event union for message commit/queue boundaries. */\nexport const MessageEvent = Schema.Union([\n SystemMessageCommittedEvent,\n UserMessageCommittedEvent,\n SteeringMessageQueuedEvent,\n SteeringMessageCancelledEvent,\n UserMessageSubmittedEvent,\n UserMessagePromotedEvent,\n UserMessageCancelledEvent,\n MessageQueuePausedEvent,\n PendingMessagesPausedEvent,\n AssistantMessageCommittedEvent,\n AssistantMessageImportedEvent,\n AssistantPartialCommittedEvent,\n]);\nexport type MessageEvent = typeof MessageEvent.Type;\n\n/** Event type values for durable run lifecycle events. */\nexport const runStartedEventType = makeEventType(\"RunStarted\");\nexport const runCompletedEventType = makeEventType(\"RunCompleted\");\nexport const runFailedEventType = makeEventType(\"RunFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `RunFailed` with an interruption-coded `FailurePayload` instead. */\nexport const runInterruptedEventType = makeEventType(\"RunInterrupted\");\n\n/** Payload recorded when a run starts with its intended model selection. */\nexport const RunStartedPayload = Schema.Struct({\n runId: RunId,\n commandIds: Schema.Array(CommandId),\n modelSelection: ModelSelectionPayload,\n trace: EDARunTrace.pipe(Schema.withConstructorDefault(Effect.sync(() => makeEDARunTrace()))),\n});\nexport type RunStartedPayload = typeof RunStartedPayload.Type;\nexport const RunStartedEvent = durableEventSchema(runStartedEventType, RunStartedPayload);\nexport type RunStartedEvent = typeof RunStartedEvent.Type;\n\n/** Payload recorded when a run completes. */\nexport const RunCompletedPayload = Schema.Struct({ runId: RunId });\nexport type RunCompletedPayload = typeof RunCompletedPayload.Type;\nexport const RunCompletedEvent = durableEventSchema(runCompletedEventType, RunCompletedPayload);\nexport type RunCompletedEvent = typeof RunCompletedEvent.Type;\n\n/** Payload recorded when a run fails. */\nexport const RunFailedPayload = Schema.Struct({ runId: RunId, error: FailurePayload });\nexport type RunFailedPayload = typeof RunFailedPayload.Type;\nexport const RunFailedEvent = durableEventSchema(runFailedEventType, RunFailedPayload);\nexport type RunFailedEvent = typeof RunFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New interruptions use `RunFailedPayload` with `error.code = \"run.interrupted\"`. */\nexport const RunInterruptedPayload = Schema.Struct({ runId: RunId, reason: Schema.String });\n/** @deprecated Use `RunFailedPayload` with interruption metadata. */\nexport type RunInterruptedPayload = typeof RunInterruptedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `RunFailedEvent`. */\nexport const RunInterruptedEvent = durableEventSchema(\n runInterruptedEventType,\n RunInterruptedPayload,\n);\n/** @deprecated Use `RunFailedEvent` with interruption metadata. */\nexport type RunInterruptedEvent = typeof RunInterruptedEvent.Type;\n\n/** Durable event union for run lifecycle boundaries. */\nexport const RunEvent = Schema.Union([\n RunStartedEvent,\n RunCompletedEvent,\n RunFailedEvent,\n RunInterruptedEvent,\n]);\nexport type RunEvent = typeof RunEvent.Type;\n\n/** Event type value for the durable barrier written after real startup recovery work. */\nexport const recoveryCompletedEventType = makeEventType(\"RecoveryCompleted\");\n\n/** Explicit relationship between an interrupted run and its startup-recovery replacement. */\nexport const RecoveryContinuation = Schema.Struct({\n commandId: CommandId,\n interruptedRunId: RunId,\n replacementRunId: RunId,\n});\nexport type RecoveryContinuation = typeof RecoveryContinuation.Type;\n\n/**\n * Durable completion barrier for a startup recovery transaction that repaired\n * unfinished state. Idle runtime construction does not emit this event.\n */\nexport const RecoveryCompletedPayload = Schema.Struct({\n trigger: Schema.Literal(\"runtime-restart\"),\n continuation: Schema.optionalKey(RecoveryContinuation),\n});\nexport type RecoveryCompletedPayload = typeof RecoveryCompletedPayload.Type;\nexport const RecoveryCompletedEvent = durableEventSchema(\n recoveryCompletedEventType,\n RecoveryCompletedPayload,\n);\nexport type RecoveryCompletedEvent = typeof RecoveryCompletedEvent.Type;\n\n/** Durable facts written only by the framework startup-recovery transaction. */\nexport const RecoveryEvent = RecoveryCompletedEvent;\nexport type RecoveryEvent = typeof RecoveryEvent.Type;\n\n/** Event type values for durable turn lifecycle events. */\nexport const turnStartedEventType = makeEventType(\"TurnStarted\");\nexport const turnCompletedEventType = makeEventType(\"TurnCompleted\");\nexport const turnFailedEventType = makeEventType(\"TurnFailed\");\n/** @deprecated Legacy terminal retained for durable replay. Emit `TurnFailed` with an interruption-coded `FailurePayload` instead. */\nexport const turnStoppedEventType = makeEventType(\"TurnStopped\");\n\n/** Payload recorded when one turn starts inside a run. */\nexport const TurnStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inputMessageIds: Schema.optionalKey(Schema.Array(MessageId)),\n});\nexport type TurnStartedPayload = typeof TurnStartedPayload.Type;\nexport const TurnStartedEvent = durableEventSchema(turnStartedEventType, TurnStartedPayload);\nexport type TurnStartedEvent = typeof TurnStartedEvent.Type;\n\n/** Payload recorded when one turn completes. */\nexport const TurnCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type TurnCompletedPayload = typeof TurnCompletedPayload.Type;\nexport const TurnCompletedEvent = durableEventSchema(turnCompletedEventType, TurnCompletedPayload);\nexport type TurnCompletedEvent = typeof TurnCompletedEvent.Type;\n\n/** Payload recorded when one turn fails. */\nexport const TurnFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n error: FailurePayload,\n});\nexport type TurnFailedPayload = typeof TurnFailedPayload.Type;\nexport const TurnFailedEvent = durableEventSchema(turnFailedEventType, TurnFailedPayload);\nexport type TurnFailedEvent = typeof TurnFailedEvent.Type;\n\n/** @deprecated Legacy payload retained for durable replay. New stops use `TurnFailedPayload` with `error.code = \"turn.interrupted\"`. */\nexport const TurnStoppedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n reason: Schema.String,\n});\n/** @deprecated Use `TurnFailedPayload` with interruption metadata. */\nexport type TurnStoppedPayload = typeof TurnStoppedPayload.Type;\n/** @deprecated Legacy event schema retained for durable replay; new producers emit `TurnFailedEvent`. */\nexport const TurnStoppedEvent = durableEventSchema(turnStoppedEventType, TurnStoppedPayload);\n/** @deprecated Use `TurnFailedEvent` with interruption metadata. */\nexport type TurnStoppedEvent = typeof TurnStoppedEvent.Type;\n\n/** Durable event union for turn lifecycle boundaries. */\nexport const TurnEvent = Schema.Union([\n TurnStartedEvent,\n TurnCompletedEvent,\n TurnFailedEvent,\n TurnStoppedEvent,\n]);\nexport type TurnEvent = typeof TurnEvent.Type;\n\n/** Event type values for durable model-inference lifecycle events. */\nexport const inferenceStartedEventType = makeEventType(\"InferenceStarted\");\nexport const inferenceCompletedEventType = makeEventType(\"InferenceCompleted\");\nexport const inferenceFailedEventType = makeEventType(\"InferenceFailed\");\n\n/** Payload recorded when one model inference starts for a turn. */\nexport const InferenceStartedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n});\nexport type InferenceStartedPayload = typeof InferenceStartedPayload.Type;\nexport const InferenceStartedEvent = durableEventSchema(\n inferenceStartedEventType,\n InferenceStartedPayload,\n);\nexport type InferenceStartedEvent = typeof InferenceStartedEvent.Type;\n\n/** Payload recorded when one model inference completes. */\nexport const InferenceCompletedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n finishReason: Schema.optionalKey(Schema.String),\n usage: Schema.optionalKey(UsagePayload),\n responseMetadata: Schema.optionalKey(Schema.Unknown),\n finishMetadata: Schema.optionalKey(Schema.Unknown),\n});\nexport type InferenceCompletedPayload = typeof InferenceCompletedPayload.Type;\nexport const InferenceCompletedEvent = durableEventSchema(\n inferenceCompletedEventType,\n InferenceCompletedPayload,\n);\nexport type InferenceCompletedEvent = typeof InferenceCompletedEvent.Type;\n\n/** Payload recorded when one model inference fails or is interrupted. */\nexport const InferenceFailedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n error: FailurePayload,\n});\nexport type InferenceFailedPayload = typeof InferenceFailedPayload.Type;\nexport const InferenceFailedEvent = durableEventSchema(\n inferenceFailedEventType,\n InferenceFailedPayload,\n);\nexport type InferenceFailedEvent = typeof InferenceFailedEvent.Type;\n\n/** Durable event union for canonical model-inference lifecycle boundaries. */\nexport const InferenceEvent = Schema.Union([\n InferenceStartedEvent,\n InferenceCompletedEvent,\n InferenceFailedEvent,\n]);\nexport type InferenceEvent = typeof InferenceEvent.Type;\n\n/** Event type values for durable tool lifecycle events. */\nexport const toolCallCreatedEventType = makeEventType(\"ToolCallCreated\");\nexport const toolCallRejectedEventType = makeEventType(\"ToolCallRejected\");\nexport const toolCallStartedEventType = makeEventType(\"ToolCallStarted\");\nexport const toolCallCompletedEventType = makeEventType(\"ToolCallCompleted\");\nexport const toolCallFailedEventType = makeEventType(\"ToolCallFailed\");\n\n/** Reason a model-requested tool call was rejected before execution. */\nexport const ToolCallRejectionReason = Schema.Literals([\"unknown-tool\", \"invalid-params\"]);\nexport type ToolCallRejectionReason = typeof ToolCallRejectionReason.Type;\n\n/** Exact synthetic tool-result feedback for a rejected model-requested tool call. */\nexport const ToolCallRejectionFeedback = Schema.Struct({\n message: Schema.String,\n reason: ToolCallRejectionReason,\n modelFeedback: Schema.NonEmptyString,\n});\nexport type ToolCallRejectionFeedback = typeof ToolCallRejectionFeedback.Type;\n\n/** Exact prompt part for a rejected model-requested tool call. */\nexport const ToolRejectionPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: ToolCallRejectionFeedback,\n});\nexport type ToolRejectionPromptPart = typeof ToolRejectionPromptPart.Type;\n\n/** Exact prompt part for a successful framework-owned tool result. */\nexport const ToolSuccessPromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(false),\n result: Schema.Unknown,\n});\nexport type ToolSuccessPromptPart = typeof ToolSuccessPromptPart.Type;\n\n/** Exact prompt part for a failed framework-owned tool result. */\nexport const ToolFailurePromptPart = Schema.Struct({\n ...ToolPromptPart.fields,\n isFailure: Schema.Literal(true),\n result: FailurePayload,\n});\nexport type ToolFailurePromptPart = typeof ToolFailurePromptPart.Type;\n\n/** Payload recorded once streamed tool parameters validate and become executable. */\nexport const ToolCallCreatedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolCallPromptPart,\n});\nexport type ToolCallCreatedPayload = typeof ToolCallCreatedPayload.Type;\nexport const ToolCallCreatedEvent = durableEventSchema(\n toolCallCreatedEventType,\n ToolCallCreatedPayload,\n);\nexport type ToolCallCreatedEvent = typeof ToolCallCreatedEvent.Type;\n\n/** Payload recorded when a model-requested tool call is not executable. */\nexport const ToolCallRejectedPayload = Schema.Struct({\n runId: RunId,\n turnId: TurnId,\n inferenceId: InferenceId,\n toolCallId: ToolCallId,\n promptPart: ToolRejectionPromptPart,\n});\nexport type ToolCallRejectedPayload = typeof ToolCallRejectedPayload.Type;\nexport const ToolCallRejectedEvent = durableEventSchema(\n toolCallRejectedEventType,\n ToolCallRejectedPayload,\n);\nexport type ToolCallRejectedEvent = typeof ToolCallRejectedEvent.Type;\n\n/** Payload recorded when framework-owned tool execution starts. */\nexport const ToolCallStartedPayload = Schema.Struct({ toolCallId: ToolCallId });\nexport type ToolCallStartedPayload = typeof ToolCallStartedPayload.Type;\nexport const ToolCallStartedEvent = durableEventSchema(\n toolCallStartedEventType,\n ToolCallStartedPayload,\n);\nexport type ToolCallStartedEvent = typeof ToolCallStartedEvent.Type;\n\n/** Payload recorded when a tool call completes with a result. */\nexport const ToolCallCompletedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n promptPart: ToolSuccessPromptPart,\n});\nexport type ToolCallCompletedPayload = typeof ToolCallCompletedPayload.Type;\nexport const ToolCallCompletedEvent = durableEventSchema(\n toolCallCompletedEventType,\n ToolCallCompletedPayload,\n);\nexport type ToolCallCompletedEvent = typeof ToolCallCompletedEvent.Type;\n\n/** Payload recorded when a tool call fails. */\nexport const ToolCallFailedPayload = Schema.Struct({\n toolCallId: ToolCallId,\n error: Schema.optionalKey(FailurePayload),\n promptPart: ToolFailurePromptPart,\n});\nexport type ToolCallFailedPayload = typeof ToolCallFailedPayload.Type;\nexport const ToolCallFailedEvent = durableEventSchema(\n toolCallFailedEventType,\n ToolCallFailedPayload,\n);\nexport type ToolCallFailedEvent = typeof ToolCallFailedEvent.Type;\n\n/** Durable event union for tool lifecycle boundaries. */\nexport const ToolCallEvent = Schema.Union([\n ToolCallCreatedEvent,\n ToolCallRejectedEvent,\n ToolCallStartedEvent,\n ToolCallCompletedEvent,\n ToolCallFailedEvent,\n]);\nexport type ToolCallEvent = typeof ToolCallEvent.Type;\n\n/** Event type values for durable stop-control events. */\nexport const stopTurnRequestedEventType = makeEventType(\"StopTurnRequested\");\nexport const stopTurnAppliedEventType = makeEventType(\"StopTurnApplied\");\n\n/** Payload recorded when a stop command targets active or future turn work. */\nexport const StopTurnRequestedPayload = Schema.Struct({\n commandId: CommandId,\n runId: Schema.optionalKey(RunId),\n turnId: Schema.optionalKey(TurnId),\n});\nexport type StopTurnRequestedPayload = typeof StopTurnRequestedPayload.Type;\nexport const StopTurnRequestedEvent = durableEventSchema(\n stopTurnRequestedEventType,\n StopTurnRequestedPayload,\n);\nexport type StopTurnRequestedEvent = typeof StopTurnRequestedEvent.Type;\n\n/** Payload recorded when a stop request has affected runtime work. */\nexport const StopTurnAppliedPayload = Schema.Struct({\n commandId: CommandId,\n runId: RunId,\n turnId: TurnId,\n inferenceId: Schema.optionalKey(InferenceId),\n});\nexport type StopTurnAppliedPayload = typeof StopTurnAppliedPayload.Type;\nexport const StopTurnAppliedEvent = durableEventSchema(\n stopTurnAppliedEventType,\n StopTurnAppliedPayload,\n);\nexport type StopTurnAppliedEvent = typeof StopTurnAppliedEvent.Type;\n\n/** Durable event union for stop-request lifecycle boundaries. */\nexport const StopControlEvent = Schema.Union([StopTurnRequestedEvent, StopTurnAppliedEvent]);\nexport type StopControlEvent = typeof StopControlEvent.Type;\n\n/** Event type values for durable context and compaction events. */\nexport const contextProjectedEventType = makeEventType(\"ContextProjected\");\nexport const compactionRequestedEventType = makeEventType(\"CompactionRequested\");\nexport const compactionStartedEventType = makeEventType(\"CompactionStarted\");\nexport const summaryCreatedEventType = makeEventType(\"SummaryCreated\");\nexport const compactionCompletedEventType = makeEventType(\"CompactionCompleted\");\nexport const contextRebasedEventType = makeEventType(\"ContextRebased\");\nexport const compactionFailedEventType = makeEventType(\"CompactionFailed\");\n\n/** Payload recorded when the prompt context projection advances. */\nexport const ContextProjectedPayload = Schema.Struct({\n contextVersion: ContextVersion,\n throughSeq: SequenceNumber,\n});\nexport type ContextProjectedPayload = typeof ContextProjectedPayload.Type;\nexport const ContextProjectedEvent = durableEventSchema(\n contextProjectedEventType,\n ContextProjectedPayload,\n);\nexport type ContextProjectedEvent = typeof ContextProjectedEvent.Type;\n\n/** Payload recorded when compaction is requested for a durable range. */\nexport const CompactionRequestedPayload = Schema.Struct({\n compactionId: CompactionId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n});\nexport type CompactionRequestedPayload = typeof CompactionRequestedPayload.Type;\nexport const CompactionRequestedEvent = durableEventSchema(\n compactionRequestedEventType,\n CompactionRequestedPayload,\n);\nexport type CompactionRequestedEvent = typeof CompactionRequestedEvent.Type;\n\n/** Payload recorded when compaction starts. */\nexport const CompactionStartedPayload = Schema.Struct({ compactionId: CompactionId });\nexport type CompactionStartedPayload = typeof CompactionStartedPayload.Type;\nexport const CompactionStartedEvent = durableEventSchema(\n compactionStartedEventType,\n CompactionStartedPayload,\n);\nexport type CompactionStartedEvent = typeof CompactionStartedEvent.Type;\n\n/** Payload recorded when a summary artifact is created. */\nexport const SummaryCreatedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n summary: Schema.Unknown,\n});\nexport type SummaryCreatedPayload = typeof SummaryCreatedPayload.Type;\nexport const SummaryCreatedEvent = durableEventSchema(\n summaryCreatedEventType,\n SummaryCreatedPayload,\n);\nexport type SummaryCreatedEvent = typeof SummaryCreatedEvent.Type;\n\n/** Payload recorded when compaction completes. */\nexport const CompactionCompletedPayload = Schema.Struct({\n compactionId: CompactionId,\n modelSelection: Schema.optionalKey(ModelSelectionPayload),\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type CompactionCompletedPayload = typeof CompactionCompletedPayload.Type;\nexport const CompactionCompletedEvent = durableEventSchema(\n compactionCompletedEventType,\n CompactionCompletedPayload,\n);\nexport type CompactionCompletedEvent = typeof CompactionCompletedEvent.Type;\n\n/** Payload recorded when durable context is rebased onto a summary. */\nexport const ContextRebasedPayload = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n contextVersion: ContextVersion,\n retainedFromContextSeq: SequenceNumber,\n});\nexport type ContextRebasedPayload = typeof ContextRebasedPayload.Type;\nexport const ContextRebasedEvent = durableEventSchema(\n contextRebasedEventType,\n ContextRebasedPayload,\n);\nexport type ContextRebasedEvent = typeof ContextRebasedEvent.Type;\n\n/** Payload recorded when compaction fails. */\nexport const CompactionFailedPayload = Schema.Struct({\n compactionId: CompactionId,\n error: FailurePayload,\n modelSelection: Schema.optionalKey(ModelSelectionPayload),\n usage: Schema.optionalKey(UsagePayload),\n});\nexport type CompactionFailedPayload = typeof CompactionFailedPayload.Type;\nexport const CompactionFailedEvent = durableEventSchema(\n compactionFailedEventType,\n CompactionFailedPayload,\n);\nexport type CompactionFailedEvent = typeof CompactionFailedEvent.Type;\n\n/** Durable event union for context projection and compaction boundaries. */\nexport const ContextAndCompactionEvent = Schema.Union([\n ContextProjectedEvent,\n CompactionRequestedEvent,\n CompactionStartedEvent,\n SummaryCreatedEvent,\n CompactionCompletedEvent,\n ContextRebasedEvent,\n CompactionFailedEvent,\n]);\nexport type ContextAndCompactionEvent = typeof ContextAndCompactionEvent.Type;\n\n/** Event type values for durable BaseState lifecycle events. */\nexport const baseStateRequestedEventType = makeEventType(\"BaseStateRequested\");\nexport const baseStateCreatedEventType = makeEventType(\"BaseStateCreated\");\nexport const baseStateFailedEventType = makeEventType(\"BaseStateFailed\");\n\n/** Payload recorded when durable BaseState generation is requested. */\nexport const BaseStateRequestedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n requestedThroughSeq: SequenceNumber,\n});\nexport type BaseStateRequestedPayload = typeof BaseStateRequestedPayload.Type;\nexport const BaseStateRequestedEvent = durableEventSchema(\n baseStateRequestedEventType,\n BaseStateRequestedPayload,\n);\nexport type BaseStateRequestedEvent = typeof BaseStateRequestedEvent.Type;\n\n/** Payload recorded when a BaseState snapshot is created. */\nexport const BaseStateCreatedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n coversThroughSeq: SequenceNumber,\n});\nexport type BaseStateCreatedPayload = typeof BaseStateCreatedPayload.Type;\nexport const BaseStateCreatedEvent = durableEventSchema(\n baseStateCreatedEventType,\n BaseStateCreatedPayload,\n);\nexport type BaseStateCreatedEvent = typeof BaseStateCreatedEvent.Type;\n\n/** Payload recorded when BaseState generation fails. */\nexport const BaseStateFailedPayload = Schema.Struct({\n baseStateId: BaseStateId,\n error: FailurePayload,\n});\nexport type BaseStateFailedPayload = typeof BaseStateFailedPayload.Type;\nexport const BaseStateFailedEvent = durableEventSchema(\n baseStateFailedEventType,\n BaseStateFailedPayload,\n);\nexport type BaseStateFailedEvent = typeof BaseStateFailedEvent.Type;\n\n/** Durable event union for BaseState lifecycle boundaries. */\nexport const BaseStateEvent = Schema.Union([\n BaseStateRequestedEvent,\n BaseStateCreatedEvent,\n BaseStateFailedEvent,\n]);\nexport type BaseStateEvent = typeof BaseStateEvent.Type;\n\n/** Built-in durable event union for framework-owned session facts. */\nexport const EDADurableEvent = Schema.Union([\n SessionConfiguredEvent,\n CommandEvent,\n MessageEvent,\n RunEvent,\n RecoveryEvent,\n TurnEvent,\n InferenceEvent,\n ToolCallEvent,\n StopControlEvent,\n ContextAndCompactionEvent,\n BaseStateEvent,\n]);\nexport type EDADurableEvent = typeof EDADurableEvent.Type;\n\n/** Current V1 framework durable event schema. Future versions route beside this alias. */\nexport const EDADurableEventV1 = EDADurableEvent;\nexport type EDADurableEventV1 = typeof EDADurableEventV1.Type;\n\n/** Decode one framework-owned durable event through the namespace/type/version router. */\nexport const decodeUnknownEDADurableEventSync = (input: unknown): EDADurableEvent => {\n const envelope = Schema.decodeUnknownSync(DurableEventEnvelope)(input);\n if (envelope.namespace !== effectDurableAgentNamespace) {\n throw new Error(\n `EDADurableEvent decoder only accepts namespace ${effectDurableAgentNamespace}; received ${envelope.namespace}`,\n );\n }\n\n switch (envelope.schemaVersion) {\n case schemaV1:\n return Schema.decodeUnknownSync(EDADurableEventV1)(envelope);\n default:\n throw new Error(\n `Unsupported EDA durable event schemaVersion ${envelope.schemaVersion} for ${envelope.type}`,\n );\n }\n};\n\n/** Effectful V1+ router for untrusted framework-owned durable event boundaries. */\nexport const decodeUnknownEDADurableEvent = (\n input: unknown,\n): Effect.Effect<EDADurableEvent, unknown> =>\n Effect.try({\n try: () => decodeUnknownEDADurableEventSync(input),\n catch: (error) => error,\n });\n"],"mappings":";;;;;;;;;AAWA,MAAa,sBACX,MACA,YAEA,OAAO,OAAO;CACZ,GAAG,qBAAqB;CACxB,WAAW,OAAO,QAAQ,2BAA2B;CACrD,MAAM,OAAO,QAAQ,IAAI;CACzB,eAAe,OAAO,QAAQ,QAAQ;CACtC;AACF,CAAC;;AAGH,MAAa,wBACX,MACA,YAEA,OAAO,OAAO;CACZ,GAAG,uBAAuB;CAC1B,WAAW,OAAO,QAAQ,2BAA2B;CACrD,MAAM,OAAO,QAAQ,IAAI;CACzB,eAAe,OAAO,QAAQ,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Aa,oBAAoB;;AAIjC,MAAa,oCAAoC,UAAoC;CACnF,MAAM,WAAW,OAAO,kBAAkB,oBAAoB,EAAE,KAAK;CACrE,IAAI,SAAS,cAAc,6BACzB,MAAM,IAAI,MACR,kDAAkD,4BAA4B,aAAa,SAAS,WACtG;CAGF,QAAQ,SAAS,eAAjB;EACE,KAAK,UACH,OAAO,OAAO,kBAAkB,iBAAiB,EAAE,QAAQ;EAC7D,SACE,MAAM,IAAI,MACR,+CAA+C,SAAS,cAAc,OAAO,SAAS,MACxF;CACJ;AACF;;AAGA,MAAa,gCACX,UAEA,OAAO,IAAI;CACT,WAAW,iCAAiC,KAAK;CACjD,QAAQ,UAAU;AACpB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"envelope-DxQzo5rN.js","names":[],"sources":["../src/types/events/envelope.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CorrelationId, EventId, Position, SessionId } from \"../core\";\nimport { EDAEventTrace, makeRootEDAEventTrace } from \"../tracing\";\n\n/** Event namespace, such as `effect-durable-agent`, `sandbox`, or `gia`. */\nexport const EventNamespace = Schema.NonEmptyString;\nexport type EventNamespace = typeof EventNamespace.Type;\n\n/** Event type within a namespace, such as `CommandAdmitted` or `TextDelta`. */\nexport const EventType = Schema.NonEmptyString;\nexport type EventType = typeof EventType.Type;\n\n/** Build a non-empty event type while preserving its string literal for exhaustive unions. */\nexport const makeEventType = <const Value extends string>(\n value: Value extends \"\" ? never : Value,\n) => value;\n\n/** Extract the literal name retained by `makeEventType`. */\nexport type EventTypeName<Type extends EventType> = Type;\n\n/** Provider-supplied stream part identity, preserved for correlation/debugging. */\nexport const ProviderPartId = Schema.NonEmptyString.pipe(Schema.brand(\"ProviderPartId\"));\nexport type ProviderPartId = typeof ProviderPartId.Type;\n\n/** Positive schema version for one namespace/type payload contract. */\nexport const SchemaVersion = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));\nexport type SchemaVersion = typeof SchemaVersion.Type;\n\n/** Milliseconds since unix epoch, represented as a non-negative integer. */\nexport const UnixEpochMillis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(\n Schema.brand(\"UnixEpochMillis\"),\n);\nexport type UnixEpochMillis = typeof UnixEpochMillis.Type;\n\n/** Whether an event is persisted or live-only. */\nexport const EventDurability = Schema.Literals([\"durable\", \"ephemeral\"]);\nexport type EventDurability = typeof EventDurability.Type;\n\n/** Common event envelope decoded before payload-specific schemas. */\nexport const EventEnvelope = Schema.Struct({\n namespace: EventNamespace,\n type: EventType,\n schemaVersion: SchemaVersion,\n durability: EventDurability,\n eventId: EventId,\n sessionId: SessionId,\n correlationId: Schema.optionalKey(CorrelationId),\n createdAtMs: UnixEpochMillis,\n trace: EDAEventTrace.pipe(Schema.withConstructorDefault(Effect.sync(makeRootEDAEventTrace))),\n payload: Schema.Unknown,\n});\nexport type EventEnvelope = typeof EventEnvelope.Type;\n\n/** Common envelope narrowed to committed durable events. */\nexport const DurableEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"durable\"),\n});\nexport type DurableEventEnvelope = typeof DurableEventEnvelope.Type;\n\n/** Common envelope narrowed to live-only ephemeral events. */\nexport const EphemeralEventEnvelope = Schema.Struct({\n ...EventEnvelope.fields,\n durability: Schema.Literal(\"ephemeral\"),\n});\nexport type EphemeralEventEnvelope = typeof EphemeralEventEnvelope.Type;\n\n/** Event delivered to live subscribers with its durable/ephemeral position. */\nexport const PositionedEvent = Schema.Struct({\n position: Position,\n event: EventEnvelope,\n});\nexport type PositionedEvent = typeof PositionedEvent.Type;\n\n/** Built-in framework event namespace. */\nexport const effectDurableAgentNamespace = EventNamespace.make(\"effect-durable-agent\");\n\n/** Initial schema version for built-in event payloads. */\nexport const schemaV1 = SchemaVersion.make(1);\n\n/** Non-negative integer used by token counts and similar counters. */\nexport const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\nexport type NonNegativeInt = typeof NonNegativeInt.Type;\n\n/** Registered tool name; plain non-empty text, not a lifecycle identity. */\nexport const ToolName = Schema.NonEmptyString;\nexport type ToolName = typeof ToolName.Type;\n\n/** Error details stored on failed lifecycle events. */\nexport const FailurePayload = Schema.Struct({\n message: Schema.String,\n code: Schema.optionalKey(Schema.String),\n details: Schema.optionalKey(Schema.Unknown),\n});\nexport type FailurePayload = typeof FailurePayload.Type;\n\n/** Token usage reported by a model provider when available. */\nexport const UsagePayload = Schema.Struct({\n inputTokens: Schema.optionalKey(NonNegativeInt),\n cachedInputTokens: Schema.optionalKey(NonNegativeInt),\n cacheWriteInputTokens: Schema.optionalKey(NonNegativeInt),\n outputTokens: Schema.optionalKey(NonNegativeInt),\n textTokens: Schema.optionalKey(NonNegativeInt),\n reasoningTokens: Schema.optionalKey(NonNegativeInt),\n});\nexport type UsagePayload = typeof UsagePayload.Type;\n\n/** Intended provider/model selection known before a model request starts. */\nexport const ModelSelectionPayload = Schema.Struct({\n provider: Schema.NonEmptyString,\n modelId: Schema.NonEmptyString,\n settings: Schema.optionalKey(Schema.Unknown),\n});\nexport type ModelSelectionPayload = typeof ModelSelectionPayload.Type;\n\n/** App-owned instructions inserted into model context as a system message. */\nexport const SystemPromptText = Schema.NonEmptyString;\nexport type SystemPromptText = typeof SystemPromptText.Type;\n"],"mappings":";;;;;;AAOA,MAAa,iBAAiB,OAAO;;AAIrC,MAAa,YAAY,OAAO;;AAIhC,MAAa,iBACX,UACG;;AAML,MAAa,iBAAiB,OAAO,eAAe,KAAK,OAAO,MAAM,gBAAgB,CAAC;;AAIvF,MAAa,gBAAgB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAI9E,MAAa,kBAAkB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,EAAE,KAChF,OAAO,MAAM,iBAAiB,CAChC;;AAIA,MAAa,kBAAkB,OAAO,SAAS,CAAC,WAAW,WAAW,CAAC;;AAIvE,MAAa,gBAAgB,OAAO,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services/session-context.ts","../src/services/event-factory.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nimport { SessionId } from \"../types/core\";\n\n/** Runtime-scoped session identity dependency. */\nexport interface SessionContextShape {\n /** The one session this runtime instance owns; fixed for the runtime lifetime. */\n readonly sessionId: SessionId;\n}\n\n/**\n * Identity of the session a runtime instance is bound to. One runtime = one\n * session, so services read the session here instead of threading `sessionId`\n * through every input struct.\n */\nexport class SessionContext extends Context.Service<SessionContext, SessionContextShape>()(\n \"@effect-durable-agent/SessionContext\",\n) {\n static readonly Live = (sessionId: SessionId) => Layer.succeed(SessionContext, { sessionId });\n}\n","import * as Clock from \"effect/Clock\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nimport {\n CommandAdmittedEvent,\n CommandAdmittedPayload,\n CommandCancelledEvent,\n CommandCancelledPayload,\n CommandCompletedEvent,\n CommandCompletedPayload,\n CommandFailedEvent,\n CommandFailedPayload,\n CommandStartedEvent,\n CommandStartedPayload,\n CompactionCompletedEvent,\n CompactionCompletedPayload,\n CompactionFailedEvent,\n CompactionFailedPayload,\n CompactionRequestedEvent,\n CompactionRequestedPayload,\n CompactionStartedEvent,\n CompactionStartedPayload,\n ContextRebasedEvent,\n ContextRebasedPayload,\n AssistantMessageCommittedEvent,\n AssistantMessageCommittedPayload,\n AssistantPartialCommittedEvent,\n AssistantPartialCommittedPayload,\n EventType,\n InferenceCompletedEvent,\n InferenceCompletedPayload,\n InferenceFailedEvent,\n InferenceFailedPayload,\n InferenceStartedEvent,\n InferenceStartedPayload,\n SummaryCreatedEvent,\n SummaryCreatedPayload,\n SystemMessageCommittedEvent,\n SystemMessageCommittedPayload,\n ReasoningDeltaEvent,\n ReasoningDeltaPayload,\n RecoveryCompletedEvent,\n RecoveryCompletedPayload,\n RunCompletedEvent,\n RunCompletedPayload,\n RunFailedEvent,\n RunFailedPayload,\n RunInterruptedEvent,\n RunInterruptedPayload,\n RunStartedEvent,\n RunStartedPayload,\n StopTurnAppliedEvent,\n StopTurnAppliedPayload,\n StopTurnRequestedEvent,\n StopTurnRequestedPayload,\n SteeringMessageCancelledEvent,\n SteeringMessageCancelledPayload,\n SteeringMessageQueuedEvent,\n SteeringMessageQueuedPayload,\n TextDeltaEvent,\n TextDeltaPayload,\n ToolCallCompletedEvent,\n ToolCallCompletedPayload,\n ToolCallCreatedEvent,\n ToolCallCreatedPayload,\n ToolCallFailedEvent,\n ToolCallFailedPayload,\n ToolCallRejectedEvent,\n ToolCallRejectedPayload,\n ToolCallStartedEvent,\n ToolCallStartedPayload,\n ToolParamsDeltaEvent,\n ToolParamsDeltaPayload,\n ToolParamsEndEvent,\n ToolParamsEndPayload,\n ToolParamsStartEvent,\n ToolParamsStartPayload,\n TurnCompletedEvent,\n TurnCompletedPayload,\n TurnFailedEvent,\n TurnFailedPayload,\n TurnStartedEvent,\n TurnStartedPayload,\n TurnStoppedEvent,\n TurnStoppedPayload,\n UnixEpochMillis,\n UserMessageCommittedEvent,\n UserMessageCommittedPayload,\n UserMessageSubmittedEvent,\n UserMessageSubmittedPayload,\n UserMessagePromotedEvent,\n UserMessagePromotedPayload,\n UserMessageCancelledEvent,\n UserMessageCancelledPayload,\n PendingMessagesPausedEvent,\n PendingMessagesPausedPayload,\n commandAdmittedEventType,\n commandCancelledEventType,\n commandCompletedEventType,\n commandFailedEventType,\n commandStartedEventType,\n compactionCompletedEventType,\n compactionFailedEventType,\n compactionRequestedEventType,\n compactionStartedEventType,\n contextRebasedEventType,\n assistantMessageCommittedEventType,\n assistantPartialCommittedEventType,\n effectDurableAgentNamespace,\n inferenceCompletedEventType,\n inferenceFailedEventType,\n inferenceStartedEventType,\n reasoningDeltaEventType,\n recoveryCompletedEventType,\n runCompletedEventType,\n runFailedEventType,\n runInterruptedEventType,\n runStartedEventType,\n schemaV1,\n steeringMessageCancelledEventType,\n summaryCreatedEventType,\n systemMessageCommittedEventType,\n steeringMessageQueuedEventType,\n stopTurnAppliedEventType,\n stopTurnRequestedEventType,\n textDeltaEventType,\n toolCallCompletedEventType,\n toolCallCreatedEventType,\n toolCallFailedEventType,\n toolCallRejectedEventType,\n toolCallStartedEventType,\n toolParamsDeltaEventType,\n toolParamsEndEventType,\n toolParamsStartEventType,\n turnCompletedEventType,\n turnFailedEventType,\n turnStartedEventType,\n turnStoppedEventType,\n userMessageCommittedEventType,\n userMessageSubmittedEventType,\n userMessagePromotedEventType,\n userMessageCancelledEventType,\n pendingMessagesPausedEventType,\n} from \"../types/events\";\nimport { IdGenerator } from \"./id-generator\";\nimport { SessionContext } from \"./session-context\";\nimport { currentOrRootEDAEventTrace } from \"./tracing\";\n\n/** Central envelope factory that stamps session id, event id, and current clock time. */\nexport interface EventFactoryShape {\n // Durable lifecycle events.\n readonly commandAdmitted: (\n payload: CommandAdmittedPayload,\n ) => Effect.Effect<CommandAdmittedEvent>;\n readonly commandStarted: (payload: CommandStartedPayload) => Effect.Effect<CommandStartedEvent>;\n readonly commandCompleted: (\n payload: CommandCompletedPayload,\n ) => Effect.Effect<CommandCompletedEvent>;\n readonly commandFailed: (payload: CommandFailedPayload) => Effect.Effect<CommandFailedEvent>;\n readonly commandCancelled: (\n payload: CommandCancelledPayload,\n ) => Effect.Effect<CommandCancelledEvent>;\n readonly systemMessageCommitted: (\n payload: SystemMessageCommittedPayload,\n ) => Effect.Effect<SystemMessageCommittedEvent>;\n readonly userMessageCommitted: (\n payload: UserMessageCommittedPayload,\n ) => Effect.Effect<UserMessageCommittedEvent>;\n readonly userMessageSubmitted: (\n payload: UserMessageSubmittedPayload,\n ) => Effect.Effect<UserMessageSubmittedEvent>;\n readonly userMessagePromoted: (\n payload: UserMessagePromotedPayload,\n ) => Effect.Effect<UserMessagePromotedEvent>;\n readonly userMessageCancelled: (\n payload: UserMessageCancelledPayload,\n ) => Effect.Effect<UserMessageCancelledEvent>;\n readonly pendingMessagesPaused: (\n payload: PendingMessagesPausedPayload,\n ) => Effect.Effect<PendingMessagesPausedEvent>;\n readonly steeringMessageQueued: (\n payload: SteeringMessageQueuedPayload,\n ) => Effect.Effect<SteeringMessageQueuedEvent>;\n readonly steeringMessageCancelled: (\n payload: SteeringMessageCancelledPayload,\n ) => Effect.Effect<SteeringMessageCancelledEvent>;\n readonly assistantMessageCommitted: (\n payload: AssistantMessageCommittedPayload,\n ) => Effect.Effect<AssistantMessageCommittedEvent>;\n readonly assistantPartialCommitted: (\n payload: AssistantPartialCommittedPayload,\n ) => Effect.Effect<AssistantPartialCommittedEvent>;\n readonly runStarted: (payload: RunStartedPayload) => Effect.Effect<RunStartedEvent>;\n readonly runCompleted: (payload: RunCompletedPayload) => Effect.Effect<RunCompletedEvent>;\n readonly runFailed: (payload: RunFailedPayload) => Effect.Effect<RunFailedEvent>;\n readonly recoveryCompleted: (\n payload: RecoveryCompletedPayload,\n ) => Effect.Effect<RecoveryCompletedEvent>;\n /** @deprecated Emit `runFailed` with `error.code = \"run.interrupted\"`. Retained for legacy event construction only. */\n readonly runInterrupted: (payload: RunInterruptedPayload) => Effect.Effect<RunInterruptedEvent>;\n readonly turnStarted: (payload: TurnStartedPayload) => Effect.Effect<TurnStartedEvent>;\n readonly turnCompleted: (payload: TurnCompletedPayload) => Effect.Effect<TurnCompletedEvent>;\n readonly turnFailed: (payload: TurnFailedPayload) => Effect.Effect<TurnFailedEvent>;\n /** @deprecated Emit `turnFailed` with `error.code = \"turn.interrupted\"`. Retained for legacy event construction only. */\n readonly turnStopped: (payload: TurnStoppedPayload) => Effect.Effect<TurnStoppedEvent>;\n readonly inferenceStarted: (\n payload: InferenceStartedPayload,\n ) => Effect.Effect<InferenceStartedEvent>;\n readonly inferenceCompleted: (\n payload: InferenceCompletedPayload,\n ) => Effect.Effect<InferenceCompletedEvent>;\n readonly inferenceFailed: (\n payload: InferenceFailedPayload,\n ) => Effect.Effect<InferenceFailedEvent>;\n readonly toolCallCreated: (\n payload: ToolCallCreatedPayload,\n ) => Effect.Effect<ToolCallCreatedEvent>;\n readonly toolCallRejected: (\n payload: ToolCallRejectedPayload,\n ) => Effect.Effect<ToolCallRejectedEvent>;\n readonly toolCallStarted: (\n payload: ToolCallStartedPayload,\n ) => Effect.Effect<ToolCallStartedEvent>;\n readonly toolCallCompleted: (\n payload: ToolCallCompletedPayload,\n ) => Effect.Effect<ToolCallCompletedEvent>;\n readonly toolCallFailed: (payload: ToolCallFailedPayload) => Effect.Effect<ToolCallFailedEvent>;\n readonly stopTurnRequested: (\n payload: StopTurnRequestedPayload,\n ) => Effect.Effect<StopTurnRequestedEvent>;\n readonly stopTurnApplied: (\n payload: StopTurnAppliedPayload,\n ) => Effect.Effect<StopTurnAppliedEvent>;\n readonly compactionRequested: (\n payload: CompactionRequestedPayload,\n ) => Effect.Effect<CompactionRequestedEvent>;\n readonly compactionStarted: (\n payload: CompactionStartedPayload,\n ) => Effect.Effect<CompactionStartedEvent>;\n readonly summaryCreated: (payload: SummaryCreatedPayload) => Effect.Effect<SummaryCreatedEvent>;\n readonly contextRebased: (payload: ContextRebasedPayload) => Effect.Effect<ContextRebasedEvent>;\n readonly compactionCompleted: (\n payload: CompactionCompletedPayload,\n ) => Effect.Effect<CompactionCompletedEvent>;\n readonly compactionFailed: (\n payload: CompactionFailedPayload,\n ) => Effect.Effect<CompactionFailedEvent>;\n // Ephemeral live-only events.\n readonly textDelta: (payload: TextDeltaPayload) => Effect.Effect<TextDeltaEvent>;\n readonly reasoningDelta: (payload: ReasoningDeltaPayload) => Effect.Effect<ReasoningDeltaEvent>;\n readonly toolParamsStart: (\n payload: ToolParamsStartPayload,\n ) => Effect.Effect<ToolParamsStartEvent>;\n readonly toolParamsDelta: (\n payload: ToolParamsDeltaPayload,\n ) => Effect.Effect<ToolParamsDeltaEvent>;\n readonly toolParamsEnd: (payload: ToolParamsEndPayload) => Effect.Effect<ToolParamsEndEvent>;\n}\n\n/**\n * The one construction path for built-in event envelopes. It closes over the\n * session identity, mints `eventId`s, and stamps `createdAtMs` from the\n * ambient `Clock`, so lifecycle code provides only the payload.\n */\nexport class EventFactory extends Context.Service<EventFactory, EventFactoryShape>()(\n \"@effect-durable-agent/EventFactory\",\n) {\n static readonly Live = Layer.effect(\n EventFactory,\n Effect.gen(function* () {\n const { sessionId } = yield* SessionContext;\n const ids = yield* IdGenerator;\n\n const envelope = (durability: \"durable\" | \"ephemeral\") =>\n Effect.gen(function* () {\n const eventId = yield* ids.makeEventId();\n const nowMs = yield* Clock.currentTimeMillis;\n const trace = yield* currentOrRootEDAEventTrace;\n return {\n namespace: effectDurableAgentNamespace,\n schemaVersion: schemaV1,\n durability,\n eventId,\n sessionId,\n createdAtMs: UnixEpochMillis.make(nowMs),\n trace,\n };\n });\n\n const event =\n (durability: \"durable\" | \"ephemeral\") =>\n <Payload, Event>(schema: { readonly make: (input: never) => Event }, type: EventType) =>\n (payload: Payload): Effect.Effect<Event> =>\n Effect.map(envelope(durability), (fields) =>\n schema.make({ ...fields, type, payload } as never),\n );\n const durable = event(\"durable\");\n const ephemeral = event(\"ephemeral\");\n\n return {\n commandAdmitted: durable<CommandAdmittedPayload, CommandAdmittedEvent>(\n CommandAdmittedEvent,\n commandAdmittedEventType,\n ),\n commandStarted: durable<CommandStartedPayload, CommandStartedEvent>(\n CommandStartedEvent,\n commandStartedEventType,\n ),\n commandCompleted: durable<CommandCompletedPayload, CommandCompletedEvent>(\n CommandCompletedEvent,\n commandCompletedEventType,\n ),\n commandFailed: durable<CommandFailedPayload, CommandFailedEvent>(\n CommandFailedEvent,\n commandFailedEventType,\n ),\n commandCancelled: durable<CommandCancelledPayload, CommandCancelledEvent>(\n CommandCancelledEvent,\n commandCancelledEventType,\n ),\n systemMessageCommitted: durable<SystemMessageCommittedPayload, SystemMessageCommittedEvent>(\n SystemMessageCommittedEvent,\n systemMessageCommittedEventType,\n ),\n userMessageCommitted: durable<UserMessageCommittedPayload, UserMessageCommittedEvent>(\n UserMessageCommittedEvent,\n userMessageCommittedEventType,\n ),\n userMessageSubmitted: durable<UserMessageSubmittedPayload, UserMessageSubmittedEvent>(\n UserMessageSubmittedEvent,\n userMessageSubmittedEventType,\n ),\n userMessagePromoted: durable<UserMessagePromotedPayload, UserMessagePromotedEvent>(\n UserMessagePromotedEvent,\n userMessagePromotedEventType,\n ),\n userMessageCancelled: durable<UserMessageCancelledPayload, UserMessageCancelledEvent>(\n UserMessageCancelledEvent,\n userMessageCancelledEventType,\n ),\n pendingMessagesPaused: durable<PendingMessagesPausedPayload, PendingMessagesPausedEvent>(\n PendingMessagesPausedEvent,\n pendingMessagesPausedEventType,\n ),\n steeringMessageQueued: durable<SteeringMessageQueuedPayload, SteeringMessageQueuedEvent>(\n SteeringMessageQueuedEvent,\n steeringMessageQueuedEventType,\n ),\n steeringMessageCancelled: durable<\n SteeringMessageCancelledPayload,\n SteeringMessageCancelledEvent\n >(SteeringMessageCancelledEvent, steeringMessageCancelledEventType),\n assistantMessageCommitted: durable<\n AssistantMessageCommittedPayload,\n AssistantMessageCommittedEvent\n >(AssistantMessageCommittedEvent, assistantMessageCommittedEventType),\n assistantPartialCommitted: durable<\n AssistantPartialCommittedPayload,\n AssistantPartialCommittedEvent\n >(AssistantPartialCommittedEvent, assistantPartialCommittedEventType),\n runStarted: durable<RunStartedPayload, RunStartedEvent>(\n RunStartedEvent,\n runStartedEventType,\n ),\n runCompleted: durable<RunCompletedPayload, RunCompletedEvent>(\n RunCompletedEvent,\n runCompletedEventType,\n ),\n runFailed: durable<RunFailedPayload, RunFailedEvent>(RunFailedEvent, runFailedEventType),\n recoveryCompleted: durable<RecoveryCompletedPayload, RecoveryCompletedEvent>(\n RecoveryCompletedEvent,\n recoveryCompletedEventType,\n ),\n runInterrupted: durable<RunInterruptedPayload, RunInterruptedEvent>(\n RunInterruptedEvent,\n runInterruptedEventType,\n ),\n turnStarted: durable<TurnStartedPayload, TurnStartedEvent>(\n TurnStartedEvent,\n turnStartedEventType,\n ),\n turnCompleted: durable<TurnCompletedPayload, TurnCompletedEvent>(\n TurnCompletedEvent,\n turnCompletedEventType,\n ),\n turnFailed: durable<TurnFailedPayload, TurnFailedEvent>(\n TurnFailedEvent,\n turnFailedEventType,\n ),\n turnStopped: durable<TurnStoppedPayload, TurnStoppedEvent>(\n TurnStoppedEvent,\n turnStoppedEventType,\n ),\n inferenceStarted: durable<InferenceStartedPayload, InferenceStartedEvent>(\n InferenceStartedEvent,\n inferenceStartedEventType,\n ),\n inferenceCompleted: durable<InferenceCompletedPayload, InferenceCompletedEvent>(\n InferenceCompletedEvent,\n inferenceCompletedEventType,\n ),\n inferenceFailed: durable<InferenceFailedPayload, InferenceFailedEvent>(\n InferenceFailedEvent,\n inferenceFailedEventType,\n ),\n toolCallCreated: durable<ToolCallCreatedPayload, ToolCallCreatedEvent>(\n ToolCallCreatedEvent,\n toolCallCreatedEventType,\n ),\n toolCallRejected: durable<ToolCallRejectedPayload, ToolCallRejectedEvent>(\n ToolCallRejectedEvent,\n toolCallRejectedEventType,\n ),\n toolCallStarted: durable<ToolCallStartedPayload, ToolCallStartedEvent>(\n ToolCallStartedEvent,\n toolCallStartedEventType,\n ),\n toolCallCompleted: durable<ToolCallCompletedPayload, ToolCallCompletedEvent>(\n ToolCallCompletedEvent,\n toolCallCompletedEventType,\n ),\n toolCallFailed: durable<ToolCallFailedPayload, ToolCallFailedEvent>(\n ToolCallFailedEvent,\n toolCallFailedEventType,\n ),\n stopTurnRequested: durable<StopTurnRequestedPayload, StopTurnRequestedEvent>(\n StopTurnRequestedEvent,\n stopTurnRequestedEventType,\n ),\n stopTurnApplied: durable<StopTurnAppliedPayload, StopTurnAppliedEvent>(\n StopTurnAppliedEvent,\n stopTurnAppliedEventType,\n ),\n compactionRequested: durable<CompactionRequestedPayload, CompactionRequestedEvent>(\n CompactionRequestedEvent,\n compactionRequestedEventType,\n ),\n compactionStarted: durable<CompactionStartedPayload, CompactionStartedEvent>(\n CompactionStartedEvent,\n compactionStartedEventType,\n ),\n summaryCreated: durable<SummaryCreatedPayload, SummaryCreatedEvent>(\n SummaryCreatedEvent,\n summaryCreatedEventType,\n ),\n contextRebased: durable<ContextRebasedPayload, ContextRebasedEvent>(\n ContextRebasedEvent,\n contextRebasedEventType,\n ),\n compactionCompleted: durable<CompactionCompletedPayload, CompactionCompletedEvent>(\n CompactionCompletedEvent,\n compactionCompletedEventType,\n ),\n compactionFailed: durable<CompactionFailedPayload, CompactionFailedEvent>(\n CompactionFailedEvent,\n compactionFailedEventType,\n ),\n textDelta: ephemeral<TextDeltaPayload, TextDeltaEvent>(TextDeltaEvent, textDeltaEventType),\n reasoningDelta: ephemeral<ReasoningDeltaPayload, ReasoningDeltaEvent>(\n ReasoningDeltaEvent,\n reasoningDeltaEventType,\n ),\n toolParamsStart: ephemeral<ToolParamsStartPayload, ToolParamsStartEvent>(\n ToolParamsStartEvent,\n toolParamsStartEventType,\n ),\n toolParamsDelta: ephemeral<ToolParamsDeltaPayload, ToolParamsDeltaEvent>(\n ToolParamsDeltaEvent,\n toolParamsDeltaEventType,\n ),\n toolParamsEnd: ephemeral<ToolParamsEndPayload, ToolParamsEndEvent>(\n ToolParamsEndEvent,\n toolParamsEndEventType,\n ),\n };\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,iBAAb,MAAa,uBAAuB,QAAQ,QAA6C,EACvF,sCACF,EAAE;CACA,OAAgB,QAAQ,cAAyB,MAAM,QAAQ,gBAAgB,EAAE,UAAU,CAAC;AAC9F;;;;;;;;ACsPA,IAAa,eAAb,MAAa,qBAAqB,QAAQ,QAAyC,EACjF,oCACF,EAAE;CACA,OAAgB,OAAO,MAAM,OAC3B,cACA,OAAO,IAAI,aAAa;EACtB,MAAM,EAAE,cAAc,OAAO;EAC7B,MAAM,MAAM,OAAO;EAEnB,MAAM,YAAY,eAChB,OAAO,IAAI,aAAa;GACtB,MAAM,UAAU,OAAO,IAAI,YAAY;GACvC,MAAM,QAAQ,OAAO,MAAM;GAC3B,MAAM,QAAQ,OAAO;GACrB,OAAO;IACL,WAAW;IACX,eAAe;IACf;IACA;IACA;IACA,aAAa,gBAAgB,KAAK,KAAK;IACvC;GACF;EACF,CAAC;EAEH,MAAM,SACH,gBACgB,QAAoD,UACpE,YACC,OAAO,IAAI,SAAS,UAAU,IAAI,WAChC,OAAO,KAAK;GAAE,GAAG;GAAQ;GAAM;EAAQ,CAAU,CACnD;EACJ,MAAM,UAAU,MAAM,SAAS;EAC/B,MAAM,YAAY,MAAM,WAAW;EAEnC,OAAO;GACL,iBAAiB,QACf,sBACA,wBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,sBAAsB,QACpB,2BACA,6BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,uBAAuB,QACrB,4BACA,8BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,2BAA2B,QAGzB,gCAAgC,kCAAkC;GACpE,YAAY,QACV,iBACA,mBACF;GACA,cAAc,QACZ,mBACA,qBACF;GACA,WAAW,QAA0C,gBAAgB,kBAAkB;GACvF,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,eAAe,QACb,oBACA,sBACF;GACA,YAAY,QACV,iBACA,mBACF;GACA,aAAa,QACX,kBACA,oBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,oBAAoB,QAClB,yBACA,2BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,iBAAiB,QACf,sBACA,wBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,mBAAmB,QACjB,wBACA,0BACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,gBAAgB,QACd,qBACA,uBACF;GACA,qBAAqB,QACnB,0BACA,4BACF;GACA,kBAAkB,QAChB,uBACA,yBACF;GACA,WAAW,UAA4C,gBAAgB,kBAAkB;GACzF,gBAAgB,UACd,qBACA,uBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,iBAAiB,UACf,sBACA,wBACF;GACA,eAAe,UACb,oBACA,sBACF;EACF;CACF,CAAC,CACH;AACF"}
@@ -1,87 +0,0 @@
1
- import { h as SessionId } from "./core-CYT6DBaS.js";
2
- import { $ as PendingMessagesPausedEvent, $t as TurnStoppedEvent, A as CompactionFailedEvent, At as ToolCallCreatedEvent, B as ContextRebasedPayload, Bt as ToolCallStartedEvent, Ct as StopTurnRequestedPayload, D as CommandStartedPayload, Dt as SystemMessageCommittedPayload, E as CommandStartedEvent, Et as SystemMessageCommittedEvent, F as CompactionStartedPayload, It as ToolCallRejectedEvent, J as InferenceStartedEvent, K as InferenceFailedEvent, Kt as TurnCompletedEvent, Lt as ToolCallRejectedPayload, M as CompactionRequestedEvent, N as CompactionRequestedPayload, Nt as ToolCallFailedEvent, O as CompactionCompletedEvent, Ot as ToolCallCompletedEvent, P as CompactionStartedEvent, Pt as ToolCallFailedPayload, Qt as TurnStartedPayload, S as CommandCompletedPayload, St as StopTurnRequestedEvent, T as CommandFailedPayload, Tt as SummaryCreatedPayload, U as InferenceCompletedEvent, Vt as ToolCallStartedPayload, W as InferenceCompletedPayload, Xt as TurnFailedPayload, Y as InferenceStartedPayload, Yt as TurnFailedEvent, Zt as TurnStartedEvent, _ as CommandAdmittedEvent, _t as SteeringMessageQueuedEvent, an as UserMessageCommittedPayload, at as RunCompletedEvent, b as CommandCancelledPayload, bt as StopTurnAppliedEvent, cn as UserMessagePromotedPayload, ct as RunFailedEvent, dt as RunInterruptedPayload, en as TurnStoppedPayload, et as PendingMessagesPausedPayload, ft as RunStartedEvent, gt as SteeringMessageCancelledPayload, ht as SteeringMessageCancelledEvent, in as UserMessageCommittedEvent, j as CompactionFailedPayload, jt as ToolCallCreatedPayload, k as CompactionCompletedPayload, kt as ToolCallCompletedPayload, ln as UserMessageSubmittedEvent, lt as RunFailedPayload, n as AssistantMessageCommittedPayload, nn as UserMessageCancelledEvent, nt as RecoveryCompletedPayload, o as AssistantPartialCommittedEvent, ot as RunCompletedPayload, pt as RunStartedPayload, q as InferenceFailedPayload, qt as TurnCompletedPayload, rn as UserMessageCancelledPayload, s as AssistantPartialCommittedPayload, sn as UserMessagePromotedEvent, t as AssistantMessageCommittedEvent, tt as RecoveryCompletedEvent, un as UserMessageSubmittedPayload, ut as RunInterruptedEvent, v as CommandAdmittedPayload, vt as SteeringMessageQueuedPayload, w as CommandFailedEvent, wt as SummaryCreatedEvent, x as CommandCompletedEvent, xt as StopTurnAppliedPayload, y as CommandCancelledEvent, z as ContextRebasedEvent } from "./durable-br2C1bWK.js";
3
- import { d as ToolParamsDeltaEvent, f as ToolParamsDeltaPayload, g as ToolParamsStartPayload, h as ToolParamsStartEvent, i as ReasoningDeltaPayload, l as TextDeltaEvent, m as ToolParamsEndPayload, p as ToolParamsEndEvent, r as ReasoningDeltaEvent, u as TextDeltaPayload } from "./events-LZFNoESe.js";
4
- import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
5
- import * as Context from "effect/Context";
6
- import * as Effect from "effect/Effect";
7
- import * as Layer from "effect/Layer";
8
-
9
- //#region src/services/session-context.d.ts
10
- /** Runtime-scoped session identity dependency. */
11
- interface SessionContextShape {
12
- /** The one session this runtime instance owns; fixed for the runtime lifetime. */
13
- readonly sessionId: SessionId;
14
- }
15
- declare const SessionContext_base: Context.ServiceClass<SessionContext, "@effect-durable-agent/SessionContext", SessionContextShape>;
16
- /**
17
- * Identity of the session a runtime instance is bound to. One runtime = one
18
- * session, so services read the session here instead of threading `sessionId`
19
- * through every input struct.
20
- */
21
- declare class SessionContext extends SessionContext_base {
22
- static readonly Live: (sessionId: SessionId) => Layer.Layer<SessionContext, never, never>;
23
- }
24
- //#endregion
25
- //#region src/services/event-factory.d.ts
26
- /** Central envelope factory that stamps session id, event id, and current clock time. */
27
- interface EventFactoryShape {
28
- readonly commandAdmitted: (payload: CommandAdmittedPayload) => Effect.Effect<CommandAdmittedEvent>;
29
- readonly commandStarted: (payload: CommandStartedPayload) => Effect.Effect<CommandStartedEvent>;
30
- readonly commandCompleted: (payload: CommandCompletedPayload) => Effect.Effect<CommandCompletedEvent>;
31
- readonly commandFailed: (payload: CommandFailedPayload) => Effect.Effect<CommandFailedEvent>;
32
- readonly commandCancelled: (payload: CommandCancelledPayload) => Effect.Effect<CommandCancelledEvent>;
33
- readonly systemMessageCommitted: (payload: SystemMessageCommittedPayload) => Effect.Effect<SystemMessageCommittedEvent>;
34
- readonly userMessageCommitted: (payload: UserMessageCommittedPayload) => Effect.Effect<UserMessageCommittedEvent>;
35
- readonly userMessageSubmitted: (payload: UserMessageSubmittedPayload) => Effect.Effect<UserMessageSubmittedEvent>;
36
- readonly userMessagePromoted: (payload: UserMessagePromotedPayload) => Effect.Effect<UserMessagePromotedEvent>;
37
- readonly userMessageCancelled: (payload: UserMessageCancelledPayload) => Effect.Effect<UserMessageCancelledEvent>;
38
- readonly pendingMessagesPaused: (payload: PendingMessagesPausedPayload) => Effect.Effect<PendingMessagesPausedEvent>;
39
- readonly steeringMessageQueued: (payload: SteeringMessageQueuedPayload) => Effect.Effect<SteeringMessageQueuedEvent>;
40
- readonly steeringMessageCancelled: (payload: SteeringMessageCancelledPayload) => Effect.Effect<SteeringMessageCancelledEvent>;
41
- readonly assistantMessageCommitted: (payload: AssistantMessageCommittedPayload) => Effect.Effect<AssistantMessageCommittedEvent>;
42
- readonly assistantPartialCommitted: (payload: AssistantPartialCommittedPayload) => Effect.Effect<AssistantPartialCommittedEvent>;
43
- readonly runStarted: (payload: RunStartedPayload) => Effect.Effect<RunStartedEvent>;
44
- readonly runCompleted: (payload: RunCompletedPayload) => Effect.Effect<RunCompletedEvent>;
45
- readonly runFailed: (payload: RunFailedPayload) => Effect.Effect<RunFailedEvent>;
46
- readonly recoveryCompleted: (payload: RecoveryCompletedPayload) => Effect.Effect<RecoveryCompletedEvent>;
47
- /** @deprecated Emit `runFailed` with `error.code = "run.interrupted"`. Retained for legacy event construction only. */
48
- readonly runInterrupted: (payload: RunInterruptedPayload) => Effect.Effect<RunInterruptedEvent>;
49
- readonly turnStarted: (payload: TurnStartedPayload) => Effect.Effect<TurnStartedEvent>;
50
- readonly turnCompleted: (payload: TurnCompletedPayload) => Effect.Effect<TurnCompletedEvent>;
51
- readonly turnFailed: (payload: TurnFailedPayload) => Effect.Effect<TurnFailedEvent>;
52
- /** @deprecated Emit `turnFailed` with `error.code = "turn.interrupted"`. Retained for legacy event construction only. */
53
- readonly turnStopped: (payload: TurnStoppedPayload) => Effect.Effect<TurnStoppedEvent>;
54
- readonly inferenceStarted: (payload: InferenceStartedPayload) => Effect.Effect<InferenceStartedEvent>;
55
- readonly inferenceCompleted: (payload: InferenceCompletedPayload) => Effect.Effect<InferenceCompletedEvent>;
56
- readonly inferenceFailed: (payload: InferenceFailedPayload) => Effect.Effect<InferenceFailedEvent>;
57
- readonly toolCallCreated: (payload: ToolCallCreatedPayload) => Effect.Effect<ToolCallCreatedEvent>;
58
- readonly toolCallRejected: (payload: ToolCallRejectedPayload) => Effect.Effect<ToolCallRejectedEvent>;
59
- readonly toolCallStarted: (payload: ToolCallStartedPayload) => Effect.Effect<ToolCallStartedEvent>;
60
- readonly toolCallCompleted: (payload: ToolCallCompletedPayload) => Effect.Effect<ToolCallCompletedEvent>;
61
- readonly toolCallFailed: (payload: ToolCallFailedPayload) => Effect.Effect<ToolCallFailedEvent>;
62
- readonly stopTurnRequested: (payload: StopTurnRequestedPayload) => Effect.Effect<StopTurnRequestedEvent>;
63
- readonly stopTurnApplied: (payload: StopTurnAppliedPayload) => Effect.Effect<StopTurnAppliedEvent>;
64
- readonly compactionRequested: (payload: CompactionRequestedPayload) => Effect.Effect<CompactionRequestedEvent>;
65
- readonly compactionStarted: (payload: CompactionStartedPayload) => Effect.Effect<CompactionStartedEvent>;
66
- readonly summaryCreated: (payload: SummaryCreatedPayload) => Effect.Effect<SummaryCreatedEvent>;
67
- readonly contextRebased: (payload: ContextRebasedPayload) => Effect.Effect<ContextRebasedEvent>;
68
- readonly compactionCompleted: (payload: CompactionCompletedPayload) => Effect.Effect<CompactionCompletedEvent>;
69
- readonly compactionFailed: (payload: CompactionFailedPayload) => Effect.Effect<CompactionFailedEvent>;
70
- readonly textDelta: (payload: TextDeltaPayload) => Effect.Effect<TextDeltaEvent>;
71
- readonly reasoningDelta: (payload: ReasoningDeltaPayload) => Effect.Effect<ReasoningDeltaEvent>;
72
- readonly toolParamsStart: (payload: ToolParamsStartPayload) => Effect.Effect<ToolParamsStartEvent>;
73
- readonly toolParamsDelta: (payload: ToolParamsDeltaPayload) => Effect.Effect<ToolParamsDeltaEvent>;
74
- readonly toolParamsEnd: (payload: ToolParamsEndPayload) => Effect.Effect<ToolParamsEndEvent>;
75
- }
76
- declare const EventFactory_base: Context.ServiceClass<EventFactory, "@effect-durable-agent/EventFactory", EventFactoryShape>;
77
- /**
78
- * The one construction path for built-in event envelopes. It closes over the
79
- * session identity, mints `eventId`s, and stamps `createdAtMs` from the
80
- * ambient `Clock`, so lifecycle code provides only the payload.
81
- */
82
- declare class EventFactory extends EventFactory_base {
83
- static readonly Live: Layer.Layer<EventFactory, never, SessionContext | IdGenerator>;
84
- }
85
- //#endregion
86
- export { EventFactoryShape as n, SessionContext as r, EventFactory as t };
87
- //# sourceMappingURL=event-factory-pFzsPlDs.d.ts.map
@@ -1 +0,0 @@
1
- export { };
@@ -1,32 +0,0 @@
1
- import { u as UserMessageContent } from "./commands-Ce1ec6kH.js";
2
- import { i as ContextProjection } from "./context-projection-n6Rdup0N.js";
3
- import { S as ReducedState, v as MessageRecord } from "./command-queues-DdDB_aYM.js";
4
- import * as Prompt from "effect/unstable/ai/Prompt";
5
-
6
- //#region src/domain/message-transcript.d.ts
7
- /** Durable user/assistant message records suitable for a session transcript. */
8
- type DurableTranscriptMessage = Extract<MessageRecord, {
9
- readonly _tag: "User" | "Assistant" | "AssistantPartial";
10
- }> | (Extract<MessageRecord, {
11
- readonly _tag: "Steering";
12
- }> & {
13
- readonly consumedSeq: NonNullable<Extract<MessageRecord, {
14
- readonly _tag: "Steering";
15
- }>["consumedSeq"]>;
16
- });
17
- /** Derive the durable user/assistant transcript in committed sequence order. */
18
- declare const durableMessageTranscript: (state: Pick<ReducedState, "messages">) => ReadonlyArray<DurableTranscriptMessage>;
19
- type PromptProjectionState = Pick<ReducedState, "messages"> & Partial<Pick<ReducedState, "toolCalls">>;
20
- /** Convert all durable transcript messages and exact tool-result parts into provider prompt history. */
21
- declare const durableTranscriptPrompt: (state: PromptProjectionState) => Prompt.Prompt;
22
- /** Convert the current compacted context into provider prompt history. */
23
- declare const contextProjectionPrompt: (state: PromptProjectionState, context: ContextProjection | undefined) => Prompt.Prompt;
24
- /** Build a provider prompt with extra user content selected by the scheduler but not yet folded. */
25
- declare const durableTranscriptPromptWithUserContent: (state: PromptProjectionState, content: UserMessageContent) => Prompt.Prompt;
26
- /** Build a compacted provider prompt with extra user content selected by the scheduler. */
27
- declare const contextProjectionPromptWithUserContent: (state: PromptProjectionState, context: ContextProjection | undefined, content: UserMessageContent) => Prompt.Prompt;
28
- /** Build a compacted provider prompt with multiple scheduler-selected user messages. */
29
- declare const contextProjectionPromptWithUserContents: (state: PromptProjectionState, context: ContextProjection | undefined, contents: ReadonlyArray<UserMessageContent>) => Prompt.Prompt;
30
- //#endregion
31
- export { durableMessageTranscript as a, contextProjectionPromptWithUserContents as i, contextProjectionPrompt as n, durableTranscriptPrompt as o, contextProjectionPromptWithUserContent as r, durableTranscriptPromptWithUserContent as s, DurableTranscriptMessage as t };
32
- //# sourceMappingURL=message-transcript-DQNlzxle.d.ts.map