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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +43 -41
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/{commands-Ce1ec6kH.d.ts → commands-3OD-p8dD.d.ts} +16 -9
  5. package/dist/compaction-63iEDHHl.js +523 -0
  6. package/dist/compaction-63iEDHHl.js.map +1 -0
  7. package/dist/context-projection-D_uRtK3r.d.ts +139 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-BcimKMIv.d.ts} +6 -4
  9. package/dist/delivery-2ZILvoRD.js +507 -0
  10. package/dist/delivery-2ZILvoRD.js.map +1 -0
  11. package/dist/{websocket-wire-D3tLrhe2.d.ts → delivery-RjM1_NAE.d.ts} +1019 -200
  12. package/dist/domain/command-queues.d.ts +81 -2
  13. package/dist/domain/command-queues.js +1 -1
  14. package/dist/domain/command-queues.js.map +1 -1
  15. package/dist/domain/context-projection.d.ts +2 -0
  16. package/dist/domain/context-projection.js +32 -0
  17. package/dist/domain/context-projection.js.map +1 -0
  18. package/dist/domain/message-transcript.d.ts +36 -2
  19. package/dist/domain/message-transcript.js +10 -2
  20. package/dist/domain/message-transcript.js.map +1 -1
  21. package/dist/domain/model-usage.d.ts +2 -0
  22. package/dist/domain/model-usage.js +59 -0
  23. package/dist/domain/model-usage.js.map +1 -0
  24. package/dist/domain/reduced-state-schema.d.ts +3 -996
  25. package/dist/domain/reduced-state-schema.js +121 -12
  26. package/dist/domain/reduced-state-schema.js.map +1 -1
  27. package/dist/domain/reduced-state.d.ts +3 -2
  28. package/dist/domain/reduced-state.js +937 -2
  29. package/dist/domain/reduced-state.js.map +1 -0
  30. package/dist/domain/run-scheduling.d.ts +2 -0
  31. package/dist/domain/run-scheduling.js +127 -0
  32. package/dist/domain/run-scheduling.js.map +1 -0
  33. package/dist/{durable-DlScwmCy.d.ts → durable-Cqv5ZRFA.d.ts} +8505 -2497
  34. package/dist/{durable-C3Rz7kg3.js → durable-D13w1Qr3.js} +253 -91
  35. package/dist/durable-D13w1Qr3.js.map +1 -0
  36. package/dist/envelope-BCzKUq_z.js +91 -0
  37. package/dist/envelope-BCzKUq_z.js.map +1 -0
  38. package/dist/envelope-Che6KatU.d.ts +254 -0
  39. package/dist/{keep-alive-p8dIcSVy.js → event-factory-_vF1bIJ7.js} +8 -10
  40. package/dist/event-factory-_vF1bIJ7.js.map +1 -0
  41. package/dist/{events-Bb9-Cu-7.d.ts → events-Dg0o5wWs.d.ts} +140 -324
  42. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
  43. package/dist/in-memory-CeODnZhE.js +150 -0
  44. package/dist/in-memory-CeODnZhE.js.map +1 -0
  45. package/dist/index.d.ts +8 -7
  46. package/dist/index.js +6 -5
  47. package/dist/interpreter-DKGJ1sSx.js +1452 -0
  48. package/dist/interpreter-DKGJ1sSx.js.map +1 -0
  49. package/dist/keep-alive-_zFCUvt3.d.ts +28 -0
  50. package/dist/model-resolver-D0vcDZsU.d.ts +24 -0
  51. package/dist/model-usage-0GeHwaaU.d.ts +54 -0
  52. package/dist/records--54mZEBx.js +675 -0
  53. package/dist/records--54mZEBx.js.map +1 -0
  54. package/dist/reduced-state-DU2ECOUp.d.ts +47821 -0
  55. package/dist/reduced-state-schema-B2t3cobf.d.ts +2187 -0
  56. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-JLU1yptN.d.ts} +24 -8
  57. package/dist/run-scheduling-wakeup-D_bGdicf.d.ts +24 -0
  58. package/dist/services/compaction.d.ts +2 -2
  59. package/dist/services/compaction.js +2 -426
  60. package/dist/services/id-generator.d.ts +1 -1
  61. package/dist/services/id-generator.js +4 -2
  62. package/dist/services/id-generator.js.map +1 -1
  63. package/dist/services/keep-alive.d.ts +2 -0
  64. package/dist/services/keep-alive.js +13 -0
  65. package/dist/services/keep-alive.js.map +1 -0
  66. package/dist/services/model-call.d.ts +15 -0
  67. package/dist/services/model-call.js +15 -0
  68. package/dist/services/model-call.js.map +1 -0
  69. package/dist/services/model-resolver.d.ts +2 -0
  70. package/dist/services/model-resolver.js +17 -0
  71. package/dist/services/model-resolver.js.map +1 -0
  72. package/dist/services/prompt-projector.d.ts +2 -2
  73. package/dist/services/prompt-projector.js +49 -5
  74. package/dist/services/prompt-projector.js.map +1 -1
  75. package/dist/services/reducer-registry.d.ts +2 -2
  76. package/dist/services/reducer-registry.js +21 -4
  77. package/dist/services/reducer-registry.js.map +1 -1
  78. package/dist/services/run-scheduler.d.ts +2 -0
  79. package/dist/services/run-scheduler.js +25 -0
  80. package/dist/services/run-scheduler.js.map +1 -0
  81. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  82. package/dist/services/run-scheduling-wakeup.js +13 -0
  83. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  84. package/dist/services/runtime-layer.d.ts +48 -0
  85. package/dist/services/runtime-layer.js +51 -0
  86. package/dist/services/runtime-layer.js.map +1 -0
  87. package/dist/services/runtime.d.ts +1 -1
  88. package/dist/services/runtime.js +34 -20
  89. package/dist/services/runtime.js.map +1 -1
  90. package/dist/services/session-event-observer.d.ts +2 -0
  91. package/dist/services/session-event-observer.js +13 -0
  92. package/dist/services/session-event-observer.js.map +1 -0
  93. package/dist/services/session-query.d.ts +2 -2
  94. package/dist/services/session-query.js +141 -2
  95. package/dist/services/session-query.js.map +1 -0
  96. package/dist/services/session-state.d.ts +2 -0
  97. package/dist/services/session-state.js +2 -0
  98. package/dist/services/session-store.d.ts +2 -2
  99. package/dist/services/session-store.js +272 -2
  100. package/dist/services/session-store.js.map +1 -0
  101. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  102. package/dist/services/sink-checkpoint-store.js +50 -0
  103. package/dist/services/sink-checkpoint-store.js.map +1 -0
  104. package/dist/services/sink-registry.d.ts +2 -2
  105. package/dist/services/sink-registry.js +1 -1
  106. package/dist/services/span-names.d.ts +1 -1
  107. package/dist/services/span-names.js +7 -1
  108. package/dist/services/span-names.js.map +1 -1
  109. package/dist/services/tool-registry.d.ts +2 -2
  110. package/dist/services/tool-registry.js +12 -3
  111. package/dist/services/tool-registry.js.map +1 -1
  112. package/dist/services/tracing.d.ts +3 -3
  113. package/dist/services/tracing.js +25 -4
  114. package/dist/services/tracing.js.map +1 -1
  115. package/dist/session-event-observer-HvrRckbC.d.ts +24 -0
  116. package/dist/{session-query-Cbf-e0rG.js → session-state-BQYsuBqi.js} +693 -251
  117. package/dist/session-state-BQYsuBqi.js.map +1 -0
  118. package/dist/session-store-CQxg9U82.d.ts +3302 -0
  119. package/dist/sink-checkpoint-store-DWGifxp0.d.ts +39 -0
  120. package/dist/sink-registry-DskRcyOS.js +345 -0
  121. package/dist/sink-registry-DskRcyOS.js.map +1 -0
  122. package/dist/subscription-DmO3BcdT.js +505 -0
  123. package/dist/subscription-DmO3BcdT.js.map +1 -0
  124. package/dist/subscription-rC35dAWn.d.ts +958 -0
  125. package/dist/testkit/layers.d.ts +34 -19
  126. package/dist/testkit/layers.js +30 -16
  127. package/dist/testkit/layers.js.map +1 -1
  128. package/dist/testkit/transcript.d.ts +226 -0
  129. package/dist/testkit/transcript.js +1475 -0
  130. package/dist/testkit/transcript.js.map +1 -0
  131. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BzlMhwzj.d.ts} +44 -8
  132. package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
  133. package/dist/transcript.d.ts +101 -0
  134. package/dist/transcript.js +107 -0
  135. package/dist/transcript.js.map +1 -0
  136. package/dist/types/commands.d.ts +2 -2
  137. package/dist/types/commands.js +8 -3
  138. package/dist/types/commands.js.map +1 -1
  139. package/dist/types/core.d.ts +2 -2
  140. package/dist/types/core.js +4 -2
  141. package/dist/types/core.js.map +1 -1
  142. package/dist/types/events/durable.d.ts +2 -2
  143. package/dist/types/events/durable.js +2 -2
  144. package/dist/types/events.d.ts +5 -4
  145. package/dist/types/events.js +3 -2
  146. package/dist/types/events.js.map +1 -1
  147. package/dist/types/tracing.d.ts +1 -1
  148. package/dist/types/tracing.js.map +1 -1
  149. package/dist/websocket/events.d.ts +2 -0
  150. package/dist/websocket/events.js +2 -0
  151. package/dist/websocket.d.ts +2201 -0
  152. package/dist/websocket.js +684 -0
  153. package/dist/websocket.js.map +1 -0
  154. package/dist/window-read-CBZEJ84M.d.ts +113 -0
  155. package/dist/window-read-DPFAA1hM.js +264 -0
  156. package/dist/window-read-DPFAA1hM.js.map +1 -0
  157. package/package.json +87 -46
  158. package/testing/offline-trace/README.md +2 -1
  159. package/CHANGELOG.md +0 -25
  160. package/CONTRIBUTING.md +0 -26
  161. package/SECURITY.md +0 -7
  162. package/dist/command-queues-CQ9cwRP7.d.ts +0 -468
  163. package/dist/compaction-1LSZR944.d.ts +0 -144
  164. package/dist/durable-C3Rz7kg3.js.map +0 -1
  165. package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
  166. package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
  167. package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
  168. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  169. package/dist/host/durable-object-runtime.d.ts +0 -2
  170. package/dist/host/durable-object-runtime.js +0 -2
  171. package/dist/host/durable-object-storage.d.ts +0 -2
  172. package/dist/host/durable-object-storage.js +0 -0
  173. package/dist/host/durable-object.d.ts +0 -83
  174. package/dist/host/durable-object.js +0 -191
  175. package/dist/host/durable-object.js.map +0 -1
  176. package/dist/host/websocket-wire.d.ts +0 -2
  177. package/dist/host/websocket-wire.js +0 -105
  178. package/dist/host/websocket-wire.js.map +0 -1
  179. package/dist/index-BVVgDSdq.d.ts +0 -1
  180. package/dist/keep-alive-DYDsH6qN.d.ts +0 -111
  181. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  182. package/dist/message-transcript-BCHdHAe2.d.ts +0 -32
  183. package/dist/prompt-projector-DimXJPOJ.d.ts +0 -39
  184. package/dist/reduced-state-C4nVVzz9.js +0 -910
  185. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  186. package/dist/runtime-DcdPOEuE.d.ts +0 -60
  187. package/dist/services/compaction.js.map +0 -1
  188. package/dist/session-query-Cbf-e0rG.js.map +0 -1
  189. package/dist/session-query-hxfujxUH.d.ts +0 -769
  190. package/dist/session-store-D2Ore1QC.d.ts +0 -295
  191. package/dist/session-store-pYxQW9qh.js +0 -214
  192. package/dist/session-store-pYxQW9qh.js.map +0 -1
  193. package/dist/sink-registry-BziFpxoE.d.ts +0 -158
  194. package/dist/sink-registry-CFC6xjsN.js +0 -312
  195. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  196. package/docs/assets/architecture.svg +0 -216
  197. package/docs/assets/event-sequence.svg +0 -133
  198. package/docs/assets/gcp-trace.png +0 -0
  199. package/docs/assets/hero.svg +0 -33
  200. package/docs/message-steering.md +0 -831
  201. package/docs/releasing.md +0 -96
  202. package/docs/spec.md +0 -777
  203. package/docs/subagents.md +0 -725
  204. package/docs/testing.md +0 -64
  205. package/docs/ui-projection.md +0 -742
  206. package/docs/websocket-protocol.md +0 -639
  207. package/examples/001-no-tools/README.md +0 -65
  208. package/examples/001-no-tools/worker.ts +0 -79
  209. package/examples/002-slack-bridge/README.md +0 -134
  210. package/examples/002-slack-bridge/events.ts +0 -115
  211. package/examples/002-slack-bridge/reducer.ts +0 -216
  212. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  213. package/examples/002-slack-bridge/sinks.ts +0 -109
  214. package/examples/002-slack-bridge/worker.ts +0 -140
  215. package/examples/003-sandbox-lifecycle/README.md +0 -78
  216. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  217. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  218. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  219. package/examples/_shared/event-id.ts +0 -12
  220. package/examples/_shared/http.ts +0 -27
  221. package/examples/_shared/openai.ts +0 -33
@@ -1,22 +1,38 @@
1
- import { t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
1
+ import { t as DurableEventEnvelope } from "./envelope-Che6KatU.js";
2
+ import { H as DecodedDurableEvent } from "./durable-Cqv5ZRFA.js";
3
+ import "./events-Dg0o5wWs.js";
4
+ import { t as CommittedDurableEvent } from "./session-store-CQxg9U82.js";
2
5
  import * as Context from "effect/Context";
3
6
  import * as Layer from "effect/Layer";
4
7
  import * as Schema from "effect/Schema";
5
-
6
8
  //#region src/services/reducer-registry.d.ts
7
- /** App-specific pure reducer over the durable session event log. */
8
- interface EDAReducer<State = unknown, Name extends string = string> {
9
+ /** Input accepted by the reducer constructor before schema codecs are materialized. */
10
+ interface EDAReducerDefinition<State, Name extends string = string, E = DecodedDurableEvent> {
9
11
  readonly name: Name;
10
12
  readonly initial: State;
11
13
  readonly stateSchema: Schema.Codec<State, unknown, never, never>;
12
14
  readonly schemaVersion?: number;
13
15
  readonly encode?: (state: State) => unknown;
14
16
  readonly decode?: (payload: unknown) => State;
17
+ /** Return the next state without mutating the input; projections may be shared across sinks. */
18
+ reduce(state: State, event: CommittedDurableEvent<E>): State;
19
+ }
20
+ /** App-specific pure reducer over the durable session event log. */
21
+ interface EDAReducer<State = unknown, Name extends string = string> {
22
+ readonly name: Name;
23
+ readonly initial: State;
24
+ readonly stateSchema: Schema.Codec<State, unknown, never, never>;
25
+ readonly schemaVersion?: number;
26
+ encode(state: State): unknown;
27
+ decode(payload: unknown): State;
28
+ /** Return the next state without mutating the input; projections may be shared across sinks. */
15
29
  reduce(state: State, event: CommittedDurableEvent): State;
16
30
  }
17
31
  /** Convenience constructor preserving a reducer's literal name and schema-derived state type. */
18
32
  declare const EDAReducer: {
19
- make: <State, const Name extends string = string>(reducer: EDAReducer<State, Name>) => EDAReducer<State, Name>;
33
+ /** Select and narrow reducer input from one event schema; malformed registered events fail in the store. */
34
+ forEvents: <E extends DurableEventEnvelope, State, const Name extends string>(events: Schema.Codec<E, unknown, never, never>, reducer: EDAReducerDefinition<State, Name, E>) => EDAReducer<State, Name>;
35
+ make: <State, const Name extends string = string>(reducer: EDAReducerDefinition<State, Name>) => EDAReducer<State, Name>;
20
36
  };
21
37
  /** Snapshot of all app reducer states, keyed by reducer name. */
22
38
  type EDAReducerStateSnapshot = ReadonlyMap<string, unknown>;
@@ -28,7 +44,7 @@ type EDAReducerStateForName<Entry extends EDASerializedReducerState, Name extend
28
44
  readonly name: Name;
29
45
  }>["state"];
30
46
  /** Exact reducer object required for every member of a serialized state union. */
31
- type EDAReducersFor<Entry extends EDASerializedReducerState> = { readonly [Name in Entry["name"]]: EDAReducer<EDAReducerStateForName<Entry, Name>, Name> };
47
+ type EDAReducersFor<Entry extends EDASerializedReducerState> = { readonly [Name in Entry["name"]]: EDAReducer<EDAReducerStateForName<Entry, Name>, Name>; };
32
48
  /** Schema-backed app reducer registry used by both runtime folding and snapshot serialization. */
33
49
  interface EDATypedReducerRegistry<EntrySchema extends Schema.Codec<EDASerializedReducerState, unknown, never, never>> {
34
50
  readonly entrySchema: EntrySchema;
@@ -65,5 +81,5 @@ declare class EDAReducerRegistry extends EDAReducerRegistry_base {
65
81
  /** Read one typed reducer state from a snapshot. */
66
82
  declare const getEDAReducerState: <State, Name extends string>(snapshot: EDAReducerStateSnapshot, reducer: EDAReducer<State, Name>) => State;
67
83
  //#endregion
68
- export { EDAReducersFor as a, defineEDAReducerRegistry as c, getEDAReducerState as d, reducerSchemaVersion as f, EDAReducerStateSnapshot as i, edaReservedReducerNamePrefix as l, EDAReducerRegistry as n, EDATypedReducerRegistry as o, EDAReducerRegistryShape as r, decodeReducerState as s, EDAReducer as t, encodeReducerState as u };
69
- //# sourceMappingURL=reducer-registry-C0svUa63.d.ts.map
84
+ export { EDAReducerStateSnapshot as a, decodeReducerState as c, encodeReducerState as d, getEDAReducerState as f, EDAReducerRegistryShape as i, defineEDAReducerRegistry as l, EDAReducerDefinition as n, EDAReducersFor as o, reducerSchemaVersion as p, EDAReducerRegistry as r, EDATypedReducerRegistry as s, EDAReducer as t, edaReservedReducerNamePrefix as u };
85
+ //# sourceMappingURL=reducer-registry-JLU1yptN.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { s as EDASessionStoreError } from "./session-store-CQxg9U82.js";
2
+ import * as Context from "effect/Context";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
+ //#region src/services/run-scheduling-wakeup.d.ts
6
+ /**
7
+ * Host-owned durable retry obligation for undelivered run authorization requests.
8
+ * setPending(true) must arm a wakeup before returning, survive eviction, and keep
9
+ * retrying until setPending(false). The callback invokes retryRunSchedulingDelivery.
10
+ * Hosts must reconcile this obligation with their active-work alarms, never delete
11
+ * it when an unrelated lease ends, and reconstruct it before recovery releases work.
12
+ */
13
+ interface RunSchedulingWakeupShape {
14
+ readonly setPending: (pending: boolean) => Effect.Effect<void, EDASessionStoreError>;
15
+ }
16
+ declare const RunSchedulingWakeup_base: Context.ServiceClass<RunSchedulingWakeup, "@effect-durable-agent/RunSchedulingWakeup", RunSchedulingWakeupShape>;
17
+ /** Required durable host capability when a scheduler can resolve Deferred. */
18
+ declare class RunSchedulingWakeup extends RunSchedulingWakeup_base {
19
+ /** Immediate runtimes need no wakeup; fail before persisting unsupported deferral. */
20
+ static readonly Unsupported: Layer.Layer<RunSchedulingWakeup, never, never>;
21
+ }
22
+ //#endregion
23
+ export { RunSchedulingWakeupShape as n, RunSchedulingWakeup as t };
24
+ //# sourceMappingURL=run-scheduling-wakeup-D_bGdicf.d.ts.map
@@ -1,2 +1,2 @@
1
- import { _ as defaultCompactionRetainTailTokens, a as CompactionExecutorShape, c as CompactionPolicy, d as CompactionRunner, f as CompactionRunnerInput, g as defaultCompactionMinSummarizableTokens, h as defaultCompactionCharsPerToken, i as CompactionExecutorInput, l as CompactionPolicyInput, m as LanguageModelSummaryCompactionExecutorOptions, n as CompactionError, o as CompactionOutput, p as CompactionRunnerShape, r as CompactionExecutor, s as CompactionPlan, t as ApproximateTokenThresholdCompactionPolicyOptions, u as CompactionPolicyShape, v as defaultCompactionThresholdTokens } from "../compaction-1LSZR944.js";
2
- export { ApproximateTokenThresholdCompactionPolicyOptions, CompactionError, CompactionExecutor, CompactionExecutorInput, CompactionExecutorShape, CompactionOutput, CompactionPlan, CompactionPolicy, CompactionPolicyInput, CompactionPolicyShape, CompactionRunner, CompactionRunnerInput, CompactionRunnerShape, LanguageModelSummaryCompactionExecutorOptions, defaultCompactionCharsPerToken, defaultCompactionMinSummarizableTokens, defaultCompactionRetainTailTokens, defaultCompactionThresholdTokens };
1
+ import { Cn as defaultCompactionThresholdTokens, Sn as defaultCompactionSummaryInstructions, _n as LanguageModelSummaryCompactionExecutorOptions, an as CompactionError, bn as defaultCompactionMinSummarizableTokens, cn as CompactionExecutorShape, dn as CompactionPolicy, fn as CompactionPolicyInput, gn as CompactionRunnerShape, hn as CompactionRunnerInput, in as ApproximateTokenThresholdCompactionPolicyOptions, ln as CompactionOutput, mn as CompactionRunner, on as CompactionExecutor, pn as CompactionPolicyShape, sn as CompactionExecutorInput, un as CompactionPlan, vn as PromptPrefixSummaryCompactionExecutorOptions, wn as promptPrefixSummaryCompactionExecutor, xn as defaultCompactionRetainTailTokens, yn as defaultCompactionCharsPerToken } from "../reduced-state-DU2ECOUp.js";
2
+ export { ApproximateTokenThresholdCompactionPolicyOptions, CompactionError, CompactionExecutor, CompactionExecutorInput, CompactionExecutorShape, CompactionOutput, CompactionPlan, CompactionPolicy, CompactionPolicyInput, CompactionPolicyShape, CompactionRunner, CompactionRunnerInput, CompactionRunnerShape, LanguageModelSummaryCompactionExecutorOptions, PromptPrefixSummaryCompactionExecutorOptions, defaultCompactionCharsPerToken, defaultCompactionMinSummarizableTokens, defaultCompactionRetainTailTokens, defaultCompactionSummaryInstructions, defaultCompactionThresholdTokens, promptPrefixSummaryCompactionExecutor };
@@ -1,426 +1,2 @@
1
- import { ContextVersion, SequenceNumber } from "../types/core.js";
2
- import { cr as FailurePayload } from "../durable-C3Rz7kg3.js";
3
- import { d as CompactionSummaryArtifact, l as CompactionExecutorId, u as CompactionPolicyId } from "../session-store-pYxQW9qh.js";
4
- import { durableMessageTranscript } from "../domain/message-transcript.js";
5
- import { IdGenerator } from "./id-generator.js";
6
- import { n as EventFactory, t as EDAKeepAlive } from "../keep-alive-p8dIcSVy.js";
7
- import { annotateEdaSpan, committedBatchAttributes } from "./tracing.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 Schema from "effect/Schema";
12
- import * as Prompt from "effect/unstable/ai/Prompt";
13
- import * as LanguageModel from "effect/unstable/ai/LanguageModel";
14
- //#region src/services/compaction.ts
15
- /** Candidate durable range and retained cursor selected by compaction policy. */
16
- const CompactionPlan = Schema.Struct({
17
- policyId: CompactionPolicyId,
18
- sourceFromSeq: SequenceNumber,
19
- sourceToSeq: SequenceNumber,
20
- retainedFromContextSeq: SequenceNumber
21
- });
22
- /** Rough token heuristic used by the built-in compaction presets. */
23
- const defaultCompactionCharsPerToken = 4;
24
- /** Production-oriented context threshold for the built-in approximate-token policy. */
25
- const defaultCompactionThresholdTokens = 22e4;
26
- /** Recent model-facing tail retained verbatim by the built-in approximate-token policy. */
27
- const defaultCompactionRetainTailTokens = 4e4;
28
- /** Minimum newly summarizable prefix needed before the approximate-token policy plans work. */
29
- const defaultCompactionMinSummarizableTokens = 1e4;
30
- /** Result produced by the summary executor before the framework commits it. */
31
- const CompactionOutput = Schema.Struct({
32
- text: Schema.NonEmptyString,
33
- promptMessage: Prompt.UserMessage,
34
- executorId: Schema.optionalKey(CompactionExecutorId)
35
- });
36
- /** Typed failure from policy planning or summary generation. */
37
- var CompactionError = class extends Schema.TaggedErrorClass()("CompactionError", { message: Schema.String }) {};
38
- /** Decides whether a safe prompt-context rebase should be attempted. */
39
- var CompactionPolicy = class CompactionPolicy extends Context.Service()("@effect-durable-agent/CompactionPolicy") {
40
- /** Default policy: compaction is disabled and commits no skip events. */
41
- static Disabled = Layer.succeed(CompactionPolicy, {
42
- id: CompactionPolicyId.make("disabled"),
43
- plan: () => Effect.succeed(void 0)
44
- });
45
- /** Test/app hook for replacing the policy with a concrete planner. */
46
- static FromFunction = (id, plan) => Layer.succeed(CompactionPolicy, {
47
- id: CompactionPolicyId.make(id),
48
- plan
49
- });
50
- /**
51
- * Common production policy: compact when approximate prompt context exceeds a token threshold.
52
- *
53
- * The policy keeps a recent tail verbatim, summarizes the older prefix, and advances from the
54
- * current summary cursor so repeated compactions behave like the first one.
55
- */
56
- static ApproximateTokenThreshold = (options = {}) => {
57
- const normalized = normalizeApproximateTokenPolicyOptions(options);
58
- return Layer.succeed(CompactionPolicy, {
59
- id: normalized.policyId,
60
- plan: ({ state, context }) => Effect.sync(() => planApproximateTokenCompaction(state, context, normalized))
61
- });
62
- };
63
- };
64
- /** Produces a cumulative summary artifact for a selected compaction plan. */
65
- var CompactionExecutor = class CompactionExecutor extends Context.Service()("@effect-durable-agent/CompactionExecutor") {
66
- /** Placeholder executor for the disabled default policy. It should never be called. */
67
- static Disabled = Layer.succeed(CompactionExecutor, {
68
- id: CompactionExecutorId.make("disabled"),
69
- execute: () => Effect.die(/* @__PURE__ */ new Error("CompactionExecutor.Disabled was called"))
70
- });
71
- /** Test/app hook for replacing summary generation. */
72
- static FromFunction = (id, execute) => Layer.succeed(CompactionExecutor, {
73
- id: CompactionExecutorId.make(id),
74
- execute
75
- });
76
- /** Summary executor backed by the configured Effect AI LanguageModel. */
77
- static LanguageModelSummary = (options = {}) => Layer.effect(CompactionExecutor, Effect.gen(function* () {
78
- const languageModel = yield* LanguageModel.LanguageModel;
79
- const executorId = CompactionExecutorId.make(options.executorId ?? "language-model-summary");
80
- const summaryMessagePrefix = options.summaryMessagePrefix ?? "Conversation summary:";
81
- return {
82
- id: executorId,
83
- execute: Effect.fn("agent.compaction")(function* (input) {
84
- yield* annotateEdaSpan({
85
- "eda.compaction.policy_id": input.plan.policyId,
86
- "eda.compaction.source_from_seq": input.plan.sourceFromSeq,
87
- "eda.compaction.source_to_seq": input.plan.sourceToSeq,
88
- "eda.compaction.retained_from_context_seq": input.plan.retainedFromContextSeq,
89
- "eda.compaction.executor_id": executorId
90
- });
91
- const promptText = buildSummaryPrompt(input);
92
- if (promptText === void 0) return yield* new CompactionError({ message: "compaction plan selected no source messages" });
93
- const text = (yield* languageModel.generateText({
94
- prompt: Prompt.fromMessages([Prompt.makeMessage("system", { content: summarizationSystemPrompt }), Prompt.makeMessage("user", { content: [Prompt.textPart({ text: promptText })] })]),
95
- toolChoice: "none"
96
- }).pipe(Effect.mapError((error) => new CompactionError({ message: `summary model failed: ${formatUnknownError(error)}` })))).text.trim();
97
- if (text.length === 0) return yield* new CompactionError({ message: "summary model returned no text" });
98
- return CompactionOutput.make({
99
- text,
100
- promptMessage: Prompt.makeMessage("user", { content: [Prompt.textPart({ text: `${summaryMessagePrefix}\n\n${text}` })] }),
101
- executorId
102
- });
103
- })
104
- };
105
- }));
106
- };
107
- /** Framework-owned compaction lifecycle runner. */
108
- var CompactionRunner = class CompactionRunner extends Context.Service()("@effect-durable-agent/CompactionRunner") {
109
- static Live = Layer.effect(CompactionRunner, Effect.suspend(() => makeLiveCompactionRunner));
110
- };
111
- const makeLiveCompactionRunner = Effect.gen(function* () {
112
- const ids = yield* IdGenerator;
113
- const events = yield* EventFactory;
114
- const policy = yield* CompactionPolicy;
115
- const executor = yield* CompactionExecutor;
116
- const keepAlive = yield* EDAKeepAlive;
117
- return { maybeCompact: Effect.fnUntraced(function* (input) {
118
- const plan = yield* policy.plan({
119
- state: input.state,
120
- context: input.context
121
- }).pipe(Effect.catchTag("CompactionError", (error) => Effect.logError("compaction policy failed", { error }).pipe(Effect.as(void 0))));
122
- if (plan === void 0) {
123
- yield* annotateEdaSpan({ "eda.compaction.selected": false });
124
- return [];
125
- }
126
- yield* annotateEdaSpan({
127
- "eda.compaction.selected": true,
128
- "eda.compaction.policy_id": plan.policyId,
129
- "eda.compaction.source_from_seq": plan.sourceFromSeq,
130
- "eda.compaction.source_to_seq": plan.sourceToSeq,
131
- "eda.compaction.retained_from_context_seq": plan.retainedFromContextSeq
132
- });
133
- const invalidPlan = validatePlan(plan, input.state, input.context);
134
- if (invalidPlan !== void 0) {
135
- yield* Effect.logError("compaction policy returned invalid plan", { reason: invalidPlan });
136
- return [];
137
- }
138
- const compactionId = yield* ids.makeCompactionId();
139
- const summaryId = yield* ids.makeSummaryId();
140
- yield* annotateEdaSpan({
141
- "eda.compaction.id": compactionId,
142
- "eda.summary.id": summaryId
143
- });
144
- const requested = yield* events.compactionRequested({
145
- compactionId,
146
- sourceFromSeq: plan.sourceFromSeq,
147
- sourceToSeq: plan.sourceToSeq
148
- });
149
- const started = yield* events.compactionStarted({ compactionId });
150
- const startedEvents = yield* input.appendDurableEntries([{ event: requested }, { event: started }]);
151
- const output = yield* keepAlive.withActiveWork(`compaction:${compactionId}`, executor.execute({
152
- plan,
153
- state: input.state,
154
- context: input.context
155
- })).pipe(Effect.catchTag("CompactionError", (error) => Effect.gen(function* () {
156
- const failed = yield* events.compactionFailed({
157
- compactionId,
158
- error: FailurePayload.make({ message: error.message })
159
- });
160
- return {
161
- _tag: "Failed",
162
- committed: yield* input.appendDurableEntries([{ event: failed }])
163
- };
164
- })), Effect.map((result) => "_tag" in result ? result : {
165
- _tag: "Output",
166
- output: result
167
- }));
168
- if (output._tag === "Failed") return [...startedEvents, ...output.committed];
169
- const artifact = CompactionSummaryArtifact.make({
170
- compactionId,
171
- summaryId,
172
- ...input.context.currentSummary === void 0 ? {} : { previousSummaryId: input.context.currentSummary.summaryId },
173
- sourceFromSeq: plan.sourceFromSeq,
174
- sourceToSeq: plan.sourceToSeq,
175
- retainedFromContextSeq: plan.retainedFromContextSeq,
176
- text: output.output.text,
177
- promptMessage: output.output.promptMessage,
178
- policyId: plan.policyId,
179
- ...output.output.executorId === void 0 ? {} : { executorId: output.output.executorId }
180
- });
181
- const summaryCreated = yield* events.summaryCreated({
182
- compactionId,
183
- summaryId,
184
- sourceFromSeq: plan.sourceFromSeq,
185
- sourceToSeq: plan.sourceToSeq,
186
- summary: artifact
187
- });
188
- const contextRebased = yield* events.contextRebased({
189
- compactionId,
190
- summaryId,
191
- contextVersion: ContextVersion.make(input.context.contextVersion + 1),
192
- retainedFromContextSeq: plan.retainedFromContextSeq
193
- });
194
- const completed = yield* events.compactionCompleted({ compactionId });
195
- const committed = yield* input.appendDurableEntries([
196
- { event: summaryCreated },
197
- { event: contextRebased },
198
- { event: completed }
199
- ]);
200
- yield* annotateEdaSpan(committedBatchAttributes([...startedEvents, ...committed]));
201
- return [...startedEvents, ...committed];
202
- }) };
203
- });
204
- const validatePlan = (plan, state, context) => {
205
- const currentRetainedFromSeq = context.currentSummary?.retainedFromContextSeq ?? SequenceNumber.make(0);
206
- if (plan.retainedFromContextSeq <= currentRetainedFromSeq) return "retainedFromContextSeq must advance beyond the current summary cursor";
207
- if (plan.sourceToSeq > state.lastSeq) return "sourceToSeq must not exceed the current durable head";
208
- if (plan.retainedFromContextSeq > state.lastSeq + 1) return "retainedFromContextSeq must not skip unsummarized future context";
209
- if (plan.sourceFromSeq > plan.sourceToSeq) return "sourceFromSeq must be less than or equal to sourceToSeq";
210
- if (plan.retainedFromContextSeq <= plan.sourceToSeq) return "retainedFromContextSeq must start after the summarized source range";
211
- };
212
- const normalizeApproximateTokenPolicyOptions = (options) => ({
213
- policyId: CompactionPolicyId.make(options.policyId ?? "approximate-token-threshold"),
214
- thresholdTokens: positiveNumber(options.thresholdTokens ?? 22e4, "thresholdTokens"),
215
- retainTailTokens: nonNegativeNumber(options.retainTailTokens ?? 4e4, "retainTailTokens"),
216
- minSummarizableTokens: nonNegativeNumber(options.minSummarizableTokens ?? 1e4, "minSummarizableTokens"),
217
- charsPerToken: positiveNumber(options.charsPerToken ?? 4, "charsPerToken")
218
- });
219
- const positiveNumber = (value, name) => {
220
- if (!Number.isFinite(value) || value <= 0) throw new Error(`${name} must be a positive finite number`);
221
- return value;
222
- };
223
- const nonNegativeNumber = (value, name) => {
224
- if (!Number.isFinite(value) || value < 0) throw new Error(`${name} must be a non-negative finite number`);
225
- return value;
226
- };
227
- /** Plan one Pi-style approximate-token compaction while keeping a recent tail verbatim. */
228
- const planApproximateTokenCompaction = (state, context, options) => {
229
- const messages = estimatedContextMessages(state);
230
- if (estimateCurrentPromptChars(state, context, messages) <= options.thresholdTokens * options.charsPerToken) return;
231
- const currentRetainedFromSeq = context.currentSummary?.retainedFromContextSeq ?? SequenceNumber.make(0);
232
- const retainedFromSeq = selectRetainedFromSeq(messages, state.lastSeq, options);
233
- if (retainedFromSeq <= currentRetainedFromSeq) return;
234
- const sourceMessages = messages.filter((message) => message.seq < retainedFromSeq);
235
- if (sourceMessages.length === 0) return;
236
- if (charsToTokens(sourceMessages.reduce((sum, message) => sum + message.chars, 0), options.charsPerToken) < options.minSummarizableTokens) return;
237
- const sourceFromSeq = currentRetainedFromSeq > 0 ? currentRetainedFromSeq : sourceMessages[0].seq;
238
- const sourceToSeq = SequenceNumber.make(retainedFromSeq - 1);
239
- if (sourceFromSeq > sourceToSeq) return;
240
- return CompactionPlan.make({
241
- policyId: options.policyId,
242
- sourceFromSeq,
243
- sourceToSeq,
244
- retainedFromContextSeq: retainedFromSeq
245
- });
246
- };
247
- const selectRetainedFromSeq = (messages, lastSeq, options) => {
248
- if (options.retainTailTokens === 0) return SequenceNumber.make(lastSeq + 1);
249
- const retainTailChars = options.retainTailTokens * options.charsPerToken;
250
- let tailChars = 0;
251
- let retainedIndex = messages.length;
252
- for (let index = messages.length - 1; index >= 0; index--) {
253
- tailChars += messages[index].chars;
254
- retainedIndex = index;
255
- if (tailChars >= retainTailChars) break;
256
- }
257
- return retainedIndex >= messages.length ? SequenceNumber.make(lastSeq + 1) : messages[retainedIndex].seq;
258
- };
259
- const estimateCurrentPromptChars = (state, context, messages) => {
260
- const systemChars = Array.from(state.messages.values()).reduce((sum, message) => message._tag === "System" ? sum + message.content.length : sum, 0);
261
- const summaryChars = context.currentSummary === void 0 ? 0 : estimatePromptMessageChars(context.currentSummary.promptMessage);
262
- const messageChars = messages.reduce((sum, message) => sum + message.chars, 0);
263
- return systemChars + summaryChars + messageChars;
264
- };
265
- const estimatedContextMessages = (state) => durableMessageTranscript(state).map((message) => ({
266
- message,
267
- seq: messageSeq(message),
268
- chars: estimateDurableMessageChars(message) + estimateAssociatedToolChars(message, state)
269
- }));
270
- const estimateDurableMessageChars = (message) => {
271
- switch (message._tag) {
272
- case "User":
273
- case "Steering": return estimateUserContentChars(message.content);
274
- case "Assistant":
275
- case "AssistantPartial": return estimateAssistantPromptChars(message.promptParts, message.content);
276
- }
277
- };
278
- const estimateAssociatedToolChars = (message, state) => {
279
- if (message._tag !== "Assistant" && message._tag !== "AssistantPartial") return 0;
280
- return toolPromptPartsForInference(message.inferenceId, state.toolCalls).reduce((sum, part) => sum + estimatePromptPartChars(part), 0);
281
- };
282
- const messageSeq = (message) => message._tag === "Steering" ? message.consumedSeq : message.seq;
283
- const charsToTokens = (chars, charsPerToken) => Math.ceil(chars / charsPerToken);
284
- const buildSummaryPrompt = (input) => {
285
- const sourceText = serializeCompactionSource(input);
286
- if (sourceText.trim().length === 0) return;
287
- return `${input.context.currentSummary === void 0 ? "" : `<previous-summary>\n${input.context.currentSummary.text}\n</previous-summary>\n\n`}<conversation>\n${sourceText}\n</conversation>\n\n${summaryPromptText}`;
288
- };
289
- const serializeCompactionSource = (input) => {
290
- const lines = [];
291
- for (const message of durableMessageTranscript(input.state)) {
292
- const seq = messageSeq(message);
293
- if (seq < input.plan.sourceFromSeq || seq > input.plan.sourceToSeq) continue;
294
- lines.push(serializeDurableMessage(message));
295
- if (message._tag === "Assistant" || message._tag === "AssistantPartial") for (const part of toolPromptPartsForInference(message.inferenceId, input.state.toolCalls)) lines.push(serializeToolResultPart(part));
296
- }
297
- return lines.filter((line) => line.trim().length > 0).join("\n\n");
298
- };
299
- const serializeDurableMessage = (message) => {
300
- switch (message._tag) {
301
- case "User": return `[User]: ${userContentText(message.content)}`;
302
- case "Steering": return `[User steering]: ${userContentText(message.content)}`;
303
- case "Assistant":
304
- case "AssistantPartial": return serializeAssistantMessage(message.promptParts, message.content);
305
- }
306
- };
307
- const serializeAssistantMessage = (promptParts, content) => {
308
- const parts = promptParts ?? assistantContentToPromptParts(content);
309
- const text = [];
310
- const reasoning = [];
311
- const toolCalls = [];
312
- const sideband = [];
313
- for (const part of parts) switch (part.type) {
314
- case "text":
315
- text.push(part.text);
316
- break;
317
- case "reasoning":
318
- reasoning.push(part.text);
319
- break;
320
- case "tool-call":
321
- toolCalls.push(`${part.name}(${safeJsonStringify(part.params)})`);
322
- break;
323
- case "file":
324
- sideband.push(`file(${part.fileName ?? "unnamed"}, ${part.mediaType})`);
325
- break;
326
- case "tool-result":
327
- sideband.push(`tool-result(${part.name}, ${truncateForSummary(safeJsonStringify(part.result))})`);
328
- break;
329
- case "tool-approval-request":
330
- sideband.push(`tool-approval-request(${part.approvalId}, ${part.toolCallId})`);
331
- break;
332
- }
333
- return [
334
- reasoning.length === 0 ? "" : `[Assistant reasoning]: ${reasoning.join("\n")}`,
335
- text.length === 0 ? "" : `[Assistant]: ${text.join("\n")}`,
336
- toolCalls.length === 0 ? "" : `[Assistant tool calls]: ${toolCalls.join("; ")}`,
337
- sideband.length === 0 ? "" : `[Assistant context]: ${sideband.join("; ")}`
338
- ].filter((line) => line.length > 0).join("\n");
339
- };
340
- const serializeToolResultPart = (part) => `[Tool result ${part.name}${part.isFailure ? " failed" : ""}]: ${truncateForSummary(safeJsonStringify(part.result))}`;
341
- const toolPromptPartsForInference = (inferenceId, toolCalls) => Array.from(toolCalls.values()).flatMap((tool) => {
342
- const { decision } = tool;
343
- if (decision === void 0 || decision.inferenceId !== inferenceId) return [];
344
- if (decision._tag === "Rejected") return decision.promptPart === void 0 ? [] : [decision.promptPart];
345
- const terminal = tool.terminal;
346
- if (terminal === void 0 || terminal.promptPart === void 0) return [];
347
- return [terminal.promptPart];
348
- });
349
- const assistantContentToPromptParts = (content) => [...content.reasoning === void 0 ? [] : [Prompt.reasoningPart({ text: content.reasoning })], ...content.text.length === 0 ? [] : [Prompt.textPart({ text: content.text })]];
350
- const estimateAssistantPromptChars = (promptParts, content) => (promptParts ?? assistantContentToPromptParts(content)).reduce((sum, part) => sum + estimatePromptPartChars(part), 0);
351
- const estimateUserContentChars = (content) => typeof content === "string" ? content.length : content.reduce((sum, part) => sum + estimatePromptPartChars(part), 0);
352
- const estimatePromptMessageChars = (message) => {
353
- if (!("content" in message)) return 0;
354
- const { content } = message;
355
- return typeof content === "string" ? content.length : content.reduce((sum, part) => sum + estimatePromptPartChars(part), 0);
356
- };
357
- const estimatePromptPartChars = (part) => {
358
- switch (part.type) {
359
- case "text": return part.text.length;
360
- case "reasoning": return part.text.length;
361
- case "file": return part.mediaType.length + (part.fileName?.length ?? 0) + (typeof part.data === "string" ? part.data.length : part.data instanceof URL ? part.data.toString().length : estimatedBinaryFileChars);
362
- case "tool-call": return part.name.length + safeJsonStringify(part.params).length;
363
- case "tool-result": return part.name.length + safeJsonStringify(part.result).length;
364
- case "tool-approval-response": return part.approvalId.length + (part.reason?.length ?? 0) + 8;
365
- case "tool-approval-request": return part.approvalId.length + part.toolCallId.length;
366
- default: return safeJsonStringify(part).length;
367
- }
368
- };
369
- const userContentText = (content) => typeof content === "string" ? content : content.map((part) => {
370
- switch (part.type) {
371
- case "text": return part.text;
372
- case "file": return `[file ${part.fileName ?? "unnamed"} ${part.mediaType}]`;
373
- }
374
- }).join("\n");
375
- const safeJsonStringify = (value) => {
376
- try {
377
- return JSON.stringify(value) ?? String(value);
378
- } catch {
379
- return String(value);
380
- }
381
- };
382
- const truncateForSummary = (text, maxChars = 2e3) => {
383
- if (text.length <= maxChars) return text;
384
- return `${text.slice(0, maxChars)}\n\n[... ${text.length - maxChars} more characters truncated]`;
385
- };
386
- const formatUnknownError = (error) => error instanceof Error ? error.message : String(error);
387
- const estimatedBinaryFileChars = 4800;
388
- const summarizationSystemPrompt = "You are a context summarization assistant. Do not continue the conversation. Only output the requested structured summary.";
389
- const 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.
390
-
391
- Use this exact structure:
392
-
393
- ## Goal
394
- [What the user is trying to accomplish]
395
-
396
- ## Constraints & Preferences
397
- - [Requirements, constraints, and preferences]
398
-
399
- ## Progress
400
- ### Done
401
- - [x] [Completed work]
402
-
403
- ### In Progress
404
- - [ ] [Current unfinished work]
405
-
406
- ### Blocked
407
- - [Current blockers, or "(none)"]
408
-
409
- ## Key Decisions
410
- - **[Decision]**: [Rationale]
411
-
412
- ## Next Steps
413
- 1. [Concrete next step]
414
-
415
- ## Critical Context
416
- - [Important facts, data, IDs, file paths, function names, and exact errors needed to continue]
417
-
418
- Rules:
419
- - If <previous-summary> is present, preserve important existing facts and update it with the new conversation.
420
- - Keep the summary concise but sufficient to replace the compacted history.
421
- - Preserve exact file paths, tool names, identifiers, and error messages.
422
- - Do not answer questions from the conversation.`;
423
- //#endregion
424
- export { CompactionError, CompactionExecutor, CompactionOutput, CompactionPlan, CompactionPolicy, CompactionRunner, defaultCompactionCharsPerToken, defaultCompactionMinSummarizableTokens, defaultCompactionRetainTailTokens, defaultCompactionThresholdTokens };
425
-
426
- //# sourceMappingURL=compaction.js.map
1
+ import { a as CompactionPolicy, c as defaultCompactionMinSummarizableTokens, d as defaultCompactionThresholdTokens, f as promptPrefixSummaryCompactionExecutor, i as CompactionPlan, l as defaultCompactionRetainTailTokens, n as CompactionExecutor, o as CompactionRunner, r as CompactionOutput, s as defaultCompactionCharsPerToken, t as CompactionError, u as defaultCompactionSummaryInstructions } from "../compaction-63iEDHHl.js";
2
+ export { CompactionError, CompactionExecutor, CompactionOutput, CompactionPlan, CompactionPolicy, CompactionRunner, defaultCompactionCharsPerToken, defaultCompactionMinSummarizableTokens, defaultCompactionRetainTailTokens, defaultCompactionSummaryInstructions, defaultCompactionThresholdTokens, promptPrefixSummaryCompactionExecutor };
@@ -1,2 +1,2 @@
1
- import { n as IdGeneratorShape, r as sequentialUuidV7, t as IdGenerator } from "../id-generator-C2Q15uZM.js";
1
+ import { n as IdGeneratorShape, r as sequentialUuidV7, t as IdGenerator } from "../id-generator-BKGoKjt-.js";
2
2
  export { IdGenerator, IdGeneratorShape, sequentialUuidV7 };
@@ -1,4 +1,4 @@
1
- import { CommandId, CompactionId, CorrelationId, EventId, InferenceId, MessageId, RunId, SessionId, SummaryId, ToolCallId, TurnId } from "../types/core.js";
1
+ import { CommandId, CompactionId, CorrelationId, EventId, InferenceId, MessageId, RunId, RunRequestId, SessionId, SummaryId, ToolCallId, TurnId } from "../types/core.js";
2
2
  import * as Context from "effect/Context";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Layer from "effect/Layer";
@@ -15,7 +15,8 @@ const WebCryptoLive = Layer.succeed(Crypto.Crypto, Crypto.make({
15
15
  /** Mints framework-owned UUIDv7 lifecycle IDs for effect-durable-agent. */
16
16
  var IdGenerator = class IdGenerator extends Context.Service()("@effect-durable-agent/IdGenerator") {
17
17
  static Live = Layer.effect(IdGenerator, Effect.gen(function* () {
18
- return makeIdGenerator((yield* Crypto.Crypto).randomUUIDv7.pipe(Effect.orDie));
18
+ const crypto = yield* Crypto.Crypto;
19
+ return makeIdGenerator(crypto.randomUUIDv7().pipe(Effect.orDie));
19
20
  })).pipe(Layer.provide(WebCryptoLive));
20
21
  static Deterministic = (ids) => Layer.sync(IdGenerator, () => {
21
22
  let index = 0;
@@ -42,6 +43,7 @@ const makeIdGenerator = (nextUuidV7) => ({
42
43
  makeEventId: () => nextUuidV7.pipe(Effect.map((id) => EventId.make(id))),
43
44
  makeCommandId: () => nextUuidV7.pipe(Effect.map((id) => CommandId.make(id))),
44
45
  makeRunId: () => nextUuidV7.pipe(Effect.map((id) => RunId.make(id))),
46
+ makeRunRequestId: () => nextUuidV7.pipe(Effect.map((id) => RunRequestId.make(id))),
45
47
  makeTurnId: () => nextUuidV7.pipe(Effect.map((id) => TurnId.make(id))),
46
48
  makeInferenceId: () => nextUuidV7.pipe(Effect.map((id) => InferenceId.make(id))),
47
49
  makeToolCallId: () => nextUuidV7.pipe(Effect.map((id) => ToolCallId.make(id))),
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.js","names":[],"sources":["../../src/services/id-generator.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Crypto from \"effect/Crypto\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nimport {\n InferenceId,\n CommandId,\n CompactionId,\n CorrelationId,\n EventId,\n MessageId,\n RunId,\n SessionId,\n SummaryId,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\n\n/** UUIDv7 minting capability for all framework-owned lifecycle identities. */\nexport interface IdGeneratorShape {\n readonly makeSessionId: () => Effect.Effect<SessionId>;\n readonly makeEventId: () => Effect.Effect<EventId>;\n readonly makeCommandId: () => Effect.Effect<CommandId>;\n readonly makeRunId: () => Effect.Effect<RunId>;\n readonly makeTurnId: () => Effect.Effect<TurnId>;\n readonly makeInferenceId: () => Effect.Effect<InferenceId>;\n readonly makeToolCallId: () => Effect.Effect<ToolCallId>;\n readonly makeMessageId: () => Effect.Effect<MessageId>;\n readonly makeCompactionId: () => Effect.Effect<CompactionId>;\n readonly makeSummaryId: () => Effect.Effect<SummaryId>;\n readonly makeCorrelationId: () => Effect.Effect<CorrelationId>;\n}\n\nconst WebCryptoLive = Layer.succeed(\n Crypto.Crypto,\n Crypto.make({\n randomBytes: (size) => {\n const bytes = new Uint8Array(size);\n globalThis.crypto.getRandomValues(bytes);\n return bytes;\n },\n digest: () => Effect.die(new Error(\"IdGenerator does not use Crypto.digest\")),\n }),\n);\n\n/** Mints framework-owned UUIDv7 lifecycle IDs for effect-durable-agent. */\nexport class IdGenerator extends Context.Service<IdGenerator, IdGeneratorShape>()(\n \"@effect-durable-agent/IdGenerator\",\n) {\n static readonly Live = Layer.effect(\n IdGenerator,\n Effect.gen(function* () {\n const crypto = yield* Crypto.Crypto;\n return makeIdGenerator(crypto.randomUUIDv7.pipe(Effect.orDie));\n }),\n ).pipe(Layer.provide(WebCryptoLive));\n\n static readonly Deterministic = (ids: ReadonlyArray<string>) =>\n Layer.sync(IdGenerator, () => {\n let index = 0;\n return makeIdGenerator(\n Effect.sync(() => {\n const next = ids[index];\n if (next === undefined) {\n throw new Error(\"deterministic IdGenerator exhausted\");\n }\n index += 1;\n return next;\n }),\n );\n });\n\n /** Counter-based deterministic IDs; the nth minted ID is `sequentialUuidV7(n)`. */\n static readonly Sequential = Layer.sync(IdGenerator, () => {\n let counter = 0;\n return makeIdGenerator(\n Effect.sync(() => {\n counter += 1;\n return sequentialUuidV7(counter);\n }),\n );\n });\n}\n\n/** The UUIDv7-shaped value minted by `IdGenerator.Sequential` for counter `n` (1-based). */\nexport const sequentialUuidV7 = (n: number): string =>\n `00000000-0000-7000-8000-${n.toString(16).padStart(12, \"0\")}`;\n\nconst makeIdGenerator = (nextUuidV7: Effect.Effect<string>): IdGeneratorShape => ({\n makeSessionId: () => nextUuidV7.pipe(Effect.map((id) => SessionId.make(id))),\n makeEventId: () => nextUuidV7.pipe(Effect.map((id) => EventId.make(id))),\n makeCommandId: () => nextUuidV7.pipe(Effect.map((id) => CommandId.make(id))),\n makeRunId: () => nextUuidV7.pipe(Effect.map((id) => RunId.make(id))),\n makeTurnId: () => nextUuidV7.pipe(Effect.map((id) => TurnId.make(id))),\n makeInferenceId: () => nextUuidV7.pipe(Effect.map((id) => InferenceId.make(id))),\n makeToolCallId: () => nextUuidV7.pipe(Effect.map((id) => ToolCallId.make(id))),\n makeMessageId: () => nextUuidV7.pipe(Effect.map((id) => MessageId.make(id))),\n makeCompactionId: () => nextUuidV7.pipe(Effect.map((id) => CompactionId.make(id))),\n makeSummaryId: () => nextUuidV7.pipe(Effect.map((id) => SummaryId.make(id))),\n makeCorrelationId: () => nextUuidV7.pipe(Effect.map((id) => CorrelationId.make(id))),\n});\n"],"mappings":";;;;;;AAkCA,MAAM,gBAAgB,MAAM,QAC1B,OAAO,QACP,OAAO,KAAK;CACV,cAAc,SAAS;EACrB,MAAM,QAAQ,IAAI,WAAW,IAAI;EACjC,WAAW,OAAO,gBAAgB,KAAK;EACvC,OAAO;CACT;CACA,cAAc,OAAO,oBAAI,IAAI,MAAM,wCAAwC,CAAC;AAC9E,CAAC,CACH;;AAGA,IAAa,cAAb,MAAa,oBAAoB,QAAQ,QAAuC,EAC9E,mCACF,EAAE;CACA,OAAgB,OAAO,MAAM,OAC3B,aACA,OAAO,IAAI,aAAa;EAEtB,OAAO,iBAAgB,OADD,OAAO,QACC,aAAa,KAAK,OAAO,KAAK,CAAC;CAC/D,CAAC,CACH,EAAE,KAAK,MAAM,QAAQ,aAAa,CAAC;CAEnC,OAAgB,iBAAiB,QAC/B,MAAM,KAAK,mBAAmB;EAC5B,IAAI,QAAQ;EACZ,OAAO,gBACL,OAAO,WAAW;GAChB,MAAM,OAAO,IAAI;GACjB,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MAAM,qCAAqC;GAEvD,SAAS;GACT,OAAO;EACT,CAAC,CACH;CACF,CAAC;;CAGH,OAAgB,aAAa,MAAM,KAAK,mBAAmB;EACzD,IAAI,UAAU;EACd,OAAO,gBACL,OAAO,WAAW;GAChB,WAAW;GACX,OAAO,iBAAiB,OAAO;EACjC,CAAC,CACH;CACF,CAAC;AACH;;AAGA,MAAa,oBAAoB,MAC/B,2BAA2B,EAAE,SAAS,EAAE,EAAE,SAAS,IAAI,GAAG;AAE5D,MAAM,mBAAmB,gBAAyD;CAChF,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,mBAAmB,WAAW,KAAK,OAAO,KAAK,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC;CACvE,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,iBAAiB,WAAW,KAAK,OAAO,KAAK,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC;CACnE,kBAAkB,WAAW,KAAK,OAAO,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC;CACrE,uBAAuB,WAAW,KAAK,OAAO,KAAK,OAAO,YAAY,KAAK,EAAE,CAAC,CAAC;CAC/E,sBAAsB,WAAW,KAAK,OAAO,KAAK,OAAO,WAAW,KAAK,EAAE,CAAC,CAAC;CAC7E,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,wBAAwB,WAAW,KAAK,OAAO,KAAK,OAAO,aAAa,KAAK,EAAE,CAAC,CAAC;CACjF,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,yBAAyB,WAAW,KAAK,OAAO,KAAK,OAAO,cAAc,KAAK,EAAE,CAAC,CAAC;AACrF"}
1
+ {"version":3,"file":"id-generator.js","names":[],"sources":["../../src/services/id-generator.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Crypto from \"effect/Crypto\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nimport {\n InferenceId,\n CommandId,\n CompactionId,\n CorrelationId,\n EventId,\n MessageId,\n RunId,\n RunRequestId,\n SessionId,\n SummaryId,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\n\n/** UUIDv7 minting capability for all framework-owned lifecycle identities. */\nexport interface IdGeneratorShape {\n readonly makeSessionId: () => Effect.Effect<SessionId>;\n readonly makeEventId: () => Effect.Effect<EventId>;\n readonly makeCommandId: () => Effect.Effect<CommandId>;\n readonly makeRunId: () => Effect.Effect<RunId>;\n readonly makeRunRequestId: () => Effect.Effect<RunRequestId>;\n readonly makeTurnId: () => Effect.Effect<TurnId>;\n readonly makeInferenceId: () => Effect.Effect<InferenceId>;\n readonly makeToolCallId: () => Effect.Effect<ToolCallId>;\n readonly makeMessageId: () => Effect.Effect<MessageId>;\n readonly makeCompactionId: () => Effect.Effect<CompactionId>;\n readonly makeSummaryId: () => Effect.Effect<SummaryId>;\n readonly makeCorrelationId: () => Effect.Effect<CorrelationId>;\n}\n\nconst WebCryptoLive = Layer.succeed(\n Crypto.Crypto,\n Crypto.make({\n randomBytes: (size) => {\n const bytes = new Uint8Array(size);\n globalThis.crypto.getRandomValues(bytes);\n return bytes;\n },\n digest: () => Effect.die(new Error(\"IdGenerator does not use Crypto.digest\")),\n }),\n);\n\n/** Mints framework-owned UUIDv7 lifecycle IDs for effect-durable-agent. */\nexport class IdGenerator extends Context.Service<IdGenerator, IdGeneratorShape>()(\n \"@effect-durable-agent/IdGenerator\",\n) {\n static readonly Live = Layer.effect(\n IdGenerator,\n Effect.gen(function* () {\n const crypto = yield* Crypto.Crypto;\n return makeIdGenerator(crypto.randomUUIDv7().pipe(Effect.orDie));\n }),\n ).pipe(Layer.provide(WebCryptoLive));\n\n static readonly Deterministic = (ids: ReadonlyArray<string>) =>\n Layer.sync(IdGenerator, () => {\n let index = 0;\n return makeIdGenerator(\n Effect.sync(() => {\n const next = ids[index];\n if (next === undefined) {\n throw new Error(\"deterministic IdGenerator exhausted\");\n }\n index += 1;\n return next;\n }),\n );\n });\n\n /** Counter-based deterministic IDs; the nth minted ID is `sequentialUuidV7(n)`. */\n static readonly Sequential = Layer.sync(IdGenerator, () => {\n let counter = 0;\n return makeIdGenerator(\n Effect.sync(() => {\n counter += 1;\n return sequentialUuidV7(counter);\n }),\n );\n });\n}\n\n/** The UUIDv7-shaped value minted by `IdGenerator.Sequential` for counter `n` (1-based). */\nexport const sequentialUuidV7 = (n: number): string =>\n `00000000-0000-7000-8000-${n.toString(16).padStart(12, \"0\")}`;\n\nconst makeIdGenerator = (nextUuidV7: Effect.Effect<string>): IdGeneratorShape => ({\n makeSessionId: () => nextUuidV7.pipe(Effect.map((id) => SessionId.make(id))),\n makeEventId: () => nextUuidV7.pipe(Effect.map((id) => EventId.make(id))),\n makeCommandId: () => nextUuidV7.pipe(Effect.map((id) => CommandId.make(id))),\n makeRunId: () => nextUuidV7.pipe(Effect.map((id) => RunId.make(id))),\n makeRunRequestId: () => nextUuidV7.pipe(Effect.map((id) => RunRequestId.make(id))),\n makeTurnId: () => nextUuidV7.pipe(Effect.map((id) => TurnId.make(id))),\n makeInferenceId: () => nextUuidV7.pipe(Effect.map((id) => InferenceId.make(id))),\n makeToolCallId: () => nextUuidV7.pipe(Effect.map((id) => ToolCallId.make(id))),\n makeMessageId: () => nextUuidV7.pipe(Effect.map((id) => MessageId.make(id))),\n makeCompactionId: () => nextUuidV7.pipe(Effect.map((id) => CompactionId.make(id))),\n makeSummaryId: () => nextUuidV7.pipe(Effect.map((id) => SummaryId.make(id))),\n makeCorrelationId: () => nextUuidV7.pipe(Effect.map((id) => CorrelationId.make(id))),\n});\n"],"mappings":";;;;;;AAoCA,MAAM,gBAAgB,MAAM,QAC1B,OAAO,QACP,OAAO,KAAK;CACV,cAAc,SAAS;EACrB,MAAM,QAAQ,IAAI,WAAW,IAAI;EACjC,WAAW,OAAO,gBAAgB,KAAK;EACvC,OAAO;CACT;CACA,cAAc,OAAO,oBAAI,IAAI,MAAM,wCAAwC,CAAC;AAC9E,CAAC,CACH;;AAGA,IAAa,cAAb,MAAa,oBAAoB,QAAQ,QAAuC,CAAC,CAC/E,mCACF,CAAC,CAAC;CACA,OAAgB,OAAO,MAAM,OAC3B,aACA,OAAO,IAAI,aAAa;EACtB,MAAM,SAAS,OAAO,OAAO;EAC7B,OAAO,gBAAgB,OAAO,aAAa,CAAC,CAAC,KAAK,OAAO,KAAK,CAAC;CACjE,CAAC,CACH,CAAC,CAAC,KAAK,MAAM,QAAQ,aAAa,CAAC;CAEnC,OAAgB,iBAAiB,QAC/B,MAAM,KAAK,mBAAmB;EAC5B,IAAI,QAAQ;EACZ,OAAO,gBACL,OAAO,WAAW;GAChB,MAAM,OAAO,IAAI;GACjB,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MAAM,qCAAqC;GAEvD,SAAS;GACT,OAAO;EACT,CAAC,CACH;CACF,CAAC;;CAGH,OAAgB,aAAa,MAAM,KAAK,mBAAmB;EACzD,IAAI,UAAU;EACd,OAAO,gBACL,OAAO,WAAW;GAChB,WAAW;GACX,OAAO,iBAAiB,OAAO;EACjC,CAAC,CACH;CACF,CAAC;AACH;;AAGA,MAAa,oBAAoB,MAC/B,2BAA2B,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,GAAG;AAE5D,MAAM,mBAAmB,gBAAyD;CAChF,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,mBAAmB,WAAW,KAAK,OAAO,KAAK,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC;CACvE,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,iBAAiB,WAAW,KAAK,OAAO,KAAK,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC;CACnE,wBAAwB,WAAW,KAAK,OAAO,KAAK,OAAO,aAAa,KAAK,EAAE,CAAC,CAAC;CACjF,kBAAkB,WAAW,KAAK,OAAO,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC;CACrE,uBAAuB,WAAW,KAAK,OAAO,KAAK,OAAO,YAAY,KAAK,EAAE,CAAC,CAAC;CAC/E,sBAAsB,WAAW,KAAK,OAAO,KAAK,OAAO,WAAW,KAAK,EAAE,CAAC,CAAC;CAC7E,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,wBAAwB,WAAW,KAAK,OAAO,KAAK,OAAO,aAAa,KAAK,EAAE,CAAC,CAAC;CACjF,qBAAqB,WAAW,KAAK,OAAO,KAAK,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC;CAC3E,yBAAyB,WAAW,KAAK,OAAO,KAAK,OAAO,cAAc,KAAK,EAAE,CAAC,CAAC;AACrF"}
@@ -0,0 +1,2 @@
1
+ import { n as EDAKeepAliveLease, r as EDAKeepAliveShape, t as EDAKeepAlive } from "../keep-alive-_zFCUvt3.js";
2
+ export { EDAKeepAlive, EDAKeepAliveLease, EDAKeepAliveShape };
@@ -0,0 +1,13 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ //#region src/services/keep-alive.ts
5
+ /** Host keep-alive service for finite active EDA work roots. */
6
+ var EDAKeepAlive = class EDAKeepAlive extends Context.Service()("@effect-durable-agent/EDAKeepAlive") {
7
+ static Noop = Layer.succeed(EDAKeepAlive, { withActiveWork: (_label, effect) => effect });
8
+ static FromAcquire = (acquire) => Layer.succeed(EDAKeepAlive, { withActiveWork: (label, effect) => Effect.acquireUseRelease(Effect.promise(() => acquire(label)), () => effect, (lease) => Effect.promise(() => lease.release())) });
9
+ };
10
+ //#endregion
11
+ export { EDAKeepAlive };
12
+
13
+ //# sourceMappingURL=keep-alive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keep-alive.js","names":[],"sources":["../../src/services/keep-alive.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\n/** Host lifecycle lease held while finite EDA work is actively running. */\nexport interface EDAKeepAliveLease {\n readonly release: () => Promise<void>;\n}\n\n/** Host-provided wrapper for keeping finite active work alive. */\nexport interface EDAKeepAliveShape {\n /**\n * A host may suspend an idle session after ingress returns while model turns,\n * recovery drains, and durable sink catch-up still run in Effect fibers. Wrap\n * those finite active-work regions so the host can retain or schedule the\n * session until work completes, parks durably, fails, or is interrupted.\n * Long-lived fibers blocked on queues should not hold a lease.\n */\n readonly withActiveWork: <A, E, R>(\n label: string,\n effect: Effect.Effect<A, E, R>,\n ) => Effect.Effect<A, E, R>;\n}\n\n/** Host keep-alive service for finite active EDA work roots. */\nexport class EDAKeepAlive extends Context.Service<EDAKeepAlive, EDAKeepAliveShape>()(\n \"@effect-durable-agent/EDAKeepAlive\",\n) {\n static readonly Noop = Layer.succeed(EDAKeepAlive, {\n withActiveWork: (_label, effect) => effect,\n } satisfies EDAKeepAliveShape);\n\n static readonly FromAcquire = (\n acquire: (label: string) => Promise<EDAKeepAliveLease>,\n ): Layer.Layer<EDAKeepAlive> =>\n Layer.succeed(EDAKeepAlive, {\n withActiveWork: (label, effect) =>\n Effect.acquireUseRelease(\n Effect.promise(() => acquire(label)),\n () => effect,\n (lease) => Effect.promise(() => lease.release()),\n ),\n } satisfies EDAKeepAliveShape);\n}\n"],"mappings":";;;;;AAyBA,IAAa,eAAb,MAAa,qBAAqB,QAAQ,QAAyC,CAAC,CAClF,oCACF,CAAC,CAAC;CACA,OAAgB,OAAO,MAAM,QAAQ,cAAc,EACjD,iBAAiB,QAAQ,WAAW,OACtC,CAA6B;CAE7B,OAAgB,eACd,YAEA,MAAM,QAAQ,cAAc,EAC1B,iBAAiB,OAAO,WACtB,OAAO,kBACL,OAAO,cAAc,QAAQ,KAAK,CAAC,SAC7B,SACL,UAAU,OAAO,cAAc,MAAM,QAAQ,CAAC,CACjD,EACJ,CAA6B;AACjC"}
@@ -0,0 +1,15 @@
1
+ import { t as EDAModelToolkit } from "../tool-registry-BzlMhwzj.js";
2
+ import * as Effect from "effect/Effect";
3
+ import * as LanguageModel from "effect/ai/LanguageModel";
4
+ import * as Prompt from "effect/ai/Prompt";
5
+ import * as AiError from "effect/ai/AiError";
6
+ //#region src/services/model-call.d.ts
7
+ /**
8
+ * One non-streaming model call that offers EDA's tools without executing them, so the request's
9
+ * tool definitions match every inference in the session (and therefore its provider cache).
10
+ * EDA owns tool execution; with resolution disabled the handlers' requirements are never used.
11
+ */
12
+ declare const generateTextOfferingTools: (model: LanguageModel.LanguageModel, prompt: Prompt.RawInput, toolkit: EDAModelToolkit | undefined) => Effect.Effect<LanguageModel.GenerateTextResponse<{}>, AiError.AiError>;
13
+ //#endregion
14
+ export { generateTextOfferingTools };
15
+ //# sourceMappingURL=model-call.d.ts.map
@@ -0,0 +1,15 @@
1
+ //#region src/services/model-call.ts
2
+ /**
3
+ * One non-streaming model call that offers EDA's tools without executing them, so the request's
4
+ * tool definitions match every inference in the session (and therefore its provider cache).
5
+ * EDA owns tool execution; with resolution disabled the handlers' requirements are never used.
6
+ */
7
+ const generateTextOfferingTools = (model, prompt, toolkit) => toolkit === void 0 ? model.generateText({ prompt }) : model.generateText({
8
+ prompt,
9
+ toolkit,
10
+ disableToolCallResolution: true
11
+ });
12
+ //#endregion
13
+ export { generateTextOfferingTools };
14
+
15
+ //# sourceMappingURL=model-call.js.map