@get-bb/plugin-sdk 0.4.84 → 0.4.87

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.
@@ -963,7 +963,6 @@ function createBridgeRecorder(args) {
963
963
  }
964
964
  }
965
965
  return {
966
- dir,
967
966
  record,
968
967
  recordRuntimeLine,
969
968
  recordChildIo,
@@ -1017,260 +1016,37 @@ function withoutBridgeRuntimeEnv(env) {
1017
1016
  }
1018
1017
 
1019
1018
  // ../provider-bridge-protocol/src/bridge-kit/bridge-tool-calls.ts
1019
+ import { z as z21 } from "zod";
1020
+
1021
+ // ../domain/src/context-snapshot.ts
1020
1022
  import { z as z3 } from "zod";
1021
- var providerToolCallResponseSchema = z3.object({
1022
- success: z3.boolean(),
1023
- contentItems: z3.array(
1024
- z3.discriminatedUnion("type", [
1025
- z3.object({
1026
- type: z3.literal("inputText"),
1027
- text: z3.string()
1028
- }),
1029
- z3.object({
1030
- type: z3.literal("inputImage"),
1031
- imageUrl: z3.string().min(1)
1032
- })
1033
- ])
1034
- )
1035
- });
1036
- var bridgeRequestEnvelopeSchema = z3.object({
1037
- jsonrpc: z3.literal("2.0"),
1038
- id: z3.union([z3.string(), z3.number()]),
1039
- method: z3.string(),
1040
- params: z3.record(z3.string(), z3.unknown()).optional()
1041
- });
1042
- var jsonRpcErrorSchema = z3.object({
1043
- code: z3.number(),
1044
- message: z3.string().optional(),
1045
- data: z3.unknown().optional()
1046
- });
1047
- var jsonRpcSuccessResponseSchema = z3.object({
1048
- jsonrpc: z3.literal("2.0"),
1049
- id: z3.union([z3.string(), z3.number()]),
1050
- result: z3.unknown()
1051
- });
1052
- var jsonRpcErrorResponseSchema = z3.object({
1053
- jsonrpc: z3.literal("2.0"),
1054
- id: z3.union([z3.string(), z3.number()]),
1055
- error: jsonRpcErrorSchema
1023
+ var tokenCountSchema = z3.number().int().nonnegative();
1024
+ var contextEntrySchema = z3.object({
1025
+ id: z3.string().min(1),
1026
+ label: z3.string().min(1),
1027
+ tokens: tokenCountSchema
1028
+ });
1029
+ var contextCategorySchema = z3.object({
1030
+ id: z3.string().min(1),
1031
+ label: z3.string().min(1),
1032
+ kind: z3.enum(["used", "free", "reserved", "deferred"]),
1033
+ tokens: tokenCountSchema,
1034
+ entries: z3.array(contextEntrySchema)
1035
+ });
1036
+ var contextSnapshotSchema = z3.object({
1037
+ capturedAt: z3.iso.datetime(),
1038
+ providerSessionId: z3.string().min(1),
1039
+ providerTurnId: z3.string().min(1).nullable(),
1040
+ model: z3.string().min(1),
1041
+ usedTokens: tokenCountSchema,
1042
+ contextWindowTokens: z3.number().int().positive(),
1043
+ autoCompactAtTokens: z3.number().int().positive().nullable(),
1044
+ estimated: z3.boolean(),
1045
+ categories: z3.array(contextCategorySchema)
1056
1046
  });
1057
- function isJsonRpcRequest(input) {
1058
- return typeof input === "object" && input !== null && "method" in input && input.method !== void 0;
1059
- }
1060
- function decodeBridgeJsonRpcResponse(input) {
1061
- if (isJsonRpcRequest(input)) return null;
1062
- const error = jsonRpcErrorResponseSchema.safeParse(input);
1063
- if (error.success) return error.data;
1064
- const success = jsonRpcSuccessResponseSchema.safeParse(input);
1065
- return success.success ? success.data : null;
1066
- }
1067
- var IMAGE_DATA_URL = /^data:(.+);base64,(.+)$/s;
1068
- function decodeImageDataUrl(imageUrl) {
1069
- const match = IMAGE_DATA_URL.exec(imageUrl);
1070
- if (match === null) {
1071
- return null;
1072
- }
1073
- const [, mimeType, data] = match;
1074
- if (data.length === 0) {
1075
- return null;
1076
- }
1077
- return { data, mimeType };
1078
- }
1079
- function decodeToolCallResponsePayload(result) {
1080
- const parsed = providerToolCallResponseSchema.safeParse(result);
1081
- if (!parsed.success) {
1082
- return {
1083
- content: "Invalid tool call response",
1084
- contentBlocks: [{ type: "text", text: "Invalid tool call response" }],
1085
- images: [],
1086
- isError: true
1087
- };
1088
- }
1089
- const texts = [];
1090
- const contentBlocks = [];
1091
- const images = [];
1092
- for (const item of parsed.data.contentItems) {
1093
- if (item.type === "inputText") {
1094
- texts.push(item.text);
1095
- if (item.text !== "") {
1096
- contentBlocks.push({ type: "text", text: item.text });
1097
- }
1098
- continue;
1099
- }
1100
- const image = decodeImageDataUrl(item.imageUrl);
1101
- if (image === null) {
1102
- texts.push(item.imageUrl);
1103
- contentBlocks.push({ type: "text", text: item.imageUrl });
1104
- continue;
1105
- }
1106
- images.push(image);
1107
- contentBlocks.push({ type: "image", ...image });
1108
- }
1109
- const text = texts.join("\n");
1110
- const isError = !parsed.data.success;
1111
- if (contentBlocks.length === 0) {
1112
- const fallback = isError ? "Tool call failed" : "OK";
1113
- return {
1114
- content: fallback,
1115
- contentBlocks: [{ type: "text", text: fallback }],
1116
- images,
1117
- isError
1118
- };
1119
- }
1120
- return {
1121
- content: text,
1122
- contentBlocks,
1123
- images,
1124
- isError
1125
- };
1126
- }
1127
- function buildBridgeToolCallContent(result) {
1128
- if (result.contentBlocks !== void 0) {
1129
- return result.contentBlocks;
1130
- }
1131
- const blocks = [];
1132
- if (result.content !== "") {
1133
- blocks.push({ type: "text", text: result.content });
1134
- }
1135
- for (const image of result.images ?? []) {
1136
- blocks.push({ type: "image", data: image.data, mimeType: image.mimeType });
1137
- }
1138
- return blocks;
1139
- }
1140
-
1141
- // ../provider-bridge-protocol/src/bridge-kit/json-rpc-envelope.ts
1142
- import { z as z4 } from "zod";
1143
- var recordSchema = z4.record(z4.string(), z4.unknown());
1144
- var jsonRpcEnvelopeSchema = z4.object({
1145
- jsonrpc: z4.literal("2.0"),
1146
- method: z4.string(),
1147
- params: recordSchema.optional()
1148
- }).passthrough();
1149
- var sdkMessageEnvelopeSchema = z4.object({
1150
- jsonrpc: z4.literal("2.0"),
1151
- method: z4.literal("sdk/message"),
1152
- params: z4.object({
1153
- message: z4.unknown(),
1154
- threadId: z4.string().optional(),
1155
- parent_tool_use_id: z4.string().optional()
1156
- }).passthrough()
1157
- }).passthrough();
1158
- var threadIdentityEnvelopeSchema = z4.object({
1159
- jsonrpc: z4.literal("2.0"),
1160
- method: z4.literal("thread/identity"),
1161
- params: z4.object({
1162
- threadId: z4.string().optional(),
1163
- providerThreadId: z4.string().optional()
1164
- }).passthrough()
1165
- }).passthrough();
1166
- var threadContextWindowUsageEnvelopeSchema = z4.object({
1167
- jsonrpc: z4.literal("2.0"),
1168
- method: z4.literal("thread/contextWindowUsage/updated"),
1169
- params: z4.object({
1170
- threadId: z4.string().optional(),
1171
- contextWindowUsage: z4.object({
1172
- usedTokens: z4.number().nullable(),
1173
- modelContextWindow: z4.number().nullable(),
1174
- estimated: z4.boolean()
1175
- })
1176
- }).passthrough()
1177
- }).passthrough();
1178
- var errorEnvelopeSchema = z4.object({
1179
- jsonrpc: z4.literal("2.0"),
1180
- method: z4.literal("error"),
1181
- params: z4.object({
1182
- message: z4.string().optional()
1183
- }).passthrough().optional()
1184
- }).passthrough();
1185
-
1186
- // ../provider-bridge-protocol/src/bridge-kit/mime-types.ts
1187
- import { extname } from "node:path";
1188
- function mimeTypeFromExtension(filePath) {
1189
- switch (extname(filePath).toLowerCase()) {
1190
- case ".png":
1191
- return "image/png";
1192
- case ".jpg":
1193
- case ".jpeg":
1194
- return "image/jpeg";
1195
- case ".gif":
1196
- return "image/gif";
1197
- case ".webp":
1198
- return "image/webp";
1199
- case ".svg":
1200
- return "image/svg+xml";
1201
- default:
1202
- return "image/png";
1203
- }
1204
- }
1205
-
1206
- // ../provider-bridge-protocol/src/bridge-kit/pending-tool-call-tracker.ts
1207
- function createPendingToolCallTracker(options) {
1208
- const pendingToolCalls = /* @__PURE__ */ new Map();
1209
- let requestIdCounter = 0;
1210
- return {
1211
- forwardToolCall: (args) => {
1212
- return new Promise((resolve2) => {
1213
- requestIdCounter += 1;
1214
- const requestId = requestIdCounter;
1215
- pendingToolCalls.set(requestId, { resolve: resolve2, scope: args.scope });
1216
- try {
1217
- options.sendToolCall({
1218
- jsonrpc: "2.0",
1219
- id: requestId,
1220
- method: "item/tool/call",
1221
- params: {
1222
- threadId: args.threadId,
1223
- providerThreadId: args.providerThreadId,
1224
- turnId: null,
1225
- callId: `call-${requestId}`,
1226
- tool: args.toolName,
1227
- arguments: args.arguments
1228
- }
1229
- });
1230
- } catch (error) {
1231
- pendingToolCalls.delete(requestId);
1232
- resolve2({
1233
- content: error instanceof Error ? error.message : String(error),
1234
- isError: true
1235
- });
1236
- }
1237
- });
1238
- },
1239
- handleToolCallResponse: (response) => {
1240
- const pending = pendingToolCalls.get(response.id);
1241
- if (!pending) {
1242
- return false;
1243
- }
1244
- pendingToolCalls.delete(response.id);
1245
- if ("error" in response) {
1246
- pending.resolve({
1247
- content: response.error.message ?? "Tool call failed",
1248
- isError: true
1249
- });
1250
- } else {
1251
- pending.resolve(decodeToolCallResponsePayload(response.result));
1252
- }
1253
- return true;
1254
- },
1255
- resolvePendingToolCalls: (scope, message) => {
1256
- for (const [requestId, pending] of pendingToolCalls) {
1257
- if (pending.scope !== scope) {
1258
- continue;
1259
- }
1260
- pendingToolCalls.delete(requestId);
1261
- pending.resolve({ content: message, isError: true });
1262
- }
1263
- }
1264
- };
1265
- }
1266
-
1267
- // ../provider-bridge-protocol/src/bridge-kit/permission-policy.ts
1268
- function shouldAutoDenyInteractiveRequest(policy) {
1269
- return policy.permissionEscalation === "deny";
1270
- }
1271
1047
 
1272
1048
  // ../domain/src/acp-cli.ts
1273
- import { z as z7 } from "zod";
1049
+ import { z as z6 } from "zod";
1274
1050
 
1275
1051
  // ../domain/src/provider-skill-roots.ts
1276
1052
  function isAbsoluteProviderSkillRootPath(value) {
@@ -1294,22 +1070,22 @@ function isRelativeProviderSkillRootPath(value) {
1294
1070
  }
1295
1071
 
1296
1072
  // ../domain/src/shared-types.ts
1297
- import { z as z6 } from "zod";
1073
+ import { z as z5 } from "zod";
1298
1074
 
1299
1075
  // ../domain/src/json-value.ts
1300
- import { z as z5 } from "zod";
1301
- var jsonValueSchema = z5.lazy(
1302
- () => z5.union([
1303
- z5.string(),
1304
- z5.number(),
1305
- z5.boolean(),
1306
- z5.null(),
1307
- z5.array(jsonValueSchema),
1308
- z5.record(z5.string(), jsonValueSchema)
1076
+ import { z as z4 } from "zod";
1077
+ var jsonValueSchema = z4.lazy(
1078
+ () => z4.union([
1079
+ z4.string(),
1080
+ z4.number(),
1081
+ z4.boolean(),
1082
+ z4.null(),
1083
+ z4.array(jsonValueSchema),
1084
+ z4.record(z4.string(), jsonValueSchema)
1309
1085
  ])
1310
1086
  );
1311
- var jsonObjectSchema = z5.record(
1312
- z5.string(),
1087
+ var jsonObjectSchema = z4.record(
1088
+ z4.string(),
1313
1089
  jsonValueSchema
1314
1090
  );
1315
1091
 
@@ -1324,42 +1100,42 @@ var reasoningLevelValues = [
1324
1100
  "max",
1325
1101
  "ultra"
1326
1102
  ];
1327
- var reasoningLevelSchema = z6.enum(reasoningLevelValues);
1328
- var serviceTierSchema = z6.enum(["fast", "default"]);
1103
+ var reasoningLevelSchema = z5.enum(reasoningLevelValues);
1104
+ var serviceTierSchema = z5.enum(["fast", "default"]);
1329
1105
  var instructionModeValues = ["append", "replace"];
1330
- var instructionModeSchema = z6.enum(instructionModeValues);
1106
+ var instructionModeSchema = z5.enum(instructionModeValues);
1331
1107
  var permissionModeValues = ["accept-edits", "auto", "full"];
1332
- var permissionModeSchema = z6.enum(permissionModeValues);
1333
- var permissionModeInputSchema = z6.union([permissionModeSchema, z6.literal("workspace-write")]).transform(
1108
+ var permissionModeSchema = z5.enum(permissionModeValues);
1109
+ var permissionModeInputSchema = z5.union([permissionModeSchema, z5.literal("workspace-write")]).transform(
1334
1110
  (permissionMode) => permissionMode === "workspace-write" ? "accept-edits" : permissionMode
1335
1111
  );
1336
1112
  var legacyRecordedPermissionModeValues = [
1337
1113
  "workspace-write",
1338
1114
  "readonly"
1339
1115
  ];
1340
- var recordedPermissionModeSchema = z6.enum([
1116
+ var recordedPermissionModeSchema = z5.enum([
1341
1117
  ...permissionModeValues,
1342
1118
  ...legacyRecordedPermissionModeValues
1343
1119
  ]);
1344
1120
  var permissionEscalationValues = ["ask", "deny"];
1345
- var permissionEscalationSchema = z6.enum(permissionEscalationValues);
1121
+ var permissionEscalationSchema = z5.enum(permissionEscalationValues);
1346
1122
  var promptInputVisibilityValues = ["agent-only"];
1347
- var promptInputVisibilitySchema = z6.enum(promptInputVisibilityValues);
1123
+ var promptInputVisibilitySchema = z5.enum(promptInputVisibilityValues);
1348
1124
  var promptInputVisibilityFields = {
1349
1125
  visibility: promptInputVisibilitySchema.optional()
1350
1126
  };
1351
1127
  var promptMentionPathSourceValues = ["workspace", "thread-storage"];
1352
- var promptMentionPathSourceSchema = z6.enum(promptMentionPathSourceValues);
1128
+ var promptMentionPathSourceSchema = z5.enum(promptMentionPathSourceValues);
1353
1129
  var promptMentionPathEntryKindValues = ["file", "directory"];
1354
- var promptMentionPathEntryKindSchema = z6.enum(
1130
+ var promptMentionPathEntryKindSchema = z5.enum(
1355
1131
  promptMentionPathEntryKindValues
1356
1132
  );
1357
1133
  var promptMentionCommandTriggerValues = ["/"];
1358
- var promptMentionCommandTriggerSchema = z6.enum(
1134
+ var promptMentionCommandTriggerSchema = z5.enum(
1359
1135
  promptMentionCommandTriggerValues
1360
1136
  );
1361
1137
  var promptMentionCommandSourceValues = ["skill", "command"];
1362
- var promptMentionCommandSourceSchema = z6.enum(
1138
+ var promptMentionCommandSourceSchema = z5.enum(
1363
1139
  promptMentionCommandSourceValues
1364
1140
  );
1365
1141
  var promptMentionCommandOriginValues = [
@@ -1367,48 +1143,48 @@ var promptMentionCommandOriginValues = [
1367
1143
  "project",
1368
1144
  "user"
1369
1145
  ];
1370
- var promptMentionCommandOriginSchema = z6.enum(
1146
+ var promptMentionCommandOriginSchema = z5.enum(
1371
1147
  promptMentionCommandOriginValues
1372
1148
  );
1373
- var canonicalPromptMentionResourceSchema = z6.discriminatedUnion("kind", [
1374
- z6.object({
1375
- kind: z6.literal("thread"),
1376
- threadId: z6.string(),
1377
- projectId: z6.string().optional(),
1378
- label: z6.string()
1149
+ var canonicalPromptMentionResourceSchema = z5.discriminatedUnion("kind", [
1150
+ z5.object({
1151
+ kind: z5.literal("thread"),
1152
+ threadId: z5.string(),
1153
+ projectId: z5.string().optional(),
1154
+ label: z5.string()
1379
1155
  }),
1380
- z6.object({
1381
- kind: z6.literal("project"),
1382
- projectId: z6.string(),
1383
- label: z6.string()
1156
+ z5.object({
1157
+ kind: z5.literal("project"),
1158
+ projectId: z5.string(),
1159
+ label: z5.string()
1384
1160
  }),
1385
- z6.object({
1386
- kind: z6.literal("section"),
1387
- sectionId: z6.string(),
1388
- label: z6.string()
1161
+ z5.object({
1162
+ kind: z5.literal("section"),
1163
+ sectionId: z5.string(),
1164
+ label: z5.string()
1389
1165
  }),
1390
- z6.object({
1391
- kind: z6.literal("path"),
1166
+ z5.object({
1167
+ kind: z5.literal("path"),
1392
1168
  source: promptMentionPathSourceSchema,
1393
1169
  entryKind: promptMentionPathEntryKindSchema,
1394
- path: z6.string(),
1395
- label: z6.string()
1170
+ path: z5.string(),
1171
+ label: z5.string()
1396
1172
  }),
1397
- z6.object({
1398
- kind: z6.literal("command"),
1173
+ z5.object({
1174
+ kind: z5.literal("command"),
1399
1175
  trigger: promptMentionCommandTriggerSchema,
1400
- name: z6.string(),
1176
+ name: z5.string(),
1401
1177
  source: promptMentionCommandSourceSchema,
1402
1178
  origin: promptMentionCommandOriginSchema,
1403
- label: z6.string(),
1404
- argumentHint: z6.string().nullable()
1179
+ label: z5.string(),
1180
+ argumentHint: z5.string().nullable()
1405
1181
  }),
1406
- z6.object({
1407
- kind: z6.literal("plugin"),
1408
- pluginId: z6.string(),
1409
- icon: z6.string().nullable().optional(),
1410
- itemId: z6.string(),
1411
- label: z6.string()
1182
+ z5.object({
1183
+ kind: z5.literal("plugin"),
1184
+ pluginId: z5.string(),
1185
+ icon: z5.string().nullable().optional(),
1186
+ itemId: z5.string(),
1187
+ label: z5.string()
1412
1188
  })
1413
1189
  ]);
1414
1190
  function normalizeLegacyPromptMentionResource(value) {
@@ -1422,38 +1198,38 @@ function normalizeLegacyPromptMentionResource(value) {
1422
1198
  const { folderId, ...rest } = record;
1423
1199
  return { ...rest, kind: "section", sectionId: folderId };
1424
1200
  }
1425
- var promptMentionResourceSchema = z6.preprocess(
1201
+ var promptMentionResourceSchema = z5.preprocess(
1426
1202
  normalizeLegacyPromptMentionResource,
1427
1203
  canonicalPromptMentionResourceSchema
1428
1204
  );
1429
- var promptTextMentionSchema = z6.object({
1430
- start: z6.number().int().nonnegative(),
1431
- end: z6.number().int().nonnegative(),
1205
+ var promptTextMentionSchema = z5.object({
1206
+ start: z5.number().int().nonnegative(),
1207
+ end: z5.number().int().nonnegative(),
1432
1208
  resource: promptMentionResourceSchema
1433
1209
  });
1434
- var promptInputSchema = z6.discriminatedUnion("type", [
1435
- z6.object({
1436
- type: z6.literal("text"),
1437
- text: z6.string(),
1438
- mentions: z6.array(promptTextMentionSchema).default([]),
1210
+ var promptInputSchema = z5.discriminatedUnion("type", [
1211
+ z5.object({
1212
+ type: z5.literal("text"),
1213
+ text: z5.string(),
1214
+ mentions: z5.array(promptTextMentionSchema).default([]),
1439
1215
  ...promptInputVisibilityFields
1440
1216
  }),
1441
- z6.object({
1442
- type: z6.literal("image"),
1443
- url: z6.string().url(),
1217
+ z5.object({
1218
+ type: z5.literal("image"),
1219
+ url: z5.string().url(),
1444
1220
  ...promptInputVisibilityFields
1445
1221
  }),
1446
- z6.object({
1447
- type: z6.literal("localImage"),
1448
- path: z6.string(),
1222
+ z5.object({
1223
+ type: z5.literal("localImage"),
1224
+ path: z5.string(),
1449
1225
  ...promptInputVisibilityFields
1450
1226
  }),
1451
- z6.object({
1452
- type: z6.literal("localFile"),
1453
- path: z6.string(),
1454
- name: z6.string().optional(),
1455
- sizeBytes: z6.number().int().nonnegative().optional(),
1456
- mimeType: z6.string().optional(),
1227
+ z5.object({
1228
+ type: z5.literal("localFile"),
1229
+ path: z5.string(),
1230
+ name: z5.string().optional(),
1231
+ sizeBytes: z5.number().int().nonnegative().optional(),
1232
+ mimeType: z5.string().optional(),
1457
1233
  ...promptInputVisibilityFields
1458
1234
  })
1459
1235
  ]);
@@ -1531,7 +1307,7 @@ function removeCommandMentionsFromPromptInput(input, selector) {
1531
1307
  (item) => item.type === "text" ? removeCommandMentionsFromTextInput(item, selector) : item
1532
1308
  );
1533
1309
  }
1534
- var threadExecutionSourceSchema = z6.enum([
1310
+ var threadExecutionSourceSchema = z5.enum([
1535
1311
  "client/thread/start",
1536
1312
  "client/turn/requested",
1537
1313
  "client/turn/start"
@@ -1540,19 +1316,19 @@ var callerExecutionInputSourceValues = [
1540
1316
  "explicit",
1541
1317
  "client-preference"
1542
1318
  ];
1543
- var callerExecutionInputSourceSchema = z6.enum(
1319
+ var callerExecutionInputSourceSchema = z5.enum(
1544
1320
  callerExecutionInputSourceValues
1545
1321
  );
1546
- var threadExecutionOptionsSchema = z6.object({
1547
- model: z6.string().optional(),
1322
+ var threadExecutionOptionsSchema = z5.object({
1323
+ model: z5.string().optional(),
1548
1324
  serviceTier: serviceTierSchema.optional(),
1549
1325
  reasoningLevel: reasoningLevelSchema.optional(),
1550
1326
  permissionMode: permissionModeSchema.optional(),
1551
1327
  source: threadExecutionSourceSchema.optional(),
1552
- seq: z6.number().int().optional()
1328
+ seq: z5.number().int().optional()
1553
1329
  });
1554
1330
  var resolvedThreadExecutionOptionsSchema = threadExecutionOptionsSchema.extend({
1555
- model: z6.string().min(1),
1331
+ model: z5.string().min(1),
1556
1332
  serviceTier: serviceTierSchema,
1557
1333
  reasoningLevel: reasoningLevelSchema,
1558
1334
  permissionMode: permissionModeSchema,
@@ -1562,53 +1338,53 @@ var recordedThreadExecutionOptionsSchema = resolvedThreadExecutionOptionsSchema.
1562
1338
  permissionMode: recordedPermissionModeSchema
1563
1339
  });
1564
1340
  var runtimePermissionScopeValues = ["workspace", "full"];
1565
- var runtimePermissionScopeSchema = z6.enum(runtimePermissionScopeValues);
1566
- var runtimePermissionPolicySchema = z6.discriminatedUnion(
1341
+ var runtimePermissionScopeSchema = z5.enum(runtimePermissionScopeValues);
1342
+ var runtimePermissionPolicySchema = z5.discriminatedUnion(
1567
1343
  "permissionMode",
1568
1344
  [
1569
- z6.object({
1570
- permissionMode: z6.literal("accept-edits"),
1571
- permissionScope: z6.literal("workspace"),
1572
- approvalReviewer: z6.literal("user"),
1345
+ z5.object({
1346
+ permissionMode: z5.literal("accept-edits"),
1347
+ permissionScope: z5.literal("workspace"),
1348
+ approvalReviewer: z5.literal("user"),
1573
1349
  permissionEscalation: permissionEscalationSchema
1574
1350
  }),
1575
- z6.object({
1576
- permissionMode: z6.literal("auto"),
1577
- permissionScope: z6.literal("workspace"),
1578
- approvalReviewer: z6.literal("automatic"),
1351
+ z5.object({
1352
+ permissionMode: z5.literal("auto"),
1353
+ permissionScope: z5.literal("workspace"),
1354
+ approvalReviewer: z5.literal("automatic"),
1579
1355
  permissionEscalation: permissionEscalationSchema
1580
1356
  }),
1581
- z6.object({
1582
- permissionMode: z6.literal("full"),
1583
- permissionScope: z6.literal("full"),
1584
- approvalReviewer: z6.null(),
1585
- permissionEscalation: z6.null()
1357
+ z5.object({
1358
+ permissionMode: z5.literal("full"),
1359
+ permissionScope: z5.literal("full"),
1360
+ approvalReviewer: z5.null(),
1361
+ permissionEscalation: z5.null()
1586
1362
  })
1587
1363
  ]
1588
1364
  );
1589
- var promptModeSchema = z6.literal("plan");
1590
- var runtimeThreadExecutionBaseOptionsSchema = z6.object({
1591
- model: z6.string().min(1),
1365
+ var promptModeSchema = z5.literal("plan");
1366
+ var runtimeThreadExecutionBaseOptionsSchema = z5.object({
1367
+ model: z5.string().min(1),
1592
1368
  serviceTier: serviceTierSchema,
1593
1369
  reasoningLevel: reasoningLevelSchema,
1594
1370
  promptMode: promptModeSchema.optional(),
1595
1371
  providerOptions: jsonObjectSchema
1596
1372
  });
1597
1373
  var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
1598
- var projectExecutionDefaultsSchema = z6.object({
1599
- providerId: z6.string().min(1),
1600
- model: z6.string().min(1),
1374
+ var projectExecutionDefaultsSchema = z5.object({
1375
+ providerId: z5.string().min(1),
1376
+ model: z5.string().min(1),
1601
1377
  serviceTier: serviceTierSchema,
1602
1378
  reasoningLevel: reasoningLevelSchema,
1603
1379
  permissionMode: permissionModeSchema
1604
1380
  });
1605
1381
 
1606
1382
  // ../domain/src/acp-cli.ts
1607
- var providerSkillRootPathSchema = z7.string().min(1).refine(
1383
+ var providerSkillRootPathSchema = z6.string().min(1).refine(
1608
1384
  isRelativeProviderSkillRootPath,
1609
1385
  "Skill roots must be relative paths without dot segments"
1610
1386
  );
1611
- var uniqueProviderSkillRootPathsSchema = z7.array(providerSkillRootPathSchema).superRefine((paths, context) => {
1387
+ var uniqueProviderSkillRootPathsSchema = z6.array(providerSkillRootPathSchema).superRefine((paths, context) => {
1612
1388
  if (new Set(paths).size !== paths.length) {
1613
1389
  context.addIssue({
1614
1390
  code: "custom",
@@ -1616,17 +1392,17 @@ var uniqueProviderSkillRootPathsSchema = z7.array(providerSkillRootPathSchema).s
1616
1392
  });
1617
1393
  }
1618
1394
  });
1619
- var providerNativeSkillRootsSchema = z7.object({
1395
+ var providerNativeSkillRootsSchema = z6.object({
1620
1396
  user: uniqueProviderSkillRootPathsSchema.default([]),
1621
1397
  project: uniqueProviderSkillRootPathsSchema.default([])
1622
1398
  }).strict();
1623
- var acpReasoningCliLevelValueOverridesSchema = z7.partialRecord(
1399
+ var acpReasoningCliLevelValueOverridesSchema = z6.partialRecord(
1624
1400
  reasoningLevelSchema,
1625
- z7.string().min(1)
1401
+ z6.string().min(1)
1626
1402
  );
1627
- var acpReasoningCliSchema = z7.object({
1628
- flag: z7.string().min(1),
1629
- supportedLevels: z7.array(reasoningLevelSchema).min(1),
1403
+ var acpReasoningCliSchema = z6.object({
1404
+ flag: z6.string().min(1),
1405
+ supportedLevels: z6.array(reasoningLevelSchema).min(1),
1630
1406
  levelValues: acpReasoningCliLevelValueOverridesSchema.optional(),
1631
1407
  defaultLevel: reasoningLevelSchema.optional()
1632
1408
  }).strict().superRefine((reasoningCli, context) => {
@@ -1646,9 +1422,9 @@ var acpReasoningCliSchema = z7.object({
1646
1422
  });
1647
1423
  }
1648
1424
  });
1649
- var acpNativeReasoningSchema = z7.object({
1650
- configId: z7.string().min(1),
1651
- supportedLevels: z7.array(reasoningLevelSchema).min(1),
1425
+ var acpNativeReasoningSchema = z6.object({
1426
+ configId: z6.string().min(1),
1427
+ supportedLevels: z6.array(reasoningLevelSchema).min(1),
1652
1428
  levelValues: acpReasoningCliLevelValueOverridesSchema.optional(),
1653
1429
  defaultLevel: reasoningLevelSchema.optional()
1654
1430
  }).strict().superRefine((nativeReasoning, context) => {
@@ -1668,12 +1444,12 @@ var acpNativeReasoningSchema = z7.object({
1668
1444
  });
1669
1445
  }
1670
1446
  });
1671
- var acpPermissionCliArgsSchema = z7.array(z7.string().min(1)).min(1);
1672
- var acpPermissionCliSchema = z7.object({
1447
+ var acpPermissionCliArgsSchema = z6.array(z6.string().min(1)).min(1);
1448
+ var acpPermissionCliSchema = z6.object({
1673
1449
  full: acpPermissionCliArgsSchema.optional(),
1674
1450
  workspaceWrite: acpPermissionCliArgsSchema.optional(),
1675
1451
  readonly: acpPermissionCliArgsSchema.optional(),
1676
- insertAfterArgs: z7.number().int().min(0).optional()
1452
+ insertAfterArgs: z6.number().int().min(0).optional()
1677
1453
  }).strict().superRefine((permissionCli, context) => {
1678
1454
  if (permissionCli.full === void 0 && permissionCli.workspaceWrite === void 0 && permissionCli.readonly === void 0) {
1679
1455
  context.addIssue({
@@ -1684,36 +1460,36 @@ var acpPermissionCliSchema = z7.object({
1684
1460
  });
1685
1461
 
1686
1462
  // ../domain/src/native-roots.ts
1687
- import { z as z8 } from "zod";
1463
+ import { z as z7 } from "zod";
1688
1464
  var PROVIDER_NATIVE_ROOTS_MAX = 32;
1689
1465
  var PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u;
1690
- var nativeRootNamePrefixSchema = z8.string().refine(
1466
+ var nativeRootNamePrefixSchema = z7.string().refine(
1691
1467
  (value) => value === "" || PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN.test(value),
1692
1468
  "A root name prefix is a plugin-name-like token ending in ':'"
1693
1469
  );
1694
- var nativeRootManifestPathSchema = z8.string().min(1).refine(
1470
+ var nativeRootManifestPathSchema = z7.string().min(1).refine(
1695
1471
  isRelativeProviderSkillRootPath,
1696
1472
  "A manifest marker is a relative path without dot segments"
1697
1473
  );
1698
- var relativeNativeRootPathSchema = z8.string().min(1).refine(
1474
+ var relativeNativeRootPathSchema = z7.string().min(1).refine(
1699
1475
  isRelativeProviderSkillRootPath,
1700
1476
  "Roots must be relative paths without dot segments"
1701
1477
  );
1702
- var absoluteNativeRootPathSchema = z8.string().min(1).refine(
1478
+ var absoluteNativeRootPathSchema = z7.string().min(1).refine(
1703
1479
  isAbsoluteProviderSkillRootPath,
1704
1480
  "Absolute roots must be absolute paths without dot segments"
1705
1481
  );
1706
- var providerNativeRootInputSchema = z8.union([
1707
- z8.string().min(1),
1708
- z8.object({
1709
- path: z8.string().min(1),
1482
+ var providerNativeRootInputSchema = z7.union([
1483
+ z7.string().min(1),
1484
+ z7.object({
1485
+ path: z7.string().min(1),
1710
1486
  /** Skills nest in subdirectories (the agent scans recursively). */
1711
- recursive: z8.boolean().optional(),
1487
+ recursive: z7.boolean().optional(),
1712
1488
  /**
1713
1489
  * Scan the same relative directory in every ancestor of the workspace
1714
1490
  * up to the repository root (`project` roots only).
1715
1491
  */
1716
- ancestors: z8.boolean().optional(),
1492
+ ancestors: z7.boolean().optional(),
1717
1493
  /**
1718
1494
  * Prepended to every name under the root, a vendor plugin's
1719
1495
  * `plugin-name:`; a prefixed root is listed as a plugin root.
@@ -1728,14 +1504,14 @@ var providerNativeRootInputSchema = z8.union([
1728
1504
  skipIfManifest: nativeRootManifestPathSchema.optional()
1729
1505
  }).strict()
1730
1506
  ]);
1731
- var providerNativeRootsInputSchema = z8.object({
1732
- user: z8.array(providerNativeRootInputSchema).optional(),
1733
- project: z8.array(providerNativeRootInputSchema).optional()
1507
+ var providerNativeRootsInputSchema = z7.object({
1508
+ user: z7.array(providerNativeRootInputSchema).optional(),
1509
+ project: z7.array(providerNativeRootInputSchema).optional()
1734
1510
  }).strict();
1735
- var providerNativeRootSchema = z8.object({
1736
- path: z8.string().min(1),
1737
- recursive: z8.boolean(),
1738
- ancestors: z8.boolean(),
1511
+ var providerNativeRootSchema = z7.object({
1512
+ path: z7.string().min(1),
1513
+ recursive: z7.boolean(),
1514
+ ancestors: z7.boolean(),
1739
1515
  namePrefix: nativeRootNamePrefixSchema,
1740
1516
  /** Absent: every skill-shaped directory under the root is a skill. */
1741
1517
  skipIfManifest: nativeRootManifestPathSchema.optional()
@@ -1744,7 +1520,7 @@ function uniqueByPath(roots) {
1744
1520
  return new Set(roots.map((root) => root.path)).size === roots.length;
1745
1521
  }
1746
1522
  function nativeRootSideSchema(side) {
1747
- return z8.array(
1523
+ return z7.array(
1748
1524
  providerNativeRootSchema.extend({ path: relativeNativeRootPathSchema }).superRefine((root, context) => {
1749
1525
  if (root.ancestors && side !== "project") {
1750
1526
  context.addIssue({
@@ -1755,7 +1531,7 @@ function nativeRootSideSchema(side) {
1755
1531
  })
1756
1532
  ).max(PROVIDER_NATIVE_ROOTS_MAX).refine(uniqueByPath, "Roots must not repeat a path");
1757
1533
  }
1758
- var providerNativeRootsSchema = z8.object({
1534
+ var providerNativeRootsSchema = z7.object({
1759
1535
  user: nativeRootSideSchema("user"),
1760
1536
  project: nativeRootSideSchema("project")
1761
1537
  }).strict();
@@ -1781,19 +1557,19 @@ function normalizeProviderNativeRoots(roots) {
1781
1557
  project: (roots?.project ?? []).map(normalizeProviderNativeRoot)
1782
1558
  };
1783
1559
  }
1784
- var providerResolvedNativeRootShapeSchema = z8.enum([
1560
+ var providerResolvedNativeRootShapeSchema = z7.enum([
1785
1561
  "skills",
1786
1562
  "skill",
1787
1563
  "skill-file",
1788
1564
  "commands",
1789
1565
  "command-file"
1790
1566
  ]);
1791
- var resolvedNativeRootFieldsSchema = z8.object({
1567
+ var resolvedNativeRootFieldsSchema = z7.object({
1792
1568
  path: absoluteNativeRootPathSchema,
1793
- origin: z8.enum(["user", "project"]),
1794
- recursive: z8.boolean(),
1569
+ origin: z7.enum(["user", "project"]),
1570
+ recursive: z7.boolean(),
1795
1571
  /** Only with origin `project`, for a path inside the workspace. */
1796
- ancestors: z8.boolean(),
1572
+ ancestors: z7.boolean(),
1797
1573
  namePrefix: nativeRootNamePrefixSchema,
1798
1574
  shape: providerResolvedNativeRootShapeSchema,
1799
1575
  /**
@@ -1801,7 +1577,7 @@ var resolvedNativeRootFieldsSchema = z8.object({
1801
1577
  * none. A vendor plugin's root SKILL.md takes the plugin's name; absent
1802
1578
  * means the parent directory's name.
1803
1579
  */
1804
- fallbackName: z8.string().min(1).optional(),
1580
+ fallbackName: z7.string().min(1).optional(),
1805
1581
  /**
1806
1582
  * `skills` only: a file, relative to a skill directory under this root,
1807
1583
  * that marks the directory as a vendor plugin rather than a skill; the
@@ -1845,14 +1621,14 @@ var resolvedCommandShapes = /* @__PURE__ */ new Set([
1845
1621
  "command-file"
1846
1622
  ]);
1847
1623
  var PROVIDER_RESOLVED_NATIVE_ROOTS_MAX = 256;
1848
- var providerResolvedNativeRootsSchema = z8.object({
1849
- skills: z8.array(
1624
+ var providerResolvedNativeRootsSchema = z7.object({
1625
+ skills: z7.array(
1850
1626
  providerResolvedNativeRootSchema.refine(
1851
1627
  (root) => resolvedSkillShapes.has(root.shape),
1852
1628
  "A skills root needs a skill shape"
1853
1629
  )
1854
1630
  ).max(PROVIDER_RESOLVED_NATIVE_ROOTS_MAX),
1855
- commands: z8.array(
1631
+ commands: z7.array(
1856
1632
  providerResolvedNativeRootSchema.refine(
1857
1633
  (root) => resolvedCommandShapes.has(root.shape),
1858
1634
  "A commands root needs a command shape"
@@ -1863,14 +1639,14 @@ var EMPTY_PROVIDER_RESOLVED_NATIVE_ROOTS = Object.freeze({
1863
1639
  skills: Object.freeze([]),
1864
1640
  commands: Object.freeze([])
1865
1641
  });
1866
- var providerNativeRootSetSchema = z8.object({
1642
+ var providerNativeRootSetSchema = z7.object({
1867
1643
  skills: providerNativeRootsSchema,
1868
1644
  commands: providerNativeRootsSchema,
1869
1645
  resolved: providerResolvedNativeRootsSchema
1870
1646
  }).strict();
1871
1647
 
1872
1648
  // ../domain/src/background-task.ts
1873
- import { z as z9 } from "zod";
1649
+ import { z as z8 } from "zod";
1874
1650
  var LOCAL_WORKFLOW_TASK_TYPE = "local_workflow";
1875
1651
  var LOCAL_BASH_TASK_TYPE = "local_bash";
1876
1652
  var LOCAL_AGENT_TASK_TYPE = "local_agent";
@@ -1887,7 +1663,7 @@ var backgroundTaskStatusValues = [
1887
1663
  "killed",
1888
1664
  "stopped"
1889
1665
  ];
1890
- var backgroundTaskStatusSchema = z9.enum(backgroundTaskStatusValues);
1666
+ var backgroundTaskStatusSchema = z8.enum(backgroundTaskStatusValues);
1891
1667
  var workflowAgentStateValues = [
1892
1668
  "queued",
1893
1669
  "running",
@@ -1895,43 +1671,43 @@ var workflowAgentStateValues = [
1895
1671
  "failed",
1896
1672
  "skipped"
1897
1673
  ];
1898
- var workflowAgentStateSchema = z9.enum(workflowAgentStateValues);
1899
- var workflowAgentSnapshotSchema = z9.object({
1900
- index: z9.number().int().positive(),
1901
- label: z9.string(),
1674
+ var workflowAgentStateSchema = z8.enum(workflowAgentStateValues);
1675
+ var workflowAgentSnapshotSchema = z8.object({
1676
+ index: z8.number().int().positive(),
1677
+ label: z8.string(),
1902
1678
  state: workflowAgentStateSchema,
1903
- model: z9.string(),
1904
- attempt: z9.number().int().positive(),
1905
- cached: z9.boolean(),
1906
- lastProgressAt: z9.number(),
1907
- phaseIndex: z9.number().int().positive().optional(),
1908
- phaseTitle: z9.string().optional(),
1909
- agentType: z9.string().optional(),
1910
- isolation: z9.string().optional(),
1911
- queuedAt: z9.number().optional(),
1912
- startedAt: z9.number().optional(),
1913
- lastToolName: z9.string().optional(),
1914
- lastToolSummary: z9.string().optional(),
1915
- promptPreview: z9.string().optional(),
1916
- resultPreview: z9.string().optional(),
1917
- error: z9.string().optional(),
1918
- tokens: z9.number().optional(),
1919
- toolCalls: z9.number().optional(),
1920
- durationMs: z9.number().optional()
1921
- });
1922
- var workflowPhaseSnapshotSchema = z9.object({
1923
- index: z9.number().int().positive(),
1924
- title: z9.string(),
1925
- kind: z9.string().optional()
1926
- });
1927
- var workflowProgressSnapshotSchema = z9.object({
1928
- phases: z9.array(workflowPhaseSnapshotSchema),
1929
- agents: z9.array(workflowAgentSnapshotSchema)
1930
- });
1931
- var backgroundTaskUsageSchema = z9.object({
1932
- totalTokens: z9.number(),
1933
- toolUses: z9.number(),
1934
- durationMs: z9.number()
1679
+ model: z8.string(),
1680
+ attempt: z8.number().int().positive(),
1681
+ cached: z8.boolean(),
1682
+ lastProgressAt: z8.number(),
1683
+ phaseIndex: z8.number().int().positive().optional(),
1684
+ phaseTitle: z8.string().optional(),
1685
+ agentType: z8.string().optional(),
1686
+ isolation: z8.string().optional(),
1687
+ queuedAt: z8.number().optional(),
1688
+ startedAt: z8.number().optional(),
1689
+ lastToolName: z8.string().optional(),
1690
+ lastToolSummary: z8.string().optional(),
1691
+ promptPreview: z8.string().optional(),
1692
+ resultPreview: z8.string().optional(),
1693
+ error: z8.string().optional(),
1694
+ tokens: z8.number().optional(),
1695
+ toolCalls: z8.number().optional(),
1696
+ durationMs: z8.number().optional()
1697
+ });
1698
+ var workflowPhaseSnapshotSchema = z8.object({
1699
+ index: z8.number().int().positive(),
1700
+ title: z8.string(),
1701
+ kind: z8.string().optional()
1702
+ });
1703
+ var workflowProgressSnapshotSchema = z8.object({
1704
+ phases: z8.array(workflowPhaseSnapshotSchema),
1705
+ agents: z8.array(workflowAgentSnapshotSchema)
1706
+ });
1707
+ var backgroundTaskUsageSchema = z8.object({
1708
+ totalTokens: z8.number(),
1709
+ toolUses: z8.number(),
1710
+ durationMs: z8.number()
1935
1711
  });
1936
1712
  function backgroundTaskItemStatus(taskStatus) {
1937
1713
  switch (taskStatus) {
@@ -1953,13 +1729,13 @@ function isSettledBackgroundTaskStatus(taskStatus) {
1953
1729
  }
1954
1730
 
1955
1731
  // ../domain/src/provider-event.ts
1956
- import { z as z18 } from "zod";
1732
+ import { z as z17 } from "zod";
1957
1733
 
1958
1734
  // ../domain/src/thread-events.ts
1959
- import { z as z15 } from "zod";
1735
+ import { z as z14 } from "zod";
1960
1736
 
1961
1737
  // ../domain/src/pending-interactions.ts
1962
- import { z as z12 } from "zod";
1738
+ import { z as z11 } from "zod";
1963
1739
 
1964
1740
  // ../domain/src/plugin-interaction-limits.ts
1965
1741
  var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
@@ -1969,223 +1745,223 @@ function jsonByteLength(value) {
1969
1745
  }
1970
1746
 
1971
1747
  // ../domain/src/item-presentation.ts
1972
- import { z as z10 } from "zod";
1748
+ import { z as z9 } from "zod";
1973
1749
  var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
1974
- var threadEventItemPresentationLabelSchema = z10.object({
1975
- pending: z10.string().min(1),
1976
- completed: z10.string().min(1)
1750
+ var threadEventItemPresentationLabelSchema = z9.object({
1751
+ pending: z9.string().min(1),
1752
+ completed: z9.string().min(1)
1977
1753
  });
1978
- var threadEventItemPresentationIconSchema = z10.object({
1979
- glyph: z10.string().min(1)
1754
+ var threadEventItemPresentationIconSchema = z9.object({
1755
+ glyph: z9.string().min(1)
1980
1756
  });
1981
- var threadEventItemPresentationTintSchema = z10.object({
1982
- light: z10.string().min(1),
1983
- dark: z10.string().min(1)
1757
+ var threadEventItemPresentationTintSchema = z9.object({
1758
+ light: z9.string().min(1),
1759
+ dark: z9.string().min(1)
1984
1760
  });
1985
1761
  var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
1986
- var threadEventItemPresentationBadgeSchema = z10.object({
1987
- glyph: z10.string().min(1),
1988
- label: z10.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
1989
- hint: z10.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
1990
- tone: z10.enum(["neutral", "destructive"])
1762
+ var threadEventItemPresentationBadgeSchema = z9.object({
1763
+ glyph: z9.string().min(1),
1764
+ label: z9.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
1765
+ hint: z9.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
1766
+ tone: z9.enum(["neutral", "destructive"])
1991
1767
  });
1992
- var threadEventItemPresentationSchema = z10.object({
1768
+ var threadEventItemPresentationSchema = z9.object({
1993
1769
  label: threadEventItemPresentationLabelSchema,
1994
1770
  icon: threadEventItemPresentationIconSchema,
1995
- title: z10.string().optional(),
1996
- detail: z10.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
1997
- suppress: z10.boolean().optional(),
1771
+ title: z9.string().optional(),
1772
+ detail: z9.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
1773
+ suppress: z9.boolean().optional(),
1998
1774
  tint: threadEventItemPresentationTintSchema.optional(),
1999
1775
  badge: threadEventItemPresentationBadgeSchema.optional()
2000
1776
  });
2001
1777
 
2002
1778
  // ../domain/src/provider-extension-kind.ts
2003
- import { z as z11 } from "zod";
1779
+ import { z as z10 } from "zod";
2004
1780
  var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
2005
1781
  function isExtensionKind(value) {
2006
1782
  return EXTENSION_KIND_PATTERN.test(value);
2007
1783
  }
2008
- var extensionKindSchema = z11.string().refine(isExtensionKind, {
1784
+ var extensionKindSchema = z10.string().refine(isExtensionKind, {
2009
1785
  message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
2010
1786
  });
2011
1787
 
2012
1788
  // ../domain/src/pending-interactions.ts
2013
- var pendingInteractionStatusSchema = z12.enum([
1789
+ var pendingInteractionStatusSchema = z11.enum([
2014
1790
  "pending",
2015
1791
  "resolving",
2016
1792
  "resolved",
2017
1793
  "interrupted"
2018
1794
  ]);
2019
- var pendingInteractionCommandActionSchema = z12.discriminatedUnion(
1795
+ var pendingInteractionCommandActionSchema = z11.discriminatedUnion(
2020
1796
  "type",
2021
1797
  [
2022
- z12.object({
2023
- type: z12.literal("read"),
2024
- command: z12.string(),
2025
- name: z12.string(),
2026
- path: z12.string()
1798
+ z11.object({
1799
+ type: z11.literal("read"),
1800
+ command: z11.string(),
1801
+ name: z11.string(),
1802
+ path: z11.string()
2027
1803
  }),
2028
- z12.object({
2029
- type: z12.literal("listFiles"),
2030
- command: z12.string(),
2031
- path: z12.string().nullable()
1804
+ z11.object({
1805
+ type: z11.literal("listFiles"),
1806
+ command: z11.string(),
1807
+ path: z11.string().nullable()
2032
1808
  }),
2033
- z12.object({
2034
- type: z12.literal("search"),
2035
- command: z12.string(),
2036
- query: z12.string().nullable(),
2037
- path: z12.string().nullable()
1809
+ z11.object({
1810
+ type: z11.literal("search"),
1811
+ command: z11.string(),
1812
+ query: z11.string().nullable(),
1813
+ path: z11.string().nullable()
2038
1814
  }),
2039
- z12.object({
2040
- type: z12.literal("unknown"),
2041
- command: z12.string()
1815
+ z11.object({
1816
+ type: z11.literal("unknown"),
1817
+ command: z11.string()
2042
1818
  })
2043
1819
  ]
2044
1820
  );
2045
- var pendingInteractionNetworkPermissionsSchema = z12.object({
2046
- enabled: z12.boolean().nullable()
1821
+ var pendingInteractionNetworkPermissionsSchema = z11.object({
1822
+ enabled: z11.boolean().nullable()
2047
1823
  });
2048
- var pendingInteractionFileSystemPermissionsSchema = z12.object({
2049
- read: z12.array(z12.string()),
2050
- write: z12.array(z12.string())
1824
+ var pendingInteractionFileSystemPermissionsSchema = z11.object({
1825
+ read: z11.array(z11.string()),
1826
+ write: z11.array(z11.string())
2051
1827
  });
2052
- var pendingInteractionMacOsPreferencesPermissionSchema = z12.enum([
1828
+ var pendingInteractionMacOsPreferencesPermissionSchema = z11.enum([
2053
1829
  "none",
2054
1830
  "read_only",
2055
1831
  "read_write"
2056
1832
  ]);
2057
- var pendingInteractionMacOsContactsPermissionSchema = z12.enum([
1833
+ var pendingInteractionMacOsContactsPermissionSchema = z11.enum([
2058
1834
  "none",
2059
1835
  "read_only",
2060
1836
  "read_write"
2061
1837
  ]);
2062
- var pendingInteractionMacOsAutomationPermissionSchema = z12.union([
2063
- z12.literal("none"),
2064
- z12.literal("all"),
2065
- z12.object({
2066
- kind: z12.literal("bundle_ids"),
2067
- bundleIds: z12.array(z12.string())
1838
+ var pendingInteractionMacOsAutomationPermissionSchema = z11.union([
1839
+ z11.literal("none"),
1840
+ z11.literal("all"),
1841
+ z11.object({
1842
+ kind: z11.literal("bundle_ids"),
1843
+ bundleIds: z11.array(z11.string())
2068
1844
  })
2069
1845
  ]);
2070
- var pendingInteractionMacOsPermissionsSchema = z12.object({
1846
+ var pendingInteractionMacOsPermissionsSchema = z11.object({
2071
1847
  preferences: pendingInteractionMacOsPreferencesPermissionSchema,
2072
1848
  automations: pendingInteractionMacOsAutomationPermissionSchema,
2073
- launchServices: z12.boolean(),
2074
- accessibility: z12.boolean(),
2075
- calendar: z12.boolean(),
2076
- reminders: z12.boolean(),
1849
+ launchServices: z11.boolean(),
1850
+ accessibility: z11.boolean(),
1851
+ calendar: z11.boolean(),
1852
+ reminders: z11.boolean(),
2077
1853
  contacts: pendingInteractionMacOsContactsPermissionSchema
2078
1854
  });
2079
- var pendingInteractionRequestedPermissionProfileSchema = z12.object({
1855
+ var pendingInteractionRequestedPermissionProfileSchema = z11.object({
2080
1856
  network: pendingInteractionNetworkPermissionsSchema.nullable(),
2081
1857
  fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
2082
1858
  macos: pendingInteractionMacOsPermissionsSchema.nullable()
2083
1859
  });
2084
- var pendingInteractionGrantablePermissionProfileSchema = z12.object({
1860
+ var pendingInteractionGrantablePermissionProfileSchema = z11.object({
2085
1861
  network: pendingInteractionNetworkPermissionsSchema.nullable(),
2086
1862
  fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
2087
1863
  }).strict();
2088
1864
  var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
2089
- var pendingInteractionApprovalDecisionSchema = z12.enum([
1865
+ var pendingInteractionApprovalDecisionSchema = z11.enum([
2090
1866
  "allow_once",
2091
1867
  "allow_for_session",
2092
1868
  "deny"
2093
1869
  ]);
2094
- var pendingInteractionFileChangeWriteScopeSchema = z12.string().min(1);
2095
- var pendingInteractionCommandApprovalSubjectSchema = z12.object({
2096
- kind: z12.literal("command"),
2097
- itemId: z12.string().min(1),
2098
- command: z12.string().min(1),
2099
- cwd: z12.string().nullable(),
2100
- actions: z12.array(pendingInteractionCommandActionSchema),
1870
+ var pendingInteractionFileChangeWriteScopeSchema = z11.string().min(1);
1871
+ var pendingInteractionCommandApprovalSubjectSchema = z11.object({
1872
+ kind: z11.literal("command"),
1873
+ itemId: z11.string().min(1),
1874
+ command: z11.string().min(1),
1875
+ cwd: z11.string().nullable(),
1876
+ actions: z11.array(pendingInteractionCommandActionSchema),
2101
1877
  sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
2102
1878
  });
2103
- var pendingInteractionFileChangeApprovalSubjectSchema = z12.object({
2104
- kind: z12.literal("file_change"),
2105
- itemId: z12.string().min(1),
1879
+ var pendingInteractionFileChangeApprovalSubjectSchema = z11.object({
1880
+ kind: z11.literal("file_change"),
1881
+ itemId: z11.string().min(1),
2106
1882
  writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
2107
1883
  sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
2108
1884
  });
2109
- var pendingInteractionPermissionGrantApprovalSubjectSchema = z12.object({
2110
- kind: z12.literal("permission_grant"),
2111
- itemId: z12.string().min(1),
2112
- toolName: z12.string().nullable(),
1885
+ var pendingInteractionPermissionGrantApprovalSubjectSchema = z11.object({
1886
+ kind: z11.literal("permission_grant"),
1887
+ itemId: z11.string().min(1),
1888
+ toolName: z11.string().nullable(),
2113
1889
  permissions: pendingInteractionGrantablePermissionProfileSchema
2114
1890
  });
2115
- var pendingInteractionPlanApprovalSubjectSchema = z12.object({
2116
- kind: z12.literal("plan"),
2117
- itemId: z12.string().min(1),
2118
- plan: z12.string().min(1),
2119
- planFilePath: z12.string().min(1).nullable()
1891
+ var pendingInteractionPlanApprovalSubjectSchema = z11.object({
1892
+ kind: z11.literal("plan"),
1893
+ itemId: z11.string().min(1),
1894
+ plan: z11.string().min(1),
1895
+ planFilePath: z11.string().min(1).nullable()
2120
1896
  });
2121
- var pendingInteractionToolUseApprovalSubjectSchema = z12.object({
2122
- kind: z12.literal("tool_use"),
2123
- itemId: z12.string().min(1),
2124
- tool: z12.string().min(1),
1897
+ var pendingInteractionToolUseApprovalSubjectSchema = z11.object({
1898
+ kind: z11.literal("tool_use"),
1899
+ itemId: z11.string().min(1),
1900
+ tool: z11.string().min(1),
2125
1901
  presentation: threadEventItemPresentationSchema
2126
1902
  });
2127
- var pendingInteractionApprovalSubjectSchema = z12.discriminatedUnion("kind", [
1903
+ var pendingInteractionApprovalSubjectSchema = z11.discriminatedUnion("kind", [
2128
1904
  pendingInteractionCommandApprovalSubjectSchema,
2129
1905
  pendingInteractionFileChangeApprovalSubjectSchema,
2130
1906
  pendingInteractionPermissionGrantApprovalSubjectSchema,
2131
1907
  pendingInteractionPlanApprovalSubjectSchema,
2132
1908
  pendingInteractionToolUseApprovalSubjectSchema
2133
1909
  ]);
2134
- var approvalPendingInteractionPayloadSchema = z12.object({
2135
- kind: z12.literal("approval"),
1910
+ var approvalPendingInteractionPayloadSchema = z11.object({
1911
+ kind: z11.literal("approval"),
2136
1912
  subject: pendingInteractionApprovalSubjectSchema,
2137
- reason: z12.string().nullable(),
2138
- availableDecisions: z12.array(pendingInteractionApprovalDecisionSchema).min(1)
1913
+ reason: z11.string().nullable(),
1914
+ availableDecisions: z11.array(pendingInteractionApprovalDecisionSchema).min(1)
2139
1915
  });
2140
1916
  var USER_QUESTION_MAX_QUESTIONS = 4;
2141
1917
  var USER_QUESTION_MAX_OPTIONS = 4;
2142
1918
  var USER_QUESTION_MAX_SELECTED = 4;
2143
1919
  var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
2144
- var pendingInteractionUserQuestionIdSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1920
+ var pendingInteractionUserQuestionIdSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2145
1921
  message: "User question ids cannot be blank"
2146
1922
  });
2147
- var pendingInteractionUserQuestionPromptSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1923
+ var pendingInteractionUserQuestionPromptSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2148
1924
  message: "User question prompts cannot be blank"
2149
1925
  });
2150
- var pendingInteractionUserQuestionShortLabelSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1926
+ var pendingInteractionUserQuestionShortLabelSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2151
1927
  message: "User question short labels cannot be blank"
2152
1928
  });
2153
- var pendingInteractionUserQuestionOptionValueSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1929
+ var pendingInteractionUserQuestionOptionValueSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2154
1930
  message: "User question option values cannot be blank"
2155
1931
  });
2156
- var pendingInteractionUserQuestionOptionLabelSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1932
+ var pendingInteractionUserQuestionOptionLabelSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2157
1933
  message: "User question option labels cannot be blank"
2158
1934
  });
2159
- var pendingInteractionUserQuestionOptionDescriptionSchema = z12.string().min(1).refine((value) => value.trim().length > 0, {
1935
+ var pendingInteractionUserQuestionOptionDescriptionSchema = z11.string().min(1).refine((value) => value.trim().length > 0, {
2160
1936
  message: "User question option descriptions cannot be blank"
2161
1937
  });
2162
- var pendingInteractionUserQuestionFreeTextSchema = z12.string().min(1).max(
1938
+ var pendingInteractionUserQuestionFreeTextSchema = z11.string().min(1).max(
2163
1939
  USER_QUESTION_MAX_FREE_TEXT_LENGTH,
2164
1940
  `User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
2165
1941
  ).refine((value) => value.trim().length > 0, {
2166
1942
  message: "User question free text cannot be blank"
2167
1943
  });
2168
- var pendingInteractionUserQuestionOptionSchema = z12.object({
1944
+ var pendingInteractionUserQuestionOptionSchema = z11.object({
2169
1945
  value: pendingInteractionUserQuestionOptionValueSchema,
2170
1946
  label: pendingInteractionUserQuestionOptionLabelSchema,
2171
1947
  description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
2172
1948
  });
2173
- var pendingInteractionUserQuestionQuestionSchema = z12.object({
1949
+ var pendingInteractionUserQuestionQuestionSchema = z11.object({
2174
1950
  id: pendingInteractionUserQuestionIdSchema,
2175
1951
  prompt: pendingInteractionUserQuestionPromptSchema,
2176
1952
  shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
2177
- multiSelect: z12.boolean(),
2178
- options: z12.array(pendingInteractionUserQuestionOptionSchema).max(
1953
+ multiSelect: z11.boolean(),
1954
+ options: z11.array(pendingInteractionUserQuestionOptionSchema).max(
2179
1955
  USER_QUESTION_MAX_OPTIONS,
2180
1956
  `User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
2181
1957
  ).optional(),
2182
- allowFreeText: z12.boolean()
1958
+ allowFreeText: z11.boolean()
2183
1959
  }).superRefine((question, context) => {
2184
1960
  const optionValues = /* @__PURE__ */ new Set();
2185
1961
  question.options?.forEach((option, index) => {
2186
1962
  if (optionValues.has(option.value)) {
2187
1963
  context.addIssue({
2188
- code: z12.ZodIssueCode.custom,
1964
+ code: z11.ZodIssueCode.custom,
2189
1965
  message: "User question option values must be unique",
2190
1966
  path: ["options", index, "value"]
2191
1967
  });
@@ -2200,9 +1976,9 @@ var pendingInteractionUserQuestionQuestionSchema = z12.object({
2200
1976
  path: ["options"]
2201
1977
  }
2202
1978
  );
2203
- var userQuestionPendingInteractionPayloadSchema = z12.object({
2204
- kind: z12.literal("user_question"),
2205
- questions: z12.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
1979
+ var userQuestionPendingInteractionPayloadSchema = z11.object({
1980
+ kind: z11.literal("user_question"),
1981
+ questions: z11.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
2206
1982
  USER_QUESTION_MAX_QUESTIONS,
2207
1983
  `User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
2208
1984
  )
@@ -2211,7 +1987,7 @@ var userQuestionPendingInteractionPayloadSchema = z12.object({
2211
1987
  payload.questions.forEach((question, index) => {
2212
1988
  if (questionIds.has(question.id)) {
2213
1989
  context.addIssue({
2214
- code: z12.ZodIssueCode.custom,
1990
+ code: z11.ZodIssueCode.custom,
2215
1991
  message: "User question ids must be unique",
2216
1992
  path: ["questions", index, "id"]
2217
1993
  });
@@ -2220,24 +1996,24 @@ var userQuestionPendingInteractionPayloadSchema = z12.object({
2220
1996
  questionIds.add(question.id);
2221
1997
  });
2222
1998
  });
2223
- var pluginPendingInteractionPayloadSchema = z12.object({
2224
- kind: z12.literal("plugin"),
2225
- title: z12.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
1999
+ var pluginPendingInteractionPayloadSchema = z11.object({
2000
+ kind: z11.literal("plugin"),
2001
+ title: z11.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
2226
2002
  data: jsonValueSchema
2227
2003
  });
2228
- var pluginExtensionInteractionRequestPayloadSchema = z12.object({
2004
+ var pluginExtensionInteractionRequestPayloadSchema = z11.object({
2229
2005
  kind: extensionKindSchema,
2230
- title: z12.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
2006
+ title: z11.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
2231
2007
  data: jsonValueSchema.refine(
2232
2008
  (value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
2233
2009
  { message: "Plugin request data exceeds 64 KiB" }
2234
2010
  )
2235
2011
  });
2236
- var interactionRequestPayloadSchema = z12.union([
2012
+ var interactionRequestPayloadSchema = z11.union([
2237
2013
  userQuestionPendingInteractionPayloadSchema,
2238
2014
  pluginExtensionInteractionRequestPayloadSchema
2239
2015
  ]);
2240
- var pendingInteractionPayloadSchema = z12.union([
2016
+ var pendingInteractionPayloadSchema = z11.union([
2241
2017
  approvalPendingInteractionPayloadSchema,
2242
2018
  userQuestionPendingInteractionPayloadSchema,
2243
2019
  pluginExtensionInteractionRequestPayloadSchema
@@ -2249,42 +2025,42 @@ function isUserQuestionPendingInteractionPayload(payload) {
2249
2025
  return payload.kind === "user_question";
2250
2026
  }
2251
2027
  var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
2252
- var approvalPendingInteractionResolutionSchema = z12.discriminatedUnion(
2028
+ var approvalPendingInteractionResolutionSchema = z11.discriminatedUnion(
2253
2029
  "decision",
2254
2030
  [
2255
- z12.object({
2256
- decision: z12.literal("allow_once"),
2031
+ z11.object({
2032
+ decision: z11.literal("allow_once"),
2257
2033
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
2258
2034
  }),
2259
- z12.object({
2260
- decision: z12.literal("allow_for_session"),
2035
+ z11.object({
2036
+ decision: z11.literal("allow_for_session"),
2261
2037
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
2262
2038
  }),
2263
- z12.object({
2264
- decision: z12.literal("deny")
2039
+ z11.object({
2040
+ decision: z11.literal("deny")
2265
2041
  })
2266
2042
  ],
2267
2043
  approvalDecisionDiscriminatorError
2268
2044
  );
2269
- var pendingInteractionUserAnswerSchema = z12.object({
2270
- selected: z12.array(z12.string().min(1)).max(
2045
+ var pendingInteractionUserAnswerSchema = z11.object({
2046
+ selected: z11.array(z11.string().min(1)).max(
2271
2047
  USER_QUESTION_MAX_SELECTED,
2272
2048
  `User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
2273
2049
  ),
2274
2050
  freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
2275
2051
  });
2276
- var userQuestionPendingInteractionResolutionSchema = z12.object({
2277
- kind: z12.literal("user_answer"),
2278
- answers: z12.record(z12.string().min(1), pendingInteractionUserAnswerSchema)
2052
+ var userQuestionPendingInteractionResolutionSchema = z11.object({
2053
+ kind: z11.literal("user_answer"),
2054
+ answers: z11.record(z11.string().min(1), pendingInteractionUserAnswerSchema)
2279
2055
  });
2280
- var pluginPendingInteractionResolutionSchema = z12.object({
2281
- kind: z12.literal("plugin_submitted")
2056
+ var pluginPendingInteractionResolutionSchema = z11.object({
2057
+ kind: z11.literal("plugin_submitted")
2282
2058
  });
2283
- var pluginExtensionInteractionResolutionSchema = z12.object({
2284
- kind: z12.literal("request_answer"),
2059
+ var pluginExtensionInteractionResolutionSchema = z11.object({
2060
+ kind: z11.literal("request_answer"),
2285
2061
  value: jsonValueSchema
2286
2062
  });
2287
- var pendingInteractionResolutionSchema = z12.union(
2063
+ var pendingInteractionResolutionSchema = z11.union(
2288
2064
  [
2289
2065
  approvalPendingInteractionResolutionSchema,
2290
2066
  userQuestionPendingInteractionResolutionSchema,
@@ -2299,19 +2075,19 @@ function isApprovalPendingInteractionResolution(resolution) {
2299
2075
  function isUserQuestionPendingInteractionResolution(resolution) {
2300
2076
  return "kind" in resolution && resolution.kind === "user_answer";
2301
2077
  }
2302
- var approvalInteractionOutcomeSchema = z12.object({
2078
+ var approvalInteractionOutcomeSchema = z11.object({
2303
2079
  payload: approvalPendingInteractionPayloadSchema,
2304
2080
  resolution: approvalPendingInteractionResolutionSchema
2305
2081
  });
2306
- var userQuestionInteractionOutcomeSchema = z12.object({
2082
+ var userQuestionInteractionOutcomeSchema = z11.object({
2307
2083
  payload: userQuestionPendingInteractionPayloadSchema,
2308
2084
  resolution: userQuestionPendingInteractionResolutionSchema
2309
2085
  });
2310
- var pluginExtensionInteractionOutcomeSchema = z12.object({
2086
+ var pluginExtensionInteractionOutcomeSchema = z11.object({
2311
2087
  payload: pluginExtensionInteractionRequestPayloadSchema,
2312
2088
  resolution: pluginExtensionInteractionResolutionSchema
2313
2089
  });
2314
- var providerInteractionOutcomeSchema = z12.union([
2090
+ var providerInteractionOutcomeSchema = z11.union([
2315
2091
  approvalInteractionOutcomeSchema,
2316
2092
  userQuestionInteractionOutcomeSchema,
2317
2093
  pluginExtensionInteractionOutcomeSchema
@@ -2319,39 +2095,39 @@ var providerInteractionOutcomeSchema = z12.union([
2319
2095
  function isApprovalInteractionOutcome(outcome) {
2320
2096
  return outcome.payload.kind === "approval";
2321
2097
  }
2322
- var pendingInteractionProviderOriginSchema = z12.object({
2323
- kind: z12.literal("provider"),
2324
- providerId: z12.string().min(1),
2325
- providerThreadId: z12.string().min(1),
2326
- providerRequestId: z12.string().min(1)
2327
- });
2328
- var pendingInteractionPluginOriginSchema = z12.object({
2329
- kind: z12.literal("plugin"),
2330
- pluginId: z12.string().min(1),
2331
- rendererId: z12.string().min(1)
2332
- });
2333
- var pendingInteractionCreateSchema = z12.object({
2334
- threadId: z12.string().min(1),
2335
- turnId: z12.string().min(1),
2336
- providerId: z12.string().min(1),
2337
- providerThreadId: z12.string().min(1),
2338
- providerRequestId: z12.string().min(1),
2098
+ var pendingInteractionProviderOriginSchema = z11.object({
2099
+ kind: z11.literal("provider"),
2100
+ providerId: z11.string().min(1),
2101
+ providerThreadId: z11.string().min(1),
2102
+ providerRequestId: z11.string().min(1)
2103
+ });
2104
+ var pendingInteractionPluginOriginSchema = z11.object({
2105
+ kind: z11.literal("plugin"),
2106
+ pluginId: z11.string().min(1),
2107
+ rendererId: z11.string().min(1)
2108
+ });
2109
+ var pendingInteractionCreateSchema = z11.object({
2110
+ threadId: z11.string().min(1),
2111
+ turnId: z11.string().min(1),
2112
+ providerId: z11.string().min(1),
2113
+ providerThreadId: z11.string().min(1),
2114
+ providerRequestId: z11.string().min(1),
2339
2115
  payload: pendingInteractionPayloadSchema
2340
2116
  });
2341
- var pendingInteractionBaseSchema = z12.object({
2342
- id: z12.string().min(1),
2343
- threadId: z12.string().min(1),
2117
+ var pendingInteractionBaseSchema = z11.object({
2118
+ id: z11.string().min(1),
2119
+ threadId: z11.string().min(1),
2344
2120
  status: pendingInteractionStatusSchema,
2345
- statusReason: z12.string().nullable(),
2346
- createdAt: z12.number().int().nonnegative(),
2347
- expiresAt: z12.number().int().nonnegative().nullable().optional(),
2348
- resolvedAt: z12.number().int().nonnegative().nullable()
2121
+ statusReason: z11.string().nullable(),
2122
+ createdAt: z11.number().int().nonnegative(),
2123
+ expiresAt: z11.number().int().nonnegative().nullable().optional(),
2124
+ resolvedAt: z11.number().int().nonnegative().nullable()
2349
2125
  });
2350
2126
  var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
2351
- turnId: z12.string().min(1),
2352
- providerId: z12.string().min(1),
2353
- providerThreadId: z12.string().min(1),
2354
- providerRequestId: z12.string().min(1),
2127
+ turnId: z11.string().min(1),
2128
+ providerId: z11.string().min(1),
2129
+ providerThreadId: z11.string().min(1),
2130
+ providerRequestId: z11.string().min(1),
2355
2131
  origin: pendingInteractionProviderOriginSchema.optional()
2356
2132
  });
2357
2133
  var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
@@ -2366,30 +2142,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
2366
2142
  payload: pluginExtensionInteractionRequestPayloadSchema,
2367
2143
  resolution: pluginExtensionInteractionResolutionSchema.nullable()
2368
2144
  });
2369
- var providerPendingInteractionSchema = z12.union([
2145
+ var providerPendingInteractionSchema = z11.union([
2370
2146
  approvalPendingInteractionSchema,
2371
2147
  userQuestionPendingInteractionSchema,
2372
2148
  pluginExtensionPendingInteractionSchema
2373
2149
  ]);
2374
2150
  var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
2375
- turnId: z12.string().min(1).nullable(),
2151
+ turnId: z11.string().min(1).nullable(),
2376
2152
  origin: pendingInteractionPluginOriginSchema,
2377
2153
  payload: pluginPendingInteractionPayloadSchema,
2378
2154
  resolution: pluginPendingInteractionResolutionSchema.nullable()
2379
2155
  });
2380
- var pendingInteractionSchema = z12.union([
2156
+ var pendingInteractionSchema = z11.union([
2381
2157
  providerPendingInteractionSchema,
2382
2158
  pluginPendingInteractionSchema
2383
2159
  ]);
2384
- var interactionLifecycleRecordBaseSchema = z12.object({
2385
- id: z12.string().min(1),
2160
+ var interactionLifecycleRecordBaseSchema = z11.object({
2161
+ id: z11.string().min(1),
2386
2162
  status: pendingInteractionStatusSchema,
2387
- statusReason: z12.string().nullable()
2163
+ statusReason: z11.string().nullable()
2388
2164
  });
2389
- var interactionLifecycleProviderOriginSchema = z12.object({
2390
- kind: z12.literal("provider"),
2391
- providerId: z12.string().min(1),
2392
- providerRequestId: z12.string().min(1)
2165
+ var interactionLifecycleProviderOriginSchema = z11.object({
2166
+ kind: z11.literal("provider"),
2167
+ providerId: z11.string().min(1),
2168
+ providerRequestId: z11.string().min(1)
2393
2169
  });
2394
2170
  var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
2395
2171
  var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
@@ -2414,7 +2190,7 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
2414
2190
  }),
2415
2191
  resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
2416
2192
  });
2417
- var interactionLifecycleSchema = z12.union([
2193
+ var interactionLifecycleSchema = z11.union([
2418
2194
  approvalInteractionLifecycleSchema,
2419
2195
  userQuestionInteractionLifecycleSchema,
2420
2196
  pluginInteractionLifecycleSchema,
@@ -2422,11 +2198,11 @@ var interactionLifecycleSchema = z12.union([
2422
2198
  ]);
2423
2199
 
2424
2200
  // ../domain/src/protocol-ids.ts
2425
- import { z as z13 } from "zod";
2426
- var clientTurnRequestIdSchema = z13.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
2201
+ import { z as z12 } from "zod";
2202
+ var clientTurnRequestIdSchema = z12.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
2427
2203
 
2428
2204
  // ../domain/src/system-message.ts
2429
- import { z as z14 } from "zod";
2205
+ import { z as z13 } from "zod";
2430
2206
  var systemMessageKindValues = [
2431
2207
  "ownership-assigned",
2432
2208
  "ownership-removed",
@@ -2437,16 +2213,16 @@ var systemMessageKindValues = [
2437
2213
  "child-outcome-batch",
2438
2214
  "unlabeled"
2439
2215
  ];
2440
- var systemMessageKindSchema = z14.enum(systemMessageKindValues);
2441
- var systemMessageSubjectSchema = z14.discriminatedUnion("kind", [
2442
- z14.object({
2443
- kind: z14.literal("thread"),
2444
- threadId: z14.string(),
2445
- threadName: z14.string()
2216
+ var systemMessageKindSchema = z13.enum(systemMessageKindValues);
2217
+ var systemMessageSubjectSchema = z13.discriminatedUnion("kind", [
2218
+ z13.object({
2219
+ kind: z13.literal("thread"),
2220
+ threadId: z13.string(),
2221
+ threadName: z13.string()
2446
2222
  }),
2447
- z14.object({
2448
- kind: z14.literal("thread-batch"),
2449
- count: z14.number()
2223
+ z13.object({
2224
+ kind: z13.literal("thread-batch"),
2225
+ count: z13.number()
2450
2226
  })
2451
2227
  ]);
2452
2228
 
@@ -2469,31 +2245,31 @@ var systemEventTypeValues = [
2469
2245
  "system/provider-turn-watchdog"
2470
2246
  ];
2471
2247
  var threadTurnInitiatorValues = ["user", "agent", "system"];
2472
- var threadTurnInitiatorSchema = z15.enum(threadTurnInitiatorValues);
2248
+ var threadTurnInitiatorSchema = z14.enum(threadTurnInitiatorValues);
2473
2249
  var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
2474
- var turnRequestTargetSchema = z15.discriminatedUnion("kind", [
2475
- z15.object({ kind: z15.literal("thread-start") }),
2476
- z15.object({ kind: z15.literal("new-turn") }),
2477
- z15.object({
2478
- kind: z15.literal("auto"),
2479
- expectedTurnId: z15.string().nullable()
2250
+ var turnRequestTargetSchema = z14.discriminatedUnion("kind", [
2251
+ z14.object({ kind: z14.literal("thread-start") }),
2252
+ z14.object({ kind: z14.literal("new-turn") }),
2253
+ z14.object({
2254
+ kind: z14.literal("auto"),
2255
+ expectedTurnId: z14.string().nullable()
2480
2256
  }),
2481
- z15.object({
2482
- kind: z15.literal("steer"),
2483
- expectedTurnId: z15.string().nullable()
2257
+ z14.object({
2258
+ kind: z14.literal("steer"),
2259
+ expectedTurnId: z14.string().nullable()
2484
2260
  })
2485
2261
  ]);
2486
- var clientTurnLifecycleEventDataSchema = z15.object({
2487
- direction: z15.literal("outbound"),
2488
- source: z15.enum(["spawn", "tell"]),
2262
+ var clientTurnLifecycleEventDataSchema = z14.object({
2263
+ direction: z14.literal("outbound"),
2264
+ source: z14.enum(["spawn", "tell"]),
2489
2265
  initiator: threadTurnInitiatorSchema,
2490
- request: z15.object({
2491
- method: z15.enum(["thread/start", "turn/start"]),
2492
- params: z15.record(z15.string(), z15.unknown())
2266
+ request: z14.object({
2267
+ method: z14.enum(["thread/start", "turn/start"]),
2268
+ params: z14.record(z14.string(), z14.unknown())
2493
2269
  })
2494
2270
  });
2495
- var turnRequestEventDataSchema = z15.object({
2496
- direction: z15.literal("outbound"),
2271
+ var turnRequestEventDataSchema = z14.object({
2272
+ direction: z14.literal("outbound"),
2497
2273
  requestId: clientTurnRequestIdSchema,
2498
2274
  // Retry provenance, written only when a `turn.failed` gate's retry row
2499
2275
  // dispatches. Both fields are present together or not at all: absence means
@@ -2503,45 +2279,45 @@ var turnRequestEventDataSchema = z15.object({
2503
2279
  /** The original request this attempt re-submits, unchanged across attempts. */
2504
2280
  retryOfRequestId: clientTurnRequestIdSchema.optional(),
2505
2281
  /** Which attempt this is: 2 is the first retry of the original request. */
2506
- retryAttempt: z15.number().int().min(2).optional(),
2507
- source: z15.enum(["spawn", "tell"]),
2282
+ retryAttempt: z14.number().int().min(2).optional(),
2283
+ source: z14.enum(["spawn", "tell"]),
2508
2284
  initiator: threadTurnInitiatorSchema,
2509
- senderThreadId: z15.string().nullable(),
2285
+ senderThreadId: z14.string().nullable(),
2510
2286
  systemMessageKind: systemMessageKindSchema.optional(),
2511
2287
  systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
2512
- input: z15.array(promptInputSchema),
2513
- inputGroups: z15.array(z15.array(promptInputSchema).min(1)).min(1).optional(),
2288
+ input: z14.array(promptInputSchema),
2289
+ inputGroups: z14.array(z14.array(promptInputSchema).min(1)).min(1).optional(),
2514
2290
  target: turnRequestTargetSchema,
2515
- request: z15.object({
2516
- method: z15.enum(["thread/start", "turn/start"]),
2517
- params: z15.record(z15.string(), z15.unknown())
2291
+ request: z14.object({
2292
+ method: z14.enum(["thread/start", "turn/start"]),
2293
+ params: z14.record(z14.string(), z14.unknown())
2518
2294
  }),
2519
2295
  execution: turnRequestOptionsSchema
2520
2296
  });
2521
- var turnRequestRejectedEventDataSchema = z15.object({
2297
+ var turnRequestRejectedEventDataSchema = z14.object({
2522
2298
  requestId: clientTurnRequestIdSchema,
2523
- reason: z15.string().min(1),
2524
- message: z15.string().min(1)
2525
- });
2526
- var systemErrorEventDataSchema = z15.object({
2527
- code: z15.string().optional(),
2528
- message: z15.string(),
2529
- detail: z15.string().optional(),
2530
- reconnectAttempt: z15.number().int().positive().optional(),
2531
- reconnectTotal: z15.number().int().positive().optional()
2299
+ reason: z14.string().min(1),
2300
+ message: z14.string().min(1)
2301
+ });
2302
+ var systemErrorEventDataSchema = z14.object({
2303
+ code: z14.string().optional(),
2304
+ message: z14.string(),
2305
+ detail: z14.string().optional(),
2306
+ reconnectAttempt: z14.number().int().positive().optional(),
2307
+ reconnectTotal: z14.number().int().positive().optional()
2532
2308
  }).superRefine((value, ctx) => {
2533
2309
  const hasReconnectAttempt = value.reconnectAttempt !== void 0;
2534
2310
  const hasReconnectTotal = value.reconnectTotal !== void 0;
2535
2311
  if (hasReconnectAttempt !== hasReconnectTotal) {
2536
2312
  ctx.addIssue({
2537
- code: z15.ZodIssueCode.custom,
2313
+ code: z14.ZodIssueCode.custom,
2538
2314
  message: "system/error reconnectAttempt and reconnectTotal must be provided together"
2539
2315
  });
2540
2316
  return;
2541
2317
  }
2542
2318
  if (value.reconnectAttempt !== void 0 && value.reconnectTotal !== void 0 && value.reconnectAttempt > value.reconnectTotal) {
2543
2319
  ctx.addIssue({
2544
- code: z15.ZodIssueCode.custom,
2320
+ code: z14.ZodIssueCode.custom,
2545
2321
  message: "system/error reconnectAttempt cannot be greater than reconnectTotal"
2546
2322
  });
2547
2323
  }
@@ -2551,42 +2327,42 @@ var ownershipChangeOperationActionValues = [
2551
2327
  "release",
2552
2328
  "transfer"
2553
2329
  ];
2554
- var ownershipChangeOperationActionSchema = z15.enum(
2330
+ var ownershipChangeOperationActionSchema = z14.enum(
2555
2331
  ownershipChangeOperationActionValues
2556
2332
  );
2557
- var ownershipChangeOperationMetadataSchema = z15.object({
2333
+ var ownershipChangeOperationMetadataSchema = z14.object({
2558
2334
  action: ownershipChangeOperationActionSchema,
2559
- nextParentThreadId: z15.string().nullable(),
2560
- nextParentThreadTitle: z15.string().nullable(),
2561
- previousParentThreadId: z15.string().nullable(),
2562
- previousParentThreadTitle: z15.string().nullable()
2563
- });
2564
- var systemOperationEventDataSchema = z15.object({
2565
- operation: z15.string(),
2566
- status: z15.string(),
2567
- message: z15.string(),
2568
- operationId: z15.string(),
2569
- metadata: z15.record(z15.string(), jsonValueSchema).optional()
2570
- });
2571
- var systemInteractionLifecycleEventDataSchema = z15.object({
2335
+ nextParentThreadId: z14.string().nullable(),
2336
+ nextParentThreadTitle: z14.string().nullable(),
2337
+ previousParentThreadId: z14.string().nullable(),
2338
+ previousParentThreadTitle: z14.string().nullable()
2339
+ });
2340
+ var systemOperationEventDataSchema = z14.object({
2341
+ operation: z14.string(),
2342
+ status: z14.string(),
2343
+ message: z14.string(),
2344
+ operationId: z14.string(),
2345
+ metadata: z14.record(z14.string(), jsonValueSchema).optional()
2346
+ });
2347
+ var systemInteractionLifecycleEventDataSchema = z14.object({
2572
2348
  interaction: interactionLifecycleSchema
2573
2349
  });
2574
- var systemPermissionGrantLifecycleEventDataSchema = z15.object({
2575
- interactionId: z15.string(),
2576
- providerId: z15.string(),
2577
- providerRequestId: z15.string(),
2350
+ var systemPermissionGrantLifecycleEventDataSchema = z14.object({
2351
+ interactionId: z14.string(),
2352
+ providerId: z14.string(),
2353
+ providerRequestId: z14.string(),
2578
2354
  status: pendingInteractionStatusSchema,
2579
2355
  resolution: approvalPendingInteractionResolutionSchema.nullable().default(null),
2580
- statusReason: z15.string().nullable().default(null),
2356
+ statusReason: z14.string().nullable().default(null),
2581
2357
  subject: pendingInteractionPermissionGrantApprovalSubjectSchema
2582
2358
  });
2583
- var systemUserQuestionLifecycleEventDataSchema = z15.object({
2584
- interactionId: z15.string(),
2585
- providerId: z15.string(),
2586
- providerRequestId: z15.string(),
2359
+ var systemUserQuestionLifecycleEventDataSchema = z14.object({
2360
+ interactionId: z14.string(),
2361
+ providerId: z14.string(),
2362
+ providerRequestId: z14.string(),
2587
2363
  status: pendingInteractionStatusSchema,
2588
2364
  resolution: userQuestionPendingInteractionResolutionSchema.nullable().default(null),
2589
- statusReason: z15.string().nullable().default(null),
2365
+ statusReason: z14.string().nullable().default(null),
2590
2366
  payload: userQuestionPendingInteractionPayloadSchema
2591
2367
  });
2592
2368
  var systemThreadInterruptedReasonValues = [
@@ -2594,20 +2370,20 @@ var systemThreadInterruptedReasonValues = [
2594
2370
  "host-daemon-restarted",
2595
2371
  "provider-turn-idle"
2596
2372
  ];
2597
- var systemThreadInterruptedReasonSchema = z15.enum(
2373
+ var systemThreadInterruptedReasonSchema = z14.enum(
2598
2374
  systemThreadInterruptedReasonValues
2599
2375
  );
2600
- var systemThreadInterruptedEventDataSchema = z15.object({
2376
+ var systemThreadInterruptedEventDataSchema = z14.object({
2601
2377
  reason: systemThreadInterruptedReasonSchema,
2602
- cause: z15.literal("host-connection-lost").optional()
2378
+ cause: z14.literal("host-connection-lost").optional()
2603
2379
  });
2604
- var provisioningTranscriptEntrySchema = z15.object({
2605
- type: z15.enum(["step", "output"]),
2606
- key: z15.string(),
2607
- text: z15.string(),
2608
- startedAt: z15.number().optional(),
2609
- status: z15.enum(["started", "completed", "failed"]).optional(),
2610
- metadata: z15.record(z15.string(), z15.unknown()).optional()
2380
+ var provisioningTranscriptEntrySchema = z14.object({
2381
+ type: z14.enum(["step", "output"]),
2382
+ key: z14.string(),
2383
+ text: z14.string(),
2384
+ startedAt: z14.number().optional(),
2385
+ status: z14.enum(["started", "completed", "failed"]).optional(),
2386
+ metadata: z14.record(z14.string(), z14.unknown()).optional()
2611
2387
  });
2612
2388
  var systemThreadProvisioningStatusValues = [
2613
2389
  "active",
@@ -2615,48 +2391,48 @@ var systemThreadProvisioningStatusValues = [
2615
2391
  "failed",
2616
2392
  "cancelled"
2617
2393
  ];
2618
- var systemThreadProvisioningStatusSchema = z15.enum(
2394
+ var systemThreadProvisioningStatusSchema = z14.enum(
2619
2395
  systemThreadProvisioningStatusValues
2620
2396
  );
2621
- var systemThreadProvisioningEventDataSchema = z15.object({
2622
- provisioningId: z15.string(),
2397
+ var systemThreadProvisioningEventDataSchema = z14.object({
2398
+ provisioningId: z14.string(),
2623
2399
  status: systemThreadProvisioningStatusSchema,
2624
- environmentId: z15.string().nullable(),
2625
- entries: z15.array(provisioningTranscriptEntrySchema)
2626
- });
2627
- var systemLegacyUserMessageEventDataSchema = z15.object({
2628
- text: z15.string(),
2629
- toolCallId: z15.string().optional(),
2630
- turnId: z15.string().optional()
2631
- });
2632
- var systemProviderTurnWatchdogEventDataSchema = z15.object({
2633
- reason: z15.literal("provider-turn-idle"),
2634
- thresholdMs: z15.number().int().positive(),
2635
- elapsedMs: z15.number().int().nonnegative(),
2636
- activeTurnId: z15.string().min(1),
2637
- activeTurnStartedAt: z15.number().int().nonnegative(),
2638
- lastActivityEventSequence: z15.number().int().positive(),
2639
- lastActivityEventType: z15.string().min(1),
2640
- lastActivityEventAt: z15.number().int().nonnegative(),
2641
- providerId: z15.string().min(1),
2642
- providerThreadId: z15.string().min(1).nullable(),
2643
- firedAt: z15.number().int().nonnegative()
2400
+ environmentId: z14.string().nullable(),
2401
+ entries: z14.array(provisioningTranscriptEntrySchema)
2402
+ });
2403
+ var systemLegacyUserMessageEventDataSchema = z14.object({
2404
+ text: z14.string(),
2405
+ toolCallId: z14.string().optional(),
2406
+ turnId: z14.string().optional()
2407
+ });
2408
+ var systemProviderTurnWatchdogEventDataSchema = z14.object({
2409
+ reason: z14.literal("provider-turn-idle"),
2410
+ thresholdMs: z14.number().int().positive(),
2411
+ elapsedMs: z14.number().int().nonnegative(),
2412
+ activeTurnId: z14.string().min(1),
2413
+ activeTurnStartedAt: z14.number().int().nonnegative(),
2414
+ lastActivityEventSequence: z14.number().int().positive(),
2415
+ lastActivityEventType: z14.string().min(1),
2416
+ lastActivityEventAt: z14.number().int().nonnegative(),
2417
+ providerId: z14.string().min(1),
2418
+ providerThreadId: z14.string().min(1).nullable(),
2419
+ firedAt: z14.number().int().nonnegative()
2644
2420
  });
2645
2421
 
2646
2422
  // ../domain/src/thread-event-scope.ts
2647
- import { z as z16 } from "zod";
2423
+ import { z as z15 } from "zod";
2648
2424
  var threadEventScopeKindValues = ["thread", "turn"];
2649
- var threadEventScopeKindSchema = z16.enum(threadEventScopeKindValues);
2650
- var threadEventScopeSchema = z16.discriminatedUnion("kind", [
2651
- z16.object({ kind: z16.literal("thread") }),
2652
- z16.object({ kind: z16.literal("turn"), turnId: z16.string().min(1) })
2425
+ var threadEventScopeKindSchema = z15.enum(threadEventScopeKindValues);
2426
+ var threadEventScopeSchema = z15.discriminatedUnion("kind", [
2427
+ z15.object({ kind: z15.literal("thread") }),
2428
+ z15.object({ kind: z15.literal("turn"), turnId: z15.string().min(1) })
2653
2429
  ]);
2654
2430
  var threadEventScopePolicyValues = [
2655
2431
  "thread",
2656
2432
  "turn",
2657
2433
  "thread-or-turn"
2658
2434
  ];
2659
- var threadEventScopePolicySchema = z16.enum(threadEventScopePolicyValues);
2435
+ var threadEventScopePolicySchema = z15.enum(threadEventScopePolicyValues);
2660
2436
  var threadEventScopeDefinitionByType = {
2661
2437
  "thread/started": {
2662
2438
  policy: "thread",
@@ -2799,9 +2575,6 @@ function getThreadEventScopePolicyDefinitionEntries() {
2799
2575
  })
2800
2576
  );
2801
2577
  }
2802
- function getThreadEventTypesForScopePolicy(policy) {
2803
- return getThreadEventScopePolicyDefinitionEntries().filter((entry) => entry.definition.policy === policy).map((entry) => entry.type);
2804
- }
2805
2578
  function buildThreadEventScopePolicyByType() {
2806
2579
  const policies = {};
2807
2580
  for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
@@ -2809,20 +2582,7 @@ function buildThreadEventScopePolicyByType() {
2809
2582
  }
2810
2583
  return policies;
2811
2584
  }
2812
- function buildThreadScopeRationaleByType() {
2813
- const rationales = {};
2814
- for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
2815
- if (entry.definition.rationale) {
2816
- rationales[entry.type] = entry.definition.rationale;
2817
- }
2818
- }
2819
- return rationales;
2820
- }
2821
- var turnOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("turn");
2822
- var threadOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("thread");
2823
- var threadOrTurnThreadEventTypes = getThreadEventTypesForScopePolicy("thread-or-turn");
2824
2585
  var threadEventScopePolicyByType = buildThreadEventScopePolicyByType();
2825
- var threadScopeRationaleByType = buildThreadScopeRationaleByType();
2826
2586
  function validateThreadEventScope(args) {
2827
2587
  const policy = threadEventScopePolicyByType[args.type];
2828
2588
  if (policy === "thread-or-turn") {
@@ -2838,32 +2598,32 @@ function validateThreadEventScope(args) {
2838
2598
  }
2839
2599
 
2840
2600
  // ../domain/src/thread-timeline-goal.ts
2841
- import { z as z17 } from "zod";
2842
- var threadTimelineGoalStatusSchema = z17.enum([
2601
+ import { z as z16 } from "zod";
2602
+ var threadTimelineGoalStatusSchema = z16.enum([
2843
2603
  "active",
2844
2604
  "paused",
2845
2605
  "budgetLimited",
2846
2606
  "complete"
2847
2607
  ]);
2848
- var threadTimelineGoalSchema = z17.object({
2849
- sourceSeq: z17.number().int().nonnegative(),
2850
- updatedAt: z17.number(),
2851
- objective: z17.string(),
2608
+ var threadTimelineGoalSchema = z16.object({
2609
+ sourceSeq: z16.number().int().nonnegative(),
2610
+ updatedAt: z16.number(),
2611
+ objective: z16.string(),
2852
2612
  status: threadTimelineGoalStatusSchema,
2853
- tokenBudget: z17.number().nullable(),
2854
- tokensUsed: z17.number(),
2855
- timeUsedSeconds: z17.number()
2613
+ tokenBudget: z16.number().nullable(),
2614
+ tokensUsed: z16.number(),
2615
+ timeUsedSeconds: z16.number()
2856
2616
  });
2857
2617
 
2858
2618
  // ../domain/src/provider-event.ts
2859
- var threadEventItemStatusSchema = z18.enum([
2619
+ var threadEventItemStatusSchema = z17.enum([
2860
2620
  "pending",
2861
2621
  "completed",
2862
2622
  "failed",
2863
2623
  "interrupted"
2864
2624
  ]);
2865
- var threadEventItemApprovalStatusSchema = z18.enum(["waiting_for_approval", "denied"]).nullable();
2866
- var threadEventTurnStatusSchema = z18.enum([
2625
+ var threadEventItemApprovalStatusSchema = z17.enum(["waiting_for_approval", "denied"]).nullable();
2626
+ var threadEventTurnStatusSchema = z17.enum([
2867
2627
  "completed",
2868
2628
  "failed",
2869
2629
  "interrupted"
@@ -2889,259 +2649,260 @@ var providerErrorCategoryValues = [
2889
2649
  "unauthorized",
2890
2650
  "unknown"
2891
2651
  ];
2892
- var providerErrorCategorySchema = z18.enum(providerErrorCategoryValues);
2893
- var providerErrorInfoSchema = z18.object({
2652
+ var providerErrorCategorySchema = z17.enum(providerErrorCategoryValues);
2653
+ var providerErrorInfoSchema = z17.object({
2894
2654
  category: providerErrorCategorySchema,
2895
- providerCode: z18.string().nullable(),
2896
- httpStatusCode: z18.number().nullable()
2655
+ providerCode: z17.string().nullable(),
2656
+ httpStatusCode: z17.number().nullable()
2897
2657
  });
2898
- var providerRateLimitStatusSchema = z18.enum([
2658
+ var providerRateLimitStatusSchema = z17.enum([
2899
2659
  "allowed",
2900
2660
  "warning",
2901
2661
  "blocked",
2902
2662
  "unknown"
2903
2663
  ]);
2904
- var providerRateLimitWindowSchema = z18.object({
2905
- providerKey: z18.string().min(1).nullable(),
2906
- label: z18.string().min(1).nullable(),
2664
+ var providerRateLimitWindowSchema = z17.object({
2665
+ providerKey: z17.string().min(1).nullable(),
2666
+ label: z17.string().min(1).nullable(),
2907
2667
  status: providerRateLimitStatusSchema,
2908
- resetsAtMs: z18.number().int().nonnegative().nullable()
2668
+ resetsAtMs: z17.number().int().nonnegative().nullable()
2909
2669
  });
2910
- var providerRateLimitStateSchema = z18.object({
2911
- providerId: z18.string().min(1),
2670
+ var providerRateLimitStateSchema = z17.object({
2671
+ providerId: z17.string().min(1),
2912
2672
  status: providerRateLimitStatusSchema,
2913
- kind: z18.enum(["subscription-window", "credits", "spend-control", "unknown"]),
2914
- windows: z18.array(providerRateLimitWindowSchema),
2915
- reachedReason: z18.string().min(1).nullable(),
2916
- overageStatus: z18.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
2917
- overageReason: z18.string().min(1).nullable()
2918
- });
2919
- var threadEventFileChangeKindSchema = z18.enum(["add", "delete", "update"]);
2920
- var threadEventFileChangeSchema = z18.object({
2921
- path: z18.string(),
2673
+ kind: z17.enum(["subscription-window", "credits", "spend-control", "unknown"]),
2674
+ windows: z17.array(providerRateLimitWindowSchema),
2675
+ reachedReason: z17.string().min(1).nullable(),
2676
+ overageStatus: z17.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
2677
+ overageReason: z17.string().min(1).nullable()
2678
+ });
2679
+ var threadEventFileChangeKindSchema = z17.enum(["add", "delete", "update"]);
2680
+ var threadEventFileChangeSchema = z17.object({
2681
+ path: z17.string(),
2922
2682
  kind: threadEventFileChangeKindSchema,
2923
- movePath: z18.string().optional(),
2924
- diff: z18.string().optional()
2683
+ movePath: z17.string().optional(),
2684
+ diff: z17.string().optional()
2925
2685
  });
2926
- var threadEventPlanStepStatusSchema = z18.enum([
2686
+ var threadEventPlanStepStatusSchema = z17.enum([
2927
2687
  "pending",
2928
2688
  "active",
2929
2689
  "completed",
2930
2690
  "failed"
2931
2691
  ]);
2932
- var threadEventPlanStepSchema = z18.object({
2933
- step: z18.string(),
2692
+ var threadEventPlanStepSchema = z17.object({
2693
+ step: z17.string(),
2934
2694
  status: threadEventPlanStepStatusSchema.optional()
2935
2695
  });
2936
2696
  var itemPresentationField = {
2937
2697
  presentation: threadEventItemPresentationSchema.optional()
2938
2698
  };
2939
- var threadEventWebSearchItemSchema = z18.object({
2940
- type: z18.literal("webSearch"),
2941
- id: z18.string(),
2942
- queries: z18.array(z18.string()).min(1),
2943
- resultText: z18.string().nullable(),
2699
+ var threadEventWebSearchItemSchema = z17.object({
2700
+ type: z17.literal("webSearch"),
2701
+ id: z17.string(),
2702
+ queries: z17.array(z17.string()).min(1),
2703
+ resultText: z17.string().nullable(),
2944
2704
  ...itemPresentationField,
2945
- parentToolCallId: z18.string().optional()
2946
- });
2947
- var threadEventWebFetchItemSchema = z18.object({
2948
- type: z18.literal("webFetch"),
2949
- id: z18.string(),
2950
- url: z18.string(),
2951
- prompt: z18.string().nullable(),
2952
- pattern: z18.string().nullable(),
2953
- resultText: z18.string().nullable(),
2705
+ parentToolCallId: z17.string().optional()
2706
+ });
2707
+ var threadEventWebFetchItemSchema = z17.object({
2708
+ type: z17.literal("webFetch"),
2709
+ id: z17.string(),
2710
+ url: z17.string(),
2711
+ prompt: z17.string().nullable(),
2712
+ pattern: z17.string().nullable(),
2713
+ resultText: z17.string().nullable(),
2954
2714
  ...itemPresentationField,
2955
- parentToolCallId: z18.string().optional()
2715
+ parentToolCallId: z17.string().optional()
2956
2716
  });
2957
- var threadEventImageViewItemSchema = z18.object({
2958
- type: z18.literal("imageView"),
2959
- id: z18.string(),
2960
- path: z18.string(),
2717
+ var threadEventImageViewItemSchema = z17.object({
2718
+ type: z17.literal("imageView"),
2719
+ id: z17.string(),
2720
+ path: z17.string(),
2961
2721
  ...itemPresentationField,
2962
- parentToolCallId: z18.string().optional()
2722
+ parentToolCallId: z17.string().optional()
2963
2723
  });
2964
- var threadEventFileReadItemSchema = z18.object({
2965
- type: z18.literal("fileRead"),
2966
- id: z18.string(),
2967
- path: z18.string(),
2968
- cmd: z18.string().optional(),
2724
+ var threadEventFileReadItemSchema = z17.object({
2725
+ type: z17.literal("fileRead"),
2726
+ id: z17.string(),
2727
+ path: z17.string(),
2728
+ cmd: z17.string().optional(),
2969
2729
  status: threadEventItemStatusSchema,
2970
2730
  ...itemPresentationField,
2971
- parentToolCallId: z18.string().optional()
2731
+ parentToolCallId: z17.string().optional()
2972
2732
  });
2973
- var threadEventSearchModeSchema = z18.enum(["content", "path", "list"]);
2974
- var threadEventSearchItemSchema = z18.object({
2975
- type: z18.literal("search"),
2976
- id: z18.string(),
2733
+ var threadEventSearchModeSchema = z17.enum(["content", "path", "list"]);
2734
+ var threadEventSearchItemSchema = z17.object({
2735
+ type: z17.literal("search"),
2736
+ id: z17.string(),
2977
2737
  mode: threadEventSearchModeSchema,
2978
- query: z18.string(),
2979
- path: z18.string().optional(),
2980
- cmd: z18.string().optional(),
2738
+ query: z17.string(),
2739
+ path: z17.string().optional(),
2740
+ cmd: z17.string().optional(),
2981
2741
  status: threadEventItemStatusSchema,
2982
2742
  ...itemPresentationField,
2983
- parentToolCallId: z18.string().optional()
2743
+ parentToolCallId: z17.string().optional()
2984
2744
  });
2985
- var threadEventDelegationItemSchema = z18.object({
2986
- type: z18.literal("delegation"),
2987
- id: z18.string(),
2988
- childRef: z18.string().min(1),
2989
- label: z18.string(),
2745
+ var threadEventDelegationItemSchema = z17.object({
2746
+ type: z17.literal("delegation"),
2747
+ id: z17.string(),
2748
+ childRef: z17.string().min(1),
2749
+ label: z17.string(),
2990
2750
  status: threadEventItemStatusSchema,
2991
- background: z18.boolean(),
2992
- summary: z18.string().optional(),
2751
+ background: z17.boolean(),
2752
+ summary: z17.string().optional(),
2993
2753
  ...itemPresentationField,
2994
- parentToolCallId: z18.string().optional()
2754
+ parentToolCallId: z17.string().optional()
2995
2755
  });
2996
- var threadEventPlanStepsItemSchema = z18.object({
2997
- type: z18.literal("planSteps"),
2998
- id: z18.string(),
2999
- steps: z18.array(threadEventPlanStepSchema),
3000
- explanation: z18.string().optional(),
2756
+ var threadEventPlanStepsItemSchema = z17.object({
2757
+ type: z17.literal("planSteps"),
2758
+ id: z17.string(),
2759
+ steps: z17.array(threadEventPlanStepSchema),
2760
+ explanation: z17.string().optional(),
3001
2761
  status: threadEventItemStatusSchema,
3002
2762
  ...itemPresentationField,
3003
- parentToolCallId: z18.string().optional()
2763
+ parentToolCallId: z17.string().optional()
3004
2764
  });
3005
- var threadEventExtensionItemSchema = z18.object({
3006
- type: z18.literal("extension"),
3007
- id: z18.string(),
2765
+ var threadEventExtensionItemSchema = z17.object({
2766
+ type: z17.literal("extension"),
2767
+ id: z17.string(),
3008
2768
  kind: extensionKindSchema,
3009
2769
  payload: jsonValueSchema,
3010
2770
  status: threadEventItemStatusSchema,
3011
2771
  presentation: threadEventItemPresentationSchema,
3012
- parentToolCallId: z18.string().optional()
2772
+ parentToolCallId: z17.string().optional()
3013
2773
  });
3014
- var threadEventTextTruncationSchema = z18.object({
3015
- originalLength: z18.number(),
3016
- retainedHeadLength: z18.number(),
3017
- retainedTailLength: z18.number(),
3018
- truncatedAt: z18.number()
2774
+ var threadEventTextTruncationSchema = z17.object({
2775
+ originalLength: z17.number(),
2776
+ retainedHeadLength: z17.number(),
2777
+ retainedTailLength: z17.number(),
2778
+ truncatedAt: z17.number()
3019
2779
  });
3020
- var threadEventItemTruncationSchema = z18.object({
2780
+ var threadEventItemTruncationSchema = z17.object({
3021
2781
  aggregatedOutput: threadEventTextTruncationSchema.optional(),
3022
2782
  result: threadEventTextTruncationSchema.optional(),
3023
2783
  resultText: threadEventTextTruncationSchema.optional()
3024
2784
  });
3025
- var threadEventImageGenerationItemSchema = z18.object({
3026
- type: z18.literal("imageGeneration"),
3027
- id: z18.string(),
2785
+ var threadEventImageGenerationItemSchema = z17.object({
2786
+ type: z17.literal("imageGeneration"),
2787
+ id: z17.string(),
3028
2788
  status: threadEventItemStatusSchema,
3029
- prompt: z18.string().nullable(),
3030
- path: z18.string().nullable(),
3031
- result: z18.string().optional(),
3032
- error: z18.string().nullable(),
3033
- transparentBackground: z18.boolean(),
2789
+ prompt: z17.string().nullable(),
2790
+ path: z17.string().nullable(),
2791
+ result: z17.string().optional(),
2792
+ error: z17.string().nullable(),
2793
+ transparentBackground: z17.boolean(),
3034
2794
  truncation: threadEventItemTruncationSchema.optional(),
3035
2795
  ...itemPresentationField,
3036
- parentToolCallId: z18.string().optional()
2796
+ parentToolCallId: z17.string().optional()
3037
2797
  });
3038
- var threadEventUserContentSchema = z18.discriminatedUnion("type", [
3039
- z18.object({ type: z18.literal("text"), text: z18.string() }),
3040
- z18.object({ type: z18.literal("image"), url: z18.string() }),
3041
- z18.object({ type: z18.literal("localImage"), path: z18.string() }),
3042
- z18.object({ type: z18.literal("localFile"), path: z18.string() })
2798
+ var threadEventUserContentSchema = z17.discriminatedUnion("type", [
2799
+ z17.object({ type: z17.literal("text"), text: z17.string() }),
2800
+ z17.object({ type: z17.literal("image"), url: z17.string() }),
2801
+ z17.object({ type: z17.literal("localImage"), path: z17.string() }),
2802
+ z17.object({ type: z17.literal("localFile"), path: z17.string() })
3043
2803
  ]);
3044
- var threadEventTokenUsageBreakdownSchema = z18.object({
3045
- totalTokens: z18.number(),
3046
- inputTokens: z18.number(),
3047
- cachedInputTokens: z18.number(),
3048
- outputTokens: z18.number(),
3049
- reasoningOutputTokens: z18.number()
3050
- });
3051
- var threadEventContextWindowUsageSchema = z18.object({
3052
- usedTokens: z18.number().nullable(),
3053
- modelContextWindow: z18.number().nullable(),
3054
- estimated: z18.boolean()
3055
- });
3056
- var threadEventTokenUsageSchema = z18.object({
2804
+ var threadEventTokenUsageBreakdownSchema = z17.object({
2805
+ totalTokens: z17.number(),
2806
+ inputTokens: z17.number(),
2807
+ cachedInputTokens: z17.number(),
2808
+ outputTokens: z17.number(),
2809
+ reasoningOutputTokens: z17.number()
2810
+ });
2811
+ var threadEventContextWindowUsageSchema = z17.object({
2812
+ snapshot: contextSnapshotSchema.optional(),
2813
+ usedTokens: z17.number().nullable(),
2814
+ modelContextWindow: z17.number().nullable(),
2815
+ estimated: z17.boolean()
2816
+ });
2817
+ var threadEventTokenUsageSchema = z17.object({
3057
2818
  total: threadEventTokenUsageBreakdownSchema,
3058
2819
  last: threadEventTokenUsageBreakdownSchema,
3059
- modelContextWindow: z18.number().nullable()
2820
+ modelContextWindow: z17.number().nullable()
3060
2821
  });
3061
- var threadEventWarningCategorySchema = z18.enum([
2822
+ var threadEventWarningCategorySchema = z17.enum([
3062
2823
  "deprecation",
3063
2824
  "config",
3064
2825
  "general",
3065
2826
  "compaction-skipped"
3066
2827
  ]);
3067
- var providerRawEventSchema = z18.object({
3068
- jsonrpc: z18.literal("2.0"),
3069
- id: z18.union([z18.string(), z18.number()]).optional(),
3070
- method: z18.string(),
2828
+ var providerRawEventSchema = z17.object({
2829
+ jsonrpc: z17.literal("2.0"),
2830
+ id: z17.union([z17.string(), z17.number()]).optional(),
2831
+ method: z17.string(),
3071
2832
  params: jsonValueSchema.optional()
3072
2833
  });
3073
- var providerUnhandledEventSchema = z18.object({
3074
- type: z18.literal("provider/unhandled"),
3075
- threadId: z18.string(),
3076
- providerThreadId: z18.string(),
3077
- providerId: z18.string(),
3078
- rawType: z18.string(),
2834
+ var providerUnhandledEventSchema = z17.object({
2835
+ type: z17.literal("provider/unhandled"),
2836
+ threadId: z17.string(),
2837
+ providerThreadId: z17.string(),
2838
+ providerId: z17.string(),
2839
+ rawType: z17.string(),
3079
2840
  rawEvent: providerRawEventSchema,
3080
- parentToolCallId: z18.string().optional()
3081
- });
3082
- var toolCallProgressEventSchema = z18.object({
3083
- type: z18.literal("item/toolCall/progress"),
3084
- threadId: z18.string(),
3085
- providerThreadId: z18.string(),
3086
- itemId: z18.string(),
3087
- message: z18.string().optional(),
3088
- parentToolCallId: z18.string().optional()
3089
- });
3090
- var threadEventBackgroundTaskItemSchema = z18.object({
3091
- type: z18.literal("backgroundTask"),
3092
- id: z18.string(),
3093
- familyId: z18.string().optional(),
3094
- taskType: z18.string(),
3095
- description: z18.string(),
2841
+ parentToolCallId: z17.string().optional()
2842
+ });
2843
+ var toolCallProgressEventSchema = z17.object({
2844
+ type: z17.literal("item/toolCall/progress"),
2845
+ threadId: z17.string(),
2846
+ providerThreadId: z17.string(),
2847
+ itemId: z17.string(),
2848
+ message: z17.string().optional(),
2849
+ parentToolCallId: z17.string().optional()
2850
+ });
2851
+ var threadEventBackgroundTaskItemSchema = z17.object({
2852
+ type: z17.literal("backgroundTask"),
2853
+ id: z17.string(),
2854
+ familyId: z17.string().optional(),
2855
+ taskType: z17.string(),
2856
+ description: z17.string(),
3096
2857
  status: threadEventItemStatusSchema,
3097
2858
  taskStatus: backgroundTaskStatusSchema,
3098
- skipTranscript: z18.boolean(),
3099
- workflowName: z18.string().optional(),
2859
+ skipTranscript: z17.boolean(),
2860
+ workflowName: z17.string().optional(),
3100
2861
  workflow: workflowProgressSnapshotSchema.optional(),
3101
2862
  usage: backgroundTaskUsageSchema.optional(),
3102
- summary: z18.string().optional(),
3103
- error: z18.string().optional(),
3104
- outputFile: z18.string().optional(),
2863
+ summary: z17.string().optional(),
2864
+ error: z17.string().optional(),
2865
+ outputFile: z17.string().optional(),
3105
2866
  ...itemPresentationField,
3106
- parentToolCallId: z18.string().optional()
2867
+ parentToolCallId: z17.string().optional()
3107
2868
  });
3108
- var threadEventItemSchema = z18.discriminatedUnion("type", [
3109
- z18.object({
3110
- type: z18.literal("userMessage"),
3111
- id: z18.string(),
3112
- content: z18.array(threadEventUserContentSchema),
2869
+ var threadEventItemSchema = z17.discriminatedUnion("type", [
2870
+ z17.object({
2871
+ type: z17.literal("userMessage"),
2872
+ id: z17.string(),
2873
+ content: z17.array(threadEventUserContentSchema),
3113
2874
  clientRequestId: clientTurnRequestIdSchema.optional(),
3114
- parentToolCallId: z18.string().optional()
2875
+ parentToolCallId: z17.string().optional()
3115
2876
  }).strict(),
3116
- z18.object({
3117
- type: z18.literal("agentMessage"),
3118
- id: z18.string(),
3119
- text: z18.string(),
2877
+ z17.object({
2878
+ type: z17.literal("agentMessage"),
2879
+ id: z17.string(),
2880
+ text: z17.string(),
3120
2881
  ...itemPresentationField,
3121
- parentToolCallId: z18.string().optional()
2882
+ parentToolCallId: z17.string().optional()
3122
2883
  }),
3123
- z18.object({
3124
- type: z18.literal("commandExecution"),
3125
- id: z18.string(),
3126
- command: z18.string(),
3127
- cwd: z18.string(),
2884
+ z17.object({
2885
+ type: z17.literal("commandExecution"),
2886
+ id: z17.string(),
2887
+ command: z17.string(),
2888
+ cwd: z17.string(),
3128
2889
  status: threadEventItemStatusSchema,
3129
2890
  approvalStatus: threadEventItemApprovalStatusSchema,
3130
- aggregatedOutput: z18.string().optional(),
3131
- exitCode: z18.number().optional(),
3132
- durationMs: z18.number().optional(),
2891
+ aggregatedOutput: z17.string().optional(),
2892
+ exitCode: z17.number().optional(),
2893
+ durationMs: z17.number().optional(),
3133
2894
  truncation: threadEventItemTruncationSchema.optional(),
3134
2895
  ...itemPresentationField,
3135
- parentToolCallId: z18.string().optional()
2896
+ parentToolCallId: z17.string().optional()
3136
2897
  }),
3137
- z18.object({
3138
- type: z18.literal("fileChange"),
3139
- id: z18.string(),
3140
- changes: z18.array(threadEventFileChangeSchema),
2898
+ z17.object({
2899
+ type: z17.literal("fileChange"),
2900
+ id: z17.string(),
2901
+ changes: z17.array(threadEventFileChangeSchema),
3141
2902
  status: threadEventItemStatusSchema,
3142
2903
  approvalStatus: threadEventItemApprovalStatusSchema,
3143
2904
  ...itemPresentationField,
3144
- parentToolCallId: z18.string().optional()
2905
+ parentToolCallId: z17.string().optional()
3145
2906
  }),
3146
2907
  threadEventWebSearchItemSchema,
3147
2908
  threadEventWebFetchItemSchema,
@@ -3149,289 +2910,264 @@ var threadEventItemSchema = z18.discriminatedUnion("type", [
3149
2910
  threadEventImageGenerationItemSchema,
3150
2911
  threadEventFileReadItemSchema,
3151
2912
  threadEventSearchItemSchema,
3152
- z18.object({
3153
- type: z18.literal("toolCall"),
3154
- id: z18.string(),
3155
- server: z18.string().optional(),
3156
- tool: z18.string(),
3157
- arguments: z18.record(z18.string(), z18.unknown()).optional(),
2913
+ z17.object({
2914
+ type: z17.literal("toolCall"),
2915
+ id: z17.string(),
2916
+ server: z17.string().optional(),
2917
+ tool: z17.string(),
2918
+ arguments: z17.record(z17.string(), z17.unknown()).optional(),
3158
2919
  status: threadEventItemStatusSchema,
3159
- result: z18.unknown().optional(),
3160
- error: z18.string().optional(),
3161
- durationMs: z18.number().optional(),
2920
+ result: z17.unknown().optional(),
2921
+ error: z17.string().optional(),
2922
+ durationMs: z17.number().optional(),
3162
2923
  truncation: threadEventItemTruncationSchema.optional(),
3163
2924
  ...itemPresentationField,
3164
- parentToolCallId: z18.string().optional()
2925
+ parentToolCallId: z17.string().optional()
3165
2926
  }),
3166
- z18.object({
3167
- type: z18.literal("reasoning"),
3168
- id: z18.string(),
3169
- summary: z18.array(z18.string()),
3170
- content: z18.array(z18.string()),
2927
+ z17.object({
2928
+ type: z17.literal("reasoning"),
2929
+ id: z17.string(),
2930
+ summary: z17.array(z17.string()),
2931
+ content: z17.array(z17.string()),
3171
2932
  ...itemPresentationField,
3172
- parentToolCallId: z18.string().optional()
2933
+ parentToolCallId: z17.string().optional()
3173
2934
  }),
3174
- z18.object({
3175
- type: z18.literal("plan"),
3176
- id: z18.string(),
3177
- text: z18.string(),
2935
+ z17.object({
2936
+ type: z17.literal("plan"),
2937
+ id: z17.string(),
2938
+ text: z17.string(),
3178
2939
  ...itemPresentationField,
3179
- parentToolCallId: z18.string().optional()
2940
+ parentToolCallId: z17.string().optional()
3180
2941
  }),
3181
2942
  threadEventPlanStepsItemSchema,
3182
- z18.object({
3183
- type: z18.literal("contextCompaction"),
3184
- id: z18.string(),
2943
+ z17.object({
2944
+ type: z17.literal("contextCompaction"),
2945
+ id: z17.string(),
3185
2946
  ...itemPresentationField,
3186
- parentToolCallId: z18.string().optional()
2947
+ parentToolCallId: z17.string().optional()
3187
2948
  }),
3188
2949
  threadEventBackgroundTaskItemSchema,
3189
2950
  threadEventDelegationItemSchema,
3190
2951
  threadEventExtensionItemSchema
3191
2952
  ]);
3192
- var unscopedProviderEventSchema = z18.discriminatedUnion("type", [
3193
- z18.object({
3194
- type: z18.literal("thread/started"),
3195
- threadId: z18.string()
2953
+ function itemTextDeltaEventSchema(type) {
2954
+ return z17.object({
2955
+ type: z17.literal(type),
2956
+ threadId: z17.string(),
2957
+ providerThreadId: z17.string(),
2958
+ itemId: z17.string(),
2959
+ delta: z17.string(),
2960
+ parentToolCallId: z17.string().optional()
2961
+ });
2962
+ }
2963
+ var unscopedProviderEventSchema = z17.discriminatedUnion("type", [
2964
+ z17.object({
2965
+ type: z17.literal("thread/started"),
2966
+ threadId: z17.string()
3196
2967
  }),
3197
- z18.object({
3198
- type: z18.literal("thread/identity"),
3199
- threadId: z18.string(),
3200
- providerThreadId: z18.string()
2968
+ z17.object({
2969
+ type: z17.literal("thread/identity"),
2970
+ threadId: z17.string(),
2971
+ providerThreadId: z17.string()
3201
2972
  }),
3202
- z18.object({
3203
- type: z18.literal("turn/started"),
3204
- threadId: z18.string(),
3205
- providerThreadId: z18.string(),
3206
- parentToolCallId: z18.string().optional()
2973
+ z17.object({
2974
+ type: z17.literal("turn/started"),
2975
+ threadId: z17.string(),
2976
+ providerThreadId: z17.string(),
2977
+ parentToolCallId: z17.string().optional()
3207
2978
  }),
3208
- z18.object({
3209
- type: z18.literal("turn/completed"),
3210
- threadId: z18.string(),
3211
- providerThreadId: z18.string().nullable(),
2979
+ z17.object({
2980
+ type: z17.literal("turn/completed"),
2981
+ threadId: z17.string(),
2982
+ providerThreadId: z17.string().nullable(),
3212
2983
  status: threadEventTurnStatusSchema,
3213
- error: z18.object({ message: z18.string() }).optional(),
3214
- providerCheckpointId: z18.string().min(1).optional()
2984
+ error: z17.object({ message: z17.string() }).optional(),
2985
+ providerCheckpointId: z17.string().min(1).optional()
3215
2986
  }),
3216
- z18.object({
3217
- type: z18.literal("turn/input/accepted"),
3218
- threadId: z18.string(),
3219
- providerThreadId: z18.string(),
2987
+ z17.object({
2988
+ type: z17.literal("turn/input/accepted"),
2989
+ threadId: z17.string(),
2990
+ providerThreadId: z17.string(),
3220
2991
  clientRequestId: clientTurnRequestIdSchema,
3221
2992
  scope: threadEventScopeSchema
3222
2993
  }).strict(),
3223
- z18.object({
3224
- type: z18.literal("thread/name/updated"),
3225
- threadId: z18.string(),
3226
- providerThreadId: z18.string(),
3227
- threadName: z18.string()
2994
+ z17.object({
2995
+ type: z17.literal("thread/name/updated"),
2996
+ threadId: z17.string(),
2997
+ providerThreadId: z17.string(),
2998
+ threadName: z17.string()
3228
2999
  }),
3229
- z18.object({
3230
- type: z18.literal("thread/compacted"),
3231
- threadId: z18.string(),
3232
- providerThreadId: z18.string()
3000
+ z17.object({
3001
+ type: z17.literal("thread/compacted"),
3002
+ threadId: z17.string(),
3003
+ providerThreadId: z17.string()
3233
3004
  }),
3234
- z18.object({
3235
- type: z18.literal("thread/context/cleared"),
3236
- threadId: z18.string(),
3237
- providerThreadId: z18.string()
3005
+ z17.object({
3006
+ type: z17.literal("thread/context/cleared"),
3007
+ threadId: z17.string(),
3008
+ providerThreadId: z17.string()
3238
3009
  }),
3239
- z18.object({
3240
- type: z18.literal("thread/goal/updated"),
3241
- threadId: z18.string(),
3242
- providerThreadId: z18.string(),
3243
- objective: z18.string(),
3010
+ z17.object({
3011
+ type: z17.literal("thread/goal/updated"),
3012
+ threadId: z17.string(),
3013
+ providerThreadId: z17.string(),
3014
+ objective: z17.string(),
3244
3015
  status: threadTimelineGoalStatusSchema,
3245
- tokenBudget: z18.number().nullable(),
3246
- tokensUsed: z18.number(),
3247
- timeUsedSeconds: z18.number()
3016
+ tokenBudget: z17.number().nullable(),
3017
+ tokensUsed: z17.number(),
3018
+ timeUsedSeconds: z17.number()
3248
3019
  }),
3249
- z18.object({
3250
- type: z18.literal("thread/goal/cleared"),
3251
- threadId: z18.string(),
3252
- providerThreadId: z18.string()
3020
+ z17.object({
3021
+ type: z17.literal("thread/goal/cleared"),
3022
+ threadId: z17.string(),
3023
+ providerThreadId: z17.string()
3253
3024
  }),
3254
- z18.object({
3255
- type: z18.literal("item/started"),
3256
- threadId: z18.string(),
3257
- providerThreadId: z18.string(),
3025
+ z17.object({
3026
+ type: z17.literal("item/started"),
3027
+ threadId: z17.string(),
3028
+ providerThreadId: z17.string(),
3258
3029
  item: threadEventItemSchema
3259
3030
  }),
3260
- z18.object({
3261
- type: z18.literal("item/completed"),
3262
- threadId: z18.string(),
3263
- providerThreadId: z18.string(),
3031
+ z17.object({
3032
+ type: z17.literal("item/completed"),
3033
+ threadId: z17.string(),
3034
+ providerThreadId: z17.string(),
3264
3035
  item: threadEventItemSchema
3265
3036
  }),
3266
- z18.object({
3267
- type: z18.literal("item/agentMessage/delta"),
3268
- threadId: z18.string(),
3269
- providerThreadId: z18.string(),
3270
- itemId: z18.string(),
3271
- delta: z18.string(),
3272
- parentToolCallId: z18.string().optional()
3273
- }),
3274
- z18.object({
3275
- type: z18.literal("item/commandExecution/outputDelta"),
3276
- threadId: z18.string(),
3277
- providerThreadId: z18.string(),
3278
- itemId: z18.string(),
3279
- delta: z18.string(),
3280
- reset: z18.boolean().optional(),
3281
- parentToolCallId: z18.string().optional()
3282
- }),
3283
- z18.object({
3284
- type: z18.literal("item/fileChange/outputDelta"),
3285
- threadId: z18.string(),
3286
- providerThreadId: z18.string(),
3287
- itemId: z18.string(),
3288
- delta: z18.string(),
3289
- parentToolCallId: z18.string().optional()
3290
- }),
3291
- z18.object({
3292
- type: z18.literal("item/reasoning/summaryTextDelta"),
3293
- threadId: z18.string(),
3294
- providerThreadId: z18.string(),
3295
- itemId: z18.string(),
3296
- delta: z18.string(),
3297
- parentToolCallId: z18.string().optional()
3037
+ itemTextDeltaEventSchema("item/agentMessage/delta"),
3038
+ z17.object({
3039
+ type: z17.literal("item/commandExecution/outputDelta"),
3040
+ threadId: z17.string(),
3041
+ providerThreadId: z17.string(),
3042
+ itemId: z17.string(),
3043
+ delta: z17.string(),
3044
+ reset: z17.boolean().optional(),
3045
+ parentToolCallId: z17.string().optional()
3298
3046
  }),
3299
- z18.object({
3300
- type: z18.literal("item/reasoning/textDelta"),
3301
- threadId: z18.string(),
3302
- providerThreadId: z18.string(),
3303
- itemId: z18.string(),
3304
- delta: z18.string(),
3305
- parentToolCallId: z18.string().optional()
3306
- }),
3307
- z18.object({
3308
- type: z18.literal("item/plan/delta"),
3309
- threadId: z18.string(),
3310
- providerThreadId: z18.string(),
3311
- itemId: z18.string(),
3312
- delta: z18.string(),
3313
- parentToolCallId: z18.string().optional()
3314
- }),
3315
- z18.object({
3316
- type: z18.literal("item/mcpToolCall/progress"),
3317
- threadId: z18.string(),
3318
- providerThreadId: z18.string(),
3319
- itemId: z18.string(),
3320
- message: z18.string().optional(),
3321
- parentToolCallId: z18.string().optional()
3047
+ itemTextDeltaEventSchema("item/fileChange/outputDelta"),
3048
+ itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
3049
+ itemTextDeltaEventSchema("item/reasoning/textDelta"),
3050
+ itemTextDeltaEventSchema("item/plan/delta"),
3051
+ z17.object({
3052
+ type: z17.literal("item/mcpToolCall/progress"),
3053
+ threadId: z17.string(),
3054
+ providerThreadId: z17.string(),
3055
+ itemId: z17.string(),
3056
+ message: z17.string().optional(),
3057
+ parentToolCallId: z17.string().optional()
3322
3058
  }),
3323
3059
  toolCallProgressEventSchema,
3324
- z18.object({
3325
- type: z18.literal("item/backgroundTask/progress"),
3326
- threadId: z18.string(),
3327
- providerThreadId: z18.string(),
3060
+ z17.object({
3061
+ type: z17.literal("item/backgroundTask/progress"),
3062
+ threadId: z17.string(),
3063
+ providerThreadId: z17.string(),
3328
3064
  item: threadEventBackgroundTaskItemSchema
3329
3065
  }),
3330
- z18.object({
3331
- type: z18.literal("item/backgroundTask/completed"),
3332
- threadId: z18.string(),
3333
- providerThreadId: z18.string(),
3066
+ z17.object({
3067
+ type: z17.literal("item/backgroundTask/completed"),
3068
+ threadId: z17.string(),
3069
+ providerThreadId: z17.string(),
3334
3070
  item: threadEventBackgroundTaskItemSchema
3335
3071
  }),
3336
- z18.object({
3337
- type: z18.literal("item/delegation/progress"),
3338
- threadId: z18.string(),
3339
- providerThreadId: z18.string(),
3072
+ z17.object({
3073
+ type: z17.literal("item/delegation/progress"),
3074
+ threadId: z17.string(),
3075
+ providerThreadId: z17.string(),
3340
3076
  item: threadEventDelegationItemSchema
3341
3077
  }),
3342
- z18.object({
3343
- type: z18.literal("item/delegation/completed"),
3344
- threadId: z18.string(),
3345
- providerThreadId: z18.string(),
3078
+ z17.object({
3079
+ type: z17.literal("item/delegation/completed"),
3080
+ threadId: z17.string(),
3081
+ providerThreadId: z17.string(),
3346
3082
  item: threadEventDelegationItemSchema
3347
3083
  }),
3348
- z18.object({
3349
- type: z18.literal("thread/tokenUsage/updated"),
3350
- threadId: z18.string(),
3351
- providerThreadId: z18.string(),
3084
+ z17.object({
3085
+ type: z17.literal("thread/tokenUsage/updated"),
3086
+ threadId: z17.string(),
3087
+ providerThreadId: z17.string(),
3352
3088
  tokenUsage: threadEventTokenUsageSchema
3353
3089
  }),
3354
- z18.object({
3355
- type: z18.literal("thread/contextWindowUsage/updated"),
3356
- threadId: z18.string(),
3357
- providerThreadId: z18.string(),
3090
+ z17.object({
3091
+ type: z17.literal("thread/contextWindowUsage/updated"),
3092
+ threadId: z17.string(),
3093
+ providerThreadId: z17.string(),
3358
3094
  contextWindowUsage: threadEventContextWindowUsageSchema
3359
3095
  }),
3360
- z18.object({
3361
- type: z18.literal("turn/plan/updated"),
3362
- threadId: z18.string(),
3363
- providerThreadId: z18.string(),
3364
- plan: z18.array(threadEventPlanStepSchema),
3365
- explanation: z18.string().optional()
3096
+ z17.object({
3097
+ type: z17.literal("turn/plan/updated"),
3098
+ threadId: z17.string(),
3099
+ providerThreadId: z17.string(),
3100
+ plan: z17.array(threadEventPlanStepSchema),
3101
+ explanation: z17.string().optional()
3366
3102
  }),
3367
- z18.object({
3368
- type: z18.literal("turn/diff/updated"),
3369
- threadId: z18.string(),
3370
- providerThreadId: z18.string(),
3371
- diff: z18.string().optional()
3103
+ z17.object({
3104
+ type: z17.literal("turn/diff/updated"),
3105
+ threadId: z17.string(),
3106
+ providerThreadId: z17.string(),
3107
+ diff: z17.string().optional()
3372
3108
  }),
3373
- z18.object({
3374
- type: z18.literal("provider/error"),
3375
- threadId: z18.string(),
3376
- providerThreadId: z18.string(),
3377
- message: z18.string(),
3378
- detail: z18.string().optional(),
3379
- willRetry: z18.boolean().optional(),
3109
+ z17.object({
3110
+ type: z17.literal("provider/error"),
3111
+ threadId: z17.string(),
3112
+ providerThreadId: z17.string(),
3113
+ message: z17.string(),
3114
+ detail: z17.string().optional(),
3115
+ willRetry: z17.boolean().optional(),
3380
3116
  errorInfo: providerErrorInfoSchema.optional()
3381
3117
  }),
3382
- z18.object({
3383
- type: z18.literal("provider/rateLimits/updated"),
3384
- threadId: z18.string(),
3385
- providerThreadId: z18.string(),
3118
+ z17.object({
3119
+ type: z17.literal("provider/rateLimits/updated"),
3120
+ threadId: z17.string(),
3121
+ providerThreadId: z17.string(),
3386
3122
  rateLimits: providerRateLimitStateSchema
3387
3123
  }),
3388
- z18.object({
3389
- type: z18.literal("provider.env-resolved"),
3390
- threadId: z18.string(),
3391
- providerThreadId: z18.string(),
3392
- entries: z18.array(
3393
- z18.object({
3394
- name: z18.string(),
3395
- source: z18.union([
3396
- z18.literal("shell"),
3397
- z18.object({ plugin: z18.string() }).strict(),
3398
- z18.object({ core: z18.enum(["machine-git", "machine-environment"]) }).strict()
3124
+ z17.object({
3125
+ type: z17.literal("provider.env-resolved"),
3126
+ threadId: z17.string(),
3127
+ providerThreadId: z17.string(),
3128
+ entries: z17.array(
3129
+ z17.object({
3130
+ name: z17.string(),
3131
+ source: z17.union([
3132
+ z17.literal("shell"),
3133
+ z17.object({ plugin: z17.string() }).strict(),
3134
+ z17.object({ core: z17.enum(["machine-git", "machine-environment"]) }).strict()
3399
3135
  ]),
3400
- value: z18.union([
3401
- z18.string(),
3402
- z18.object({ masked: z18.literal(true) }).strict()
3136
+ value: z17.union([
3137
+ z17.string(),
3138
+ z17.object({ masked: z17.literal(true) }).strict()
3403
3139
  ]),
3404
- reason: z18.string().optional()
3140
+ reason: z17.string().optional()
3405
3141
  }).strict()
3406
3142
  )
3407
3143
  }),
3408
- z18.object({
3409
- type: z18.literal("thread/extensionState/updated"),
3410
- threadId: z18.string(),
3411
- providerThreadId: z18.string(),
3144
+ z17.object({
3145
+ type: z17.literal("thread/extensionState/updated"),
3146
+ threadId: z17.string(),
3147
+ providerThreadId: z17.string(),
3412
3148
  kind: extensionKindSchema,
3413
3149
  payload: jsonValueSchema
3414
3150
  }),
3415
- z18.object({
3416
- type: z18.literal("provider/warning"),
3417
- threadId: z18.string(),
3418
- providerThreadId: z18.string(),
3151
+ z17.object({
3152
+ type: z17.literal("provider/warning"),
3153
+ threadId: z17.string(),
3154
+ providerThreadId: z17.string(),
3419
3155
  category: threadEventWarningCategorySchema,
3420
- summary: z18.string().optional(),
3421
- details: z18.string().optional()
3156
+ summary: z17.string().optional(),
3157
+ details: z17.string().optional()
3422
3158
  }),
3423
- z18.object({
3424
- type: z18.literal("provider/modelFallback"),
3425
- threadId: z18.string(),
3426
- providerThreadId: z18.string(),
3427
- originalModel: z18.string().min(1),
3428
- fallbackModel: z18.string().min(1),
3429
- reason: z18.enum(["refusal", "provider"]),
3430
- message: z18.string()
3159
+ z17.object({
3160
+ type: z17.literal("provider/modelFallback"),
3161
+ threadId: z17.string(),
3162
+ providerThreadId: z17.string(),
3163
+ originalModel: z17.string().min(1),
3164
+ fallbackModel: z17.string().min(1),
3165
+ reason: z17.enum(["refusal", "provider"]),
3166
+ message: z17.string()
3431
3167
  }),
3432
3168
  providerUnhandledEventSchema
3433
3169
  ]);
3434
- var scopedEventDataSchema = z18.object({
3170
+ var scopedEventDataSchema = z17.object({
3435
3171
  scope: threadEventScopeSchema
3436
3172
  });
3437
3173
  var providerEventSchema = unscopedProviderEventSchema.and(
@@ -3440,58 +3176,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
3440
3176
  var providerEventTypeValues = unscopedProviderEventSchema.options.map(
3441
3177
  (option) => option.shape.type.value
3442
3178
  );
3443
- var unscopedSystemEventSchema = z18.discriminatedUnion("type", [
3444
- z18.object({
3445
- type: z18.literal("client/thread/start"),
3446
- threadId: z18.string()
3179
+ var unscopedSystemEventSchema = z17.discriminatedUnion("type", [
3180
+ z17.object({
3181
+ type: z17.literal("client/thread/start"),
3182
+ threadId: z17.string()
3447
3183
  }).merge(clientTurnLifecycleEventDataSchema),
3448
- z18.object({
3449
- type: z18.literal("client/turn/requested"),
3450
- threadId: z18.string()
3184
+ z17.object({
3185
+ type: z17.literal("client/turn/requested"),
3186
+ threadId: z17.string()
3451
3187
  }).merge(turnRequestEventDataSchema),
3452
- z18.object({
3453
- type: z18.literal("client/turn/rejected"),
3454
- threadId: z18.string()
3188
+ z17.object({
3189
+ type: z17.literal("client/turn/rejected"),
3190
+ threadId: z17.string()
3455
3191
  }).merge(turnRequestRejectedEventDataSchema),
3456
- z18.object({
3457
- type: z18.literal("client/turn/start"),
3458
- threadId: z18.string()
3192
+ z17.object({
3193
+ type: z17.literal("client/turn/start"),
3194
+ threadId: z17.string()
3459
3195
  }).merge(clientTurnLifecycleEventDataSchema),
3460
- z18.object({
3461
- type: z18.literal("system/error"),
3462
- threadId: z18.string()
3196
+ z17.object({
3197
+ type: z17.literal("system/error"),
3198
+ threadId: z17.string()
3463
3199
  }).merge(systemErrorEventDataSchema),
3464
- z18.object({
3465
- type: z18.literal("system/manager/user_message"),
3466
- threadId: z18.string()
3200
+ z17.object({
3201
+ type: z17.literal("system/manager/user_message"),
3202
+ threadId: z17.string()
3467
3203
  }).merge(systemLegacyUserMessageEventDataSchema),
3468
- z18.object({
3469
- type: z18.literal("system/thread/interrupted"),
3470
- threadId: z18.string()
3204
+ z17.object({
3205
+ type: z17.literal("system/thread/interrupted"),
3206
+ threadId: z17.string()
3471
3207
  }).merge(systemThreadInterruptedEventDataSchema),
3472
- z18.object({
3473
- type: z18.literal("system/operation"),
3474
- threadId: z18.string()
3208
+ z17.object({
3209
+ type: z17.literal("system/operation"),
3210
+ threadId: z17.string()
3475
3211
  }).merge(systemOperationEventDataSchema),
3476
- z18.object({
3477
- type: z18.literal("system/interaction/lifecycle"),
3478
- threadId: z18.string()
3212
+ z17.object({
3213
+ type: z17.literal("system/interaction/lifecycle"),
3214
+ threadId: z17.string()
3479
3215
  }).merge(systemInteractionLifecycleEventDataSchema),
3480
- z18.object({
3481
- type: z18.literal("system/permissionGrant/lifecycle"),
3482
- threadId: z18.string()
3216
+ z17.object({
3217
+ type: z17.literal("system/permissionGrant/lifecycle"),
3218
+ threadId: z17.string()
3483
3219
  }).merge(systemPermissionGrantLifecycleEventDataSchema),
3484
- z18.object({
3485
- type: z18.literal("system/userQuestion/lifecycle"),
3486
- threadId: z18.string()
3220
+ z17.object({
3221
+ type: z17.literal("system/userQuestion/lifecycle"),
3222
+ threadId: z17.string()
3487
3223
  }).merge(systemUserQuestionLifecycleEventDataSchema),
3488
- z18.object({
3489
- type: z18.literal("system/thread-provisioning"),
3490
- threadId: z18.string()
3224
+ z17.object({
3225
+ type: z17.literal("system/thread-provisioning"),
3226
+ threadId: z17.string()
3491
3227
  }).merge(systemThreadProvisioningEventDataSchema),
3492
- z18.object({
3493
- type: z18.literal("system/provider-turn-watchdog"),
3494
- threadId: z18.string()
3228
+ z17.object({
3229
+ type: z17.literal("system/provider-turn-watchdog"),
3230
+ threadId: z17.string()
3495
3231
  }).merge(systemProviderTurnWatchdogEventDataSchema)
3496
3232
  ]);
3497
3233
  var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
@@ -3499,13 +3235,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
3499
3235
  function isEventPropertyBag(value) {
3500
3236
  return typeof value === "object" && value !== null && !Array.isArray(value);
3501
3237
  }
3502
- var rejectLegacyClientRequestSequenceSchema = z18.unknown().superRefine((value, ctx) => {
3238
+ var rejectLegacyClientRequestSequenceSchema = z17.unknown().superRefine((value, ctx) => {
3503
3239
  if (!isEventPropertyBag(value)) {
3504
3240
  return;
3505
3241
  }
3506
3242
  if (Object.hasOwn(value, legacyClientRequestKey)) {
3507
3243
  ctx.addIssue({
3508
- code: z18.ZodIssueCode.custom,
3244
+ code: z17.ZodIssueCode.custom,
3509
3245
  message: "legacy request sequence field is no longer accepted",
3510
3246
  path: [legacyClientRequestKey]
3511
3247
  });
@@ -3513,21 +3249,21 @@ var rejectLegacyClientRequestSequenceSchema = z18.unknown().superRefine((value,
3513
3249
  const item = value.item;
3514
3250
  if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
3515
3251
  ctx.addIssue({
3516
- code: z18.ZodIssueCode.custom,
3252
+ code: z17.ZodIssueCode.custom,
3517
3253
  message: "legacy user-message request sequence field is no longer accepted",
3518
3254
  path: ["item", legacyClientRequestKey]
3519
3255
  });
3520
3256
  }
3521
3257
  });
3522
3258
  var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
3523
- z18.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
3259
+ z17.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
3524
3260
  const result = validateThreadEventScope({
3525
3261
  type: event.type,
3526
3262
  scope: event.scope
3527
3263
  });
3528
3264
  if (!result.valid) {
3529
3265
  ctx.addIssue({
3530
- code: z18.ZodIssueCode.custom,
3266
+ code: z17.ZodIssueCode.custom,
3531
3267
  message: result.message ?? "Invalid thread event scope",
3532
3268
  path: ["scope"]
3533
3269
  });
@@ -3540,7 +3276,7 @@ var threadEventTypeValues = [
3540
3276
  ...systemEventTypeValues
3541
3277
  ];
3542
3278
  var threadEventTypeSet = new Set(threadEventTypeValues);
3543
- var threadEventTypeSchema = z18.string().refine(
3279
+ var threadEventTypeSchema = z17.string().refine(
3544
3280
  (value) => threadEventTypeSet.has(value),
3545
3281
  "Invalid thread event type"
3546
3282
  );
@@ -3551,95 +3287,95 @@ function toPositiveNumber(value) {
3551
3287
  }
3552
3288
 
3553
3289
  // ../domain/src/provider-fork.ts
3554
- import { z as z19 } from "zod";
3290
+ import { z as z18 } from "zod";
3555
3291
  var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
3556
- var providerForkSchema = z19.enum(PROVIDER_FORK_VALUES);
3292
+ var providerForkSchema = z18.enum(PROVIDER_FORK_VALUES);
3557
3293
 
3558
3294
  // ../domain/src/provider-types.ts
3559
- import { z as z20 } from "zod";
3560
- var modelReasoningEffortSchema = z20.object({
3295
+ import { z as z19 } from "zod";
3296
+ var modelReasoningEffortSchema = z19.object({
3561
3297
  reasoningEffort: reasoningLevelSchema,
3562
- description: z20.string()
3563
- });
3564
- var availableModelSchema = z20.object({
3565
- id: z20.string(),
3566
- model: z20.string(),
3567
- displayName: z20.string(),
3568
- routeProviderId: z20.string().min(1).optional(),
3569
- description: z20.string(),
3570
- supportedReasoningEfforts: z20.array(modelReasoningEffortSchema),
3298
+ description: z19.string()
3299
+ });
3300
+ var availableModelSchema = z19.object({
3301
+ id: z19.string(),
3302
+ model: z19.string(),
3303
+ displayName: z19.string(),
3304
+ routeProviderId: z19.string().min(1).optional(),
3305
+ description: z19.string(),
3306
+ supportedReasoningEfforts: z19.array(modelReasoningEffortSchema),
3571
3307
  defaultReasoningEffort: reasoningLevelSchema,
3572
- isDefault: z20.boolean()
3573
- });
3574
- var providerModelCatalogScopeSchema = z20.enum(["host", "workspace"]);
3575
- var providerCapabilitiesSchema = z20.object({
3576
- supportsThreadArchive: z20.boolean(),
3577
- supportsThreadRename: z20.boolean(),
3578
- supportsServiceTier: z20.boolean(),
3579
- supportsNativeUserQuestion: z20.boolean(),
3580
- supportsFork: z20.boolean(),
3581
- supportsSessionRewind: z20.boolean(),
3582
- permissionModes: z20.array(permissionModeSchema).min(1),
3308
+ isDefault: z19.boolean()
3309
+ });
3310
+ var providerModelCatalogScopeSchema = z19.enum(["host", "workspace"]);
3311
+ var providerCapabilitiesSchema = z19.object({
3312
+ supportsThreadArchive: z19.boolean(),
3313
+ supportsThreadRename: z19.boolean(),
3314
+ supportsServiceTier: z19.boolean(),
3315
+ supportsNativeUserQuestion: z19.boolean(),
3316
+ supportsFork: z19.boolean(),
3317
+ supportsSessionRewind: z19.boolean(),
3318
+ permissionModes: z19.array(permissionModeSchema).min(1),
3583
3319
  modelCatalogScope: providerModelCatalogScopeSchema
3584
3320
  });
3585
- var providerComposerCommandSchema = z20.object({
3321
+ var providerComposerCommandSchema = z19.object({
3586
3322
  trigger: promptMentionCommandTriggerSchema,
3587
- name: z20.string().min(1).regex(/^[^\s/$]+$/u),
3588
- trailingText: z20.string().regex(/^\s*$/u)
3323
+ name: z19.string().min(1).regex(/^[^\s/$]+$/u),
3324
+ trailingText: z19.string().regex(/^\s*$/u)
3589
3325
  });
3590
- var providerComposerActionSchema = z20.discriminatedUnion("kind", [
3591
- z20.object({
3592
- kind: z20.literal("skills"),
3326
+ var providerComposerActionSchema = z19.discriminatedUnion("kind", [
3327
+ z19.object({
3328
+ kind: z19.literal("skills"),
3593
3329
  trigger: promptMentionCommandTriggerSchema
3594
3330
  }),
3595
- z20.object({
3596
- kind: z20.literal("plan"),
3331
+ z19.object({
3332
+ kind: z19.literal("plan"),
3597
3333
  command: providerComposerCommandSchema
3598
3334
  }),
3599
- z20.object({
3600
- kind: z20.literal("goal"),
3335
+ z19.object({
3336
+ kind: z19.literal("goal"),
3601
3337
  command: providerComposerCommandSchema
3602
3338
  })
3603
3339
  ]);
3604
- var providerStringsSchema = z20.object({
3605
- signInHint: z20.string().min(1),
3606
- expiredHint: z20.string().min(1),
3607
- installUrl: z20.string().min(1),
3608
- brandPrefix: z20.string().min(1).optional(),
3609
- planModeCopy: z20.string().min(1).optional(),
3610
- iconTint: z20.object({ light: z20.string().min(1), dark: z20.string().min(1) }).optional()
3611
- });
3612
- var providerOptionDescriptorSchema = z20.object({
3613
- id: z20.string().min(1),
3614
- label: z20.string().min(1),
3615
- description: z20.string().min(1).optional()
3616
- });
3617
- var providerExtensionKindInfoSchema = z20.object({
3618
- item: z20.boolean(),
3619
- state: z20.boolean()
3620
- });
3621
- var providerExtensionKindsSchema = z20.record(
3340
+ var providerStringsSchema = z19.object({
3341
+ signInHint: z19.string().min(1),
3342
+ expiredHint: z19.string().min(1),
3343
+ installUrl: z19.string().min(1),
3344
+ brandPrefix: z19.string().min(1).optional(),
3345
+ planModeCopy: z19.string().min(1).optional(),
3346
+ iconTint: z19.object({ light: z19.string().min(1), dark: z19.string().min(1) }).optional()
3347
+ });
3348
+ var providerOptionDescriptorSchema = z19.object({
3349
+ id: z19.string().min(1),
3350
+ label: z19.string().min(1),
3351
+ description: z19.string().min(1).optional()
3352
+ });
3353
+ var providerExtensionKindInfoSchema = z19.object({
3354
+ item: z19.boolean(),
3355
+ state: z19.boolean()
3356
+ });
3357
+ var providerExtensionKindsSchema = z19.record(
3622
3358
  extensionKindSchema,
3623
3359
  providerExtensionKindInfoSchema
3624
3360
  );
3625
- var providerInfoSchema = z20.object({
3626
- id: z20.string(),
3627
- pluginId: z20.string().min(1),
3628
- displayName: z20.string(),
3629
- family: z20.string().min(1).optional(),
3630
- icon: z20.object({ glyph: z20.string().min(1) }).optional(),
3631
- logoUrl: z20.string().min(1).nullable(),
3632
- maintenance: z20.object({
3633
- health: z20.boolean(),
3634
- usage: z20.boolean(),
3635
- installation: z20.boolean()
3361
+ var providerInfoSchema = z19.object({
3362
+ id: z19.string(),
3363
+ pluginId: z19.string().min(1),
3364
+ displayName: z19.string(),
3365
+ family: z19.string().min(1).optional(),
3366
+ icon: z19.object({ glyph: z19.string().min(1) }).optional(),
3367
+ logoUrl: z19.string().min(1).nullable(),
3368
+ maintenance: z19.object({
3369
+ health: z19.boolean(),
3370
+ usage: z19.boolean(),
3371
+ installation: z19.boolean()
3636
3372
  }),
3637
3373
  capabilities: providerCapabilitiesSchema,
3638
- composerActions: z20.array(providerComposerActionSchema),
3639
- available: z20.boolean(),
3374
+ composerActions: z19.array(providerComposerActionSchema),
3375
+ available: z19.boolean(),
3640
3376
  strings: providerStringsSchema.optional(),
3641
- serviceTiers: z20.array(providerOptionDescriptorSchema).optional(),
3642
- reasoningLevels: z20.array(providerOptionDescriptorSchema).optional(),
3377
+ serviceTiers: z19.array(providerOptionDescriptorSchema).optional(),
3378
+ reasoningLevels: z19.array(providerOptionDescriptorSchema).optional(),
3643
3379
  extensionKinds: providerExtensionKindsSchema.optional()
3644
3380
  });
3645
3381
  var providerRecoveryKindValues = [
@@ -3649,34 +3385,34 @@ var providerRecoveryKindValues = [
3649
3385
  "staleTurn",
3650
3386
  "rateLimited"
3651
3387
  ];
3652
- var providerRecoveryKindSchema = z20.enum(providerRecoveryKindValues);
3653
- var toolCallOutputItemSchema = z20.discriminatedUnion("type", [
3654
- z20.object({
3655
- type: z20.literal("inputText"),
3656
- text: z20.string()
3388
+ var providerRecoveryKindSchema = z19.enum(providerRecoveryKindValues);
3389
+ var toolCallOutputItemSchema = z19.discriminatedUnion("type", [
3390
+ z19.object({
3391
+ type: z19.literal("inputText"),
3392
+ text: z19.string()
3657
3393
  }),
3658
- z20.object({
3659
- type: z20.literal("inputImage"),
3660
- imageUrl: z20.string()
3394
+ z19.object({
3395
+ type: z19.literal("inputImage"),
3396
+ imageUrl: z19.string()
3661
3397
  })
3662
3398
  ]);
3663
- var toolCallRequestSchema = z20.object({
3664
- requestId: z20.union([z20.string().min(1), z20.number()]),
3665
- threadId: z20.string().min(1),
3666
- providerThreadId: z20.string().min(1),
3667
- turnId: z20.string().min(1),
3668
- callId: z20.string().min(1),
3669
- tool: z20.string().min(1),
3670
- arguments: z20.unknown().optional()
3671
- });
3672
- var toolCallResponseSchema = z20.object({
3673
- contentItems: z20.array(toolCallOutputItemSchema),
3674
- success: z20.boolean()
3675
- });
3676
- var dynamicToolSchema = z20.object({
3677
- name: z20.string(),
3678
- description: z20.string(),
3679
- inputSchema: z20.unknown(),
3399
+ var toolCallRequestSchema = z19.object({
3400
+ requestId: z19.union([z19.string().min(1), z19.number()]),
3401
+ threadId: z19.string().min(1),
3402
+ providerThreadId: z19.string().min(1),
3403
+ turnId: z19.string().min(1),
3404
+ callId: z19.string().min(1),
3405
+ tool: z19.string().min(1),
3406
+ arguments: z19.unknown().optional()
3407
+ });
3408
+ var toolCallResponseSchema = z19.object({
3409
+ contentItems: z19.array(toolCallOutputItemSchema),
3410
+ success: z19.boolean()
3411
+ });
3412
+ var dynamicToolSchema = z19.object({
3413
+ name: z19.string(),
3414
+ description: z19.string(),
3415
+ inputSchema: z19.unknown(),
3680
3416
  presentation: threadEventItemPresentationSchema.optional()
3681
3417
  });
3682
3418
 
@@ -3727,6 +3463,278 @@ function reasoningEffortsForLevels(levels) {
3727
3463
  return levels.map((level) => ({ ...REASONING_EFFORT_BY_LEVEL[level] }));
3728
3464
  }
3729
3465
 
3466
+ // ../provider-bridge-protocol/src/bridge-requests.ts
3467
+ import { z as z20 } from "zod";
3468
+ var BRIDGE_INBOUND_REQUEST_METHODS = {
3469
+ toolCall: "item/tool/call",
3470
+ interactionRequest: "interaction/request"
3471
+ };
3472
+ var toolCallRequestParamsSchema = z20.object({
3473
+ providerThreadId: z20.string().min(1),
3474
+ threadId: z20.string().min(1).optional(),
3475
+ turnId: z20.union([z20.string().min(1), z20.null()]),
3476
+ callId: z20.string().min(1),
3477
+ tool: z20.string().min(1),
3478
+ arguments: z20.unknown(),
3479
+ providerNativeIds: z20.boolean().optional()
3480
+ }).passthrough();
3481
+ var toolCallResultSchema = z20.object({
3482
+ success: z20.boolean(),
3483
+ contentItems: z20.array(
3484
+ z20.discriminatedUnion("type", [
3485
+ z20.object({ type: z20.literal("inputText"), text: z20.string() }),
3486
+ z20.object({
3487
+ type: z20.literal("inputImage"),
3488
+ imageUrl: z20.string().min(1)
3489
+ })
3490
+ ])
3491
+ )
3492
+ }).passthrough();
3493
+ var interactionRequestParamsSchema = z20.object({
3494
+ providerThreadId: z20.string().min(1),
3495
+ threadId: z20.string().min(1).optional(),
3496
+ turnId: z20.union([z20.string().min(1), z20.null()]),
3497
+ payload: pendingInteractionPayloadSchema,
3498
+ providerNativeIds: z20.boolean().optional()
3499
+ }).passthrough();
3500
+
3501
+ // ../provider-bridge-protocol/src/bridge-kit/bridge-tool-calls.ts
3502
+ var bridgeRequestEnvelopeSchema = z21.object({
3503
+ jsonrpc: z21.literal("2.0"),
3504
+ id: z21.union([z21.string(), z21.number()]),
3505
+ method: z21.string(),
3506
+ params: z21.record(z21.string(), z21.unknown()).optional()
3507
+ });
3508
+ var jsonRpcErrorSchema = z21.object({
3509
+ code: z21.number(),
3510
+ message: z21.string().optional(),
3511
+ data: z21.unknown().optional()
3512
+ });
3513
+ var jsonRpcSuccessResponseSchema = z21.object({
3514
+ jsonrpc: z21.literal("2.0"),
3515
+ id: z21.union([z21.string(), z21.number()]),
3516
+ result: z21.unknown()
3517
+ });
3518
+ var jsonRpcErrorResponseSchema = z21.object({
3519
+ jsonrpc: z21.literal("2.0"),
3520
+ id: z21.union([z21.string(), z21.number()]),
3521
+ error: jsonRpcErrorSchema
3522
+ });
3523
+ function isJsonRpcRequest(input) {
3524
+ return typeof input === "object" && input !== null && "method" in input && input.method !== void 0;
3525
+ }
3526
+ function decodeBridgeJsonRpcResponse(input) {
3527
+ if (isJsonRpcRequest(input)) return null;
3528
+ const error = jsonRpcErrorResponseSchema.safeParse(input);
3529
+ if (error.success) return error.data;
3530
+ const success = jsonRpcSuccessResponseSchema.safeParse(input);
3531
+ return success.success ? success.data : null;
3532
+ }
3533
+ var IMAGE_DATA_URL = /^data:(.+);base64,(.+)$/s;
3534
+ function decodeImageDataUrl(imageUrl) {
3535
+ const match = IMAGE_DATA_URL.exec(imageUrl);
3536
+ if (match === null) {
3537
+ return null;
3538
+ }
3539
+ const [, mimeType, data] = match;
3540
+ if (data.length === 0) {
3541
+ return null;
3542
+ }
3543
+ return { data, mimeType };
3544
+ }
3545
+ function decodeToolCallResponsePayload(result) {
3546
+ const parsed = toolCallResultSchema.safeParse(result);
3547
+ if (!parsed.success) {
3548
+ return {
3549
+ content: "Invalid tool call response",
3550
+ contentBlocks: [{ type: "text", text: "Invalid tool call response" }],
3551
+ images: [],
3552
+ isError: true
3553
+ };
3554
+ }
3555
+ const texts = [];
3556
+ const contentBlocks = [];
3557
+ const images = [];
3558
+ for (const item of parsed.data.contentItems) {
3559
+ if (item.type === "inputText") {
3560
+ texts.push(item.text);
3561
+ if (item.text !== "") {
3562
+ contentBlocks.push({ type: "text", text: item.text });
3563
+ }
3564
+ continue;
3565
+ }
3566
+ const image = decodeImageDataUrl(item.imageUrl);
3567
+ if (image === null) {
3568
+ texts.push(item.imageUrl);
3569
+ contentBlocks.push({ type: "text", text: item.imageUrl });
3570
+ continue;
3571
+ }
3572
+ images.push(image);
3573
+ contentBlocks.push({ type: "image", ...image });
3574
+ }
3575
+ const text = texts.join("\n");
3576
+ const isError = !parsed.data.success;
3577
+ if (contentBlocks.length === 0) {
3578
+ const fallback = isError ? "Tool call failed" : "OK";
3579
+ return {
3580
+ content: fallback,
3581
+ contentBlocks: [{ type: "text", text: fallback }],
3582
+ images,
3583
+ isError
3584
+ };
3585
+ }
3586
+ return {
3587
+ content: text,
3588
+ contentBlocks,
3589
+ images,
3590
+ isError
3591
+ };
3592
+ }
3593
+ function buildBridgeToolCallContent(result) {
3594
+ if (result.contentBlocks !== void 0) {
3595
+ return result.contentBlocks;
3596
+ }
3597
+ const blocks = [];
3598
+ if (result.content !== "") {
3599
+ blocks.push({ type: "text", text: result.content });
3600
+ }
3601
+ for (const image of result.images ?? []) {
3602
+ blocks.push({ type: "image", data: image.data, mimeType: image.mimeType });
3603
+ }
3604
+ return blocks;
3605
+ }
3606
+
3607
+ // ../provider-bridge-protocol/src/bridge-kit/json-rpc-envelope.ts
3608
+ import { z as z22 } from "zod";
3609
+ var recordSchema = z22.record(z22.string(), z22.unknown());
3610
+ var jsonRpcEnvelopeSchema = z22.object({
3611
+ jsonrpc: z22.literal("2.0"),
3612
+ method: z22.string(),
3613
+ params: recordSchema.optional()
3614
+ }).passthrough();
3615
+ var sdkMessageEnvelopeSchema = z22.object({
3616
+ jsonrpc: z22.literal("2.0"),
3617
+ method: z22.literal("sdk/message"),
3618
+ params: z22.object({
3619
+ message: z22.unknown(),
3620
+ threadId: z22.string().optional(),
3621
+ parent_tool_use_id: z22.string().optional()
3622
+ }).passthrough()
3623
+ }).passthrough();
3624
+ var threadIdentityEnvelopeSchema = z22.object({
3625
+ jsonrpc: z22.literal("2.0"),
3626
+ method: z22.literal("thread/identity"),
3627
+ params: z22.object({
3628
+ threadId: z22.string().optional(),
3629
+ providerThreadId: z22.string().optional()
3630
+ }).passthrough()
3631
+ }).passthrough();
3632
+ var threadContextWindowUsageEnvelopeSchema = z22.object({
3633
+ jsonrpc: z22.literal("2.0"),
3634
+ method: z22.literal("thread/contextWindowUsage/updated"),
3635
+ params: z22.object({
3636
+ threadId: z22.string().optional(),
3637
+ contextWindowUsage: z22.object({
3638
+ usedTokens: z22.number().nullable(),
3639
+ modelContextWindow: z22.number().nullable(),
3640
+ estimated: z22.boolean()
3641
+ })
3642
+ }).passthrough()
3643
+ }).passthrough();
3644
+ var errorEnvelopeSchema = z22.object({
3645
+ jsonrpc: z22.literal("2.0"),
3646
+ method: z22.literal("error"),
3647
+ params: z22.object({
3648
+ message: z22.string().optional()
3649
+ }).passthrough().optional()
3650
+ }).passthrough();
3651
+
3652
+ // ../provider-bridge-protocol/src/bridge-kit/mime-types.ts
3653
+ import { extname } from "node:path";
3654
+ function mimeTypeFromExtension(filePath) {
3655
+ switch (extname(filePath).toLowerCase()) {
3656
+ case ".png":
3657
+ return "image/png";
3658
+ case ".jpg":
3659
+ case ".jpeg":
3660
+ return "image/jpeg";
3661
+ case ".gif":
3662
+ return "image/gif";
3663
+ case ".webp":
3664
+ return "image/webp";
3665
+ case ".svg":
3666
+ return "image/svg+xml";
3667
+ default:
3668
+ return "image/png";
3669
+ }
3670
+ }
3671
+
3672
+ // ../provider-bridge-protocol/src/bridge-kit/pending-tool-call-tracker.ts
3673
+ function createPendingToolCallTracker(options) {
3674
+ const pendingToolCalls = /* @__PURE__ */ new Map();
3675
+ let requestIdCounter = 0;
3676
+ return {
3677
+ forwardToolCall: (args) => {
3678
+ return new Promise((resolve2) => {
3679
+ requestIdCounter += 1;
3680
+ const requestId = requestIdCounter;
3681
+ pendingToolCalls.set(requestId, { resolve: resolve2, scope: args.scope });
3682
+ try {
3683
+ options.sendToolCall({
3684
+ jsonrpc: "2.0",
3685
+ id: requestId,
3686
+ method: "item/tool/call",
3687
+ params: {
3688
+ threadId: args.threadId,
3689
+ providerThreadId: args.providerThreadId,
3690
+ turnId: null,
3691
+ callId: `call-${requestId}`,
3692
+ tool: args.toolName,
3693
+ arguments: args.arguments
3694
+ }
3695
+ });
3696
+ } catch (error) {
3697
+ pendingToolCalls.delete(requestId);
3698
+ resolve2({
3699
+ content: error instanceof Error ? error.message : String(error),
3700
+ isError: true
3701
+ });
3702
+ }
3703
+ });
3704
+ },
3705
+ handleToolCallResponse: (response) => {
3706
+ const pending = pendingToolCalls.get(response.id);
3707
+ if (!pending) {
3708
+ return false;
3709
+ }
3710
+ pendingToolCalls.delete(response.id);
3711
+ if ("error" in response) {
3712
+ pending.resolve({
3713
+ content: response.error.message ?? "Tool call failed",
3714
+ isError: true
3715
+ });
3716
+ } else {
3717
+ pending.resolve(decodeToolCallResponsePayload(response.result));
3718
+ }
3719
+ return true;
3720
+ },
3721
+ resolvePendingToolCalls: (scope, message) => {
3722
+ for (const [requestId, pending] of pendingToolCalls) {
3723
+ if (pending.scope !== scope) {
3724
+ continue;
3725
+ }
3726
+ pendingToolCalls.delete(requestId);
3727
+ pending.resolve({ content: message, isError: true });
3728
+ }
3729
+ }
3730
+ };
3731
+ }
3732
+
3733
+ // ../provider-bridge-protocol/src/bridge-kit/permission-policy.ts
3734
+ function shouldAutoDenyInteractiveRequest(policy) {
3735
+ return policy.permissionEscalation === "deny";
3736
+ }
3737
+
3730
3738
  // ../provider-bridge-protocol/src/bridge-kit/presentation.ts
3731
3739
  var PRESENTATION_TITLE_MAX_LENGTH = 160;
3732
3740
  function presentationTitle(text) {
@@ -3823,7 +3831,7 @@ import { constants as fsConstants } from "node:fs";
3823
3831
  import { access } from "node:fs/promises";
3824
3832
  import path from "node:path";
3825
3833
  import { promisify } from "node:util";
3826
- import { z as z21 } from "zod";
3834
+ import { z as z23 } from "zod";
3827
3835
  var execFileAsync = promisify(execFile);
3828
3836
  var CLI_PROBE_TIMEOUT_MS = 5e3;
3829
3837
  var INSTALLATION_CHECK_TIMEOUT_MS = 15e3;
@@ -3928,8 +3936,8 @@ function firstLine(value) {
3928
3936
  function npmGlobalPackageVersion(value, npmPackage) {
3929
3937
  if (value === null) return null;
3930
3938
  try {
3931
- const parsed = z21.object({
3932
- dependencies: z21.record(z21.string(), z21.object({ version: z21.string().min(1) })).default({})
3939
+ const parsed = z23.object({
3940
+ dependencies: z23.record(z23.string(), z23.object({ version: z23.string().min(1) })).default({})
3933
3941
  }).safeParse(JSON.parse(value));
3934
3942
  return parsed.success ? parsed.data.dependencies[npmPackage]?.version ?? null : null;
3935
3943
  } catch {
@@ -3965,18 +3973,6 @@ function clampPercent(value) {
3965
3973
  );
3966
3974
  }
3967
3975
 
3968
- // ../provider-bridge-protocol/src/bridge-kit/provider-tool-call-contract.ts
3969
- import { z as z22 } from "zod";
3970
- var normalizedToolCallRequestSchema = z22.object({
3971
- providerThreadId: z22.string().min(1),
3972
- threadId: z22.string().min(1).optional(),
3973
- turnId: z22.union([z22.string().min(1), z22.null()]),
3974
- callId: z22.string().min(1),
3975
- tool: z22.string().min(1),
3976
- arguments: z22.unknown(),
3977
- providerNativeIds: z22.boolean().optional()
3978
- });
3979
-
3980
3976
  // ../provider-bridge-protocol/src/bridge-kit/provider-visibility.ts
3981
3977
  function createProviderVisibilityMetadata(args) {
3982
3978
  return {
@@ -3989,10 +3985,10 @@ function createProviderVisibilityMetadata(args) {
3989
3985
  }
3990
3986
 
3991
3987
  // ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
3992
- import { z as z24 } from "zod";
3988
+ import { z as z25 } from "zod";
3993
3989
 
3994
3990
  // ../provider-bridge-protocol/src/errors.ts
3995
- import { z as z23 } from "zod";
3991
+ import { z as z24 } from "zod";
3996
3992
  var BRIDGE_JSON_RPC_ERRORS = {
3997
3993
  INVALID_PARAMS: -32602,
3998
3994
  METHOD_NOT_FOUND: -32601,
@@ -4001,12 +3997,12 @@ var BRIDGE_JSON_RPC_ERRORS = {
4001
3997
  SESSION_NOT_RESTORABLE: -32002,
4002
3998
  FORK_CHECKPOINT_UNSUPPORTED: -32003
4003
3999
  };
4004
- var providerRecoveryHintSchema = z23.object({
4000
+ var providerRecoveryHintSchema = z24.object({
4005
4001
  kind: providerRecoveryKindSchema,
4006
- message: z23.string().min(1),
4007
- retryable: z23.boolean()
4002
+ message: z24.string().min(1),
4003
+ retryable: z24.boolean()
4008
4004
  });
4009
- var bridgeErrorDataSchema = z23.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
4005
+ var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
4010
4006
 
4011
4007
  // ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
4012
4008
  var JSON_RPC_INVALID_PARAMS_CODE = -32602;
@@ -4024,7 +4020,7 @@ var ProviderResponseEncodeError = class extends Error {
4024
4020
  this.name = "ProviderResponseEncodeError";
4025
4021
  }
4026
4022
  };
4027
- var ignoredJsonRpcResultSchema = z24.unknown();
4023
+ var ignoredJsonRpcResultSchema = z25.unknown();
4028
4024
 
4029
4025
  // ../provider-bridge-protocol/src/version.ts
4030
4026
  var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
@@ -4032,66 +4028,66 @@ var THREAD_DELTA_GRAMMAR_V2 = PROVIDER_BRIDGE_PROTOCOL_VERSION;
4032
4028
  var THREAD_DELTA_GRAMMAR_V3 = 3;
4033
4029
 
4034
4030
  // ../provider-bridge-protocol/src/handshake.ts
4035
- import { z as z25 } from "zod";
4036
- var bridgeGrammarVersionsSchema = z25.tuple([z25.number().int().positive(), z25.number().int().positive()]).refine(([min, max]) => min <= max, {
4031
+ import { z as z26 } from "zod";
4032
+ var bridgeGrammarVersionsSchema = z26.tuple([z26.number().int().positive(), z26.number().int().positive()]).refine(([min, max]) => min <= max, {
4037
4033
  message: "grammarVersions must be an ascending [min, max] range"
4038
4034
  });
4039
- var bridgeSteerModeSchema = z25.enum(["inject", "queue"]);
4040
- var bridgeCapabilitiesSchema = z25.object({
4041
- sessionRestore: z25.boolean().default(false),
4042
- threadArchive: z25.boolean().default(false),
4043
- threadRename: z25.boolean().default(false),
4044
- threadGoalClear: z25.boolean().default(false),
4035
+ var bridgeSteerModeSchema = z26.enum(["inject", "queue"]);
4036
+ var bridgeCapabilitiesSchema = z26.object({
4037
+ sessionRestore: z26.boolean().default(false),
4038
+ threadArchive: z26.boolean().default(false),
4039
+ threadRename: z26.boolean().default(false),
4040
+ threadGoalClear: z26.boolean().default(false),
4045
4041
  fork: providerForkSchema.default("none"),
4046
- approvalEnforcedBy: z25.enum(["runtime", "provider"]).default("runtime"),
4042
+ approvalEnforcedBy: z26.enum(["runtime", "provider"]).default("runtime"),
4047
4043
  grammarVersions: bridgeGrammarVersionsSchema.default([
4048
4044
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
4049
4045
  PROVIDER_BRIDGE_PROTOCOL_VERSION
4050
4046
  ]),
4051
4047
  steerMode: bridgeSteerModeSchema.default("queue"),
4052
- skills: z25.object({ configure: z25.boolean().default(false) }).default({ configure: false })
4048
+ skills: z26.object({ configure: z26.boolean().default(false) }).default({ configure: false })
4053
4049
  }).passthrough();
4054
- var initializeParamsSchema = z25.object({
4055
- protocolVersion: z25.number().int().positive(),
4056
- client: z25.object({ name: z25.string().min(1), version: z25.string().min(1) }),
4050
+ var initializeParamsSchema = z26.object({
4051
+ protocolVersion: z26.number().int().positive(),
4052
+ client: z26.object({ name: z26.string().min(1), version: z26.string().min(1) }),
4057
4053
  grammarVersions: bridgeGrammarVersionsSchema.default([
4058
4054
  PROVIDER_BRIDGE_PROTOCOL_VERSION,
4059
4055
  PROVIDER_BRIDGE_PROTOCOL_VERSION
4060
4056
  ])
4061
4057
  }).passthrough();
4062
- var initializeResultSchema = z25.object({
4063
- protocolVersion: z25.number().int().positive(),
4064
- capabilities: z25.preprocess(
4058
+ var initializeResultSchema = z26.object({
4059
+ protocolVersion: z26.number().int().positive(),
4060
+ capabilities: z26.preprocess(
4065
4061
  (value) => value ?? {},
4066
4062
  bridgeCapabilitiesSchema
4067
4063
  )
4068
4064
  }).passthrough();
4069
4065
 
4070
4066
  // ../provider-bridge-protocol/src/execution-options.ts
4071
- import { z as z26 } from "zod";
4072
- var bridgeExecutionOptionsSchema = z26.object({
4073
- model: z26.string().min(1).optional(),
4067
+ import { z as z27 } from "zod";
4068
+ var bridgeExecutionOptionsSchema = z27.object({
4069
+ model: z27.string().min(1).optional(),
4074
4070
  serviceTier: serviceTierSchema.optional(),
4075
4071
  reasoningLevel: reasoningLevelSchema.optional(),
4076
4072
  promptMode: promptModeSchema.optional(),
4077
- instructions: z26.string().optional(),
4078
- envVars: z26.record(z26.string(), z26.string()).optional(),
4079
- providerOptions: z26.record(z26.string(), z26.unknown()).optional()
4073
+ instructions: z27.string().optional(),
4074
+ envVars: z27.record(z27.string(), z27.string()).optional(),
4075
+ providerOptions: z27.record(z27.string(), z27.unknown()).optional()
4080
4076
  }).and(runtimePermissionPolicySchema);
4081
4077
 
4082
4078
  // ../provider-bridge-protocol/src/provider-maintenance.ts
4083
- import { z as z27 } from "zod";
4084
- var providerMaintenanceParamsSchema = z27.object({
4085
- providerId: z27.string().min(1),
4086
- cwd: z27.string().min(1).optional(),
4087
- providerOptions: z27.record(z27.string(), z27.unknown()).optional()
4079
+ import { z as z28 } from "zod";
4080
+ var providerMaintenanceParamsSchema = z28.object({
4081
+ providerId: z28.string().min(1),
4082
+ cwd: z28.string().min(1).optional(),
4083
+ providerOptions: z28.record(z28.string(), z28.unknown()).optional()
4088
4084
  }).passthrough();
4089
- var providerInstallationRequirementSchema = z27.enum(["thread_rewind"]);
4085
+ var providerInstallationRequirementSchema = z28.enum(["thread_rewind"]);
4090
4086
  var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
4091
4087
  requirement: providerInstallationRequirementSchema.optional()
4092
4088
  });
4093
- var providerHealthSchema = z27.object({
4094
- status: z27.enum([
4089
+ var providerHealthSchema = z28.object({
4090
+ status: z28.enum([
4095
4091
  "ready",
4096
4092
  "not_installed",
4097
4093
  "unauthenticated",
@@ -4099,114 +4095,114 @@ var providerHealthSchema = z27.object({
4099
4095
  "unsupported_version",
4100
4096
  "unknown"
4101
4097
  ]),
4102
- statusMessage: z27.string().min(1).nullable(),
4103
- accountEmail: z27.string().nullable(),
4104
- planLabel: z27.string().min(1).nullable(),
4105
- installedVersion: z27.string().min(1).nullable(),
4106
- minimumSupportedVersion: z27.string().min(1).nullable(),
4107
- canInstall: z27.boolean(),
4108
- canUpdate: z27.boolean(),
4109
- loginCommand: z27.string().min(1).nullable()
4098
+ statusMessage: z28.string().min(1).nullable(),
4099
+ accountEmail: z28.string().nullable(),
4100
+ planLabel: z28.string().min(1).nullable(),
4101
+ installedVersion: z28.string().min(1).nullable(),
4102
+ minimumSupportedVersion: z28.string().min(1).nullable(),
4103
+ canInstall: z28.boolean(),
4104
+ canUpdate: z28.boolean(),
4105
+ loginCommand: z28.string().min(1).nullable()
4110
4106
  }).passthrough();
4111
- var providerUsageWindowSchema = z27.object({
4112
- label: z27.string().min(1),
4113
- usedPercent: z27.number().min(0).max(100),
4114
- resetsAt: z27.string().min(1).nullable(),
4115
- cost: z27.object({
4116
- usedUsdCents: z27.number().int().nonnegative(),
4117
- limitUsdCents: z27.number().int().positive()
4107
+ var providerUsageWindowSchema = z28.object({
4108
+ label: z28.string().min(1),
4109
+ usedPercent: z28.number().min(0).max(100),
4110
+ resetsAt: z28.string().min(1).nullable(),
4111
+ cost: z28.object({
4112
+ usedUsdCents: z28.number().int().nonnegative(),
4113
+ limitUsdCents: z28.number().int().positive()
4118
4114
  }).optional()
4119
4115
  }).passthrough();
4120
- var providerUsageSchema = z27.discriminatedUnion("status", [
4121
- z27.object({
4122
- status: z27.literal("ok"),
4123
- accountEmail: z27.string().email().nullable(),
4124
- planLabel: z27.string().min(1).nullable(),
4125
- windows: z27.array(providerUsageWindowSchema)
4116
+ var providerUsageSchema = z28.discriminatedUnion("status", [
4117
+ z28.object({
4118
+ status: z28.literal("ok"),
4119
+ accountEmail: z28.string().email().nullable(),
4120
+ planLabel: z28.string().min(1).nullable(),
4121
+ windows: z28.array(providerUsageWindowSchema)
4126
4122
  }).passthrough(),
4127
- z27.object({ status: z27.literal("not_installed") }).passthrough(),
4128
- z27.object({ status: z27.literal("unauthenticated") }).passthrough(),
4129
- z27.object({ status: z27.literal("expired") }).passthrough(),
4130
- z27.object({
4131
- status: z27.literal("error"),
4132
- message: z27.string().min(1),
4133
- planLabel: z27.string().min(1).nullable().default(null),
4134
- accountEmail: z27.string().nullable().default(null)
4123
+ z28.object({ status: z28.literal("not_installed") }).passthrough(),
4124
+ z28.object({ status: z28.literal("unauthenticated") }).passthrough(),
4125
+ z28.object({ status: z28.literal("expired") }).passthrough(),
4126
+ z28.object({
4127
+ status: z28.literal("error"),
4128
+ message: z28.string().min(1),
4129
+ planLabel: z28.string().min(1).nullable().default(null),
4130
+ accountEmail: z28.string().nullable().default(null)
4135
4131
  }).passthrough()
4136
4132
  ]);
4137
- var providerHealthResultSchema = z27.discriminatedUnion("supported", [
4138
- z27.object({ supported: z27.literal(false) }).passthrough(),
4139
- z27.object({
4140
- supported: z27.literal(true),
4133
+ var providerHealthResultSchema = z28.discriminatedUnion("supported", [
4134
+ z28.object({ supported: z28.literal(false) }).passthrough(),
4135
+ z28.object({
4136
+ supported: z28.literal(true),
4141
4137
  health: providerHealthSchema
4142
4138
  }).passthrough()
4143
4139
  ]);
4144
- var providerUsageResultSchema = z27.discriminatedUnion("supported", [
4145
- z27.object({ supported: z27.literal(false) }).passthrough(),
4146
- z27.object({
4147
- supported: z27.literal(true),
4140
+ var providerUsageResultSchema = z28.discriminatedUnion("supported", [
4141
+ z28.object({ supported: z28.literal(false) }).passthrough(),
4142
+ z28.object({
4143
+ supported: z28.literal(true),
4148
4144
  usage: providerUsageSchema
4149
4145
  }).passthrough()
4150
4146
  ]);
4151
- var providerInstallationActionKindSchema = z27.enum([
4147
+ var providerInstallationActionKindSchema = z28.enum([
4152
4148
  "install",
4153
4149
  "update"
4154
4150
  ]);
4155
- var providerInstallationActionSchema = z27.object({
4151
+ var providerInstallationActionSchema = z28.object({
4156
4152
  kind: providerInstallationActionKindSchema,
4157
- label: z27.enum(["Install", "Update"]),
4158
- command: z27.string().min(1)
4153
+ label: z28.enum(["Install", "Update"]),
4154
+ command: z28.string().min(1)
4159
4155
  }).passthrough();
4160
- var providerInstallationSourceSchema = z27.enum([
4156
+ var providerInstallationSourceSchema = z28.enum([
4161
4157
  "notInstalled",
4162
4158
  "npmGlobal",
4163
4159
  "external"
4164
4160
  ]);
4165
- var providerInstallationStatusSchema = z27.object({
4166
- executableName: z27.string().min(1),
4167
- executablePath: z27.string().min(1).nullable(),
4168
- installed: z27.boolean(),
4161
+ var providerInstallationStatusSchema = z28.object({
4162
+ executableName: z28.string().min(1),
4163
+ executablePath: z28.string().min(1).nullable(),
4164
+ installed: z28.boolean(),
4169
4165
  installSource: providerInstallationSourceSchema,
4170
- currentVersion: z27.string().min(1).nullable(),
4171
- latestVersion: z27.string().min(1).nullable(),
4172
- minimumSupportedVersion: z27.string().min(1).nullable(),
4173
- npmPackageName: z27.string().min(1).nullable(),
4174
- npmGlobalPackageVersion: z27.string().min(1).nullable(),
4166
+ currentVersion: z28.string().min(1).nullable(),
4167
+ latestVersion: z28.string().min(1).nullable(),
4168
+ minimumSupportedVersion: z28.string().min(1).nullable(),
4169
+ npmPackageName: z28.string().min(1).nullable(),
4170
+ npmGlobalPackageVersion: z28.string().min(1).nullable(),
4175
4171
  installAction: providerInstallationActionSchema.nullable(),
4176
- needsUpdate: z27.boolean(),
4177
- versionUnsupported: z27.boolean()
4172
+ needsUpdate: z28.boolean(),
4173
+ versionUnsupported: z28.boolean()
4178
4174
  }).passthrough();
4179
4175
  var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
4180
4176
  action: providerInstallationActionKindSchema
4181
4177
  });
4182
- var providerInstallationCommandSchema = z27.object({
4183
- command: z27.string().min(1),
4184
- args: z27.array(z27.string()).max(64),
4185
- displayCommand: z27.string().min(1)
4178
+ var providerInstallationCommandSchema = z28.object({
4179
+ command: z28.string().min(1),
4180
+ args: z28.array(z28.string()).max(64),
4181
+ displayCommand: z28.string().min(1)
4186
4182
  }).passthrough();
4187
- var providerInstallationVerificationSchema = z27.discriminatedUnion(
4183
+ var providerInstallationVerificationSchema = z28.discriminatedUnion(
4188
4184
  "kind",
4189
4185
  [
4190
- z27.object({ kind: z27.literal("installed") }).passthrough(),
4191
- z27.object({
4192
- kind: z27.literal("version_changed"),
4193
- previousVersion: z27.string().min(1)
4186
+ z28.object({ kind: z28.literal("installed") }).passthrough(),
4187
+ z28.object({
4188
+ kind: z28.literal("version_changed"),
4189
+ previousVersion: z28.string().min(1)
4194
4190
  }).passthrough(),
4195
- z27.object({
4196
- kind: z27.literal("version_at_least"),
4197
- version: z27.string().min(1)
4191
+ z28.object({
4192
+ kind: z28.literal("version_at_least"),
4193
+ version: z28.string().min(1)
4198
4194
  }).passthrough()
4199
4195
  ]
4200
4196
  );
4201
- var providerInstallationRunResultSchema = z27.discriminatedUnion(
4197
+ var providerInstallationRunResultSchema = z28.discriminatedUnion(
4202
4198
  "available",
4203
4199
  [
4204
- z27.object({
4205
- available: z27.literal(false),
4206
- message: z27.string().min(1)
4200
+ z28.object({
4201
+ available: z28.literal(false),
4202
+ message: z28.string().min(1)
4207
4203
  }).passthrough(),
4208
- z27.object({
4209
- available: z27.literal(true),
4204
+ z28.object({
4205
+ available: z28.literal(true),
4210
4206
  command: providerInstallationCommandSchema,
4211
4207
  verification: providerInstallationVerificationSchema
4212
4208
  }).passthrough()
@@ -4214,7 +4210,7 @@ var providerInstallationRunResultSchema = z27.discriminatedUnion(
4214
4210
  );
4215
4211
 
4216
4212
  // ../provider-bridge-protocol/src/requests.ts
4217
- import { z as z28 } from "zod";
4213
+ import { z as z29 } from "zod";
4218
4214
  var BRIDGE_REQUEST_METHODS = {
4219
4215
  initialize: "initialize",
4220
4216
  modelList: "model/list",
@@ -4236,82 +4232,78 @@ var BRIDGE_REQUEST_METHODS = {
4236
4232
  skillsConfigure: "skills/configure"
4237
4233
  };
4238
4234
  var sessionConstructionFields = {
4239
- threadId: z28.string().min(1),
4240
- cwd: z28.string().min(1),
4235
+ threadId: z29.string().min(1),
4236
+ cwd: z29.string().min(1),
4241
4237
  options: bridgeExecutionOptionsSchema,
4242
- dynamicTools: z28.array(dynamicToolSchema).optional(),
4243
- disallowedTools: z28.array(z28.string().min(1)).optional(),
4238
+ dynamicTools: z29.array(dynamicToolSchema).optional(),
4239
+ disallowedTools: z29.array(z29.string().min(1)).optional(),
4244
4240
  instructionMode: instructionModeSchema
4245
4241
  };
4246
- var modelListParamsSchema = z28.object({ cwd: z28.string().min(1).optional() }).passthrough();
4247
- var threadStartParamsSchema = z28.object({
4242
+ var modelListParamsSchema = z29.object({ cwd: z29.string().min(1).optional() }).passthrough();
4243
+ var threadStartParamsSchema = z29.object({
4248
4244
  ...sessionConstructionFields,
4249
- input: z28.array(promptInputSchema).optional()
4245
+ input: z29.array(promptInputSchema).optional()
4250
4246
  }).passthrough();
4251
- var threadResumeParamsSchema = z28.object({
4247
+ var threadResumeParamsSchema = z29.object({
4252
4248
  ...sessionConstructionFields,
4253
- providerThreadId: z28.string().min(1)
4249
+ providerThreadId: z29.string().min(1)
4254
4250
  }).passthrough();
4255
- var threadForkParamsSchema = z28.object({
4251
+ var threadForkParamsSchema = z29.object({
4256
4252
  ...sessionConstructionFields,
4257
- sourceProviderThreadId: z28.string().min(1),
4258
- sourceProviderCheckpointId: z28.string().min(1).optional()
4253
+ sourceProviderThreadId: z29.string().min(1),
4254
+ sourceProviderCheckpointId: z29.string().min(1).optional()
4259
4255
  }).passthrough();
4260
- var threadStopParamsSchema = z28.object({
4261
- threadId: z28.string().min(1),
4262
- providerThreadId: z28.string().min(1),
4263
- intent: z28.enum(["interrupt", "release"]),
4264
- activeTurnId: z28.string().min(1).nullable()
4256
+ var threadStopParamsSchema = z29.object({
4257
+ threadId: z29.string().min(1),
4258
+ providerThreadId: z29.string().min(1),
4259
+ intent: z29.enum(["interrupt", "release"]),
4260
+ activeTurnId: z29.string().min(1).nullable()
4265
4261
  }).passthrough();
4266
- var threadRefParams = z28.object({
4267
- threadId: z28.string().min(1),
4268
- providerThreadId: z28.string().min(1)
4262
+ var threadRefParams = z29.object({
4263
+ threadId: z29.string().min(1),
4264
+ providerThreadId: z29.string().min(1)
4269
4265
  }).passthrough();
4270
4266
  var threadDiscardParamsSchema = threadRefParams;
4271
4267
  var threadArchiveParamsSchema = threadRefParams;
4272
4268
  var threadUnarchiveParamsSchema = threadRefParams;
4273
4269
  var threadGoalClearParamsSchema = threadRefParams;
4274
- var threadNameSetParamsSchema = z28.object({
4275
- threadId: z28.string().min(1),
4276
- providerThreadId: z28.string().min(1),
4277
- title: z28.string().min(1)
4270
+ var threadNameSetParamsSchema = z29.object({
4271
+ threadId: z29.string().min(1),
4272
+ providerThreadId: z29.string().min(1),
4273
+ title: z29.string().min(1)
4278
4274
  }).passthrough();
4279
4275
  var turnInputFields = {
4280
- threadId: z28.string().min(1),
4281
- providerThreadId: z28.string().min(1),
4282
- input: z28.array(promptInputSchema),
4276
+ threadId: z29.string().min(1),
4277
+ providerThreadId: z29.string().min(1),
4278
+ input: z29.array(promptInputSchema),
4283
4279
  clientRequestId: clientTurnRequestIdSchema,
4284
4280
  options: bridgeExecutionOptionsSchema
4285
4281
  };
4286
- var turnStartParamsSchema = z28.object(turnInputFields).passthrough();
4287
- var turnSteerParamsSchema = z28.object({
4282
+ var turnStartParamsSchema = z29.object(turnInputFields).passthrough();
4283
+ var turnSteerParamsSchema = z29.object({
4288
4284
  ...turnInputFields,
4289
- expectedTurnId: z28.string().min(1)
4285
+ expectedTurnId: z29.string().min(1)
4290
4286
  }).passthrough();
4291
- var skillsConfigureRootSchema = z28.object({
4292
- id: z28.string().min(1),
4293
- path: z28.string().min(1),
4294
- skills: z28.array(
4295
- z28.object({
4296
- name: z28.string().min(1),
4297
- description: z28.string()
4287
+ var skillsConfigureRootSchema = z29.object({
4288
+ id: z29.string().min(1),
4289
+ path: z29.string().min(1),
4290
+ skills: z29.array(
4291
+ z29.object({
4292
+ name: z29.string().min(1),
4293
+ description: z29.string()
4298
4294
  }).passthrough()
4299
4295
  )
4300
4296
  }).passthrough();
4301
- var skillsConfigureParamsSchema = z28.object({
4302
- roots: z28.array(skillsConfigureRootSchema)
4297
+ var skillsConfigureParamsSchema = z29.object({
4298
+ roots: z29.array(skillsConfigureRootSchema)
4303
4299
  }).passthrough();
4304
- var threadIdentityResultSchema = z28.object({
4305
- providerThreadId: z28.string().min(1),
4306
- sessionRestorable: z28.boolean().optional()
4307
- }).passthrough();
4308
- var modelListResultSchema = z28.object({
4309
- models: z28.array(availableModelSchema),
4310
- selectedOnlyModels: z28.array(availableModelSchema).default([])
4300
+ var threadIdentityResultSchema = z29.object({
4301
+ providerThreadId: z29.string().min(1),
4302
+ sessionRestorable: z29.boolean().optional()
4311
4303
  }).passthrough();
4312
4304
 
4313
4305
  // ../provider-bridge-protocol/src/notifications.ts
4314
- import { z as z29 } from "zod";
4306
+ import { z as z30 } from "zod";
4315
4307
  var BRIDGE_NOTIFICATION_METHODS = {
4316
4308
  threadIdentity: "thread/identity",
4317
4309
  sessionReplaced: "session/replaced",
@@ -4319,64 +4311,26 @@ var BRIDGE_NOTIFICATION_METHODS = {
4319
4311
  providerRecovery: "provider/recovery",
4320
4312
  error: "error"
4321
4313
  };
4322
- var threadIdentityNotificationSchema = z29.object({
4323
- threadId: z29.string().min(1),
4324
- providerThreadId: z29.string().min(1),
4325
- sessionRestorable: z29.boolean().optional()
4326
- }).passthrough();
4327
- var sessionReplacedNotificationSchema = z29.object({
4328
- threadId: z29.string().min(1),
4329
- providerThreadId: z29.string().min(1).nullable(),
4330
- reason: z29.string().min(1),
4331
- contextLost: z29.boolean().default(false),
4332
- showRuntimeNote: z29.boolean().default(false)
4333
- }).passthrough();
4334
- var providerRawNotificationSchema = z29.object({
4335
- threadId: z29.string().min(1).optional(),
4336
- coverage: z29.enum(["noise", "unknown"]),
4337
- payload: z29.unknown()
4338
- }).passthrough();
4339
- var providerRecoveryNotificationSchema = z29.object({
4340
- threadId: z29.string().min(1).optional(),
4341
- ...providerRecoveryHintSchema.shape
4314
+ var threadIdentityNotificationSchema = z30.object({
4315
+ threadId: z30.string().min(1),
4316
+ providerThreadId: z30.string().min(1),
4317
+ sessionRestorable: z30.boolean().optional()
4342
4318
  }).passthrough();
4343
- var errorNotificationSchema = z29.object({
4344
- threadId: z29.string().min(1).optional(),
4345
- message: z29.string().min(1)
4319
+ var sessionReplacedNotificationSchema = z30.object({
4320
+ threadId: z30.string().min(1),
4321
+ providerThreadId: z30.string().min(1).nullable(),
4322
+ reason: z30.string().min(1),
4323
+ contextLost: z30.boolean().default(false),
4324
+ showRuntimeNote: z30.boolean().default(false)
4346
4325
  }).passthrough();
4347
-
4348
- // ../provider-bridge-protocol/src/bridge-requests.ts
4349
- import { z as z30 } from "zod";
4350
- var BRIDGE_INBOUND_REQUEST_METHODS = {
4351
- toolCall: "item/tool/call",
4352
- interactionRequest: "interaction/request"
4353
- };
4354
- var toolCallRequestParamsSchema = z30.object({
4355
- providerThreadId: z30.string().min(1),
4326
+ var providerRecoveryNotificationSchema = z30.object({
4356
4327
  threadId: z30.string().min(1).optional(),
4357
- turnId: z30.union([z30.string().min(1), z30.null()]),
4358
- callId: z30.string().min(1),
4359
- tool: z30.string().min(1),
4360
- arguments: z30.unknown()
4361
- }).passthrough();
4362
- var toolCallResultSchema = z30.object({
4363
- success: z30.boolean(),
4364
- contentItems: z30.array(
4365
- z30.discriminatedUnion("type", [
4366
- z30.object({ type: z30.literal("inputText"), text: z30.string() }),
4367
- z30.object({
4368
- type: z30.literal("inputImage"),
4369
- imageUrl: z30.string().min(1)
4370
- })
4371
- ])
4372
- )
4328
+ ...providerRecoveryHintSchema.shape
4373
4329
  }).passthrough();
4374
- var interactionRequestParamsSchema = z30.object({
4375
- providerThreadId: z30.string().min(1),
4330
+ var errorNotificationSchema = z30.object({
4376
4331
  threadId: z30.string().min(1).optional(),
4377
- turnId: z30.union([z30.string().min(1), z30.null()]),
4378
- payload: pendingInteractionPayloadSchema,
4379
- providerNativeIds: z30.boolean().optional()
4332
+ providerThreadId: z30.string().min(1).optional(),
4333
+ message: z30.string().min(1)
4380
4334
  }).passthrough();
4381
4335
 
4382
4336
  // ../provider-bridge-protocol/src/thread-delta.ts
@@ -4621,6 +4575,7 @@ var threadDeltaSchema = z31.discriminatedUnion("kind", [
4621
4575
  }),
4622
4576
  z31.object({
4623
4577
  kind: z31.literal("contextWindow"),
4578
+ snapshot: contextSnapshotSchema.optional(),
4624
4579
  used: z31.number().nullable(),
4625
4580
  size: z31.number().nullable().optional(),
4626
4581
  estimated: z31.boolean(),
@@ -4853,6 +4808,7 @@ export {
4853
4808
  buildShellEnvOverrides,
4854
4809
  claudeTaskToolNameSchema,
4855
4810
  claudeTaskToolOutputSchema,
4811
+ contextSnapshotSchema,
4856
4812
  createBridgeIo,
4857
4813
  createBridgeLineHandler,
4858
4814
  createPendingToolCallTracker,