@get-bb/plugin-sdk 0.4.84 → 0.4.88
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.
- package/bundled-types/bb-plugin-sdk-app.d.ts +9 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +229 -43
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +52 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +131 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +17 -8
- package/bundled-types/bb-plugin-sdk.d.ts +172 -5
- package/dist/host.js +1 -1
- package/dist/internal/host-policy.js +790 -114
- package/dist/internal/plugin-app-collector.js +71 -90
- package/dist/provider-bridge-acp.js +1967 -2047
- package/dist/provider-bridge-testing.js +1378 -1405
- package/dist/provider-bridge-worker-entry.mjs +0 -1
- package/dist/provider-bridge.js +1458 -1500
- package/dist/testing/app.js +71 -90
- package/dist/testing/index.js +954 -791
- package/package.json +1 -2
package/dist/provider-bridge.js
CHANGED
|
@@ -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
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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
|
|
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
|
|
1073
|
+
import { z as z5 } from "zod";
|
|
1298
1074
|
|
|
1299
1075
|
// ../domain/src/json-value.ts
|
|
1300
|
-
import { z as
|
|
1301
|
-
var jsonValueSchema =
|
|
1302
|
-
() =>
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
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 =
|
|
1312
|
-
|
|
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 =
|
|
1328
|
-
var serviceTierSchema =
|
|
1103
|
+
var reasoningLevelSchema = z5.enum(reasoningLevelValues);
|
|
1104
|
+
var serviceTierSchema = z5.enum(["fast", "default"]);
|
|
1329
1105
|
var instructionModeValues = ["append", "replace"];
|
|
1330
|
-
var instructionModeSchema =
|
|
1106
|
+
var instructionModeSchema = z5.enum(instructionModeValues);
|
|
1331
1107
|
var permissionModeValues = ["accept-edits", "auto", "full"];
|
|
1332
|
-
var permissionModeSchema =
|
|
1333
|
-
var permissionModeInputSchema =
|
|
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 =
|
|
1116
|
+
var recordedPermissionModeSchema = z5.enum([
|
|
1341
1117
|
...permissionModeValues,
|
|
1342
1118
|
...legacyRecordedPermissionModeValues
|
|
1343
1119
|
]);
|
|
1344
1120
|
var permissionEscalationValues = ["ask", "deny"];
|
|
1345
|
-
var permissionEscalationSchema =
|
|
1121
|
+
var permissionEscalationSchema = z5.enum(permissionEscalationValues);
|
|
1346
1122
|
var promptInputVisibilityValues = ["agent-only"];
|
|
1347
|
-
var promptInputVisibilitySchema =
|
|
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 =
|
|
1128
|
+
var promptMentionPathSourceSchema = z5.enum(promptMentionPathSourceValues);
|
|
1353
1129
|
var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
1354
|
-
var promptMentionPathEntryKindSchema =
|
|
1130
|
+
var promptMentionPathEntryKindSchema = z5.enum(
|
|
1355
1131
|
promptMentionPathEntryKindValues
|
|
1356
1132
|
);
|
|
1357
1133
|
var promptMentionCommandTriggerValues = ["/"];
|
|
1358
|
-
var promptMentionCommandTriggerSchema =
|
|
1134
|
+
var promptMentionCommandTriggerSchema = z5.enum(
|
|
1359
1135
|
promptMentionCommandTriggerValues
|
|
1360
1136
|
);
|
|
1361
1137
|
var promptMentionCommandSourceValues = ["skill", "command"];
|
|
1362
|
-
var promptMentionCommandSourceSchema =
|
|
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 =
|
|
1146
|
+
var promptMentionCommandOriginSchema = z5.enum(
|
|
1371
1147
|
promptMentionCommandOriginValues
|
|
1372
1148
|
);
|
|
1373
|
-
var canonicalPromptMentionResourceSchema =
|
|
1374
|
-
|
|
1375
|
-
kind:
|
|
1376
|
-
threadId:
|
|
1377
|
-
projectId:
|
|
1378
|
-
label:
|
|
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
|
-
|
|
1381
|
-
kind:
|
|
1382
|
-
projectId:
|
|
1383
|
-
label:
|
|
1156
|
+
z5.object({
|
|
1157
|
+
kind: z5.literal("project"),
|
|
1158
|
+
projectId: z5.string(),
|
|
1159
|
+
label: z5.string()
|
|
1384
1160
|
}),
|
|
1385
|
-
|
|
1386
|
-
kind:
|
|
1387
|
-
sectionId:
|
|
1388
|
-
label:
|
|
1161
|
+
z5.object({
|
|
1162
|
+
kind: z5.literal("section"),
|
|
1163
|
+
sectionId: z5.string(),
|
|
1164
|
+
label: z5.string()
|
|
1389
1165
|
}),
|
|
1390
|
-
|
|
1391
|
-
kind:
|
|
1166
|
+
z5.object({
|
|
1167
|
+
kind: z5.literal("path"),
|
|
1392
1168
|
source: promptMentionPathSourceSchema,
|
|
1393
1169
|
entryKind: promptMentionPathEntryKindSchema,
|
|
1394
|
-
path:
|
|
1395
|
-
label:
|
|
1170
|
+
path: z5.string(),
|
|
1171
|
+
label: z5.string()
|
|
1396
1172
|
}),
|
|
1397
|
-
|
|
1398
|
-
kind:
|
|
1173
|
+
z5.object({
|
|
1174
|
+
kind: z5.literal("command"),
|
|
1399
1175
|
trigger: promptMentionCommandTriggerSchema,
|
|
1400
|
-
name:
|
|
1176
|
+
name: z5.string(),
|
|
1401
1177
|
source: promptMentionCommandSourceSchema,
|
|
1402
1178
|
origin: promptMentionCommandOriginSchema,
|
|
1403
|
-
label:
|
|
1404
|
-
argumentHint:
|
|
1179
|
+
label: z5.string(),
|
|
1180
|
+
argumentHint: z5.string().nullable()
|
|
1405
1181
|
}),
|
|
1406
|
-
|
|
1407
|
-
kind:
|
|
1408
|
-
pluginId:
|
|
1409
|
-
icon:
|
|
1410
|
-
itemId:
|
|
1411
|
-
label:
|
|
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 =
|
|
1201
|
+
var promptMentionResourceSchema = z5.preprocess(
|
|
1426
1202
|
normalizeLegacyPromptMentionResource,
|
|
1427
1203
|
canonicalPromptMentionResourceSchema
|
|
1428
1204
|
);
|
|
1429
|
-
var promptTextMentionSchema =
|
|
1430
|
-
start:
|
|
1431
|
-
end:
|
|
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 =
|
|
1435
|
-
|
|
1436
|
-
type:
|
|
1437
|
-
text:
|
|
1438
|
-
mentions:
|
|
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
|
-
|
|
1442
|
-
type:
|
|
1443
|
-
url:
|
|
1217
|
+
z5.object({
|
|
1218
|
+
type: z5.literal("image"),
|
|
1219
|
+
url: z5.string().url(),
|
|
1444
1220
|
...promptInputVisibilityFields
|
|
1445
1221
|
}),
|
|
1446
|
-
|
|
1447
|
-
type:
|
|
1448
|
-
path:
|
|
1222
|
+
z5.object({
|
|
1223
|
+
type: z5.literal("localImage"),
|
|
1224
|
+
path: z5.string(),
|
|
1449
1225
|
...promptInputVisibilityFields
|
|
1450
1226
|
}),
|
|
1451
|
-
|
|
1452
|
-
type:
|
|
1453
|
-
path:
|
|
1454
|
-
name:
|
|
1455
|
-
sizeBytes:
|
|
1456
|
-
mimeType:
|
|
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 =
|
|
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 =
|
|
1319
|
+
var callerExecutionInputSourceSchema = z5.enum(
|
|
1544
1320
|
callerExecutionInputSourceValues
|
|
1545
1321
|
);
|
|
1546
|
-
var threadExecutionOptionsSchema =
|
|
1547
|
-
model:
|
|
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:
|
|
1328
|
+
seq: z5.number().int().optional()
|
|
1553
1329
|
});
|
|
1554
1330
|
var resolvedThreadExecutionOptionsSchema = threadExecutionOptionsSchema.extend({
|
|
1555
|
-
model:
|
|
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 =
|
|
1566
|
-
var runtimePermissionPolicySchema =
|
|
1341
|
+
var runtimePermissionScopeSchema = z5.enum(runtimePermissionScopeValues);
|
|
1342
|
+
var runtimePermissionPolicySchema = z5.discriminatedUnion(
|
|
1567
1343
|
"permissionMode",
|
|
1568
1344
|
[
|
|
1569
|
-
|
|
1570
|
-
permissionMode:
|
|
1571
|
-
permissionScope:
|
|
1572
|
-
approvalReviewer:
|
|
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
|
-
|
|
1576
|
-
permissionMode:
|
|
1577
|
-
permissionScope:
|
|
1578
|
-
approvalReviewer:
|
|
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
|
-
|
|
1582
|
-
permissionMode:
|
|
1583
|
-
permissionScope:
|
|
1584
|
-
approvalReviewer:
|
|
1585
|
-
permissionEscalation:
|
|
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 =
|
|
1590
|
-
var runtimeThreadExecutionBaseOptionsSchema =
|
|
1591
|
-
model:
|
|
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 =
|
|
1599
|
-
providerId:
|
|
1600
|
-
model:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1395
|
+
var providerNativeSkillRootsSchema = z6.object({
|
|
1620
1396
|
user: uniqueProviderSkillRootPathsSchema.default([]),
|
|
1621
1397
|
project: uniqueProviderSkillRootPathsSchema.default([])
|
|
1622
1398
|
}).strict();
|
|
1623
|
-
var acpReasoningCliLevelValueOverridesSchema =
|
|
1399
|
+
var acpReasoningCliLevelValueOverridesSchema = z6.partialRecord(
|
|
1624
1400
|
reasoningLevelSchema,
|
|
1625
|
-
|
|
1401
|
+
z6.string().min(1)
|
|
1626
1402
|
);
|
|
1627
|
-
var acpReasoningCliSchema =
|
|
1628
|
-
flag:
|
|
1629
|
-
supportedLevels:
|
|
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 =
|
|
1650
|
-
configId:
|
|
1651
|
-
supportedLevels:
|
|
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 =
|
|
1672
|
-
var acpPermissionCliSchema =
|
|
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:
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
path:
|
|
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:
|
|
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:
|
|
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 =
|
|
1732
|
-
user:
|
|
1733
|
-
project:
|
|
1507
|
+
var providerNativeRootsInputSchema = z7.object({
|
|
1508
|
+
user: z7.array(providerNativeRootInputSchema).optional(),
|
|
1509
|
+
project: z7.array(providerNativeRootInputSchema).optional()
|
|
1734
1510
|
}).strict();
|
|
1735
|
-
var providerNativeRootSchema =
|
|
1736
|
-
path:
|
|
1737
|
-
recursive:
|
|
1738
|
-
ancestors:
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1567
|
+
var resolvedNativeRootFieldsSchema = z7.object({
|
|
1792
1568
|
path: absoluteNativeRootPathSchema,
|
|
1793
|
-
origin:
|
|
1794
|
-
recursive:
|
|
1569
|
+
origin: z7.enum(["user", "project"]),
|
|
1570
|
+
recursive: z7.boolean(),
|
|
1795
1571
|
/** Only with origin `project`, for a path inside the workspace. */
|
|
1796
|
-
ancestors:
|
|
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:
|
|
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 =
|
|
1849
|
-
skills:
|
|
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:
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
1899
|
-
var workflowAgentSnapshotSchema =
|
|
1900
|
-
index:
|
|
1901
|
-
label:
|
|
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:
|
|
1904
|
-
attempt:
|
|
1905
|
-
cached:
|
|
1906
|
-
lastProgressAt:
|
|
1907
|
-
phaseIndex:
|
|
1908
|
-
phaseTitle:
|
|
1909
|
-
agentType:
|
|
1910
|
-
isolation:
|
|
1911
|
-
queuedAt:
|
|
1912
|
-
startedAt:
|
|
1913
|
-
lastToolName:
|
|
1914
|
-
lastToolSummary:
|
|
1915
|
-
promptPreview:
|
|
1916
|
-
resultPreview:
|
|
1917
|
-
error:
|
|
1918
|
-
tokens:
|
|
1919
|
-
toolCalls:
|
|
1920
|
-
durationMs:
|
|
1921
|
-
});
|
|
1922
|
-
var workflowPhaseSnapshotSchema =
|
|
1923
|
-
index:
|
|
1924
|
-
title:
|
|
1925
|
-
kind:
|
|
1926
|
-
});
|
|
1927
|
-
var workflowProgressSnapshotSchema =
|
|
1928
|
-
phases:
|
|
1929
|
-
agents:
|
|
1930
|
-
});
|
|
1931
|
-
var backgroundTaskUsageSchema =
|
|
1932
|
-
totalTokens:
|
|
1933
|
-
toolUses:
|
|
1934
|
-
durationMs:
|
|
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
|
|
1732
|
+
import { z as z17 } from "zod";
|
|
1957
1733
|
|
|
1958
1734
|
// ../domain/src/thread-events.ts
|
|
1959
|
-
import { z as
|
|
1735
|
+
import { z as z14 } from "zod";
|
|
1960
1736
|
|
|
1961
1737
|
// ../domain/src/pending-interactions.ts
|
|
1962
|
-
import { z as
|
|
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
|
|
1748
|
+
import { z as z9 } from "zod";
|
|
1973
1749
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
1974
|
-
var threadEventItemPresentationLabelSchema =
|
|
1975
|
-
pending:
|
|
1976
|
-
completed:
|
|
1750
|
+
var threadEventItemPresentationLabelSchema = z9.object({
|
|
1751
|
+
pending: z9.string().min(1),
|
|
1752
|
+
completed: z9.string().min(1)
|
|
1977
1753
|
});
|
|
1978
|
-
var threadEventItemPresentationIconSchema =
|
|
1979
|
-
glyph:
|
|
1754
|
+
var threadEventItemPresentationIconSchema = z9.object({
|
|
1755
|
+
glyph: z9.string().min(1)
|
|
1980
1756
|
});
|
|
1981
|
-
var threadEventItemPresentationTintSchema =
|
|
1982
|
-
light:
|
|
1983
|
-
dark:
|
|
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 =
|
|
1987
|
-
glyph:
|
|
1988
|
-
label:
|
|
1989
|
-
hint:
|
|
1990
|
-
tone:
|
|
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 =
|
|
1768
|
+
var threadEventItemPresentationSchema = z9.object({
|
|
1993
1769
|
label: threadEventItemPresentationLabelSchema,
|
|
1994
1770
|
icon: threadEventItemPresentationIconSchema,
|
|
1995
|
-
title:
|
|
1996
|
-
detail:
|
|
1997
|
-
suppress:
|
|
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
|
|
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 =
|
|
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 =
|
|
1789
|
+
var pendingInteractionStatusSchema = z11.enum([
|
|
2014
1790
|
"pending",
|
|
2015
1791
|
"resolving",
|
|
2016
1792
|
"resolved",
|
|
2017
1793
|
"interrupted"
|
|
2018
1794
|
]);
|
|
2019
|
-
var pendingInteractionCommandActionSchema =
|
|
1795
|
+
var pendingInteractionCommandActionSchema = z11.discriminatedUnion(
|
|
2020
1796
|
"type",
|
|
2021
1797
|
[
|
|
2022
|
-
|
|
2023
|
-
type:
|
|
2024
|
-
command:
|
|
2025
|
-
name:
|
|
2026
|
-
path:
|
|
1798
|
+
z11.object({
|
|
1799
|
+
type: z11.literal("read"),
|
|
1800
|
+
command: z11.string(),
|
|
1801
|
+
name: z11.string(),
|
|
1802
|
+
path: z11.string()
|
|
2027
1803
|
}),
|
|
2028
|
-
|
|
2029
|
-
type:
|
|
2030
|
-
command:
|
|
2031
|
-
path:
|
|
1804
|
+
z11.object({
|
|
1805
|
+
type: z11.literal("listFiles"),
|
|
1806
|
+
command: z11.string(),
|
|
1807
|
+
path: z11.string().nullable()
|
|
2032
1808
|
}),
|
|
2033
|
-
|
|
2034
|
-
type:
|
|
2035
|
-
command:
|
|
2036
|
-
query:
|
|
2037
|
-
path:
|
|
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
|
-
|
|
2040
|
-
type:
|
|
2041
|
-
command:
|
|
1815
|
+
z11.object({
|
|
1816
|
+
type: z11.literal("unknown"),
|
|
1817
|
+
command: z11.string()
|
|
2042
1818
|
})
|
|
2043
1819
|
]
|
|
2044
1820
|
);
|
|
2045
|
-
var pendingInteractionNetworkPermissionsSchema =
|
|
2046
|
-
enabled:
|
|
1821
|
+
var pendingInteractionNetworkPermissionsSchema = z11.object({
|
|
1822
|
+
enabled: z11.boolean().nullable()
|
|
2047
1823
|
});
|
|
2048
|
-
var pendingInteractionFileSystemPermissionsSchema =
|
|
2049
|
-
read:
|
|
2050
|
-
write:
|
|
1824
|
+
var pendingInteractionFileSystemPermissionsSchema = z11.object({
|
|
1825
|
+
read: z11.array(z11.string()),
|
|
1826
|
+
write: z11.array(z11.string())
|
|
2051
1827
|
});
|
|
2052
|
-
var pendingInteractionMacOsPreferencesPermissionSchema =
|
|
1828
|
+
var pendingInteractionMacOsPreferencesPermissionSchema = z11.enum([
|
|
2053
1829
|
"none",
|
|
2054
1830
|
"read_only",
|
|
2055
1831
|
"read_write"
|
|
2056
1832
|
]);
|
|
2057
|
-
var pendingInteractionMacOsContactsPermissionSchema =
|
|
1833
|
+
var pendingInteractionMacOsContactsPermissionSchema = z11.enum([
|
|
2058
1834
|
"none",
|
|
2059
1835
|
"read_only",
|
|
2060
1836
|
"read_write"
|
|
2061
1837
|
]);
|
|
2062
|
-
var pendingInteractionMacOsAutomationPermissionSchema =
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
kind:
|
|
2067
|
-
bundleIds:
|
|
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 =
|
|
1846
|
+
var pendingInteractionMacOsPermissionsSchema = z11.object({
|
|
2071
1847
|
preferences: pendingInteractionMacOsPreferencesPermissionSchema,
|
|
2072
1848
|
automations: pendingInteractionMacOsAutomationPermissionSchema,
|
|
2073
|
-
launchServices:
|
|
2074
|
-
accessibility:
|
|
2075
|
-
calendar:
|
|
2076
|
-
reminders:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1865
|
+
var pendingInteractionApprovalDecisionSchema = z11.enum([
|
|
2090
1866
|
"allow_once",
|
|
2091
1867
|
"allow_for_session",
|
|
2092
1868
|
"deny"
|
|
2093
1869
|
]);
|
|
2094
|
-
var pendingInteractionFileChangeWriteScopeSchema =
|
|
2095
|
-
var pendingInteractionCommandApprovalSubjectSchema =
|
|
2096
|
-
kind:
|
|
2097
|
-
itemId:
|
|
2098
|
-
command:
|
|
2099
|
-
cwd:
|
|
2100
|
-
actions:
|
|
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 =
|
|
2104
|
-
kind:
|
|
2105
|
-
itemId:
|
|
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 =
|
|
2110
|
-
kind:
|
|
2111
|
-
itemId:
|
|
2112
|
-
toolName:
|
|
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 =
|
|
2116
|
-
kind:
|
|
2117
|
-
itemId:
|
|
2118
|
-
plan:
|
|
2119
|
-
planFilePath:
|
|
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 =
|
|
2122
|
-
kind:
|
|
2123
|
-
itemId:
|
|
2124
|
-
tool:
|
|
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 =
|
|
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 =
|
|
2135
|
-
kind:
|
|
1910
|
+
var approvalPendingInteractionPayloadSchema = z11.object({
|
|
1911
|
+
kind: z11.literal("approval"),
|
|
2136
1912
|
subject: pendingInteractionApprovalSubjectSchema,
|
|
2137
|
-
reason:
|
|
2138
|
-
availableDecisions:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1944
|
+
var pendingInteractionUserQuestionOptionSchema = z11.object({
|
|
2169
1945
|
value: pendingInteractionUserQuestionOptionValueSchema,
|
|
2170
1946
|
label: pendingInteractionUserQuestionOptionLabelSchema,
|
|
2171
1947
|
description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
|
|
2172
1948
|
});
|
|
2173
|
-
var pendingInteractionUserQuestionQuestionSchema =
|
|
1949
|
+
var pendingInteractionUserQuestionQuestionSchema = z11.object({
|
|
2174
1950
|
id: pendingInteractionUserQuestionIdSchema,
|
|
2175
1951
|
prompt: pendingInteractionUserQuestionPromptSchema,
|
|
2176
1952
|
shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
|
|
2177
|
-
multiSelect:
|
|
2178
|
-
options:
|
|
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:
|
|
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:
|
|
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 =
|
|
2204
|
-
kind:
|
|
2205
|
-
questions:
|
|
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:
|
|
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 =
|
|
2224
|
-
kind:
|
|
2225
|
-
title:
|
|
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 =
|
|
2004
|
+
var pluginExtensionInteractionRequestPayloadSchema = z11.object({
|
|
2229
2005
|
kind: extensionKindSchema,
|
|
2230
|
-
title:
|
|
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 =
|
|
2012
|
+
var interactionRequestPayloadSchema = z11.union([
|
|
2237
2013
|
userQuestionPendingInteractionPayloadSchema,
|
|
2238
2014
|
pluginExtensionInteractionRequestPayloadSchema
|
|
2239
2015
|
]);
|
|
2240
|
-
var pendingInteractionPayloadSchema =
|
|
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 =
|
|
2028
|
+
var approvalPendingInteractionResolutionSchema = z11.discriminatedUnion(
|
|
2253
2029
|
"decision",
|
|
2254
2030
|
[
|
|
2255
|
-
|
|
2256
|
-
decision:
|
|
2031
|
+
z11.object({
|
|
2032
|
+
decision: z11.literal("allow_once"),
|
|
2257
2033
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
2258
2034
|
}),
|
|
2259
|
-
|
|
2260
|
-
decision:
|
|
2035
|
+
z11.object({
|
|
2036
|
+
decision: z11.literal("allow_for_session"),
|
|
2261
2037
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
2262
2038
|
}),
|
|
2263
|
-
|
|
2264
|
-
decision:
|
|
2039
|
+
z11.object({
|
|
2040
|
+
decision: z11.literal("deny")
|
|
2265
2041
|
})
|
|
2266
2042
|
],
|
|
2267
2043
|
approvalDecisionDiscriminatorError
|
|
2268
2044
|
);
|
|
2269
|
-
var pendingInteractionUserAnswerSchema =
|
|
2270
|
-
selected:
|
|
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 =
|
|
2277
|
-
kind:
|
|
2278
|
-
answers:
|
|
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 =
|
|
2281
|
-
kind:
|
|
2056
|
+
var pluginPendingInteractionResolutionSchema = z11.object({
|
|
2057
|
+
kind: z11.literal("plugin_submitted")
|
|
2282
2058
|
});
|
|
2283
|
-
var pluginExtensionInteractionResolutionSchema =
|
|
2284
|
-
kind:
|
|
2059
|
+
var pluginExtensionInteractionResolutionSchema = z11.object({
|
|
2060
|
+
kind: z11.literal("request_answer"),
|
|
2285
2061
|
value: jsonValueSchema
|
|
2286
2062
|
});
|
|
2287
|
-
var pendingInteractionResolutionSchema =
|
|
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 =
|
|
2078
|
+
var approvalInteractionOutcomeSchema = z11.object({
|
|
2303
2079
|
payload: approvalPendingInteractionPayloadSchema,
|
|
2304
2080
|
resolution: approvalPendingInteractionResolutionSchema
|
|
2305
2081
|
});
|
|
2306
|
-
var userQuestionInteractionOutcomeSchema =
|
|
2082
|
+
var userQuestionInteractionOutcomeSchema = z11.object({
|
|
2307
2083
|
payload: userQuestionPendingInteractionPayloadSchema,
|
|
2308
2084
|
resolution: userQuestionPendingInteractionResolutionSchema
|
|
2309
2085
|
});
|
|
2310
|
-
var pluginExtensionInteractionOutcomeSchema =
|
|
2086
|
+
var pluginExtensionInteractionOutcomeSchema = z11.object({
|
|
2311
2087
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
2312
2088
|
resolution: pluginExtensionInteractionResolutionSchema
|
|
2313
2089
|
});
|
|
2314
|
-
var providerInteractionOutcomeSchema =
|
|
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 =
|
|
2323
|
-
kind:
|
|
2324
|
-
providerId:
|
|
2325
|
-
providerThreadId:
|
|
2326
|
-
providerRequestId:
|
|
2327
|
-
});
|
|
2328
|
-
var pendingInteractionPluginOriginSchema =
|
|
2329
|
-
kind:
|
|
2330
|
-
pluginId:
|
|
2331
|
-
rendererId:
|
|
2332
|
-
});
|
|
2333
|
-
var pendingInteractionCreateSchema =
|
|
2334
|
-
threadId:
|
|
2335
|
-
turnId:
|
|
2336
|
-
providerId:
|
|
2337
|
-
providerThreadId:
|
|
2338
|
-
providerRequestId:
|
|
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 =
|
|
2342
|
-
id:
|
|
2343
|
-
threadId:
|
|
2117
|
+
var pendingInteractionBaseSchema = z11.object({
|
|
2118
|
+
id: z11.string().min(1),
|
|
2119
|
+
threadId: z11.string().min(1),
|
|
2344
2120
|
status: pendingInteractionStatusSchema,
|
|
2345
|
-
statusReason:
|
|
2346
|
-
createdAt:
|
|
2347
|
-
expiresAt:
|
|
2348
|
-
resolvedAt:
|
|
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:
|
|
2352
|
-
providerId:
|
|
2353
|
-
providerThreadId:
|
|
2354
|
-
providerRequestId:
|
|
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 =
|
|
2145
|
+
var providerPendingInteractionSchema = z11.union([
|
|
2370
2146
|
approvalPendingInteractionSchema,
|
|
2371
2147
|
userQuestionPendingInteractionSchema,
|
|
2372
2148
|
pluginExtensionPendingInteractionSchema
|
|
2373
2149
|
]);
|
|
2374
2150
|
var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
|
|
2375
|
-
turnId:
|
|
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 =
|
|
2156
|
+
var pendingInteractionSchema = z11.union([
|
|
2381
2157
|
providerPendingInteractionSchema,
|
|
2382
2158
|
pluginPendingInteractionSchema
|
|
2383
2159
|
]);
|
|
2384
|
-
var interactionLifecycleRecordBaseSchema =
|
|
2385
|
-
id:
|
|
2160
|
+
var interactionLifecycleRecordBaseSchema = z11.object({
|
|
2161
|
+
id: z11.string().min(1),
|
|
2386
2162
|
status: pendingInteractionStatusSchema,
|
|
2387
|
-
statusReason:
|
|
2163
|
+
statusReason: z11.string().nullable()
|
|
2388
2164
|
});
|
|
2389
|
-
var interactionLifecycleProviderOriginSchema =
|
|
2390
|
-
kind:
|
|
2391
|
-
providerId:
|
|
2392
|
-
providerRequestId:
|
|
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 =
|
|
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
|
|
2426
|
-
var clientTurnRequestIdSchema =
|
|
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
|
|
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 =
|
|
2441
|
-
var systemMessageSubjectSchema =
|
|
2442
|
-
|
|
2443
|
-
kind:
|
|
2444
|
-
threadId:
|
|
2445
|
-
threadName:
|
|
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
|
-
|
|
2448
|
-
kind:
|
|
2449
|
-
count:
|
|
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 =
|
|
2248
|
+
var threadTurnInitiatorSchema = z14.enum(threadTurnInitiatorValues);
|
|
2473
2249
|
var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
|
|
2474
|
-
var turnRequestTargetSchema =
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
kind:
|
|
2479
|
-
expectedTurnId:
|
|
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
|
-
|
|
2482
|
-
kind:
|
|
2483
|
-
expectedTurnId:
|
|
2257
|
+
z14.object({
|
|
2258
|
+
kind: z14.literal("steer"),
|
|
2259
|
+
expectedTurnId: z14.string().nullable()
|
|
2484
2260
|
})
|
|
2485
2261
|
]);
|
|
2486
|
-
var clientTurnLifecycleEventDataSchema =
|
|
2487
|
-
direction:
|
|
2488
|
-
source:
|
|
2262
|
+
var clientTurnLifecycleEventDataSchema = z14.object({
|
|
2263
|
+
direction: z14.literal("outbound"),
|
|
2264
|
+
source: z14.enum(["spawn", "tell"]),
|
|
2489
2265
|
initiator: threadTurnInitiatorSchema,
|
|
2490
|
-
request:
|
|
2491
|
-
method:
|
|
2492
|
-
params:
|
|
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 =
|
|
2496
|
-
direction:
|
|
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:
|
|
2507
|
-
source:
|
|
2282
|
+
retryAttempt: z14.number().int().min(2).optional(),
|
|
2283
|
+
source: z14.enum(["spawn", "tell"]),
|
|
2508
2284
|
initiator: threadTurnInitiatorSchema,
|
|
2509
|
-
senderThreadId:
|
|
2285
|
+
senderThreadId: z14.string().nullable(),
|
|
2510
2286
|
systemMessageKind: systemMessageKindSchema.optional(),
|
|
2511
2287
|
systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
|
|
2512
|
-
input:
|
|
2513
|
-
inputGroups:
|
|
2288
|
+
input: z14.array(promptInputSchema),
|
|
2289
|
+
inputGroups: z14.array(z14.array(promptInputSchema).min(1)).min(1).optional(),
|
|
2514
2290
|
target: turnRequestTargetSchema,
|
|
2515
|
-
request:
|
|
2516
|
-
method:
|
|
2517
|
-
params:
|
|
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 =
|
|
2297
|
+
var turnRequestRejectedEventDataSchema = z14.object({
|
|
2522
2298
|
requestId: clientTurnRequestIdSchema,
|
|
2523
|
-
reason:
|
|
2524
|
-
message:
|
|
2525
|
-
});
|
|
2526
|
-
var systemErrorEventDataSchema =
|
|
2527
|
-
code:
|
|
2528
|
-
message:
|
|
2529
|
-
detail:
|
|
2530
|
-
reconnectAttempt:
|
|
2531
|
-
reconnectTotal:
|
|
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:
|
|
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:
|
|
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 =
|
|
2330
|
+
var ownershipChangeOperationActionSchema = z14.enum(
|
|
2555
2331
|
ownershipChangeOperationActionValues
|
|
2556
2332
|
);
|
|
2557
|
-
var ownershipChangeOperationMetadataSchema =
|
|
2333
|
+
var ownershipChangeOperationMetadataSchema = z14.object({
|
|
2558
2334
|
action: ownershipChangeOperationActionSchema,
|
|
2559
|
-
nextParentThreadId:
|
|
2560
|
-
nextParentThreadTitle:
|
|
2561
|
-
previousParentThreadId:
|
|
2562
|
-
previousParentThreadTitle:
|
|
2563
|
-
});
|
|
2564
|
-
var systemOperationEventDataSchema =
|
|
2565
|
-
operation:
|
|
2566
|
-
status:
|
|
2567
|
-
message:
|
|
2568
|
-
operationId:
|
|
2569
|
-
metadata:
|
|
2570
|
-
});
|
|
2571
|
-
var systemInteractionLifecycleEventDataSchema =
|
|
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 =
|
|
2575
|
-
interactionId:
|
|
2576
|
-
providerId:
|
|
2577
|
-
providerRequestId:
|
|
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:
|
|
2356
|
+
statusReason: z14.string().nullable().default(null),
|
|
2581
2357
|
subject: pendingInteractionPermissionGrantApprovalSubjectSchema
|
|
2582
2358
|
});
|
|
2583
|
-
var systemUserQuestionLifecycleEventDataSchema =
|
|
2584
|
-
interactionId:
|
|
2585
|
-
providerId:
|
|
2586
|
-
providerRequestId:
|
|
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:
|
|
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 =
|
|
2373
|
+
var systemThreadInterruptedReasonSchema = z14.enum(
|
|
2598
2374
|
systemThreadInterruptedReasonValues
|
|
2599
2375
|
);
|
|
2600
|
-
var systemThreadInterruptedEventDataSchema =
|
|
2376
|
+
var systemThreadInterruptedEventDataSchema = z14.object({
|
|
2601
2377
|
reason: systemThreadInterruptedReasonSchema,
|
|
2602
|
-
cause:
|
|
2378
|
+
cause: z14.literal("host-connection-lost").optional()
|
|
2603
2379
|
});
|
|
2604
|
-
var provisioningTranscriptEntrySchema =
|
|
2605
|
-
type:
|
|
2606
|
-
key:
|
|
2607
|
-
text:
|
|
2608
|
-
startedAt:
|
|
2609
|
-
status:
|
|
2610
|
-
metadata:
|
|
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 =
|
|
2394
|
+
var systemThreadProvisioningStatusSchema = z14.enum(
|
|
2619
2395
|
systemThreadProvisioningStatusValues
|
|
2620
2396
|
);
|
|
2621
|
-
var systemThreadProvisioningEventDataSchema =
|
|
2622
|
-
provisioningId:
|
|
2397
|
+
var systemThreadProvisioningEventDataSchema = z14.object({
|
|
2398
|
+
provisioningId: z14.string(),
|
|
2623
2399
|
status: systemThreadProvisioningStatusSchema,
|
|
2624
|
-
environmentId:
|
|
2625
|
-
entries:
|
|
2626
|
-
});
|
|
2627
|
-
var systemLegacyUserMessageEventDataSchema =
|
|
2628
|
-
text:
|
|
2629
|
-
toolCallId:
|
|
2630
|
-
turnId:
|
|
2631
|
-
});
|
|
2632
|
-
var systemProviderTurnWatchdogEventDataSchema =
|
|
2633
|
-
reason:
|
|
2634
|
-
thresholdMs:
|
|
2635
|
-
elapsedMs:
|
|
2636
|
-
activeTurnId:
|
|
2637
|
-
activeTurnStartedAt:
|
|
2638
|
-
lastActivityEventSequence:
|
|
2639
|
-
lastActivityEventType:
|
|
2640
|
-
lastActivityEventAt:
|
|
2641
|
-
providerId:
|
|
2642
|
-
providerThreadId:
|
|
2643
|
-
firedAt:
|
|
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
|
|
2423
|
+
import { z as z15 } from "zod";
|
|
2648
2424
|
var threadEventScopeKindValues = ["thread", "turn"];
|
|
2649
|
-
var threadEventScopeKindSchema =
|
|
2650
|
-
var threadEventScopeSchema =
|
|
2651
|
-
|
|
2652
|
-
|
|
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 =
|
|
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
|
|
2842
|
-
var threadTimelineGoalStatusSchema =
|
|
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 =
|
|
2849
|
-
sourceSeq:
|
|
2850
|
-
updatedAt:
|
|
2851
|
-
objective:
|
|
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:
|
|
2854
|
-
tokensUsed:
|
|
2855
|
-
timeUsedSeconds:
|
|
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 =
|
|
2619
|
+
var threadEventItemStatusSchema = z17.enum([
|
|
2860
2620
|
"pending",
|
|
2861
2621
|
"completed",
|
|
2862
2622
|
"failed",
|
|
2863
2623
|
"interrupted"
|
|
2864
2624
|
]);
|
|
2865
|
-
var threadEventItemApprovalStatusSchema =
|
|
2866
|
-
var threadEventTurnStatusSchema =
|
|
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 =
|
|
2893
|
-
var providerErrorInfoSchema =
|
|
2652
|
+
var providerErrorCategorySchema = z17.enum(providerErrorCategoryValues);
|
|
2653
|
+
var providerErrorInfoSchema = z17.object({
|
|
2894
2654
|
category: providerErrorCategorySchema,
|
|
2895
|
-
providerCode:
|
|
2896
|
-
httpStatusCode:
|
|
2655
|
+
providerCode: z17.string().nullable(),
|
|
2656
|
+
httpStatusCode: z17.number().nullable()
|
|
2897
2657
|
});
|
|
2898
|
-
var providerRateLimitStatusSchema =
|
|
2658
|
+
var providerRateLimitStatusSchema = z17.enum([
|
|
2899
2659
|
"allowed",
|
|
2900
2660
|
"warning",
|
|
2901
2661
|
"blocked",
|
|
2902
2662
|
"unknown"
|
|
2903
2663
|
]);
|
|
2904
|
-
var providerRateLimitWindowSchema =
|
|
2905
|
-
providerKey:
|
|
2906
|
-
label:
|
|
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:
|
|
2668
|
+
resetsAtMs: z17.number().int().nonnegative().nullable()
|
|
2909
2669
|
});
|
|
2910
|
-
var providerRateLimitStateSchema =
|
|
2911
|
-
providerId:
|
|
2670
|
+
var providerRateLimitStateSchema = z17.object({
|
|
2671
|
+
providerId: z17.string().min(1),
|
|
2912
2672
|
status: providerRateLimitStatusSchema,
|
|
2913
|
-
kind:
|
|
2914
|
-
windows:
|
|
2915
|
-
reachedReason:
|
|
2916
|
-
overageStatus:
|
|
2917
|
-
overageReason:
|
|
2918
|
-
});
|
|
2919
|
-
var threadEventFileChangeKindSchema =
|
|
2920
|
-
var threadEventFileChangeSchema =
|
|
2921
|
-
path:
|
|
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:
|
|
2924
|
-
diff:
|
|
2683
|
+
movePath: z17.string().optional(),
|
|
2684
|
+
diff: z17.string().optional()
|
|
2925
2685
|
});
|
|
2926
|
-
var threadEventPlanStepStatusSchema =
|
|
2686
|
+
var threadEventPlanStepStatusSchema = z17.enum([
|
|
2927
2687
|
"pending",
|
|
2928
2688
|
"active",
|
|
2929
2689
|
"completed",
|
|
2930
2690
|
"failed"
|
|
2931
2691
|
]);
|
|
2932
|
-
var threadEventPlanStepSchema =
|
|
2933
|
-
step:
|
|
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 =
|
|
2940
|
-
type:
|
|
2941
|
-
id:
|
|
2942
|
-
queries:
|
|
2943
|
-
resultText:
|
|
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:
|
|
2946
|
-
});
|
|
2947
|
-
var threadEventWebFetchItemSchema =
|
|
2948
|
-
type:
|
|
2949
|
-
id:
|
|
2950
|
-
url:
|
|
2951
|
-
prompt:
|
|
2952
|
-
pattern:
|
|
2953
|
-
resultText:
|
|
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:
|
|
2715
|
+
parentToolCallId: z17.string().optional()
|
|
2956
2716
|
});
|
|
2957
|
-
var threadEventImageViewItemSchema =
|
|
2958
|
-
type:
|
|
2959
|
-
id:
|
|
2960
|
-
path:
|
|
2717
|
+
var threadEventImageViewItemSchema = z17.object({
|
|
2718
|
+
type: z17.literal("imageView"),
|
|
2719
|
+
id: z17.string(),
|
|
2720
|
+
path: z17.string(),
|
|
2961
2721
|
...itemPresentationField,
|
|
2962
|
-
parentToolCallId:
|
|
2722
|
+
parentToolCallId: z17.string().optional()
|
|
2963
2723
|
});
|
|
2964
|
-
var threadEventFileReadItemSchema =
|
|
2965
|
-
type:
|
|
2966
|
-
id:
|
|
2967
|
-
path:
|
|
2968
|
-
cmd:
|
|
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:
|
|
2731
|
+
parentToolCallId: z17.string().optional()
|
|
2972
2732
|
});
|
|
2973
|
-
var threadEventSearchModeSchema =
|
|
2974
|
-
var threadEventSearchItemSchema =
|
|
2975
|
-
type:
|
|
2976
|
-
id:
|
|
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:
|
|
2979
|
-
path:
|
|
2980
|
-
cmd:
|
|
2738
|
+
query: z17.string(),
|
|
2739
|
+
path: z17.string().optional(),
|
|
2740
|
+
cmd: z17.string().optional(),
|
|
2981
2741
|
status: threadEventItemStatusSchema,
|
|
2982
2742
|
...itemPresentationField,
|
|
2983
|
-
parentToolCallId:
|
|
2743
|
+
parentToolCallId: z17.string().optional()
|
|
2984
2744
|
});
|
|
2985
|
-
var threadEventDelegationItemSchema =
|
|
2986
|
-
type:
|
|
2987
|
-
id:
|
|
2988
|
-
childRef:
|
|
2989
|
-
label:
|
|
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:
|
|
2992
|
-
summary:
|
|
2751
|
+
background: z17.boolean(),
|
|
2752
|
+
summary: z17.string().optional(),
|
|
2993
2753
|
...itemPresentationField,
|
|
2994
|
-
parentToolCallId:
|
|
2754
|
+
parentToolCallId: z17.string().optional()
|
|
2995
2755
|
});
|
|
2996
|
-
var threadEventPlanStepsItemSchema =
|
|
2997
|
-
type:
|
|
2998
|
-
id:
|
|
2999
|
-
steps:
|
|
3000
|
-
explanation:
|
|
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:
|
|
2763
|
+
parentToolCallId: z17.string().optional()
|
|
3004
2764
|
});
|
|
3005
|
-
var threadEventExtensionItemSchema =
|
|
3006
|
-
type:
|
|
3007
|
-
id:
|
|
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:
|
|
2772
|
+
parentToolCallId: z17.string().optional()
|
|
3013
2773
|
});
|
|
3014
|
-
var threadEventTextTruncationSchema =
|
|
3015
|
-
originalLength:
|
|
3016
|
-
retainedHeadLength:
|
|
3017
|
-
retainedTailLength:
|
|
3018
|
-
truncatedAt:
|
|
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 =
|
|
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 =
|
|
3026
|
-
type:
|
|
3027
|
-
id:
|
|
2785
|
+
var threadEventImageGenerationItemSchema = z17.object({
|
|
2786
|
+
type: z17.literal("imageGeneration"),
|
|
2787
|
+
id: z17.string(),
|
|
3028
2788
|
status: threadEventItemStatusSchema,
|
|
3029
|
-
prompt:
|
|
3030
|
-
path:
|
|
3031
|
-
result:
|
|
3032
|
-
error:
|
|
3033
|
-
transparentBackground:
|
|
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:
|
|
2796
|
+
parentToolCallId: z17.string().optional()
|
|
3037
2797
|
});
|
|
3038
|
-
var threadEventUserContentSchema =
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
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 =
|
|
3045
|
-
totalTokens:
|
|
3046
|
-
inputTokens:
|
|
3047
|
-
cachedInputTokens:
|
|
3048
|
-
outputTokens:
|
|
3049
|
-
reasoningOutputTokens:
|
|
3050
|
-
});
|
|
3051
|
-
var threadEventContextWindowUsageSchema =
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
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:
|
|
2820
|
+
modelContextWindow: z17.number().nullable()
|
|
3060
2821
|
});
|
|
3061
|
-
var threadEventWarningCategorySchema =
|
|
2822
|
+
var threadEventWarningCategorySchema = z17.enum([
|
|
3062
2823
|
"deprecation",
|
|
3063
2824
|
"config",
|
|
3064
2825
|
"general",
|
|
3065
2826
|
"compaction-skipped"
|
|
3066
2827
|
]);
|
|
3067
|
-
var providerRawEventSchema =
|
|
3068
|
-
jsonrpc:
|
|
3069
|
-
id:
|
|
3070
|
-
method:
|
|
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 =
|
|
3074
|
-
type:
|
|
3075
|
-
threadId:
|
|
3076
|
-
providerThreadId:
|
|
3077
|
-
providerId:
|
|
3078
|
-
rawType:
|
|
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:
|
|
3081
|
-
});
|
|
3082
|
-
var toolCallProgressEventSchema =
|
|
3083
|
-
type:
|
|
3084
|
-
threadId:
|
|
3085
|
-
providerThreadId:
|
|
3086
|
-
itemId:
|
|
3087
|
-
message:
|
|
3088
|
-
parentToolCallId:
|
|
3089
|
-
});
|
|
3090
|
-
var threadEventBackgroundTaskItemSchema =
|
|
3091
|
-
type:
|
|
3092
|
-
id:
|
|
3093
|
-
familyId:
|
|
3094
|
-
taskType:
|
|
3095
|
-
description:
|
|
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:
|
|
3099
|
-
workflowName:
|
|
2859
|
+
skipTranscript: z17.boolean(),
|
|
2860
|
+
workflowName: z17.string().optional(),
|
|
3100
2861
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
3101
2862
|
usage: backgroundTaskUsageSchema.optional(),
|
|
3102
|
-
summary:
|
|
3103
|
-
error:
|
|
3104
|
-
outputFile:
|
|
2863
|
+
summary: z17.string().optional(),
|
|
2864
|
+
error: z17.string().optional(),
|
|
2865
|
+
outputFile: z17.string().optional(),
|
|
3105
2866
|
...itemPresentationField,
|
|
3106
|
-
parentToolCallId:
|
|
2867
|
+
parentToolCallId: z17.string().optional()
|
|
3107
2868
|
});
|
|
3108
|
-
var threadEventItemSchema =
|
|
3109
|
-
|
|
3110
|
-
type:
|
|
3111
|
-
id:
|
|
3112
|
-
content:
|
|
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:
|
|
2875
|
+
parentToolCallId: z17.string().optional()
|
|
3115
2876
|
}).strict(),
|
|
3116
|
-
|
|
3117
|
-
type:
|
|
3118
|
-
id:
|
|
3119
|
-
text:
|
|
2877
|
+
z17.object({
|
|
2878
|
+
type: z17.literal("agentMessage"),
|
|
2879
|
+
id: z17.string(),
|
|
2880
|
+
text: z17.string(),
|
|
3120
2881
|
...itemPresentationField,
|
|
3121
|
-
parentToolCallId:
|
|
2882
|
+
parentToolCallId: z17.string().optional()
|
|
3122
2883
|
}),
|
|
3123
|
-
|
|
3124
|
-
type:
|
|
3125
|
-
id:
|
|
3126
|
-
command:
|
|
3127
|
-
cwd:
|
|
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:
|
|
3131
|
-
exitCode:
|
|
3132
|
-
durationMs:
|
|
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:
|
|
2896
|
+
parentToolCallId: z17.string().optional()
|
|
3136
2897
|
}),
|
|
3137
|
-
|
|
3138
|
-
type:
|
|
3139
|
-
id:
|
|
3140
|
-
changes:
|
|
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:
|
|
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
|
-
|
|
3153
|
-
type:
|
|
3154
|
-
id:
|
|
3155
|
-
server:
|
|
3156
|
-
tool:
|
|
3157
|
-
arguments:
|
|
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:
|
|
3160
|
-
error:
|
|
3161
|
-
durationMs:
|
|
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:
|
|
2925
|
+
parentToolCallId: z17.string().optional()
|
|
3165
2926
|
}),
|
|
3166
|
-
|
|
3167
|
-
type:
|
|
3168
|
-
id:
|
|
3169
|
-
summary:
|
|
3170
|
-
content:
|
|
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:
|
|
2933
|
+
parentToolCallId: z17.string().optional()
|
|
3173
2934
|
}),
|
|
3174
|
-
|
|
3175
|
-
type:
|
|
3176
|
-
id:
|
|
3177
|
-
text:
|
|
2935
|
+
z17.object({
|
|
2936
|
+
type: z17.literal("plan"),
|
|
2937
|
+
id: z17.string(),
|
|
2938
|
+
text: z17.string(),
|
|
3178
2939
|
...itemPresentationField,
|
|
3179
|
-
parentToolCallId:
|
|
2940
|
+
parentToolCallId: z17.string().optional()
|
|
3180
2941
|
}),
|
|
3181
2942
|
threadEventPlanStepsItemSchema,
|
|
3182
|
-
|
|
3183
|
-
type:
|
|
3184
|
-
id:
|
|
2943
|
+
z17.object({
|
|
2944
|
+
type: z17.literal("contextCompaction"),
|
|
2945
|
+
id: z17.string(),
|
|
3185
2946
|
...itemPresentationField,
|
|
3186
|
-
parentToolCallId:
|
|
2947
|
+
parentToolCallId: z17.string().optional()
|
|
3187
2948
|
}),
|
|
3188
2949
|
threadEventBackgroundTaskItemSchema,
|
|
3189
2950
|
threadEventDelegationItemSchema,
|
|
3190
2951
|
threadEventExtensionItemSchema
|
|
3191
2952
|
]);
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
type:
|
|
3195
|
-
threadId:
|
|
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
|
-
|
|
3198
|
-
type:
|
|
3199
|
-
threadId:
|
|
3200
|
-
providerThreadId:
|
|
2968
|
+
z17.object({
|
|
2969
|
+
type: z17.literal("thread/identity"),
|
|
2970
|
+
threadId: z17.string(),
|
|
2971
|
+
providerThreadId: z17.string()
|
|
3201
2972
|
}),
|
|
3202
|
-
|
|
3203
|
-
type:
|
|
3204
|
-
threadId:
|
|
3205
|
-
providerThreadId:
|
|
3206
|
-
parentToolCallId:
|
|
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
|
-
|
|
3209
|
-
type:
|
|
3210
|
-
threadId:
|
|
3211
|
-
providerThreadId:
|
|
2979
|
+
z17.object({
|
|
2980
|
+
type: z17.literal("turn/completed"),
|
|
2981
|
+
threadId: z17.string(),
|
|
2982
|
+
providerThreadId: z17.string().nullable(),
|
|
3212
2983
|
status: threadEventTurnStatusSchema,
|
|
3213
|
-
error:
|
|
3214
|
-
providerCheckpointId:
|
|
2984
|
+
error: z17.object({ message: z17.string() }).optional(),
|
|
2985
|
+
providerCheckpointId: z17.string().min(1).optional()
|
|
3215
2986
|
}),
|
|
3216
|
-
|
|
3217
|
-
type:
|
|
3218
|
-
threadId:
|
|
3219
|
-
providerThreadId:
|
|
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
|
-
|
|
3224
|
-
type:
|
|
3225
|
-
threadId:
|
|
3226
|
-
providerThreadId:
|
|
3227
|
-
threadName:
|
|
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
|
-
|
|
3230
|
-
type:
|
|
3231
|
-
threadId:
|
|
3232
|
-
providerThreadId:
|
|
3000
|
+
z17.object({
|
|
3001
|
+
type: z17.literal("thread/compacted"),
|
|
3002
|
+
threadId: z17.string(),
|
|
3003
|
+
providerThreadId: z17.string()
|
|
3233
3004
|
}),
|
|
3234
|
-
|
|
3235
|
-
type:
|
|
3236
|
-
threadId:
|
|
3237
|
-
providerThreadId:
|
|
3005
|
+
z17.object({
|
|
3006
|
+
type: z17.literal("thread/context/cleared"),
|
|
3007
|
+
threadId: z17.string(),
|
|
3008
|
+
providerThreadId: z17.string()
|
|
3238
3009
|
}),
|
|
3239
|
-
|
|
3240
|
-
type:
|
|
3241
|
-
threadId:
|
|
3242
|
-
providerThreadId:
|
|
3243
|
-
objective:
|
|
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:
|
|
3246
|
-
tokensUsed:
|
|
3247
|
-
timeUsedSeconds:
|
|
3016
|
+
tokenBudget: z17.number().nullable(),
|
|
3017
|
+
tokensUsed: z17.number(),
|
|
3018
|
+
timeUsedSeconds: z17.number()
|
|
3248
3019
|
}),
|
|
3249
|
-
|
|
3250
|
-
type:
|
|
3251
|
-
threadId:
|
|
3252
|
-
providerThreadId:
|
|
3020
|
+
z17.object({
|
|
3021
|
+
type: z17.literal("thread/goal/cleared"),
|
|
3022
|
+
threadId: z17.string(),
|
|
3023
|
+
providerThreadId: z17.string()
|
|
3253
3024
|
}),
|
|
3254
|
-
|
|
3255
|
-
type:
|
|
3256
|
-
threadId:
|
|
3257
|
-
providerThreadId:
|
|
3025
|
+
z17.object({
|
|
3026
|
+
type: z17.literal("item/started"),
|
|
3027
|
+
threadId: z17.string(),
|
|
3028
|
+
providerThreadId: z17.string(),
|
|
3258
3029
|
item: threadEventItemSchema
|
|
3259
3030
|
}),
|
|
3260
|
-
|
|
3261
|
-
type:
|
|
3262
|
-
threadId:
|
|
3263
|
-
providerThreadId:
|
|
3031
|
+
z17.object({
|
|
3032
|
+
type: z17.literal("item/completed"),
|
|
3033
|
+
threadId: z17.string(),
|
|
3034
|
+
providerThreadId: z17.string(),
|
|
3264
3035
|
item: threadEventItemSchema
|
|
3265
3036
|
}),
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
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
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
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
|
-
|
|
3325
|
-
type:
|
|
3326
|
-
threadId:
|
|
3327
|
-
providerThreadId:
|
|
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
|
-
|
|
3331
|
-
type:
|
|
3332
|
-
threadId:
|
|
3333
|
-
providerThreadId:
|
|
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
|
-
|
|
3337
|
-
type:
|
|
3338
|
-
threadId:
|
|
3339
|
-
providerThreadId:
|
|
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
|
-
|
|
3343
|
-
type:
|
|
3344
|
-
threadId:
|
|
3345
|
-
providerThreadId:
|
|
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
|
-
|
|
3349
|
-
type:
|
|
3350
|
-
threadId:
|
|
3351
|
-
providerThreadId:
|
|
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
|
-
|
|
3355
|
-
type:
|
|
3356
|
-
threadId:
|
|
3357
|
-
providerThreadId:
|
|
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
|
-
|
|
3361
|
-
type:
|
|
3362
|
-
threadId:
|
|
3363
|
-
providerThreadId:
|
|
3364
|
-
plan:
|
|
3365
|
-
explanation:
|
|
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
|
-
|
|
3368
|
-
type:
|
|
3369
|
-
threadId:
|
|
3370
|
-
providerThreadId:
|
|
3371
|
-
diff:
|
|
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
|
-
|
|
3374
|
-
type:
|
|
3375
|
-
threadId:
|
|
3376
|
-
providerThreadId:
|
|
3377
|
-
message:
|
|
3378
|
-
detail:
|
|
3379
|
-
willRetry:
|
|
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
|
-
|
|
3383
|
-
type:
|
|
3384
|
-
threadId:
|
|
3385
|
-
providerThreadId:
|
|
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
|
-
|
|
3389
|
-
type:
|
|
3390
|
-
threadId:
|
|
3391
|
-
providerThreadId:
|
|
3392
|
-
entries:
|
|
3393
|
-
|
|
3394
|
-
name:
|
|
3395
|
-
source:
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
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:
|
|
3401
|
-
|
|
3402
|
-
|
|
3136
|
+
value: z17.union([
|
|
3137
|
+
z17.string(),
|
|
3138
|
+
z17.object({ masked: z17.literal(true) }).strict()
|
|
3403
3139
|
]),
|
|
3404
|
-
reason:
|
|
3140
|
+
reason: z17.string().optional()
|
|
3405
3141
|
}).strict()
|
|
3406
3142
|
)
|
|
3407
3143
|
}),
|
|
3408
|
-
|
|
3409
|
-
type:
|
|
3410
|
-
threadId:
|
|
3411
|
-
providerThreadId:
|
|
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
|
-
|
|
3416
|
-
type:
|
|
3417
|
-
threadId:
|
|
3418
|
-
providerThreadId:
|
|
3151
|
+
z17.object({
|
|
3152
|
+
type: z17.literal("provider/warning"),
|
|
3153
|
+
threadId: z17.string(),
|
|
3154
|
+
providerThreadId: z17.string(),
|
|
3419
3155
|
category: threadEventWarningCategorySchema,
|
|
3420
|
-
summary:
|
|
3421
|
-
details:
|
|
3156
|
+
summary: z17.string().optional(),
|
|
3157
|
+
details: z17.string().optional()
|
|
3422
3158
|
}),
|
|
3423
|
-
|
|
3424
|
-
type:
|
|
3425
|
-
threadId:
|
|
3426
|
-
providerThreadId:
|
|
3427
|
-
originalModel:
|
|
3428
|
-
fallbackModel:
|
|
3429
|
-
reason:
|
|
3430
|
-
message:
|
|
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 =
|
|
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 =
|
|
3444
|
-
|
|
3445
|
-
type:
|
|
3446
|
-
threadId:
|
|
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
|
-
|
|
3449
|
-
type:
|
|
3450
|
-
threadId:
|
|
3184
|
+
z17.object({
|
|
3185
|
+
type: z17.literal("client/turn/requested"),
|
|
3186
|
+
threadId: z17.string()
|
|
3451
3187
|
}).merge(turnRequestEventDataSchema),
|
|
3452
|
-
|
|
3453
|
-
type:
|
|
3454
|
-
threadId:
|
|
3188
|
+
z17.object({
|
|
3189
|
+
type: z17.literal("client/turn/rejected"),
|
|
3190
|
+
threadId: z17.string()
|
|
3455
3191
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
3456
|
-
|
|
3457
|
-
type:
|
|
3458
|
-
threadId:
|
|
3192
|
+
z17.object({
|
|
3193
|
+
type: z17.literal("client/turn/start"),
|
|
3194
|
+
threadId: z17.string()
|
|
3459
3195
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
3460
|
-
|
|
3461
|
-
type:
|
|
3462
|
-
threadId:
|
|
3196
|
+
z17.object({
|
|
3197
|
+
type: z17.literal("system/error"),
|
|
3198
|
+
threadId: z17.string()
|
|
3463
3199
|
}).merge(systemErrorEventDataSchema),
|
|
3464
|
-
|
|
3465
|
-
type:
|
|
3466
|
-
threadId:
|
|
3200
|
+
z17.object({
|
|
3201
|
+
type: z17.literal("system/manager/user_message"),
|
|
3202
|
+
threadId: z17.string()
|
|
3467
3203
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
3468
|
-
|
|
3469
|
-
type:
|
|
3470
|
-
threadId:
|
|
3204
|
+
z17.object({
|
|
3205
|
+
type: z17.literal("system/thread/interrupted"),
|
|
3206
|
+
threadId: z17.string()
|
|
3471
3207
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
3472
|
-
|
|
3473
|
-
type:
|
|
3474
|
-
threadId:
|
|
3208
|
+
z17.object({
|
|
3209
|
+
type: z17.literal("system/operation"),
|
|
3210
|
+
threadId: z17.string()
|
|
3475
3211
|
}).merge(systemOperationEventDataSchema),
|
|
3476
|
-
|
|
3477
|
-
type:
|
|
3478
|
-
threadId:
|
|
3212
|
+
z17.object({
|
|
3213
|
+
type: z17.literal("system/interaction/lifecycle"),
|
|
3214
|
+
threadId: z17.string()
|
|
3479
3215
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
threadId:
|
|
3216
|
+
z17.object({
|
|
3217
|
+
type: z17.literal("system/permissionGrant/lifecycle"),
|
|
3218
|
+
threadId: z17.string()
|
|
3483
3219
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
3484
|
-
|
|
3485
|
-
type:
|
|
3486
|
-
threadId:
|
|
3220
|
+
z17.object({
|
|
3221
|
+
type: z17.literal("system/userQuestion/lifecycle"),
|
|
3222
|
+
threadId: z17.string()
|
|
3487
3223
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
3488
|
-
|
|
3489
|
-
type:
|
|
3490
|
-
threadId:
|
|
3224
|
+
z17.object({
|
|
3225
|
+
type: z17.literal("system/thread-provisioning"),
|
|
3226
|
+
threadId: z17.string()
|
|
3491
3227
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
3492
|
-
|
|
3493
|
-
type:
|
|
3494
|
-
threadId:
|
|
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 =
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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 =
|
|
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
|
|
3290
|
+
import { z as z18 } from "zod";
|
|
3555
3291
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
3556
|
-
var providerForkSchema =
|
|
3292
|
+
var providerForkSchema = z18.enum(PROVIDER_FORK_VALUES);
|
|
3557
3293
|
|
|
3558
3294
|
// ../domain/src/provider-types.ts
|
|
3559
|
-
import { z as
|
|
3560
|
-
var modelReasoningEffortSchema =
|
|
3295
|
+
import { z as z19 } from "zod";
|
|
3296
|
+
var modelReasoningEffortSchema = z19.object({
|
|
3561
3297
|
reasoningEffort: reasoningLevelSchema,
|
|
3562
|
-
description:
|
|
3563
|
-
});
|
|
3564
|
-
var availableModelSchema =
|
|
3565
|
-
id:
|
|
3566
|
-
model:
|
|
3567
|
-
displayName:
|
|
3568
|
-
routeProviderId:
|
|
3569
|
-
description:
|
|
3570
|
-
supportedReasoningEfforts:
|
|
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:
|
|
3573
|
-
});
|
|
3574
|
-
var providerModelCatalogScopeSchema =
|
|
3575
|
-
var providerCapabilitiesSchema =
|
|
3576
|
-
supportsThreadArchive:
|
|
3577
|
-
supportsThreadRename:
|
|
3578
|
-
supportsServiceTier:
|
|
3579
|
-
supportsNativeUserQuestion:
|
|
3580
|
-
supportsFork:
|
|
3581
|
-
supportsSessionRewind:
|
|
3582
|
-
permissionModes:
|
|
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 =
|
|
3321
|
+
var providerComposerCommandSchema = z19.object({
|
|
3586
3322
|
trigger: promptMentionCommandTriggerSchema,
|
|
3587
|
-
name:
|
|
3588
|
-
trailingText:
|
|
3323
|
+
name: z19.string().min(1).regex(/^[^\s/$]+$/u),
|
|
3324
|
+
trailingText: z19.string().regex(/^\s*$/u)
|
|
3589
3325
|
});
|
|
3590
|
-
var providerComposerActionSchema =
|
|
3591
|
-
|
|
3592
|
-
kind:
|
|
3326
|
+
var providerComposerActionSchema = z19.discriminatedUnion("kind", [
|
|
3327
|
+
z19.object({
|
|
3328
|
+
kind: z19.literal("skills"),
|
|
3593
3329
|
trigger: promptMentionCommandTriggerSchema
|
|
3594
3330
|
}),
|
|
3595
|
-
|
|
3596
|
-
kind:
|
|
3331
|
+
z19.object({
|
|
3332
|
+
kind: z19.literal("plan"),
|
|
3597
3333
|
command: providerComposerCommandSchema
|
|
3598
3334
|
}),
|
|
3599
|
-
|
|
3600
|
-
kind:
|
|
3335
|
+
z19.object({
|
|
3336
|
+
kind: z19.literal("goal"),
|
|
3601
3337
|
command: providerComposerCommandSchema
|
|
3602
3338
|
})
|
|
3603
3339
|
]);
|
|
3604
|
-
var providerStringsSchema =
|
|
3605
|
-
signInHint:
|
|
3606
|
-
expiredHint:
|
|
3607
|
-
installUrl:
|
|
3608
|
-
brandPrefix:
|
|
3609
|
-
planModeCopy:
|
|
3610
|
-
iconTint:
|
|
3611
|
-
});
|
|
3612
|
-
var providerOptionDescriptorSchema =
|
|
3613
|
-
id:
|
|
3614
|
-
label:
|
|
3615
|
-
description:
|
|
3616
|
-
});
|
|
3617
|
-
var providerExtensionKindInfoSchema =
|
|
3618
|
-
item:
|
|
3619
|
-
state:
|
|
3620
|
-
});
|
|
3621
|
-
var providerExtensionKindsSchema =
|
|
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 =
|
|
3626
|
-
id:
|
|
3627
|
-
pluginId:
|
|
3628
|
-
displayName:
|
|
3629
|
-
family:
|
|
3630
|
-
icon:
|
|
3631
|
-
logoUrl:
|
|
3632
|
-
maintenance:
|
|
3633
|
-
health:
|
|
3634
|
-
usage:
|
|
3635
|
-
installation:
|
|
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:
|
|
3639
|
-
available:
|
|
3374
|
+
composerActions: z19.array(providerComposerActionSchema),
|
|
3375
|
+
available: z19.boolean(),
|
|
3640
3376
|
strings: providerStringsSchema.optional(),
|
|
3641
|
-
serviceTiers:
|
|
3642
|
-
reasoningLevels:
|
|
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 =
|
|
3653
|
-
var toolCallOutputItemSchema =
|
|
3654
|
-
|
|
3655
|
-
type:
|
|
3656
|
-
text:
|
|
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
|
-
|
|
3659
|
-
type:
|
|
3660
|
-
imageUrl:
|
|
3394
|
+
z19.object({
|
|
3395
|
+
type: z19.literal("inputImage"),
|
|
3396
|
+
imageUrl: z19.string()
|
|
3661
3397
|
})
|
|
3662
3398
|
]);
|
|
3663
|
-
var toolCallRequestSchema =
|
|
3664
|
-
requestId:
|
|
3665
|
-
threadId:
|
|
3666
|
-
providerThreadId:
|
|
3667
|
-
turnId:
|
|
3668
|
-
callId:
|
|
3669
|
-
tool:
|
|
3670
|
-
arguments:
|
|
3671
|
-
});
|
|
3672
|
-
var toolCallResponseSchema =
|
|
3673
|
-
contentItems:
|
|
3674
|
-
success:
|
|
3675
|
-
});
|
|
3676
|
-
var dynamicToolSchema =
|
|
3677
|
-
name:
|
|
3678
|
-
description:
|
|
3679
|
-
inputSchema:
|
|
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
|
|
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;
|
|
@@ -3862,9 +3870,11 @@ function versionFrom(value) {
|
|
|
3862
3870
|
}
|
|
3863
3871
|
async function readCliVersion(command) {
|
|
3864
3872
|
try {
|
|
3865
|
-
const
|
|
3873
|
+
const probe = execFileAsync(command, ["--version"], {
|
|
3866
3874
|
timeout: CLI_PROBE_TIMEOUT_MS
|
|
3867
3875
|
});
|
|
3876
|
+
probe.child.stdin?.end();
|
|
3877
|
+
const { stdout, stderr } = await probe;
|
|
3868
3878
|
return `${stdout}
|
|
3869
3879
|
${stderr}`.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/u)?.[0] ?? null;
|
|
3870
3880
|
} catch {
|
|
@@ -3928,8 +3938,8 @@ function firstLine(value) {
|
|
|
3928
3938
|
function npmGlobalPackageVersion(value, npmPackage) {
|
|
3929
3939
|
if (value === null) return null;
|
|
3930
3940
|
try {
|
|
3931
|
-
const parsed =
|
|
3932
|
-
dependencies:
|
|
3941
|
+
const parsed = z23.object({
|
|
3942
|
+
dependencies: z23.record(z23.string(), z23.object({ version: z23.string().min(1) })).default({})
|
|
3933
3943
|
}).safeParse(JSON.parse(value));
|
|
3934
3944
|
return parsed.success ? parsed.data.dependencies[npmPackage]?.version ?? null : null;
|
|
3935
3945
|
} catch {
|
|
@@ -3965,18 +3975,6 @@ function clampPercent(value) {
|
|
|
3965
3975
|
);
|
|
3966
3976
|
}
|
|
3967
3977
|
|
|
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
3978
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility.ts
|
|
3981
3979
|
function createProviderVisibilityMetadata(args) {
|
|
3982
3980
|
return {
|
|
@@ -3989,10 +3987,10 @@ function createProviderVisibilityMetadata(args) {
|
|
|
3989
3987
|
}
|
|
3990
3988
|
|
|
3991
3989
|
// ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
|
|
3992
|
-
import { z as
|
|
3990
|
+
import { z as z25 } from "zod";
|
|
3993
3991
|
|
|
3994
3992
|
// ../provider-bridge-protocol/src/errors.ts
|
|
3995
|
-
import { z as
|
|
3993
|
+
import { z as z24 } from "zod";
|
|
3996
3994
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
3997
3995
|
INVALID_PARAMS: -32602,
|
|
3998
3996
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -4001,12 +3999,12 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4001
3999
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4002
4000
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4003
4001
|
};
|
|
4004
|
-
var providerRecoveryHintSchema =
|
|
4002
|
+
var providerRecoveryHintSchema = z24.object({
|
|
4005
4003
|
kind: providerRecoveryKindSchema,
|
|
4006
|
-
message:
|
|
4007
|
-
retryable:
|
|
4004
|
+
message: z24.string().min(1),
|
|
4005
|
+
retryable: z24.boolean()
|
|
4008
4006
|
});
|
|
4009
|
-
var bridgeErrorDataSchema =
|
|
4007
|
+
var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4010
4008
|
|
|
4011
4009
|
// ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
|
|
4012
4010
|
var JSON_RPC_INVALID_PARAMS_CODE = -32602;
|
|
@@ -4024,7 +4022,7 @@ var ProviderResponseEncodeError = class extends Error {
|
|
|
4024
4022
|
this.name = "ProviderResponseEncodeError";
|
|
4025
4023
|
}
|
|
4026
4024
|
};
|
|
4027
|
-
var ignoredJsonRpcResultSchema =
|
|
4025
|
+
var ignoredJsonRpcResultSchema = z25.unknown();
|
|
4028
4026
|
|
|
4029
4027
|
// ../provider-bridge-protocol/src/version.ts
|
|
4030
4028
|
var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
@@ -4032,66 +4030,66 @@ var THREAD_DELTA_GRAMMAR_V2 = PROVIDER_BRIDGE_PROTOCOL_VERSION;
|
|
|
4032
4030
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
4033
4031
|
|
|
4034
4032
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
4035
|
-
import { z as
|
|
4036
|
-
var bridgeGrammarVersionsSchema =
|
|
4033
|
+
import { z as z26 } from "zod";
|
|
4034
|
+
var bridgeGrammarVersionsSchema = z26.tuple([z26.number().int().positive(), z26.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
4037
4035
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
4038
4036
|
});
|
|
4039
|
-
var bridgeSteerModeSchema =
|
|
4040
|
-
var bridgeCapabilitiesSchema =
|
|
4041
|
-
sessionRestore:
|
|
4042
|
-
threadArchive:
|
|
4043
|
-
threadRename:
|
|
4044
|
-
threadGoalClear:
|
|
4037
|
+
var bridgeSteerModeSchema = z26.enum(["inject", "queue"]);
|
|
4038
|
+
var bridgeCapabilitiesSchema = z26.object({
|
|
4039
|
+
sessionRestore: z26.boolean().default(false),
|
|
4040
|
+
threadArchive: z26.boolean().default(false),
|
|
4041
|
+
threadRename: z26.boolean().default(false),
|
|
4042
|
+
threadGoalClear: z26.boolean().default(false),
|
|
4045
4043
|
fork: providerForkSchema.default("none"),
|
|
4046
|
-
approvalEnforcedBy:
|
|
4044
|
+
approvalEnforcedBy: z26.enum(["runtime", "provider"]).default("runtime"),
|
|
4047
4045
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4048
4046
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4049
4047
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4050
4048
|
]),
|
|
4051
4049
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4052
|
-
skills:
|
|
4050
|
+
skills: z26.object({ configure: z26.boolean().default(false) }).default({ configure: false })
|
|
4053
4051
|
}).passthrough();
|
|
4054
|
-
var initializeParamsSchema =
|
|
4055
|
-
protocolVersion:
|
|
4056
|
-
client:
|
|
4052
|
+
var initializeParamsSchema = z26.object({
|
|
4053
|
+
protocolVersion: z26.number().int().positive(),
|
|
4054
|
+
client: z26.object({ name: z26.string().min(1), version: z26.string().min(1) }),
|
|
4057
4055
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4058
4056
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4059
4057
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4060
4058
|
])
|
|
4061
4059
|
}).passthrough();
|
|
4062
|
-
var initializeResultSchema =
|
|
4063
|
-
protocolVersion:
|
|
4064
|
-
capabilities:
|
|
4060
|
+
var initializeResultSchema = z26.object({
|
|
4061
|
+
protocolVersion: z26.number().int().positive(),
|
|
4062
|
+
capabilities: z26.preprocess(
|
|
4065
4063
|
(value) => value ?? {},
|
|
4066
4064
|
bridgeCapabilitiesSchema
|
|
4067
4065
|
)
|
|
4068
4066
|
}).passthrough();
|
|
4069
4067
|
|
|
4070
4068
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
4071
|
-
import { z as
|
|
4072
|
-
var bridgeExecutionOptionsSchema =
|
|
4073
|
-
model:
|
|
4069
|
+
import { z as z27 } from "zod";
|
|
4070
|
+
var bridgeExecutionOptionsSchema = z27.object({
|
|
4071
|
+
model: z27.string().min(1).optional(),
|
|
4074
4072
|
serviceTier: serviceTierSchema.optional(),
|
|
4075
4073
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4076
4074
|
promptMode: promptModeSchema.optional(),
|
|
4077
|
-
instructions:
|
|
4078
|
-
envVars:
|
|
4079
|
-
providerOptions:
|
|
4075
|
+
instructions: z27.string().optional(),
|
|
4076
|
+
envVars: z27.record(z27.string(), z27.string()).optional(),
|
|
4077
|
+
providerOptions: z27.record(z27.string(), z27.unknown()).optional()
|
|
4080
4078
|
}).and(runtimePermissionPolicySchema);
|
|
4081
4079
|
|
|
4082
4080
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
4083
|
-
import { z as
|
|
4084
|
-
var providerMaintenanceParamsSchema =
|
|
4085
|
-
providerId:
|
|
4086
|
-
cwd:
|
|
4087
|
-
providerOptions:
|
|
4081
|
+
import { z as z28 } from "zod";
|
|
4082
|
+
var providerMaintenanceParamsSchema = z28.object({
|
|
4083
|
+
providerId: z28.string().min(1),
|
|
4084
|
+
cwd: z28.string().min(1).optional(),
|
|
4085
|
+
providerOptions: z28.record(z28.string(), z28.unknown()).optional()
|
|
4088
4086
|
}).passthrough();
|
|
4089
|
-
var providerInstallationRequirementSchema =
|
|
4087
|
+
var providerInstallationRequirementSchema = z28.enum(["thread_rewind"]);
|
|
4090
4088
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4091
4089
|
requirement: providerInstallationRequirementSchema.optional()
|
|
4092
4090
|
});
|
|
4093
|
-
var providerHealthSchema =
|
|
4094
|
-
status:
|
|
4091
|
+
var providerHealthSchema = z28.object({
|
|
4092
|
+
status: z28.enum([
|
|
4095
4093
|
"ready",
|
|
4096
4094
|
"not_installed",
|
|
4097
4095
|
"unauthenticated",
|
|
@@ -4099,114 +4097,114 @@ var providerHealthSchema = z27.object({
|
|
|
4099
4097
|
"unsupported_version",
|
|
4100
4098
|
"unknown"
|
|
4101
4099
|
]),
|
|
4102
|
-
statusMessage:
|
|
4103
|
-
accountEmail:
|
|
4104
|
-
planLabel:
|
|
4105
|
-
installedVersion:
|
|
4106
|
-
minimumSupportedVersion:
|
|
4107
|
-
canInstall:
|
|
4108
|
-
canUpdate:
|
|
4109
|
-
loginCommand:
|
|
4100
|
+
statusMessage: z28.string().min(1).nullable(),
|
|
4101
|
+
accountEmail: z28.string().nullable(),
|
|
4102
|
+
planLabel: z28.string().min(1).nullable(),
|
|
4103
|
+
installedVersion: z28.string().min(1).nullable(),
|
|
4104
|
+
minimumSupportedVersion: z28.string().min(1).nullable(),
|
|
4105
|
+
canInstall: z28.boolean(),
|
|
4106
|
+
canUpdate: z28.boolean(),
|
|
4107
|
+
loginCommand: z28.string().min(1).nullable()
|
|
4110
4108
|
}).passthrough();
|
|
4111
|
-
var providerUsageWindowSchema =
|
|
4112
|
-
label:
|
|
4113
|
-
usedPercent:
|
|
4114
|
-
resetsAt:
|
|
4115
|
-
cost:
|
|
4116
|
-
usedUsdCents:
|
|
4117
|
-
limitUsdCents:
|
|
4109
|
+
var providerUsageWindowSchema = z28.object({
|
|
4110
|
+
label: z28.string().min(1),
|
|
4111
|
+
usedPercent: z28.number().min(0).max(100),
|
|
4112
|
+
resetsAt: z28.string().min(1).nullable(),
|
|
4113
|
+
cost: z28.object({
|
|
4114
|
+
usedUsdCents: z28.number().int().nonnegative(),
|
|
4115
|
+
limitUsdCents: z28.number().int().positive()
|
|
4118
4116
|
}).optional()
|
|
4119
4117
|
}).passthrough();
|
|
4120
|
-
var providerUsageSchema =
|
|
4121
|
-
|
|
4122
|
-
status:
|
|
4123
|
-
accountEmail:
|
|
4124
|
-
planLabel:
|
|
4125
|
-
windows:
|
|
4118
|
+
var providerUsageSchema = z28.discriminatedUnion("status", [
|
|
4119
|
+
z28.object({
|
|
4120
|
+
status: z28.literal("ok"),
|
|
4121
|
+
accountEmail: z28.string().email().nullable(),
|
|
4122
|
+
planLabel: z28.string().min(1).nullable(),
|
|
4123
|
+
windows: z28.array(providerUsageWindowSchema)
|
|
4126
4124
|
}).passthrough(),
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
status:
|
|
4132
|
-
message:
|
|
4133
|
-
planLabel:
|
|
4134
|
-
accountEmail:
|
|
4125
|
+
z28.object({ status: z28.literal("not_installed") }).passthrough(),
|
|
4126
|
+
z28.object({ status: z28.literal("unauthenticated") }).passthrough(),
|
|
4127
|
+
z28.object({ status: z28.literal("expired") }).passthrough(),
|
|
4128
|
+
z28.object({
|
|
4129
|
+
status: z28.literal("error"),
|
|
4130
|
+
message: z28.string().min(1),
|
|
4131
|
+
planLabel: z28.string().min(1).nullable().default(null),
|
|
4132
|
+
accountEmail: z28.string().nullable().default(null)
|
|
4135
4133
|
}).passthrough()
|
|
4136
4134
|
]);
|
|
4137
|
-
var providerHealthResultSchema =
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
supported:
|
|
4135
|
+
var providerHealthResultSchema = z28.discriminatedUnion("supported", [
|
|
4136
|
+
z28.object({ supported: z28.literal(false) }).passthrough(),
|
|
4137
|
+
z28.object({
|
|
4138
|
+
supported: z28.literal(true),
|
|
4141
4139
|
health: providerHealthSchema
|
|
4142
4140
|
}).passthrough()
|
|
4143
4141
|
]);
|
|
4144
|
-
var providerUsageResultSchema =
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
supported:
|
|
4142
|
+
var providerUsageResultSchema = z28.discriminatedUnion("supported", [
|
|
4143
|
+
z28.object({ supported: z28.literal(false) }).passthrough(),
|
|
4144
|
+
z28.object({
|
|
4145
|
+
supported: z28.literal(true),
|
|
4148
4146
|
usage: providerUsageSchema
|
|
4149
4147
|
}).passthrough()
|
|
4150
4148
|
]);
|
|
4151
|
-
var providerInstallationActionKindSchema =
|
|
4149
|
+
var providerInstallationActionKindSchema = z28.enum([
|
|
4152
4150
|
"install",
|
|
4153
4151
|
"update"
|
|
4154
4152
|
]);
|
|
4155
|
-
var providerInstallationActionSchema =
|
|
4153
|
+
var providerInstallationActionSchema = z28.object({
|
|
4156
4154
|
kind: providerInstallationActionKindSchema,
|
|
4157
|
-
label:
|
|
4158
|
-
command:
|
|
4155
|
+
label: z28.enum(["Install", "Update"]),
|
|
4156
|
+
command: z28.string().min(1)
|
|
4159
4157
|
}).passthrough();
|
|
4160
|
-
var providerInstallationSourceSchema =
|
|
4158
|
+
var providerInstallationSourceSchema = z28.enum([
|
|
4161
4159
|
"notInstalled",
|
|
4162
4160
|
"npmGlobal",
|
|
4163
4161
|
"external"
|
|
4164
4162
|
]);
|
|
4165
|
-
var providerInstallationStatusSchema =
|
|
4166
|
-
executableName:
|
|
4167
|
-
executablePath:
|
|
4168
|
-
installed:
|
|
4163
|
+
var providerInstallationStatusSchema = z28.object({
|
|
4164
|
+
executableName: z28.string().min(1),
|
|
4165
|
+
executablePath: z28.string().min(1).nullable(),
|
|
4166
|
+
installed: z28.boolean(),
|
|
4169
4167
|
installSource: providerInstallationSourceSchema,
|
|
4170
|
-
currentVersion:
|
|
4171
|
-
latestVersion:
|
|
4172
|
-
minimumSupportedVersion:
|
|
4173
|
-
npmPackageName:
|
|
4174
|
-
npmGlobalPackageVersion:
|
|
4168
|
+
currentVersion: z28.string().min(1).nullable(),
|
|
4169
|
+
latestVersion: z28.string().min(1).nullable(),
|
|
4170
|
+
minimumSupportedVersion: z28.string().min(1).nullable(),
|
|
4171
|
+
npmPackageName: z28.string().min(1).nullable(),
|
|
4172
|
+
npmGlobalPackageVersion: z28.string().min(1).nullable(),
|
|
4175
4173
|
installAction: providerInstallationActionSchema.nullable(),
|
|
4176
|
-
needsUpdate:
|
|
4177
|
-
versionUnsupported:
|
|
4174
|
+
needsUpdate: z28.boolean(),
|
|
4175
|
+
versionUnsupported: z28.boolean()
|
|
4178
4176
|
}).passthrough();
|
|
4179
4177
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4180
4178
|
action: providerInstallationActionKindSchema
|
|
4181
4179
|
});
|
|
4182
|
-
var providerInstallationCommandSchema =
|
|
4183
|
-
command:
|
|
4184
|
-
args:
|
|
4185
|
-
displayCommand:
|
|
4180
|
+
var providerInstallationCommandSchema = z28.object({
|
|
4181
|
+
command: z28.string().min(1),
|
|
4182
|
+
args: z28.array(z28.string()).max(64),
|
|
4183
|
+
displayCommand: z28.string().min(1)
|
|
4186
4184
|
}).passthrough();
|
|
4187
|
-
var providerInstallationVerificationSchema =
|
|
4185
|
+
var providerInstallationVerificationSchema = z28.discriminatedUnion(
|
|
4188
4186
|
"kind",
|
|
4189
4187
|
[
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
kind:
|
|
4193
|
-
previousVersion:
|
|
4188
|
+
z28.object({ kind: z28.literal("installed") }).passthrough(),
|
|
4189
|
+
z28.object({
|
|
4190
|
+
kind: z28.literal("version_changed"),
|
|
4191
|
+
previousVersion: z28.string().min(1)
|
|
4194
4192
|
}).passthrough(),
|
|
4195
|
-
|
|
4196
|
-
kind:
|
|
4197
|
-
version:
|
|
4193
|
+
z28.object({
|
|
4194
|
+
kind: z28.literal("version_at_least"),
|
|
4195
|
+
version: z28.string().min(1)
|
|
4198
4196
|
}).passthrough()
|
|
4199
4197
|
]
|
|
4200
4198
|
);
|
|
4201
|
-
var providerInstallationRunResultSchema =
|
|
4199
|
+
var providerInstallationRunResultSchema = z28.discriminatedUnion(
|
|
4202
4200
|
"available",
|
|
4203
4201
|
[
|
|
4204
|
-
|
|
4205
|
-
available:
|
|
4206
|
-
message:
|
|
4202
|
+
z28.object({
|
|
4203
|
+
available: z28.literal(false),
|
|
4204
|
+
message: z28.string().min(1)
|
|
4207
4205
|
}).passthrough(),
|
|
4208
|
-
|
|
4209
|
-
available:
|
|
4206
|
+
z28.object({
|
|
4207
|
+
available: z28.literal(true),
|
|
4210
4208
|
command: providerInstallationCommandSchema,
|
|
4211
4209
|
verification: providerInstallationVerificationSchema
|
|
4212
4210
|
}).passthrough()
|
|
@@ -4214,7 +4212,7 @@ var providerInstallationRunResultSchema = z27.discriminatedUnion(
|
|
|
4214
4212
|
);
|
|
4215
4213
|
|
|
4216
4214
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4217
|
-
import { z as
|
|
4215
|
+
import { z as z29 } from "zod";
|
|
4218
4216
|
var BRIDGE_REQUEST_METHODS = {
|
|
4219
4217
|
initialize: "initialize",
|
|
4220
4218
|
modelList: "model/list",
|
|
@@ -4236,82 +4234,78 @@ var BRIDGE_REQUEST_METHODS = {
|
|
|
4236
4234
|
skillsConfigure: "skills/configure"
|
|
4237
4235
|
};
|
|
4238
4236
|
var sessionConstructionFields = {
|
|
4239
|
-
threadId:
|
|
4240
|
-
cwd:
|
|
4237
|
+
threadId: z29.string().min(1),
|
|
4238
|
+
cwd: z29.string().min(1),
|
|
4241
4239
|
options: bridgeExecutionOptionsSchema,
|
|
4242
|
-
dynamicTools:
|
|
4243
|
-
disallowedTools:
|
|
4240
|
+
dynamicTools: z29.array(dynamicToolSchema).optional(),
|
|
4241
|
+
disallowedTools: z29.array(z29.string().min(1)).optional(),
|
|
4244
4242
|
instructionMode: instructionModeSchema
|
|
4245
4243
|
};
|
|
4246
|
-
var modelListParamsSchema =
|
|
4247
|
-
var threadStartParamsSchema =
|
|
4244
|
+
var modelListParamsSchema = z29.object({ cwd: z29.string().min(1).optional() }).passthrough();
|
|
4245
|
+
var threadStartParamsSchema = z29.object({
|
|
4248
4246
|
...sessionConstructionFields,
|
|
4249
|
-
input:
|
|
4247
|
+
input: z29.array(promptInputSchema).optional()
|
|
4250
4248
|
}).passthrough();
|
|
4251
|
-
var threadResumeParamsSchema =
|
|
4249
|
+
var threadResumeParamsSchema = z29.object({
|
|
4252
4250
|
...sessionConstructionFields,
|
|
4253
|
-
providerThreadId:
|
|
4251
|
+
providerThreadId: z29.string().min(1)
|
|
4254
4252
|
}).passthrough();
|
|
4255
|
-
var threadForkParamsSchema =
|
|
4253
|
+
var threadForkParamsSchema = z29.object({
|
|
4256
4254
|
...sessionConstructionFields,
|
|
4257
|
-
sourceProviderThreadId:
|
|
4258
|
-
sourceProviderCheckpointId:
|
|
4255
|
+
sourceProviderThreadId: z29.string().min(1),
|
|
4256
|
+
sourceProviderCheckpointId: z29.string().min(1).optional()
|
|
4259
4257
|
}).passthrough();
|
|
4260
|
-
var threadStopParamsSchema =
|
|
4261
|
-
threadId:
|
|
4262
|
-
providerThreadId:
|
|
4263
|
-
intent:
|
|
4264
|
-
activeTurnId:
|
|
4258
|
+
var threadStopParamsSchema = z29.object({
|
|
4259
|
+
threadId: z29.string().min(1),
|
|
4260
|
+
providerThreadId: z29.string().min(1),
|
|
4261
|
+
intent: z29.enum(["interrupt", "release"]),
|
|
4262
|
+
activeTurnId: z29.string().min(1).nullable()
|
|
4265
4263
|
}).passthrough();
|
|
4266
|
-
var threadRefParams =
|
|
4267
|
-
threadId:
|
|
4268
|
-
providerThreadId:
|
|
4264
|
+
var threadRefParams = z29.object({
|
|
4265
|
+
threadId: z29.string().min(1),
|
|
4266
|
+
providerThreadId: z29.string().min(1)
|
|
4269
4267
|
}).passthrough();
|
|
4270
4268
|
var threadDiscardParamsSchema = threadRefParams;
|
|
4271
4269
|
var threadArchiveParamsSchema = threadRefParams;
|
|
4272
4270
|
var threadUnarchiveParamsSchema = threadRefParams;
|
|
4273
4271
|
var threadGoalClearParamsSchema = threadRefParams;
|
|
4274
|
-
var threadNameSetParamsSchema =
|
|
4275
|
-
threadId:
|
|
4276
|
-
providerThreadId:
|
|
4277
|
-
title:
|
|
4272
|
+
var threadNameSetParamsSchema = z29.object({
|
|
4273
|
+
threadId: z29.string().min(1),
|
|
4274
|
+
providerThreadId: z29.string().min(1),
|
|
4275
|
+
title: z29.string().min(1)
|
|
4278
4276
|
}).passthrough();
|
|
4279
4277
|
var turnInputFields = {
|
|
4280
|
-
threadId:
|
|
4281
|
-
providerThreadId:
|
|
4282
|
-
input:
|
|
4278
|
+
threadId: z29.string().min(1),
|
|
4279
|
+
providerThreadId: z29.string().min(1),
|
|
4280
|
+
input: z29.array(promptInputSchema),
|
|
4283
4281
|
clientRequestId: clientTurnRequestIdSchema,
|
|
4284
4282
|
options: bridgeExecutionOptionsSchema
|
|
4285
4283
|
};
|
|
4286
|
-
var turnStartParamsSchema =
|
|
4287
|
-
var turnSteerParamsSchema =
|
|
4284
|
+
var turnStartParamsSchema = z29.object(turnInputFields).passthrough();
|
|
4285
|
+
var turnSteerParamsSchema = z29.object({
|
|
4288
4286
|
...turnInputFields,
|
|
4289
|
-
expectedTurnId:
|
|
4287
|
+
expectedTurnId: z29.string().min(1)
|
|
4290
4288
|
}).passthrough();
|
|
4291
|
-
var skillsConfigureRootSchema =
|
|
4292
|
-
id:
|
|
4293
|
-
path:
|
|
4294
|
-
skills:
|
|
4295
|
-
|
|
4296
|
-
name:
|
|
4297
|
-
description:
|
|
4289
|
+
var skillsConfigureRootSchema = z29.object({
|
|
4290
|
+
id: z29.string().min(1),
|
|
4291
|
+
path: z29.string().min(1),
|
|
4292
|
+
skills: z29.array(
|
|
4293
|
+
z29.object({
|
|
4294
|
+
name: z29.string().min(1),
|
|
4295
|
+
description: z29.string()
|
|
4298
4296
|
}).passthrough()
|
|
4299
4297
|
)
|
|
4300
4298
|
}).passthrough();
|
|
4301
|
-
var skillsConfigureParamsSchema =
|
|
4302
|
-
roots:
|
|
4299
|
+
var skillsConfigureParamsSchema = z29.object({
|
|
4300
|
+
roots: z29.array(skillsConfigureRootSchema)
|
|
4303
4301
|
}).passthrough();
|
|
4304
|
-
var threadIdentityResultSchema =
|
|
4305
|
-
providerThreadId:
|
|
4306
|
-
sessionRestorable:
|
|
4307
|
-
}).passthrough();
|
|
4308
|
-
var modelListResultSchema = z28.object({
|
|
4309
|
-
models: z28.array(availableModelSchema),
|
|
4310
|
-
selectedOnlyModels: z28.array(availableModelSchema).default([])
|
|
4302
|
+
var threadIdentityResultSchema = z29.object({
|
|
4303
|
+
providerThreadId: z29.string().min(1),
|
|
4304
|
+
sessionRestorable: z29.boolean().optional()
|
|
4311
4305
|
}).passthrough();
|
|
4312
4306
|
|
|
4313
4307
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4314
|
-
import { z as
|
|
4308
|
+
import { z as z30 } from "zod";
|
|
4315
4309
|
var BRIDGE_NOTIFICATION_METHODS = {
|
|
4316
4310
|
threadIdentity: "thread/identity",
|
|
4317
4311
|
sessionReplaced: "session/replaced",
|
|
@@ -4319,64 +4313,26 @@ var BRIDGE_NOTIFICATION_METHODS = {
|
|
|
4319
4313
|
providerRecovery: "provider/recovery",
|
|
4320
4314
|
error: "error"
|
|
4321
4315
|
};
|
|
4322
|
-
var threadIdentityNotificationSchema =
|
|
4323
|
-
threadId:
|
|
4324
|
-
providerThreadId:
|
|
4325
|
-
sessionRestorable:
|
|
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
|
|
4316
|
+
var threadIdentityNotificationSchema = z30.object({
|
|
4317
|
+
threadId: z30.string().min(1),
|
|
4318
|
+
providerThreadId: z30.string().min(1),
|
|
4319
|
+
sessionRestorable: z30.boolean().optional()
|
|
4342
4320
|
}).passthrough();
|
|
4343
|
-
var
|
|
4344
|
-
threadId:
|
|
4345
|
-
|
|
4321
|
+
var sessionReplacedNotificationSchema = z30.object({
|
|
4322
|
+
threadId: z30.string().min(1),
|
|
4323
|
+
providerThreadId: z30.string().min(1).nullable(),
|
|
4324
|
+
reason: z30.string().min(1),
|
|
4325
|
+
contextLost: z30.boolean().default(false),
|
|
4326
|
+
showRuntimeNote: z30.boolean().default(false)
|
|
4346
4327
|
}).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),
|
|
4328
|
+
var providerRecoveryNotificationSchema = z30.object({
|
|
4356
4329
|
threadId: z30.string().min(1).optional(),
|
|
4357
|
-
|
|
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
|
-
)
|
|
4330
|
+
...providerRecoveryHintSchema.shape
|
|
4373
4331
|
}).passthrough();
|
|
4374
|
-
var
|
|
4375
|
-
providerThreadId: z30.string().min(1),
|
|
4332
|
+
var errorNotificationSchema = z30.object({
|
|
4376
4333
|
threadId: z30.string().min(1).optional(),
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
providerNativeIds: z30.boolean().optional()
|
|
4334
|
+
providerThreadId: z30.string().min(1).optional(),
|
|
4335
|
+
message: z30.string().min(1)
|
|
4380
4336
|
}).passthrough();
|
|
4381
4337
|
|
|
4382
4338
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
@@ -4621,6 +4577,7 @@ var threadDeltaSchema = z31.discriminatedUnion("kind", [
|
|
|
4621
4577
|
}),
|
|
4622
4578
|
z31.object({
|
|
4623
4579
|
kind: z31.literal("contextWindow"),
|
|
4580
|
+
snapshot: contextSnapshotSchema.optional(),
|
|
4624
4581
|
used: z31.number().nullable(),
|
|
4625
4582
|
size: z31.number().nullable().optional(),
|
|
4626
4583
|
estimated: z31.boolean(),
|
|
@@ -4853,6 +4810,7 @@ export {
|
|
|
4853
4810
|
buildShellEnvOverrides,
|
|
4854
4811
|
claudeTaskToolNameSchema,
|
|
4855
4812
|
claudeTaskToolOutputSchema,
|
|
4813
|
+
contextSnapshotSchema,
|
|
4856
4814
|
createBridgeIo,
|
|
4857
4815
|
createBridgeLineHandler,
|
|
4858
4816
|
createPendingToolCallTracker,
|