effect-durable-agent 0.1.0-alpha.4 → 0.1.0-alpha.6
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.
- package/README.md +19 -18
- package/dist/{command-queues-CV7O-51r.d.ts → command-queues-C8muEqeQ.d.ts} +2 -2
- package/dist/{compaction-zbvLREI8.d.ts → compaction-F4HEWzuI.d.ts} +5 -5
- package/dist/{context-projection-n6Rdup0N.d.ts → context-projection-C43pyxn2.d.ts} +2 -2
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/context-projection.d.ts +1 -1
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/reduced-state.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{message-transcript-DiOPBY3l.d.ts → message-transcript-DsKTT47f.d.ts} +3 -3
- package/dist/{prompt-projector-C1IbkHr0.d.ts → prompt-projector-hqPh5-NI.d.ts} +4 -4
- package/dist/{reducer-registry-CjSJBPKo.d.ts → reducer-registry--vQFATXb.d.ts} +16 -6
- package/dist/{runtime-DOgmAKsO.d.ts → runtime-BO9KJq_Y.d.ts} +7 -5
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/reducer-registry.d.ts +2 -2
- package/dist/services/reducer-registry.js +7 -3
- package/dist/services/reducer-registry.js.map +1 -1
- package/dist/services/runtime-layer.d.ts +12 -9
- package/dist/services/runtime-layer.js +6 -4
- package/dist/services/runtime-layer.js.map +1 -1
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +3 -2
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-event-observer.d.ts +2 -0
- package/dist/services/session-event-observer.js +13 -0
- package/dist/services/session-event-observer.js.map +1 -0
- package/dist/services/session-query.d.ts +2 -2
- package/dist/services/session-query.js +20 -3
- package/dist/services/session-query.js.map +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/session-store.d.ts +1 -1
- package/dist/services/sink-checkpoint-store.d.ts +1 -1
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/span-names.d.ts +1 -1
- package/dist/services/span-names.js +1 -0
- package/dist/services/span-names.js.map +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/services/tracing.js +23 -2
- package/dist/services/tracing.js.map +1 -1
- package/dist/session-event-observer-D_aoFnQs.d.ts +24 -0
- package/dist/{session-query-C-C4m1eq.d.ts → session-query-_Z3Kw6jj.d.ts} +15 -8
- package/dist/{session-state-CjOSvWbe.d.ts → session-state-BfoXKafd.d.ts} +11 -11
- package/dist/{session-state-SStf0KUo.js → session-state-C4m0j6CJ.js} +2 -2
- package/dist/{session-state-SStf0KUo.js.map → session-state-C4m0j6CJ.js.map} +1 -1
- package/dist/{session-store-DZZUffUy.d.ts → session-store-ofm8FFxs.d.ts} +2 -2
- package/dist/{sink-checkpoint-store-BZmQFTRE.d.ts → sink-checkpoint-store-BQVbI9DQ.d.ts} +2 -2
- package/dist/{sink-registry-D13eUO_c.js → sink-registry-DH6uiEgP.js} +19 -21
- package/dist/sink-registry-DH6uiEgP.js.map +1 -0
- package/dist/{sink-registry-Cf79ICdW.d.ts → sink-registry-PRYbj6dp.d.ts} +18 -14
- package/dist/testkit/layers.d.ts +10 -10
- package/dist/testkit/layers.js +3 -3
- package/dist/testkit/layers.js.map +1 -1
- package/dist/{tool-registry-B7Wona6N.d.ts → tool-registry-ClHdr_G5.d.ts} +2 -2
- package/dist/{websocket-wire-QD2SquQE.d.ts → websocket.d.ts} +335 -12
- package/dist/websocket.js +428 -0
- package/dist/websocket.js.map +1 -0
- package/package.json +15 -31
- package/testing/offline-trace/README.md +2 -1
- package/CHANGELOG.md +0 -34
- package/CONTRIBUTING.md +0 -26
- package/SECURITY.md +0 -7
- package/dist/host/websocket-protocol.d.ts +0 -229
- package/dist/host/websocket-protocol.js +0 -99
- package/dist/host/websocket-protocol.js.map +0 -1
- package/dist/host/websocket-wire.d.ts +0 -2
- package/dist/host/websocket-wire.js +0 -105
- package/dist/host/websocket-wire.js.map +0 -1
- package/dist/services/websocket-subscriber.d.ts +0 -54
- package/dist/services/websocket-subscriber.js +0 -190
- package/dist/services/websocket-subscriber.js.map +0 -1
- package/dist/sink-registry-D13eUO_c.js.map +0 -1
- package/docs/assets/architecture.svg +0 -216
- package/docs/assets/event-sequence.svg +0 -133
- package/docs/assets/gcp-trace.png +0 -0
- package/docs/assets/hero.svg +0 -33
- package/docs/message-steering.md +0 -831
- package/docs/releasing.md +0 -114
- package/docs/spec.md +0 -777
- package/docs/subagents.md +0 -725
- package/docs/testing.md +0 -64
- package/docs/ui-projection.md +0 -742
- package/docs/websocket-protocol.md +0 -639
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# effect-durable-agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> ## EDA is a redux-inspired durable agent framework hosted on [Durable Objects](https://developers.cloudflare.com/durable-objects/) and [celld](https://celld.dev/)
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/effect-durable-agent)
|
|
6
6
|
[](https://github.com/advait/effect-durable-agent/actions/workflows/ci.yml)
|
|
@@ -21,7 +21,7 @@ the same event sequence.
|
|
|
21
21
|
EDA models the agent and the surrounding product as one application state machine. For example, a
|
|
22
22
|
coding-agent session might record:
|
|
23
23
|
|
|
24
|
-

|
|
25
25
|
|
|
26
26
|
Framework events and product events are not separate channels. They form the same history and
|
|
27
27
|
transition the same application state.
|
|
@@ -38,7 +38,7 @@ external conversations, delivery state, or anything else the product needs to re
|
|
|
38
38
|
|
|
39
39
|
Those events flow through the rest of the system as follows:
|
|
40
40
|
|
|
41
|
-

|
|
42
42
|
|
|
43
43
|
### 1. Session runtime: one state machine for the entire application
|
|
44
44
|
|
|
@@ -92,7 +92,7 @@ projection of state, and the LLM context is a separate pure projection of that s
|
|
|
92
92
|
The UI can preserve tool progress, approvals, sandbox status, and rich product history while the
|
|
93
93
|
LLM context selects and compacts only what the model should see. Applications can model each
|
|
94
94
|
consumer honestly instead of collapsing both into one constrained representation. See the
|
|
95
|
-
[UI projection guide](
|
|
95
|
+
[UI projection guide](https://github.com/advait/effect-durable-agent/blob/master/docs/ui-projection.md) for the projection contract.
|
|
96
96
|
|
|
97
97
|
### 7. Durable sinks: callbacks that survive failure
|
|
98
98
|
|
|
@@ -127,7 +127,7 @@ keeps moving. When Slack recovers, it receives the committed events and converge
|
|
|
127
127
|
history. External availability stays off the application's critical path without sacrificing
|
|
128
128
|
reliable delivery.
|
|
129
129
|
|
|
130
|
-
See the [Slack bridge example](
|
|
130
|
+
See the [Slack bridge example](https://github.com/advait/effect-durable-agent/tree/master/examples/002-slack-bridge) for idempotent
|
|
131
131
|
ingress, a custom reducer, and durable outbound delivery.
|
|
132
132
|
|
|
133
133
|
**Durable state. Durable side effects.**
|
|
@@ -161,7 +161,7 @@ turns, model inference, tools, event streaming, durable sinks, and recovery. Tra
|
|
|
161
161
|
the durable boundaries that separate ingress, execution, and side effects, and Effect telemetry can
|
|
162
162
|
be exported through OpenTelemetry to Google Cloud Trace or another existing backend.
|
|
163
163
|
|
|
164
|
-

|
|
165
165
|
|
|
166
166
|
## Host-neutral core, pluggable deployment
|
|
167
167
|
|
|
@@ -210,9 +210,10 @@ Start with the executable examples:
|
|
|
210
210
|
|
|
211
211
|
| Example | What it demonstrates |
|
|
212
212
|
| --- | --- |
|
|
213
|
-
| [`001-no-tools`](
|
|
214
|
-
| [`002-slack-bridge`](
|
|
215
|
-
| [`003-sandbox-lifecycle`](
|
|
213
|
+
| [`001-no-tools`](https://github.com/advait/effect-durable-agent/tree/master/examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
|
|
214
|
+
| [`002-slack-bridge`](https://github.com/advait/effect-durable-agent/tree/master/examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
|
|
215
|
+
| [`003-sandbox-lifecycle`](https://github.com/advait/effect-durable-agent/tree/master/examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
|
|
216
|
+
| [`004-celld-no-tools`](https://github.com/advait/effect-durable-agent/tree/master/examples/004-celld-no-tools) | Deployable celld cell with durable command admission. |
|
|
216
217
|
|
|
217
218
|
## Why EDA instead of another agent SDK or framework?
|
|
218
219
|
|
|
@@ -293,16 +294,16 @@ typed boundaries, structured concurrency, and first-class tracing.
|
|
|
293
294
|
|
|
294
295
|
## Documentation
|
|
295
296
|
|
|
296
|
-
- [Current implementation](
|
|
297
|
-
- [Testing strategy](
|
|
298
|
-
- [WebSocket live-event protocol](
|
|
299
|
-
- [Message steering](
|
|
300
|
-
- [UI projection proposal](
|
|
301
|
-
- [Subagents proposal](
|
|
302
|
-
- [Maintainer release guide](
|
|
297
|
+
- [Current implementation](https://github.com/advait/effect-durable-agent/blob/master/docs/spec.md)
|
|
298
|
+
- [Testing strategy](https://github.com/advait/effect-durable-agent/blob/master/docs/testing.md)
|
|
299
|
+
- [WebSocket live-event protocol](https://github.com/advait/effect-durable-agent/blob/master/docs/websocket-protocol.md)
|
|
300
|
+
- [Message steering](https://github.com/advait/effect-durable-agent/blob/master/docs/message-steering.md)
|
|
301
|
+
- [UI projection proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/ui-projection.md)
|
|
302
|
+
- [Subagents proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/subagents.md)
|
|
303
|
+
- [Maintainer release guide](https://github.com/advait/effect-durable-agent/blob/master/docs/releasing.md)
|
|
303
304
|
|
|
304
305
|
## Contributing and license
|
|
305
306
|
|
|
306
|
-
See [CONTRIBUTING.md](
|
|
307
|
+
See [CONTRIBUTING.md](https://github.com/advait/effect-durable-agent/blob/master/CONTRIBUTING.md) to run the project and validate the npm package. Effect
|
|
307
308
|
Durable Agent is available under the [MIT License](./LICENSE). Please report vulnerabilities
|
|
308
|
-
through the process in [SECURITY.md](
|
|
309
|
+
through the process in [SECURITY.md](https://github.com/advait/effect-durable-agent/blob/master/SECURITY.md).
|
|
@@ -3,7 +3,7 @@ import { r as EDACommand, u as UserMessageContent } from "./commands-Ce1ec6kH.js
|
|
|
3
3
|
import { n as EDARunTrace, t as EDAEventTrace } from "./tracing-BXHAkxkx.js";
|
|
4
4
|
import { B as SystemPromptText, P as FailurePayload, R as ProviderPartId, U as UsagePayload, V as ToolName } from "./events-Bb9-Cu-7.js";
|
|
5
5
|
import { r as AssistantMessageContent, rt as RecoveryContinuation } from "./durable-B7M6TD_0.js";
|
|
6
|
-
import { t as CommittedDurableEvent } from "./session-store-
|
|
6
|
+
import { t as CommittedDurableEvent } from "./session-store-ofm8FFxs.js";
|
|
7
7
|
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
8
8
|
|
|
9
9
|
//#region src/domain/reduced-state.d.ts
|
|
@@ -466,4 +466,4 @@ declare const emptyCommandQueues: CommandQueues;
|
|
|
466
466
|
declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
|
|
467
467
|
//#endregion
|
|
468
468
|
export { RunTerminal as A, activeTurnIdentityForCommand as B, ReducedStateCheckpointCommandRecord as C, ReducedStateCheckpointToolDecision as D, ReducedStateCheckpointToolCallRecord as E, ToolDecision as F, frameworkReducedStateReducerName as G, decodeReducedStateCheckpoint as H, ToolTerminal as I, pendingCommands as J, frameworkReducedStateReducerSchemaVersion as K, TurnRecord as L, TokenConsumptionState as M, TokenUsageTotals as N, ReducedStateCheckpointToolTerminal as O, ToolCallRecord as P, TurnTerminal as R, ReducedState as S, ReducedStateCheckpointPayload as T, encodeReducedStateCheckpoint as U, classifyRecoverableWork as V, foldReducedState as W, reduceCommittedEvents as X, pendingStopCommand as Y, reducedStateCheckpointEventSeqs as Z, LifecycleTiming as _, deriveCommandQueues as a, RecoverableWork as b, ActiveTurnIdentity as c, CompactionRecord as d, CompactionTerminal as f, LifecycleFailure as g, InferenceTerminal as h, PendingUserMessage as i, StopRequestRecord as j, RunRecord as k, CommandRecord as l, InferenceRecord as m, CommandQueues as n, emptyCommandQueues as o, ContextRecord as p, initialReducedState as q, PendingSteeringMessage as r, ActiveCommandEvidence as s, CommandQueueSource as t, CommandTerminal as u, MessageRecord as v, ReducedStateCheckpointMessageRecord as w, RecoveryContinuationRecord as x, PendingCommand as y, activeCommand as z };
|
|
469
|
-
//# sourceMappingURL=command-queues-
|
|
469
|
+
//# sourceMappingURL=command-queues-C8muEqeQ.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-
|
|
2
|
-
import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-
|
|
3
|
-
import { S as ReducedState } from "./command-queues-
|
|
1
|
+
import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-C43pyxn2.js";
|
|
2
|
+
import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-ofm8FFxs.js";
|
|
3
|
+
import { S as ReducedState } from "./command-queues-C8muEqeQ.js";
|
|
4
4
|
import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
|
|
5
5
|
import { t as EventFactory } from "./event-factory-CLJcyymV.js";
|
|
6
6
|
import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
|
|
@@ -139,8 +139,8 @@ interface CompactionRunnerShape {
|
|
|
139
139
|
declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
|
|
140
140
|
/** Framework-owned compaction lifecycle runner. */
|
|
141
141
|
declare class CompactionRunner extends CompactionRunner_base {
|
|
142
|
-
static readonly Live: Layer.Layer<CompactionRunner, never,
|
|
142
|
+
static readonly Live: Layer.Layer<CompactionRunner, never, CompactionExecutor | CompactionPolicy | EDAKeepAlive | IdGenerator | EventFactory>;
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
145
|
export { defaultCompactionRetainTailTokens as _, CompactionExecutorShape as a, CompactionPolicy as c, CompactionRunner as d, CompactionRunnerInput as f, defaultCompactionMinSummarizableTokens as g, defaultCompactionCharsPerToken as h, CompactionExecutorInput as i, CompactionPolicyInput as l, LanguageModelSummaryCompactionExecutorOptions as m, CompactionError as n, CompactionOutput as o, CompactionRunnerShape as p, CompactionExecutor as r, CompactionPlan as s, ApproximateTokenThresholdCompactionPolicyOptions as t, CompactionPolicyShape as u, defaultCompactionThresholdTokens as v };
|
|
146
|
-
//# sourceMappingURL=compaction-
|
|
146
|
+
//# sourceMappingURL=compaction-F4HEWzuI.d.ts.map
|
|
@@ -116,11 +116,11 @@ declare const emptyContextProjection: {
|
|
|
116
116
|
readonly [x: string]: Schema.Json;
|
|
117
117
|
};
|
|
118
118
|
} | {
|
|
119
|
+
readonly type: "file";
|
|
119
120
|
readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
|
|
120
121
|
readonly options: {
|
|
121
122
|
readonly [x: string]: Schema.Json;
|
|
122
123
|
};
|
|
123
|
-
readonly type: "file";
|
|
124
124
|
readonly mediaType: string;
|
|
125
125
|
readonly data: string | Uint8Array<ArrayBufferLike> | URL;
|
|
126
126
|
readonly fileName?: string | undefined;
|
|
@@ -137,4 +137,4 @@ declare const emptyContextProjection: {
|
|
|
137
137
|
};
|
|
138
138
|
//#endregion
|
|
139
139
|
export { emptyContextProjection as a, ContextProjection as i, CompactionPolicyId as n, CompactionSummaryArtifact as r, CompactionExecutorId as t };
|
|
140
|
-
//# sourceMappingURL=context-projection-
|
|
140
|
+
//# sourceMappingURL=context-projection-C43pyxn2.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as deriveCommandQueues, i as PendingUserMessage, n as CommandQueues, o as emptyCommandQueues, r as PendingSteeringMessage, t as CommandQueueSource } from "../command-queues-
|
|
1
|
+
import { a as deriveCommandQueues, i as PendingUserMessage, n as CommandQueues, o as emptyCommandQueues, r as PendingSteeringMessage, t as CommandQueueSource } from "../command-queues-C8muEqeQ.js";
|
|
2
2
|
export { CommandQueueSource, CommandQueues, PendingSteeringMessage, PendingUserMessage, deriveCommandQueues, emptyCommandQueues };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-
|
|
1
|
+
import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-C43pyxn2.js";
|
|
2
2
|
export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as durableMessageTranscript, i as contextProjectionPromptWithUserContents, n as contextProjectionPrompt, o as durableTranscriptPrompt, r as contextProjectionPromptWithUserContent, s as durableTranscriptPromptWithUserContent, t as DurableTranscriptMessage } from "../message-transcript-
|
|
1
|
+
import { a as durableMessageTranscript, i as contextProjectionPromptWithUserContents, n as contextProjectionPrompt, o as durableTranscriptPrompt, r as contextProjectionPromptWithUserContent, s as durableTranscriptPromptWithUserContent, t as DurableTranscriptMessage } from "../message-transcript-DsKTT47f.js";
|
|
2
2
|
export { DurableTranscriptMessage, contextProjectionPrompt, contextProjectionPromptWithUserContent, contextProjectionPromptWithUserContents, durableMessageTranscript, durableTranscriptPrompt, durableTranscriptPromptWithUserContent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as RunTerminal, B as activeTurnIdentityForCommand, C as ReducedStateCheckpointCommandRecord, D as ReducedStateCheckpointToolDecision, E as ReducedStateCheckpointToolCallRecord, F as ToolDecision, G as frameworkReducedStateReducerName, H as decodeReducedStateCheckpoint, I as ToolTerminal, J as pendingCommands, K as frameworkReducedStateReducerSchemaVersion, L as TurnRecord, M as TokenConsumptionState, N as TokenUsageTotals, O as ReducedStateCheckpointToolTerminal, P as ToolCallRecord, R as TurnTerminal, S as ReducedState, T as ReducedStateCheckpointPayload, U as encodeReducedStateCheckpoint, V as classifyRecoverableWork, W as foldReducedState, X as reduceCommittedEvents, Y as pendingStopCommand, Z as reducedStateCheckpointEventSeqs, _ as LifecycleTiming, b as RecoverableWork, c as ActiveTurnIdentity, d as CompactionRecord, f as CompactionTerminal, g as LifecycleFailure, h as InferenceTerminal, j as StopRequestRecord, k as RunRecord, l as CommandRecord, m as InferenceRecord, p as ContextRecord, q as initialReducedState, s as ActiveCommandEvidence, u as CommandTerminal, v as MessageRecord, w as ReducedStateCheckpointMessageRecord, x as RecoveryContinuationRecord, y as PendingCommand, z as activeCommand } from "../command-queues-
|
|
1
|
+
import { A as RunTerminal, B as activeTurnIdentityForCommand, C as ReducedStateCheckpointCommandRecord, D as ReducedStateCheckpointToolDecision, E as ReducedStateCheckpointToolCallRecord, F as ToolDecision, G as frameworkReducedStateReducerName, H as decodeReducedStateCheckpoint, I as ToolTerminal, J as pendingCommands, K as frameworkReducedStateReducerSchemaVersion, L as TurnRecord, M as TokenConsumptionState, N as TokenUsageTotals, O as ReducedStateCheckpointToolTerminal, P as ToolCallRecord, R as TurnTerminal, S as ReducedState, T as ReducedStateCheckpointPayload, U as encodeReducedStateCheckpoint, V as classifyRecoverableWork, W as foldReducedState, X as reduceCommittedEvents, Y as pendingStopCommand, Z as reducedStateCheckpointEventSeqs, _ as LifecycleTiming, b as RecoverableWork, c as ActiveTurnIdentity, d as CompactionRecord, f as CompactionTerminal, g as LifecycleFailure, h as InferenceTerminal, j as StopRequestRecord, k as RunRecord, l as CommandRecord, m as InferenceRecord, p as ContextRecord, q as initialReducedState, s as ActiveCommandEvidence, u as CommandTerminal, v as MessageRecord, w as ReducedStateCheckpointMessageRecord, x as RecoveryContinuationRecord, y as PendingCommand, z as activeCommand } from "../command-queues-C8muEqeQ.js";
|
|
2
2
|
export { ActiveCommandEvidence, ActiveTurnIdentity, CommandRecord, CommandTerminal, CompactionRecord, CompactionTerminal, ContextRecord, InferenceRecord, InferenceTerminal, LifecycleFailure, LifecycleTiming, MessageRecord, PendingCommand, RecoverableWork, RecoveryContinuationRecord, ReducedState, ReducedStateCheckpointCommandRecord, ReducedStateCheckpointMessageRecord, ReducedStateCheckpointPayload, ReducedStateCheckpointToolCallRecord, ReducedStateCheckpointToolDecision, ReducedStateCheckpointToolTerminal, RunRecord, RunTerminal, StopRequestRecord, TokenConsumptionState, TokenUsageTotals, ToolCallRecord, ToolDecision, ToolTerminal, TurnRecord, TurnTerminal, activeCommand, activeTurnIdentityForCommand, classifyRecoverableWork, decodeReducedStateCheckpoint, encodeReducedStateCheckpoint, foldReducedState, frameworkReducedStateReducerName, frameworkReducedStateReducerSchemaVersion, initialReducedState, pendingCommands, pendingStopCommand, reduceCommittedEvents, reducedStateCheckpointEventSeqs };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { a as PromotePendingMessageCommand, c as SubmitMessageCommand, d as User
|
|
|
3
3
|
import { _ as parseEDATraceparent, a as EDATraceAttributes, c as EDATraceLink, d as makeEDAEventTrace, f as makeEDARunTrace, g as makeRootEDATraceMetadata, h as makeRootEDAEventTrace, i as EDATraceAttributeValue, l as EDATraceMetadata, m as makeEDATraceMetadataFromParent, n as EDARunTrace, o as EDATraceContext, p as makeEDATraceContext, r as EDASpanId, s as EDATraceId, t as EDAEventTrace, u as buildEDATraceparent } from "./tracing-BXHAkxkx.js";
|
|
4
4
|
import { A as EventEnvelope, B as SystemPromptText, C as toolParamsDeltaEventType, D as DurableEventEnvelope, E as traceStatusEventType, F as ModelSelectionPayload, G as makeEventType, H as UnixEpochMillis, I as NonNegativeInt, K as schemaV1, L as PositionedEvent, M as EventType, N as EventTypeName, O as EphemeralEventEnvelope, P as FailurePayload, R as ProviderPartId, S as textDeltaEventType, T as toolParamsStartEventType, U as UsagePayload, V as ToolName, W as effectDurableAgentNamespace, _ as TraceStatusEvent, a as RuntimeStatusEvent, b as reasoningDeltaEventType, c as SubscriberStatusPayload, d as ToolParamsDeltaEvent, f as ToolParamsDeltaPayload, g as ToolParamsStartPayload, h as ToolParamsStartEvent, i as ReasoningDeltaPayload, j as EventNamespace, k as EventDurability, l as TextDeltaEvent, m as ToolParamsEndPayload, n as ModelStreamEvent, o as SubscriberStatusEvent, p as ToolParamsEndEvent, r as ReasoningDeltaEvent, s as SubscriberStatusKind, t as EDAEphemeralEvent, u as TextDeltaPayload, v as TraceStatusKind, w as toolParamsEndEventType, x as subscriberStatusEventType, y as TraceStatusPayload, z as SchemaVersion } from "./events-Bb9-Cu-7.js";
|
|
5
5
|
import { $ as PendingMessagesPausedEvent, $n as turnStoppedEventType, $t as TurnStoppedPayload, A as CompactionFailedEvent, An as inferenceFailedEventType, At as ToolCallCreatedPayload, B as ContextRebasedPayload, Bn as steeringMessageQueuedEventType, Bt as ToolCallStartedPayload, C as CommandEvent, Cn as compactionRequestedEventType, Ct as SummaryCreatedEvent, D as CommandStartedPayload, Dn as decodeUnknownEDADurableEvent, Dt as ToolCallCompletedEvent, E as CommandStartedEvent, En as contextRebasedEventType, Et as SystemMessageCommittedPayload, F as CompactionStartedPayload, Fn as runCompletedEventType, Ft as ToolCallRejectedEvent, G as InferenceEvent, Gn as toolCallCompletedEventType, Gt as TurnCompletedEvent, H as EDADurableEventV1, Hn as stopTurnRequestedEventType, Ht as ToolPromptPart, I as ContextAndCompactionEvent, In as runFailedEventType, It as ToolCallRejectedPayload, J as InferenceStartedEvent, Jn as toolCallRejectedEventType, Jt as TurnFailedEvent, K as InferenceFailedEvent, Kn as toolCallCreatedEventType, Kt as TurnCompletedPayload, L as ContextProjectedEvent, Ln as runInterruptedEventType, Lt as ToolCallRejectionFeedback, M as CompactionRequestedEvent, Mn as messageQueuePausedEventType, Mt as ToolCallFailedEvent, N as CompactionRequestedPayload, Nn as pendingMessagesPausedEventType, Nt as ToolCallFailedPayload, O as CompactionCompletedEvent, On as decodeUnknownEDADurableEventSync, Ot as ToolCallCompletedPayload, P as CompactionStartedEvent, Pn as recoveryCompletedEventType, Pt as ToolCallPromptPart, Q as MessageQueuePausedPayload, Qn as turnStartedEventType, Qt as TurnStoppedEvent, R as ContextProjectedPayload, Rn as runStartedEventType, Rt as ToolCallRejectionReason, S as CommandCompletedPayload, Sn as compactionFailedEventType, St as StopTurnRequestedPayload, T as CommandFailedPayload, Tn as contextProjectedEventType, Tt as SystemMessageCommittedEvent, U as InferenceCompletedEvent, Un as summaryCreatedEventType, Ut as ToolRejectionPromptPart, V as EDADurableEvent, Vn as stopTurnAppliedEventType, Vt as ToolFailurePromptPart, W as InferenceCompletedPayload, Wn as systemMessageCommittedEventType, Wt as ToolSuccessPromptPart, X as MessageEvent, Xn as turnCompletedEventType, Xt as TurnStartedEvent, Y as InferenceStartedPayload, Yn as toolCallStartedEventType, Yt as TurnFailedPayload, Z as MessageQueuePausedEvent, Zn as turnFailedEventType, Zt as TurnStartedPayload, _ as CommandAdmittedEvent, _n as commandCancelledEventType, _t as SteeringMessageQueuedPayload, a as AssistantMessageImportedPayload, an as UserMessageDisposition, at as RunCompletedEvent, b as CommandCancelledPayload, bn as commandStartedEventType, bt as StopTurnAppliedPayload, c as AssistantPromptPart, cn as UserMessageSubmittedEvent, ct as RunFailedEvent, d as BaseStateCreatedPayload, dn as assistantMessageImportedEventType, dt as RunInterruptedPayload, en as UserMessageCancellationReason, er as userMessageCancelledEventType, et as PendingMessagesPausedPayload, f as BaseStateEvent, fn as assistantPartialCommittedEventType, ft as RunStartedEvent, g as BaseStateRequestedPayload, gn as commandAdmittedEventType, gt as SteeringMessageQueuedEvent, h as BaseStateRequestedEvent, hn as baseStateRequestedEventType, ht as SteeringMessageCancelledPayload, i as AssistantMessageImportedEvent, in as UserMessageCommittedPayload, it as RecoveryEvent, j as CompactionFailedPayload, jn as inferenceStartedEventType, jt as ToolCallEvent, k as CompactionCompletedPayload, kn as inferenceCompletedEventType, kt as ToolCallCreatedEvent, l as AssistantPromptParts, ln as UserMessageSubmittedPayload, lt as RunFailedPayload, m as BaseStateFailedPayload, mn as baseStateFailedEventType, mt as SteeringMessageCancelledEvent, n as AssistantMessageCommittedPayload, nn as UserMessageCancelledPayload, nr as userMessagePromotedEventType, nt as RecoveryCompletedPayload, o as AssistantPartialCommittedEvent, on as UserMessagePromotedEvent, ot as RunCompletedPayload, p as BaseStateFailedEvent, pn as baseStateCreatedEventType, pt as RunStartedPayload, q as InferenceFailedPayload, qn as toolCallFailedEventType, qt as TurnEvent, r as AssistantMessageContent, rn as UserMessageCommittedEvent, rr as userMessageSubmittedEventType, rt as RecoveryContinuation, s as AssistantPartialCommittedPayload, sn as UserMessagePromotedPayload, st as RunEvent, t as AssistantMessageCommittedEvent, tn as UserMessageCancelledEvent, tr as userMessageCommittedEventType, tt as RecoveryCompletedEvent, u as BaseStateCreatedEvent, un as assistantMessageCommittedEventType, ut as RunInterruptedEvent, v as CommandAdmittedPayload, vn as commandCompletedEventType, vt as StopControlEvent, w as CommandFailedEvent, wn as compactionStartedEventType, wt as SummaryCreatedPayload, x as CommandCompletedEvent, xn as compactionCompletedEventType, xt as StopTurnRequestedEvent, y as CommandCancelledEvent, yn as commandFailedEventType, yt as StopTurnAppliedEvent, z as ContextRebasedEvent, zn as steeringMessageCancelledEventType, zt as ToolCallStartedEvent } from "./durable-B7M6TD_0.js";
|
|
6
|
-
import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "./runtime-
|
|
6
|
+
import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "./runtime-BO9KJq_Y.js";
|
|
7
7
|
export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateId, BaseStateRequestedEvent, BaseStateRequestedPayload, CancelPendingMessageCommand, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandId, CommandIdempotencyKey, CommandStartedEvent, CommandStartedPayload, CommittedCommandTerminalEvent, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionId, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, ContextVersion, CorrelationId, DurableEventEnvelope, DurablePosition, DurableSubSequenceNumber, EDACommand, EDACommandTerminalEvent, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDARuntime, EDARuntimeConfig, EDARuntimeError, EDARuntimeShape, EDARuntimeSubmit, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDurability, EventEnvelope, EventId, EventNamespace, EventType, EventTypeName, FailurePayload, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceId, InferenceStartedEvent, InferenceStartedPayload, MessageEvent, MessageId, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessageCancellationReason, PendingMessagesPausedEvent, PendingMessagesPausedPayload, Position, PositionOrder, PositionedEvent, PromotePendingMessageCommand, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, ResumePendingMessagesCommand, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunId, RunInterruptedEvent, RunInterruptedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SequenceNumber, SessionId, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnCommand, StopTurnRequestedEvent, StopTurnRequestedPayload, SubSequenceNumber, SubmitMessageCommand, SubmitMessageDisposition, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SummaryId, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallId, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnId, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageContent, UserMessageDisposition, UserMessagePart, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, comparePosition, contextProjectedEventType, contextRebasedEventType, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durablePosition, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runStartedEventType, schemaV1, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as UserMessageContent } from "./commands-Ce1ec6kH.js";
|
|
2
|
-
import { i as ContextProjection } from "./context-projection-
|
|
3
|
-
import { S as ReducedState, v as MessageRecord } from "./command-queues-
|
|
2
|
+
import { i as ContextProjection } from "./context-projection-C43pyxn2.js";
|
|
3
|
+
import { S as ReducedState, v as MessageRecord } from "./command-queues-C8muEqeQ.js";
|
|
4
4
|
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
5
5
|
|
|
6
6
|
//#region src/domain/message-transcript.d.ts
|
|
@@ -29,4 +29,4 @@ declare const contextProjectionPromptWithUserContent: (state: PromptProjectionSt
|
|
|
29
29
|
declare const contextProjectionPromptWithUserContents: (state: PromptProjectionState, context: ContextProjection | undefined, contents: ReadonlyArray<UserMessageContent>) => Prompt.Prompt;
|
|
30
30
|
//#endregion
|
|
31
31
|
export { durableMessageTranscript as a, contextProjectionPromptWithUserContents as i, contextProjectionPrompt as n, durableTranscriptPrompt as o, contextProjectionPromptWithUserContent as r, durableTranscriptPromptWithUserContent as s, DurableTranscriptMessage as t };
|
|
32
|
-
//# sourceMappingURL=message-transcript-
|
|
32
|
+
//# sourceMappingURL=message-transcript-DsKTT47f.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h as SessionId } from "./core-CYT6DBaS.js";
|
|
2
|
-
import { i as ContextProjection } from "./context-projection-
|
|
3
|
-
import { S as ReducedState } from "./command-queues-
|
|
4
|
-
import {
|
|
2
|
+
import { i as ContextProjection } from "./context-projection-C43pyxn2.js";
|
|
3
|
+
import { S as ReducedState } from "./command-queues-C8muEqeQ.js";
|
|
4
|
+
import { a as EDAReducerStateSnapshot } from "./reducer-registry--vQFATXb.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";
|
|
@@ -36,4 +36,4 @@ declare class EDAPromptProjector extends EDAPromptProjector_base {
|
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
38
|
export { buildEDAPrompt as a, EDAPromptProjectorShape as i, EDAPromptProjectionInput as n, EDAPromptProjector as r, EDAProjectedPromptContext as t };
|
|
39
|
-
//# sourceMappingURL=prompt-projector-
|
|
39
|
+
//# sourceMappingURL=prompt-projector-hqPh5-NI.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as CommittedDurableEvent } from "./session-store-
|
|
1
|
+
import { t as CommittedDurableEvent } from "./session-store-ofm8FFxs.js";
|
|
2
2
|
import * as Context from "effect/Context";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
|
|
6
6
|
//#region src/services/reducer-registry.d.ts
|
|
7
|
-
/**
|
|
8
|
-
interface
|
|
7
|
+
/** Input accepted by the reducer constructor before schema codecs are materialized. */
|
|
8
|
+
interface EDAReducerDefinition<State, Name extends string = string> {
|
|
9
9
|
readonly name: Name;
|
|
10
10
|
readonly initial: State;
|
|
11
11
|
readonly stateSchema: Schema.Codec<State, unknown, never, never>;
|
|
@@ -14,9 +14,19 @@ interface EDAReducer<State = unknown, Name extends string = string> {
|
|
|
14
14
|
readonly decode?: (payload: unknown) => State;
|
|
15
15
|
reduce(state: State, event: CommittedDurableEvent): State;
|
|
16
16
|
}
|
|
17
|
+
/** App-specific pure reducer over the durable session event log. */
|
|
18
|
+
interface EDAReducer<State = unknown, Name extends string = string> {
|
|
19
|
+
readonly name: Name;
|
|
20
|
+
readonly initial: State;
|
|
21
|
+
readonly stateSchema: Schema.Codec<State, unknown, never, never>;
|
|
22
|
+
readonly schemaVersion?: number;
|
|
23
|
+
encode(state: State): unknown;
|
|
24
|
+
decode(payload: unknown): State;
|
|
25
|
+
reduce(state: State, event: CommittedDurableEvent): State;
|
|
26
|
+
}
|
|
17
27
|
/** Convenience constructor preserving a reducer's literal name and schema-derived state type. */
|
|
18
28
|
declare const EDAReducer: {
|
|
19
|
-
make: <State, const Name extends string = string>(reducer:
|
|
29
|
+
make: <State, const Name extends string = string>(reducer: EDAReducerDefinition<State, Name>) => EDAReducer<State, Name>;
|
|
20
30
|
};
|
|
21
31
|
/** Snapshot of all app reducer states, keyed by reducer name. */
|
|
22
32
|
type EDAReducerStateSnapshot = ReadonlyMap<string, unknown>;
|
|
@@ -65,5 +75,5 @@ declare class EDAReducerRegistry extends EDAReducerRegistry_base {
|
|
|
65
75
|
/** Read one typed reducer state from a snapshot. */
|
|
66
76
|
declare const getEDAReducerState: <State, Name extends string>(snapshot: EDAReducerStateSnapshot, reducer: EDAReducer<State, Name>) => State;
|
|
67
77
|
//#endregion
|
|
68
|
-
export {
|
|
69
|
-
//# sourceMappingURL=reducer-registry
|
|
78
|
+
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 };
|
|
79
|
+
//# sourceMappingURL=reducer-registry--vQFATXb.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { m as SequenceNumber, n as CommandId } from "./core-CYT6DBaS.js";
|
|
2
2
|
import { r as EDACommand } from "./commands-Ce1ec6kH.js";
|
|
3
3
|
import { w as CommandFailedEvent, x as CommandCompletedEvent, y as CommandCancelledEvent } from "./durable-B7M6TD_0.js";
|
|
4
|
-
import { t as CommittedDurableEvent } from "./session-store-
|
|
5
|
-
import { h as SessionState, r as SessionCommandAdmissionError, t as EDASubmittable } from "./session-state-
|
|
6
|
-
import { n as
|
|
4
|
+
import { t as CommittedDurableEvent } from "./session-store-ofm8FFxs.js";
|
|
5
|
+
import { h as SessionState, r as SessionCommandAdmissionError, t as EDASubmittable } from "./session-state-BfoXKafd.js";
|
|
6
|
+
import { n as EDASessionQuery, r as EDASessionQueryShape } from "./session-query-_Z3Kw6jj.js";
|
|
7
7
|
import * as Context from "effect/Context";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Layer from "effect/Layer";
|
|
@@ -50,12 +50,14 @@ interface EDARuntimeShape {
|
|
|
50
50
|
readonly messages: EDASessionQueryShape["messages"];
|
|
51
51
|
/** Backfill durable events after a committed sequence, then follow live events. */
|
|
52
52
|
readonly eventsAfter: EDASessionQueryShape["eventsAfter"];
|
|
53
|
+
/** Read one bounded page of committed durable events plus the committed head. */
|
|
54
|
+
readonly readEventPage: EDASessionQueryShape["readEventPage"];
|
|
53
55
|
}
|
|
54
56
|
declare const EDARuntime_base: Context.ServiceClass<EDARuntime, "@effect-durable-agent/EDARuntime", EDARuntimeShape>;
|
|
55
57
|
/** Top-level public facade for one effect-durable-agent session runtime. */
|
|
56
58
|
declare class EDARuntime extends EDARuntime_base {
|
|
57
|
-
static readonly Live: (config: EDARuntimeConfig) => Layer.Layer<EDARuntime, SessionCommandAdmissionError,
|
|
59
|
+
static readonly Live: (config: EDARuntimeConfig) => Layer.Layer<EDARuntime, SessionCommandAdmissionError, EDASessionQuery | SessionState>;
|
|
58
60
|
}
|
|
59
61
|
//#endregion
|
|
60
62
|
export { EDARuntimeError as a, EDARuntimeConfig as i, EDACommandTerminalEvent as n, EDARuntimeShape as o, EDARuntime as r, EDARuntimeSubmit as s, CommittedCommandTerminalEvent as t };
|
|
61
|
-
//# sourceMappingURL=runtime-
|
|
63
|
+
//# sourceMappingURL=runtime-BO9KJq_Y.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-
|
|
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-F4HEWzuI.js";
|
|
2
2
|
export { ApproximateTokenThresholdCompactionPolicyOptions, CompactionError, CompactionExecutor, CompactionExecutorInput, CompactionExecutorShape, CompactionOutput, CompactionPlan, CompactionPolicy, CompactionPolicyInput, CompactionPolicyShape, CompactionRunner, CompactionRunnerInput, CompactionRunnerShape, LanguageModelSummaryCompactionExecutorOptions, defaultCompactionCharsPerToken, defaultCompactionMinSummarizableTokens, defaultCompactionRetainTailTokens, defaultCompactionThresholdTokens };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildEDAPrompt, i as EDAPromptProjectorShape, n as EDAPromptProjectionInput, r as EDAPromptProjector, t as EDAProjectedPromptContext } from "../prompt-projector-
|
|
1
|
+
import { a as buildEDAPrompt, i as EDAPromptProjectorShape, n as EDAPromptProjectionInput, r as EDAPromptProjector, t as EDAProjectedPromptContext } from "../prompt-projector-hqPh5-NI.js";
|
|
2
2
|
export { EDAProjectedPromptContext, EDAPromptProjectionInput, EDAPromptProjector, EDAPromptProjectorShape, buildEDAPrompt };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { EDAReducer, EDAReducerRegistry, EDAReducerRegistryShape, EDAReducerStateSnapshot, EDAReducersFor, EDATypedReducerRegistry, decodeReducerState, defineEDAReducerRegistry, edaReservedReducerNamePrefix, encodeReducerState, getEDAReducerState, reducerSchemaVersion };
|
|
1
|
+
import { a as EDAReducerStateSnapshot, c as decodeReducerState, d as encodeReducerState, f as getEDAReducerState, i as EDAReducerRegistryShape, l as defineEDAReducerRegistry, n as EDAReducerDefinition, o as EDAReducersFor, p as reducerSchemaVersion, r as EDAReducerRegistry, s as EDATypedReducerRegistry, t as EDAReducer, u as edaReservedReducerNamePrefix } from "../reducer-registry--vQFATXb.js";
|
|
2
|
+
export { EDAReducer, EDAReducerDefinition, EDAReducerRegistry, EDAReducerRegistryShape, EDAReducerStateSnapshot, EDAReducersFor, EDATypedReducerRegistry, decodeReducerState, defineEDAReducerRegistry, edaReservedReducerNamePrefix, encodeReducerState, getEDAReducerState, reducerSchemaVersion };
|
|
@@ -3,7 +3,11 @@ import * as Layer from "effect/Layer";
|
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
//#region src/services/reducer-registry.ts
|
|
5
5
|
/** Convenience constructor preserving a reducer's literal name and schema-derived state type. */
|
|
6
|
-
const EDAReducer = { make: (reducer) =>
|
|
6
|
+
const EDAReducer = { make: (reducer) => ({
|
|
7
|
+
...reducer,
|
|
8
|
+
encode: reducer.encode ?? ((state) => Schema.encodeUnknownSync(reducer.stateSchema)(state)),
|
|
9
|
+
decode: reducer.decode ?? ((payload) => Schema.decodeUnknownSync(reducer.stateSchema)(payload))
|
|
10
|
+
}) };
|
|
7
11
|
const reducerValues = (reducers) => Object.values(reducers);
|
|
8
12
|
/**
|
|
9
13
|
* Register an app's complete reducer set against its public serialized-state union.
|
|
@@ -28,9 +32,9 @@ const edaReservedReducerNamePrefix = "_eda.";
|
|
|
28
32
|
/** Return the persisted schema version for one reducer. */
|
|
29
33
|
const reducerSchemaVersion = (reducer) => reducer.schemaVersion ?? 1;
|
|
30
34
|
/** Encode one reducer state for durable checkpoint storage. */
|
|
31
|
-
const encodeReducerState = (reducer, state) => reducer.encode
|
|
35
|
+
const encodeReducerState = (reducer, state) => reducer.encode(state);
|
|
32
36
|
/** Decode one reducer state from durable checkpoint storage. */
|
|
33
|
-
const decodeReducerState = (reducer, payload) => reducer.decode
|
|
37
|
+
const decodeReducerState = (reducer, payload) => reducer.decode(payload);
|
|
34
38
|
/** Registry for app-specific durable metadata reducers. */
|
|
35
39
|
var EDAReducerRegistry = class EDAReducerRegistry extends Context.Service()("@effect-durable-agent/EDAReducerRegistry") {
|
|
36
40
|
static Empty = Layer.succeed(EDAReducerRegistry, makeReducerRegistry([]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer-registry.js","names":[],"sources":["../../src/services/reducer-registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\n\nimport type { CommittedDurableEvent } from \"./session-store\";\n\n/** App-specific pure reducer over the durable session event log. */\nexport interface EDAReducer<State = unknown, Name extends string = string> {\n readonly name: Name;\n readonly initial: State;\n readonly stateSchema: Schema.Codec<State, unknown, never, never>;\n readonly schemaVersion?: number;\n
|
|
1
|
+
{"version":3,"file":"reducer-registry.js","names":[],"sources":["../../src/services/reducer-registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\nimport * as Schema from \"effect/Schema\";\n\nimport type { CommittedDurableEvent } from \"./session-store\";\n\n/** Input accepted by the reducer constructor before schema codecs are materialized. */\nexport interface EDAReducerDefinition<State, Name extends string = string> {\n readonly name: Name;\n readonly initial: State;\n readonly stateSchema: Schema.Codec<State, unknown, never, never>;\n readonly schemaVersion?: number;\n readonly encode?: (state: State) => unknown;\n readonly decode?: (payload: unknown) => State;\n reduce(state: State, event: CommittedDurableEvent): State;\n}\n\n/** App-specific pure reducer over the durable session event log. */\nexport interface EDAReducer<State = unknown, Name extends string = string> {\n readonly name: Name;\n readonly initial: State;\n readonly stateSchema: Schema.Codec<State, unknown, never, never>;\n readonly schemaVersion?: number;\n encode(state: State): unknown;\n decode(payload: unknown): State;\n reduce(state: State, event: CommittedDurableEvent): State;\n}\n\n/** Convenience constructor preserving a reducer's literal name and schema-derived state type. */\nexport const EDAReducer = {\n make: <State, const Name extends string = string>(\n reducer: EDAReducerDefinition<State, Name>,\n ): EDAReducer<State, Name> => ({\n ...reducer,\n encode: reducer.encode ?? ((state) => Schema.encodeUnknownSync(reducer.stateSchema)(state)),\n decode: reducer.decode ?? ((payload) => Schema.decodeUnknownSync(reducer.stateSchema)(payload)),\n }),\n};\n\n/** Snapshot of all app reducer states, keyed by reducer name. */\nexport type EDAReducerStateSnapshot = ReadonlyMap<string, unknown>;\n\ninterface EDASerializedReducerState {\n readonly name: string;\n readonly state: unknown;\n}\n\ntype EDAReducerStateForName<\n Entry extends EDASerializedReducerState,\n Name extends Entry[\"name\"],\n> = Extract<Entry, { readonly name: Name }>[\"state\"];\n\n/** Exact reducer object required for every member of a serialized state union. */\nexport type EDAReducersFor<Entry extends EDASerializedReducerState> = {\n readonly [Name in Entry[\"name\"]]: EDAReducer<EDAReducerStateForName<Entry, Name>, Name>;\n};\n\n/** Schema-backed app reducer registry used by both runtime folding and snapshot serialization. */\nexport interface EDATypedReducerRegistry<\n EntrySchema extends Schema.Codec<EDASerializedReducerState, unknown, never, never>,\n> {\n readonly entrySchema: EntrySchema;\n readonly reducers: ReadonlyArray<EDAReducer>;\n readonly serialize: (snapshot: EDAReducerStateSnapshot) => ReadonlyArray<EntrySchema[\"Type\"]>;\n}\n\nconst reducerValues = (reducers: Readonly<Record<string, EDAReducer>>): ReadonlyArray<EDAReducer> =>\n Object.values(reducers);\n\n/**\n * Register an app's complete reducer set against its public serialized-state union.\n *\n * Missing reducers, extra reducers, reducer-name drift, and state-schema drift are\n * rejected by TypeScript at the registration site.\n */\nexport const defineEDAReducerRegistry = <\n EntrySchema extends Schema.Codec<EDASerializedReducerState, unknown, never, never>,\n>(\n entrySchema: EntrySchema,\n reducers: EDAReducersFor<EntrySchema[\"Type\"]>,\n): EDATypedReducerRegistry<EntrySchema> => {\n const values = reducerValues(reducers);\n const serializedStatesSchema = Schema.Array(entrySchema);\n return {\n entrySchema,\n reducers: values,\n serialize: (snapshot) =>\n Schema.decodeUnknownSync(serializedStatesSchema)(\n values.map((reducer) => ({\n name: reducer.name,\n state: snapshot.get(reducer.name) ?? reducer.initial,\n })),\n ),\n };\n};\n\n/** Registry that folds app-specific read-model state beside EDA reduced state. */\nexport interface EDAReducerRegistryShape {\n readonly reducers: ReadonlyArray<EDAReducer>;\n readonly initial: EDAReducerStateSnapshot;\n readonly reduce: (\n state: EDAReducerStateSnapshot,\n events: ReadonlyArray<CommittedDurableEvent>,\n ) => EDAReducerStateSnapshot;\n}\n\n/** Prefix reserved for framework-owned reducer checkpoints. */\nexport const edaReservedReducerNamePrefix = \"_eda.\";\n\n/** Return the persisted schema version for one reducer. */\nexport const reducerSchemaVersion = (reducer: EDAReducer): number => reducer.schemaVersion ?? 1;\n\n/** Encode one reducer state for durable checkpoint storage. */\nexport const encodeReducerState = <State, Name extends string>(\n reducer: EDAReducer<State, Name>,\n state: State,\n): unknown => reducer.encode(state);\n\n/** Decode one reducer state from durable checkpoint storage. */\nexport const decodeReducerState = <State, Name extends string>(\n reducer: EDAReducer<State, Name>,\n payload: unknown,\n): State => reducer.decode(payload);\n\n/** Registry for app-specific durable metadata reducers. */\nexport class EDAReducerRegistry extends Context.Service<\n EDAReducerRegistry,\n EDAReducerRegistryShape\n>()(\"@effect-durable-agent/EDAReducerRegistry\") {\n static readonly Empty = Layer.succeed(EDAReducerRegistry, makeReducerRegistry([]));\n\n static readonly Live = (reducers: ReadonlyArray<EDAReducer>) =>\n Layer.succeed(EDAReducerRegistry, makeReducerRegistry(reducers));\n}\n\n/** Read one typed reducer state from a snapshot. */\nexport const getEDAReducerState = <State, Name extends string>(\n snapshot: EDAReducerStateSnapshot,\n reducer: EDAReducer<State, Name>,\n): State => {\n const state = snapshot.get(reducer.name);\n return state === undefined\n ? reducer.initial\n : Schema.decodeUnknownSync(reducer.stateSchema)(state);\n};\n\nfunction makeReducerRegistry(reducers: ReadonlyArray<EDAReducer>): EDAReducerRegistryShape {\n validateReducerNames(reducers);\n const initial = new Map(reducers.map((reducer) => [reducer.name, reducer.initial]));\n return {\n reducers,\n initial,\n reduce: (state, events) => {\n if (events.length === 0 || reducers.length === 0) {\n return state;\n }\n const next = new Map(state);\n for (const event of events) {\n for (const reducer of reducers) {\n const current = next.get(reducer.name) ?? reducer.initial;\n next.set(reducer.name, reducer.reduce(current, event));\n }\n }\n return next;\n },\n };\n}\n\nfunction validateReducerNames(reducers: ReadonlyArray<EDAReducer>): void {\n const seen = new Set<string>();\n for (const reducer of reducers) {\n if (reducer.name.startsWith(edaReservedReducerNamePrefix)) {\n throw new Error(\n `Reducer name ${reducer.name} uses reserved EDA prefix ${edaReservedReducerNamePrefix}`,\n );\n }\n if (seen.has(reducer.name)) {\n throw new Error(`Duplicate EDA reducer name ${reducer.name}`);\n }\n seen.add(reducer.name);\n }\n}\n"],"mappings":";;;;;AA6BA,MAAa,aAAa,EACxB,OACE,aAC6B;CAC7B,GAAG;CACH,QAAQ,QAAQ,YAAY,UAAU,OAAO,kBAAkB,QAAQ,WAAW,EAAE,KAAK;CACzF,QAAQ,QAAQ,YAAY,YAAY,OAAO,kBAAkB,QAAQ,WAAW,EAAE,OAAO;AAC/F,GACF;AA6BA,MAAM,iBAAiB,aACrB,OAAO,OAAO,QAAQ;;;;;;;AAQxB,MAAa,4BAGX,aACA,aACyC;CACzC,MAAM,SAAS,cAAc,QAAQ;CACrC,MAAM,yBAAyB,OAAO,MAAM,WAAW;CACvD,OAAO;EACL;EACA,UAAU;EACV,YAAY,aACV,OAAO,kBAAkB,sBAAsB,EAC7C,OAAO,KAAK,aAAa;GACvB,MAAM,QAAQ;GACd,OAAO,SAAS,IAAI,QAAQ,IAAI,KAAK,QAAQ;EAC/C,EAAE,CACJ;CACJ;AACF;;AAaA,MAAa,+BAA+B;;AAG5C,MAAa,wBAAwB,YAAgC,QAAQ,iBAAiB;;AAG9F,MAAa,sBACX,SACA,UACY,QAAQ,OAAO,KAAK;;AAGlC,MAAa,sBACX,SACA,YACU,QAAQ,OAAO,OAAO;;AAGlC,IAAa,qBAAb,MAAa,2BAA2B,QAAQ,QAG9C,EAAE,0CAA0C,EAAE;CAC9C,OAAgB,QAAQ,MAAM,QAAQ,oBAAoB,oBAAoB,CAAC,CAAC,CAAC;CAEjF,OAAgB,QAAQ,aACtB,MAAM,QAAQ,oBAAoB,oBAAoB,QAAQ,CAAC;AACnE;;AAGA,MAAa,sBACX,UACA,YACU;CACV,MAAM,QAAQ,SAAS,IAAI,QAAQ,IAAI;CACvC,OAAO,UAAU,KAAA,IACb,QAAQ,UACR,OAAO,kBAAkB,QAAQ,WAAW,EAAE,KAAK;AACzD;AAEA,SAAS,oBAAoB,UAA8D;CACzF,qBAAqB,QAAQ;CAE7B,OAAO;EACL;EACA,SAAA,IAHkB,IAAI,SAAS,KAAK,YAAY,CAAC,QAAQ,MAAM,QAAQ,OAAO,CAAC,CAGzE;EACN,SAAS,OAAO,WAAW;GACzB,IAAI,OAAO,WAAW,KAAK,SAAS,WAAW,GAC7C,OAAO;GAET,MAAM,OAAO,IAAI,IAAI,KAAK;GAC1B,KAAK,MAAM,SAAS,QAClB,KAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,UAAU,KAAK,IAAI,QAAQ,IAAI,KAAK,QAAQ;IAClD,KAAK,IAAI,QAAQ,MAAM,QAAQ,OAAO,SAAS,KAAK,CAAC;GACvD;GAEF,OAAO;EACT;CACF;AACF;AAEA,SAAS,qBAAqB,UAA2C;CACvE,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,KAAK,WAAA,OAAuC,GACtD,MAAM,IAAI,MACR,gBAAgB,QAAQ,KAAK,4BAA4B,8BAC3D;EAEF,IAAI,KAAK,IAAI,QAAQ,IAAI,GACvB,MAAM,IAAI,MAAM,8BAA8B,QAAQ,MAAM;EAE9D,KAAK,IAAI,QAAQ,IAAI;CACvB;AACF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { h as SessionId } from "../core-CYT6DBaS.js";
|
|
2
|
-
import { a as EDASessionStore, o as EDASessionStoreError } from "../session-store-
|
|
2
|
+
import { a as EDASessionStore, o as EDASessionStoreError } from "../session-store-ofm8FFxs.js";
|
|
3
3
|
import { t as EDAKeepAlive } from "../keep-alive-Chl5SJxy.js";
|
|
4
|
-
import { c as CompactionPolicy, r as CompactionExecutor } from "../compaction-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { i as
|
|
4
|
+
import { c as CompactionPolicy, r as CompactionExecutor } from "../compaction-F4HEWzuI.js";
|
|
5
|
+
import { t as SessionEventObserver } from "../session-event-observer-D_aoFnQs.js";
|
|
6
|
+
import { r as EDASink } from "../sink-registry-PRYbj6dp.js";
|
|
7
|
+
import { r as EDAReducerRegistry } from "../reducer-registry--vQFATXb.js";
|
|
8
|
+
import { r as EDAPromptProjector } from "../prompt-projector-hqPh5-NI.js";
|
|
9
|
+
import { n as SinkCheckpointStore } from "../sink-checkpoint-store-BQVbI9DQ.js";
|
|
10
|
+
import { r as SessionCommandAdmissionError } from "../session-state-BfoXKafd.js";
|
|
11
|
+
import { i as EDAToolRegistryShape, t as EDAModelToolkit } from "../tool-registry-ClHdr_G5.js";
|
|
12
|
+
import { i as EDARuntimeConfig, r as EDARuntime } from "../runtime-BO9KJq_Y.js";
|
|
12
13
|
import * as Layer from "effect/Layer";
|
|
13
14
|
import * as LanguageModel from "effect/unstable/ai/LanguageModel";
|
|
14
15
|
import * as Tracer from "effect/Tracer";
|
|
@@ -29,6 +30,7 @@ interface EDARuntimeLayerOptions {
|
|
|
29
30
|
readonly promptProjectorLayer?: Layer.Layer<EDAPromptProjector>;
|
|
30
31
|
readonly reducerRegistryLayer?: Layer.Layer<EDAReducerRegistry>;
|
|
31
32
|
readonly sessionId: SessionId;
|
|
33
|
+
readonly sessionEventObserverLayer?: Layer.Layer<SessionEventObserver>;
|
|
32
34
|
readonly sessionStoreLayer: Layer.Layer<EDASessionStore, EDASessionStoreError>;
|
|
33
35
|
readonly sinkCheckpointStoreLayer: Layer.Layer<SinkCheckpointStore, EDASessionStoreError>;
|
|
34
36
|
readonly sinks?: ReadonlyArray<EDASink>;
|
|
@@ -46,6 +48,7 @@ declare const makeEDARuntimeLayer: ({
|
|
|
46
48
|
promptProjectorLayer,
|
|
47
49
|
reducerRegistryLayer,
|
|
48
50
|
sessionId,
|
|
51
|
+
sessionEventObserverLayer,
|
|
49
52
|
sessionStoreLayer,
|
|
50
53
|
sinkCheckpointStoreLayer,
|
|
51
54
|
sinks,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { d as TurnRunner, f as InferenceRunner, p as ToolExecutor, u as SessionState } from "../session-state-
|
|
1
|
+
import { d as TurnRunner, f as InferenceRunner, p as ToolExecutor, u as SessionState } from "../session-state-C4m0j6CJ.js";
|
|
2
2
|
import { IdGenerator } from "./id-generator.js";
|
|
3
3
|
import { n as SessionContext, t as EventFactory } from "../event-factory-tcpLgdMN.js";
|
|
4
4
|
import { EDAKeepAlive } from "./keep-alive.js";
|
|
5
5
|
import { CompactionExecutor, CompactionPolicy, CompactionRunner } from "./compaction.js";
|
|
6
|
-
import {
|
|
6
|
+
import { SessionEventObserver } from "./session-event-observer.js";
|
|
7
|
+
import { n as EDASinkRegistry, r as LiveEventBus } from "../sink-registry-DH6uiEgP.js";
|
|
7
8
|
import { EDAPromptProjector } from "./prompt-projector.js";
|
|
8
9
|
import { EDAReducerRegistry } from "./reducer-registry.js";
|
|
9
10
|
import { EDAToolRegistry } from "./tool-registry.js";
|
|
@@ -13,9 +14,10 @@ import * as Layer from "effect/Layer";
|
|
|
13
14
|
import * as Tracer from "effect/Tracer";
|
|
14
15
|
//#region src/services/runtime-layer.ts
|
|
15
16
|
/** Compose the complete platform-neutral EDA service graph for one session. */
|
|
16
|
-
const makeEDARuntimeLayer = ({ config, compactionExecutorLayer, compactionPolicyLayer, keepAliveLayer, modelLayer, promptProjectorLayer, reducerRegistryLayer, sessionId, sessionStoreLayer, sinkCheckpointStoreLayer, sinks, toolkit, toolRegistry, tracer }) => {
|
|
17
|
+
const makeEDARuntimeLayer = ({ config, compactionExecutorLayer, compactionPolicyLayer, keepAliveLayer, modelLayer, promptProjectorLayer, reducerRegistryLayer, sessionId, sessionEventObserverLayer, sessionStoreLayer, sinkCheckpointStoreLayer, sinks, toolkit, toolRegistry, tracer }) => {
|
|
17
18
|
const Store = sessionStoreLayer;
|
|
18
|
-
const
|
|
19
|
+
const EventObserver = sessionEventObserverLayer ?? SessionEventObserver.Noop;
|
|
20
|
+
const Bus = LiveEventBus.Live.pipe(Layer.provide(EventObserver));
|
|
19
21
|
const KeepAlive = keepAliveLayer ?? EDAKeepAlive.Noop;
|
|
20
22
|
const Ids = IdGenerator.Live;
|
|
21
23
|
const Session = SessionContext.Live(sessionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-layer.js","names":[],"sources":["../../src/services/runtime-layer.ts"],"sourcesContent":["import type * as LanguageModel from \"effect/unstable/ai/LanguageModel\";\nimport * as Layer from \"effect/Layer\";\nimport * as Tracer from \"effect/Tracer\";\n\nimport type { SessionId } from \"../types/core\";\nimport { CompactionExecutor, CompactionPolicy, CompactionRunner } from \"./compaction\";\nimport { EventFactory } from \"./event-factory\";\nimport { IdGenerator } from \"./id-generator\";\nimport { InferenceRunner } from \"./inference-runner\";\nimport { EDAKeepAlive } from \"./keep-alive\";\nimport { LiveEventBus } from \"./live-event-bus\";\nimport { EDAPromptProjector } from \"./prompt-projector\";\nimport { EDAReducerRegistry } from \"./reducer-registry\";\nimport { EDARuntime, type EDARuntimeConfig } from \"./runtime\";\nimport { SessionContext } from \"./session-context\";\nimport { EDASessionQuery } from \"./session-query\";\nimport { EDASessionStore, EDASessionStoreError } from \"./session-store\";\nimport { SessionState, type SessionCommandAdmissionError } from \"./session-state\";\nimport { SinkCheckpointStore } from \"./sink-checkpoint-store\";\nimport { EDASinkRegistry, type EDASink } from \"./sink-registry\";\nimport { ToolExecutor } from \"./tool-executor\";\nimport { EDAToolRegistry, type EDAModelToolkit, type EDAToolRegistryShape } from \"./tool-registry\";\nimport { TurnRunner } from \"./turn-runner\";\n\n/**\n * Host-owned adapters and application policy needed to construct one EDA runtime.\n *\n * Core owns the service graph, while hosts supply only semantic persistence,\n * checkpoint, and lifecycle layers. Platform SDK types never cross this boundary.\n */\nexport interface EDARuntimeLayerOptions {\n readonly config: EDARuntimeConfig;\n readonly compactionExecutorLayer?: Layer.Layer<\n CompactionExecutor,\n never,\n LanguageModel.LanguageModel\n >;\n readonly compactionPolicyLayer?: Layer.Layer<CompactionPolicy>;\n readonly keepAliveLayer?: Layer.Layer<EDAKeepAlive>;\n readonly modelLayer: Layer.Layer<LanguageModel.LanguageModel>;\n readonly promptProjectorLayer?: Layer.Layer<EDAPromptProjector>;\n readonly reducerRegistryLayer?: Layer.Layer<EDAReducerRegistry>;\n readonly sessionId: SessionId;\n readonly sessionStoreLayer: Layer.Layer<EDASessionStore, EDASessionStoreError>;\n readonly sinkCheckpointStoreLayer: Layer.Layer<SinkCheckpointStore, EDASessionStoreError>;\n readonly sinks?: ReadonlyArray<EDASink>;\n readonly toolkit?: EDAModelToolkit;\n readonly toolRegistry?: EDAToolRegistryShape;\n readonly tracer?: Tracer.Tracer;\n}\n\n/** Compose the complete platform-neutral EDA service graph for one session. */\nexport const makeEDARuntimeLayer = ({\n config,\n compactionExecutorLayer,\n compactionPolicyLayer,\n keepAliveLayer,\n modelLayer,\n promptProjectorLayer,\n reducerRegistryLayer,\n sessionId,\n sessionStoreLayer,\n sinkCheckpointStoreLayer,\n sinks,\n toolkit,\n toolRegistry,\n tracer,\n}: EDARuntimeLayerOptions): Layer.Layer<EDARuntime, SessionCommandAdmissionError> => {\n const Store = sessionStoreLayer;\n const Bus = LiveEventBus.Live;\n const KeepAlive = keepAliveLayer ?? EDAKeepAlive.Noop;\n const Ids = IdGenerator.Live;\n const Session = SessionContext.Live(sessionId);\n const Factory = EventFactory.Live.pipe(Layer.provideMerge(Layer.mergeAll(Session, Ids)));\n const PromptProjector = promptProjectorLayer ?? EDAPromptProjector.Default;\n const ReducerRegistry = reducerRegistryLayer ?? EDAReducerRegistry.Empty;\n const CompactionPolicyLayer = compactionPolicyLayer ?? CompactionPolicy.Disabled;\n const CompactionExecutorLayer = compactionExecutorLayer ?? CompactionExecutor.Disabled;\n const Compaction = CompactionRunner.Live.pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Store,\n Factory,\n Ids,\n KeepAlive,\n modelLayer,\n CompactionPolicyLayer,\n CompactionExecutorLayer,\n ),\n ),\n );\n const SinkRegistry = EDASinkRegistry.Live(sinks ?? []).pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Session,\n Store,\n Bus,\n sinkCheckpointStoreLayer,\n Factory,\n Ids,\n ReducerRegistry,\n KeepAlive,\n ),\n ),\n );\n const State = SessionState.Live.pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Store,\n Bus,\n Session,\n ReducerRegistry,\n SinkRegistry,\n KeepAlive,\n Compaction,\n PromptProjector,\n ),\n ),\n );\n const Registry =\n toolRegistry !== undefined\n ? EDAToolRegistry.FromShape(toolRegistry)\n : toolkit === undefined\n ? EDAToolRegistry.Empty\n : EDAToolRegistry.FromToolkit(toolkit);\n const InferenceRunnerLayer = InferenceRunner.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(Factory, modelLayer, Registry, Ids)),\n );\n const ToolExec = ToolExecutor.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(Factory, Registry, Ids, Session)),\n );\n const Turn = TurnRunner.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(InferenceRunnerLayer, ToolExec, Factory, Ids)),\n );\n const StateWithRun = State.pipe(Layer.provideMerge(Layer.mergeAll(Turn, Factory, Ids)));\n const Query = EDASessionQuery.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(StateWithRun, Store, Bus)),\n );\n const Runtime = EDARuntime.Live(config).pipe(\n Layer.provideMerge(Layer.mergeAll(StateWithRun, Query)),\n );\n\n return tracer === undefined\n ? Runtime\n : Runtime.pipe(Layer.provideMerge(Layer.succeed(Tracer.Tracer, tracer)));\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-layer.js","names":[],"sources":["../../src/services/runtime-layer.ts"],"sourcesContent":["import type * as LanguageModel from \"effect/unstable/ai/LanguageModel\";\nimport * as Layer from \"effect/Layer\";\nimport * as Tracer from \"effect/Tracer\";\n\nimport type { SessionId } from \"../types/core\";\nimport { CompactionExecutor, CompactionPolicy, CompactionRunner } from \"./compaction\";\nimport { EventFactory } from \"./event-factory\";\nimport { IdGenerator } from \"./id-generator\";\nimport { InferenceRunner } from \"./inference-runner\";\nimport { EDAKeepAlive } from \"./keep-alive\";\nimport { LiveEventBus } from \"./live-event-bus\";\nimport { EDAPromptProjector } from \"./prompt-projector\";\nimport { EDAReducerRegistry } from \"./reducer-registry\";\nimport { EDARuntime, type EDARuntimeConfig } from \"./runtime\";\nimport { SessionContext } from \"./session-context\";\nimport { SessionEventObserver } from \"./session-event-observer\";\nimport { EDASessionQuery } from \"./session-query\";\nimport { EDASessionStore, EDASessionStoreError } from \"./session-store\";\nimport { SessionState, type SessionCommandAdmissionError } from \"./session-state\";\nimport { SinkCheckpointStore } from \"./sink-checkpoint-store\";\nimport { EDASinkRegistry, type EDASink } from \"./sink-registry\";\nimport { ToolExecutor } from \"./tool-executor\";\nimport { EDAToolRegistry, type EDAModelToolkit, type EDAToolRegistryShape } from \"./tool-registry\";\nimport { TurnRunner } from \"./turn-runner\";\n\n/**\n * Host-owned adapters and application policy needed to construct one EDA runtime.\n *\n * Core owns the service graph, while hosts supply only semantic persistence,\n * checkpoint, and lifecycle layers. Platform SDK types never cross this boundary.\n */\nexport interface EDARuntimeLayerOptions {\n readonly config: EDARuntimeConfig;\n readonly compactionExecutorLayer?: Layer.Layer<\n CompactionExecutor,\n never,\n LanguageModel.LanguageModel\n >;\n readonly compactionPolicyLayer?: Layer.Layer<CompactionPolicy>;\n readonly keepAliveLayer?: Layer.Layer<EDAKeepAlive>;\n readonly modelLayer: Layer.Layer<LanguageModel.LanguageModel>;\n readonly promptProjectorLayer?: Layer.Layer<EDAPromptProjector>;\n readonly reducerRegistryLayer?: Layer.Layer<EDAReducerRegistry>;\n readonly sessionId: SessionId;\n readonly sessionEventObserverLayer?: Layer.Layer<SessionEventObserver>;\n readonly sessionStoreLayer: Layer.Layer<EDASessionStore, EDASessionStoreError>;\n readonly sinkCheckpointStoreLayer: Layer.Layer<SinkCheckpointStore, EDASessionStoreError>;\n readonly sinks?: ReadonlyArray<EDASink>;\n readonly toolkit?: EDAModelToolkit;\n readonly toolRegistry?: EDAToolRegistryShape;\n readonly tracer?: Tracer.Tracer;\n}\n\n/** Compose the complete platform-neutral EDA service graph for one session. */\nexport const makeEDARuntimeLayer = ({\n config,\n compactionExecutorLayer,\n compactionPolicyLayer,\n keepAliveLayer,\n modelLayer,\n promptProjectorLayer,\n reducerRegistryLayer,\n sessionId,\n sessionEventObserverLayer,\n sessionStoreLayer,\n sinkCheckpointStoreLayer,\n sinks,\n toolkit,\n toolRegistry,\n tracer,\n}: EDARuntimeLayerOptions): Layer.Layer<EDARuntime, SessionCommandAdmissionError> => {\n const Store = sessionStoreLayer;\n const EventObserver = sessionEventObserverLayer ?? SessionEventObserver.Noop;\n const Bus = LiveEventBus.Live.pipe(Layer.provide(EventObserver));\n const KeepAlive = keepAliveLayer ?? EDAKeepAlive.Noop;\n const Ids = IdGenerator.Live;\n const Session = SessionContext.Live(sessionId);\n const Factory = EventFactory.Live.pipe(Layer.provideMerge(Layer.mergeAll(Session, Ids)));\n const PromptProjector = promptProjectorLayer ?? EDAPromptProjector.Default;\n const ReducerRegistry = reducerRegistryLayer ?? EDAReducerRegistry.Empty;\n const CompactionPolicyLayer = compactionPolicyLayer ?? CompactionPolicy.Disabled;\n const CompactionExecutorLayer = compactionExecutorLayer ?? CompactionExecutor.Disabled;\n const Compaction = CompactionRunner.Live.pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Store,\n Factory,\n Ids,\n KeepAlive,\n modelLayer,\n CompactionPolicyLayer,\n CompactionExecutorLayer,\n ),\n ),\n );\n const SinkRegistry = EDASinkRegistry.Live(sinks ?? []).pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Session,\n Store,\n Bus,\n sinkCheckpointStoreLayer,\n Factory,\n Ids,\n ReducerRegistry,\n KeepAlive,\n ),\n ),\n );\n const State = SessionState.Live.pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n Store,\n Bus,\n Session,\n ReducerRegistry,\n SinkRegistry,\n KeepAlive,\n Compaction,\n PromptProjector,\n ),\n ),\n );\n const Registry =\n toolRegistry !== undefined\n ? EDAToolRegistry.FromShape(toolRegistry)\n : toolkit === undefined\n ? EDAToolRegistry.Empty\n : EDAToolRegistry.FromToolkit(toolkit);\n const InferenceRunnerLayer = InferenceRunner.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(Factory, modelLayer, Registry, Ids)),\n );\n const ToolExec = ToolExecutor.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(Factory, Registry, Ids, Session)),\n );\n const Turn = TurnRunner.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(InferenceRunnerLayer, ToolExec, Factory, Ids)),\n );\n const StateWithRun = State.pipe(Layer.provideMerge(Layer.mergeAll(Turn, Factory, Ids)));\n const Query = EDASessionQuery.Live.pipe(\n Layer.provideMerge(Layer.mergeAll(StateWithRun, Store, Bus)),\n );\n const Runtime = EDARuntime.Live(config).pipe(\n Layer.provideMerge(Layer.mergeAll(StateWithRun, Query)),\n );\n\n return tracer === undefined\n ? Runtime\n : Runtime.pipe(Layer.provideMerge(Layer.succeed(Tracer.Tracer, tracer)));\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAa,uBAAuB,EAClC,QACA,yBACA,uBACA,gBACA,YACA,sBACA,sBACA,WACA,2BACA,mBACA,0BACA,OACA,SACA,cACA,aACmF;CACnF,MAAM,QAAQ;CACd,MAAM,gBAAgB,6BAA6B,qBAAqB;CACxE,MAAM,MAAM,aAAa,KAAK,KAAK,MAAM,QAAQ,aAAa,CAAC;CAC/D,MAAM,YAAY,kBAAkB,aAAa;CACjD,MAAM,MAAM,YAAY;CACxB,MAAM,UAAU,eAAe,KAAK,SAAS;CAC7C,MAAM,UAAU,aAAa,KAAK,KAAK,MAAM,aAAa,MAAM,SAAS,SAAS,GAAG,CAAC,CAAC;CACvF,MAAM,kBAAkB,wBAAwB,mBAAmB;CACnE,MAAM,kBAAkB,wBAAwB,mBAAmB;CACnE,MAAM,wBAAwB,yBAAyB,iBAAiB;CACxE,MAAM,0BAA0B,2BAA2B,mBAAmB;CAC9E,MAAM,aAAa,iBAAiB,KAAK,KACvC,MAAM,aACJ,MAAM,SACJ,OACA,SACA,KACA,WACA,YACA,uBACA,uBACF,CACF,CACF;CACA,MAAM,eAAe,gBAAgB,KAAK,SAAS,CAAC,CAAC,EAAE,KACrD,MAAM,aACJ,MAAM,SACJ,SACA,OACA,KACA,0BACA,SACA,KACA,iBACA,SACF,CACF,CACF;CACA,MAAM,QAAQ,aAAa,KAAK,KAC9B,MAAM,aACJ,MAAM,SACJ,OACA,KACA,SACA,iBACA,cACA,WACA,YACA,eACF,CACF,CACF;CACA,MAAM,WACJ,iBAAiB,KAAA,IACb,gBAAgB,UAAU,YAAY,IACtC,YAAY,KAAA,IACV,gBAAgB,QAChB,gBAAgB,YAAY,OAAO;CAC3C,MAAM,uBAAuB,gBAAgB,KAAK,KAChD,MAAM,aAAa,MAAM,SAAS,SAAS,YAAY,UAAU,GAAG,CAAC,CACvE;CACA,MAAM,WAAW,aAAa,KAAK,KACjC,MAAM,aAAa,MAAM,SAAS,SAAS,UAAU,KAAK,OAAO,CAAC,CACpE;CACA,MAAM,OAAO,WAAW,KAAK,KAC3B,MAAM,aAAa,MAAM,SAAS,sBAAsB,UAAU,SAAS,GAAG,CAAC,CACjF;CACA,MAAM,eAAe,MAAM,KAAK,MAAM,aAAa,MAAM,SAAS,MAAM,SAAS,GAAG,CAAC,CAAC;CACtF,MAAM,QAAQ,gBAAgB,KAAK,KACjC,MAAM,aAAa,MAAM,SAAS,cAAc,OAAO,GAAG,CAAC,CAC7D;CACA,MAAM,UAAU,WAAW,KAAK,MAAM,EAAE,KACtC,MAAM,aAAa,MAAM,SAAS,cAAc,KAAK,CAAC,CACxD;CAEA,OAAO,WAAW,KAAA,IACd,UACA,QAAQ,KAAK,MAAM,aAAa,MAAM,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC;AAC3E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "../runtime-
|
|
1
|
+
import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "../runtime-BO9KJq_Y.js";
|
|
2
2
|
export { CommittedCommandTerminalEvent, EDACommandTerminalEvent, EDARuntime, EDARuntimeConfig, EDARuntimeError, EDARuntimeShape, EDARuntimeSubmit };
|
package/dist/services/runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SequenceNumber, durablePosition } from "../types/core.js";
|
|
2
2
|
import { _n as commandCancelledEventType, _r as SystemPromptText, fr as ModelSelectionPayload, pr as NonNegativeInt, vn as commandCompletedEventType, yn as commandFailedEventType } from "../durable-DsV9PxZC.js";
|
|
3
|
-
import { u as SessionState } from "../session-state-
|
|
3
|
+
import { u as SessionState } from "../session-state-C4m0j6CJ.js";
|
|
4
4
|
import { CommittedDurableEvent } from "./session-store.js";
|
|
5
5
|
import { annotateEdaSpan, committedBatchAttributes } from "./tracing.js";
|
|
6
6
|
import { EDASessionQuery } from "./session-query.js";
|
|
@@ -63,7 +63,8 @@ const makeLiveRuntime = (config) => Effect.gen(function* () {
|
|
|
63
63
|
}),
|
|
64
64
|
snapshot: () => query.snapshot(),
|
|
65
65
|
messages: () => query.messages(),
|
|
66
|
-
eventsAfter: (afterSeq) => query.eventsAfter(afterSeq)
|
|
66
|
+
eventsAfter: (afterSeq) => query.eventsAfter(afterSeq),
|
|
67
|
+
readEventPage: (afterSeq, limit) => query.readEventPage(afterSeq, limit)
|
|
67
68
|
};
|
|
68
69
|
});
|
|
69
70
|
const isCommandTerminalFor = (commandId) => (event) => {
|