@yielded/agent-platform-cloudflare 0.1.0-beta.174 → 0.1.0-beta.176

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 (30) hide show
  1. package/dist/{Alarm-4J9B8Fg8.mjs → Alarm-7uipp6LW.mjs} +155 -117
  2. package/dist/Alarm-7uipp6LW.mjs.map +1 -0
  3. package/dist/Alarm.d.mts +2 -0
  4. package/dist/Alarm.mjs +1 -1
  5. package/dist/CloudflareScheduling.mjs +2 -2
  6. package/dist/CloudflareSubscriptions.mjs +2 -2
  7. package/dist/{CloudflareThreadClient-lTm6baDP.d.mts → CloudflareThreadClient-HO_3rkM7.d.mts} +362 -362
  8. package/dist/{CloudflareThreadClient-DU548EEj.mjs → CloudflareThreadClient-bA3lGA_2.mjs} +4 -4
  9. package/dist/CloudflareThreadClient-bA3lGA_2.mjs.map +1 -0
  10. package/dist/CloudflareThreadClient.d.mts +1 -1
  11. package/dist/CloudflareThreadClient.mjs +1 -1
  12. package/dist/{ThreadObject-BLYgzcdT.d.mts → ThreadObject-CxNlhoPL.d.mts} +13 -13
  13. package/dist/{ThreadObject-C2LF3btz.mjs → ThreadObject-SNcCsrS2.mjs} +52 -50
  14. package/dist/ThreadObject-SNcCsrS2.mjs.map +1 -0
  15. package/dist/ThreadObject.d.mts +1 -1
  16. package/dist/ThreadObject.mjs +1 -1
  17. package/dist/WakeScheduler.mjs +1 -1
  18. package/dist/index.d.mts +2 -2
  19. package/dist/index.mjs +3 -3
  20. package/dist/{prepared-admission-BoUPHSNQ.mjs → prepared-admission-BvMiFR41.mjs} +2 -2
  21. package/dist/{prepared-admission-BoUPHSNQ.mjs.map → prepared-admission-BvMiFR41.mjs.map} +1 -1
  22. package/package.json +1 -1
  23. package/src/Alarm.ts +295 -201
  24. package/src/CloudflareThreadClient.ts +3 -2
  25. package/src/ThreadObject.ts +17 -22
  26. package/src/internal/layers.ts +124 -82
  27. package/src/internal/message-delivery.ts +61 -37
  28. package/dist/Alarm-4J9B8Fg8.mjs.map +0 -1
  29. package/dist/CloudflareThreadClient-DU548EEj.mjs.map +0 -1
  30. package/dist/ThreadObject-C2LF3btz.mjs.map +0 -1
@@ -599,13 +599,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
599
599
  readonly author: string;
600
600
  readonly reason: string;
601
601
  readonly resolution: {
602
+ readonly _tag: "SafeToRetry";
603
+ } | {
602
604
  readonly _tag: "CompletedWithResult";
603
605
  readonly result: Schema.Json;
604
606
  readonly isFailure: boolean;
605
607
  } | {
606
608
  readonly _tag: "NeverHappened";
607
- } | {
608
- readonly _tag: "SafeToRetry";
609
609
  } | {
610
610
  readonly _tag: "AbortSubmission";
611
611
  };
@@ -1024,17 +1024,56 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1024
1024
  readonly summary?: string | undefined;
1025
1025
  readonly handoff?: string | undefined;
1026
1026
  } | {
1027
- readonly _tag: "AbortRequested";
1028
- readonly submissionId: string;
1029
- readonly author: string;
1030
- readonly reason: string;
1027
+ readonly _tag: "ThreadCreated";
1028
+ readonly agentId: string;
1029
+ readonly definitions: {
1030
+ readonly agent: string;
1031
+ readonly model: string;
1032
+ readonly tools: string;
1033
+ readonly replay?: {
1034
+ readonly agent: string;
1035
+ readonly agentBehavior?: string | undefined;
1036
+ readonly tools: {
1037
+ readonly [x: string]: string;
1038
+ };
1039
+ } | undefined;
1040
+ };
1031
1041
  } | {
1032
- readonly _tag: "ToolApprovalDecided";
1042
+ readonly _tag: "RunStarted";
1043
+ readonly runId: string;
1044
+ readonly policyAccountingVersion: 1;
1045
+ readonly maxDurationMillis: number;
1046
+ } | {
1047
+ readonly _tag: "RunDurationExhausted";
1048
+ readonly runId: string;
1049
+ } | {
1050
+ readonly _tag: "RunPolicyUsageReserved";
1051
+ readonly runId: string;
1052
+ readonly programmaticToolCalls: number;
1053
+ readonly finalizationUsed: boolean;
1054
+ } | {
1055
+ readonly _tag: "ModelCompleted";
1056
+ readonly runId: string;
1057
+ readonly output: Schema.Json;
1058
+ readonly messages?: Schema.Json | undefined;
1059
+ readonly history?: Schema.Json | undefined;
1060
+ } | {
1061
+ readonly _tag: "ToolCallSettled";
1062
+ readonly toolSelection?: {
1063
+ readonly toolNames: readonly string[];
1064
+ } | undefined;
1065
+ readonly runId: string;
1066
+ readonly toolCallId: string;
1067
+ readonly toolName: string;
1068
+ readonly result: Schema.Json;
1069
+ readonly isFailure: boolean;
1070
+ readonly budgetRejected?: true | undefined;
1071
+ } | {
1072
+ readonly _tag: "ToolCallUnknown";
1033
1073
  readonly runId: string;
1034
1074
  readonly turn: number;
1035
1075
  readonly toolCallId: string;
1036
- readonly decision: "approved" | "denied";
1037
- readonly resolver: string;
1076
+ readonly toolName: string;
1038
1077
  readonly reason: string;
1039
1078
  } | {
1040
1079
  readonly _tag: "ToolCallResolved";
@@ -1044,40 +1083,12 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1044
1083
  readonly author: string;
1045
1084
  readonly reason: string;
1046
1085
  } | {
1047
- readonly _tag: "RunStarted";
1086
+ readonly _tag: "ToolStepSettled";
1048
1087
  readonly runId: string;
1049
- readonly policyAccountingVersion: 1;
1050
- readonly maxDurationMillis: number;
1051
- } | {
1052
- readonly _tag: "AgentUpdateEmitted";
1053
- readonly update: {
1054
- readonly schemaVersion: 1;
1055
- readonly agentId: string;
1056
- readonly threadId: string;
1057
- readonly runId: string;
1058
- readonly updateId: string;
1059
- readonly sequence: number;
1060
- readonly value: Schema.Json;
1061
- };
1062
- readonly definitions: {
1063
- readonly agent: string;
1064
- readonly model: string;
1065
- readonly tools: string;
1066
- readonly replay?: {
1067
- readonly agent: string;
1068
- readonly agentBehavior?: string | undefined;
1069
- readonly tools: {
1070
- readonly [x: string]: string;
1071
- };
1072
- } | undefined;
1073
- };
1074
- readonly delivery?: {
1075
- readonly messageId: string;
1076
- readonly envelope: Schema.Json;
1077
- readonly createdAtMillis: number;
1078
- readonly deadlineAtMillis: number;
1079
- readonly predecessor?: string | undefined;
1080
- } | undefined;
1088
+ readonly toolCallId: string;
1089
+ readonly stepName: string;
1090
+ readonly output: Schema.Json;
1091
+ readonly outputDigest: string;
1081
1092
  } | {
1082
1093
  readonly _tag: "ToolApprovalRequested";
1083
1094
  readonly runId: string;
@@ -1088,246 +1099,66 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1088
1099
  readonly parametersDigest: string;
1089
1100
  readonly blocksInitialDispatch: boolean;
1090
1101
  } | {
1091
- readonly _tag: "WorkerInputCompleted";
1092
- readonly messageId: string;
1093
- readonly workerThreadId: string;
1094
- readonly submissionId: string;
1095
- readonly receiptId: string;
1096
- readonly settlementId: string;
1097
- readonly completedAtMillis: number;
1098
- readonly effectsResolved?: true | undefined;
1099
- } | {
1100
- readonly _tag: "WorkerInputRequested";
1101
- readonly admission: {
1102
- readonly origin: {
1103
- readonly worker: {
1104
- readonly schemaVersion: 1;
1105
- readonly delegationId: string;
1106
- readonly targetAgentId: string;
1107
- readonly threadId: string;
1108
- };
1109
- readonly source: {
1110
- readonly _tag: "tool";
1111
- readonly agentId: string;
1112
- readonly threadId: string;
1113
- readonly runId: string;
1114
- readonly toolCallId: string;
1115
- } | {
1116
- readonly _tag: "programmatic";
1117
- readonly agentId: string;
1118
- readonly threadId: string;
1119
- };
1120
- readonly continuationOf?: {
1121
- readonly worker: {
1122
- readonly schemaVersion: 1;
1123
- readonly delegationId: string;
1124
- readonly targetAgentId: string;
1125
- readonly threadId: string;
1126
- };
1127
- readonly receipt: {
1128
- readonly receiptId: string;
1129
- readonly submissionId: string;
1130
- readonly threadId: string;
1131
- readonly queueSequence: number;
1132
- };
1133
- readonly settlementId: string;
1134
- } | undefined;
1135
- readonly budgetScope: "source-subtree" | "worker-run";
1136
- readonly lifecycle?: "assignment" | undefined;
1137
- readonly targetDigests: {
1138
- readonly agent: string;
1139
- readonly model: string;
1140
- readonly tools: string;
1141
- readonly replay?: {
1142
- readonly agent: string;
1143
- readonly agentBehavior?: string | undefined;
1144
- readonly tools: {
1145
- readonly [x: string]: string;
1146
- };
1147
- } | undefined;
1148
- };
1149
- readonly policy: Schema.Json;
1150
- readonly budget: {
1151
- readonly caps: {
1152
- readonly maxTotalChildInvocations?: number | undefined;
1153
- readonly maxConcurrentChildren?: number | undefined;
1154
- readonly maxTurns?: number | undefined;
1155
- readonly maxToolCalls?: number | undefined;
1156
- readonly maxDurationMillis?: number | undefined;
1157
- readonly maxInputTokens?: number | undefined;
1158
- readonly maxOutputTokens?: number | undefined;
1159
- readonly maxCostMicrousd?: number | undefined;
1160
- readonly maxResultBytes?: number | undefined;
1161
- };
1162
- readonly allocation: {
1163
- readonly turns: number;
1164
- readonly toolCalls: number;
1165
- readonly durationMillis: number;
1166
- readonly inputTokens: number;
1167
- readonly outputTokens: number;
1168
- readonly costMicrousd: number;
1169
- readonly resultBytes: number;
1170
- };
1171
- readonly descendantInvocations?: number | undefined;
1172
- };
1173
- readonly grant: {
1174
- readonly allowedToolNames: readonly string[];
1175
- readonly maxDepth: number;
1176
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1177
- };
1178
- readonly depth: number;
1179
- readonly toolCallAllowance?: number | undefined;
1180
- readonly firstMessageId: string;
1181
- readonly createdAtMillis: number;
1182
- readonly expiresAtMillis: number;
1183
- readonly reporting?: {
1184
- readonly mode?: "standard" | undefined;
1185
- readonly sourceDigests: {
1186
- readonly agent: string;
1187
- readonly model: string;
1188
- readonly tools: string;
1189
- readonly replay?: {
1190
- readonly agent: string;
1191
- readonly agentBehavior?: string | undefined;
1192
- readonly tools: {
1193
- readonly [x: string]: string;
1194
- };
1195
- } | undefined;
1196
- };
1197
- readonly destinationDelegationId?: string | undefined;
1198
- readonly returnAddress?: {
1199
- readonly input: Schema.Json;
1200
- readonly principal: string;
1201
- readonly policy: Schema.Json;
1202
- readonly depth: number;
1203
- readonly grant?: {
1204
- readonly allowedToolNames: readonly string[];
1205
- readonly maxDepth: number;
1206
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1207
- } | undefined;
1208
- readonly workerAdmission?: Schema.Json | undefined;
1209
- } | undefined;
1210
- } | undefined;
1211
- };
1212
- readonly executionRunId: string | null;
1213
- readonly messageId: string;
1214
- readonly parameters: Schema.Json;
1215
- readonly createdAtMillis: number;
1216
- readonly sourceSubmissionId?: string | undefined;
1217
- readonly deliveryPrincipal?: string | undefined;
1218
- readonly reportKind?: "update" | undefined;
1219
- };
1220
- readonly inputDigest: string;
1102
+ readonly _tag: "ToolApprovalDecided";
1103
+ readonly runId: string;
1104
+ readonly turn: number;
1105
+ readonly toolCallId: string;
1106
+ readonly decision: "approved" | "denied";
1107
+ readonly resolver: string;
1108
+ readonly reason: string;
1221
1109
  } | {
1222
- readonly _tag: "WorkerStopRequested";
1223
- readonly command: {
1224
- readonly worker: {
1225
- readonly schemaVersion: 1;
1226
- readonly delegationId: string;
1227
- readonly targetAgentId: string;
1228
- readonly threadId: string;
1229
- };
1230
- readonly idempotencyKey: string;
1231
- };
1232
- readonly principal: string;
1233
- readonly sourceSubmissionId?: string | undefined;
1110
+ readonly _tag: "ModelResponseInterrupted";
1111
+ readonly runId: string;
1234
1112
  } | {
1235
- readonly _tag: "SubagentRequested";
1113
+ readonly _tag: "ModelCallAborted";
1236
1114
  readonly runId: string;
1237
1115
  readonly turnId: string;
1238
1116
  readonly turn: number;
1239
- readonly toolCallId: string;
1240
- readonly delegationId: string;
1241
- readonly targetAgentId: string;
1242
- readonly targetDigests: {
1243
- readonly agent: string;
1244
- readonly model: string;
1245
- readonly tools: string;
1246
- readonly replay?: {
1247
- readonly agent: string;
1248
- readonly agentBehavior?: string | undefined;
1249
- readonly tools: {
1250
- readonly [x: string]: string;
1251
- };
1117
+ readonly restart: number;
1118
+ readonly reason: "joined-input";
1119
+ readonly modelUsage: readonly {
1120
+ readonly provider: string;
1121
+ readonly model: string;
1122
+ readonly serviceTier?: string | undefined;
1123
+ readonly pricingVersion?: string | undefined;
1124
+ readonly response?: {
1125
+ readonly id?: string | undefined;
1126
+ readonly model?: string | undefined;
1252
1127
  } | undefined;
1253
- };
1254
- readonly childInput: Schema.Json;
1255
- readonly childInputDigest: string;
1256
- readonly grantDigest: string;
1257
- readonly reservationId: string;
1258
- readonly reservationDigest: string;
1259
- readonly childThreadId: string;
1260
- readonly childPrincipal: string;
1261
- readonly childIdempotencyKey: string;
1262
- readonly toolCallAllowance?: number | undefined;
1263
- readonly policy?: Schema.Json | undefined;
1264
- readonly budget?: {
1265
- readonly caps: {
1266
- readonly maxTotalChildInvocations?: number | undefined;
1267
- readonly maxConcurrentChildren?: number | undefined;
1268
- readonly maxTurns?: number | undefined;
1269
- readonly maxToolCalls?: number | undefined;
1270
- readonly maxDurationMillis?: number | undefined;
1271
- readonly maxInputTokens?: number | undefined;
1272
- readonly maxOutputTokens?: number | undefined;
1273
- readonly maxCostMicrousd?: number | undefined;
1274
- readonly maxResultBytes?: number | undefined;
1128
+ readonly purpose?: "summary" | "turn" | undefined;
1129
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1130
+ readonly pricingStatus?: "estimated" | "unknown" | undefined;
1131
+ readonly inputTokens: {
1132
+ readonly total: number;
1133
+ readonly uncached: number;
1134
+ readonly cacheRead: number;
1135
+ readonly cacheWrite: number;
1275
1136
  };
1276
- readonly allocation: {
1277
- readonly turns: number;
1278
- readonly toolCalls: number;
1279
- readonly durationMillis: number;
1280
- readonly inputTokens: number;
1281
- readonly outputTokens: number;
1282
- readonly costMicrousd: number;
1283
- readonly resultBytes: number;
1137
+ readonly outputTokens: {
1138
+ readonly total: number;
1139
+ readonly text: number;
1140
+ readonly reasoning: number;
1284
1141
  };
1285
- readonly descendantInvocations?: number | undefined;
1286
- } | undefined;
1287
- readonly grant?: {
1288
- readonly allowedToolNames: readonly string[];
1289
- readonly maxDepth: number;
1290
- readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1291
- } | undefined;
1292
- readonly depth?: number | undefined;
1142
+ readonly webSearchCalls?: number | undefined;
1143
+ readonly costMicrousd: number;
1144
+ }[];
1145
+ readonly unobservedModelCalls: number;
1293
1146
  } | {
1294
- readonly _tag: "SubagentStarted";
1147
+ readonly _tag: "RunFailed";
1295
1148
  readonly runId: string;
1296
- readonly toolCallId: string;
1297
- readonly childThreadId: string;
1298
- readonly childSubmissionId: string;
1299
- readonly childReceiptId: string;
1300
- readonly childRunId: string;
1149
+ readonly failure: Schema.Json;
1301
1150
  } | {
1302
- readonly _tag: "SubagentJoined";
1151
+ readonly _tag: "RunCompleted";
1303
1152
  readonly runId: string;
1304
- readonly toolCallId: string;
1305
- readonly childSubmissionId: string;
1306
- readonly childSettlementId: string;
1307
- readonly childOutcome: "aborted" | "completed" | "failed";
1308
- readonly usageSummary: Schema.Json;
1309
- readonly usage?: {
1310
- readonly modelCalls: number;
1311
- readonly inputTokens: number;
1312
- readonly outputTokens: number;
1313
- readonly webSearchCalls?: number | undefined;
1314
- readonly costMicrousd: number;
1315
- readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1316
- readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1317
- readonly unobservedModelCalls?: number | undefined;
1318
- } | undefined;
1319
- readonly delegatedUsage?: {
1320
- readonly modelCalls: number;
1321
- readonly inputTokens: number;
1322
- readonly outputTokens: number;
1323
- readonly webSearchCalls?: number | undefined;
1324
- readonly costMicrousd: number;
1325
- readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1326
- readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1327
- readonly unobservedModelCalls?: number | undefined;
1328
- } | undefined;
1329
- readonly reservationId: string;
1330
- readonly finalAccounting: Schema.Json;
1153
+ readonly output: Schema.Json;
1154
+ readonly runDisposition?: Schema.Json | undefined;
1155
+ readonly finishReason?: "budget-exhausted" | undefined;
1156
+ readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1157
+ } | {
1158
+ readonly _tag: "AbortRequested";
1159
+ readonly submissionId: string;
1160
+ readonly author: string;
1161
+ readonly reason: string;
1331
1162
  } | {
1332
1163
  readonly _tag: "SubmissionSettled";
1333
1164
  readonly submissionId: string;
@@ -1408,9 +1239,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1408
1239
  readonly costMicrousd: number;
1409
1240
  }[] | undefined;
1410
1241
  } | {
1411
- readonly _tag: "ThreadCreated";
1412
- readonly agentId: string;
1413
- readonly definitions: {
1242
+ readonly _tag: "SubagentRequested";
1243
+ readonly runId: string;
1244
+ readonly turnId: string;
1245
+ readonly turn: number;
1246
+ readonly toolCallId: string;
1247
+ readonly delegationId: string;
1248
+ readonly targetAgentId: string;
1249
+ readonly targetDigests: {
1414
1250
  readonly agent: string;
1415
1251
  readonly model: string;
1416
1252
  readonly tools: string;
@@ -1422,93 +1258,83 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1422
1258
  };
1423
1259
  } | undefined;
1424
1260
  };
1425
- } | {
1426
- readonly _tag: "RunDurationExhausted";
1427
- readonly runId: string;
1428
- } | {
1429
- readonly _tag: "RunPolicyUsageReserved";
1430
- readonly runId: string;
1431
- readonly programmaticToolCalls: number;
1432
- readonly finalizationUsed: boolean;
1433
- } | {
1434
- readonly _tag: "ModelCompleted";
1435
- readonly runId: string;
1436
- readonly output: Schema.Json;
1437
- readonly messages?: Schema.Json | undefined;
1438
- readonly history?: Schema.Json | undefined;
1439
- } | {
1440
- readonly _tag: "ToolCallSettled";
1441
- readonly toolSelection?: {
1442
- readonly toolNames: readonly string[];
1261
+ readonly childInput: Schema.Json;
1262
+ readonly childInputDigest: string;
1263
+ readonly grantDigest: string;
1264
+ readonly reservationId: string;
1265
+ readonly reservationDigest: string;
1266
+ readonly childThreadId: string;
1267
+ readonly childPrincipal: string;
1268
+ readonly childIdempotencyKey: string;
1269
+ readonly toolCallAllowance?: number | undefined;
1270
+ readonly policy?: Schema.Json | undefined;
1271
+ readonly budget?: {
1272
+ readonly caps: {
1273
+ readonly maxTotalChildInvocations?: number | undefined;
1274
+ readonly maxConcurrentChildren?: number | undefined;
1275
+ readonly maxTurns?: number | undefined;
1276
+ readonly maxToolCalls?: number | undefined;
1277
+ readonly maxDurationMillis?: number | undefined;
1278
+ readonly maxInputTokens?: number | undefined;
1279
+ readonly maxOutputTokens?: number | undefined;
1280
+ readonly maxCostMicrousd?: number | undefined;
1281
+ readonly maxResultBytes?: number | undefined;
1282
+ };
1283
+ readonly allocation: {
1284
+ readonly turns: number;
1285
+ readonly toolCalls: number;
1286
+ readonly durationMillis: number;
1287
+ readonly inputTokens: number;
1288
+ readonly outputTokens: number;
1289
+ readonly costMicrousd: number;
1290
+ readonly resultBytes: number;
1291
+ };
1292
+ readonly descendantInvocations?: number | undefined;
1443
1293
  } | undefined;
1444
- readonly runId: string;
1445
- readonly toolCallId: string;
1446
- readonly toolName: string;
1447
- readonly result: Schema.Json;
1448
- readonly isFailure: boolean;
1449
- readonly budgetRejected?: true | undefined;
1294
+ readonly grant?: {
1295
+ readonly allowedToolNames: readonly string[];
1296
+ readonly maxDepth: number;
1297
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1298
+ } | undefined;
1299
+ readonly depth?: number | undefined;
1450
1300
  } | {
1451
- readonly _tag: "ToolCallUnknown";
1301
+ readonly _tag: "SubagentStarted";
1452
1302
  readonly runId: string;
1453
- readonly turn: number;
1454
1303
  readonly toolCallId: string;
1455
- readonly toolName: string;
1456
- readonly reason: string;
1304
+ readonly childThreadId: string;
1305
+ readonly childSubmissionId: string;
1306
+ readonly childReceiptId: string;
1307
+ readonly childRunId: string;
1457
1308
  } | {
1458
- readonly _tag: "ToolStepSettled";
1309
+ readonly _tag: "SubagentJoined";
1459
1310
  readonly runId: string;
1460
1311
  readonly toolCallId: string;
1461
- readonly stepName: string;
1462
- readonly output: Schema.Json;
1463
- readonly outputDigest: string;
1464
- } | {
1465
- readonly _tag: "ModelResponseInterrupted";
1466
- readonly runId: string;
1467
- } | {
1468
- readonly _tag: "ModelCallAborted";
1469
- readonly runId: string;
1470
- readonly turnId: string;
1471
- readonly turn: number;
1472
- readonly restart: number;
1473
- readonly reason: "joined-input";
1474
- readonly modelUsage: readonly {
1475
- readonly provider: string;
1476
- readonly model: string;
1477
- readonly serviceTier?: string | undefined;
1478
- readonly pricingVersion?: string | undefined;
1479
- readonly response?: {
1480
- readonly id?: string | undefined;
1481
- readonly model?: string | undefined;
1482
- } | undefined;
1483
- readonly purpose?: "summary" | "turn" | undefined;
1312
+ readonly childSubmissionId: string;
1313
+ readonly childSettlementId: string;
1314
+ readonly childOutcome: "aborted" | "completed" | "failed";
1315
+ readonly usageSummary: Schema.Json;
1316
+ readonly usage?: {
1317
+ readonly modelCalls: number;
1318
+ readonly inputTokens: number;
1319
+ readonly outputTokens: number;
1320
+ readonly webSearchCalls?: number | undefined;
1321
+ readonly costMicrousd: number;
1484
1322
  readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1485
- readonly pricingStatus?: "estimated" | "unknown" | undefined;
1486
- readonly inputTokens: {
1487
- readonly total: number;
1488
- readonly uncached: number;
1489
- readonly cacheRead: number;
1490
- readonly cacheWrite: number;
1491
- };
1492
- readonly outputTokens: {
1493
- readonly total: number;
1494
- readonly text: number;
1495
- readonly reasoning: number;
1496
- };
1323
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1324
+ readonly unobservedModelCalls?: number | undefined;
1325
+ } | undefined;
1326
+ readonly delegatedUsage?: {
1327
+ readonly modelCalls: number;
1328
+ readonly inputTokens: number;
1329
+ readonly outputTokens: number;
1497
1330
  readonly webSearchCalls?: number | undefined;
1498
1331
  readonly costMicrousd: number;
1499
- }[];
1500
- readonly unobservedModelCalls: number;
1501
- } | {
1502
- readonly _tag: "RunFailed";
1503
- readonly runId: string;
1504
- readonly failure: Schema.Json;
1505
- } | {
1506
- readonly _tag: "RunCompleted";
1507
- readonly runId: string;
1508
- readonly output: Schema.Json;
1509
- readonly runDisposition?: Schema.Json | undefined;
1510
- readonly finishReason?: "budget-exhausted" | undefined;
1511
- readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
1332
+ readonly usageStatus?: "complete" | "partial" | "unknown" | undefined;
1333
+ readonly pricingStatus?: "complete" | "partial" | "unknown" | undefined;
1334
+ readonly unobservedModelCalls?: number | undefined;
1335
+ } | undefined;
1336
+ readonly reservationId: string;
1337
+ readonly finalAccounting: Schema.Json;
1512
1338
  } | {
1513
1339
  readonly _tag: "SubagentLineageRecorded";
1514
1340
  readonly parentLink: {
@@ -1564,6 +1390,141 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1564
1390
  readonly maxDepth: number;
1565
1391
  readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1566
1392
  } | undefined;
1393
+ } | {
1394
+ readonly _tag: "WorkerInputRequested";
1395
+ readonly admission: {
1396
+ readonly origin: {
1397
+ readonly worker: {
1398
+ readonly schemaVersion: 1;
1399
+ readonly delegationId: string;
1400
+ readonly targetAgentId: string;
1401
+ readonly threadId: string;
1402
+ };
1403
+ readonly source: {
1404
+ readonly _tag: "tool";
1405
+ readonly agentId: string;
1406
+ readonly threadId: string;
1407
+ readonly runId: string;
1408
+ readonly toolCallId: string;
1409
+ } | {
1410
+ readonly _tag: "programmatic";
1411
+ readonly agentId: string;
1412
+ readonly threadId: string;
1413
+ };
1414
+ readonly continuationOf?: {
1415
+ readonly worker: {
1416
+ readonly schemaVersion: 1;
1417
+ readonly delegationId: string;
1418
+ readonly targetAgentId: string;
1419
+ readonly threadId: string;
1420
+ };
1421
+ readonly receipt: {
1422
+ readonly receiptId: string;
1423
+ readonly submissionId: string;
1424
+ readonly threadId: string;
1425
+ readonly queueSequence: number;
1426
+ };
1427
+ readonly settlementId: string;
1428
+ } | undefined;
1429
+ readonly budgetScope: "source-subtree" | "worker-run";
1430
+ readonly lifecycle?: "assignment" | undefined;
1431
+ readonly targetDigests: {
1432
+ readonly agent: string;
1433
+ readonly model: string;
1434
+ readonly tools: string;
1435
+ readonly replay?: {
1436
+ readonly agent: string;
1437
+ readonly agentBehavior?: string | undefined;
1438
+ readonly tools: {
1439
+ readonly [x: string]: string;
1440
+ };
1441
+ } | undefined;
1442
+ };
1443
+ readonly policy: Schema.Json;
1444
+ readonly budget: {
1445
+ readonly caps: {
1446
+ readonly maxTotalChildInvocations?: number | undefined;
1447
+ readonly maxConcurrentChildren?: number | undefined;
1448
+ readonly maxTurns?: number | undefined;
1449
+ readonly maxToolCalls?: number | undefined;
1450
+ readonly maxDurationMillis?: number | undefined;
1451
+ readonly maxInputTokens?: number | undefined;
1452
+ readonly maxOutputTokens?: number | undefined;
1453
+ readonly maxCostMicrousd?: number | undefined;
1454
+ readonly maxResultBytes?: number | undefined;
1455
+ };
1456
+ readonly allocation: {
1457
+ readonly turns: number;
1458
+ readonly toolCalls: number;
1459
+ readonly durationMillis: number;
1460
+ readonly inputTokens: number;
1461
+ readonly outputTokens: number;
1462
+ readonly costMicrousd: number;
1463
+ readonly resultBytes: number;
1464
+ };
1465
+ readonly descendantInvocations?: number | undefined;
1466
+ };
1467
+ readonly grant: {
1468
+ readonly allowedToolNames: readonly string[];
1469
+ readonly maxDepth: number;
1470
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1471
+ };
1472
+ readonly depth: number;
1473
+ readonly toolCallAllowance?: number | undefined;
1474
+ readonly firstMessageId: string;
1475
+ readonly createdAtMillis: number;
1476
+ readonly expiresAtMillis: number;
1477
+ readonly reporting?: {
1478
+ readonly mode?: "standard" | undefined;
1479
+ readonly sourceDigests: {
1480
+ readonly agent: string;
1481
+ readonly model: string;
1482
+ readonly tools: string;
1483
+ readonly replay?: {
1484
+ readonly agent: string;
1485
+ readonly agentBehavior?: string | undefined;
1486
+ readonly tools: {
1487
+ readonly [x: string]: string;
1488
+ };
1489
+ } | undefined;
1490
+ };
1491
+ readonly destinationDelegationId?: string | undefined;
1492
+ readonly returnAddress?: {
1493
+ readonly input: Schema.Json;
1494
+ readonly principal: string;
1495
+ readonly policy: Schema.Json;
1496
+ readonly depth: number;
1497
+ readonly grant?: {
1498
+ readonly allowedToolNames: readonly string[];
1499
+ readonly maxDepth: number;
1500
+ readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
1501
+ } | undefined;
1502
+ readonly workerAdmission?: Schema.Json | undefined;
1503
+ } | undefined;
1504
+ } | undefined;
1505
+ };
1506
+ readonly executionRunId: string | null;
1507
+ readonly messageId: string;
1508
+ readonly parameters: Schema.Json;
1509
+ readonly createdAtMillis: number;
1510
+ readonly sourceSubmissionId?: string | undefined;
1511
+ readonly deliveryPrincipal?: string | undefined;
1512
+ readonly reportKind?: "update" | undefined;
1513
+ };
1514
+ readonly inputDigest: string;
1515
+ } | {
1516
+ readonly _tag: "WorkerStopRequested";
1517
+ readonly command: {
1518
+ readonly worker: {
1519
+ readonly schemaVersion: 1;
1520
+ readonly delegationId: string;
1521
+ readonly targetAgentId: string;
1522
+ readonly threadId: string;
1523
+ };
1524
+ readonly idempotencyKey: string;
1525
+ };
1526
+ readonly principal: string;
1527
+ readonly sourceSubmissionId?: string | undefined;
1567
1528
  } | {
1568
1529
  readonly _tag: "WorkHandoffCompleted";
1569
1530
  readonly preparationId: string;
@@ -1680,6 +1641,15 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1680
1641
  } | undefined;
1681
1642
  } | undefined;
1682
1643
  };
1644
+ } | {
1645
+ readonly _tag: "WorkerInputCompleted";
1646
+ readonly messageId: string;
1647
+ readonly workerThreadId: string;
1648
+ readonly submissionId: string;
1649
+ readonly receiptId: string;
1650
+ readonly settlementId: string;
1651
+ readonly completedAtMillis: number;
1652
+ readonly effectsResolved?: true | undefined;
1683
1653
  } | {
1684
1654
  readonly _tag: "WorkerInputRefused";
1685
1655
  readonly messageId: string;
@@ -1708,6 +1678,36 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1708
1678
  readonly createdAtMillis: number;
1709
1679
  readonly deadlineAtMillis: number;
1710
1680
  readonly predecessor?: string | undefined;
1681
+ } | {
1682
+ readonly _tag: "AgentUpdateEmitted";
1683
+ readonly update: {
1684
+ readonly schemaVersion: 1;
1685
+ readonly agentId: string;
1686
+ readonly threadId: string;
1687
+ readonly runId: string;
1688
+ readonly updateId: string;
1689
+ readonly sequence: number;
1690
+ readonly value: Schema.Json;
1691
+ };
1692
+ readonly definitions: {
1693
+ readonly agent: string;
1694
+ readonly model: string;
1695
+ readonly tools: string;
1696
+ readonly replay?: {
1697
+ readonly agent: string;
1698
+ readonly agentBehavior?: string | undefined;
1699
+ readonly tools: {
1700
+ readonly [x: string]: string;
1701
+ };
1702
+ } | undefined;
1703
+ };
1704
+ readonly delivery?: {
1705
+ readonly messageId: string;
1706
+ readonly envelope: Schema.Json;
1707
+ readonly createdAtMillis: number;
1708
+ readonly deadlineAtMillis: number;
1709
+ readonly predecessor?: string | undefined;
1710
+ } | undefined;
1711
1711
  } | {
1712
1712
  readonly _tag: "WorkerReportRefused";
1713
1713
  readonly runId: string;
@@ -1866,13 +1866,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1866
1866
  readonly author: string;
1867
1867
  readonly reason: string;
1868
1868
  readonly resolution: {
1869
+ readonly _tag: "SafeToRetry";
1870
+ } | {
1869
1871
  readonly _tag: "CompletedWithResult";
1870
1872
  readonly result: Schema.Json;
1871
1873
  readonly isFailure: boolean;
1872
1874
  } | {
1873
1875
  readonly _tag: "NeverHappened";
1874
- } | {
1875
- readonly _tag: "SafeToRetry";
1876
1876
  } | {
1877
1877
  readonly _tag: "AbortSubmission";
1878
1878
  };
@@ -1882,13 +1882,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1882
1882
  } | {
1883
1883
  readonly _tag: "HostFailed";
1884
1884
  readonly failure: {
1885
- readonly _tag: "DurableAlarmError";
1885
+ readonly _tag: "LedgerError";
1886
1886
  readonly operation: string;
1887
1887
  readonly message: string;
1888
- readonly cause?: Schema.Json | undefined;
1889
- } | {
1890
- readonly _tag: "ThreadNotMaterialized";
1891
- readonly threadId: string;
1888
+ readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
1892
1889
  } | {
1893
1890
  readonly _tag: "ThreadStoreError";
1894
1891
  readonly operation: string;
@@ -1902,10 +1899,8 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1902
1899
  readonly sequence?: number | undefined;
1903
1900
  } | undefined;
1904
1901
  } | {
1905
- readonly _tag: "LedgerError";
1906
- readonly operation: string;
1907
- readonly message: string;
1908
- readonly cause?: import("@yielded/agent/failure-diagnostic").Diagnostic | undefined;
1902
+ readonly _tag: "ThreadNotMaterialized";
1903
+ readonly threadId: string;
1909
1904
  } | {
1910
1905
  readonly _tag: "AppendConflict";
1911
1906
  readonly threadId: string;
@@ -1953,6 +1948,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1953
1948
  readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
1954
1949
  readonly actual: number;
1955
1950
  readonly maximum: number;
1951
+ } | {
1952
+ readonly _tag: "DurableAlarmError";
1953
+ readonly operation: string;
1954
+ readonly message: string;
1955
+ readonly cause?: Schema.Json | undefined;
1956
1956
  } | {
1957
1957
  readonly _tag: "HostProtocolError";
1958
1958
  readonly message: string;
@@ -2052,4 +2052,4 @@ declare class CloudflareThreadClient extends CloudflareThreadClient_base {
2052
2052
  }
2053
2053
  //#endregion
2054
2054
  export { boundHostDiagnostic as A, decodeUnknownResolutionCommand as B, SettlementReached as C, SubmitSucceeded as D, SubmitRequest as E, decodeCancelProgressRequest as F, encodeCancelProgressRequest as G, encodeApprovalDecisionCommand as H, decodeHostResponse as I, encodeReceipt as J, encodeHostResponse as K, decodeObservePageRequest as L, decodeApprovalDecisionCommand as M, decodeAwaitProgressRequest as N, ThreadClientError as O, decodeAwaitSettlementRequest as P, decodeReceipt as R, ProgressObserved as S, SubmissionStatusResponse as T, encodeAwaitProgressRequest as U, encodeAbortCommand as V, encodeAwaitSettlementRequest as W, encodeUnknownResolutionCommand as X, encodeSubmitRequest as Y, Frame as Z, HostProtocolError as _, CancelProgressRequest as a, ObservedPage as b, ClientAwaitFailure as c, ClientSubmitFailure as d, ClientUnknownFailure as f, HostFailure as g, HostFailed as h, AwaitSettlementRequest as i, decodeAbortCommand as j, UnknownResolutionRecorded as k, ClientObserveFailure as l, CloudflareThreadClient_d_exports as m, ApprovalRecorded as n, ClientAbortFailure as o, CloudflareThreadClient as p, encodeObservePageRequest as q, AwaitProgressRequest as r, ClientApprovalFailure as s, AbortRecorded as t, ClientProgressFailure as u, HostResponse as v, SettlementRecordReached as w, ProgressCancelled as x, ObservePageRequest as y, decodeSubmitRequest as z };
2055
- //# sourceMappingURL=CloudflareThreadClient-lTm6baDP.d.mts.map
2055
+ //# sourceMappingURL=CloudflareThreadClient-HO_3rkM7.d.mts.map