effect-durable-agent 0.1.0-alpha.3 → 0.1.0-alpha.4
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/CHANGELOG.md +9 -0
- package/README.md +28 -27
- package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-CV7O-51r.d.ts} +7 -6
- package/dist/{compaction-1LSZR944.d.ts → compaction-zbvLREI8.d.ts} +8 -6
- package/dist/context-projection-n6Rdup0N.d.ts +140 -0
- package/dist/{core-Hv3cFydL.d.ts → core-CYT6DBaS.d.ts} +2 -2
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/context-projection.d.ts +2 -0
- package/dist/domain/context-projection.js +32 -0
- package/dist/domain/context-projection.js.map +1 -0
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/reduced-state-schema.d.ts +2 -0
- package/dist/domain/reduced-state-schema.js +2 -1
- package/dist/domain/reduced-state-schema.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +1 -1
- package/dist/domain/reduced-state.js +1 -1
- package/dist/{durable-DlScwmCy.d.ts → durable-B7M6TD_0.d.ts} +341 -2
- package/dist/{durable-C3Rz7kg3.js → durable-DsV9PxZC.js} +13 -2
- package/dist/durable-DsV9PxZC.js.map +1 -0
- package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-CLJcyymV.d.ts} +5 -29
- package/dist/{keep-alive-p8dIcSVy.js → event-factory-tcpLgdMN.js} +3 -10
- package/dist/event-factory-tcpLgdMN.js.map +1 -0
- package/dist/host/websocket-protocol.d.ts +229 -0
- package/dist/host/websocket-protocol.js +99 -0
- package/dist/host/websocket-protocol.js.map +1 -0
- package/dist/host/websocket-wire.d.ts +1 -1
- package/dist/host/websocket-wire.js +2 -2
- package/dist/host/websocket-wire.js.map +1 -1
- package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-Ckl8_XWW.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
- package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-DiOPBY3l.d.ts} +3 -3
- package/dist/{prompt-projector-DimXJPOJ.d.ts → prompt-projector-C1IbkHr0.d.ts} +5 -5
- package/dist/{reduced-state-C4nVVzz9.js → reduced-state-TMi7ISla.js} +20 -4
- package/dist/reduced-state-TMi7ISla.js.map +1 -0
- package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-CjSJBPKo.d.ts} +2 -2
- package/dist/{runtime-DcdPOEuE.d.ts → runtime-DOgmAKsO.d.ts} +7 -6
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/compaction.js +4 -3
- package/dist/services/compaction.js.map +1 -1
- package/dist/services/id-generator.d.ts +1 -1
- package/dist/services/keep-alive.d.ts +2 -0
- package/dist/services/keep-alive.js +13 -0
- package/dist/services/keep-alive.js.map +1 -0
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/reducer-registry.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +58 -0
- package/dist/services/runtime-layer.js +42 -0
- package/dist/services/runtime-layer.js.map +1 -0
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +4 -3
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +76 -1
- package/dist/services/session-query.js.map +1 -0
- package/dist/services/session-state.d.ts +2 -0
- package/dist/services/session-state.js +2 -0
- package/dist/services/session-store.d.ts +2 -2
- package/dist/services/session-store.js +181 -2
- package/dist/services/session-store.js.map +1 -0
- package/dist/services/sink-checkpoint-store.d.ts +2 -0
- package/dist/services/sink-checkpoint-store.js +49 -0
- package/dist/services/sink-checkpoint-store.js.map +1 -0
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/services/websocket-subscriber.d.ts +54 -0
- package/dist/services/websocket-subscriber.js +190 -0
- package/dist/services/websocket-subscriber.js.map +1 -0
- package/dist/session-query-C-C4m1eq.d.ts +38 -0
- package/dist/{session-query-hxfujxUH.d.ts → session-state-CjOSvWbe.d.ts} +134 -42
- package/dist/{session-query-Cbf-e0rG.js → session-state-SStf0KUo.js} +18 -77
- package/dist/session-state-SStf0KUo.js.map +1 -0
- package/dist/{session-store-D2Ore1QC.d.ts → session-store-DZZUffUy.d.ts} +5 -94
- package/dist/sink-checkpoint-store-BZmQFTRE.d.ts +40 -0
- package/dist/{sink-registry-BziFpxoE.d.ts → sink-registry-Cf79ICdW.d.ts} +11 -40
- package/dist/{sink-registry-CFC6xjsN.js → sink-registry-D13eUO_c.js} +9 -47
- package/dist/sink-registry-D13eUO_c.js.map +1 -0
- package/dist/testkit/layers.d.ts +14 -11
- package/dist/testkit/layers.js +8 -5
- package/dist/testkit/layers.js.map +1 -1
- package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-B7Wona6N.d.ts} +3 -3
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.js +1 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/events/durable.d.ts +2 -2
- package/dist/types/events/durable.js +2 -2
- package/dist/types/events.d.ts +2 -2
- package/dist/types/events.js +2 -2
- package/dist/{websocket-wire-D3tLrhe2.d.ts → websocket-wire-QD2SquQE.d.ts} +74 -2
- package/docs/message-steering.md +1 -1
- package/docs/releasing.md +42 -24
- package/docs/spec.md +11 -11
- package/docs/websocket-protocol.md +4 -4
- package/package.json +55 -35
- package/dist/durable-C3Rz7kg3.js.map +0 -1
- package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
- package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
- package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
- package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
- package/dist/host/durable-object-runtime.d.ts +0 -2
- package/dist/host/durable-object-runtime.js +0 -2
- package/dist/host/durable-object-storage.d.ts +0 -2
- package/dist/host/durable-object-storage.js +0 -0
- package/dist/host/durable-object.d.ts +0 -83
- package/dist/host/durable-object.js +0 -191
- package/dist/host/durable-object.js.map +0 -1
- package/dist/keep-alive-p8dIcSVy.js.map +0 -1
- package/dist/reduced-state-C4nVVzz9.js.map +0 -1
- package/dist/session-query-Cbf-e0rG.js.map +0 -1
- package/dist/session-store-pYxQW9qh.js +0 -214
- package/dist/session-store-pYxQW9qh.js.map +0 -1
- package/dist/sink-registry-CFC6xjsN.js.map +0 -1
- package/examples/001-no-tools/README.md +0 -65
- package/examples/001-no-tools/worker.ts +0 -79
- package/examples/002-slack-bridge/README.md +0 -134
- package/examples/002-slack-bridge/events.ts +0 -115
- package/examples/002-slack-bridge/reducer.ts +0 -216
- package/examples/002-slack-bridge/scenario.test.ts +0 -223
- package/examples/002-slack-bridge/sinks.ts +0 -109
- package/examples/002-slack-bridge/worker.ts +0 -140
- package/examples/003-sandbox-lifecycle/README.md +0 -78
- package/examples/003-sandbox-lifecycle/events.ts +0 -203
- package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
- package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
- package/examples/_shared/event-id.ts +0 -12
- package/examples/_shared/http.ts +0 -27
- package/examples/_shared/openai.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to Effect Durable Agent will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.1.0-alpha.4
|
|
8
|
+
|
|
9
|
+
- Let applications project instruction and data messages from current reducer state into each model prompt
|
|
10
|
+
- Build prompts only after turn input selection is committed into durable reducer state
|
|
11
|
+
- Split the host-neutral runtime, Cloudflare Durable Objects host, and celld host into lockstep packages
|
|
12
|
+
- Add shared real-runtime conformance tests for workerd and celld, including RPC, persistence,
|
|
13
|
+
hard-restart recovery, durable idempotency, WebSocket resume/ACK, and warm/cold session recreation
|
|
14
|
+
- Encode Effect Schema values explicitly at Durable Object RPC boundaries
|
|
15
|
+
|
|
7
16
|
## 0.1.0-alpha.3
|
|
8
17
|
|
|
9
18
|
- Publish the state-projected prompt context and WebSocket schema changes from the unpublished `0.1.0-alpha.2` package
|
package/README.md
CHANGED
|
@@ -78,8 +78,8 @@ makes every state transition explicit, replayable, and testable.
|
|
|
78
78
|
### 5. State: a cached view of durable history
|
|
79
79
|
|
|
80
80
|
The reducers produce a complete snapshot of framework and application state through a known
|
|
81
|
-
sequence number. EDA caches that snapshot in
|
|
82
|
-
need to replay the entire history from the beginning.
|
|
81
|
+
sequence number. EDA caches that snapshot in host-provided durable storage so reads and restarts do
|
|
82
|
+
not need to replay the entire history from the beginning.
|
|
83
83
|
|
|
84
84
|
The cache is an optimization, not a second source of truth. If it is missing or incompatible, EDA
|
|
85
85
|
can rebuild it from the event log; the application is ultimately defined by its ordered events.
|
|
@@ -127,8 +127,8 @@ 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](./examples/002-slack-bridge) for idempotent
|
|
131
|
-
and durable outbound delivery.
|
|
130
|
+
See the [Slack bridge example](./packages/cloudflare/examples/002-slack-bridge) for idempotent
|
|
131
|
+
ingress, a custom reducer, and durable outbound delivery.
|
|
132
132
|
|
|
133
133
|
**Durable state. Durable side effects.**
|
|
134
134
|
|
|
@@ -163,37 +163,38 @@ be exported through OpenTelemetry to Google Cloud Trace or another existing back
|
|
|
163
163
|
|
|
164
164
|

|
|
165
165
|
|
|
166
|
-
##
|
|
166
|
+
## Host-neutral core, pluggable deployment
|
|
167
167
|
|
|
168
|
-
EDA
|
|
169
|
-
|
|
170
|
-
durable coordinator for that session's state, execution, SQLite event log, live WebSockets, alarms,
|
|
171
|
-
and sink cursors.
|
|
168
|
+
EDA separates its state machine and Effect service graph from the platform that provides durable
|
|
169
|
+
storage, scheduling, identity, and live WebSockets. Applications select one host package:
|
|
172
170
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
|
|
177
|
-
-
|
|
178
|
-
- Alarms wake evicted sessions for recovery, keep-alive, and sink draining
|
|
171
|
+
| Package | Responsibility |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| `effect-durable-agent` | Host-independent commands, events, reducers, runtime, and adapter contracts. |
|
|
174
|
+
| `effect-durable-agent-cloudflare` | Cloudflare Durable Objects, SQLite, alarms, RPC, and hibernatable WebSockets. |
|
|
175
|
+
| `effect-durable-agent-celld` | [celld](https://celld.dev/) deployment of the Durable Objects contract on your infrastructure. |
|
|
179
176
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
with equivalent semantics.
|
|
177
|
+
All three packages are released together with the same version. A host and core from different
|
|
178
|
+
versions are not a supported combination; keep the versions identical when upgrading.
|
|
183
179
|
|
|
184
180
|
## Get started
|
|
185
181
|
|
|
186
|
-
Install the
|
|
187
|
-
|
|
182
|
+
Install the core and one host from the public alpha channel:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
pnpm add effect-durable-agent@alpha effect-durable-agent-cloudflare@alpha
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
For celld, select its host package at the same version instead:
|
|
188
189
|
|
|
189
190
|
```bash
|
|
190
|
-
pnpm add effect-durable-agent@alpha
|
|
191
|
+
pnpm add effect-durable-agent@alpha effect-durable-agent-celld@alpha
|
|
191
192
|
```
|
|
192
193
|
|
|
193
|
-
The smallest host is a concrete Durable Object subclass:
|
|
194
|
+
The smallest Cloudflare host is a concrete Durable Object subclass:
|
|
194
195
|
|
|
195
196
|
```ts
|
|
196
|
-
import { EDASessionDurableObject } from "effect-durable-agent
|
|
197
|
+
import { EDASessionDurableObject } from "effect-durable-agent-cloudflare"
|
|
197
198
|
|
|
198
199
|
export class MyAgentSession extends EDASessionDurableObject<MyEnv> {
|
|
199
200
|
constructor(ctx: DurableObjectState, env: MyEnv) {
|
|
@@ -209,9 +210,9 @@ Start with the executable examples:
|
|
|
209
210
|
|
|
210
211
|
| Example | What it demonstrates |
|
|
211
212
|
| --- | --- |
|
|
212
|
-
| [`001-no-tools`](./examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
|
|
213
|
-
| [`002-slack-bridge`](./examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
|
|
214
|
-
| [`003-sandbox-lifecycle`](./examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
|
|
213
|
+
| [`001-no-tools`](./packages/cloudflare/examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
|
|
214
|
+
| [`002-slack-bridge`](./packages/cloudflare/examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
|
|
215
|
+
| [`003-sandbox-lifecycle`](./packages/cloudflare/examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
|
|
215
216
|
|
|
216
217
|
## Why EDA instead of another agent SDK or framework?
|
|
217
218
|
|
|
@@ -267,7 +268,7 @@ client catch-up, restart recovery, production-derived UI fixtures, and durable s
|
|
|
267
268
|
## Capabilities
|
|
268
269
|
|
|
269
270
|
- Effect-native agent runtime with command, run, turn, inference, message, and tool lifecycles
|
|
270
|
-
- Cloudflare Durable
|
|
271
|
+
- Pluggable Cloudflare Durable Objects and celld hosts with one session per object and SQLite event storage
|
|
271
272
|
- Typed custom durable application events and pure application reducers
|
|
272
273
|
- Reducer checkpoints and serialized snapshots
|
|
273
274
|
- Reconnect-safe event streaming with sequence resume and WebSocket ACK flow control
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as SummaryId, i as ContextVersion, l as InferenceId, m as SequenceNumber, n as CommandId, p as RunId, r as CompactionId, u as MessageId, v as ToolCallId, y as TurnId } from "./core-
|
|
1
|
+
import { _ as SummaryId, i as ContextVersion, l as InferenceId, m as SequenceNumber, n as CommandId, p as RunId, r as CompactionId, u as MessageId, v as ToolCallId, y as TurnId } from "./core-CYT6DBaS.js";
|
|
2
2
|
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
|
-
import { r as AssistantMessageContent,
|
|
6
|
-
import { t as CommittedDurableEvent } from "./session-store-
|
|
5
|
+
import { r as AssistantMessageContent, rt as RecoveryContinuation } from "./durable-B7M6TD_0.js";
|
|
6
|
+
import { t as CommittedDurableEvent } from "./session-store-DZZUffUy.js";
|
|
7
7
|
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
8
8
|
|
|
9
9
|
//#region src/domain/reduced-state.d.ts
|
|
@@ -188,7 +188,8 @@ type MessageRecord = {
|
|
|
188
188
|
readonly messageId: MessageId;
|
|
189
189
|
readonly runId: RunId;
|
|
190
190
|
readonly turnId: TurnId;
|
|
191
|
-
readonly inferenceId: InferenceId;
|
|
191
|
+
readonly inferenceId: InferenceId; /** True when the assistant message originated outside this EDA session. */
|
|
192
|
+
readonly imported?: true;
|
|
192
193
|
readonly content: AssistantMessageContent;
|
|
193
194
|
readonly createdAtMs?: number;
|
|
194
195
|
readonly promptParts?: ReadonlyArray<Prompt.AssistantMessagePart>;
|
|
@@ -316,7 +317,7 @@ declare const initialReducedState: ReducedState;
|
|
|
316
317
|
/** Reserved reducer checkpoint name for the framework-owned `ReducedState`. */
|
|
317
318
|
declare const frameworkReducedStateReducerName = "_eda.framework.reduced-state";
|
|
318
319
|
/** Schema version for the framework-owned `ReducedState` checkpoint payload. */
|
|
319
|
-
declare const frameworkReducedStateReducerSchemaVersion =
|
|
320
|
+
declare const frameworkReducedStateReducerSchemaVersion = 5;
|
|
320
321
|
/** JSON payload stored for the framework-owned reduced-state reducer checkpoint. */
|
|
321
322
|
type ReducedStateCheckpointCommandRecord = Omit<CommandRecord, "command">;
|
|
322
323
|
type SystemMessageRecord = Extract<MessageRecord, {
|
|
@@ -465,4 +466,4 @@ declare const emptyCommandQueues: CommandQueues;
|
|
|
465
466
|
declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
|
|
466
467
|
//#endregion
|
|
467
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 };
|
|
468
|
-
//# sourceMappingURL=command-queues-
|
|
469
|
+
//# sourceMappingURL=command-queues-CV7O-51r.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-n6Rdup0N.js";
|
|
2
|
+
import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-DZZUffUy.js";
|
|
3
|
+
import { S as ReducedState } from "./command-queues-CV7O-51r.js";
|
|
4
|
+
import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
|
|
5
|
+
import { t as EventFactory } from "./event-factory-CLJcyymV.js";
|
|
6
|
+
import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
|
|
5
7
|
import * as Context from "effect/Context";
|
|
6
8
|
import * as Effect from "effect/Effect";
|
|
7
9
|
import * as Layer from "effect/Layer";
|
|
@@ -137,8 +139,8 @@ interface CompactionRunnerShape {
|
|
|
137
139
|
declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
|
|
138
140
|
/** Framework-owned compaction lifecycle runner. */
|
|
139
141
|
declare class CompactionRunner extends CompactionRunner_base {
|
|
140
|
-
static readonly Live: Layer.Layer<CompactionRunner, never,
|
|
142
|
+
static readonly Live: Layer.Layer<CompactionRunner, never, EDAKeepAlive | IdGenerator | EventFactory | CompactionExecutor | CompactionPolicy>;
|
|
141
143
|
}
|
|
142
144
|
//#endregion
|
|
143
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 };
|
|
144
|
-
//# sourceMappingURL=compaction-
|
|
146
|
+
//# sourceMappingURL=compaction-zbvLREI8.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/context-projection.d.ts
|
|
4
|
+
/** Stable identifier for the compaction policy that selected a summary plan. */
|
|
5
|
+
declare const CompactionPolicyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
|
|
6
|
+
type CompactionPolicyId = typeof CompactionPolicyId.Type;
|
|
7
|
+
/** Stable identifier for the executor that produced a summary artifact. */
|
|
8
|
+
declare const CompactionExecutorId: Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">;
|
|
9
|
+
type CompactionExecutorId = typeof CompactionExecutorId.Type;
|
|
10
|
+
/** Authoritative cumulative model-context summary written with `SummaryCreated`. */
|
|
11
|
+
declare const CompactionSummaryArtifact: Schema.Struct<{
|
|
12
|
+
readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
|
|
13
|
+
readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
|
|
14
|
+
readonly previousSummaryId: Schema.optionalKey<Schema.brand<Schema.String, "SummaryId">>;
|
|
15
|
+
readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
16
|
+
readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
17
|
+
readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
18
|
+
readonly text: Schema.NonEmptyString;
|
|
19
|
+
readonly promptMessage: Schema.Struct<{
|
|
20
|
+
readonly role: Schema.Literal<"user">;
|
|
21
|
+
readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
|
|
22
|
+
readonly type: Schema.Literal<"text">;
|
|
23
|
+
readonly text: Schema.String;
|
|
24
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
25
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
26
|
+
}>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
27
|
+
readonly type: Schema.Literal<"text">;
|
|
28
|
+
readonly text: Schema.String;
|
|
29
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
30
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
31
|
+
}>, Schema.Struct<{
|
|
32
|
+
readonly type: Schema.Literal<"file">;
|
|
33
|
+
readonly mediaType: Schema.String;
|
|
34
|
+
readonly fileName: Schema.optional<Schema.String>;
|
|
35
|
+
readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
|
|
36
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
37
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
38
|
+
}>]>>]>;
|
|
39
|
+
readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
|
|
40
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
41
|
+
}>;
|
|
42
|
+
readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
|
|
43
|
+
readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
|
|
44
|
+
}>;
|
|
45
|
+
type CompactionSummaryArtifact = typeof CompactionSummaryArtifact.Type;
|
|
46
|
+
/** Current durable context cursor projected from framework reducer state and summary rows. */
|
|
47
|
+
declare const ContextProjection: Schema.Struct<{
|
|
48
|
+
readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
|
|
49
|
+
readonly currentSummary: Schema.optionalKey<Schema.Struct<{
|
|
50
|
+
readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
|
|
51
|
+
readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
|
|
52
|
+
readonly previousSummaryId: Schema.optionalKey<Schema.brand<Schema.String, "SummaryId">>;
|
|
53
|
+
readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
54
|
+
readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
55
|
+
readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
56
|
+
readonly text: Schema.NonEmptyString;
|
|
57
|
+
readonly promptMessage: Schema.Struct<{
|
|
58
|
+
readonly role: Schema.Literal<"user">;
|
|
59
|
+
readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
|
|
60
|
+
readonly type: Schema.Literal<"text">;
|
|
61
|
+
readonly text: Schema.String;
|
|
62
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
63
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
64
|
+
}>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
65
|
+
readonly type: Schema.Literal<"text">;
|
|
66
|
+
readonly text: Schema.String;
|
|
67
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
68
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
69
|
+
}>, Schema.Struct<{
|
|
70
|
+
readonly type: Schema.Literal<"file">;
|
|
71
|
+
readonly mediaType: Schema.String;
|
|
72
|
+
readonly fileName: Schema.optional<Schema.String>;
|
|
73
|
+
readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
|
|
74
|
+
readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
|
|
75
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
76
|
+
}>]>>]>;
|
|
77
|
+
readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
|
|
78
|
+
readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
|
|
79
|
+
}>;
|
|
80
|
+
readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
|
|
81
|
+
readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
|
|
82
|
+
}>>;
|
|
83
|
+
}>;
|
|
84
|
+
type ContextProjection = typeof ContextProjection.Type;
|
|
85
|
+
/** Genesis context before any compaction has rebased prompt history. */
|
|
86
|
+
declare const emptyContextProjection: {
|
|
87
|
+
readonly contextVersion: number & import("effect/Brand").Brand<"ContextVersion">;
|
|
88
|
+
readonly currentSummary?: {
|
|
89
|
+
readonly compactionId: string & import("effect/Brand").Brand<"CompactionId">;
|
|
90
|
+
readonly summaryId: string & import("effect/Brand").Brand<"SummaryId">;
|
|
91
|
+
readonly sourceFromSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
|
|
92
|
+
readonly sourceToSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
|
|
93
|
+
readonly retainedFromContextSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
|
|
94
|
+
readonly text: string;
|
|
95
|
+
readonly promptMessage: {
|
|
96
|
+
readonly role: "user";
|
|
97
|
+
readonly content: readonly [{
|
|
98
|
+
readonly type: "text";
|
|
99
|
+
readonly text: string;
|
|
100
|
+
readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
|
|
101
|
+
readonly options: {
|
|
102
|
+
readonly [x: string]: Schema.Json;
|
|
103
|
+
};
|
|
104
|
+
}, ...{
|
|
105
|
+
readonly type: "text";
|
|
106
|
+
readonly text: string;
|
|
107
|
+
readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
|
|
108
|
+
readonly options: {
|
|
109
|
+
readonly [x: string]: Schema.Json;
|
|
110
|
+
};
|
|
111
|
+
}[]] | readonly ({
|
|
112
|
+
readonly type: "text";
|
|
113
|
+
readonly text: string;
|
|
114
|
+
readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
|
|
115
|
+
readonly options: {
|
|
116
|
+
readonly [x: string]: Schema.Json;
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
|
|
120
|
+
readonly options: {
|
|
121
|
+
readonly [x: string]: Schema.Json;
|
|
122
|
+
};
|
|
123
|
+
readonly type: "file";
|
|
124
|
+
readonly mediaType: string;
|
|
125
|
+
readonly data: string | Uint8Array<ArrayBufferLike> | URL;
|
|
126
|
+
readonly fileName?: string | undefined;
|
|
127
|
+
})[];
|
|
128
|
+
readonly "~effect/ai/Prompt/Message": "~effect/ai/Prompt/Message";
|
|
129
|
+
readonly options: {
|
|
130
|
+
readonly [x: string]: Schema.Json;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
readonly policyId: string & import("effect/Brand").Brand<"CompactionPolicyId">;
|
|
134
|
+
readonly previousSummaryId?: (string & import("effect/Brand").Brand<"SummaryId">) | undefined;
|
|
135
|
+
readonly executorId?: (string & import("effect/Brand").Brand<"CompactionExecutorId">) | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
};
|
|
138
|
+
//#endregion
|
|
139
|
+
export { emptyContextProjection as a, ContextProjection as i, CompactionPolicyId as n, CompactionSummaryArtifact as r, CompactionExecutorId as t };
|
|
140
|
+
//# sourceMappingURL=context-projection-n6Rdup0N.d.ts.map
|
|
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
|
|
|
2
2
|
import * as Order from "effect/Order";
|
|
3
3
|
|
|
4
4
|
//#region src/types/core.d.ts
|
|
5
|
-
/** Durable conversation identity; one
|
|
5
|
+
/** Durable conversation identity; one host isolation unit stores one session.
|
|
6
6
|
*
|
|
7
7
|
* New EDA sessions are minted as UUIDv7. Migrated sessions may retain UUIDv4
|
|
8
8
|
* identities, so runtime identity accepts any RFC UUID without changing app
|
|
@@ -78,4 +78,4 @@ declare const comparePosition: Order.Order<{
|
|
|
78
78
|
}>;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { SummaryId as _, CorrelationId as a, comparePosition as b, EventId as c, Position as d, PositionOrder as f, SubSequenceNumber as g, SessionId as h, ContextVersion as i, InferenceId as l, SequenceNumber as m, CommandId as n, DurablePosition as o, RunId as p, CompactionId as r, DurableSubSequenceNumber as s, BaseStateId as t, MessageId as u, ToolCallId as v, durablePosition as x, TurnId as y };
|
|
81
|
-
//# sourceMappingURL=core-
|
|
81
|
+
//# sourceMappingURL=core-CYT6DBaS.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-CV7O-51r.js";
|
|
2
2
|
export { CommandQueueSource, CommandQueues, PendingSteeringMessage, PendingUserMessage, deriveCommandQueues, emptyCommandQueues };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-n6Rdup0N.js";
|
|
2
|
+
export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CompactionId, ContextVersion, SequenceNumber, SummaryId } from "../types/core.js";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
4
|
+
//#region src/domain/context-projection.ts
|
|
5
|
+
/** Stable identifier for the compaction policy that selected a summary plan. */
|
|
6
|
+
const CompactionPolicyId = Schema.NonEmptyString.pipe(Schema.brand("CompactionPolicyId"));
|
|
7
|
+
/** Stable identifier for the executor that produced a summary artifact. */
|
|
8
|
+
const CompactionExecutorId = Schema.NonEmptyString.pipe(Schema.brand("CompactionExecutorId"));
|
|
9
|
+
/** Authoritative cumulative model-context summary written with `SummaryCreated`. */
|
|
10
|
+
const CompactionSummaryArtifact = Schema.Struct({
|
|
11
|
+
compactionId: CompactionId,
|
|
12
|
+
summaryId: SummaryId,
|
|
13
|
+
previousSummaryId: Schema.optionalKey(SummaryId),
|
|
14
|
+
sourceFromSeq: SequenceNumber,
|
|
15
|
+
sourceToSeq: SequenceNumber,
|
|
16
|
+
retainedFromContextSeq: SequenceNumber,
|
|
17
|
+
text: Schema.NonEmptyString,
|
|
18
|
+
promptMessage: Prompt.UserMessage,
|
|
19
|
+
policyId: CompactionPolicyId,
|
|
20
|
+
executorId: Schema.optionalKey(CompactionExecutorId)
|
|
21
|
+
});
|
|
22
|
+
/** Current durable context cursor projected from framework reducer state and summary rows. */
|
|
23
|
+
const ContextProjection = Schema.Struct({
|
|
24
|
+
contextVersion: ContextVersion,
|
|
25
|
+
currentSummary: Schema.optionalKey(CompactionSummaryArtifact)
|
|
26
|
+
});
|
|
27
|
+
/** Genesis context before any compaction has rebased prompt history. */
|
|
28
|
+
const emptyContextProjection = ContextProjection.make({ contextVersion: ContextVersion.make(0) });
|
|
29
|
+
//#endregion
|
|
30
|
+
export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=context-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-projection.js","names":[],"sources":["../../src/domain/context-projection.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CompactionId, ContextVersion, SequenceNumber, SummaryId } from \"../types/core\";\n\n/** Stable identifier for the compaction policy that selected a summary plan. */\nexport const CompactionPolicyId = Schema.NonEmptyString.pipe(Schema.brand(\"CompactionPolicyId\"));\nexport type CompactionPolicyId = typeof CompactionPolicyId.Type;\n\n/** Stable identifier for the executor that produced a summary artifact. */\nexport const CompactionExecutorId = Schema.NonEmptyString.pipe(\n Schema.brand(\"CompactionExecutorId\"),\n);\nexport type CompactionExecutorId = typeof CompactionExecutorId.Type;\n\n/** Authoritative cumulative model-context summary written with `SummaryCreated`. */\nexport const CompactionSummaryArtifact = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n previousSummaryId: Schema.optionalKey(SummaryId),\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n retainedFromContextSeq: SequenceNumber,\n text: Schema.NonEmptyString,\n promptMessage: Prompt.UserMessage,\n policyId: CompactionPolicyId,\n executorId: Schema.optionalKey(CompactionExecutorId),\n});\nexport type CompactionSummaryArtifact = typeof CompactionSummaryArtifact.Type;\n\n/** Current durable context cursor projected from framework reducer state and summary rows. */\nexport const ContextProjection = Schema.Struct({\n contextVersion: ContextVersion,\n currentSummary: Schema.optionalKey(CompactionSummaryArtifact),\n});\nexport type ContextProjection = typeof ContextProjection.Type;\n\n/** Genesis context before any compaction has rebased prompt history. */\nexport const emptyContextProjection = ContextProjection.make({\n contextVersion: ContextVersion.make(0),\n});\n"],"mappings":";;;;;AAMA,MAAa,qBAAqB,OAAO,eAAe,KAAK,OAAO,MAAM,oBAAoB,CAAC;;AAI/F,MAAa,uBAAuB,OAAO,eAAe,KACxD,OAAO,MAAM,sBAAsB,CACrC;;AAIA,MAAa,4BAA4B,OAAO,OAAO;CACrD,cAAc;CACd,WAAW;CACX,mBAAmB,OAAO,YAAY,SAAS;CAC/C,eAAe;CACf,aAAa;CACb,wBAAwB;CACxB,MAAM,OAAO;CACb,eAAe,OAAO;CACtB,UAAU;CACV,YAAY,OAAO,YAAY,oBAAoB;AACrD,CAAC;;AAID,MAAa,oBAAoB,OAAO,OAAO;CAC7C,gBAAgB;CAChB,gBAAgB,OAAO,YAAY,yBAAyB;AAC9D,CAAC;;AAID,MAAa,yBAAyB,kBAAkB,KAAK,EAC3D,gBAAgB,eAAe,KAAK,CAAC,EACvC,CAAC"}
|
|
@@ -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-DiOPBY3l.js";
|
|
2
2
|
export { DurableTranscriptMessage, contextProjectionPrompt, contextProjectionPromptWithUserContent, contextProjectionPromptWithUserContents, durableMessageTranscript, durableTranscriptPrompt, durableTranscriptPromptWithUserContent };
|
|
@@ -662,6 +662,7 @@ declare const MessageRecordSchema: Schema.Union<readonly [Schema.Struct<{
|
|
|
662
662
|
readonly text: Schema.String;
|
|
663
663
|
readonly reasoning: Schema.optionalKey<Schema.String>;
|
|
664
664
|
}>;
|
|
665
|
+
readonly imported: Schema.optionalKey<Schema.Literal<true>>;
|
|
665
666
|
readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
|
|
666
667
|
readonly promptParts: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
667
668
|
readonly type: Schema.Literal<"text">;
|
|
@@ -855,6 +856,7 @@ declare const JsonMessageRecordSchema: Schema.Union<readonly [Schema.Struct<{
|
|
|
855
856
|
readonly text: Schema.String;
|
|
856
857
|
readonly reasoning: Schema.optionalKey<Schema.String>;
|
|
857
858
|
}>;
|
|
859
|
+
readonly imported: Schema.optionalKey<Schema.Literal<true>>;
|
|
858
860
|
readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
|
|
859
861
|
readonly promptParts: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
860
862
|
readonly type: Schema.Literal<"text">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandId, InferenceId, MessageId, RunId, SequenceNumber, ToolCallId, TurnId } from "../types/core.js";
|
|
2
2
|
import { CancelPendingMessageCommand, EDACommand, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, UserMessageContent } from "../types/commands.js";
|
|
3
3
|
import { EDAEventTrace, EDARunTrace } from "../types/tracing.js";
|
|
4
|
-
import { _r as
|
|
4
|
+
import { _r as SystemPromptText, br as UsagePayload, dr as FailurePayload, hr as ProviderPartId, r as AssistantMessageContent, rt as RecoveryContinuation, vr as ToolName } from "../durable-DsV9PxZC.js";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
7
7
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
@@ -243,6 +243,7 @@ const messageRecordSchema = (userContent, assistantPart) => Schema.Union([
|
|
|
243
243
|
...MessageIdentityFields,
|
|
244
244
|
_tag: Schema.Literal("Assistant"),
|
|
245
245
|
content: AssistantMessageContent,
|
|
246
|
+
imported: Schema.optionalKey(Schema.Literal(true)),
|
|
246
247
|
inferenceId: InferenceId,
|
|
247
248
|
promptParts: Schema.optionalKey(Schema.Array(assistantPart)),
|
|
248
249
|
runId: RunId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduced-state-schema.js","names":[],"sources":["../../src/domain/reduced-state-schema.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\n\nimport {\n CancelPendingMessageCommand,\n EDACommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n StopTurnCommand,\n SubmitMessageCommand,\n UserMessageContent,\n} from \"../types/commands\";\nimport {\n CommandId,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\nimport {\n AssistantMessageContent,\n EDAEventTrace,\n EDARunTrace,\n FailurePayload,\n ProviderPartId,\n RecoveryContinuation,\n SystemPromptText,\n ToolName,\n UsagePayload,\n} from \"../types/events\";\n\nconst PromptFilePart = Schema.Struct(Prompt.FilePart.fields);\nconst PromptReasoningPart = Schema.Struct(Prompt.ReasoningPart.fields);\nconst PromptTextPart = Schema.Struct(Prompt.TextPart.fields);\nconst PromptToolApprovalRequestPart = Schema.Struct(Prompt.ToolApprovalRequestPart.fields);\nconst PromptToolCallPart = Schema.Struct(Prompt.ToolCallPart.fields);\nconst PromptToolResultPart = Schema.Struct(Prompt.ToolResultPart.fields);\n\nconst JsonPromptFilePartEncoded = Schema.Struct({\n ...PromptFilePart.fields,\n data: Schema.String,\n});\n\nconst byteArrayDataUrl = (data: Uint8Array, mediaType: string): string => {\n let binary = \"\";\n for (const byte of data) {\n binary += String.fromCharCode(byte);\n }\n return `data:${mediaType};base64,${btoa(binary)}`;\n};\n\n/**\n * Canonical Effect Prompt file part with an explicit JSON string encoding.\n *\n * Strings pass through unchanged, URLs use their href, and bytes become a data\n * URL. Decoding produces the normal Prompt.FilePart type.\n */\nexport const JsonPromptFilePart = JsonPromptFilePartEncoded.pipe(\n Schema.decodeTo(\n Prompt.FilePart,\n SchemaTransformation.transform<Prompt.FilePartEncoded, typeof JsonPromptFilePartEncoded.Type>({\n decode: (part) => part,\n encode: (part) => ({\n ...part,\n \"~effect/ai/Prompt/Part\": \"~effect/ai/Prompt/Part\",\n data:\n typeof part.data === \"string\"\n ? part.data\n : part.data instanceof URL\n ? part.data.href\n : byteArrayDataUrl(part.data, part.mediaType),\n options: part.options ?? {},\n }),\n }),\n ),\n);\n\nexport const JsonUserMessagePart = Schema.Union([PromptTextPart, JsonPromptFilePart]);\nexport const JsonUserMessageContent = Schema.Union([\n Prompt.ContentFromString,\n Schema.NonEmptyArray(JsonUserMessagePart),\n]);\n\nexport const JsonAssistantMessagePart = Schema.Union([\n PromptTextPart,\n JsonPromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n]);\n\n/**\n * Command schema for JSON snapshots.\n *\n * Every command except SubmitMessage is reused directly. SubmitMessage only\n * replaces canonical Prompt file data with its explicit JSON string projection.\n */\nexport const JsonEDACommand = Schema.Union([\n Schema.Struct({\n ...SubmitMessageCommand.fields,\n content: JsonUserMessageContent,\n }),\n StopTurnCommand,\n CancelPendingMessageCommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n]);\n\nexport const CommandTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Cancelled\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const RunTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Interrupted\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const TurnTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Stopped\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const InferenceTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n]);\n\nconst LifecycleTimingFields = {\n durationMs: Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0))),\n startedAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n terminalAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n};\n\nexport const CommandRecordSchema = Schema.Struct({\n admittedSeq: Schema.optionalKey(SequenceNumber),\n admissionTrace: Schema.optionalKey(EDAEventTrace),\n command: Schema.optionalKey(EDACommand),\n commandId: CommandId,\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(CommandTerminalSchema),\n});\n\nexport const JsonCommandRecordSchema = Schema.Struct({\n ...CommandRecordSchema.fields,\n command: Schema.optionalKey(JsonEDACommand),\n});\n\nexport const RunRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n commandIds: Schema.Array(CommandId),\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(RunTerminalSchema),\n trace: EDARunTrace,\n});\n\nexport const TurnRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(TurnTerminalSchema),\n turnId: TurnId,\n});\n\nexport const InferenceRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n inferenceId: InferenceId,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(InferenceTerminalSchema),\n turnId: TurnId,\n});\n\nexport const ToolDecisionSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Created\"),\n inferenceId: InferenceId,\n params: Schema.Unknown,\n promptPart: Schema.optionalKey(PromptToolCallPart),\n providerExecuted: Schema.Boolean,\n providerPartId: ProviderPartId,\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Rejected\"),\n inferenceId: InferenceId,\n modelFeedback: Schema.String,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n providerPartId: ProviderPartId,\n reason: Schema.Literals([\"unknown-tool\", \"invalid-params\"]),\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n]);\n\nexport const ToolTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n promptPart: Schema.optionalKey(PromptToolResultPart),\n result: Schema.Unknown,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n seq: SequenceNumber,\n }),\n]);\n\nexport const ToolCallRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n decision: Schema.optionalKey(ToolDecisionSchema),\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(ToolTerminalSchema),\n toolCallId: ToolCallId,\n});\n\nconst MessageIdentityFields = {\n createdAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n messageId: MessageId,\n seq: SequenceNumber,\n};\n\nconst PendingMessageStateFields = {\n cancellationReason: Schema.optionalKey(Schema.String),\n cancelledByCommandId: Schema.optionalKey(CommandId),\n cancelledSeq: Schema.optionalKey(SequenceNumber),\n consumedSeq: Schema.optionalKey(SequenceNumber),\n consumedTurnId: Schema.optionalKey(TurnId),\n pausedByCommandId: Schema.optionalKey(CommandId),\n pausedSeq: Schema.optionalKey(SequenceNumber),\n promotedSeq: Schema.optionalKey(SequenceNumber),\n};\n\nconst messageRecordSchema = <UserContent extends Schema.Top, AssistantPart extends Schema.Top>(\n userContent: UserContent,\n assistantPart: AssistantPart,\n) =>\n Schema.Union([\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"System\"),\n content: SystemPromptText,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"User\"),\n commandId: CommandId,\n content: userContent,\n disposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n requestedDisposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"Steering\"),\n commandId: CommandId,\n content: userContent,\n runId: RunId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"Assistant\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n runId: RunId,\n turnId: TurnId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"AssistantPartial\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n reason: Schema.String,\n runId: RunId,\n turnId: TurnId,\n }),\n ]);\n\nexport const MessageRecordSchema = messageRecordSchema(\n UserMessageContent,\n Schema.Union([\n PromptTextPart,\n PromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n ]),\n);\n\nexport const JsonMessageRecordSchema = messageRecordSchema(\n JsonUserMessageContent,\n JsonAssistantMessagePart,\n);\n\nexport const RecoveryContinuationRecordSchema = Schema.Struct({\n ...RecoveryContinuation.fields,\n seq: SequenceNumber,\n});\n\nexport const TokenUsageTotalsSchema = Schema.Struct({\n cachedInputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n inputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n reasoningTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n textTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n});\n\nexport const TokenConsumptionStateSchema = Schema.Struct({\n total: TokenUsageTotalsSchema,\n});\n"],"mappings":";;;;;;;;AAkCA,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,sBAAsB,OAAO,OAAO,OAAO,cAAc,MAAM;AACrE,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,gCAAgC,OAAO,OAAO,OAAO,wBAAwB,MAAM;AACzF,MAAM,qBAAqB,OAAO,OAAO,OAAO,aAAa,MAAM;AACnE,MAAM,uBAAuB,OAAO,OAAO,OAAO,eAAe,MAAM;AAEvE,MAAM,4BAA4B,OAAO,OAAO;CAC9C,GAAG,eAAe;CAClB,MAAM,OAAO;AACf,CAAC;AAED,MAAM,oBAAoB,MAAkB,cAA8B;CACxE,IAAI,SAAS;CACb,KAAK,MAAM,QAAQ,MACjB,UAAU,OAAO,aAAa,IAAI;CAEpC,OAAO,QAAQ,UAAU,UAAU,KAAK,MAAM;AAChD;;;;;;;AAQA,MAAa,qBAAqB,0BAA0B,KAC1D,OAAO,SACL,OAAO,UACP,qBAAqB,UAAyE;CAC5F,SAAS,SAAS;CAClB,SAAS,UAAU;EACjB,GAAG;EACH,0BAA0B;EAC1B,MACE,OAAO,KAAK,SAAS,WACjB,KAAK,OACL,KAAK,gBAAgB,MACnB,KAAK,KAAK,OACV,iBAAiB,KAAK,MAAM,KAAK,SAAS;EAClD,SAAS,KAAK,WAAW,CAAC;CAC5B;AACF,CAAC,CACH,CACF;AAEA,MAAa,sBAAsB,OAAO,MAAM,CAAC,gBAAgB,kBAAkB,CAAC;AACpF,MAAa,yBAAyB,OAAO,MAAM,CACjD,OAAO,mBACP,OAAO,cAAc,mBAAmB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OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAClE,YAAY,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAC/D,CAAC;AAED,MAAa,8BAA8B,OAAO,OAAO,EACvD,OAAO,uBACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"reduced-state-schema.js","names":[],"sources":["../../src/domain/reduced-state-schema.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\n\nimport {\n CancelPendingMessageCommand,\n EDACommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n StopTurnCommand,\n SubmitMessageCommand,\n UserMessageContent,\n} from \"../types/commands\";\nimport {\n CommandId,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\nimport {\n AssistantMessageContent,\n EDAEventTrace,\n EDARunTrace,\n FailurePayload,\n ProviderPartId,\n RecoveryContinuation,\n SystemPromptText,\n ToolName,\n UsagePayload,\n} from \"../types/events\";\n\nconst PromptFilePart = Schema.Struct(Prompt.FilePart.fields);\nconst PromptReasoningPart = Schema.Struct(Prompt.ReasoningPart.fields);\nconst PromptTextPart = Schema.Struct(Prompt.TextPart.fields);\nconst PromptToolApprovalRequestPart = Schema.Struct(Prompt.ToolApprovalRequestPart.fields);\nconst PromptToolCallPart = Schema.Struct(Prompt.ToolCallPart.fields);\nconst PromptToolResultPart = Schema.Struct(Prompt.ToolResultPart.fields);\n\nconst JsonPromptFilePartEncoded = Schema.Struct({\n ...PromptFilePart.fields,\n data: Schema.String,\n});\n\nconst byteArrayDataUrl = (data: Uint8Array, mediaType: string): string => {\n let binary = \"\";\n for (const byte of data) {\n binary += String.fromCharCode(byte);\n }\n return `data:${mediaType};base64,${btoa(binary)}`;\n};\n\n/**\n * Canonical Effect Prompt file part with an explicit JSON string encoding.\n *\n * Strings pass through unchanged, URLs use their href, and bytes become a data\n * URL. Decoding produces the normal Prompt.FilePart type.\n */\nexport const JsonPromptFilePart = JsonPromptFilePartEncoded.pipe(\n Schema.decodeTo(\n Prompt.FilePart,\n SchemaTransformation.transform<Prompt.FilePartEncoded, typeof JsonPromptFilePartEncoded.Type>({\n decode: (part) => part,\n encode: (part) => ({\n ...part,\n \"~effect/ai/Prompt/Part\": \"~effect/ai/Prompt/Part\",\n data:\n typeof part.data === \"string\"\n ? part.data\n : part.data instanceof URL\n ? part.data.href\n : byteArrayDataUrl(part.data, part.mediaType),\n options: part.options ?? {},\n }),\n }),\n ),\n);\n\nexport const JsonUserMessagePart = Schema.Union([PromptTextPart, JsonPromptFilePart]);\nexport const JsonUserMessageContent = Schema.Union([\n Prompt.ContentFromString,\n Schema.NonEmptyArray(JsonUserMessagePart),\n]);\n\nexport const JsonAssistantMessagePart = Schema.Union([\n PromptTextPart,\n JsonPromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n]);\n\n/**\n * Command schema for JSON snapshots.\n *\n * Every command except SubmitMessage is reused directly. SubmitMessage only\n * replaces canonical Prompt file data with its explicit JSON string projection.\n */\nexport const JsonEDACommand = Schema.Union([\n Schema.Struct({\n ...SubmitMessageCommand.fields,\n content: JsonUserMessageContent,\n }),\n StopTurnCommand,\n CancelPendingMessageCommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n]);\n\nexport const CommandTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Cancelled\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const RunTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Interrupted\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const TurnTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Stopped\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const InferenceTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n]);\n\nconst LifecycleTimingFields = {\n durationMs: Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0))),\n startedAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n terminalAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n};\n\nexport const CommandRecordSchema = Schema.Struct({\n admittedSeq: Schema.optionalKey(SequenceNumber),\n admissionTrace: Schema.optionalKey(EDAEventTrace),\n command: Schema.optionalKey(EDACommand),\n commandId: CommandId,\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(CommandTerminalSchema),\n});\n\nexport const JsonCommandRecordSchema = Schema.Struct({\n ...CommandRecordSchema.fields,\n command: Schema.optionalKey(JsonEDACommand),\n});\n\nexport const RunRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n commandIds: Schema.Array(CommandId),\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(RunTerminalSchema),\n trace: EDARunTrace,\n});\n\nexport const TurnRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(TurnTerminalSchema),\n turnId: TurnId,\n});\n\nexport const InferenceRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n inferenceId: InferenceId,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(InferenceTerminalSchema),\n turnId: TurnId,\n});\n\nexport const ToolDecisionSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Created\"),\n inferenceId: InferenceId,\n params: Schema.Unknown,\n promptPart: Schema.optionalKey(PromptToolCallPart),\n providerExecuted: Schema.Boolean,\n providerPartId: ProviderPartId,\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Rejected\"),\n inferenceId: InferenceId,\n modelFeedback: Schema.String,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n providerPartId: ProviderPartId,\n reason: Schema.Literals([\"unknown-tool\", \"invalid-params\"]),\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n]);\n\nexport const ToolTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n promptPart: Schema.optionalKey(PromptToolResultPart),\n result: Schema.Unknown,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n seq: SequenceNumber,\n }),\n]);\n\nexport const ToolCallRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n decision: Schema.optionalKey(ToolDecisionSchema),\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(ToolTerminalSchema),\n toolCallId: ToolCallId,\n});\n\nconst MessageIdentityFields = {\n createdAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n messageId: MessageId,\n seq: SequenceNumber,\n};\n\nconst PendingMessageStateFields = {\n cancellationReason: Schema.optionalKey(Schema.String),\n cancelledByCommandId: Schema.optionalKey(CommandId),\n cancelledSeq: Schema.optionalKey(SequenceNumber),\n consumedSeq: Schema.optionalKey(SequenceNumber),\n consumedTurnId: Schema.optionalKey(TurnId),\n pausedByCommandId: Schema.optionalKey(CommandId),\n pausedSeq: Schema.optionalKey(SequenceNumber),\n promotedSeq: Schema.optionalKey(SequenceNumber),\n};\n\nconst messageRecordSchema = <UserContent extends Schema.Top, AssistantPart extends Schema.Top>(\n userContent: UserContent,\n assistantPart: AssistantPart,\n) =>\n Schema.Union([\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"System\"),\n content: SystemPromptText,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"User\"),\n commandId: CommandId,\n content: userContent,\n disposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n requestedDisposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"Steering\"),\n commandId: CommandId,\n content: userContent,\n runId: RunId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"Assistant\"),\n content: AssistantMessageContent,\n imported: Schema.optionalKey(Schema.Literal(true)),\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n runId: RunId,\n turnId: TurnId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"AssistantPartial\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n reason: Schema.String,\n runId: RunId,\n turnId: TurnId,\n }),\n ]);\n\nexport const MessageRecordSchema = messageRecordSchema(\n UserMessageContent,\n Schema.Union([\n PromptTextPart,\n PromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n ]),\n);\n\nexport const JsonMessageRecordSchema = messageRecordSchema(\n JsonUserMessageContent,\n JsonAssistantMessagePart,\n);\n\nexport const RecoveryContinuationRecordSchema = Schema.Struct({\n ...RecoveryContinuation.fields,\n seq: SequenceNumber,\n});\n\nexport const TokenUsageTotalsSchema = Schema.Struct({\n cachedInputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n inputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n reasoningTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n textTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n});\n\nexport const TokenConsumptionStateSchema = Schema.Struct({\n total: TokenUsageTotalsSchema,\n});\n"],"mappings":";;;;;;;;AAkCA,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,sBAAsB,OAAO,OAAO,OAAO,cAAc,MAAM;AACrE,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,gCAAgC,OAAO,OAAO,OAAO,wBAAwB,MAAM;AACzF,MAAM,qBAAqB,OAAO,OAAO,OAAO,aAAa,MAAM;AACnE,MAAM,uBAAuB,OAAO,OAAO,OAAO,eAAe,MAAM;AAEvE,MAAM,4BAA4B,OAAO,OAAO;CAC9C,GAAG,eAAe;CAClB,MAAM,OAAO;AACf,CAAC;AAED,MAAM,oBAAoB,MAAkB,cAA8B;CACxE,IAAI,SAAS;CACb,KAAK,MAAM,QAAQ,MACjB,UAAU,OAAO,aAAa,IAAI;CAEpC,OAAO,QAAQ,UAAU,UAAU,KAAK,MAAM;AAChD;;;;;;;AAQA,MAAa,qBAAqB,0BAA0B,KAC1D,OAAO,SACL,OAAO,UACP,qBAAqB,UAAyE;CAC5F,SAAS,SAAS;C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ACA,OAAO,MAAM;CACX;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CACH;AAEA,MAAa,0BAA0B,oBACrC,wBACA,wBACF;AAEA,MAAa,mCAAmC,OAAO,OAAO;CAC5D,GAAG,qBAAqB;CACxB,KAAK;AACP,CAAC;AAED,MAAa,yBAAyB,OAAO,OAAO;CAClD,mBAAmB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CACpE,aAAa,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC9D,cAAc,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC/D,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAClE,YAAY,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAC/D,CAAC;AAED,MAAa,8BAA8B,OAAO,OAAO,EACvD,OAAO,uBACT,CAAC"}
|
|
@@ -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-CV7O-51r.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 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as encodeReducedStateCheckpoint, c as frameworkReducedStateReducerSchemaVersion, d as pendingStopCommand, f as reduceCommittedEvents, i as decodeReducedStateCheckpoint, l as initialReducedState, n as activeTurnIdentityForCommand, o as foldReducedState, p as reducedStateCheckpointEventSeqs, r as classifyRecoverableWork, s as frameworkReducedStateReducerName, t as activeCommand, u as pendingCommands } from "../reduced-state-
|
|
1
|
+
import { a as encodeReducedStateCheckpoint, c as frameworkReducedStateReducerSchemaVersion, d as pendingStopCommand, f as reduceCommittedEvents, i as decodeReducedStateCheckpoint, l as initialReducedState, n as activeTurnIdentityForCommand, o as foldReducedState, p as reducedStateCheckpointEventSeqs, r as classifyRecoverableWork, s as frameworkReducedStateReducerName, t as activeCommand, u as pendingCommands } from "../reduced-state-TMi7ISla.js";
|
|
2
2
|
export { activeCommand, activeTurnIdentityForCommand, classifyRecoverableWork, decodeReducedStateCheckpoint, encodeReducedStateCheckpoint, foldReducedState, frameworkReducedStateReducerName, frameworkReducedStateReducerSchemaVersion, initialReducedState, pendingCommands, pendingStopCommand, reduceCommittedEvents, reducedStateCheckpointEventSeqs };
|