@effect-agent/storage-cloudflare 0.1.0-beta.8 → 0.1.0-beta.81

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.
Files changed (73) hide show
  1. package/dist/DoMemoryStore.d.mts +29 -0
  2. package/dist/DoMemoryStore.mjs +55 -0
  3. package/dist/DoMemoryStore.mjs.map +1 -0
  4. package/dist/DoMessageDeliveryStore.d.mts +17 -0
  5. package/dist/DoMessageDeliveryStore.mjs +32 -0
  6. package/dist/DoMessageDeliveryStore.mjs.map +1 -0
  7. package/dist/DoScheduleStore.d.mts +36 -0
  8. package/dist/DoScheduleStore.mjs +388 -0
  9. package/dist/DoScheduleStore.mjs.map +1 -0
  10. package/dist/DoStorageConfig.d.mts +45 -0
  11. package/dist/DoStorageConfig.mjs +52 -0
  12. package/dist/DoStorageConfig.mjs.map +1 -0
  13. package/dist/DoStorageError-Cmhvl4TQ.d.mts +98 -0
  14. package/dist/DoStorageError.d.mts +2 -0
  15. package/dist/DoStorageError.mjs +164 -0
  16. package/dist/DoStorageError.mjs.map +1 -0
  17. package/dist/DoStorageFailpoint.d.mts +17 -0
  18. package/dist/DoStorageFailpoint.mjs +14 -0
  19. package/dist/DoStorageFailpoint.mjs.map +1 -0
  20. package/dist/DoStorageFailpointTesting.d.mts +34 -0
  21. package/dist/DoStorageFailpointTesting.mjs +35 -0
  22. package/dist/DoStorageFailpointTesting.mjs.map +1 -0
  23. package/dist/DoStorageVersion-x5OOurvZ.d.mts +12 -0
  24. package/dist/DoStorageVersion.d.mts +2 -0
  25. package/dist/DoStorageVersion.mjs +8 -0
  26. package/dist/DoStorageVersion.mjs.map +1 -0
  27. package/dist/DoSubmissionLedger.d.mts +23 -0
  28. package/dist/DoSubmissionLedger.mjs +1849 -0
  29. package/dist/DoSubmissionLedger.mjs.map +1 -0
  30. package/dist/DoSubscriptionStore.d.mts +25 -0
  31. package/dist/DoSubscriptionStore.mjs +183 -0
  32. package/dist/DoSubscriptionStore.mjs.map +1 -0
  33. package/dist/DoThreadStore.d.mts +59 -0
  34. package/dist/DoThreadStore.mjs +465 -0
  35. package/dist/DoThreadStore.mjs.map +1 -0
  36. package/dist/MemoryProtocol.d.mts +38160 -0
  37. package/dist/MemoryProtocol.mjs +219 -0
  38. package/dist/MemoryProtocol.mjs.map +1 -0
  39. package/dist/PortProtocol.d.mts +3207 -0
  40. package/dist/PortProtocol.mjs +176 -0
  41. package/dist/PortProtocol.mjs.map +1 -0
  42. package/dist/PortRouting.d.mts +83 -0
  43. package/dist/PortRouting.mjs +410 -0
  44. package/dist/PortRouting.mjs.map +1 -0
  45. package/dist/do-journal-DHqCQeBU.mjs +991 -0
  46. package/dist/do-journal-DHqCQeBU.mjs.map +1 -0
  47. package/dist/index.d.mts +14 -1521
  48. package/dist/index.mjs +14 -3695
  49. package/dist/migrations-Ba_kOrSx.mjs +287 -0
  50. package/dist/migrations-Ba_kOrSx.mjs.map +1 -0
  51. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  52. package/package.json +1 -45
  53. package/src/DoMemoryStore.ts +59 -0
  54. package/src/DoMessageDeliveryStore.ts +53 -0
  55. package/src/DoScheduleStore.ts +622 -0
  56. package/src/{errors.ts → DoStorageError.ts} +10 -3
  57. package/src/DoStorageFailpoint.ts +20 -0
  58. package/src/{do-storage-failpoint.ts → DoStorageFailpointTesting.ts} +5 -18
  59. package/src/DoStorageVersion.ts +2 -0
  60. package/src/{do-ledger.ts → DoSubmissionLedger.ts} +862 -163
  61. package/src/DoSubscriptionStore.ts +329 -0
  62. package/src/DoThreadStore.ts +1014 -0
  63. package/src/MemoryProtocol.ts +355 -0
  64. package/src/{port-protocol.ts → PortProtocol.ts} +44 -37
  65. package/src/{routing.ts → PortRouting.ts} +292 -264
  66. package/src/index.ts +13 -32
  67. package/src/{do-journal.ts → internal/do-journal.ts} +716 -232
  68. package/src/internal/message-delivery-schema.ts +24 -0
  69. package/src/{migrations.ts → internal/migrations.ts} +51 -35
  70. package/src/internal/recovery-checkpoint-schema.ts +17 -0
  71. package/dist/index.mjs.map +0 -1
  72. package/src/do-conversation-store.ts +0 -850
  73. /package/src/{do-storage-config.ts → DoStorageConfig.ts} +0 -0
package/dist/index.d.mts CHANGED
@@ -1,1521 +1,14 @@
1
- import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionRequest, AdmissionResult, AppendConflict, AppendResult, CanonicalRecordEnvelope, ChildSettledNotification, ConversationExport, ConversationExportRequest, ConversationMaterialization, ConversationNotMaterialized, ConversationRead, ConversationStore, ConversationStoreError, ConversationTail, ConversationTailRequest, FenceRejected, FencedAppendRequest, JoinedToHost, LedgerError, MarkReadyRequest, SettlementConflict, SubmissionLedger, SubmissionLookupByKey, SubmissionSnapshot } from "@effect-agent/session";
2
- import { Context, Crypto, Effect, Layer, Schema } from "effect";
3
- import { SqliteMigrator } from "@effect/sql-sqlite-do";
4
- 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
- //#region src/migrations.d.ts
99
- /**
100
- * The exact-or-fresh storage version recorded in `effect_agent_meta`. Cloudflare is a fresh
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>;
121
- //#endregion
122
- //#region src/do-storage-config.d.ts
123
- /**
124
- * Default per-value byte bound, kept under the Durable Object platform's 2 MB SQLite value
125
- * limit with a safety margin. This is the DC analogue of Node's 16 MB `BoundedStoredText`
126
- * bound: both fail typed before mutating, only the threshold differs (a documented DN/DC
127
- * behavioral difference; Travel Planner payloads sit orders of magnitude below both).
128
- */
129
- declare const DEFAULT_MAX_STORED_VALUE_BYTES = 1900000;
130
- declare const DoStorageConfigValue_base: Schema.Class<DoStorageConfigValue, Schema.Struct<{
131
- readonly observationPollInterval: Schema.Int;
132
- /**
133
- * Submission ownership lease duration in milliseconds (D5). Inside one Durable Object the
134
- * object itself is the serialized owner, so the lease's primary DC role is fencing work
135
- * across DO incarnations (an evicted incarnation's claim becomes reclaimable); correctness
136
- * never depends on it because every canonical append is fenced by producer epoch.
137
- */
138
- readonly ownershipLeaseDuration: Schema.Int;
139
- /**
140
- * Maximum bytes for any single stored text value (canonical batch/record JSON, admission
141
- * input payload, checkpoint JSON). Enforced typed BEFORE any write; must stay under the
142
- * platform's 2 MB per-value limit.
143
- */
144
- readonly maxStoredValueBytes: Schema.Int;
145
- /**
146
- * Re-verify every stored payload and digest chain while opening the store. Per-operation
147
- * Schema decoding and the digest chain already fail clearly on corrupt rows, so the full
148
- * scan is an explicit opt-in integrity audit rather than a startup requirement.
149
- */
150
- readonly verifyOnOpen: Schema.Boolean;
151
- }>, {}>;
152
- /**
153
- * Validated construction configuration consumed by the Durable Object storage Layers. The
154
- * storage identity itself belongs to the SqlClient Layer (built from `ctx.storage`);
155
- * duplicating it here could silently diverge from the handle actually in use.
156
- */
157
- declare class DoStorageConfigValue extends DoStorageConfigValue_base {}
158
- declare const DoStorageConfig_base: Context.ServiceClass<DoStorageConfig, "@effect-agent/storage-cloudflare/DoStorageConfig", DoStorageConfigValue>;
159
- /** Explicit Durable Object storage configuration authority. */
160
- declare class DoStorageConfig extends DoStorageConfig_base {}
161
- //#endregion
162
- //#region src/do-storage-failpoint.d.ts
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
200
- /**
201
- * Convenience-layer construction options. `storage` is the Durable Object's own
202
- * `ctx.storage` handle, injected as a value (DEPLOY-010: platform bindings enter only
203
- * through Layers; this package never imports `cloudflare:workers`).
204
- */
205
- interface DoStorageOptions {
206
- readonly storage: DurableObjectStorage;
207
- readonly observationPollInterval?: number | undefined;
208
- /**
209
- * Submission ownership lease duration in milliseconds (D5). Defaults to
210
- * `DEFAULT_OWNERSHIP_LEASE_DURATION` from `@effect-agent/session`.
211
- */
212
- readonly ownershipLeaseDuration?: number | undefined;
213
- /**
214
- * Maximum bytes for any single stored value; must stay under the platform's 2 MB
215
- * per-value limit. Defaults to `DEFAULT_MAX_STORED_VALUE_BYTES`.
216
- */
217
- readonly maxStoredValueBytes?: number | undefined;
218
- /**
219
- * Re-verify every stored payload and digest chain while opening the store. Defaults to
220
- * off: per-operation Schema decoding and the digest chain already fail clearly on corrupt
221
- * rows without scanning the whole database on every open.
222
- */
223
- readonly verifyOnOpen?: boolean | undefined;
224
- readonly failpoint?: DoStorageFailpointHandler | undefined;
225
- }
226
- type DoStorageInitializationError = DoStorageCompatibilityError | DoStorageCorruptionError | DoStorageError;
227
- /**
228
- * Durable Object Conversation Store implementation with configuration, failpoint, SQL, and
229
- * Crypto authority kept visible in its input channel.
230
- */
231
- declare const conversationStoreLayer: Layer.Layer<ConversationStore, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
232
- /**
233
- * Validated Durable Object storage configuration Layer with the documented defaults applied.
234
- * Shared by the ConversationStore and SubmissionLedger convenience layers so their defaults
235
- * cannot drift.
236
- */
237
- declare const storageConfigLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageConfig, DoStorageError>;
238
- /** The failpoint Layer selected by convenience options: explicit handler or the no-op default. */
239
- declare const storageFailpointLayer: (options: DoStorageOptions) => Layer.Layer<DoStorageFailpoint>;
240
- /**
241
- * A composition-root convenience Layer for canonical Conversations inside one Durable Object,
242
- * built over `ctx.storage`. Durable accepted work is served by the separate SubmissionLedger
243
- * port; point both at the SAME `ctx.storage` so claims fence the same producer epochs
244
- * (ADR-0011 D7's "same file" rule, transposed to one object's private database).
245
- */
246
- declare const layer: (options: DoStorageOptions) => Layer.Layer<ConversationStore, DoStorageInitializationError>;
247
- /** Create an adapter-owned resumable observation offset for a known canonical sequence. */
248
- declare const observationOffsetAt: (conversationId: string & import("effect/Brand").Brand<"@effect-agent/core/ConversationId">, sequence: number) => Effect.Effect<string & import("effect/Brand").Brand<"@effect-agent/session/ObservationOffset">, ConversationStoreError, never>;
249
- //#endregion
250
- //#region src/do-ledger.d.ts
251
- /**
252
- * Durable Object SubmissionLedger implementation sharing the journal's private SQLite
253
- * database, storage-backed transaction discipline, and producer-epoch fencing substrate.
254
- * Configuration, failpoint, SQL, and Crypto authority stay visible in the input channel.
255
- */
256
- declare const submissionLedgerLayer: Layer.Layer<SubmissionLedger, DoStorageInitializationError, DoStorageConfig | DoStorageFailpoint | SqlClientService.SqlClient | Crypto.Crypto>;
257
- /**
258
- * A composition-root convenience Layer for the durable Submission Ledger. Point it at the
259
- * same `ctx.storage` as the ConversationStore so claims fence the same producer epochs.
260
- */
261
- declare const ledgerLayer: (options: DoStorageOptions) => Layer.Layer<SubmissionLedger, DoStorageInitializationError>;
262
- //#endregion
263
- //#region src/port-protocol.d.ts
264
- /**
265
- * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
266
- * envelopes for the CLOSED route-capable subset of the session ports. One Conversation's
267
- * Durable Object executes another Conversation's request against its OWN local facets; the
268
- * envelopes here are the only values that cross the Object boundary, and they are
269
- * transport-agnostic — native Durable Object JS RPC is the shipped carrier, fetch-with-JSON
270
- * the documented fallback, and both move the same Schema-encoded JSON.
271
- *
272
- * The closed subset is exactly the set of operations the durable coordinator performs against
273
- * a FOREIGN Conversation (parent/child establishment, status checks, abort propagation,
274
- * child-settlement notification, and the child-conversation store operations used by
275
- * establishment, `verifySettledChild`, and result projection):
276
- *
277
- * - ledger: `admit`, `markReady`, `lookup`, `resolveAdmission`, `requestAbort`,
278
- * `recordChildSettled`;
279
- * - store: `materialize`, `append`, `read` (one page), `inspectTail`, `export`.
280
- *
281
- * Every other port operation is lane-local by construction and is NOT given an envelope:
282
- * honesty over accidental distribution — the routing layer fails such calls fast and typed
283
- * instead of quietly widening the distributed surface.
284
- *
285
- * Failures cross the boundary as the `PortFailure` union and re-decode on the caller side to
286
- * the SAME tagged error types the local facet would have produced, so routed calls keep
287
- * error-tag fidelity. `cause` chains inside `LedgerError`/`ConversationStoreError` travel as
288
- * Schema defects and do not claim instance fidelity across Objects (plan §2.8).
289
- */
290
- /** Ceiling for protocol diagnostic strings; matches `AdmissionIndeterminate.reason`. */
291
- declare const MAX_PORT_DIAGNOSTIC_LENGTH = 4096;
292
- /** Truncate a diagnostic string to the protocol's bounded diagnostic length. */
293
- declare const boundPortDiagnostic: (value: string) => string;
294
- declare const PortProtocolError_base: Schema.Class<PortProtocolError, Schema.TaggedStruct<"PortProtocolError", {
295
- readonly message: Schema.String;
296
- }>, import("effect/Cause").YieldableError>;
297
- /**
298
- * The envelope itself could not be honored: the receiving Object could not decode the
299
- * request, or a response could not be encoded/decoded. It never carries port semantics —
300
- * callers fold it into the operation's base error (`LedgerError`/`ConversationStoreError`),
301
- * except `resolveAdmission`, which folds it into `AdmissionIndeterminate` because a
302
- * non-answer is never proof of absence (SUB-031).
303
- */
304
- declare class PortProtocolError extends PortProtocolError_base {}
305
- declare const LedgerAdmitCall_base: Schema.Class<LedgerAdmitCall, Schema.TaggedStruct<"LedgerAdmit", {
306
- readonly request: typeof AdmissionRequest;
307
- }>, {}>;
308
- /** Routed `SubmissionLedger.admit` — child establishment admits INTO the owning Object. */
309
- declare class LedgerAdmitCall extends LedgerAdmitCall_base {}
310
- declare const LedgerMarkReadyCall_base: Schema.Class<LedgerMarkReadyCall, Schema.TaggedStruct<"LedgerMarkReady", {
311
- readonly request: typeof MarkReadyRequest;
312
- }>, {}>;
313
- /** Routed `SubmissionLedger.markReady` for a Submission owned by another Object. */
314
- declare class LedgerMarkReadyCall extends LedgerMarkReadyCall_base {}
315
- declare const LedgerLookupCall_base: Schema.Class<LedgerLookupCall, Schema.TaggedStruct<"LedgerLookup", {
316
- readonly request: Schema.Union<readonly [typeof import("@effect-agent/session").SubmissionLookupById, typeof SubmissionLookupByKey]>;
317
- }>, {}>;
318
- /** Routed `SubmissionLedger.lookup` (by identity or scoped idempotency key). */
319
- declare class LedgerLookupCall extends LedgerLookupCall_base {}
320
- declare const LedgerResolveAdmissionCall_base: Schema.Class<LedgerResolveAdmissionCall, Schema.TaggedStruct<"LedgerResolveAdmission", {
321
- readonly request: typeof SubmissionLookupByKey;
322
- }>, {}>;
323
- /** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */
324
- declare class LedgerResolveAdmissionCall extends LedgerResolveAdmissionCall_base {}
325
- declare const LedgerRequestAbortCall_base: Schema.Class<LedgerRequestAbortCall, Schema.TaggedStruct<"LedgerRequestAbort", {
326
- readonly request: typeof AbortCommand;
327
- }>, {}>;
328
- /** Routed `SubmissionLedger.requestAbort` — abort propagation across Objects. */
329
- declare class LedgerRequestAbortCall extends LedgerRequestAbortCall_base {}
330
- declare const LedgerRecordChildSettledCall_base: Schema.Class<LedgerRecordChildSettledCall, Schema.TaggedStruct<"LedgerRecordChildSettled", {
331
- readonly request: typeof ChildSettledNotification;
332
- }>, {}>;
333
- /** Routed `SubmissionLedger.recordChildSettled` — the child→parent durable notification. */
334
- declare class LedgerRecordChildSettledCall extends LedgerRecordChildSettledCall_base {}
335
- declare const StoreMaterializeCall_base: Schema.Class<StoreMaterializeCall, Schema.TaggedStruct<"StoreMaterialize", {
336
- readonly request: typeof ConversationMaterialization;
337
- }>, {}>;
338
- /** Routed `ConversationStore.materialize` against the owning Object. */
339
- declare class StoreMaterializeCall extends StoreMaterializeCall_base {}
340
- declare const StoreAppendCall_base: Schema.Class<StoreAppendCall, Schema.TaggedStruct<"StoreAppend", {
341
- readonly request: typeof FencedAppendRequest;
342
- }>, {}>;
343
- /** Routed `ConversationStore.append` against the owning Object. */
344
- declare class StoreAppendCall extends StoreAppendCall_base {}
345
- declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.TaggedStruct<"StoreReadPage", {
346
- readonly request: typeof ConversationRead;
347
- }>, {}>;
348
- /** Routed one-page `ConversationStore.read`; the page bound is the request's own `limit`. */
349
- declare class StoreReadPageCall extends StoreReadPageCall_base {}
350
- declare const StoreInspectTailCall_base: Schema.Class<StoreInspectTailCall, Schema.TaggedStruct<"StoreInspectTail", {
351
- readonly request: typeof ConversationTailRequest;
352
- }>, {}>;
353
- /** Routed `ConversationStore.inspectTail` against the owning Object. */
354
- declare class StoreInspectTailCall extends StoreInspectTailCall_base {}
355
- declare const StoreExportCall_base: Schema.Class<StoreExportCall, Schema.TaggedStruct<"StoreExport", {
356
- readonly request: typeof ConversationExportRequest;
357
- }>, {}>;
358
- /** Routed `ConversationStore.export` against the owning Object. */
359
- declare class StoreExportCall extends StoreExportCall_base {}
360
- /** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
361
- 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]>;
362
- type PortRequest = typeof PortRequest.Type;
363
- /** The wire form of one port request (what a transport actually carries). */
364
- type PortRequestEnvelope = typeof PortRequest.Encoded;
365
- declare const LedgerAdmitResult_base: Schema.Class<LedgerAdmitResult, Schema.TaggedStruct<"LedgerAdmitResult", {
366
- readonly result: typeof AdmissionResult;
367
- }>, {}>;
368
- declare class LedgerAdmitResult extends LedgerAdmitResult_base {}
369
- declare const LedgerMarkReadyResult_base: Schema.Class<LedgerMarkReadyResult, Schema.TaggedStruct<"LedgerMarkReadyResult", {}>, {}>;
370
- declare class LedgerMarkReadyResult extends LedgerMarkReadyResult_base {}
371
- declare const LedgerLookupResult_base: Schema.Class<LedgerLookupResult, Schema.TaggedStruct<"LedgerLookupResult", {
372
- readonly submission: Schema.optionalKey<typeof SubmissionSnapshot>;
373
- }>, {}>;
374
- /** `submission` is absent exactly when the lookup answered `Option.none`. */
375
- declare class LedgerLookupResult extends LedgerLookupResult_base {}
376
- declare const LedgerResolveAdmissionResult_base: Schema.Class<LedgerResolveAdmissionResult, Schema.TaggedStruct<"LedgerResolveAdmissionResult", {
377
- readonly resolution: Schema.Union<readonly [typeof import("@effect-agent/session").AdmissionNotAdmitted, typeof import("@effect-agent/session").AdmissionAdmitted, typeof import("@effect-agent/session").AdmissionIndeterminate]>;
378
- }>, {}>;
379
- declare class LedgerResolveAdmissionResult extends LedgerResolveAdmissionResult_base {}
380
- declare const LedgerRequestAbortResult_base: Schema.Class<LedgerRequestAbortResult, Schema.TaggedStruct<"LedgerRequestAbortResult", {
381
- readonly intent: typeof AbortIntent;
382
- }>, {}>;
383
- declare class LedgerRequestAbortResult extends LedgerRequestAbortResult_base {}
384
- declare const LedgerRecordChildSettledResult_base: Schema.Class<LedgerRecordChildSettledResult, Schema.TaggedStruct<"LedgerRecordChildSettledResult", {
385
- readonly outcome: Schema.Literals<readonly ["woken", "still-waiting", "not-waiting"]>;
386
- }>, {}>;
387
- declare class LedgerRecordChildSettledResult extends LedgerRecordChildSettledResult_base {}
388
- declare const StoreMaterializeResult_base: Schema.Class<StoreMaterializeResult, Schema.TaggedStruct<"StoreMaterializeResult", {}>, {}>;
389
- declare class StoreMaterializeResult extends StoreMaterializeResult_base {}
390
- declare const StoreAppendResult_base: Schema.Class<StoreAppendResult, Schema.TaggedStruct<"StoreAppendResult", {
391
- readonly result: typeof AppendResult;
392
- }>, {}>;
393
- declare class StoreAppendResult extends StoreAppendResult_base {}
394
- declare const StoreReadPageResult_base: Schema.Class<StoreReadPageResult, Schema.TaggedStruct<"StoreReadPageResult", {
395
- readonly records: Schema.$Array<typeof CanonicalRecordEnvelope>;
396
- }>, {}>;
397
- /** One page of canonical records, bounded by the request's `limit` (≤ 1,024). */
398
- declare class StoreReadPageResult extends StoreReadPageResult_base {}
399
- declare const StoreInspectTailResult_base: Schema.Class<StoreInspectTailResult, Schema.TaggedStruct<"StoreInspectTailResult", {
400
- readonly tail: typeof ConversationTail;
401
- }>, {}>;
402
- declare class StoreInspectTailResult extends StoreInspectTailResult_base {}
403
- declare const StoreExportResult_base: Schema.Class<StoreExportResult, Schema.TaggedStruct<"StoreExportResult", {
404
- readonly export: typeof ConversationExport;
405
- }>, {}>;
406
- declare class StoreExportResult extends StoreExportResult_base {}
407
- /** Every successful routed result. Callers narrow by the tag their request implies. */
408
- declare const PortResult: 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]>;
409
- type PortResult = typeof PortResult.Type;
410
- /**
411
- * Every typed failure a route-capable operation can produce on its owning Object, plus the
412
- * protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
413
- * session ports declare, so a routed caller observes identical error tags and fields.
414
- */
415
- declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
416
- type PortFailure = typeof PortFailure.Type;
417
- declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
418
- 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]>;
419
- }>, {}>;
420
- /** The routed operation succeeded on its owning Object. */
421
- declare class PortSucceeded extends PortSucceeded_base {}
422
- declare const PortFailed_base: Schema.Class<PortFailed, Schema.TaggedStruct<"PortFailed", {
423
- readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
424
- }>, {}>;
425
- /** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
426
- declare class PortFailed extends PortFailed_base {}
427
- /** The uniform answer of one `portCall`: op-specific success or a re-decodable typed failure. */
428
- declare const PortResponse: Schema.Union<readonly [typeof PortSucceeded, typeof PortFailed]>;
429
- type PortResponse = typeof PortResponse.Type;
430
- /** The wire form of one port response (what a transport actually carries). */
431
- type PortResponseEnvelope = typeof PortResponse.Encoded;
432
- declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
433
- readonly _tag: "LedgerAdmit";
434
- readonly request: {
435
- readonly conversationId: string;
436
- readonly principal: string;
437
- readonly idempotencyKey: string;
438
- readonly agentId: string;
439
- readonly agentDigests: {
440
- readonly agent: string;
441
- readonly model: string;
442
- readonly tools: string;
443
- };
444
- readonly deploymentId: string;
445
- readonly inputPayload: Schema.Json;
446
- readonly inputDigest: string;
447
- readonly parentLinkage?: {
448
- readonly parentSubmissionId: string;
449
- readonly parentToolCallId: string;
450
- } | undefined;
451
- };
452
- } | {
453
- readonly _tag: "LedgerMarkReady";
454
- readonly request: {
455
- readonly submissionId: string;
456
- };
457
- } | {
458
- readonly _tag: "LedgerLookup";
459
- readonly request: {
460
- readonly _tag: "SubmissionLookupById";
461
- readonly submissionId: string;
462
- } | {
463
- readonly _tag: "SubmissionLookupByKey";
464
- readonly conversationId: string;
465
- readonly principal: string;
466
- readonly idempotencyKey: string;
467
- };
468
- } | {
469
- readonly _tag: "LedgerResolveAdmission";
470
- readonly request: {
471
- readonly _tag: "SubmissionLookupByKey";
472
- readonly conversationId: string;
473
- readonly principal: string;
474
- readonly idempotencyKey: string;
475
- };
476
- } | {
477
- readonly _tag: "LedgerRequestAbort";
478
- readonly request: {
479
- readonly submissionId: string;
480
- readonly author: string;
481
- readonly reason: string;
482
- };
483
- } | {
484
- readonly _tag: "LedgerRecordChildSettled";
485
- readonly request: {
486
- readonly parentSubmissionId: string;
487
- readonly childSubmissionId: string;
488
- };
489
- } | {
490
- readonly _tag: "StoreMaterialize";
491
- readonly request: {
492
- readonly conversationId: string;
493
- readonly producerEpoch: number;
494
- };
495
- } | {
496
- readonly _tag: "StoreAppend";
497
- readonly request: {
498
- readonly conversationId: string;
499
- readonly batch: {
500
- readonly batchId: string;
501
- readonly producerId: string;
502
- readonly records: readonly [{
503
- readonly recordId: string;
504
- readonly family: "conversation";
505
- readonly schemaVersion: 1;
506
- readonly createdAt: string;
507
- readonly deploymentId: string;
508
- readonly payload: {
509
- readonly _tag: "AbortRequested";
510
- readonly submissionId: string;
511
- readonly author: string;
512
- readonly reason: string;
513
- } | {
514
- readonly _tag: "ConversationCreated";
515
- readonly agentId: string;
516
- readonly definitions: {
517
- readonly agent: string;
518
- readonly model: string;
519
- readonly tools: string;
520
- };
521
- } | {
522
- readonly _tag: "UserInputRecorded";
523
- readonly submissionId: string;
524
- readonly kind: "follow-up" | "steering" | "user";
525
- readonly runId?: string | undefined;
526
- readonly input: Schema.Json;
527
- } | {
528
- readonly _tag: "ModelCompleted";
529
- readonly runId: string;
530
- readonly output: Schema.Json;
531
- } | {
532
- readonly _tag: "ModelResponseRecorded";
533
- readonly runId: string;
534
- readonly turnId: string;
535
- readonly turn: number;
536
- readonly messages: Schema.Json;
537
- readonly messagesDigest: string;
538
- readonly inputTokens?: number | undefined;
539
- readonly outputTokens?: number | undefined;
540
- } | {
541
- readonly _tag: "ToolCallPrepared";
542
- readonly runId: string;
543
- readonly turnId: string;
544
- readonly turn: number;
545
- readonly toolCallId: string;
546
- readonly toolName: string;
547
- readonly parameters: Schema.Json;
548
- readonly parametersDigest: string;
549
- } | {
550
- readonly _tag: "ToolCallSettled";
551
- readonly runId: string;
552
- readonly toolCallId: string;
553
- readonly toolName: string;
554
- readonly result: Schema.Json;
555
- readonly isFailure: boolean;
556
- } | {
557
- readonly _tag: "ToolCallUnknown";
558
- readonly runId: string;
559
- readonly turn: number;
560
- readonly toolCallId: string;
561
- readonly toolName: string;
562
- readonly reason: string;
563
- } | {
564
- readonly _tag: "ToolCallResolved";
565
- readonly runId: string;
566
- readonly toolCallId: string;
567
- readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
568
- readonly author: string;
569
- readonly reason: string;
570
- } | {
571
- readonly _tag: "ToolStepSettled";
572
- readonly runId: string;
573
- readonly toolCallId: string;
574
- readonly stepName: string;
575
- readonly output: Schema.Json;
576
- readonly outputDigest: string;
577
- } | {
578
- readonly _tag: "ToolApprovalRequested";
579
- readonly runId: string;
580
- readonly turnId: string;
581
- readonly turn: number;
582
- readonly toolCallId: string;
583
- readonly toolName: string;
584
- readonly parametersDigest: string;
585
- } | {
586
- readonly _tag: "ToolApprovalDecided";
587
- readonly runId: string;
588
- readonly turn: number;
589
- readonly toolCallId: string;
590
- readonly decision: "approved" | "denied";
591
- readonly resolver: string;
592
- readonly reason: string;
593
- } | {
594
- readonly _tag: "ModelResponseInterrupted";
595
- readonly runId: string;
596
- readonly supersededEpoch: number;
597
- readonly attemptId: string;
598
- readonly reason: string;
599
- } | {
600
- readonly _tag: "CompactionCreated";
601
- readonly runId: string;
602
- readonly turn: number;
603
- readonly kind: "clear-tool-results" | "summarize";
604
- readonly coversThrough: number;
605
- readonly summary?: string | undefined;
606
- } | {
607
- readonly _tag: "RunFailed";
608
- readonly runId: string;
609
- readonly failure: Schema.Json;
610
- } | {
611
- readonly _tag: "RunCompleted";
612
- readonly runId: string;
613
- readonly output: Schema.Json;
614
- } | {
615
- readonly _tag: "SubmissionSettled";
616
- readonly submissionId: string;
617
- readonly settlementId: string;
618
- readonly receiptId: string;
619
- readonly outcome: "aborted" | "completed" | "failed";
620
- readonly runId?: string | undefined;
621
- readonly result?: Schema.Json | undefined;
622
- readonly finishReason?: "budget-exhausted" | undefined;
623
- } | {
624
- readonly _tag: "SubagentRequested";
625
- readonly runId: string;
626
- readonly turnId: string;
627
- readonly turn: number;
628
- readonly toolCallId: string;
629
- readonly delegationId: string;
630
- readonly targetAgentId: string;
631
- readonly targetDigests: {
632
- readonly agent: string;
633
- readonly model: string;
634
- readonly tools: string;
635
- };
636
- readonly childInput: Schema.Json;
637
- readonly childInputDigest: string;
638
- readonly grantDigest: string;
639
- readonly reservationId: string;
640
- readonly reservationDigest: string;
641
- readonly childConversationId: string;
642
- readonly childPrincipal: string;
643
- readonly childIdempotencyKey: string;
644
- } | {
645
- readonly _tag: "SubagentStarted";
646
- readonly runId: string;
647
- readonly toolCallId: string;
648
- readonly childConversationId: string;
649
- readonly childSubmissionId: string;
650
- readonly childReceiptId: string;
651
- readonly childRunId: string;
652
- } | {
653
- readonly _tag: "SubagentJoined";
654
- readonly runId: string;
655
- readonly toolCallId: string;
656
- readonly childSubmissionId: string;
657
- readonly childSettlementId: string;
658
- readonly childOutcome: "aborted" | "completed" | "failed";
659
- readonly childResultDigest: string;
660
- readonly projectedResultDigest: string;
661
- readonly usageSummary: Schema.Json;
662
- readonly reservationId: string;
663
- readonly finalAccounting: Schema.Json;
664
- } | {
665
- readonly _tag: "SubagentLineageRecorded";
666
- readonly parentLink: {
667
- readonly delegationId: string;
668
- readonly parentAgentId: string;
669
- readonly parentConversationId: string;
670
- readonly parentRunId: string;
671
- readonly parentToolCallId: string;
672
- readonly depth: number;
673
- };
674
- readonly parentSubmissionId: string;
675
- readonly childDefinitionDigests: {
676
- readonly agent: string;
677
- readonly model: string;
678
- readonly tools: string;
679
- };
680
- readonly childInputDigest: string;
681
- readonly grantDigest: string;
682
- } | {
683
- readonly _tag: "RepairAnnotated";
684
- readonly reason: string;
685
- readonly details: Schema.Json;
686
- };
687
- }, ...{
688
- readonly recordId: string;
689
- readonly family: "conversation";
690
- readonly schemaVersion: 1;
691
- readonly createdAt: string;
692
- readonly deploymentId: string;
693
- readonly payload: {
694
- readonly _tag: "AbortRequested";
695
- readonly submissionId: string;
696
- readonly author: string;
697
- readonly reason: string;
698
- } | {
699
- readonly _tag: "ConversationCreated";
700
- readonly agentId: string;
701
- readonly definitions: {
702
- readonly agent: string;
703
- readonly model: string;
704
- readonly tools: string;
705
- };
706
- } | {
707
- readonly _tag: "UserInputRecorded";
708
- readonly submissionId: string;
709
- readonly kind: "follow-up" | "steering" | "user";
710
- readonly runId?: string | undefined;
711
- readonly input: Schema.Json;
712
- } | {
713
- readonly _tag: "ModelCompleted";
714
- readonly runId: string;
715
- readonly output: Schema.Json;
716
- } | {
717
- readonly _tag: "ModelResponseRecorded";
718
- readonly runId: string;
719
- readonly turnId: string;
720
- readonly turn: number;
721
- readonly messages: Schema.Json;
722
- readonly messagesDigest: string;
723
- readonly inputTokens?: number | undefined;
724
- readonly outputTokens?: number | undefined;
725
- } | {
726
- readonly _tag: "ToolCallPrepared";
727
- readonly runId: string;
728
- readonly turnId: string;
729
- readonly turn: number;
730
- readonly toolCallId: string;
731
- readonly toolName: string;
732
- readonly parameters: Schema.Json;
733
- readonly parametersDigest: string;
734
- } | {
735
- readonly _tag: "ToolCallSettled";
736
- readonly runId: string;
737
- readonly toolCallId: string;
738
- readonly toolName: string;
739
- readonly result: Schema.Json;
740
- readonly isFailure: boolean;
741
- } | {
742
- readonly _tag: "ToolCallUnknown";
743
- readonly runId: string;
744
- readonly turn: number;
745
- readonly toolCallId: string;
746
- readonly toolName: string;
747
- readonly reason: string;
748
- } | {
749
- readonly _tag: "ToolCallResolved";
750
- readonly runId: string;
751
- readonly toolCallId: string;
752
- readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
753
- readonly author: string;
754
- readonly reason: string;
755
- } | {
756
- readonly _tag: "ToolStepSettled";
757
- readonly runId: string;
758
- readonly toolCallId: string;
759
- readonly stepName: string;
760
- readonly output: Schema.Json;
761
- readonly outputDigest: string;
762
- } | {
763
- readonly _tag: "ToolApprovalRequested";
764
- readonly runId: string;
765
- readonly turnId: string;
766
- readonly turn: number;
767
- readonly toolCallId: string;
768
- readonly toolName: string;
769
- readonly parametersDigest: string;
770
- } | {
771
- readonly _tag: "ToolApprovalDecided";
772
- readonly runId: string;
773
- readonly turn: number;
774
- readonly toolCallId: string;
775
- readonly decision: "approved" | "denied";
776
- readonly resolver: string;
777
- readonly reason: string;
778
- } | {
779
- readonly _tag: "ModelResponseInterrupted";
780
- readonly runId: string;
781
- readonly supersededEpoch: number;
782
- readonly attemptId: string;
783
- readonly reason: string;
784
- } | {
785
- readonly _tag: "CompactionCreated";
786
- readonly runId: string;
787
- readonly turn: number;
788
- readonly kind: "clear-tool-results" | "summarize";
789
- readonly coversThrough: number;
790
- readonly summary?: string | undefined;
791
- } | {
792
- readonly _tag: "RunFailed";
793
- readonly runId: string;
794
- readonly failure: Schema.Json;
795
- } | {
796
- readonly _tag: "RunCompleted";
797
- readonly runId: string;
798
- readonly output: Schema.Json;
799
- } | {
800
- readonly _tag: "SubmissionSettled";
801
- readonly submissionId: string;
802
- readonly settlementId: string;
803
- readonly receiptId: string;
804
- readonly outcome: "aborted" | "completed" | "failed";
805
- readonly runId?: string | undefined;
806
- readonly result?: Schema.Json | undefined;
807
- readonly finishReason?: "budget-exhausted" | undefined;
808
- } | {
809
- readonly _tag: "SubagentRequested";
810
- readonly runId: string;
811
- readonly turnId: string;
812
- readonly turn: number;
813
- readonly toolCallId: string;
814
- readonly delegationId: string;
815
- readonly targetAgentId: string;
816
- readonly targetDigests: {
817
- readonly agent: string;
818
- readonly model: string;
819
- readonly tools: string;
820
- };
821
- readonly childInput: Schema.Json;
822
- readonly childInputDigest: string;
823
- readonly grantDigest: string;
824
- readonly reservationId: string;
825
- readonly reservationDigest: string;
826
- readonly childConversationId: string;
827
- readonly childPrincipal: string;
828
- readonly childIdempotencyKey: string;
829
- } | {
830
- readonly _tag: "SubagentStarted";
831
- readonly runId: string;
832
- readonly toolCallId: string;
833
- readonly childConversationId: string;
834
- readonly childSubmissionId: string;
835
- readonly childReceiptId: string;
836
- readonly childRunId: string;
837
- } | {
838
- readonly _tag: "SubagentJoined";
839
- readonly runId: string;
840
- readonly toolCallId: string;
841
- readonly childSubmissionId: string;
842
- readonly childSettlementId: string;
843
- readonly childOutcome: "aborted" | "completed" | "failed";
844
- readonly childResultDigest: string;
845
- readonly projectedResultDigest: string;
846
- readonly usageSummary: Schema.Json;
847
- readonly reservationId: string;
848
- readonly finalAccounting: Schema.Json;
849
- } | {
850
- readonly _tag: "SubagentLineageRecorded";
851
- readonly parentLink: {
852
- readonly delegationId: string;
853
- readonly parentAgentId: string;
854
- readonly parentConversationId: string;
855
- readonly parentRunId: string;
856
- readonly parentToolCallId: string;
857
- readonly depth: number;
858
- };
859
- readonly parentSubmissionId: string;
860
- readonly childDefinitionDigests: {
861
- readonly agent: string;
862
- readonly model: string;
863
- readonly tools: string;
864
- };
865
- readonly childInputDigest: string;
866
- readonly grantDigest: string;
867
- } | {
868
- readonly _tag: "RepairAnnotated";
869
- readonly reason: string;
870
- readonly details: Schema.Json;
871
- };
872
- }[]];
873
- };
874
- readonly expectedTailSequence: number;
875
- readonly expectedTailDigest: string;
876
- readonly producerEpoch: number;
877
- };
878
- } | {
879
- readonly _tag: "StoreReadPage";
880
- readonly request: {
881
- readonly conversationId: string;
882
- readonly afterSequence?: number | undefined;
883
- readonly limit: number;
884
- };
885
- } | {
886
- readonly _tag: "StoreInspectTail";
887
- readonly request: {
888
- readonly conversationId: string;
889
- };
890
- } | {
891
- readonly _tag: "StoreExport";
892
- readonly request: {
893
- readonly conversationId: string;
894
- };
895
- }, Schema.SchemaError, never>;
896
- 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>;
897
- declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
898
- readonly _tag: "PortSucceeded";
899
- readonly result: {
900
- readonly _tag: "LedgerAdmitResult";
901
- readonly result: {
902
- readonly submissionId: string;
903
- readonly receiptId: string;
904
- readonly queueSequence: number;
905
- readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
906
- readonly replayed: boolean;
907
- };
908
- } | {
909
- readonly _tag: "LedgerMarkReadyResult";
910
- } | {
911
- readonly _tag: "LedgerLookupResult";
912
- readonly submission?: {
913
- readonly submissionId: string;
914
- readonly conversationId: string;
915
- readonly queueSequence: number;
916
- readonly principal: string;
917
- readonly idempotencyKey: string;
918
- readonly agentId: string;
919
- readonly agentDigests: {
920
- readonly agent: string;
921
- readonly model: string;
922
- readonly tools: string;
923
- };
924
- readonly deploymentId: string;
925
- readonly inputPayload: Schema.Json;
926
- readonly inputDigest: string;
927
- readonly receiptId: string;
928
- readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
929
- readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
930
- readonly createdAt: string;
931
- readonly readyAt?: string | undefined;
932
- readonly parentLinkage?: {
933
- readonly parentSubmissionId: string;
934
- readonly parentToolCallId: string;
935
- } | undefined;
936
- } | undefined;
937
- } | {
938
- readonly _tag: "LedgerResolveAdmissionResult";
939
- readonly resolution: {
940
- readonly _tag: "NotAdmitted";
941
- } | {
942
- readonly _tag: "Admitted";
943
- readonly submission: {
944
- readonly submissionId: string;
945
- readonly conversationId: string;
946
- readonly queueSequence: number;
947
- readonly principal: string;
948
- readonly idempotencyKey: string;
949
- readonly agentId: string;
950
- readonly agentDigests: {
951
- readonly agent: string;
952
- readonly model: string;
953
- readonly tools: string;
954
- };
955
- readonly deploymentId: string;
956
- readonly inputPayload: Schema.Json;
957
- readonly inputDigest: string;
958
- readonly receiptId: string;
959
- readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
960
- readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
961
- readonly createdAt: string;
962
- readonly readyAt?: string | undefined;
963
- readonly parentLinkage?: {
964
- readonly parentSubmissionId: string;
965
- readonly parentToolCallId: string;
966
- } | undefined;
967
- };
968
- } | {
969
- readonly _tag: "Indeterminate";
970
- readonly reason: string;
971
- };
972
- } | {
973
- readonly _tag: "LedgerRequestAbortResult";
974
- readonly intent: {
975
- readonly submissionId: string;
976
- readonly author: string;
977
- readonly reason: string;
978
- readonly requestedAt: string;
979
- readonly canonicalRecordId?: string | undefined;
980
- };
981
- } | {
982
- readonly _tag: "LedgerRecordChildSettledResult";
983
- readonly outcome: "not-waiting" | "still-waiting" | "woken";
984
- } | {
985
- readonly _tag: "StoreMaterializeResult";
986
- } | {
987
- readonly _tag: "StoreAppendResult";
988
- readonly result: {
989
- readonly firstSequence: number;
990
- readonly lastSequence: number;
991
- readonly tailDigest: string;
992
- readonly replayed: boolean;
993
- };
994
- } | {
995
- readonly _tag: "StoreReadPageResult";
996
- readonly records: readonly {
997
- readonly conversationId: string;
998
- readonly batchId: string;
999
- readonly sequence: number;
1000
- readonly offset: string;
1001
- readonly record: {
1002
- readonly recordId: string;
1003
- readonly family: "conversation";
1004
- readonly schemaVersion: 1;
1005
- readonly createdAt: string;
1006
- readonly deploymentId: string;
1007
- readonly payload: {
1008
- readonly _tag: "AbortRequested";
1009
- readonly submissionId: string;
1010
- readonly author: string;
1011
- readonly reason: string;
1012
- } | {
1013
- readonly _tag: "ConversationCreated";
1014
- readonly agentId: string;
1015
- readonly definitions: {
1016
- readonly agent: string;
1017
- readonly model: string;
1018
- readonly tools: string;
1019
- };
1020
- } | {
1021
- readonly _tag: "UserInputRecorded";
1022
- readonly submissionId: string;
1023
- readonly kind: "follow-up" | "steering" | "user";
1024
- readonly runId?: string | undefined;
1025
- readonly input: Schema.Json;
1026
- } | {
1027
- readonly _tag: "ModelCompleted";
1028
- readonly runId: string;
1029
- readonly output: Schema.Json;
1030
- } | {
1031
- readonly _tag: "ModelResponseRecorded";
1032
- readonly runId: string;
1033
- readonly turnId: string;
1034
- readonly turn: number;
1035
- readonly messages: Schema.Json;
1036
- readonly messagesDigest: string;
1037
- readonly inputTokens?: number | undefined;
1038
- readonly outputTokens?: number | undefined;
1039
- } | {
1040
- readonly _tag: "ToolCallPrepared";
1041
- readonly runId: string;
1042
- readonly turnId: string;
1043
- readonly turn: number;
1044
- readonly toolCallId: string;
1045
- readonly toolName: string;
1046
- readonly parameters: Schema.Json;
1047
- readonly parametersDigest: string;
1048
- } | {
1049
- readonly _tag: "ToolCallSettled";
1050
- readonly runId: string;
1051
- readonly toolCallId: string;
1052
- readonly toolName: string;
1053
- readonly result: Schema.Json;
1054
- readonly isFailure: boolean;
1055
- } | {
1056
- readonly _tag: "ToolCallUnknown";
1057
- readonly runId: string;
1058
- readonly turn: number;
1059
- readonly toolCallId: string;
1060
- readonly toolName: string;
1061
- readonly reason: string;
1062
- } | {
1063
- readonly _tag: "ToolCallResolved";
1064
- readonly runId: string;
1065
- readonly toolCallId: string;
1066
- readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
1067
- readonly author: string;
1068
- readonly reason: string;
1069
- } | {
1070
- readonly _tag: "ToolStepSettled";
1071
- readonly runId: string;
1072
- readonly toolCallId: string;
1073
- readonly stepName: string;
1074
- readonly output: Schema.Json;
1075
- readonly outputDigest: string;
1076
- } | {
1077
- readonly _tag: "ToolApprovalRequested";
1078
- readonly runId: string;
1079
- readonly turnId: string;
1080
- readonly turn: number;
1081
- readonly toolCallId: string;
1082
- readonly toolName: string;
1083
- readonly parametersDigest: string;
1084
- } | {
1085
- readonly _tag: "ToolApprovalDecided";
1086
- readonly runId: string;
1087
- readonly turn: number;
1088
- readonly toolCallId: string;
1089
- readonly decision: "approved" | "denied";
1090
- readonly resolver: string;
1091
- readonly reason: string;
1092
- } | {
1093
- readonly _tag: "ModelResponseInterrupted";
1094
- readonly runId: string;
1095
- readonly supersededEpoch: number;
1096
- readonly attemptId: string;
1097
- readonly reason: string;
1098
- } | {
1099
- readonly _tag: "CompactionCreated";
1100
- readonly runId: string;
1101
- readonly turn: number;
1102
- readonly kind: "clear-tool-results" | "summarize";
1103
- readonly coversThrough: number;
1104
- readonly summary?: string | undefined;
1105
- } | {
1106
- readonly _tag: "RunFailed";
1107
- readonly runId: string;
1108
- readonly failure: Schema.Json;
1109
- } | {
1110
- readonly _tag: "RunCompleted";
1111
- readonly runId: string;
1112
- readonly output: Schema.Json;
1113
- } | {
1114
- readonly _tag: "SubmissionSettled";
1115
- readonly submissionId: string;
1116
- readonly settlementId: string;
1117
- readonly receiptId: string;
1118
- readonly outcome: "aborted" | "completed" | "failed";
1119
- readonly runId?: string | undefined;
1120
- readonly result?: Schema.Json | undefined;
1121
- readonly finishReason?: "budget-exhausted" | undefined;
1122
- } | {
1123
- readonly _tag: "SubagentRequested";
1124
- readonly runId: string;
1125
- readonly turnId: string;
1126
- readonly turn: number;
1127
- readonly toolCallId: string;
1128
- readonly delegationId: string;
1129
- readonly targetAgentId: string;
1130
- readonly targetDigests: {
1131
- readonly agent: string;
1132
- readonly model: string;
1133
- readonly tools: string;
1134
- };
1135
- readonly childInput: Schema.Json;
1136
- readonly childInputDigest: string;
1137
- readonly grantDigest: string;
1138
- readonly reservationId: string;
1139
- readonly reservationDigest: string;
1140
- readonly childConversationId: string;
1141
- readonly childPrincipal: string;
1142
- readonly childIdempotencyKey: string;
1143
- } | {
1144
- readonly _tag: "SubagentStarted";
1145
- readonly runId: string;
1146
- readonly toolCallId: string;
1147
- readonly childConversationId: string;
1148
- readonly childSubmissionId: string;
1149
- readonly childReceiptId: string;
1150
- readonly childRunId: string;
1151
- } | {
1152
- readonly _tag: "SubagentJoined";
1153
- readonly runId: string;
1154
- readonly toolCallId: string;
1155
- readonly childSubmissionId: string;
1156
- readonly childSettlementId: string;
1157
- readonly childOutcome: "aborted" | "completed" | "failed";
1158
- readonly childResultDigest: string;
1159
- readonly projectedResultDigest: string;
1160
- readonly usageSummary: Schema.Json;
1161
- readonly reservationId: string;
1162
- readonly finalAccounting: Schema.Json;
1163
- } | {
1164
- readonly _tag: "SubagentLineageRecorded";
1165
- readonly parentLink: {
1166
- readonly delegationId: string;
1167
- readonly parentAgentId: string;
1168
- readonly parentConversationId: string;
1169
- readonly parentRunId: string;
1170
- readonly parentToolCallId: string;
1171
- readonly depth: number;
1172
- };
1173
- readonly parentSubmissionId: string;
1174
- readonly childDefinitionDigests: {
1175
- readonly agent: string;
1176
- readonly model: string;
1177
- readonly tools: string;
1178
- };
1179
- readonly childInputDigest: string;
1180
- readonly grantDigest: string;
1181
- } | {
1182
- readonly _tag: "RepairAnnotated";
1183
- readonly reason: string;
1184
- readonly details: Schema.Json;
1185
- };
1186
- };
1187
- }[];
1188
- } | {
1189
- readonly _tag: "StoreInspectTailResult";
1190
- readonly tail: {
1191
- readonly conversationId: string;
1192
- readonly tailSequence: number;
1193
- readonly tailDigest: string;
1194
- readonly producerEpoch: number;
1195
- };
1196
- } | {
1197
- readonly _tag: "StoreExportResult";
1198
- readonly export: {
1199
- readonly format: "effect-agent/conversation@1";
1200
- readonly conversationId: string;
1201
- readonly tailSequence: number;
1202
- readonly tailDigest: string;
1203
- readonly records: readonly {
1204
- readonly conversationId: string;
1205
- readonly batchId: string;
1206
- readonly sequence: number;
1207
- readonly offset: string;
1208
- readonly record: {
1209
- readonly recordId: string;
1210
- readonly family: "conversation";
1211
- readonly schemaVersion: 1;
1212
- readonly createdAt: string;
1213
- readonly deploymentId: string;
1214
- readonly payload: {
1215
- readonly _tag: "AbortRequested";
1216
- readonly submissionId: string;
1217
- readonly author: string;
1218
- readonly reason: string;
1219
- } | {
1220
- readonly _tag: "ConversationCreated";
1221
- readonly agentId: string;
1222
- readonly definitions: {
1223
- readonly agent: string;
1224
- readonly model: string;
1225
- readonly tools: string;
1226
- };
1227
- } | {
1228
- readonly _tag: "UserInputRecorded";
1229
- readonly submissionId: string;
1230
- readonly kind: "follow-up" | "steering" | "user";
1231
- readonly runId?: string | undefined;
1232
- readonly input: Schema.Json;
1233
- } | {
1234
- readonly _tag: "ModelCompleted";
1235
- readonly runId: string;
1236
- readonly output: Schema.Json;
1237
- } | {
1238
- readonly _tag: "ModelResponseRecorded";
1239
- readonly runId: string;
1240
- readonly turnId: string;
1241
- readonly turn: number;
1242
- readonly messages: Schema.Json;
1243
- readonly messagesDigest: string;
1244
- readonly inputTokens?: number | undefined;
1245
- readonly outputTokens?: number | undefined;
1246
- } | {
1247
- readonly _tag: "ToolCallPrepared";
1248
- readonly runId: string;
1249
- readonly turnId: string;
1250
- readonly turn: number;
1251
- readonly toolCallId: string;
1252
- readonly toolName: string;
1253
- readonly parameters: Schema.Json;
1254
- readonly parametersDigest: string;
1255
- } | {
1256
- readonly _tag: "ToolCallSettled";
1257
- readonly runId: string;
1258
- readonly toolCallId: string;
1259
- readonly toolName: string;
1260
- readonly result: Schema.Json;
1261
- readonly isFailure: boolean;
1262
- } | {
1263
- readonly _tag: "ToolCallUnknown";
1264
- readonly runId: string;
1265
- readonly turn: number;
1266
- readonly toolCallId: string;
1267
- readonly toolName: string;
1268
- readonly reason: string;
1269
- } | {
1270
- readonly _tag: "ToolCallResolved";
1271
- readonly runId: string;
1272
- readonly toolCallId: string;
1273
- readonly resolution: "completed-with-result" | "failed-with-error" | "never-started" | "safe-retry";
1274
- readonly author: string;
1275
- readonly reason: string;
1276
- } | {
1277
- readonly _tag: "ToolStepSettled";
1278
- readonly runId: string;
1279
- readonly toolCallId: string;
1280
- readonly stepName: string;
1281
- readonly output: Schema.Json;
1282
- readonly outputDigest: string;
1283
- } | {
1284
- readonly _tag: "ToolApprovalRequested";
1285
- readonly runId: string;
1286
- readonly turnId: string;
1287
- readonly turn: number;
1288
- readonly toolCallId: string;
1289
- readonly toolName: string;
1290
- readonly parametersDigest: string;
1291
- } | {
1292
- readonly _tag: "ToolApprovalDecided";
1293
- readonly runId: string;
1294
- readonly turn: number;
1295
- readonly toolCallId: string;
1296
- readonly decision: "approved" | "denied";
1297
- readonly resolver: string;
1298
- readonly reason: string;
1299
- } | {
1300
- readonly _tag: "ModelResponseInterrupted";
1301
- readonly runId: string;
1302
- readonly supersededEpoch: number;
1303
- readonly attemptId: string;
1304
- readonly reason: string;
1305
- } | {
1306
- readonly _tag: "CompactionCreated";
1307
- readonly runId: string;
1308
- readonly turn: number;
1309
- readonly kind: "clear-tool-results" | "summarize";
1310
- readonly coversThrough: number;
1311
- readonly summary?: string | undefined;
1312
- } | {
1313
- readonly _tag: "RunFailed";
1314
- readonly runId: string;
1315
- readonly failure: Schema.Json;
1316
- } | {
1317
- readonly _tag: "RunCompleted";
1318
- readonly runId: string;
1319
- readonly output: Schema.Json;
1320
- } | {
1321
- readonly _tag: "SubmissionSettled";
1322
- readonly submissionId: string;
1323
- readonly settlementId: string;
1324
- readonly receiptId: string;
1325
- readonly outcome: "aborted" | "completed" | "failed";
1326
- readonly runId?: string | undefined;
1327
- readonly result?: Schema.Json | undefined;
1328
- readonly finishReason?: "budget-exhausted" | undefined;
1329
- } | {
1330
- readonly _tag: "SubagentRequested";
1331
- readonly runId: string;
1332
- readonly turnId: string;
1333
- readonly turn: number;
1334
- readonly toolCallId: string;
1335
- readonly delegationId: string;
1336
- readonly targetAgentId: string;
1337
- readonly targetDigests: {
1338
- readonly agent: string;
1339
- readonly model: string;
1340
- readonly tools: string;
1341
- };
1342
- readonly childInput: Schema.Json;
1343
- readonly childInputDigest: string;
1344
- readonly grantDigest: string;
1345
- readonly reservationId: string;
1346
- readonly reservationDigest: string;
1347
- readonly childConversationId: string;
1348
- readonly childPrincipal: string;
1349
- readonly childIdempotencyKey: string;
1350
- } | {
1351
- readonly _tag: "SubagentStarted";
1352
- readonly runId: string;
1353
- readonly toolCallId: string;
1354
- readonly childConversationId: string;
1355
- readonly childSubmissionId: string;
1356
- readonly childReceiptId: string;
1357
- readonly childRunId: string;
1358
- } | {
1359
- readonly _tag: "SubagentJoined";
1360
- readonly runId: string;
1361
- readonly toolCallId: string;
1362
- readonly childSubmissionId: string;
1363
- readonly childSettlementId: string;
1364
- readonly childOutcome: "aborted" | "completed" | "failed";
1365
- readonly childResultDigest: string;
1366
- readonly projectedResultDigest: string;
1367
- readonly usageSummary: Schema.Json;
1368
- readonly reservationId: string;
1369
- readonly finalAccounting: Schema.Json;
1370
- } | {
1371
- readonly _tag: "SubagentLineageRecorded";
1372
- readonly parentLink: {
1373
- readonly delegationId: string;
1374
- readonly parentAgentId: string;
1375
- readonly parentConversationId: string;
1376
- readonly parentRunId: string;
1377
- readonly parentToolCallId: string;
1378
- readonly depth: number;
1379
- };
1380
- readonly parentSubmissionId: string;
1381
- readonly childDefinitionDigests: {
1382
- readonly agent: string;
1383
- readonly model: string;
1384
- readonly tools: string;
1385
- };
1386
- readonly childInputDigest: string;
1387
- readonly grantDigest: string;
1388
- } | {
1389
- readonly _tag: "RepairAnnotated";
1390
- readonly reason: string;
1391
- readonly details: Schema.Json;
1392
- };
1393
- };
1394
- }[];
1395
- };
1396
- };
1397
- } | {
1398
- readonly _tag: "PortFailed";
1399
- readonly failure: {
1400
- readonly _tag: "PortProtocolError";
1401
- readonly message: string;
1402
- } | {
1403
- readonly _tag: "AdmissionConflict";
1404
- readonly conversationId: string;
1405
- readonly principal: string;
1406
- readonly idempotencyKey: string;
1407
- readonly existingInputDigest: string;
1408
- readonly attemptedInputDigest: string;
1409
- } | {
1410
- readonly _tag: "SettlementConflict";
1411
- readonly submissionId: string;
1412
- readonly existingOutcome: "aborted" | "completed" | "failed";
1413
- } | {
1414
- readonly _tag: "JoinedToHost";
1415
- readonly submissionId: string;
1416
- readonly hostSubmissionId: string;
1417
- } | {
1418
- readonly _tag: "LedgerError";
1419
- readonly operation: string;
1420
- readonly message: string;
1421
- readonly cause?: Schema.Json | undefined;
1422
- } | {
1423
- readonly _tag: "ConversationStoreError";
1424
- readonly operation: string;
1425
- readonly message: string;
1426
- readonly cause?: Schema.Json | undefined;
1427
- } | {
1428
- readonly _tag: "ConversationNotMaterialized";
1429
- readonly conversationId: string;
1430
- } | {
1431
- readonly _tag: "AppendConflict";
1432
- readonly conversationId: string;
1433
- readonly batchId: string;
1434
- readonly reason: "batch-digest" | "record-identity" | "tail";
1435
- readonly actualTailSequence?: number | undefined;
1436
- readonly actualTailDigest?: string | undefined;
1437
- } | {
1438
- readonly _tag: "FenceRejected";
1439
- readonly conversationId: string;
1440
- readonly actualEpoch: number;
1441
- readonly attemptedEpoch: number;
1442
- };
1443
- }, Schema.SchemaError, never>;
1444
- declare const decodePortResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<PortFailed | PortSucceeded, Schema.SchemaError, never>;
1445
- //#endregion
1446
- //#region src/routing.d.ts
1447
- type ConversationId = ConversationMaterialization["conversationId"];
1448
- declare const PortTransportError_base: Schema.Class<PortTransportError, Schema.TaggedStruct<"PortTransportError", {
1449
- readonly target: Schema.String;
1450
- readonly message: Schema.String;
1451
- readonly retryable: Schema.optionalKey<Schema.Boolean>;
1452
- readonly cause: Schema.optionalKey<Schema.Defect>;
1453
- }>, import("effect/Cause").YieldableError>;
1454
- /**
1455
- * A transport could not deliver a port request to (or an answer from) the owning
1456
- * Conversation's Durable Object. `retryable` carries the platform's own stub signal when one
1457
- * exists. This error never crosses the wire — it is the CALLER-side evidence that the
1458
- * authority was unreachable, which is exactly the case `AdmissionIndeterminate` was
1459
- * specified for (SUB-031).
1460
- */
1461
- declare class PortTransportError extends PortTransportError_base {}
1462
- /**
1463
- * Build a `PortTransportError` from an arbitrary thrown transport cause, preserving the
1464
- * platform stub's own `retryable` signal when present.
1465
- */
1466
- declare const portTransportFailure: (target: string, cause: unknown) => PortTransportError;
1467
- declare const ConversationPortTransport_base: Context.ServiceClass<ConversationPortTransport, "@effect-agent/storage-cloudflare/ConversationPortTransport", {
1468
- readonly call: (conversationId: ConversationId, request: PortRequestEnvelope) => Effect.Effect<unknown, PortTransportError>;
1469
- }>;
1470
- /**
1471
- * Delivery of Schema-encoded port envelopes to the Durable Object that owns a FOREIGN
1472
- * Conversation (plan §1.3, D-P6-3). The shipped implementation (platform-cloudflare, WP3)
1473
- * calls the owner's `portCall` over native Durable Object JS RPC via
1474
- * `namespace.idFromName(conversationId)`; the protocol is transport-agnostic and any carrier
1475
- * that moves the encoded envelopes verbatim satisfies this service. Implementations MUST
1476
- * surface every delivery problem as `PortTransportError` and must never fabricate an answer.
1477
- */
1478
- declare class ConversationPortTransport extends ConversationPortTransport_base {}
1479
- /** Construction options shared by both routed port Layers. */
1480
- interface RoutedPortOptions {
1481
- /**
1482
- * The Conversation this Durable Object owns (the Object identity rule is
1483
- * `namespace.idFromName(conversationId)`). Requests addressed here execute on the local
1484
- * facet; requests addressed anywhere else route through the transport or fail fast typed.
1485
- */
1486
- readonly localConversationId: ConversationId;
1487
- }
1488
- /**
1489
- * Routing decorator over the LOCAL `SubmissionLedger` facet (plan §1.3): a request addressing
1490
- * this Object's Conversation executes locally; a route-capable request addressing another
1491
- * Conversation is Schema-encoded onto the `ConversationPortTransport` and executed by the
1492
- * owning Object's local facet; any other foreign request fails fast typed. Provide the WP1
1493
- * local facet (`submissionLedgerLayer`/`ledgerLayer`) and a transport to close it.
1494
- */
1495
- declare const routedSubmissionLedgerLayer: (options: RoutedPortOptions) => Layer.Layer<SubmissionLedger, never, SubmissionLedger | ConversationPortTransport>;
1496
- /**
1497
- * Routing decorator over the LOCAL `ConversationStore` facet (plan §1.3): this-conversation
1498
- * requests execute locally; foreign materialize/append/read/inspectTail/export travel the
1499
- * transport; foreign observation and checkpoints fail fast typed.
1500
- */
1501
- declare const routedConversationStoreLayer: (options: RoutedPortOptions) => Layer.Layer<ConversationStore, never, ConversationStore | ConversationPortTransport>;
1502
- /**
1503
- * Execute one decoded port request against THIS Object's LOCAL facets — the owner-side half
1504
- * of the routed ports (plan §1.3). Callers must provide the WP1 local facets, never the
1505
- * routed decorators: the routing layer already established that this Object owns the
1506
- * addressed Conversation, and re-routing here could bounce a request between Objects.
1507
- * Failures never escape — every typed port failure becomes a `PortFailed` envelope that
1508
- * re-decodes on the caller side.
1509
- */
1510
- declare const executePortRequest: (request: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall) => Effect.Effect<PortFailed | PortSucceeded, never, ConversationStore | SubmissionLedger>;
1511
- /**
1512
- * The complete owner-side endpoint body for `portCall` (D-P6-3): decode the wire request,
1513
- * execute it against this Object's LOCAL facets, and answer with the encoded response
1514
- * envelope. Total by construction — a request that cannot be decoded, or a response that
1515
- * cannot be encoded, answers `PortFailed(PortProtocolError)` instead of throwing, so the
1516
- * transport never has to interpret exceptions as protocol answers.
1517
- */
1518
- declare const handleEncodedPortRequest: (encoded: unknown) => Effect.Effect<unknown, never, ConversationStore | SubmissionLedger>;
1519
- //#endregion
1520
- export { ConversationPortTransport, CurrentDoStorageVersion, DEFAULT_MAX_STORED_VALUE_BYTES, DoAppendConflict, DoCheckpointConflict, DoFenceRejected, DoLedgerError, DoStorageCompatibilityError, DoStorageConfig, DoStorageConfigValue, DoStorageCorruptionError, DoStorageError, DoStorageFailpoint, DoStorageFailpointError, DoStorageFailpointHandler, DoStorageFailpointLocation, DoStorageFailpointTestControl, DoStorageInitializationError, DoStorageOptions, 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, boundPortDiagnostic, conversationStoreLayer, decodePortRequest, decodePortResponse, doMigrations, encodePortRequest, encodePortResponse, evictionFailpointHandler, executePortRequest, handleEncodedPortRequest, layer, ledgerLayer, observationOffsetAt, portTransportFailure, routedConversationStoreLayer, routedSubmissionLedgerLayer, storageConfigLayer, storageFailpointLayer, submissionLedgerLayer };
1521
- //# sourceMappingURL=index.d.mts.map
1
+ import { t as DoMemoryStore_d_exports } from "./DoMemoryStore.mjs";
2
+ import { c as DoStorageError_d_exports } from "./DoStorageError-Cmhvl4TQ.mjs";
3
+ import { t as DoStorageConfig_d_exports } from "./DoStorageConfig.mjs";
4
+ import { t as DoStorageFailpoint_d_exports } from "./DoStorageFailpoint.mjs";
5
+ import { t as DoMessageDeliveryStore_d_exports } from "./DoMessageDeliveryStore.mjs";
6
+ import { t as DoScheduleStore_d_exports } from "./DoScheduleStore.mjs";
7
+ import { t as DoStorageVersion_d_exports } from "./DoStorageVersion-x5OOurvZ.mjs";
8
+ import { t as DoThreadStore_d_exports } from "./DoThreadStore.mjs";
9
+ import { t as DoSubmissionLedger_d_exports } from "./DoSubmissionLedger.mjs";
10
+ import { t as DoSubscriptionStore_d_exports } from "./DoSubscriptionStore.mjs";
11
+ import { t as MemoryProtocol_d_exports } from "./MemoryProtocol.mjs";
12
+ import { t as PortProtocol_d_exports } from "./PortProtocol.mjs";
13
+ import { t as PortRouting_d_exports } from "./PortRouting.mjs";
14
+ export { DoMemoryStore_d_exports as DoMemoryStore, DoMessageDeliveryStore_d_exports as DoMessageDeliveryStore, DoScheduleStore_d_exports as DoScheduleStore, DoStorageConfig_d_exports as DoStorageConfig, DoStorageError_d_exports as DoStorageError, DoStorageFailpoint_d_exports as DoStorageFailpoint, DoStorageVersion_d_exports as DoStorageVersion, DoSubmissionLedger_d_exports as DoSubmissionLedger, DoSubscriptionStore_d_exports as DoSubscriptionStore, DoThreadStore_d_exports as DoThreadStore, MemoryProtocol_d_exports as MemoryProtocol, PortProtocol_d_exports as PortProtocol, PortRouting_d_exports as PortRouting };