@effect-agent/storage-cloudflare 0.1.0-beta.114 → 0.1.0-beta.115

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.
@@ -4,7 +4,7 @@ import { CanonicalRecordEnvelope } from "effect-agent/records";
4
4
  import { AppendConflict, AppendResult, FenceRejected, FencedAppendRequest, ThreadExport, ThreadExportRequest, ThreadMaterialization, ThreadNotMaterialized, ThreadStoreError, ThreadTail, ThreadTailRequest } from "effect-agent/thread-store";
5
5
  import { AbortCommand, AbortIntent, AdmissionConflict, AdmissionPolicyError, AdmissionRequest, AdmissionResult, ChildSettledNotification, JoinedToHost, LedgerError, MarkReadyRequest, SettlementConflict, SubmissionLookupByKey, SubmissionSnapshot } from "effect-agent/submission-ledger";
6
6
  declare namespace PortProtocol_d_exports {
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
+ export { LedgerAdmitCall, LedgerAdmitResult, LedgerInspectWorkerCall, LedgerInspectWorkerResult, LedgerLookupCall, LedgerLookupResult, LedgerMarkReadyCall, LedgerMarkReadyResult, LedgerRecordChildSettledCall, LedgerRecordChildSettledResult, LedgerRequestAbortCall, LedgerRequestAbortResult, LedgerResolveAdmissionCall, LedgerResolveAdmissionResult, LedgerStopWorkerCall, LedgerStopWorkerResult, 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 };
8
8
  }
9
9
  /**
10
10
  * The cross-Durable-Object port protocol (plan §1.3, D-P6-3): Schema request/response/error
@@ -67,6 +67,32 @@ declare const LedgerResolveAdmissionCall_base: Schema.Class<LedgerResolveAdmissi
67
67
  }>, {}>;
68
68
  /** Routed `SubmissionLedger.resolveAdmission` — the SUB-031 tri-state authority call. */
69
69
  export declare class LedgerResolveAdmissionCall extends LedgerResolveAdmissionCall_base {}
70
+ declare const LedgerInspectWorkerCall_base: Schema.Class<LedgerInspectWorkerCall, Schema.TaggedStruct<"LedgerInspectWorker", {
71
+ readonly request: Schema.Struct<{
72
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
73
+ }>;
74
+ }>, {}>;
75
+ export declare class LedgerInspectWorkerCall extends LedgerInspectWorkerCall_base {}
76
+ declare const LedgerInspectWorkerResult_base: Schema.Class<LedgerInspectWorkerResult, Schema.TaggedStruct<"LedgerInspectWorkerResult", {
77
+ readonly state: Schema.Struct<{
78
+ readonly latest: Schema.NullOr<typeof SubmissionSnapshot>;
79
+ readonly active: Schema.NullOr<typeof SubmissionSnapshot>;
80
+ readonly stopped: Schema.Boolean;
81
+ readonly terminal: Schema.optionalKey<Schema.Literals<readonly ["completed", "failed", "cancelled"]>>;
82
+ }>;
83
+ }>, {}>;
84
+ export declare class LedgerInspectWorkerResult extends LedgerInspectWorkerResult_base {}
85
+ declare const LedgerStopWorkerCall_base: Schema.Class<LedgerStopWorkerCall, Schema.TaggedStruct<"LedgerStopWorker", {
86
+ readonly request: Schema.Struct<{
87
+ readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
88
+ readonly author: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
89
+ }>;
90
+ }>, {}>;
91
+ export declare class LedgerStopWorkerCall extends LedgerStopWorkerCall_base {}
92
+ declare const LedgerStopWorkerResult_base: Schema.Class<LedgerStopWorkerResult, Schema.TaggedStruct<"LedgerStopWorkerResult", {
93
+ readonly owned: Schema.Natural;
94
+ }>, {}>;
95
+ export declare class LedgerStopWorkerResult extends LedgerStopWorkerResult_base {}
70
96
  declare const LedgerRequestAbortCall_base: Schema.Class<LedgerRequestAbortCall, Schema.TaggedStruct<"LedgerRequestAbort", {
71
97
  readonly request: typeof AbortCommand;
72
98
  }>, {}>;
@@ -100,6 +126,10 @@ declare const StoreReadPageCall_base: Schema.Class<StoreReadPageCall, Schema.Tag
100
126
  readonly _tag: Schema.Literal<"Outstanding">;
101
127
  readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
102
128
  readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
129
+ }>, Schema.Struct<{
130
+ readonly _tag: Schema.Literal<"WorkerExecution">;
131
+ readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
132
+ readonly expectedTailDigest: Schema.brand<Schema.String, "@effect-agent/thread/Digest">;
103
133
  }>, Schema.Struct<{
104
134
  readonly _tag: Schema.Literal<"WorkerState">;
105
135
  readonly expectedTailSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
@@ -137,11 +167,16 @@ declare const MessageDeliveryListCall_base: Schema.Class<MessageDeliveryListCall
137
167
  readonly limit: Schema.Int;
138
168
  readonly after: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">>;
139
169
  readonly pendingOnly: Schema.optionalKey<Schema.Boolean>;
170
+ readonly workerStarts: Schema.optionalKey<Schema.Struct<{
171
+ readonly delegationId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/DelegationId">;
172
+ readonly targetAgentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
173
+ }>>;
174
+ readonly pendingWorker: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">>;
140
175
  }>;
141
176
  }>, {}>;
142
177
  export declare class MessageDeliveryListCall extends MessageDeliveryListCall_base {}
143
178
  /** Every request that may cross a Durable Object boundary — the CLOSED route-capable subset. */
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]>;
179
+ export declare const PortRequest: Schema.Union<readonly [typeof MessageDeliveryListCall, typeof LedgerAdmitCall, typeof LedgerMarkReadyCall, typeof LedgerLookupCall, typeof LedgerResolveAdmissionCall, typeof LedgerRequestAbortCall, typeof LedgerStopWorkerCall, typeof LedgerInspectWorkerCall, typeof LedgerRecordChildSettledCall, typeof StoreMaterializeCall, typeof StoreAppendCall, typeof StoreReadPageCall, typeof StoreInspectTailCall, typeof StoreExportCall, typeof StoreCountPeerMessagesCall]>;
145
180
  export type PortRequest = typeof PortRequest.Type;
146
181
  /** The wire form of one port request (what a transport actually carries). */
147
182
  export type PortRequestEnvelope = typeof PortRequest.Encoded;
@@ -238,6 +273,7 @@ declare const MessageDeliveryListResult_base: Schema.Class<MessageDeliveryListRe
238
273
  readonly threadId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/ThreadId">;
239
274
  }>]>;
240
275
  readonly budgetScope: Schema.optionalKey<Schema.Literals<readonly ["source-subtree", "worker-run"]>>;
276
+ readonly lifecycle: Schema.optionalKey<Schema.Literal<"assignment">>;
241
277
  readonly targetDigests: typeof import("effect-agent/records").DefinitionDigests;
242
278
  readonly policy: Schema.toCodecJson<typeof import("effect-agent/agent-policy").AgentPolicy>;
243
279
  readonly budget: Schema.Struct<{
@@ -369,7 +405,7 @@ declare const MessageDeliveryListResult_base: Schema.Class<MessageDeliveryListRe
369
405
  }>, {}>;
370
406
  export declare class MessageDeliveryListResult extends MessageDeliveryListResult_base {}
371
407
  /** Every successful routed result. Callers narrow by the tag their request implies. */
372
- 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]>;
408
+ export declare const PortResult: Schema.Union<readonly [typeof MessageDeliveryListResult, typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerStopWorkerResult, typeof LedgerInspectWorkerResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult, typeof StoreCountPeerMessagesResult]>;
373
409
  export type PortResult = typeof PortResult.Type;
374
410
  /**
375
411
  * Every typed failure a route-capable operation can produce on its owning Object, plus the
@@ -379,7 +415,7 @@ export type PortResult = typeof PortResult.Type;
379
415
  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]>;
380
416
  export type PortFailure = typeof PortFailure.Type;
381
417
  declare const PortSucceeded_base: Schema.Class<PortSucceeded, Schema.TaggedStruct<"PortSucceeded", {
382
- 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]>;
418
+ readonly result: Schema.Union<readonly [typeof MessageDeliveryListResult, typeof LedgerAdmitResult, typeof LedgerMarkReadyResult, typeof LedgerLookupResult, typeof LedgerResolveAdmissionResult, typeof LedgerRequestAbortResult, typeof LedgerStopWorkerResult, typeof LedgerInspectWorkerResult, typeof LedgerRecordChildSettledResult, typeof StoreMaterializeResult, typeof StoreAppendResult, typeof StoreReadPageResult, typeof StoreInspectTailResult, typeof StoreExportResult, typeof StoreCountPeerMessagesResult]>;
383
419
  }>, {}>;
384
420
  /** The routed operation succeeded on its owning Object. */
385
421
  export declare class PortSucceeded extends PortSucceeded_base {}
@@ -393,7 +429,7 @@ export declare const PortResponse: Schema.Union<readonly [typeof PortSucceeded,
393
429
  export type PortResponse = typeof PortResponse.Type;
394
430
  /** The wire form of one port response (what a transport actually carries). */
395
431
  export type PortResponseEnvelope = typeof PortResponse.Encoded;
396
- 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<{
432
+ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerInspectWorkerCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | LedgerStopWorkerCall | MessageDeliveryListCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
397
433
  readonly _tag: "LedgerAdmit";
398
434
  readonly request: {
399
435
  readonly threadId: string;
@@ -439,6 +475,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
439
475
  readonly threadId: string;
440
476
  };
441
477
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
478
+ readonly lifecycle?: "assignment" | undefined;
442
479
  readonly targetDigests: {
443
480
  readonly agent: string;
444
481
  readonly model: string;
@@ -641,6 +678,17 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
641
678
  readonly principal: string;
642
679
  readonly idempotencyKey: string;
643
680
  };
681
+ } | {
682
+ readonly _tag: "LedgerInspectWorker";
683
+ readonly request: {
684
+ readonly threadId: string;
685
+ };
686
+ } | {
687
+ readonly _tag: "LedgerStopWorker";
688
+ readonly request: {
689
+ readonly threadId: string;
690
+ readonly author: string;
691
+ };
644
692
  } | {
645
693
  readonly _tag: "LedgerRequestAbort";
646
694
  readonly request: {
@@ -674,11 +722,6 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
674
722
  readonly createdAt: string;
675
723
  readonly deploymentId: string;
676
724
  readonly payload: {
677
- readonly _tag: "AbortRequested";
678
- readonly submissionId: string;
679
- readonly author: string;
680
- readonly reason: string;
681
- } | {
682
725
  readonly _tag: "ThreadCreated";
683
726
  readonly agentId: string;
684
727
  readonly definitions: {
@@ -956,6 +999,11 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
956
999
  readonly runDisposition?: Schema.Json | undefined;
957
1000
  readonly finishReason?: "budget-exhausted" | undefined;
958
1001
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1002
+ } | {
1003
+ readonly _tag: "AbortRequested";
1004
+ readonly submissionId: string;
1005
+ readonly author: string;
1006
+ readonly reason: string;
959
1007
  } | {
960
1008
  readonly _tag: "SubmissionSettled";
961
1009
  readonly submissionId: string;
@@ -1205,6 +1253,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1205
1253
  readonly threadId: string;
1206
1254
  };
1207
1255
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1256
+ readonly lifecycle?: "assignment" | undefined;
1208
1257
  readonly targetDigests: {
1209
1258
  readonly agent: string;
1210
1259
  readonly model: string;
@@ -1288,6 +1337,17 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1288
1337
  readonly reportKind?: "update" | undefined;
1289
1338
  };
1290
1339
  readonly inputDigest: string;
1340
+ } | {
1341
+ readonly _tag: "WorkerStopRequested";
1342
+ readonly command: {
1343
+ readonly worker: {
1344
+ readonly schemaVersion: 1;
1345
+ readonly delegationId: string;
1346
+ readonly targetAgentId: string;
1347
+ readonly threadId: string;
1348
+ };
1349
+ readonly idempotencyKey: string;
1350
+ };
1291
1351
  } | {
1292
1352
  readonly _tag: "WorkerOriginRecorded";
1293
1353
  readonly origin: {
@@ -1309,6 +1369,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1309
1369
  readonly threadId: string;
1310
1370
  };
1311
1371
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
1372
+ readonly lifecycle?: "assignment" | undefined;
1312
1373
  readonly targetDigests: {
1313
1374
  readonly agent: string;
1314
1375
  readonly model: string;
@@ -1491,11 +1552,6 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1491
1552
  readonly createdAt: string;
1492
1553
  readonly deploymentId: string;
1493
1554
  readonly payload: {
1494
- readonly _tag: "AbortRequested";
1495
- readonly submissionId: string;
1496
- readonly author: string;
1497
- readonly reason: string;
1498
- } | {
1499
1555
  readonly _tag: "ThreadCreated";
1500
1556
  readonly agentId: string;
1501
1557
  readonly definitions: {
@@ -1773,6 +1829,11 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
1773
1829
  readonly runDisposition?: Schema.Json | undefined;
1774
1830
  readonly finishReason?: "budget-exhausted" | undefined;
1775
1831
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1832
+ } | {
1833
+ readonly _tag: "AbortRequested";
1834
+ readonly submissionId: string;
1835
+ readonly author: string;
1836
+ readonly reason: string;
1776
1837
  } | {
1777
1838
  readonly _tag: "SubmissionSettled";
1778
1839
  readonly submissionId: string;
@@ -2022,6 +2083,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2022
2083
  readonly threadId: string;
2023
2084
  };
2024
2085
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2086
+ readonly lifecycle?: "assignment" | undefined;
2025
2087
  readonly targetDigests: {
2026
2088
  readonly agent: string;
2027
2089
  readonly model: string;
@@ -2105,6 +2167,17 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2105
2167
  readonly reportKind?: "update" | undefined;
2106
2168
  };
2107
2169
  readonly inputDigest: string;
2170
+ } | {
2171
+ readonly _tag: "WorkerStopRequested";
2172
+ readonly command: {
2173
+ readonly worker: {
2174
+ readonly schemaVersion: 1;
2175
+ readonly delegationId: string;
2176
+ readonly targetAgentId: string;
2177
+ readonly threadId: string;
2178
+ };
2179
+ readonly idempotencyKey: string;
2180
+ };
2108
2181
  } | {
2109
2182
  readonly _tag: "WorkerOriginRecorded";
2110
2183
  readonly origin: {
@@ -2126,6 +2199,7 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2126
2199
  readonly threadId: string;
2127
2200
  };
2128
2201
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2202
+ readonly lifecycle?: "assignment" | undefined;
2129
2203
  readonly targetDigests: {
2130
2204
  readonly agent: string;
2131
2205
  readonly model: string;
@@ -2162,64 +2236,669 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2162
2236
  };
2163
2237
  readonly descendantInvocations?: number | undefined;
2164
2238
  };
2165
- readonly grant: {
2166
- readonly allowedToolNames: readonly string[];
2167
- readonly maxDepth: number;
2168
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2239
+ readonly grant: {
2240
+ readonly allowedToolNames: readonly string[];
2241
+ readonly maxDepth: number;
2242
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2243
+ };
2244
+ readonly depth: number;
2245
+ readonly toolCallAllowance?: number | undefined;
2246
+ readonly firstMessageId: string;
2247
+ readonly createdAtMillis: number;
2248
+ readonly expiresAtMillis: number;
2249
+ readonly reporting?: {
2250
+ readonly mode?: "standard" | undefined;
2251
+ readonly sourceDigests: {
2252
+ readonly agent: string;
2253
+ readonly model: string;
2254
+ readonly tools: string;
2255
+ readonly replay?: {
2256
+ readonly agent: string;
2257
+ readonly agentBehavior?: string | undefined;
2258
+ readonly tools: {
2259
+ readonly [x: string]: string;
2260
+ };
2261
+ } | undefined;
2262
+ };
2263
+ readonly destinationDelegationId?: string | undefined;
2264
+ readonly returnAddress?: {
2265
+ readonly input: Schema.Json;
2266
+ readonly principal: string;
2267
+ readonly policy: Schema.Json;
2268
+ readonly depth: number;
2269
+ readonly grant?: {
2270
+ readonly allowedToolNames: readonly string[];
2271
+ readonly maxDepth: number;
2272
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2273
+ } | undefined;
2274
+ readonly workerAdmission?: Schema.Json | undefined;
2275
+ } | undefined;
2276
+ } | undefined;
2277
+ };
2278
+ } | {
2279
+ readonly _tag: "WorkerInputCompleted";
2280
+ readonly messageId: string;
2281
+ readonly workerThreadId: string;
2282
+ readonly submissionId: string;
2283
+ readonly receiptId: string;
2284
+ readonly settlementId: string;
2285
+ readonly completedAtMillis: number;
2286
+ readonly effectsResolved?: true | undefined;
2287
+ } | {
2288
+ readonly _tag: "WorkerReportPrepared";
2289
+ readonly runId: string;
2290
+ readonly messageId: string;
2291
+ readonly envelope: Schema.Json;
2292
+ readonly createdAtMillis: number;
2293
+ readonly deadlineAtMillis: number;
2294
+ readonly predecessor?: string | undefined;
2295
+ } | {
2296
+ readonly _tag: "AgentUpdateEmitted";
2297
+ readonly update: {
2298
+ readonly schemaVersion: 1;
2299
+ readonly agentId: string;
2300
+ readonly threadId: string;
2301
+ readonly runId: string;
2302
+ readonly updateId: string;
2303
+ readonly sequence: number;
2304
+ readonly value: Schema.Json;
2305
+ };
2306
+ readonly definitions: {
2307
+ readonly agent: string;
2308
+ readonly model: string;
2309
+ readonly tools: string;
2310
+ readonly replay?: {
2311
+ readonly agent: string;
2312
+ readonly agentBehavior?: string | undefined;
2313
+ readonly tools: {
2314
+ readonly [x: string]: string;
2315
+ };
2316
+ } | undefined;
2317
+ };
2318
+ readonly delivery?: {
2319
+ readonly messageId: string;
2320
+ readonly envelope: Schema.Json;
2321
+ readonly createdAtMillis: number;
2322
+ readonly deadlineAtMillis: number;
2323
+ readonly predecessor?: string | undefined;
2324
+ } | undefined;
2325
+ } | {
2326
+ readonly _tag: "WorkerReportRefused";
2327
+ readonly runId: string;
2328
+ readonly messageId: string;
2329
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
2330
+ } | {
2331
+ readonly _tag: "PeerMessagePrepared";
2332
+ readonly messageId: string;
2333
+ readonly sourcePrincipal: string;
2334
+ readonly operation: "reply" | "send";
2335
+ readonly deadlineAtMillis: number;
2336
+ readonly encodedEnvelope: Schema.Json;
2337
+ } | {
2338
+ readonly _tag: "SubtreeBudgetReserved";
2339
+ readonly reservationId: string;
2340
+ readonly sourceSubmissionId?: string | undefined;
2341
+ readonly childThreadId: string;
2342
+ readonly lifetime: "attached" | "background";
2343
+ readonly depth: number;
2344
+ readonly policy: Schema.Json;
2345
+ readonly grant: {
2346
+ readonly allowedToolNames: readonly string[];
2347
+ readonly maxDepth: number;
2348
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2349
+ };
2350
+ readonly budget: {
2351
+ readonly caps: {
2352
+ readonly maxTotalChildInvocations?: number | undefined;
2353
+ readonly maxConcurrentChildren?: number | undefined;
2354
+ readonly maxTurns?: number | undefined;
2355
+ readonly maxToolCalls?: number | undefined;
2356
+ readonly maxDurationMillis?: number | undefined;
2357
+ readonly maxInputTokens?: number | undefined;
2358
+ readonly maxOutputTokens?: number | undefined;
2359
+ readonly maxCostMicrousd?: number | undefined;
2360
+ readonly maxResultBytes?: number | undefined;
2361
+ };
2362
+ readonly allocation: {
2363
+ readonly turns: number;
2364
+ readonly toolCalls: number;
2365
+ readonly durationMillis: number;
2366
+ readonly inputTokens: number;
2367
+ readonly outputTokens: number;
2368
+ readonly costMicrousd: number;
2369
+ readonly resultBytes: number;
2370
+ };
2371
+ readonly descendantInvocations?: number | undefined;
2372
+ };
2373
+ } | {
2374
+ readonly _tag: "RepairAnnotated";
2375
+ readonly reason: string;
2376
+ readonly details: Schema.Json;
2377
+ };
2378
+ }[]];
2379
+ };
2380
+ readonly expectedTailSequence: number;
2381
+ readonly expectedTailDigest: string;
2382
+ readonly producerEpoch: number;
2383
+ };
2384
+ } | {
2385
+ readonly _tag: "StoreReadPage";
2386
+ readonly request: {
2387
+ readonly threadId: string;
2388
+ readonly afterSequence?: number | undefined;
2389
+ readonly limit: number;
2390
+ } | {
2391
+ readonly threadId: string;
2392
+ readonly selection: {
2393
+ readonly _tag: "RecordId";
2394
+ readonly recordId: string;
2395
+ } | {
2396
+ readonly _tag: "RunInput";
2397
+ readonly runId: string;
2398
+ } | {
2399
+ readonly _tag: "Outstanding";
2400
+ readonly expectedTailSequence: number;
2401
+ readonly expectedTailDigest: string;
2402
+ } | {
2403
+ readonly _tag: "WorkerExecution";
2404
+ readonly expectedTailSequence: number;
2405
+ readonly expectedTailDigest: string;
2406
+ } | {
2407
+ readonly _tag: "WorkerState";
2408
+ readonly expectedTailSequence: number;
2409
+ readonly expectedTailDigest: string;
2410
+ readonly sourceSubmissionId?: string | undefined;
2411
+ };
2412
+ readonly page: {
2413
+ readonly afterSequence?: number | undefined;
2414
+ readonly limit: number;
2415
+ };
2416
+ };
2417
+ } | {
2418
+ readonly _tag: "StoreInspectTail";
2419
+ readonly request: {
2420
+ readonly threadId: string;
2421
+ };
2422
+ } | {
2423
+ readonly _tag: "StoreExport";
2424
+ readonly request: {
2425
+ readonly threadId: string;
2426
+ };
2427
+ } | {
2428
+ readonly _tag: "StoreCountPeerMessages";
2429
+ readonly request: {
2430
+ readonly threadId: string;
2431
+ readonly limit: number;
2432
+ };
2433
+ } | {
2434
+ readonly _tag: "MessageDeliveryList";
2435
+ readonly request: {
2436
+ readonly ownerThreadId: string;
2437
+ readonly limit: number;
2438
+ readonly after?: string | undefined;
2439
+ readonly pendingOnly?: boolean | undefined;
2440
+ readonly workerStarts?: {
2441
+ readonly delegationId: string;
2442
+ readonly targetAgentId: string;
2443
+ } | undefined;
2444
+ readonly pendingWorker?: string | undefined;
2445
+ };
2446
+ }, Schema.SchemaError, never>;
2447
+ export declare const decodePortRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<LedgerAdmitCall | LedgerInspectWorkerCall | LedgerLookupCall | LedgerMarkReadyCall | LedgerRecordChildSettledCall | LedgerRequestAbortCall | LedgerResolveAdmissionCall | LedgerStopWorkerCall | MessageDeliveryListCall | StoreAppendCall | StoreCountPeerMessagesCall | StoreExportCall | StoreInspectTailCall | StoreMaterializeCall | StoreReadPageCall, Schema.SchemaError, never>;
2448
+ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
2449
+ readonly _tag: "PortSucceeded";
2450
+ readonly result: {
2451
+ readonly _tag: "LedgerInspectWorkerResult";
2452
+ readonly state: {
2453
+ readonly latest: {
2454
+ readonly submissionId: string;
2455
+ readonly threadId: string;
2456
+ readonly queueSequence: number;
2457
+ readonly principal: string;
2458
+ readonly idempotencyKey: string;
2459
+ readonly deploymentId: string;
2460
+ readonly receiptId: string;
2461
+ readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
2462
+ readonly agentId: string;
2463
+ readonly agentDigests: {
2464
+ readonly agent: string;
2465
+ readonly model: string;
2466
+ readonly tools: string;
2467
+ readonly replay?: {
2468
+ readonly agent: string;
2469
+ readonly agentBehavior?: string | undefined;
2470
+ readonly tools: {
2471
+ readonly [x: string]: string;
2472
+ };
2473
+ } | undefined;
2474
+ };
2475
+ readonly inputPayload: Schema.Json;
2476
+ readonly inputDigest: string;
2477
+ readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
2478
+ readonly createdAt: string;
2479
+ readonly readyAt?: string | undefined;
2480
+ readonly admissionGroup?: string | undefined;
2481
+ readonly admissionFence?: {
2482
+ readonly policyId: string;
2483
+ readonly key: string;
2484
+ readonly revision: string;
2485
+ } | undefined;
2486
+ readonly parentLinkage?: {
2487
+ readonly parentSubmissionId: string;
2488
+ readonly parentToolCallId: string;
2489
+ } | undefined;
2490
+ readonly workerAdmission?: {
2491
+ readonly origin: {
2492
+ readonly worker: {
2493
+ readonly schemaVersion: 1;
2494
+ readonly delegationId: string;
2495
+ readonly targetAgentId: string;
2496
+ readonly threadId: string;
2497
+ };
2498
+ readonly source: {
2499
+ readonly _tag: "tool";
2500
+ readonly agentId: string;
2501
+ readonly threadId: string;
2502
+ readonly runId: string;
2503
+ readonly toolCallId: string;
2504
+ } | {
2505
+ readonly _tag: "programmatic";
2506
+ readonly agentId: string;
2507
+ readonly threadId: string;
2508
+ };
2509
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2510
+ readonly lifecycle?: "assignment" | undefined;
2511
+ readonly targetDigests: {
2512
+ readonly agent: string;
2513
+ readonly model: string;
2514
+ readonly tools: string;
2515
+ readonly replay?: {
2516
+ readonly agent: string;
2517
+ readonly agentBehavior?: string | undefined;
2518
+ readonly tools: {
2519
+ readonly [x: string]: string;
2520
+ };
2521
+ } | undefined;
2522
+ };
2523
+ readonly policy: Schema.Json;
2524
+ readonly budget: {
2525
+ readonly caps: {
2526
+ readonly maxTotalChildInvocations?: number | undefined;
2527
+ readonly maxConcurrentChildren?: number | undefined;
2528
+ readonly maxTurns?: number | undefined;
2529
+ readonly maxToolCalls?: number | undefined;
2530
+ readonly maxDurationMillis?: number | undefined;
2531
+ readonly maxInputTokens?: number | undefined;
2532
+ readonly maxOutputTokens?: number | undefined;
2533
+ readonly maxCostMicrousd?: number | undefined;
2534
+ readonly maxResultBytes?: number | undefined;
2535
+ };
2536
+ readonly allocation: {
2537
+ readonly turns: number;
2538
+ readonly toolCalls: number;
2539
+ readonly durationMillis: number;
2540
+ readonly inputTokens: number;
2541
+ readonly outputTokens: number;
2542
+ readonly costMicrousd: number;
2543
+ readonly resultBytes: number;
2544
+ };
2545
+ readonly descendantInvocations?: number | undefined;
2546
+ };
2547
+ readonly grant: {
2548
+ readonly allowedToolNames: readonly string[];
2549
+ readonly maxDepth: number;
2550
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2551
+ };
2552
+ readonly depth: number;
2553
+ readonly toolCallAllowance?: number | undefined;
2554
+ readonly firstMessageId: string;
2555
+ readonly createdAtMillis: number;
2556
+ readonly expiresAtMillis: number;
2557
+ readonly reporting?: {
2558
+ readonly mode?: "standard" | undefined;
2559
+ readonly sourceDigests: {
2560
+ readonly agent: string;
2561
+ readonly model: string;
2562
+ readonly tools: string;
2563
+ readonly replay?: {
2564
+ readonly agent: string;
2565
+ readonly agentBehavior?: string | undefined;
2566
+ readonly tools: {
2567
+ readonly [x: string]: string;
2568
+ };
2569
+ } | undefined;
2570
+ };
2571
+ readonly destinationDelegationId?: string | undefined;
2572
+ readonly returnAddress?: {
2573
+ readonly input: Schema.Json;
2574
+ readonly principal: string;
2575
+ readonly policy: Schema.Json;
2576
+ readonly depth: number;
2577
+ readonly grant?: {
2578
+ readonly allowedToolNames: readonly string[];
2579
+ readonly maxDepth: number;
2580
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2581
+ } | undefined;
2582
+ readonly workerAdmission?: Schema.Json | undefined;
2583
+ } | undefined;
2584
+ } | undefined;
2585
+ };
2586
+ readonly messageId: string;
2587
+ readonly parameters: Schema.Json;
2588
+ readonly createdAtMillis: number;
2589
+ readonly sourceSubmissionId?: string | undefined;
2590
+ readonly deliveryPrincipal?: string | undefined;
2591
+ readonly reportKind?: "update" | undefined;
2592
+ } | undefined;
2593
+ readonly messageAdmission?: {
2594
+ readonly schemaVersion: 1;
2595
+ readonly message: {
2596
+ readonly ownerThreadId: string;
2597
+ readonly messageId: string;
2598
+ };
2599
+ readonly peerName: string;
2600
+ readonly sender: {
2601
+ readonly threadId: string;
2602
+ readonly agentId: string;
2603
+ };
2604
+ readonly returnAddress: {
2605
+ readonly threadId: string;
2606
+ readonly agentId: string;
2607
+ };
2608
+ readonly inReplyTo?: {
2609
+ readonly ownerThreadId: string;
2610
+ readonly messageId: string;
2611
+ } | undefined;
2612
+ } | {
2613
+ readonly _tag: "WorkerCompletion";
2614
+ readonly budgetExhausted: boolean;
2615
+ readonly schemaVersion: 1;
2616
+ readonly report: {
2617
+ readonly _tag: "Settled";
2618
+ readonly worker: {
2619
+ readonly schemaVersion: 1;
2620
+ readonly delegationId: string;
2621
+ readonly targetAgentId: string;
2622
+ readonly threadId: string;
2623
+ };
2624
+ readonly receipt: {
2625
+ readonly receiptId: string;
2626
+ readonly submissionId: string;
2627
+ readonly threadId: string;
2628
+ readonly queueSequence: number;
2629
+ };
2630
+ readonly runId: string;
2631
+ readonly settlementId: string;
2632
+ readonly outcome: "completed";
2633
+ readonly result: Schema.Json;
2634
+ } | {
2635
+ readonly _tag: "Settled";
2636
+ readonly worker: {
2637
+ readonly schemaVersion: 1;
2638
+ readonly delegationId: string;
2639
+ readonly targetAgentId: string;
2640
+ readonly threadId: string;
2641
+ };
2642
+ readonly receipt: {
2643
+ readonly receiptId: string;
2644
+ readonly submissionId: string;
2645
+ readonly threadId: string;
2646
+ readonly queueSequence: number;
2647
+ };
2648
+ readonly runId: string;
2649
+ readonly settlementId: string;
2650
+ readonly outcome: "aborted" | "failed";
2651
+ readonly failure: {
2652
+ readonly _tag: "SubagentExecutionFailure";
2653
+ readonly delegationId: string;
2654
+ readonly targetAgentId: string;
2655
+ readonly classification: "child-aborted" | "child-compatibility" | "child-failed" | "declaration-unavailable" | "establishment-denied";
2656
+ readonly childThreadId?: string | undefined;
2657
+ readonly childSubmissionId?: string | undefined;
2658
+ readonly childRunId?: string | undefined;
2659
+ readonly errorTag: string;
2660
+ readonly message: string;
2661
+ };
2662
+ };
2663
+ } | {
2664
+ readonly _tag: "WorkerUpdate";
2665
+ readonly schemaVersion: 1;
2666
+ readonly worker: {
2667
+ readonly schemaVersion: 1;
2668
+ readonly delegationId: string;
2669
+ readonly targetAgentId: string;
2670
+ readonly threadId: string;
2671
+ };
2672
+ readonly update: {
2673
+ readonly schemaVersion: 1;
2674
+ readonly agentId: string;
2675
+ readonly threadId: string;
2676
+ readonly runId: string;
2677
+ readonly updateId: string;
2678
+ readonly sequence: number;
2679
+ readonly value: Schema.Json;
2680
+ };
2681
+ } | undefined;
2682
+ } | null;
2683
+ readonly active: {
2684
+ readonly submissionId: string;
2685
+ readonly threadId: string;
2686
+ readonly queueSequence: number;
2687
+ readonly principal: string;
2688
+ readonly idempotencyKey: string;
2689
+ readonly deploymentId: string;
2690
+ readonly receiptId: string;
2691
+ readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
2692
+ readonly agentId: string;
2693
+ readonly agentDigests: {
2694
+ readonly agent: string;
2695
+ readonly model: string;
2696
+ readonly tools: string;
2697
+ readonly replay?: {
2698
+ readonly agent: string;
2699
+ readonly agentBehavior?: string | undefined;
2700
+ readonly tools: {
2701
+ readonly [x: string]: string;
2702
+ };
2703
+ } | undefined;
2704
+ };
2705
+ readonly inputPayload: Schema.Json;
2706
+ readonly inputDigest: string;
2707
+ readonly settledOutcome?: "aborted" | "completed" | "failed" | undefined;
2708
+ readonly createdAt: string;
2709
+ readonly readyAt?: string | undefined;
2710
+ readonly admissionGroup?: string | undefined;
2711
+ readonly admissionFence?: {
2712
+ readonly policyId: string;
2713
+ readonly key: string;
2714
+ readonly revision: string;
2715
+ } | undefined;
2716
+ readonly parentLinkage?: {
2717
+ readonly parentSubmissionId: string;
2718
+ readonly parentToolCallId: string;
2719
+ } | undefined;
2720
+ readonly workerAdmission?: {
2721
+ readonly origin: {
2722
+ readonly worker: {
2723
+ readonly schemaVersion: 1;
2724
+ readonly delegationId: string;
2725
+ readonly targetAgentId: string;
2726
+ readonly threadId: string;
2727
+ };
2728
+ readonly source: {
2729
+ readonly _tag: "tool";
2730
+ readonly agentId: string;
2731
+ readonly threadId: string;
2732
+ readonly runId: string;
2733
+ readonly toolCallId: string;
2734
+ } | {
2735
+ readonly _tag: "programmatic";
2736
+ readonly agentId: string;
2737
+ readonly threadId: string;
2738
+ };
2739
+ readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2740
+ readonly lifecycle?: "assignment" | undefined;
2741
+ readonly targetDigests: {
2742
+ readonly agent: string;
2743
+ readonly model: string;
2744
+ readonly tools: string;
2745
+ readonly replay?: {
2746
+ readonly agent: string;
2747
+ readonly agentBehavior?: string | undefined;
2748
+ readonly tools: {
2749
+ readonly [x: string]: string;
2750
+ };
2751
+ } | undefined;
2752
+ };
2753
+ readonly policy: Schema.Json;
2754
+ readonly budget: {
2755
+ readonly caps: {
2756
+ readonly maxTotalChildInvocations?: number | undefined;
2757
+ readonly maxConcurrentChildren?: number | undefined;
2758
+ readonly maxTurns?: number | undefined;
2759
+ readonly maxToolCalls?: number | undefined;
2760
+ readonly maxDurationMillis?: number | undefined;
2761
+ readonly maxInputTokens?: number | undefined;
2762
+ readonly maxOutputTokens?: number | undefined;
2763
+ readonly maxCostMicrousd?: number | undefined;
2764
+ readonly maxResultBytes?: number | undefined;
2765
+ };
2766
+ readonly allocation: {
2767
+ readonly turns: number;
2768
+ readonly toolCalls: number;
2769
+ readonly durationMillis: number;
2770
+ readonly inputTokens: number;
2771
+ readonly outputTokens: number;
2772
+ readonly costMicrousd: number;
2773
+ readonly resultBytes: number;
2774
+ };
2775
+ readonly descendantInvocations?: number | undefined;
2776
+ };
2777
+ readonly grant: {
2778
+ readonly allowedToolNames: readonly string[];
2779
+ readonly maxDepth: number;
2780
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2781
+ };
2782
+ readonly depth: number;
2783
+ readonly toolCallAllowance?: number | undefined;
2784
+ readonly firstMessageId: string;
2785
+ readonly createdAtMillis: number;
2786
+ readonly expiresAtMillis: number;
2787
+ readonly reporting?: {
2788
+ readonly mode?: "standard" | undefined;
2789
+ readonly sourceDigests: {
2790
+ readonly agent: string;
2791
+ readonly model: string;
2792
+ readonly tools: string;
2793
+ readonly replay?: {
2794
+ readonly agent: string;
2795
+ readonly agentBehavior?: string | undefined;
2796
+ readonly tools: {
2797
+ readonly [x: string]: string;
2798
+ };
2799
+ } | undefined;
2800
+ };
2801
+ readonly destinationDelegationId?: string | undefined;
2802
+ readonly returnAddress?: {
2803
+ readonly input: Schema.Json;
2804
+ readonly principal: string;
2805
+ readonly policy: Schema.Json;
2806
+ readonly depth: number;
2807
+ readonly grant?: {
2808
+ readonly allowedToolNames: readonly string[];
2809
+ readonly maxDepth: number;
2810
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2811
+ } | undefined;
2812
+ readonly workerAdmission?: Schema.Json | undefined;
2813
+ } | undefined;
2814
+ } | undefined;
2815
+ };
2816
+ readonly messageId: string;
2817
+ readonly parameters: Schema.Json;
2818
+ readonly createdAtMillis: number;
2819
+ readonly sourceSubmissionId?: string | undefined;
2820
+ readonly deliveryPrincipal?: string | undefined;
2821
+ readonly reportKind?: "update" | undefined;
2822
+ } | undefined;
2823
+ readonly messageAdmission?: {
2824
+ readonly schemaVersion: 1;
2825
+ readonly message: {
2826
+ readonly ownerThreadId: string;
2827
+ readonly messageId: string;
2828
+ };
2829
+ readonly peerName: string;
2830
+ readonly sender: {
2831
+ readonly threadId: string;
2832
+ readonly agentId: string;
2833
+ };
2834
+ readonly returnAddress: {
2835
+ readonly threadId: string;
2836
+ readonly agentId: string;
2837
+ };
2838
+ readonly inReplyTo?: {
2839
+ readonly ownerThreadId: string;
2840
+ readonly messageId: string;
2841
+ } | undefined;
2842
+ } | {
2843
+ readonly _tag: "WorkerCompletion";
2844
+ readonly budgetExhausted: boolean;
2845
+ readonly schemaVersion: 1;
2846
+ readonly report: {
2847
+ readonly _tag: "Settled";
2848
+ readonly worker: {
2849
+ readonly schemaVersion: 1;
2850
+ readonly delegationId: string;
2851
+ readonly targetAgentId: string;
2852
+ readonly threadId: string;
2853
+ };
2854
+ readonly receipt: {
2855
+ readonly receiptId: string;
2856
+ readonly submissionId: string;
2857
+ readonly threadId: string;
2858
+ readonly queueSequence: number;
2859
+ };
2860
+ readonly runId: string;
2861
+ readonly settlementId: string;
2862
+ readonly outcome: "completed";
2863
+ readonly result: Schema.Json;
2864
+ } | {
2865
+ readonly _tag: "Settled";
2866
+ readonly worker: {
2867
+ readonly schemaVersion: 1;
2868
+ readonly delegationId: string;
2869
+ readonly targetAgentId: string;
2870
+ readonly threadId: string;
2871
+ };
2872
+ readonly receipt: {
2873
+ readonly receiptId: string;
2874
+ readonly submissionId: string;
2875
+ readonly threadId: string;
2876
+ readonly queueSequence: number;
2877
+ };
2878
+ readonly runId: string;
2879
+ readonly settlementId: string;
2880
+ readonly outcome: "aborted" | "failed";
2881
+ readonly failure: {
2882
+ readonly _tag: "SubagentExecutionFailure";
2883
+ readonly delegationId: string;
2884
+ readonly targetAgentId: string;
2885
+ readonly classification: "child-aborted" | "child-compatibility" | "child-failed" | "declaration-unavailable" | "establishment-denied";
2886
+ readonly childThreadId?: string | undefined;
2887
+ readonly childSubmissionId?: string | undefined;
2888
+ readonly childRunId?: string | undefined;
2889
+ readonly errorTag: string;
2890
+ readonly message: string;
2169
2891
  };
2170
- readonly depth: number;
2171
- readonly toolCallAllowance?: number | undefined;
2172
- readonly firstMessageId: string;
2173
- readonly createdAtMillis: number;
2174
- readonly expiresAtMillis: number;
2175
- readonly reporting?: {
2176
- readonly mode?: "standard" | undefined;
2177
- readonly sourceDigests: {
2178
- readonly agent: string;
2179
- readonly model: string;
2180
- readonly tools: string;
2181
- readonly replay?: {
2182
- readonly agent: string;
2183
- readonly agentBehavior?: string | undefined;
2184
- readonly tools: {
2185
- readonly [x: string]: string;
2186
- };
2187
- } | undefined;
2188
- };
2189
- readonly destinationDelegationId?: string | undefined;
2190
- readonly returnAddress?: {
2191
- readonly input: Schema.Json;
2192
- readonly principal: string;
2193
- readonly policy: Schema.Json;
2194
- readonly depth: number;
2195
- readonly grant?: {
2196
- readonly allowedToolNames: readonly string[];
2197
- readonly maxDepth: number;
2198
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2199
- } | undefined;
2200
- readonly workerAdmission?: Schema.Json | undefined;
2201
- } | undefined;
2202
- } | undefined;
2203
2892
  };
2204
2893
  } | {
2205
- readonly _tag: "WorkerInputCompleted";
2206
- readonly messageId: string;
2207
- readonly workerThreadId: string;
2208
- readonly submissionId: string;
2209
- readonly receiptId: string;
2210
- readonly settlementId: string;
2211
- readonly completedAtMillis: number;
2212
- readonly effectsResolved?: true | undefined;
2213
- } | {
2214
- readonly _tag: "WorkerReportPrepared";
2215
- readonly runId: string;
2216
- readonly messageId: string;
2217
- readonly envelope: Schema.Json;
2218
- readonly createdAtMillis: number;
2219
- readonly deadlineAtMillis: number;
2220
- readonly predecessor?: string | undefined;
2221
- } | {
2222
- readonly _tag: "AgentUpdateEmitted";
2894
+ readonly _tag: "WorkerUpdate";
2895
+ readonly schemaVersion: 1;
2896
+ readonly worker: {
2897
+ readonly schemaVersion: 1;
2898
+ readonly delegationId: string;
2899
+ readonly targetAgentId: string;
2900
+ readonly threadId: string;
2901
+ };
2223
2902
  readonly update: {
2224
2903
  readonly schemaVersion: 1;
2225
2904
  readonly agentId: string;
@@ -2229,142 +2908,15 @@ export declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCa
2229
2908
  readonly sequence: number;
2230
2909
  readonly value: Schema.Json;
2231
2910
  };
2232
- readonly definitions: {
2233
- readonly agent: string;
2234
- readonly model: string;
2235
- readonly tools: string;
2236
- readonly replay?: {
2237
- readonly agent: string;
2238
- readonly agentBehavior?: string | undefined;
2239
- readonly tools: {
2240
- readonly [x: string]: string;
2241
- };
2242
- } | undefined;
2243
- };
2244
- readonly delivery?: {
2245
- readonly messageId: string;
2246
- readonly envelope: Schema.Json;
2247
- readonly createdAtMillis: number;
2248
- readonly deadlineAtMillis: number;
2249
- readonly predecessor?: string | undefined;
2250
- } | undefined;
2251
- } | {
2252
- readonly _tag: "WorkerReportRefused";
2253
- readonly runId: string;
2254
- readonly messageId: string;
2255
- readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
2256
- } | {
2257
- readonly _tag: "PeerMessagePrepared";
2258
- readonly messageId: string;
2259
- readonly sourcePrincipal: string;
2260
- readonly operation: "reply" | "send";
2261
- readonly deadlineAtMillis: number;
2262
- readonly encodedEnvelope: Schema.Json;
2263
- } | {
2264
- readonly _tag: "SubtreeBudgetReserved";
2265
- readonly reservationId: string;
2266
- readonly sourceSubmissionId?: string | undefined;
2267
- readonly childThreadId: string;
2268
- readonly lifetime: "attached" | "background";
2269
- readonly depth: number;
2270
- readonly policy: Schema.Json;
2271
- readonly grant: {
2272
- readonly allowedToolNames: readonly string[];
2273
- readonly maxDepth: number;
2274
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2275
- };
2276
- readonly budget: {
2277
- readonly caps: {
2278
- readonly maxTotalChildInvocations?: number | undefined;
2279
- readonly maxConcurrentChildren?: number | undefined;
2280
- readonly maxTurns?: number | undefined;
2281
- readonly maxToolCalls?: number | undefined;
2282
- readonly maxDurationMillis?: number | undefined;
2283
- readonly maxInputTokens?: number | undefined;
2284
- readonly maxOutputTokens?: number | undefined;
2285
- readonly maxCostMicrousd?: number | undefined;
2286
- readonly maxResultBytes?: number | undefined;
2287
- };
2288
- readonly allocation: {
2289
- readonly turns: number;
2290
- readonly toolCalls: number;
2291
- readonly durationMillis: number;
2292
- readonly inputTokens: number;
2293
- readonly outputTokens: number;
2294
- readonly costMicrousd: number;
2295
- readonly resultBytes: number;
2296
- };
2297
- readonly descendantInvocations?: number | undefined;
2298
- };
2299
- } | {
2300
- readonly _tag: "RepairAnnotated";
2301
- readonly reason: string;
2302
- readonly details: Schema.Json;
2303
- };
2304
- }[]];
2911
+ } | undefined;
2912
+ } | null;
2913
+ readonly stopped: boolean;
2914
+ readonly terminal?: "cancelled" | "completed" | "failed" | undefined;
2305
2915
  };
2306
- readonly expectedTailSequence: number;
2307
- readonly expectedTailDigest: string;
2308
- readonly producerEpoch: number;
2309
- };
2310
- } | {
2311
- readonly _tag: "StoreReadPage";
2312
- readonly request: {
2313
- readonly threadId: string;
2314
- readonly afterSequence?: number | undefined;
2315
- readonly limit: number;
2316
2916
  } | {
2317
- readonly threadId: string;
2318
- readonly selection: {
2319
- readonly _tag: "RecordId";
2320
- readonly recordId: string;
2321
- } | {
2322
- readonly _tag: "RunInput";
2323
- readonly runId: string;
2324
- } | {
2325
- readonly _tag: "Outstanding";
2326
- readonly expectedTailSequence: number;
2327
- readonly expectedTailDigest: string;
2328
- } | {
2329
- readonly _tag: "WorkerState";
2330
- readonly expectedTailSequence: number;
2331
- readonly expectedTailDigest: string;
2332
- readonly sourceSubmissionId?: string | undefined;
2333
- };
2334
- readonly page: {
2335
- readonly afterSequence?: number | undefined;
2336
- readonly limit: number;
2337
- };
2338
- };
2339
- } | {
2340
- readonly _tag: "StoreInspectTail";
2341
- readonly request: {
2342
- readonly threadId: string;
2343
- };
2344
- } | {
2345
- readonly _tag: "StoreExport";
2346
- readonly request: {
2347
- readonly threadId: string;
2348
- };
2349
- } | {
2350
- readonly _tag: "StoreCountPeerMessages";
2351
- readonly request: {
2352
- readonly threadId: string;
2353
- readonly limit: number;
2354
- };
2355
- } | {
2356
- readonly _tag: "MessageDeliveryList";
2357
- readonly request: {
2358
- readonly ownerThreadId: string;
2359
- readonly limit: number;
2360
- readonly after?: string | undefined;
2361
- readonly pendingOnly?: boolean | undefined;
2362
- };
2363
- }, Schema.SchemaError, never>;
2364
- 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>;
2365
- export declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<{
2366
- readonly _tag: "PortSucceeded";
2367
- readonly result: {
2917
+ readonly _tag: "LedgerStopWorkerResult";
2918
+ readonly owned: number;
2919
+ } | {
2368
2920
  readonly _tag: "LedgerAdmitResult";
2369
2921
  readonly result: {
2370
2922
  readonly submissionId: string;
@@ -2434,6 +2986,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
2434
2986
  readonly threadId: string;
2435
2987
  };
2436
2988
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
2989
+ readonly lifecycle?: "assignment" | undefined;
2437
2990
  readonly targetDigests: {
2438
2991
  readonly agent: string;
2439
2992
  readonly model: string;
@@ -2669,6 +3222,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
2669
3222
  readonly threadId: string;
2670
3223
  };
2671
3224
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
3225
+ readonly lifecycle?: "assignment" | undefined;
2672
3226
  readonly targetDigests: {
2673
3227
  readonly agent: string;
2674
3228
  readonly model: string;
@@ -2881,11 +3435,6 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
2881
3435
  readonly createdAt: string;
2882
3436
  readonly deploymentId: string;
2883
3437
  readonly payload: {
2884
- readonly _tag: "AbortRequested";
2885
- readonly submissionId: string;
2886
- readonly author: string;
2887
- readonly reason: string;
2888
- } | {
2889
3438
  readonly _tag: "ThreadCreated";
2890
3439
  readonly agentId: string;
2891
3440
  readonly definitions: {
@@ -3163,6 +3712,11 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3163
3712
  readonly runDisposition?: Schema.Json | undefined;
3164
3713
  readonly finishReason?: "budget-exhausted" | undefined;
3165
3714
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
3715
+ } | {
3716
+ readonly _tag: "AbortRequested";
3717
+ readonly submissionId: string;
3718
+ readonly author: string;
3719
+ readonly reason: string;
3166
3720
  } | {
3167
3721
  readonly _tag: "SubmissionSettled";
3168
3722
  readonly submissionId: string;
@@ -3412,6 +3966,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3412
3966
  readonly threadId: string;
3413
3967
  };
3414
3968
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
3969
+ readonly lifecycle?: "assignment" | undefined;
3415
3970
  readonly targetDigests: {
3416
3971
  readonly agent: string;
3417
3972
  readonly model: string;
@@ -3495,6 +4050,17 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3495
4050
  readonly reportKind?: "update" | undefined;
3496
4051
  };
3497
4052
  readonly inputDigest: string;
4053
+ } | {
4054
+ readonly _tag: "WorkerStopRequested";
4055
+ readonly command: {
4056
+ readonly worker: {
4057
+ readonly schemaVersion: 1;
4058
+ readonly delegationId: string;
4059
+ readonly targetAgentId: string;
4060
+ readonly threadId: string;
4061
+ };
4062
+ readonly idempotencyKey: string;
4063
+ };
3498
4064
  } | {
3499
4065
  readonly _tag: "WorkerOriginRecorded";
3500
4066
  readonly origin: {
@@ -3516,6 +4082,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3516
4082
  readonly threadId: string;
3517
4083
  };
3518
4084
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
4085
+ readonly lifecycle?: "assignment" | undefined;
3519
4086
  readonly targetDigests: {
3520
4087
  readonly agent: string;
3521
4088
  readonly model: string;
@@ -3720,11 +4287,6 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
3720
4287
  readonly createdAt: string;
3721
4288
  readonly deploymentId: string;
3722
4289
  readonly payload: {
3723
- readonly _tag: "AbortRequested";
3724
- readonly submissionId: string;
3725
- readonly author: string;
3726
- readonly reason: string;
3727
- } | {
3728
4290
  readonly _tag: "ThreadCreated";
3729
4291
  readonly agentId: string;
3730
4292
  readonly definitions: {
@@ -4002,6 +4564,11 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4002
4564
  readonly runDisposition?: Schema.Json | undefined;
4003
4565
  readonly finishReason?: "budget-exhausted" | undefined;
4004
4566
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
4567
+ } | {
4568
+ readonly _tag: "AbortRequested";
4569
+ readonly submissionId: string;
4570
+ readonly author: string;
4571
+ readonly reason: string;
4005
4572
  } | {
4006
4573
  readonly _tag: "SubmissionSettled";
4007
4574
  readonly submissionId: string;
@@ -4251,6 +4818,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4251
4818
  readonly threadId: string;
4252
4819
  };
4253
4820
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
4821
+ readonly lifecycle?: "assignment" | undefined;
4254
4822
  readonly targetDigests: {
4255
4823
  readonly agent: string;
4256
4824
  readonly model: string;
@@ -4334,6 +4902,17 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4334
4902
  readonly reportKind?: "update" | undefined;
4335
4903
  };
4336
4904
  readonly inputDigest: string;
4905
+ } | {
4906
+ readonly _tag: "WorkerStopRequested";
4907
+ readonly command: {
4908
+ readonly worker: {
4909
+ readonly schemaVersion: 1;
4910
+ readonly delegationId: string;
4911
+ readonly targetAgentId: string;
4912
+ readonly threadId: string;
4913
+ };
4914
+ readonly idempotencyKey: string;
4915
+ };
4337
4916
  } | {
4338
4917
  readonly _tag: "WorkerOriginRecorded";
4339
4918
  readonly origin: {
@@ -4355,6 +4934,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4355
4934
  readonly threadId: string;
4356
4935
  };
4357
4936
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
4937
+ readonly lifecycle?: "assignment" | undefined;
4358
4938
  readonly targetDigests: {
4359
4939
  readonly agent: string;
4360
4940
  readonly model: string;
@@ -4595,6 +5175,7 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4595
5175
  readonly threadId: string;
4596
5176
  };
4597
5177
  readonly budgetScope?: "source-subtree" | "worker-run" | undefined;
5178
+ readonly lifecycle?: "assignment" | undefined;
4598
5179
  readonly targetDigests: {
4599
5180
  readonly agent: string;
4600
5181
  readonly model: string;
@@ -4871,9 +5452,6 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4871
5452
  } | {
4872
5453
  readonly _tag: "PortFailed";
4873
5454
  readonly failure: {
4874
- readonly _tag: "PortProtocolError";
4875
- readonly message: string;
4876
- } | {
4877
5455
  readonly _tag: "MessageDeliveryError";
4878
5456
  readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
4879
5457
  readonly stack?: string | undefined;
@@ -4899,6 +5477,9 @@ export declare const encodePortResponse: (input: PortFailed | PortSucceeded, opt
4899
5477
  readonly issueTag?: string | undefined;
4900
5478
  readonly sequence?: number | undefined;
4901
5479
  } | undefined;
5480
+ } | {
5481
+ readonly _tag: "PortProtocolError";
5482
+ readonly message: string;
4902
5483
  } | {
4903
5484
  readonly _tag: "AdmissionConflict";
4904
5485
  readonly threadId: string;