@effect-agent/storage-cloudflare 0.1.0-beta.37 → 0.1.0-beta.39
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 +160 -242
- package/dist/index.mjs +1199 -522
- 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 +12 -5
- 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 +26 -26
- 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,100 +1,8 @@
|
|
|
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
7
|
/**
|
|
100
8
|
* The exact-or-fresh storage version recorded in `effect_agent_meta`. Cloudflare is a fresh
|
|
@@ -102,22 +10,7 @@ declare class DoStorageFailpointError extends DoStorageFailpointError_base {
|
|
|
102
10
|
* v1→v4 history to replay (deployment spec §9: no rolling data-version promise during
|
|
103
11
|
* private development).
|
|
104
12
|
*/
|
|
105
|
-
declare const CurrentDoStorageVersion =
|
|
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>;
|
|
13
|
+
declare const CurrentDoStorageVersion = 2;
|
|
121
14
|
//#endregion
|
|
122
15
|
//#region src/do-storage-config.d.ts
|
|
123
16
|
/**
|
|
@@ -159,44 +52,7 @@ declare const DoStorageConfig_base: Context.ServiceClass<DoStorageConfig, "@effe
|
|
|
159
52
|
/** Explicit Durable Object storage configuration authority. */
|
|
160
53
|
declare class DoStorageConfig extends DoStorageConfig_base {}
|
|
161
54
|
//#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
|
|
55
|
+
//#region src/do-thread-store.d.ts
|
|
200
56
|
/**
|
|
201
57
|
* Convenience-layer construction options. `storage` is the Durable Object's own
|
|
202
58
|
* `ctx.storage` handle, injected as a value (DEPLOY-010: platform bindings enter only
|
|
@@ -207,7 +63,7 @@ interface DoStorageOptions {
|
|
|
207
63
|
readonly observationPollInterval?: number | undefined;
|
|
208
64
|
/**
|
|
209
65
|
* Submission ownership lease duration in milliseconds (D5). Defaults to
|
|
210
|
-
* `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/
|
|
66
|
+
* `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/thread`.
|
|
211
67
|
*/
|
|
212
68
|
readonly ownershipLeaseDuration?: number | undefined;
|
|
213
69
|
/**
|
|
@@ -225,27 +81,27 @@ interface DoStorageOptions {
|
|
|
225
81
|
}
|
|
226
82
|
type DoStorageInitializationError = DoStorageCompatibilityError | DoStorageCorruptionError | DoStorageError;
|
|
227
83
|
/**
|
|
228
|
-
* Durable Object
|
|
84
|
+
* Durable Object Thread Store implementation with configuration, failpoint, SQL, and
|
|
229
85
|
* Crypto authority kept visible in its input channel.
|
|
230
86
|
*/
|
|
231
|
-
declare const
|
|
87
|
+
declare const threadStoreLayer: Layer.Layer<ThreadStore, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
|
|
232
88
|
/**
|
|
233
89
|
* Validated Durable Object storage configuration Layer with the documented defaults applied.
|
|
234
|
-
* Shared by the
|
|
90
|
+
* Shared by the ThreadStore and SubmissionLedger convenience layers so their defaults
|
|
235
91
|
* cannot drift.
|
|
236
92
|
*/
|
|
237
93
|
declare const storageConfigLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageConfig, DoStorageError>;
|
|
238
94
|
/** The failpoint Layer selected by convenience options: explicit handler or the no-op default. */
|
|
239
95
|
declare const storageFailpointLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageFailpoint>;
|
|
240
96
|
/**
|
|
241
|
-
* A composition-root convenience Layer for canonical
|
|
97
|
+
* A composition-root convenience Layer for canonical Threads inside one Durable Object,
|
|
242
98
|
* built over `ctx.storage`. Durable accepted work is served by the separate SubmissionLedger
|
|
243
99
|
* port; point both at the SAME `ctx.storage` so claims fence the same producer epochs
|
|
244
100
|
* (ADR-0011 D7's "same file" rule, transposed to one object's private database).
|
|
245
101
|
*/
|
|
246
|
-
declare const layer: (options: DoStorageOptions) => Layer.Layer<
|
|
102
|
+
declare const layer: (options: DoStorageOptions) => Layer.Layer<ThreadStore, DoStorageInitializationError>;
|
|
247
103
|
/** Create an adapter-owned resumable observation offset for a known canonical sequence. */
|
|
248
|
-
declare const observationOffsetAt: (
|
|
104
|
+
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
105
|
//#endregion
|
|
250
106
|
//#region src/do-ledger.d.ts
|
|
251
107
|
/**
|
|
@@ -256,7 +112,7 @@ declare const observationOffsetAt: (conversationId: string & import("effect/Bran
|
|
|
256
112
|
declare const submissionLedgerLayer: Layer.Layer<SubmissionLedger, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
|
|
257
113
|
/**
|
|
258
114
|
* A composition-root convenience Layer for the durable Submission Ledger. Point it at the
|
|
259
|
-
* same `ctx.storage` as the
|
|
115
|
+
* same `ctx.storage` as the ThreadStore so claims fence the same producer epochs.
|
|
260
116
|
*/
|
|
261
117
|
declare const ledgerLayer: (options: DoStorageOptions) => Layer.Layer<SubmissionLedger, DoStorageInitializationError>;
|
|
262
118
|
//#endregion
|
|
@@ -289,18 +145,36 @@ declare class DoScheduleAlarmControl extends DoScheduleAlarmControl_base {}
|
|
|
289
145
|
*/
|
|
290
146
|
declare const scheduleStoreLayer: Layer.Layer<ScheduleStore | DoScheduleAlarmControl, ScheduleStorageError, SqlClientService.SqlClient | DoScheduleTransaction>;
|
|
291
147
|
//#endregion
|
|
148
|
+
//#region src/do-subscription-store.d.ts
|
|
149
|
+
interface DoSubscriptionAlarmReplacement {
|
|
150
|
+
readonly deadlineAtMillis: number | null;
|
|
151
|
+
readonly generation: number;
|
|
152
|
+
}
|
|
153
|
+
type DoSubscriptionReplaceAlarm = (replacement: DoSubscriptionAlarmReplacement) => Effect.Effect<void, SubscriptionError>;
|
|
154
|
+
declare const DoSubscriptionTransaction_base: Context.ServiceClass<DoSubscriptionTransaction, "@effect-agent/storage-cloudflare/DoSubscriptionTransaction", {
|
|
155
|
+
readonly run: <A, E, R>(body: (replaceAlarm: DoSubscriptionReplaceAlarm) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | SubscriptionError, R>;
|
|
156
|
+
}>;
|
|
157
|
+
/** One Durable Object transaction combining subscription SQL and its single native alarm. */
|
|
158
|
+
declare class DoSubscriptionTransaction extends DoSubscriptionTransaction_base {}
|
|
159
|
+
declare const DoSubscriptionAlarmControl_base: Context.ServiceClass<DoSubscriptionAlarmControl, "@effect-agent/storage-cloudflare/DoSubscriptionAlarmControl", {
|
|
160
|
+
readonly prearm: (deadlineAtMillis: number) => Effect.Effect<void, SubscriptionError | SubscriptionFailpointError>;
|
|
161
|
+
readonly reconcile: Effect.Effect<void, SubscriptionError | SubscriptionFailpointError>;
|
|
162
|
+
}>;
|
|
163
|
+
declare class DoSubscriptionAlarmControl extends DoSubscriptionAlarmControl_base {}
|
|
164
|
+
declare const doSubscriptionStoreLayer: (partition: SourcePartition) => Layer.Layer<SubscriptionStore | DoSubscriptionAlarmControl, SubscriptionError, DoSubscriptionTransaction | SqlClientService.SqlClient>;
|
|
165
|
+
//#endregion
|
|
292
166
|
//#region src/port-protocol.d.ts
|
|
293
167
|
/**
|
|
294
168
|
* 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
|
|
169
|
+
* envelopes for the CLOSED route-capable subset of the thread ports. One Thread's
|
|
170
|
+
* Durable Object executes another Thread's request against its OWN local facets; the
|
|
297
171
|
* envelopes here are the only values that cross the Object boundary, and they are
|
|
298
172
|
* transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
|
|
299
173
|
* the documented fallback, and both move the same Schema-encoded JSON.
|
|
300
174
|
*
|
|
301
175
|
* The closed subset is exactly the set of operations the durable coordinator performs against
|
|
302
|
-
* a FOREIGN
|
|
303
|
-
* child-settlement notification, and the child-
|
|
176
|
+
* a FOREIGN Thread (parent/child establishment, status checks, abort propagation,
|
|
177
|
+
* child-settlement notification, and the child-thread store operations used by
|
|
304
178
|
* establishment, `verifySettledChild`, and result projection):
|
|
305
179
|
*
|
|
306
180
|
* - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
|
|
@@ -313,7 +187,7 @@ declare const scheduleStoreLayer: Layer.Layer<ScheduleStore | DoScheduleAlarmCon
|
|
|
313
187
|
*
|
|
314
188
|
* Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
|
|
315
189
|
* the SAME tagged error types the local facet would have produced, so routed calls keep
|
|
316
|
-
* error-tag fidelity. `cause` chains inside `LedgerError`/`
|
|
190
|
+
* error-tag fidelity. `cause` chains inside `LedgerError`/`ThreadStoreError` travel as
|
|
317
191
|
* Schema defects and do not claim instance fidelity across Objects (plan §2.8).
|
|
318
192
|
*/
|
|
319
193
|
/** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */
|
|
@@ -326,7 +200,7 @@ declare const PortProtocolError_base: Schema.Class<PortProtocolError, Schema.Tag
|
|
|
326
200
|
/**
|
|
327
201
|
* The envelope itself could not be honored: the receiving Object could not decode the
|
|
328
202
|
* 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`/`
|
|
203
|
+
* callers fold it into the operation's base error (`LedgerError`/`ThreadStoreError`),
|
|
330
204
|
* except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
|
|
331
205
|
* non-answer is never proof of absence (SUB-031).
|
|
332
206
|
*/
|
|
@@ -342,7 +216,7 @@ declare const LedgerMarkReadyCall_base: Schema.Class<LedgerMarkReadyCall, Schema
|
|
|
342
216
|
/** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
|
|
343
217
|
declare class LedgerMarkReadyCall extends LedgerMarkReadyCall_base {}
|
|
344
218
|
declare const LedgerLookupCall_base: Schema.Class<LedgerLookupCall, Schema.TaggedStruct<"LedgerLookup", {
|
|
345
|
-
readonly request: Schema.Union<readonly [typeof import("@effect-agent/
|
|
219
|
+
readonly request: Schema.Union<readonly [typeof import("@effect-agent/thread").SubmissionLookupById, typeof SubmissionLookupByKey]>;
|
|
346
220
|
}>, {}>;
|
|
347
221
|
/** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
|
|
348
222
|
declare class LedgerLookupCall extends LedgerLookupCall_base {}
|
|
@@ -362,29 +236,29 @@ declare const LedgerRecordChildSettledCall_base: Schema.Class<LedgerRecordChildS
|
|
|
362
236
|
/** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
|
|
363
237
|
declare class LedgerRecordChildSettledCall extends LedgerRecordChildSettledCall_base {}
|
|
364
238
|
declare const StoreMaterializeCall_base: Schema.Class<StoreMaterializeCall, Schema.TaggedStruct<"StoreMaterialize", {
|
|
365
|
-
readonly request: typeof
|
|
239
|
+
readonly request: typeof ThreadMaterialization;
|
|
366
240
|
}>, {}>;
|
|
367
|
-
/** Routed `
|
|
241
|
+
/** Routed `ThreadStore.materialize` against the owning Object. */
|
|
368
242
|
declare class StoreMaterializeCall extends StoreMaterializeCall_base {}
|
|
369
243
|
declare const StoreAppendCall_base: Schema.Class<StoreAppendCall, Schema.TaggedStruct<"StoreAppend", {
|
|
370
244
|
readonly request: typeof FencedAppendRequest;
|
|
371
245
|
}>, {}>;
|
|
372
|
-
/** Routed `
|
|
246
|
+
/** Routed `ThreadStore.append` against the owning Object. */
|
|
373
247
|
declare class StoreAppendCall extends StoreAppendCall_base {}
|
|
374
248
|
declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.TaggedStruct<"StoreReadPage", {
|
|
375
|
-
readonly request: typeof
|
|
249
|
+
readonly request: typeof ThreadRead;
|
|
376
250
|
}>, {}>;
|
|
377
|
-
/** Routed one-page `
|
|
251
|
+
/** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
|
|
378
252
|
declare class StoreReadPageCall extends StoreReadPageCall_base {}
|
|
379
253
|
declare const StoreInspectTailCall_base: Schema.Class<StoreInspectTailCall, Schema.TaggedStruct<"StoreInspectTail", {
|
|
380
|
-
readonly request: typeof
|
|
254
|
+
readonly request: typeof ThreadTailRequest;
|
|
381
255
|
}>, {}>;
|
|
382
|
-
/** Routed `
|
|
256
|
+
/** Routed `ThreadStore.inspectTail` against the owning Object. */
|
|
383
257
|
declare class StoreInspectTailCall extends StoreInspectTailCall_base {}
|
|
384
258
|
declare const StoreExportCall_base: Schema.Class<StoreExportCall, Schema.TaggedStruct<"StoreExport", {
|
|
385
|
-
readonly request: typeof
|
|
259
|
+
readonly request: typeof ThreadExportRequest;
|
|
386
260
|
}>, {}>;
|
|
387
|
-
/** Routed `
|
|
261
|
+
/** Routed `ThreadStore.export` against the owning Object. */
|
|
388
262
|
declare class StoreExportCall extends StoreExportCall_base {}
|
|
389
263
|
/** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
|
|
390
264
|
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 +277,7 @@ declare const LedgerLookupResult_base: Schema.Class<LedgerLookupResult, Schema.T
|
|
|
403
277
|
/** `submission` is absent exactly when the lookup answered `Option.none`. */
|
|
404
278
|
declare class LedgerLookupResult extends LedgerLookupResult_base {}
|
|
405
279
|
declare const LedgerResolveAdmissionResult_base: Schema.Class<LedgerResolveAdmissionResult, Schema.TaggedStruct<"LedgerResolveAdmissionResult", {
|
|
406
|
-
readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/
|
|
280
|
+
readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/thread").AdmissionNotAdmitted, typeof import("@effect-agent/thread").AdmissionAdmitted, typeof import("@effect-agent/thread").AdmissionIndeterminate]>;
|
|
407
281
|
}>, {}>;
|
|
408
282
|
declare class LedgerResolveAdmissionResult extends LedgerResolveAdmissionResult_base {}
|
|
409
283
|
declare const LedgerRequestAbortResult_base: Schema.Class<LedgerRequestAbortResult, Schema.TaggedStruct<"LedgerRequestAbortResult", {
|
|
@@ -426,11 +300,11 @@ declare const StoreReadPageResult_base: Schema.Class<StoreReadPageResult, Schema
|
|
|
426
300
|
/** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
|
|
427
301
|
declare class StoreReadPageResult extends StoreReadPageResult_base {}
|
|
428
302
|
declare const StoreInspectTailResult_base: Schema.Class<StoreInspectTailResult, Schema.TaggedStruct<"StoreInspectTailResult", {
|
|
429
|
-
readonly tail: typeof
|
|
303
|
+
readonly tail: typeof ThreadTail;
|
|
430
304
|
}>, {}>;
|
|
431
305
|
declare class StoreInspectTailResult extends StoreInspectTailResult_base {}
|
|
432
306
|
declare const StoreExportResult_base: Schema.Class<StoreExportResult, Schema.TaggedStruct<"StoreExportResult", {
|
|
433
|
-
readonly export: typeof
|
|
307
|
+
readonly export: typeof ThreadExport;
|
|
434
308
|
}>, {}>;
|
|
435
309
|
declare class StoreExportResult extends StoreExportResult_base {}
|
|
436
310
|
/** Every successful routed result. Callers narrow by the tag their request implies. */
|
|
@@ -439,9 +313,9 @@ type PortResult = typeof PortResult.Type;
|
|
|
439
313
|
/**
|
|
440
314
|
* Every typed failure a route-capable operation can produce on its owning Object, plus the
|
|
441
315
|
* protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
|
|
442
|
-
*
|
|
316
|
+
* thread ports declare, so a routed caller observes identical error tags and fields.
|
|
443
317
|
*/
|
|
444
|
-
declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof
|
|
318
|
+
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
319
|
type PortFailure = typeof PortFailure.Type;
|
|
446
320
|
declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
|
|
447
321
|
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 +323,7 @@ declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruc
|
|
|
449
323
|
/** The routed operation succeeded on its owning Object. */
|
|
450
324
|
declare class PortSucceeded extends PortSucceeded_base {}
|
|
451
325
|
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
|
|
326
|
+
readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
|
|
453
327
|
}>, {}>;
|
|
454
328
|
/** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
|
|
455
329
|
declare class PortFailed extends PortFailed_base {}
|
|
@@ -461,7 +335,7 @@ type PortResponseEnvelope = typeof PortResponse.Encoded;
|
|
|
461
335
|
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
336
|
readonly _tag: "LedgerAdmit";
|
|
463
337
|
readonly request: {
|
|
464
|
-
readonly
|
|
338
|
+
readonly threadId: string;
|
|
465
339
|
readonly principal: string;
|
|
466
340
|
readonly idempotencyKey: string;
|
|
467
341
|
readonly agentId: string;
|
|
@@ -490,7 +364,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
490
364
|
readonly submissionId: string;
|
|
491
365
|
} | {
|
|
492
366
|
readonly _tag: "SubmissionLookupByKey";
|
|
493
|
-
readonly
|
|
367
|
+
readonly threadId: string;
|
|
494
368
|
readonly principal: string;
|
|
495
369
|
readonly idempotencyKey: string;
|
|
496
370
|
};
|
|
@@ -498,7 +372,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
498
372
|
readonly _tag: "LedgerResolveAdmission";
|
|
499
373
|
readonly request: {
|
|
500
374
|
readonly _tag: "SubmissionLookupByKey";
|
|
501
|
-
readonly
|
|
375
|
+
readonly threadId: string;
|
|
502
376
|
readonly principal: string;
|
|
503
377
|
readonly idempotencyKey: string;
|
|
504
378
|
};
|
|
@@ -518,19 +392,19 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
518
392
|
} | {
|
|
519
393
|
readonly _tag: "StoreMaterialize";
|
|
520
394
|
readonly request: {
|
|
521
|
-
readonly
|
|
395
|
+
readonly threadId: string;
|
|
522
396
|
readonly producerEpoch: number;
|
|
523
397
|
};
|
|
524
398
|
} | {
|
|
525
399
|
readonly _tag: "StoreAppend";
|
|
526
400
|
readonly request: {
|
|
527
|
-
readonly
|
|
401
|
+
readonly threadId: string;
|
|
528
402
|
readonly batch: {
|
|
529
403
|
readonly batchId: string;
|
|
530
404
|
readonly producerId: string;
|
|
531
405
|
readonly records: readonly [{
|
|
532
406
|
readonly recordId: string;
|
|
533
|
-
readonly family: "
|
|
407
|
+
readonly family: "thread";
|
|
534
408
|
readonly schemaVersion: 1;
|
|
535
409
|
readonly createdAt: string;
|
|
536
410
|
readonly deploymentId: string;
|
|
@@ -540,7 +414,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
540
414
|
readonly author: string;
|
|
541
415
|
readonly reason: string;
|
|
542
416
|
} | {
|
|
543
|
-
readonly _tag: "
|
|
417
|
+
readonly _tag: "ThreadCreated";
|
|
544
418
|
readonly agentId: string;
|
|
545
419
|
readonly definitions: {
|
|
546
420
|
readonly agent: string;
|
|
@@ -549,18 +423,25 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
549
423
|
};
|
|
550
424
|
} | {
|
|
551
425
|
readonly _tag: "UserInputRecorded";
|
|
552
|
-
readonly submissionId
|
|
426
|
+
readonly submissionId?: string | undefined;
|
|
553
427
|
readonly kind: "follow-up" | "steering" | "user";
|
|
554
428
|
readonly runId?: string | undefined;
|
|
555
429
|
readonly input: Schema.Json;
|
|
556
430
|
} | {
|
|
557
431
|
readonly _tag: "RunStarted";
|
|
558
432
|
readonly runId: string;
|
|
433
|
+
readonly policyAccountingVersion: 1;
|
|
559
434
|
readonly maxDurationMillis: number;
|
|
435
|
+
} | {
|
|
436
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
437
|
+
readonly runId: string;
|
|
438
|
+
readonly programmaticToolCalls: number;
|
|
439
|
+
readonly finalizationUsed: boolean;
|
|
560
440
|
} | {
|
|
561
441
|
readonly _tag: "ModelCompleted";
|
|
562
442
|
readonly runId: string;
|
|
563
443
|
readonly output: Schema.Json;
|
|
444
|
+
readonly messages?: Schema.Json | undefined;
|
|
564
445
|
} | {
|
|
565
446
|
readonly _tag: "ModelResponseRecorded";
|
|
566
447
|
readonly runId: string;
|
|
@@ -599,6 +480,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
599
480
|
readonly toolName: string;
|
|
600
481
|
readonly parameters: Schema.Json;
|
|
601
482
|
readonly parametersDigest: string;
|
|
483
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
602
484
|
} | {
|
|
603
485
|
readonly _tag: "ToolCallSettled";
|
|
604
486
|
readonly runId: string;
|
|
@@ -606,6 +488,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
606
488
|
readonly toolName: string;
|
|
607
489
|
readonly result: Schema.Json;
|
|
608
490
|
readonly isFailure: boolean;
|
|
491
|
+
readonly budgetRejected?: true | undefined;
|
|
609
492
|
} | {
|
|
610
493
|
readonly _tag: "ToolCallUnknown";
|
|
611
494
|
readonly runId: string;
|
|
@@ -731,14 +614,15 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
731
614
|
readonly grantDigest: string;
|
|
732
615
|
readonly reservationId: string;
|
|
733
616
|
readonly reservationDigest: string;
|
|
734
|
-
readonly
|
|
617
|
+
readonly childThreadId: string;
|
|
735
618
|
readonly childPrincipal: string;
|
|
736
619
|
readonly childIdempotencyKey: string;
|
|
620
|
+
readonly toolCallAllowance?: number | undefined;
|
|
737
621
|
} | {
|
|
738
622
|
readonly _tag: "SubagentStarted";
|
|
739
623
|
readonly runId: string;
|
|
740
624
|
readonly toolCallId: string;
|
|
741
|
-
readonly
|
|
625
|
+
readonly childThreadId: string;
|
|
742
626
|
readonly childSubmissionId: string;
|
|
743
627
|
readonly childReceiptId: string;
|
|
744
628
|
readonly childRunId: string;
|
|
@@ -759,7 +643,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
759
643
|
readonly parentLink: {
|
|
760
644
|
readonly delegationId: string;
|
|
761
645
|
readonly parentAgentId: string;
|
|
762
|
-
readonly
|
|
646
|
+
readonly parentThreadId: string;
|
|
763
647
|
readonly parentRunId: string;
|
|
764
648
|
readonly parentToolCallId: string;
|
|
765
649
|
readonly depth: number;
|
|
@@ -772,6 +656,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
772
656
|
};
|
|
773
657
|
readonly childInputDigest: string;
|
|
774
658
|
readonly grantDigest: string;
|
|
659
|
+
readonly toolCallAllowance?: number | undefined;
|
|
775
660
|
} | {
|
|
776
661
|
readonly _tag: "RepairAnnotated";
|
|
777
662
|
readonly reason: string;
|
|
@@ -779,7 +664,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
779
664
|
};
|
|
780
665
|
}, ...{
|
|
781
666
|
readonly recordId: string;
|
|
782
|
-
readonly family: "
|
|
667
|
+
readonly family: "thread";
|
|
783
668
|
readonly schemaVersion: 1;
|
|
784
669
|
readonly createdAt: string;
|
|
785
670
|
readonly deploymentId: string;
|
|
@@ -789,7 +674,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
789
674
|
readonly author: string;
|
|
790
675
|
readonly reason: string;
|
|
791
676
|
} | {
|
|
792
|
-
readonly _tag: "
|
|
677
|
+
readonly _tag: "ThreadCreated";
|
|
793
678
|
readonly agentId: string;
|
|
794
679
|
readonly definitions: {
|
|
795
680
|
readonly agent: string;
|
|
@@ -798,18 +683,25 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
798
683
|
};
|
|
799
684
|
} | {
|
|
800
685
|
readonly _tag: "UserInputRecorded";
|
|
801
|
-
readonly submissionId
|
|
686
|
+
readonly submissionId?: string | undefined;
|
|
802
687
|
readonly kind: "follow-up" | "steering" | "user";
|
|
803
688
|
readonly runId?: string | undefined;
|
|
804
689
|
readonly input: Schema.Json;
|
|
805
690
|
} | {
|
|
806
691
|
readonly _tag: "RunStarted";
|
|
807
692
|
readonly runId: string;
|
|
693
|
+
readonly policyAccountingVersion: 1;
|
|
808
694
|
readonly maxDurationMillis: number;
|
|
695
|
+
} | {
|
|
696
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
697
|
+
readonly runId: string;
|
|
698
|
+
readonly programmaticToolCalls: number;
|
|
699
|
+
readonly finalizationUsed: boolean;
|
|
809
700
|
} | {
|
|
810
701
|
readonly _tag: "ModelCompleted";
|
|
811
702
|
readonly runId: string;
|
|
812
703
|
readonly output: Schema.Json;
|
|
704
|
+
readonly messages?: Schema.Json | undefined;
|
|
813
705
|
} | {
|
|
814
706
|
readonly _tag: "ModelResponseRecorded";
|
|
815
707
|
readonly runId: string;
|
|
@@ -848,6 +740,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
848
740
|
readonly toolName: string;
|
|
849
741
|
readonly parameters: Schema.Json;
|
|
850
742
|
readonly parametersDigest: string;
|
|
743
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
851
744
|
} | {
|
|
852
745
|
readonly _tag: "ToolCallSettled";
|
|
853
746
|
readonly runId: string;
|
|
@@ -855,6 +748,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
855
748
|
readonly toolName: string;
|
|
856
749
|
readonly result: Schema.Json;
|
|
857
750
|
readonly isFailure: boolean;
|
|
751
|
+
readonly budgetRejected?: true | undefined;
|
|
858
752
|
} | {
|
|
859
753
|
readonly _tag: "ToolCallUnknown";
|
|
860
754
|
readonly runId: string;
|
|
@@ -980,14 +874,15 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
980
874
|
readonly grantDigest: string;
|
|
981
875
|
readonly reservationId: string;
|
|
982
876
|
readonly reservationDigest: string;
|
|
983
|
-
readonly
|
|
877
|
+
readonly childThreadId: string;
|
|
984
878
|
readonly childPrincipal: string;
|
|
985
879
|
readonly childIdempotencyKey: string;
|
|
880
|
+
readonly toolCallAllowance?: number | undefined;
|
|
986
881
|
} | {
|
|
987
882
|
readonly _tag: "SubagentStarted";
|
|
988
883
|
readonly runId: string;
|
|
989
884
|
readonly toolCallId: string;
|
|
990
|
-
readonly
|
|
885
|
+
readonly childThreadId: string;
|
|
991
886
|
readonly childSubmissionId: string;
|
|
992
887
|
readonly childReceiptId: string;
|
|
993
888
|
readonly childRunId: string;
|
|
@@ -1008,7 +903,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1008
903
|
readonly parentLink: {
|
|
1009
904
|
readonly delegationId: string;
|
|
1010
905
|
readonly parentAgentId: string;
|
|
1011
|
-
readonly
|
|
906
|
+
readonly parentThreadId: string;
|
|
1012
907
|
readonly parentRunId: string;
|
|
1013
908
|
readonly parentToolCallId: string;
|
|
1014
909
|
readonly depth: number;
|
|
@@ -1021,6 +916,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1021
916
|
};
|
|
1022
917
|
readonly childInputDigest: string;
|
|
1023
918
|
readonly grantDigest: string;
|
|
919
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1024
920
|
} | {
|
|
1025
921
|
readonly _tag: "RepairAnnotated";
|
|
1026
922
|
readonly reason: string;
|
|
@@ -1035,19 +931,19 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
|
|
|
1035
931
|
} | {
|
|
1036
932
|
readonly _tag: "StoreReadPage";
|
|
1037
933
|
readonly request: {
|
|
1038
|
-
readonly
|
|
934
|
+
readonly threadId: string;
|
|
1039
935
|
readonly afterSequence?: number | undefined;
|
|
1040
936
|
readonly limit: number;
|
|
1041
937
|
};
|
|
1042
938
|
} | {
|
|
1043
939
|
readonly _tag: "StoreInspectTail";
|
|
1044
940
|
readonly request: {
|
|
1045
|
-
readonly
|
|
941
|
+
readonly threadId: string;
|
|
1046
942
|
};
|
|
1047
943
|
} | {
|
|
1048
944
|
readonly _tag: "StoreExport";
|
|
1049
945
|
readonly request: {
|
|
1050
|
-
readonly
|
|
946
|
+
readonly threadId: string;
|
|
1051
947
|
};
|
|
1052
948
|
}, Schema.SchemaError, never>;
|
|
1053
949
|
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 +964,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1068
964
|
readonly _tag: "LedgerLookupResult";
|
|
1069
965
|
readonly submission?: {
|
|
1070
966
|
readonly submissionId: string;
|
|
1071
|
-
readonly
|
|
967
|
+
readonly threadId: string;
|
|
1072
968
|
readonly queueSequence: number;
|
|
1073
969
|
readonly principal: string;
|
|
1074
970
|
readonly idempotencyKey: string;
|
|
@@ -1099,7 +995,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1099
995
|
readonly _tag: "Admitted";
|
|
1100
996
|
readonly submission: {
|
|
1101
997
|
readonly submissionId: string;
|
|
1102
|
-
readonly
|
|
998
|
+
readonly threadId: string;
|
|
1103
999
|
readonly queueSequence: number;
|
|
1104
1000
|
readonly principal: string;
|
|
1105
1001
|
readonly idempotencyKey: string;
|
|
@@ -1151,13 +1047,13 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1151
1047
|
} | {
|
|
1152
1048
|
readonly _tag: "StoreReadPageResult";
|
|
1153
1049
|
readonly records: readonly {
|
|
1154
|
-
readonly
|
|
1050
|
+
readonly threadId: string;
|
|
1155
1051
|
readonly batchId: string;
|
|
1156
1052
|
readonly sequence: number;
|
|
1157
1053
|
readonly offset: string;
|
|
1158
1054
|
readonly record: {
|
|
1159
1055
|
readonly recordId: string;
|
|
1160
|
-
readonly family: "
|
|
1056
|
+
readonly family: "thread";
|
|
1161
1057
|
readonly schemaVersion: 1;
|
|
1162
1058
|
readonly createdAt: string;
|
|
1163
1059
|
readonly deploymentId: string;
|
|
@@ -1167,7 +1063,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1167
1063
|
readonly author: string;
|
|
1168
1064
|
readonly reason: string;
|
|
1169
1065
|
} | {
|
|
1170
|
-
readonly _tag: "
|
|
1066
|
+
readonly _tag: "ThreadCreated";
|
|
1171
1067
|
readonly agentId: string;
|
|
1172
1068
|
readonly definitions: {
|
|
1173
1069
|
readonly agent: string;
|
|
@@ -1176,18 +1072,25 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1176
1072
|
};
|
|
1177
1073
|
} | {
|
|
1178
1074
|
readonly _tag: "UserInputRecorded";
|
|
1179
|
-
readonly submissionId
|
|
1075
|
+
readonly submissionId?: string | undefined;
|
|
1180
1076
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1181
1077
|
readonly runId?: string | undefined;
|
|
1182
1078
|
readonly input: Schema.Json;
|
|
1183
1079
|
} | {
|
|
1184
1080
|
readonly _tag: "RunStarted";
|
|
1185
1081
|
readonly runId: string;
|
|
1082
|
+
readonly policyAccountingVersion: 1;
|
|
1186
1083
|
readonly maxDurationMillis: number;
|
|
1084
|
+
} | {
|
|
1085
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
1086
|
+
readonly runId: string;
|
|
1087
|
+
readonly programmaticToolCalls: number;
|
|
1088
|
+
readonly finalizationUsed: boolean;
|
|
1187
1089
|
} | {
|
|
1188
1090
|
readonly _tag: "ModelCompleted";
|
|
1189
1091
|
readonly runId: string;
|
|
1190
1092
|
readonly output: Schema.Json;
|
|
1093
|
+
readonly messages?: Schema.Json | undefined;
|
|
1191
1094
|
} | {
|
|
1192
1095
|
readonly _tag: "ModelResponseRecorded";
|
|
1193
1096
|
readonly runId: string;
|
|
@@ -1226,6 +1129,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1226
1129
|
readonly toolName: string;
|
|
1227
1130
|
readonly parameters: Schema.Json;
|
|
1228
1131
|
readonly parametersDigest: string;
|
|
1132
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
1229
1133
|
} | {
|
|
1230
1134
|
readonly _tag: "ToolCallSettled";
|
|
1231
1135
|
readonly runId: string;
|
|
@@ -1233,6 +1137,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1233
1137
|
readonly toolName: string;
|
|
1234
1138
|
readonly result: Schema.Json;
|
|
1235
1139
|
readonly isFailure: boolean;
|
|
1140
|
+
readonly budgetRejected?: true | undefined;
|
|
1236
1141
|
} | {
|
|
1237
1142
|
readonly _tag: "ToolCallUnknown";
|
|
1238
1143
|
readonly runId: string;
|
|
@@ -1358,14 +1263,15 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1358
1263
|
readonly grantDigest: string;
|
|
1359
1264
|
readonly reservationId: string;
|
|
1360
1265
|
readonly reservationDigest: string;
|
|
1361
|
-
readonly
|
|
1266
|
+
readonly childThreadId: string;
|
|
1362
1267
|
readonly childPrincipal: string;
|
|
1363
1268
|
readonly childIdempotencyKey: string;
|
|
1269
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1364
1270
|
} | {
|
|
1365
1271
|
readonly _tag: "SubagentStarted";
|
|
1366
1272
|
readonly runId: string;
|
|
1367
1273
|
readonly toolCallId: string;
|
|
1368
|
-
readonly
|
|
1274
|
+
readonly childThreadId: string;
|
|
1369
1275
|
readonly childSubmissionId: string;
|
|
1370
1276
|
readonly childReceiptId: string;
|
|
1371
1277
|
readonly childRunId: string;
|
|
@@ -1386,7 +1292,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1386
1292
|
readonly parentLink: {
|
|
1387
1293
|
readonly delegationId: string;
|
|
1388
1294
|
readonly parentAgentId: string;
|
|
1389
|
-
readonly
|
|
1295
|
+
readonly parentThreadId: string;
|
|
1390
1296
|
readonly parentRunId: string;
|
|
1391
1297
|
readonly parentToolCallId: string;
|
|
1392
1298
|
readonly depth: number;
|
|
@@ -1399,6 +1305,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1399
1305
|
};
|
|
1400
1306
|
readonly childInputDigest: string;
|
|
1401
1307
|
readonly grantDigest: string;
|
|
1308
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1402
1309
|
} | {
|
|
1403
1310
|
readonly _tag: "RepairAnnotated";
|
|
1404
1311
|
readonly reason: string;
|
|
@@ -1409,7 +1316,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1409
1316
|
} | {
|
|
1410
1317
|
readonly _tag: "StoreInspectTailResult";
|
|
1411
1318
|
readonly tail: {
|
|
1412
|
-
readonly
|
|
1319
|
+
readonly threadId: string;
|
|
1413
1320
|
readonly tailSequence: number;
|
|
1414
1321
|
readonly tailDigest: string;
|
|
1415
1322
|
readonly producerEpoch: number;
|
|
@@ -1417,18 +1324,18 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1417
1324
|
} | {
|
|
1418
1325
|
readonly _tag: "StoreExportResult";
|
|
1419
1326
|
readonly export: {
|
|
1420
|
-
readonly format: "effect-agent/
|
|
1421
|
-
readonly
|
|
1327
|
+
readonly format: "effect-agent/thread@1";
|
|
1328
|
+
readonly threadId: string;
|
|
1422
1329
|
readonly tailSequence: number;
|
|
1423
1330
|
readonly tailDigest: string;
|
|
1424
1331
|
readonly records: readonly {
|
|
1425
|
-
readonly
|
|
1332
|
+
readonly threadId: string;
|
|
1426
1333
|
readonly batchId: string;
|
|
1427
1334
|
readonly sequence: number;
|
|
1428
1335
|
readonly offset: string;
|
|
1429
1336
|
readonly record: {
|
|
1430
1337
|
readonly recordId: string;
|
|
1431
|
-
readonly family: "
|
|
1338
|
+
readonly family: "thread";
|
|
1432
1339
|
readonly schemaVersion: 1;
|
|
1433
1340
|
readonly createdAt: string;
|
|
1434
1341
|
readonly deploymentId: string;
|
|
@@ -1438,7 +1345,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1438
1345
|
readonly author: string;
|
|
1439
1346
|
readonly reason: string;
|
|
1440
1347
|
} | {
|
|
1441
|
-
readonly _tag: "
|
|
1348
|
+
readonly _tag: "ThreadCreated";
|
|
1442
1349
|
readonly agentId: string;
|
|
1443
1350
|
readonly definitions: {
|
|
1444
1351
|
readonly agent: string;
|
|
@@ -1447,18 +1354,25 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1447
1354
|
};
|
|
1448
1355
|
} | {
|
|
1449
1356
|
readonly _tag: "UserInputRecorded";
|
|
1450
|
-
readonly submissionId
|
|
1357
|
+
readonly submissionId?: string | undefined;
|
|
1451
1358
|
readonly kind: "follow-up" | "steering" | "user";
|
|
1452
1359
|
readonly runId?: string | undefined;
|
|
1453
1360
|
readonly input: Schema.Json;
|
|
1454
1361
|
} | {
|
|
1455
1362
|
readonly _tag: "RunStarted";
|
|
1456
1363
|
readonly runId: string;
|
|
1364
|
+
readonly policyAccountingVersion: 1;
|
|
1457
1365
|
readonly maxDurationMillis: number;
|
|
1366
|
+
} | {
|
|
1367
|
+
readonly _tag: "RunPolicyUsageReserved";
|
|
1368
|
+
readonly runId: string;
|
|
1369
|
+
readonly programmaticToolCalls: number;
|
|
1370
|
+
readonly finalizationUsed: boolean;
|
|
1458
1371
|
} | {
|
|
1459
1372
|
readonly _tag: "ModelCompleted";
|
|
1460
1373
|
readonly runId: string;
|
|
1461
1374
|
readonly output: Schema.Json;
|
|
1375
|
+
readonly messages?: Schema.Json | undefined;
|
|
1462
1376
|
} | {
|
|
1463
1377
|
readonly _tag: "ModelResponseRecorded";
|
|
1464
1378
|
readonly runId: string;
|
|
@@ -1497,6 +1411,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1497
1411
|
readonly toolName: string;
|
|
1498
1412
|
readonly parameters: Schema.Json;
|
|
1499
1413
|
readonly parametersDigest: string;
|
|
1414
|
+
readonly executionKind?: "delegation" | "ordinary" | undefined;
|
|
1500
1415
|
} | {
|
|
1501
1416
|
readonly _tag: "ToolCallSettled";
|
|
1502
1417
|
readonly runId: string;
|
|
@@ -1504,6 +1419,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1504
1419
|
readonly toolName: string;
|
|
1505
1420
|
readonly result: Schema.Json;
|
|
1506
1421
|
readonly isFailure: boolean;
|
|
1422
|
+
readonly budgetRejected?: true | undefined;
|
|
1507
1423
|
} | {
|
|
1508
1424
|
readonly _tag: "ToolCallUnknown";
|
|
1509
1425
|
readonly runId: string;
|
|
@@ -1629,14 +1545,15 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1629
1545
|
readonly grantDigest: string;
|
|
1630
1546
|
readonly reservationId: string;
|
|
1631
1547
|
readonly reservationDigest: string;
|
|
1632
|
-
readonly
|
|
1548
|
+
readonly childThreadId: string;
|
|
1633
1549
|
readonly childPrincipal: string;
|
|
1634
1550
|
readonly childIdempotencyKey: string;
|
|
1551
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1635
1552
|
} | {
|
|
1636
1553
|
readonly _tag: "SubagentStarted";
|
|
1637
1554
|
readonly runId: string;
|
|
1638
1555
|
readonly toolCallId: string;
|
|
1639
|
-
readonly
|
|
1556
|
+
readonly childThreadId: string;
|
|
1640
1557
|
readonly childSubmissionId: string;
|
|
1641
1558
|
readonly childReceiptId: string;
|
|
1642
1559
|
readonly childRunId: string;
|
|
@@ -1657,7 +1574,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1657
1574
|
readonly parentLink: {
|
|
1658
1575
|
readonly delegationId: string;
|
|
1659
1576
|
readonly parentAgentId: string;
|
|
1660
|
-
readonly
|
|
1577
|
+
readonly parentThreadId: string;
|
|
1661
1578
|
readonly parentRunId: string;
|
|
1662
1579
|
readonly parentToolCallId: string;
|
|
1663
1580
|
readonly depth: number;
|
|
@@ -1670,6 +1587,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1670
1587
|
};
|
|
1671
1588
|
readonly childInputDigest: string;
|
|
1672
1589
|
readonly grantDigest: string;
|
|
1590
|
+
readonly toolCallAllowance?: number | undefined;
|
|
1673
1591
|
} | {
|
|
1674
1592
|
readonly _tag: "RepairAnnotated";
|
|
1675
1593
|
readonly reason: string;
|
|
@@ -1686,7 +1604,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1686
1604
|
readonly message: string;
|
|
1687
1605
|
} | {
|
|
1688
1606
|
readonly _tag: "AdmissionConflict";
|
|
1689
|
-
readonly
|
|
1607
|
+
readonly threadId: string;
|
|
1690
1608
|
readonly principal: string;
|
|
1691
1609
|
readonly idempotencyKey: string;
|
|
1692
1610
|
readonly existingInputDigest: string;
|
|
@@ -1705,23 +1623,23 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1705
1623
|
readonly message: string;
|
|
1706
1624
|
readonly cause?: Schema.Json | undefined;
|
|
1707
1625
|
} | {
|
|
1708
|
-
readonly _tag: "
|
|
1626
|
+
readonly _tag: "ThreadStoreError";
|
|
1709
1627
|
readonly operation: string;
|
|
1710
1628
|
readonly message: string;
|
|
1711
1629
|
readonly cause?: Schema.Json | undefined;
|
|
1712
1630
|
} | {
|
|
1713
|
-
readonly _tag: "
|
|
1714
|
-
readonly
|
|
1631
|
+
readonly _tag: "ThreadNotMaterialized";
|
|
1632
|
+
readonly threadId: string;
|
|
1715
1633
|
} | {
|
|
1716
1634
|
readonly _tag: "AppendConflict";
|
|
1717
|
-
readonly
|
|
1635
|
+
readonly threadId: string;
|
|
1718
1636
|
readonly batchId: string;
|
|
1719
1637
|
readonly reason: "batch-digest" | "record-identity" | "tail";
|
|
1720
1638
|
readonly actualTailSequence?: number | undefined;
|
|
1721
1639
|
readonly actualTailDigest?: string | undefined;
|
|
1722
1640
|
} | {
|
|
1723
1641
|
readonly _tag: "FenceRejected";
|
|
1724
|
-
readonly
|
|
1642
|
+
readonly threadId: string;
|
|
1725
1643
|
readonly actualEpoch: number;
|
|
1726
1644
|
readonly attemptedEpoch: number;
|
|
1727
1645
|
};
|
|
@@ -1729,7 +1647,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
|
|
|
1729
1647
|
declare const decodePortResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<PortFailed | PortSucceeded, Schema.SchemaError, never>;
|
|
1730
1648
|
//#endregion
|
|
1731
1649
|
//#region src/routing.d.ts
|
|
1732
|
-
type
|
|
1650
|
+
type ThreadId = ThreadMaterialization["threadId"];
|
|
1733
1651
|
declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.TaggedStruct<"PortTransportError", {
|
|
1734
1652
|
readonly target: Schema.String;
|
|
1735
1653
|
readonly message: Schema.String;
|
|
@@ -1738,7 +1656,7 @@ declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.T
|
|
|
1738
1656
|
}>, import("effect/Cause").YieldableError>;
|
|
1739
1657
|
/**
|
|
1740
1658
|
* A transport could not deliver a port request to (or an answer from) the owning
|
|
1741
|
-
*
|
|
1659
|
+
* Thread's Durable Object. `retryable` carries the platform's own stub signal when one
|
|
1742
1660
|
* exists. This error never crosses the wire — it is the CALLER-side evidence that the
|
|
1743
1661
|
* authority was unreachable, which is exactly the case `AdmissionIndeterminate` was
|
|
1744
1662
|
* specified for (SUB-031).
|
|
@@ -1749,50 +1667,50 @@ declare class PortTransportError extends PortTransportError_base {}
|
|
|
1749
1667
|
* platform stub's own `retryable` signal when present.
|
|
1750
1668
|
*/
|
|
1751
1669
|
declare const portTransportFailure: (target: string, cause: unknown) => PortTransportError;
|
|
1752
|
-
declare const
|
|
1753
|
-
readonly call: (
|
|
1670
|
+
declare const ThreadPortTransport_base: Context.ServiceClass<ThreadPortTransport, "@effect-agent/storage-cloudflare/ThreadPortTransport", {
|
|
1671
|
+
readonly call: (threadId: ThreadId, request: PortRequestEnvelope) => Effect.Effect<unknown, PortTransportError>;
|
|
1754
1672
|
}>;
|
|
1755
1673
|
/**
|
|
1756
1674
|
* Delivery of Schema-encoded port envelopes to the Durable Object that owns a FOREIGN
|
|
1757
|
-
*
|
|
1675
|
+
* Thread (plan §1.3, D-P6-3). The shipped implementation (platform-cloudflare, WP3)
|
|
1758
1676
|
* calls the owner's `portCall` over native Durable Object JS RPC via
|
|
1759
|
-
* `namespace.idFromName(
|
|
1677
|
+
* `namespace.idFromName(threadId)`; the protocol is transport-agnostic and any carrier
|
|
1760
1678
|
* that moves the encoded envelopes verbatim satisfies this service. Implementations MUST
|
|
1761
1679
|
* surface every delivery problem as `PortTransportError` and must never fabricate an answer.
|
|
1762
1680
|
*/
|
|
1763
|
-
declare class
|
|
1681
|
+
declare class ThreadPortTransport extends ThreadPortTransport_base {}
|
|
1764
1682
|
/** Construction options shared by both routed port Layers. */
|
|
1765
1683
|
interface RoutedPortOptions {
|
|
1766
1684
|
/**
|
|
1767
|
-
* The
|
|
1768
|
-
* `namespace.idFromName(
|
|
1685
|
+
* The Thread this Durable Object owns (the Object identity rule is
|
|
1686
|
+
* `namespace.idFromName(threadId)`). Requests addressed here execute on the local
|
|
1769
1687
|
* facet; requests addressed anywhere else route through the transport or fail fast typed.
|
|
1770
1688
|
*/
|
|
1771
|
-
readonly
|
|
1689
|
+
readonly localThreadId: ThreadId;
|
|
1772
1690
|
}
|
|
1773
1691
|
/**
|
|
1774
1692
|
* Routing decorator over the LOCAL `SubmissionLedger` facet (plan §1.3): a request addressing
|
|
1775
|
-
* this Object's
|
|
1776
|
-
*
|
|
1693
|
+
* this Object's Thread executes locally; a route-capable request addressing another
|
|
1694
|
+
* Thread is Schema-encoded onto the `ThreadPortTransport` and executed by the
|
|
1777
1695
|
* owning Object's local facet; any other foreign request fails fast typed. Provide the WP1
|
|
1778
1696
|
* local facet (`submissionLedgerLayer`/`ledgerLayer`) and a transport to close it.
|
|
1779
1697
|
*/
|
|
1780
|
-
declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger |
|
|
1698
|
+
declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger | ThreadPortTransport>;
|
|
1781
1699
|
/**
|
|
1782
|
-
* Routing decorator over the LOCAL `
|
|
1700
|
+
* Routing decorator over the LOCAL `ThreadStore` facet (plan §1.3): this-thread
|
|
1783
1701
|
* requests execute locally; foreign materialize/append/read/inspectTail/export travel the
|
|
1784
1702
|
* transport; foreign observation and checkpoints fail fast typed.
|
|
1785
1703
|
*/
|
|
1786
|
-
declare const
|
|
1704
|
+
declare const routedThreadStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ThreadStore, never, ThreadStore | ThreadPortTransport>;
|
|
1787
1705
|
/**
|
|
1788
1706
|
* Execute one decoded port request against THIS Object's LOCAL facets — the owner-side half
|
|
1789
1707
|
* of the routed ports (plan §1.3). Callers must provide the WP1 local facets, never the
|
|
1790
1708
|
* routed decorators: the routing layer already established that this Object owns the
|
|
1791
|
-
* addressed
|
|
1709
|
+
* addressed Thread, and re-routing here could bounce a request between Objects.
|
|
1792
1710
|
* Failures never escape — every typed port failure becomes a `PortFailed` envelope that
|
|
1793
1711
|
* re-decodes on the caller side.
|
|
1794
1712
|
*/
|
|
1795
|
-
declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never,
|
|
1713
|
+
declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never, SubmissionLedger | ThreadStore>;
|
|
1796
1714
|
/**
|
|
1797
1715
|
* The complete owner-side endpoint body for `portCall` (D-P6-3): decode the wire request,
|
|
1798
1716
|
* execute it against this Object's LOCAL facets, and answer with the encoded response
|
|
@@ -1800,7 +1718,7 @@ declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall |
|
|
|
1800
1718
|
* cannot be encoded, answers `PortFailed(PortProtocolError)` instead of throwing, so the
|
|
1801
1719
|
* transport never has to interpret exceptions as protocol answers.
|
|
1802
1720
|
*/
|
|
1803
|
-
declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never,
|
|
1721
|
+
declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, SubmissionLedger | ThreadStore>;
|
|
1804
1722
|
//#endregion
|
|
1805
|
-
export {
|
|
1723
|
+
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
1724
|
//# sourceMappingURL=index.d.mts.map
|