@get-bb/plugin-sdk 0.4.94 → 0.4.97
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 +13 -2
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +15 -0
- package/bundled-types/bb-plugin-sdk-machine-provider.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +15 -0
- package/bundled-types/bb-plugin-sdk.d.ts +53 -3
- package/dist/internal/host-policy.js +116 -93
- package/dist/provider-bridge-acp.js +2114 -1561
- package/dist/provider-bridge-testing.js +1232 -1226
- package/dist/provider-bridge.js +1812 -1310
- package/dist/testing/index.js +116 -93
- package/package.json +1 -1
|
@@ -261,8 +261,13 @@ var projectExecutionDefaultsSchema = z3.object({
|
|
|
261
261
|
permissionMode: permissionModeSchema
|
|
262
262
|
});
|
|
263
263
|
|
|
264
|
-
// ../domain/src/
|
|
264
|
+
// ../domain/src/completed-turn-display.ts
|
|
265
265
|
import { z as z4 } from "zod";
|
|
266
|
+
var COMPLETED_TURN_DISPLAY_VALUES = ["collapse", "flat"];
|
|
267
|
+
var completedTurnDisplaySchema = z4.enum(COMPLETED_TURN_DISPLAY_VALUES);
|
|
268
|
+
|
|
269
|
+
// ../domain/src/background-task.ts
|
|
270
|
+
import { z as z5 } from "zod";
|
|
266
271
|
var backgroundTaskStatusValues = [
|
|
267
272
|
"pending",
|
|
268
273
|
"running",
|
|
@@ -272,7 +277,7 @@ var backgroundTaskStatusValues = [
|
|
|
272
277
|
"killed",
|
|
273
278
|
"stopped"
|
|
274
279
|
];
|
|
275
|
-
var backgroundTaskStatusSchema =
|
|
280
|
+
var backgroundTaskStatusSchema = z5.enum(backgroundTaskStatusValues);
|
|
276
281
|
var workflowAgentStateValues = [
|
|
277
282
|
"queued",
|
|
278
283
|
"running",
|
|
@@ -280,53 +285,53 @@ var workflowAgentStateValues = [
|
|
|
280
285
|
"failed",
|
|
281
286
|
"skipped"
|
|
282
287
|
];
|
|
283
|
-
var workflowAgentStateSchema =
|
|
284
|
-
var workflowAgentSnapshotSchema =
|
|
285
|
-
index:
|
|
286
|
-
label:
|
|
288
|
+
var workflowAgentStateSchema = z5.enum(workflowAgentStateValues);
|
|
289
|
+
var workflowAgentSnapshotSchema = z5.object({
|
|
290
|
+
index: z5.number().int().positive(),
|
|
291
|
+
label: z5.string(),
|
|
287
292
|
state: workflowAgentStateSchema,
|
|
288
|
-
model:
|
|
289
|
-
attempt:
|
|
290
|
-
cached:
|
|
291
|
-
lastProgressAt:
|
|
292
|
-
phaseIndex:
|
|
293
|
-
phaseTitle:
|
|
294
|
-
agentType:
|
|
295
|
-
isolation:
|
|
296
|
-
queuedAt:
|
|
297
|
-
startedAt:
|
|
298
|
-
lastToolName:
|
|
299
|
-
lastToolSummary:
|
|
300
|
-
promptPreview:
|
|
301
|
-
resultPreview:
|
|
302
|
-
error:
|
|
303
|
-
tokens:
|
|
304
|
-
toolCalls:
|
|
305
|
-
durationMs:
|
|
306
|
-
});
|
|
307
|
-
var workflowPhaseSnapshotSchema =
|
|
308
|
-
index:
|
|
309
|
-
title:
|
|
310
|
-
kind:
|
|
311
|
-
});
|
|
312
|
-
var workflowProgressSnapshotSchema =
|
|
313
|
-
phases:
|
|
314
|
-
agents:
|
|
315
|
-
});
|
|
316
|
-
var backgroundTaskUsageSchema =
|
|
317
|
-
totalTokens:
|
|
318
|
-
toolUses:
|
|
319
|
-
durationMs:
|
|
293
|
+
model: z5.string(),
|
|
294
|
+
attempt: z5.number().int().positive(),
|
|
295
|
+
cached: z5.boolean(),
|
|
296
|
+
lastProgressAt: z5.number(),
|
|
297
|
+
phaseIndex: z5.number().int().positive().optional(),
|
|
298
|
+
phaseTitle: z5.string().optional(),
|
|
299
|
+
agentType: z5.string().optional(),
|
|
300
|
+
isolation: z5.string().optional(),
|
|
301
|
+
queuedAt: z5.number().optional(),
|
|
302
|
+
startedAt: z5.number().optional(),
|
|
303
|
+
lastToolName: z5.string().optional(),
|
|
304
|
+
lastToolSummary: z5.string().optional(),
|
|
305
|
+
promptPreview: z5.string().optional(),
|
|
306
|
+
resultPreview: z5.string().optional(),
|
|
307
|
+
error: z5.string().optional(),
|
|
308
|
+
tokens: z5.number().optional(),
|
|
309
|
+
toolCalls: z5.number().optional(),
|
|
310
|
+
durationMs: z5.number().optional()
|
|
311
|
+
});
|
|
312
|
+
var workflowPhaseSnapshotSchema = z5.object({
|
|
313
|
+
index: z5.number().int().positive(),
|
|
314
|
+
title: z5.string(),
|
|
315
|
+
kind: z5.string().optional()
|
|
316
|
+
});
|
|
317
|
+
var workflowProgressSnapshotSchema = z5.object({
|
|
318
|
+
phases: z5.array(workflowPhaseSnapshotSchema),
|
|
319
|
+
agents: z5.array(workflowAgentSnapshotSchema)
|
|
320
|
+
});
|
|
321
|
+
var backgroundTaskUsageSchema = z5.object({
|
|
322
|
+
totalTokens: z5.number(),
|
|
323
|
+
toolUses: z5.number(),
|
|
324
|
+
durationMs: z5.number()
|
|
320
325
|
});
|
|
321
326
|
|
|
322
327
|
// ../domain/src/provider-event.ts
|
|
323
|
-
import { z as
|
|
328
|
+
import { z as z14 } from "zod";
|
|
324
329
|
|
|
325
330
|
// ../domain/src/thread-events.ts
|
|
326
|
-
import { z as
|
|
331
|
+
import { z as z11 } from "zod";
|
|
327
332
|
|
|
328
333
|
// ../domain/src/pending-interactions.ts
|
|
329
|
-
import { z as
|
|
334
|
+
import { z as z8 } from "zod";
|
|
330
335
|
|
|
331
336
|
// ../domain/src/plugin-interaction-limits.ts
|
|
332
337
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
@@ -336,223 +341,223 @@ function jsonByteLength(value) {
|
|
|
336
341
|
}
|
|
337
342
|
|
|
338
343
|
// ../domain/src/item-presentation.ts
|
|
339
|
-
import { z as
|
|
344
|
+
import { z as z6 } from "zod";
|
|
340
345
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
341
|
-
var threadEventItemPresentationLabelSchema =
|
|
342
|
-
pending:
|
|
343
|
-
completed:
|
|
346
|
+
var threadEventItemPresentationLabelSchema = z6.object({
|
|
347
|
+
pending: z6.string().min(1),
|
|
348
|
+
completed: z6.string().min(1)
|
|
344
349
|
});
|
|
345
|
-
var threadEventItemPresentationIconSchema =
|
|
346
|
-
glyph:
|
|
350
|
+
var threadEventItemPresentationIconSchema = z6.object({
|
|
351
|
+
glyph: z6.string().min(1)
|
|
347
352
|
});
|
|
348
|
-
var threadEventItemPresentationTintSchema =
|
|
349
|
-
light:
|
|
350
|
-
dark:
|
|
353
|
+
var threadEventItemPresentationTintSchema = z6.object({
|
|
354
|
+
light: z6.string().min(1),
|
|
355
|
+
dark: z6.string().min(1)
|
|
351
356
|
});
|
|
352
357
|
var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
|
|
353
|
-
var threadEventItemPresentationBadgeSchema =
|
|
354
|
-
glyph:
|
|
355
|
-
label:
|
|
356
|
-
hint:
|
|
357
|
-
tone:
|
|
358
|
+
var threadEventItemPresentationBadgeSchema = z6.object({
|
|
359
|
+
glyph: z6.string().min(1),
|
|
360
|
+
label: z6.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
361
|
+
hint: z6.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
362
|
+
tone: z6.enum(["neutral", "destructive"])
|
|
358
363
|
});
|
|
359
|
-
var threadEventItemPresentationSchema =
|
|
364
|
+
var threadEventItemPresentationSchema = z6.object({
|
|
360
365
|
label: threadEventItemPresentationLabelSchema,
|
|
361
366
|
icon: threadEventItemPresentationIconSchema,
|
|
362
|
-
title:
|
|
363
|
-
detail:
|
|
364
|
-
suppress:
|
|
367
|
+
title: z6.string().optional(),
|
|
368
|
+
detail: z6.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
369
|
+
suppress: z6.boolean().optional(),
|
|
365
370
|
tint: threadEventItemPresentationTintSchema.optional(),
|
|
366
371
|
badge: threadEventItemPresentationBadgeSchema.optional()
|
|
367
372
|
});
|
|
368
373
|
|
|
369
374
|
// ../domain/src/provider-extension-kind.ts
|
|
370
|
-
import { z as
|
|
375
|
+
import { z as z7 } from "zod";
|
|
371
376
|
var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
|
|
372
377
|
function isExtensionKind(value) {
|
|
373
378
|
return EXTENSION_KIND_PATTERN.test(value);
|
|
374
379
|
}
|
|
375
|
-
var extensionKindSchema =
|
|
380
|
+
var extensionKindSchema = z7.string().refine(isExtensionKind, {
|
|
376
381
|
message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
|
|
377
382
|
});
|
|
378
383
|
|
|
379
384
|
// ../domain/src/pending-interactions.ts
|
|
380
|
-
var pendingInteractionStatusSchema =
|
|
385
|
+
var pendingInteractionStatusSchema = z8.enum([
|
|
381
386
|
"pending",
|
|
382
387
|
"resolving",
|
|
383
388
|
"resolved",
|
|
384
389
|
"interrupted"
|
|
385
390
|
]);
|
|
386
|
-
var pendingInteractionCommandActionSchema =
|
|
391
|
+
var pendingInteractionCommandActionSchema = z8.discriminatedUnion(
|
|
387
392
|
"type",
|
|
388
393
|
[
|
|
389
|
-
|
|
390
|
-
type:
|
|
391
|
-
command:
|
|
392
|
-
name:
|
|
393
|
-
path:
|
|
394
|
+
z8.object({
|
|
395
|
+
type: z8.literal("read"),
|
|
396
|
+
command: z8.string(),
|
|
397
|
+
name: z8.string(),
|
|
398
|
+
path: z8.string()
|
|
394
399
|
}),
|
|
395
|
-
|
|
396
|
-
type:
|
|
397
|
-
command:
|
|
398
|
-
path:
|
|
400
|
+
z8.object({
|
|
401
|
+
type: z8.literal("listFiles"),
|
|
402
|
+
command: z8.string(),
|
|
403
|
+
path: z8.string().nullable()
|
|
399
404
|
}),
|
|
400
|
-
|
|
401
|
-
type:
|
|
402
|
-
command:
|
|
403
|
-
query:
|
|
404
|
-
path:
|
|
405
|
+
z8.object({
|
|
406
|
+
type: z8.literal("search"),
|
|
407
|
+
command: z8.string(),
|
|
408
|
+
query: z8.string().nullable(),
|
|
409
|
+
path: z8.string().nullable()
|
|
405
410
|
}),
|
|
406
|
-
|
|
407
|
-
type:
|
|
408
|
-
command:
|
|
411
|
+
z8.object({
|
|
412
|
+
type: z8.literal("unknown"),
|
|
413
|
+
command: z8.string()
|
|
409
414
|
})
|
|
410
415
|
]
|
|
411
416
|
);
|
|
412
|
-
var pendingInteractionNetworkPermissionsSchema =
|
|
413
|
-
enabled:
|
|
417
|
+
var pendingInteractionNetworkPermissionsSchema = z8.object({
|
|
418
|
+
enabled: z8.boolean().nullable()
|
|
414
419
|
});
|
|
415
|
-
var pendingInteractionFileSystemPermissionsSchema =
|
|
416
|
-
read:
|
|
417
|
-
write:
|
|
420
|
+
var pendingInteractionFileSystemPermissionsSchema = z8.object({
|
|
421
|
+
read: z8.array(z8.string()),
|
|
422
|
+
write: z8.array(z8.string())
|
|
418
423
|
});
|
|
419
|
-
var pendingInteractionMacOsPreferencesPermissionSchema =
|
|
424
|
+
var pendingInteractionMacOsPreferencesPermissionSchema = z8.enum([
|
|
420
425
|
"none",
|
|
421
426
|
"read_only",
|
|
422
427
|
"read_write"
|
|
423
428
|
]);
|
|
424
|
-
var pendingInteractionMacOsContactsPermissionSchema =
|
|
429
|
+
var pendingInteractionMacOsContactsPermissionSchema = z8.enum([
|
|
425
430
|
"none",
|
|
426
431
|
"read_only",
|
|
427
432
|
"read_write"
|
|
428
433
|
]);
|
|
429
|
-
var pendingInteractionMacOsAutomationPermissionSchema =
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
kind:
|
|
434
|
-
bundleIds:
|
|
434
|
+
var pendingInteractionMacOsAutomationPermissionSchema = z8.union([
|
|
435
|
+
z8.literal("none"),
|
|
436
|
+
z8.literal("all"),
|
|
437
|
+
z8.object({
|
|
438
|
+
kind: z8.literal("bundle_ids"),
|
|
439
|
+
bundleIds: z8.array(z8.string())
|
|
435
440
|
})
|
|
436
441
|
]);
|
|
437
|
-
var pendingInteractionMacOsPermissionsSchema =
|
|
442
|
+
var pendingInteractionMacOsPermissionsSchema = z8.object({
|
|
438
443
|
preferences: pendingInteractionMacOsPreferencesPermissionSchema,
|
|
439
444
|
automations: pendingInteractionMacOsAutomationPermissionSchema,
|
|
440
|
-
launchServices:
|
|
441
|
-
accessibility:
|
|
442
|
-
calendar:
|
|
443
|
-
reminders:
|
|
445
|
+
launchServices: z8.boolean(),
|
|
446
|
+
accessibility: z8.boolean(),
|
|
447
|
+
calendar: z8.boolean(),
|
|
448
|
+
reminders: z8.boolean(),
|
|
444
449
|
contacts: pendingInteractionMacOsContactsPermissionSchema
|
|
445
450
|
});
|
|
446
|
-
var pendingInteractionRequestedPermissionProfileSchema =
|
|
451
|
+
var pendingInteractionRequestedPermissionProfileSchema = z8.object({
|
|
447
452
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
448
453
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
|
|
449
454
|
macos: pendingInteractionMacOsPermissionsSchema.nullable()
|
|
450
455
|
});
|
|
451
|
-
var pendingInteractionGrantablePermissionProfileSchema =
|
|
456
|
+
var pendingInteractionGrantablePermissionProfileSchema = z8.object({
|
|
452
457
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
453
458
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
|
|
454
459
|
}).strict();
|
|
455
460
|
var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
|
|
456
|
-
var pendingInteractionApprovalDecisionSchema =
|
|
461
|
+
var pendingInteractionApprovalDecisionSchema = z8.enum([
|
|
457
462
|
"allow_once",
|
|
458
463
|
"allow_for_session",
|
|
459
464
|
"deny"
|
|
460
465
|
]);
|
|
461
|
-
var pendingInteractionFileChangeWriteScopeSchema =
|
|
462
|
-
var pendingInteractionCommandApprovalSubjectSchema =
|
|
463
|
-
kind:
|
|
464
|
-
itemId:
|
|
465
|
-
command:
|
|
466
|
-
cwd:
|
|
467
|
-
actions:
|
|
466
|
+
var pendingInteractionFileChangeWriteScopeSchema = z8.string().min(1);
|
|
467
|
+
var pendingInteractionCommandApprovalSubjectSchema = z8.object({
|
|
468
|
+
kind: z8.literal("command"),
|
|
469
|
+
itemId: z8.string().min(1),
|
|
470
|
+
command: z8.string().min(1),
|
|
471
|
+
cwd: z8.string().nullable(),
|
|
472
|
+
actions: z8.array(pendingInteractionCommandActionSchema),
|
|
468
473
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
469
474
|
});
|
|
470
|
-
var pendingInteractionFileChangeApprovalSubjectSchema =
|
|
471
|
-
kind:
|
|
472
|
-
itemId:
|
|
475
|
+
var pendingInteractionFileChangeApprovalSubjectSchema = z8.object({
|
|
476
|
+
kind: z8.literal("file_change"),
|
|
477
|
+
itemId: z8.string().min(1),
|
|
473
478
|
writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
|
|
474
479
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
475
480
|
});
|
|
476
|
-
var pendingInteractionPermissionGrantApprovalSubjectSchema =
|
|
477
|
-
kind:
|
|
478
|
-
itemId:
|
|
479
|
-
toolName:
|
|
481
|
+
var pendingInteractionPermissionGrantApprovalSubjectSchema = z8.object({
|
|
482
|
+
kind: z8.literal("permission_grant"),
|
|
483
|
+
itemId: z8.string().min(1),
|
|
484
|
+
toolName: z8.string().nullable(),
|
|
480
485
|
permissions: pendingInteractionGrantablePermissionProfileSchema
|
|
481
486
|
});
|
|
482
|
-
var pendingInteractionPlanApprovalSubjectSchema =
|
|
483
|
-
kind:
|
|
484
|
-
itemId:
|
|
485
|
-
plan:
|
|
486
|
-
planFilePath:
|
|
487
|
+
var pendingInteractionPlanApprovalSubjectSchema = z8.object({
|
|
488
|
+
kind: z8.literal("plan"),
|
|
489
|
+
itemId: z8.string().min(1),
|
|
490
|
+
plan: z8.string().min(1),
|
|
491
|
+
planFilePath: z8.string().min(1).nullable()
|
|
487
492
|
});
|
|
488
|
-
var pendingInteractionToolUseApprovalSubjectSchema =
|
|
489
|
-
kind:
|
|
490
|
-
itemId:
|
|
491
|
-
tool:
|
|
493
|
+
var pendingInteractionToolUseApprovalSubjectSchema = z8.object({
|
|
494
|
+
kind: z8.literal("tool_use"),
|
|
495
|
+
itemId: z8.string().min(1),
|
|
496
|
+
tool: z8.string().min(1),
|
|
492
497
|
presentation: threadEventItemPresentationSchema
|
|
493
498
|
});
|
|
494
|
-
var pendingInteractionApprovalSubjectSchema =
|
|
499
|
+
var pendingInteractionApprovalSubjectSchema = z8.discriminatedUnion("kind", [
|
|
495
500
|
pendingInteractionCommandApprovalSubjectSchema,
|
|
496
501
|
pendingInteractionFileChangeApprovalSubjectSchema,
|
|
497
502
|
pendingInteractionPermissionGrantApprovalSubjectSchema,
|
|
498
503
|
pendingInteractionPlanApprovalSubjectSchema,
|
|
499
504
|
pendingInteractionToolUseApprovalSubjectSchema
|
|
500
505
|
]);
|
|
501
|
-
var approvalPendingInteractionPayloadSchema =
|
|
502
|
-
kind:
|
|
506
|
+
var approvalPendingInteractionPayloadSchema = z8.object({
|
|
507
|
+
kind: z8.literal("approval"),
|
|
503
508
|
subject: pendingInteractionApprovalSubjectSchema,
|
|
504
|
-
reason:
|
|
505
|
-
availableDecisions:
|
|
509
|
+
reason: z8.string().nullable(),
|
|
510
|
+
availableDecisions: z8.array(pendingInteractionApprovalDecisionSchema).min(1)
|
|
506
511
|
});
|
|
507
512
|
var USER_QUESTION_MAX_QUESTIONS = 4;
|
|
508
513
|
var USER_QUESTION_MAX_OPTIONS = 4;
|
|
509
514
|
var USER_QUESTION_MAX_SELECTED = 4;
|
|
510
515
|
var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
|
|
511
|
-
var pendingInteractionUserQuestionIdSchema =
|
|
516
|
+
var pendingInteractionUserQuestionIdSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
512
517
|
message: "User question ids cannot be blank"
|
|
513
518
|
});
|
|
514
|
-
var pendingInteractionUserQuestionPromptSchema =
|
|
519
|
+
var pendingInteractionUserQuestionPromptSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
515
520
|
message: "User question prompts cannot be blank"
|
|
516
521
|
});
|
|
517
|
-
var pendingInteractionUserQuestionShortLabelSchema =
|
|
522
|
+
var pendingInteractionUserQuestionShortLabelSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
518
523
|
message: "User question short labels cannot be blank"
|
|
519
524
|
});
|
|
520
|
-
var pendingInteractionUserQuestionOptionValueSchema =
|
|
525
|
+
var pendingInteractionUserQuestionOptionValueSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
521
526
|
message: "User question option values cannot be blank"
|
|
522
527
|
});
|
|
523
|
-
var pendingInteractionUserQuestionOptionLabelSchema =
|
|
528
|
+
var pendingInteractionUserQuestionOptionLabelSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
524
529
|
message: "User question option labels cannot be blank"
|
|
525
530
|
});
|
|
526
|
-
var pendingInteractionUserQuestionOptionDescriptionSchema =
|
|
531
|
+
var pendingInteractionUserQuestionOptionDescriptionSchema = z8.string().min(1).refine((value) => value.trim().length > 0, {
|
|
527
532
|
message: "User question option descriptions cannot be blank"
|
|
528
533
|
});
|
|
529
|
-
var pendingInteractionUserQuestionFreeTextSchema =
|
|
534
|
+
var pendingInteractionUserQuestionFreeTextSchema = z8.string().min(1).max(
|
|
530
535
|
USER_QUESTION_MAX_FREE_TEXT_LENGTH,
|
|
531
536
|
`User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
|
|
532
537
|
).refine((value) => value.trim().length > 0, {
|
|
533
538
|
message: "User question free text cannot be blank"
|
|
534
539
|
});
|
|
535
|
-
var pendingInteractionUserQuestionOptionSchema =
|
|
540
|
+
var pendingInteractionUserQuestionOptionSchema = z8.object({
|
|
536
541
|
value: pendingInteractionUserQuestionOptionValueSchema,
|
|
537
542
|
label: pendingInteractionUserQuestionOptionLabelSchema,
|
|
538
543
|
description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
|
|
539
544
|
});
|
|
540
|
-
var pendingInteractionUserQuestionQuestionSchema =
|
|
545
|
+
var pendingInteractionUserQuestionQuestionSchema = z8.object({
|
|
541
546
|
id: pendingInteractionUserQuestionIdSchema,
|
|
542
547
|
prompt: pendingInteractionUserQuestionPromptSchema,
|
|
543
548
|
shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
|
|
544
|
-
multiSelect:
|
|
545
|
-
options:
|
|
549
|
+
multiSelect: z8.boolean(),
|
|
550
|
+
options: z8.array(pendingInteractionUserQuestionOptionSchema).max(
|
|
546
551
|
USER_QUESTION_MAX_OPTIONS,
|
|
547
552
|
`User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
|
|
548
553
|
).optional(),
|
|
549
|
-
allowFreeText:
|
|
554
|
+
allowFreeText: z8.boolean()
|
|
550
555
|
}).superRefine((question, context) => {
|
|
551
556
|
const optionValues = /* @__PURE__ */ new Set();
|
|
552
557
|
question.options?.forEach((option, index) => {
|
|
553
558
|
if (optionValues.has(option.value)) {
|
|
554
559
|
context.addIssue({
|
|
555
|
-
code:
|
|
560
|
+
code: z8.ZodIssueCode.custom,
|
|
556
561
|
message: "User question option values must be unique",
|
|
557
562
|
path: ["options", index, "value"]
|
|
558
563
|
});
|
|
@@ -567,9 +572,9 @@ var pendingInteractionUserQuestionQuestionSchema = z7.object({
|
|
|
567
572
|
path: ["options"]
|
|
568
573
|
}
|
|
569
574
|
);
|
|
570
|
-
var userQuestionPendingInteractionPayloadSchema =
|
|
571
|
-
kind:
|
|
572
|
-
questions:
|
|
575
|
+
var userQuestionPendingInteractionPayloadSchema = z8.object({
|
|
576
|
+
kind: z8.literal("user_question"),
|
|
577
|
+
questions: z8.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
|
|
573
578
|
USER_QUESTION_MAX_QUESTIONS,
|
|
574
579
|
`User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
|
|
575
580
|
)
|
|
@@ -578,7 +583,7 @@ var userQuestionPendingInteractionPayloadSchema = z7.object({
|
|
|
578
583
|
payload.questions.forEach((question, index) => {
|
|
579
584
|
if (questionIds.has(question.id)) {
|
|
580
585
|
context.addIssue({
|
|
581
|
-
code:
|
|
586
|
+
code: z8.ZodIssueCode.custom,
|
|
582
587
|
message: "User question ids must be unique",
|
|
583
588
|
path: ["questions", index, "id"]
|
|
584
589
|
});
|
|
@@ -587,65 +592,65 @@ var userQuestionPendingInteractionPayloadSchema = z7.object({
|
|
|
587
592
|
questionIds.add(question.id);
|
|
588
593
|
});
|
|
589
594
|
});
|
|
590
|
-
var pluginPendingInteractionPayloadSchema =
|
|
591
|
-
kind:
|
|
592
|
-
title:
|
|
595
|
+
var pluginPendingInteractionPayloadSchema = z8.object({
|
|
596
|
+
kind: z8.literal("plugin"),
|
|
597
|
+
title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
593
598
|
data: jsonValueSchema
|
|
594
599
|
});
|
|
595
|
-
var pluginExtensionInteractionRequestPayloadSchema =
|
|
600
|
+
var pluginExtensionInteractionRequestPayloadSchema = z8.object({
|
|
596
601
|
kind: extensionKindSchema,
|
|
597
|
-
title:
|
|
602
|
+
title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
598
603
|
data: jsonValueSchema.refine(
|
|
599
604
|
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
600
605
|
{ message: "Plugin request data exceeds 64 KiB" }
|
|
601
606
|
)
|
|
602
607
|
});
|
|
603
|
-
var interactionRequestPayloadSchema =
|
|
608
|
+
var interactionRequestPayloadSchema = z8.union([
|
|
604
609
|
userQuestionPendingInteractionPayloadSchema,
|
|
605
610
|
pluginExtensionInteractionRequestPayloadSchema
|
|
606
611
|
]);
|
|
607
|
-
var pendingInteractionPayloadSchema =
|
|
612
|
+
var pendingInteractionPayloadSchema = z8.union([
|
|
608
613
|
approvalPendingInteractionPayloadSchema,
|
|
609
614
|
userQuestionPendingInteractionPayloadSchema,
|
|
610
615
|
pluginExtensionInteractionRequestPayloadSchema
|
|
611
616
|
]);
|
|
612
617
|
var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
|
|
613
|
-
var approvalPendingInteractionResolutionSchema =
|
|
618
|
+
var approvalPendingInteractionResolutionSchema = z8.discriminatedUnion(
|
|
614
619
|
"decision",
|
|
615
620
|
[
|
|
616
|
-
|
|
617
|
-
decision:
|
|
621
|
+
z8.object({
|
|
622
|
+
decision: z8.literal("allow_once"),
|
|
618
623
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
619
624
|
}),
|
|
620
|
-
|
|
621
|
-
decision:
|
|
625
|
+
z8.object({
|
|
626
|
+
decision: z8.literal("allow_for_session"),
|
|
622
627
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
623
628
|
}),
|
|
624
|
-
|
|
625
|
-
decision:
|
|
629
|
+
z8.object({
|
|
630
|
+
decision: z8.literal("deny")
|
|
626
631
|
})
|
|
627
632
|
],
|
|
628
633
|
approvalDecisionDiscriminatorError
|
|
629
634
|
);
|
|
630
|
-
var pendingInteractionUserAnswerSchema =
|
|
631
|
-
selected:
|
|
635
|
+
var pendingInteractionUserAnswerSchema = z8.object({
|
|
636
|
+
selected: z8.array(z8.string().min(1)).max(
|
|
632
637
|
USER_QUESTION_MAX_SELECTED,
|
|
633
638
|
`User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
|
|
634
639
|
),
|
|
635
640
|
freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
|
|
636
641
|
});
|
|
637
|
-
var userQuestionPendingInteractionResolutionSchema =
|
|
638
|
-
kind:
|
|
639
|
-
answers:
|
|
642
|
+
var userQuestionPendingInteractionResolutionSchema = z8.object({
|
|
643
|
+
kind: z8.literal("user_answer"),
|
|
644
|
+
answers: z8.record(z8.string().min(1), pendingInteractionUserAnswerSchema)
|
|
640
645
|
});
|
|
641
|
-
var pluginPendingInteractionResolutionSchema =
|
|
642
|
-
kind:
|
|
646
|
+
var pluginPendingInteractionResolutionSchema = z8.object({
|
|
647
|
+
kind: z8.literal("plugin_submitted")
|
|
643
648
|
});
|
|
644
|
-
var pluginExtensionInteractionResolutionSchema =
|
|
645
|
-
kind:
|
|
649
|
+
var pluginExtensionInteractionResolutionSchema = z8.object({
|
|
650
|
+
kind: z8.literal("request_answer"),
|
|
646
651
|
value: jsonValueSchema
|
|
647
652
|
});
|
|
648
|
-
var pendingInteractionResolutionSchema =
|
|
653
|
+
var pendingInteractionResolutionSchema = z8.union(
|
|
649
654
|
[
|
|
650
655
|
approvalPendingInteractionResolutionSchema,
|
|
651
656
|
userQuestionPendingInteractionResolutionSchema,
|
|
@@ -654,56 +659,56 @@ var pendingInteractionResolutionSchema = z7.union(
|
|
|
654
659
|
],
|
|
655
660
|
approvalDecisionDiscriminatorError
|
|
656
661
|
);
|
|
657
|
-
var approvalInteractionOutcomeSchema =
|
|
662
|
+
var approvalInteractionOutcomeSchema = z8.object({
|
|
658
663
|
payload: approvalPendingInteractionPayloadSchema,
|
|
659
664
|
resolution: approvalPendingInteractionResolutionSchema
|
|
660
665
|
});
|
|
661
|
-
var userQuestionInteractionOutcomeSchema =
|
|
666
|
+
var userQuestionInteractionOutcomeSchema = z8.object({
|
|
662
667
|
payload: userQuestionPendingInteractionPayloadSchema,
|
|
663
668
|
resolution: userQuestionPendingInteractionResolutionSchema
|
|
664
669
|
});
|
|
665
|
-
var pluginExtensionInteractionOutcomeSchema =
|
|
670
|
+
var pluginExtensionInteractionOutcomeSchema = z8.object({
|
|
666
671
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
667
672
|
resolution: pluginExtensionInteractionResolutionSchema
|
|
668
673
|
});
|
|
669
|
-
var providerInteractionOutcomeSchema =
|
|
674
|
+
var providerInteractionOutcomeSchema = z8.union([
|
|
670
675
|
approvalInteractionOutcomeSchema,
|
|
671
676
|
userQuestionInteractionOutcomeSchema,
|
|
672
677
|
pluginExtensionInteractionOutcomeSchema
|
|
673
678
|
]);
|
|
674
|
-
var pendingInteractionProviderOriginSchema =
|
|
675
|
-
kind:
|
|
676
|
-
providerId:
|
|
677
|
-
providerThreadId:
|
|
678
|
-
providerRequestId:
|
|
679
|
-
});
|
|
680
|
-
var pendingInteractionPluginOriginSchema =
|
|
681
|
-
kind:
|
|
682
|
-
pluginId:
|
|
683
|
-
rendererId:
|
|
684
|
-
});
|
|
685
|
-
var pendingInteractionCreateSchema =
|
|
686
|
-
threadId:
|
|
687
|
-
turnId:
|
|
688
|
-
providerId:
|
|
689
|
-
providerThreadId:
|
|
690
|
-
providerRequestId:
|
|
679
|
+
var pendingInteractionProviderOriginSchema = z8.object({
|
|
680
|
+
kind: z8.literal("provider"),
|
|
681
|
+
providerId: z8.string().min(1),
|
|
682
|
+
providerThreadId: z8.string().min(1),
|
|
683
|
+
providerRequestId: z8.string().min(1)
|
|
684
|
+
});
|
|
685
|
+
var pendingInteractionPluginOriginSchema = z8.object({
|
|
686
|
+
kind: z8.literal("plugin"),
|
|
687
|
+
pluginId: z8.string().min(1),
|
|
688
|
+
rendererId: z8.string().min(1)
|
|
689
|
+
});
|
|
690
|
+
var pendingInteractionCreateSchema = z8.object({
|
|
691
|
+
threadId: z8.string().min(1),
|
|
692
|
+
turnId: z8.string().min(1),
|
|
693
|
+
providerId: z8.string().min(1),
|
|
694
|
+
providerThreadId: z8.string().min(1),
|
|
695
|
+
providerRequestId: z8.string().min(1),
|
|
691
696
|
payload: pendingInteractionPayloadSchema
|
|
692
697
|
});
|
|
693
|
-
var pendingInteractionBaseSchema =
|
|
694
|
-
id:
|
|
695
|
-
threadId:
|
|
698
|
+
var pendingInteractionBaseSchema = z8.object({
|
|
699
|
+
id: z8.string().min(1),
|
|
700
|
+
threadId: z8.string().min(1),
|
|
696
701
|
status: pendingInteractionStatusSchema,
|
|
697
|
-
statusReason:
|
|
698
|
-
createdAt:
|
|
699
|
-
expiresAt:
|
|
700
|
-
resolvedAt:
|
|
702
|
+
statusReason: z8.string().nullable(),
|
|
703
|
+
createdAt: z8.number().int().nonnegative(),
|
|
704
|
+
expiresAt: z8.number().int().nonnegative().nullable().optional(),
|
|
705
|
+
resolvedAt: z8.number().int().nonnegative().nullable()
|
|
701
706
|
});
|
|
702
707
|
var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
|
|
703
|
-
turnId:
|
|
704
|
-
providerId:
|
|
705
|
-
providerThreadId:
|
|
706
|
-
providerRequestId:
|
|
708
|
+
turnId: z8.string().min(1),
|
|
709
|
+
providerId: z8.string().min(1),
|
|
710
|
+
providerThreadId: z8.string().min(1),
|
|
711
|
+
providerRequestId: z8.string().min(1),
|
|
707
712
|
origin: pendingInteractionProviderOriginSchema.optional()
|
|
708
713
|
});
|
|
709
714
|
var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
|
|
@@ -718,30 +723,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
|
|
|
718
723
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
719
724
|
resolution: pluginExtensionInteractionResolutionSchema.nullable()
|
|
720
725
|
});
|
|
721
|
-
var providerPendingInteractionSchema =
|
|
726
|
+
var providerPendingInteractionSchema = z8.union([
|
|
722
727
|
approvalPendingInteractionSchema,
|
|
723
728
|
userQuestionPendingInteractionSchema,
|
|
724
729
|
pluginExtensionPendingInteractionSchema
|
|
725
730
|
]);
|
|
726
731
|
var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
|
|
727
|
-
turnId:
|
|
732
|
+
turnId: z8.string().min(1).nullable(),
|
|
728
733
|
origin: pendingInteractionPluginOriginSchema,
|
|
729
734
|
payload: pluginPendingInteractionPayloadSchema,
|
|
730
735
|
resolution: pluginPendingInteractionResolutionSchema.nullable()
|
|
731
736
|
});
|
|
732
|
-
var pendingInteractionSchema =
|
|
737
|
+
var pendingInteractionSchema = z8.union([
|
|
733
738
|
providerPendingInteractionSchema,
|
|
734
739
|
pluginPendingInteractionSchema
|
|
735
740
|
]);
|
|
736
|
-
var interactionLifecycleRecordBaseSchema =
|
|
737
|
-
id:
|
|
741
|
+
var interactionLifecycleRecordBaseSchema = z8.object({
|
|
742
|
+
id: z8.string().min(1),
|
|
738
743
|
status: pendingInteractionStatusSchema,
|
|
739
|
-
statusReason:
|
|
744
|
+
statusReason: z8.string().nullable()
|
|
740
745
|
});
|
|
741
|
-
var interactionLifecycleProviderOriginSchema =
|
|
742
|
-
kind:
|
|
743
|
-
providerId:
|
|
744
|
-
providerRequestId:
|
|
746
|
+
var interactionLifecycleProviderOriginSchema = z8.object({
|
|
747
|
+
kind: z8.literal("provider"),
|
|
748
|
+
providerId: z8.string().min(1),
|
|
749
|
+
providerRequestId: z8.string().min(1)
|
|
745
750
|
});
|
|
746
751
|
var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
|
|
747
752
|
var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
|
|
@@ -766,7 +771,7 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
|
|
|
766
771
|
}),
|
|
767
772
|
resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
|
|
768
773
|
});
|
|
769
|
-
var interactionLifecycleSchema =
|
|
774
|
+
var interactionLifecycleSchema = z8.union([
|
|
770
775
|
approvalInteractionLifecycleSchema,
|
|
771
776
|
userQuestionInteractionLifecycleSchema,
|
|
772
777
|
pluginInteractionLifecycleSchema,
|
|
@@ -774,11 +779,11 @@ var interactionLifecycleSchema = z7.union([
|
|
|
774
779
|
]);
|
|
775
780
|
|
|
776
781
|
// ../domain/src/protocol-ids.ts
|
|
777
|
-
import { z as
|
|
778
|
-
var clientTurnRequestIdSchema =
|
|
782
|
+
import { z as z9 } from "zod";
|
|
783
|
+
var clientTurnRequestIdSchema = z9.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
779
784
|
|
|
780
785
|
// ../domain/src/system-message.ts
|
|
781
|
-
import { z as
|
|
786
|
+
import { z as z10 } from "zod";
|
|
782
787
|
var systemMessageKindValues = [
|
|
783
788
|
"ownership-assigned",
|
|
784
789
|
"ownership-removed",
|
|
@@ -789,16 +794,16 @@ var systemMessageKindValues = [
|
|
|
789
794
|
"child-outcome-batch",
|
|
790
795
|
"unlabeled"
|
|
791
796
|
];
|
|
792
|
-
var systemMessageKindSchema =
|
|
793
|
-
var systemMessageSubjectSchema =
|
|
794
|
-
|
|
795
|
-
kind:
|
|
796
|
-
threadId:
|
|
797
|
-
threadName:
|
|
797
|
+
var systemMessageKindSchema = z10.enum(systemMessageKindValues);
|
|
798
|
+
var systemMessageSubjectSchema = z10.discriminatedUnion("kind", [
|
|
799
|
+
z10.object({
|
|
800
|
+
kind: z10.literal("thread"),
|
|
801
|
+
threadId: z10.string(),
|
|
802
|
+
threadName: z10.string()
|
|
798
803
|
}),
|
|
799
|
-
|
|
800
|
-
kind:
|
|
801
|
-
count:
|
|
804
|
+
z10.object({
|
|
805
|
+
kind: z10.literal("thread-batch"),
|
|
806
|
+
count: z10.number()
|
|
802
807
|
})
|
|
803
808
|
]);
|
|
804
809
|
|
|
@@ -821,31 +826,31 @@ var systemEventTypeValues = [
|
|
|
821
826
|
"system/provider-turn-watchdog"
|
|
822
827
|
];
|
|
823
828
|
var threadTurnInitiatorValues = ["user", "agent", "system"];
|
|
824
|
-
var threadTurnInitiatorSchema =
|
|
829
|
+
var threadTurnInitiatorSchema = z11.enum(threadTurnInitiatorValues);
|
|
825
830
|
var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
|
|
826
|
-
var turnRequestTargetSchema =
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
kind:
|
|
831
|
-
expectedTurnId:
|
|
831
|
+
var turnRequestTargetSchema = z11.discriminatedUnion("kind", [
|
|
832
|
+
z11.object({ kind: z11.literal("thread-start") }),
|
|
833
|
+
z11.object({ kind: z11.literal("new-turn") }),
|
|
834
|
+
z11.object({
|
|
835
|
+
kind: z11.literal("auto"),
|
|
836
|
+
expectedTurnId: z11.string().nullable()
|
|
832
837
|
}),
|
|
833
|
-
|
|
834
|
-
kind:
|
|
835
|
-
expectedTurnId:
|
|
838
|
+
z11.object({
|
|
839
|
+
kind: z11.literal("steer"),
|
|
840
|
+
expectedTurnId: z11.string().nullable()
|
|
836
841
|
})
|
|
837
842
|
]);
|
|
838
|
-
var clientTurnLifecycleEventDataSchema =
|
|
839
|
-
direction:
|
|
840
|
-
source:
|
|
843
|
+
var clientTurnLifecycleEventDataSchema = z11.object({
|
|
844
|
+
direction: z11.literal("outbound"),
|
|
845
|
+
source: z11.enum(["spawn", "tell"]),
|
|
841
846
|
initiator: threadTurnInitiatorSchema,
|
|
842
|
-
request:
|
|
843
|
-
method:
|
|
844
|
-
params:
|
|
847
|
+
request: z11.object({
|
|
848
|
+
method: z11.enum(["thread/start", "turn/start"]),
|
|
849
|
+
params: z11.record(z11.string(), z11.unknown())
|
|
845
850
|
})
|
|
846
851
|
});
|
|
847
|
-
var turnRequestEventDataSchema =
|
|
848
|
-
direction:
|
|
852
|
+
var turnRequestEventDataSchema = z11.object({
|
|
853
|
+
direction: z11.literal("outbound"),
|
|
849
854
|
requestId: clientTurnRequestIdSchema,
|
|
850
855
|
// Retry provenance, written only when a `turn.failed` gate's retry row
|
|
851
856
|
// dispatches. Both fields are present together or not at all: absence means
|
|
@@ -855,45 +860,45 @@ var turnRequestEventDataSchema = z10.object({
|
|
|
855
860
|
/** The original request this attempt re-submits, unchanged across attempts. */
|
|
856
861
|
retryOfRequestId: clientTurnRequestIdSchema.optional(),
|
|
857
862
|
/** Which attempt this is: 2 is the first retry of the original request. */
|
|
858
|
-
retryAttempt:
|
|
859
|
-
source:
|
|
863
|
+
retryAttempt: z11.number().int().min(2).optional(),
|
|
864
|
+
source: z11.enum(["spawn", "tell"]),
|
|
860
865
|
initiator: threadTurnInitiatorSchema,
|
|
861
|
-
senderThreadId:
|
|
866
|
+
senderThreadId: z11.string().nullable(),
|
|
862
867
|
systemMessageKind: systemMessageKindSchema.optional(),
|
|
863
868
|
systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
|
|
864
|
-
input:
|
|
865
|
-
inputGroups:
|
|
869
|
+
input: z11.array(promptInputSchema),
|
|
870
|
+
inputGroups: z11.array(z11.array(promptInputSchema).min(1)).min(1).optional(),
|
|
866
871
|
target: turnRequestTargetSchema,
|
|
867
|
-
request:
|
|
868
|
-
method:
|
|
869
|
-
params:
|
|
872
|
+
request: z11.object({
|
|
873
|
+
method: z11.enum(["thread/start", "turn/start"]),
|
|
874
|
+
params: z11.record(z11.string(), z11.unknown())
|
|
870
875
|
}),
|
|
871
876
|
execution: turnRequestOptionsSchema
|
|
872
877
|
});
|
|
873
|
-
var turnRequestRejectedEventDataSchema =
|
|
878
|
+
var turnRequestRejectedEventDataSchema = z11.object({
|
|
874
879
|
requestId: clientTurnRequestIdSchema,
|
|
875
|
-
reason:
|
|
876
|
-
message:
|
|
877
|
-
});
|
|
878
|
-
var systemErrorEventDataSchema =
|
|
879
|
-
code:
|
|
880
|
-
message:
|
|
881
|
-
detail:
|
|
882
|
-
reconnectAttempt:
|
|
883
|
-
reconnectTotal:
|
|
880
|
+
reason: z11.string().min(1),
|
|
881
|
+
message: z11.string().min(1)
|
|
882
|
+
});
|
|
883
|
+
var systemErrorEventDataSchema = z11.object({
|
|
884
|
+
code: z11.string().optional(),
|
|
885
|
+
message: z11.string(),
|
|
886
|
+
detail: z11.string().optional(),
|
|
887
|
+
reconnectAttempt: z11.number().int().positive().optional(),
|
|
888
|
+
reconnectTotal: z11.number().int().positive().optional()
|
|
884
889
|
}).superRefine((value, ctx) => {
|
|
885
890
|
const hasReconnectAttempt = value.reconnectAttempt !== void 0;
|
|
886
891
|
const hasReconnectTotal = value.reconnectTotal !== void 0;
|
|
887
892
|
if (hasReconnectAttempt !== hasReconnectTotal) {
|
|
888
893
|
ctx.addIssue({
|
|
889
|
-
code:
|
|
894
|
+
code: z11.ZodIssueCode.custom,
|
|
890
895
|
message: "system/error reconnectAttempt and reconnectTotal must be provided together"
|
|
891
896
|
});
|
|
892
897
|
return;
|
|
893
898
|
}
|
|
894
899
|
if (value.reconnectAttempt !== void 0 && value.reconnectTotal !== void 0 && value.reconnectAttempt > value.reconnectTotal) {
|
|
895
900
|
ctx.addIssue({
|
|
896
|
-
code:
|
|
901
|
+
code: z11.ZodIssueCode.custom,
|
|
897
902
|
message: "system/error reconnectAttempt cannot be greater than reconnectTotal"
|
|
898
903
|
});
|
|
899
904
|
}
|
|
@@ -903,42 +908,42 @@ var ownershipChangeOperationActionValues = [
|
|
|
903
908
|
"release",
|
|
904
909
|
"transfer"
|
|
905
910
|
];
|
|
906
|
-
var ownershipChangeOperationActionSchema =
|
|
911
|
+
var ownershipChangeOperationActionSchema = z11.enum(
|
|
907
912
|
ownershipChangeOperationActionValues
|
|
908
913
|
);
|
|
909
|
-
var ownershipChangeOperationMetadataSchema =
|
|
914
|
+
var ownershipChangeOperationMetadataSchema = z11.object({
|
|
910
915
|
action: ownershipChangeOperationActionSchema,
|
|
911
|
-
nextParentThreadId:
|
|
912
|
-
nextParentThreadTitle:
|
|
913
|
-
previousParentThreadId:
|
|
914
|
-
previousParentThreadTitle:
|
|
915
|
-
});
|
|
916
|
-
var systemOperationEventDataSchema =
|
|
917
|
-
operation:
|
|
918
|
-
status:
|
|
919
|
-
message:
|
|
920
|
-
operationId:
|
|
921
|
-
metadata:
|
|
922
|
-
});
|
|
923
|
-
var systemInteractionLifecycleEventDataSchema =
|
|
916
|
+
nextParentThreadId: z11.string().nullable(),
|
|
917
|
+
nextParentThreadTitle: z11.string().nullable(),
|
|
918
|
+
previousParentThreadId: z11.string().nullable(),
|
|
919
|
+
previousParentThreadTitle: z11.string().nullable()
|
|
920
|
+
});
|
|
921
|
+
var systemOperationEventDataSchema = z11.object({
|
|
922
|
+
operation: z11.string(),
|
|
923
|
+
status: z11.string(),
|
|
924
|
+
message: z11.string(),
|
|
925
|
+
operationId: z11.string(),
|
|
926
|
+
metadata: z11.record(z11.string(), jsonValueSchema).optional()
|
|
927
|
+
});
|
|
928
|
+
var systemInteractionLifecycleEventDataSchema = z11.object({
|
|
924
929
|
interaction: interactionLifecycleSchema
|
|
925
930
|
});
|
|
926
|
-
var systemPermissionGrantLifecycleEventDataSchema =
|
|
927
|
-
interactionId:
|
|
928
|
-
providerId:
|
|
929
|
-
providerRequestId:
|
|
931
|
+
var systemPermissionGrantLifecycleEventDataSchema = z11.object({
|
|
932
|
+
interactionId: z11.string(),
|
|
933
|
+
providerId: z11.string(),
|
|
934
|
+
providerRequestId: z11.string(),
|
|
930
935
|
status: pendingInteractionStatusSchema,
|
|
931
936
|
resolution: approvalPendingInteractionResolutionSchema.nullable().default(null),
|
|
932
|
-
statusReason:
|
|
937
|
+
statusReason: z11.string().nullable().default(null),
|
|
933
938
|
subject: pendingInteractionPermissionGrantApprovalSubjectSchema
|
|
934
939
|
});
|
|
935
|
-
var systemUserQuestionLifecycleEventDataSchema =
|
|
936
|
-
interactionId:
|
|
937
|
-
providerId:
|
|
938
|
-
providerRequestId:
|
|
940
|
+
var systemUserQuestionLifecycleEventDataSchema = z11.object({
|
|
941
|
+
interactionId: z11.string(),
|
|
942
|
+
providerId: z11.string(),
|
|
943
|
+
providerRequestId: z11.string(),
|
|
939
944
|
status: pendingInteractionStatusSchema,
|
|
940
945
|
resolution: userQuestionPendingInteractionResolutionSchema.nullable().default(null),
|
|
941
|
-
statusReason:
|
|
946
|
+
statusReason: z11.string().nullable().default(null),
|
|
942
947
|
payload: userQuestionPendingInteractionPayloadSchema
|
|
943
948
|
});
|
|
944
949
|
var systemThreadInterruptedReasonValues = [
|
|
@@ -946,20 +951,20 @@ var systemThreadInterruptedReasonValues = [
|
|
|
946
951
|
"host-daemon-restarted",
|
|
947
952
|
"provider-turn-idle"
|
|
948
953
|
];
|
|
949
|
-
var systemThreadInterruptedReasonSchema =
|
|
954
|
+
var systemThreadInterruptedReasonSchema = z11.enum(
|
|
950
955
|
systemThreadInterruptedReasonValues
|
|
951
956
|
);
|
|
952
|
-
var systemThreadInterruptedEventDataSchema =
|
|
957
|
+
var systemThreadInterruptedEventDataSchema = z11.object({
|
|
953
958
|
reason: systemThreadInterruptedReasonSchema,
|
|
954
|
-
cause:
|
|
959
|
+
cause: z11.literal("host-connection-lost").optional()
|
|
955
960
|
});
|
|
956
|
-
var provisioningTranscriptEntrySchema =
|
|
957
|
-
type:
|
|
958
|
-
key:
|
|
959
|
-
text:
|
|
960
|
-
startedAt:
|
|
961
|
-
status:
|
|
962
|
-
metadata:
|
|
961
|
+
var provisioningTranscriptEntrySchema = z11.object({
|
|
962
|
+
type: z11.enum(["step", "output"]),
|
|
963
|
+
key: z11.string(),
|
|
964
|
+
text: z11.string(),
|
|
965
|
+
startedAt: z11.number().optional(),
|
|
966
|
+
status: z11.enum(["started", "completed", "failed"]).optional(),
|
|
967
|
+
metadata: z11.record(z11.string(), z11.unknown()).optional()
|
|
963
968
|
});
|
|
964
969
|
var systemThreadProvisioningStatusValues = [
|
|
965
970
|
"active",
|
|
@@ -967,48 +972,48 @@ var systemThreadProvisioningStatusValues = [
|
|
|
967
972
|
"failed",
|
|
968
973
|
"cancelled"
|
|
969
974
|
];
|
|
970
|
-
var systemThreadProvisioningStatusSchema =
|
|
975
|
+
var systemThreadProvisioningStatusSchema = z11.enum(
|
|
971
976
|
systemThreadProvisioningStatusValues
|
|
972
977
|
);
|
|
973
|
-
var systemThreadProvisioningEventDataSchema =
|
|
974
|
-
provisioningId:
|
|
978
|
+
var systemThreadProvisioningEventDataSchema = z11.object({
|
|
979
|
+
provisioningId: z11.string(),
|
|
975
980
|
status: systemThreadProvisioningStatusSchema,
|
|
976
|
-
environmentId:
|
|
977
|
-
entries:
|
|
978
|
-
});
|
|
979
|
-
var systemLegacyUserMessageEventDataSchema =
|
|
980
|
-
text:
|
|
981
|
-
toolCallId:
|
|
982
|
-
turnId:
|
|
983
|
-
});
|
|
984
|
-
var systemProviderTurnWatchdogEventDataSchema =
|
|
985
|
-
reason:
|
|
986
|
-
thresholdMs:
|
|
987
|
-
elapsedMs:
|
|
988
|
-
activeTurnId:
|
|
989
|
-
activeTurnStartedAt:
|
|
990
|
-
lastActivityEventSequence:
|
|
991
|
-
lastActivityEventType:
|
|
992
|
-
lastActivityEventAt:
|
|
993
|
-
providerId:
|
|
994
|
-
providerThreadId:
|
|
995
|
-
firedAt:
|
|
981
|
+
environmentId: z11.string().nullable(),
|
|
982
|
+
entries: z11.array(provisioningTranscriptEntrySchema)
|
|
983
|
+
});
|
|
984
|
+
var systemLegacyUserMessageEventDataSchema = z11.object({
|
|
985
|
+
text: z11.string(),
|
|
986
|
+
toolCallId: z11.string().optional(),
|
|
987
|
+
turnId: z11.string().optional()
|
|
988
|
+
});
|
|
989
|
+
var systemProviderTurnWatchdogEventDataSchema = z11.object({
|
|
990
|
+
reason: z11.literal("provider-turn-idle"),
|
|
991
|
+
thresholdMs: z11.number().int().positive(),
|
|
992
|
+
elapsedMs: z11.number().int().nonnegative(),
|
|
993
|
+
activeTurnId: z11.string().min(1),
|
|
994
|
+
activeTurnStartedAt: z11.number().int().nonnegative(),
|
|
995
|
+
lastActivityEventSequence: z11.number().int().positive(),
|
|
996
|
+
lastActivityEventType: z11.string().min(1),
|
|
997
|
+
lastActivityEventAt: z11.number().int().nonnegative(),
|
|
998
|
+
providerId: z11.string().min(1),
|
|
999
|
+
providerThreadId: z11.string().min(1).nullable(),
|
|
1000
|
+
firedAt: z11.number().int().nonnegative()
|
|
996
1001
|
});
|
|
997
1002
|
|
|
998
1003
|
// ../domain/src/thread-event-scope.ts
|
|
999
|
-
import { z as
|
|
1004
|
+
import { z as z12 } from "zod";
|
|
1000
1005
|
var threadEventScopeKindValues = ["thread", "turn"];
|
|
1001
|
-
var threadEventScopeKindSchema =
|
|
1002
|
-
var threadEventScopeSchema =
|
|
1003
|
-
|
|
1004
|
-
|
|
1006
|
+
var threadEventScopeKindSchema = z12.enum(threadEventScopeKindValues);
|
|
1007
|
+
var threadEventScopeSchema = z12.discriminatedUnion("kind", [
|
|
1008
|
+
z12.object({ kind: z12.literal("thread") }),
|
|
1009
|
+
z12.object({ kind: z12.literal("turn"), turnId: z12.string().min(1) })
|
|
1005
1010
|
]);
|
|
1006
1011
|
var threadEventScopePolicyValues = [
|
|
1007
1012
|
"thread",
|
|
1008
1013
|
"turn",
|
|
1009
1014
|
"thread-or-turn"
|
|
1010
1015
|
];
|
|
1011
|
-
var threadEventScopePolicySchema =
|
|
1016
|
+
var threadEventScopePolicySchema = z12.enum(threadEventScopePolicyValues);
|
|
1012
1017
|
var threadEventScopeDefinitionByType = {
|
|
1013
1018
|
"thread/started": {
|
|
1014
1019
|
policy: "thread",
|
|
@@ -1183,32 +1188,32 @@ function validateThreadEventScope(args) {
|
|
|
1183
1188
|
}
|
|
1184
1189
|
|
|
1185
1190
|
// ../domain/src/thread-timeline-goal.ts
|
|
1186
|
-
import { z as
|
|
1187
|
-
var threadTimelineGoalStatusSchema =
|
|
1191
|
+
import { z as z13 } from "zod";
|
|
1192
|
+
var threadTimelineGoalStatusSchema = z13.enum([
|
|
1188
1193
|
"active",
|
|
1189
1194
|
"paused",
|
|
1190
1195
|
"budgetLimited",
|
|
1191
1196
|
"complete"
|
|
1192
1197
|
]);
|
|
1193
|
-
var threadTimelineGoalSchema =
|
|
1194
|
-
sourceSeq:
|
|
1195
|
-
updatedAt:
|
|
1196
|
-
objective:
|
|
1198
|
+
var threadTimelineGoalSchema = z13.object({
|
|
1199
|
+
sourceSeq: z13.number().int().nonnegative(),
|
|
1200
|
+
updatedAt: z13.number(),
|
|
1201
|
+
objective: z13.string(),
|
|
1197
1202
|
status: threadTimelineGoalStatusSchema,
|
|
1198
|
-
tokenBudget:
|
|
1199
|
-
tokensUsed:
|
|
1200
|
-
timeUsedSeconds:
|
|
1203
|
+
tokenBudget: z13.number().nullable(),
|
|
1204
|
+
tokensUsed: z13.number(),
|
|
1205
|
+
timeUsedSeconds: z13.number()
|
|
1201
1206
|
});
|
|
1202
1207
|
|
|
1203
1208
|
// ../domain/src/provider-event.ts
|
|
1204
|
-
var threadEventItemStatusSchema =
|
|
1209
|
+
var threadEventItemStatusSchema = z14.enum([
|
|
1205
1210
|
"pending",
|
|
1206
1211
|
"completed",
|
|
1207
1212
|
"failed",
|
|
1208
1213
|
"interrupted"
|
|
1209
1214
|
]);
|
|
1210
|
-
var threadEventItemApprovalStatusSchema =
|
|
1211
|
-
var threadEventTurnStatusSchema =
|
|
1215
|
+
var threadEventItemApprovalStatusSchema = z14.enum(["waiting_for_approval", "denied"]).nullable();
|
|
1216
|
+
var threadEventTurnStatusSchema = z14.enum([
|
|
1212
1217
|
"completed",
|
|
1213
1218
|
"failed",
|
|
1214
1219
|
"interrupted"
|
|
@@ -1234,262 +1239,262 @@ var providerErrorCategoryValues = [
|
|
|
1234
1239
|
"unauthorized",
|
|
1235
1240
|
"unknown"
|
|
1236
1241
|
];
|
|
1237
|
-
var providerErrorCategorySchema =
|
|
1238
|
-
var providerErrorInfoSchema =
|
|
1242
|
+
var providerErrorCategorySchema = z14.enum(providerErrorCategoryValues);
|
|
1243
|
+
var providerErrorInfoSchema = z14.object({
|
|
1239
1244
|
category: providerErrorCategorySchema,
|
|
1240
|
-
providerCode:
|
|
1241
|
-
httpStatusCode:
|
|
1245
|
+
providerCode: z14.string().nullable(),
|
|
1246
|
+
httpStatusCode: z14.number().nullable()
|
|
1242
1247
|
});
|
|
1243
|
-
var providerRateLimitStatusSchema =
|
|
1248
|
+
var providerRateLimitStatusSchema = z14.enum([
|
|
1244
1249
|
"allowed",
|
|
1245
1250
|
"warning",
|
|
1246
1251
|
"blocked",
|
|
1247
1252
|
"unknown"
|
|
1248
1253
|
]);
|
|
1249
|
-
var providerRateLimitWindowSchema =
|
|
1250
|
-
providerKey:
|
|
1251
|
-
label:
|
|
1254
|
+
var providerRateLimitWindowSchema = z14.object({
|
|
1255
|
+
providerKey: z14.string().min(1).nullable(),
|
|
1256
|
+
label: z14.string().min(1).nullable(),
|
|
1252
1257
|
status: providerRateLimitStatusSchema,
|
|
1253
|
-
resetsAtMs:
|
|
1258
|
+
resetsAtMs: z14.number().int().nonnegative().nullable()
|
|
1254
1259
|
});
|
|
1255
|
-
var providerRateLimitStateSchema =
|
|
1256
|
-
providerId:
|
|
1260
|
+
var providerRateLimitStateSchema = z14.object({
|
|
1261
|
+
providerId: z14.string().min(1),
|
|
1257
1262
|
status: providerRateLimitStatusSchema,
|
|
1258
|
-
kind:
|
|
1259
|
-
windows:
|
|
1260
|
-
reachedReason:
|
|
1261
|
-
overageStatus:
|
|
1262
|
-
overageReason:
|
|
1263
|
-
});
|
|
1264
|
-
var threadEventFileChangeKindSchema =
|
|
1265
|
-
var threadEventFileChangeSchema =
|
|
1266
|
-
path:
|
|
1263
|
+
kind: z14.enum(["subscription-window", "credits", "spend-control", "unknown"]),
|
|
1264
|
+
windows: z14.array(providerRateLimitWindowSchema),
|
|
1265
|
+
reachedReason: z14.string().min(1).nullable(),
|
|
1266
|
+
overageStatus: z14.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
|
|
1267
|
+
overageReason: z14.string().min(1).nullable()
|
|
1268
|
+
});
|
|
1269
|
+
var threadEventFileChangeKindSchema = z14.enum(["add", "delete", "update"]);
|
|
1270
|
+
var threadEventFileChangeSchema = z14.object({
|
|
1271
|
+
path: z14.string(),
|
|
1267
1272
|
kind: threadEventFileChangeKindSchema,
|
|
1268
|
-
movePath:
|
|
1269
|
-
diff:
|
|
1273
|
+
movePath: z14.string().optional(),
|
|
1274
|
+
diff: z14.string().optional()
|
|
1270
1275
|
});
|
|
1271
|
-
var threadEventPlanStepStatusSchema =
|
|
1276
|
+
var threadEventPlanStepStatusSchema = z14.enum([
|
|
1272
1277
|
"pending",
|
|
1273
1278
|
"active",
|
|
1274
1279
|
"completed",
|
|
1275
1280
|
"failed"
|
|
1276
1281
|
]);
|
|
1277
|
-
var threadEventPlanStepSchema =
|
|
1278
|
-
step:
|
|
1282
|
+
var threadEventPlanStepSchema = z14.object({
|
|
1283
|
+
step: z14.string(),
|
|
1279
1284
|
status: threadEventPlanStepStatusSchema.optional()
|
|
1280
1285
|
});
|
|
1281
1286
|
var itemPresentationField = {
|
|
1282
1287
|
presentation: threadEventItemPresentationSchema.optional()
|
|
1283
1288
|
};
|
|
1284
|
-
var threadEventWebSearchItemSchema =
|
|
1285
|
-
type:
|
|
1286
|
-
id:
|
|
1287
|
-
queries:
|
|
1288
|
-
resultText:
|
|
1289
|
+
var threadEventWebSearchItemSchema = z14.object({
|
|
1290
|
+
type: z14.literal("webSearch"),
|
|
1291
|
+
id: z14.string(),
|
|
1292
|
+
queries: z14.array(z14.string()).min(1),
|
|
1293
|
+
resultText: z14.string().nullable(),
|
|
1289
1294
|
...itemPresentationField,
|
|
1290
|
-
parentToolCallId:
|
|
1291
|
-
});
|
|
1292
|
-
var threadEventWebFetchItemSchema =
|
|
1293
|
-
type:
|
|
1294
|
-
id:
|
|
1295
|
-
url:
|
|
1296
|
-
prompt:
|
|
1297
|
-
pattern:
|
|
1298
|
-
resultText:
|
|
1295
|
+
parentToolCallId: z14.string().optional()
|
|
1296
|
+
});
|
|
1297
|
+
var threadEventWebFetchItemSchema = z14.object({
|
|
1298
|
+
type: z14.literal("webFetch"),
|
|
1299
|
+
id: z14.string(),
|
|
1300
|
+
url: z14.string(),
|
|
1301
|
+
prompt: z14.string().nullable(),
|
|
1302
|
+
pattern: z14.string().nullable(),
|
|
1303
|
+
resultText: z14.string().nullable(),
|
|
1299
1304
|
...itemPresentationField,
|
|
1300
|
-
parentToolCallId:
|
|
1305
|
+
parentToolCallId: z14.string().optional()
|
|
1301
1306
|
});
|
|
1302
|
-
var threadEventImageViewItemSchema =
|
|
1303
|
-
type:
|
|
1304
|
-
id:
|
|
1305
|
-
path:
|
|
1307
|
+
var threadEventImageViewItemSchema = z14.object({
|
|
1308
|
+
type: z14.literal("imageView"),
|
|
1309
|
+
id: z14.string(),
|
|
1310
|
+
path: z14.string(),
|
|
1306
1311
|
...itemPresentationField,
|
|
1307
|
-
parentToolCallId:
|
|
1312
|
+
parentToolCallId: z14.string().optional()
|
|
1308
1313
|
});
|
|
1309
|
-
var threadEventFileReadItemSchema =
|
|
1310
|
-
type:
|
|
1311
|
-
id:
|
|
1312
|
-
path:
|
|
1313
|
-
cmd:
|
|
1314
|
+
var threadEventFileReadItemSchema = z14.object({
|
|
1315
|
+
type: z14.literal("fileRead"),
|
|
1316
|
+
id: z14.string(),
|
|
1317
|
+
path: z14.string(),
|
|
1318
|
+
cmd: z14.string().optional(),
|
|
1314
1319
|
status: threadEventItemStatusSchema,
|
|
1315
1320
|
...itemPresentationField,
|
|
1316
|
-
parentToolCallId:
|
|
1321
|
+
parentToolCallId: z14.string().optional()
|
|
1317
1322
|
});
|
|
1318
|
-
var threadEventSearchModeSchema =
|
|
1319
|
-
var threadEventSearchItemSchema =
|
|
1320
|
-
type:
|
|
1321
|
-
id:
|
|
1323
|
+
var threadEventSearchModeSchema = z14.enum(["content", "path", "list"]);
|
|
1324
|
+
var threadEventSearchItemSchema = z14.object({
|
|
1325
|
+
type: z14.literal("search"),
|
|
1326
|
+
id: z14.string(),
|
|
1322
1327
|
mode: threadEventSearchModeSchema,
|
|
1323
|
-
query:
|
|
1324
|
-
path:
|
|
1325
|
-
cmd:
|
|
1328
|
+
query: z14.string(),
|
|
1329
|
+
path: z14.string().optional(),
|
|
1330
|
+
cmd: z14.string().optional(),
|
|
1326
1331
|
status: threadEventItemStatusSchema,
|
|
1327
1332
|
...itemPresentationField,
|
|
1328
|
-
parentToolCallId:
|
|
1333
|
+
parentToolCallId: z14.string().optional()
|
|
1329
1334
|
});
|
|
1330
|
-
var threadEventDelegationItemSchema =
|
|
1331
|
-
type:
|
|
1332
|
-
id:
|
|
1333
|
-
childRef:
|
|
1334
|
-
label:
|
|
1335
|
+
var threadEventDelegationItemSchema = z14.object({
|
|
1336
|
+
type: z14.literal("delegation"),
|
|
1337
|
+
id: z14.string(),
|
|
1338
|
+
childRef: z14.string().min(1),
|
|
1339
|
+
label: z14.string(),
|
|
1335
1340
|
status: threadEventItemStatusSchema,
|
|
1336
|
-
background:
|
|
1337
|
-
summary:
|
|
1341
|
+
background: z14.boolean(),
|
|
1342
|
+
summary: z14.string().optional(),
|
|
1338
1343
|
...itemPresentationField,
|
|
1339
|
-
parentToolCallId:
|
|
1344
|
+
parentToolCallId: z14.string().optional()
|
|
1340
1345
|
});
|
|
1341
|
-
var threadEventPlanStepsItemSchema =
|
|
1342
|
-
type:
|
|
1343
|
-
id:
|
|
1344
|
-
steps:
|
|
1345
|
-
explanation:
|
|
1346
|
+
var threadEventPlanStepsItemSchema = z14.object({
|
|
1347
|
+
type: z14.literal("planSteps"),
|
|
1348
|
+
id: z14.string(),
|
|
1349
|
+
steps: z14.array(threadEventPlanStepSchema),
|
|
1350
|
+
explanation: z14.string().optional(),
|
|
1346
1351
|
status: threadEventItemStatusSchema,
|
|
1347
1352
|
...itemPresentationField,
|
|
1348
|
-
parentToolCallId:
|
|
1353
|
+
parentToolCallId: z14.string().optional()
|
|
1349
1354
|
});
|
|
1350
|
-
var threadEventExtensionItemSchema =
|
|
1351
|
-
type:
|
|
1352
|
-
id:
|
|
1355
|
+
var threadEventExtensionItemSchema = z14.object({
|
|
1356
|
+
type: z14.literal("extension"),
|
|
1357
|
+
id: z14.string(),
|
|
1353
1358
|
kind: extensionKindSchema,
|
|
1354
1359
|
payload: jsonValueSchema,
|
|
1355
1360
|
status: threadEventItemStatusSchema,
|
|
1356
1361
|
presentation: threadEventItemPresentationSchema,
|
|
1357
|
-
parentToolCallId:
|
|
1362
|
+
parentToolCallId: z14.string().optional()
|
|
1358
1363
|
});
|
|
1359
|
-
var threadEventTextTruncationSchema =
|
|
1360
|
-
originalLength:
|
|
1361
|
-
retainedHeadLength:
|
|
1362
|
-
retainedTailLength:
|
|
1363
|
-
truncatedAt:
|
|
1364
|
+
var threadEventTextTruncationSchema = z14.object({
|
|
1365
|
+
originalLength: z14.number(),
|
|
1366
|
+
retainedHeadLength: z14.number(),
|
|
1367
|
+
retainedTailLength: z14.number(),
|
|
1368
|
+
truncatedAt: z14.number()
|
|
1364
1369
|
});
|
|
1365
|
-
var threadEventItemTruncationSchema =
|
|
1370
|
+
var threadEventItemTruncationSchema = z14.object({
|
|
1366
1371
|
aggregatedOutput: threadEventTextTruncationSchema.optional(),
|
|
1367
1372
|
result: threadEventTextTruncationSchema.optional(),
|
|
1368
1373
|
resultText: threadEventTextTruncationSchema.optional()
|
|
1369
1374
|
});
|
|
1370
|
-
var threadEventImageGenerationItemSchema =
|
|
1371
|
-
type:
|
|
1372
|
-
id:
|
|
1375
|
+
var threadEventImageGenerationItemSchema = z14.object({
|
|
1376
|
+
type: z14.literal("imageGeneration"),
|
|
1377
|
+
id: z14.string(),
|
|
1373
1378
|
status: threadEventItemStatusSchema,
|
|
1374
|
-
prompt:
|
|
1375
|
-
path:
|
|
1376
|
-
result:
|
|
1377
|
-
error:
|
|
1378
|
-
transparentBackground:
|
|
1379
|
+
prompt: z14.string().nullable(),
|
|
1380
|
+
path: z14.string().nullable(),
|
|
1381
|
+
result: z14.string().optional(),
|
|
1382
|
+
error: z14.string().nullable(),
|
|
1383
|
+
transparentBackground: z14.boolean(),
|
|
1379
1384
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1380
1385
|
...itemPresentationField,
|
|
1381
|
-
parentToolCallId:
|
|
1386
|
+
parentToolCallId: z14.string().optional()
|
|
1382
1387
|
});
|
|
1383
|
-
var threadEventUserContentSchema =
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
+
var threadEventUserContentSchema = z14.discriminatedUnion("type", [
|
|
1389
|
+
z14.object({ type: z14.literal("text"), text: z14.string() }),
|
|
1390
|
+
z14.object({ type: z14.literal("image"), url: z14.string() }),
|
|
1391
|
+
z14.object({ type: z14.literal("localImage"), path: z14.string() }),
|
|
1392
|
+
z14.object({ type: z14.literal("localFile"), path: z14.string() })
|
|
1388
1393
|
]);
|
|
1389
|
-
var threadEventTokenUsageBreakdownSchema =
|
|
1390
|
-
totalTokens:
|
|
1391
|
-
inputTokens:
|
|
1392
|
-
cachedInputTokens:
|
|
1393
|
-
cacheReadInputTokens:
|
|
1394
|
-
cacheWriteInputTokens:
|
|
1395
|
-
outputTokens:
|
|
1396
|
-
reasoningOutputTokens:
|
|
1397
|
-
});
|
|
1398
|
-
var threadEventContextWindowUsageSchema =
|
|
1394
|
+
var threadEventTokenUsageBreakdownSchema = z14.object({
|
|
1395
|
+
totalTokens: z14.number(),
|
|
1396
|
+
inputTokens: z14.number(),
|
|
1397
|
+
cachedInputTokens: z14.number(),
|
|
1398
|
+
cacheReadInputTokens: z14.number().nonnegative().optional(),
|
|
1399
|
+
cacheWriteInputTokens: z14.number().nonnegative().optional(),
|
|
1400
|
+
outputTokens: z14.number(),
|
|
1401
|
+
reasoningOutputTokens: z14.number()
|
|
1402
|
+
});
|
|
1403
|
+
var threadEventContextWindowUsageSchema = z14.object({
|
|
1399
1404
|
snapshot: contextSnapshotSchema.optional(),
|
|
1400
|
-
usedTokens:
|
|
1401
|
-
modelContextWindow:
|
|
1402
|
-
estimated:
|
|
1405
|
+
usedTokens: z14.number().nullable(),
|
|
1406
|
+
modelContextWindow: z14.number().nullable(),
|
|
1407
|
+
estimated: z14.boolean()
|
|
1403
1408
|
});
|
|
1404
|
-
var threadEventTokenUsageSchema =
|
|
1409
|
+
var threadEventTokenUsageSchema = z14.object({
|
|
1405
1410
|
total: threadEventTokenUsageBreakdownSchema,
|
|
1406
1411
|
last: threadEventTokenUsageBreakdownSchema,
|
|
1407
|
-
modelContextWindow:
|
|
1412
|
+
modelContextWindow: z14.number().nullable()
|
|
1408
1413
|
});
|
|
1409
|
-
var threadEventWarningCategorySchema =
|
|
1414
|
+
var threadEventWarningCategorySchema = z14.enum([
|
|
1410
1415
|
"deprecation",
|
|
1411
1416
|
"config",
|
|
1412
1417
|
"general",
|
|
1413
1418
|
"compaction-skipped"
|
|
1414
1419
|
]);
|
|
1415
|
-
var providerRawEventSchema =
|
|
1416
|
-
jsonrpc:
|
|
1417
|
-
id:
|
|
1418
|
-
method:
|
|
1420
|
+
var providerRawEventSchema = z14.object({
|
|
1421
|
+
jsonrpc: z14.literal("2.0"),
|
|
1422
|
+
id: z14.union([z14.string(), z14.number()]).optional(),
|
|
1423
|
+
method: z14.string(),
|
|
1419
1424
|
params: jsonValueSchema.optional()
|
|
1420
1425
|
});
|
|
1421
|
-
var providerUnhandledEventSchema =
|
|
1422
|
-
type:
|
|
1423
|
-
threadId:
|
|
1424
|
-
providerThreadId:
|
|
1425
|
-
providerId:
|
|
1426
|
-
rawType:
|
|
1426
|
+
var providerUnhandledEventSchema = z14.object({
|
|
1427
|
+
type: z14.literal("provider/unhandled"),
|
|
1428
|
+
threadId: z14.string(),
|
|
1429
|
+
providerThreadId: z14.string(),
|
|
1430
|
+
providerId: z14.string(),
|
|
1431
|
+
rawType: z14.string(),
|
|
1427
1432
|
rawEvent: providerRawEventSchema,
|
|
1428
|
-
parentToolCallId:
|
|
1429
|
-
});
|
|
1430
|
-
var toolCallProgressEventSchema =
|
|
1431
|
-
type:
|
|
1432
|
-
threadId:
|
|
1433
|
-
providerThreadId:
|
|
1434
|
-
itemId:
|
|
1435
|
-
message:
|
|
1436
|
-
parentToolCallId:
|
|
1437
|
-
});
|
|
1438
|
-
var threadEventBackgroundTaskItemSchema =
|
|
1439
|
-
type:
|
|
1440
|
-
id:
|
|
1441
|
-
familyId:
|
|
1442
|
-
taskType:
|
|
1443
|
-
description:
|
|
1433
|
+
parentToolCallId: z14.string().optional()
|
|
1434
|
+
});
|
|
1435
|
+
var toolCallProgressEventSchema = z14.object({
|
|
1436
|
+
type: z14.literal("item/toolCall/progress"),
|
|
1437
|
+
threadId: z14.string(),
|
|
1438
|
+
providerThreadId: z14.string(),
|
|
1439
|
+
itemId: z14.string(),
|
|
1440
|
+
message: z14.string().optional(),
|
|
1441
|
+
parentToolCallId: z14.string().optional()
|
|
1442
|
+
});
|
|
1443
|
+
var threadEventBackgroundTaskItemSchema = z14.object({
|
|
1444
|
+
type: z14.literal("backgroundTask"),
|
|
1445
|
+
id: z14.string(),
|
|
1446
|
+
familyId: z14.string().optional(),
|
|
1447
|
+
taskType: z14.string(),
|
|
1448
|
+
description: z14.string(),
|
|
1444
1449
|
status: threadEventItemStatusSchema,
|
|
1445
1450
|
taskStatus: backgroundTaskStatusSchema,
|
|
1446
|
-
skipTranscript:
|
|
1447
|
-
workflowName:
|
|
1451
|
+
skipTranscript: z14.boolean(),
|
|
1452
|
+
workflowName: z14.string().optional(),
|
|
1448
1453
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
1449
1454
|
usage: backgroundTaskUsageSchema.optional(),
|
|
1450
|
-
summary:
|
|
1451
|
-
error:
|
|
1452
|
-
outputFile:
|
|
1455
|
+
summary: z14.string().optional(),
|
|
1456
|
+
error: z14.string().optional(),
|
|
1457
|
+
outputFile: z14.string().optional(),
|
|
1453
1458
|
...itemPresentationField,
|
|
1454
|
-
parentToolCallId:
|
|
1459
|
+
parentToolCallId: z14.string().optional()
|
|
1455
1460
|
});
|
|
1456
|
-
var threadEventItemSchema =
|
|
1457
|
-
|
|
1458
|
-
type:
|
|
1459
|
-
id:
|
|
1460
|
-
content:
|
|
1461
|
+
var threadEventItemSchema = z14.discriminatedUnion("type", [
|
|
1462
|
+
z14.object({
|
|
1463
|
+
type: z14.literal("userMessage"),
|
|
1464
|
+
id: z14.string(),
|
|
1465
|
+
content: z14.array(threadEventUserContentSchema),
|
|
1461
1466
|
clientRequestId: clientTurnRequestIdSchema.optional(),
|
|
1462
|
-
parentToolCallId:
|
|
1467
|
+
parentToolCallId: z14.string().optional()
|
|
1463
1468
|
}).strict(),
|
|
1464
|
-
|
|
1465
|
-
type:
|
|
1466
|
-
id:
|
|
1467
|
-
text:
|
|
1469
|
+
z14.object({
|
|
1470
|
+
type: z14.literal("agentMessage"),
|
|
1471
|
+
id: z14.string(),
|
|
1472
|
+
text: z14.string(),
|
|
1468
1473
|
...itemPresentationField,
|
|
1469
|
-
parentToolCallId:
|
|
1474
|
+
parentToolCallId: z14.string().optional()
|
|
1470
1475
|
}),
|
|
1471
|
-
|
|
1472
|
-
type:
|
|
1473
|
-
id:
|
|
1474
|
-
command:
|
|
1475
|
-
cwd:
|
|
1476
|
+
z14.object({
|
|
1477
|
+
type: z14.literal("commandExecution"),
|
|
1478
|
+
id: z14.string(),
|
|
1479
|
+
command: z14.string(),
|
|
1480
|
+
cwd: z14.string(),
|
|
1476
1481
|
status: threadEventItemStatusSchema,
|
|
1477
1482
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1478
|
-
aggregatedOutput:
|
|
1479
|
-
exitCode:
|
|
1480
|
-
durationMs:
|
|
1483
|
+
aggregatedOutput: z14.string().optional(),
|
|
1484
|
+
exitCode: z14.number().optional(),
|
|
1485
|
+
durationMs: z14.number().optional(),
|
|
1481
1486
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1482
1487
|
...itemPresentationField,
|
|
1483
|
-
parentToolCallId:
|
|
1488
|
+
parentToolCallId: z14.string().optional()
|
|
1484
1489
|
}),
|
|
1485
|
-
|
|
1486
|
-
type:
|
|
1487
|
-
id:
|
|
1488
|
-
changes:
|
|
1490
|
+
z14.object({
|
|
1491
|
+
type: z14.literal("fileChange"),
|
|
1492
|
+
id: z14.string(),
|
|
1493
|
+
changes: z14.array(threadEventFileChangeSchema),
|
|
1489
1494
|
status: threadEventItemStatusSchema,
|
|
1490
1495
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1491
1496
|
...itemPresentationField,
|
|
1492
|
-
parentToolCallId:
|
|
1497
|
+
parentToolCallId: z14.string().optional()
|
|
1493
1498
|
}),
|
|
1494
1499
|
threadEventWebSearchItemSchema,
|
|
1495
1500
|
threadEventWebFetchItemSchema,
|
|
@@ -1497,264 +1502,264 @@ var threadEventItemSchema = z13.discriminatedUnion("type", [
|
|
|
1497
1502
|
threadEventImageGenerationItemSchema,
|
|
1498
1503
|
threadEventFileReadItemSchema,
|
|
1499
1504
|
threadEventSearchItemSchema,
|
|
1500
|
-
|
|
1501
|
-
type:
|
|
1502
|
-
id:
|
|
1503
|
-
server:
|
|
1504
|
-
tool:
|
|
1505
|
-
arguments:
|
|
1505
|
+
z14.object({
|
|
1506
|
+
type: z14.literal("toolCall"),
|
|
1507
|
+
id: z14.string(),
|
|
1508
|
+
server: z14.string().optional(),
|
|
1509
|
+
tool: z14.string(),
|
|
1510
|
+
arguments: z14.record(z14.string(), z14.unknown()).optional(),
|
|
1506
1511
|
status: threadEventItemStatusSchema,
|
|
1507
|
-
result:
|
|
1508
|
-
error:
|
|
1509
|
-
durationMs:
|
|
1512
|
+
result: z14.unknown().optional(),
|
|
1513
|
+
error: z14.string().optional(),
|
|
1514
|
+
durationMs: z14.number().optional(),
|
|
1510
1515
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1511
1516
|
...itemPresentationField,
|
|
1512
|
-
parentToolCallId:
|
|
1517
|
+
parentToolCallId: z14.string().optional()
|
|
1513
1518
|
}),
|
|
1514
|
-
|
|
1515
|
-
type:
|
|
1516
|
-
id:
|
|
1517
|
-
summary:
|
|
1518
|
-
content:
|
|
1519
|
+
z14.object({
|
|
1520
|
+
type: z14.literal("reasoning"),
|
|
1521
|
+
id: z14.string(),
|
|
1522
|
+
summary: z14.array(z14.string()),
|
|
1523
|
+
content: z14.array(z14.string()),
|
|
1519
1524
|
...itemPresentationField,
|
|
1520
|
-
parentToolCallId:
|
|
1525
|
+
parentToolCallId: z14.string().optional()
|
|
1521
1526
|
}),
|
|
1522
|
-
|
|
1523
|
-
type:
|
|
1524
|
-
id:
|
|
1525
|
-
text:
|
|
1527
|
+
z14.object({
|
|
1528
|
+
type: z14.literal("plan"),
|
|
1529
|
+
id: z14.string(),
|
|
1530
|
+
text: z14.string(),
|
|
1526
1531
|
...itemPresentationField,
|
|
1527
|
-
parentToolCallId:
|
|
1532
|
+
parentToolCallId: z14.string().optional()
|
|
1528
1533
|
}),
|
|
1529
1534
|
threadEventPlanStepsItemSchema,
|
|
1530
|
-
|
|
1531
|
-
type:
|
|
1532
|
-
id:
|
|
1535
|
+
z14.object({
|
|
1536
|
+
type: z14.literal("contextCompaction"),
|
|
1537
|
+
id: z14.string(),
|
|
1533
1538
|
...itemPresentationField,
|
|
1534
|
-
parentToolCallId:
|
|
1539
|
+
parentToolCallId: z14.string().optional()
|
|
1535
1540
|
}),
|
|
1536
1541
|
threadEventBackgroundTaskItemSchema,
|
|
1537
1542
|
threadEventDelegationItemSchema,
|
|
1538
1543
|
threadEventExtensionItemSchema
|
|
1539
1544
|
]);
|
|
1540
1545
|
function itemTextDeltaEventSchema(type) {
|
|
1541
|
-
return
|
|
1542
|
-
type:
|
|
1543
|
-
threadId:
|
|
1544
|
-
providerThreadId:
|
|
1545
|
-
itemId:
|
|
1546
|
-
delta:
|
|
1547
|
-
parentToolCallId:
|
|
1546
|
+
return z14.object({
|
|
1547
|
+
type: z14.literal(type),
|
|
1548
|
+
threadId: z14.string(),
|
|
1549
|
+
providerThreadId: z14.string(),
|
|
1550
|
+
itemId: z14.string(),
|
|
1551
|
+
delta: z14.string(),
|
|
1552
|
+
parentToolCallId: z14.string().optional()
|
|
1548
1553
|
});
|
|
1549
1554
|
}
|
|
1550
|
-
var unscopedProviderEventSchema =
|
|
1551
|
-
|
|
1552
|
-
type:
|
|
1553
|
-
threadId:
|
|
1555
|
+
var unscopedProviderEventSchema = z14.discriminatedUnion("type", [
|
|
1556
|
+
z14.object({
|
|
1557
|
+
type: z14.literal("thread/started"),
|
|
1558
|
+
threadId: z14.string()
|
|
1554
1559
|
}),
|
|
1555
|
-
|
|
1556
|
-
type:
|
|
1557
|
-
threadId:
|
|
1558
|
-
providerThreadId:
|
|
1560
|
+
z14.object({
|
|
1561
|
+
type: z14.literal("thread/identity"),
|
|
1562
|
+
threadId: z14.string(),
|
|
1563
|
+
providerThreadId: z14.string()
|
|
1559
1564
|
}),
|
|
1560
|
-
|
|
1561
|
-
type:
|
|
1562
|
-
threadId:
|
|
1563
|
-
providerThreadId:
|
|
1564
|
-
parentToolCallId:
|
|
1565
|
+
z14.object({
|
|
1566
|
+
type: z14.literal("turn/started"),
|
|
1567
|
+
threadId: z14.string(),
|
|
1568
|
+
providerThreadId: z14.string(),
|
|
1569
|
+
parentToolCallId: z14.string().optional()
|
|
1565
1570
|
}),
|
|
1566
|
-
|
|
1567
|
-
type:
|
|
1568
|
-
threadId:
|
|
1569
|
-
providerThreadId:
|
|
1571
|
+
z14.object({
|
|
1572
|
+
type: z14.literal("turn/completed"),
|
|
1573
|
+
threadId: z14.string(),
|
|
1574
|
+
providerThreadId: z14.string().nullable(),
|
|
1570
1575
|
status: threadEventTurnStatusSchema,
|
|
1571
|
-
error:
|
|
1572
|
-
providerCheckpointId:
|
|
1576
|
+
error: z14.object({ message: z14.string() }).optional(),
|
|
1577
|
+
providerCheckpointId: z14.string().min(1).optional()
|
|
1573
1578
|
}),
|
|
1574
|
-
|
|
1575
|
-
type:
|
|
1576
|
-
threadId:
|
|
1577
|
-
providerThreadId:
|
|
1579
|
+
z14.object({
|
|
1580
|
+
type: z14.literal("turn/input/accepted"),
|
|
1581
|
+
threadId: z14.string(),
|
|
1582
|
+
providerThreadId: z14.string(),
|
|
1578
1583
|
clientRequestId: clientTurnRequestIdSchema,
|
|
1579
1584
|
scope: threadEventScopeSchema
|
|
1580
1585
|
}).strict(),
|
|
1581
|
-
|
|
1582
|
-
type:
|
|
1583
|
-
threadId:
|
|
1584
|
-
providerThreadId:
|
|
1585
|
-
threadName:
|
|
1586
|
+
z14.object({
|
|
1587
|
+
type: z14.literal("thread/name/updated"),
|
|
1588
|
+
threadId: z14.string(),
|
|
1589
|
+
providerThreadId: z14.string(),
|
|
1590
|
+
threadName: z14.string()
|
|
1586
1591
|
}),
|
|
1587
|
-
|
|
1588
|
-
type:
|
|
1589
|
-
threadId:
|
|
1590
|
-
providerThreadId:
|
|
1592
|
+
z14.object({
|
|
1593
|
+
type: z14.literal("thread/compacted"),
|
|
1594
|
+
threadId: z14.string(),
|
|
1595
|
+
providerThreadId: z14.string()
|
|
1591
1596
|
}),
|
|
1592
|
-
|
|
1593
|
-
type:
|
|
1594
|
-
threadId:
|
|
1595
|
-
providerThreadId:
|
|
1597
|
+
z14.object({
|
|
1598
|
+
type: z14.literal("thread/context/cleared"),
|
|
1599
|
+
threadId: z14.string(),
|
|
1600
|
+
providerThreadId: z14.string()
|
|
1596
1601
|
}),
|
|
1597
|
-
|
|
1598
|
-
type:
|
|
1599
|
-
threadId:
|
|
1600
|
-
providerThreadId:
|
|
1601
|
-
objective:
|
|
1602
|
+
z14.object({
|
|
1603
|
+
type: z14.literal("thread/goal/updated"),
|
|
1604
|
+
threadId: z14.string(),
|
|
1605
|
+
providerThreadId: z14.string(),
|
|
1606
|
+
objective: z14.string(),
|
|
1602
1607
|
status: threadTimelineGoalStatusSchema,
|
|
1603
|
-
tokenBudget:
|
|
1604
|
-
tokensUsed:
|
|
1605
|
-
timeUsedSeconds:
|
|
1608
|
+
tokenBudget: z14.number().nullable(),
|
|
1609
|
+
tokensUsed: z14.number(),
|
|
1610
|
+
timeUsedSeconds: z14.number()
|
|
1606
1611
|
}),
|
|
1607
|
-
|
|
1608
|
-
type:
|
|
1609
|
-
threadId:
|
|
1610
|
-
providerThreadId:
|
|
1612
|
+
z14.object({
|
|
1613
|
+
type: z14.literal("thread/goal/cleared"),
|
|
1614
|
+
threadId: z14.string(),
|
|
1615
|
+
providerThreadId: z14.string()
|
|
1611
1616
|
}),
|
|
1612
|
-
|
|
1613
|
-
type:
|
|
1614
|
-
threadId:
|
|
1615
|
-
providerThreadId:
|
|
1617
|
+
z14.object({
|
|
1618
|
+
type: z14.literal("item/started"),
|
|
1619
|
+
threadId: z14.string(),
|
|
1620
|
+
providerThreadId: z14.string(),
|
|
1616
1621
|
item: threadEventItemSchema
|
|
1617
1622
|
}),
|
|
1618
|
-
|
|
1619
|
-
type:
|
|
1620
|
-
threadId:
|
|
1621
|
-
providerThreadId:
|
|
1623
|
+
z14.object({
|
|
1624
|
+
type: z14.literal("item/completed"),
|
|
1625
|
+
threadId: z14.string(),
|
|
1626
|
+
providerThreadId: z14.string(),
|
|
1622
1627
|
item: threadEventItemSchema
|
|
1623
1628
|
}),
|
|
1624
1629
|
itemTextDeltaEventSchema("item/agentMessage/delta"),
|
|
1625
|
-
|
|
1626
|
-
type:
|
|
1627
|
-
threadId:
|
|
1628
|
-
providerThreadId:
|
|
1629
|
-
itemId:
|
|
1630
|
-
delta:
|
|
1631
|
-
reset:
|
|
1632
|
-
parentToolCallId:
|
|
1630
|
+
z14.object({
|
|
1631
|
+
type: z14.literal("item/commandExecution/outputDelta"),
|
|
1632
|
+
threadId: z14.string(),
|
|
1633
|
+
providerThreadId: z14.string(),
|
|
1634
|
+
itemId: z14.string(),
|
|
1635
|
+
delta: z14.string(),
|
|
1636
|
+
reset: z14.boolean().optional(),
|
|
1637
|
+
parentToolCallId: z14.string().optional()
|
|
1633
1638
|
}),
|
|
1634
1639
|
itemTextDeltaEventSchema("item/fileChange/outputDelta"),
|
|
1635
1640
|
itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
|
|
1636
1641
|
itemTextDeltaEventSchema("item/reasoning/textDelta"),
|
|
1637
1642
|
itemTextDeltaEventSchema("item/plan/delta"),
|
|
1638
|
-
|
|
1639
|
-
type:
|
|
1640
|
-
threadId:
|
|
1641
|
-
providerThreadId:
|
|
1642
|
-
itemId:
|
|
1643
|
-
message:
|
|
1644
|
-
parentToolCallId:
|
|
1643
|
+
z14.object({
|
|
1644
|
+
type: z14.literal("item/mcpToolCall/progress"),
|
|
1645
|
+
threadId: z14.string(),
|
|
1646
|
+
providerThreadId: z14.string(),
|
|
1647
|
+
itemId: z14.string(),
|
|
1648
|
+
message: z14.string().optional(),
|
|
1649
|
+
parentToolCallId: z14.string().optional()
|
|
1645
1650
|
}),
|
|
1646
1651
|
toolCallProgressEventSchema,
|
|
1647
|
-
|
|
1648
|
-
type:
|
|
1649
|
-
threadId:
|
|
1650
|
-
providerThreadId:
|
|
1652
|
+
z14.object({
|
|
1653
|
+
type: z14.literal("item/backgroundTask/progress"),
|
|
1654
|
+
threadId: z14.string(),
|
|
1655
|
+
providerThreadId: z14.string(),
|
|
1651
1656
|
item: threadEventBackgroundTaskItemSchema
|
|
1652
1657
|
}),
|
|
1653
|
-
|
|
1654
|
-
type:
|
|
1655
|
-
threadId:
|
|
1656
|
-
providerThreadId:
|
|
1658
|
+
z14.object({
|
|
1659
|
+
type: z14.literal("item/backgroundTask/completed"),
|
|
1660
|
+
threadId: z14.string(),
|
|
1661
|
+
providerThreadId: z14.string(),
|
|
1657
1662
|
item: threadEventBackgroundTaskItemSchema
|
|
1658
1663
|
}),
|
|
1659
|
-
|
|
1660
|
-
type:
|
|
1661
|
-
threadId:
|
|
1662
|
-
providerThreadId:
|
|
1664
|
+
z14.object({
|
|
1665
|
+
type: z14.literal("item/delegation/progress"),
|
|
1666
|
+
threadId: z14.string(),
|
|
1667
|
+
providerThreadId: z14.string(),
|
|
1663
1668
|
item: threadEventDelegationItemSchema
|
|
1664
1669
|
}),
|
|
1665
|
-
|
|
1666
|
-
type:
|
|
1667
|
-
threadId:
|
|
1668
|
-
providerThreadId:
|
|
1670
|
+
z14.object({
|
|
1671
|
+
type: z14.literal("item/delegation/completed"),
|
|
1672
|
+
threadId: z14.string(),
|
|
1673
|
+
providerThreadId: z14.string(),
|
|
1669
1674
|
item: threadEventDelegationItemSchema
|
|
1670
1675
|
}),
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
threadId:
|
|
1674
|
-
providerThreadId:
|
|
1676
|
+
z14.object({
|
|
1677
|
+
type: z14.literal("thread/tokenUsage/updated"),
|
|
1678
|
+
threadId: z14.string(),
|
|
1679
|
+
providerThreadId: z14.string(),
|
|
1675
1680
|
tokenUsage: threadEventTokenUsageSchema
|
|
1676
1681
|
}),
|
|
1677
|
-
|
|
1678
|
-
type:
|
|
1679
|
-
threadId:
|
|
1680
|
-
providerThreadId:
|
|
1682
|
+
z14.object({
|
|
1683
|
+
type: z14.literal("thread/contextWindowUsage/updated"),
|
|
1684
|
+
threadId: z14.string(),
|
|
1685
|
+
providerThreadId: z14.string(),
|
|
1681
1686
|
contextWindowUsage: threadEventContextWindowUsageSchema
|
|
1682
1687
|
}),
|
|
1683
|
-
|
|
1684
|
-
type:
|
|
1685
|
-
threadId:
|
|
1686
|
-
providerThreadId:
|
|
1687
|
-
plan:
|
|
1688
|
-
explanation:
|
|
1688
|
+
z14.object({
|
|
1689
|
+
type: z14.literal("turn/plan/updated"),
|
|
1690
|
+
threadId: z14.string(),
|
|
1691
|
+
providerThreadId: z14.string(),
|
|
1692
|
+
plan: z14.array(threadEventPlanStepSchema),
|
|
1693
|
+
explanation: z14.string().optional()
|
|
1689
1694
|
}),
|
|
1690
|
-
|
|
1691
|
-
type:
|
|
1692
|
-
threadId:
|
|
1693
|
-
providerThreadId:
|
|
1694
|
-
diff:
|
|
1695
|
+
z14.object({
|
|
1696
|
+
type: z14.literal("turn/diff/updated"),
|
|
1697
|
+
threadId: z14.string(),
|
|
1698
|
+
providerThreadId: z14.string(),
|
|
1699
|
+
diff: z14.string().optional()
|
|
1695
1700
|
}),
|
|
1696
|
-
|
|
1697
|
-
type:
|
|
1698
|
-
threadId:
|
|
1699
|
-
providerThreadId:
|
|
1700
|
-
message:
|
|
1701
|
-
detail:
|
|
1702
|
-
willRetry:
|
|
1701
|
+
z14.object({
|
|
1702
|
+
type: z14.literal("provider/error"),
|
|
1703
|
+
threadId: z14.string(),
|
|
1704
|
+
providerThreadId: z14.string(),
|
|
1705
|
+
message: z14.string(),
|
|
1706
|
+
detail: z14.string().optional(),
|
|
1707
|
+
willRetry: z14.boolean().optional(),
|
|
1703
1708
|
errorInfo: providerErrorInfoSchema.optional()
|
|
1704
1709
|
}),
|
|
1705
|
-
|
|
1706
|
-
type:
|
|
1707
|
-
threadId:
|
|
1708
|
-
providerThreadId:
|
|
1710
|
+
z14.object({
|
|
1711
|
+
type: z14.literal("provider/rateLimits/updated"),
|
|
1712
|
+
threadId: z14.string(),
|
|
1713
|
+
providerThreadId: z14.string(),
|
|
1709
1714
|
rateLimits: providerRateLimitStateSchema
|
|
1710
1715
|
}),
|
|
1711
|
-
|
|
1712
|
-
type:
|
|
1713
|
-
threadId:
|
|
1714
|
-
providerThreadId:
|
|
1715
|
-
entries:
|
|
1716
|
-
|
|
1717
|
-
name:
|
|
1718
|
-
source:
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1716
|
+
z14.object({
|
|
1717
|
+
type: z14.literal("provider.env-resolved"),
|
|
1718
|
+
threadId: z14.string(),
|
|
1719
|
+
providerThreadId: z14.string(),
|
|
1720
|
+
entries: z14.array(
|
|
1721
|
+
z14.object({
|
|
1722
|
+
name: z14.string(),
|
|
1723
|
+
source: z14.union([
|
|
1724
|
+
z14.literal("shell"),
|
|
1725
|
+
z14.object({ plugin: z14.string() }).strict(),
|
|
1726
|
+
z14.object({ core: z14.enum(["machine-git", "machine-environment"]) }).strict()
|
|
1722
1727
|
]),
|
|
1723
|
-
value:
|
|
1724
|
-
|
|
1725
|
-
|
|
1728
|
+
value: z14.union([
|
|
1729
|
+
z14.string(),
|
|
1730
|
+
z14.object({ masked: z14.literal(true) }).strict()
|
|
1726
1731
|
]),
|
|
1727
|
-
reason:
|
|
1732
|
+
reason: z14.string().optional()
|
|
1728
1733
|
}).strict()
|
|
1729
1734
|
)
|
|
1730
1735
|
}),
|
|
1731
|
-
|
|
1732
|
-
type:
|
|
1733
|
-
threadId:
|
|
1734
|
-
providerThreadId:
|
|
1736
|
+
z14.object({
|
|
1737
|
+
type: z14.literal("thread/extensionState/updated"),
|
|
1738
|
+
threadId: z14.string(),
|
|
1739
|
+
providerThreadId: z14.string(),
|
|
1735
1740
|
kind: extensionKindSchema,
|
|
1736
1741
|
payload: jsonValueSchema
|
|
1737
1742
|
}),
|
|
1738
|
-
|
|
1739
|
-
type:
|
|
1740
|
-
threadId:
|
|
1741
|
-
providerThreadId:
|
|
1743
|
+
z14.object({
|
|
1744
|
+
type: z14.literal("provider/warning"),
|
|
1745
|
+
threadId: z14.string(),
|
|
1746
|
+
providerThreadId: z14.string(),
|
|
1742
1747
|
category: threadEventWarningCategorySchema,
|
|
1743
|
-
summary:
|
|
1744
|
-
details:
|
|
1748
|
+
summary: z14.string().optional(),
|
|
1749
|
+
details: z14.string().optional()
|
|
1745
1750
|
}),
|
|
1746
|
-
|
|
1747
|
-
type:
|
|
1748
|
-
threadId:
|
|
1749
|
-
providerThreadId:
|
|
1750
|
-
originalModel:
|
|
1751
|
-
fallbackModel:
|
|
1752
|
-
reason:
|
|
1753
|
-
message:
|
|
1751
|
+
z14.object({
|
|
1752
|
+
type: z14.literal("provider/modelFallback"),
|
|
1753
|
+
threadId: z14.string(),
|
|
1754
|
+
providerThreadId: z14.string(),
|
|
1755
|
+
originalModel: z14.string().min(1),
|
|
1756
|
+
fallbackModel: z14.string().min(1),
|
|
1757
|
+
reason: z14.enum(["refusal", "provider"]),
|
|
1758
|
+
message: z14.string()
|
|
1754
1759
|
}),
|
|
1755
1760
|
providerUnhandledEventSchema
|
|
1756
1761
|
]);
|
|
1757
|
-
var scopedEventDataSchema =
|
|
1762
|
+
var scopedEventDataSchema = z14.object({
|
|
1758
1763
|
scope: threadEventScopeSchema
|
|
1759
1764
|
});
|
|
1760
1765
|
var providerEventSchema = unscopedProviderEventSchema.and(
|
|
@@ -1763,58 +1768,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
|
|
|
1763
1768
|
var providerEventTypeValues = unscopedProviderEventSchema.options.map(
|
|
1764
1769
|
(option) => option.shape.type.value
|
|
1765
1770
|
);
|
|
1766
|
-
var unscopedSystemEventSchema =
|
|
1767
|
-
|
|
1768
|
-
type:
|
|
1769
|
-
threadId:
|
|
1771
|
+
var unscopedSystemEventSchema = z14.discriminatedUnion("type", [
|
|
1772
|
+
z14.object({
|
|
1773
|
+
type: z14.literal("client/thread/start"),
|
|
1774
|
+
threadId: z14.string()
|
|
1770
1775
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1771
|
-
|
|
1772
|
-
type:
|
|
1773
|
-
threadId:
|
|
1776
|
+
z14.object({
|
|
1777
|
+
type: z14.literal("client/turn/requested"),
|
|
1778
|
+
threadId: z14.string()
|
|
1774
1779
|
}).merge(turnRequestEventDataSchema),
|
|
1775
|
-
|
|
1776
|
-
type:
|
|
1777
|
-
threadId:
|
|
1780
|
+
z14.object({
|
|
1781
|
+
type: z14.literal("client/turn/rejected"),
|
|
1782
|
+
threadId: z14.string()
|
|
1778
1783
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
1779
|
-
|
|
1780
|
-
type:
|
|
1781
|
-
threadId:
|
|
1784
|
+
z14.object({
|
|
1785
|
+
type: z14.literal("client/turn/start"),
|
|
1786
|
+
threadId: z14.string()
|
|
1782
1787
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1783
|
-
|
|
1784
|
-
type:
|
|
1785
|
-
threadId:
|
|
1788
|
+
z14.object({
|
|
1789
|
+
type: z14.literal("system/error"),
|
|
1790
|
+
threadId: z14.string()
|
|
1786
1791
|
}).merge(systemErrorEventDataSchema),
|
|
1787
|
-
|
|
1788
|
-
type:
|
|
1789
|
-
threadId:
|
|
1792
|
+
z14.object({
|
|
1793
|
+
type: z14.literal("system/manager/user_message"),
|
|
1794
|
+
threadId: z14.string()
|
|
1790
1795
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
1791
|
-
|
|
1792
|
-
type:
|
|
1793
|
-
threadId:
|
|
1796
|
+
z14.object({
|
|
1797
|
+
type: z14.literal("system/thread/interrupted"),
|
|
1798
|
+
threadId: z14.string()
|
|
1794
1799
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
1795
|
-
|
|
1796
|
-
type:
|
|
1797
|
-
threadId:
|
|
1800
|
+
z14.object({
|
|
1801
|
+
type: z14.literal("system/operation"),
|
|
1802
|
+
threadId: z14.string()
|
|
1798
1803
|
}).merge(systemOperationEventDataSchema),
|
|
1799
|
-
|
|
1800
|
-
type:
|
|
1801
|
-
threadId:
|
|
1804
|
+
z14.object({
|
|
1805
|
+
type: z14.literal("system/interaction/lifecycle"),
|
|
1806
|
+
threadId: z14.string()
|
|
1802
1807
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
1803
|
-
|
|
1804
|
-
type:
|
|
1805
|
-
threadId:
|
|
1808
|
+
z14.object({
|
|
1809
|
+
type: z14.literal("system/permissionGrant/lifecycle"),
|
|
1810
|
+
threadId: z14.string()
|
|
1806
1811
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
1807
|
-
|
|
1808
|
-
type:
|
|
1809
|
-
threadId:
|
|
1812
|
+
z14.object({
|
|
1813
|
+
type: z14.literal("system/userQuestion/lifecycle"),
|
|
1814
|
+
threadId: z14.string()
|
|
1810
1815
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
1811
|
-
|
|
1812
|
-
type:
|
|
1813
|
-
threadId:
|
|
1816
|
+
z14.object({
|
|
1817
|
+
type: z14.literal("system/thread-provisioning"),
|
|
1818
|
+
threadId: z14.string()
|
|
1814
1819
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
1815
|
-
|
|
1816
|
-
type:
|
|
1817
|
-
threadId:
|
|
1820
|
+
z14.object({
|
|
1821
|
+
type: z14.literal("system/provider-turn-watchdog"),
|
|
1822
|
+
threadId: z14.string()
|
|
1818
1823
|
}).merge(systemProviderTurnWatchdogEventDataSchema)
|
|
1819
1824
|
]);
|
|
1820
1825
|
var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
|
|
@@ -1822,13 +1827,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
|
|
|
1822
1827
|
function isEventPropertyBag(value) {
|
|
1823
1828
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1824
1829
|
}
|
|
1825
|
-
var rejectLegacyClientRequestSequenceSchema =
|
|
1830
|
+
var rejectLegacyClientRequestSequenceSchema = z14.unknown().superRefine((value, ctx) => {
|
|
1826
1831
|
if (!isEventPropertyBag(value)) {
|
|
1827
1832
|
return;
|
|
1828
1833
|
}
|
|
1829
1834
|
if (Object.hasOwn(value, legacyClientRequestKey)) {
|
|
1830
1835
|
ctx.addIssue({
|
|
1831
|
-
code:
|
|
1836
|
+
code: z14.ZodIssueCode.custom,
|
|
1832
1837
|
message: "legacy request sequence field is no longer accepted",
|
|
1833
1838
|
path: [legacyClientRequestKey]
|
|
1834
1839
|
});
|
|
@@ -1836,21 +1841,21 @@ var rejectLegacyClientRequestSequenceSchema = z13.unknown().superRefine((value,
|
|
|
1836
1841
|
const item = value.item;
|
|
1837
1842
|
if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
|
|
1838
1843
|
ctx.addIssue({
|
|
1839
|
-
code:
|
|
1844
|
+
code: z14.ZodIssueCode.custom,
|
|
1840
1845
|
message: "legacy user-message request sequence field is no longer accepted",
|
|
1841
1846
|
path: ["item", legacyClientRequestKey]
|
|
1842
1847
|
});
|
|
1843
1848
|
}
|
|
1844
1849
|
});
|
|
1845
1850
|
var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
|
|
1846
|
-
|
|
1851
|
+
z14.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
|
|
1847
1852
|
const result2 = validateThreadEventScope({
|
|
1848
1853
|
type: event.type,
|
|
1849
1854
|
scope: event.scope
|
|
1850
1855
|
});
|
|
1851
1856
|
if (!result2.valid) {
|
|
1852
1857
|
ctx.addIssue({
|
|
1853
|
-
code:
|
|
1858
|
+
code: z14.ZodIssueCode.custom,
|
|
1854
1859
|
message: result2.message ?? "Invalid thread event scope",
|
|
1855
1860
|
path: ["scope"]
|
|
1856
1861
|
});
|
|
@@ -1876,7 +1881,7 @@ var threadEventTypeValues = [
|
|
|
1876
1881
|
...systemEventTypeValues
|
|
1877
1882
|
];
|
|
1878
1883
|
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1879
|
-
var threadEventTypeSchema =
|
|
1884
|
+
var threadEventTypeSchema = z14.string().refine(
|
|
1880
1885
|
(value) => threadEventTypeSet.has(value),
|
|
1881
1886
|
"Invalid thread event type"
|
|
1882
1887
|
);
|
|
@@ -1899,95 +1904,96 @@ function parseNamespacedGlyph(glyph) {
|
|
|
1899
1904
|
}
|
|
1900
1905
|
|
|
1901
1906
|
// ../domain/src/provider-fork.ts
|
|
1902
|
-
import { z as
|
|
1907
|
+
import { z as z15 } from "zod";
|
|
1903
1908
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
1904
|
-
var providerForkSchema =
|
|
1909
|
+
var providerForkSchema = z15.enum(PROVIDER_FORK_VALUES);
|
|
1905
1910
|
|
|
1906
1911
|
// ../domain/src/provider-types.ts
|
|
1907
|
-
import { z as
|
|
1908
|
-
var modelReasoningEffortSchema =
|
|
1912
|
+
import { z as z16 } from "zod";
|
|
1913
|
+
var modelReasoningEffortSchema = z16.object({
|
|
1909
1914
|
reasoningEffort: reasoningLevelSchema,
|
|
1910
|
-
description:
|
|
1911
|
-
});
|
|
1912
|
-
var availableModelSchema =
|
|
1913
|
-
id:
|
|
1914
|
-
model:
|
|
1915
|
-
displayName:
|
|
1916
|
-
routeProviderId:
|
|
1917
|
-
description:
|
|
1918
|
-
supportedReasoningEfforts:
|
|
1915
|
+
description: z16.string()
|
|
1916
|
+
});
|
|
1917
|
+
var availableModelSchema = z16.object({
|
|
1918
|
+
id: z16.string(),
|
|
1919
|
+
model: z16.string(),
|
|
1920
|
+
displayName: z16.string(),
|
|
1921
|
+
routeProviderId: z16.string().min(1).optional(),
|
|
1922
|
+
description: z16.string(),
|
|
1923
|
+
supportedReasoningEfforts: z16.array(modelReasoningEffortSchema),
|
|
1919
1924
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
1920
|
-
isDefault:
|
|
1921
|
-
});
|
|
1922
|
-
var providerModelCatalogScopeSchema =
|
|
1923
|
-
var providerCapabilitiesSchema =
|
|
1924
|
-
supportsThreadArchive:
|
|
1925
|
-
supportsThreadRename:
|
|
1926
|
-
supportsServiceTier:
|
|
1927
|
-
supportsNativeUserQuestion:
|
|
1928
|
-
supportsFork:
|
|
1929
|
-
supportsSessionRewind:
|
|
1930
|
-
permissionModes:
|
|
1925
|
+
isDefault: z16.boolean()
|
|
1926
|
+
});
|
|
1927
|
+
var providerModelCatalogScopeSchema = z16.enum(["host", "workspace"]);
|
|
1928
|
+
var providerCapabilitiesSchema = z16.object({
|
|
1929
|
+
supportsThreadArchive: z16.boolean(),
|
|
1930
|
+
supportsThreadRename: z16.boolean(),
|
|
1931
|
+
supportsServiceTier: z16.boolean(),
|
|
1932
|
+
supportsNativeUserQuestion: z16.boolean(),
|
|
1933
|
+
supportsFork: z16.boolean(),
|
|
1934
|
+
supportsSessionRewind: z16.boolean(),
|
|
1935
|
+
permissionModes: z16.array(permissionModeSchema).min(1),
|
|
1931
1936
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
1932
1937
|
});
|
|
1933
|
-
var providerComposerCommandSchema =
|
|
1938
|
+
var providerComposerCommandSchema = z16.object({
|
|
1934
1939
|
trigger: promptMentionCommandTriggerSchema,
|
|
1935
|
-
name:
|
|
1936
|
-
trailingText:
|
|
1940
|
+
name: z16.string().min(1).regex(/^[^\s/$]+$/u),
|
|
1941
|
+
trailingText: z16.string().regex(/^\s*$/u)
|
|
1937
1942
|
});
|
|
1938
|
-
var providerComposerActionSchema =
|
|
1939
|
-
|
|
1940
|
-
kind:
|
|
1943
|
+
var providerComposerActionSchema = z16.discriminatedUnion("kind", [
|
|
1944
|
+
z16.object({
|
|
1945
|
+
kind: z16.literal("skills"),
|
|
1941
1946
|
trigger: promptMentionCommandTriggerSchema
|
|
1942
1947
|
}),
|
|
1943
|
-
|
|
1944
|
-
kind:
|
|
1948
|
+
z16.object({
|
|
1949
|
+
kind: z16.literal("plan"),
|
|
1945
1950
|
command: providerComposerCommandSchema
|
|
1946
1951
|
}),
|
|
1947
|
-
|
|
1948
|
-
kind:
|
|
1952
|
+
z16.object({
|
|
1953
|
+
kind: z16.literal("goal"),
|
|
1949
1954
|
command: providerComposerCommandSchema
|
|
1950
1955
|
})
|
|
1951
1956
|
]);
|
|
1952
|
-
var providerStringsSchema =
|
|
1953
|
-
signInHint:
|
|
1954
|
-
expiredHint:
|
|
1955
|
-
installUrl:
|
|
1956
|
-
brandPrefix:
|
|
1957
|
-
planModeCopy:
|
|
1958
|
-
iconTint:
|
|
1959
|
-
});
|
|
1960
|
-
var providerOptionDescriptorSchema =
|
|
1961
|
-
id:
|
|
1962
|
-
label:
|
|
1963
|
-
description:
|
|
1964
|
-
});
|
|
1965
|
-
var providerExtensionKindInfoSchema =
|
|
1966
|
-
item:
|
|
1967
|
-
state:
|
|
1968
|
-
});
|
|
1969
|
-
var providerExtensionKindsSchema =
|
|
1957
|
+
var providerStringsSchema = z16.object({
|
|
1958
|
+
signInHint: z16.string().min(1),
|
|
1959
|
+
expiredHint: z16.string().min(1),
|
|
1960
|
+
installUrl: z16.string().min(1),
|
|
1961
|
+
brandPrefix: z16.string().min(1).optional(),
|
|
1962
|
+
planModeCopy: z16.string().min(1).optional(),
|
|
1963
|
+
iconTint: z16.object({ light: z16.string().min(1), dark: z16.string().min(1) }).optional()
|
|
1964
|
+
});
|
|
1965
|
+
var providerOptionDescriptorSchema = z16.object({
|
|
1966
|
+
id: z16.string().min(1),
|
|
1967
|
+
label: z16.string().min(1),
|
|
1968
|
+
description: z16.string().min(1).optional()
|
|
1969
|
+
});
|
|
1970
|
+
var providerExtensionKindInfoSchema = z16.object({
|
|
1971
|
+
item: z16.boolean(),
|
|
1972
|
+
state: z16.boolean()
|
|
1973
|
+
});
|
|
1974
|
+
var providerExtensionKindsSchema = z16.record(
|
|
1970
1975
|
extensionKindSchema,
|
|
1971
1976
|
providerExtensionKindInfoSchema
|
|
1972
1977
|
);
|
|
1973
|
-
var providerInfoSchema =
|
|
1974
|
-
id:
|
|
1975
|
-
pluginId:
|
|
1976
|
-
displayName:
|
|
1977
|
-
family:
|
|
1978
|
-
icon:
|
|
1979
|
-
logoUrl:
|
|
1980
|
-
maintenance:
|
|
1981
|
-
health:
|
|
1982
|
-
usage:
|
|
1983
|
-
installation:
|
|
1978
|
+
var providerInfoSchema = z16.object({
|
|
1979
|
+
id: z16.string(),
|
|
1980
|
+
pluginId: z16.string().min(1),
|
|
1981
|
+
displayName: z16.string(),
|
|
1982
|
+
family: z16.string().min(1).optional(),
|
|
1983
|
+
icon: z16.object({ glyph: z16.string().min(1) }).optional(),
|
|
1984
|
+
logoUrl: z16.string().min(1).nullable(),
|
|
1985
|
+
maintenance: z16.object({
|
|
1986
|
+
health: z16.boolean(),
|
|
1987
|
+
usage: z16.boolean(),
|
|
1988
|
+
installation: z16.boolean()
|
|
1984
1989
|
}),
|
|
1985
1990
|
capabilities: providerCapabilitiesSchema,
|
|
1986
|
-
composerActions:
|
|
1987
|
-
|
|
1991
|
+
composerActions: z16.array(providerComposerActionSchema),
|
|
1992
|
+
completedTurnDisplay: completedTurnDisplaySchema,
|
|
1993
|
+
available: z16.boolean(),
|
|
1988
1994
|
strings: providerStringsSchema.optional(),
|
|
1989
|
-
serviceTiers:
|
|
1990
|
-
reasoningLevels:
|
|
1995
|
+
serviceTiers: z16.array(providerOptionDescriptorSchema).optional(),
|
|
1996
|
+
reasoningLevels: z16.array(providerOptionDescriptorSchema).optional(),
|
|
1991
1997
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
1992
1998
|
});
|
|
1993
1999
|
var providerRecoveryKindValues = [
|
|
@@ -1997,151 +2003,151 @@ var providerRecoveryKindValues = [
|
|
|
1997
2003
|
"staleTurn",
|
|
1998
2004
|
"rateLimited"
|
|
1999
2005
|
];
|
|
2000
|
-
var providerRecoveryKindSchema =
|
|
2001
|
-
var toolCallOutputItemSchema =
|
|
2002
|
-
|
|
2003
|
-
type:
|
|
2004
|
-
text:
|
|
2006
|
+
var providerRecoveryKindSchema = z16.enum(providerRecoveryKindValues);
|
|
2007
|
+
var toolCallOutputItemSchema = z16.discriminatedUnion("type", [
|
|
2008
|
+
z16.object({
|
|
2009
|
+
type: z16.literal("inputText"),
|
|
2010
|
+
text: z16.string()
|
|
2005
2011
|
}),
|
|
2006
|
-
|
|
2007
|
-
type:
|
|
2008
|
-
imageUrl:
|
|
2012
|
+
z16.object({
|
|
2013
|
+
type: z16.literal("inputImage"),
|
|
2014
|
+
imageUrl: z16.string()
|
|
2009
2015
|
})
|
|
2010
2016
|
]);
|
|
2011
|
-
var toolCallRequestSchema =
|
|
2012
|
-
requestId:
|
|
2013
|
-
threadId:
|
|
2014
|
-
providerThreadId:
|
|
2015
|
-
turnId:
|
|
2016
|
-
callId:
|
|
2017
|
-
tool:
|
|
2018
|
-
arguments:
|
|
2019
|
-
});
|
|
2020
|
-
var toolCallResponseSchema =
|
|
2021
|
-
contentItems:
|
|
2022
|
-
success:
|
|
2023
|
-
});
|
|
2024
|
-
var dynamicToolSchema =
|
|
2025
|
-
name:
|
|
2026
|
-
description:
|
|
2027
|
-
inputSchema:
|
|
2017
|
+
var toolCallRequestSchema = z16.object({
|
|
2018
|
+
requestId: z16.union([z16.string().min(1), z16.number()]),
|
|
2019
|
+
threadId: z16.string().min(1),
|
|
2020
|
+
providerThreadId: z16.string().min(1),
|
|
2021
|
+
turnId: z16.string().min(1),
|
|
2022
|
+
callId: z16.string().min(1),
|
|
2023
|
+
tool: z16.string().min(1),
|
|
2024
|
+
arguments: z16.unknown().optional()
|
|
2025
|
+
});
|
|
2026
|
+
var toolCallResponseSchema = z16.object({
|
|
2027
|
+
contentItems: z16.array(toolCallOutputItemSchema),
|
|
2028
|
+
success: z16.boolean()
|
|
2029
|
+
});
|
|
2030
|
+
var dynamicToolSchema = z16.object({
|
|
2031
|
+
name: z16.string(),
|
|
2032
|
+
description: z16.string(),
|
|
2033
|
+
inputSchema: z16.unknown(),
|
|
2028
2034
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2029
2035
|
});
|
|
2030
2036
|
|
|
2031
2037
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
2032
|
-
import { z as
|
|
2038
|
+
import { z as z17 } from "zod";
|
|
2033
2039
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
2034
2040
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
2035
2041
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
2036
|
-
var deltaKeyPartSchema =
|
|
2042
|
+
var deltaKeyPartSchema = z17.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
2037
2043
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
2038
2044
|
});
|
|
2039
|
-
var deltaItemKeySchema =
|
|
2045
|
+
var deltaItemKeySchema = z17.object({
|
|
2040
2046
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
2041
2047
|
channel: deltaKeyPartSchema.optional(),
|
|
2042
2048
|
parentRef: deltaKeyPartSchema.optional()
|
|
2043
2049
|
});
|
|
2044
2050
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2045
|
-
var deltaFileChangeSchema =
|
|
2046
|
-
path:
|
|
2047
|
-
kind:
|
|
2048
|
-
movePath:
|
|
2049
|
-
diff:
|
|
2050
|
-
oldText:
|
|
2051
|
-
newText:
|
|
2052
|
-
});
|
|
2053
|
-
var deltaBackgroundTaskShapeSchema =
|
|
2054
|
-
type:
|
|
2055
|
-
familyId:
|
|
2056
|
-
taskType:
|
|
2057
|
-
description:
|
|
2051
|
+
var deltaFileChangeSchema = z17.object({
|
|
2052
|
+
path: z17.string(),
|
|
2053
|
+
kind: z17.enum(["add", "update", "delete"]),
|
|
2054
|
+
movePath: z17.string().optional(),
|
|
2055
|
+
diff: z17.string().optional(),
|
|
2056
|
+
oldText: z17.string().optional(),
|
|
2057
|
+
newText: z17.string().optional()
|
|
2058
|
+
});
|
|
2059
|
+
var deltaBackgroundTaskShapeSchema = z17.object({
|
|
2060
|
+
type: z17.literal("backgroundTask"),
|
|
2061
|
+
familyId: z17.string().min(1),
|
|
2062
|
+
taskType: z17.string(),
|
|
2063
|
+
description: z17.string(),
|
|
2058
2064
|
status: threadEventItemStatusSchema,
|
|
2059
2065
|
taskStatus: backgroundTaskStatusSchema,
|
|
2060
|
-
skipTranscript:
|
|
2061
|
-
workflowName:
|
|
2066
|
+
skipTranscript: z17.boolean(),
|
|
2067
|
+
workflowName: z17.string().optional(),
|
|
2062
2068
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2063
2069
|
usage: backgroundTaskUsageSchema.optional(),
|
|
2064
|
-
summary:
|
|
2065
|
-
error:
|
|
2066
|
-
outputFile:
|
|
2070
|
+
summary: z17.string().optional(),
|
|
2071
|
+
error: z17.string().optional(),
|
|
2072
|
+
outputFile: z17.string().optional()
|
|
2067
2073
|
});
|
|
2068
|
-
var deltaFileReadShapeSchema =
|
|
2069
|
-
type:
|
|
2070
|
-
path:
|
|
2071
|
-
cmd:
|
|
2074
|
+
var deltaFileReadShapeSchema = z17.object({
|
|
2075
|
+
type: z17.literal("fileRead"),
|
|
2076
|
+
path: z17.string(),
|
|
2077
|
+
cmd: z17.string().optional()
|
|
2072
2078
|
});
|
|
2073
|
-
var deltaSearchShapeSchema =
|
|
2074
|
-
type:
|
|
2079
|
+
var deltaSearchShapeSchema = z17.object({
|
|
2080
|
+
type: z17.literal("search"),
|
|
2075
2081
|
mode: threadEventSearchModeSchema,
|
|
2076
|
-
query:
|
|
2077
|
-
path:
|
|
2078
|
-
cmd:
|
|
2082
|
+
query: z17.string(),
|
|
2083
|
+
path: z17.string().optional(),
|
|
2084
|
+
cmd: z17.string().optional()
|
|
2079
2085
|
});
|
|
2080
|
-
var deltaDelegationShapeSchema =
|
|
2081
|
-
type:
|
|
2086
|
+
var deltaDelegationShapeSchema = z17.object({
|
|
2087
|
+
type: z17.literal("delegation"),
|
|
2082
2088
|
childRef: deltaKeyPartSchema,
|
|
2083
|
-
label:
|
|
2084
|
-
background:
|
|
2085
|
-
summary:
|
|
2089
|
+
label: z17.string(),
|
|
2090
|
+
background: z17.boolean(),
|
|
2091
|
+
summary: z17.string().optional()
|
|
2086
2092
|
});
|
|
2087
|
-
var deltaPlanStepsShapeSchema =
|
|
2088
|
-
type:
|
|
2089
|
-
steps:
|
|
2090
|
-
explanation:
|
|
2093
|
+
var deltaPlanStepsShapeSchema = z17.object({
|
|
2094
|
+
type: z17.literal("planSteps"),
|
|
2095
|
+
steps: z17.array(threadEventPlanStepSchema),
|
|
2096
|
+
explanation: z17.string().optional()
|
|
2091
2097
|
});
|
|
2092
|
-
var deltaExtensionShapeSchema =
|
|
2093
|
-
type:
|
|
2098
|
+
var deltaExtensionShapeSchema = z17.object({
|
|
2099
|
+
type: z17.literal("extension"),
|
|
2094
2100
|
kind: extensionKindSchema,
|
|
2095
2101
|
payload: jsonValueSchema
|
|
2096
2102
|
});
|
|
2097
|
-
var deltaItemShapeSchema =
|
|
2098
|
-
|
|
2099
|
-
type:
|
|
2100
|
-
command:
|
|
2101
|
-
cwd:
|
|
2102
|
-
aggregatedOutput:
|
|
2103
|
-
exitCode:
|
|
2104
|
-
durationMs:
|
|
2103
|
+
var deltaItemShapeSchema = z17.discriminatedUnion("type", [
|
|
2104
|
+
z17.object({
|
|
2105
|
+
type: z17.literal("command"),
|
|
2106
|
+
command: z17.string(),
|
|
2107
|
+
cwd: z17.string(),
|
|
2108
|
+
aggregatedOutput: z17.string().optional(),
|
|
2109
|
+
exitCode: z17.number().optional(),
|
|
2110
|
+
durationMs: z17.number().optional()
|
|
2105
2111
|
}),
|
|
2106
|
-
|
|
2107
|
-
type:
|
|
2108
|
-
changes:
|
|
2112
|
+
z17.object({
|
|
2113
|
+
type: z17.literal("fileChange"),
|
|
2114
|
+
changes: z17.array(deltaFileChangeSchema)
|
|
2109
2115
|
}),
|
|
2110
|
-
|
|
2111
|
-
type:
|
|
2112
|
-
tool:
|
|
2113
|
-
server:
|
|
2114
|
-
args:
|
|
2115
|
-
result:
|
|
2116
|
-
error:
|
|
2117
|
-
durationMs:
|
|
2116
|
+
z17.object({
|
|
2117
|
+
type: z17.literal("tool"),
|
|
2118
|
+
tool: z17.string(),
|
|
2119
|
+
server: z17.string().optional(),
|
|
2120
|
+
args: z17.unknown().optional(),
|
|
2121
|
+
result: z17.unknown().optional(),
|
|
2122
|
+
error: z17.string().optional(),
|
|
2123
|
+
durationMs: z17.number().optional()
|
|
2118
2124
|
}),
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
type:
|
|
2123
|
-
summary:
|
|
2124
|
-
content:
|
|
2125
|
+
z17.object({ type: z17.literal("compaction") }),
|
|
2126
|
+
z17.object({ type: z17.literal("agentMessage"), text: z17.string() }),
|
|
2127
|
+
z17.object({
|
|
2128
|
+
type: z17.literal("reasoning"),
|
|
2129
|
+
summary: z17.array(z17.string()),
|
|
2130
|
+
content: z17.array(z17.string())
|
|
2125
2131
|
}),
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
type:
|
|
2129
|
-
queries:
|
|
2132
|
+
z17.object({ type: z17.literal("plan"), text: z17.string() }),
|
|
2133
|
+
z17.object({
|
|
2134
|
+
type: z17.literal("webSearch"),
|
|
2135
|
+
queries: z17.array(z17.string()).min(1)
|
|
2130
2136
|
}),
|
|
2131
|
-
|
|
2132
|
-
type:
|
|
2133
|
-
url:
|
|
2134
|
-
prompt:
|
|
2135
|
-
pattern:
|
|
2137
|
+
z17.object({
|
|
2138
|
+
type: z17.literal("webFetch"),
|
|
2139
|
+
url: z17.string(),
|
|
2140
|
+
prompt: z17.string().nullable().optional(),
|
|
2141
|
+
pattern: z17.string().nullable()
|
|
2136
2142
|
}),
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
type:
|
|
2140
|
-
prompt:
|
|
2141
|
-
path:
|
|
2142
|
-
result:
|
|
2143
|
-
error:
|
|
2144
|
-
transparentBackground:
|
|
2143
|
+
z17.object({ type: z17.literal("imageView"), path: z17.string() }),
|
|
2144
|
+
z17.object({
|
|
2145
|
+
type: z17.literal("imageGeneration"),
|
|
2146
|
+
prompt: z17.string().nullable(),
|
|
2147
|
+
path: z17.string().nullable(),
|
|
2148
|
+
result: z17.string().optional(),
|
|
2149
|
+
error: z17.string().nullable(),
|
|
2150
|
+
transparentBackground: z17.boolean()
|
|
2145
2151
|
}),
|
|
2146
2152
|
deltaBackgroundTaskShapeSchema,
|
|
2147
2153
|
deltaFileReadShapeSchema,
|
|
@@ -2150,22 +2156,22 @@ var deltaItemShapeSchema = z16.discriminatedUnion("type", [
|
|
|
2150
2156
|
deltaPlanStepsShapeSchema,
|
|
2151
2157
|
deltaExtensionShapeSchema
|
|
2152
2158
|
]);
|
|
2153
|
-
var deltaProgressSnapshotSchema =
|
|
2159
|
+
var deltaProgressSnapshotSchema = z17.discriminatedUnion("type", [
|
|
2154
2160
|
deltaBackgroundTaskShapeSchema,
|
|
2155
2161
|
deltaDelegationShapeSchema
|
|
2156
2162
|
]);
|
|
2157
|
-
var deltaTextChannelSchema =
|
|
2163
|
+
var deltaTextChannelSchema = z17.enum([
|
|
2158
2164
|
"agentMessage",
|
|
2159
2165
|
"reasoningSummary",
|
|
2160
2166
|
"reasoningText",
|
|
2161
2167
|
"plan"
|
|
2162
2168
|
]);
|
|
2163
|
-
var deltaOutputChannelSchema =
|
|
2164
|
-
var deltaErrorSchema =
|
|
2165
|
-
var deltaAttachSchema =
|
|
2166
|
-
var deltaNoTurnFallbackSchema =
|
|
2169
|
+
var deltaOutputChannelSchema = z17.enum(["command", "fileChange"]);
|
|
2170
|
+
var deltaErrorSchema = z17.object({ message: z17.string() });
|
|
2171
|
+
var deltaAttachSchema = z17.enum(["open", "currentOrLast"]);
|
|
2172
|
+
var deltaNoTurnFallbackSchema = z17.object({
|
|
2167
2173
|
raw: providerRawEventSchema,
|
|
2168
|
-
rawType:
|
|
2174
|
+
rawType: z17.string()
|
|
2169
2175
|
});
|
|
2170
2176
|
function requireExtensionPresentation(delta, ctx) {
|
|
2171
2177
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -2176,32 +2182,32 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2176
2182
|
});
|
|
2177
2183
|
}
|
|
2178
2184
|
}
|
|
2179
|
-
var threadDeltaSchema =
|
|
2180
|
-
|
|
2181
|
-
kind:
|
|
2185
|
+
var threadDeltaSchema = z17.discriminatedUnion("kind", [
|
|
2186
|
+
z17.object({
|
|
2187
|
+
kind: z17.literal("input.accepted"),
|
|
2182
2188
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2183
2189
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2184
2190
|
}),
|
|
2185
|
-
|
|
2186
|
-
kind:
|
|
2187
|
-
text:
|
|
2191
|
+
z17.object({
|
|
2192
|
+
kind: z17.literal("input.provider"),
|
|
2193
|
+
text: z17.string().min(1),
|
|
2188
2194
|
parentRef: deltaKeyPartSchema.optional()
|
|
2189
2195
|
}),
|
|
2190
|
-
|
|
2191
|
-
kind:
|
|
2196
|
+
z17.object({
|
|
2197
|
+
kind: z17.literal("turn.open"),
|
|
2192
2198
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2193
2199
|
parentRef: deltaKeyPartSchema.optional()
|
|
2194
2200
|
}),
|
|
2195
|
-
|
|
2196
|
-
kind:
|
|
2201
|
+
z17.object({
|
|
2202
|
+
kind: z17.literal("turn.boundary"),
|
|
2197
2203
|
status: threadEventTurnStatusSchema,
|
|
2198
2204
|
error: deltaErrorSchema.optional(),
|
|
2199
|
-
providerCheckpointId:
|
|
2200
|
-
claimIfIdle:
|
|
2205
|
+
providerCheckpointId: z17.string().min(1).optional(),
|
|
2206
|
+
claimIfIdle: z17.boolean().optional(),
|
|
2201
2207
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2202
2208
|
}),
|
|
2203
|
-
|
|
2204
|
-
kind:
|
|
2209
|
+
z17.object({
|
|
2210
|
+
kind: z17.literal("item.open"),
|
|
2205
2211
|
key: deltaItemKeySchema,
|
|
2206
2212
|
item: deltaItemShapeSchema,
|
|
2207
2213
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -2209,140 +2215,140 @@ var threadDeltaSchema = z16.discriminatedUnion("kind", [
|
|
|
2209
2215
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2210
2216
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2211
2217
|
}).superRefine(requireExtensionPresentation),
|
|
2212
|
-
|
|
2213
|
-
kind:
|
|
2218
|
+
z17.object({
|
|
2219
|
+
kind: z17.literal("item.close"),
|
|
2214
2220
|
key: deltaItemKeySchema,
|
|
2215
2221
|
status: threadEventItemStatusSchema,
|
|
2216
|
-
resultText:
|
|
2217
|
-
exitCode:
|
|
2218
|
-
aggregatedOutput:
|
|
2219
|
-
approvalStatus:
|
|
2222
|
+
resultText: z17.string().optional(),
|
|
2223
|
+
exitCode: z17.number().optional(),
|
|
2224
|
+
aggregatedOutput: z17.string().optional(),
|
|
2225
|
+
approvalStatus: z17.literal("denied").optional(),
|
|
2220
2226
|
item: deltaItemShapeSchema,
|
|
2221
2227
|
presentation: deltaPresentationSchema.optional(),
|
|
2222
2228
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2223
2229
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2224
2230
|
}).superRefine(requireExtensionPresentation),
|
|
2225
|
-
|
|
2226
|
-
kind:
|
|
2231
|
+
z17.object({
|
|
2232
|
+
kind: z17.literal("item.progress"),
|
|
2227
2233
|
key: deltaItemKeySchema,
|
|
2228
|
-
message:
|
|
2234
|
+
message: z17.string().optional(),
|
|
2229
2235
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
2230
|
-
flush:
|
|
2236
|
+
flush: z17.boolean().optional(),
|
|
2231
2237
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2232
2238
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2233
2239
|
}),
|
|
2234
|
-
|
|
2235
|
-
kind:
|
|
2240
|
+
z17.object({
|
|
2241
|
+
kind: z17.literal("item.textDelta"),
|
|
2236
2242
|
key: deltaItemKeySchema,
|
|
2237
2243
|
channel: deltaTextChannelSchema,
|
|
2238
|
-
text:
|
|
2244
|
+
text: z17.string(),
|
|
2239
2245
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2240
2246
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2241
2247
|
}),
|
|
2242
|
-
|
|
2243
|
-
kind:
|
|
2248
|
+
z17.object({
|
|
2249
|
+
kind: z17.literal("item.textClose"),
|
|
2244
2250
|
key: deltaItemKeySchema,
|
|
2245
2251
|
channel: deltaTextChannelSchema,
|
|
2246
|
-
text:
|
|
2252
|
+
text: z17.string().optional(),
|
|
2247
2253
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2248
2254
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2249
2255
|
}),
|
|
2250
|
-
|
|
2251
|
-
kind:
|
|
2256
|
+
z17.object({
|
|
2257
|
+
kind: z17.literal("item.outputDelta"),
|
|
2252
2258
|
key: deltaItemKeySchema,
|
|
2253
2259
|
channel: deltaOutputChannelSchema,
|
|
2254
|
-
text:
|
|
2260
|
+
text: z17.string(),
|
|
2255
2261
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2256
2262
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2257
2263
|
}),
|
|
2258
|
-
|
|
2259
|
-
kind:
|
|
2264
|
+
z17.object({
|
|
2265
|
+
kind: z17.literal("command.outputSnapshot"),
|
|
2260
2266
|
key: deltaItemKeySchema,
|
|
2261
|
-
text:
|
|
2267
|
+
text: z17.string(),
|
|
2262
2268
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2263
2269
|
}),
|
|
2264
|
-
|
|
2265
|
-
kind:
|
|
2270
|
+
z17.object({
|
|
2271
|
+
kind: z17.literal("usage"),
|
|
2266
2272
|
total: threadEventTokenUsageBreakdownSchema,
|
|
2267
2273
|
last: threadEventTokenUsageBreakdownSchema,
|
|
2268
|
-
modelContextWindow:
|
|
2274
|
+
modelContextWindow: z17.number().nullable(),
|
|
2269
2275
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2270
2276
|
}),
|
|
2271
|
-
|
|
2272
|
-
kind:
|
|
2277
|
+
z17.object({
|
|
2278
|
+
kind: z17.literal("contextWindow"),
|
|
2273
2279
|
snapshot: contextSnapshotSchema.optional(),
|
|
2274
|
-
used:
|
|
2275
|
-
size:
|
|
2276
|
-
estimated:
|
|
2280
|
+
used: z17.number().nullable(),
|
|
2281
|
+
size: z17.number().nullable().optional(),
|
|
2282
|
+
estimated: z17.boolean(),
|
|
2277
2283
|
attach: deltaAttachSchema,
|
|
2278
2284
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2279
2285
|
}),
|
|
2280
|
-
|
|
2281
|
-
kind:
|
|
2286
|
+
z17.object({
|
|
2287
|
+
kind: z17.literal("context.compacted"),
|
|
2282
2288
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2283
2289
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2284
2290
|
}),
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
kind:
|
|
2288
|
-
diff:
|
|
2291
|
+
z17.object({ kind: z17.literal("context.cleared") }),
|
|
2292
|
+
z17.object({
|
|
2293
|
+
kind: z17.literal("turn.diff"),
|
|
2294
|
+
diff: z17.string(),
|
|
2289
2295
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2290
2296
|
}),
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
kind:
|
|
2294
|
-
providerThreadId:
|
|
2297
|
+
z17.object({ kind: z17.literal("thread.started") }),
|
|
2298
|
+
z17.object({
|
|
2299
|
+
kind: z17.literal("thread.identity"),
|
|
2300
|
+
providerThreadId: z17.string().min(1)
|
|
2295
2301
|
}),
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
kind:
|
|
2302
|
+
z17.object({ kind: z17.literal("thread.name"), name: z17.string().min(1) }),
|
|
2303
|
+
z17.object({
|
|
2304
|
+
kind: z17.literal("extension.state"),
|
|
2299
2305
|
extensionKind: extensionKindSchema,
|
|
2300
2306
|
payload: jsonValueSchema
|
|
2301
2307
|
}),
|
|
2302
|
-
|
|
2303
|
-
kind:
|
|
2308
|
+
z17.object({
|
|
2309
|
+
kind: z17.literal("provider.rateLimits"),
|
|
2304
2310
|
rateLimits: providerRateLimitStateSchema
|
|
2305
2311
|
}),
|
|
2306
|
-
|
|
2307
|
-
kind:
|
|
2308
|
-
message:
|
|
2309
|
-
detail:
|
|
2310
|
-
willRetry:
|
|
2312
|
+
z17.object({
|
|
2313
|
+
kind: z17.literal("provider.error"),
|
|
2314
|
+
message: z17.string(),
|
|
2315
|
+
detail: z17.string().optional(),
|
|
2316
|
+
willRetry: z17.boolean().optional(),
|
|
2311
2317
|
category: providerErrorCategorySchema.optional(),
|
|
2312
2318
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
2313
|
-
settlesTurn:
|
|
2319
|
+
settlesTurn: z17.boolean().optional(),
|
|
2314
2320
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2315
|
-
threadScoped:
|
|
2321
|
+
threadScoped: z17.boolean().optional()
|
|
2316
2322
|
}),
|
|
2317
|
-
|
|
2318
|
-
kind:
|
|
2319
|
-
originalModel:
|
|
2320
|
-
fallbackModel:
|
|
2321
|
-
reason:
|
|
2322
|
-
message:
|
|
2323
|
+
z17.object({
|
|
2324
|
+
kind: z17.literal("provider.modelFallback"),
|
|
2325
|
+
originalModel: z17.string().min(1),
|
|
2326
|
+
fallbackModel: z17.string().min(1),
|
|
2327
|
+
reason: z17.enum(["refusal", "provider"]),
|
|
2328
|
+
message: z17.string()
|
|
2323
2329
|
}),
|
|
2324
|
-
|
|
2325
|
-
kind:
|
|
2326
|
-
summary:
|
|
2327
|
-
details:
|
|
2330
|
+
z17.object({
|
|
2331
|
+
kind: z17.literal("provider.warning"),
|
|
2332
|
+
summary: z17.string().optional(),
|
|
2333
|
+
details: z17.string().optional(),
|
|
2328
2334
|
category: threadEventWarningCategorySchema.optional(),
|
|
2329
|
-
vouchedTurn:
|
|
2335
|
+
vouchedTurn: z17.boolean().optional()
|
|
2330
2336
|
}),
|
|
2331
|
-
|
|
2332
|
-
kind:
|
|
2337
|
+
z17.object({
|
|
2338
|
+
kind: z17.literal("unhandled"),
|
|
2333
2339
|
raw: providerRawEventSchema,
|
|
2334
|
-
rawType:
|
|
2335
|
-
vouchedTurn:
|
|
2336
|
-
onlyIfNoTurn:
|
|
2340
|
+
rawType: z17.string(),
|
|
2341
|
+
vouchedTurn: z17.boolean(),
|
|
2342
|
+
onlyIfNoTurn: z17.boolean().optional(),
|
|
2337
2343
|
parentRef: deltaKeyPartSchema.optional(),
|
|
2338
2344
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2339
2345
|
}),
|
|
2340
|
-
|
|
2341
|
-
|
|
2346
|
+
z17.object({ kind: z17.literal("session.ended") }),
|
|
2347
|
+
z17.object({ kind: z17.literal("session.reset") })
|
|
2342
2348
|
]);
|
|
2343
|
-
var threadDeltaNotificationParamsSchema =
|
|
2344
|
-
threadId:
|
|
2345
|
-
deltas:
|
|
2349
|
+
var threadDeltaNotificationParamsSchema = z17.object({
|
|
2350
|
+
threadId: z17.string().min(1),
|
|
2351
|
+
deltas: z17.array(threadDeltaSchema)
|
|
2346
2352
|
}).passthrough();
|
|
2347
2353
|
|
|
2348
2354
|
// ../provider-bridge-protocol/src/assembler/delta-assembler.ts
|
|
@@ -2353,17 +2359,17 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2353
2359
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
2354
2360
|
|
|
2355
2361
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2356
|
-
import { z as
|
|
2362
|
+
import { z as z19 } from "zod";
|
|
2357
2363
|
|
|
2358
2364
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
2359
|
-
import { z as
|
|
2360
|
-
var bashArgsSchema =
|
|
2361
|
-
command:
|
|
2362
|
-
cwd:
|
|
2365
|
+
import { z as z18 } from "zod";
|
|
2366
|
+
var bashArgsSchema = z18.object({
|
|
2367
|
+
command: z18.string().optional(),
|
|
2368
|
+
cwd: z18.string().optional()
|
|
2363
2369
|
}).passthrough();
|
|
2364
|
-
var textBlockSchema =
|
|
2365
|
-
type:
|
|
2366
|
-
text:
|
|
2370
|
+
var textBlockSchema = z18.object({
|
|
2371
|
+
type: z18.literal("text"),
|
|
2372
|
+
text: z18.string()
|
|
2367
2373
|
});
|
|
2368
2374
|
|
|
2369
2375
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -2372,10 +2378,10 @@ function isRecord(value) {
|
|
|
2372
2378
|
}
|
|
2373
2379
|
|
|
2374
2380
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2375
|
-
var contentWrapperSchema =
|
|
2376
|
-
content:
|
|
2381
|
+
var contentWrapperSchema = z19.object({
|
|
2382
|
+
content: z19.array(z19.unknown())
|
|
2377
2383
|
}).passthrough();
|
|
2378
|
-
var shellEnvironmentVariableKeySchema =
|
|
2384
|
+
var shellEnvironmentVariableKeySchema = z19.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
2379
2385
|
var MAX_EXACT_LINE_DIFF_CELLS = 1e6;
|
|
2380
2386
|
function splitComparableLines(text) {
|
|
2381
2387
|
const normalized = text.replace(/\r\n?/gu, "\n");
|
|
@@ -4222,11 +4228,11 @@ function toConformanceMessages() {
|
|
|
4222
4228
|
}
|
|
4223
4229
|
|
|
4224
4230
|
// ../provider-bridge-protocol/src/conformance/client.ts
|
|
4225
|
-
import { z as
|
|
4231
|
+
import { z as z20 } from "zod";
|
|
4226
4232
|
function isWireMessage(value) {
|
|
4227
4233
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4228
4234
|
}
|
|
4229
|
-
var threadDeltaAddressSchema =
|
|
4235
|
+
var threadDeltaAddressSchema = z20.object({ threadId: z20.string() }).passthrough();
|
|
4230
4236
|
var ConformanceClient = class {
|
|
4231
4237
|
constructor(transport, timeoutMs, collector) {
|
|
4232
4238
|
this.transport = transport;
|
|
@@ -4335,11 +4341,11 @@ function nextConformanceClientRequestId() {
|
|
|
4335
4341
|
}
|
|
4336
4342
|
|
|
4337
4343
|
// ../provider-bridge-protocol/src/conformance/scenarios.ts
|
|
4338
|
-
import { z as
|
|
4344
|
+
import { z as z28 } from "zod";
|
|
4339
4345
|
|
|
4340
4346
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
4341
|
-
import { z as
|
|
4342
|
-
var bridgeGrammarVersionsSchema =
|
|
4347
|
+
import { z as z21 } from "zod";
|
|
4348
|
+
var bridgeGrammarVersionsSchema = z21.tuple([z21.number().int().positive(), z21.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
4343
4349
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
4344
4350
|
});
|
|
4345
4351
|
function negotiateGrammarVersion(runtime, bridge) {
|
|
@@ -4347,62 +4353,62 @@ function negotiateGrammarVersion(runtime, bridge) {
|
|
|
4347
4353
|
const max = Math.min(runtime[1], bridge[1]);
|
|
4348
4354
|
return min <= max ? max : null;
|
|
4349
4355
|
}
|
|
4350
|
-
var bridgeSteerModeSchema =
|
|
4351
|
-
var bridgeCapabilitiesSchema =
|
|
4352
|
-
sessionRestore:
|
|
4353
|
-
threadArchive:
|
|
4354
|
-
threadRename:
|
|
4355
|
-
threadGoalClear:
|
|
4356
|
+
var bridgeSteerModeSchema = z21.enum(["inject", "queue"]);
|
|
4357
|
+
var bridgeCapabilitiesSchema = z21.object({
|
|
4358
|
+
sessionRestore: z21.boolean().default(false),
|
|
4359
|
+
threadArchive: z21.boolean().default(false),
|
|
4360
|
+
threadRename: z21.boolean().default(false),
|
|
4361
|
+
threadGoalClear: z21.boolean().default(false),
|
|
4356
4362
|
fork: providerForkSchema.default("none"),
|
|
4357
|
-
approvalEnforcedBy:
|
|
4363
|
+
approvalEnforcedBy: z21.enum(["runtime", "provider"]).default("runtime"),
|
|
4358
4364
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4359
4365
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4360
4366
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4361
4367
|
]),
|
|
4362
4368
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4363
|
-
skills:
|
|
4369
|
+
skills: z21.object({ configure: z21.boolean().default(false) }).default({ configure: false })
|
|
4364
4370
|
}).passthrough();
|
|
4365
|
-
var initializeParamsSchema =
|
|
4366
|
-
protocolVersion:
|
|
4367
|
-
client:
|
|
4371
|
+
var initializeParamsSchema = z21.object({
|
|
4372
|
+
protocolVersion: z21.number().int().positive(),
|
|
4373
|
+
client: z21.object({ name: z21.string().min(1), version: z21.string().min(1) }),
|
|
4368
4374
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4369
4375
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4370
4376
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4371
4377
|
])
|
|
4372
4378
|
}).passthrough();
|
|
4373
|
-
var initializeResultSchema =
|
|
4374
|
-
protocolVersion:
|
|
4375
|
-
capabilities:
|
|
4379
|
+
var initializeResultSchema = z21.object({
|
|
4380
|
+
protocolVersion: z21.number().int().positive(),
|
|
4381
|
+
capabilities: z21.preprocess(
|
|
4376
4382
|
(value) => value ?? {},
|
|
4377
4383
|
bridgeCapabilitiesSchema
|
|
4378
4384
|
)
|
|
4379
4385
|
}).passthrough();
|
|
4380
4386
|
|
|
4381
4387
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
4382
|
-
import { z as
|
|
4383
|
-
var bridgeExecutionOptionsSchema =
|
|
4384
|
-
model:
|
|
4388
|
+
import { z as z22 } from "zod";
|
|
4389
|
+
var bridgeExecutionOptionsSchema = z22.object({
|
|
4390
|
+
model: z22.string().min(1).optional(),
|
|
4385
4391
|
serviceTier: serviceTierSchema.optional(),
|
|
4386
4392
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4387
4393
|
promptMode: promptModeSchema.optional(),
|
|
4388
|
-
instructions:
|
|
4389
|
-
envVars:
|
|
4390
|
-
providerOptions:
|
|
4394
|
+
instructions: z22.string().optional(),
|
|
4395
|
+
envVars: z22.record(z22.string(), z22.string()).optional(),
|
|
4396
|
+
providerOptions: z22.record(z22.string(), z22.unknown()).optional()
|
|
4391
4397
|
}).and(runtimePermissionPolicySchema);
|
|
4392
4398
|
|
|
4393
4399
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
4394
|
-
import { z as
|
|
4395
|
-
var providerMaintenanceParamsSchema =
|
|
4396
|
-
providerId:
|
|
4397
|
-
cwd:
|
|
4398
|
-
providerOptions:
|
|
4400
|
+
import { z as z23 } from "zod";
|
|
4401
|
+
var providerMaintenanceParamsSchema = z23.object({
|
|
4402
|
+
providerId: z23.string().min(1),
|
|
4403
|
+
cwd: z23.string().min(1).optional(),
|
|
4404
|
+
providerOptions: z23.record(z23.string(), z23.unknown()).optional()
|
|
4399
4405
|
}).passthrough();
|
|
4400
|
-
var providerInstallationRequirementSchema =
|
|
4406
|
+
var providerInstallationRequirementSchema = z23.enum(["thread_rewind"]);
|
|
4401
4407
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4402
4408
|
requirement: providerInstallationRequirementSchema.optional()
|
|
4403
4409
|
});
|
|
4404
|
-
var providerHealthSchema =
|
|
4405
|
-
status:
|
|
4410
|
+
var providerHealthSchema = z23.object({
|
|
4411
|
+
status: z23.enum([
|
|
4406
4412
|
"ready",
|
|
4407
4413
|
"not_installed",
|
|
4408
4414
|
"unauthenticated",
|
|
@@ -4410,114 +4416,114 @@ var providerHealthSchema = z22.object({
|
|
|
4410
4416
|
"unsupported_version",
|
|
4411
4417
|
"unknown"
|
|
4412
4418
|
]),
|
|
4413
|
-
statusMessage:
|
|
4414
|
-
accountEmail:
|
|
4415
|
-
planLabel:
|
|
4416
|
-
installedVersion:
|
|
4417
|
-
minimumSupportedVersion:
|
|
4418
|
-
canInstall:
|
|
4419
|
-
canUpdate:
|
|
4420
|
-
loginCommand:
|
|
4419
|
+
statusMessage: z23.string().min(1).nullable(),
|
|
4420
|
+
accountEmail: z23.string().nullable(),
|
|
4421
|
+
planLabel: z23.string().min(1).nullable(),
|
|
4422
|
+
installedVersion: z23.string().min(1).nullable(),
|
|
4423
|
+
minimumSupportedVersion: z23.string().min(1).nullable(),
|
|
4424
|
+
canInstall: z23.boolean(),
|
|
4425
|
+
canUpdate: z23.boolean(),
|
|
4426
|
+
loginCommand: z23.string().min(1).nullable()
|
|
4421
4427
|
}).passthrough();
|
|
4422
|
-
var providerUsageWindowSchema =
|
|
4423
|
-
label:
|
|
4424
|
-
usedPercent:
|
|
4425
|
-
resetsAt:
|
|
4426
|
-
cost:
|
|
4427
|
-
usedUsdCents:
|
|
4428
|
-
limitUsdCents:
|
|
4428
|
+
var providerUsageWindowSchema = z23.object({
|
|
4429
|
+
label: z23.string().min(1),
|
|
4430
|
+
usedPercent: z23.number().min(0).max(100),
|
|
4431
|
+
resetsAt: z23.string().min(1).nullable(),
|
|
4432
|
+
cost: z23.object({
|
|
4433
|
+
usedUsdCents: z23.number().int().nonnegative(),
|
|
4434
|
+
limitUsdCents: z23.number().int().positive()
|
|
4429
4435
|
}).optional()
|
|
4430
4436
|
}).passthrough();
|
|
4431
|
-
var providerUsageSchema =
|
|
4432
|
-
|
|
4433
|
-
status:
|
|
4434
|
-
accountEmail:
|
|
4435
|
-
planLabel:
|
|
4436
|
-
windows:
|
|
4437
|
+
var providerUsageSchema = z23.discriminatedUnion("status", [
|
|
4438
|
+
z23.object({
|
|
4439
|
+
status: z23.literal("ok"),
|
|
4440
|
+
accountEmail: z23.string().email().nullable(),
|
|
4441
|
+
planLabel: z23.string().min(1).nullable(),
|
|
4442
|
+
windows: z23.array(providerUsageWindowSchema)
|
|
4437
4443
|
}).passthrough(),
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
status:
|
|
4443
|
-
message:
|
|
4444
|
-
planLabel:
|
|
4445
|
-
accountEmail:
|
|
4444
|
+
z23.object({ status: z23.literal("not_installed") }).passthrough(),
|
|
4445
|
+
z23.object({ status: z23.literal("unauthenticated") }).passthrough(),
|
|
4446
|
+
z23.object({ status: z23.literal("expired") }).passthrough(),
|
|
4447
|
+
z23.object({
|
|
4448
|
+
status: z23.literal("error"),
|
|
4449
|
+
message: z23.string().min(1),
|
|
4450
|
+
planLabel: z23.string().min(1).nullable().default(null),
|
|
4451
|
+
accountEmail: z23.string().nullable().default(null)
|
|
4446
4452
|
}).passthrough()
|
|
4447
4453
|
]);
|
|
4448
|
-
var providerHealthResultSchema =
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
supported:
|
|
4454
|
+
var providerHealthResultSchema = z23.discriminatedUnion("supported", [
|
|
4455
|
+
z23.object({ supported: z23.literal(false) }).passthrough(),
|
|
4456
|
+
z23.object({
|
|
4457
|
+
supported: z23.literal(true),
|
|
4452
4458
|
health: providerHealthSchema
|
|
4453
4459
|
}).passthrough()
|
|
4454
4460
|
]);
|
|
4455
|
-
var providerUsageResultSchema =
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
supported:
|
|
4461
|
+
var providerUsageResultSchema = z23.discriminatedUnion("supported", [
|
|
4462
|
+
z23.object({ supported: z23.literal(false) }).passthrough(),
|
|
4463
|
+
z23.object({
|
|
4464
|
+
supported: z23.literal(true),
|
|
4459
4465
|
usage: providerUsageSchema
|
|
4460
4466
|
}).passthrough()
|
|
4461
4467
|
]);
|
|
4462
|
-
var providerInstallationActionKindSchema =
|
|
4468
|
+
var providerInstallationActionKindSchema = z23.enum([
|
|
4463
4469
|
"install",
|
|
4464
4470
|
"update"
|
|
4465
4471
|
]);
|
|
4466
|
-
var providerInstallationActionSchema =
|
|
4472
|
+
var providerInstallationActionSchema = z23.object({
|
|
4467
4473
|
kind: providerInstallationActionKindSchema,
|
|
4468
|
-
label:
|
|
4469
|
-
command:
|
|
4474
|
+
label: z23.enum(["Install", "Update"]),
|
|
4475
|
+
command: z23.string().min(1)
|
|
4470
4476
|
}).passthrough();
|
|
4471
|
-
var providerInstallationSourceSchema =
|
|
4477
|
+
var providerInstallationSourceSchema = z23.enum([
|
|
4472
4478
|
"notInstalled",
|
|
4473
4479
|
"npmGlobal",
|
|
4474
4480
|
"external"
|
|
4475
4481
|
]);
|
|
4476
|
-
var providerInstallationStatusSchema =
|
|
4477
|
-
executableName:
|
|
4478
|
-
executablePath:
|
|
4479
|
-
installed:
|
|
4482
|
+
var providerInstallationStatusSchema = z23.object({
|
|
4483
|
+
executableName: z23.string().min(1),
|
|
4484
|
+
executablePath: z23.string().min(1).nullable(),
|
|
4485
|
+
installed: z23.boolean(),
|
|
4480
4486
|
installSource: providerInstallationSourceSchema,
|
|
4481
|
-
currentVersion:
|
|
4482
|
-
latestVersion:
|
|
4483
|
-
minimumSupportedVersion:
|
|
4484
|
-
npmPackageName:
|
|
4485
|
-
npmGlobalPackageVersion:
|
|
4487
|
+
currentVersion: z23.string().min(1).nullable(),
|
|
4488
|
+
latestVersion: z23.string().min(1).nullable(),
|
|
4489
|
+
minimumSupportedVersion: z23.string().min(1).nullable(),
|
|
4490
|
+
npmPackageName: z23.string().min(1).nullable(),
|
|
4491
|
+
npmGlobalPackageVersion: z23.string().min(1).nullable(),
|
|
4486
4492
|
installAction: providerInstallationActionSchema.nullable(),
|
|
4487
|
-
needsUpdate:
|
|
4488
|
-
versionUnsupported:
|
|
4493
|
+
needsUpdate: z23.boolean(),
|
|
4494
|
+
versionUnsupported: z23.boolean()
|
|
4489
4495
|
}).passthrough();
|
|
4490
4496
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4491
4497
|
action: providerInstallationActionKindSchema
|
|
4492
4498
|
});
|
|
4493
|
-
var providerInstallationCommandSchema =
|
|
4494
|
-
command:
|
|
4495
|
-
args:
|
|
4496
|
-
displayCommand:
|
|
4499
|
+
var providerInstallationCommandSchema = z23.object({
|
|
4500
|
+
command: z23.string().min(1),
|
|
4501
|
+
args: z23.array(z23.string()).max(64),
|
|
4502
|
+
displayCommand: z23.string().min(1)
|
|
4497
4503
|
}).passthrough();
|
|
4498
|
-
var providerInstallationVerificationSchema =
|
|
4504
|
+
var providerInstallationVerificationSchema = z23.discriminatedUnion(
|
|
4499
4505
|
"kind",
|
|
4500
4506
|
[
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
kind:
|
|
4504
|
-
previousVersion:
|
|
4507
|
+
z23.object({ kind: z23.literal("installed") }).passthrough(),
|
|
4508
|
+
z23.object({
|
|
4509
|
+
kind: z23.literal("version_changed"),
|
|
4510
|
+
previousVersion: z23.string().min(1)
|
|
4505
4511
|
}).passthrough(),
|
|
4506
|
-
|
|
4507
|
-
kind:
|
|
4508
|
-
version:
|
|
4512
|
+
z23.object({
|
|
4513
|
+
kind: z23.literal("version_at_least"),
|
|
4514
|
+
version: z23.string().min(1)
|
|
4509
4515
|
}).passthrough()
|
|
4510
4516
|
]
|
|
4511
4517
|
);
|
|
4512
|
-
var providerInstallationRunResultSchema =
|
|
4518
|
+
var providerInstallationRunResultSchema = z23.discriminatedUnion(
|
|
4513
4519
|
"available",
|
|
4514
4520
|
[
|
|
4515
|
-
|
|
4516
|
-
available:
|
|
4517
|
-
message:
|
|
4521
|
+
z23.object({
|
|
4522
|
+
available: z23.literal(false),
|
|
4523
|
+
message: z23.string().min(1)
|
|
4518
4524
|
}).passthrough(),
|
|
4519
|
-
|
|
4520
|
-
available:
|
|
4525
|
+
z23.object({
|
|
4526
|
+
available: z23.literal(true),
|
|
4521
4527
|
command: providerInstallationCommandSchema,
|
|
4522
4528
|
verification: providerInstallationVerificationSchema
|
|
4523
4529
|
}).passthrough()
|
|
@@ -4525,7 +4531,7 @@ var providerInstallationRunResultSchema = z22.discriminatedUnion(
|
|
|
4525
4531
|
);
|
|
4526
4532
|
|
|
4527
4533
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4528
|
-
import { z as
|
|
4534
|
+
import { z as z24 } from "zod";
|
|
4529
4535
|
var BRIDGE_REQUEST_METHODS = {
|
|
4530
4536
|
initialize: "initialize",
|
|
4531
4537
|
modelList: "model/list",
|
|
@@ -4547,77 +4553,77 @@ var BRIDGE_REQUEST_METHODS = {
|
|
|
4547
4553
|
skillsConfigure: "skills/configure"
|
|
4548
4554
|
};
|
|
4549
4555
|
var sessionConstructionFields = {
|
|
4550
|
-
threadId:
|
|
4551
|
-
cwd:
|
|
4556
|
+
threadId: z24.string().min(1),
|
|
4557
|
+
cwd: z24.string().min(1),
|
|
4552
4558
|
options: bridgeExecutionOptionsSchema,
|
|
4553
|
-
dynamicTools:
|
|
4554
|
-
disallowedTools:
|
|
4559
|
+
dynamicTools: z24.array(dynamicToolSchema).optional(),
|
|
4560
|
+
disallowedTools: z24.array(z24.string().min(1)).optional(),
|
|
4555
4561
|
instructionMode: instructionModeSchema
|
|
4556
4562
|
};
|
|
4557
|
-
var modelListParamsSchema =
|
|
4558
|
-
var threadStartParamsSchema =
|
|
4563
|
+
var modelListParamsSchema = z24.object({ cwd: z24.string().min(1).optional() }).passthrough();
|
|
4564
|
+
var threadStartParamsSchema = z24.object({
|
|
4559
4565
|
...sessionConstructionFields,
|
|
4560
|
-
input:
|
|
4566
|
+
input: z24.array(promptInputSchema).optional()
|
|
4561
4567
|
}).passthrough();
|
|
4562
|
-
var threadResumeParamsSchema =
|
|
4568
|
+
var threadResumeParamsSchema = z24.object({
|
|
4563
4569
|
...sessionConstructionFields,
|
|
4564
|
-
providerThreadId:
|
|
4570
|
+
providerThreadId: z24.string().min(1)
|
|
4565
4571
|
}).passthrough();
|
|
4566
|
-
var threadForkParamsSchema =
|
|
4572
|
+
var threadForkParamsSchema = z24.object({
|
|
4567
4573
|
...sessionConstructionFields,
|
|
4568
|
-
sourceProviderThreadId:
|
|
4569
|
-
sourceProviderCheckpointId:
|
|
4574
|
+
sourceProviderThreadId: z24.string().min(1),
|
|
4575
|
+
sourceProviderCheckpointId: z24.string().min(1).optional()
|
|
4570
4576
|
}).passthrough();
|
|
4571
|
-
var threadStopParamsSchema =
|
|
4572
|
-
threadId:
|
|
4573
|
-
providerThreadId:
|
|
4574
|
-
intent:
|
|
4575
|
-
activeTurnId:
|
|
4577
|
+
var threadStopParamsSchema = z24.object({
|
|
4578
|
+
threadId: z24.string().min(1),
|
|
4579
|
+
providerThreadId: z24.string().min(1),
|
|
4580
|
+
intent: z24.enum(["interrupt", "release"]),
|
|
4581
|
+
activeTurnId: z24.string().min(1).nullable()
|
|
4576
4582
|
}).passthrough();
|
|
4577
|
-
var threadRefParams =
|
|
4578
|
-
threadId:
|
|
4579
|
-
providerThreadId:
|
|
4583
|
+
var threadRefParams = z24.object({
|
|
4584
|
+
threadId: z24.string().min(1),
|
|
4585
|
+
providerThreadId: z24.string().min(1)
|
|
4580
4586
|
}).passthrough();
|
|
4581
|
-
var threadNameSetParamsSchema =
|
|
4582
|
-
threadId:
|
|
4583
|
-
providerThreadId:
|
|
4584
|
-
title:
|
|
4587
|
+
var threadNameSetParamsSchema = z24.object({
|
|
4588
|
+
threadId: z24.string().min(1),
|
|
4589
|
+
providerThreadId: z24.string().min(1),
|
|
4590
|
+
title: z24.string().min(1)
|
|
4585
4591
|
}).passthrough();
|
|
4586
4592
|
var turnInputFields = {
|
|
4587
|
-
threadId:
|
|
4588
|
-
providerThreadId:
|
|
4589
|
-
input:
|
|
4593
|
+
threadId: z24.string().min(1),
|
|
4594
|
+
providerThreadId: z24.string().min(1),
|
|
4595
|
+
input: z24.array(promptInputSchema),
|
|
4590
4596
|
clientRequestId: clientTurnRequestIdSchema,
|
|
4591
4597
|
options: bridgeExecutionOptionsSchema
|
|
4592
4598
|
};
|
|
4593
|
-
var turnStartParamsSchema =
|
|
4594
|
-
var turnSteerParamsSchema =
|
|
4599
|
+
var turnStartParamsSchema = z24.object(turnInputFields).passthrough();
|
|
4600
|
+
var turnSteerParamsSchema = z24.object({
|
|
4595
4601
|
...turnInputFields,
|
|
4596
|
-
expectedTurnId:
|
|
4602
|
+
expectedTurnId: z24.string().min(1)
|
|
4597
4603
|
}).passthrough();
|
|
4598
|
-
var skillsConfigureRootSchema =
|
|
4599
|
-
id:
|
|
4600
|
-
path:
|
|
4601
|
-
skills:
|
|
4602
|
-
|
|
4603
|
-
name:
|
|
4604
|
-
description:
|
|
4604
|
+
var skillsConfigureRootSchema = z24.object({
|
|
4605
|
+
id: z24.string().min(1),
|
|
4606
|
+
path: z24.string().min(1),
|
|
4607
|
+
skills: z24.array(
|
|
4608
|
+
z24.object({
|
|
4609
|
+
name: z24.string().min(1),
|
|
4610
|
+
description: z24.string()
|
|
4605
4611
|
}).passthrough()
|
|
4606
4612
|
)
|
|
4607
4613
|
}).passthrough();
|
|
4608
|
-
var skillsConfigureParamsSchema =
|
|
4609
|
-
roots:
|
|
4614
|
+
var skillsConfigureParamsSchema = z24.object({
|
|
4615
|
+
roots: z24.array(skillsConfigureRootSchema)
|
|
4610
4616
|
}).passthrough();
|
|
4611
|
-
var threadIdentityResultSchema =
|
|
4612
|
-
providerThreadId:
|
|
4613
|
-
sessionRestorable:
|
|
4617
|
+
var threadIdentityResultSchema = z24.object({
|
|
4618
|
+
providerThreadId: z24.string().min(1),
|
|
4619
|
+
sessionRestorable: z24.boolean().optional()
|
|
4614
4620
|
}).passthrough();
|
|
4615
4621
|
|
|
4616
4622
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4617
|
-
import { z as
|
|
4623
|
+
import { z as z26 } from "zod";
|
|
4618
4624
|
|
|
4619
4625
|
// ../provider-bridge-protocol/src/errors.ts
|
|
4620
|
-
import { z as
|
|
4626
|
+
import { z as z25 } from "zod";
|
|
4621
4627
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
4622
4628
|
INVALID_PARAMS: -32602,
|
|
4623
4629
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -4626,65 +4632,65 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4626
4632
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4627
4633
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4628
4634
|
};
|
|
4629
|
-
var providerRecoveryHintSchema =
|
|
4635
|
+
var providerRecoveryHintSchema = z25.object({
|
|
4630
4636
|
kind: providerRecoveryKindSchema,
|
|
4631
|
-
message:
|
|
4632
|
-
retryable:
|
|
4637
|
+
message: z25.string().min(1),
|
|
4638
|
+
retryable: z25.boolean()
|
|
4633
4639
|
});
|
|
4634
|
-
var bridgeErrorDataSchema =
|
|
4640
|
+
var bridgeErrorDataSchema = z25.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4635
4641
|
|
|
4636
4642
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4637
|
-
var threadIdentityNotificationSchema =
|
|
4638
|
-
threadId:
|
|
4639
|
-
providerThreadId:
|
|
4640
|
-
sessionRestorable:
|
|
4643
|
+
var threadIdentityNotificationSchema = z26.object({
|
|
4644
|
+
threadId: z26.string().min(1),
|
|
4645
|
+
providerThreadId: z26.string().min(1),
|
|
4646
|
+
sessionRestorable: z26.boolean().optional()
|
|
4641
4647
|
}).passthrough();
|
|
4642
|
-
var sessionReplacedNotificationSchema =
|
|
4643
|
-
threadId:
|
|
4644
|
-
providerThreadId:
|
|
4645
|
-
reason:
|
|
4646
|
-
contextLost:
|
|
4647
|
-
showRuntimeNote:
|
|
4648
|
+
var sessionReplacedNotificationSchema = z26.object({
|
|
4649
|
+
threadId: z26.string().min(1),
|
|
4650
|
+
providerThreadId: z26.string().min(1).nullable(),
|
|
4651
|
+
reason: z26.string().min(1),
|
|
4652
|
+
contextLost: z26.boolean().default(false),
|
|
4653
|
+
showRuntimeNote: z26.boolean().default(false)
|
|
4648
4654
|
}).passthrough();
|
|
4649
|
-
var providerRecoveryNotificationSchema =
|
|
4650
|
-
threadId:
|
|
4655
|
+
var providerRecoveryNotificationSchema = z26.object({
|
|
4656
|
+
threadId: z26.string().min(1).optional(),
|
|
4651
4657
|
...providerRecoveryHintSchema.shape
|
|
4652
4658
|
}).passthrough();
|
|
4653
|
-
var errorNotificationSchema =
|
|
4654
|
-
threadId:
|
|
4655
|
-
providerThreadId:
|
|
4656
|
-
message:
|
|
4659
|
+
var errorNotificationSchema = z26.object({
|
|
4660
|
+
threadId: z26.string().min(1).optional(),
|
|
4661
|
+
providerThreadId: z26.string().min(1).optional(),
|
|
4662
|
+
message: z26.string().min(1)
|
|
4657
4663
|
}).passthrough();
|
|
4658
4664
|
|
|
4659
4665
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
4660
|
-
import { z as
|
|
4661
|
-
var toolCallRequestParamsSchema =
|
|
4662
|
-
providerThreadId:
|
|
4663
|
-
threadId:
|
|
4664
|
-
turnId:
|
|
4665
|
-
callId:
|
|
4666
|
-
tool:
|
|
4667
|
-
arguments:
|
|
4668
|
-
providerNativeIds:
|
|
4666
|
+
import { z as z27 } from "zod";
|
|
4667
|
+
var toolCallRequestParamsSchema = z27.object({
|
|
4668
|
+
providerThreadId: z27.string().min(1),
|
|
4669
|
+
threadId: z27.string().min(1).optional(),
|
|
4670
|
+
turnId: z27.union([z27.string().min(1), z27.null()]),
|
|
4671
|
+
callId: z27.string().min(1),
|
|
4672
|
+
tool: z27.string().min(1),
|
|
4673
|
+
arguments: z27.unknown(),
|
|
4674
|
+
providerNativeIds: z27.boolean().optional()
|
|
4669
4675
|
}).passthrough();
|
|
4670
|
-
var toolCallResultSchema =
|
|
4671
|
-
success:
|
|
4672
|
-
contentItems:
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
type:
|
|
4677
|
-
imageUrl:
|
|
4676
|
+
var toolCallResultSchema = z27.object({
|
|
4677
|
+
success: z27.boolean(),
|
|
4678
|
+
contentItems: z27.array(
|
|
4679
|
+
z27.discriminatedUnion("type", [
|
|
4680
|
+
z27.object({ type: z27.literal("inputText"), text: z27.string() }),
|
|
4681
|
+
z27.object({
|
|
4682
|
+
type: z27.literal("inputImage"),
|
|
4683
|
+
imageUrl: z27.string().min(1)
|
|
4678
4684
|
})
|
|
4679
4685
|
])
|
|
4680
4686
|
)
|
|
4681
4687
|
}).passthrough();
|
|
4682
|
-
var interactionRequestParamsSchema =
|
|
4683
|
-
providerThreadId:
|
|
4684
|
-
threadId:
|
|
4685
|
-
turnId:
|
|
4688
|
+
var interactionRequestParamsSchema = z27.object({
|
|
4689
|
+
providerThreadId: z27.string().min(1),
|
|
4690
|
+
threadId: z27.string().min(1).optional(),
|
|
4691
|
+
turnId: z27.union([z27.string().min(1), z27.null()]),
|
|
4686
4692
|
payload: pendingInteractionPayloadSchema,
|
|
4687
|
-
providerNativeIds:
|
|
4693
|
+
providerNativeIds: z27.boolean().optional()
|
|
4688
4694
|
}).passthrough();
|
|
4689
4695
|
|
|
4690
4696
|
// ../provider-bridge-protocol/src/thread-event-grammar.ts
|
|
@@ -4861,7 +4867,7 @@ function threadEvents(context, threadId) {
|
|
|
4861
4867
|
context.client.drainIntoLog();
|
|
4862
4868
|
return context.client.events.filter((entry) => entry.threadId === threadId).map((entry) => entry.event);
|
|
4863
4869
|
}
|
|
4864
|
-
var persistedEventSchema =
|
|
4870
|
+
var persistedEventSchema = z28.preprocess(
|
|
4865
4871
|
(event) => JSON.parse(JSON.stringify(event)),
|
|
4866
4872
|
threadEventSchema
|
|
4867
4873
|
);
|
|
@@ -5956,26 +5962,26 @@ function formatConformanceReport(report) {
|
|
|
5956
5962
|
}
|
|
5957
5963
|
|
|
5958
5964
|
// ../provider-bridge-protocol/src/testing/bridge-json-rpc-test-helpers.ts
|
|
5959
|
-
import { z as
|
|
5960
|
-
var bridgeJsonRpcValueSchema =
|
|
5961
|
-
() =>
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5965
|
+
import { z as z29 } from "zod";
|
|
5966
|
+
var bridgeJsonRpcValueSchema = z29.lazy(
|
|
5967
|
+
() => z29.union([
|
|
5968
|
+
z29.string(),
|
|
5969
|
+
z29.number(),
|
|
5970
|
+
z29.boolean(),
|
|
5971
|
+
z29.null(),
|
|
5972
|
+
z29.array(bridgeJsonRpcValueSchema),
|
|
5973
|
+
z29.record(z29.string(), bridgeJsonRpcValueSchema)
|
|
5968
5974
|
])
|
|
5969
5975
|
);
|
|
5970
|
-
var bridgeJsonRpcOutputSchema =
|
|
5971
|
-
jsonrpc:
|
|
5972
|
-
id:
|
|
5973
|
-
method:
|
|
5976
|
+
var bridgeJsonRpcOutputSchema = z29.object({
|
|
5977
|
+
jsonrpc: z29.literal("2.0"),
|
|
5978
|
+
id: z29.union([z29.string(), z29.number()]).optional(),
|
|
5979
|
+
method: z29.string().optional(),
|
|
5974
5980
|
params: bridgeJsonRpcValueSchema.optional(),
|
|
5975
5981
|
result: bridgeJsonRpcValueSchema.optional(),
|
|
5976
|
-
error:
|
|
5977
|
-
code:
|
|
5978
|
-
message:
|
|
5982
|
+
error: z29.object({
|
|
5983
|
+
code: z29.number(),
|
|
5984
|
+
message: z29.string(),
|
|
5979
5985
|
data: bridgeJsonRpcValueSchema.optional()
|
|
5980
5986
|
}).optional()
|
|
5981
5987
|
});
|