@effect-agent/storage-cloudflare 0.1.0-beta.56 → 0.1.0-beta.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/DoMemoryStore.d.mts +2 -2
  2. package/dist/DoMemoryStore.mjs +2 -2
  3. package/dist/DoMessageDeliveryStore.d.mts +17 -0
  4. package/dist/DoMessageDeliveryStore.mjs +32 -0
  5. package/dist/DoMessageDeliveryStore.mjs.map +1 -0
  6. package/dist/DoScheduleStore.d.mts +1 -1
  7. package/dist/DoScheduleStore.mjs +2 -2
  8. package/dist/{DoStorageVersion-DxqcVgDE.d.mts → DoStorageVersion-Pt3jEHdW.d.mts} +2 -2
  9. package/dist/DoStorageVersion.d.mts +1 -1
  10. package/dist/DoStorageVersion.mjs +2 -2
  11. package/dist/DoSubmissionLedger.mjs +45 -9
  12. package/dist/DoSubmissionLedger.mjs.map +1 -1
  13. package/dist/DoSubscriptionStore.mjs +1 -1
  14. package/dist/DoThreadStore.d.mts +1 -1
  15. package/dist/DoThreadStore.mjs +432 -5
  16. package/dist/DoThreadStore.mjs.map +1 -0
  17. package/dist/MemoryProtocol.d.mts +1 -1
  18. package/dist/MemoryProtocol.mjs +1 -1
  19. package/dist/PortProtocol.d.mts +1334 -7
  20. package/dist/{DoThreadStore-CCSgDto6.mjs → do-journal-Brv7xSH5.mjs} +186 -456
  21. package/dist/do-journal-Brv7xSH5.mjs.map +1 -0
  22. package/dist/index.d.mts +5 -4
  23. package/dist/index.mjs +6 -5
  24. package/dist/{migrations-B-jiT7vx.mjs → migrations-soC86CQA.mjs} +30 -5
  25. package/dist/migrations-soC86CQA.mjs.map +1 -0
  26. package/package.json +1 -1
  27. package/src/DoMessageDeliveryStore.ts +53 -0
  28. package/src/DoSubmissionLedger.ts +118 -3
  29. package/src/index.ts +1 -0
  30. package/src/internal/do-journal.ts +174 -19
  31. package/src/internal/message-delivery-schema.ts +24 -0
  32. package/src/internal/migrations.ts +6 -1
  33. package/dist/DoThreadStore-CCSgDto6.mjs.map +0 -1
  34. package/dist/migrations-B-jiT7vx.mjs.map +0 -1
@@ -192,6 +192,99 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
192
192
  readonly parentSubmissionId: string;
193
193
  readonly parentToolCallId: string;
194
194
  } | undefined;
195
+ readonly workerAdmission?: {
196
+ readonly origin: {
197
+ readonly worker: {
198
+ readonly schemaVersion: 1;
199
+ readonly delegationId: string;
200
+ readonly targetAgentId: string;
201
+ readonly threadId: string;
202
+ };
203
+ readonly source: {
204
+ readonly _tag: "tool";
205
+ readonly agentId: string;
206
+ readonly threadId: string;
207
+ readonly runId: string;
208
+ readonly toolCallId: string;
209
+ } | {
210
+ readonly _tag: "programmatic";
211
+ readonly agentId: string;
212
+ readonly threadId: string;
213
+ };
214
+ readonly targetDigests: {
215
+ readonly agent: string;
216
+ readonly model: string;
217
+ readonly tools: string;
218
+ };
219
+ readonly policy: Schema.Json;
220
+ readonly budget: {
221
+ readonly caps: {
222
+ readonly maxTotalChildInvocations?: number | undefined;
223
+ readonly maxConcurrentChildren?: number | undefined;
224
+ readonly maxTurns?: number | undefined;
225
+ readonly maxToolCalls?: number | undefined;
226
+ readonly maxDurationMillis?: number | undefined;
227
+ readonly maxInputTokens?: number | undefined;
228
+ readonly maxOutputTokens?: number | undefined;
229
+ readonly maxCostMicrousd?: number | undefined;
230
+ readonly maxResultBytes?: number | undefined;
231
+ };
232
+ readonly allocation: {
233
+ readonly turns: number;
234
+ readonly toolCalls: number;
235
+ readonly durationMillis: number;
236
+ readonly inputTokens: number;
237
+ readonly outputTokens: number;
238
+ readonly costMicrousd: number;
239
+ readonly resultBytes: number;
240
+ };
241
+ readonly descendantInvocations?: number | undefined;
242
+ };
243
+ readonly grant: {
244
+ readonly allowedToolNames: readonly string[];
245
+ readonly maxDepth: number;
246
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
247
+ };
248
+ readonly depth: number;
249
+ readonly toolCallAllowance?: number | undefined;
250
+ readonly firstMessageId: string;
251
+ readonly createdAtMillis: number;
252
+ readonly expiresAtMillis: number;
253
+ readonly reporting?: {
254
+ readonly sourceDigests: {
255
+ readonly agent: string;
256
+ readonly model: string;
257
+ readonly tools: string;
258
+ };
259
+ readonly destinationDelegationId?: string | undefined;
260
+ } | undefined;
261
+ };
262
+ readonly messageId: string;
263
+ readonly parameters: Schema.Json;
264
+ readonly createdAtMillis: number;
265
+ readonly sourceSubmissionId?: string | undefined;
266
+ readonly deliveryPrincipal?: string | undefined;
267
+ } | undefined;
268
+ readonly messageAdmission?: {
269
+ readonly schemaVersion: 1;
270
+ readonly message: {
271
+ readonly ownerThreadId: string;
272
+ readonly messageId: string;
273
+ };
274
+ readonly peerName: string;
275
+ readonly sender: {
276
+ readonly threadId: string;
277
+ readonly agentId: string;
278
+ };
279
+ readonly returnAddress: {
280
+ readonly threadId: string;
281
+ readonly agentId: string;
282
+ };
283
+ readonly inReplyTo?: {
284
+ readonly ownerThreadId: string;
285
+ readonly messageId: string;
286
+ } | undefined;
287
+ } | undefined;
195
288
  readonly admissionGroup?: string | undefined;
196
289
  readonly admissionFence?: {
197
290
  readonly policyId: string;
@@ -274,6 +367,26 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
274
367
  readonly kind: "follow-up" | "steering" | "user";
275
368
  readonly runId?: string | undefined;
276
369
  readonly input: Schema.Json;
370
+ readonly messageAdmission?: {
371
+ readonly schemaVersion: 1;
372
+ readonly message: {
373
+ readonly ownerThreadId: string;
374
+ readonly messageId: string;
375
+ };
376
+ readonly peerName: string;
377
+ readonly sender: {
378
+ readonly threadId: string;
379
+ readonly agentId: string;
380
+ };
381
+ readonly returnAddress: {
382
+ readonly threadId: string;
383
+ readonly agentId: string;
384
+ };
385
+ readonly inReplyTo?: {
386
+ readonly ownerThreadId: string;
387
+ readonly messageId: string;
388
+ } | undefined;
389
+ } | undefined;
277
390
  } | {
278
391
  readonly _tag: "RunStarted";
279
392
  readonly runId: string;
@@ -327,7 +440,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
327
440
  readonly toolName: string;
328
441
  readonly parameters: Schema.Json;
329
442
  readonly parametersDigest: string;
330
- readonly executionKind?: "delegation" | "ordinary" | undefined;
443
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
331
444
  } | {
332
445
  readonly _tag: "ToolCallSettled";
333
446
  readonly runId: string;
@@ -488,7 +601,14 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
488
601
  readonly costMicrousd: number;
489
602
  readonly resultBytes: number;
490
603
  };
604
+ readonly descendantInvocations?: number | undefined;
605
+ } | undefined;
606
+ readonly grant?: {
607
+ readonly allowedToolNames: readonly string[];
608
+ readonly maxDepth: number;
609
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
491
610
  } | undefined;
611
+ readonly depth?: number | undefined;
492
612
  } | {
493
613
  readonly _tag: "SubagentStarted";
494
614
  readonly runId: string;
@@ -529,6 +649,241 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
529
649
  readonly grantDigest: string;
530
650
  readonly toolCallAllowance?: number | undefined;
531
651
  readonly policy?: Schema.Json | undefined;
652
+ readonly budget?: {
653
+ readonly caps: {
654
+ readonly maxTotalChildInvocations?: number | undefined;
655
+ readonly maxConcurrentChildren?: number | undefined;
656
+ readonly maxTurns?: number | undefined;
657
+ readonly maxToolCalls?: number | undefined;
658
+ readonly maxDurationMillis?: number | undefined;
659
+ readonly maxInputTokens?: number | undefined;
660
+ readonly maxOutputTokens?: number | undefined;
661
+ readonly maxCostMicrousd?: number | undefined;
662
+ readonly maxResultBytes?: number | undefined;
663
+ };
664
+ readonly allocation: {
665
+ readonly turns: number;
666
+ readonly toolCalls: number;
667
+ readonly durationMillis: number;
668
+ readonly inputTokens: number;
669
+ readonly outputTokens: number;
670
+ readonly costMicrousd: number;
671
+ readonly resultBytes: number;
672
+ };
673
+ readonly descendantInvocations?: number | undefined;
674
+ } | undefined;
675
+ readonly grant?: {
676
+ readonly allowedToolNames: readonly string[];
677
+ readonly maxDepth: number;
678
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
679
+ } | undefined;
680
+ } | {
681
+ readonly _tag: "WorkerInputRequested";
682
+ readonly admission: {
683
+ readonly origin: {
684
+ readonly worker: {
685
+ readonly schemaVersion: 1;
686
+ readonly delegationId: string;
687
+ readonly targetAgentId: string;
688
+ readonly threadId: string;
689
+ };
690
+ readonly source: {
691
+ readonly _tag: "tool";
692
+ readonly agentId: string;
693
+ readonly threadId: string;
694
+ readonly runId: string;
695
+ readonly toolCallId: string;
696
+ } | {
697
+ readonly _tag: "programmatic";
698
+ readonly agentId: string;
699
+ readonly threadId: string;
700
+ };
701
+ readonly targetDigests: {
702
+ readonly agent: string;
703
+ readonly model: string;
704
+ readonly tools: string;
705
+ };
706
+ readonly policy: Schema.Json;
707
+ readonly budget: {
708
+ readonly caps: {
709
+ readonly maxTotalChildInvocations?: number | undefined;
710
+ readonly maxConcurrentChildren?: number | undefined;
711
+ readonly maxTurns?: number | undefined;
712
+ readonly maxToolCalls?: number | undefined;
713
+ readonly maxDurationMillis?: number | undefined;
714
+ readonly maxInputTokens?: number | undefined;
715
+ readonly maxOutputTokens?: number | undefined;
716
+ readonly maxCostMicrousd?: number | undefined;
717
+ readonly maxResultBytes?: number | undefined;
718
+ };
719
+ readonly allocation: {
720
+ readonly turns: number;
721
+ readonly toolCalls: number;
722
+ readonly durationMillis: number;
723
+ readonly inputTokens: number;
724
+ readonly outputTokens: number;
725
+ readonly costMicrousd: number;
726
+ readonly resultBytes: number;
727
+ };
728
+ readonly descendantInvocations?: number | undefined;
729
+ };
730
+ readonly grant: {
731
+ readonly allowedToolNames: readonly string[];
732
+ readonly maxDepth: number;
733
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
734
+ };
735
+ readonly depth: number;
736
+ readonly toolCallAllowance?: number | undefined;
737
+ readonly firstMessageId: string;
738
+ readonly createdAtMillis: number;
739
+ readonly expiresAtMillis: number;
740
+ readonly reporting?: {
741
+ readonly sourceDigests: {
742
+ readonly agent: string;
743
+ readonly model: string;
744
+ readonly tools: string;
745
+ };
746
+ readonly destinationDelegationId?: string | undefined;
747
+ } | undefined;
748
+ };
749
+ readonly messageId: string;
750
+ readonly parameters: Schema.Json;
751
+ readonly createdAtMillis: number;
752
+ readonly sourceSubmissionId?: string | undefined;
753
+ readonly deliveryPrincipal?: string | undefined;
754
+ };
755
+ readonly inputDigest: string;
756
+ } | {
757
+ readonly _tag: "WorkerOriginRecorded";
758
+ readonly origin: {
759
+ readonly worker: {
760
+ readonly schemaVersion: 1;
761
+ readonly delegationId: string;
762
+ readonly targetAgentId: string;
763
+ readonly threadId: string;
764
+ };
765
+ readonly source: {
766
+ readonly _tag: "tool";
767
+ readonly agentId: string;
768
+ readonly threadId: string;
769
+ readonly runId: string;
770
+ readonly toolCallId: string;
771
+ } | {
772
+ readonly _tag: "programmatic";
773
+ readonly agentId: string;
774
+ readonly threadId: string;
775
+ };
776
+ readonly targetDigests: {
777
+ readonly agent: string;
778
+ readonly model: string;
779
+ readonly tools: string;
780
+ };
781
+ readonly policy: Schema.Json;
782
+ readonly budget: {
783
+ readonly caps: {
784
+ readonly maxTotalChildInvocations?: number | undefined;
785
+ readonly maxConcurrentChildren?: number | undefined;
786
+ readonly maxTurns?: number | undefined;
787
+ readonly maxToolCalls?: number | undefined;
788
+ readonly maxDurationMillis?: number | undefined;
789
+ readonly maxInputTokens?: number | undefined;
790
+ readonly maxOutputTokens?: number | undefined;
791
+ readonly maxCostMicrousd?: number | undefined;
792
+ readonly maxResultBytes?: number | undefined;
793
+ };
794
+ readonly allocation: {
795
+ readonly turns: number;
796
+ readonly toolCalls: number;
797
+ readonly durationMillis: number;
798
+ readonly inputTokens: number;
799
+ readonly outputTokens: number;
800
+ readonly costMicrousd: number;
801
+ readonly resultBytes: number;
802
+ };
803
+ readonly descendantInvocations?: number | undefined;
804
+ };
805
+ readonly grant: {
806
+ readonly allowedToolNames: readonly string[];
807
+ readonly maxDepth: number;
808
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
809
+ };
810
+ readonly depth: number;
811
+ readonly toolCallAllowance?: number | undefined;
812
+ readonly firstMessageId: string;
813
+ readonly createdAtMillis: number;
814
+ readonly expiresAtMillis: number;
815
+ readonly reporting?: {
816
+ readonly sourceDigests: {
817
+ readonly agent: string;
818
+ readonly model: string;
819
+ readonly tools: string;
820
+ };
821
+ readonly destinationDelegationId?: string | undefined;
822
+ } | undefined;
823
+ };
824
+ } | {
825
+ readonly _tag: "WorkerInputCompleted";
826
+ readonly messageId: string;
827
+ readonly workerThreadId: string;
828
+ readonly submissionId: string;
829
+ readonly receiptId: string;
830
+ readonly settlementId: string;
831
+ readonly completedAtMillis: number;
832
+ } | {
833
+ readonly _tag: "WorkerReportPrepared";
834
+ readonly runId: string;
835
+ readonly messageId: string;
836
+ readonly envelope: Schema.Json;
837
+ readonly createdAtMillis: number;
838
+ readonly deadlineAtMillis: number;
839
+ } | {
840
+ readonly _tag: "WorkerReportRefused";
841
+ readonly runId: string;
842
+ readonly messageId: string;
843
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
844
+ } | {
845
+ readonly _tag: "PeerMessagePrepared";
846
+ readonly messageId: string;
847
+ readonly sourcePrincipal: string;
848
+ readonly operation: "reply" | "send";
849
+ readonly deadlineAtMillis: number;
850
+ readonly encodedEnvelope: Schema.Json;
851
+ } | {
852
+ readonly _tag: "SubtreeBudgetReserved";
853
+ readonly reservationId: string;
854
+ readonly sourceSubmissionId?: string | undefined;
855
+ readonly childThreadId: string;
856
+ readonly lifetime: "attached" | "background";
857
+ readonly depth: number;
858
+ readonly policy: Schema.Json;
859
+ readonly grant: {
860
+ readonly allowedToolNames: readonly string[];
861
+ readonly maxDepth: number;
862
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
863
+ };
864
+ readonly budget: {
865
+ readonly caps: {
866
+ readonly maxTotalChildInvocations?: number | undefined;
867
+ readonly maxConcurrentChildren?: number | undefined;
868
+ readonly maxTurns?: number | undefined;
869
+ readonly maxToolCalls?: number | undefined;
870
+ readonly maxDurationMillis?: number | undefined;
871
+ readonly maxInputTokens?: number | undefined;
872
+ readonly maxOutputTokens?: number | undefined;
873
+ readonly maxCostMicrousd?: number | undefined;
874
+ readonly maxResultBytes?: number | undefined;
875
+ };
876
+ readonly allocation: {
877
+ readonly turns: number;
878
+ readonly toolCalls: number;
879
+ readonly durationMillis: number;
880
+ readonly inputTokens: number;
881
+ readonly outputTokens: number;
882
+ readonly costMicrousd: number;
883
+ readonly resultBytes: number;
884
+ };
885
+ readonly descendantInvocations?: number | undefined;
886
+ };
532
887
  } | {
533
888
  readonly _tag: "RepairAnnotated";
534
889
  readonly reason: string;
@@ -559,6 +914,26 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
559
914
  readonly kind: "follow-up" | "steering" | "user";
560
915
  readonly runId?: string | undefined;
561
916
  readonly input: Schema.Json;
917
+ readonly messageAdmission?: {
918
+ readonly schemaVersion: 1;
919
+ readonly message: {
920
+ readonly ownerThreadId: string;
921
+ readonly messageId: string;
922
+ };
923
+ readonly peerName: string;
924
+ readonly sender: {
925
+ readonly threadId: string;
926
+ readonly agentId: string;
927
+ };
928
+ readonly returnAddress: {
929
+ readonly threadId: string;
930
+ readonly agentId: string;
931
+ };
932
+ readonly inReplyTo?: {
933
+ readonly ownerThreadId: string;
934
+ readonly messageId: string;
935
+ } | undefined;
936
+ } | undefined;
562
937
  } | {
563
938
  readonly _tag: "RunStarted";
564
939
  readonly runId: string;
@@ -612,7 +987,7 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
612
987
  readonly toolName: string;
613
988
  readonly parameters: Schema.Json;
614
989
  readonly parametersDigest: string;
615
- readonly executionKind?: "delegation" | "ordinary" | undefined;
990
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
616
991
  } | {
617
992
  readonly _tag: "ToolCallSettled";
618
993
  readonly runId: string;
@@ -773,7 +1148,14 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
773
1148
  readonly costMicrousd: number;
774
1149
  readonly resultBytes: number;
775
1150
  };
1151
+ readonly descendantInvocations?: number | undefined;
776
1152
  } | undefined;
1153
+ readonly grant?: {
1154
+ readonly allowedToolNames: readonly string[];
1155
+ readonly maxDepth: number;
1156
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1157
+ } | undefined;
1158
+ readonly depth?: number | undefined;
777
1159
  } | {
778
1160
  readonly _tag: "SubagentStarted";
779
1161
  readonly runId: string;
@@ -814,6 +1196,241 @@ declare const encodePortRequest: (input: LedgerAdmitCall | LedgerLookupCall | Le
814
1196
  readonly grantDigest: string;
815
1197
  readonly toolCallAllowance?: number | undefined;
816
1198
  readonly policy?: Schema.Json | undefined;
1199
+ readonly budget?: {
1200
+ readonly caps: {
1201
+ readonly maxTotalChildInvocations?: number | undefined;
1202
+ readonly maxConcurrentChildren?: number | undefined;
1203
+ readonly maxTurns?: number | undefined;
1204
+ readonly maxToolCalls?: number | undefined;
1205
+ readonly maxDurationMillis?: number | undefined;
1206
+ readonly maxInputTokens?: number | undefined;
1207
+ readonly maxOutputTokens?: number | undefined;
1208
+ readonly maxCostMicrousd?: number | undefined;
1209
+ readonly maxResultBytes?: number | undefined;
1210
+ };
1211
+ readonly allocation: {
1212
+ readonly turns: number;
1213
+ readonly toolCalls: number;
1214
+ readonly durationMillis: number;
1215
+ readonly inputTokens: number;
1216
+ readonly outputTokens: number;
1217
+ readonly costMicrousd: number;
1218
+ readonly resultBytes: number;
1219
+ };
1220
+ readonly descendantInvocations?: number | undefined;
1221
+ } | undefined;
1222
+ readonly grant?: {
1223
+ readonly allowedToolNames: readonly string[];
1224
+ readonly maxDepth: number;
1225
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1226
+ } | undefined;
1227
+ } | {
1228
+ readonly _tag: "WorkerInputRequested";
1229
+ readonly admission: {
1230
+ readonly origin: {
1231
+ readonly worker: {
1232
+ readonly schemaVersion: 1;
1233
+ readonly delegationId: string;
1234
+ readonly targetAgentId: string;
1235
+ readonly threadId: string;
1236
+ };
1237
+ readonly source: {
1238
+ readonly _tag: "tool";
1239
+ readonly agentId: string;
1240
+ readonly threadId: string;
1241
+ readonly runId: string;
1242
+ readonly toolCallId: string;
1243
+ } | {
1244
+ readonly _tag: "programmatic";
1245
+ readonly agentId: string;
1246
+ readonly threadId: string;
1247
+ };
1248
+ readonly targetDigests: {
1249
+ readonly agent: string;
1250
+ readonly model: string;
1251
+ readonly tools: string;
1252
+ };
1253
+ readonly policy: Schema.Json;
1254
+ readonly budget: {
1255
+ readonly caps: {
1256
+ readonly maxTotalChildInvocations?: number | undefined;
1257
+ readonly maxConcurrentChildren?: number | undefined;
1258
+ readonly maxTurns?: number | undefined;
1259
+ readonly maxToolCalls?: number | undefined;
1260
+ readonly maxDurationMillis?: number | undefined;
1261
+ readonly maxInputTokens?: number | undefined;
1262
+ readonly maxOutputTokens?: number | undefined;
1263
+ readonly maxCostMicrousd?: number | undefined;
1264
+ readonly maxResultBytes?: number | undefined;
1265
+ };
1266
+ readonly allocation: {
1267
+ readonly turns: number;
1268
+ readonly toolCalls: number;
1269
+ readonly durationMillis: number;
1270
+ readonly inputTokens: number;
1271
+ readonly outputTokens: number;
1272
+ readonly costMicrousd: number;
1273
+ readonly resultBytes: number;
1274
+ };
1275
+ readonly descendantInvocations?: number | undefined;
1276
+ };
1277
+ readonly grant: {
1278
+ readonly allowedToolNames: readonly string[];
1279
+ readonly maxDepth: number;
1280
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1281
+ };
1282
+ readonly depth: number;
1283
+ readonly toolCallAllowance?: number | undefined;
1284
+ readonly firstMessageId: string;
1285
+ readonly createdAtMillis: number;
1286
+ readonly expiresAtMillis: number;
1287
+ readonly reporting?: {
1288
+ readonly sourceDigests: {
1289
+ readonly agent: string;
1290
+ readonly model: string;
1291
+ readonly tools: string;
1292
+ };
1293
+ readonly destinationDelegationId?: string | undefined;
1294
+ } | undefined;
1295
+ };
1296
+ readonly messageId: string;
1297
+ readonly parameters: Schema.Json;
1298
+ readonly createdAtMillis: number;
1299
+ readonly sourceSubmissionId?: string | undefined;
1300
+ readonly deliveryPrincipal?: string | undefined;
1301
+ };
1302
+ readonly inputDigest: string;
1303
+ } | {
1304
+ readonly _tag: "WorkerOriginRecorded";
1305
+ readonly origin: {
1306
+ readonly worker: {
1307
+ readonly schemaVersion: 1;
1308
+ readonly delegationId: string;
1309
+ readonly targetAgentId: string;
1310
+ readonly threadId: string;
1311
+ };
1312
+ readonly source: {
1313
+ readonly _tag: "tool";
1314
+ readonly agentId: string;
1315
+ readonly threadId: string;
1316
+ readonly runId: string;
1317
+ readonly toolCallId: string;
1318
+ } | {
1319
+ readonly _tag: "programmatic";
1320
+ readonly agentId: string;
1321
+ readonly threadId: string;
1322
+ };
1323
+ readonly targetDigests: {
1324
+ readonly agent: string;
1325
+ readonly model: string;
1326
+ readonly tools: string;
1327
+ };
1328
+ readonly policy: Schema.Json;
1329
+ readonly budget: {
1330
+ readonly caps: {
1331
+ readonly maxTotalChildInvocations?: number | undefined;
1332
+ readonly maxConcurrentChildren?: number | undefined;
1333
+ readonly maxTurns?: number | undefined;
1334
+ readonly maxToolCalls?: number | undefined;
1335
+ readonly maxDurationMillis?: number | undefined;
1336
+ readonly maxInputTokens?: number | undefined;
1337
+ readonly maxOutputTokens?: number | undefined;
1338
+ readonly maxCostMicrousd?: number | undefined;
1339
+ readonly maxResultBytes?: number | undefined;
1340
+ };
1341
+ readonly allocation: {
1342
+ readonly turns: number;
1343
+ readonly toolCalls: number;
1344
+ readonly durationMillis: number;
1345
+ readonly inputTokens: number;
1346
+ readonly outputTokens: number;
1347
+ readonly costMicrousd: number;
1348
+ readonly resultBytes: number;
1349
+ };
1350
+ readonly descendantInvocations?: number | undefined;
1351
+ };
1352
+ readonly grant: {
1353
+ readonly allowedToolNames: readonly string[];
1354
+ readonly maxDepth: number;
1355
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1356
+ };
1357
+ readonly depth: number;
1358
+ readonly toolCallAllowance?: number | undefined;
1359
+ readonly firstMessageId: string;
1360
+ readonly createdAtMillis: number;
1361
+ readonly expiresAtMillis: number;
1362
+ readonly reporting?: {
1363
+ readonly sourceDigests: {
1364
+ readonly agent: string;
1365
+ readonly model: string;
1366
+ readonly tools: string;
1367
+ };
1368
+ readonly destinationDelegationId?: string | undefined;
1369
+ } | undefined;
1370
+ };
1371
+ } | {
1372
+ readonly _tag: "WorkerInputCompleted";
1373
+ readonly messageId: string;
1374
+ readonly workerThreadId: string;
1375
+ readonly submissionId: string;
1376
+ readonly receiptId: string;
1377
+ readonly settlementId: string;
1378
+ readonly completedAtMillis: number;
1379
+ } | {
1380
+ readonly _tag: "WorkerReportPrepared";
1381
+ readonly runId: string;
1382
+ readonly messageId: string;
1383
+ readonly envelope: Schema.Json;
1384
+ readonly createdAtMillis: number;
1385
+ readonly deadlineAtMillis: number;
1386
+ } | {
1387
+ readonly _tag: "WorkerReportRefused";
1388
+ readonly runId: string;
1389
+ readonly messageId: string;
1390
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
1391
+ } | {
1392
+ readonly _tag: "PeerMessagePrepared";
1393
+ readonly messageId: string;
1394
+ readonly sourcePrincipal: string;
1395
+ readonly operation: "reply" | "send";
1396
+ readonly deadlineAtMillis: number;
1397
+ readonly encodedEnvelope: Schema.Json;
1398
+ } | {
1399
+ readonly _tag: "SubtreeBudgetReserved";
1400
+ readonly reservationId: string;
1401
+ readonly sourceSubmissionId?: string | undefined;
1402
+ readonly childThreadId: string;
1403
+ readonly lifetime: "attached" | "background";
1404
+ readonly depth: number;
1405
+ readonly policy: Schema.Json;
1406
+ readonly grant: {
1407
+ readonly allowedToolNames: readonly string[];
1408
+ readonly maxDepth: number;
1409
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1410
+ };
1411
+ readonly budget: {
1412
+ readonly caps: {
1413
+ readonly maxTotalChildInvocations?: number | undefined;
1414
+ readonly maxConcurrentChildren?: number | undefined;
1415
+ readonly maxTurns?: number | undefined;
1416
+ readonly maxToolCalls?: number | undefined;
1417
+ readonly maxDurationMillis?: number | undefined;
1418
+ readonly maxInputTokens?: number | undefined;
1419
+ readonly maxOutputTokens?: number | undefined;
1420
+ readonly maxCostMicrousd?: number | undefined;
1421
+ readonly maxResultBytes?: number | undefined;
1422
+ };
1423
+ readonly allocation: {
1424
+ readonly turns: number;
1425
+ readonly toolCalls: number;
1426
+ readonly durationMillis: number;
1427
+ readonly inputTokens: number;
1428
+ readonly outputTokens: number;
1429
+ readonly costMicrousd: number;
1430
+ readonly resultBytes: number;
1431
+ };
1432
+ readonly descendantInvocations?: number | undefined;
1433
+ };
817
1434
  } | {
818
1435
  readonly _tag: "RepairAnnotated";
819
1436
  readonly reason: string;
@@ -885,9 +1502,102 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
885
1502
  readonly key: string;
886
1503
  readonly revision: string;
887
1504
  } | undefined;
888
- readonly parentLinkage?: {
889
- readonly parentSubmissionId: string;
890
- readonly parentToolCallId: string;
1505
+ readonly parentLinkage?: {
1506
+ readonly parentSubmissionId: string;
1507
+ readonly parentToolCallId: string;
1508
+ } | undefined;
1509
+ readonly workerAdmission?: {
1510
+ readonly origin: {
1511
+ readonly worker: {
1512
+ readonly schemaVersion: 1;
1513
+ readonly delegationId: string;
1514
+ readonly targetAgentId: string;
1515
+ readonly threadId: string;
1516
+ };
1517
+ readonly source: {
1518
+ readonly _tag: "tool";
1519
+ readonly agentId: string;
1520
+ readonly threadId: string;
1521
+ readonly runId: string;
1522
+ readonly toolCallId: string;
1523
+ } | {
1524
+ readonly _tag: "programmatic";
1525
+ readonly agentId: string;
1526
+ readonly threadId: string;
1527
+ };
1528
+ readonly targetDigests: {
1529
+ readonly agent: string;
1530
+ readonly model: string;
1531
+ readonly tools: string;
1532
+ };
1533
+ readonly policy: Schema.Json;
1534
+ readonly budget: {
1535
+ readonly caps: {
1536
+ readonly maxTotalChildInvocations?: number | undefined;
1537
+ readonly maxConcurrentChildren?: number | undefined;
1538
+ readonly maxTurns?: number | undefined;
1539
+ readonly maxToolCalls?: number | undefined;
1540
+ readonly maxDurationMillis?: number | undefined;
1541
+ readonly maxInputTokens?: number | undefined;
1542
+ readonly maxOutputTokens?: number | undefined;
1543
+ readonly maxCostMicrousd?: number | undefined;
1544
+ readonly maxResultBytes?: number | undefined;
1545
+ };
1546
+ readonly allocation: {
1547
+ readonly turns: number;
1548
+ readonly toolCalls: number;
1549
+ readonly durationMillis: number;
1550
+ readonly inputTokens: number;
1551
+ readonly outputTokens: number;
1552
+ readonly costMicrousd: number;
1553
+ readonly resultBytes: number;
1554
+ };
1555
+ readonly descendantInvocations?: number | undefined;
1556
+ };
1557
+ readonly grant: {
1558
+ readonly allowedToolNames: readonly string[];
1559
+ readonly maxDepth: number;
1560
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1561
+ };
1562
+ readonly depth: number;
1563
+ readonly toolCallAllowance?: number | undefined;
1564
+ readonly firstMessageId: string;
1565
+ readonly createdAtMillis: number;
1566
+ readonly expiresAtMillis: number;
1567
+ readonly reporting?: {
1568
+ readonly sourceDigests: {
1569
+ readonly agent: string;
1570
+ readonly model: string;
1571
+ readonly tools: string;
1572
+ };
1573
+ readonly destinationDelegationId?: string | undefined;
1574
+ } | undefined;
1575
+ };
1576
+ readonly messageId: string;
1577
+ readonly parameters: Schema.Json;
1578
+ readonly createdAtMillis: number;
1579
+ readonly sourceSubmissionId?: string | undefined;
1580
+ readonly deliveryPrincipal?: string | undefined;
1581
+ } | undefined;
1582
+ readonly messageAdmission?: {
1583
+ readonly schemaVersion: 1;
1584
+ readonly message: {
1585
+ readonly ownerThreadId: string;
1586
+ readonly messageId: string;
1587
+ };
1588
+ readonly peerName: string;
1589
+ readonly sender: {
1590
+ readonly threadId: string;
1591
+ readonly agentId: string;
1592
+ };
1593
+ readonly returnAddress: {
1594
+ readonly threadId: string;
1595
+ readonly agentId: string;
1596
+ };
1597
+ readonly inReplyTo?: {
1598
+ readonly ownerThreadId: string;
1599
+ readonly messageId: string;
1600
+ } | undefined;
891
1601
  } | undefined;
892
1602
  } | undefined;
893
1603
  } | {
@@ -926,6 +1636,99 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
926
1636
  readonly parentSubmissionId: string;
927
1637
  readonly parentToolCallId: string;
928
1638
  } | undefined;
1639
+ readonly workerAdmission?: {
1640
+ readonly origin: {
1641
+ readonly worker: {
1642
+ readonly schemaVersion: 1;
1643
+ readonly delegationId: string;
1644
+ readonly targetAgentId: string;
1645
+ readonly threadId: string;
1646
+ };
1647
+ readonly source: {
1648
+ readonly _tag: "tool";
1649
+ readonly agentId: string;
1650
+ readonly threadId: string;
1651
+ readonly runId: string;
1652
+ readonly toolCallId: string;
1653
+ } | {
1654
+ readonly _tag: "programmatic";
1655
+ readonly agentId: string;
1656
+ readonly threadId: string;
1657
+ };
1658
+ readonly targetDigests: {
1659
+ readonly agent: string;
1660
+ readonly model: string;
1661
+ readonly tools: string;
1662
+ };
1663
+ readonly policy: Schema.Json;
1664
+ readonly budget: {
1665
+ readonly caps: {
1666
+ readonly maxTotalChildInvocations?: number | undefined;
1667
+ readonly maxConcurrentChildren?: number | undefined;
1668
+ readonly maxTurns?: number | undefined;
1669
+ readonly maxToolCalls?: number | undefined;
1670
+ readonly maxDurationMillis?: number | undefined;
1671
+ readonly maxInputTokens?: number | undefined;
1672
+ readonly maxOutputTokens?: number | undefined;
1673
+ readonly maxCostMicrousd?: number | undefined;
1674
+ readonly maxResultBytes?: number | undefined;
1675
+ };
1676
+ readonly allocation: {
1677
+ readonly turns: number;
1678
+ readonly toolCalls: number;
1679
+ readonly durationMillis: number;
1680
+ readonly inputTokens: number;
1681
+ readonly outputTokens: number;
1682
+ readonly costMicrousd: number;
1683
+ readonly resultBytes: number;
1684
+ };
1685
+ readonly descendantInvocations?: number | undefined;
1686
+ };
1687
+ readonly grant: {
1688
+ readonly allowedToolNames: readonly string[];
1689
+ readonly maxDepth: number;
1690
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1691
+ };
1692
+ readonly depth: number;
1693
+ readonly toolCallAllowance?: number | undefined;
1694
+ readonly firstMessageId: string;
1695
+ readonly createdAtMillis: number;
1696
+ readonly expiresAtMillis: number;
1697
+ readonly reporting?: {
1698
+ readonly sourceDigests: {
1699
+ readonly agent: string;
1700
+ readonly model: string;
1701
+ readonly tools: string;
1702
+ };
1703
+ readonly destinationDelegationId?: string | undefined;
1704
+ } | undefined;
1705
+ };
1706
+ readonly messageId: string;
1707
+ readonly parameters: Schema.Json;
1708
+ readonly createdAtMillis: number;
1709
+ readonly sourceSubmissionId?: string | undefined;
1710
+ readonly deliveryPrincipal?: string | undefined;
1711
+ } | undefined;
1712
+ readonly messageAdmission?: {
1713
+ readonly schemaVersion: 1;
1714
+ readonly message: {
1715
+ readonly ownerThreadId: string;
1716
+ readonly messageId: string;
1717
+ };
1718
+ readonly peerName: string;
1719
+ readonly sender: {
1720
+ readonly threadId: string;
1721
+ readonly agentId: string;
1722
+ };
1723
+ readonly returnAddress: {
1724
+ readonly threadId: string;
1725
+ readonly agentId: string;
1726
+ };
1727
+ readonly inReplyTo?: {
1728
+ readonly ownerThreadId: string;
1729
+ readonly messageId: string;
1730
+ } | undefined;
1731
+ } | undefined;
929
1732
  };
930
1733
  } | {
931
1734
  readonly _tag: "Indeterminate";
@@ -985,6 +1788,26 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
985
1788
  readonly kind: "follow-up" | "steering" | "user";
986
1789
  readonly runId?: string | undefined;
987
1790
  readonly input: Schema.Json;
1791
+ readonly messageAdmission?: {
1792
+ readonly schemaVersion: 1;
1793
+ readonly message: {
1794
+ readonly ownerThreadId: string;
1795
+ readonly messageId: string;
1796
+ };
1797
+ readonly peerName: string;
1798
+ readonly sender: {
1799
+ readonly threadId: string;
1800
+ readonly agentId: string;
1801
+ };
1802
+ readonly returnAddress: {
1803
+ readonly threadId: string;
1804
+ readonly agentId: string;
1805
+ };
1806
+ readonly inReplyTo?: {
1807
+ readonly ownerThreadId: string;
1808
+ readonly messageId: string;
1809
+ } | undefined;
1810
+ } | undefined;
988
1811
  } | {
989
1812
  readonly _tag: "RunStarted";
990
1813
  readonly runId: string;
@@ -1038,7 +1861,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1038
1861
  readonly toolName: string;
1039
1862
  readonly parameters: Schema.Json;
1040
1863
  readonly parametersDigest: string;
1041
- readonly executionKind?: "delegation" | "ordinary" | undefined;
1864
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
1042
1865
  } | {
1043
1866
  readonly _tag: "ToolCallSettled";
1044
1867
  readonly runId: string;
@@ -1199,7 +2022,14 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1199
2022
  readonly costMicrousd: number;
1200
2023
  readonly resultBytes: number;
1201
2024
  };
2025
+ readonly descendantInvocations?: number | undefined;
1202
2026
  } | undefined;
2027
+ readonly grant?: {
2028
+ readonly allowedToolNames: readonly string[];
2029
+ readonly maxDepth: number;
2030
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2031
+ } | undefined;
2032
+ readonly depth?: number | undefined;
1203
2033
  } | {
1204
2034
  readonly _tag: "SubagentStarted";
1205
2035
  readonly runId: string;
@@ -1240,6 +2070,241 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1240
2070
  readonly grantDigest: string;
1241
2071
  readonly toolCallAllowance?: number | undefined;
1242
2072
  readonly policy?: Schema.Json | undefined;
2073
+ readonly budget?: {
2074
+ readonly caps: {
2075
+ readonly maxTotalChildInvocations?: number | undefined;
2076
+ readonly maxConcurrentChildren?: number | undefined;
2077
+ readonly maxTurns?: number | undefined;
2078
+ readonly maxToolCalls?: number | undefined;
2079
+ readonly maxDurationMillis?: number | undefined;
2080
+ readonly maxInputTokens?: number | undefined;
2081
+ readonly maxOutputTokens?: number | undefined;
2082
+ readonly maxCostMicrousd?: number | undefined;
2083
+ readonly maxResultBytes?: number | undefined;
2084
+ };
2085
+ readonly allocation: {
2086
+ readonly turns: number;
2087
+ readonly toolCalls: number;
2088
+ readonly durationMillis: number;
2089
+ readonly inputTokens: number;
2090
+ readonly outputTokens: number;
2091
+ readonly costMicrousd: number;
2092
+ readonly resultBytes: number;
2093
+ };
2094
+ readonly descendantInvocations?: number | undefined;
2095
+ } | undefined;
2096
+ readonly grant?: {
2097
+ readonly allowedToolNames: readonly string[];
2098
+ readonly maxDepth: number;
2099
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2100
+ } | undefined;
2101
+ } | {
2102
+ readonly _tag: "WorkerInputRequested";
2103
+ readonly admission: {
2104
+ readonly origin: {
2105
+ readonly worker: {
2106
+ readonly schemaVersion: 1;
2107
+ readonly delegationId: string;
2108
+ readonly targetAgentId: string;
2109
+ readonly threadId: string;
2110
+ };
2111
+ readonly source: {
2112
+ readonly _tag: "tool";
2113
+ readonly agentId: string;
2114
+ readonly threadId: string;
2115
+ readonly runId: string;
2116
+ readonly toolCallId: string;
2117
+ } | {
2118
+ readonly _tag: "programmatic";
2119
+ readonly agentId: string;
2120
+ readonly threadId: string;
2121
+ };
2122
+ readonly targetDigests: {
2123
+ readonly agent: string;
2124
+ readonly model: string;
2125
+ readonly tools: string;
2126
+ };
2127
+ readonly policy: Schema.Json;
2128
+ readonly budget: {
2129
+ readonly caps: {
2130
+ readonly maxTotalChildInvocations?: number | undefined;
2131
+ readonly maxConcurrentChildren?: number | undefined;
2132
+ readonly maxTurns?: number | undefined;
2133
+ readonly maxToolCalls?: number | undefined;
2134
+ readonly maxDurationMillis?: number | undefined;
2135
+ readonly maxInputTokens?: number | undefined;
2136
+ readonly maxOutputTokens?: number | undefined;
2137
+ readonly maxCostMicrousd?: number | undefined;
2138
+ readonly maxResultBytes?: number | undefined;
2139
+ };
2140
+ readonly allocation: {
2141
+ readonly turns: number;
2142
+ readonly toolCalls: number;
2143
+ readonly durationMillis: number;
2144
+ readonly inputTokens: number;
2145
+ readonly outputTokens: number;
2146
+ readonly costMicrousd: number;
2147
+ readonly resultBytes: number;
2148
+ };
2149
+ readonly descendantInvocations?: number | undefined;
2150
+ };
2151
+ readonly grant: {
2152
+ readonly allowedToolNames: readonly string[];
2153
+ readonly maxDepth: number;
2154
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2155
+ };
2156
+ readonly depth: number;
2157
+ readonly toolCallAllowance?: number | undefined;
2158
+ readonly firstMessageId: string;
2159
+ readonly createdAtMillis: number;
2160
+ readonly expiresAtMillis: number;
2161
+ readonly reporting?: {
2162
+ readonly sourceDigests: {
2163
+ readonly agent: string;
2164
+ readonly model: string;
2165
+ readonly tools: string;
2166
+ };
2167
+ readonly destinationDelegationId?: string | undefined;
2168
+ } | undefined;
2169
+ };
2170
+ readonly messageId: string;
2171
+ readonly parameters: Schema.Json;
2172
+ readonly createdAtMillis: number;
2173
+ readonly sourceSubmissionId?: string | undefined;
2174
+ readonly deliveryPrincipal?: string | undefined;
2175
+ };
2176
+ readonly inputDigest: string;
2177
+ } | {
2178
+ readonly _tag: "WorkerOriginRecorded";
2179
+ readonly origin: {
2180
+ readonly worker: {
2181
+ readonly schemaVersion: 1;
2182
+ readonly delegationId: string;
2183
+ readonly targetAgentId: string;
2184
+ readonly threadId: string;
2185
+ };
2186
+ readonly source: {
2187
+ readonly _tag: "tool";
2188
+ readonly agentId: string;
2189
+ readonly threadId: string;
2190
+ readonly runId: string;
2191
+ readonly toolCallId: string;
2192
+ } | {
2193
+ readonly _tag: "programmatic";
2194
+ readonly agentId: string;
2195
+ readonly threadId: string;
2196
+ };
2197
+ readonly targetDigests: {
2198
+ readonly agent: string;
2199
+ readonly model: string;
2200
+ readonly tools: string;
2201
+ };
2202
+ readonly policy: Schema.Json;
2203
+ readonly budget: {
2204
+ readonly caps: {
2205
+ readonly maxTotalChildInvocations?: number | undefined;
2206
+ readonly maxConcurrentChildren?: number | undefined;
2207
+ readonly maxTurns?: number | undefined;
2208
+ readonly maxToolCalls?: number | undefined;
2209
+ readonly maxDurationMillis?: number | undefined;
2210
+ readonly maxInputTokens?: number | undefined;
2211
+ readonly maxOutputTokens?: number | undefined;
2212
+ readonly maxCostMicrousd?: number | undefined;
2213
+ readonly maxResultBytes?: number | undefined;
2214
+ };
2215
+ readonly allocation: {
2216
+ readonly turns: number;
2217
+ readonly toolCalls: number;
2218
+ readonly durationMillis: number;
2219
+ readonly inputTokens: number;
2220
+ readonly outputTokens: number;
2221
+ readonly costMicrousd: number;
2222
+ readonly resultBytes: number;
2223
+ };
2224
+ readonly descendantInvocations?: number | undefined;
2225
+ };
2226
+ readonly grant: {
2227
+ readonly allowedToolNames: readonly string[];
2228
+ readonly maxDepth: number;
2229
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2230
+ };
2231
+ readonly depth: number;
2232
+ readonly toolCallAllowance?: number | undefined;
2233
+ readonly firstMessageId: string;
2234
+ readonly createdAtMillis: number;
2235
+ readonly expiresAtMillis: number;
2236
+ readonly reporting?: {
2237
+ readonly sourceDigests: {
2238
+ readonly agent: string;
2239
+ readonly model: string;
2240
+ readonly tools: string;
2241
+ };
2242
+ readonly destinationDelegationId?: string | undefined;
2243
+ } | undefined;
2244
+ };
2245
+ } | {
2246
+ readonly _tag: "WorkerInputCompleted";
2247
+ readonly messageId: string;
2248
+ readonly workerThreadId: string;
2249
+ readonly submissionId: string;
2250
+ readonly receiptId: string;
2251
+ readonly settlementId: string;
2252
+ readonly completedAtMillis: number;
2253
+ } | {
2254
+ readonly _tag: "WorkerReportPrepared";
2255
+ readonly runId: string;
2256
+ readonly messageId: string;
2257
+ readonly envelope: Schema.Json;
2258
+ readonly createdAtMillis: number;
2259
+ readonly deadlineAtMillis: number;
2260
+ } | {
2261
+ readonly _tag: "WorkerReportRefused";
2262
+ readonly runId: string;
2263
+ readonly messageId: string;
2264
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
2265
+ } | {
2266
+ readonly _tag: "PeerMessagePrepared";
2267
+ readonly messageId: string;
2268
+ readonly sourcePrincipal: string;
2269
+ readonly operation: "reply" | "send";
2270
+ readonly deadlineAtMillis: number;
2271
+ readonly encodedEnvelope: Schema.Json;
2272
+ } | {
2273
+ readonly _tag: "SubtreeBudgetReserved";
2274
+ readonly reservationId: string;
2275
+ readonly sourceSubmissionId?: string | undefined;
2276
+ readonly childThreadId: string;
2277
+ readonly lifetime: "attached" | "background";
2278
+ readonly depth: number;
2279
+ readonly policy: Schema.Json;
2280
+ readonly grant: {
2281
+ readonly allowedToolNames: readonly string[];
2282
+ readonly maxDepth: number;
2283
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2284
+ };
2285
+ readonly budget: {
2286
+ readonly caps: {
2287
+ readonly maxTotalChildInvocations?: number | undefined;
2288
+ readonly maxConcurrentChildren?: number | undefined;
2289
+ readonly maxTurns?: number | undefined;
2290
+ readonly maxToolCalls?: number | undefined;
2291
+ readonly maxDurationMillis?: number | undefined;
2292
+ readonly maxInputTokens?: number | undefined;
2293
+ readonly maxOutputTokens?: number | undefined;
2294
+ readonly maxCostMicrousd?: number | undefined;
2295
+ readonly maxResultBytes?: number | undefined;
2296
+ };
2297
+ readonly allocation: {
2298
+ readonly turns: number;
2299
+ readonly toolCalls: number;
2300
+ readonly durationMillis: number;
2301
+ readonly inputTokens: number;
2302
+ readonly outputTokens: number;
2303
+ readonly costMicrousd: number;
2304
+ readonly resultBytes: number;
2305
+ };
2306
+ readonly descendantInvocations?: number | undefined;
2307
+ };
1243
2308
  } | {
1244
2309
  readonly _tag: "RepairAnnotated";
1245
2310
  readonly reason: string;
@@ -1292,6 +2357,26 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1292
2357
  readonly kind: "follow-up" | "steering" | "user";
1293
2358
  readonly runId?: string | undefined;
1294
2359
  readonly input: Schema.Json;
2360
+ readonly messageAdmission?: {
2361
+ readonly schemaVersion: 1;
2362
+ readonly message: {
2363
+ readonly ownerThreadId: string;
2364
+ readonly messageId: string;
2365
+ };
2366
+ readonly peerName: string;
2367
+ readonly sender: {
2368
+ readonly threadId: string;
2369
+ readonly agentId: string;
2370
+ };
2371
+ readonly returnAddress: {
2372
+ readonly threadId: string;
2373
+ readonly agentId: string;
2374
+ };
2375
+ readonly inReplyTo?: {
2376
+ readonly ownerThreadId: string;
2377
+ readonly messageId: string;
2378
+ } | undefined;
2379
+ } | undefined;
1295
2380
  } | {
1296
2381
  readonly _tag: "RunStarted";
1297
2382
  readonly runId: string;
@@ -1345,7 +2430,7 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1345
2430
  readonly toolName: string;
1346
2431
  readonly parameters: Schema.Json;
1347
2432
  readonly parametersDigest: string;
1348
- readonly executionKind?: "delegation" | "ordinary" | undefined;
2433
+ readonly executionKind?: "delegation" | "orchestration" | "ordinary" | undefined;
1349
2434
  } | {
1350
2435
  readonly _tag: "ToolCallSettled";
1351
2436
  readonly runId: string;
@@ -1506,7 +2591,14 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1506
2591
  readonly costMicrousd: number;
1507
2592
  readonly resultBytes: number;
1508
2593
  };
2594
+ readonly descendantInvocations?: number | undefined;
2595
+ } | undefined;
2596
+ readonly grant?: {
2597
+ readonly allowedToolNames: readonly string[];
2598
+ readonly maxDepth: number;
2599
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1509
2600
  } | undefined;
2601
+ readonly depth?: number | undefined;
1510
2602
  } | {
1511
2603
  readonly _tag: "SubagentStarted";
1512
2604
  readonly runId: string;
@@ -1547,6 +2639,241 @@ declare const encodePortResponse: (input: PortFailed | PortSucceeded, options?:
1547
2639
  readonly grantDigest: string;
1548
2640
  readonly toolCallAllowance?: number | undefined;
1549
2641
  readonly policy?: Schema.Json | undefined;
2642
+ readonly budget?: {
2643
+ readonly caps: {
2644
+ readonly maxTotalChildInvocations?: number | undefined;
2645
+ readonly maxConcurrentChildren?: number | undefined;
2646
+ readonly maxTurns?: number | undefined;
2647
+ readonly maxToolCalls?: number | undefined;
2648
+ readonly maxDurationMillis?: number | undefined;
2649
+ readonly maxInputTokens?: number | undefined;
2650
+ readonly maxOutputTokens?: number | undefined;
2651
+ readonly maxCostMicrousd?: number | undefined;
2652
+ readonly maxResultBytes?: number | undefined;
2653
+ };
2654
+ readonly allocation: {
2655
+ readonly turns: number;
2656
+ readonly toolCalls: number;
2657
+ readonly durationMillis: number;
2658
+ readonly inputTokens: number;
2659
+ readonly outputTokens: number;
2660
+ readonly costMicrousd: number;
2661
+ readonly resultBytes: number;
2662
+ };
2663
+ readonly descendantInvocations?: number | undefined;
2664
+ } | undefined;
2665
+ readonly grant?: {
2666
+ readonly allowedToolNames: readonly string[];
2667
+ readonly maxDepth: number;
2668
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2669
+ } | undefined;
2670
+ } | {
2671
+ readonly _tag: "WorkerInputRequested";
2672
+ readonly admission: {
2673
+ readonly origin: {
2674
+ readonly worker: {
2675
+ readonly schemaVersion: 1;
2676
+ readonly delegationId: string;
2677
+ readonly targetAgentId: string;
2678
+ readonly threadId: string;
2679
+ };
2680
+ readonly source: {
2681
+ readonly _tag: "tool";
2682
+ readonly agentId: string;
2683
+ readonly threadId: string;
2684
+ readonly runId: string;
2685
+ readonly toolCallId: string;
2686
+ } | {
2687
+ readonly _tag: "programmatic";
2688
+ readonly agentId: string;
2689
+ readonly threadId: string;
2690
+ };
2691
+ readonly targetDigests: {
2692
+ readonly agent: string;
2693
+ readonly model: string;
2694
+ readonly tools: string;
2695
+ };
2696
+ readonly policy: Schema.Json;
2697
+ readonly budget: {
2698
+ readonly caps: {
2699
+ readonly maxTotalChildInvocations?: number | undefined;
2700
+ readonly maxConcurrentChildren?: number | undefined;
2701
+ readonly maxTurns?: number | undefined;
2702
+ readonly maxToolCalls?: number | undefined;
2703
+ readonly maxDurationMillis?: number | undefined;
2704
+ readonly maxInputTokens?: number | undefined;
2705
+ readonly maxOutputTokens?: number | undefined;
2706
+ readonly maxCostMicrousd?: number | undefined;
2707
+ readonly maxResultBytes?: number | undefined;
2708
+ };
2709
+ readonly allocation: {
2710
+ readonly turns: number;
2711
+ readonly toolCalls: number;
2712
+ readonly durationMillis: number;
2713
+ readonly inputTokens: number;
2714
+ readonly outputTokens: number;
2715
+ readonly costMicrousd: number;
2716
+ readonly resultBytes: number;
2717
+ };
2718
+ readonly descendantInvocations?: number | undefined;
2719
+ };
2720
+ readonly grant: {
2721
+ readonly allowedToolNames: readonly string[];
2722
+ readonly maxDepth: number;
2723
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2724
+ };
2725
+ readonly depth: number;
2726
+ readonly toolCallAllowance?: number | undefined;
2727
+ readonly firstMessageId: string;
2728
+ readonly createdAtMillis: number;
2729
+ readonly expiresAtMillis: number;
2730
+ readonly reporting?: {
2731
+ readonly sourceDigests: {
2732
+ readonly agent: string;
2733
+ readonly model: string;
2734
+ readonly tools: string;
2735
+ };
2736
+ readonly destinationDelegationId?: string | undefined;
2737
+ } | undefined;
2738
+ };
2739
+ readonly messageId: string;
2740
+ readonly parameters: Schema.Json;
2741
+ readonly createdAtMillis: number;
2742
+ readonly sourceSubmissionId?: string | undefined;
2743
+ readonly deliveryPrincipal?: string | undefined;
2744
+ };
2745
+ readonly inputDigest: string;
2746
+ } | {
2747
+ readonly _tag: "WorkerOriginRecorded";
2748
+ readonly origin: {
2749
+ readonly worker: {
2750
+ readonly schemaVersion: 1;
2751
+ readonly delegationId: string;
2752
+ readonly targetAgentId: string;
2753
+ readonly threadId: string;
2754
+ };
2755
+ readonly source: {
2756
+ readonly _tag: "tool";
2757
+ readonly agentId: string;
2758
+ readonly threadId: string;
2759
+ readonly runId: string;
2760
+ readonly toolCallId: string;
2761
+ } | {
2762
+ readonly _tag: "programmatic";
2763
+ readonly agentId: string;
2764
+ readonly threadId: string;
2765
+ };
2766
+ readonly targetDigests: {
2767
+ readonly agent: string;
2768
+ readonly model: string;
2769
+ readonly tools: string;
2770
+ };
2771
+ readonly policy: Schema.Json;
2772
+ readonly budget: {
2773
+ readonly caps: {
2774
+ readonly maxTotalChildInvocations?: number | undefined;
2775
+ readonly maxConcurrentChildren?: number | undefined;
2776
+ readonly maxTurns?: number | undefined;
2777
+ readonly maxToolCalls?: number | undefined;
2778
+ readonly maxDurationMillis?: number | undefined;
2779
+ readonly maxInputTokens?: number | undefined;
2780
+ readonly maxOutputTokens?: number | undefined;
2781
+ readonly maxCostMicrousd?: number | undefined;
2782
+ readonly maxResultBytes?: number | undefined;
2783
+ };
2784
+ readonly allocation: {
2785
+ readonly turns: number;
2786
+ readonly toolCalls: number;
2787
+ readonly durationMillis: number;
2788
+ readonly inputTokens: number;
2789
+ readonly outputTokens: number;
2790
+ readonly costMicrousd: number;
2791
+ readonly resultBytes: number;
2792
+ };
2793
+ readonly descendantInvocations?: number | undefined;
2794
+ };
2795
+ readonly grant: {
2796
+ readonly allowedToolNames: readonly string[];
2797
+ readonly maxDepth: number;
2798
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2799
+ };
2800
+ readonly depth: number;
2801
+ readonly toolCallAllowance?: number | undefined;
2802
+ readonly firstMessageId: string;
2803
+ readonly createdAtMillis: number;
2804
+ readonly expiresAtMillis: number;
2805
+ readonly reporting?: {
2806
+ readonly sourceDigests: {
2807
+ readonly agent: string;
2808
+ readonly model: string;
2809
+ readonly tools: string;
2810
+ };
2811
+ readonly destinationDelegationId?: string | undefined;
2812
+ } | undefined;
2813
+ };
2814
+ } | {
2815
+ readonly _tag: "WorkerInputCompleted";
2816
+ readonly messageId: string;
2817
+ readonly workerThreadId: string;
2818
+ readonly submissionId: string;
2819
+ readonly receiptId: string;
2820
+ readonly settlementId: string;
2821
+ readonly completedAtMillis: number;
2822
+ } | {
2823
+ readonly _tag: "WorkerReportPrepared";
2824
+ readonly runId: string;
2825
+ readonly messageId: string;
2826
+ readonly envelope: Schema.Json;
2827
+ readonly createdAtMillis: number;
2828
+ readonly deadlineAtMillis: number;
2829
+ } | {
2830
+ readonly _tag: "WorkerReportRefused";
2831
+ readonly runId: string;
2832
+ readonly messageId: string;
2833
+ readonly reason: "capacity" | "declaration-unavailable" | "defect" | "denied" | "destination" | "expired" | "input" | "preparation" | "projection" | "timeout";
2834
+ } | {
2835
+ readonly _tag: "PeerMessagePrepared";
2836
+ readonly messageId: string;
2837
+ readonly sourcePrincipal: string;
2838
+ readonly operation: "reply" | "send";
2839
+ readonly deadlineAtMillis: number;
2840
+ readonly encodedEnvelope: Schema.Json;
2841
+ } | {
2842
+ readonly _tag: "SubtreeBudgetReserved";
2843
+ readonly reservationId: string;
2844
+ readonly sourceSubmissionId?: string | undefined;
2845
+ readonly childThreadId: string;
2846
+ readonly lifetime: "attached" | "background";
2847
+ readonly depth: number;
2848
+ readonly policy: Schema.Json;
2849
+ readonly grant: {
2850
+ readonly allowedToolNames: readonly string[];
2851
+ readonly maxDepth: number;
2852
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
2853
+ };
2854
+ readonly budget: {
2855
+ readonly caps: {
2856
+ readonly maxTotalChildInvocations?: number | undefined;
2857
+ readonly maxConcurrentChildren?: number | undefined;
2858
+ readonly maxTurns?: number | undefined;
2859
+ readonly maxToolCalls?: number | undefined;
2860
+ readonly maxDurationMillis?: number | undefined;
2861
+ readonly maxInputTokens?: number | undefined;
2862
+ readonly maxOutputTokens?: number | undefined;
2863
+ readonly maxCostMicrousd?: number | undefined;
2864
+ readonly maxResultBytes?: number | undefined;
2865
+ };
2866
+ readonly allocation: {
2867
+ readonly turns: number;
2868
+ readonly toolCalls: number;
2869
+ readonly durationMillis: number;
2870
+ readonly inputTokens: number;
2871
+ readonly outputTokens: number;
2872
+ readonly costMicrousd: number;
2873
+ readonly resultBytes: number;
2874
+ };
2875
+ readonly descendantInvocations?: number | undefined;
2876
+ };
1550
2877
  } | {
1551
2878
  readonly _tag: "RepairAnnotated";
1552
2879
  readonly reason: string;