effect-durable-agent 0.1.0-alpha.23 → 0.1.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/delivery-Bb7pkQ9o.js +507 -0
  2. package/dist/delivery-Bb7pkQ9o.js.map +1 -0
  3. package/dist/delivery-o6sDIiwO.d.ts +2990 -0
  4. package/dist/in-memory-IgxnTbGb.js +150 -0
  5. package/dist/in-memory-IgxnTbGb.js.map +1 -0
  6. package/dist/{window-read-BDayZf7O.js → interpreter-BdRoYrfL.js} +94 -206
  7. package/dist/interpreter-BdRoYrfL.js.map +1 -0
  8. package/dist/services/reducer-registry.js +1 -1
  9. package/dist/services/runtime-layer.js +3 -3
  10. package/dist/services/runtime.js +1 -1
  11. package/dist/services/session-query.js +2 -2
  12. package/dist/services/session-state.js +1 -1
  13. package/dist/services/session-store.js +271 -1
  14. package/dist/services/session-store.js.map +1 -0
  15. package/dist/services/sink-registry.js +1 -1
  16. package/dist/{session-state-C6SyphC0.js → session-state-BW0l2aNk.js} +3 -3
  17. package/dist/{session-state-C6SyphC0.js.map → session-state-BW0l2aNk.js.map} +1 -1
  18. package/dist/{sink-registry-DtrssBxF.js → sink-registry-D0MetcNq.js} +2 -2
  19. package/dist/{sink-registry-DtrssBxF.js.map → sink-registry-D0MetcNq.js.map} +1 -1
  20. package/dist/{subscription-g5W0Ggqx.js → subscription-Dzr5LqPX.js} +5 -3
  21. package/dist/subscription-Dzr5LqPX.js.map +1 -0
  22. package/dist/testkit/layers.d.ts +8 -2
  23. package/dist/testkit/layers.js +7 -3
  24. package/dist/testkit/layers.js.map +1 -1
  25. package/dist/testkit/transcript.d.ts +226 -0
  26. package/dist/testkit/transcript.js +1475 -0
  27. package/dist/testkit/transcript.js.map +1 -0
  28. package/dist/transcript.d.ts +25 -101
  29. package/dist/transcript.js +4 -3
  30. package/dist/transcript.js.map +1 -1
  31. package/dist/websocket/events.d.ts +2 -0
  32. package/dist/websocket/events.js +2 -0
  33. package/dist/websocket.d.ts +1 -2986
  34. package/dist/websocket.js +3 -504
  35. package/dist/websocket.js.map +1 -1
  36. package/dist/window-read-DBf1Iktt.d.ts +104 -0
  37. package/dist/window-read-U55aAeuz.js +184 -0
  38. package/dist/window-read-U55aAeuz.js.map +1 -0
  39. package/package.json +9 -1
  40. package/dist/session-store-DuEhcqIC.js +0 -414
  41. package/dist/session-store-DuEhcqIC.js.map +0 -1
  42. package/dist/subscription-g5W0Ggqx.js.map +0 -1
  43. package/dist/window-read-BDayZf7O.js.map +0 -1
@@ -0,0 +1,226 @@
1
+ import { t as DurableEventEnvelope } from "../envelope-Che6KatU.js";
2
+ import { A as TranscriptDefinition, C as TranscriptVersionMeta, L as TranscriptMappings, t as CommittedDurableEvent, vt as TranscriptRecord, xt as TranscriptRecordId } from "../session-store-CWYZ29CV.js";
3
+ import "../window-read-DBf1Iktt.js";
4
+ //#region src/transcript/transcript-scenarios.d.ts
5
+ /**
6
+ * The fixed scenario corpus: one named log per interpretation rule the transcript must get
7
+ * right. The oracle, the fingerprint and the prompt-parity check all run over it. Add a scenario
8
+ * for every new rule; never edit an existing one without bumping the semantic revision.
9
+ */
10
+ interface TranscriptScenario {
11
+ readonly name: string;
12
+ readonly events: ReadonlyArray<CommittedDurableEvent>;
13
+ /** Whether the log contains a context rebase (the reduced state is pruned). */
14
+ readonly compacted: boolean;
15
+ }
16
+ /** Gia-shaped decorations used by the decoration scenarios. */
17
+ declare const giaLikeTestMappings: TranscriptMappings;
18
+ /** Build the corpus. Logs are deterministic: ids, timestamps and traces are fixed. */
19
+ declare const transcriptScenarios: () => ReadonlyArray<TranscriptScenario>;
20
+ //#endregion
21
+ //#region src/transcript/in-memory.d.ts
22
+ /**
23
+ * The in-memory store's transcript state: the semantic model of the adapter's tables
24
+ * (`transcript_records`, `transcript_aliases`, `transcript_meta`), kept inside the store's
25
+ * `Ref.modify` critical section so maintenance commits atomically with the appended events.
26
+ */
27
+ interface InMemoryTranscriptVersion {
28
+ readonly meta: TranscriptVersionMeta;
29
+ readonly records: ReadonlyMap<TranscriptRecordId, TranscriptRecord>;
30
+ readonly aliases: ReadonlyMap<string, TranscriptRecordId>;
31
+ readonly ordinals: ReadonlyMap<number, number>;
32
+ }
33
+ //#endregion
34
+ //#region src/transcript/transcript-testkit.d.ts
35
+ /** Deterministic UUIDv7-shaped id; `space` keeps identities of different kinds apart. */
36
+ declare const testId: (space: number, slot: number) => string;
37
+ declare const ids: {
38
+ readonly command: (slot: number) => string;
39
+ readonly message: (slot: number) => string;
40
+ readonly run: (slot: number) => string;
41
+ readonly turn: (slot: number) => string;
42
+ readonly inference: (slot: number) => string;
43
+ readonly tool: (slot: number) => string;
44
+ readonly compaction: (slot: number) => string;
45
+ readonly summary: (slot: number) => string;
46
+ readonly event: (slot: number) => string;
47
+ };
48
+ declare const testSessionId: string & import("effect/Brand").Brand<"SessionId">;
49
+ /**
50
+ * Append-only test log. Every event is built as a raw envelope and decoded through the store's
51
+ * durable decoder, so tests exercise the same shapes the interpreter receives in production.
52
+ */
53
+ declare class TestLog {
54
+ readonly events: Array<CommittedDurableEvent>;
55
+ private readonly envelopes;
56
+ private nextEvent;
57
+ /** The raw envelopes, for seeding an in-memory store. */
58
+ get durableEnvelopes(): ReadonlyArray<DurableEventEnvelope>;
59
+ append(type: string, payload: Record<string, unknown>, namespace?: string): this;
60
+ appendForeign(namespace: string, type: string, payload: Record<string, unknown>): this;
61
+ configure(): this;
62
+ /** Command admission plus the submitted message, as session ingress writes them. */
63
+ submit(input: {
64
+ readonly command: number;
65
+ readonly message: number;
66
+ readonly text: string;
67
+ readonly disposition?: "queue" | "steer";
68
+ readonly idempotencyKey?: string;
69
+ }): this;
70
+ /** A legacy or interrupt-path admission: the message is committed when the command starts. */
71
+ admitOnly(input: {
72
+ readonly command: number;
73
+ readonly text: string;
74
+ readonly idempotencyKey?: string;
75
+ }): this;
76
+ commitUser(input: {
77
+ readonly command: number;
78
+ readonly message: number;
79
+ readonly text: string;
80
+ }): this;
81
+ startRun(input: {
82
+ readonly run: number;
83
+ readonly commands: ReadonlyArray<number>;
84
+ }): this;
85
+ runStarted(input: {
86
+ readonly run: number;
87
+ readonly commands: ReadonlyArray<number>;
88
+ }): this;
89
+ turn(input: {
90
+ readonly run: number;
91
+ readonly turn: number;
92
+ readonly inputs?: ReadonlyArray<number>;
93
+ }): this;
94
+ inferenceStarted(input: {
95
+ readonly run: number;
96
+ readonly turn: number;
97
+ readonly inference: number;
98
+ }): this;
99
+ assistant(input: {
100
+ readonly run: number;
101
+ readonly turn: number;
102
+ readonly inference: number;
103
+ readonly message: number;
104
+ readonly text?: string;
105
+ readonly reasoning?: string;
106
+ readonly toolCalls?: ReadonlyArray<{
107
+ readonly providerId: string;
108
+ readonly name: string;
109
+ }>;
110
+ readonly partial?: string;
111
+ }): this;
112
+ importAssistant(input: {
113
+ readonly run: number;
114
+ readonly turn: number;
115
+ readonly inference: number;
116
+ readonly message: number;
117
+ readonly text: string;
118
+ }): this;
119
+ inferenceCompleted(input: {
120
+ readonly run: number;
121
+ readonly turn: number;
122
+ readonly inference: number;
123
+ readonly outputTokens?: number;
124
+ }): this;
125
+ inferenceFailed(input: {
126
+ readonly run: number;
127
+ readonly turn: number;
128
+ readonly inference: number;
129
+ readonly code?: string;
130
+ }): this;
131
+ toolCreated(input: {
132
+ readonly run: number;
133
+ readonly turn: number;
134
+ readonly inference: number;
135
+ readonly tool: number;
136
+ readonly providerId: string;
137
+ readonly name: string;
138
+ }): this;
139
+ toolRejected(input: {
140
+ readonly run: number;
141
+ readonly turn: number;
142
+ readonly inference: number;
143
+ readonly tool: number;
144
+ readonly providerId: string;
145
+ readonly name: string;
146
+ }): this;
147
+ toolStarted(tool: number): this;
148
+ toolCompleted(input: {
149
+ readonly tool: number;
150
+ readonly providerId: string;
151
+ readonly name: string;
152
+ readonly result?: unknown;
153
+ }): this;
154
+ toolFailed(input: {
155
+ readonly tool: number;
156
+ readonly providerId: string;
157
+ readonly name: string;
158
+ }): this;
159
+ turnCompleted(input: {
160
+ readonly run: number;
161
+ readonly turn: number;
162
+ }): this;
163
+ runCompleted(run: number, commands?: ReadonlyArray<number>): this;
164
+ runInterrupted(run: number): this;
165
+ steer(input: {
166
+ readonly command: number;
167
+ readonly message: number;
168
+ readonly run: number;
169
+ readonly text: string;
170
+ }): this;
171
+ compaction(input: {
172
+ readonly compaction: number;
173
+ readonly summary: number;
174
+ readonly retainedFromContextSeq: number;
175
+ readonly contextVersion: number;
176
+ }): this;
177
+ /** One complete assistant turn: start, content, optional tools run to completion, finish. */
178
+ assistantTurn(input: {
179
+ readonly run: number;
180
+ readonly turn: number;
181
+ readonly inference: number;
182
+ readonly message: number;
183
+ readonly text: string;
184
+ readonly inputs?: ReadonlyArray<number>;
185
+ readonly tools?: ReadonlyArray<number>;
186
+ }): this;
187
+ }
188
+ /** A definition, built synchronously for tests. */
189
+ declare const testDefinition: (mappings?: TranscriptMappings) => TranscriptDefinition;
190
+ /** Project a log split into the given batches, starting from an empty version. */
191
+ declare const projectBatches: (definition: TranscriptDefinition, batches: ReadonlyArray<ReadonlyArray<CommittedDurableEvent>>) => InMemoryTranscriptVersion;
192
+ /**
193
+ * A semantic view of a projected version for equality: every record encoded through its stored
194
+ * envelope with `updatedSeq` normalized, every alias, and the cursor and status.
195
+ */
196
+ declare const normalizedProjection: (version: InMemoryTranscriptVersion) => {
197
+ meta: {
198
+ readonly version: string & import("effect/Brand").Brand<"TranscriptVersion">;
199
+ readonly role: "active" | "building";
200
+ readonly cursor: number & import("effect/Brand").Brand<"SequenceNumber">;
201
+ readonly status: {
202
+ readonly _tag: "Failed";
203
+ readonly failedAtSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
204
+ readonly error: string;
205
+ } | {
206
+ readonly _tag: "Ok";
207
+ };
208
+ };
209
+ records: {
210
+ format: number;
211
+ kind: string;
212
+ id: string;
213
+ position?: {
214
+ readonly anchorSeq: number;
215
+ readonly ordinal: number;
216
+ } | undefined;
217
+ body: {
218
+ readonly [x: string]: unknown;
219
+ };
220
+ updatedSeq: number;
221
+ }[];
222
+ aliases: [string, "session" | `assistant:${string}` | `compaction:${string}` | `decorations:command:${string}` | `decorations:idempotencyKey:${string}` | `import:${string}` | `run:${string}` | `tool:${string}` | `user:${string}`][];
223
+ };
224
+ //#endregion
225
+ export { TestLog, type TranscriptScenario, giaLikeTestMappings, ids, normalizedProjection, projectBatches, testDefinition, testId, testSessionId, transcriptScenarios };
226
+ //# sourceMappingURL=transcript.d.ts.map