@effect-agent/storage-cloudflare 0.1.0-beta.100 → 0.1.0-beta.101

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.
@@ -1,9 +1,10 @@
1
1
  import { Schema } from "effect";
2
+ import { MessageDeliveryError } from "effect-agent/message-delivery";
2
3
  import { CanonicalRecordEnvelope } from "effect-agent/records";
3
- import { AppendConflict, AppendResult, FenceRejected, FencedAppendRequest, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadRead, ThreadStoreError, ThreadTail, ThreadTailRequest } from "effect-agent/thread-store";
4
+ import { AppendConflict, AppendResult, FenceRejected, FencedAppendRequest, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadStoreError, ThreadTail, ThreadTailRequest } from "effect-agent/thread-store";
4
5
  import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, AdmissionResult, ChildSettledNotification, JoinedToHost, LedgerError, MarkReadyRequest, SettlementConflict, SubmissionLookupByKey, SubmissionSnapshot } from "effect-agent/submission-ledger";
5
6
  declare namespace PortProtocol_d_exports {
6
- export { 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, StoreAppendCall, StoreAppendResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse };
7
+ export { LedgerAdmitCall, LedgerAdmitResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, MAX_PORT_DIAGNOSTIC_LENGTH, MessageDeliveryListCall, MessageDeliveryListResult, PortFailed, PortFailure, PortProtocolError, PortRequest, PortRequestEnvelope, PortResponse, PortResponseEnvelope, PortResult, PortSucceeded, StoreAppendCall, StoreAppendResult, StoreCountPeerMessagesCall, StoreCountPeerMessagesResult, StoreExportCall, StoreExportResult, StoreInspectTailCall, StoreInspectTailResult, StoreMaterializeCall, StoreMaterializeResult, StoreReadPageCall, StoreReadPageResult, boundPortDiagnostic, decodePortRequest, decodePortResponse, encodePortRequest, encodePortResponse };
7
8
  }
8
9
  /**
9
10
  * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
@@ -87,7 +88,29 @@ declare const StoreAppendCall_base: Schema.Class<StoreAppendCall, Schema.TaggedS
87
88
  /** Routed `ThreadStore.append` against the owning Object. */
88
89
  export declare class StoreAppendCall extends StoreAppendCall_base {}
89
90
  declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.TaggedStruct<"StoreReadPage", {
90
- readonly request: typeof ThreadRead;
91
+ readonly request: Schema.Union<readonly [Schema.Struct<{
92
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
93
+ readonly selection: Schema.Union<readonly [Schema.Struct<{
94
+ readonly _tag: Schema.Literal<"RecordId">;
95
+ readonly recordId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/RecordId">;
96
+ }>, Schema.Struct<{
97
+ readonly _tag: Schema.Literal<"RunInput">;
98
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
99
+ }>, Schema.Struct<{
100
+ readonly _tag: Schema.Literal<"Outstanding">;
101
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
102
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
103
+ }>, Schema.Struct<{
104
+ readonly _tag: Schema.Literal<"WorkerState">;
105
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
106
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
107
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
108
+ }>]>;
109
+ readonly page: Schema.Struct<{
110
+ readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
111
+ readonly limit: Schema.Natural;
112
+ }>;
113
+ }>, typeof import("effect-agent/thread-store").ThreadRead]>;
91
114
  }>, {}>;
92
115
  /** Routed one-page `ThreadStore.read`; the page bound is the request's own `limit`. */
93
116
  export declare class StoreReadPageCall extends StoreReadPageCall_base {}
@@ -101,8 +124,24 @@ declare const StoreExportCall_base: Schema.Class<StoreExportCall, Schema.TaggedS
101
124
  }>, {}>;
102
125
  /** Routed `ThreadStore.export` against the owning Object. */
103
126
  export declare class StoreExportCall extends StoreExportCall_base {}
127
+ declare const StoreCountPeerMessagesCall_base: Schema.Class<StoreCountPeerMessagesCall, Schema.TaggedStruct<"StoreCountPeerMessages", {
128
+ readonly request: Schema.Struct<{
129
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
130
+ readonly limit: Schema.Int;
131
+ }>;
132
+ }>, {}>;
133
+ export declare class StoreCountPeerMessagesCall extends StoreCountPeerMessagesCall_base {}
134
+ declare const MessageDeliveryListCall_base: Schema.Class<MessageDeliveryListCall, Schema.TaggedStruct<"MessageDeliveryList", {
135
+ readonly request: Schema.Struct<{
136
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
137
+ readonly limit: Schema.Int;
138
+ readonly after: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">>;
139
+ readonly pendingOnly: Schema.optionalKey<Schema.Boolean>;
140
+ }>;
141
+ }>, {}>;
142
+ export declare class MessageDeliveryListCall extends MessageDeliveryListCall_base {}
104
143
  /** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
105
- export 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]>;
144
+ export declare const PortRequest: Schema.Union<readonly [typeof MessageDeliveryListCall, typeof LedgerAdmitCall, typeof LedgerMarkReadyCall, typeof LedgerLookupCall, typeof LedgerResolveAdmissionCall, typeof LedgerRequestAbortCall, typeof LedgerRecordChildSettledCall, typeof StoreMaterializeCall, typeof StoreAppendCall, typeof StoreReadPageCall, typeof StoreInspectTailCall, typeof StoreExportCall, typeof StoreCountPeerMessagesCall]>;
106
145
  export type PortRequest = typeof PortRequest.Type;
107
146
  /** The wire form of one port request (what a transport actually carries). */
108
147
  export type PortRequestEnvelope = typeof PortRequest.Encoded;
@@ -148,23 +187,195 @@ declare const StoreExportResult_base: Schema.Class<StoreExportResult, Schema.Tag
148
187
  readonly export: typeof ThreadExport;
149
188
  }>, {}>;
150
189
  export declare class StoreExportResult extends StoreExportResult_base {}
190
+ declare const StoreCountPeerMessagesResult_base: Schema.Class<StoreCountPeerMessagesResult, Schema.TaggedStruct<"StoreCountPeerMessagesResult", {
191
+ readonly count: Schema.Int;
192
+ }>, {}>;
193
+ export declare class StoreCountPeerMessagesResult extends StoreCountPeerMessagesResult_base {}
194
+ declare const MessageDeliveryListResult_base: Schema.Class<MessageDeliveryListResult, Schema.TaggedStruct<"MessageDeliveryListResult", {
195
+ readonly page: Schema.Struct<{
196
+ readonly items: Schema.$Array<Schema.Struct<{
197
+ readonly schemaVersion: Schema.Literal<1>;
198
+ readonly key: Schema.Struct<{
199
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
200
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
201
+ }>;
202
+ readonly envelope: Schema.Struct<{
203
+ readonly schemaVersion: Schema.Literal<1>;
204
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
205
+ readonly deliveryPrincipal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
206
+ readonly admissionGroup: Schema.optionalKey<Schema.NonEmptyString>;
207
+ readonly admissionFence: Schema.optionalKey<Schema.Struct<{
208
+ readonly policyId: Schema.NonEmptyString;
209
+ readonly key: Schema.NonEmptyString;
210
+ readonly revision: Schema.NonEmptyString;
211
+ }>>;
212
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
213
+ readonly definitions: typeof import("effect-agent/records").DefinitionDigests;
214
+ readonly input: Schema.declare<Schema.Json, Schema.Json>;
215
+ readonly inputDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
216
+ readonly admissionKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
217
+ readonly authorization: Schema.Struct<{
218
+ readonly policyId: Schema.NonEmptyString;
219
+ readonly decisionId: Schema.NonEmptyString;
220
+ }>;
221
+ readonly workerAdmission: Schema.optionalKey<Schema.Struct<{
222
+ readonly origin: Schema.Struct<{
223
+ readonly worker: Schema.Struct<{
224
+ readonly schemaVersion: Schema.Literal<1>;
225
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
226
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
227
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
228
+ }>;
229
+ readonly source: Schema.Union<readonly [Schema.Struct<{
230
+ readonly _tag: Schema.Literal<"tool">;
231
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
232
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
233
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
234
+ readonly toolCallId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ToolCallId">;
235
+ }>, Schema.Struct<{
236
+ readonly _tag: Schema.Literal<"programmatic">;
237
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
238
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
239
+ }>]>;
240
+ readonly budgetScope: Schema.optionalKey<Schema.Literals<readonly ["source-subtree", "worker-run"]>>;
241
+ readonly targetDigests: typeof import("effect-agent/records").DefinitionDigests;
242
+ readonly policy: Schema.toCodecJson<typeof import("effect-agent/agent-policy").AgentPolicy>;
243
+ readonly budget: Schema.Struct<{
244
+ readonly caps: typeof import("effect-agent/subagent-contract").SubagentDelegationCaps;
245
+ readonly allocation: typeof import("effect-agent/subagent-contract").SubagentReservationAmounts;
246
+ readonly descendantInvocations: Schema.optionalKey<Schema.Natural>;
247
+ }>;
248
+ readonly grant: typeof import("effect-agent/subagent-contract").SubagentGrant;
249
+ readonly depth: Schema.Int;
250
+ readonly toolCallAllowance: Schema.optionalKey<Schema.Int>;
251
+ readonly firstMessageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
252
+ readonly createdAtMillis: Schema.Natural;
253
+ readonly expiresAtMillis: Schema.Natural;
254
+ readonly reporting: Schema.optionalKey<Schema.Struct<{
255
+ readonly mode: Schema.optionalKey<Schema.Literal<"standard">>;
256
+ readonly sourceDigests: typeof import("effect-agent/records").DefinitionDigests;
257
+ readonly destinationDelegationId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">>;
258
+ }>>;
259
+ }>;
260
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
261
+ readonly parameters: Schema.declare<Schema.Json, Schema.Json>;
262
+ readonly createdAtMillis: Schema.Natural;
263
+ readonly sourceSubmissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
264
+ readonly deliveryPrincipal: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">>;
265
+ readonly reportKind: Schema.optionalKey<Schema.Literal<"update">>;
266
+ }>>;
267
+ readonly messageAdmission: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
268
+ readonly schemaVersion: Schema.Literal<1>;
269
+ readonly message: Schema.Struct<{
270
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
271
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
272
+ }>;
273
+ readonly peerName: Schema.NonEmptyString;
274
+ readonly sender: Schema.Struct<{
275
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
276
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
277
+ }>;
278
+ readonly returnAddress: Schema.Struct<{
279
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
280
+ readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
281
+ }>;
282
+ readonly inReplyTo: Schema.optionalKey<Schema.Struct<{
283
+ readonly ownerThreadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
284
+ readonly messageId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
285
+ }>>;
286
+ }>, Schema.Union<readonly [Schema.Struct<{
287
+ readonly _tag: Schema.Literal<"WorkerCompletion">;
288
+ readonly budgetExhausted: Schema.Boolean;
289
+ readonly schemaVersion: Schema.Literal<1>;
290
+ readonly report: Schema.Union<readonly [Schema.Struct<{
291
+ readonly _tag: Schema.Literal<"Settled">;
292
+ readonly worker: Schema.Struct<{
293
+ readonly schemaVersion: Schema.Literal<1>;
294
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
295
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
296
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
297
+ }>;
298
+ readonly receipt: typeof import("effect-agent/receipt").Receipt;
299
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
300
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
301
+ readonly outcome: Schema.Literal<"completed">;
302
+ readonly result: Schema.Union<readonly [Schema.Codec<Schema.Json, Schema.Json, never, never>]>;
303
+ }>, Schema.Struct<{
304
+ readonly _tag: Schema.Literal<"Settled">;
305
+ readonly worker: Schema.Struct<{
306
+ readonly schemaVersion: Schema.Literal<1>;
307
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
308
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
309
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
310
+ }>;
311
+ readonly receipt: typeof import("effect-agent/receipt").Receipt;
312
+ readonly runId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/RunId">;
313
+ readonly settlementId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SettlementId">;
314
+ readonly outcome: Schema.Literals<readonly ["failed", "aborted"]>;
315
+ readonly failure: typeof import("effect-agent/subagent-contract").SubagentExecutionFailure;
316
+ }>]>;
317
+ }>, Schema.Struct<{
318
+ readonly _tag: Schema.Literal<"WorkerUpdate">;
319
+ readonly schemaVersion: Schema.Literal<1>;
320
+ readonly worker: Schema.Struct<{
321
+ readonly schemaVersion: Schema.Literal<1>;
322
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
323
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
324
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
325
+ }>;
326
+ readonly update: typeof import("effect-agent/agent-updates").Update;
327
+ }>]>]>>;
328
+ }>;
329
+ readonly envelopeDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
330
+ readonly predecessor: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">>;
331
+ readonly createdAtMillis: Schema.Int;
332
+ readonly initialDeadlineAtMillis: Schema.Int;
333
+ readonly deadlineAtMillis: Schema.Int;
334
+ readonly policy: Schema.Struct<{
335
+ readonly maxAutomaticAttempts: Schema.Int;
336
+ readonly attemptTimeoutMillis: Schema.Int;
337
+ readonly retryBaseMillis: Schema.Int;
338
+ readonly retryMaxMillis: Schema.Int;
339
+ readonly settlementPollMillis: Schema.Int;
340
+ }>;
341
+ readonly version: Schema.Int;
342
+ readonly status: Schema.Literals<readonly ["pending", "accepted", "processed", "refused", "parked"]>;
343
+ readonly receipt: Schema.NullOr<typeof import("effect-agent/receipt").Receipt>;
344
+ readonly settlement: Schema.NullOr<typeof import("effect-agent/submission-ledger").Settlement>;
345
+ readonly refusal: Schema.NullOr<Schema.String>;
346
+ readonly parkReason: Schema.NullOr<Schema.Literals<readonly ["exhausted", "deadline", "status-unavailable"]>>;
347
+ readonly leaseUntilMillis: Schema.NullOr<Schema.Int>;
348
+ readonly retry: Schema.Struct<{
349
+ readonly attempts: Schema.Natural;
350
+ readonly generation: Schema.Natural;
351
+ readonly automaticAttempts: Schema.Natural;
352
+ readonly parked: Schema.Boolean;
353
+ readonly nextAttemptAtMillis: Schema.Int;
354
+ readonly lastAttemptAtMillis: Schema.NullOr<Schema.Int>;
355
+ readonly lastFailure: Schema.NullOr<Schema.Literals<readonly ["transport", "capacity", "storage", "host-closed", "timeout", "ambiguous"]>>;
356
+ }>;
357
+ }>>;
358
+ readonly next: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">>;
359
+ }>;
360
+ }>, {}>;
361
+ export declare class MessageDeliveryListResult extends MessageDeliveryListResult_base {}
151
362
  /** Every successful routed result. Callers narrow by the tag their request implies. */
152
- export 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]>;
363
+ export declare const PortResult: Schema.Union<readonly [typeof MessageDeliveryListResult, typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult, typeof StoreCountPeerMessagesResult]>;
153
364
  export type PortResult = typeof PortResult.Type;
154
365
  /**
155
366
  * Every typed failure a route-capable operation can produce on its owning Object, plus the
156
367
  * protocol's own `PortProtocolError`. Members re-decode to the SAME tagged classes the
157
368
  * thread ports declare, so a routed caller observes identical error tags and fields.
158
369
  */
159
- export declare const PortFailure: Schema.Union<readonly [typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
370
+ export declare const PortFailure: Schema.Union<readonly [typeof MessageDeliveryError, typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
160
371
  export type PortFailure = typeof PortFailure.Type;
161
372
  declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
162
- 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]>;
373
+ readonly result: Schema.Union<readonly [typeof MessageDeliveryListResult, typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult, typeof StoreCountPeerMessagesResult]>;
163
374
  }>, {}>;
164
375
  /** The routed operation succeeded on its owning Object. */
165
376
  export declare class PortSucceeded extends PortSucceeded_base {}
166
377
  declare const PortFailed_base: Schema.Class<PortFailed, Schema.TaggedStruct<"PortFailed", {
167
- readonly failure: Schema.Union<readonly [typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
378
+ readonly failure: Schema.Union<readonly [typeof MessageDeliveryError, typeof AdmissionConflict, typeof AdmissionPolicyError, typeof SettlementConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof PortProtocolError]>;
168
379
  }>, {}>;
169
380
  /** The routed operation failed TYPED on its owning Object; the failure re-decodes verbatim. */
170
381
  export declare class PortFailed extends PortFailed_base {}
@@ -173,7 +384,7 @@ export declare const PortResponse: Schema.Union<readonly [typeof PortSucceeded,
173
384
  export type PortResponse = typeof PortResponse.Type;
174
385
  /** The wire form of one port response (what a transport actually carries). */
175
386
  export type PortResponseEnvelope = typeof PortResponse.Encoded;
176
- export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | StoreAppendCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
387
+ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | MessageDeliveryListCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
177
388
  readonly _tag: "LedgerAdmit";
178
389
  readonly request: {
179
390
  readonly threadId: string;
@@ -1136,6 +1347,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1136
1347
  readonly receiptId: string;
1137
1348
  readonly settlementId: string;
1138
1349
  readonly completedAtMillis: number;
1350
+ readonly effectsResolved?: true | undefined;
1139
1351
  } | {
1140
1352
  readonly _tag: "WorkerReportPrepared";
1141
1353
  readonly runId: string;
@@ -1928,6 +2140,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1928
2140
  readonly receiptId: string;
1929
2141
  readonly settlementId: string;
1930
2142
  readonly completedAtMillis: number;
2143
+ readonly effectsResolved?: true | undefined;
1931
2144
  } | {
1932
2145
  readonly _tag: "WorkerReportPrepared";
1933
2146
  readonly runId: string;
@@ -2031,6 +2244,28 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2031
2244
  readonly threadId: string;
2032
2245
  readonly afterSequence?: number | undefined;
2033
2246
  readonly limit: number;
2247
+ } | {
2248
+ readonly threadId: string;
2249
+ readonly selection: {
2250
+ readonly _tag: "RecordId";
2251
+ readonly recordId: string;
2252
+ } | {
2253
+ readonly _tag: "RunInput";
2254
+ readonly runId: string;
2255
+ } | {
2256
+ readonly _tag: "Outstanding";
2257
+ readonly expectedTailSequence: number;
2258
+ readonly expectedTailDigest: string;
2259
+ } | {
2260
+ readonly _tag: "WorkerState";
2261
+ readonly expectedTailSequence: number;
2262
+ readonly expectedTailDigest: string;
2263
+ readonly sourceSubmissionId?: string | undefined;
2264
+ };
2265
+ readonly page: {
2266
+ readonly afterSequence?: number | undefined;
2267
+ readonly limit: number;
2268
+ };
2034
2269
  };
2035
2270
  } | {
2036
2271
  readonly _tag: "StoreInspectTail";
@@ -2042,8 +2277,22 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2042
2277
  readonly request: {
2043
2278
  readonly threadId: string;
2044
2279
  };
2280
+ } | {
2281
+ readonly _tag: "StoreCountPeerMessages";
2282
+ readonly request: {
2283
+ readonly threadId: string;
2284
+ readonly limit: number;
2285
+ };
2286
+ } | {
2287
+ readonly _tag: "MessageDeliveryList";
2288
+ readonly request: {
2289
+ readonly ownerThreadId: string;
2290
+ readonly limit: number;
2291
+ readonly after?: string | undefined;
2292
+ readonly pendingOnly?: boolean | undefined;
2293
+ };
2045
2294
  }, Schema.SchemaError, never>;
2046
- export 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>;
2295
+ export declare const decodePortRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<LedgerAdmitCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | MessageDeliveryListCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, Schema.SchemaError, never>;
2047
2296
  export declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
2048
2297
  readonly _tag: "PortSucceeded";
2049
2298
  readonly result: {
@@ -3233,6 +3482,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3233
3482
  readonly receiptId: string;
3234
3483
  readonly settlementId: string;
3235
3484
  readonly completedAtMillis: number;
3485
+ readonly effectsResolved?: true | undefined;
3236
3486
  } | {
3237
3487
  readonly _tag: "WorkerReportPrepared";
3238
3488
  readonly runId: string;
@@ -4047,6 +4297,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4047
4297
  readonly receiptId: string;
4048
4298
  readonly settlementId: string;
4049
4299
  readonly completedAtMillis: number;
4300
+ readonly effectsResolved?: true | undefined;
4050
4301
  } | {
4051
4302
  readonly _tag: "WorkerReportPrepared";
4052
4303
  readonly runId: string;
@@ -4141,12 +4392,323 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4141
4392
  };
4142
4393
  }[];
4143
4394
  };
4395
+ } | {
4396
+ readonly _tag: "StoreCountPeerMessagesResult";
4397
+ readonly count: number;
4398
+ } | {
4399
+ readonly _tag: "MessageDeliveryListResult";
4400
+ readonly page: {
4401
+ readonly items: readonly {
4402
+ readonly schemaVersion: 1;
4403
+ readonly key: {
4404
+ readonly ownerThreadId: string;
4405
+ readonly messageId: string;
4406
+ };
4407
+ readonly envelope: {
4408
+ readonly schemaVersion: 1;
4409
+ readonly threadId: string;
4410
+ readonly deliveryPrincipal: string;
4411
+ readonly admissionGroup?: string | undefined;
4412
+ readonly admissionFence?: {
4413
+ readonly policyId: string;
4414
+ readonly key: string;
4415
+ readonly revision: string;
4416
+ } | undefined;
4417
+ readonly agentId: string;
4418
+ readonly definitions: {
4419
+ readonly agent: string;
4420
+ readonly model: string;
4421
+ readonly tools: string;
4422
+ readonly replay?: {
4423
+ readonly agent: string;
4424
+ readonly agentBehavior?: string | undefined;
4425
+ readonly tools: {
4426
+ readonly [x: string]: string;
4427
+ };
4428
+ } | undefined;
4429
+ };
4430
+ readonly input: Schema.Json;
4431
+ readonly inputDigest: string;
4432
+ readonly admissionKey: string;
4433
+ readonly authorization: {
4434
+ readonly policyId: string;
4435
+ readonly decisionId: string;
4436
+ };
4437
+ readonly workerAdmission?: {
4438
+ readonly origin: {
4439
+ readonly worker: {
4440
+ readonly schemaVersion: 1;
4441
+ readonly delegationId: string;
4442
+ readonly targetAgentId: string;
4443
+ readonly threadId: string;
4444
+ };
4445
+ readonly source: {
4446
+ readonly _tag: "tool";
4447
+ readonly agentId: string;
4448
+ readonly threadId: string;
4449
+ readonly runId: string;
4450
+ readonly toolCallId: string;
4451
+ } | {
4452
+ readonly _tag: "programmatic";
4453
+ readonly agentId: string;
4454
+ readonly threadId: string;
4455
+ };
4456
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
4457
+ readonly targetDigests: {
4458
+ readonly agent: string;
4459
+ readonly model: string;
4460
+ readonly tools: string;
4461
+ readonly replay?: {
4462
+ readonly agent: string;
4463
+ readonly agentBehavior?: string | undefined;
4464
+ readonly tools: {
4465
+ readonly [x: string]: string;
4466
+ };
4467
+ } | undefined;
4468
+ };
4469
+ readonly policy: Schema.Json;
4470
+ readonly budget: {
4471
+ readonly caps: {
4472
+ readonly maxTotalChildInvocations?: number | undefined;
4473
+ readonly maxConcurrentChildren?: number | undefined;
4474
+ readonly maxTurns?: number | undefined;
4475
+ readonly maxToolCalls?: number | undefined;
4476
+ readonly maxDurationMillis?: number | undefined;
4477
+ readonly maxInputTokens?: number | undefined;
4478
+ readonly maxOutputTokens?: number | undefined;
4479
+ readonly maxCostMicrousd?: number | undefined;
4480
+ readonly maxResultBytes?: number | undefined;
4481
+ };
4482
+ readonly allocation: {
4483
+ readonly turns: number;
4484
+ readonly toolCalls: number;
4485
+ readonly durationMillis: number;
4486
+ readonly inputTokens: number;
4487
+ readonly outputTokens: number;
4488
+ readonly costMicrousd: number;
4489
+ readonly resultBytes: number;
4490
+ };
4491
+ readonly descendantInvocations?: number | undefined;
4492
+ };
4493
+ readonly grant: {
4494
+ readonly allowedToolNames: readonly string[];
4495
+ readonly maxDepth: number;
4496
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
4497
+ };
4498
+ readonly depth: number;
4499
+ readonly toolCallAllowance?: number | undefined;
4500
+ readonly firstMessageId: string;
4501
+ readonly createdAtMillis: number;
4502
+ readonly expiresAtMillis: number;
4503
+ readonly reporting?: {
4504
+ readonly mode?: "standard" | undefined;
4505
+ readonly sourceDigests: {
4506
+ readonly agent: string;
4507
+ readonly model: string;
4508
+ readonly tools: string;
4509
+ readonly replay?: {
4510
+ readonly agent: string;
4511
+ readonly agentBehavior?: string | undefined;
4512
+ readonly tools: {
4513
+ readonly [x: string]: string;
4514
+ };
4515
+ } | undefined;
4516
+ };
4517
+ readonly destinationDelegationId?: string | undefined;
4518
+ } | undefined;
4519
+ };
4520
+ readonly messageId: string;
4521
+ readonly parameters: Schema.Json;
4522
+ readonly createdAtMillis: number;
4523
+ readonly sourceSubmissionId?: string | undefined;
4524
+ readonly deliveryPrincipal?: string | undefined;
4525
+ readonly reportKind?: "update" | undefined;
4526
+ } | undefined;
4527
+ readonly messageAdmission?: {
4528
+ readonly schemaVersion: 1;
4529
+ readonly message: {
4530
+ readonly ownerThreadId: string;
4531
+ readonly messageId: string;
4532
+ };
4533
+ readonly peerName: string;
4534
+ readonly sender: {
4535
+ readonly threadId: string;
4536
+ readonly agentId: string;
4537
+ };
4538
+ readonly returnAddress: {
4539
+ readonly threadId: string;
4540
+ readonly agentId: string;
4541
+ };
4542
+ readonly inReplyTo?: {
4543
+ readonly ownerThreadId: string;
4544
+ readonly messageId: string;
4545
+ } | undefined;
4546
+ } | {
4547
+ readonly _tag: "WorkerCompletion";
4548
+ readonly budgetExhausted: boolean;
4549
+ readonly schemaVersion: 1;
4550
+ readonly report: {
4551
+ readonly _tag: "Settled";
4552
+ readonly worker: {
4553
+ readonly schemaVersion: 1;
4554
+ readonly delegationId: string;
4555
+ readonly targetAgentId: string;
4556
+ readonly threadId: string;
4557
+ };
4558
+ readonly receipt: {
4559
+ readonly receiptId: string;
4560
+ readonly submissionId: string;
4561
+ readonly threadId: string;
4562
+ readonly queueSequence: number;
4563
+ };
4564
+ readonly runId: string;
4565
+ readonly settlementId: string;
4566
+ readonly outcome: "completed";
4567
+ readonly result: Schema.Json;
4568
+ } | {
4569
+ readonly _tag: "Settled";
4570
+ readonly worker: {
4571
+ readonly schemaVersion: 1;
4572
+ readonly delegationId: string;
4573
+ readonly targetAgentId: string;
4574
+ readonly threadId: string;
4575
+ };
4576
+ readonly receipt: {
4577
+ readonly receiptId: string;
4578
+ readonly submissionId: string;
4579
+ readonly threadId: string;
4580
+ readonly queueSequence: number;
4581
+ };
4582
+ readonly runId: string;
4583
+ readonly settlementId: string;
4584
+ readonly outcome: "aborted" | "failed";
4585
+ readonly failure: {
4586
+ readonly _tag: "SubagentExecutionFailure";
4587
+ readonly delegationId: string;
4588
+ readonly targetAgentId: string;
4589
+ readonly classification: "child-aborted" | "child-compatibility" | "child-failed" | "declaration-unavailable" | "establishment-denied";
4590
+ readonly childThreadId?: string | undefined;
4591
+ readonly childSubmissionId?: string | undefined;
4592
+ readonly childRunId?: string | undefined;
4593
+ readonly errorTag: string;
4594
+ readonly message: string;
4595
+ };
4596
+ };
4597
+ } | {
4598
+ readonly _tag: "WorkerUpdate";
4599
+ readonly schemaVersion: 1;
4600
+ readonly worker: {
4601
+ readonly schemaVersion: 1;
4602
+ readonly delegationId: string;
4603
+ readonly targetAgentId: string;
4604
+ readonly threadId: string;
4605
+ };
4606
+ readonly update: {
4607
+ readonly schemaVersion: 1;
4608
+ readonly agentId: string;
4609
+ readonly threadId: string;
4610
+ readonly runId: string;
4611
+ readonly updateId: string;
4612
+ readonly sequence: number;
4613
+ readonly value: Schema.Json;
4614
+ };
4615
+ } | undefined;
4616
+ };
4617
+ readonly envelopeDigest: string;
4618
+ readonly predecessor?: string | undefined;
4619
+ readonly createdAtMillis: number;
4620
+ readonly initialDeadlineAtMillis: number;
4621
+ readonly deadlineAtMillis: number;
4622
+ readonly policy: {
4623
+ readonly maxAutomaticAttempts: number;
4624
+ readonly attemptTimeoutMillis: number;
4625
+ readonly retryBaseMillis: number;
4626
+ readonly retryMaxMillis: number;
4627
+ readonly settlementPollMillis: number;
4628
+ };
4629
+ readonly version: number;
4630
+ readonly status: "accepted" | "parked" | "pending" | "processed" | "refused";
4631
+ readonly receipt: {
4632
+ readonly receiptId: string;
4633
+ readonly submissionId: string;
4634
+ readonly threadId: string;
4635
+ readonly queueSequence: number;
4636
+ } | null;
4637
+ readonly settlement: {
4638
+ readonly submissionId: string;
4639
+ readonly settlementId: string;
4640
+ readonly receiptId: string;
4641
+ readonly outcome: "aborted" | "completed" | "failed";
4642
+ readonly runDisposition?: Schema.Json | undefined;
4643
+ readonly usageSummary?: {
4644
+ readonly modelCalls: number;
4645
+ readonly inputTokens: {
4646
+ readonly total: number;
4647
+ readonly uncached: number;
4648
+ readonly cacheRead: number;
4649
+ readonly cacheWrite: number;
4650
+ };
4651
+ readonly outputTokens: {
4652
+ readonly total: number;
4653
+ readonly text: number;
4654
+ readonly reasoning: number;
4655
+ };
4656
+ readonly costMicrousd: number;
4657
+ readonly byModel: readonly {
4658
+ readonly provider: string;
4659
+ readonly model: string;
4660
+ readonly responseModel?: string | undefined;
4661
+ readonly serviceTier?: string | undefined;
4662
+ readonly pricingVersion?: string | undefined;
4663
+ readonly modelCalls: number;
4664
+ readonly inputTokens: {
4665
+ readonly total: number;
4666
+ readonly uncached: number;
4667
+ readonly cacheRead: number;
4668
+ readonly cacheWrite: number;
4669
+ };
4670
+ readonly outputTokens: {
4671
+ readonly total: number;
4672
+ readonly text: number;
4673
+ readonly reasoning: number;
4674
+ };
4675
+ readonly costMicrousd: number;
4676
+ }[];
4677
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
4678
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
4679
+ readonly unobservedModelCalls?: number | undefined;
4680
+ } | undefined;
4681
+ readonly failure?: {
4682
+ readonly errorTag: string;
4683
+ readonly message: string;
4684
+ } | undefined;
4685
+ readonly settledAt: string;
4686
+ } | null;
4687
+ readonly refusal: string | null;
4688
+ readonly parkReason: "deadline" | "exhausted" | "status-unavailable" | null;
4689
+ readonly leaseUntilMillis: number | null;
4690
+ readonly retry: {
4691
+ readonly attempts: number;
4692
+ readonly generation: number;
4693
+ readonly automaticAttempts: number;
4694
+ readonly parked: boolean;
4695
+ readonly nextAttemptAtMillis: number;
4696
+ readonly lastAttemptAtMillis: number | null;
4697
+ readonly lastFailure: "ambiguous" | "capacity" | "host-closed" | "storage" | "timeout" | "transport" | null;
4698
+ };
4699
+ }[];
4700
+ readonly next: string | null;
4701
+ };
4144
4702
  };
4145
4703
  } | {
4146
4704
  readonly _tag: "PortFailed";
4147
4705
  readonly failure: {
4148
4706
  readonly _tag: "PortProtocolError";
4149
4707
  readonly message: string;
4708
+ } | {
4709
+ readonly _tag: "MessageDeliveryError";
4710
+ readonly reason: "capacity" | "conflict" | "corrupt" | "not-found" | "storage" | "validation";
4711
+ readonly operation: string;
4150
4712
  } | {
4151
4713
  readonly _tag: "ThreadNotMaterialized";
4152
4714
  readonly threadId: string;
@@ -4155,6 +4717,11 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4155
4717
  readonly threadId: string;
4156
4718
  readonly actualEpoch: number;
4157
4719
  readonly attemptedEpoch: number;
4720
+ } | {
4721
+ readonly _tag: "ThreadStoreError";
4722
+ readonly operation: string;
4723
+ readonly message: string;
4724
+ readonly cause?: Schema.Json | undefined;
4158
4725
  } | {
4159
4726
  readonly _tag: "AdmissionConflict";
4160
4727
  readonly threadId: string;
@@ -4179,11 +4746,6 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4179
4746
  readonly operation: string;
4180
4747
  readonly message: string;
4181
4748
  readonly cause?: Schema.Json | undefined;
4182
- } | {
4183
- readonly _tag: "ThreadStoreError";
4184
- readonly operation: string;
4185
- readonly message: string;
4186
- readonly cause?: Schema.Json | undefined;
4187
4749
  } | {
4188
4750
  readonly _tag: "AppendConflict";
4189
4751
  readonly threadId: string;