effect-durable-agent 0.1.0-alpha.16 → 0.1.0-alpha.18
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-CCdfxYkq.js → compaction-Db6eoLce.js} +3 -3
- package/dist/{compaction-CCdfxYkq.js.map → compaction-Db6eoLce.js.map} +1 -1
- package/dist/{context-projection-C43pyxn2.d.ts → context-projection-Dr_kA41k.d.ts} +3 -3
- package/dist/domain/command-queues.d.ts +82 -2
- package/dist/domain/context-projection.d.ts +1 -1
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/model-usage.d.ts +1 -1
- package/dist/domain/model-usage.js +1 -1
- package/dist/domain/reduced-state-schema.d.ts +3 -992
- package/dist/domain/reduced-state-schema.js +116 -4
- package/dist/domain/reduced-state-schema.js.map +1 -1
- package/dist/domain/reduced-state.d.ts +2 -2
- package/dist/domain/reduced-state.js +1 -1
- package/dist/domain/run-scheduling.d.ts +1 -1
- package/dist/{durable-D_tjjz4B.js → durable-DRY7AcsF.js} +59 -40
- package/dist/durable-DRY7AcsF.js.map +1 -0
- package/dist/{durable-RSiz3YBK.d.ts → durable-DeQBR5wA.d.ts} +4266 -235
- package/dist/{envelope-DxQzo5rN.js → envelope-BCzKUq_z.js} +12 -3
- package/dist/envelope-BCzKUq_z.js.map +1 -0
- package/dist/{envelope-DkZyMIgp.d.ts → envelope-VXFEC8zr.d.ts} +68 -4
- package/dist/{event-factory-CX0_laE5.js → event-factory-CKuWhjS4.js} +3 -3
- package/dist/{event-factory-CX0_laE5.js.map → event-factory-CKuWhjS4.js.map} +1 -1
- package/dist/{events-LZFNoESe.d.ts → events-D3OAPXgS.d.ts} +22 -22
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/{model-resolver-BPPJAsuh.d.ts → model-resolver-ci5D5WQv.d.ts} +2 -2
- package/dist/{model-usage-CdBEkTwU.d.ts → model-usage-CNcnhj72.d.ts} +2 -2
- package/dist/{reduced-state-BAKvToAh.js → reduced-state-DFIYylAq.js} +55 -56
- package/dist/reduced-state-DFIYylAq.js.map +1 -0
- package/dist/reduced-state-schema-CgW0mzpS.d.ts +2167 -0
- package/dist/reduced-state-xY-tYuGo.d.ts +47902 -0
- package/dist/{reducer-registry-BgtK0NuX.d.ts → reducer-registry-bRbc4COf.d.ts} +7 -4
- package/dist/{run-scheduling-wakeup-DRYZztL6.d.ts → run-scheduling-wakeup-CY5hfgMR.d.ts} +2 -2
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/compaction.js +1 -1
- package/dist/services/model-resolver.d.ts +1 -1
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/reducer-registry.d.ts +1 -1
- package/dist/services/reducer-registry.js +19 -6
- package/dist/services/reducer-registry.js.map +1 -1
- package/dist/services/run-scheduler.d.ts +1 -2
- package/dist/services/run-scheduling-wakeup.d.ts +1 -1
- package/dist/services/runtime-layer.d.ts +11 -13
- package/dist/services/runtime-layer.js +11 -7
- package/dist/services/runtime-layer.js.map +1 -1
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +17 -9
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-event-observer.d.ts +1 -1
- package/dist/services/session-query.d.ts +2 -2
- package/dist/services/session-query.js +30 -13
- package/dist/services/session-query.js.map +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/session-store.d.ts +2 -2
- package/dist/services/session-store.js +84 -16
- package/dist/services/session-store.js.map +1 -1
- package/dist/services/sink-checkpoint-store.d.ts +1 -1
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/tracing.d.ts +1 -1
- package/dist/{session-event-observer-DaFMKKNc.d.ts → session-event-observer-BWppl2Fr.d.ts} +2 -2
- package/dist/{session-state-CWKwjwdx.js → session-state-8PJZvuR3.js} +28 -20
- package/dist/session-state-8PJZvuR3.js.map +1 -0
- package/dist/{session-store-DCs--1kc.d.ts → session-store-CERvTeaV.d.ts} +25 -40
- package/dist/{sink-checkpoint-store-CasqHvDz.d.ts → sink-checkpoint-store-DTiswoqy.d.ts} +2 -2
- package/dist/{sink-registry-DUkifMag.js → sink-registry-B4yxTmlI.js} +33 -8
- package/dist/sink-registry-B4yxTmlI.js.map +1 -0
- package/dist/testkit/layers.d.ts +10 -16
- package/dist/testkit/layers.js +6 -6
- package/dist/testkit/layers.js.map +1 -1
- package/dist/{tool-registry-CHMtDCJ5.d.ts → tool-registry-D4ALie3K.d.ts} +11 -4
- package/dist/types/events/durable.d.ts +2 -2
- package/dist/types/events/durable.js +2 -2
- package/dist/types/events.d.ts +4 -4
- package/dist/types/events.js +3 -3
- package/dist/websocket.d.ts +66 -66
- package/dist/websocket.js +2 -2
- package/package.json +1 -1
- package/dist/command-queues-CtOtDZm3.d.ts +0 -556
- package/dist/compaction-BfzzyWko.d.ts +0 -165
- package/dist/durable-D_tjjz4B.js.map +0 -1
- package/dist/envelope-DxQzo5rN.js.map +0 -1
- package/dist/event-factory-CClLXzI9.d.ts +0 -91
- package/dist/index-BVVgDSdq.d.ts +0 -1
- package/dist/message-transcript-CEp0gCSQ.d.ts +0 -32
- package/dist/prompt-projector-Dh1-qvCH.d.ts +0 -39
- package/dist/reduced-state-BAKvToAh.js.map +0 -1
- package/dist/run-scheduler-CpPjFQD7.d.ts +0 -43
- package/dist/runtime-CX1M7jgX.d.ts +0 -69
- package/dist/session-query-BHB4OxR_.d.ts +0 -46
- package/dist/session-state-CWKwjwdx.js.map +0 -1
- package/dist/session-state-dE07Zzcr.d.ts +0 -895
- package/dist/sink-registry-CEBjrMd_.d.ts +0 -140
- package/dist/sink-registry-DUkifMag.js.map +0 -1
|
@@ -1,895 +0,0 @@
|
|
|
1
|
-
import { b as TurnId } from "./core-C-6xHzRx.js";
|
|
2
|
-
import { Q as RunGrantResult, S as ReducedState } from "./command-queues-CtOtDZm3.js";
|
|
3
|
-
import { d as PositionedEvent, l as ModelSelectionPayload, n as EphemeralEventEnvelope, t as DurableEventEnvelope, u as NonNegativeInt } from "./envelope-DkZyMIgp.js";
|
|
4
|
-
import { i as GrantRunCommand, r as EDACommand } from "./commands-p8venTWs.js";
|
|
5
|
-
import { Wt as ToolCallCreatedEvent } from "./durable-RSiz3YBK.js";
|
|
6
|
-
import { a as EDASessionStore, o as EDASessionStoreError, t as CommittedDurableEvent } from "./session-store-DCs--1kc.js";
|
|
7
|
-
import { t as ModelResolver } from "./model-resolver-BPPJAsuh.js";
|
|
8
|
-
import { t as IdGenerator } from "./id-generator--x6itQZ2.js";
|
|
9
|
-
import { r as SessionContext, t as EventFactory } from "./event-factory-CClLXzI9.js";
|
|
10
|
-
import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
|
|
11
|
-
import { d as CompactionRunner } from "./compaction-BfzzyWko.js";
|
|
12
|
-
import { t as SessionEventObserver } from "./session-event-observer-DaFMKKNc.js";
|
|
13
|
-
import { a as EDAReducerStateSnapshot, r as EDAReducerRegistry } from "./reducer-registry-BgtK0NuX.js";
|
|
14
|
-
import { r as EDAPromptProjector } from "./prompt-projector-Dh1-qvCH.js";
|
|
15
|
-
import { p as EDASinkRegistry } from "./sink-registry-CEBjrMd_.js";
|
|
16
|
-
import { t as RunScheduler } from "./run-scheduler-CpPjFQD7.js";
|
|
17
|
-
import { t as RunSchedulingWakeup } from "./run-scheduling-wakeup-DRYZztL6.js";
|
|
18
|
-
import { r as EDAToolRegistry } from "./tool-registry-CHMtDCJ5.js";
|
|
19
|
-
import * as Context from "effect/Context";
|
|
20
|
-
import * as Effect from "effect/Effect";
|
|
21
|
-
import * as Layer from "effect/Layer";
|
|
22
|
-
import * as Schema from "effect/Schema";
|
|
23
|
-
import * as Stream from "effect/Stream";
|
|
24
|
-
import * as Prompt from "effect/unstable/ai/Prompt";
|
|
25
|
-
import * as Cause from "effect/Cause";
|
|
26
|
-
import * as Scope from "effect/Scope";
|
|
27
|
-
import * as PubSub from "effect/PubSub";
|
|
28
|
-
import * as Response from "effect/unstable/ai/Response";
|
|
29
|
-
|
|
30
|
-
//#region src/services/live-event-bus.d.ts
|
|
31
|
-
/** Live-only replay buffer for the currently open turn. */
|
|
32
|
-
interface ActiveTurnEphemeralReplay {
|
|
33
|
-
readonly turnId?: TurnId;
|
|
34
|
-
readonly events: ReadonlyArray<PositionedEvent>;
|
|
35
|
-
readonly overflowed: boolean;
|
|
36
|
-
}
|
|
37
|
-
/** In-memory live fanout plus active-turn replay source for reconnect streams. */
|
|
38
|
-
interface LiveEventBusShape {
|
|
39
|
-
readonly publish: (event: PositionedEvent) => Effect.Effect<boolean>;
|
|
40
|
-
readonly subscribe: () => Effect.Effect<Stream.Stream<PositionedEvent>, never, Scope.Scope>;
|
|
41
|
-
readonly subscribeQueue: () => Effect.Effect<PubSub.Subscription<PositionedEvent>, never, Scope.Scope>;
|
|
42
|
-
/** Snapshot raw live-only events retained for the currently open turn. */
|
|
43
|
-
readonly activeTurnReplay: () => Effect.Effect<ActiveTurnEphemeralReplay>;
|
|
44
|
-
}
|
|
45
|
-
declare const LiveEventBus_base: Context.ServiceClass<LiveEventBus, "@effect-durable-agent/LiveEventBus", LiveEventBusShape>;
|
|
46
|
-
/** Unbounded in-memory fanout plus bounded active-turn ephemeral replay. */
|
|
47
|
-
declare class LiveEventBus extends LiveEventBus_base {
|
|
48
|
-
static readonly Live: Layer.Layer<LiveEventBus, never, SessionEventObserver>;
|
|
49
|
-
/** Live bus for hosts that do not install an append-driven observer. */
|
|
50
|
-
static readonly Noop: Layer.Layer<LiveEventBus, never, never>;
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/services/session-event-sink.d.ts
|
|
54
|
-
/**
|
|
55
|
-
* Narrow write/publish capability passed from `SessionState` into execution subcomponents.
|
|
56
|
-
*
|
|
57
|
-
* This intentionally excludes `snapshot`, admission, and scheduler methods so
|
|
58
|
-
* turns, inferences, and tools can emit events without becoming session-state
|
|
59
|
-
* authorities.
|
|
60
|
-
*/
|
|
61
|
-
interface SessionEventSink {
|
|
62
|
-
/** Commit one durable event through the authoritative session write path. */
|
|
63
|
-
readonly appendDurable: (event: DurableEventEnvelope) => Effect.Effect<CommittedDurableEvent, EDASessionStoreError>;
|
|
64
|
-
/** Commit an ordered durable batch through the authoritative session write path. */
|
|
65
|
-
readonly appendDurableBatch: (events: ReadonlyArray<DurableEventEnvelope>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
|
|
66
|
-
/** Position and publish a live-only event against the session's durable head. */
|
|
67
|
-
readonly publishEphemeral: (event: EphemeralEventEnvelope) => Effect.Effect<PositionedEvent, EDASessionStoreError>;
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/services/tool-executor.d.ts
|
|
71
|
-
/** Committed durable event narrowed to a framework-owned ToolCallCreated boundary. */
|
|
72
|
-
type CommittedToolCallCreated = CommittedDurableEvent & {
|
|
73
|
-
readonly event: ToolCallCreatedEvent;
|
|
74
|
-
};
|
|
75
|
-
/** Runtime input for executing one sealed tool-call decision. */
|
|
76
|
-
interface ExecuteToolCallInput {
|
|
77
|
-
readonly created: CommittedDurableEvent;
|
|
78
|
-
readonly eventSink: SessionEventSink;
|
|
79
|
-
}
|
|
80
|
-
/** Result variant for one framework tool execution attempt. */
|
|
81
|
-
declare const ToolExecutionOutcome: Schema.Union<readonly [Schema.TaggedStruct<"ToolExecutionCompleted", {
|
|
82
|
-
readonly committed: Schema.Struct<{
|
|
83
|
-
readonly position: Schema.Struct<{
|
|
84
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
85
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
86
|
-
}>;
|
|
87
|
-
readonly event: Schema.Struct<{
|
|
88
|
-
readonly durability: Schema.Literal<"durable">;
|
|
89
|
-
readonly namespace: Schema.NonEmptyString;
|
|
90
|
-
readonly type: Schema.NonEmptyString;
|
|
91
|
-
readonly schemaVersion: Schema.Int;
|
|
92
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
93
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
94
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
95
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
96
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
97
|
-
readonly span: Schema.Struct<{
|
|
98
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
99
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
100
|
-
readonly sampled: Schema.Boolean;
|
|
101
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
102
|
-
}>;
|
|
103
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
104
|
-
readonly context: Schema.Struct<{
|
|
105
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
106
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
107
|
-
readonly sampled: Schema.Boolean;
|
|
108
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
109
|
-
}>;
|
|
110
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
111
|
-
}>>;
|
|
112
|
-
}>>;
|
|
113
|
-
readonly payload: Schema.Unknown;
|
|
114
|
-
}>;
|
|
115
|
-
}>;
|
|
116
|
-
readonly result: Schema.Unknown;
|
|
117
|
-
}>, Schema.TaggedStruct<"ToolExecutionFailed", {
|
|
118
|
-
readonly committed: Schema.Struct<{
|
|
119
|
-
readonly position: Schema.Struct<{
|
|
120
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
121
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
122
|
-
}>;
|
|
123
|
-
readonly event: Schema.Struct<{
|
|
124
|
-
readonly durability: Schema.Literal<"durable">;
|
|
125
|
-
readonly namespace: Schema.NonEmptyString;
|
|
126
|
-
readonly type: Schema.NonEmptyString;
|
|
127
|
-
readonly schemaVersion: Schema.Int;
|
|
128
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
129
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
130
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
131
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
132
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
133
|
-
readonly span: Schema.Struct<{
|
|
134
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
135
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
136
|
-
readonly sampled: Schema.Boolean;
|
|
137
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
138
|
-
}>;
|
|
139
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
140
|
-
readonly context: Schema.Struct<{
|
|
141
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
142
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
143
|
-
readonly sampled: Schema.Boolean;
|
|
144
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
145
|
-
}>;
|
|
146
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
147
|
-
}>>;
|
|
148
|
-
}>>;
|
|
149
|
-
readonly payload: Schema.Unknown;
|
|
150
|
-
}>;
|
|
151
|
-
}>;
|
|
152
|
-
}>, Schema.TaggedStruct<"ToolExecutionSkipped", {
|
|
153
|
-
readonly reason: Schema.Literal<"provider-executed">;
|
|
154
|
-
}>]>;
|
|
155
|
-
type ToolExecutionOutcome = typeof ToolExecutionOutcome.Type;
|
|
156
|
-
/** Execution result paired with the committed ToolCallCreated event that caused it. */
|
|
157
|
-
interface ToolExecutionResult {
|
|
158
|
-
readonly created: CommittedToolCallCreated;
|
|
159
|
-
readonly outcome: ToolExecutionOutcome;
|
|
160
|
-
}
|
|
161
|
-
declare const ToolExecutionEventNotCreated_base: Schema.Class<ToolExecutionEventNotCreated, Schema.TaggedStruct<"ToolExecutionEventNotCreated", {
|
|
162
|
-
readonly eventType: Schema.String;
|
|
163
|
-
}>, Cause.YieldableError>;
|
|
164
|
-
/** Failure when tool execution receives a committed event that is not ToolCallCreated. */
|
|
165
|
-
declare class ToolExecutionEventNotCreated extends ToolExecutionEventNotCreated_base {}
|
|
166
|
-
/** Error surface for validating and committing framework tool execution. */
|
|
167
|
-
type ToolExecutorError = ToolExecutionEventNotCreated | EDASessionStoreError;
|
|
168
|
-
/** Runtime service that executes sealed framework-owned tool calls. */
|
|
169
|
-
interface ToolExecutorShape {
|
|
170
|
-
/** Execute one sealed, framework-owned ToolCallCreated event. */
|
|
171
|
-
readonly executeCreated: (input: ExecuteToolCallInput) => Effect.Effect<ToolExecutionResult, ToolExecutorError>;
|
|
172
|
-
}
|
|
173
|
-
declare const ToolExecutor_base: Context.ServiceClass<ToolExecutor, "@effect-durable-agent/ToolExecutor", ToolExecutorShape>;
|
|
174
|
-
/** Executes sealed framework-owned tool calls and commits tool lifecycle boundaries. */
|
|
175
|
-
declare class ToolExecutor extends ToolExecutor_base {
|
|
176
|
-
static readonly Live: Layer.Layer<ToolExecutor, never, SessionContext | EventFactory | IdGenerator | EDAToolRegistry>;
|
|
177
|
-
}
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/services/inference-runner.d.ts
|
|
180
|
-
/** Provider stream parts this runner explicitly handles or rejects with policy. */
|
|
181
|
-
type InferenceRunnerStreamPart = Response.TextStartPart | Response.TextDeltaPart | Response.TextEndPart | Response.ReasoningStartPart | Response.ReasoningDeltaPart | Response.ReasoningEndPart | Response.ToolParamsStartPart | Response.ToolParamsDeltaPart | Response.ToolParamsEndPart | Response.ToolCallPart<string, unknown> | Response.ToolResultPart<string, unknown, unknown> | Response.ToolApprovalRequestPart | Response.FilePart | Response.DocumentSourcePart | Response.UrlSourcePart | Response.ResponseMetadataPart | Response.FinishPart | Response.ErrorPart;
|
|
182
|
-
/** Input identity for running one model inference stream. */
|
|
183
|
-
declare const RunInferenceContext: Schema.Struct<{
|
|
184
|
-
readonly runId: Schema.brand<Schema.String, "RunId">;
|
|
185
|
-
readonly turnId: Schema.brand<Schema.String, "TurnId">;
|
|
186
|
-
readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
|
|
187
|
-
}>;
|
|
188
|
-
type RunInferenceContext = typeof RunInferenceContext.Type;
|
|
189
|
-
/** Effectful inputs for running one provider inference stream. */
|
|
190
|
-
interface RunInferenceInput extends RunInferenceContext {
|
|
191
|
-
readonly prompt: Prompt.RawInput;
|
|
192
|
-
readonly eventSink: SessionEventSink;
|
|
193
|
-
readonly modelSelection?: ModelSelectionPayload;
|
|
194
|
-
}
|
|
195
|
-
/** Summary returned after one provider inference stream is consumed. */
|
|
196
|
-
declare const InferenceRunResult: Schema.Struct<{
|
|
197
|
-
readonly started: Schema.Struct<{
|
|
198
|
-
readonly position: Schema.Struct<{
|
|
199
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
200
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
201
|
-
}>;
|
|
202
|
-
readonly event: Schema.Struct<{
|
|
203
|
-
readonly durability: Schema.Literal<"durable">;
|
|
204
|
-
readonly namespace: Schema.NonEmptyString;
|
|
205
|
-
readonly type: Schema.NonEmptyString;
|
|
206
|
-
readonly schemaVersion: Schema.Int;
|
|
207
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
208
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
209
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
210
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
211
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
212
|
-
readonly span: Schema.Struct<{
|
|
213
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
214
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
215
|
-
readonly sampled: Schema.Boolean;
|
|
216
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
217
|
-
}>;
|
|
218
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
219
|
-
readonly context: Schema.Struct<{
|
|
220
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
221
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
222
|
-
readonly sampled: Schema.Boolean;
|
|
223
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
224
|
-
}>;
|
|
225
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
226
|
-
}>>;
|
|
227
|
-
}>>;
|
|
228
|
-
readonly payload: Schema.Unknown;
|
|
229
|
-
}>;
|
|
230
|
-
}>;
|
|
231
|
-
readonly partsRecorded: Schema.Int;
|
|
232
|
-
readonly terminal: Schema.Union<readonly [Schema.TaggedStruct<"InferenceRunFinished", {
|
|
233
|
-
readonly committed: Schema.$Array<Schema.Struct<{
|
|
234
|
-
readonly position: Schema.Struct<{
|
|
235
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
236
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
237
|
-
}>;
|
|
238
|
-
readonly event: Schema.Struct<{
|
|
239
|
-
readonly durability: Schema.Literal<"durable">;
|
|
240
|
-
readonly namespace: Schema.NonEmptyString;
|
|
241
|
-
readonly type: Schema.NonEmptyString;
|
|
242
|
-
readonly schemaVersion: Schema.Int;
|
|
243
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
244
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
245
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
246
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
247
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
248
|
-
readonly span: Schema.Struct<{
|
|
249
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
250
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
251
|
-
readonly sampled: Schema.Boolean;
|
|
252
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
253
|
-
}>;
|
|
254
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
255
|
-
readonly context: Schema.Struct<{
|
|
256
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
257
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
258
|
-
readonly sampled: Schema.Boolean;
|
|
259
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
260
|
-
}>;
|
|
261
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
262
|
-
}>>;
|
|
263
|
-
}>>;
|
|
264
|
-
readonly payload: Schema.Unknown;
|
|
265
|
-
}>;
|
|
266
|
-
}>>;
|
|
267
|
-
readonly assistantText: Schema.String;
|
|
268
|
-
readonly reasoningText: Schema.String;
|
|
269
|
-
readonly responseParts: Schema.$Array<Schema.Any>;
|
|
270
|
-
}>, Schema.TaggedStruct<"InferenceRunFailed", {
|
|
271
|
-
readonly committed: Schema.$Array<Schema.Struct<{
|
|
272
|
-
readonly position: Schema.Struct<{
|
|
273
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
274
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
275
|
-
}>;
|
|
276
|
-
readonly event: Schema.Struct<{
|
|
277
|
-
readonly durability: Schema.Literal<"durable">;
|
|
278
|
-
readonly namespace: Schema.NonEmptyString;
|
|
279
|
-
readonly type: Schema.NonEmptyString;
|
|
280
|
-
readonly schemaVersion: Schema.Int;
|
|
281
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
282
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
283
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
284
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
285
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
286
|
-
readonly span: Schema.Struct<{
|
|
287
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
288
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
289
|
-
readonly sampled: Schema.Boolean;
|
|
290
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
291
|
-
}>;
|
|
292
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
293
|
-
readonly context: Schema.Struct<{
|
|
294
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
295
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
296
|
-
readonly sampled: Schema.Boolean;
|
|
297
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
298
|
-
}>;
|
|
299
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
300
|
-
}>>;
|
|
301
|
-
}>>;
|
|
302
|
-
readonly payload: Schema.Unknown;
|
|
303
|
-
}>;
|
|
304
|
-
}>>;
|
|
305
|
-
}>]>;
|
|
306
|
-
}>;
|
|
307
|
-
type InferenceRunResult = typeof InferenceRunResult.Type;
|
|
308
|
-
declare const UnsupportedInferencePart_base: Schema.Class<UnsupportedInferencePart, Schema.TaggedStruct<"UnsupportedInferencePart", {
|
|
309
|
-
readonly partType: Schema.String;
|
|
310
|
-
readonly reason: Schema.String;
|
|
311
|
-
}>, Cause.YieldableError>;
|
|
312
|
-
/** Failure for provider sideband parts without current EDA storage/UI semantics. */
|
|
313
|
-
declare class UnsupportedInferencePart extends UnsupportedInferencePart_base {}
|
|
314
|
-
/** Error surface for model inference streaming and part policy. */
|
|
315
|
-
type InferenceRunnerError = EDASessionStoreError | UnsupportedInferencePart;
|
|
316
|
-
/** Runtime service that owns one provider stream fold and durable finalization. */
|
|
317
|
-
interface InferenceRunnerShape {
|
|
318
|
-
/** Run one provider inference stream and fold provider parts into inference state. */
|
|
319
|
-
readonly runInference: (input: RunInferenceInput) => Effect.Effect<InferenceRunResult, InferenceRunnerError>;
|
|
320
|
-
}
|
|
321
|
-
declare const InferenceRunner_base: Context.ServiceClass<InferenceRunner, "@effect-durable-agent/InferenceRunner", InferenceRunnerShape>;
|
|
322
|
-
/** Owns provider inference streams and routes them into durable/live inference emissions. */
|
|
323
|
-
declare class InferenceRunner extends InferenceRunner_base {
|
|
324
|
-
static readonly Live: Layer.Layer<InferenceRunner, never, ModelResolver | EventFactory | IdGenerator | EDAToolRegistry>;
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
//#region src/services/turn-runner.d.ts
|
|
328
|
-
/** Input identity for running one turn with one provider inference stream. */
|
|
329
|
-
declare const RunTurnContext: Schema.Struct<{
|
|
330
|
-
readonly runId: Schema.brand<Schema.String, "RunId">;
|
|
331
|
-
readonly turnId: Schema.brand<Schema.String, "TurnId">;
|
|
332
|
-
}>;
|
|
333
|
-
type RunTurnContext = typeof RunTurnContext.Type;
|
|
334
|
-
/** Effectful inputs for running an already-started turn body. */
|
|
335
|
-
interface RunTurnInput extends RunTurnContext {
|
|
336
|
-
readonly prompt: Prompt.RawInput;
|
|
337
|
-
readonly eventSink: SessionEventSink;
|
|
338
|
-
readonly started: CommittedDurableEvent;
|
|
339
|
-
readonly modelSelection?: ModelSelectionPayload;
|
|
340
|
-
/** Maximum framework-owned tool calls this model run may execute before failing safely. */
|
|
341
|
-
readonly maxToolCallsPerRun?: NonNegativeInt;
|
|
342
|
-
/** Remaining rejected-tool correction turns before this turn must fail closed. */
|
|
343
|
-
readonly remainingToolRejectionCorrections?: NonNegativeInt;
|
|
344
|
-
/** Configured rejected-tool correction limit used in failure details. */
|
|
345
|
-
readonly maxToolRejectionCorrections?: NonNegativeInt;
|
|
346
|
-
}
|
|
347
|
-
/** Summary returned after the turn runner processes one inference stream. */
|
|
348
|
-
declare const TurnRunResult: Schema.Struct<{
|
|
349
|
-
readonly started: Schema.Struct<{
|
|
350
|
-
readonly position: Schema.Struct<{
|
|
351
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
352
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
353
|
-
}>;
|
|
354
|
-
readonly event: Schema.Struct<{
|
|
355
|
-
readonly durability: Schema.Literal<"durable">;
|
|
356
|
-
readonly namespace: Schema.NonEmptyString;
|
|
357
|
-
readonly type: Schema.NonEmptyString;
|
|
358
|
-
readonly schemaVersion: Schema.Int;
|
|
359
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
360
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
361
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
362
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
363
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
364
|
-
readonly span: Schema.Struct<{
|
|
365
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
366
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
367
|
-
readonly sampled: Schema.Boolean;
|
|
368
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
369
|
-
}>;
|
|
370
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
371
|
-
readonly context: Schema.Struct<{
|
|
372
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
373
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
374
|
-
readonly sampled: Schema.Boolean;
|
|
375
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
376
|
-
}>;
|
|
377
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
378
|
-
}>>;
|
|
379
|
-
}>>;
|
|
380
|
-
readonly payload: Schema.Unknown;
|
|
381
|
-
}>;
|
|
382
|
-
}>;
|
|
383
|
-
readonly inference: Schema.Struct<{
|
|
384
|
-
readonly started: Schema.Struct<{
|
|
385
|
-
readonly position: Schema.Struct<{
|
|
386
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
387
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
388
|
-
}>;
|
|
389
|
-
readonly event: Schema.Struct<{
|
|
390
|
-
readonly durability: Schema.Literal<"durable">;
|
|
391
|
-
readonly namespace: Schema.NonEmptyString;
|
|
392
|
-
readonly type: Schema.NonEmptyString;
|
|
393
|
-
readonly schemaVersion: Schema.Int;
|
|
394
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
395
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
396
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
397
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
398
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
399
|
-
readonly span: Schema.Struct<{
|
|
400
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
401
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
402
|
-
readonly sampled: Schema.Boolean;
|
|
403
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
404
|
-
}>;
|
|
405
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
406
|
-
readonly context: Schema.Struct<{
|
|
407
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
408
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
409
|
-
readonly sampled: Schema.Boolean;
|
|
410
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
411
|
-
}>;
|
|
412
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
413
|
-
}>>;
|
|
414
|
-
}>>;
|
|
415
|
-
readonly payload: Schema.Unknown;
|
|
416
|
-
}>;
|
|
417
|
-
}>;
|
|
418
|
-
readonly partsRecorded: Schema.Int;
|
|
419
|
-
readonly terminal: Schema.Union<readonly [Schema.TaggedStruct<"InferenceRunFinished", {
|
|
420
|
-
readonly committed: Schema.$Array<Schema.Struct<{
|
|
421
|
-
readonly position: Schema.Struct<{
|
|
422
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
423
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
424
|
-
}>;
|
|
425
|
-
readonly event: Schema.Struct<{
|
|
426
|
-
readonly durability: Schema.Literal<"durable">;
|
|
427
|
-
readonly namespace: Schema.NonEmptyString;
|
|
428
|
-
readonly type: Schema.NonEmptyString;
|
|
429
|
-
readonly schemaVersion: Schema.Int;
|
|
430
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
431
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
432
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
433
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
434
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
435
|
-
readonly span: Schema.Struct<{
|
|
436
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
437
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
438
|
-
readonly sampled: Schema.Boolean;
|
|
439
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
440
|
-
}>;
|
|
441
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
442
|
-
readonly context: Schema.Struct<{
|
|
443
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
444
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
445
|
-
readonly sampled: Schema.Boolean;
|
|
446
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
447
|
-
}>;
|
|
448
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
449
|
-
}>>;
|
|
450
|
-
}>>;
|
|
451
|
-
readonly payload: Schema.Unknown;
|
|
452
|
-
}>;
|
|
453
|
-
}>>;
|
|
454
|
-
readonly assistantText: Schema.String;
|
|
455
|
-
readonly reasoningText: Schema.String;
|
|
456
|
-
readonly responseParts: Schema.$Array<Schema.Any>;
|
|
457
|
-
}>, Schema.TaggedStruct<"InferenceRunFailed", {
|
|
458
|
-
readonly committed: Schema.$Array<Schema.Struct<{
|
|
459
|
-
readonly position: Schema.Struct<{
|
|
460
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
461
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
462
|
-
}>;
|
|
463
|
-
readonly event: Schema.Struct<{
|
|
464
|
-
readonly durability: Schema.Literal<"durable">;
|
|
465
|
-
readonly namespace: Schema.NonEmptyString;
|
|
466
|
-
readonly type: Schema.NonEmptyString;
|
|
467
|
-
readonly schemaVersion: Schema.Int;
|
|
468
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
469
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
470
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
471
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
472
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
473
|
-
readonly span: Schema.Struct<{
|
|
474
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
475
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
476
|
-
readonly sampled: Schema.Boolean;
|
|
477
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
478
|
-
}>;
|
|
479
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
480
|
-
readonly context: Schema.Struct<{
|
|
481
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
482
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
483
|
-
readonly sampled: Schema.Boolean;
|
|
484
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
485
|
-
}>;
|
|
486
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
487
|
-
}>>;
|
|
488
|
-
}>>;
|
|
489
|
-
readonly payload: Schema.Unknown;
|
|
490
|
-
}>;
|
|
491
|
-
}>>;
|
|
492
|
-
}>]>;
|
|
493
|
-
}>;
|
|
494
|
-
readonly outcome: Schema.Union<readonly [Schema.TaggedStruct<"TurnRunCompleted", {
|
|
495
|
-
readonly committed: Schema.Struct<{
|
|
496
|
-
readonly position: Schema.Struct<{
|
|
497
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
498
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
499
|
-
}>;
|
|
500
|
-
readonly event: Schema.Struct<{
|
|
501
|
-
readonly durability: Schema.Literal<"durable">;
|
|
502
|
-
readonly namespace: Schema.NonEmptyString;
|
|
503
|
-
readonly type: Schema.NonEmptyString;
|
|
504
|
-
readonly schemaVersion: Schema.Int;
|
|
505
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
506
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
507
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
508
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
509
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
510
|
-
readonly span: Schema.Struct<{
|
|
511
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
512
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
513
|
-
readonly sampled: Schema.Boolean;
|
|
514
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
515
|
-
}>;
|
|
516
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
517
|
-
readonly context: Schema.Struct<{
|
|
518
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
519
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
520
|
-
readonly sampled: Schema.Boolean;
|
|
521
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
522
|
-
}>;
|
|
523
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
524
|
-
}>>;
|
|
525
|
-
}>>;
|
|
526
|
-
readonly payload: Schema.Unknown;
|
|
527
|
-
}>;
|
|
528
|
-
}>;
|
|
529
|
-
}>, Schema.TaggedStruct<"TurnRunFailed", {
|
|
530
|
-
readonly committed: Schema.Struct<{
|
|
531
|
-
readonly position: Schema.Struct<{
|
|
532
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
533
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
534
|
-
}>;
|
|
535
|
-
readonly event: Schema.Struct<{
|
|
536
|
-
readonly durability: Schema.Literal<"durable">;
|
|
537
|
-
readonly namespace: Schema.NonEmptyString;
|
|
538
|
-
readonly type: Schema.NonEmptyString;
|
|
539
|
-
readonly schemaVersion: Schema.Int;
|
|
540
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
541
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
542
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
543
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
544
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
545
|
-
readonly span: Schema.Struct<{
|
|
546
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
547
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
548
|
-
readonly sampled: Schema.Boolean;
|
|
549
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
550
|
-
}>;
|
|
551
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
552
|
-
readonly context: Schema.Struct<{
|
|
553
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
554
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
555
|
-
readonly sampled: Schema.Boolean;
|
|
556
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
557
|
-
}>;
|
|
558
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
559
|
-
}>>;
|
|
560
|
-
}>>;
|
|
561
|
-
readonly payload: Schema.Unknown;
|
|
562
|
-
}>;
|
|
563
|
-
}>;
|
|
564
|
-
}>]>;
|
|
565
|
-
}>;
|
|
566
|
-
type TurnRunResult = typeof TurnRunResult.Type;
|
|
567
|
-
/** Error surface for the turn runner's inference and tool orchestration. */
|
|
568
|
-
type TurnRunnerError = EDASessionStoreError | InferenceRunnerError | ToolExecutorError;
|
|
569
|
-
/** Runtime service that owns inferences, tool execution, and turn terminalization. */
|
|
570
|
-
interface TurnRunnerShape {
|
|
571
|
-
/** Run one turn around a provider inference stream. */
|
|
572
|
-
readonly runTurn: (input: RunTurnInput) => Effect.Effect<TurnRunResult, TurnRunnerError>;
|
|
573
|
-
}
|
|
574
|
-
declare const TurnRunner_base: Context.ServiceClass<TurnRunner, "@effect-durable-agent/TurnRunner", TurnRunnerShape>;
|
|
575
|
-
/** Owns one turn: turn boundaries, inferences, tool handoff, and terminal turn events. */
|
|
576
|
-
declare class TurnRunner extends TurnRunner_base {
|
|
577
|
-
static readonly Live: Layer.Layer<TurnRunner, never, EventFactory | IdGenerator | InferenceRunner | ToolExecutor>;
|
|
578
|
-
}
|
|
579
|
-
//#endregion
|
|
580
|
-
//#region src/services/session-state.d.ts
|
|
581
|
-
/** Authoritative framework and app reducer state snapshot. */
|
|
582
|
-
interface SessionStateSnapshotData {
|
|
583
|
-
readonly reduced: ReducedState;
|
|
584
|
-
readonly reducerStates: EDAReducerStateSnapshot;
|
|
585
|
-
}
|
|
586
|
-
/** Input for one session control pass or long-lived control process. */
|
|
587
|
-
declare const SessionRunInput: Schema.Struct<{
|
|
588
|
-
readonly modelSelection: Schema.Struct<{
|
|
589
|
-
readonly provider: Schema.NonEmptyString;
|
|
590
|
-
readonly modelId: Schema.NonEmptyString;
|
|
591
|
-
readonly settings: Schema.optionalKey<Schema.Unknown>;
|
|
592
|
-
}>;
|
|
593
|
-
readonly maxToolCallsPerRun: Schema.optionalKey<Schema.Int>;
|
|
594
|
-
readonly systemPrompt: Schema.optionalKey<Schema.NonEmptyString>;
|
|
595
|
-
}>;
|
|
596
|
-
type SessionRunInput = typeof SessionRunInput.Type;
|
|
597
|
-
/** Command outcome when the command's run completed and the command was completed. */
|
|
598
|
-
declare const SessionCommandCompleted: Schema.TaggedStruct<"SessionCommandCompleted", {
|
|
599
|
-
readonly committed: Schema.Struct<{
|
|
600
|
-
readonly position: Schema.Struct<{
|
|
601
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
602
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
603
|
-
}>;
|
|
604
|
-
readonly event: Schema.Struct<{
|
|
605
|
-
readonly durability: Schema.Literal<"durable">;
|
|
606
|
-
readonly namespace: Schema.NonEmptyString;
|
|
607
|
-
readonly type: Schema.NonEmptyString;
|
|
608
|
-
readonly schemaVersion: Schema.Int;
|
|
609
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
610
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
611
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
612
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
613
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
614
|
-
readonly span: Schema.Struct<{
|
|
615
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
616
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
617
|
-
readonly sampled: Schema.Boolean;
|
|
618
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
619
|
-
}>;
|
|
620
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
621
|
-
readonly context: Schema.Struct<{
|
|
622
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
623
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
624
|
-
readonly sampled: Schema.Boolean;
|
|
625
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
626
|
-
}>;
|
|
627
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
628
|
-
}>>;
|
|
629
|
-
}>>;
|
|
630
|
-
readonly payload: Schema.Unknown;
|
|
631
|
-
}>;
|
|
632
|
-
}>;
|
|
633
|
-
}>;
|
|
634
|
-
type SessionCommandCompleted = typeof SessionCommandCompleted.Type;
|
|
635
|
-
/** Command outcome when the command's run failed and the command was failed. */
|
|
636
|
-
declare const SessionCommandFailed: Schema.TaggedStruct<"SessionCommandFailed", {
|
|
637
|
-
readonly committed: Schema.Struct<{
|
|
638
|
-
readonly position: Schema.Struct<{
|
|
639
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
640
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
641
|
-
}>;
|
|
642
|
-
readonly event: Schema.Struct<{
|
|
643
|
-
readonly durability: Schema.Literal<"durable">;
|
|
644
|
-
readonly namespace: Schema.NonEmptyString;
|
|
645
|
-
readonly type: Schema.NonEmptyString;
|
|
646
|
-
readonly schemaVersion: Schema.Int;
|
|
647
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
648
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
649
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
650
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
651
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
652
|
-
readonly span: Schema.Struct<{
|
|
653
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
654
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
655
|
-
readonly sampled: Schema.Boolean;
|
|
656
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
657
|
-
}>;
|
|
658
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
659
|
-
readonly context: Schema.Struct<{
|
|
660
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
661
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
662
|
-
readonly sampled: Schema.Boolean;
|
|
663
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
664
|
-
}>;
|
|
665
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
666
|
-
}>>;
|
|
667
|
-
}>>;
|
|
668
|
-
readonly payload: Schema.Unknown;
|
|
669
|
-
}>;
|
|
670
|
-
}>;
|
|
671
|
-
}>;
|
|
672
|
-
type SessionCommandFailed = typeof SessionCommandFailed.Type;
|
|
673
|
-
/** Command outcome when command work was cancelled by stop, interrupt, or recovery. */
|
|
674
|
-
declare const SessionCommandCancelled: Schema.TaggedStruct<"SessionCommandCancelled", {
|
|
675
|
-
readonly committed: Schema.Struct<{
|
|
676
|
-
readonly position: Schema.Struct<{
|
|
677
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
678
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
679
|
-
}>;
|
|
680
|
-
readonly event: Schema.Struct<{
|
|
681
|
-
readonly durability: Schema.Literal<"durable">;
|
|
682
|
-
readonly namespace: Schema.NonEmptyString;
|
|
683
|
-
readonly type: Schema.NonEmptyString;
|
|
684
|
-
readonly schemaVersion: Schema.Int;
|
|
685
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
686
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
687
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
688
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
689
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
690
|
-
readonly span: Schema.Struct<{
|
|
691
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
692
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
693
|
-
readonly sampled: Schema.Boolean;
|
|
694
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
695
|
-
}>;
|
|
696
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
697
|
-
readonly context: Schema.Struct<{
|
|
698
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
699
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
700
|
-
readonly sampled: Schema.Boolean;
|
|
701
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
702
|
-
}>;
|
|
703
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
704
|
-
}>>;
|
|
705
|
-
}>>;
|
|
706
|
-
readonly payload: Schema.Unknown;
|
|
707
|
-
}>;
|
|
708
|
-
}>;
|
|
709
|
-
}>;
|
|
710
|
-
type SessionCommandCancelled = typeof SessionCommandCancelled.Type;
|
|
711
|
-
/** Terminal command-processing variants returned from one control action. */
|
|
712
|
-
declare const SessionCommandOutcome: Schema.Union<readonly [Schema.TaggedStruct<"SessionCommandCompleted", {
|
|
713
|
-
readonly committed: Schema.Struct<{
|
|
714
|
-
readonly position: Schema.Struct<{
|
|
715
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
716
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
717
|
-
}>;
|
|
718
|
-
readonly event: Schema.Struct<{
|
|
719
|
-
readonly durability: Schema.Literal<"durable">;
|
|
720
|
-
readonly namespace: Schema.NonEmptyString;
|
|
721
|
-
readonly type: Schema.NonEmptyString;
|
|
722
|
-
readonly schemaVersion: Schema.Int;
|
|
723
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
724
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
725
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
726
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
727
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
728
|
-
readonly span: Schema.Struct<{
|
|
729
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
730
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
731
|
-
readonly sampled: Schema.Boolean;
|
|
732
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
733
|
-
}>;
|
|
734
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
735
|
-
readonly context: Schema.Struct<{
|
|
736
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
737
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
738
|
-
readonly sampled: Schema.Boolean;
|
|
739
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
740
|
-
}>;
|
|
741
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
742
|
-
}>>;
|
|
743
|
-
}>>;
|
|
744
|
-
readonly payload: Schema.Unknown;
|
|
745
|
-
}>;
|
|
746
|
-
}>;
|
|
747
|
-
}>, Schema.TaggedStruct<"SessionCommandFailed", {
|
|
748
|
-
readonly committed: Schema.Struct<{
|
|
749
|
-
readonly position: Schema.Struct<{
|
|
750
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
751
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
752
|
-
}>;
|
|
753
|
-
readonly event: Schema.Struct<{
|
|
754
|
-
readonly durability: Schema.Literal<"durable">;
|
|
755
|
-
readonly namespace: Schema.NonEmptyString;
|
|
756
|
-
readonly type: Schema.NonEmptyString;
|
|
757
|
-
readonly schemaVersion: Schema.Int;
|
|
758
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
759
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
760
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
761
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
762
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
763
|
-
readonly span: Schema.Struct<{
|
|
764
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
765
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
766
|
-
readonly sampled: Schema.Boolean;
|
|
767
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
768
|
-
}>;
|
|
769
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
770
|
-
readonly context: Schema.Struct<{
|
|
771
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
772
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
773
|
-
readonly sampled: Schema.Boolean;
|
|
774
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
775
|
-
}>;
|
|
776
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
777
|
-
}>>;
|
|
778
|
-
}>>;
|
|
779
|
-
readonly payload: Schema.Unknown;
|
|
780
|
-
}>;
|
|
781
|
-
}>;
|
|
782
|
-
}>, Schema.TaggedStruct<"SessionCommandCancelled", {
|
|
783
|
-
readonly committed: Schema.Struct<{
|
|
784
|
-
readonly position: Schema.Struct<{
|
|
785
|
-
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
786
|
-
readonly subSeq: Schema.brand<Schema.Literal<0>, "SubSequenceNumber">;
|
|
787
|
-
}>;
|
|
788
|
-
readonly event: Schema.Struct<{
|
|
789
|
-
readonly durability: Schema.Literal<"durable">;
|
|
790
|
-
readonly namespace: Schema.NonEmptyString;
|
|
791
|
-
readonly type: Schema.NonEmptyString;
|
|
792
|
-
readonly schemaVersion: Schema.Int;
|
|
793
|
-
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
794
|
-
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
795
|
-
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
796
|
-
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
797
|
-
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
798
|
-
readonly span: Schema.Struct<{
|
|
799
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
800
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
801
|
-
readonly sampled: Schema.Boolean;
|
|
802
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
803
|
-
}>;
|
|
804
|
-
readonly links: Schema.$Array<Schema.Struct<{
|
|
805
|
-
readonly context: Schema.Struct<{
|
|
806
|
-
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
807
|
-
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
808
|
-
readonly sampled: Schema.Boolean;
|
|
809
|
-
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
810
|
-
}>;
|
|
811
|
-
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
812
|
-
}>>;
|
|
813
|
-
}>>;
|
|
814
|
-
readonly payload: Schema.Unknown;
|
|
815
|
-
}>;
|
|
816
|
-
}>;
|
|
817
|
-
}>]>;
|
|
818
|
-
type SessionCommandOutcome = typeof SessionCommandOutcome.Type;
|
|
819
|
-
/** Summary returned after processing one admitted command. */
|
|
820
|
-
interface SessionCommandResult {
|
|
821
|
-
readonly started: CommittedDurableEvent;
|
|
822
|
-
readonly outcome: SessionCommandOutcome;
|
|
823
|
-
}
|
|
824
|
-
/** Why a control drain stopped without starting more command work. */
|
|
825
|
-
declare const SessionNoRunnableReason: Schema.Literals<readonly ["active-command", "no-pending-command", "awaiting-run-authorization"]>;
|
|
826
|
-
type SessionNoRunnableReason = typeof SessionNoRunnableReason.Type;
|
|
827
|
-
/** Session control result when no admitted command is runnable. */
|
|
828
|
-
declare const SessionNoRunnableCommand: Schema.TaggedStruct<"SessionNoRunnableCommand", {
|
|
829
|
-
readonly reason: Schema.Literals<readonly ["active-command", "no-pending-command", "awaiting-run-authorization"]>;
|
|
830
|
-
readonly active: Schema.optionalKey<Schema.TaggedStruct<"DispatchActiveCommand", {
|
|
831
|
-
readonly commandId: Schema.brand<Schema.String, "CommandId">;
|
|
832
|
-
readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
|
|
833
|
-
}>>;
|
|
834
|
-
}>;
|
|
835
|
-
type SessionNoRunnableCommand = typeof SessionNoRunnableCommand.Type;
|
|
836
|
-
/** Control result when command execution was started in an active child scope. */
|
|
837
|
-
declare const SessionForkedCommand: Schema.TaggedStruct<"SessionForkedCommand", {
|
|
838
|
-
readonly commandId: Schema.brand<Schema.String, "CommandId">;
|
|
839
|
-
}>;
|
|
840
|
-
type SessionForkedCommand = typeof SessionForkedCommand.Type;
|
|
841
|
-
/** One processed control-loop action from a drain pass. */
|
|
842
|
-
type SessionDrainProcessed = SessionCommandResult | SessionForkedCommand;
|
|
843
|
-
/** Summary of a control-loop drain pass and the reason it stopped. */
|
|
844
|
-
interface SessionDrainResult {
|
|
845
|
-
readonly _tag: "SessionDrainResult";
|
|
846
|
-
readonly processed: ReadonlyArray<SessionDrainProcessed>;
|
|
847
|
-
readonly stop: SessionNoRunnableCommand;
|
|
848
|
-
}
|
|
849
|
-
/** Error surface for session control-loop execution. */
|
|
850
|
-
type SessionStateError = EDASessionStoreError | TurnRunnerError;
|
|
851
|
-
declare const SessionCommandAdmissionConflict_base: Schema.Class<SessionCommandAdmissionConflict, Schema.TaggedStruct<"SessionCommandAdmissionConflict", {
|
|
852
|
-
readonly code: Schema.Literals<readonly ["queue_paused", "paused_queue_changed"]>;
|
|
853
|
-
readonly message: Schema.String;
|
|
854
|
-
readonly pausedMessageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
|
|
855
|
-
}>, Cause.YieldableError>;
|
|
856
|
-
declare class SessionCommandAdmissionConflict extends SessionCommandAdmissionConflict_base {}
|
|
857
|
-
/** Error surface for durable command admission and batched submit. */
|
|
858
|
-
type SessionCommandAdmissionError = EDASessionStoreError | SessionCommandAdmissionConflict;
|
|
859
|
-
/** Ordered item admitted through the public runtime submit batch. */
|
|
860
|
-
type EDASubmittable = EDACommand | DurableEventEnvelope;
|
|
861
|
-
/** Internal live-process authority for commands, durable writes, and scheduling. */
|
|
862
|
-
interface SessionStateShape extends SessionEventSink {
|
|
863
|
-
/** Trusted permission entrypoint, serialized with control actions and revalidated before commit. */
|
|
864
|
-
readonly grantRun: (command: GrantRunCommand, input: SessionRunInput) => Effect.Effect<RunGrantResult, SessionStateError>;
|
|
865
|
-
/** Host alarm callback for strict, at-least-once delivery of the current persisted request. */
|
|
866
|
-
readonly retryRunSchedulingDelivery: () => Effect.Effect<void, EDASessionStoreError>;
|
|
867
|
-
/** Commit session-initial context, such as app-owned system prompt, before command work starts. */
|
|
868
|
-
readonly initialize: (input: SessionRunInput) => Effect.Effect<void, SessionCommandAdmissionError>;
|
|
869
|
-
/** Submit commands and/or app durable events as one ordered durable batch. */
|
|
870
|
-
readonly submitBatch: (input: ReadonlyArray<EDASubmittable>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, SessionCommandAdmissionError>;
|
|
871
|
-
/** Admit an external command durably and wake the control loop. */
|
|
872
|
-
readonly admitCommand: (command: EDACommand) => Effect.Effect<CommittedDurableEvent, SessionCommandAdmissionError>;
|
|
873
|
-
/** Observe the authoritative live reduced state. Use for reads only, not detached mutation. */
|
|
874
|
-
readonly snapshot: () => Effect.Effect<ReducedState>;
|
|
875
|
-
/** Observe the authoritative framework state plus app reducer states. */
|
|
876
|
-
readonly snapshotData: () => Effect.Effect<SessionStateSnapshotData>;
|
|
877
|
-
/**
|
|
878
|
-
* Process runnable work until blocked or empty after startup recovery has completed.
|
|
879
|
-
*
|
|
880
|
-
* This is a post-recovery dispatch helper. If durable replay says a command is
|
|
881
|
-
* already active while no in-memory execution owner exists, that is a fatal
|
|
882
|
-
* live-runtime invariant violation rather than an inline recovery case.
|
|
883
|
-
*/
|
|
884
|
-
readonly drainReadyWork: (input: SessionRunInput) => Effect.Effect<SessionDrainResult, SessionStateError>;
|
|
885
|
-
/** Initialize, recover exactly once, then enter the long-lived live control loop. */
|
|
886
|
-
readonly start: (input: SessionRunInput) => Effect.Effect<void, SessionCommandAdmissionError>;
|
|
887
|
-
}
|
|
888
|
-
declare const SessionState_base: Context.ServiceClass<SessionState, "@effect-durable-agent/SessionState", SessionStateShape>;
|
|
889
|
-
/** Internal authoritative live state and root control loop for one session. */
|
|
890
|
-
declare class SessionState extends SessionState_base {
|
|
891
|
-
static readonly Live: Layer.Layer<SessionState, EDASessionStoreError, EDAKeepAlive | EDAPromptProjector | EDAReducerRegistry | RunScheduler | RunSchedulingWakeup | EDASessionStore | LiveEventBus | EDASinkRegistry | SessionContext | EventFactory | IdGenerator | TurnRunner | CompactionRunner>;
|
|
892
|
-
}
|
|
893
|
-
//#endregion
|
|
894
|
-
export { LiveEventBus as C, ToolExecutor as S, SessionStateShape as _, SessionCommandCompleted as a, InferenceRunner as b, SessionCommandResult as c, SessionForkedCommand as d, SessionNoRunnableCommand as f, SessionStateError as g, SessionState as h, SessionCommandCancelled as i, SessionDrainProcessed as l, SessionRunInput as m, SessionCommandAdmissionConflict as n, SessionCommandFailed as o, SessionNoRunnableReason as p, SessionCommandAdmissionError as r, SessionCommandOutcome as s, EDASubmittable as t, SessionDrainResult as u, SessionStateSnapshotData as v, InferenceRunnerStreamPart as x, TurnRunner as y };
|
|
895
|
-
//# sourceMappingURL=session-state-dE07Zzcr.d.ts.map
|