effect-durable-agent 0.1.0-alpha.20 → 0.1.0-alpha.22

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 (72) hide show
  1. package/README.md +2 -2
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/{compaction-GD1cTPTZ.js → compaction-ajHZ5l7f.js} +58 -6
  5. package/dist/compaction-ajHZ5l7f.js.map +1 -0
  6. package/dist/domain/command-queues.d.ts +1 -1
  7. package/dist/domain/message-transcript.d.ts +2 -2
  8. package/dist/domain/message-transcript.js +9 -1
  9. package/dist/domain/message-transcript.js.map +1 -1
  10. package/dist/domain/reduced-state.d.ts +1 -1
  11. package/dist/domain/reduced-state.js +927 -2
  12. package/dist/domain/reduced-state.js.map +1 -0
  13. package/dist/domain/run-scheduling.d.ts +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/{model-resolver-BfM5YA6A.d.ts → model-resolver-DUms5p6X.d.ts} +7 -1
  16. package/dist/{reduced-state-4FSWDdgT.d.ts → reduced-state-PJdig48e.d.ts} +5087 -5025
  17. package/dist/{reducer-registry-BIhncOHH.d.ts → reducer-registry-BAbhZs6d.d.ts} +2 -2
  18. package/dist/{run-scheduling-wakeup-BH2pHE0U.d.ts → run-scheduling-wakeup-QLK87OqG.d.ts} +2 -2
  19. package/dist/services/compaction.d.ts +2 -2
  20. package/dist/services/compaction.js +2 -2
  21. package/dist/services/model-call.d.ts +15 -0
  22. package/dist/services/model-call.js +15 -0
  23. package/dist/services/model-call.js.map +1 -0
  24. package/dist/services/model-resolver.d.ts +1 -1
  25. package/dist/services/model-resolver.js.map +1 -1
  26. package/dist/services/prompt-projector.d.ts +2 -2
  27. package/dist/services/prompt-projector.js +48 -4
  28. package/dist/services/prompt-projector.js.map +1 -1
  29. package/dist/services/reducer-registry.d.ts +1 -1
  30. package/dist/services/reducer-registry.js +1 -1
  31. package/dist/services/run-scheduler.d.ts +1 -1
  32. package/dist/services/run-scheduling-wakeup.d.ts +1 -1
  33. package/dist/services/runtime-layer.d.ts +7 -7
  34. package/dist/services/runtime-layer.js +9 -9
  35. package/dist/services/runtime-layer.js.map +1 -1
  36. package/dist/services/runtime.d.ts +1 -1
  37. package/dist/services/runtime.js +1 -1
  38. package/dist/services/session-query.d.ts +1 -1
  39. package/dist/services/session-query.js +2 -2
  40. package/dist/services/session-state.d.ts +1 -1
  41. package/dist/services/session-state.js +1 -1
  42. package/dist/services/session-store.d.ts +2 -2
  43. package/dist/services/session-store.js +1 -251
  44. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  45. package/dist/services/sink-registry.d.ts +1 -1
  46. package/dist/services/sink-registry.js +1 -1
  47. package/dist/services/tool-registry.d.ts +1 -1
  48. package/dist/{session-state-BAzdzqV4.js → session-state-StlO5B2N.js} +51 -21
  49. package/dist/session-state-StlO5B2N.js.map +1 -0
  50. package/dist/session-store-ByDjS03N.d.ts +3184 -0
  51. package/dist/session-store-DcJjs4Fd.js +413 -0
  52. package/dist/session-store-DcJjs4Fd.js.map +1 -0
  53. package/dist/{sink-checkpoint-store-C-SY0cG2.d.ts → sink-checkpoint-store-BHb8YRTw.d.ts} +2 -2
  54. package/dist/{sink-registry-BnWfMABI.js → sink-registry-DEneTH8u.js} +4 -4
  55. package/dist/{sink-registry-BnWfMABI.js.map → sink-registry-DEneTH8u.js.map} +1 -1
  56. package/dist/testkit/layers.d.ts +7 -7
  57. package/dist/testkit/layers.js +9 -9
  58. package/dist/testkit/layers.js.map +1 -1
  59. package/dist/{tool-registry-wPsHagF_.d.ts → tool-registry-CxZ0iuYb.d.ts} +2 -2
  60. package/dist/transcript.d.ts +137 -0
  61. package/dist/transcript.js +178 -0
  62. package/dist/transcript.js.map +1 -0
  63. package/dist/websocket.d.ts +1 -1
  64. package/dist/window-read-B8aF_hDq.js +2173 -0
  65. package/dist/window-read-B8aF_hDq.js.map +1 -0
  66. package/package.json +9 -1
  67. package/dist/compaction-GD1cTPTZ.js.map +0 -1
  68. package/dist/reduced-state-Vuud6LCM.js +0 -942
  69. package/dist/reduced-state-Vuud6LCM.js.map +0 -1
  70. package/dist/services/session-store.js.map +0 -1
  71. package/dist/session-state-BAzdzqV4.js.map +0 -1
  72. package/dist/session-store-BpitF4Wg.d.ts +0 -191
@@ -1,191 +0,0 @@
1
- import { n as CommandIdempotencyKey } from "./commands-3OD-p8dD.js";
2
- import { g as SessionId, h as SequenceNumber, n as CommandId, o as DurablePosition, v as SummaryId } from "./core-BcimKMIv.js";
3
- import { t as DurableEventEnvelope } from "./envelope-Che6KatU.js";
4
- import { H as DecodedDurableEvent } from "./durable-CKdCCqhw.js";
5
- import "./events-BWuvzVml.js";
6
- import { r as CompactionSummaryArtifact } from "./context-projection-D_uRtK3r.js";
7
- import * as Context from "effect/Context";
8
- import * as Effect from "effect/Effect";
9
- import * as Layer from "effect/Layer";
10
- import * as Schema from "effect/Schema";
11
- import * as Stream from "effect/Stream";
12
- import * as Cause from "effect/Cause";
13
- //#region src/services/session-store.d.ts
14
- type CommittedDurableEvent<E = DecodedDurableEvent> = {
15
- readonly position: typeof DurablePosition.Type;
16
- readonly event: E;
17
- };
18
- /** A durable event after the store has assigned its replay position. */
19
- declare const CommittedDurableEvent: Schema.Codec<CommittedDurableEvent, {
20
- readonly position: typeof DurablePosition.Encoded;
21
- readonly event: typeof DurableEventEnvelope.Encoded;
22
- }, never, never>;
23
- declare const EDASessionStoreError_base: Schema.Class<EDASessionStoreError, Schema.TaggedStruct<"EDASessionStoreError", {
24
- readonly message: Schema.String;
25
- }>, Cause.YieldableError>;
26
- /**
27
- * Store-level failure surfaced by durable append, replay, and hydration APIs.
28
- *
29
- * The error intentionally stays storage-semantic rather than SQL-specific so
30
- * framework services can treat SQL-backed hosts, in-memory tests, and future adapters
31
- * as the same durability boundary.
32
- */
33
- declare class EDASessionStoreError extends EDASessionStoreError_base {}
34
- /** True when a Cause contains an escaped durable-store failure. */
35
- declare const hasEDASessionStoreError: (cause: Cause.Cause<unknown>) => boolean;
36
- /**
37
- * One logical event to persist in the durable session log.
38
- *
39
- * Store adapters may split large logical payload fields into sidecar rows after
40
- * the event insert assigns `seq`, but callers still provide one fat event.
41
- */
42
- declare const DurableAppendEntry: Schema.Struct<{
43
- readonly event: Schema.Struct<{
44
- readonly namespace: Schema.NonEmptyString;
45
- readonly type: Schema.NonEmptyString;
46
- readonly schemaVersion: Schema.Int;
47
- readonly eventId: Schema.brand<Schema.String, "EventId">;
48
- readonly sessionId: Schema.brand<Schema.String, "SessionId">;
49
- readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
50
- readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
51
- readonly trace: Schema.withConstructorDefault<Schema.Struct<{
52
- readonly span: Schema.Struct<{
53
- readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
54
- readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
55
- readonly sampled: Schema.Boolean;
56
- readonly tracestate: Schema.NullOr<Schema.String>;
57
- }>;
58
- readonly links: Schema.$Array<Schema.Struct<{
59
- readonly context: Schema.Struct<{
60
- readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
61
- readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
62
- readonly sampled: Schema.Boolean;
63
- readonly tracestate: Schema.NullOr<Schema.String>;
64
- }>;
65
- readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
66
- }>>;
67
- }>>;
68
- readonly payload: Schema.Unknown;
69
- readonly durability: Schema.Literal<"durable">;
70
- }>;
71
- }>;
72
- type DurableAppendEntry = typeof DurableAppendEntry.Type;
73
- /**
74
- * Ordered durable append intent. Adapters assign positions in entry order.
75
- *
76
- * This is the single write shape exposed to framework services. It avoids raw
77
- * SQL and public transaction callbacks while still expressing the full atomic
78
- * transition EDA needs for events, normalized bodies, and metadata.
79
- */
80
- declare const DurableAppendBatch: Schema.Struct<{
81
- readonly entries: Schema.$Array<Schema.Struct<{
82
- readonly event: Schema.Struct<{
83
- readonly namespace: Schema.NonEmptyString;
84
- readonly type: Schema.NonEmptyString;
85
- readonly schemaVersion: Schema.Int;
86
- readonly eventId: Schema.brand<Schema.String, "EventId">;
87
- readonly sessionId: Schema.brand<Schema.String, "SessionId">;
88
- readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
89
- readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
90
- readonly trace: Schema.withConstructorDefault<Schema.Struct<{
91
- readonly span: Schema.Struct<{
92
- readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
93
- readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
94
- readonly sampled: Schema.Boolean;
95
- readonly tracestate: Schema.NullOr<Schema.String>;
96
- }>;
97
- readonly links: Schema.$Array<Schema.Struct<{
98
- readonly context: Schema.Struct<{
99
- readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
100
- readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
101
- readonly sampled: Schema.Boolean;
102
- readonly tracestate: Schema.NullOr<Schema.String>;
103
- }>;
104
- readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
105
- }>>;
106
- }>>;
107
- readonly payload: Schema.Unknown;
108
- readonly durability: Schema.Literal<"durable">;
109
- }>;
110
- }>>;
111
- }>;
112
- type DurableAppendBatch = typeof DurableAppendBatch.Type;
113
- /** Durable reducer checkpoint row used to hydrate framework and app projections cheaply. */
114
- interface EDAReducerCheckpoint {
115
- readonly name: string;
116
- readonly schemaVersion: number;
117
- readonly throughSeq: SequenceNumber;
118
- readonly payload: unknown;
119
- readonly updatedAtMs: number;
120
- }
121
- /** Input for writing one durable reducer checkpoint. */
122
- interface SaveReducerCheckpointInput {
123
- readonly name: string;
124
- readonly schemaVersion: number;
125
- readonly throughSeq: SequenceNumber;
126
- readonly payload: unknown;
127
- readonly updatedAtMs: number;
128
- }
129
- /** Indexed command-admission lookup used for idempotent ingress. */
130
- declare const FindCommandAdmissionInput: Schema.Struct<{
131
- readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
132
- readonly idempotencyKey: Schema.optionalKey<Schema.String>;
133
- }>;
134
- /** Typed command-admission lookup accepted by the semantic store port. */
135
- interface FindCommandAdmissionInput {
136
- readonly commandId?: CommandId;
137
- readonly idempotencyKey?: CommandIdempotencyKey;
138
- }
139
- /** Semantic durable store contract for one EDA session. */
140
- interface EDASessionStoreShape {
141
- /**
142
- * Append durable logical events atomically, preserving input order.
143
- *
144
- * Implementations must be idempotent by `eventId`: duplicates return the
145
- * original committed position and do not advance the durable head. Live publish
146
- * remains outside the store and is owned by `SessionState` after this succeeds.
147
- */
148
- readonly append: (batch: DurableAppendBatch) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
149
- /** Replay committed durable events with `seq > afterSeq`. */
150
- readonly eventsAfter: (afterSeq: SequenceNumber) => Stream.Stream<CommittedDurableEvent, EDASessionStoreError>;
151
- /** Load committed durable events by exact sequence number for checkpoint pointer hydration. */
152
- readonly loadCommittedEventsBySeq: (seqs: ReadonlyArray<SequenceNumber>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
153
- /** Lookup an admitted command without replaying the full journal. */
154
- readonly findCommandAdmission: (input: FindCommandAdmissionInput) => Effect.Effect<CommittedDurableEvent | undefined, EDASessionStoreError>;
155
- /** Load one compacted summary artifact body by id, if it has been saved. */
156
- readonly loadSummaryArtifact: (summaryId: SummaryId) => Effect.Effect<CompactionSummaryArtifact | undefined, EDASessionStoreError>;
157
- /** Load one framework or app reducer checkpoint, if it has been saved. */
158
- readonly loadReducerCheckpoint: (name: string) => Effect.Effect<EDAReducerCheckpoint | undefined, EDASessionStoreError>;
159
- /** Persist one framework or app reducer checkpoint as a derived cache. */
160
- readonly saveReducerCheckpoint: (checkpoint: SaveReducerCheckpointInput) => Effect.Effect<void, EDASessionStoreError>;
161
- /** Persist a reducer checkpoint snapshot atomically across framework and app reducers. */
162
- readonly saveReducerCheckpoints: (checkpoints: ReadonlyArray<SaveReducerCheckpointInput>) => Effect.Effect<void, EDASessionStoreError>;
163
- }
164
- declare const EDASessionStore_base: Context.ServiceClass<EDASessionStore, "@effect-durable-agent/EDASessionStore", EDASessionStoreShape>;
165
- /**
166
- * SQL-agnostic durable storage port for one EDA session.
167
- *
168
- * Framework services depend on this semantic port rather than raw SQL. Host
169
- * adapters own physical tables and synchronous transaction mechanics; callers
170
- * only express durable append/replay/lookup intent.
171
- */
172
- declare class EDASessionStore extends EDASessionStore_base {
173
- /** Deterministic in-memory implementation used by runtime and recovery tests. */
174
- static readonly InMemory: (sessionId: SessionId) => Layer.Layer<EDASessionStore, never, never>;
175
- /** In-memory store seeded with a durable prefix; intended for recovery tests. */
176
- static readonly InMemorySeeded: (sessionId: SessionId, events: ReadonlyArray<DurableEventEnvelope>) => Layer.Layer<EDASessionStore, never, never>;
177
- }
178
- /** App schemas are registered once; known namespaces fail at the store boundary when malformed. */
179
- type EDAAppEvents = Schema.Codec<DurableEventEnvelope, unknown, never, never>;
180
- /** Attach the app decoder to every event-returning store operation without changing storage bytes. */
181
- declare const registerAppEvents: (store: EDASessionStoreShape, schema: EDAAppEvents) => EDASessionStoreShape;
182
- /** Narrow an already decoded fact from one schema, without decoding its payload again. */
183
- declare const selectCommittedEvent: <E extends DurableEventEnvelope>(schema: Schema.Codec<E, unknown, never, never>, entry: CommittedDurableEvent) => CommittedDurableEvent<E> | undefined;
184
- /** Typed journal read available to tools and application services without private SQL access. */
185
- declare const queryCommittedEvents: <E extends DurableEventEnvelope>(store: EDASessionStoreShape, schema: Schema.Codec<E, unknown, never, never>, options?: {
186
- readonly afterSeq?: SequenceNumber;
187
- readonly limit?: number;
188
- }) => Effect.Effect<ReadonlyArray<CommittedDurableEvent<E>>, EDASessionStoreError>;
189
- //#endregion
190
- export { EDAReducerCheckpoint as a, EDASessionStoreShape as c, hasEDASessionStoreError as d, queryCommittedEvents as f, EDAAppEvents as i, FindCommandAdmissionInput as l, selectCommittedEvent as m, DurableAppendBatch as n, EDASessionStore as o, registerAppEvents as p, DurableAppendEntry as r, EDASessionStoreError as s, CommittedDurableEvent as t, SaveReducerCheckpointInput as u };
191
- //# sourceMappingURL=session-store-BpitF4Wg.d.ts.map