effect-durable-agent-cloudflare 0.1.0-alpha.24 → 0.1.0-alpha.26
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/{durable-object-BZJM3RyV.js → durable-object-CkrxIOH4.js} +190 -40
- package/dist/durable-object-CkrxIOH4.js.map +1 -0
- package/dist/{durable-object-storage-D3muKtpz.d.ts → durable-object-storage-BVsu5oAV.d.ts} +21 -1
- package/dist/{durable-object-store-Dct3N6rk.js → durable-object-store-Ca0pvpa_.js} +100 -17
- package/dist/durable-object-store-Ca0pvpa_.js.map +1 -0
- package/dist/durable-object.d.ts +41 -6
- package/dist/durable-object.js +1 -1
- package/dist/index.d.ts +54 -13
- package/dist/index.js +5 -5
- package/dist/{rpc-spec-B5cL83zd.js → rpc-spec-BupIkBhI.js} +125 -17
- package/dist/rpc-spec-BupIkBhI.js.map +1 -0
- package/dist/{rpc-spec-BTVd02Rg.d.ts → rpc-spec-CwehaLCd.d.ts} +191 -7
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.js +2 -2
- package/dist/{session-controller-D8uXDKVG.d.ts → session-controller-D0PxLJJ9.d.ts} +9 -4
- package/dist/{session-controller-DoUy9zR6.js → session-controller-KWMuKhlX.js} +3 -3
- package/dist/session-controller-KWMuKhlX.js.map +1 -0
- package/dist/session-controller.d.ts +1 -1
- package/dist/session-controller.js +1 -1
- package/dist/storage.d.ts +1 -1
- package/package.json +2 -2
- package/dist/durable-object-BZJM3RyV.js.map +0 -1
- package/dist/durable-object-store-Dct3N6rk.js.map +0 -1
- package/dist/rpc-spec-B5cL83zd.js.map +0 -1
- package/dist/session-controller-DoUy9zR6.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { a as DurableObjectTranscriptObserver, c as TranscriptAlert, i as DurableObjectSqlStorage, l as AdoptedLogIncarnation, n as DurableObjectSessionStoreOptions, o as DurableObjectTranscriptOptions, r as DurableObjectSqlCursor, s as DurableObjectTranscriptSliceLimits, t as DurableObjectSessionStorage } from "./durable-object-storage-
|
|
2
|
-
import { a as SessionOutcomeInput, c as SessionTranscriptWindowResult, i as SessionGrantRunInput, l as edaSessionRpc, n as SessionBlockInput, o as SessionScopedInput, r as SessionCommandInput, s as
|
|
3
|
-
import { _ as makeEDADurableObjectRuntimeLayer, a as EDASessionEventsInput, c as EDASessionSubmitInput, d as EDAWebSocketProjection, f as EDAWebSocketProjectionId, g as EDASessionDurableObjectStorage, h as EDADurableObjectRuntimeLayerOptions, i as EDASessionControllerOptions, l as EDATranscriptSocketOptions, m as EDAWebSocketProjectionResult, n as EDASessionBlockOnCommandInput, o as EDASessionScopedInput, p as EDAWebSocketProjectionInitial, r as EDASessionController, s as EDASessionSubmitBatchInput, t as EDAPreparedEventWebSocket, u as defaultActiveContentCadenceMs, v as DurableObjectAlarmStorage } from "./session-controller-
|
|
1
|
+
import { a as DurableObjectTranscriptObserver, c as TranscriptAlert, i as DurableObjectSqlStorage, l as AdoptedLogIncarnation, n as DurableObjectSessionStoreOptions, o as DurableObjectTranscriptOptions, r as DurableObjectSqlCursor, s as DurableObjectTranscriptSliceLimits, t as DurableObjectSessionStorage } from "./durable-object-storage-BVsu5oAV.js";
|
|
2
|
+
import { a as SessionOutcomeInput, c as SessionTranscriptBodyResult, d as SessionTranscriptWindowInput, f as SessionTranscriptWindowResult, i as SessionGrantRunInput, l as SessionTranscriptSummaryInput, m as edaSessionRpc, n as SessionBlockInput, o as SessionScopedInput, p as TranscriptCompactionSummary, r as SessionCommandInput, s as SessionTranscriptBodyInput, t as SessionBatchInput, u as SessionTranscriptSummaryResult } from "./rpc-spec-CwehaLCd.js";
|
|
3
|
+
import { _ as makeEDADurableObjectRuntimeLayer, a as EDASessionEventsInput, c as EDASessionSubmitInput, d as EDAWebSocketProjection, f as EDAWebSocketProjectionId, g as EDASessionDurableObjectStorage, h as EDADurableObjectRuntimeLayerOptions, i as EDASessionControllerOptions, l as EDATranscriptSocketOptions, m as EDAWebSocketProjectionResult, n as EDASessionBlockOnCommandInput, o as EDASessionScopedInput, p as EDAWebSocketProjectionInitial, r as EDASessionController, s as EDASessionSubmitBatchInput, t as EDAPreparedEventWebSocket, u as defaultActiveContentCadenceMs, v as DurableObjectAlarmStorage } from "./session-controller-D0PxLJJ9.js";
|
|
4
4
|
import { EDASessionBlockOnCommandRpcInput, EDASessionCommandRpcInput, EDASessionDurableObject, EDASessionDurableObjectOptions, EDASessionEventsRpcInput, EDASessionGrantRunRpcInput, EDASessionRpcSurface, EDASessionRunRequestOutcomeRpcInput, EDASessionScopedRpcInput, EDASessionSubmitBatchRpcInput, EDASessionTranscriptOptions, EDA_WEB_SOCKET_PROJECTION_HEADER, EDA_WEB_SOCKET_STREAM_PARAM, edaRuntimeConfig, encodeEdaRpcCommittedDurableEvent, encodeEdaRpcSessionSnapshot, getEDASessionDurableObjectByName } from "./durable-object.js";
|
|
5
5
|
import { EDAOpenAiModelConfig, makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDAOpenAiClientLayer } from "./openai.js";
|
|
6
6
|
import { a as encodeEdaRpcDurableEvent, i as encodeEdaRpcCommand, n as decodeEdaRpcCommand, o as encodeEdaRpcSubmittables, r as decodeEdaRpcSubmittables, t as EDARpcSubmittable } from "./rpc-codec-B2aLiNqt.js";
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
|
-
import { SessionId } from "effect-durable-agent/types/core";
|
|
11
|
-
import { EDASessionStore, EDASessionStoreError, EDASessionStoreShape } from "effect-durable-agent/services/session-store";
|
|
12
|
-
import { EDATranscriptStore, EDATranscriptStoreShape, TranscriptCursorMismatch, TranscriptVersionMeta, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector } from "effect-durable-agent/transcript";
|
|
10
|
+
import { SessionId, SummaryId } from "effect-durable-agent/types/core";
|
|
11
|
+
import { CommittedDurableEvent, EDASessionStore, EDASessionStoreError, EDASessionStoreShape } from "effect-durable-agent/services/session-store";
|
|
12
|
+
import { EDATranscriptStore, EDATranscriptStoreShape, TranscriptCursorMismatch, TranscriptLogIncarnation, TranscriptVersionMeta, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector } from "effect-durable-agent/transcript";
|
|
13
13
|
import * as Result from "effect/Result";
|
|
14
|
+
import { CompactionSummaryArtifact } from "effect-durable-agent/domain/context-projection";
|
|
14
15
|
//#region src/durable-object-alarms.d.ts
|
|
15
16
|
/**
|
|
16
17
|
* The independent owners of a session object's single platform alarm.
|
|
@@ -51,7 +52,11 @@ declare class DurableObjectAlarmScheduler {
|
|
|
51
52
|
* caller syncs once at the end, or not at all when it rethrows, which leaves the platform's own
|
|
52
53
|
* retry (with its backoff and cap) in force.
|
|
53
54
|
*/
|
|
54
|
-
retain(owner: DurableObjectAlarmOwner, atMs: number): void;
|
|
55
|
+
retain(owner: DurableObjectAlarmOwner, atMs: number, failures?: number): void;
|
|
56
|
+
/** Consecutive failures recorded with `owner`'s wakeup; 0 without one. */
|
|
57
|
+
failures(owner: DurableObjectAlarmOwner): number;
|
|
58
|
+
/** Remove `owner`'s wakeup whatever its time; call `sync` afterwards. */
|
|
59
|
+
clear(owner: DurableObjectAlarmOwner): void;
|
|
55
60
|
/** Wake `owner` no later than `atMs`; an earlier wakeup it already holds is kept. */
|
|
56
61
|
request(owner: DurableObjectAlarmOwner, atMs: number): Promise<void>;
|
|
57
62
|
/**
|
|
@@ -76,10 +81,14 @@ declare class DurableObjectAlarmScheduler {
|
|
|
76
81
|
/**
|
|
77
82
|
* Maintenance state of one session's transcript, as a host backfill records it (§7).
|
|
78
83
|
*
|
|
79
|
-
* `converged` is the backfill's proof
|
|
80
|
-
* and no builder or
|
|
84
|
+
* - `Enabled`: the host maintains this session's transcript. `converged` is the backfill's proof
|
|
85
|
+
* condition: the active version is `currentVersion`, healthy and at the head, and no builder or
|
|
86
|
+
* cleanup work remains.
|
|
87
|
+
* - `Disabled`: the host has not enabled this session (a rollout ring). It is reported read-only:
|
|
88
|
+
* any stored versions are listed as they are, nothing is maintained, and no incarnation is
|
|
89
|
+
* minted, so `incarnation` is present only when one already exists or can be adopted.
|
|
81
90
|
*/
|
|
82
|
-
declare const TranscriptStorageStatus: Schema.
|
|
91
|
+
declare const TranscriptStorageStatus: Schema.Union<readonly [Schema.TaggedStruct<"Enabled", {
|
|
83
92
|
readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
|
|
84
93
|
readonly headSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
85
94
|
readonly currentVersion: Schema.brand<Schema.String, "TranscriptVersion">;
|
|
@@ -97,7 +106,23 @@ declare const TranscriptStorageStatus: Schema.Struct<{
|
|
|
97
106
|
}>>;
|
|
98
107
|
readonly pending: Schema.Boolean;
|
|
99
108
|
readonly converged: Schema.Boolean;
|
|
100
|
-
}
|
|
109
|
+
}>, Schema.TaggedStruct<"Disabled", {
|
|
110
|
+
readonly incarnation: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">>;
|
|
111
|
+
readonly headSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
112
|
+
readonly currentVersion: Schema.brand<Schema.String, "TranscriptVersion">;
|
|
113
|
+
readonly versions: Schema.$Array<Schema.Struct<{
|
|
114
|
+
readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
|
|
115
|
+
readonly role: Schema.Literals<readonly ["active", "building"]>;
|
|
116
|
+
readonly cursor: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
117
|
+
readonly status: Schema.TaggedUnion<{
|
|
118
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
119
|
+
readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
120
|
+
readonly error: Schema.String;
|
|
121
|
+
}>;
|
|
122
|
+
readonly Ok: Schema.TaggedStruct<"Ok", {}>;
|
|
123
|
+
}>;
|
|
124
|
+
}>>;
|
|
125
|
+
}>]>;
|
|
101
126
|
type TranscriptStorageStatus = typeof TranscriptStorageStatus.Type;
|
|
102
127
|
/** Construction options for the runtime-free transcript store of one session. */
|
|
103
128
|
interface DurableObjectTranscriptStoreOptions {
|
|
@@ -124,13 +149,29 @@ declare class DurableObjectTranscriptStore {
|
|
|
124
149
|
/** Maintenance state of every version present. */
|
|
125
150
|
readMeta(): ReadonlyArray<TranscriptVersionMeta>;
|
|
126
151
|
/** Status for builders, backfill proofs and alerts. */
|
|
127
|
-
status(): TranscriptStorageStatus
|
|
152
|
+
status(): Extract<TranscriptStorageStatus, {
|
|
153
|
+
readonly _tag: "Enabled";
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Status of a session the host has not enabled, read without writing anything: no version is
|
|
157
|
+
* initialized or reconciled and no incarnation is minted.
|
|
158
|
+
*/
|
|
159
|
+
disabledStatus(): Extract<TranscriptStorageStatus, {
|
|
160
|
+
readonly _tag: "Disabled";
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* This log's incarnation, minted (or adopted from the host's key) inside a transaction the
|
|
164
|
+
* same way window reads mint it. Body and summary reads check a reference against it.
|
|
165
|
+
*/
|
|
166
|
+
incarnation(): TranscriptLogIncarnation;
|
|
128
167
|
/** Raise the missed-session alert if the active version is no longer carried. */
|
|
129
168
|
auditMissedSession(): void;
|
|
130
169
|
/** Whether a builder or cleanup slice has work to do. */
|
|
131
170
|
hasPendingWork(): boolean;
|
|
132
171
|
/** Run one bounded builder slice in its own transaction; returns whether work remains. */
|
|
133
172
|
runSlice(): boolean;
|
|
173
|
+
/** Raise an alert through the host observer. */
|
|
174
|
+
alert(alert: TranscriptAlert): void;
|
|
134
175
|
/** The `EDATranscriptStore` port: the same reads as Effects. */
|
|
135
176
|
get port(): EDATranscriptStoreShape;
|
|
136
177
|
}
|
|
@@ -179,5 +220,5 @@ declare class DurableObjectSessionStore {
|
|
|
179
220
|
static readonly layer: (options: DurableObjectSessionStoreOptions) => Layer.Layer<EDASessionStore, EDASessionStoreError, never>;
|
|
180
221
|
}
|
|
181
222
|
//#endregion
|
|
182
|
-
export { type AdoptedLogIncarnation, DurableObjectAlarmOwner, DurableObjectAlarmScheduler, DurableObjectSessionStorage, DurableObjectSessionStore, DurableObjectSessionStoreOptions, DurableObjectSqlCursor, DurableObjectSqlStorage, DurableObjectTranscriptBuilder, type DurableObjectTranscriptObserver, type DurableObjectTranscriptOptions, type DurableObjectTranscriptSliceLimits, DurableObjectTranscriptStore, DurableObjectTranscriptStoreOptions, EDADurableObjectRuntimeLayerOptions, EDAOpenAiModelConfig, EDAPreparedEventWebSocket, EDARpcSubmittable, EDASessionBlockOnCommandInput, EDASessionBlockOnCommandRpcInput, EDASessionCommandRpcInput, EDASessionController, EDASessionControllerOptions, EDASessionDurableObject, EDASessionDurableObjectOptions, EDASessionDurableObjectStorage, EDASessionEventsInput, EDASessionEventsRpcInput, EDASessionGrantRunRpcInput, EDASessionRpcSurface, EDASessionRunRequestOutcomeRpcInput, EDASessionScopedInput, EDASessionScopedRpcInput, EDASessionSubmitBatchInput, EDASessionSubmitBatchRpcInput, EDASessionSubmitInput, EDASessionTranscriptOptions, type EDATranscriptSocketOptions, EDAWebSocketProjection, EDAWebSocketProjectionId, EDAWebSocketProjectionInitial, EDAWebSocketProjectionResult, EDA_WEB_SOCKET_PROJECTION_HEADER, EDA_WEB_SOCKET_STREAM_PARAM, SessionBatchInput, SessionBlockInput, SessionCommandInput, SessionGrantRunInput, SessionOutcomeInput, SessionScopedInput, SessionTranscriptWindowInput, SessionTranscriptWindowResult, type TranscriptAlert, TranscriptStorageStatus, decodeEdaRpcCommand, decodeEdaRpcSubmittables, defaultActiveContentCadenceMs, edaRuntimeConfig, edaSessionRpc, encodeEdaRpcCommand, encodeEdaRpcCommittedDurableEvent, encodeEdaRpcDurableEvent, encodeEdaRpcSessionSnapshot, encodeEdaRpcSubmittables, getEDASessionDurableObjectByName, makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDADurableObjectRuntimeLayer, makeEDAOpenAiClientLayer };
|
|
223
|
+
export { type AdoptedLogIncarnation, DurableObjectAlarmOwner, DurableObjectAlarmScheduler, DurableObjectSessionStorage, DurableObjectSessionStore, DurableObjectSessionStoreOptions, DurableObjectSqlCursor, DurableObjectSqlStorage, DurableObjectTranscriptBuilder, type DurableObjectTranscriptObserver, type DurableObjectTranscriptOptions, type DurableObjectTranscriptSliceLimits, DurableObjectTranscriptStore, DurableObjectTranscriptStoreOptions, EDADurableObjectRuntimeLayerOptions, EDAOpenAiModelConfig, EDAPreparedEventWebSocket, EDARpcSubmittable, EDASessionBlockOnCommandInput, EDASessionBlockOnCommandRpcInput, EDASessionCommandRpcInput, EDASessionController, EDASessionControllerOptions, EDASessionDurableObject, EDASessionDurableObjectOptions, EDASessionDurableObjectStorage, EDASessionEventsInput, EDASessionEventsRpcInput, EDASessionGrantRunRpcInput, EDASessionRpcSurface, EDASessionRunRequestOutcomeRpcInput, EDASessionScopedInput, EDASessionScopedRpcInput, EDASessionSubmitBatchInput, EDASessionSubmitBatchRpcInput, EDASessionSubmitInput, EDASessionTranscriptOptions, type EDATranscriptSocketOptions, EDAWebSocketProjection, EDAWebSocketProjectionId, EDAWebSocketProjectionInitial, EDAWebSocketProjectionResult, EDA_WEB_SOCKET_PROJECTION_HEADER, EDA_WEB_SOCKET_STREAM_PARAM, SessionBatchInput, SessionBlockInput, SessionCommandInput, SessionGrantRunInput, SessionOutcomeInput, SessionScopedInput, SessionTranscriptBodyInput, SessionTranscriptBodyResult, SessionTranscriptSummaryInput, SessionTranscriptSummaryResult, SessionTranscriptWindowInput, SessionTranscriptWindowResult, type TranscriptAlert, TranscriptCompactionSummary, TranscriptStorageStatus, decodeEdaRpcCommand, decodeEdaRpcSubmittables, defaultActiveContentCadenceMs, edaRuntimeConfig, edaSessionRpc, encodeEdaRpcCommand, encodeEdaRpcCommittedDurableEvent, encodeEdaRpcDurableEvent, encodeEdaRpcSessionSnapshot, encodeEdaRpcSubmittables, getEDASessionDurableObjectByName, makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDADurableObjectRuntimeLayer, makeEDAOpenAiClientLayer };
|
|
183
224
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as DurableObjectSessionStore } from "./durable-object-store-
|
|
3
|
-
import { i as makeEDADurableObjectRuntimeLayer, n as defaultActiveContentCadenceMs, r as EDAWebSocketProjectionId, t as EDASessionController } from "./session-controller-
|
|
4
|
-
import { a as encodeEdaRpcCommittedDurableEvent, c as DurableObjectAlarmScheduler, i as edaRuntimeConfig, n as EDA_WEB_SOCKET_PROJECTION_HEADER, o as encodeEdaRpcSessionSnapshot, r as EDA_WEB_SOCKET_STREAM_PARAM, s as getEDASessionDurableObjectByName, t as EDASessionDurableObject } from "./durable-object-
|
|
1
|
+
import { C as encodeEdaRpcSubmittables, S as encodeEdaRpcDurableEvent, _ as TranscriptStorageStatus, a as SessionOutcomeInput, b as decodeEdaRpcSubmittables, c as SessionTranscriptBodyResult, d as SessionTranscriptWindowInput, f as SessionTranscriptWindowResult, g as DurableObjectTranscriptStore, h as DurableObjectTranscriptBuilder, i as SessionGrantRunInput, l as SessionTranscriptSummaryInput, m as edaSessionRpc, n as SessionBlockInput, o as SessionScopedInput, p as TranscriptCompactionSummary, r as SessionCommandInput, s as SessionTranscriptBodyInput, t as SessionBatchInput, u as SessionTranscriptSummaryResult, v as EDARpcSubmittable, x as encodeEdaRpcCommand, y as decodeEdaRpcCommand } from "./rpc-spec-BupIkBhI.js";
|
|
2
|
+
import { t as DurableObjectSessionStore } from "./durable-object-store-Ca0pvpa_.js";
|
|
3
|
+
import { i as makeEDADurableObjectRuntimeLayer, n as defaultActiveContentCadenceMs, r as EDAWebSocketProjectionId, t as EDASessionController } from "./session-controller-KWMuKhlX.js";
|
|
4
|
+
import { a as encodeEdaRpcCommittedDurableEvent, c as DurableObjectAlarmScheduler, i as edaRuntimeConfig, n as EDA_WEB_SOCKET_PROJECTION_HEADER, o as encodeEdaRpcSessionSnapshot, r as EDA_WEB_SOCKET_STREAM_PARAM, s as getEDASessionDurableObjectByName, t as EDASessionDurableObject } from "./durable-object-CkrxIOH4.js";
|
|
5
5
|
import "./storage.js";
|
|
6
6
|
import { makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDAOpenAiClientLayer } from "./openai.js";
|
|
7
|
-
export { DurableObjectAlarmScheduler, DurableObjectSessionStore, DurableObjectTranscriptBuilder, DurableObjectTranscriptStore, EDARpcSubmittable, EDASessionController, EDASessionDurableObject, EDAWebSocketProjectionId, EDA_WEB_SOCKET_PROJECTION_HEADER, EDA_WEB_SOCKET_STREAM_PARAM, SessionBatchInput, SessionBlockInput, SessionCommandInput, SessionGrantRunInput, SessionOutcomeInput, SessionScopedInput, SessionTranscriptWindowInput, SessionTranscriptWindowResult, TranscriptStorageStatus, decodeEdaRpcCommand, decodeEdaRpcSubmittables, defaultActiveContentCadenceMs, edaRuntimeConfig, edaSessionRpc, encodeEdaRpcCommand, encodeEdaRpcCommittedDurableEvent, encodeEdaRpcDurableEvent, encodeEdaRpcSessionSnapshot, encodeEdaRpcSubmittables, getEDASessionDurableObjectByName, makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDADurableObjectRuntimeLayer, makeEDAOpenAiClientLayer };
|
|
7
|
+
export { DurableObjectAlarmScheduler, DurableObjectSessionStore, DurableObjectTranscriptBuilder, DurableObjectTranscriptStore, EDARpcSubmittable, EDASessionController, EDASessionDurableObject, EDAWebSocketProjectionId, EDA_WEB_SOCKET_PROJECTION_HEADER, EDA_WEB_SOCKET_STREAM_PARAM, SessionBatchInput, SessionBlockInput, SessionCommandInput, SessionGrantRunInput, SessionOutcomeInput, SessionScopedInput, SessionTranscriptBodyInput, SessionTranscriptBodyResult, SessionTranscriptSummaryInput, SessionTranscriptSummaryResult, SessionTranscriptWindowInput, SessionTranscriptWindowResult, TranscriptCompactionSummary, TranscriptStorageStatus, decodeEdaRpcCommand, decodeEdaRpcSubmittables, defaultActiveContentCadenceMs, edaRuntimeConfig, edaSessionRpc, encodeEdaRpcCommand, encodeEdaRpcCommittedDurableEvent, encodeEdaRpcDurableEvent, encodeEdaRpcSessionSnapshot, encodeEdaRpcSubmittables, getEDASessionDurableObjectByName, makeEDADurableObjectOpenAiModelLayer, makeEDADurableObjectOpenAiModelResolverLayer, makeEDADurableObjectRuntimeLayer, makeEDAOpenAiClientLayer };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { _ as makeTranscriptWindowSource, a as TranscriptBuildSliceError, b as readTranscriptSlots, c as emptyTranscriptEffects, d as publishTranscriptEffects, f as reconcileTranscriptSlots, g as TranscriptRowDecodeError, h as runTranscriptSlice, l as hasPendingTranscriptWork, m as resolveTranscriptSliceLimits, n as makeDurableObjectEventLog, o as carriedDefinition, p as recordTranscriptSliceFailure, u as missedSessionAlert, v as readLogIncarnation, x as transcriptVersionMetaOf, y as readOrMintLogIncarnation } from "./durable-object-store-Ca0pvpa_.js";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Exit from "effect/Exit";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import { EDACommand, GrantRunCommand } from "effect-durable-agent/types/commands";
|
|
7
7
|
import { DurableEventEnvelope, EDADurableEvent, effectDurableAgentNamespace } from "effect-durable-agent/types/events";
|
|
8
|
-
import { CommandId, RunRequestId, SequenceNumber, SessionId } from "effect-durable-agent/types/core";
|
|
8
|
+
import { CommandId, CompactionId, RunRequestId, SequenceNumber, SessionId, SummaryId } from "effect-durable-agent/types/core";
|
|
9
9
|
import { EDATraceMetadata } from "effect-durable-agent/types/tracing";
|
|
10
10
|
import { CommittedDurableEvent, EDASessionStoreError } from "effect-durable-agent/services/session-store";
|
|
11
11
|
import { CommittedCommandTerminalEvent } from "effect-durable-agent/services/runtime";
|
|
12
12
|
import { DurableTranscriptMessages, EDASessionSnapshot } from "effect-durable-agent/services/session-query";
|
|
13
13
|
import { RunGrantResult, RunRequestOutcome } from "effect-durable-agent/domain/run-scheduling";
|
|
14
|
-
import { EDATranscriptStore, TranscriptLogIncarnation, TranscriptVersion, TranscriptVersionMeta, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector, buildingTranscriptWindow, readTranscriptWindowFrom } from "effect-durable-agent/transcript";
|
|
14
|
+
import { EDATranscriptStore, TranscriptBodySource, TranscriptLogIncarnation, TranscriptVersion, TranscriptVersionMeta, TranscriptWindow, TranscriptWindowLimits, TranscriptWindowSelector, buildingTranscriptWindow, readTranscriptWindowFrom } from "effect-durable-agent/transcript";
|
|
15
15
|
import * as Result from "effect/Result";
|
|
16
16
|
//#region src/rpc-codec.ts
|
|
17
17
|
/** Encode one durable event into a structured-clone-safe Durable Object RPC value. */
|
|
@@ -36,17 +36,26 @@ const decodeEdaRpcSubmittables = (input) => Effect.forEach(input, (item) => Sche
|
|
|
36
36
|
/**
|
|
37
37
|
* Maintenance state of one session's transcript, as a host backfill records it (§7).
|
|
38
38
|
*
|
|
39
|
-
* `converged` is the backfill's proof
|
|
40
|
-
* and no builder or
|
|
39
|
+
* - `Enabled`: the host maintains this session's transcript. `converged` is the backfill's proof
|
|
40
|
+
* condition: the active version is `currentVersion`, healthy and at the head, and no builder or
|
|
41
|
+
* cleanup work remains.
|
|
42
|
+
* - `Disabled`: the host has not enabled this session (a rollout ring). It is reported read-only:
|
|
43
|
+
* any stored versions are listed as they are, nothing is maintained, and no incarnation is
|
|
44
|
+
* minted, so `incarnation` is present only when one already exists or can be adopted.
|
|
41
45
|
*/
|
|
42
|
-
const TranscriptStorageStatus = Schema.
|
|
46
|
+
const TranscriptStorageStatus = Schema.Union([Schema.TaggedStruct("Enabled", {
|
|
43
47
|
incarnation: TranscriptLogIncarnation,
|
|
44
48
|
headSeq: SequenceNumber,
|
|
45
49
|
currentVersion: TranscriptVersion,
|
|
46
50
|
versions: Schema.Array(TranscriptVersionMeta),
|
|
47
51
|
pending: Schema.Boolean,
|
|
48
52
|
converged: Schema.Boolean
|
|
49
|
-
})
|
|
53
|
+
}), Schema.TaggedStruct("Disabled", {
|
|
54
|
+
incarnation: Schema.optionalKey(TranscriptLogIncarnation),
|
|
55
|
+
headSeq: SequenceNumber,
|
|
56
|
+
currentVersion: TranscriptVersion,
|
|
57
|
+
versions: Schema.Array(TranscriptVersionMeta)
|
|
58
|
+
})]);
|
|
50
59
|
/**
|
|
51
60
|
* Storage-level transcript service of one session Durable Object: reads, status and builder
|
|
52
61
|
* slices over the same SQLite tables the session store maintains in its appends.
|
|
@@ -65,10 +74,7 @@ var DurableObjectTranscriptStore = class DurableObjectTranscriptStore {
|
|
|
65
74
|
this.#storage = options.storage;
|
|
66
75
|
this.#options = options.transcript;
|
|
67
76
|
this.#log = makeDurableObjectEventLog(options.storage.sql, options.sessionId);
|
|
68
|
-
this.#limits =
|
|
69
|
-
...defaultTranscriptSliceLimits,
|
|
70
|
-
...options.transcript.sliceLimits
|
|
71
|
-
};
|
|
77
|
+
this.#limits = resolveTranscriptSliceLimits(options.transcript.sliceLimits);
|
|
72
78
|
}
|
|
73
79
|
/** The `EDATranscriptStore` port over this store. */
|
|
74
80
|
static layer = (options) => Layer.sync(EDATranscriptStore, () => new DurableObjectTranscriptStore(options).port);
|
|
@@ -79,7 +85,11 @@ var DurableObjectTranscriptStore = class DurableObjectTranscriptStore {
|
|
|
79
85
|
if (active === void 0) return Result.succeed(buildingTranscriptWindow(incarnation, this.#options.definitions.current.version));
|
|
80
86
|
const carried = carriedDefinition(this.#options.definitions, active.version) !== void 0;
|
|
81
87
|
try {
|
|
82
|
-
|
|
88
|
+
const window = readTranscriptWindowFrom(makeTranscriptWindowSource(this.#storage.sql, incarnation, active, carried), selector, limits);
|
|
89
|
+
return Result.isSuccess(window) && window.success.readiness._tag === "Ready" && active.cursor < this.#log.head() ? Result.succeed({
|
|
90
|
+
...window.success,
|
|
91
|
+
readiness: { _tag: "UpdatingHistory" }
|
|
92
|
+
}) : window;
|
|
83
93
|
} catch (error) {
|
|
84
94
|
if (!(error instanceof TranscriptRowDecodeError)) throw error;
|
|
85
95
|
return Result.succeed({
|
|
@@ -109,6 +119,7 @@ var DurableObjectTranscriptStore = class DurableObjectTranscriptStore {
|
|
|
109
119
|
const pending = hasPendingTranscriptWork(this.#storage, config, headSeq);
|
|
110
120
|
const active = slots.find((slot) => slot.role === "active");
|
|
111
121
|
return {
|
|
122
|
+
_tag: "Enabled",
|
|
112
123
|
incarnation,
|
|
113
124
|
headSeq,
|
|
114
125
|
currentVersion: config.current.version,
|
|
@@ -117,6 +128,27 @@ var DurableObjectTranscriptStore = class DurableObjectTranscriptStore {
|
|
|
117
128
|
converged: !pending && active?.version === config.current.version && active.status._tag === "Ok"
|
|
118
129
|
};
|
|
119
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Status of a session the host has not enabled, read without writing anything: no version is
|
|
133
|
+
* initialized or reconciled and no incarnation is minted.
|
|
134
|
+
*/
|
|
135
|
+
disabledStatus() {
|
|
136
|
+
const incarnation = readLogIncarnation(this.#storage.sql, this.#options.adoptIncarnation);
|
|
137
|
+
return {
|
|
138
|
+
_tag: "Disabled",
|
|
139
|
+
...incarnation === void 0 ? {} : { incarnation },
|
|
140
|
+
headSeq: this.#log.head(),
|
|
141
|
+
currentVersion: this.#options.definitions.current.version,
|
|
142
|
+
versions: readTranscriptSlots(this.#storage.sql).flatMap((slot) => transcriptVersionMetaOf(slot) ?? [])
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* This log's incarnation, minted (or adopted from the host's key) inside a transaction the
|
|
147
|
+
* same way window reads mint it. Body and summary reads check a reference against it.
|
|
148
|
+
*/
|
|
149
|
+
incarnation() {
|
|
150
|
+
return this.#transact(() => readOrMintLogIncarnation(this.#storage.sql, this.#options.adoptIncarnation));
|
|
151
|
+
}
|
|
120
152
|
/** Raise the missed-session alert if the active version is no longer carried. */
|
|
121
153
|
auditMissedSession() {
|
|
122
154
|
const alert = missedSessionAlert(this.#storage, this.#options.definitions);
|
|
@@ -131,7 +163,29 @@ var DurableObjectTranscriptStore = class DurableObjectTranscriptStore {
|
|
|
131
163
|
}
|
|
132
164
|
/** Run one bounded builder slice in its own transaction; returns whether work remains. */
|
|
133
165
|
runSlice() {
|
|
134
|
-
|
|
166
|
+
try {
|
|
167
|
+
return this.#transact((effects) => runTranscriptSlice(this.#storage, this.#options.definitions, this.#log, this.#limits, effects));
|
|
168
|
+
} catch (error) {
|
|
169
|
+
if (!(error instanceof TranscriptBuildSliceError)) throw error;
|
|
170
|
+
if (this.#recordSliceFailure(error.cause)) return this.hasPendingWork();
|
|
171
|
+
throw error.cause;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/** Record a thrown slice in its own transaction; returns whether a version was frozen. */
|
|
175
|
+
#recordSliceFailure(cause) {
|
|
176
|
+
try {
|
|
177
|
+
return this.#transact((effects) => recordTranscriptSliceFailure(this.#storage, this.#options.definitions, this.#log, this.#limits, cause, effects));
|
|
178
|
+
} catch (error) {
|
|
179
|
+
console.error("EDA transcript could not record a failed builder slice", error);
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Raise an alert through the host observer. */
|
|
184
|
+
alert(alert) {
|
|
185
|
+
publishTranscriptEffects(this.#options.observer, {
|
|
186
|
+
alerts: [alert],
|
|
187
|
+
pendingWork: false
|
|
188
|
+
});
|
|
135
189
|
}
|
|
136
190
|
/** The `EDATranscriptStore` port: the same reads as Effects. */
|
|
137
191
|
get port() {
|
|
@@ -248,8 +302,54 @@ const SessionTranscriptWindowInput = Schema.Struct({
|
|
|
248
302
|
selector: TranscriptWindowSelector,
|
|
249
303
|
limits: Schema.optionalKey(TranscriptWindowLimits)
|
|
250
304
|
});
|
|
251
|
-
/**
|
|
252
|
-
|
|
305
|
+
/**
|
|
306
|
+
* A window; a cursor minted for another incarnation or version (the client takes `Latest`); or a
|
|
307
|
+
* session the host has not enabled for transcripts.
|
|
308
|
+
*/
|
|
309
|
+
const SessionTranscriptWindowResult = Schema.Union([
|
|
310
|
+
Schema.TaggedStruct("Window", { window: TranscriptWindow }),
|
|
311
|
+
Schema.TaggedStruct("CursorMismatch", { message: Schema.String }),
|
|
312
|
+
Schema.TaggedStruct("Disabled", {})
|
|
313
|
+
]);
|
|
314
|
+
/** A runtime-free read of the body a transcript `Ref` names, by its immutable log source. */
|
|
315
|
+
const SessionTranscriptBodyInput = Schema.Struct({
|
|
316
|
+
...SessionScopedInput.fields,
|
|
317
|
+
source: TranscriptBodySource,
|
|
318
|
+
/**
|
|
319
|
+
* The log incarnation the reference was minted in (the window's `incarnation`). Required: a
|
|
320
|
+
* wiped log invalidates every reference, so a reference never resolves against another log.
|
|
321
|
+
*/
|
|
322
|
+
incarnation: TranscriptLogIncarnation
|
|
323
|
+
});
|
|
324
|
+
/** The body as the JSON the interpreter would have inlined, or why the log has none there. */
|
|
325
|
+
const SessionTranscriptBodyResult = Schema.Union([
|
|
326
|
+
Schema.TaggedStruct("Body", { value: Schema.Json }),
|
|
327
|
+
Schema.TaggedStruct("NotFound", { message: Schema.String }),
|
|
328
|
+
Schema.TaggedStruct("IncarnationMismatch", { incarnation: TranscriptLogIncarnation }),
|
|
329
|
+
Schema.TaggedStruct("Disabled", {})
|
|
330
|
+
]);
|
|
331
|
+
/** A runtime-free read of the summary a transcript `compaction` record references. */
|
|
332
|
+
const SessionTranscriptSummaryInput = Schema.Struct({
|
|
333
|
+
...SessionScopedInput.fields,
|
|
334
|
+
summaryId: SummaryId,
|
|
335
|
+
/** The log incarnation the compaction record was read from (the window's `incarnation`). */
|
|
336
|
+
incarnation: TranscriptLogIncarnation
|
|
337
|
+
});
|
|
338
|
+
/** The user-visible part of one compaction summary: its text and the log span it summarizes. */
|
|
339
|
+
const TranscriptCompactionSummary = Schema.Struct({
|
|
340
|
+
compactionId: CompactionId,
|
|
341
|
+
summaryId: SummaryId,
|
|
342
|
+
text: Schema.String,
|
|
343
|
+
sourceFromSeq: SequenceNumber,
|
|
344
|
+
sourceToSeq: SequenceNumber
|
|
345
|
+
});
|
|
346
|
+
/** The summary, or `NotFound` when this log has no summary with that id. */
|
|
347
|
+
const SessionTranscriptSummaryResult = Schema.Union([
|
|
348
|
+
Schema.TaggedStruct("Summary", { summary: TranscriptCompactionSummary }),
|
|
349
|
+
Schema.TaggedStruct("NotFound", { message: Schema.String }),
|
|
350
|
+
Schema.TaggedStruct("IncarnationMismatch", { incarnation: TranscriptLogIncarnation }),
|
|
351
|
+
Schema.TaggedStruct("Disabled", {})
|
|
352
|
+
]);
|
|
253
353
|
/** Private session RPC contracts retain the deployed structured-clone shapes, including snapshot Maps. */
|
|
254
354
|
const edaSessionRpc = {
|
|
255
355
|
submit: {
|
|
@@ -295,9 +395,17 @@ const edaSessionRpc = {
|
|
|
295
395
|
readTranscriptWindow: {
|
|
296
396
|
input: SessionTranscriptWindowInput,
|
|
297
397
|
output: SessionTranscriptWindowResult
|
|
398
|
+
},
|
|
399
|
+
readTranscriptBody: {
|
|
400
|
+
input: SessionTranscriptBodyInput,
|
|
401
|
+
output: SessionTranscriptBodyResult
|
|
402
|
+
},
|
|
403
|
+
readTranscriptSummary: {
|
|
404
|
+
input: SessionTranscriptSummaryInput,
|
|
405
|
+
output: SessionTranscriptSummaryResult
|
|
298
406
|
}
|
|
299
407
|
};
|
|
300
408
|
//#endregion
|
|
301
|
-
export { encodeEdaRpcDurableEvent as _, SessionOutcomeInput as a,
|
|
409
|
+
export { encodeEdaRpcSubmittables as C, encodeEdaRpcDurableEvent as S, TranscriptStorageStatus as _, SessionOutcomeInput as a, decodeEdaRpcSubmittables as b, SessionTranscriptBodyResult as c, SessionTranscriptWindowInput as d, SessionTranscriptWindowResult as f, DurableObjectTranscriptStore as g, DurableObjectTranscriptBuilder as h, SessionGrantRunInput as i, SessionTranscriptSummaryInput as l, edaSessionRpc as m, SessionBlockInput as n, SessionScopedInput as o, TranscriptCompactionSummary as p, SessionCommandInput as r, SessionTranscriptBodyInput as s, SessionBatchInput as t, SessionTranscriptSummaryResult as u, EDARpcSubmittable as v, encodeEdaRpcCommand as x, decodeEdaRpcCommand as y };
|
|
302
410
|
|
|
303
|
-
//# sourceMappingURL=rpc-spec-
|
|
411
|
+
//# sourceMappingURL=rpc-spec-BupIkBhI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-spec-BupIkBhI.js","names":["#storage","#options","#log","#limits","#prepare","#transact","#recordSliceFailure"],"sources":["../src/rpc-codec.ts","../src/durable-object-transcript.ts","../src/rpc-spec.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport * as Schema from \"effect/Schema\";\n\nimport { EDACommand } from \"effect-durable-agent/types/commands\";\nimport type { EDASubmittable } from \"effect-durable-agent/services/session-state\";\nimport {\n DurableEventEnvelope,\n EDADurableEvent,\n effectDurableAgentNamespace,\n} from \"effect-durable-agent/types/events\";\n\n/** Encode one durable event into a structured-clone-safe Durable Object RPC value. */\nexport const encodeEdaRpcDurableEvent = (event: DurableEventEnvelope): DurableEventEnvelope => {\n const encoded =\n event.namespace === effectDurableAgentNamespace\n ? Schema.encodeSync(EDADurableEvent)(Schema.decodeUnknownSync(EDADurableEvent)(event))\n : Schema.encodeSync(DurableEventEnvelope)(event);\n return Schema.decodeUnknownSync(DurableEventEnvelope)(encoded);\n};\n\n/** Command/application-event RPC admission union; controller validation owns admission authorization. */\nexport const EDARpcSubmittable = Schema.Union([EDACommand, DurableEventEnvelope]);\n\nexport const encodeEdaRpcCommand = (input: EDACommand): typeof EDACommand.Encoded =>\n Schema.encodeSync(EDACommand)(input);\n\nexport const encodeEdaRpcSubmittables = (\n input: ReadonlyArray<EDASubmittable>,\n): ReadonlyArray<typeof EDARpcSubmittable.Encoded> =>\n input.map((item) => Schema.encodeSync(EDARpcSubmittable)(item));\n\nexport const decodeEdaRpcCommand = (\n input: unknown,\n): Effect.Effect<EDACommand, Schema.SchemaError> =>\n Schema.decodeUnknownExit(EDACommand)(input).pipe(\n Exit.match({ onFailure: Effect.failCause, onSuccess: Effect.succeed }),\n );\n\nexport const decodeEdaRpcSubmittables = (\n input: ReadonlyArray<unknown>,\n): Effect.Effect<ReadonlyArray<EDASubmittable>, Schema.SchemaError> =>\n Effect.forEach(input, (item) =>\n Schema.decodeUnknownExit(EDARpcSubmittable)(item).pipe(\n Exit.match({ onFailure: Effect.failCause, onSuccess: Effect.succeed }),\n ),\n );\n","import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\n\nimport { EDASessionStoreError } from \"effect-durable-agent/services/session-store\";\nimport { SequenceNumber, type SessionId } from \"effect-durable-agent/types/core\";\nimport {\n EDATranscriptStore,\n TranscriptLogIncarnation,\n TranscriptVersion,\n TranscriptVersionMeta,\n buildingTranscriptWindow,\n readTranscriptWindowFrom,\n type EDATranscriptStoreShape,\n type TranscriptCursorMismatch,\n type TranscriptVersionMeta as TranscriptVersionMetaType,\n type TranscriptWindow,\n type TranscriptWindowLimits,\n type TranscriptWindowSelector,\n} from \"effect-durable-agent/transcript\";\nimport type { DurableObjectSessionStorage } from \"./durable-object-storage\";\nimport { makeDurableObjectEventLog } from \"./durable-object-store\";\nimport {\n carriedDefinition,\n resolveTranscriptSliceLimits,\n emptyTranscriptEffects,\n hasPendingTranscriptWork,\n missedSessionAlert,\n publishTranscriptEffects,\n reconcileTranscriptSlots,\n recordTranscriptSliceFailure,\n TranscriptBuildSliceError,\n runTranscriptSlice,\n type DurableObjectTranscriptOptions,\n type DurableObjectTranscriptSliceLimits,\n type TranscriptAlert,\n type TranscriptEffects,\n type TranscriptEventLog,\n} from \"./durable-object-transcript-maintenance\";\nimport {\n makeTranscriptWindowSource,\n readLogIncarnation,\n readOrMintLogIncarnation,\n readTranscriptSlots,\n transcriptVersionMetaOf,\n TranscriptRowDecodeError,\n type TranscriptSlot,\n} from \"./durable-object-transcript-tables\";\n\n/**\n * Maintenance state of one session's transcript, as a host backfill records it (§7).\n *\n * - `Enabled`: the host maintains this session's transcript. `converged` is the backfill's proof\n * condition: the active version is `currentVersion`, healthy and at the head, and no builder or\n * cleanup work remains.\n * - `Disabled`: the host has not enabled this session (a rollout ring). It is reported read-only:\n * any stored versions are listed as they are, nothing is maintained, and no incarnation is\n * minted, so `incarnation` is present only when one already exists or can be adopted.\n */\nexport const TranscriptStorageStatus = Schema.Union([\n Schema.TaggedStruct(\"Enabled\", {\n incarnation: TranscriptLogIncarnation,\n headSeq: SequenceNumber,\n currentVersion: TranscriptVersion,\n versions: Schema.Array(TranscriptVersionMeta),\n pending: Schema.Boolean,\n converged: Schema.Boolean,\n }),\n Schema.TaggedStruct(\"Disabled\", {\n incarnation: Schema.optionalKey(TranscriptLogIncarnation),\n headSeq: SequenceNumber,\n currentVersion: TranscriptVersion,\n versions: Schema.Array(TranscriptVersionMeta),\n }),\n]);\nexport type TranscriptStorageStatus = typeof TranscriptStorageStatus.Type;\n\n/** Construction options for the runtime-free transcript store of one session. */\nexport interface DurableObjectTranscriptStoreOptions {\n readonly sessionId: SessionId;\n readonly storage: DurableObjectSessionStorage;\n readonly transcript: DurableObjectTranscriptOptions;\n}\n\n/**\n * Storage-level transcript service of one session Durable Object: reads, status and builder\n * slices over the same SQLite tables the session store maintains in its appends.\n *\n * It never constructs the model runtime, reducers or sinks, so a cold object can serve SSR and\n * CLI reads and advance a backfill without starting an agent. It holds no cache: every call\n * reads storage, so a storage wipe or another writer is always observed. Every method is\n * synchronous, which makes each window a single cut. Callers must have run the store migration.\n */\nexport class DurableObjectTranscriptStore {\n readonly #storage: DurableObjectSessionStorage;\n readonly #options: DurableObjectTranscriptOptions;\n readonly #log: TranscriptEventLog;\n readonly #limits: DurableObjectTranscriptSliceLimits;\n\n constructor(options: DurableObjectTranscriptStoreOptions) {\n this.#storage = options.storage;\n this.#options = options.transcript;\n this.#log = makeDurableObjectEventLog(options.storage.sql, options.sessionId);\n this.#limits = resolveTranscriptSliceLimits(options.transcript.sliceLimits);\n }\n\n /** The `EDATranscriptStore` port over this store. */\n static readonly layer = (options: DurableObjectTranscriptStoreOptions) =>\n Layer.sync(EDATranscriptStore, () => new DurableObjectTranscriptStore(options).port);\n\n /** Read one complete window of the served version at a single cut. */\n readWindow(\n selector: TranscriptWindowSelector,\n limits: TranscriptWindowLimits,\n ): Result.Result<TranscriptWindow, TranscriptCursorMismatch> {\n const { incarnation, slots } = this.#prepare();\n const active = slots.find((slot) => slot.role === \"active\");\n if (active === undefined) {\n return Result.succeed(\n buildingTranscriptWindow(incarnation, this.#options.definitions.current.version),\n );\n }\n const carried = carriedDefinition(this.#options.definitions, active.version) !== undefined;\n try {\n const window = readTranscriptWindowFrom(\n makeTranscriptWindowSource(this.#storage.sql, incarnation, active, carried),\n selector,\n limits,\n );\n // An active version behind the head (re-enabled after its session was disabled, or caught\n // up by the builder for any other reason) serves its consistent last cut, but never as\n // current: it reads as updating history until the builder brings it to the head.\n return Result.isSuccess(window) &&\n window.success.readiness._tag === \"Ready\" &&\n active.cursor < this.#log.head()\n ? Result.succeed({ ...window.success, readiness: { _tag: \"UpdatingHistory\" } })\n : window;\n } catch (error) {\n // Only a stored row this release cannot decode serves nothing rather than a wrong view (§7);\n // a storage failure is an error.\n if (!(error instanceof TranscriptRowDecodeError)) throw error;\n return Result.succeed({\n incarnation,\n version: active.version,\n throughSeq: active.cursor,\n records: [],\n dependencies: [],\n hasOlder: false,\n hasNewer: false,\n readiness: {\n _tag: \"Unreadable\",\n error: error instanceof Error ? error.message : String(error),\n },\n });\n }\n }\n\n /** Maintenance state of every version present. */\n readMeta(): ReadonlyArray<TranscriptVersionMetaType> {\n return this.#prepare().slots.flatMap((slot) => transcriptVersionMetaOf(slot) ?? []);\n }\n\n /** Status for builders, backfill proofs and alerts. */\n status(): Extract<TranscriptStorageStatus, { readonly _tag: \"Enabled\" }> {\n const { incarnation, slots } = this.#prepare();\n const headSeq = this.#log.head();\n const config = this.#options.definitions;\n const pending = hasPendingTranscriptWork(this.#storage, config, headSeq);\n const active = slots.find((slot) => slot.role === \"active\");\n return {\n _tag: \"Enabled\",\n incarnation,\n headSeq,\n currentVersion: config.current.version,\n versions: slots.flatMap((slot) => transcriptVersionMetaOf(slot) ?? []),\n pending,\n converged:\n !pending && active?.version === config.current.version && active.status._tag === \"Ok\",\n };\n }\n\n /**\n * Status of a session the host has not enabled, read without writing anything: no version is\n * initialized or reconciled and no incarnation is minted.\n */\n disabledStatus(): Extract<TranscriptStorageStatus, { readonly _tag: \"Disabled\" }> {\n const incarnation = readLogIncarnation(this.#storage.sql, this.#options.adoptIncarnation);\n return {\n _tag: \"Disabled\",\n ...(incarnation === undefined ? {} : { incarnation }),\n headSeq: this.#log.head(),\n currentVersion: this.#options.definitions.current.version,\n versions: readTranscriptSlots(this.#storage.sql).flatMap(\n (slot) => transcriptVersionMetaOf(slot) ?? [],\n ),\n };\n }\n\n /**\n * This log's incarnation, minted (or adopted from the host's key) inside a transaction the\n * same way window reads mint it. Body and summary reads check a reference against it.\n */\n incarnation(): TranscriptLogIncarnation {\n return this.#transact(() =>\n readOrMintLogIncarnation(this.#storage.sql, this.#options.adoptIncarnation),\n );\n }\n\n /** Raise the missed-session alert if the active version is no longer carried. */\n auditMissedSession(): void {\n const alert = missedSessionAlert(this.#storage, this.#options.definitions);\n if (alert !== undefined)\n publishTranscriptEffects(this.#options.observer, { alerts: [alert], pendingWork: false });\n }\n\n /** Whether a builder or cleanup slice has work to do. */\n hasPendingWork(): boolean {\n return hasPendingTranscriptWork(this.#storage, this.#options.definitions, this.#log.head());\n }\n\n /** Run one bounded builder slice in its own transaction; returns whether work remains. */\n runSlice(): boolean {\n try {\n return this.#transact((effects) =>\n runTranscriptSlice(\n this.#storage,\n this.#options.definitions,\n this.#log,\n this.#limits,\n effects,\n ),\n );\n } catch (error) {\n // The slice rolled back. A failure while advancing its build target counts against that\n // target, which freezes at the limit; any other failure is bounded by the builder alarm.\n if (!(error instanceof TranscriptBuildSliceError)) throw error;\n if (this.#recordSliceFailure(error.cause)) return this.hasPendingWork();\n throw error.cause;\n }\n }\n\n /** Record a thrown slice in its own transaction; returns whether a version was frozen. */\n #recordSliceFailure(cause: unknown): boolean {\n try {\n return this.#transact((effects) =>\n recordTranscriptSliceFailure(\n this.#storage,\n this.#options.definitions,\n this.#log,\n this.#limits,\n cause,\n effects,\n ),\n );\n } catch (error) {\n // Storage refuses even the failure record; the caller still sees the original failure,\n // and the builder alarm's own failure count bounds its retries.\n console.error(\"EDA transcript could not record a failed builder slice\", error);\n return false;\n }\n }\n\n /** Raise an alert through the host observer. */\n alert(alert: TranscriptAlert): void {\n publishTranscriptEffects(this.#options.observer, { alerts: [alert], pendingWork: false });\n }\n\n /** The `EDATranscriptStore` port: the same reads as Effects. */\n get port(): EDATranscriptStoreShape {\n return {\n readTranscriptWindow: (selector, limits) =>\n Effect.try({\n try: () => this.readWindow(selector, limits),\n catch: (error) => storeError(\"reading transcript window\", error),\n }).pipe(\n Effect.flatMap((window) =>\n Result.isSuccess(window) ? Effect.succeed(window.success) : Effect.fail(window.failure),\n ),\n ),\n readTranscriptMeta: Effect.try({\n try: () => this.readMeta(),\n catch: (error) => storeError(\"reading transcript meta\", error),\n }),\n };\n }\n\n /**\n * Reconcile versions (a brand-new log initializes `current` at seq 0 before its first read)\n * and read the incarnation and slots, all in one transaction.\n */\n #prepare(): {\n readonly incarnation: TranscriptLogIncarnation;\n readonly slots: ReadonlyArray<TranscriptSlot>;\n } {\n return this.#transact((effects) => {\n reconcileTranscriptSlots(this.#storage, this.#options.definitions, this.#log.head(), effects);\n return {\n incarnation: readOrMintLogIncarnation(this.#storage.sql, this.#options.adoptIncarnation),\n slots: readTranscriptSlots(this.#storage.sql),\n };\n });\n }\n\n #transact<A>(body: (effects: TranscriptEffects) => A): A {\n const effects = emptyTranscriptEffects();\n const result = this.#storage.transactionSync(() => body(effects));\n publishTranscriptEffects(this.#options.observer, effects);\n return result;\n }\n}\n\nconst storeError = (operation: string, cause: unknown) =>\n new EDASessionStoreError({\n message: `${operation}: ${cause instanceof Error ? cause.message : String(cause)}`,\n });\n\n/**\n * Drives builder and cleanup slices for one session object (§7 \"The builder\").\n *\n * Builder state lives entirely in `_eda_transcript_meta`, so whichever entry point notices\n * pending work — the constructor, an alarm, a status request — runs or schedules the next slice;\n * nothing depends on in-memory state surviving eviction. Slices run through the storage service\n * only and never construct the model runtime.\n */\nexport class DurableObjectTranscriptBuilder {\n constructor(\n private readonly store: DurableObjectTranscriptStore,\n /** Durably request a builder wakeup as soon as possible. */\n private readonly wake: () => Promise<void>,\n ) {}\n\n /** At object start: raise standing alerts and schedule a slice if any work is pending. */\n async start(): Promise<void> {\n this.store.auditMissedSession();\n await this.kick();\n }\n\n /** Schedule a slice if any work is pending. */\n async kick(): Promise<void> {\n if (this.store.hasPendingWork()) await this.wake();\n }\n\n /**\n * Run up to `maxSlices` slices, letting other requests in between them, and schedule a\n * continuation if work remains. Returns whether work remains.\n */\n async run(maxSlices: number): Promise<boolean> {\n const more = await this.runSlices(maxSlices);\n if (more) await this.wake();\n return more;\n }\n\n /** Run up to `maxSlices` slices without scheduling a continuation; returns whether work remains. */\n async runSlices(maxSlices: number): Promise<boolean> {\n for (let slice = 0; slice < maxSlices; slice += 1) {\n if (slice > 0) await new Promise((resolve) => setTimeout(resolve, 0));\n if (!this.store.runSlice()) return false;\n }\n return true;\n }\n}\n","import * as Schema from \"effect/Schema\";\nimport { EDACommand, GrantRunCommand } from \"effect-durable-agent/types/commands\";\nimport {\n CommandId,\n CompactionId,\n RunRequestId,\n SequenceNumber,\n SessionId,\n SummaryId,\n} from \"effect-durable-agent/types/core\";\nimport { EDATraceMetadata } from \"effect-durable-agent/types/tracing\";\nimport { CommittedDurableEvent } from \"effect-durable-agent/services/session-store\";\nimport { CommittedCommandTerminalEvent } from \"effect-durable-agent/services/runtime\";\nimport {\n EDASessionSnapshot,\n DurableTranscriptMessages,\n} from \"effect-durable-agent/services/session-query\";\nimport { RunGrantResult, RunRequestOutcome } from \"effect-durable-agent/domain/run-scheduling\";\nimport {\n TranscriptBodySource,\n TranscriptLogIncarnation,\n TranscriptWindow,\n TranscriptWindowLimits,\n TranscriptWindowSelector,\n} from \"effect-durable-agent/transcript\";\nimport { TranscriptStorageStatus } from \"./durable-object-transcript\";\nimport { EDARpcSubmittable } from \"./rpc-codec\";\n\n/** Names the session isolation boundary and carries caller trace metadata. */\nexport const SessionScopedInput = Schema.Struct({ sessionId: SessionId, trace: EDATraceMetadata });\n/** Ordinary command admission; controller validation excludes trusted scheduler grants. */\nexport const SessionCommandInput = Schema.Struct({\n ...SessionScopedInput.fields,\n command: EDACommand,\n});\n/** Trusted scheduler permission for a reserved run; ordinary command ingress cannot grant it. */\nexport const SessionGrantRunInput = Schema.Struct({\n ...SessionScopedInput.fields,\n command: GrantRunCommand,\n});\n/** Atomic ordered admission of ordinary commands and application events for one session. */\nexport const SessionBatchInput = Schema.Struct({\n ...SessionScopedInput.fields,\n items: Schema.Array(EDARpcSubmittable),\n});\n/** Waits for one command terminal after an optional durable replay position. */\nexport const SessionBlockInput = Schema.Struct({\n ...SessionScopedInput.fields,\n afterSeq: Schema.optionalKey(SequenceNumber),\n commandId: CommandId,\n});\n/** Reconciles a scheduler request against the named session’s authoritative state. */\nexport const SessionOutcomeInput = Schema.Struct({\n ...SessionScopedInput.fields,\n requestId: RunRequestId,\n});\n/** A runtime-free transcript window read; `limits` defaults to the transcript window defaults. */\nexport const SessionTranscriptWindowInput = Schema.Struct({\n ...SessionScopedInput.fields,\n selector: TranscriptWindowSelector,\n limits: Schema.optionalKey(TranscriptWindowLimits),\n});\n/**\n * A window; a cursor minted for another incarnation or version (the client takes `Latest`); or a\n * session the host has not enabled for transcripts.\n */\nexport const SessionTranscriptWindowResult = Schema.Union([\n Schema.TaggedStruct(\"Window\", { window: TranscriptWindow }),\n Schema.TaggedStruct(\"CursorMismatch\", { message: Schema.String }),\n /** The host has not enabled transcript maintenance for this session. */\n Schema.TaggedStruct(\"Disabled\", {}),\n]);\n/** A runtime-free read of the body a transcript `Ref` names, by its immutable log source. */\nexport const SessionTranscriptBodyInput = Schema.Struct({\n ...SessionScopedInput.fields,\n source: TranscriptBodySource,\n /**\n * The log incarnation the reference was minted in (the window's `incarnation`). Required: a\n * wiped log invalidates every reference, so a reference never resolves against another log.\n */\n incarnation: TranscriptLogIncarnation,\n});\n/** The body as the JSON the interpreter would have inlined, or why the log has none there. */\nexport const SessionTranscriptBodyResult = Schema.Union([\n Schema.TaggedStruct(\"Body\", { value: Schema.Json }),\n Schema.TaggedStruct(\"NotFound\", { message: Schema.String }),\n /** The reference names another log: the client takes a new window. */\n Schema.TaggedStruct(\"IncarnationMismatch\", { incarnation: TranscriptLogIncarnation }),\n /** The session is outside the host's transcript rollout. */\n Schema.TaggedStruct(\"Disabled\", {}),\n]);\n/** A runtime-free read of the summary a transcript `compaction` record references. */\nexport const SessionTranscriptSummaryInput = Schema.Struct({\n ...SessionScopedInput.fields,\n summaryId: SummaryId,\n /** The log incarnation the compaction record was read from (the window's `incarnation`). */\n incarnation: TranscriptLogIncarnation,\n});\n/** The user-visible part of one compaction summary: its text and the log span it summarizes. */\nexport const TranscriptCompactionSummary = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n text: Schema.String,\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n});\nexport type TranscriptCompactionSummary = typeof TranscriptCompactionSummary.Type;\n/** The summary, or `NotFound` when this log has no summary with that id. */\nexport const SessionTranscriptSummaryResult = Schema.Union([\n Schema.TaggedStruct(\"Summary\", { summary: TranscriptCompactionSummary }),\n Schema.TaggedStruct(\"NotFound\", { message: Schema.String }),\n Schema.TaggedStruct(\"IncarnationMismatch\", { incarnation: TranscriptLogIncarnation }),\n Schema.TaggedStruct(\"Disabled\", {}),\n]);\n/** Private session RPC contracts retain the deployed structured-clone shapes, including snapshot Maps. */\nexport const edaSessionRpc = {\n submit: { input: SessionCommandInput, output: CommittedDurableEvent },\n submitBatch: { input: SessionBatchInput, output: Schema.Array(CommittedDurableEvent) },\n submitAndBlock: { input: SessionCommandInput, output: CommittedCommandTerminalEvent },\n blockOnCommand: { input: SessionBlockInput, output: CommittedCommandTerminalEvent },\n grantRun: { input: SessionGrantRunInput, output: RunGrantResult },\n runRequestOutcome: { input: SessionOutcomeInput, output: RunRequestOutcome },\n snapshot: { input: SessionScopedInput, output: EDASessionSnapshot },\n messages: { input: SessionScopedInput, output: DurableTranscriptMessages },\n destroySession: { input: SessionScopedInput, output: Schema.Void },\n transcriptStatus: { input: SessionScopedInput, output: TranscriptStorageStatus },\n readTranscriptWindow: {\n input: SessionTranscriptWindowInput,\n output: SessionTranscriptWindowResult,\n },\n readTranscriptBody: { input: SessionTranscriptBodyInput, output: SessionTranscriptBodyResult },\n readTranscriptSummary: {\n input: SessionTranscriptSummaryInput,\n output: SessionTranscriptSummaryResult,\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAaA,MAAa,4BAA4B,UAAsD;CAC7F,MAAM,UACJ,MAAM,cAAc,8BAChB,OAAO,WAAW,eAAe,CAAC,CAAC,OAAO,kBAAkB,eAAe,CAAC,CAAC,KAAK,CAAC,IACnF,OAAO,WAAW,oBAAoB,CAAC,CAAC,KAAK;CACnD,OAAO,OAAO,kBAAkB,oBAAoB,CAAC,CAAC,OAAO;AAC/D;;AAGA,MAAa,oBAAoB,OAAO,MAAM,CAAC,YAAY,oBAAoB,CAAC;AAEhF,MAAa,uBAAuB,UAClC,OAAO,WAAW,UAAU,CAAC,CAAC,KAAK;AAErC,MAAa,4BACX,UAEA,MAAM,KAAK,SAAS,OAAO,WAAW,iBAAiB,CAAC,CAAC,IAAI,CAAC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