effect-durable-agent 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (183) hide show
  1. package/README.md +140 -136
  2. package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-CQi4Xc7u.d.ts} +109 -21
  3. package/dist/{commands-Ce1ec6kH.d.ts → commands-p8venTWs.d.ts} +10 -2
  4. package/dist/compaction-0k8zCJgB.js +473 -0
  5. package/dist/compaction-0k8zCJgB.js.map +1 -0
  6. package/dist/{compaction-YayFKo_1.d.ts → compaction-BhLSSXJ-.d.ts} +28 -7
  7. package/dist/context-projection-mCuvcO2W.d.ts +140 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-C-6xHzRx.d.ts} +6 -3
  9. package/dist/domain/command-queues.d.ts +1 -1
  10. package/dist/domain/command-queues.js +1 -1
  11. package/dist/domain/command-queues.js.map +1 -1
  12. package/dist/domain/context-projection.d.ts +2 -0
  13. package/dist/domain/context-projection.js +32 -0
  14. package/dist/domain/context-projection.js.map +1 -0
  15. package/dist/domain/message-transcript.d.ts +1 -1
  16. package/dist/domain/model-usage.d.ts +2 -0
  17. package/dist/domain/model-usage.js +59 -0
  18. package/dist/domain/model-usage.js.map +1 -0
  19. package/dist/domain/reduced-state-schema.d.ts +14 -18
  20. package/dist/domain/reduced-state-schema.js +7 -11
  21. package/dist/domain/reduced-state-schema.js.map +1 -1
  22. package/dist/domain/reduced-state.d.ts +3 -2
  23. package/dist/domain/reduced-state.js +3 -2
  24. package/dist/domain/run-scheduling.d.ts +2 -0
  25. package/dist/domain/run-scheduling.js +127 -0
  26. package/dist/domain/run-scheduling.js.map +1 -0
  27. package/dist/{durable-C3Rz7kg3.js → durable-BPHVFVvV.js} +74 -83
  28. package/dist/durable-BPHVFVvV.js.map +1 -0
  29. package/dist/{durable-DlScwmCy.d.ts → durable-DeLCAvbw.d.ts} +1256 -104
  30. package/dist/envelope-DkZyMIgp.d.ts +191 -0
  31. package/dist/envelope-DxQzo5rN.js +82 -0
  32. package/dist/envelope-DxQzo5rN.js.map +1 -0
  33. package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-KaeDSfeP.d.ts} +11 -31
  34. package/dist/{keep-alive-p8dIcSVy.js → event-factory-QuC_UvyP.js} +8 -10
  35. package/dist/event-factory-QuC_UvyP.js.map +1 -0
  36. package/dist/{events-Bb9-Cu-7.d.ts → events-LZFNoESe.d.ts} +2 -188
  37. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator--x6itQZ2.d.ts} +3 -2
  38. package/dist/index.d.ts +7 -6
  39. package/dist/index.js +5 -4
  40. package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
  41. package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-6PEzaEGn.d.ts} +4 -4
  42. package/dist/model-resolver-BPPJAsuh.d.ts +18 -0
  43. package/dist/model-usage-CdBEkTwU.d.ts +55 -0
  44. package/dist/{prompt-projector-9_02lk5-.d.ts → prompt-projector-CNhqUsEr.d.ts} +15 -16
  45. package/dist/{reduced-state-C4nVVzz9.js → reduced-state-Bz68V2H8.js} +65 -32
  46. package/dist/reduced-state-Bz68V2H8.js.map +1 -0
  47. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-CCSzc4h8.d.ts} +16 -6
  48. package/dist/run-scheduler-DcS_okUH.d.ts +43 -0
  49. package/dist/run-scheduling-wakeup-CeHrvXie.d.ts +25 -0
  50. package/dist/{runtime-C56FQxiL.d.ts → runtime-WL_gKqxn.d.ts} +16 -7
  51. package/dist/services/compaction.d.ts +1 -1
  52. package/dist/services/compaction.js +1 -425
  53. package/dist/services/id-generator.d.ts +1 -1
  54. package/dist/services/id-generator.js +2 -1
  55. package/dist/services/id-generator.js.map +1 -1
  56. package/dist/services/keep-alive.d.ts +2 -0
  57. package/dist/services/keep-alive.js +13 -0
  58. package/dist/services/keep-alive.js.map +1 -0
  59. package/dist/services/model-resolver.d.ts +2 -0
  60. package/dist/services/model-resolver.js +17 -0
  61. package/dist/services/model-resolver.js.map +1 -0
  62. package/dist/services/prompt-projector.d.ts +2 -2
  63. package/dist/services/prompt-projector.js +20 -10
  64. package/dist/services/prompt-projector.js.map +1 -1
  65. package/dist/services/reducer-registry.d.ts +2 -2
  66. package/dist/services/reducer-registry.js +7 -3
  67. package/dist/services/reducer-registry.js.map +1 -1
  68. package/dist/services/run-scheduler.d.ts +3 -0
  69. package/dist/services/run-scheduler.js +25 -0
  70. package/dist/services/run-scheduler.js.map +1 -0
  71. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  72. package/dist/services/run-scheduling-wakeup.js +13 -0
  73. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  74. package/dist/services/runtime-layer.d.ts +67 -0
  75. package/dist/services/runtime-layer.js +47 -0
  76. package/dist/services/runtime-layer.js.map +1 -0
  77. package/dist/services/runtime.d.ts +1 -1
  78. package/dist/services/runtime.js +21 -14
  79. package/dist/services/runtime.js.map +1 -1
  80. package/dist/services/session-event-observer.d.ts +2 -0
  81. package/dist/services/session-event-observer.js +13 -0
  82. package/dist/services/session-event-observer.js.map +1 -0
  83. package/dist/services/session-query.d.ts +2 -2
  84. package/dist/services/session-query.js +140 -1
  85. package/dist/services/session-query.js.map +1 -0
  86. package/dist/services/session-state.d.ts +2 -0
  87. package/dist/services/session-state.js +2 -0
  88. package/dist/services/session-store.d.ts +2 -2
  89. package/dist/services/session-store.js +182 -2
  90. package/dist/services/session-store.js.map +1 -0
  91. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  92. package/dist/services/sink-checkpoint-store.js +49 -0
  93. package/dist/services/sink-checkpoint-store.js.map +1 -0
  94. package/dist/services/sink-registry.d.ts +1 -1
  95. package/dist/services/sink-registry.js +1 -1
  96. package/dist/services/span-names.d.ts +1 -1
  97. package/dist/services/span-names.js +3 -0
  98. package/dist/services/span-names.js.map +1 -1
  99. package/dist/services/tool-registry.d.ts +1 -1
  100. package/dist/services/tracing.d.ts +1 -1
  101. package/dist/services/tracing.js +23 -2
  102. package/dist/services/tracing.js.map +1 -1
  103. package/dist/session-event-observer-DaFMKKNc.d.ts +24 -0
  104. package/dist/session-query-DfW_4KC0.d.ts +47 -0
  105. package/dist/{session-query-DOc1KanA.js → session-state-BIZ2SYaP.js} +350 -183
  106. package/dist/session-state-BIZ2SYaP.js.map +1 -0
  107. package/dist/{session-query-DlRo5Ufc.d.ts → session-state-BeR2rZRR.d.ts} +144 -46
  108. package/dist/{session-store-D2Ore1QC.d.ts → session-store-J_Un45kW.d.ts} +7 -96
  109. package/dist/sink-checkpoint-store-C9hUxfH0.d.ts +40 -0
  110. package/dist/{sink-registry-CFC6xjsN.js → sink-registry-Bbqhtdnx.js} +27 -67
  111. package/dist/sink-registry-Bbqhtdnx.js.map +1 -0
  112. package/dist/{sink-registry-CIU0LD3m.d.ts → sink-registry-DuDkNXjZ.d.ts} +24 -49
  113. package/dist/testkit/layers.d.ts +24 -14
  114. package/dist/testkit/layers.js +18 -11
  115. package/dist/testkit/layers.js.map +1 -1
  116. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BDmJe_Wr.d.ts} +4 -4
  117. package/dist/types/commands.d.ts +2 -2
  118. package/dist/types/commands.js +7 -2
  119. package/dist/types/commands.js.map +1 -1
  120. package/dist/types/core.d.ts +2 -2
  121. package/dist/types/core.js +4 -2
  122. package/dist/types/core.js.map +1 -1
  123. package/dist/types/events/durable.d.ts +2 -2
  124. package/dist/types/events/durable.js +2 -2
  125. package/dist/types/events.d.ts +4 -3
  126. package/dist/types/events.js +3 -2
  127. package/dist/types/events.js.map +1 -1
  128. package/dist/websocket.d.ts +2776 -0
  129. package/dist/websocket.js +498 -0
  130. package/dist/websocket.js.map +1 -0
  131. package/package.json +68 -43
  132. package/testing/offline-trace/README.md +2 -1
  133. package/CHANGELOG.md +0 -10
  134. package/CONTRIBUTING.md +0 -26
  135. package/SECURITY.md +0 -8
  136. package/dist/durable-C3Rz7kg3.js.map +0 -1
  137. package/dist/durable-object-runtime-B7jwBY2R.js +0 -1494
  138. package/dist/durable-object-runtime-B7jwBY2R.js.map +0 -1
  139. package/dist/durable-object-runtime-pWv0ohlz.d.ts +0 -257
  140. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  141. package/dist/host/durable-object-runtime.d.ts +0 -2
  142. package/dist/host/durable-object-runtime.js +0 -2
  143. package/dist/host/durable-object-storage.d.ts +0 -2
  144. package/dist/host/durable-object-storage.js +0 -0
  145. package/dist/host/durable-object.d.ts +0 -83
  146. package/dist/host/durable-object.js +0 -191
  147. package/dist/host/durable-object.js.map +0 -1
  148. package/dist/host/websocket-wire.d.ts +0 -2
  149. package/dist/host/websocket-wire.js +0 -88
  150. package/dist/host/websocket-wire.js.map +0 -1
  151. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  152. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  153. package/dist/services/compaction.js.map +0 -1
  154. package/dist/session-query-DOc1KanA.js.map +0 -1
  155. package/dist/session-store-pYxQW9qh.js +0 -214
  156. package/dist/session-store-pYxQW9qh.js.map +0 -1
  157. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  158. package/dist/websocket-wire-DvOu_6BJ.d.ts +0 -16773
  159. package/docs/assets/architecture.svg +0 -106
  160. package/docs/assets/event-sequence.svg +0 -143
  161. package/docs/assets/gcp-trace.png +0 -0
  162. package/docs/message-steering.md +0 -831
  163. package/docs/releasing.md +0 -57
  164. package/docs/spec.md +0 -774
  165. package/docs/subagents.md +0 -725
  166. package/docs/testing.md +0 -64
  167. package/docs/ui-projection.md +0 -742
  168. package/docs/websocket-protocol.md +0 -613
  169. package/examples/001-no-tools/README.md +0 -65
  170. package/examples/001-no-tools/worker.ts +0 -79
  171. package/examples/002-slack-bridge/README.md +0 -134
  172. package/examples/002-slack-bridge/events.ts +0 -115
  173. package/examples/002-slack-bridge/reducer.ts +0 -216
  174. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  175. package/examples/002-slack-bridge/sinks.ts +0 -109
  176. package/examples/002-slack-bridge/worker.ts +0 -140
  177. package/examples/003-sandbox-lifecycle/README.md +0 -78
  178. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  179. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  180. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  181. package/examples/_shared/event-id.ts +0 -12
  182. package/examples/_shared/http.ts +0 -27
  183. package/examples/_shared/openai.ts +0 -33
@@ -0,0 +1,191 @@
1
+ import * as Schema from "effect/Schema";
2
+
3
+ //#region src/types/events/envelope.d.ts
4
+ /** Event namespace, such as `effect-durable-agent`, `sandbox`, or `gia`. */
5
+ declare const EventNamespace: Schema.NonEmptyString;
6
+ type EventNamespace = typeof EventNamespace.Type;
7
+ /** Event type within a namespace, such as `CommandAdmitted` or `TextDelta`. */
8
+ declare const EventType: Schema.NonEmptyString;
9
+ type EventType = typeof EventType.Type;
10
+ /** Build a non-empty event type while preserving its string literal for exhaustive unions. */
11
+ declare const makeEventType: <const Value extends string>(value: Value extends "" ? never : Value) => Value extends "" ? never : Value;
12
+ /** Extract the literal name retained by `makeEventType`. */
13
+ type EventTypeName<Type extends EventType> = Type;
14
+ /** Provider-supplied stream part identity, preserved for correlation/debugging. */
15
+ declare const ProviderPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
16
+ type ProviderPartId = typeof ProviderPartId.Type;
17
+ /** Positive schema version for one namespace/type payload contract. */
18
+ declare const SchemaVersion: Schema.Int;
19
+ type SchemaVersion = typeof SchemaVersion.Type;
20
+ /** Milliseconds since unix epoch, represented as a non-negative integer. */
21
+ declare const UnixEpochMillis: Schema.brand<Schema.Int, "UnixEpochMillis">;
22
+ type UnixEpochMillis = typeof UnixEpochMillis.Type;
23
+ /** Whether an event is persisted or live-only. */
24
+ declare const EventDurability: Schema.Literals<readonly ["durable", "ephemeral"]>;
25
+ type EventDurability = typeof EventDurability.Type;
26
+ /** Common event envelope decoded before payload-specific schemas. */
27
+ declare const EventEnvelope: Schema.Struct<{
28
+ readonly namespace: Schema.NonEmptyString;
29
+ readonly type: Schema.NonEmptyString;
30
+ readonly schemaVersion: Schema.Int;
31
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
32
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
33
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
34
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
35
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
36
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
37
+ readonly span: Schema.Struct<{
38
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
39
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
40
+ readonly sampled: Schema.Boolean;
41
+ readonly tracestate: Schema.NullOr<Schema.String>;
42
+ }>;
43
+ readonly links: Schema.$Array<Schema.Struct<{
44
+ readonly context: Schema.Struct<{
45
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
46
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
47
+ readonly sampled: Schema.Boolean;
48
+ readonly tracestate: Schema.NullOr<Schema.String>;
49
+ }>;
50
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
51
+ }>>;
52
+ }>>;
53
+ readonly payload: Schema.Unknown;
54
+ }>;
55
+ type EventEnvelope = typeof EventEnvelope.Type;
56
+ /** Common envelope narrowed to committed durable events. */
57
+ declare const DurableEventEnvelope: Schema.Struct<{
58
+ readonly durability: Schema.Literal<"durable">;
59
+ readonly namespace: Schema.NonEmptyString;
60
+ readonly type: Schema.NonEmptyString;
61
+ readonly schemaVersion: Schema.Int;
62
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
63
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
64
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
65
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
66
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
67
+ readonly span: Schema.Struct<{
68
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
69
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
70
+ readonly sampled: Schema.Boolean;
71
+ readonly tracestate: Schema.NullOr<Schema.String>;
72
+ }>;
73
+ readonly links: Schema.$Array<Schema.Struct<{
74
+ readonly context: Schema.Struct<{
75
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
76
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
77
+ readonly sampled: Schema.Boolean;
78
+ readonly tracestate: Schema.NullOr<Schema.String>;
79
+ }>;
80
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
81
+ }>>;
82
+ }>>;
83
+ readonly payload: Schema.Unknown;
84
+ }>;
85
+ type DurableEventEnvelope = typeof DurableEventEnvelope.Type;
86
+ /** Common envelope narrowed to live-only ephemeral events. */
87
+ declare const EphemeralEventEnvelope: Schema.Struct<{
88
+ readonly durability: Schema.Literal<"ephemeral">;
89
+ readonly namespace: Schema.NonEmptyString;
90
+ readonly type: Schema.NonEmptyString;
91
+ readonly schemaVersion: Schema.Int;
92
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
93
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
94
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
95
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
96
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
97
+ readonly span: Schema.Struct<{
98
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
99
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
100
+ readonly sampled: Schema.Boolean;
101
+ readonly tracestate: Schema.NullOr<Schema.String>;
102
+ }>;
103
+ readonly links: Schema.$Array<Schema.Struct<{
104
+ readonly context: Schema.Struct<{
105
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
106
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
107
+ readonly sampled: Schema.Boolean;
108
+ readonly tracestate: Schema.NullOr<Schema.String>;
109
+ }>;
110
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
111
+ }>>;
112
+ }>>;
113
+ readonly payload: Schema.Unknown;
114
+ }>;
115
+ type EphemeralEventEnvelope = typeof EphemeralEventEnvelope.Type;
116
+ /** Event delivered to live subscribers with its durable/ephemeral position. */
117
+ declare const PositionedEvent: Schema.Struct<{
118
+ readonly position: Schema.Struct<{
119
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
120
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
121
+ }>;
122
+ readonly event: Schema.Struct<{
123
+ readonly namespace: Schema.NonEmptyString;
124
+ readonly type: Schema.NonEmptyString;
125
+ readonly schemaVersion: Schema.Int;
126
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
127
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
128
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
129
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
130
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
131
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
132
+ readonly span: Schema.Struct<{
133
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
134
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
135
+ readonly sampled: Schema.Boolean;
136
+ readonly tracestate: Schema.NullOr<Schema.String>;
137
+ }>;
138
+ readonly links: Schema.$Array<Schema.Struct<{
139
+ readonly context: Schema.Struct<{
140
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
141
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
142
+ readonly sampled: Schema.Boolean;
143
+ readonly tracestate: Schema.NullOr<Schema.String>;
144
+ }>;
145
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
146
+ }>>;
147
+ }>>;
148
+ readonly payload: Schema.Unknown;
149
+ }>;
150
+ }>;
151
+ type PositionedEvent = typeof PositionedEvent.Type;
152
+ /** Built-in framework event namespace. */
153
+ declare const effectDurableAgentNamespace: string;
154
+ /** Initial schema version for built-in event payloads. */
155
+ declare const schemaV1: number;
156
+ /** Non-negative integer used by token counts and similar counters. */
157
+ declare const NonNegativeInt: Schema.Int;
158
+ type NonNegativeInt = typeof NonNegativeInt.Type;
159
+ /** Registered tool name; plain non-empty text, not a lifecycle identity. */
160
+ declare const ToolName: Schema.NonEmptyString;
161
+ type ToolName = typeof ToolName.Type;
162
+ /** Error details stored on failed lifecycle events. */
163
+ declare const FailurePayload: Schema.Struct<{
164
+ readonly message: Schema.String;
165
+ readonly code: Schema.optionalKey<Schema.String>;
166
+ readonly details: Schema.optionalKey<Schema.Unknown>;
167
+ }>;
168
+ type FailurePayload = typeof FailurePayload.Type;
169
+ /** Token usage reported by a model provider when available. */
170
+ declare const UsagePayload: Schema.Struct<{
171
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
172
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
173
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
174
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
175
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
176
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
177
+ }>;
178
+ type UsagePayload = typeof UsagePayload.Type;
179
+ /** Intended provider/model selection known before a model request starts. */
180
+ declare const ModelSelectionPayload: Schema.Struct<{
181
+ readonly provider: Schema.NonEmptyString;
182
+ readonly modelId: Schema.NonEmptyString;
183
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
184
+ }>;
185
+ type ModelSelectionPayload = typeof ModelSelectionPayload.Type;
186
+ /** App-owned instructions inserted into model context as a system message. */
187
+ declare const SystemPromptText: Schema.NonEmptyString;
188
+ type SystemPromptText = typeof SystemPromptText.Type;
189
+ //#endregion
190
+ export { UsagePayload as _, EventNamespace as a, schemaV1 as b, FailurePayload as c, PositionedEvent as d, ProviderPartId as f, UnixEpochMillis as g, ToolName as h, EventEnvelope as i, ModelSelectionPayload as l, SystemPromptText as m, EphemeralEventEnvelope as n, EventType as o, SchemaVersion as p, EventDurability as r, EventTypeName as s, DurableEventEnvelope as t, NonNegativeInt as u, effectDurableAgentNamespace as v, makeEventType as y };
191
+ //# sourceMappingURL=envelope-DkZyMIgp.d.ts.map
@@ -0,0 +1,82 @@
1
+ import { CorrelationId, EventId, Position, SessionId } from "./types/core.js";
2
+ import { EDAEventTrace, makeRootEDAEventTrace } from "./types/tracing.js";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Schema from "effect/Schema";
5
+ //#region src/types/events/envelope.ts
6
+ /** Event namespace, such as `effect-durable-agent`, `sandbox`, or `gia`. */
7
+ const EventNamespace = Schema.NonEmptyString;
8
+ /** Event type within a namespace, such as `CommandAdmitted` or `TextDelta`. */
9
+ const EventType = Schema.NonEmptyString;
10
+ /** Build a non-empty event type while preserving its string literal for exhaustive unions. */
11
+ const makeEventType = (value) => value;
12
+ /** Provider-supplied stream part identity, preserved for correlation/debugging. */
13
+ const ProviderPartId = Schema.NonEmptyString.pipe(Schema.brand("ProviderPartId"));
14
+ /** Positive schema version for one namespace/type payload contract. */
15
+ const SchemaVersion = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
16
+ /** Milliseconds since unix epoch, represented as a non-negative integer. */
17
+ const UnixEpochMillis = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)).pipe(Schema.brand("UnixEpochMillis"));
18
+ /** Whether an event is persisted or live-only. */
19
+ const EventDurability = Schema.Literals(["durable", "ephemeral"]);
20
+ /** Common event envelope decoded before payload-specific schemas. */
21
+ const EventEnvelope = Schema.Struct({
22
+ namespace: EventNamespace,
23
+ type: EventType,
24
+ schemaVersion: SchemaVersion,
25
+ durability: EventDurability,
26
+ eventId: EventId,
27
+ sessionId: SessionId,
28
+ correlationId: Schema.optionalKey(CorrelationId),
29
+ createdAtMs: UnixEpochMillis,
30
+ trace: EDAEventTrace.pipe(Schema.withConstructorDefault(Effect.sync(makeRootEDAEventTrace))),
31
+ payload: Schema.Unknown
32
+ });
33
+ /** Common envelope narrowed to committed durable events. */
34
+ const DurableEventEnvelope = Schema.Struct({
35
+ ...EventEnvelope.fields,
36
+ durability: Schema.Literal("durable")
37
+ });
38
+ /** Common envelope narrowed to live-only ephemeral events. */
39
+ const EphemeralEventEnvelope = Schema.Struct({
40
+ ...EventEnvelope.fields,
41
+ durability: Schema.Literal("ephemeral")
42
+ });
43
+ /** Event delivered to live subscribers with its durable/ephemeral position. */
44
+ const PositionedEvent = Schema.Struct({
45
+ position: Position,
46
+ event: EventEnvelope
47
+ });
48
+ /** Built-in framework event namespace. */
49
+ const effectDurableAgentNamespace = EventNamespace.make("effect-durable-agent");
50
+ /** Initial schema version for built-in event payloads. */
51
+ const schemaV1 = SchemaVersion.make(1);
52
+ /** Non-negative integer used by token counts and similar counters. */
53
+ const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
54
+ /** Registered tool name; plain non-empty text, not a lifecycle identity. */
55
+ const ToolName = Schema.NonEmptyString;
56
+ /** Error details stored on failed lifecycle events. */
57
+ const FailurePayload = Schema.Struct({
58
+ message: Schema.String,
59
+ code: Schema.optionalKey(Schema.String),
60
+ details: Schema.optionalKey(Schema.Unknown)
61
+ });
62
+ /** Token usage reported by a model provider when available. */
63
+ const UsagePayload = Schema.Struct({
64
+ inputTokens: Schema.optionalKey(NonNegativeInt),
65
+ cachedInputTokens: Schema.optionalKey(NonNegativeInt),
66
+ cacheWriteInputTokens: Schema.optionalKey(NonNegativeInt),
67
+ outputTokens: Schema.optionalKey(NonNegativeInt),
68
+ textTokens: Schema.optionalKey(NonNegativeInt),
69
+ reasoningTokens: Schema.optionalKey(NonNegativeInt)
70
+ });
71
+ /** Intended provider/model selection known before a model request starts. */
72
+ const ModelSelectionPayload = Schema.Struct({
73
+ provider: Schema.NonEmptyString,
74
+ modelId: Schema.NonEmptyString,
75
+ settings: Schema.optionalKey(Schema.Unknown)
76
+ });
77
+ /** App-owned instructions inserted into model context as a system message. */
78
+ const SystemPromptText = Schema.NonEmptyString;
79
+ //#endregion
80
+ export { effectDurableAgentNamespace as _, EventNamespace as a, ModelSelectionPayload as c, ProviderPartId as d, SchemaVersion as f, UsagePayload as g, UnixEpochMillis as h, EventEnvelope as i, NonNegativeInt as l, ToolName as m, EphemeralEventEnvelope as n, EventType as o, SystemPromptText as p, EventDurability as r, FailurePayload as s, DurableEventEnvelope as t, PositionedEvent as u, makeEventType as v, schemaV1 as y };
81
+
82
+ //# sourceMappingURL=envelope-DxQzo5rN.js.map
@@ -0,0 +1 @@
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,OAAO;CACzC,WAAW;CACX,MAAM;CACN,eAAe;CACf,YAAY;CACZ,SAAS;CACT,WAAW;CACX,eAAe,OAAO,YAAY,aAAa;CAC/C,aAAa;CACb,OAAO,cAAc,KAAK,OAAO,uBAAuB,OAAO,KAAK,qBAAqB,CAAC,CAAC;CAC3F,SAAS,OAAO;AAClB,CAAC;;AAID,MAAa,uBAAuB,OAAO,OAAO;CAChD,GAAG,cAAc;CACjB,YAAY,OAAO,QAAQ,SAAS;AACtC,CAAC;;AAID,MAAa,yBAAyB,OAAO,OAAO;CAClD,GAAG,cAAc;CACjB,YAAY,OAAO,QAAQ,WAAW;AACxC,CAAC;;AAID,MAAa,kBAAkB,OAAO,OAAO;CAC3C,UAAU;CACV,OAAO;AACT,CAAC;;AAID,MAAa,8BAA8B,eAAe,KAAK,sBAAsB;;AAGrF,MAAa,WAAW,cAAc,KAAK,CAAC;;AAG5C,MAAa,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAI/E,MAAa,WAAW,OAAO;;AAI/B,MAAa,iBAAiB,OAAO,OAAO;CAC1C,SAAS,OAAO;CAChB,MAAM,OAAO,YAAY,OAAO,MAAM;CACtC,SAAS,OAAO,YAAY,OAAO,OAAO;AAC5C,CAAC;;AAID,MAAa,eAAe,OAAO,OAAO;CACxC,aAAa,OAAO,YAAY,cAAc;CAC9C,mBAAmB,OAAO,YAAY,cAAc;CACpD,uBAAuB,OAAO,YAAY,cAAc;CACxD,cAAc,OAAO,YAAY,cAAc;CAC/C,YAAY,OAAO,YAAY,cAAc;CAC7C,iBAAiB,OAAO,YAAY,cAAc;AACpD,CAAC;;AAID,MAAa,wBAAwB,OAAO,OAAO;CACjD,UAAU,OAAO;CACjB,SAAS,OAAO;CAChB,UAAU,OAAO,YAAY,OAAO,OAAO;AAC7C,CAAC;;AAID,MAAa,mBAAmB,OAAO"}
@@ -1,7 +1,7 @@
1
- import { h as SessionId } from "./core-Hv3cFydL.js";
2
- 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-Bb9-Cu-7.js";
3
- import { $ as RecoveryCompletedEvent, $t as UserMessageCancelledEvent, A as CompactionRequestedEvent, At as ToolCallFailedEvent, C as CommandFailedPayload, Ct as SystemMessageCommittedEvent, D as CompactionCompletedPayload, Dt as ToolCallCreatedEvent, E as CompactionCompletedEvent, Et as ToolCallCompletedPayload, G as InferenceFailedPayload, H as InferenceCompletedPayload, Jt as TurnStartedEvent, K as InferenceStartedEvent, Kt as TurnFailedEvent, L as ContextRebasedEvent, Lt as ToolCallStartedEvent, M as CompactionStartedEvent, N as CompactionStartedPayload, Nt as ToolCallRejectedEvent, O as CompactionFailedEvent, Ot as ToolCallCreatedPayload, Pt as ToolCallRejectedPayload, Q as PendingMessagesPausedPayload, R as ContextRebasedPayload, Rt as ToolCallStartedPayload, S as CommandFailedEvent, St as SummaryCreatedPayload, T as CommandStartedPayload, Tt as ToolCallCompletedEvent, Ut as TurnCompletedEvent, V as InferenceCompletedEvent, W as InferenceFailedEvent, Wt as TurnCompletedPayload, Xt as TurnStoppedEvent, Yt as TurnStartedPayload, Z as PendingMessagesPausedEvent, Zt as TurnStoppedPayload, _ as CommandCancelledEvent, _t as StopTurnAppliedEvent, a as AssistantPartialCommittedPayload, an as UserMessagePromotedPayload, b as CommandCompletedPayload, bt as StopTurnRequestedPayload, ct as RunInterruptedEvent, dt as RunStartedPayload, en as UserMessageCancelledPayload, et as RecoveryCompletedPayload, ft as SteeringMessageCancelledEvent, g as CommandAdmittedPayload, h as CommandAdmittedEvent, ht as SteeringMessageQueuedPayload, i as AssistantPartialCommittedEvent, in as UserMessagePromotedEvent, it as RunCompletedPayload, j as CompactionRequestedPayload, jt as ToolCallFailedPayload, k as CompactionFailedPayload, lt as RunInterruptedPayload, mt as SteeringMessageQueuedEvent, n as AssistantMessageCommittedPayload, nn as UserMessageCommittedPayload, on as UserMessageSubmittedEvent, ot as RunFailedEvent, pt as SteeringMessageCancelledPayload, q as InferenceStartedPayload, qt as TurnFailedPayload, rt as RunCompletedEvent, sn as UserMessageSubmittedPayload, st as RunFailedPayload, t as AssistantMessageCommittedEvent, tn as UserMessageCommittedEvent, ut as RunStartedEvent, v as CommandCancelledPayload, vt as StopTurnAppliedPayload, w as CommandStartedEvent, wt as SystemMessageCommittedPayload, xt as SummaryCreatedEvent, y as CommandCompletedEvent, yt as StopTurnRequestedEvent } from "./durable-DlScwmCy.js";
4
- import { t as IdGenerator } from "./id-generator-C2Q15uZM.js";
1
+ import { g as SessionId } from "./core-C-6xHzRx.js";
2
+ import { $ as PendingMessagesPausedEvent, A as CompactionFailedEvent, At as StopTurnAppliedPayload, B as ContextRebasedPayload, Bt as ToolCallCreatedPayload, D as CommandStartedPayload, Dt as SteeringMessageQueuedPayload, E as CommandStartedEvent, Et as SteeringMessageQueuedEvent, F as CompactionStartedPayload, Ft as SystemMessageCommittedEvent, Gt as ToolCallRejectedEvent, Ht as ToolCallFailedEvent, It as SystemMessageCommittedPayload, J as InferenceStartedEvent, K as InferenceFailedEvent, Kt as ToolCallRejectedPayload, Lt as ToolCallCompletedEvent, M as CompactionRequestedEvent, Mt as StopTurnRequestedPayload, N as CompactionRequestedPayload, Nt as SummaryCreatedEvent, O as CompactionCompletedEvent, P as CompactionStartedEvent, Pt as SummaryCreatedPayload, Rt as ToolCallCompletedPayload, S as CommandCompletedPayload, St as RunStartedPayload, T as CommandFailedPayload, Tt as SteeringMessageCancelledPayload, U as InferenceCompletedEvent, Ut as ToolCallFailedPayload, W as InferenceCompletedPayload, Xt as ToolCallStartedPayload, Y as InferenceStartedPayload, Yt as ToolCallStartedEvent, _ as CommandAdmittedEvent, _n as UserMessagePromotedPayload, _t as RunSchedulingInvalidatedEvent, an as TurnFailedPayload, at as RunCompletedEvent, b as CommandCancelledPayload, bt as RunSchedulingRequestedPayload, cn as TurnStoppedEvent, ct as RunFailedEvent, dn as UserMessageCancelledEvent, dt as RunInterruptedPayload, et as PendingMessagesPausedPayload, fn as UserMessageCancelledPayload, ft as RunSchedulingDeliveredEvent, gn as UserMessagePromotedEvent, gt as RunSchedulingGrantedPayload, ht as RunSchedulingGrantedEvent, in as TurnFailedEvent, j as CompactionFailedPayload, jt as StopTurnRequestedEvent, k as CompactionCompletedPayload, kt as StopTurnAppliedEvent, ln as TurnStoppedPayload, lt as RunFailedPayload, mn as UserMessageCommittedPayload, n as AssistantMessageCommittedPayload, nn as TurnCompletedPayload, nt as RecoveryCompletedPayload, o as AssistantPartialCommittedEvent, on as TurnStartedEvent, ot as RunCompletedPayload, pn as UserMessageCommittedEvent, pt as RunSchedulingDeliveredPayload, q as InferenceFailedPayload, s as AssistantPartialCommittedPayload, sn as TurnStartedPayload, t as AssistantMessageCommittedEvent, tn as TurnCompletedEvent, tt as RecoveryCompletedEvent, ut as RunInterruptedEvent, v as CommandAdmittedPayload, vn as UserMessageSubmittedEvent, vt as RunSchedulingInvalidatedPayload, w as CommandFailedEvent, wt as SteeringMessageCancelledEvent, x as CommandCompletedEvent, xt as RunStartedEvent, y as CommandCancelledEvent, yn as UserMessageSubmittedPayload, yt as RunSchedulingRequestedEvent, z as ContextRebasedEvent, zt as ToolCallCreatedEvent } from "./durable-DeLCAvbw.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--x6itQZ2.js";
5
5
  import * as Context from "effect/Context";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
@@ -40,6 +40,10 @@ interface EventFactoryShape {
40
40
  readonly steeringMessageCancelled: (payload: SteeringMessageCancelledPayload) => Effect.Effect<SteeringMessageCancelledEvent>;
41
41
  readonly assistantMessageCommitted: (payload: AssistantMessageCommittedPayload) => Effect.Effect<AssistantMessageCommittedEvent>;
42
42
  readonly assistantPartialCommitted: (payload: AssistantPartialCommittedPayload) => Effect.Effect<AssistantPartialCommittedEvent>;
43
+ readonly runSchedulingRequested: (payload: RunSchedulingRequestedPayload) => Effect.Effect<RunSchedulingRequestedEvent>;
44
+ readonly runSchedulingDelivered: (payload: RunSchedulingDeliveredPayload) => Effect.Effect<RunSchedulingDeliveredEvent>;
45
+ readonly runSchedulingInvalidated: (payload: RunSchedulingInvalidatedPayload) => Effect.Effect<RunSchedulingInvalidatedEvent>;
46
+ readonly runSchedulingGranted: (payload: RunSchedulingGrantedPayload) => Effect.Effect<RunSchedulingGrantedEvent>;
43
47
  readonly runStarted: (payload: RunStartedPayload) => Effect.Effect<RunStartedEvent>;
44
48
  readonly runCompleted: (payload: RunCompletedPayload) => Effect.Effect<RunCompletedEvent>;
45
49
  readonly runFailed: (payload: RunFailedPayload) => Effect.Effect<RunFailedEvent>;
@@ -80,32 +84,8 @@ declare const EventFactory_base: Context.ServiceClass<EventFactory, "@effect-dur
80
84
  * ambient `Clock`, so lifecycle code provides only the payload.
81
85
  */
82
86
  declare class EventFactory extends EventFactory_base {
83
- static readonly Live: Layer.Layer<EventFactory, never, IdGenerator | SessionContext>;
87
+ static readonly Live: Layer.Layer<EventFactory, never, SessionContext | IdGenerator>;
84
88
  }
85
89
  //#endregion
86
- //#region src/services/keep-alive.d.ts
87
- /** Host alarm lease held while finite EDA work is actively running. */
88
- interface EDAKeepAliveLease {
89
- readonly release: () => Promise<void>;
90
- }
91
- /** Host-provided wrapper for keeping finite active work alive in Durable Objects. */
92
- interface EDAKeepAliveShape {
93
- /**
94
- * Durable Objects may hibernate after request/alarm callbacks finish, but EDA
95
- * continues work in Effect fibers after public ingress returns: model turns,
96
- * recovery drains, and durable sink catch-up. Wrap those finite active work
97
- * regions so the host can keep an alarm armed until the work either completes,
98
- * parks durably, fails, or is interrupted. Long-lived fibers blocked on queues
99
- * should not hold a lease.
100
- */
101
- readonly withActiveWork: <A, E, R>(label: string, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
102
- }
103
- declare const EDAKeepAlive_base: Context.ServiceClass<EDAKeepAlive, "@effect-durable-agent/EDAKeepAlive", EDAKeepAliveShape>;
104
- /** Host keep-alive service for finite active EDA work roots. */
105
- declare class EDAKeepAlive extends EDAKeepAlive_base {
106
- static readonly Noop: Layer.Layer<EDAKeepAlive, never, never>;
107
- static readonly FromAcquire: (acquire: (label: string) => Promise<EDAKeepAliveLease>) => Layer.Layer<EDAKeepAlive>;
108
- }
109
- //#endregion
110
- export { SessionContext as i, EventFactory as n, EventFactoryShape as r, EDAKeepAlive as t };
111
- //# sourceMappingURL=keep-alive-DYDsH6qN.d.ts.map
90
+ export { EventFactoryShape as n, SessionContext as r, EventFactory as t };
91
+ //# sourceMappingURL=event-factory-KaeDSfeP.d.ts.map
@@ -1,4 +1,5 @@
1
- import { $ as RecoveryCompletedEvent, $n as userMessagePromotedEventType, $t as UserMessageCancelledEvent, A as CompactionRequestedEvent, An as pendingMessagesPausedEventType, At as ToolCallFailedEvent, Bn as summaryCreatedEventType, Cn as contextRebasedEventType, Ct as SystemMessageCommittedEvent, Dn as inferenceFailedEventType, Dt as ToolCallCreatedEvent, E as CompactionCompletedEvent, En as inferenceCompletedEventType, Fn as runStartedEventType, Gn as toolCallRejectedEventType, Hn as toolCallCompletedEventType, In as steeringMessageCancelledEventType, Jn as turnFailedEventType, Jt as TurnStartedEvent, K as InferenceStartedEvent, Kn as toolCallStartedEventType, Kt as TurnFailedEvent, L as ContextRebasedEvent, Ln as steeringMessageQueuedEventType, Lt as ToolCallStartedEvent, M as CompactionStartedEvent, Mn as runCompletedEventType, Nn as runFailedEventType, Nt as ToolCallRejectedEvent, O as CompactionFailedEvent, On as inferenceStartedEventType, Pn as runInterruptedEventType, Qn as userMessageCommittedEventType, Rn as stopTurnAppliedEventType, S as CommandFailedEvent, Tt as ToolCallCompletedEvent, Un as toolCallCreatedEventType, Ut as TurnCompletedEvent, V as InferenceCompletedEvent, Vn as systemMessageCommittedEventType, W as InferenceFailedEvent, Wn as toolCallFailedEventType, Xn as turnStoppedEventType, Xt as TurnStoppedEvent, Yn as turnStartedEventType, Z as PendingMessagesPausedEvent, Zn as userMessageCancelledEventType, _ as CommandCancelledEvent, _n as commandStartedEventType, _t as StopTurnAppliedEvent, bn as compactionRequestedEventType, br as schemaV1, cn as assistantMessageCommittedEventType, ct as RunInterruptedEvent, er as userMessageSubmittedEventType, ft as SteeringMessageCancelledEvent, gn as commandFailedEventType, gr as UnixEpochMillis, h as CommandAdmittedEvent, hn as commandCompletedEventType, i as AssistantPartialCommittedEvent, in as UserMessagePromotedEvent, jn as recoveryCompletedEventType, ln as assistantPartialCommittedEventType, mn as commandCancelledEventType, mt as SteeringMessageQueuedEvent, on as UserMessageSubmittedEvent, ot as RunFailedEvent, pn as commandAdmittedEventType, qn as turnCompletedEventType, rt as RunCompletedEvent, t as AssistantMessageCommittedEvent, tn as UserMessageCommittedEvent, ut as RunStartedEvent, vn as compactionCompletedEventType, vr as effectDurableAgentNamespace, w as CommandStartedEvent, xn as compactionStartedEventType, xt as SummaryCreatedEvent, y as CommandCompletedEvent, yn as compactionFailedEventType, yt as StopTurnRequestedEvent, zn as stopTurnRequestedEventType } from "./durable-C3Rz7kg3.js";
1
+ import { _ as effectDurableAgentNamespace, h as UnixEpochMillis, y as schemaV1 } from "./envelope-DxQzo5rN.js";
2
+ import { $ as PendingMessagesPausedEvent, A as CompactionFailedEvent, An as commandStartedEventType, Bn as inferenceFailedEventType, Dn as commandCancelledEventType, E as CommandStartedEvent, En as commandAdmittedEventType, Et as SteeringMessageQueuedEvent, Ft as SystemMessageCommittedEvent, Gn as runCompletedEventType, Gt as ToolCallRejectedEvent, Ht as ToolCallFailedEvent, In as contextRebasedEventType, J as InferenceStartedEvent, Jn as runSchedulingDeliveredEventType, K as InferenceFailedEvent, Kn as runFailedEventType, Lt as ToolCallCompletedEvent, M as CompactionRequestedEvent, Mn as compactionFailedEventType, Nn as compactionRequestedEventType, Nt as SummaryCreatedEvent, O as CompactionCompletedEvent, On as commandCompletedEventType, P as CompactionStartedEvent, Pn as compactionStartedEventType, Qn as runStartedEventType, Sn as assistantPartialCommittedEventType, U as InferenceCompletedEvent, Un as pendingMessagesPausedEventType, Vn as inferenceStartedEventType, Wn as recoveryCompletedEventType, Xn as runSchedulingInvalidatedEventType, Yn as runSchedulingGrantedEventType, Yt as ToolCallStartedEvent, Zn as runSchedulingRequestedEventType, _ as CommandAdmittedEvent, _r as userMessagePromotedEventType, _t as RunSchedulingInvalidatedEvent, ar as systemMessageCommittedEventType, at as RunCompletedEvent, bn as assistantMessageCommittedEventType, cn as TurnStoppedEvent, cr as toolCallFailedEventType, ct as RunFailedEvent, dn as UserMessageCancelledEvent, dr as turnCompletedEventType, er as steeringMessageCancelledEventType, fr as turnFailedEventType, ft as RunSchedulingDeliveredEvent, gn as UserMessagePromotedEvent, gr as userMessageCommittedEventType, hr as userMessageCancelledEventType, ht as RunSchedulingGrantedEvent, in as TurnFailedEvent, ir as summaryCreatedEventType, jn as compactionCompletedEventType, jt as StopTurnRequestedEvent, kn as commandFailedEventType, kt as StopTurnAppliedEvent, lr as toolCallRejectedEventType, mr as turnStoppedEventType, nr as stopTurnAppliedEventType, o as AssistantPartialCommittedEvent, on as TurnStartedEvent, or as toolCallCompletedEventType, pn as UserMessageCommittedEvent, pr as turnStartedEventType, qn as runInterruptedEventType, rr as stopTurnRequestedEventType, sr as toolCallCreatedEventType, t as AssistantMessageCommittedEvent, tn as TurnCompletedEvent, tr as steeringMessageQueuedEventType, tt as RecoveryCompletedEvent, ur as toolCallStartedEventType, ut as RunInterruptedEvent, vn as UserMessageSubmittedEvent, vr as userMessageSubmittedEventType, w as CommandFailedEvent, wt as SteeringMessageCancelledEvent, x as CommandCompletedEvent, xt as RunStartedEvent, y as CommandCancelledEvent, yt as RunSchedulingRequestedEvent, z as ContextRebasedEvent, zn as inferenceCompletedEventType, zt as ToolCallCreatedEvent } from "./durable-BPHVFVvV.js";
2
3
  import { ReasoningDeltaEvent, TextDeltaEvent, ToolParamsDeltaEvent, ToolParamsEndEvent, ToolParamsStartEvent, reasoningDeltaEventType, textDeltaEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType } from "./types/events.js";
3
4
  import { IdGenerator } from "./services/id-generator.js";
4
5
  import { currentOrRootEDAEventTrace } from "./services/tracing.js";
@@ -63,6 +64,10 @@ var EventFactory = class EventFactory extends Context.Service()("@effect-durable
63
64
  steeringMessageCancelled: durable(SteeringMessageCancelledEvent, steeringMessageCancelledEventType),
64
65
  assistantMessageCommitted: durable(AssistantMessageCommittedEvent, assistantMessageCommittedEventType),
65
66
  assistantPartialCommitted: durable(AssistantPartialCommittedEvent, assistantPartialCommittedEventType),
67
+ runSchedulingRequested: durable(RunSchedulingRequestedEvent, runSchedulingRequestedEventType),
68
+ runSchedulingDelivered: durable(RunSchedulingDeliveredEvent, runSchedulingDeliveredEventType),
69
+ runSchedulingInvalidated: durable(RunSchedulingInvalidatedEvent, runSchedulingInvalidatedEventType),
70
+ runSchedulingGranted: durable(RunSchedulingGrantedEvent, runSchedulingGrantedEventType),
66
71
  runStarted: durable(RunStartedEvent, runStartedEventType),
67
72
  runCompleted: durable(RunCompletedEvent, runCompletedEventType),
68
73
  runFailed: durable(RunFailedEvent, runFailedEventType),
@@ -97,13 +102,6 @@ var EventFactory = class EventFactory extends Context.Service()("@effect-durable
97
102
  }));
98
103
  };
99
104
  //#endregion
100
- //#region src/services/keep-alive.ts
101
- /** Host keep-alive service for finite active EDA work roots. */
102
- var EDAKeepAlive = class EDAKeepAlive extends Context.Service()("@effect-durable-agent/EDAKeepAlive") {
103
- static Noop = Layer.succeed(EDAKeepAlive, { withActiveWork: (_label, effect) => effect });
104
- static FromAcquire = (acquire) => Layer.succeed(EDAKeepAlive, { withActiveWork: (label, effect) => Effect.acquireUseRelease(Effect.promise(() => acquire(label)), () => effect, (lease) => Effect.promise(() => lease.release())) });
105
- };
106
- //#endregion
107
- export { EventFactory as n, SessionContext as r, EDAKeepAlive as t };
105
+ export { SessionContext as n, EventFactory as t };
108
106
 
109
- //# sourceMappingURL=keep-alive-p8dIcSVy.js.map
107
+ //# sourceMappingURL=event-factory-QuC_UvyP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-factory-QuC_UvyP.js","names":[],"sources":["../src/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 RunSchedulingRequestedEvent,\n RunSchedulingRequestedPayload,\n runSchedulingRequestedEventType,\n RunSchedulingDeliveredEvent,\n RunSchedulingDeliveredPayload,\n runSchedulingDeliveredEventType,\n RunSchedulingInvalidatedEvent,\n RunSchedulingInvalidatedPayload,\n runSchedulingInvalidatedEventType,\n RunSchedulingGrantedEvent,\n RunSchedulingGrantedPayload,\n runSchedulingGrantedEventType,\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 runSchedulingRequested: (\n payload: RunSchedulingRequestedPayload,\n ) => Effect.Effect<RunSchedulingRequestedEvent>;\n readonly runSchedulingDelivered: (\n payload: RunSchedulingDeliveredPayload,\n ) => Effect.Effect<RunSchedulingDeliveredEvent>;\n readonly runSchedulingInvalidated: (\n payload: RunSchedulingInvalidatedPayload,\n ) => Effect.Effect<RunSchedulingInvalidatedEvent>;\n readonly runSchedulingGranted: (\n payload: RunSchedulingGrantedPayload,\n ) => Effect.Effect<RunSchedulingGrantedEvent>;\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 runSchedulingRequested: durable<RunSchedulingRequestedPayload, RunSchedulingRequestedEvent>(\n RunSchedulingRequestedEvent,\n runSchedulingRequestedEventType,\n ),\n runSchedulingDelivered: durable<RunSchedulingDeliveredPayload, RunSchedulingDeliveredEvent>(\n RunSchedulingDeliveredEvent,\n runSchedulingDeliveredEventType,\n ),\n runSchedulingInvalidated: durable<\n RunSchedulingInvalidatedPayload,\n RunSchedulingInvalidatedEvent\n >(RunSchedulingInvalidatedEvent, runSchedulingInvalidatedEventType),\n runSchedulingGranted: durable<RunSchedulingGrantedPayload, RunSchedulingGrantedEvent>(\n RunSchedulingGrantedEvent,\n runSchedulingGrantedEventType,\n ),\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;;;;;;;;AC8QA,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,wBAAwB,QACtB,6BACA,+BACF;GACA,wBAAwB,QACtB,6BACA,+BACF;GACA,0BAA0B,QAGxB,+BAA+B,iCAAiC;GAClE,sBAAsB,QACpB,2BACA,6BACF;GACA,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"}