@effect-agent/storage-cloudflare 0.1.0-beta.38 → 0.1.0-beta.40
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/do-storage-failpoint-9XB9tuif.d.mts +107 -0
- package/dist/do-storage-failpoint-C-Qtchs7.mjs +12 -0
- package/dist/do-storage-failpoint-C-Qtchs7.mjs.map +1 -0
- package/dist/index.d.mts +161 -248
- package/dist/index.mjs +1211 -539
- package/dist/index.mjs.map +1 -1
- package/dist/testing.d.mts +33 -0
- package/dist/testing.mjs +35 -0
- package/dist/testing.mjs.map +1 -0
- package/package.json +14 -7
- package/src/do-journal.ts +148 -157
- package/src/do-ledger.ts +66 -66
- package/src/do-schedule-store.ts +7 -3
- package/src/do-storage-failpoint-testing.ts +73 -0
- package/src/do-storage-failpoint.ts +1 -68
- package/src/do-subscription-store.ts +1122 -0
- package/src/{do-conversation-store.ts → do-thread-store.ts} +313 -334
- package/src/errors.ts +3 -3
- package/src/index.ts +9 -8
- package/src/migrations.ts +28 -35
- package/src/port-protocol.ts +29 -29
- package/src/routing.ts +146 -188
- package/src/testing.ts +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,123 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as DoFenceRejected, c as DoStorageCorruptionError, d as DoStorageFailpointLocation, f as DoValueBoundExceeded, i as DoCheckpointConflict, l as DoStorageError, n as DoStorageFailpointHandler, o as DoLedgerError, r as DoAppendConflict, s as DoStorageCompatibilityError, t as DoStorageFailpoint, u as DoStorageFailpointError } from "./do-storage-failpoint-9XB9tuif.mjs";
|
|
2
|
+
import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionRequest, AdmissionResult, AppendConflict, AppendResult, CanonicalRecordEnvelope, ChildSettledNotification, FenceRejected, FencedAppendRequest, JoinedToHost, LedgerError, MarkReadyRequest, ScheduleFailpointError, ScheduleStorageError, ScheduleStore, SettlementConflict, SourcePartition, SubmissionLedger, SubmissionLookupByKey, SubmissionSnapshot, SubscriptionError, SubscriptionFailpointError, SubscriptionStore, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadRead, ThreadStore, ThreadStoreError, ThreadTail, ThreadTailRequest } from "@effect-agent/thread";
|
|
2
3
|
import { Context, Crypto, Effect, Layer, Schema } from "effect";
|
|
3
4
|
import { SqliteMigrator } from "@effect/sql-sqlite-do";
|
|
4
5
|
import * as SqlClientService from "effect/unstable/sql/SqlClient";
|
|
5
|
-
//#region src/errors.d.ts
|
|
6
|
-
declare const DoStorageCompatibilityError_base: Schema.Class<DoStorageCompatibilityError, Schema.TaggedStruct<"DoStorageCompatibilityError", {
|
|
7
|
-
readonly actualVersion: Schema.Int;
|
|
8
|
-
readonly message: Schema.String;
|
|
9
|
-
readonly supportedVersion: Schema.Int;
|
|
10
|
-
}>, import("effect/Cause").YieldableError>;
|
|
11
|
-
/** The Durable Object's SQLite storage uses a private-development format this adapter cannot read. */
|
|
12
|
-
declare class DoStorageCompatibilityError extends DoStorageCompatibilityError_base {}
|
|
13
|
-
declare const DoStorageCorruptionError_base: Schema.Class<DoStorageCorruptionError, Schema.TaggedStruct<"DoStorageCorruptionError", {
|
|
14
|
-
readonly message: Schema.String;
|
|
15
|
-
readonly rowKey: Schema.String;
|
|
16
|
-
readonly table: Schema.String;
|
|
17
|
-
}>, import("effect/Cause").YieldableError>;
|
|
18
|
-
/** Stored bytes failed the current Schema and cannot be used as recovery truth. */
|
|
19
|
-
declare class DoStorageCorruptionError extends DoStorageCorruptionError_base {}
|
|
20
|
-
declare const DoStorageError_base: Schema.Class<DoStorageError, Schema.TaggedStruct<"DoStorageError", {
|
|
21
|
-
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
22
|
-
readonly message: Schema.String;
|
|
23
|
-
readonly operation: Schema.String;
|
|
24
|
-
}>, import("effect/Cause").YieldableError>;
|
|
25
|
-
/** Durable Object SQLite infrastructure failed while opening or operating the store. */
|
|
26
|
-
declare class DoStorageError extends DoStorageError_base {}
|
|
27
|
-
declare const DoLedgerError_base: Schema.Class<DoLedgerError, Schema.TaggedStruct<"DoLedgerError", {
|
|
28
|
-
readonly cause: Schema.optionalKey<Schema.Defect>;
|
|
29
|
-
readonly message: Schema.String;
|
|
30
|
-
readonly operation: Schema.String;
|
|
31
|
-
}>, import("effect/Cause").YieldableError>;
|
|
32
|
-
/**
|
|
33
|
-
* Durable Object SQLite infrastructure failed while operating the Submission Ledger. Surfaces
|
|
34
|
-
* at the SubmissionLedger port as the typed `LedgerError` with this error preserved as its
|
|
35
|
-
* cause, so the adapter-level tag is never erased.
|
|
36
|
-
*/
|
|
37
|
-
declare class DoLedgerError extends DoLedgerError_base {}
|
|
38
|
-
declare const DoValueBoundExceeded_base: Schema.Class<DoValueBoundExceeded, Schema.TaggedStruct<"DoValueBoundExceeded", {
|
|
39
|
-
readonly actualBytes: Schema.Int;
|
|
40
|
-
readonly maxBytes: Schema.Int;
|
|
41
|
-
readonly operation: Schema.String;
|
|
42
|
-
}>, import("effect/Cause").YieldableError>;
|
|
43
|
-
/**
|
|
44
|
-
* A value to be stored exceeds the configured Durable Object per-value bound
|
|
45
|
-
* (`DoStorageConfigValue.maxStoredValueBytes`, kept under the platform's 2 MB SQLite value
|
|
46
|
-
* limit). The refusal happens typed BEFORE any durable mutation; no partial state is written.
|
|
47
|
-
* Payloads of this size are the designed overflow case for a future R2-backed AttachmentStore
|
|
48
|
-
* (deployment spec §3.1, deferred until a real attachment requirement exists).
|
|
49
|
-
*/
|
|
50
|
-
declare class DoValueBoundExceeded extends DoValueBoundExceeded_base {
|
|
51
|
-
get message(): string;
|
|
52
|
-
}
|
|
53
|
-
declare const DoAppendConflict_base: Schema.Class<DoAppendConflict, Schema.TaggedStruct<"DoAppendConflict", {
|
|
54
|
-
readonly message: Schema.String;
|
|
55
|
-
readonly reason: Schema.Literals<readonly ["batch-digest", "record-identity", "tail"]>;
|
|
56
|
-
readonly actualTailSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/session/CanonicalSequence">>;
|
|
57
|
-
readonly actualTailDigest: Schema.optionalKey<Schema.String>;
|
|
58
|
-
}>, import("effect/Cause").YieldableError>;
|
|
59
|
-
/**
|
|
60
|
-
* A canonical batch retry conflicts with existing append state. Tail conflicts carry the
|
|
61
|
-
* actual committed tail as a diagnostic resume hint.
|
|
62
|
-
*/
|
|
63
|
-
declare class DoAppendConflict extends DoAppendConflict_base {}
|
|
64
|
-
declare const DoFenceRejected_base: Schema.Class<DoFenceRejected, Schema.TaggedStruct<"DoFenceRejected", {
|
|
65
|
-
readonly actualEpoch: Schema.brand<Schema.Natural, "@effect-agent/session/ProducerEpoch">;
|
|
66
|
-
readonly message: Schema.String;
|
|
67
|
-
readonly producerEpoch: Schema.brand<Schema.Natural, "@effect-agent/session/ProducerEpoch">;
|
|
68
|
-
}>, import("effect/Cause").YieldableError>;
|
|
69
|
-
/**
|
|
70
|
-
* A producer epoch does not match the Conversation's current writer registration. Appends
|
|
71
|
-
* require the exact registered epoch, so both older and newer unregistered epochs are fenced;
|
|
72
|
-
* a newer epoch takes over by materializing first.
|
|
73
|
-
*/
|
|
74
|
-
declare class DoFenceRejected extends DoFenceRejected_base {}
|
|
75
|
-
declare const DoCheckpointConflict_base: Schema.Class<DoCheckpointConflict, Schema.TaggedStruct<"DoCheckpointConflict", {
|
|
76
|
-
readonly message: Schema.String;
|
|
77
|
-
}>, import("effect/Cause").YieldableError>;
|
|
78
|
-
/** A checkpoint conflicts with a previously stored checkpoint at the same offset. */
|
|
79
|
-
declare class DoCheckpointConflict extends DoCheckpointConflict_base {}
|
|
80
|
-
/**
|
|
81
|
-
* Deterministic fault-injection locations at Durable Object storage operation boundaries.
|
|
82
|
-
*
|
|
83
|
-
* The string list is copied VERBATIM from `SqliteStorageFailpointLocation`
|
|
84
|
-
* (`packages/storage-sqlite/src/errors.ts`) so every crash-matrix row keeps the same name on
|
|
85
|
-
* both platforms — the DN process-kill evidence and the DC eviction evidence address identical
|
|
86
|
-
* locations. There is intentionally no Cloudflare-only location.
|
|
87
|
-
*/
|
|
88
|
-
declare const DoStorageFailpointLocation: Schema.Literals<readonly ["materialize:before", "materialize:after", "append:before", "append:after-batch-insert", "append:after-record-insert", "append:after-tail-update", "append:after", "export:after-conversation-read", "save-checkpoint:before", "save-checkpoint:after", "ledger:admit:before", "ledger:admit:after", "ledger:mark-ready:before", "ledger:mark-ready:after", "ledger:claim:before", "ledger:claim:after", "ledger:mark-input-applied:before", "ledger:mark-input-applied:after", "ledger:renew:before", "ledger:renew:after", "ledger:reserve-settlement:before", "ledger:reserve-settlement:after", "ledger:finalize-settlement:before", "ledger:finalize-settlement:after", "ledger:request-abort:before", "ledger:request-abort:after", "ledger:release:before", "ledger:release:after", "ledger:claim-joining:before", "ledger:claim-joining:after", "ledger:mark-joined:before", "ledger:mark-joined:after", "ledger:revert-joining:before", "ledger:revert-joining:after", "ledger:suspend:before", "ledger:suspend:after", "ledger:approval-decision:before", "ledger:approval-decision:after", "ledger:mark-unknown:before", "ledger:mark-unknown:after", "ledger:unknown-resolution:before", "ledger:unknown-resolution:after", "ledger:child-reservation:before", "ledger:child-reservation:after", "ledger:child-attach:before", "ledger:child-attach:after", "ledger:child-release-pending:before", "ledger:child-release-pending:after", "ledger:child-release:before", "ledger:child-release:after", "ledger:child-settled:before", "ledger:child-settled:after"]>;
|
|
89
|
-
type DoStorageFailpointLocation = typeof DoStorageFailpointLocation.Type;
|
|
90
|
-
declare const DoStorageFailpointError_base: Schema.Class<DoStorageFailpointError, Schema.TaggedStruct<"DoStorageFailpointError", {
|
|
91
|
-
readonly location: Schema.Literals<readonly ["materialize:before", "materialize:after", "append:before", "append:after-batch-insert", "append:after-record-insert", "append:after-tail-update", "append:after", "export:after-conversation-read", "save-checkpoint:before", "save-checkpoint:after", "ledger:admit:before", "ledger:admit:after", "ledger:mark-ready:before", "ledger:mark-ready:after", "ledger:claim:before", "ledger:claim:after", "ledger:mark-input-applied:before", "ledger:mark-input-applied:after", "ledger:renew:before", "ledger:renew:after", "ledger:reserve-settlement:before", "ledger:reserve-settlement:after", "ledger:finalize-settlement:before", "ledger:finalize-settlement:after", "ledger:request-abort:before", "ledger:request-abort:after", "ledger:release:before", "ledger:release:after", "ledger:claim-joining:before", "ledger:claim-joining:after", "ledger:mark-joined:before", "ledger:mark-joined:after", "ledger:revert-joining:before", "ledger:revert-joining:after", "ledger:suspend:before", "ledger:suspend:after", "ledger:approval-decision:before", "ledger:approval-decision:after", "ledger:mark-unknown:before", "ledger:mark-unknown:after", "ledger:unknown-resolution:before", "ledger:unknown-resolution:after", "ledger:child-reservation:before", "ledger:child-reservation:after", "ledger:child-attach:before", "ledger:child-attach:after", "ledger:child-release-pending:before", "ledger:child-release-pending:after", "ledger:child-release:before", "ledger:child-release:after", "ledger:child-settled:before", "ledger:child-settled:after"]>;
|
|
92
|
-
}>, import("effect/Cause").YieldableError>;
|
|
93
|
-
/** Deterministic test-only fault or pause injected at a Durable Object storage boundary. */
|
|
94
|
-
declare class DoStorageFailpointError extends DoStorageFailpointError_base {
|
|
95
|
-
get message(): string;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
6
|
//#region src/migrations.d.ts
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
* platform, so there is exactly ONE migration carrying the complete current schema — no
|
|
102
|
-
* v1→v4 history to replay (deployment spec §9: no rolling data-version promise during
|
|
103
|
-
* private development).
|
|
104
|
-
*/
|
|
105
|
-
declare const CurrentDoStorageVersion = 1;
|
|
106
|
-
/**
|
|
107
|
-
* The Conversation Durable Object schema. Table names and columns mirror the Node/SQLite v4
|
|
108
|
-
* schema byte-for-byte (`packages/storage-sqlite/src/migrations.ts`, migrations 1–4 collapsed
|
|
109
|
-
* into their final shape) so the shared conformance suites and crash-matrix rows address
|
|
110
|
-
* identical durable state. Two DC-specific additions:
|
|
111
|
-
*
|
|
112
|
-
* 1. `effect_agent_meta` replaces `PRAGMA user_version` as the exact-or-fresh version gate —
|
|
113
|
-
* a meta table is portable regardless of which PRAGMAs Durable Object SQL storage allows.
|
|
114
|
-
* 2. `effect_agent_child_settlements` is the durable cross-store notification marker the
|
|
115
|
-
* SubmissionLedger port contract mandates for cross-store adapters (`suspend`'s covering
|
|
116
|
-
* check and `recordChildSettled`'s wake both consult it): parent and child Conversations
|
|
117
|
-
* live in different Durable Objects, so a child settlement reported before the parent's
|
|
118
|
-
* suspend commits must be observable from the PARENT's own storage.
|
|
119
|
-
*/
|
|
120
|
-
declare const doMigrations: SqliteMigrator.Loader<never>;
|
|
7
|
+
/** The current storage version recorded in `effect_agent_meta`. */
|
|
8
|
+
declare const CurrentDoStorageVersion = 2;
|
|
121
9
|
//#endregion
|
|
122
10
|
//#region src/do-storage-config.d.ts
|
|
123
11
|
/**
|
|
@@ -159,44 +47,7 @@ declare const DoStorageConfig_base: Context.ServiceClass<DoStorageConfig, "@effe
|
|
|
159
47
|
/** Explicit Durable Object storage configuration authority. */
|
|
160
48
|
declare class DoStorageConfig extends DoStorageConfig_base {}
|
|
161
49
|
//#endregion
|
|
162
|
-
//#region src/do-
|
|
163
|
-
type DoStorageFailpointHandler = (location: DoStorageFailpointLocation) => Effect.Effect<void, DoStorageFailpointError>;
|
|
164
|
-
declare const DoStorageFailpointTestControl_base: Context.ServiceClass<DoStorageFailpointTestControl, "@effect-agent/storage-cloudflare/DoStorageFailpointTestControl", {
|
|
165
|
-
readonly clear: Effect.Effect<void>;
|
|
166
|
-
readonly setHandler: (handler: DoStorageFailpointHandler) => Effect.Effect<void>;
|
|
167
|
-
}>;
|
|
168
|
-
/** Test-only control for replacing the active Durable Object failpoint handler. */
|
|
169
|
-
declare class DoStorageFailpointTestControl extends DoStorageFailpointTestControl_base {}
|
|
170
|
-
declare const DoStorageFailpoint_base: Context.ServiceClass<DoStorageFailpoint, "@effect-agent/storage-cloudflare/DoStorageFailpoint", {
|
|
171
|
-
readonly hit: DoStorageFailpointHandler;
|
|
172
|
-
}>;
|
|
173
|
-
/** Explicit fault-injection authority used at Durable Object storage operation boundaries. */
|
|
174
|
-
declare class DoStorageFailpoint extends DoStorageFailpoint_base {
|
|
175
|
-
/** Production default: no fault injection. */
|
|
176
|
-
static readonly layer: Layer.Layer<DoStorageFailpoint, never, never>;
|
|
177
|
-
/** Reusable test Layer with a control service backed by the same handler Ref. */
|
|
178
|
-
static readonly layerTest: Layer.Layer<DoStorageFailpoint | DoStorageFailpointTestControl, never, never>;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* The DC-specific eviction failpoint mode: instead of failing typed, an armed hit evicts the
|
|
182
|
-
* Durable Object through an injected `evict` thunk — in production-shaped harnesses that thunk
|
|
183
|
-
* is `() => ctx.abort()`, the platform's real failure mode. `ctx.abort()` never returns (it
|
|
184
|
-
* throws while destroying the in-memory instance and every in-flight implicit or explicit
|
|
185
|
-
* storage transaction rolls back), so an armed hit ends the current Attempt exactly like an
|
|
186
|
-
* unannounced platform eviction; DO storage — the only correctness-critical state — survives
|
|
187
|
-
* for the next incarnation, which the persisted alarm wakes without any incoming request.
|
|
188
|
-
*
|
|
189
|
-
* The handles stay injected: this package never imports `cloudflare:workers`, so the harness
|
|
190
|
-
* that owns a `DurableObjectState` supplies the thunk.
|
|
191
|
-
*/
|
|
192
|
-
declare const evictionFailpointHandler: (options: {
|
|
193
|
-
readonly isArmed: (location: DoStorageFailpointLocation) => Effect.Effect<boolean>;
|
|
194
|
-
/** Kills the incarnation — e.g. `() => ctx.abort()`. Typed `void` because the platform
|
|
195
|
-
* declares `abort` as returning, but it throws while destroying the instance. */
|
|
196
|
-
readonly evict: (location: DoStorageFailpointLocation) => void;
|
|
197
|
-
}) => DoStorageFailpointHandler;
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region src/do-conversation-store.d.ts
|
|
50
|
+
//#region src/do-thread-store.d.ts
|
|
200
51
|
/**
|
|
201
52
|
* Convenience-layer construction options. `storage` is the Durable Object's own
|
|
202
53
|
* `ctx.storage` handle, injected as a value (DEPLOY-010: platform bindings enter only
|
|
@@ -207,7 +58,7 @@ interface DoStorageOptions {
|
|
|
207
58
|
readonly observationPollInterval?: number | undefined;
|
|
208
59
|
/**
|
|
209
60
|
* Submission ownership lease duration in milliseconds (D5). Defaults to
|
|
210
|
-
* `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/
|
|
61
|
+
* `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
|
|
211
62
|
*/
|
|
212
63
|
readonly ownershipLeaseDuration?: number | undefined;
|
|
213
64
|
/**
|
|
@@ -225,27 +76,27 @@ interface DoStorageOptions {
|
|
|
225
76
|
}
|
|
226
77
|
type DoStorageInitializationError = DoStorageCompatibilityError | DoStorageCorruptionError | DoStorageError;
|
|
227
78
|
/**
|
|
228
|
-
* Durable Object
|
|
79
|
+
* Durable Object Thread Store implementation with configuration, failpoint, SQL, and
|
|
229
80
|
* Crypto authority kept visible in its input channel.
|
|
230
81
|
*/
|
|
231
|
-
declare const
|
|
82
|
+
declare const threadStoreLayer: Layer.Layer<ThreadStore, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
|
|
232
83
|
/**
|
|
233
84
|
* Validated Durable Object storage configuration Layer with the documented defaults applied.
|
|
234
|
-
* Shared by the
|
|
85
|
+
* Shared by the ThreadStore and SubmissionLedger convenience layers so their defaults
|
|
235
86
|
* cannot drift.
|
|
236
87
|
*/
|
|
237
88
|
declare const storageConfigLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageConfig, DoStorageError>;
|
|
238
89
|
/** The failpoint Layer selected by convenience options: explicit handler or the no-op default. */
|
|
239
90
|
declare const storageFailpointLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageFailpoint>;
|
|
240
91
|
/**
|
|
241
|
-
* A composition-root convenience Layer for canonical
|
|
92
|
+
* A composition-root convenience Layer for canonical Threads inside one Durable Object,
|
|
242
93
|
* built over `ctx.storage`. Durable accepted work is served by the separate SubmissionLedger
|
|
243
94
|
* port; point both at the SAME `ctx.storage` so claims fence the same producer epochs
|
|
244
95
|
* (ADR-0011 D7's "same file" rule, transposed to one object's private database).
|
|
245
96
|
*/
|
|
246
|
-
declare const layer: (options: DoStorageOptions) => Layer.Layer<
|
|
97
|
+
declare const layer: (options: DoStorageOptions) => Layer.Layer<ThreadStore, DoStorageInitializationError>;
|
|
247
98
|
/** Create an adapter-owned resumable observation offset for a known canonical sequence. */
|
|
248
|
-
declare const observationOffsetAt: (
|
|
99
|
+
declare const observationOffsetAt: (threadId: string & import("effect/Brand").Brand<"@effect-agent/core/ThreadId">, sequence: number) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/thread/ObservationOffset">, ThreadStoreError, never>;
|
|
249
100
|
//#endregion
|
|
250
101
|
//#region src/do-ledger.d.ts
|
|
251
102
|
/**
|
|
@@ -256,7 +107,7 @@ declare const observationOffsetAt: (conversationId: string & import("effect/Bran
|
|
|
256
107
|
declare const submissionLedgerLayer: Layer.Layer<SubmissionLedger, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
|
|
257
108
|
/**
|
|
258
109
|
* A composition-root convenience Layer for the durable Submission Ledger. Point it at the
|
|
259
|
-
* same `ctx.storage` as the
|
|
110
|
+
* same `ctx.storage` as the ThreadStore so claims fence the same producer epochs.
|
|
260
111
|
*/
|
|
261
112
|
declare const ledgerLayer: (options: DoStorageOptions) => Layer.Layer<SubmissionLedger, DoStorageInitializationError>;
|
|
262
113
|
//#endregion
|
|
@@ -289,18 +140,36 @@ declare class DoScheduleAlarmControl extends DoScheduleAlarmControl_base {}
|
|
|
289
140
|
*/
|
|
290
141
|
declare const scheduleStoreLayer: Layer.Layer<ScheduleStore | DoScheduleAlarmControl, ScheduleStorageError, SqlClientService.SqlClient | DoScheduleTransaction>;
|
|
291
142
|
//#endregion
|
|
143
|
+
//#region src/do-subscription-store.d.ts
|
|
144
|
+
interface DoSubscriptionAlarmReplacement {
|
|
145
|
+
readonly deadlineAtMillis: number | null;
|
|
146
|
+
readonly generation: number;
|
|
147
|
+
}
|
|
148
|
+
type DoSubscriptionReplaceAlarm = (replacement: DoSubscriptionAlarmReplacement) => Effect.Effect<void, SubscriptionError>;
|
|
149
|
+
declare const DoSubscriptionTransaction_base: Context.ServiceClass<DoSubscriptionTransaction, "@effect-agent/storage-cloudflare/DoSubscriptionTransaction", {
|
|
150
|
+
readonly run: <A, E, R>(body: (replaceAlarm: DoSubscriptionReplaceAlarm) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | SubscriptionError, R>;
|
|
151
|
+
}>;
|
|
152
|
+
/** One Durable Object transaction combining subscription SQL and its single native alarm. */
|
|
153
|
+
declare class DoSubscriptionTransaction extends DoSubscriptionTransaction_base {}
|
|
154
|
+
declare const DoSubscriptionAlarmControl_base: Context.ServiceClass<DoSubscriptionAlarmControl, "@effect-agent/storage-cloudflare/DoSubscriptionAlarmControl", {
|
|
155
|
+
readonly prearm: (deadlineAtMillis: number) => Effect.Effect<void, SubscriptionError | SubscriptionFailpointError>;
|
|
156
|
+
readonly reconcile: Effect.Effect<void, SubscriptionError | SubscriptionFailpointError>;
|
|
157
|
+
}>;
|
|
158
|
+
declare class DoSubscriptionAlarmControl extends DoSubscriptionAlarmControl_base {}
|
|
159
|
+
declare const doSubscriptionStoreLayer: (partition: SourcePartition) => Layer.Layer<SubscriptionStore | DoSubscriptionAlarmControl, SubscriptionError, DoSubscriptionTransaction | SqlClientService.SqlClient>;
|
|
160
|
+
//#endregion
|
|
292
161
|
//#region src/port-protocol.d.ts
|
|
293
162
|
/**
|
|
294
163
|
* The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
|
|
295
|
-
* envelopes for the CLOSED route-capable subset of the
|
|
296
|
-
* Durable Object executes another
|
|
164
|
+
* envelopes for the CLOSED route-capable subset of the thread ports. One Thread's
|
|
165
|
+
* Durable Object executes another Thread's request against its OWN local facets; the
|
|
297
166
|
* envelopes here are the only values that cross the Object boundary, and they are
|
|
298
167
|
* transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
|
|
299
168
|
* the documented fallback, and both move the same Schema-encoded JSON.
|
|
300
169
|
*
|
|
301
170
|
* The closed subset is exactly the set of operations the durable coordinator performs against
|
|
302
|
-
* a FOREIGN
|
|
303
|
-
* child-settlement notification, and the child-
|
|
171
|
+
* a FOREIGN Thread (parent/child establishment, status checks, abort propagation,
|
|
172
|
+
* child-settlement notification, and the child-thread store operations used by
|
|
304
173
|
* establishment, `verifySettledChild`, and result projection):
|
|
305
174
|
*
|
|
306
175
|
* - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
|
|
@@ -313,7 +182,7 @@ declare const scheduleStoreLayer: Layer.Layer<ScheduleStore | DoScheduleAlarmCon
|
|
|
313
182
|
*
|
|
314
183
|
* Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
|
|
315
184
|
* the SAME tagged error types the local facet would have produced, so routed calls keep
|
|
316
|
-
* error-tag fidelity. `cause` chains inside `LedgerError`/`
|
|
185
|
+
* error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as
|
|
317
186
|
* Schema defects and do not claim instance fidelity across Objects (plan §2.8).
|
|
318
187
|
*/
|
|
319
188
|
/** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */
|
|
@@ -326,7 +195,7 @@ declare const PortProtocolError_base: Schema.Class<PortProtocolError, Schema.Tag
|
|
|
326
195
|
/**
|
|
327
196
|
* The envelope itself could not be honored: the receiving Object could not decode the
|
|
328
197
|
* request, or a response could not be encoded/decoded. It never carries port semantics —
|
|
329
|
-
* callers fold it into the operation's base error (`LedgerError`/`
|
|
198
|
+
* callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),
|
|
330
199
|
* except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
|
|
331
200
|
* non-answer is never proof of absence (SUB-031).
|
|
332
201
|
*/
|
|
@@ -342,7 +211,7 @@ declare const LedgerMarkReadyCall_base: Schema.Class<LedgerMarkReadyCall, Schema
|
|
|
342
211
|
/** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
|
|
343
212
|
declare class LedgerMarkReadyCall extends LedgerMarkReadyCall_base {}
|
|
344
213
|
declare const LedgerLookupCall_base: Schema.Class<LedgerLookupCall, Schema.TaggedStruct<"LedgerLookup", {
|
|
345
|
-
readonly request: Schema.Union<readonly [typeof import("@effect-agent/
|
|
214
|
+
readonly request: Schema.Union<readonly [typeof import("@effect-agent/thread").SubmissionLookupById, typeof SubmissionLookupByKey]>;
|
|
346
215
|
}>, {}>;
|
|
347
216
|
/** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
|
|
348
217
|
declare class LedgerLookupCall extends LedgerLookupCall_base {}
|
|
@@ -362,29 +231,29 @@ declare const LedgerRecordChildSettledCall_base: Schema.Class<LedgerRecordChildS
|
|
|
362
231
|
/** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
|
|
363
232
|
declare class LedgerRecordChildSettledCall extends LedgerRecordChildSettledCall_base {}
|
|
364
233
|
declare const StoreMaterializeCall_base: Schema.Class<StoreMaterializeCall, Schema.TaggedStruct<"StoreMaterialize", {
|
|
365
|
-
readonly request: typeof
|
|
234
|
+
readonly request: typeof ThreadMaterialization;
|
|
366
235
|
}>, {}>;
|
|
367
|
-
/** Routed `
|
|
236
|
+
/** Routed `ThreadStore.materialize` against the owning Object. */
|
|
368
237
|
declare class StoreMaterializeCall extends StoreMaterializeCall_base {}
|
|
369
238
|
declare const StoreAppendCall_base: Schema.Class<StoreAppendCall, Schema.TaggedStruct<"StoreAppend", {
|
|
370
239
|
readonly request: typeof FencedAppendRequest;
|
|
371
240
|
}>, {}>;
|
|
372
|
-
/** Routed `
|
|
241
|
+
/** Routed `ThreadStore.append` against the owning Object. */
|
|
373
242
|
declare class StoreAppendCall extends StoreAppendCall_base {}
|
|
374
243
|
declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.TaggedStruct<"StoreReadPage", {
|
|
375
|
-
readonly request: typeof
|
|
244
|
+
readonly request: typeof ThreadRead;
|
|
376
245
|
}>, {}>;
|
|
377
|
-
/** Routed one-page `
|
|
246
|
+
/** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
|
|
378
247
|
declare class StoreReadPageCall extends StoreReadPageCall_base {}
|
|
379
248
|
declare const StoreInspectTailCall_base: Schema.Class<StoreInspectTailCall, Schema.TaggedStruct<"StoreInspectTail", {
|
|
380
|
-
readonly request: typeof
|
|
249
|
+
readonly request: typeof ThreadTailRequest;
|
|
381
250
|
}>, {}>;
|
|
382
|
-
/** Routed `
|
|
251
|
+
/** Routed `ThreadStore.inspectTail` against the owning Object. */
|
|
383
252
|
declare class StoreInspectTailCall extends StoreInspectTailCall_base {}
|
|
384
253
|
declare const StoreExportCall_base: Schema.Class<StoreExportCall, Schema.TaggedStruct<"StoreExport", {
|
|
385
|
-
readonly request: typeof
|
|
254
|
+
readonly request: typeof ThreadExportRequest;
|
|
386
255
|
}>, {}>;
|
|
387
|
-
/** Routed `
|
|
256
|
+
/** Routed `ThreadStore.export` against the owning Object. */
|
|
388
257
|
declare class StoreExportCall extends StoreExportCall_base {}
|
|
389
258
|
/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
|
|
390
259
|
declare const PortRequest: Schema.Union<readonly [typeof LedgerAdmitCall, typeof LedgerMarkReadyCall, typeof LedgerLookupCall, typeof LedgerResolveAdmissionCall, typeof LedgerRequestAbortCall, typeof LedgerRecordChildSettledCall, typeof StoreMaterializeCall, typeof StoreAppendCall, typeof StoreReadPageCall, typeof StoreInspectTailCall, typeof StoreExportCall]>;
|
|
@@ -403,7 +272,7 @@ declare const LedgerLookupResult_base: Schema.Class<LedgerLookupResult, Schema.T
|
|
|
403
272
|
/** `submission` is absent exactly when the lookup answered `Option.none`. */
|
|
404
273
|
declare class LedgerLookupResult extends LedgerLookupResult_base {}
|
|
405
274
|
declare const LedgerResolveAdmissionResult_base: Schema.Class<LedgerResolveAdmissionResult, Schema.TaggedStruct<"LedgerResolveAdmissionResult", {
|
|
406
|
-
readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/
|
|
275
|
+
readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/thread").AdmissionNotAdmitted, typeof import("@effect-agent/thread").AdmissionAdmitted, typeof import("@effect-agent/thread").AdmissionIndeterminate]>;
|
|
407
276
|
}>, {}>;
|
|
408
277
|
declare class LedgerResolveAdmissionResult extends LedgerResolveAdmissionResult_base {}
|
|
409
278
|
declare const LedgerRequestAbortResult_base: Schema.Class<LedgerRequestAbortResult, Schema.TaggedStruct<"LedgerRequestAbortResult", {
|
|
@@ -426,11 +295,11 @@ declare const StoreReadPageResult_base: Schema.Class<StoreReadPageResult, Schema
|
|
|
426
295
|
/** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
|
|
427
296
|
declare class StoreReadPageResult extends StoreReadPageResult_base {}
|
|
428
297
|
declare const StoreInspectTailResult_base: Schema.Class<StoreInspectTailResult, Schema.TaggedStruct<"StoreInspectTailResult", {
|
|
429
|
-
readonly tail: typeof
|
|
298
|
+
readonly tail: typeof ThreadTail;
|
|
430
299
|
}>, {}>;
|
|
431
300
|
declare class StoreInspectTailResult extends StoreInspectTailResult_base {}
|
|
432
301
|
declare const StoreExportResult_base: Schema.Class<StoreExportResult, Schema.TaggedStruct<"StoreExportResult", {
|
|
433
|
-
readonly export: typeof
|
|
302
|
+
readonly export: typeof ThreadExport;
|
|
434
303
|
}>, {}>;
|
|
435
304
|
declare class StoreExportResult extends StoreExportResult_base {}
|
|
436
305
|
/** Every successful routed result. Callers narrow by the tag their request implies. */
|
|
@@ -439,9 +308,9 @@ type PortResult = typeof PortResult.Type;
|
|
|
439
308
|
/**
|
|
440
309
|
* Every typed failure a route-capable operation can produce on its owning Object, plus the
|
|
441
310
|
* protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
|
|
442
|
-
*
|
|
311
|
+
* thread ports declare, so a routed caller observes identical error tags and fields.
|
|
443
312
|
*/
|
|
444
|
-
declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof
|
|
313
|
+
declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
|
|
445
314
|
type PortFailure = typeof PortFailure.Type;
|
|
446
315
|
declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
|
|
447
316
|
readonly result: Schema.Union<readonly [typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult]>;
|
|
@@ -449,7 +318,7 @@ declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruc
|
|
|
449
318
|
/** The routed operation succeeded on its owning Object. */
|
|
450
319
|
declare class PortSucceeded extends PortSucceeded_base {}
|
|
451
320
|
declare const PortFailed_base: Schema.Class<PortFailed, Schema.TaggedStruct<"PortFailed", {
|
|
452
|
-
readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof
|
|
321
|
+
readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
|
|
453
322
|
}>, {}>;
|
|
454
323
|
/** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
|
|
455
324
|
declare class PortFailed extends PortFailed_base {}
|
|
@@ -461,7 +330,7 @@ type PortResponseEnvelope = typeof PortResponse.Encoded;
|
|
|
461
330
|
declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
|
|
462
331
|
readonly _tag: "LedgerAdmit";
|
|
463
332
|
readonly request: {
|
|
464
|
-
readonly
|
|
333
|
+
readonly threadId: string;
|
|
465
334
|
readonly principal: string;
|
|
466
335
|
readonly idempotencyKey: string;
|
|
467
336
|
readonly agentId: string;
|
|
@@ -490,7 +359,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
490
359
|
readonly submissionId: string;
|
|
491
360
|
} | {
|
|
492
361
|
readonly _tag: "SubmissionLookupByKey";
|
|
493
|
-
readonly
|
|
362
|
+
readonly threadId: string;
|
|
494
363
|
readonly principal: string;
|
|
495
364
|
readonly idempotencyKey: string;
|
|
496
365
|
};
|
|
@@ -498,7 +367,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
498
367
|
readonly _tag: "LedgerResolveAdmission";
|
|
499
368
|
readonly request: {
|
|
500
369
|
readonly _tag: "SubmissionLookupByKey";
|
|
501
|
-
readonly
|
|
370
|
+
readonly threadId: string;
|
|
502
371
|
readonly principal: string;
|
|
503
372
|
readonly idempotencyKey: string;
|
|
504
373
|
};
|
|
@@ -518,19 +387,19 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
518
387
|
} | {
|
|
519
388
|
readonly _tag: "StoreMaterialize";
|
|
520
389
|
readonly request: {
|
|
521
|
-
readonly
|
|
390
|
+
readonly threadId: string;
|
|
522
391
|
readonly producerEpoch: number;
|
|
523
392
|
};
|
|
524
393
|
} | {
|
|
525
394
|
readonly _tag: "StoreAppend";
|
|
526
395
|
readonly request: {
|
|
527
|
-
readonly
|
|
396
|
+
readonly threadId: string;
|
|
528
397
|
readonly batch: {
|
|
529
398
|
readonly batchId: string;
|
|
530
399
|
readonly producerId: string;
|
|
531
400
|
readonly records: readonly [{
|
|
532
401
|
readonly recordId: string;
|
|
533
|
-
readonly family: "
|
|
402
|
+
readonly family: "thread";
|
|
534
403
|
readonly schemaVersion: 1;
|
|
535
404
|
readonly createdAt: string;
|
|
536
405
|
readonly deploymentId: string;
|
|
@@ -540,7 +409,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
540
409
|
readonly author: string;
|
|
541
410
|
readonly reason: string;
|
|
542
411
|
} | {
|
|
543
|
-
readonly _tag: "
|
|
412
|
+
readonly _tag: "ThreadCreated";
|
|
544
413
|
readonly agentId: string;
|
|
545
414
|
readonly definitions: {
|
|
546
415
|
readonly agent: string;
|
|
@@ -549,18 +418,25 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
549
418
|
};
|
|
550
419
|
} | {
|
|
551
420
|
readonly _tag: "UserInputRecorded";
|
|
552
|
-
readonly submissionId
|
|
421
|
+
readonly submissionId?: string | undefined;
|
|
553
422
|
readonly kind: "follow-up" | "steering" | "user";
|
|
554
423
|
readonly runId?: string | undefined;
|
|
555
424
|
readonly input: Schema.Json;
|
|
556
425
|
} | {
|
|
557
426
|
readonly _tag: "RunStarted";
|
|
558
427
|
readonly runId: string;
|
|
428
|
+
readonly policyAccountingVersion: 1;
|
|
559
429
|
readonly maxDurationMillis: number;
|
|
430
|
+
} | {
|
|
431
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
432
|
+
readonly runId: string;
|
|
433
|
+
readonly programmaticToolCalls: number;
|
|
434
|
+
readonly finalizationUsed: boolean;
|
|
560
435
|
} | {
|
|
561
436
|
readonly _tag: "ModelCompleted";
|
|
562
437
|
readonly runId: string;
|
|
563
438
|
readonly output: Schema.Json;
|
|
439
|
+
readonly messages?: Schema.Json | undefined;
|
|
564
440
|
} | {
|
|
565
441
|
readonly _tag: "ModelResponseRecorded";
|
|
566
442
|
readonly runId: string;
|
|
@@ -599,6 +475,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
599
475
|
readonly toolName: string;
|
|
600
476
|
readonly parameters: Schema.Json;
|
|
601
477
|
readonly parametersDigest: string;
|
|
478
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
602
479
|
} | {
|
|
603
480
|
readonly _tag: "ToolCallSettled";
|
|
604
481
|
readonly runId: string;
|
|
@@ -606,6 +483,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
606
483
|
readonly toolName: string;
|
|
607
484
|
readonly result: Schema.Json;
|
|
608
485
|
readonly isFailure: boolean;
|
|
486
|
+
readonly budgetRejected?: true | undefined;
|
|
609
487
|
} | {
|
|
610
488
|
readonly _tag: "ToolCallUnknown";
|
|
611
489
|
readonly runId: string;
|
|
@@ -731,14 +609,15 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
731
609
|
readonly grantDigest: string;
|
|
732
610
|
readonly reservationId: string;
|
|
733
611
|
readonly reservationDigest: string;
|
|
734
|
-
readonly
|
|
612
|
+
readonly childThreadId: string;
|
|
735
613
|
readonly childPrincipal: string;
|
|
736
614
|
readonly childIdempotencyKey: string;
|
|
615
|
+
readonly toolCallAllowance?: number | undefined;
|
|
737
616
|
} | {
|
|
738
617
|
readonly _tag: "SubagentStarted";
|
|
739
618
|
readonly runId: string;
|
|
740
619
|
readonly toolCallId: string;
|
|
741
|
-
readonly
|
|
620
|
+
readonly childThreadId: string;
|
|
742
621
|
readonly childSubmissionId: string;
|
|
743
622
|
readonly childReceiptId: string;
|
|
744
623
|
readonly childRunId: string;
|
|
@@ -759,7 +638,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
759
638
|
readonly parentLink: {
|
|
760
639
|
readonly delegationId: string;
|
|
761
640
|
readonly parentAgentId: string;
|
|
762
|
-
readonly
|
|
641
|
+
readonly parentThreadId: string;
|
|
763
642
|
readonly parentRunId: string;
|
|
764
643
|
readonly parentToolCallId: string;
|
|
765
644
|
readonly depth: number;
|
|
@@ -772,6 +651,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
772
651
|
};
|
|
773
652
|
readonly childInputDigest: string;
|
|
774
653
|
readonly grantDigest: string;
|
|
654
|
+
readonly toolCallAllowance?: number | undefined;
|
|
775
655
|
} | {
|
|
776
656
|
readonly _tag: "RepairAnnotated";
|
|
777
657
|
readonly reason: string;
|
|
@@ -779,7 +659,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
779
659
|
};
|
|
780
660
|
}, ...{
|
|
781
661
|
readonly recordId: string;
|
|
782
|
-
readonly family: "
|
|
662
|
+
readonly family: "thread";
|
|
783
663
|
readonly schemaVersion: 1;
|
|
784
664
|
readonly createdAt: string;
|
|
785
665
|
readonly deploymentId: string;
|
|
@@ -789,7 +669,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
789
669
|
readonly author: string;
|
|
790
670
|
readonly reason: string;
|
|
791
671
|
} | {
|
|
792
|
-
readonly _tag: "
|
|
672
|
+
readonly _tag: "ThreadCreated";
|
|
793
673
|
readonly agentId: string;
|
|
794
674
|
readonly definitions: {
|
|
795
675
|
readonly agent: string;
|
|
@@ -798,18 +678,25 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
798
678
|
};
|
|
799
679
|
} | {
|
|
800
680
|
readonly _tag: "UserInputRecorded";
|
|
801
|
-
readonly submissionId
|
|
681
|
+
readonly submissionId?: string | undefined;
|
|
802
682
|
readonly kind: "follow-up" | "steering" | "user";
|
|
803
683
|
readonly runId?: string | undefined;
|
|
804
684
|
readonly input: Schema.Json;
|
|
805
685
|
} | {
|
|
806
686
|
readonly _tag: "RunStarted";
|
|
807
687
|
readonly runId: string;
|
|
688
|
+
readonly policyAccountingVersion: 1;
|
|
808
689
|
readonly maxDurationMillis: number;
|
|
690
|
+
} | {
|
|
691
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
692
|
+
readonly runId: string;
|
|
693
|
+
readonly programmaticToolCalls: number;
|
|
694
|
+
readonly finalizationUsed: boolean;
|
|
809
695
|
} | {
|
|
810
696
|
readonly _tag: "ModelCompleted";
|
|
811
697
|
readonly runId: string;
|
|
812
698
|
readonly output: Schema.Json;
|
|
699
|
+
readonly messages?: Schema.Json | undefined;
|
|
813
700
|
} | {
|
|
814
701
|
readonly _tag: "ModelResponseRecorded";
|
|
815
702
|
readonly runId: string;
|
|
@@ -848,6 +735,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
848
735
|
readonly toolName: string;
|
|
849
736
|
readonly parameters: Schema.Json;
|
|
850
737
|
readonly parametersDigest: string;
|
|
738
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
851
739
|
} | {
|
|
852
740
|
readonly _tag: "ToolCallSettled";
|
|
853
741
|
readonly runId: string;
|
|
@@ -855,6 +743,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
855
743
|
readonly toolName: string;
|
|
856
744
|
readonly result: Schema.Json;
|
|
857
745
|
readonly isFailure: boolean;
|
|
746
|
+
readonly budgetRejected?: true | undefined;
|
|
858
747
|
} | {
|
|
859
748
|
readonly _tag: "ToolCallUnknown";
|
|
860
749
|
readonly runId: string;
|
|
@@ -980,14 +869,15 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
980
869
|
readonly grantDigest: string;
|
|
981
870
|
readonly reservationId: string;
|
|
982
871
|
readonly reservationDigest: string;
|
|
983
|
-
readonly
|
|
872
|
+
readonly childThreadId: string;
|
|
984
873
|
readonly childPrincipal: string;
|
|
985
874
|
readonly childIdempotencyKey: string;
|
|
875
|
+
readonly toolCallAllowance?: number | undefined;
|
|
986
876
|
} | {
|
|
987
877
|
readonly _tag: "SubagentStarted";
|
|
988
878
|
readonly runId: string;
|
|
989
879
|
readonly toolCallId: string;
|
|
990
|
-
readonly
|
|
880
|
+
readonly childThreadId: string;
|
|
991
881
|
readonly childSubmissionId: string;
|
|
992
882
|
readonly childReceiptId: string;
|
|
993
883
|
readonly childRunId: string;
|
|
@@ -1008,7 +898,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1008
898
|
readonly parentLink: {
|
|
1009
899
|
readonly delegationId: string;
|
|
1010
900
|
readonly parentAgentId: string;
|
|
1011
|
-
readonly
|
|
901
|
+
readonly parentThreadId: string;
|
|
1012
902
|
readonly parentRunId: string;
|
|
1013
903
|
readonly parentToolCallId: string;
|
|
1014
904
|
readonly depth: number;
|
|
@@ -1021,6 +911,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1021
911
|
};
|
|
1022
912
|
readonly childInputDigest: string;
|
|
1023
913
|
readonly grantDigest: string;
|
|
914
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1024
915
|
} | {
|
|
1025
916
|
readonly _tag: "RepairAnnotated";
|
|
1026
917
|
readonly reason: string;
|
|
@@ -1035,19 +926,19 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1035
926
|
} | {
|
|
1036
927
|
readonly _tag: "StoreReadPage";
|
|
1037
928
|
readonly request: {
|
|
1038
|
-
readonly
|
|
929
|
+
readonly threadId: string;
|
|
1039
930
|
readonly afterSequence?: number | undefined;
|
|
1040
931
|
readonly limit: number;
|
|
1041
932
|
};
|
|
1042
933
|
} | {
|
|
1043
934
|
readonly _tag: "StoreInspectTail";
|
|
1044
935
|
readonly request: {
|
|
1045
|
-
readonly
|
|
936
|
+
readonly threadId: string;
|
|
1046
937
|
};
|
|
1047
938
|
} | {
|
|
1048
939
|
readonly _tag: "StoreExport";
|
|
1049
940
|
readonly request: {
|
|
1050
|
-
readonly
|
|
941
|
+
readonly threadId: string;
|
|
1051
942
|
};
|
|
1052
943
|
}, Schema.SchemaError, never>;
|
|
1053
944
|
declare const decodePortRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, Schema.SchemaError, never>;
|
|
@@ -1068,7 +959,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1068
959
|
readonly _tag: "LedgerLookupResult";
|
|
1069
960
|
readonly submission?: {
|
|
1070
961
|
readonly submissionId: string;
|
|
1071
|
-
readonly
|
|
962
|
+
readonly threadId: string;
|
|
1072
963
|
readonly queueSequence: number;
|
|
1073
964
|
readonly principal: string;
|
|
1074
965
|
readonly idempotencyKey: string;
|
|
@@ -1099,7 +990,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1099
990
|
readonly _tag: "Admitted";
|
|
1100
991
|
readonly submission: {
|
|
1101
992
|
readonly submissionId: string;
|
|
1102
|
-
readonly
|
|
993
|
+
readonly threadId: string;
|
|
1103
994
|
readonly queueSequence: number;
|
|
1104
995
|
readonly principal: string;
|
|
1105
996
|
readonly idempotencyKey: string;
|
|
@@ -1151,13 +1042,13 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1151
1042
|
} | {
|
|
1152
1043
|
readonly _tag: "StoreReadPageResult";
|
|
1153
1044
|
readonly records: readonly {
|
|
1154
|
-
readonly
|
|
1045
|
+
readonly threadId: string;
|
|
1155
1046
|
readonly batchId: string;
|
|
1156
1047
|
readonly sequence: number;
|
|
1157
1048
|
readonly offset: string;
|
|
1158
1049
|
readonly record: {
|
|
1159
1050
|
readonly recordId: string;
|
|
1160
|
-
readonly family: "
|
|
1051
|
+
readonly family: "thread";
|
|
1161
1052
|
readonly schemaVersion: 1;
|
|
1162
1053
|
readonly createdAt: string;
|
|
1163
1054
|
readonly deploymentId: string;
|
|
@@ -1167,7 +1058,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1167
1058
|
readonly author: string;
|
|
1168
1059
|
readonly reason: string;
|
|
1169
1060
|
} | {
|
|
1170
|
-
readonly _tag: "
|
|
1061
|
+
readonly _tag: "ThreadCreated";
|
|
1171
1062
|
readonly agentId: string;
|
|
1172
1063
|
readonly definitions: {
|
|
1173
1064
|
readonly agent: string;
|
|
@@ -1176,18 +1067,25 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1176
1067
|
};
|
|
1177
1068
|
} | {
|
|
1178
1069
|
readonly _tag: "UserInputRecorded";
|
|
1179
|
-
readonly submissionId
|
|
1070
|
+
readonly submissionId?: string | undefined;
|
|
1180
1071
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1181
1072
|
readonly runId?: string | undefined;
|
|
1182
1073
|
readonly input: Schema.Json;
|
|
1183
1074
|
} | {
|
|
1184
1075
|
readonly _tag: "RunStarted";
|
|
1185
1076
|
readonly runId: string;
|
|
1077
|
+
readonly policyAccountingVersion: 1;
|
|
1186
1078
|
readonly maxDurationMillis: number;
|
|
1079
|
+
} | {
|
|
1080
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
1081
|
+
readonly runId: string;
|
|
1082
|
+
readonly programmaticToolCalls: number;
|
|
1083
|
+
readonly finalizationUsed: boolean;
|
|
1187
1084
|
} | {
|
|
1188
1085
|
readonly _tag: "ModelCompleted";
|
|
1189
1086
|
readonly runId: string;
|
|
1190
1087
|
readonly output: Schema.Json;
|
|
1088
|
+
readonly messages?: Schema.Json | undefined;
|
|
1191
1089
|
} | {
|
|
1192
1090
|
readonly _tag: "ModelResponseRecorded";
|
|
1193
1091
|
readonly runId: string;
|
|
@@ -1226,6 +1124,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1226
1124
|
readonly toolName: string;
|
|
1227
1125
|
readonly parameters: Schema.Json;
|
|
1228
1126
|
readonly parametersDigest: string;
|
|
1127
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
1229
1128
|
} | {
|
|
1230
1129
|
readonly _tag: "ToolCallSettled";
|
|
1231
1130
|
readonly runId: string;
|
|
@@ -1233,6 +1132,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1233
1132
|
readonly toolName: string;
|
|
1234
1133
|
readonly result: Schema.Json;
|
|
1235
1134
|
readonly isFailure: boolean;
|
|
1135
|
+
readonly budgetRejected?: true | undefined;
|
|
1236
1136
|
} | {
|
|
1237
1137
|
readonly _tag: "ToolCallUnknown";
|
|
1238
1138
|
readonly runId: string;
|
|
@@ -1358,14 +1258,15 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1358
1258
|
readonly grantDigest: string;
|
|
1359
1259
|
readonly reservationId: string;
|
|
1360
1260
|
readonly reservationDigest: string;
|
|
1361
|
-
readonly
|
|
1261
|
+
readonly childThreadId: string;
|
|
1362
1262
|
readonly childPrincipal: string;
|
|
1363
1263
|
readonly childIdempotencyKey: string;
|
|
1264
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1364
1265
|
} | {
|
|
1365
1266
|
readonly _tag: "SubagentStarted";
|
|
1366
1267
|
readonly runId: string;
|
|
1367
1268
|
readonly toolCallId: string;
|
|
1368
|
-
readonly
|
|
1269
|
+
readonly childThreadId: string;
|
|
1369
1270
|
readonly childSubmissionId: string;
|
|
1370
1271
|
readonly childReceiptId: string;
|
|
1371
1272
|
readonly childRunId: string;
|
|
@@ -1386,7 +1287,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1386
1287
|
readonly parentLink: {
|
|
1387
1288
|
readonly delegationId: string;
|
|
1388
1289
|
readonly parentAgentId: string;
|
|
1389
|
-
readonly
|
|
1290
|
+
readonly parentThreadId: string;
|
|
1390
1291
|
readonly parentRunId: string;
|
|
1391
1292
|
readonly parentToolCallId: string;
|
|
1392
1293
|
readonly depth: number;
|
|
@@ -1399,6 +1300,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1399
1300
|
};
|
|
1400
1301
|
readonly childInputDigest: string;
|
|
1401
1302
|
readonly grantDigest: string;
|
|
1303
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1402
1304
|
} | {
|
|
1403
1305
|
readonly _tag: "RepairAnnotated";
|
|
1404
1306
|
readonly reason: string;
|
|
@@ -1409,7 +1311,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1409
1311
|
} | {
|
|
1410
1312
|
readonly _tag: "StoreInspectTailResult";
|
|
1411
1313
|
readonly tail: {
|
|
1412
|
-
readonly
|
|
1314
|
+
readonly threadId: string;
|
|
1413
1315
|
readonly tailSequence: number;
|
|
1414
1316
|
readonly tailDigest: string;
|
|
1415
1317
|
readonly producerEpoch: number;
|
|
@@ -1417,18 +1319,18 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1417
1319
|
} | {
|
|
1418
1320
|
readonly _tag: "StoreExportResult";
|
|
1419
1321
|
readonly export: {
|
|
1420
|
-
readonly format: "effect-agent/
|
|
1421
|
-
readonly
|
|
1322
|
+
readonly format: "effect-agent/thread@1";
|
|
1323
|
+
readonly threadId: string;
|
|
1422
1324
|
readonly tailSequence: number;
|
|
1423
1325
|
readonly tailDigest: string;
|
|
1424
1326
|
readonly records: readonly {
|
|
1425
|
-
readonly
|
|
1327
|
+
readonly threadId: string;
|
|
1426
1328
|
readonly batchId: string;
|
|
1427
1329
|
readonly sequence: number;
|
|
1428
1330
|
readonly offset: string;
|
|
1429
1331
|
readonly record: {
|
|
1430
1332
|
readonly recordId: string;
|
|
1431
|
-
readonly family: "
|
|
1333
|
+
readonly family: "thread";
|
|
1432
1334
|
readonly schemaVersion: 1;
|
|
1433
1335
|
readonly createdAt: string;
|
|
1434
1336
|
readonly deploymentId: string;
|
|
@@ -1438,7 +1340,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1438
1340
|
readonly author: string;
|
|
1439
1341
|
readonly reason: string;
|
|
1440
1342
|
} | {
|
|
1441
|
-
readonly _tag: "
|
|
1343
|
+
readonly _tag: "ThreadCreated";
|
|
1442
1344
|
readonly agentId: string;
|
|
1443
1345
|
readonly definitions: {
|
|
1444
1346
|
readonly agent: string;
|
|
@@ -1447,18 +1349,25 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1447
1349
|
};
|
|
1448
1350
|
} | {
|
|
1449
1351
|
readonly _tag: "UserInputRecorded";
|
|
1450
|
-
readonly submissionId
|
|
1352
|
+
readonly submissionId?: string | undefined;
|
|
1451
1353
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1452
1354
|
readonly runId?: string | undefined;
|
|
1453
1355
|
readonly input: Schema.Json;
|
|
1454
1356
|
} | {
|
|
1455
1357
|
readonly _tag: "RunStarted";
|
|
1456
1358
|
readonly runId: string;
|
|
1359
|
+
readonly policyAccountingVersion: 1;
|
|
1457
1360
|
readonly maxDurationMillis: number;
|
|
1361
|
+
} | {
|
|
1362
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
1363
|
+
readonly runId: string;
|
|
1364
|
+
readonly programmaticToolCalls: number;
|
|
1365
|
+
readonly finalizationUsed: boolean;
|
|
1458
1366
|
} | {
|
|
1459
1367
|
readonly _tag: "ModelCompleted";
|
|
1460
1368
|
readonly runId: string;
|
|
1461
1369
|
readonly output: Schema.Json;
|
|
1370
|
+
readonly messages?: Schema.Json | undefined;
|
|
1462
1371
|
} | {
|
|
1463
1372
|
readonly _tag: "ModelResponseRecorded";
|
|
1464
1373
|
readonly runId: string;
|
|
@@ -1497,6 +1406,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1497
1406
|
readonly toolName: string;
|
|
1498
1407
|
readonly parameters: Schema.Json;
|
|
1499
1408
|
readonly parametersDigest: string;
|
|
1409
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
1500
1410
|
} | {
|
|
1501
1411
|
readonly _tag: "ToolCallSettled";
|
|
1502
1412
|
readonly runId: string;
|
|
@@ -1504,6 +1414,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1504
1414
|
readonly toolName: string;
|
|
1505
1415
|
readonly result: Schema.Json;
|
|
1506
1416
|
readonly isFailure: boolean;
|
|
1417
|
+
readonly budgetRejected?: true | undefined;
|
|
1507
1418
|
} | {
|
|
1508
1419
|
readonly _tag: "ToolCallUnknown";
|
|
1509
1420
|
readonly runId: string;
|
|
@@ -1629,14 +1540,15 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1629
1540
|
readonly grantDigest: string;
|
|
1630
1541
|
readonly reservationId: string;
|
|
1631
1542
|
readonly reservationDigest: string;
|
|
1632
|
-
readonly
|
|
1543
|
+
readonly childThreadId: string;
|
|
1633
1544
|
readonly childPrincipal: string;
|
|
1634
1545
|
readonly childIdempotencyKey: string;
|
|
1546
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1635
1547
|
} | {
|
|
1636
1548
|
readonly _tag: "SubagentStarted";
|
|
1637
1549
|
readonly runId: string;
|
|
1638
1550
|
readonly toolCallId: string;
|
|
1639
|
-
readonly
|
|
1551
|
+
readonly childThreadId: string;
|
|
1640
1552
|
readonly childSubmissionId: string;
|
|
1641
1553
|
readonly childReceiptId: string;
|
|
1642
1554
|
readonly childRunId: string;
|
|
@@ -1657,7 +1569,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1657
1569
|
readonly parentLink: {
|
|
1658
1570
|
readonly delegationId: string;
|
|
1659
1571
|
readonly parentAgentId: string;
|
|
1660
|
-
readonly
|
|
1572
|
+
readonly parentThreadId: string;
|
|
1661
1573
|
readonly parentRunId: string;
|
|
1662
1574
|
readonly parentToolCallId: string;
|
|
1663
1575
|
readonly depth: number;
|
|
@@ -1670,6 +1582,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1670
1582
|
};
|
|
1671
1583
|
readonly childInputDigest: string;
|
|
1672
1584
|
readonly grantDigest: string;
|
|
1585
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1673
1586
|
} | {
|
|
1674
1587
|
readonly _tag: "RepairAnnotated";
|
|
1675
1588
|
readonly reason: string;
|
|
@@ -1686,7 +1599,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1686
1599
|
readonly message: string;
|
|
1687
1600
|
} | {
|
|
1688
1601
|
readonly _tag: "AdmissionConflict";
|
|
1689
|
-
readonly
|
|
1602
|
+
readonly threadId: string;
|
|
1690
1603
|
readonly principal: string;
|
|
1691
1604
|
readonly idempotencyKey: string;
|
|
1692
1605
|
readonly existingInputDigest: string;
|
|
@@ -1705,23 +1618,23 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1705
1618
|
readonly message: string;
|
|
1706
1619
|
readonly cause?: Schema.Json | undefined;
|
|
1707
1620
|
} | {
|
|
1708
|
-
readonly _tag: "
|
|
1621
|
+
readonly _tag: "ThreadStoreError";
|
|
1709
1622
|
readonly operation: string;
|
|
1710
1623
|
readonly message: string;
|
|
1711
1624
|
readonly cause?: Schema.Json | undefined;
|
|
1712
1625
|
} | {
|
|
1713
|
-
readonly _tag: "
|
|
1714
|
-
readonly
|
|
1626
|
+
readonly _tag: "ThreadNotMaterialized";
|
|
1627
|
+
readonly threadId: string;
|
|
1715
1628
|
} | {
|
|
1716
1629
|
readonly _tag: "AppendConflict";
|
|
1717
|
-
readonly
|
|
1630
|
+
readonly threadId: string;
|
|
1718
1631
|
readonly batchId: string;
|
|
1719
1632
|
readonly reason: "batch-digest" | "record-identity" | "tail";
|
|
1720
1633
|
readonly actualTailSequence?: number | undefined;
|
|
1721
1634
|
readonly actualTailDigest?: string | undefined;
|
|
1722
1635
|
} | {
|
|
1723
1636
|
readonly _tag: "FenceRejected";
|
|
1724
|
-
readonly
|
|
1637
|
+
readonly threadId: string;
|
|
1725
1638
|
readonly actualEpoch: number;
|
|
1726
1639
|
readonly attemptedEpoch: number;
|
|
1727
1640
|
};
|
|
@@ -1729,7 +1642,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1729
1642
|
declare const decodePortResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<PortFailed | PortSucceeded, Schema.SchemaError, never>;
|
|
1730
1643
|
//#endregion
|
|
1731
1644
|
//#region src/routing.d.ts
|
|
1732
|
-
type
|
|
1645
|
+
type ThreadId = ThreadMaterialization["threadId"];
|
|
1733
1646
|
declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.TaggedStruct<"PortTransportError", {
|
|
1734
1647
|
readonly target: Schema.String;
|
|
1735
1648
|
readonly message: Schema.String;
|
|
@@ -1738,7 +1651,7 @@ declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.T
|
|
|
1738
1651
|
}>, import("effect/Cause").YieldableError>;
|
|
1739
1652
|
/**
|
|
1740
1653
|
* A transport could not deliver a port request to (or an answer from) the owning
|
|
1741
|
-
*
|
|
1654
|
+
* Thread's Durable Object. `retryable` carries the platform's own stub signal when one
|
|
1742
1655
|
* exists. This error never crosses the wire — it is the CALLER-side evidence that the
|
|
1743
1656
|
* authority was unreachable, which is exactly the case `AdmissionIndeterminate` was
|
|
1744
1657
|
* specified for (SUB-031).
|
|
@@ -1749,50 +1662,50 @@ declare class PortTransportError extends PortTransportError_base {}
|
|
|
1749
1662
|
* platform stub's own `retryable` signal when present.
|
|
1750
1663
|
*/
|
|
1751
1664
|
declare const portTransportFailure: (target: string, cause: unknown) => PortTransportError;
|
|
1752
|
-
declare const
|
|
1753
|
-
readonly call: (
|
|
1665
|
+
declare const ThreadPortTransport_base: Context.ServiceClass<ThreadPortTransport, "@effect-agent/storage-cloudflare/ThreadPortTransport", {
|
|
1666
|
+
readonly call: (threadId: ThreadId, request: PortRequestEnvelope) => Effect.Effect<unknown, PortTransportError>;
|
|
1754
1667
|
}>;
|
|
1755
1668
|
/**
|
|
1756
1669
|
* Delivery of Schema-encoded port envelopes to the Durable Object that owns a FOREIGN
|
|
1757
|
-
*
|
|
1670
|
+
* Thread (plan §1.3, D-P6-3). The shipped implementation (platform-cloudflare, WP3)
|
|
1758
1671
|
* calls the owner's `portCall` over native Durable Object JS RPC via
|
|
1759
|
-
* `namespace.idFromName(
|
|
1672
|
+
* `namespace.idFromName(threadId)`; the protocol is transport-agnostic and any carrier
|
|
1760
1673
|
* that moves the encoded envelopes verbatim satisfies this service. Implementations MUST
|
|
1761
1674
|
* surface every delivery problem as `PortTransportError` and must never fabricate an answer.
|
|
1762
1675
|
*/
|
|
1763
|
-
declare class
|
|
1676
|
+
declare class ThreadPortTransport extends ThreadPortTransport_base {}
|
|
1764
1677
|
/** Construction options shared by both routed port Layers. */
|
|
1765
1678
|
interface RoutedPortOptions {
|
|
1766
1679
|
/**
|
|
1767
|
-
* The
|
|
1768
|
-
* `namespace.idFromName(
|
|
1680
|
+
* The Thread this Durable Object owns (the Object identity rule is
|
|
1681
|
+
* `namespace.idFromName(threadId)`). Requests addressed here execute on the local
|
|
1769
1682
|
* facet; requests addressed anywhere else route through the transport or fail fast typed.
|
|
1770
1683
|
*/
|
|
1771
|
-
readonly
|
|
1684
|
+
readonly localThreadId: ThreadId;
|
|
1772
1685
|
}
|
|
1773
1686
|
/**
|
|
1774
1687
|
* Routing decorator over the LOCAL `SubmissionLedger` facet (plan §1.3): a request addressing
|
|
1775
|
-
* this Object's
|
|
1776
|
-
*
|
|
1688
|
+
* this Object's Thread executes locally; a route-capable request addressing another
|
|
1689
|
+
* Thread is Schema-encoded onto the `ThreadPortTransport` and executed by the
|
|
1777
1690
|
* owning Object's local facet; any other foreign request fails fast typed. Provide the WP1
|
|
1778
1691
|
* local facet (`submissionLedgerLayer`/`ledgerLayer`) and a transport to close it.
|
|
1779
1692
|
*/
|
|
1780
|
-
declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger |
|
|
1693
|
+
declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger | ThreadPortTransport>;
|
|
1781
1694
|
/**
|
|
1782
|
-
* Routing decorator over the LOCAL `
|
|
1695
|
+
* Routing decorator over the LOCAL `ThreadStore` facet (plan §1.3): this-thread
|
|
1783
1696
|
* requests execute locally; foreign materialize/append/read/inspectTail/export travel the
|
|
1784
1697
|
* transport; foreign observation and checkpoints fail fast typed.
|
|
1785
1698
|
*/
|
|
1786
|
-
declare const
|
|
1699
|
+
declare const routedThreadStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ThreadStore, never, ThreadStore | ThreadPortTransport>;
|
|
1787
1700
|
/**
|
|
1788
1701
|
* Execute one decoded port request against THIS Object's LOCAL facets — the owner-side half
|
|
1789
1702
|
* of the routed ports (plan §1.3). Callers must provide the WP1 local facets, never the
|
|
1790
1703
|
* routed decorators: the routing layer already established that this Object owns the
|
|
1791
|
-
* addressed
|
|
1704
|
+
* addressed Thread, and re-routing here could bounce a request between Objects.
|
|
1792
1705
|
* Failures never escape — every typed port failure becomes a `PortFailed` envelope that
|
|
1793
1706
|
* re-decodes on the caller side.
|
|
1794
1707
|
*/
|
|
1795
|
-
declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never,
|
|
1708
|
+
declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never, SubmissionLedger | ThreadStore>;
|
|
1796
1709
|
/**
|
|
1797
1710
|
* The complete owner-side endpoint body for `portCall` (D-P6-3): decode the wire request,
|
|
1798
1711
|
* execute it against this Object's LOCAL facets, and answer with the encoded response
|
|
@@ -1800,7 +1713,7 @@ declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall |
|
|
|
1800
1713
|
* cannot be encoded, answers `PortFailed(PortProtocolError)` instead of throwing, so the
|
|
1801
1714
|
* transport never has to interpret exceptions as protocol answers.
|
|
1802
1715
|
*/
|
|
1803
|
-
declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never,
|
|
1716
|
+
declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, SubmissionLedger | ThreadStore>;
|
|
1804
1717
|
//#endregion
|
|
1805
|
-
export {
|
|
1718
|
+
export { CurrentDoStorageVersion, DEFAULT_MAX_STORED_VALUE_BYTES, DoAppendConflict, DoCheckpointConflict, DoFenceRejected, DoLedgerError, DoScheduleAlarmControl, DoScheduleAlarmReplacement, DoScheduleReplaceAlarm, DoScheduleTransaction, DoStorageCompatibilityError, DoStorageConfig, DoStorageConfigValue, DoStorageCorruptionError, DoStorageError, DoStorageFailpoint, DoStorageFailpointError, DoStorageFailpointHandler, DoStorageFailpointLocation, DoStorageInitializationError, DoStorageOptions, DoSubscriptionAlarmControl, DoSubscriptionAlarmReplacement, DoSubscriptionReplaceAlarm, DoSubscriptionTransaction, DoValueBoundExceeded, LedgerAdmitCall, LedgerAdmitResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, MAX_PORT_DIAGNOSTIC_LENGTH, PortFailed, PortFailure, PortProtocolError, PortRequest, PortRequestEnvelope, PortResponse, PortResponseEnvelope, PortResult, PortSucceeded, PortTransportError, RoutedPortOptions, StoreAppendCall, StoreAppendResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, ThreadPortTransport, boundPortDiagnostic, decodePortRequest, decodePortResponse, doSubscriptionStoreLayer, encodePortRequest, encodePortResponse, executePortRequest, handleEncodedPortRequest, layer, ledgerLayer, observationOffsetAt, portTransportFailure, routedSubmissionLedgerLayer, routedThreadStoreLayer, scheduleStoreLayer, storageConfigLayer, storageFailpointLayer, submissionLedgerLayer, threadStoreLayer };
|
|
1806
1719
|
//# sourceMappingURL=index.d.mts.map
|