effect-durable-agent 0.1.0-alpha.13 → 0.1.0-alpha.15
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/dist/{compaction-CYItD6di.d.ts → compaction-DYAlYxx5.d.ts} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/{runtime-BRURBOyt.d.ts → runtime-Ca8Qw1fl.d.ts} +3 -3
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +4 -4
- package/dist/services/runtime-layer.js +2 -2
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +1 -1
- package/dist/services/session-query.d.ts +1 -1
- package/dist/services/session-query.js +1 -2
- package/dist/services/session-query.js.map +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/sink-registry.d.ts +2 -2
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/span-names.d.ts +1 -1
- package/dist/services/span-names.js +1 -0
- package/dist/services/span-names.js.map +1 -1
- package/dist/{session-query-Dzdcr2xL.d.ts → session-query-dlbwukcq.d.ts} +2 -3
- package/dist/{session-state-Cm5sXbZW.d.ts → session-state-Cb_8YOre.d.ts} +35 -7
- package/dist/{session-state-DfYX21mA.js → session-state-Dk7Iie-r.js} +59 -9
- package/dist/session-state-Dk7Iie-r.js.map +1 -0
- package/dist/{sink-registry-CT3C3N5R.js → sink-registry-C2XFRBEV.js} +163 -135
- package/dist/sink-registry-C2XFRBEV.js.map +1 -0
- package/dist/{sink-registry-CU-WMK96.d.ts → sink-registry-DiZyYd5f.d.ts} +44 -41
- package/dist/testkit/layers.d.ts +5 -5
- package/dist/testkit/layers.js +2 -2
- package/package.json +1 -1
- package/dist/session-state-DfYX21mA.js.map +0 -1
- package/dist/sink-registry-CT3C3N5R.js.map +0 -1
|
@@ -1,57 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as EventId, g as SessionId, h as SequenceNumber } from "./core-C-6xHzRx.js";
|
|
2
2
|
import { S as ReducedState } from "./command-queues-CSEl1yrH.js";
|
|
3
3
|
import { d as PositionedEvent, n as EphemeralEventEnvelope, o as EventType, t as DurableEventEnvelope } from "./envelope-DkZyMIgp.js";
|
|
4
4
|
import { a as EDASessionStore, o as EDASessionStoreError, t as CommittedDurableEvent } from "./session-store-DCs--1kc.js";
|
|
5
5
|
import { t as IdGenerator } from "./id-generator--x6itQZ2.js";
|
|
6
6
|
import { n as EventFactoryShape, r as SessionContext, t as EventFactory } from "./event-factory-EL4szNWm.js";
|
|
7
7
|
import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
|
|
8
|
-
import { t as SessionEventObserver } from "./session-event-observer-DaFMKKNc.js";
|
|
9
8
|
import { a as EDAReducerStateSnapshot, r as EDAReducerRegistry } from "./reducer-registry-BgtK0NuX.js";
|
|
10
9
|
import { n as SinkCheckpointStore } from "./sink-checkpoint-store-CasqHvDz.js";
|
|
11
10
|
import * as Context from "effect/Context";
|
|
12
11
|
import * as Effect from "effect/Effect";
|
|
13
12
|
import * as Layer from "effect/Layer";
|
|
14
13
|
import * as Schema from "effect/Schema";
|
|
15
|
-
import * as Stream from "effect/Stream";
|
|
16
14
|
import * as Scope from "effect/Scope";
|
|
17
|
-
import * as PubSub from "effect/PubSub";
|
|
18
15
|
|
|
19
|
-
//#region src/services/live-event-bus.d.ts
|
|
20
|
-
/** Live-only replay buffer for the currently open turn. */
|
|
21
|
-
interface ActiveTurnEphemeralReplay {
|
|
22
|
-
readonly turnId?: TurnId;
|
|
23
|
-
readonly events: ReadonlyArray<PositionedEvent>;
|
|
24
|
-
readonly overflowed: boolean;
|
|
25
|
-
}
|
|
26
|
-
/** In-memory live fanout plus active-turn replay source for reconnect streams. */
|
|
27
|
-
interface LiveEventBusShape {
|
|
28
|
-
readonly publish: (event: PositionedEvent) => Effect.Effect<boolean>;
|
|
29
|
-
readonly subscribe: () => Effect.Effect<Stream.Stream<PositionedEvent>, never, Scope.Scope>;
|
|
30
|
-
readonly subscribeQueue: () => Effect.Effect<PubSub.Subscription<PositionedEvent>, never, Scope.Scope>;
|
|
31
|
-
/** Snapshot raw live-only events retained for the currently open turn. */
|
|
32
|
-
readonly activeTurnReplay: () => Effect.Effect<ActiveTurnEphemeralReplay>;
|
|
33
|
-
}
|
|
34
|
-
declare const LiveEventBus_base: Context.ServiceClass<LiveEventBus, "@effect-durable-agent/LiveEventBus", LiveEventBusShape>;
|
|
35
|
-
/** Unbounded in-memory fanout plus bounded active-turn ephemeral replay. */
|
|
36
|
-
declare class LiveEventBus extends LiveEventBus_base {
|
|
37
|
-
static readonly Live: Layer.Layer<LiveEventBus, never, SessionEventObserver>;
|
|
38
|
-
/** Live bus for hosts that do not install an append-driven observer. */
|
|
39
|
-
static readonly Noop: Layer.Layer<LiveEventBus, never, never>;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
16
|
//#region src/services/sink-registry.d.ts
|
|
43
17
|
/** Cursor-window input delivered to one durable sink drain. */
|
|
44
|
-
interface
|
|
18
|
+
interface EDASinkRawDurableBatch {
|
|
45
19
|
/** All durable events replayed for this cursor window, including uninterested events. */
|
|
46
20
|
readonly allEvents: ReadonlyArray<CommittedDurableEvent>;
|
|
47
21
|
/** Events matching the sink's durable interests. */
|
|
48
22
|
readonly events: ReadonlyArray<CommittedDurableEvent>;
|
|
23
|
+
/** Durable sequence through which the sink may advance after success. */
|
|
24
|
+
readonly throughSeq: SequenceNumber;
|
|
25
|
+
}
|
|
26
|
+
/** Cursor window with framework and app projections, enabled by default. */
|
|
27
|
+
interface EDASinkDurableBatch extends EDASinkRawDurableBatch {
|
|
49
28
|
/** Authoritative reduced state folded exactly through `throughSeq`. */
|
|
50
29
|
readonly stateAfter: ReducedState;
|
|
51
30
|
/** App-specific durable reducer states folded exactly through `throughSeq`. */
|
|
52
31
|
readonly reducerStates: EDAReducerStateSnapshot;
|
|
53
|
-
/** Durable sequence through which the sink may advance after success. */
|
|
54
|
-
readonly throughSeq: SequenceNumber;
|
|
55
32
|
}
|
|
56
33
|
/** Typed, sink-owned durable state stored independently from cursor advancement. */
|
|
57
34
|
interface EDASinkCheckpoint {
|
|
@@ -76,15 +53,26 @@ interface EDASinkContext {
|
|
|
76
53
|
/** Fork background sink work into the session scope. */
|
|
77
54
|
readonly forkScoped: (effect: Effect.Effect<unknown, unknown>) => Effect.Effect<void>;
|
|
78
55
|
}
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
56
|
+
/** `"*"` and omission select every event; an array selects exact event types. */
|
|
57
|
+
type EDASinkInterests = "*" | ReadonlyArray<EventType | string>;
|
|
58
|
+
/** Delivery policy shared by raw and projected durable consumers. */
|
|
59
|
+
interface EDADurableSinkOptions {
|
|
60
|
+
readonly interests?: EDASinkInterests;
|
|
82
61
|
readonly batchSize?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Default durable consumer with framework and app projections at each cursor window. */
|
|
64
|
+
interface EDAProjectedDurableSinkDefinition extends EDADurableSinkOptions {
|
|
83
65
|
readonly process: (batch: EDASinkDurableBatch, ctx: EDASinkContext) => Effect.Effect<void, never>;
|
|
84
66
|
}
|
|
67
|
+
/** Raw consumer that never hydrates, folds, or retains a session projection. */
|
|
68
|
+
interface EDARawDurableSinkDefinition extends EDADurableSinkOptions {
|
|
69
|
+
readonly process: (batch: EDASinkRawDurableBatch, ctx: EDASinkContext) => Effect.Effect<void, never>;
|
|
70
|
+
}
|
|
71
|
+
/** Durable sink definition backed by a checkpoint and an app-owned delivery policy. */
|
|
72
|
+
type EDADurableSinkDefinition = EDAProjectedDurableSinkDefinition;
|
|
85
73
|
/** Best-effort live-only sink definition. */
|
|
86
74
|
interface EDAEphemeralSinkDefinition {
|
|
87
|
-
readonly interests?:
|
|
75
|
+
readonly interests?: EDASinkInterests;
|
|
88
76
|
readonly process: (event: PositionedEvent, ctx: EDASinkContext) => Effect.Effect<void, never>;
|
|
89
77
|
}
|
|
90
78
|
/**
|
|
@@ -96,14 +84,29 @@ interface EDAEphemeralSinkDefinition {
|
|
|
96
84
|
* advances. Ephemeral callbacks are best-effort and are only processed after the
|
|
97
85
|
* durable prefix at their anchor sequence has been projected.
|
|
98
86
|
*/
|
|
99
|
-
interface
|
|
87
|
+
interface EDASinkOptions {
|
|
100
88
|
readonly name: string;
|
|
101
|
-
readonly durable?: EDADurableSinkDefinition;
|
|
102
89
|
readonly ephemeral?: EDAEphemeralSinkDefinition;
|
|
103
90
|
}
|
|
91
|
+
/** Existing consumers receive framework and app projections unless explicitly opted out. */
|
|
92
|
+
interface EDAProjectedSink extends EDASinkOptions {
|
|
93
|
+
readonly state?: "projected";
|
|
94
|
+
readonly durable?: EDAProjectedDurableSinkDefinition;
|
|
95
|
+
}
|
|
96
|
+
/** Raw consumers retain only their cursor and sink-owned checkpoint payload. */
|
|
97
|
+
interface EDARawSink extends EDASinkOptions {
|
|
98
|
+
readonly state: "none";
|
|
99
|
+
readonly durable?: EDARawDurableSinkDefinition;
|
|
100
|
+
}
|
|
101
|
+
/** The outer discriminant preserves contextual callback typing for inline default sinks. */
|
|
102
|
+
type EDASink = EDAProjectedSink | EDARawSink;
|
|
103
|
+
/** Projected and raw overloads preserve contextual callback inference and literal names. */
|
|
104
|
+
declare function makeSink<const Sink extends EDAProjectedSink>(sink: Sink): Sink;
|
|
105
|
+
declare function makeSink<const Sink extends EDARawSink>(sink: Sink): Sink;
|
|
106
|
+
declare function makeSink<const Sink extends EDASink>(sink: Sink): Sink;
|
|
104
107
|
/** Convenience constructor preserving a sink's literal name/type information. */
|
|
105
108
|
declare const EDASink: {
|
|
106
|
-
make:
|
|
109
|
+
make: typeof makeSink;
|
|
107
110
|
};
|
|
108
111
|
/** Session-owned capabilities needed to start all registered sink runners. */
|
|
109
112
|
interface EDASinkRunnerStartInput {
|
|
@@ -124,14 +127,14 @@ interface EDASinkRegistryShape {
|
|
|
124
127
|
/** Coalesced non-blocking nudge that the durable log head advanced. */
|
|
125
128
|
readonly notifyDurableHeadAdvanced: (head: SequenceNumber) => Effect.Effect<void>;
|
|
126
129
|
/** Best-effort non-blocking delivery to ephemeral sink workers. */
|
|
127
|
-
readonly publishEphemeralToSinks: (event: PositionedEvent
|
|
130
|
+
readonly publishEphemeralToSinks: (event: PositionedEvent) => Effect.Effect<void>;
|
|
128
131
|
}
|
|
129
132
|
declare const EDASinkRegistry_base: Context.ServiceClass<EDASinkRegistry, "@effect-durable-agent/EDASinkRegistry", EDASinkRegistryShape>;
|
|
130
133
|
/** Registry and runner for app-provided EDA sinks. */
|
|
131
134
|
declare class EDASinkRegistry extends EDASinkRegistry_base {
|
|
132
135
|
static readonly Empty: Layer.Layer<EDASinkRegistry, never, never>;
|
|
133
|
-
static readonly Live: (sinks: ReadonlyArray<EDASink>) => Layer.Layer<EDASinkRegistry, never,
|
|
136
|
+
static readonly Live: (sinks: ReadonlyArray<EDASink>) => Layer.Layer<EDASinkRegistry, never, EDAReducerRegistry | IdGenerator | EDAKeepAlive | EDASessionStore | SinkCheckpointStore | EventFactory | SessionContext>;
|
|
134
137
|
}
|
|
135
138
|
//#endregion
|
|
136
|
-
export {
|
|
137
|
-
//# sourceMappingURL=sink-registry-
|
|
139
|
+
export { EDARawDurableSinkDefinition as a, EDASinkCheckpoint as c, EDASinkInterests as d, EDASinkRawDurableBatch as f, EDASinkRunnerStartInput as h, EDAProjectedSink as i, EDASinkContext as l, EDASinkRegistryShape as m, EDAEphemeralSinkDefinition as n, EDARawSink as o, EDASinkRegistry as p, EDAProjectedDurableSinkDefinition as r, EDASink as s, EDADurableSinkDefinition as t, EDASinkDurableBatch as u };
|
|
140
|
+
//# sourceMappingURL=sink-registry-DiZyYd5f.d.ts.map
|
package/dist/testkit/layers.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ import { t as ModelResolver } from "../model-resolver-BPPJAsuh.js";
|
|
|
5
5
|
import { t as IdGenerator } from "../id-generator--x6itQZ2.js";
|
|
6
6
|
import { r as SessionContext, t as EventFactory } from "../event-factory-EL4szNWm.js";
|
|
7
7
|
import { t as EDAKeepAlive } from "../keep-alive-Chl5SJxy.js";
|
|
8
|
-
import { c as CompactionPolicy, d as CompactionRunner, r as CompactionExecutor } from "../compaction-
|
|
9
|
-
import {
|
|
8
|
+
import { c as CompactionPolicy, d as CompactionRunner, r as CompactionExecutor } from "../compaction-DYAlYxx5.js";
|
|
9
|
+
import { C as LiveEventBus, S as ToolExecutor, b as InferenceRunner, h as SessionState, x as InferenceRunnerStreamPart, y as TurnRunner } from "../session-state-Cb_8YOre.js";
|
|
10
10
|
import { r as EDAReducerRegistry, t as EDAReducer } from "../reducer-registry-BgtK0NuX.js";
|
|
11
11
|
import { r as EDAPromptProjector } from "../prompt-projector-_Zxe7dlE.js";
|
|
12
12
|
import { n as SinkCheckpointStore } from "../sink-checkpoint-store-CasqHvDz.js";
|
|
13
|
+
import { p as EDASinkRegistry, s as EDASink } from "../sink-registry-DiZyYd5f.js";
|
|
13
14
|
import { t as RunScheduler } from "../run-scheduler-BBqZ0Ate.js";
|
|
14
15
|
import { t as RunSchedulingWakeup } from "../run-scheduling-wakeup-DRYZztL6.js";
|
|
15
|
-
import { S as ToolExecutor, b as InferenceRunner, h as SessionState, x as InferenceRunnerStreamPart, y as TurnRunner } from "../session-state-Cm5sXbZW.js";
|
|
16
16
|
import { a as ToolParamsSchema, r as EDAToolRegistry, t as EDAModelToolkit } from "../tool-registry-CHMtDCJ5.js";
|
|
17
|
-
import { n as EDASessionQuery } from "../session-query-
|
|
17
|
+
import { n as EDASessionQuery } from "../session-query-dlbwukcq.js";
|
|
18
18
|
import * as Layer from "effect/Layer";
|
|
19
19
|
import * as LanguageModel from "effect/unstable/ai/LanguageModel";
|
|
20
20
|
import * as Stream from "effect/Stream";
|
|
@@ -105,7 +105,7 @@ interface EdaTestLayerOptions {
|
|
|
105
105
|
* EDA service plus the fixed Clock. Layer constants are shared by reference,
|
|
106
106
|
* so all services see the same store, bus, and ID counter.
|
|
107
107
|
*/
|
|
108
|
-
declare const makeEdaTestLayer: (options: EdaTestLayerOptions) => Layer.Layer<
|
|
108
|
+
declare const makeEdaTestLayer: (options: EdaTestLayerOptions) => Layer.Layer<EDAReducerRegistry | RunSchedulingWakeup | RunScheduler | ModelResolver | IdGenerator | EDASessionQuery | SessionState | EDAKeepAlive | CompactionExecutor | CompactionPolicy | EDAPromptProjector | EDASessionStore | SinkCheckpointStore | CompactionRunner | EventFactory | EDASinkRegistry | SessionContext | LiveEventBus | TurnRunner | InferenceRunner | ToolExecutor | EDAToolRegistry, EDASessionStoreError, never>;
|
|
109
109
|
//#endregion
|
|
110
110
|
export { EdaTestLayerOptions, FixedClock, TestLanguageModelOptions, TestModelParts, makeEdaTestLayer, makeFixedClock, makeLanguageModelLayer, testNowMs };
|
|
111
111
|
//# sourceMappingURL=layers.d.ts.map
|
package/dist/testkit/layers.js
CHANGED
|
@@ -2,15 +2,15 @@ import { RunSchedulingWakeup } from "../services/run-scheduling-wakeup.js";
|
|
|
2
2
|
import { RunScheduler } from "../services/run-scheduler.js";
|
|
3
3
|
import { ModelResolver } from "../services/model-resolver.js";
|
|
4
4
|
import { h as UnixEpochMillis } from "../envelope-DxQzo5rN.js";
|
|
5
|
-
import { d as TurnRunner, f as InferenceRunner, p as ToolExecutor, u as SessionState } from "../session-state-
|
|
5
|
+
import { d as TurnRunner, f as InferenceRunner, m as LiveEventBus, p as ToolExecutor, u as SessionState } from "../session-state-Dk7Iie-r.js";
|
|
6
6
|
import { EDASessionStore } from "../services/session-store.js";
|
|
7
7
|
import { a as CompactionPolicy, n as CompactionExecutor, o as CompactionRunner } from "../compaction-0k8zCJgB.js";
|
|
8
8
|
import { IdGenerator } from "../services/id-generator.js";
|
|
9
9
|
import { n as SessionContext, t as EventFactory } from "../event-factory-QuC_UvyP.js";
|
|
10
10
|
import { EDAKeepAlive } from "../services/keep-alive.js";
|
|
11
|
-
import { n as EDASinkRegistry, r as LiveEventBus } from "../sink-registry-CT3C3N5R.js";
|
|
12
11
|
import { EDAPromptProjector } from "../services/prompt-projector.js";
|
|
13
12
|
import { EDAReducerRegistry } from "../services/reducer-registry.js";
|
|
13
|
+
import { n as EDASinkRegistry } from "../sink-registry-C2XFRBEV.js";
|
|
14
14
|
import { SinkCheckpointStore } from "../services/sink-checkpoint-store.js";
|
|
15
15
|
import { EDAToolRegistry } from "../services/tool-registry.js";
|
|
16
16
|
import { EDASessionQuery } from "../services/session-query.js";
|
package/package.json
CHANGED