@get-bb/plugin-sdk 0.6.65 → 0.6.73
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/README.md +2 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +1192 -440
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +60 -35
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +34 -14
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +19 -2
- package/bundled-types/bb-plugin-sdk.d.ts +6463 -5633
- package/dist/app.js +98 -4
- package/dist/index.js +16 -0
- package/dist/internal/composer-handle.js +14 -15
- package/dist/internal/plugin-app-collector.js +243 -150
- package/dist/internal/rpc-query-host.js +1987 -193
- package/dist/provider-bridge-acp-next.js +2599 -2627
- package/dist/provider-bridge-acp.js +2599 -2627
- package/dist/provider-bridge-testing.js +1210 -1238
- package/dist/provider-bridge.js +1258 -1286
- package/dist/testing/app.js +2577 -450
- package/dist/testing/index.js +69 -0
- package/package.json +1 -1
|
@@ -329,241 +329,291 @@ var backgroundTaskUsageSchema = z5.object({
|
|
|
329
329
|
durationMs: z5.number()
|
|
330
330
|
});
|
|
331
331
|
|
|
332
|
-
// ../domain/src/
|
|
333
|
-
import { z as
|
|
334
|
-
|
|
335
|
-
// ../domain/src/thread-events.ts
|
|
336
|
-
import { z as z11 } from "zod";
|
|
337
|
-
|
|
338
|
-
// ../domain/src/pending-interactions.ts
|
|
339
|
-
import { z as z8 } from "zod";
|
|
332
|
+
// ../domain/src/protocol-ids.ts
|
|
333
|
+
import { z as z6 } from "zod";
|
|
334
|
+
var clientTurnRequestIdSchema = z6.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
340
335
|
|
|
341
|
-
// ../domain/src/
|
|
342
|
-
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
336
|
+
// ../domain/src/system-message.ts
|
|
337
|
+
import { z as z7 } from "zod";
|
|
338
|
+
var systemMessageKindValues = [
|
|
339
|
+
"ownership-assigned",
|
|
340
|
+
"ownership-removed",
|
|
341
|
+
"child-needs-attention",
|
|
342
|
+
"child-completed",
|
|
343
|
+
"child-failed",
|
|
344
|
+
"child-interrupted",
|
|
345
|
+
"child-outcome-batch",
|
|
346
|
+
"tool-result-delivered",
|
|
347
|
+
"environment-directory-updated",
|
|
348
|
+
"unlabeled"
|
|
349
|
+
];
|
|
350
|
+
var systemMessageKindSchema = z7.enum(systemMessageKindValues);
|
|
351
|
+
var systemThreadInterruptedReasonSchema = z7.enum([
|
|
352
|
+
"manual-stop",
|
|
353
|
+
"host-daemon-restarted",
|
|
354
|
+
"host-removed",
|
|
355
|
+
"provider-turn-idle"
|
|
356
|
+
]);
|
|
357
|
+
var childThreadOutcomeSchema = z7.object({
|
|
358
|
+
threadId: z7.string(),
|
|
359
|
+
status: z7.enum(["completed", "failed", "interrupted"]),
|
|
360
|
+
interruption: z7.object({
|
|
361
|
+
reason: systemThreadInterruptedReasonSchema,
|
|
362
|
+
cause: z7.literal("host-connection-lost").optional()
|
|
363
|
+
}).optional()
|
|
364
|
+
});
|
|
365
|
+
var systemMessageSubjectSchema = z7.discriminatedUnion("kind", [
|
|
366
|
+
z7.object({
|
|
367
|
+
kind: z7.literal("thread"),
|
|
368
|
+
threadId: z7.string(),
|
|
369
|
+
threadName: z7.string(),
|
|
370
|
+
outcomes: z7.array(childThreadOutcomeSchema).optional()
|
|
371
|
+
}),
|
|
372
|
+
z7.object({
|
|
373
|
+
kind: z7.literal("thread-batch"),
|
|
374
|
+
count: z7.number(),
|
|
375
|
+
outcomes: z7.array(childThreadOutcomeSchema).optional()
|
|
376
|
+
}),
|
|
377
|
+
z7.object({
|
|
378
|
+
kind: z7.literal("tool-call"),
|
|
379
|
+
toolName: z7.string(),
|
|
380
|
+
suppress: z7.boolean()
|
|
381
|
+
}),
|
|
382
|
+
z7.object({
|
|
383
|
+
kind: z7.literal("directory"),
|
|
384
|
+
path: z7.string()
|
|
385
|
+
})
|
|
386
|
+
]);
|
|
348
387
|
|
|
349
388
|
// ../domain/src/item-presentation.ts
|
|
350
|
-
import { z as
|
|
389
|
+
import { z as z8 } from "zod";
|
|
351
390
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
352
|
-
var threadEventItemPresentationLabelSchema =
|
|
353
|
-
pending:
|
|
354
|
-
completed:
|
|
391
|
+
var threadEventItemPresentationLabelSchema = z8.object({
|
|
392
|
+
pending: z8.string().min(1),
|
|
393
|
+
completed: z8.string().min(1)
|
|
355
394
|
});
|
|
356
|
-
var threadEventItemPresentationIconSchema =
|
|
357
|
-
glyph:
|
|
395
|
+
var threadEventItemPresentationIconSchema = z8.object({
|
|
396
|
+
glyph: z8.string().min(1)
|
|
358
397
|
});
|
|
359
|
-
var threadEventItemPresentationTintSchema =
|
|
360
|
-
light:
|
|
361
|
-
dark:
|
|
398
|
+
var threadEventItemPresentationTintSchema = z8.object({
|
|
399
|
+
light: z8.string().min(1),
|
|
400
|
+
dark: z8.string().min(1)
|
|
362
401
|
});
|
|
363
402
|
var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
|
|
364
|
-
var threadEventItemPresentationBadgeSchema =
|
|
365
|
-
glyph:
|
|
366
|
-
label:
|
|
367
|
-
hint:
|
|
368
|
-
tone:
|
|
403
|
+
var threadEventItemPresentationBadgeSchema = z8.object({
|
|
404
|
+
glyph: z8.string().min(1),
|
|
405
|
+
label: z8.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
406
|
+
hint: z8.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
407
|
+
tone: z8.enum(["neutral", "destructive"])
|
|
369
408
|
});
|
|
370
|
-
var threadEventItemPresentationSchema =
|
|
409
|
+
var threadEventItemPresentationSchema = z8.object({
|
|
371
410
|
label: threadEventItemPresentationLabelSchema,
|
|
372
411
|
icon: threadEventItemPresentationIconSchema,
|
|
373
|
-
title:
|
|
374
|
-
detail:
|
|
375
|
-
suppress:
|
|
412
|
+
title: z8.string().optional(),
|
|
413
|
+
detail: z8.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
414
|
+
suppress: z8.boolean().optional(),
|
|
376
415
|
tint: threadEventItemPresentationTintSchema.optional(),
|
|
377
416
|
badge: threadEventItemPresentationBadgeSchema.optional()
|
|
378
417
|
});
|
|
379
418
|
|
|
419
|
+
// ../domain/src/pending-interactions.ts
|
|
420
|
+
import { z as z10 } from "zod";
|
|
421
|
+
|
|
422
|
+
// ../domain/src/plugin-interaction-limits.ts
|
|
423
|
+
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
424
|
+
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
425
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
426
|
+
function jsonByteLength(value) {
|
|
427
|
+
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
428
|
+
}
|
|
429
|
+
|
|
380
430
|
// ../domain/src/provider-extension-kind.ts
|
|
381
|
-
import { z as
|
|
431
|
+
import { z as z9 } from "zod";
|
|
382
432
|
var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
|
|
383
433
|
function isExtensionKind(value) {
|
|
384
434
|
return EXTENSION_KIND_PATTERN.test(value);
|
|
385
435
|
}
|
|
386
|
-
var extensionKindSchema =
|
|
436
|
+
var extensionKindSchema = z9.string().refine(isExtensionKind, {
|
|
387
437
|
message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
|
|
388
438
|
});
|
|
389
439
|
|
|
390
440
|
// ../domain/src/pending-interactions.ts
|
|
391
|
-
var pendingInteractionStatusSchema =
|
|
441
|
+
var pendingInteractionStatusSchema = z10.enum([
|
|
392
442
|
"pending",
|
|
393
443
|
"resolving",
|
|
394
444
|
"resolved",
|
|
395
445
|
"interrupted"
|
|
396
446
|
]);
|
|
397
|
-
var pendingInteractionCommandActionSchema =
|
|
447
|
+
var pendingInteractionCommandActionSchema = z10.discriminatedUnion(
|
|
398
448
|
"type",
|
|
399
449
|
[
|
|
400
|
-
|
|
401
|
-
type:
|
|
402
|
-
command:
|
|
403
|
-
name:
|
|
404
|
-
path:
|
|
450
|
+
z10.object({
|
|
451
|
+
type: z10.literal("read"),
|
|
452
|
+
command: z10.string(),
|
|
453
|
+
name: z10.string(),
|
|
454
|
+
path: z10.string()
|
|
405
455
|
}),
|
|
406
|
-
|
|
407
|
-
type:
|
|
408
|
-
command:
|
|
409
|
-
path:
|
|
456
|
+
z10.object({
|
|
457
|
+
type: z10.literal("listFiles"),
|
|
458
|
+
command: z10.string(),
|
|
459
|
+
path: z10.string().nullable()
|
|
410
460
|
}),
|
|
411
|
-
|
|
412
|
-
type:
|
|
413
|
-
command:
|
|
414
|
-
query:
|
|
415
|
-
path:
|
|
461
|
+
z10.object({
|
|
462
|
+
type: z10.literal("search"),
|
|
463
|
+
command: z10.string(),
|
|
464
|
+
query: z10.string().nullable(),
|
|
465
|
+
path: z10.string().nullable()
|
|
416
466
|
}),
|
|
417
|
-
|
|
418
|
-
type:
|
|
419
|
-
command:
|
|
467
|
+
z10.object({
|
|
468
|
+
type: z10.literal("unknown"),
|
|
469
|
+
command: z10.string()
|
|
420
470
|
})
|
|
421
471
|
]
|
|
422
472
|
);
|
|
423
|
-
var pendingInteractionNetworkPermissionsSchema =
|
|
424
|
-
enabled:
|
|
473
|
+
var pendingInteractionNetworkPermissionsSchema = z10.object({
|
|
474
|
+
enabled: z10.boolean().nullable()
|
|
425
475
|
});
|
|
426
|
-
var pendingInteractionFileSystemPermissionsSchema =
|
|
427
|
-
read:
|
|
428
|
-
write:
|
|
476
|
+
var pendingInteractionFileSystemPermissionsSchema = z10.object({
|
|
477
|
+
read: z10.array(z10.string()),
|
|
478
|
+
write: z10.array(z10.string())
|
|
429
479
|
});
|
|
430
|
-
var pendingInteractionMacOsPreferencesPermissionSchema =
|
|
480
|
+
var pendingInteractionMacOsPreferencesPermissionSchema = z10.enum([
|
|
431
481
|
"none",
|
|
432
482
|
"read_only",
|
|
433
483
|
"read_write"
|
|
434
484
|
]);
|
|
435
|
-
var pendingInteractionMacOsContactsPermissionSchema =
|
|
485
|
+
var pendingInteractionMacOsContactsPermissionSchema = z10.enum([
|
|
436
486
|
"none",
|
|
437
487
|
"read_only",
|
|
438
488
|
"read_write"
|
|
439
489
|
]);
|
|
440
|
-
var pendingInteractionMacOsAutomationPermissionSchema =
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
kind:
|
|
445
|
-
bundleIds:
|
|
490
|
+
var pendingInteractionMacOsAutomationPermissionSchema = z10.union([
|
|
491
|
+
z10.literal("none"),
|
|
492
|
+
z10.literal("all"),
|
|
493
|
+
z10.object({
|
|
494
|
+
kind: z10.literal("bundle_ids"),
|
|
495
|
+
bundleIds: z10.array(z10.string())
|
|
446
496
|
})
|
|
447
497
|
]);
|
|
448
|
-
var pendingInteractionMacOsPermissionsSchema =
|
|
498
|
+
var pendingInteractionMacOsPermissionsSchema = z10.object({
|
|
449
499
|
preferences: pendingInteractionMacOsPreferencesPermissionSchema,
|
|
450
500
|
automations: pendingInteractionMacOsAutomationPermissionSchema,
|
|
451
|
-
launchServices:
|
|
452
|
-
accessibility:
|
|
453
|
-
calendar:
|
|
454
|
-
reminders:
|
|
501
|
+
launchServices: z10.boolean(),
|
|
502
|
+
accessibility: z10.boolean(),
|
|
503
|
+
calendar: z10.boolean(),
|
|
504
|
+
reminders: z10.boolean(),
|
|
455
505
|
contacts: pendingInteractionMacOsContactsPermissionSchema
|
|
456
506
|
});
|
|
457
|
-
var pendingInteractionRequestedPermissionProfileSchema =
|
|
507
|
+
var pendingInteractionRequestedPermissionProfileSchema = z10.object({
|
|
458
508
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
459
509
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
|
|
460
510
|
macos: pendingInteractionMacOsPermissionsSchema.nullable()
|
|
461
511
|
});
|
|
462
|
-
var pendingInteractionGrantablePermissionProfileSchema =
|
|
512
|
+
var pendingInteractionGrantablePermissionProfileSchema = z10.object({
|
|
463
513
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
464
514
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
|
|
465
515
|
}).strict();
|
|
466
516
|
var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
|
|
467
|
-
var pendingInteractionApprovalDecisionSchema =
|
|
517
|
+
var pendingInteractionApprovalDecisionSchema = z10.enum([
|
|
468
518
|
"allow_once",
|
|
469
519
|
"allow_for_session",
|
|
470
520
|
"deny"
|
|
471
521
|
]);
|
|
472
|
-
var pendingInteractionFileChangeWriteScopeSchema =
|
|
473
|
-
var pendingInteractionCommandApprovalSubjectSchema =
|
|
474
|
-
kind:
|
|
475
|
-
itemId:
|
|
476
|
-
command:
|
|
477
|
-
cwd:
|
|
478
|
-
actions:
|
|
522
|
+
var pendingInteractionFileChangeWriteScopeSchema = z10.string().min(1);
|
|
523
|
+
var pendingInteractionCommandApprovalSubjectSchema = z10.object({
|
|
524
|
+
kind: z10.literal("command"),
|
|
525
|
+
itemId: z10.string().min(1),
|
|
526
|
+
command: z10.string().min(1),
|
|
527
|
+
cwd: z10.string().nullable(),
|
|
528
|
+
actions: z10.array(pendingInteractionCommandActionSchema),
|
|
479
529
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
480
530
|
});
|
|
481
|
-
var pendingInteractionFileChangeApprovalSubjectSchema =
|
|
482
|
-
kind:
|
|
483
|
-
itemId:
|
|
531
|
+
var pendingInteractionFileChangeApprovalSubjectSchema = z10.object({
|
|
532
|
+
kind: z10.literal("file_change"),
|
|
533
|
+
itemId: z10.string().min(1),
|
|
484
534
|
writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
|
|
485
535
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
486
536
|
});
|
|
487
|
-
var pendingInteractionPermissionGrantApprovalSubjectSchema =
|
|
488
|
-
kind:
|
|
489
|
-
itemId:
|
|
490
|
-
toolName:
|
|
537
|
+
var pendingInteractionPermissionGrantApprovalSubjectSchema = z10.object({
|
|
538
|
+
kind: z10.literal("permission_grant"),
|
|
539
|
+
itemId: z10.string().min(1),
|
|
540
|
+
toolName: z10.string().nullable(),
|
|
491
541
|
permissions: pendingInteractionGrantablePermissionProfileSchema
|
|
492
542
|
});
|
|
493
|
-
var pendingInteractionPlanApprovalSubjectSchema =
|
|
494
|
-
kind:
|
|
495
|
-
itemId:
|
|
496
|
-
plan:
|
|
497
|
-
planFilePath:
|
|
543
|
+
var pendingInteractionPlanApprovalSubjectSchema = z10.object({
|
|
544
|
+
kind: z10.literal("plan"),
|
|
545
|
+
itemId: z10.string().min(1),
|
|
546
|
+
plan: z10.string().min(1),
|
|
547
|
+
planFilePath: z10.string().min(1).nullable()
|
|
498
548
|
});
|
|
499
|
-
var pendingInteractionToolUseApprovalSubjectSchema =
|
|
500
|
-
kind:
|
|
501
|
-
itemId:
|
|
502
|
-
tool:
|
|
549
|
+
var pendingInteractionToolUseApprovalSubjectSchema = z10.object({
|
|
550
|
+
kind: z10.literal("tool_use"),
|
|
551
|
+
itemId: z10.string().min(1),
|
|
552
|
+
tool: z10.string().min(1),
|
|
503
553
|
presentation: threadEventItemPresentationSchema
|
|
504
554
|
});
|
|
505
|
-
var pendingInteractionApprovalSubjectSchema =
|
|
555
|
+
var pendingInteractionApprovalSubjectSchema = z10.discriminatedUnion("kind", [
|
|
506
556
|
pendingInteractionCommandApprovalSubjectSchema,
|
|
507
557
|
pendingInteractionFileChangeApprovalSubjectSchema,
|
|
508
558
|
pendingInteractionPermissionGrantApprovalSubjectSchema,
|
|
509
559
|
pendingInteractionPlanApprovalSubjectSchema,
|
|
510
560
|
pendingInteractionToolUseApprovalSubjectSchema
|
|
511
561
|
]);
|
|
512
|
-
var approvalPendingInteractionPayloadSchema =
|
|
513
|
-
kind:
|
|
562
|
+
var approvalPendingInteractionPayloadSchema = z10.object({
|
|
563
|
+
kind: z10.literal("approval"),
|
|
514
564
|
subject: pendingInteractionApprovalSubjectSchema,
|
|
515
|
-
reason:
|
|
516
|
-
availableDecisions:
|
|
565
|
+
reason: z10.string().nullable(),
|
|
566
|
+
availableDecisions: z10.array(pendingInteractionApprovalDecisionSchema).min(1)
|
|
517
567
|
});
|
|
518
568
|
var USER_QUESTION_MAX_QUESTIONS = 4;
|
|
519
569
|
var USER_QUESTION_MAX_OPTIONS = 4;
|
|
520
570
|
var USER_QUESTION_MAX_SELECTED = 4;
|
|
521
571
|
var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
|
|
522
|
-
var pendingInteractionUserQuestionIdSchema =
|
|
572
|
+
var pendingInteractionUserQuestionIdSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
523
573
|
message: "User question ids cannot be blank"
|
|
524
574
|
});
|
|
525
|
-
var pendingInteractionUserQuestionPromptSchema =
|
|
575
|
+
var pendingInteractionUserQuestionPromptSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
526
576
|
message: "User question prompts cannot be blank"
|
|
527
577
|
});
|
|
528
|
-
var pendingInteractionUserQuestionShortLabelSchema =
|
|
578
|
+
var pendingInteractionUserQuestionShortLabelSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
529
579
|
message: "User question short labels cannot be blank"
|
|
530
580
|
});
|
|
531
|
-
var pendingInteractionUserQuestionOptionValueSchema =
|
|
581
|
+
var pendingInteractionUserQuestionOptionValueSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
532
582
|
message: "User question option values cannot be blank"
|
|
533
583
|
});
|
|
534
|
-
var pendingInteractionUserQuestionOptionLabelSchema =
|
|
584
|
+
var pendingInteractionUserQuestionOptionLabelSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
535
585
|
message: "User question option labels cannot be blank"
|
|
536
586
|
});
|
|
537
|
-
var pendingInteractionUserQuestionOptionDescriptionSchema =
|
|
587
|
+
var pendingInteractionUserQuestionOptionDescriptionSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
538
588
|
message: "User question option descriptions cannot be blank"
|
|
539
589
|
});
|
|
540
|
-
var pendingInteractionUserQuestionFreeTextSchema =
|
|
590
|
+
var pendingInteractionUserQuestionFreeTextSchema = z10.string().min(1).max(
|
|
541
591
|
USER_QUESTION_MAX_FREE_TEXT_LENGTH,
|
|
542
592
|
`User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
|
|
543
593
|
).refine((value) => value.trim().length > 0, {
|
|
544
594
|
message: "User question free text cannot be blank"
|
|
545
595
|
});
|
|
546
|
-
var pendingInteractionUserQuestionOptionSchema =
|
|
596
|
+
var pendingInteractionUserQuestionOptionSchema = z10.object({
|
|
547
597
|
value: pendingInteractionUserQuestionOptionValueSchema,
|
|
548
598
|
label: pendingInteractionUserQuestionOptionLabelSchema,
|
|
549
599
|
description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
|
|
550
600
|
});
|
|
551
|
-
var pendingInteractionUserQuestionQuestionSchema =
|
|
601
|
+
var pendingInteractionUserQuestionQuestionSchema = z10.object({
|
|
552
602
|
id: pendingInteractionUserQuestionIdSchema,
|
|
553
603
|
prompt: pendingInteractionUserQuestionPromptSchema,
|
|
554
604
|
shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
|
|
555
|
-
multiSelect:
|
|
556
|
-
options:
|
|
605
|
+
multiSelect: z10.boolean(),
|
|
606
|
+
options: z10.array(pendingInteractionUserQuestionOptionSchema).max(
|
|
557
607
|
USER_QUESTION_MAX_OPTIONS,
|
|
558
608
|
`User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
|
|
559
609
|
).optional(),
|
|
560
|
-
allowFreeText:
|
|
610
|
+
allowFreeText: z10.boolean()
|
|
561
611
|
}).superRefine((question, context) => {
|
|
562
612
|
const optionValues = /* @__PURE__ */ new Set();
|
|
563
613
|
question.options?.forEach((option, index) => {
|
|
564
614
|
if (optionValues.has(option.value)) {
|
|
565
615
|
context.addIssue({
|
|
566
|
-
code:
|
|
616
|
+
code: z10.ZodIssueCode.custom,
|
|
567
617
|
message: "User question option values must be unique",
|
|
568
618
|
path: ["options", index, "value"]
|
|
569
619
|
});
|
|
@@ -578,9 +628,9 @@ var pendingInteractionUserQuestionQuestionSchema = z8.object({
|
|
|
578
628
|
path: ["options"]
|
|
579
629
|
}
|
|
580
630
|
);
|
|
581
|
-
var userQuestionPendingInteractionPayloadSchema =
|
|
582
|
-
kind:
|
|
583
|
-
questions:
|
|
631
|
+
var userQuestionPendingInteractionPayloadSchema = z10.object({
|
|
632
|
+
kind: z10.literal("user_question"),
|
|
633
|
+
questions: z10.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
|
|
584
634
|
USER_QUESTION_MAX_QUESTIONS,
|
|
585
635
|
`User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
|
|
586
636
|
)
|
|
@@ -589,7 +639,7 @@ var userQuestionPendingInteractionPayloadSchema = z8.object({
|
|
|
589
639
|
payload.questions.forEach((question, index) => {
|
|
590
640
|
if (questionIds.has(question.id)) {
|
|
591
641
|
context.addIssue({
|
|
592
|
-
code:
|
|
642
|
+
code: z10.ZodIssueCode.custom,
|
|
593
643
|
message: "User question ids must be unique",
|
|
594
644
|
path: ["questions", index, "id"]
|
|
595
645
|
});
|
|
@@ -598,75 +648,75 @@ var userQuestionPendingInteractionPayloadSchema = z8.object({
|
|
|
598
648
|
questionIds.add(question.id);
|
|
599
649
|
});
|
|
600
650
|
});
|
|
601
|
-
var pluginPendingInteractionPayloadSchema =
|
|
602
|
-
kind:
|
|
603
|
-
title:
|
|
651
|
+
var pluginPendingInteractionPayloadSchema = z10.object({
|
|
652
|
+
kind: z10.literal("plugin"),
|
|
653
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
604
654
|
data: jsonValueSchema,
|
|
605
655
|
presentation: threadEventItemPresentationSchema.optional()
|
|
606
656
|
});
|
|
607
|
-
var pluginExtensionInteractionRequestPayloadSchema =
|
|
657
|
+
var pluginExtensionInteractionRequestPayloadSchema = z10.object({
|
|
608
658
|
kind: extensionKindSchema,
|
|
609
|
-
title:
|
|
659
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
610
660
|
data: jsonValueSchema.refine(
|
|
611
661
|
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
612
662
|
{ message: "Plugin request data exceeds 64 KiB" }
|
|
613
663
|
)
|
|
614
664
|
});
|
|
615
|
-
var interactionRequestPayloadSchema =
|
|
665
|
+
var interactionRequestPayloadSchema = z10.union([
|
|
616
666
|
userQuestionPendingInteractionPayloadSchema,
|
|
617
667
|
pluginExtensionInteractionRequestPayloadSchema
|
|
618
668
|
]);
|
|
619
|
-
var pendingInteractionPayloadSchema =
|
|
669
|
+
var pendingInteractionPayloadSchema = z10.union([
|
|
620
670
|
approvalPendingInteractionPayloadSchema,
|
|
621
671
|
userQuestionPendingInteractionPayloadSchema,
|
|
622
672
|
pluginExtensionInteractionRequestPayloadSchema
|
|
623
673
|
]);
|
|
624
674
|
var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
|
|
625
|
-
var approvalPendingInteractionResolutionSchema =
|
|
675
|
+
var approvalPendingInteractionResolutionSchema = z10.discriminatedUnion(
|
|
626
676
|
"decision",
|
|
627
677
|
[
|
|
628
|
-
|
|
629
|
-
decision:
|
|
678
|
+
z10.object({
|
|
679
|
+
decision: z10.literal("allow_once"),
|
|
630
680
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
631
681
|
}),
|
|
632
|
-
|
|
633
|
-
decision:
|
|
682
|
+
z10.object({
|
|
683
|
+
decision: z10.literal("allow_for_session"),
|
|
634
684
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
635
685
|
}),
|
|
636
|
-
|
|
637
|
-
decision:
|
|
686
|
+
z10.object({
|
|
687
|
+
decision: z10.literal("deny")
|
|
638
688
|
})
|
|
639
689
|
],
|
|
640
690
|
approvalDecisionDiscriminatorError
|
|
641
691
|
);
|
|
642
|
-
var pendingInteractionUserAnswerSchema =
|
|
643
|
-
selected:
|
|
692
|
+
var pendingInteractionUserAnswerSchema = z10.object({
|
|
693
|
+
selected: z10.array(z10.string().min(1)).max(
|
|
644
694
|
USER_QUESTION_MAX_SELECTED,
|
|
645
695
|
`User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
|
|
646
696
|
),
|
|
647
697
|
freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
|
|
648
698
|
});
|
|
649
|
-
var userQuestionPendingInteractionResolutionSchema =
|
|
650
|
-
kind:
|
|
651
|
-
answers:
|
|
699
|
+
var userQuestionPendingInteractionResolutionSchema = z10.object({
|
|
700
|
+
kind: z10.literal("user_answer"),
|
|
701
|
+
answers: z10.record(z10.string().min(1), pendingInteractionUserAnswerSchema)
|
|
652
702
|
});
|
|
653
|
-
var pluginInteractionDescriptionSchema =
|
|
654
|
-
title:
|
|
655
|
-
detail:
|
|
703
|
+
var pluginInteractionDescriptionSchema = z10.object({
|
|
704
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH).optional(),
|
|
705
|
+
detail: z10.string().trim().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
656
706
|
payload: jsonValueSchema.refine(
|
|
657
707
|
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
658
708
|
{ message: "Plugin interaction description payload exceeds 64 KiB" }
|
|
659
709
|
).optional()
|
|
660
710
|
});
|
|
661
|
-
var pluginPendingInteractionResolutionSchema =
|
|
662
|
-
kind:
|
|
711
|
+
var pluginPendingInteractionResolutionSchema = z10.object({
|
|
712
|
+
kind: z10.literal("plugin_submitted"),
|
|
663
713
|
description: pluginInteractionDescriptionSchema.optional()
|
|
664
714
|
});
|
|
665
|
-
var pluginExtensionInteractionResolutionSchema =
|
|
666
|
-
kind:
|
|
715
|
+
var pluginExtensionInteractionResolutionSchema = z10.object({
|
|
716
|
+
kind: z10.literal("request_answer"),
|
|
667
717
|
value: jsonValueSchema
|
|
668
718
|
});
|
|
669
|
-
var pendingInteractionResolutionSchema =
|
|
719
|
+
var pendingInteractionResolutionSchema = z10.union(
|
|
670
720
|
[
|
|
671
721
|
approvalPendingInteractionResolutionSchema,
|
|
672
722
|
userQuestionPendingInteractionResolutionSchema,
|
|
@@ -675,56 +725,56 @@ var pendingInteractionResolutionSchema = z8.union(
|
|
|
675
725
|
],
|
|
676
726
|
approvalDecisionDiscriminatorError
|
|
677
727
|
);
|
|
678
|
-
var approvalInteractionOutcomeSchema =
|
|
728
|
+
var approvalInteractionOutcomeSchema = z10.object({
|
|
679
729
|
payload: approvalPendingInteractionPayloadSchema,
|
|
680
730
|
resolution: approvalPendingInteractionResolutionSchema
|
|
681
731
|
});
|
|
682
|
-
var userQuestionInteractionOutcomeSchema =
|
|
732
|
+
var userQuestionInteractionOutcomeSchema = z10.object({
|
|
683
733
|
payload: userQuestionPendingInteractionPayloadSchema,
|
|
684
734
|
resolution: userQuestionPendingInteractionResolutionSchema
|
|
685
735
|
});
|
|
686
|
-
var pluginExtensionInteractionOutcomeSchema =
|
|
736
|
+
var pluginExtensionInteractionOutcomeSchema = z10.object({
|
|
687
737
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
688
738
|
resolution: pluginExtensionInteractionResolutionSchema
|
|
689
739
|
});
|
|
690
|
-
var providerInteractionOutcomeSchema =
|
|
740
|
+
var providerInteractionOutcomeSchema = z10.union([
|
|
691
741
|
approvalInteractionOutcomeSchema,
|
|
692
742
|
userQuestionInteractionOutcomeSchema,
|
|
693
743
|
pluginExtensionInteractionOutcomeSchema
|
|
694
744
|
]);
|
|
695
|
-
var pendingInteractionProviderOriginSchema =
|
|
696
|
-
kind:
|
|
697
|
-
providerId:
|
|
698
|
-
providerThreadId:
|
|
699
|
-
providerRequestId:
|
|
700
|
-
});
|
|
701
|
-
var pendingInteractionPluginOriginSchema =
|
|
702
|
-
kind:
|
|
703
|
-
pluginId:
|
|
704
|
-
rendererId:
|
|
705
|
-
});
|
|
706
|
-
var pendingInteractionCreateSchema =
|
|
707
|
-
threadId:
|
|
708
|
-
turnId:
|
|
709
|
-
providerId:
|
|
710
|
-
providerThreadId:
|
|
711
|
-
providerRequestId:
|
|
745
|
+
var pendingInteractionProviderOriginSchema = z10.object({
|
|
746
|
+
kind: z10.literal("provider"),
|
|
747
|
+
providerId: z10.string().min(1),
|
|
748
|
+
providerThreadId: z10.string().min(1),
|
|
749
|
+
providerRequestId: z10.string().min(1)
|
|
750
|
+
});
|
|
751
|
+
var pendingInteractionPluginOriginSchema = z10.object({
|
|
752
|
+
kind: z10.literal("plugin"),
|
|
753
|
+
pluginId: z10.string().min(1),
|
|
754
|
+
rendererId: z10.string().min(1)
|
|
755
|
+
});
|
|
756
|
+
var pendingInteractionCreateSchema = z10.object({
|
|
757
|
+
threadId: z10.string().min(1),
|
|
758
|
+
turnId: z10.string().min(1),
|
|
759
|
+
providerId: z10.string().min(1),
|
|
760
|
+
providerThreadId: z10.string().min(1),
|
|
761
|
+
providerRequestId: z10.string().min(1),
|
|
712
762
|
payload: pendingInteractionPayloadSchema
|
|
713
763
|
});
|
|
714
|
-
var pendingInteractionBaseSchema =
|
|
715
|
-
id:
|
|
716
|
-
threadId:
|
|
764
|
+
var pendingInteractionBaseSchema = z10.object({
|
|
765
|
+
id: z10.string().min(1),
|
|
766
|
+
threadId: z10.string().min(1),
|
|
717
767
|
status: pendingInteractionStatusSchema,
|
|
718
|
-
statusReason:
|
|
719
|
-
createdAt:
|
|
720
|
-
expiresAt:
|
|
721
|
-
resolvedAt:
|
|
768
|
+
statusReason: z10.string().nullable(),
|
|
769
|
+
createdAt: z10.number().int().nonnegative(),
|
|
770
|
+
expiresAt: z10.number().int().nonnegative().nullable().optional(),
|
|
771
|
+
resolvedAt: z10.number().int().nonnegative().nullable()
|
|
722
772
|
});
|
|
723
773
|
var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
|
|
724
|
-
turnId:
|
|
725
|
-
providerId:
|
|
726
|
-
providerThreadId:
|
|
727
|
-
providerRequestId:
|
|
774
|
+
turnId: z10.string().min(1),
|
|
775
|
+
providerId: z10.string().min(1),
|
|
776
|
+
providerThreadId: z10.string().min(1),
|
|
777
|
+
providerRequestId: z10.string().min(1),
|
|
728
778
|
origin: pendingInteractionProviderOriginSchema.optional()
|
|
729
779
|
});
|
|
730
780
|
var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
|
|
@@ -739,30 +789,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
|
|
|
739
789
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
740
790
|
resolution: pluginExtensionInteractionResolutionSchema.nullable()
|
|
741
791
|
});
|
|
742
|
-
var providerPendingInteractionSchema =
|
|
792
|
+
var providerPendingInteractionSchema = z10.union([
|
|
743
793
|
approvalPendingInteractionSchema,
|
|
744
794
|
userQuestionPendingInteractionSchema,
|
|
745
795
|
pluginExtensionPendingInteractionSchema
|
|
746
796
|
]);
|
|
747
797
|
var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
|
|
748
|
-
turnId:
|
|
798
|
+
turnId: z10.string().min(1).nullable(),
|
|
749
799
|
origin: pendingInteractionPluginOriginSchema,
|
|
750
800
|
payload: pluginPendingInteractionPayloadSchema,
|
|
751
801
|
resolution: pluginPendingInteractionResolutionSchema.nullable()
|
|
752
802
|
});
|
|
753
|
-
var pendingInteractionSchema =
|
|
803
|
+
var pendingInteractionSchema = z10.union([
|
|
754
804
|
providerPendingInteractionSchema,
|
|
755
805
|
pluginPendingInteractionSchema
|
|
756
806
|
]);
|
|
757
|
-
var interactionLifecycleRecordBaseSchema =
|
|
758
|
-
id:
|
|
807
|
+
var interactionLifecycleRecordBaseSchema = z10.object({
|
|
808
|
+
id: z10.string().min(1),
|
|
759
809
|
status: pendingInteractionStatusSchema,
|
|
760
|
-
statusReason:
|
|
810
|
+
statusReason: z10.string().nullable()
|
|
761
811
|
});
|
|
762
|
-
var interactionLifecycleProviderOriginSchema =
|
|
763
|
-
kind:
|
|
764
|
-
providerId:
|
|
765
|
-
providerRequestId:
|
|
812
|
+
var interactionLifecycleProviderOriginSchema = z10.object({
|
|
813
|
+
kind: z10.literal("provider"),
|
|
814
|
+
providerId: z10.string().min(1),
|
|
815
|
+
providerRequestId: z10.string().min(1)
|
|
766
816
|
});
|
|
767
817
|
var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
|
|
768
818
|
var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
|
|
@@ -787,87 +837,35 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
|
|
|
787
837
|
}),
|
|
788
838
|
resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
|
|
789
839
|
});
|
|
790
|
-
var interactionLifecycleSchema =
|
|
840
|
+
var interactionLifecycleSchema = z10.union([
|
|
791
841
|
approvalInteractionLifecycleSchema,
|
|
792
842
|
userQuestionInteractionLifecycleSchema,
|
|
793
843
|
pluginInteractionLifecycleSchema,
|
|
794
844
|
pluginExtensionInteractionLifecycleSchema
|
|
795
845
|
]);
|
|
796
846
|
|
|
797
|
-
// ../domain/src/
|
|
798
|
-
|
|
799
|
-
var
|
|
847
|
+
// ../domain/src/plugin-icon.ts
|
|
848
|
+
var PLUGIN_ICON_MAX_BYTES = 32 * 1024;
|
|
849
|
+
var NAMESPACED_GLYPH_PATTERN = /^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u;
|
|
850
|
+
function isNamespacedGlyph(glyph) {
|
|
851
|
+
return NAMESPACED_GLYPH_PATTERN.test(glyph);
|
|
852
|
+
}
|
|
853
|
+
function parseNamespacedGlyph(glyph) {
|
|
854
|
+
if (!isNamespacedGlyph(glyph)) {
|
|
855
|
+
return null;
|
|
856
|
+
}
|
|
857
|
+
const separator = glyph.indexOf("/");
|
|
858
|
+
return {
|
|
859
|
+
pluginId: glyph.slice(0, separator),
|
|
860
|
+
name: glyph.slice(separator + 1)
|
|
861
|
+
};
|
|
862
|
+
}
|
|
800
863
|
|
|
801
|
-
// ../domain/src/
|
|
802
|
-
import { z as
|
|
803
|
-
var systemMessageKindValues = [
|
|
804
|
-
"ownership-assigned",
|
|
805
|
-
"ownership-removed",
|
|
806
|
-
"child-needs-attention",
|
|
807
|
-
"child-completed",
|
|
808
|
-
"child-failed",
|
|
809
|
-
"child-interrupted",
|
|
810
|
-
"child-outcome-batch",
|
|
811
|
-
"tool-result-delivered",
|
|
812
|
-
"environment-directory-updated",
|
|
813
|
-
"unlabeled"
|
|
814
|
-
];
|
|
815
|
-
var systemMessageKindSchema = z10.enum(systemMessageKindValues);
|
|
816
|
-
var systemThreadInterruptedReasonSchema = z10.enum([
|
|
817
|
-
"manual-stop",
|
|
818
|
-
"host-daemon-restarted",
|
|
819
|
-
"host-removed",
|
|
820
|
-
"provider-turn-idle"
|
|
821
|
-
]);
|
|
822
|
-
var childThreadOutcomeSchema = z10.object({
|
|
823
|
-
threadId: z10.string(),
|
|
824
|
-
status: z10.enum(["completed", "failed", "interrupted"]),
|
|
825
|
-
interruption: z10.object({
|
|
826
|
-
reason: systemThreadInterruptedReasonSchema,
|
|
827
|
-
cause: z10.literal("host-connection-lost").optional()
|
|
828
|
-
}).optional()
|
|
829
|
-
});
|
|
830
|
-
var systemMessageSubjectSchema = z10.discriminatedUnion("kind", [
|
|
831
|
-
z10.object({
|
|
832
|
-
kind: z10.literal("thread"),
|
|
833
|
-
threadId: z10.string(),
|
|
834
|
-
threadName: z10.string(),
|
|
835
|
-
outcomes: z10.array(childThreadOutcomeSchema).optional()
|
|
836
|
-
}),
|
|
837
|
-
z10.object({
|
|
838
|
-
kind: z10.literal("thread-batch"),
|
|
839
|
-
count: z10.number(),
|
|
840
|
-
outcomes: z10.array(childThreadOutcomeSchema).optional()
|
|
841
|
-
}),
|
|
842
|
-
z10.object({
|
|
843
|
-
kind: z10.literal("tool-call"),
|
|
844
|
-
toolName: z10.string(),
|
|
845
|
-
suppress: z10.boolean()
|
|
846
|
-
}),
|
|
847
|
-
z10.object({
|
|
848
|
-
kind: z10.literal("directory"),
|
|
849
|
-
path: z10.string()
|
|
850
|
-
})
|
|
851
|
-
]);
|
|
864
|
+
// ../domain/src/provider-event.ts
|
|
865
|
+
import { z as z15 } from "zod";
|
|
852
866
|
|
|
853
867
|
// ../domain/src/thread-events.ts
|
|
854
|
-
|
|
855
|
-
"client/thread/start",
|
|
856
|
-
"client/turn/requested",
|
|
857
|
-
"client/turn/rejected",
|
|
858
|
-
"client/turn/start",
|
|
859
|
-
"system/error",
|
|
860
|
-
"system/manager/user_message",
|
|
861
|
-
"system/thread/interrupted",
|
|
862
|
-
"system/operation",
|
|
863
|
-
"system/interaction/lifecycle",
|
|
864
|
-
"system/permissionGrant/lifecycle",
|
|
865
|
-
"system/userQuestion/lifecycle",
|
|
866
|
-
"system/thread-provisioning",
|
|
867
|
-
// Legacy persisted watchdog diagnostic; retained for read/decode/render
|
|
868
|
-
// only, with no current producer.
|
|
869
|
-
"system/provider-turn-watchdog"
|
|
870
|
-
];
|
|
868
|
+
import { z as z11 } from "zod";
|
|
871
869
|
var threadTurnInitiatorValues = ["user", "agent", "system"];
|
|
872
870
|
var threadTurnInitiatorSchema = z11.enum(threadTurnInitiatorValues);
|
|
873
871
|
var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
|
|
@@ -1223,15 +1221,22 @@ var threadTimelineGoalSchema = z13.object({
|
|
|
1223
1221
|
timeUsedSeconds: z13.number()
|
|
1224
1222
|
});
|
|
1225
1223
|
|
|
1224
|
+
// ../domain/src/thread-usage-cost.ts
|
|
1225
|
+
import { z as z14 } from "zod";
|
|
1226
|
+
var threadUsageCostSchema = z14.object({
|
|
1227
|
+
amount: z14.number().nonnegative(),
|
|
1228
|
+
currency: z14.string().min(1)
|
|
1229
|
+
});
|
|
1230
|
+
|
|
1226
1231
|
// ../domain/src/provider-event.ts
|
|
1227
|
-
var threadEventItemStatusSchema =
|
|
1232
|
+
var threadEventItemStatusSchema = z15.enum([
|
|
1228
1233
|
"pending",
|
|
1229
1234
|
"completed",
|
|
1230
1235
|
"failed",
|
|
1231
1236
|
"interrupted"
|
|
1232
1237
|
]);
|
|
1233
|
-
var threadEventItemApprovalStatusSchema =
|
|
1234
|
-
var threadEventTurnStatusSchema =
|
|
1238
|
+
var threadEventItemApprovalStatusSchema = z15.enum(["waiting_for_approval", "denied"]).nullable();
|
|
1239
|
+
var threadEventTurnStatusSchema = z15.enum([
|
|
1235
1240
|
"completed",
|
|
1236
1241
|
"failed",
|
|
1237
1242
|
"interrupted"
|
|
@@ -1257,271 +1262,267 @@ var providerErrorCategoryValues = [
|
|
|
1257
1262
|
"unauthorized",
|
|
1258
1263
|
"unknown"
|
|
1259
1264
|
];
|
|
1260
|
-
var providerErrorCategorySchema =
|
|
1261
|
-
var providerErrorInfoSchema =
|
|
1265
|
+
var providerErrorCategorySchema = z15.enum(providerErrorCategoryValues);
|
|
1266
|
+
var providerErrorInfoSchema = z15.object({
|
|
1262
1267
|
category: providerErrorCategorySchema,
|
|
1263
|
-
providerCode:
|
|
1264
|
-
httpStatusCode:
|
|
1268
|
+
providerCode: z15.string().nullable(),
|
|
1269
|
+
httpStatusCode: z15.number().nullable()
|
|
1265
1270
|
});
|
|
1266
|
-
var providerRateLimitStatusSchema =
|
|
1271
|
+
var providerRateLimitStatusSchema = z15.enum([
|
|
1267
1272
|
"allowed",
|
|
1268
1273
|
"warning",
|
|
1269
1274
|
"blocked",
|
|
1270
1275
|
"unknown"
|
|
1271
1276
|
]);
|
|
1272
|
-
var providerRateLimitWindowSchema =
|
|
1273
|
-
providerKey:
|
|
1274
|
-
label:
|
|
1277
|
+
var providerRateLimitWindowSchema = z15.object({
|
|
1278
|
+
providerKey: z15.string().min(1).nullable(),
|
|
1279
|
+
label: z15.string().min(1).nullable(),
|
|
1275
1280
|
status: providerRateLimitStatusSchema,
|
|
1276
|
-
resetsAtMs:
|
|
1281
|
+
resetsAtMs: z15.number().int().nonnegative().nullable()
|
|
1277
1282
|
});
|
|
1278
|
-
var providerRateLimitStateSchema =
|
|
1279
|
-
providerId:
|
|
1283
|
+
var providerRateLimitStateSchema = z15.object({
|
|
1284
|
+
providerId: z15.string().min(1),
|
|
1280
1285
|
status: providerRateLimitStatusSchema,
|
|
1281
|
-
kind:
|
|
1282
|
-
windows:
|
|
1283
|
-
reachedReason:
|
|
1284
|
-
overageStatus:
|
|
1285
|
-
overageReason:
|
|
1286
|
-
});
|
|
1287
|
-
var threadEventFileChangeKindSchema =
|
|
1288
|
-
var threadEventFileChangeSchema =
|
|
1289
|
-
path:
|
|
1286
|
+
kind: z15.enum(["subscription-window", "credits", "spend-control", "unknown"]),
|
|
1287
|
+
windows: z15.array(providerRateLimitWindowSchema),
|
|
1288
|
+
reachedReason: z15.string().min(1).nullable(),
|
|
1289
|
+
overageStatus: z15.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
|
|
1290
|
+
overageReason: z15.string().min(1).nullable()
|
|
1291
|
+
});
|
|
1292
|
+
var threadEventFileChangeKindSchema = z15.enum(["add", "delete", "update"]);
|
|
1293
|
+
var threadEventFileChangeSchema = z15.object({
|
|
1294
|
+
path: z15.string(),
|
|
1290
1295
|
kind: threadEventFileChangeKindSchema,
|
|
1291
|
-
movePath:
|
|
1292
|
-
diff:
|
|
1296
|
+
movePath: z15.string().optional(),
|
|
1297
|
+
diff: z15.string().optional()
|
|
1293
1298
|
});
|
|
1294
|
-
var threadEventPlanStepStatusSchema =
|
|
1299
|
+
var threadEventPlanStepStatusSchema = z15.enum([
|
|
1295
1300
|
"pending",
|
|
1296
1301
|
"active",
|
|
1297
1302
|
"completed",
|
|
1298
1303
|
"failed"
|
|
1299
1304
|
]);
|
|
1300
|
-
var threadEventPlanStepSchema =
|
|
1301
|
-
step:
|
|
1305
|
+
var threadEventPlanStepSchema = z15.object({
|
|
1306
|
+
step: z15.string(),
|
|
1302
1307
|
status: threadEventPlanStepStatusSchema.optional()
|
|
1303
1308
|
});
|
|
1304
1309
|
var itemPresentationField = {
|
|
1305
1310
|
presentation: threadEventItemPresentationSchema.optional()
|
|
1306
1311
|
};
|
|
1307
|
-
var threadEventWebSearchItemSchema =
|
|
1308
|
-
type:
|
|
1309
|
-
id:
|
|
1310
|
-
queries:
|
|
1311
|
-
resultText:
|
|
1312
|
+
var threadEventWebSearchItemSchema = z15.object({
|
|
1313
|
+
type: z15.literal("webSearch"),
|
|
1314
|
+
id: z15.string(),
|
|
1315
|
+
queries: z15.array(z15.string()).min(1),
|
|
1316
|
+
resultText: z15.string().nullable(),
|
|
1312
1317
|
...itemPresentationField,
|
|
1313
|
-
parentToolCallId:
|
|
1314
|
-
});
|
|
1315
|
-
var threadEventWebFetchItemSchema =
|
|
1316
|
-
type:
|
|
1317
|
-
id:
|
|
1318
|
-
url:
|
|
1319
|
-
prompt:
|
|
1320
|
-
pattern:
|
|
1321
|
-
resultText:
|
|
1318
|
+
parentToolCallId: z15.string().optional()
|
|
1319
|
+
});
|
|
1320
|
+
var threadEventWebFetchItemSchema = z15.object({
|
|
1321
|
+
type: z15.literal("webFetch"),
|
|
1322
|
+
id: z15.string(),
|
|
1323
|
+
url: z15.string(),
|
|
1324
|
+
prompt: z15.string().nullable(),
|
|
1325
|
+
pattern: z15.string().nullable(),
|
|
1326
|
+
resultText: z15.string().nullable(),
|
|
1322
1327
|
...itemPresentationField,
|
|
1323
|
-
parentToolCallId:
|
|
1328
|
+
parentToolCallId: z15.string().optional()
|
|
1324
1329
|
});
|
|
1325
|
-
var threadEventImageViewItemSchema =
|
|
1326
|
-
type:
|
|
1327
|
-
id:
|
|
1328
|
-
path:
|
|
1330
|
+
var threadEventImageViewItemSchema = z15.object({
|
|
1331
|
+
type: z15.literal("imageView"),
|
|
1332
|
+
id: z15.string(),
|
|
1333
|
+
path: z15.string(),
|
|
1329
1334
|
...itemPresentationField,
|
|
1330
|
-
parentToolCallId:
|
|
1335
|
+
parentToolCallId: z15.string().optional()
|
|
1331
1336
|
});
|
|
1332
|
-
var threadEventFileReadItemSchema =
|
|
1333
|
-
type:
|
|
1334
|
-
id:
|
|
1335
|
-
path:
|
|
1336
|
-
cmd:
|
|
1337
|
+
var threadEventFileReadItemSchema = z15.object({
|
|
1338
|
+
type: z15.literal("fileRead"),
|
|
1339
|
+
id: z15.string(),
|
|
1340
|
+
path: z15.string(),
|
|
1341
|
+
cmd: z15.string().optional(),
|
|
1337
1342
|
status: threadEventItemStatusSchema,
|
|
1338
1343
|
...itemPresentationField,
|
|
1339
|
-
parentToolCallId:
|
|
1344
|
+
parentToolCallId: z15.string().optional()
|
|
1340
1345
|
});
|
|
1341
|
-
var threadEventSearchModeSchema =
|
|
1342
|
-
var threadEventSearchItemSchema =
|
|
1343
|
-
type:
|
|
1344
|
-
id:
|
|
1346
|
+
var threadEventSearchModeSchema = z15.enum(["content", "path", "list"]);
|
|
1347
|
+
var threadEventSearchItemSchema = z15.object({
|
|
1348
|
+
type: z15.literal("search"),
|
|
1349
|
+
id: z15.string(),
|
|
1345
1350
|
mode: threadEventSearchModeSchema,
|
|
1346
|
-
query:
|
|
1347
|
-
path:
|
|
1348
|
-
cmd:
|
|
1351
|
+
query: z15.string(),
|
|
1352
|
+
path: z15.string().optional(),
|
|
1353
|
+
cmd: z15.string().optional(),
|
|
1349
1354
|
status: threadEventItemStatusSchema,
|
|
1350
1355
|
...itemPresentationField,
|
|
1351
|
-
parentToolCallId:
|
|
1356
|
+
parentToolCallId: z15.string().optional()
|
|
1352
1357
|
});
|
|
1353
|
-
var threadEventDelegationItemSchema =
|
|
1354
|
-
type:
|
|
1355
|
-
id:
|
|
1356
|
-
childRef:
|
|
1357
|
-
label:
|
|
1358
|
+
var threadEventDelegationItemSchema = z15.object({
|
|
1359
|
+
type: z15.literal("delegation"),
|
|
1360
|
+
id: z15.string(),
|
|
1361
|
+
childRef: z15.string().min(1),
|
|
1362
|
+
label: z15.string(),
|
|
1358
1363
|
status: threadEventItemStatusSchema,
|
|
1359
|
-
background:
|
|
1360
|
-
summary:
|
|
1364
|
+
background: z15.boolean(),
|
|
1365
|
+
summary: z15.string().optional(),
|
|
1361
1366
|
...itemPresentationField,
|
|
1362
|
-
parentToolCallId:
|
|
1367
|
+
parentToolCallId: z15.string().optional()
|
|
1363
1368
|
});
|
|
1364
|
-
var threadEventPlanStepsItemSchema =
|
|
1365
|
-
type:
|
|
1366
|
-
id:
|
|
1367
|
-
steps:
|
|
1368
|
-
explanation:
|
|
1369
|
+
var threadEventPlanStepsItemSchema = z15.object({
|
|
1370
|
+
type: z15.literal("planSteps"),
|
|
1371
|
+
id: z15.string(),
|
|
1372
|
+
steps: z15.array(threadEventPlanStepSchema),
|
|
1373
|
+
explanation: z15.string().optional(),
|
|
1369
1374
|
status: threadEventItemStatusSchema,
|
|
1370
1375
|
...itemPresentationField,
|
|
1371
|
-
parentToolCallId:
|
|
1376
|
+
parentToolCallId: z15.string().optional()
|
|
1372
1377
|
});
|
|
1373
|
-
var threadEventExtensionItemSchema =
|
|
1374
|
-
type:
|
|
1375
|
-
id:
|
|
1378
|
+
var threadEventExtensionItemSchema = z15.object({
|
|
1379
|
+
type: z15.literal("extension"),
|
|
1380
|
+
id: z15.string(),
|
|
1376
1381
|
kind: extensionKindSchema,
|
|
1377
1382
|
payload: jsonValueSchema,
|
|
1378
1383
|
status: threadEventItemStatusSchema,
|
|
1379
1384
|
presentation: threadEventItemPresentationSchema,
|
|
1380
|
-
parentToolCallId:
|
|
1385
|
+
parentToolCallId: z15.string().optional()
|
|
1381
1386
|
});
|
|
1382
|
-
var threadEventTextTruncationSchema =
|
|
1383
|
-
originalLength:
|
|
1384
|
-
retainedHeadLength:
|
|
1385
|
-
retainedTailLength:
|
|
1386
|
-
truncatedAt:
|
|
1387
|
+
var threadEventTextTruncationSchema = z15.object({
|
|
1388
|
+
originalLength: z15.number(),
|
|
1389
|
+
retainedHeadLength: z15.number(),
|
|
1390
|
+
retainedTailLength: z15.number(),
|
|
1391
|
+
truncatedAt: z15.number()
|
|
1387
1392
|
});
|
|
1388
|
-
var threadEventItemTruncationSchema =
|
|
1393
|
+
var threadEventItemTruncationSchema = z15.object({
|
|
1389
1394
|
aggregatedOutput: threadEventTextTruncationSchema.optional(),
|
|
1390
1395
|
result: threadEventTextTruncationSchema.optional(),
|
|
1391
1396
|
resultText: threadEventTextTruncationSchema.optional()
|
|
1392
1397
|
});
|
|
1393
|
-
var threadEventImageGenerationItemSchema =
|
|
1394
|
-
type:
|
|
1395
|
-
id:
|
|
1398
|
+
var threadEventImageGenerationItemSchema = z15.object({
|
|
1399
|
+
type: z15.literal("imageGeneration"),
|
|
1400
|
+
id: z15.string(),
|
|
1396
1401
|
status: threadEventItemStatusSchema,
|
|
1397
|
-
prompt:
|
|
1398
|
-
path:
|
|
1399
|
-
result:
|
|
1400
|
-
error:
|
|
1401
|
-
transparentBackground:
|
|
1402
|
+
prompt: z15.string().nullable(),
|
|
1403
|
+
path: z15.string().nullable(),
|
|
1404
|
+
result: z15.string().optional(),
|
|
1405
|
+
error: z15.string().nullable(),
|
|
1406
|
+
transparentBackground: z15.boolean(),
|
|
1402
1407
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1403
1408
|
...itemPresentationField,
|
|
1404
|
-
parentToolCallId:
|
|
1409
|
+
parentToolCallId: z15.string().optional()
|
|
1405
1410
|
});
|
|
1406
|
-
var threadEventUserContentSchema =
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
+
var threadEventUserContentSchema = z15.discriminatedUnion("type", [
|
|
1412
|
+
z15.object({ type: z15.literal("text"), text: z15.string() }),
|
|
1413
|
+
z15.object({ type: z15.literal("image"), url: z15.string() }),
|
|
1414
|
+
z15.object({ type: z15.literal("localImage"), path: z15.string() }),
|
|
1415
|
+
z15.object({ type: z15.literal("localFile"), path: z15.string() })
|
|
1411
1416
|
]);
|
|
1412
|
-
var threadEventTokenUsageBreakdownSchema =
|
|
1413
|
-
totalTokens:
|
|
1414
|
-
inputTokens:
|
|
1415
|
-
cachedInputTokens:
|
|
1416
|
-
cacheReadInputTokens:
|
|
1417
|
-
cacheWriteInputTokens:
|
|
1418
|
-
outputTokens:
|
|
1419
|
-
reasoningOutputTokens:
|
|
1420
|
-
});
|
|
1421
|
-
var
|
|
1422
|
-
amount: z14.number().nonnegative(),
|
|
1423
|
-
currency: z14.string().min(1)
|
|
1424
|
-
});
|
|
1425
|
-
var threadEventContextWindowUsageSchema = z14.object({
|
|
1417
|
+
var threadEventTokenUsageBreakdownSchema = z15.object({
|
|
1418
|
+
totalTokens: z15.number(),
|
|
1419
|
+
inputTokens: z15.number(),
|
|
1420
|
+
cachedInputTokens: z15.number(),
|
|
1421
|
+
cacheReadInputTokens: z15.number().nonnegative().optional(),
|
|
1422
|
+
cacheWriteInputTokens: z15.number().nonnegative().optional(),
|
|
1423
|
+
outputTokens: z15.number(),
|
|
1424
|
+
reasoningOutputTokens: z15.number()
|
|
1425
|
+
});
|
|
1426
|
+
var threadEventContextWindowUsageSchema = z15.object({
|
|
1426
1427
|
snapshot: contextSnapshotSchema.optional(),
|
|
1427
|
-
usedTokens:
|
|
1428
|
-
modelContextWindow:
|
|
1429
|
-
estimated:
|
|
1428
|
+
usedTokens: z15.number().nullable(),
|
|
1429
|
+
modelContextWindow: z15.number().nullable(),
|
|
1430
|
+
estimated: z15.boolean(),
|
|
1430
1431
|
cost: threadUsageCostSchema.optional()
|
|
1431
1432
|
});
|
|
1432
|
-
var promptCacheTtlMsSchema =
|
|
1433
|
-
var threadEventTokenUsageSchema =
|
|
1433
|
+
var promptCacheTtlMsSchema = z15.number().int().positive();
|
|
1434
|
+
var threadEventTokenUsageSchema = z15.object({
|
|
1434
1435
|
total: threadEventTokenUsageBreakdownSchema,
|
|
1435
1436
|
last: threadEventTokenUsageBreakdownSchema,
|
|
1436
|
-
modelContextWindow:
|
|
1437
|
+
modelContextWindow: z15.number().nullable(),
|
|
1437
1438
|
promptCacheTtlMs: promptCacheTtlMsSchema.optional()
|
|
1438
1439
|
});
|
|
1439
|
-
var threadEventWarningCategorySchema =
|
|
1440
|
+
var threadEventWarningCategorySchema = z15.enum([
|
|
1440
1441
|
"deprecation",
|
|
1441
1442
|
"config",
|
|
1442
1443
|
"general",
|
|
1443
1444
|
"compaction-skipped"
|
|
1444
1445
|
]);
|
|
1445
|
-
var providerRawEventSchema =
|
|
1446
|
-
jsonrpc:
|
|
1447
|
-
id:
|
|
1448
|
-
method:
|
|
1446
|
+
var providerRawEventSchema = z15.object({
|
|
1447
|
+
jsonrpc: z15.literal("2.0"),
|
|
1448
|
+
id: z15.union([z15.string(), z15.number()]).optional(),
|
|
1449
|
+
method: z15.string(),
|
|
1449
1450
|
params: jsonValueSchema.optional()
|
|
1450
1451
|
});
|
|
1451
|
-
var providerUnhandledEventSchema =
|
|
1452
|
-
type:
|
|
1453
|
-
threadId:
|
|
1454
|
-
providerThreadId:
|
|
1455
|
-
providerId:
|
|
1456
|
-
rawType:
|
|
1452
|
+
var providerUnhandledEventSchema = z15.object({
|
|
1453
|
+
type: z15.literal("provider/unhandled"),
|
|
1454
|
+
threadId: z15.string(),
|
|
1455
|
+
providerThreadId: z15.string(),
|
|
1456
|
+
providerId: z15.string(),
|
|
1457
|
+
rawType: z15.string(),
|
|
1457
1458
|
rawEvent: providerRawEventSchema,
|
|
1458
|
-
parentToolCallId:
|
|
1459
|
-
});
|
|
1460
|
-
var toolCallProgressEventSchema =
|
|
1461
|
-
type:
|
|
1462
|
-
threadId:
|
|
1463
|
-
providerThreadId:
|
|
1464
|
-
itemId:
|
|
1465
|
-
message:
|
|
1466
|
-
parentToolCallId:
|
|
1467
|
-
});
|
|
1468
|
-
var threadEventBackgroundTaskItemSchema =
|
|
1469
|
-
type:
|
|
1470
|
-
id:
|
|
1471
|
-
familyId:
|
|
1472
|
-
taskType:
|
|
1473
|
-
description:
|
|
1459
|
+
parentToolCallId: z15.string().optional()
|
|
1460
|
+
});
|
|
1461
|
+
var toolCallProgressEventSchema = z15.object({
|
|
1462
|
+
type: z15.literal("item/toolCall/progress"),
|
|
1463
|
+
threadId: z15.string(),
|
|
1464
|
+
providerThreadId: z15.string(),
|
|
1465
|
+
itemId: z15.string(),
|
|
1466
|
+
message: z15.string().optional(),
|
|
1467
|
+
parentToolCallId: z15.string().optional()
|
|
1468
|
+
});
|
|
1469
|
+
var threadEventBackgroundTaskItemSchema = z15.object({
|
|
1470
|
+
type: z15.literal("backgroundTask"),
|
|
1471
|
+
id: z15.string(),
|
|
1472
|
+
familyId: z15.string().optional(),
|
|
1473
|
+
taskType: z15.string(),
|
|
1474
|
+
description: z15.string(),
|
|
1474
1475
|
status: threadEventItemStatusSchema,
|
|
1475
1476
|
taskStatus: backgroundTaskStatusSchema,
|
|
1476
|
-
skipTranscript:
|
|
1477
|
-
foreground:
|
|
1478
|
-
workflowName:
|
|
1477
|
+
skipTranscript: z15.boolean(),
|
|
1478
|
+
foreground: z15.boolean(),
|
|
1479
|
+
workflowName: z15.string().optional(),
|
|
1479
1480
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
1480
1481
|
usage: backgroundTaskUsageSchema.optional(),
|
|
1481
|
-
summary:
|
|
1482
|
-
error:
|
|
1483
|
-
outputFile:
|
|
1482
|
+
summary: z15.string().optional(),
|
|
1483
|
+
error: z15.string().optional(),
|
|
1484
|
+
outputFile: z15.string().optional(),
|
|
1484
1485
|
...itemPresentationField,
|
|
1485
|
-
parentToolCallId:
|
|
1486
|
+
parentToolCallId: z15.string().optional()
|
|
1486
1487
|
});
|
|
1487
|
-
var threadEventItemSchema =
|
|
1488
|
-
|
|
1489
|
-
type:
|
|
1490
|
-
id:
|
|
1491
|
-
content:
|
|
1488
|
+
var threadEventItemSchema = z15.discriminatedUnion("type", [
|
|
1489
|
+
z15.object({
|
|
1490
|
+
type: z15.literal("userMessage"),
|
|
1491
|
+
id: z15.string(),
|
|
1492
|
+
content: z15.array(threadEventUserContentSchema),
|
|
1492
1493
|
clientRequestId: clientTurnRequestIdSchema.optional(),
|
|
1493
|
-
parentToolCallId:
|
|
1494
|
+
parentToolCallId: z15.string().optional()
|
|
1494
1495
|
}).strict(),
|
|
1495
|
-
|
|
1496
|
-
type:
|
|
1497
|
-
id:
|
|
1498
|
-
text:
|
|
1496
|
+
z15.object({
|
|
1497
|
+
type: z15.literal("agentMessage"),
|
|
1498
|
+
id: z15.string(),
|
|
1499
|
+
text: z15.string(),
|
|
1499
1500
|
...itemPresentationField,
|
|
1500
|
-
parentToolCallId:
|
|
1501
|
+
parentToolCallId: z15.string().optional()
|
|
1501
1502
|
}),
|
|
1502
|
-
|
|
1503
|
-
type:
|
|
1504
|
-
id:
|
|
1505
|
-
command:
|
|
1506
|
-
cwd:
|
|
1503
|
+
z15.object({
|
|
1504
|
+
type: z15.literal("commandExecution"),
|
|
1505
|
+
id: z15.string(),
|
|
1506
|
+
command: z15.string(),
|
|
1507
|
+
cwd: z15.string(),
|
|
1507
1508
|
status: threadEventItemStatusSchema,
|
|
1508
1509
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1509
|
-
aggregatedOutput:
|
|
1510
|
-
exitCode:
|
|
1511
|
-
durationMs:
|
|
1510
|
+
aggregatedOutput: z15.string().optional(),
|
|
1511
|
+
exitCode: z15.number().optional(),
|
|
1512
|
+
durationMs: z15.number().optional(),
|
|
1512
1513
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1513
1514
|
...itemPresentationField,
|
|
1514
|
-
parentToolCallId:
|
|
1515
|
+
parentToolCallId: z15.string().optional()
|
|
1515
1516
|
}),
|
|
1516
|
-
|
|
1517
|
-
type:
|
|
1518
|
-
id:
|
|
1519
|
-
changes:
|
|
1517
|
+
z15.object({
|
|
1518
|
+
type: z15.literal("fileChange"),
|
|
1519
|
+
id: z15.string(),
|
|
1520
|
+
changes: z15.array(threadEventFileChangeSchema),
|
|
1520
1521
|
status: threadEventItemStatusSchema,
|
|
1521
1522
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1522
|
-
error:
|
|
1523
|
+
error: z15.string().optional(),
|
|
1523
1524
|
...itemPresentationField,
|
|
1524
|
-
parentToolCallId:
|
|
1525
|
+
parentToolCallId: z15.string().optional()
|
|
1525
1526
|
}),
|
|
1526
1527
|
threadEventWebSearchItemSchema,
|
|
1527
1528
|
threadEventWebFetchItemSchema,
|
|
@@ -1529,348 +1530,345 @@ var threadEventItemSchema = z14.discriminatedUnion("type", [
|
|
|
1529
1530
|
threadEventImageGenerationItemSchema,
|
|
1530
1531
|
threadEventFileReadItemSchema,
|
|
1531
1532
|
threadEventSearchItemSchema,
|
|
1532
|
-
|
|
1533
|
-
type:
|
|
1534
|
-
id:
|
|
1535
|
-
server:
|
|
1536
|
-
tool:
|
|
1537
|
-
arguments:
|
|
1533
|
+
z15.object({
|
|
1534
|
+
type: z15.literal("toolCall"),
|
|
1535
|
+
id: z15.string(),
|
|
1536
|
+
server: z15.string().optional(),
|
|
1537
|
+
tool: z15.string(),
|
|
1538
|
+
arguments: z15.record(z15.string(), z15.unknown()).optional(),
|
|
1538
1539
|
status: threadEventItemStatusSchema,
|
|
1539
|
-
result:
|
|
1540
|
-
error:
|
|
1541
|
-
durationMs:
|
|
1540
|
+
result: z15.unknown().optional(),
|
|
1541
|
+
error: z15.string().optional(),
|
|
1542
|
+
durationMs: z15.number().optional(),
|
|
1542
1543
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1543
1544
|
...itemPresentationField,
|
|
1544
|
-
parentToolCallId:
|
|
1545
|
+
parentToolCallId: z15.string().optional()
|
|
1545
1546
|
}),
|
|
1546
|
-
|
|
1547
|
-
type:
|
|
1548
|
-
id:
|
|
1549
|
-
summary:
|
|
1550
|
-
content:
|
|
1547
|
+
z15.object({
|
|
1548
|
+
type: z15.literal("reasoning"),
|
|
1549
|
+
id: z15.string(),
|
|
1550
|
+
summary: z15.array(z15.string()),
|
|
1551
|
+
content: z15.array(z15.string()),
|
|
1551
1552
|
...itemPresentationField,
|
|
1552
|
-
parentToolCallId:
|
|
1553
|
+
parentToolCallId: z15.string().optional()
|
|
1553
1554
|
}),
|
|
1554
|
-
|
|
1555
|
-
type:
|
|
1556
|
-
id:
|
|
1557
|
-
text:
|
|
1555
|
+
z15.object({
|
|
1556
|
+
type: z15.literal("plan"),
|
|
1557
|
+
id: z15.string(),
|
|
1558
|
+
text: z15.string(),
|
|
1558
1559
|
...itemPresentationField,
|
|
1559
|
-
parentToolCallId:
|
|
1560
|
+
parentToolCallId: z15.string().optional()
|
|
1560
1561
|
}),
|
|
1561
1562
|
threadEventPlanStepsItemSchema,
|
|
1562
|
-
|
|
1563
|
-
type:
|
|
1564
|
-
id:
|
|
1563
|
+
z15.object({
|
|
1564
|
+
type: z15.literal("contextCompaction"),
|
|
1565
|
+
id: z15.string(),
|
|
1565
1566
|
...itemPresentationField,
|
|
1566
|
-
parentToolCallId:
|
|
1567
|
+
parentToolCallId: z15.string().optional()
|
|
1567
1568
|
}),
|
|
1568
1569
|
threadEventBackgroundTaskItemSchema,
|
|
1569
1570
|
threadEventDelegationItemSchema,
|
|
1570
1571
|
threadEventExtensionItemSchema
|
|
1571
1572
|
]);
|
|
1572
1573
|
function itemTextDeltaEventSchema(type) {
|
|
1573
|
-
return
|
|
1574
|
-
type:
|
|
1575
|
-
threadId:
|
|
1576
|
-
providerThreadId:
|
|
1577
|
-
itemId:
|
|
1578
|
-
delta:
|
|
1579
|
-
parentToolCallId:
|
|
1574
|
+
return z15.object({
|
|
1575
|
+
type: z15.literal(type),
|
|
1576
|
+
threadId: z15.string(),
|
|
1577
|
+
providerThreadId: z15.string(),
|
|
1578
|
+
itemId: z15.string(),
|
|
1579
|
+
delta: z15.string(),
|
|
1580
|
+
parentToolCallId: z15.string().optional()
|
|
1580
1581
|
});
|
|
1581
1582
|
}
|
|
1582
|
-
var unscopedProviderEventSchema =
|
|
1583
|
-
|
|
1584
|
-
type:
|
|
1585
|
-
threadId:
|
|
1583
|
+
var unscopedProviderEventSchema = z15.discriminatedUnion("type", [
|
|
1584
|
+
z15.object({
|
|
1585
|
+
type: z15.literal("thread/started"),
|
|
1586
|
+
threadId: z15.string()
|
|
1586
1587
|
}),
|
|
1587
|
-
|
|
1588
|
-
type:
|
|
1589
|
-
threadId:
|
|
1590
|
-
providerThreadId:
|
|
1588
|
+
z15.object({
|
|
1589
|
+
type: z15.literal("thread/identity"),
|
|
1590
|
+
threadId: z15.string(),
|
|
1591
|
+
providerThreadId: z15.string()
|
|
1591
1592
|
}),
|
|
1592
|
-
|
|
1593
|
-
type:
|
|
1594
|
-
threadId:
|
|
1595
|
-
providerThreadId:
|
|
1596
|
-
parentToolCallId:
|
|
1593
|
+
z15.object({
|
|
1594
|
+
type: z15.literal("turn/started"),
|
|
1595
|
+
threadId: z15.string(),
|
|
1596
|
+
providerThreadId: z15.string(),
|
|
1597
|
+
parentToolCallId: z15.string().optional()
|
|
1597
1598
|
}),
|
|
1598
|
-
|
|
1599
|
-
type:
|
|
1600
|
-
threadId:
|
|
1601
|
-
providerThreadId:
|
|
1599
|
+
z15.object({
|
|
1600
|
+
type: z15.literal("turn/completed"),
|
|
1601
|
+
threadId: z15.string(),
|
|
1602
|
+
providerThreadId: z15.string().nullable(),
|
|
1602
1603
|
status: threadEventTurnStatusSchema,
|
|
1603
|
-
error:
|
|
1604
|
-
providerCheckpointId:
|
|
1604
|
+
error: z15.object({ message: z15.string() }).optional(),
|
|
1605
|
+
providerCheckpointId: z15.string().min(1).optional()
|
|
1605
1606
|
}),
|
|
1606
|
-
|
|
1607
|
-
type:
|
|
1608
|
-
threadId:
|
|
1609
|
-
providerThreadId:
|
|
1607
|
+
z15.object({
|
|
1608
|
+
type: z15.literal("turn/input/accepted"),
|
|
1609
|
+
threadId: z15.string(),
|
|
1610
|
+
providerThreadId: z15.string(),
|
|
1610
1611
|
clientRequestId: clientTurnRequestIdSchema,
|
|
1611
1612
|
scope: threadEventScopeSchema
|
|
1612
1613
|
}).strict(),
|
|
1613
|
-
|
|
1614
|
-
type:
|
|
1615
|
-
threadId:
|
|
1616
|
-
providerThreadId:
|
|
1617
|
-
threadName:
|
|
1618
|
-
source:
|
|
1614
|
+
z15.object({
|
|
1615
|
+
type: z15.literal("thread/name/updated"),
|
|
1616
|
+
threadId: z15.string(),
|
|
1617
|
+
providerThreadId: z15.string(),
|
|
1618
|
+
threadName: z15.string(),
|
|
1619
|
+
source: z15.literal("agent").optional()
|
|
1619
1620
|
}),
|
|
1620
|
-
|
|
1621
|
-
type:
|
|
1622
|
-
threadId:
|
|
1623
|
-
providerThreadId:
|
|
1621
|
+
z15.object({
|
|
1622
|
+
type: z15.literal("thread/compacted"),
|
|
1623
|
+
threadId: z15.string(),
|
|
1624
|
+
providerThreadId: z15.string()
|
|
1624
1625
|
}),
|
|
1625
|
-
|
|
1626
|
-
type:
|
|
1627
|
-
threadId:
|
|
1628
|
-
providerThreadId:
|
|
1626
|
+
z15.object({
|
|
1627
|
+
type: z15.literal("thread/context/cleared"),
|
|
1628
|
+
threadId: z15.string(),
|
|
1629
|
+
providerThreadId: z15.string()
|
|
1629
1630
|
}),
|
|
1630
|
-
|
|
1631
|
-
type:
|
|
1632
|
-
threadId:
|
|
1633
|
-
providerThreadId:
|
|
1634
|
-
objective:
|
|
1631
|
+
z15.object({
|
|
1632
|
+
type: z15.literal("thread/goal/updated"),
|
|
1633
|
+
threadId: z15.string(),
|
|
1634
|
+
providerThreadId: z15.string(),
|
|
1635
|
+
objective: z15.string(),
|
|
1635
1636
|
status: threadTimelineGoalStatusSchema,
|
|
1636
|
-
tokenBudget:
|
|
1637
|
-
tokensUsed:
|
|
1638
|
-
timeUsedSeconds:
|
|
1637
|
+
tokenBudget: z15.number().nullable(),
|
|
1638
|
+
tokensUsed: z15.number(),
|
|
1639
|
+
timeUsedSeconds: z15.number()
|
|
1639
1640
|
}),
|
|
1640
|
-
|
|
1641
|
-
type:
|
|
1642
|
-
threadId:
|
|
1643
|
-
providerThreadId:
|
|
1641
|
+
z15.object({
|
|
1642
|
+
type: z15.literal("thread/goal/cleared"),
|
|
1643
|
+
threadId: z15.string(),
|
|
1644
|
+
providerThreadId: z15.string()
|
|
1644
1645
|
}),
|
|
1645
|
-
|
|
1646
|
-
type:
|
|
1647
|
-
threadId:
|
|
1648
|
-
providerThreadId:
|
|
1646
|
+
z15.object({
|
|
1647
|
+
type: z15.literal("item/started"),
|
|
1648
|
+
threadId: z15.string(),
|
|
1649
|
+
providerThreadId: z15.string(),
|
|
1649
1650
|
item: threadEventItemSchema
|
|
1650
1651
|
}),
|
|
1651
|
-
|
|
1652
|
-
type:
|
|
1653
|
-
threadId:
|
|
1654
|
-
providerThreadId:
|
|
1652
|
+
z15.object({
|
|
1653
|
+
type: z15.literal("item/completed"),
|
|
1654
|
+
threadId: z15.string(),
|
|
1655
|
+
providerThreadId: z15.string(),
|
|
1655
1656
|
item: threadEventItemSchema
|
|
1656
1657
|
}),
|
|
1657
1658
|
itemTextDeltaEventSchema("item/agentMessage/delta"),
|
|
1658
|
-
|
|
1659
|
-
type:
|
|
1660
|
-
threadId:
|
|
1661
|
-
providerThreadId:
|
|
1662
|
-
itemId:
|
|
1663
|
-
delta:
|
|
1664
|
-
reset:
|
|
1665
|
-
parentToolCallId:
|
|
1659
|
+
z15.object({
|
|
1660
|
+
type: z15.literal("item/commandExecution/outputDelta"),
|
|
1661
|
+
threadId: z15.string(),
|
|
1662
|
+
providerThreadId: z15.string(),
|
|
1663
|
+
itemId: z15.string(),
|
|
1664
|
+
delta: z15.string(),
|
|
1665
|
+
reset: z15.boolean().optional(),
|
|
1666
|
+
parentToolCallId: z15.string().optional()
|
|
1666
1667
|
}),
|
|
1667
1668
|
itemTextDeltaEventSchema("item/fileChange/outputDelta"),
|
|
1668
1669
|
itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
|
|
1669
1670
|
itemTextDeltaEventSchema("item/reasoning/textDelta"),
|
|
1670
1671
|
itemTextDeltaEventSchema("item/plan/delta"),
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
threadId:
|
|
1674
|
-
providerThreadId:
|
|
1675
|
-
itemId:
|
|
1676
|
-
message:
|
|
1677
|
-
parentToolCallId:
|
|
1672
|
+
z15.object({
|
|
1673
|
+
type: z15.literal("item/mcpToolCall/progress"),
|
|
1674
|
+
threadId: z15.string(),
|
|
1675
|
+
providerThreadId: z15.string(),
|
|
1676
|
+
itemId: z15.string(),
|
|
1677
|
+
message: z15.string().optional(),
|
|
1678
|
+
parentToolCallId: z15.string().optional()
|
|
1678
1679
|
}),
|
|
1679
1680
|
toolCallProgressEventSchema,
|
|
1680
|
-
|
|
1681
|
-
type:
|
|
1682
|
-
threadId:
|
|
1683
|
-
providerThreadId:
|
|
1681
|
+
z15.object({
|
|
1682
|
+
type: z15.literal("item/backgroundTask/progress"),
|
|
1683
|
+
threadId: z15.string(),
|
|
1684
|
+
providerThreadId: z15.string(),
|
|
1684
1685
|
item: threadEventBackgroundTaskItemSchema
|
|
1685
1686
|
}),
|
|
1686
|
-
|
|
1687
|
-
type:
|
|
1688
|
-
threadId:
|
|
1689
|
-
providerThreadId:
|
|
1687
|
+
z15.object({
|
|
1688
|
+
type: z15.literal("item/backgroundTask/completed"),
|
|
1689
|
+
threadId: z15.string(),
|
|
1690
|
+
providerThreadId: z15.string(),
|
|
1690
1691
|
item: threadEventBackgroundTaskItemSchema
|
|
1691
1692
|
}),
|
|
1692
|
-
|
|
1693
|
-
type:
|
|
1694
|
-
threadId:
|
|
1695
|
-
providerThreadId:
|
|
1693
|
+
z15.object({
|
|
1694
|
+
type: z15.literal("item/delegation/progress"),
|
|
1695
|
+
threadId: z15.string(),
|
|
1696
|
+
providerThreadId: z15.string(),
|
|
1696
1697
|
item: threadEventDelegationItemSchema
|
|
1697
1698
|
}),
|
|
1698
|
-
|
|
1699
|
-
type:
|
|
1700
|
-
threadId:
|
|
1701
|
-
providerThreadId:
|
|
1699
|
+
z15.object({
|
|
1700
|
+
type: z15.literal("item/delegation/completed"),
|
|
1701
|
+
threadId: z15.string(),
|
|
1702
|
+
providerThreadId: z15.string(),
|
|
1702
1703
|
item: threadEventDelegationItemSchema
|
|
1703
1704
|
}),
|
|
1704
|
-
|
|
1705
|
-
type:
|
|
1706
|
-
threadId:
|
|
1707
|
-
providerThreadId:
|
|
1705
|
+
z15.object({
|
|
1706
|
+
type: z15.literal("thread/tokenUsage/updated"),
|
|
1707
|
+
threadId: z15.string(),
|
|
1708
|
+
providerThreadId: z15.string(),
|
|
1708
1709
|
tokenUsage: threadEventTokenUsageSchema
|
|
1709
1710
|
}),
|
|
1710
|
-
|
|
1711
|
-
type:
|
|
1712
|
-
threadId:
|
|
1713
|
-
providerThreadId:
|
|
1711
|
+
z15.object({
|
|
1712
|
+
type: z15.literal("thread/contextWindowUsage/updated"),
|
|
1713
|
+
threadId: z15.string(),
|
|
1714
|
+
providerThreadId: z15.string(),
|
|
1714
1715
|
contextWindowUsage: threadEventContextWindowUsageSchema
|
|
1715
1716
|
}),
|
|
1716
|
-
|
|
1717
|
-
type:
|
|
1718
|
-
threadId:
|
|
1719
|
-
providerThreadId:
|
|
1720
|
-
plan:
|
|
1721
|
-
explanation:
|
|
1717
|
+
z15.object({
|
|
1718
|
+
type: z15.literal("turn/plan/updated"),
|
|
1719
|
+
threadId: z15.string(),
|
|
1720
|
+
providerThreadId: z15.string(),
|
|
1721
|
+
plan: z15.array(threadEventPlanStepSchema),
|
|
1722
|
+
explanation: z15.string().optional()
|
|
1722
1723
|
}),
|
|
1723
|
-
|
|
1724
|
-
type:
|
|
1725
|
-
threadId:
|
|
1726
|
-
providerThreadId:
|
|
1727
|
-
state:
|
|
1724
|
+
z15.object({
|
|
1725
|
+
type: z15.literal("turn/mainRun/updated"),
|
|
1726
|
+
threadId: z15.string(),
|
|
1727
|
+
providerThreadId: z15.string(),
|
|
1728
|
+
state: z15.enum(["idle", "running"])
|
|
1728
1729
|
}),
|
|
1729
|
-
|
|
1730
|
-
type:
|
|
1731
|
-
threadId:
|
|
1732
|
-
providerThreadId:
|
|
1733
|
-
diff:
|
|
1730
|
+
z15.object({
|
|
1731
|
+
type: z15.literal("turn/diff/updated"),
|
|
1732
|
+
threadId: z15.string(),
|
|
1733
|
+
providerThreadId: z15.string(),
|
|
1734
|
+
diff: z15.string().optional()
|
|
1734
1735
|
}),
|
|
1735
|
-
|
|
1736
|
-
type:
|
|
1737
|
-
threadId:
|
|
1738
|
-
providerThreadId:
|
|
1739
|
-
message:
|
|
1740
|
-
detail:
|
|
1741
|
-
willRetry:
|
|
1736
|
+
z15.object({
|
|
1737
|
+
type: z15.literal("provider/error"),
|
|
1738
|
+
threadId: z15.string(),
|
|
1739
|
+
providerThreadId: z15.string(),
|
|
1740
|
+
message: z15.string(),
|
|
1741
|
+
detail: z15.string().optional(),
|
|
1742
|
+
willRetry: z15.boolean().optional(),
|
|
1742
1743
|
errorInfo: providerErrorInfoSchema.optional()
|
|
1743
1744
|
}),
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1746
|
-
threadId:
|
|
1747
|
-
providerThreadId:
|
|
1745
|
+
z15.object({
|
|
1746
|
+
type: z15.literal("provider/rateLimits/updated"),
|
|
1747
|
+
threadId: z15.string(),
|
|
1748
|
+
providerThreadId: z15.string(),
|
|
1748
1749
|
rateLimits: providerRateLimitStateSchema
|
|
1749
1750
|
}),
|
|
1750
|
-
|
|
1751
|
-
type:
|
|
1752
|
-
threadId:
|
|
1753
|
-
providerThreadId:
|
|
1754
|
-
entries:
|
|
1755
|
-
|
|
1756
|
-
name:
|
|
1757
|
-
source:
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
core:
|
|
1751
|
+
z15.object({
|
|
1752
|
+
type: z15.literal("provider.env-resolved"),
|
|
1753
|
+
threadId: z15.string(),
|
|
1754
|
+
providerThreadId: z15.string(),
|
|
1755
|
+
entries: z15.array(
|
|
1756
|
+
z15.object({
|
|
1757
|
+
name: z15.string(),
|
|
1758
|
+
source: z15.union([
|
|
1759
|
+
z15.literal("shell"),
|
|
1760
|
+
z15.object({ plugin: z15.string() }).strict(),
|
|
1761
|
+
z15.object({
|
|
1762
|
+
core: z15.enum([
|
|
1762
1763
|
"machine-git",
|
|
1763
1764
|
"machine-environment",
|
|
1764
1765
|
"project-environment"
|
|
1765
1766
|
])
|
|
1766
1767
|
}).strict()
|
|
1767
1768
|
]),
|
|
1768
|
-
value:
|
|
1769
|
-
|
|
1770
|
-
|
|
1769
|
+
value: z15.union([
|
|
1770
|
+
z15.string(),
|
|
1771
|
+
z15.object({ masked: z15.literal(true) }).strict()
|
|
1771
1772
|
]),
|
|
1772
|
-
reason:
|
|
1773
|
+
reason: z15.string().optional()
|
|
1773
1774
|
}).strict()
|
|
1774
1775
|
)
|
|
1775
1776
|
}),
|
|
1776
|
-
|
|
1777
|
-
type:
|
|
1778
|
-
threadId:
|
|
1779
|
-
providerThreadId:
|
|
1777
|
+
z15.object({
|
|
1778
|
+
type: z15.literal("thread/extensionState/updated"),
|
|
1779
|
+
threadId: z15.string(),
|
|
1780
|
+
providerThreadId: z15.string(),
|
|
1780
1781
|
kind: extensionKindSchema,
|
|
1781
1782
|
payload: jsonValueSchema
|
|
1782
1783
|
}),
|
|
1783
|
-
|
|
1784
|
-
type:
|
|
1785
|
-
threadId:
|
|
1786
|
-
providerThreadId:
|
|
1784
|
+
z15.object({
|
|
1785
|
+
type: z15.literal("provider/warning"),
|
|
1786
|
+
threadId: z15.string(),
|
|
1787
|
+
providerThreadId: z15.string(),
|
|
1787
1788
|
category: threadEventWarningCategorySchema,
|
|
1788
|
-
summary:
|
|
1789
|
-
details:
|
|
1789
|
+
summary: z15.string().optional(),
|
|
1790
|
+
details: z15.string().optional()
|
|
1790
1791
|
}),
|
|
1791
|
-
|
|
1792
|
-
type:
|
|
1793
|
-
threadId:
|
|
1794
|
-
providerThreadId:
|
|
1795
|
-
originalModel:
|
|
1796
|
-
fallbackModel:
|
|
1797
|
-
reason:
|
|
1798
|
-
message:
|
|
1792
|
+
z15.object({
|
|
1793
|
+
type: z15.literal("provider/modelFallback"),
|
|
1794
|
+
threadId: z15.string(),
|
|
1795
|
+
providerThreadId: z15.string(),
|
|
1796
|
+
originalModel: z15.string().min(1),
|
|
1797
|
+
fallbackModel: z15.string().min(1),
|
|
1798
|
+
reason: z15.enum(["refusal", "provider"]),
|
|
1799
|
+
message: z15.string()
|
|
1799
1800
|
}),
|
|
1800
1801
|
providerUnhandledEventSchema
|
|
1801
1802
|
]);
|
|
1802
|
-
var scopedEventDataSchema =
|
|
1803
|
+
var scopedEventDataSchema = z15.object({
|
|
1803
1804
|
scope: threadEventScopeSchema
|
|
1804
1805
|
});
|
|
1805
1806
|
var providerEventSchema = unscopedProviderEventSchema.and(
|
|
1806
1807
|
scopedEventDataSchema
|
|
1807
1808
|
);
|
|
1808
|
-
var
|
|
1809
|
-
(
|
|
1810
|
-
)
|
|
1811
|
-
|
|
1812
|
-
z14.object({
|
|
1813
|
-
type: z14.literal("client/thread/start"),
|
|
1814
|
-
threadId: z14.string()
|
|
1809
|
+
var unscopedSystemEventSchema = z15.discriminatedUnion("type", [
|
|
1810
|
+
z15.object({
|
|
1811
|
+
type: z15.literal("client/thread/start"),
|
|
1812
|
+
threadId: z15.string()
|
|
1815
1813
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1816
|
-
|
|
1817
|
-
type:
|
|
1818
|
-
threadId:
|
|
1814
|
+
z15.object({
|
|
1815
|
+
type: z15.literal("client/turn/requested"),
|
|
1816
|
+
threadId: z15.string()
|
|
1819
1817
|
}).merge(turnRequestEventDataSchema),
|
|
1820
|
-
|
|
1821
|
-
type:
|
|
1822
|
-
threadId:
|
|
1818
|
+
z15.object({
|
|
1819
|
+
type: z15.literal("client/turn/rejected"),
|
|
1820
|
+
threadId: z15.string()
|
|
1823
1821
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
1824
|
-
|
|
1825
|
-
type:
|
|
1826
|
-
threadId:
|
|
1822
|
+
z15.object({
|
|
1823
|
+
type: z15.literal("client/turn/start"),
|
|
1824
|
+
threadId: z15.string()
|
|
1827
1825
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1828
|
-
|
|
1829
|
-
type:
|
|
1830
|
-
threadId:
|
|
1826
|
+
z15.object({
|
|
1827
|
+
type: z15.literal("system/error"),
|
|
1828
|
+
threadId: z15.string()
|
|
1831
1829
|
}).merge(systemErrorEventDataSchema),
|
|
1832
|
-
|
|
1833
|
-
type:
|
|
1834
|
-
threadId:
|
|
1830
|
+
z15.object({
|
|
1831
|
+
type: z15.literal("system/manager/user_message"),
|
|
1832
|
+
threadId: z15.string()
|
|
1835
1833
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
1836
|
-
|
|
1837
|
-
type:
|
|
1838
|
-
threadId:
|
|
1834
|
+
z15.object({
|
|
1835
|
+
type: z15.literal("system/thread/interrupted"),
|
|
1836
|
+
threadId: z15.string()
|
|
1839
1837
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
1840
|
-
|
|
1841
|
-
type:
|
|
1842
|
-
threadId:
|
|
1838
|
+
z15.object({
|
|
1839
|
+
type: z15.literal("system/operation"),
|
|
1840
|
+
threadId: z15.string()
|
|
1843
1841
|
}).merge(systemOperationEventDataSchema),
|
|
1844
|
-
|
|
1845
|
-
type:
|
|
1846
|
-
threadId:
|
|
1842
|
+
z15.object({
|
|
1843
|
+
type: z15.literal("system/interaction/lifecycle"),
|
|
1844
|
+
threadId: z15.string()
|
|
1847
1845
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
1848
|
-
|
|
1849
|
-
type:
|
|
1850
|
-
threadId:
|
|
1846
|
+
z15.object({
|
|
1847
|
+
type: z15.literal("system/permissionGrant/lifecycle"),
|
|
1848
|
+
threadId: z15.string()
|
|
1851
1849
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
1852
|
-
|
|
1853
|
-
type:
|
|
1854
|
-
threadId:
|
|
1850
|
+
z15.object({
|
|
1851
|
+
type: z15.literal("system/userQuestion/lifecycle"),
|
|
1852
|
+
threadId: z15.string()
|
|
1855
1853
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
1856
|
-
|
|
1857
|
-
type:
|
|
1858
|
-
threadId:
|
|
1854
|
+
z15.object({
|
|
1855
|
+
type: z15.literal("system/thread-provisioning"),
|
|
1856
|
+
threadId: z15.string()
|
|
1859
1857
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
1860
|
-
|
|
1861
|
-
type:
|
|
1862
|
-
threadId:
|
|
1858
|
+
z15.object({
|
|
1859
|
+
type: z15.literal("system/provider-turn-watchdog"),
|
|
1860
|
+
threadId: z15.string()
|
|
1863
1861
|
}).merge(systemProviderTurnWatchdogEventDataSchema)
|
|
1864
1862
|
]);
|
|
1865
1863
|
var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
|
|
1866
|
-
var threadEventSchema =
|
|
1864
|
+
var threadEventSchema = z15.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
|
|
1867
1865
|
const result2 = validateThreadEventScope({
|
|
1868
1866
|
type: event.type,
|
|
1869
1867
|
scope: event.scope
|
|
1870
1868
|
});
|
|
1871
1869
|
if (!result2.valid) {
|
|
1872
1870
|
ctx.addIssue({
|
|
1873
|
-
code:
|
|
1871
|
+
code: z15.ZodIssueCode.custom,
|
|
1874
1872
|
message: result2.message ?? "Invalid thread event scope",
|
|
1875
1873
|
path: ["scope"]
|
|
1876
1874
|
});
|
|
@@ -1890,75 +1888,49 @@ function isThreadEventWithItem(event) {
|
|
|
1890
1888
|
return false;
|
|
1891
1889
|
}
|
|
1892
1890
|
}
|
|
1893
|
-
var threadEventTypeValues = [
|
|
1894
|
-
...providerEventTypeValues,
|
|
1895
|
-
...systemEventTypeValues
|
|
1896
|
-
];
|
|
1897
|
-
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1898
|
-
var threadEventTypeSchema = z14.string().refine(
|
|
1899
|
-
(value) => threadEventTypeSet.has(value),
|
|
1900
|
-
"Invalid thread event type"
|
|
1901
|
-
);
|
|
1902
|
-
|
|
1903
|
-
// ../domain/src/plugin-icon.ts
|
|
1904
|
-
var PLUGIN_ICON_MAX_BYTES = 32 * 1024;
|
|
1905
|
-
var NAMESPACED_GLYPH_PATTERN = /^[a-z0-9-]+\/[a-z0-9][a-z0-9-]*$/u;
|
|
1906
|
-
function isNamespacedGlyph(glyph) {
|
|
1907
|
-
return NAMESPACED_GLYPH_PATTERN.test(glyph);
|
|
1908
|
-
}
|
|
1909
|
-
function parseNamespacedGlyph(glyph) {
|
|
1910
|
-
if (!isNamespacedGlyph(glyph)) {
|
|
1911
|
-
return null;
|
|
1912
|
-
}
|
|
1913
|
-
const separator = glyph.indexOf("/");
|
|
1914
|
-
return {
|
|
1915
|
-
pluginId: glyph.slice(0, separator),
|
|
1916
|
-
name: glyph.slice(separator + 1)
|
|
1917
|
-
};
|
|
1918
|
-
}
|
|
1919
1891
|
|
|
1920
1892
|
// ../domain/src/thread-provider-state.ts
|
|
1921
|
-
import { z as
|
|
1893
|
+
import { z as z16 } from "zod";
|
|
1922
1894
|
var THREAD_PROVIDER_COMMANDS_STATE_KIND = "bb/provider-commands";
|
|
1923
1895
|
var THREAD_SESSION_OPTIONS_STATE_KIND = "bb/session-options";
|
|
1924
|
-
var threadProviderCommandSchema =
|
|
1925
|
-
name:
|
|
1926
|
-
description:
|
|
1927
|
-
inputHint:
|
|
1896
|
+
var threadProviderCommandSchema = z16.object({
|
|
1897
|
+
name: z16.string().min(1),
|
|
1898
|
+
description: z16.string(),
|
|
1899
|
+
inputHint: z16.string().min(1).optional()
|
|
1928
1900
|
});
|
|
1929
|
-
var threadProviderCommandsStateSchema =
|
|
1930
|
-
commands:
|
|
1901
|
+
var threadProviderCommandsStateSchema = z16.object({
|
|
1902
|
+
commands: z16.array(threadProviderCommandSchema).max(500)
|
|
1931
1903
|
});
|
|
1932
|
-
var threadSessionOptionValueSchema =
|
|
1933
|
-
id:
|
|
1934
|
-
label:
|
|
1935
|
-
description:
|
|
1936
|
-
group:
|
|
1904
|
+
var threadSessionOptionValueSchema = z16.object({
|
|
1905
|
+
id: z16.string().min(1),
|
|
1906
|
+
label: z16.string().min(1),
|
|
1907
|
+
description: z16.string().min(1).optional(),
|
|
1908
|
+
group: z16.string().min(1).optional()
|
|
1937
1909
|
});
|
|
1938
1910
|
var threadSessionOptionBaseShape = {
|
|
1939
|
-
id:
|
|
1940
|
-
label:
|
|
1941
|
-
description:
|
|
1942
|
-
category:
|
|
1911
|
+
id: z16.string().min(1),
|
|
1912
|
+
label: z16.string().min(1),
|
|
1913
|
+
description: z16.string().min(1).optional(),
|
|
1914
|
+
category: z16.string().min(1).optional()
|
|
1943
1915
|
};
|
|
1944
|
-
var threadSessionOptionSchema =
|
|
1945
|
-
|
|
1916
|
+
var threadSessionOptionSchema = z16.discriminatedUnion("type", [
|
|
1917
|
+
z16.object({
|
|
1946
1918
|
...threadSessionOptionBaseShape,
|
|
1947
|
-
type:
|
|
1948
|
-
value:
|
|
1949
|
-
values:
|
|
1919
|
+
type: z16.literal("select"),
|
|
1920
|
+
value: z16.string(),
|
|
1921
|
+
values: z16.array(threadSessionOptionValueSchema).max(1e3)
|
|
1950
1922
|
}),
|
|
1951
|
-
|
|
1923
|
+
z16.object({
|
|
1952
1924
|
...threadSessionOptionBaseShape,
|
|
1953
|
-
type:
|
|
1954
|
-
value:
|
|
1955
|
-
fixed:
|
|
1925
|
+
type: z16.literal("boolean"),
|
|
1926
|
+
value: z16.boolean(),
|
|
1927
|
+
fixed: z16.boolean().optional()
|
|
1956
1928
|
})
|
|
1957
1929
|
]);
|
|
1958
|
-
var threadSessionOptionsStateSchema =
|
|
1959
|
-
options:
|
|
1930
|
+
var threadSessionOptionsStateSchema = z16.object({
|
|
1931
|
+
options: z16.array(threadSessionOptionSchema).max(64)
|
|
1960
1932
|
});
|
|
1961
|
-
var threadSessionOptionSelectionsStateSchema =
|
|
1933
|
+
var threadSessionOptionSelectionsStateSchema = z16.object({
|
|
1962
1934
|
selections: sessionOptionSelectionsSchema
|
|
1963
1935
|
});
|
|
1964
1936
|
var CORE_THREAD_STATE_SCHEMAS = {
|
|
@@ -1967,104 +1939,104 @@ var CORE_THREAD_STATE_SCHEMAS = {
|
|
|
1967
1939
|
};
|
|
1968
1940
|
|
|
1969
1941
|
// ../domain/src/provider-fork.ts
|
|
1970
|
-
import { z as
|
|
1942
|
+
import { z as z17 } from "zod";
|
|
1971
1943
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
1972
|
-
var providerForkSchema =
|
|
1944
|
+
var providerForkSchema = z17.enum(PROVIDER_FORK_VALUES);
|
|
1973
1945
|
|
|
1974
1946
|
// ../domain/src/provider-types.ts
|
|
1975
|
-
import { z as
|
|
1976
|
-
var modelReasoningEffortSchema =
|
|
1947
|
+
import { z as z18 } from "zod";
|
|
1948
|
+
var modelReasoningEffortSchema = z18.object({
|
|
1977
1949
|
reasoningEffort: reasoningLevelSchema,
|
|
1978
|
-
label:
|
|
1979
|
-
description:
|
|
1950
|
+
label: z18.string().min(1).optional(),
|
|
1951
|
+
description: z18.string()
|
|
1980
1952
|
});
|
|
1981
|
-
var modelServiceTierSchema =
|
|
1953
|
+
var modelServiceTierSchema = z18.object({
|
|
1982
1954
|
id: serviceTierSchema,
|
|
1983
|
-
label:
|
|
1984
|
-
description:
|
|
1985
|
-
});
|
|
1986
|
-
var availableModelSchema =
|
|
1987
|
-
id:
|
|
1988
|
-
model:
|
|
1989
|
-
displayName:
|
|
1990
|
-
routeProviderId:
|
|
1991
|
-
description:
|
|
1992
|
-
supportedReasoningEfforts:
|
|
1955
|
+
label: z18.string().min(1).optional(),
|
|
1956
|
+
description: z18.string().min(1).optional()
|
|
1957
|
+
});
|
|
1958
|
+
var availableModelSchema = z18.object({
|
|
1959
|
+
id: z18.string(),
|
|
1960
|
+
model: z18.string(),
|
|
1961
|
+
displayName: z18.string(),
|
|
1962
|
+
routeProviderId: z18.string().min(1).optional(),
|
|
1963
|
+
description: z18.string(),
|
|
1964
|
+
supportedReasoningEfforts: z18.array(modelReasoningEffortSchema),
|
|
1993
1965
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
1994
|
-
supportedServiceTiers:
|
|
1995
|
-
sessionOptions:
|
|
1996
|
-
isDefault:
|
|
1997
|
-
});
|
|
1998
|
-
var providerModelCatalogScopeSchema =
|
|
1999
|
-
var providerCapabilitiesSchema =
|
|
2000
|
-
supportsThreadArchive:
|
|
2001
|
-
supportsThreadRename:
|
|
2002
|
-
supportsServiceTier:
|
|
2003
|
-
supportsNativeUserQuestion:
|
|
2004
|
-
supportsFork:
|
|
2005
|
-
supportsSessionRewind:
|
|
2006
|
-
permissionModes:
|
|
1966
|
+
supportedServiceTiers: z18.array(modelServiceTierSchema).optional(),
|
|
1967
|
+
sessionOptions: z18.array(threadSessionOptionSchema).max(64).optional(),
|
|
1968
|
+
isDefault: z18.boolean()
|
|
1969
|
+
});
|
|
1970
|
+
var providerModelCatalogScopeSchema = z18.enum(["host", "workspace"]);
|
|
1971
|
+
var providerCapabilitiesSchema = z18.object({
|
|
1972
|
+
supportsThreadArchive: z18.boolean(),
|
|
1973
|
+
supportsThreadRename: z18.boolean(),
|
|
1974
|
+
supportsServiceTier: z18.boolean(),
|
|
1975
|
+
supportsNativeUserQuestion: z18.boolean(),
|
|
1976
|
+
supportsFork: z18.boolean(),
|
|
1977
|
+
supportsSessionRewind: z18.boolean(),
|
|
1978
|
+
permissionModes: z18.array(permissionModeSchema).min(1),
|
|
2007
1979
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
2008
1980
|
});
|
|
2009
|
-
var providerComposerCommandSchema =
|
|
1981
|
+
var providerComposerCommandSchema = z18.object({
|
|
2010
1982
|
trigger: promptMentionCommandTriggerSchema,
|
|
2011
|
-
name:
|
|
2012
|
-
trailingText:
|
|
1983
|
+
name: z18.string().min(1).regex(/^[^\s/$]+$/u),
|
|
1984
|
+
trailingText: z18.string().regex(/^\s*$/u)
|
|
2013
1985
|
});
|
|
2014
|
-
var providerComposerActionSchema =
|
|
2015
|
-
|
|
2016
|
-
kind:
|
|
1986
|
+
var providerComposerActionSchema = z18.discriminatedUnion("kind", [
|
|
1987
|
+
z18.object({
|
|
1988
|
+
kind: z18.literal("skills"),
|
|
2017
1989
|
trigger: promptMentionCommandTriggerSchema
|
|
2018
1990
|
}),
|
|
2019
|
-
|
|
2020
|
-
kind:
|
|
1991
|
+
z18.object({
|
|
1992
|
+
kind: z18.literal("plan"),
|
|
2021
1993
|
command: providerComposerCommandSchema
|
|
2022
1994
|
}),
|
|
2023
|
-
|
|
2024
|
-
kind:
|
|
1995
|
+
z18.object({
|
|
1996
|
+
kind: z18.literal("goal"),
|
|
2025
1997
|
command: providerComposerCommandSchema
|
|
2026
1998
|
})
|
|
2027
1999
|
]);
|
|
2028
|
-
var providerStringsSchema =
|
|
2029
|
-
signInHint:
|
|
2030
|
-
expiredHint:
|
|
2031
|
-
installUrl:
|
|
2032
|
-
brandPrefix:
|
|
2033
|
-
planModeCopy:
|
|
2034
|
-
iconTint:
|
|
2035
|
-
});
|
|
2036
|
-
var providerOptionDescriptorSchema =
|
|
2037
|
-
id:
|
|
2038
|
-
label:
|
|
2039
|
-
description:
|
|
2040
|
-
});
|
|
2041
|
-
var providerExtensionKindInfoSchema =
|
|
2042
|
-
item:
|
|
2043
|
-
state:
|
|
2044
|
-
});
|
|
2045
|
-
var providerExtensionKindsSchema =
|
|
2000
|
+
var providerStringsSchema = z18.object({
|
|
2001
|
+
signInHint: z18.string().min(1),
|
|
2002
|
+
expiredHint: z18.string().min(1),
|
|
2003
|
+
installUrl: z18.string().min(1),
|
|
2004
|
+
brandPrefix: z18.string().min(1).optional(),
|
|
2005
|
+
planModeCopy: z18.string().min(1).optional(),
|
|
2006
|
+
iconTint: z18.object({ light: z18.string().min(1), dark: z18.string().min(1) }).optional()
|
|
2007
|
+
});
|
|
2008
|
+
var providerOptionDescriptorSchema = z18.object({
|
|
2009
|
+
id: z18.string().min(1),
|
|
2010
|
+
label: z18.string().min(1),
|
|
2011
|
+
description: z18.string().min(1).optional()
|
|
2012
|
+
});
|
|
2013
|
+
var providerExtensionKindInfoSchema = z18.object({
|
|
2014
|
+
item: z18.boolean(),
|
|
2015
|
+
state: z18.boolean()
|
|
2016
|
+
});
|
|
2017
|
+
var providerExtensionKindsSchema = z18.record(
|
|
2046
2018
|
extensionKindSchema,
|
|
2047
2019
|
providerExtensionKindInfoSchema
|
|
2048
2020
|
);
|
|
2049
|
-
var providerInfoSchema =
|
|
2050
|
-
id:
|
|
2051
|
-
pluginId:
|
|
2052
|
-
displayName:
|
|
2053
|
-
family:
|
|
2054
|
-
icon:
|
|
2055
|
-
logoUrl:
|
|
2056
|
-
maintenance:
|
|
2057
|
-
health:
|
|
2058
|
-
usage:
|
|
2059
|
-
installation:
|
|
2021
|
+
var providerInfoSchema = z18.object({
|
|
2022
|
+
id: z18.string(),
|
|
2023
|
+
pluginId: z18.string().min(1),
|
|
2024
|
+
displayName: z18.string(),
|
|
2025
|
+
family: z18.string().min(1).optional(),
|
|
2026
|
+
icon: z18.object({ glyph: z18.string().min(1) }).optional(),
|
|
2027
|
+
logoUrl: z18.string().min(1).nullable(),
|
|
2028
|
+
maintenance: z18.object({
|
|
2029
|
+
health: z18.boolean(),
|
|
2030
|
+
usage: z18.boolean(),
|
|
2031
|
+
installation: z18.boolean()
|
|
2060
2032
|
}),
|
|
2061
2033
|
capabilities: providerCapabilitiesSchema,
|
|
2062
|
-
composerActions:
|
|
2034
|
+
composerActions: z18.array(providerComposerActionSchema),
|
|
2063
2035
|
completedTurnDisplay: completedTurnDisplaySchema,
|
|
2064
|
-
available:
|
|
2036
|
+
available: z18.boolean(),
|
|
2065
2037
|
strings: providerStringsSchema.optional(),
|
|
2066
|
-
serviceTiers:
|
|
2067
|
-
reasoningLevels:
|
|
2038
|
+
serviceTiers: z18.array(providerOptionDescriptorSchema).optional(),
|
|
2039
|
+
reasoningLevels: z18.array(providerOptionDescriptorSchema).optional(),
|
|
2068
2040
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
2069
2041
|
});
|
|
2070
2042
|
var providerRecoveryKindValues = [
|
|
@@ -2074,152 +2046,152 @@ var providerRecoveryKindValues = [
|
|
|
2074
2046
|
"staleTurn",
|
|
2075
2047
|
"rateLimited"
|
|
2076
2048
|
];
|
|
2077
|
-
var providerRecoveryKindSchema =
|
|
2078
|
-
var toolCallOutputItemSchema =
|
|
2079
|
-
|
|
2080
|
-
type:
|
|
2081
|
-
text:
|
|
2049
|
+
var providerRecoveryKindSchema = z18.enum(providerRecoveryKindValues);
|
|
2050
|
+
var toolCallOutputItemSchema = z18.discriminatedUnion("type", [
|
|
2051
|
+
z18.object({
|
|
2052
|
+
type: z18.literal("inputText"),
|
|
2053
|
+
text: z18.string()
|
|
2082
2054
|
}),
|
|
2083
|
-
|
|
2084
|
-
type:
|
|
2085
|
-
imageUrl:
|
|
2055
|
+
z18.object({
|
|
2056
|
+
type: z18.literal("inputImage"),
|
|
2057
|
+
imageUrl: z18.string()
|
|
2086
2058
|
})
|
|
2087
2059
|
]);
|
|
2088
|
-
var toolCallRequestSchema =
|
|
2089
|
-
requestId:
|
|
2090
|
-
threadId:
|
|
2091
|
-
providerThreadId:
|
|
2092
|
-
turnId:
|
|
2093
|
-
callId:
|
|
2094
|
-
tool:
|
|
2095
|
-
arguments:
|
|
2096
|
-
});
|
|
2097
|
-
var toolCallResponseSchema =
|
|
2098
|
-
contentItems:
|
|
2099
|
-
success:
|
|
2100
|
-
});
|
|
2101
|
-
var dynamicToolSchema =
|
|
2102
|
-
name:
|
|
2103
|
-
description:
|
|
2104
|
-
inputSchema:
|
|
2060
|
+
var toolCallRequestSchema = z18.object({
|
|
2061
|
+
requestId: z18.union([z18.string().min(1), z18.number()]),
|
|
2062
|
+
threadId: z18.string().min(1),
|
|
2063
|
+
providerThreadId: z18.string().min(1),
|
|
2064
|
+
turnId: z18.string().min(1),
|
|
2065
|
+
callId: z18.string().min(1),
|
|
2066
|
+
tool: z18.string().min(1),
|
|
2067
|
+
arguments: z18.unknown().optional()
|
|
2068
|
+
});
|
|
2069
|
+
var toolCallResponseSchema = z18.object({
|
|
2070
|
+
contentItems: z18.array(toolCallOutputItemSchema),
|
|
2071
|
+
success: z18.boolean()
|
|
2072
|
+
});
|
|
2073
|
+
var dynamicToolSchema = z18.object({
|
|
2074
|
+
name: z18.string(),
|
|
2075
|
+
description: z18.string(),
|
|
2076
|
+
inputSchema: z18.unknown(),
|
|
2105
2077
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2106
2078
|
});
|
|
2107
2079
|
|
|
2108
2080
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
2109
|
-
import { z as
|
|
2081
|
+
import { z as z19 } from "zod";
|
|
2110
2082
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
2111
2083
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
2112
2084
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
2113
|
-
var deltaKeyPartSchema =
|
|
2085
|
+
var deltaKeyPartSchema = z19.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
2114
2086
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
2115
2087
|
});
|
|
2116
|
-
var deltaItemKeySchema =
|
|
2088
|
+
var deltaItemKeySchema = z19.object({
|
|
2117
2089
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
2118
2090
|
channel: deltaKeyPartSchema.optional(),
|
|
2119
2091
|
parentRef: deltaKeyPartSchema.optional()
|
|
2120
2092
|
});
|
|
2121
2093
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2122
|
-
var deltaFileChangeSchema =
|
|
2123
|
-
path:
|
|
2124
|
-
kind:
|
|
2125
|
-
movePath:
|
|
2126
|
-
diff:
|
|
2127
|
-
oldText:
|
|
2128
|
-
newText:
|
|
2129
|
-
});
|
|
2130
|
-
var deltaBackgroundTaskShapeSchema =
|
|
2131
|
-
type:
|
|
2132
|
-
familyId:
|
|
2133
|
-
taskType:
|
|
2134
|
-
description:
|
|
2094
|
+
var deltaFileChangeSchema = z19.object({
|
|
2095
|
+
path: z19.string(),
|
|
2096
|
+
kind: z19.enum(["add", "update", "delete"]),
|
|
2097
|
+
movePath: z19.string().optional(),
|
|
2098
|
+
diff: z19.string().optional(),
|
|
2099
|
+
oldText: z19.string().optional(),
|
|
2100
|
+
newText: z19.string().optional()
|
|
2101
|
+
});
|
|
2102
|
+
var deltaBackgroundTaskShapeSchema = z19.object({
|
|
2103
|
+
type: z19.literal("backgroundTask"),
|
|
2104
|
+
familyId: z19.string().min(1),
|
|
2105
|
+
taskType: z19.string(),
|
|
2106
|
+
description: z19.string(),
|
|
2135
2107
|
status: threadEventItemStatusSchema,
|
|
2136
2108
|
taskStatus: backgroundTaskStatusSchema,
|
|
2137
|
-
skipTranscript:
|
|
2138
|
-
foreground:
|
|
2139
|
-
workflowName:
|
|
2109
|
+
skipTranscript: z19.boolean(),
|
|
2110
|
+
foreground: z19.boolean().optional(),
|
|
2111
|
+
workflowName: z19.string().optional(),
|
|
2140
2112
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2141
2113
|
usage: backgroundTaskUsageSchema.optional(),
|
|
2142
|
-
summary:
|
|
2143
|
-
error:
|
|
2144
|
-
outputFile:
|
|
2114
|
+
summary: z19.string().optional(),
|
|
2115
|
+
error: z19.string().optional(),
|
|
2116
|
+
outputFile: z19.string().optional()
|
|
2145
2117
|
});
|
|
2146
|
-
var deltaFileReadShapeSchema =
|
|
2147
|
-
type:
|
|
2148
|
-
path:
|
|
2149
|
-
cmd:
|
|
2118
|
+
var deltaFileReadShapeSchema = z19.object({
|
|
2119
|
+
type: z19.literal("fileRead"),
|
|
2120
|
+
path: z19.string(),
|
|
2121
|
+
cmd: z19.string().optional()
|
|
2150
2122
|
});
|
|
2151
|
-
var deltaSearchShapeSchema =
|
|
2152
|
-
type:
|
|
2123
|
+
var deltaSearchShapeSchema = z19.object({
|
|
2124
|
+
type: z19.literal("search"),
|
|
2153
2125
|
mode: threadEventSearchModeSchema,
|
|
2154
|
-
query:
|
|
2155
|
-
path:
|
|
2156
|
-
cmd:
|
|
2126
|
+
query: z19.string(),
|
|
2127
|
+
path: z19.string().optional(),
|
|
2128
|
+
cmd: z19.string().optional()
|
|
2157
2129
|
});
|
|
2158
|
-
var deltaDelegationShapeSchema =
|
|
2159
|
-
type:
|
|
2130
|
+
var deltaDelegationShapeSchema = z19.object({
|
|
2131
|
+
type: z19.literal("delegation"),
|
|
2160
2132
|
childRef: deltaKeyPartSchema,
|
|
2161
|
-
label:
|
|
2162
|
-
background:
|
|
2163
|
-
summary:
|
|
2133
|
+
label: z19.string(),
|
|
2134
|
+
background: z19.boolean(),
|
|
2135
|
+
summary: z19.string().optional()
|
|
2164
2136
|
});
|
|
2165
|
-
var deltaPlanStepsShapeSchema =
|
|
2166
|
-
type:
|
|
2167
|
-
steps:
|
|
2168
|
-
explanation:
|
|
2137
|
+
var deltaPlanStepsShapeSchema = z19.object({
|
|
2138
|
+
type: z19.literal("planSteps"),
|
|
2139
|
+
steps: z19.array(threadEventPlanStepSchema),
|
|
2140
|
+
explanation: z19.string().optional()
|
|
2169
2141
|
});
|
|
2170
|
-
var deltaExtensionShapeSchema =
|
|
2171
|
-
type:
|
|
2142
|
+
var deltaExtensionShapeSchema = z19.object({
|
|
2143
|
+
type: z19.literal("extension"),
|
|
2172
2144
|
kind: extensionKindSchema,
|
|
2173
2145
|
payload: jsonValueSchema
|
|
2174
2146
|
});
|
|
2175
|
-
var deltaItemShapeSchema =
|
|
2176
|
-
|
|
2177
|
-
type:
|
|
2178
|
-
command:
|
|
2179
|
-
cwd:
|
|
2180
|
-
aggregatedOutput:
|
|
2181
|
-
exitCode:
|
|
2182
|
-
durationMs:
|
|
2147
|
+
var deltaItemShapeSchema = z19.discriminatedUnion("type", [
|
|
2148
|
+
z19.object({
|
|
2149
|
+
type: z19.literal("command"),
|
|
2150
|
+
command: z19.string(),
|
|
2151
|
+
cwd: z19.string(),
|
|
2152
|
+
aggregatedOutput: z19.string().optional(),
|
|
2153
|
+
exitCode: z19.number().optional(),
|
|
2154
|
+
durationMs: z19.number().optional()
|
|
2183
2155
|
}),
|
|
2184
|
-
|
|
2185
|
-
type:
|
|
2186
|
-
changes:
|
|
2156
|
+
z19.object({
|
|
2157
|
+
type: z19.literal("fileChange"),
|
|
2158
|
+
changes: z19.array(deltaFileChangeSchema)
|
|
2187
2159
|
}),
|
|
2188
|
-
|
|
2189
|
-
type:
|
|
2190
|
-
tool:
|
|
2191
|
-
server:
|
|
2192
|
-
args:
|
|
2193
|
-
result:
|
|
2194
|
-
error:
|
|
2195
|
-
durationMs:
|
|
2160
|
+
z19.object({
|
|
2161
|
+
type: z19.literal("tool"),
|
|
2162
|
+
tool: z19.string(),
|
|
2163
|
+
server: z19.string().optional(),
|
|
2164
|
+
args: z19.unknown().optional(),
|
|
2165
|
+
result: z19.unknown().optional(),
|
|
2166
|
+
error: z19.string().optional(),
|
|
2167
|
+
durationMs: z19.number().optional()
|
|
2196
2168
|
}),
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
type:
|
|
2201
|
-
summary:
|
|
2202
|
-
content:
|
|
2169
|
+
z19.object({ type: z19.literal("compaction") }),
|
|
2170
|
+
z19.object({ type: z19.literal("agentMessage"), text: z19.string() }),
|
|
2171
|
+
z19.object({
|
|
2172
|
+
type: z19.literal("reasoning"),
|
|
2173
|
+
summary: z19.array(z19.string()),
|
|
2174
|
+
content: z19.array(z19.string())
|
|
2203
2175
|
}),
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
type:
|
|
2207
|
-
queries:
|
|
2176
|
+
z19.object({ type: z19.literal("plan"), text: z19.string() }),
|
|
2177
|
+
z19.object({
|
|
2178
|
+
type: z19.literal("webSearch"),
|
|
2179
|
+
queries: z19.array(z19.string()).min(1)
|
|
2208
2180
|
}),
|
|
2209
|
-
|
|
2210
|
-
type:
|
|
2211
|
-
url:
|
|
2212
|
-
prompt:
|
|
2213
|
-
pattern:
|
|
2181
|
+
z19.object({
|
|
2182
|
+
type: z19.literal("webFetch"),
|
|
2183
|
+
url: z19.string(),
|
|
2184
|
+
prompt: z19.string().nullable().optional(),
|
|
2185
|
+
pattern: z19.string().nullable()
|
|
2214
2186
|
}),
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
type:
|
|
2218
|
-
prompt:
|
|
2219
|
-
path:
|
|
2220
|
-
result:
|
|
2221
|
-
error:
|
|
2222
|
-
transparentBackground:
|
|
2187
|
+
z19.object({ type: z19.literal("imageView"), path: z19.string() }),
|
|
2188
|
+
z19.object({
|
|
2189
|
+
type: z19.literal("imageGeneration"),
|
|
2190
|
+
prompt: z19.string().nullable(),
|
|
2191
|
+
path: z19.string().nullable(),
|
|
2192
|
+
result: z19.string().optional(),
|
|
2193
|
+
error: z19.string().nullable(),
|
|
2194
|
+
transparentBackground: z19.boolean()
|
|
2223
2195
|
}),
|
|
2224
2196
|
deltaBackgroundTaskShapeSchema,
|
|
2225
2197
|
deltaFileReadShapeSchema,
|
|
@@ -2228,22 +2200,22 @@ var deltaItemShapeSchema = z18.discriminatedUnion("type", [
|
|
|
2228
2200
|
deltaPlanStepsShapeSchema,
|
|
2229
2201
|
deltaExtensionShapeSchema
|
|
2230
2202
|
]);
|
|
2231
|
-
var deltaProgressSnapshotSchema =
|
|
2203
|
+
var deltaProgressSnapshotSchema = z19.discriminatedUnion("type", [
|
|
2232
2204
|
deltaBackgroundTaskShapeSchema,
|
|
2233
2205
|
deltaDelegationShapeSchema
|
|
2234
2206
|
]);
|
|
2235
|
-
var deltaTextChannelSchema =
|
|
2207
|
+
var deltaTextChannelSchema = z19.enum([
|
|
2236
2208
|
"agentMessage",
|
|
2237
2209
|
"reasoningSummary",
|
|
2238
2210
|
"reasoningText",
|
|
2239
2211
|
"plan"
|
|
2240
2212
|
]);
|
|
2241
|
-
var deltaOutputChannelSchema =
|
|
2242
|
-
var deltaErrorSchema =
|
|
2243
|
-
var deltaAttachSchema =
|
|
2244
|
-
var deltaNoTurnFallbackSchema =
|
|
2213
|
+
var deltaOutputChannelSchema = z19.enum(["command", "fileChange"]);
|
|
2214
|
+
var deltaErrorSchema = z19.object({ message: z19.string() });
|
|
2215
|
+
var deltaAttachSchema = z19.enum(["open", "currentOrLast"]);
|
|
2216
|
+
var deltaNoTurnFallbackSchema = z19.object({
|
|
2245
2217
|
raw: providerRawEventSchema,
|
|
2246
|
-
rawType:
|
|
2218
|
+
rawType: z19.string()
|
|
2247
2219
|
});
|
|
2248
2220
|
function requireExtensionPresentation(delta, ctx) {
|
|
2249
2221
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -2254,36 +2226,36 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2254
2226
|
});
|
|
2255
2227
|
}
|
|
2256
2228
|
}
|
|
2257
|
-
var threadDeltaSchema =
|
|
2258
|
-
|
|
2259
|
-
kind:
|
|
2229
|
+
var threadDeltaSchema = z19.discriminatedUnion("kind", [
|
|
2230
|
+
z19.object({
|
|
2231
|
+
kind: z19.literal("input.accepted"),
|
|
2260
2232
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2261
2233
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2262
2234
|
}),
|
|
2263
|
-
|
|
2264
|
-
kind:
|
|
2265
|
-
text:
|
|
2235
|
+
z19.object({
|
|
2236
|
+
kind: z19.literal("input.provider"),
|
|
2237
|
+
text: z19.string().min(1),
|
|
2266
2238
|
parentRef: deltaKeyPartSchema.optional()
|
|
2267
2239
|
}),
|
|
2268
|
-
|
|
2269
|
-
kind:
|
|
2240
|
+
z19.object({
|
|
2241
|
+
kind: z19.literal("turn.open"),
|
|
2270
2242
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2271
2243
|
parentRef: deltaKeyPartSchema.optional()
|
|
2272
2244
|
}),
|
|
2273
|
-
|
|
2274
|
-
kind:
|
|
2275
|
-
state:
|
|
2245
|
+
z19.object({
|
|
2246
|
+
kind: z19.literal("turn.mainRun"),
|
|
2247
|
+
state: z19.enum(["idle", "running"])
|
|
2276
2248
|
}),
|
|
2277
|
-
|
|
2278
|
-
kind:
|
|
2249
|
+
z19.object({
|
|
2250
|
+
kind: z19.literal("turn.boundary"),
|
|
2279
2251
|
status: threadEventTurnStatusSchema,
|
|
2280
2252
|
error: deltaErrorSchema.optional(),
|
|
2281
|
-
providerCheckpointId:
|
|
2282
|
-
claimIfIdle:
|
|
2253
|
+
providerCheckpointId: z19.string().min(1).optional(),
|
|
2254
|
+
claimIfIdle: z19.boolean().optional(),
|
|
2283
2255
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2284
2256
|
}),
|
|
2285
|
-
|
|
2286
|
-
kind:
|
|
2257
|
+
z19.object({
|
|
2258
|
+
kind: z19.literal("item.open"),
|
|
2287
2259
|
key: deltaItemKeySchema,
|
|
2288
2260
|
item: deltaItemShapeSchema,
|
|
2289
2261
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -2291,146 +2263,146 @@ var threadDeltaSchema = z18.discriminatedUnion("kind", [
|
|
|
2291
2263
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2292
2264
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2293
2265
|
}).superRefine(requireExtensionPresentation),
|
|
2294
|
-
|
|
2295
|
-
kind:
|
|
2266
|
+
z19.object({
|
|
2267
|
+
kind: z19.literal("item.close"),
|
|
2296
2268
|
key: deltaItemKeySchema,
|
|
2297
2269
|
status: threadEventItemStatusSchema,
|
|
2298
|
-
resultText:
|
|
2299
|
-
exitCode:
|
|
2300
|
-
aggregatedOutput:
|
|
2301
|
-
approvalStatus:
|
|
2270
|
+
resultText: z19.string().optional(),
|
|
2271
|
+
exitCode: z19.number().optional(),
|
|
2272
|
+
aggregatedOutput: z19.string().optional(),
|
|
2273
|
+
approvalStatus: z19.literal("denied").optional(),
|
|
2302
2274
|
item: deltaItemShapeSchema,
|
|
2303
2275
|
presentation: deltaPresentationSchema.optional(),
|
|
2304
2276
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2305
2277
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2306
2278
|
}).superRefine(requireExtensionPresentation),
|
|
2307
|
-
|
|
2308
|
-
kind:
|
|
2279
|
+
z19.object({
|
|
2280
|
+
kind: z19.literal("item.progress"),
|
|
2309
2281
|
key: deltaItemKeySchema,
|
|
2310
|
-
message:
|
|
2282
|
+
message: z19.string().optional(),
|
|
2311
2283
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
2312
|
-
flush:
|
|
2284
|
+
flush: z19.boolean().optional(),
|
|
2313
2285
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2314
2286
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2315
2287
|
}),
|
|
2316
|
-
|
|
2317
|
-
kind:
|
|
2288
|
+
z19.object({
|
|
2289
|
+
kind: z19.literal("item.textDelta"),
|
|
2318
2290
|
key: deltaItemKeySchema,
|
|
2319
2291
|
channel: deltaTextChannelSchema,
|
|
2320
|
-
text:
|
|
2292
|
+
text: z19.string(),
|
|
2321
2293
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2322
2294
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2323
2295
|
}),
|
|
2324
|
-
|
|
2325
|
-
kind:
|
|
2296
|
+
z19.object({
|
|
2297
|
+
kind: z19.literal("item.textClose"),
|
|
2326
2298
|
key: deltaItemKeySchema,
|
|
2327
2299
|
channel: deltaTextChannelSchema,
|
|
2328
|
-
text:
|
|
2300
|
+
text: z19.string().optional(),
|
|
2329
2301
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2330
2302
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2331
2303
|
}),
|
|
2332
|
-
|
|
2333
|
-
kind:
|
|
2304
|
+
z19.object({
|
|
2305
|
+
kind: z19.literal("item.outputDelta"),
|
|
2334
2306
|
key: deltaItemKeySchema,
|
|
2335
2307
|
channel: deltaOutputChannelSchema,
|
|
2336
|
-
text:
|
|
2308
|
+
text: z19.string(),
|
|
2337
2309
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2338
2310
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2339
2311
|
}),
|
|
2340
|
-
|
|
2341
|
-
kind:
|
|
2312
|
+
z19.object({
|
|
2313
|
+
kind: z19.literal("command.outputSnapshot"),
|
|
2342
2314
|
key: deltaItemKeySchema,
|
|
2343
|
-
text:
|
|
2315
|
+
text: z19.string(),
|
|
2344
2316
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2345
2317
|
}),
|
|
2346
|
-
|
|
2347
|
-
kind:
|
|
2318
|
+
z19.object({
|
|
2319
|
+
kind: z19.literal("usage"),
|
|
2348
2320
|
total: threadEventTokenUsageBreakdownSchema,
|
|
2349
2321
|
last: threadEventTokenUsageBreakdownSchema,
|
|
2350
|
-
modelContextWindow:
|
|
2322
|
+
modelContextWindow: z19.number().nullable(),
|
|
2351
2323
|
promptCacheTtlMs: promptCacheTtlMsSchema.optional(),
|
|
2352
2324
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2353
2325
|
}),
|
|
2354
|
-
|
|
2355
|
-
kind:
|
|
2326
|
+
z19.object({
|
|
2327
|
+
kind: z19.literal("contextWindow"),
|
|
2356
2328
|
snapshot: contextSnapshotSchema.optional(),
|
|
2357
|
-
used:
|
|
2358
|
-
size:
|
|
2359
|
-
estimated:
|
|
2329
|
+
used: z19.number().nullable(),
|
|
2330
|
+
size: z19.number().nullable().optional(),
|
|
2331
|
+
estimated: z19.boolean(),
|
|
2360
2332
|
cost: threadUsageCostSchema.optional(),
|
|
2361
2333
|
attach: deltaAttachSchema,
|
|
2362
2334
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2363
2335
|
}),
|
|
2364
|
-
|
|
2365
|
-
kind:
|
|
2336
|
+
z19.object({
|
|
2337
|
+
kind: z19.literal("context.compacted"),
|
|
2366
2338
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2367
2339
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2368
2340
|
}),
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
kind:
|
|
2372
|
-
diff:
|
|
2341
|
+
z19.object({ kind: z19.literal("context.cleared") }),
|
|
2342
|
+
z19.object({
|
|
2343
|
+
kind: z19.literal("turn.diff"),
|
|
2344
|
+
diff: z19.string(),
|
|
2373
2345
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2374
2346
|
}),
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
kind:
|
|
2378
|
-
providerThreadId:
|
|
2347
|
+
z19.object({ kind: z19.literal("thread.started") }),
|
|
2348
|
+
z19.object({
|
|
2349
|
+
kind: z19.literal("thread.identity"),
|
|
2350
|
+
providerThreadId: z19.string().min(1)
|
|
2379
2351
|
}),
|
|
2380
|
-
|
|
2381
|
-
kind:
|
|
2382
|
-
name:
|
|
2383
|
-
source:
|
|
2352
|
+
z19.object({
|
|
2353
|
+
kind: z19.literal("thread.name"),
|
|
2354
|
+
name: z19.string().min(1),
|
|
2355
|
+
source: z19.literal("agent").optional()
|
|
2384
2356
|
}),
|
|
2385
|
-
|
|
2386
|
-
kind:
|
|
2357
|
+
z19.object({
|
|
2358
|
+
kind: z19.literal("extension.state"),
|
|
2387
2359
|
extensionKind: extensionKindSchema,
|
|
2388
2360
|
payload: jsonValueSchema
|
|
2389
2361
|
}),
|
|
2390
|
-
|
|
2391
|
-
kind:
|
|
2362
|
+
z19.object({
|
|
2363
|
+
kind: z19.literal("provider.rateLimits"),
|
|
2392
2364
|
rateLimits: providerRateLimitStateSchema
|
|
2393
2365
|
}),
|
|
2394
|
-
|
|
2395
|
-
kind:
|
|
2396
|
-
message:
|
|
2397
|
-
detail:
|
|
2398
|
-
willRetry:
|
|
2366
|
+
z19.object({
|
|
2367
|
+
kind: z19.literal("provider.error"),
|
|
2368
|
+
message: z19.string(),
|
|
2369
|
+
detail: z19.string().optional(),
|
|
2370
|
+
willRetry: z19.boolean().optional(),
|
|
2399
2371
|
category: providerErrorCategorySchema.optional(),
|
|
2400
2372
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
2401
|
-
settlesTurn:
|
|
2373
|
+
settlesTurn: z19.boolean().optional(),
|
|
2402
2374
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2403
|
-
threadScoped:
|
|
2375
|
+
threadScoped: z19.boolean().optional()
|
|
2404
2376
|
}),
|
|
2405
|
-
|
|
2406
|
-
kind:
|
|
2407
|
-
originalModel:
|
|
2408
|
-
fallbackModel:
|
|
2409
|
-
reason:
|
|
2410
|
-
message:
|
|
2377
|
+
z19.object({
|
|
2378
|
+
kind: z19.literal("provider.modelFallback"),
|
|
2379
|
+
originalModel: z19.string().min(1),
|
|
2380
|
+
fallbackModel: z19.string().min(1),
|
|
2381
|
+
reason: z19.enum(["refusal", "provider"]),
|
|
2382
|
+
message: z19.string()
|
|
2411
2383
|
}),
|
|
2412
|
-
|
|
2413
|
-
kind:
|
|
2414
|
-
summary:
|
|
2415
|
-
details:
|
|
2384
|
+
z19.object({
|
|
2385
|
+
kind: z19.literal("provider.warning"),
|
|
2386
|
+
summary: z19.string().optional(),
|
|
2387
|
+
details: z19.string().optional(),
|
|
2416
2388
|
category: threadEventWarningCategorySchema.optional(),
|
|
2417
|
-
vouchedTurn:
|
|
2389
|
+
vouchedTurn: z19.boolean().optional()
|
|
2418
2390
|
}),
|
|
2419
|
-
|
|
2420
|
-
kind:
|
|
2391
|
+
z19.object({
|
|
2392
|
+
kind: z19.literal("unhandled"),
|
|
2421
2393
|
raw: providerRawEventSchema,
|
|
2422
|
-
rawType:
|
|
2423
|
-
vouchedTurn:
|
|
2424
|
-
onlyIfNoTurn:
|
|
2394
|
+
rawType: z19.string(),
|
|
2395
|
+
vouchedTurn: z19.boolean(),
|
|
2396
|
+
onlyIfNoTurn: z19.boolean().optional(),
|
|
2425
2397
|
parentRef: deltaKeyPartSchema.optional(),
|
|
2426
2398
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2427
2399
|
}),
|
|
2428
|
-
|
|
2429
|
-
|
|
2400
|
+
z19.object({ kind: z19.literal("session.ended") }),
|
|
2401
|
+
z19.object({ kind: z19.literal("session.reset") })
|
|
2430
2402
|
]);
|
|
2431
|
-
var threadDeltaNotificationParamsSchema =
|
|
2432
|
-
threadId:
|
|
2433
|
-
deltas:
|
|
2403
|
+
var threadDeltaNotificationParamsSchema = z19.object({
|
|
2404
|
+
threadId: z19.string().min(1),
|
|
2405
|
+
deltas: z19.array(threadDeltaSchema)
|
|
2434
2406
|
}).passthrough();
|
|
2435
2407
|
|
|
2436
2408
|
// ../provider-bridge-protocol/src/assembler/delta-assembler.ts
|
|
@@ -2441,17 +2413,17 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2441
2413
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
2442
2414
|
|
|
2443
2415
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2444
|
-
import { z as
|
|
2416
|
+
import { z as z21 } from "zod";
|
|
2445
2417
|
|
|
2446
2418
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
2447
|
-
import { z as
|
|
2448
|
-
var bashArgsSchema =
|
|
2449
|
-
command:
|
|
2450
|
-
cwd:
|
|
2419
|
+
import { z as z20 } from "zod";
|
|
2420
|
+
var bashArgsSchema = z20.object({
|
|
2421
|
+
command: z20.string().optional(),
|
|
2422
|
+
cwd: z20.string().optional()
|
|
2451
2423
|
}).passthrough();
|
|
2452
|
-
var textBlockSchema =
|
|
2453
|
-
type:
|
|
2454
|
-
text:
|
|
2424
|
+
var textBlockSchema = z20.object({
|
|
2425
|
+
type: z20.literal("text"),
|
|
2426
|
+
text: z20.string()
|
|
2455
2427
|
});
|
|
2456
2428
|
|
|
2457
2429
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -2460,10 +2432,10 @@ function isRecord(value) {
|
|
|
2460
2432
|
}
|
|
2461
2433
|
|
|
2462
2434
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2463
|
-
var contentWrapperSchema =
|
|
2464
|
-
content:
|
|
2435
|
+
var contentWrapperSchema = z21.object({
|
|
2436
|
+
content: z21.array(z21.unknown())
|
|
2465
2437
|
}).passthrough();
|
|
2466
|
-
var shellEnvironmentVariableKeySchema =
|
|
2438
|
+
var shellEnvironmentVariableKeySchema = z21.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
2467
2439
|
var MAX_EXACT_LINE_DIFF_CELLS = 1e6;
|
|
2468
2440
|
function splitComparableLines(text) {
|
|
2469
2441
|
const normalized = text.replace(/\r\n?/gu, "\n");
|
|
@@ -4338,11 +4310,11 @@ function assembleCapturedThreadEvents(messages, providerId = "pi") {
|
|
|
4338
4310
|
}
|
|
4339
4311
|
|
|
4340
4312
|
// ../provider-bridge-protocol/src/conformance/client.ts
|
|
4341
|
-
import { z as
|
|
4313
|
+
import { z as z22 } from "zod";
|
|
4342
4314
|
function isWireMessage(value) {
|
|
4343
4315
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4344
4316
|
}
|
|
4345
|
-
var threadDeltaAddressSchema =
|
|
4317
|
+
var threadDeltaAddressSchema = z22.object({ threadId: z22.string() }).passthrough();
|
|
4346
4318
|
var ConformanceClient = class {
|
|
4347
4319
|
constructor(transport, timeoutMs, collector) {
|
|
4348
4320
|
this.transport = transport;
|
|
@@ -4451,11 +4423,11 @@ function nextConformanceClientRequestId() {
|
|
|
4451
4423
|
}
|
|
4452
4424
|
|
|
4453
4425
|
// ../provider-bridge-protocol/src/conformance/scenarios.ts
|
|
4454
|
-
import { z as
|
|
4426
|
+
import { z as z30 } from "zod";
|
|
4455
4427
|
|
|
4456
4428
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
4457
|
-
import { z as
|
|
4458
|
-
var bridgeGrammarVersionsSchema =
|
|
4429
|
+
import { z as z23 } from "zod";
|
|
4430
|
+
var bridgeGrammarVersionsSchema = z23.tuple([z23.number().int().positive(), z23.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
4459
4431
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
4460
4432
|
});
|
|
4461
4433
|
function negotiateGrammarVersion(runtime, bridge) {
|
|
@@ -4463,65 +4435,65 @@ function negotiateGrammarVersion(runtime, bridge) {
|
|
|
4463
4435
|
const max = Math.min(runtime[1], bridge[1]);
|
|
4464
4436
|
return min <= max ? max : null;
|
|
4465
4437
|
}
|
|
4466
|
-
var bridgeSteerModeSchema =
|
|
4467
|
-
var bridgeCapabilitiesSchema =
|
|
4468
|
-
sessionRestore:
|
|
4469
|
-
threadArchive:
|
|
4470
|
-
threadRename:
|
|
4471
|
-
threadGoalClear:
|
|
4438
|
+
var bridgeSteerModeSchema = z23.enum(["inject", "queue"]);
|
|
4439
|
+
var bridgeCapabilitiesSchema = z23.object({
|
|
4440
|
+
sessionRestore: z23.boolean().default(false),
|
|
4441
|
+
threadArchive: z23.boolean().default(false),
|
|
4442
|
+
threadRename: z23.boolean().default(false),
|
|
4443
|
+
threadGoalClear: z23.boolean().default(false),
|
|
4472
4444
|
fork: providerForkSchema.default("none"),
|
|
4473
|
-
approvalEnforcedBy:
|
|
4445
|
+
approvalEnforcedBy: z23.enum(["runtime", "provider"]).default("runtime"),
|
|
4474
4446
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4475
4447
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4476
4448
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4477
4449
|
]),
|
|
4478
4450
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4479
|
-
skills:
|
|
4480
|
-
commands:
|
|
4451
|
+
skills: z23.object({ configure: z23.boolean().default(false) }).default({ configure: false }),
|
|
4452
|
+
commands: z23.object({ list: z23.boolean().default(false) }).default({ list: false })
|
|
4481
4453
|
}).passthrough();
|
|
4482
|
-
var initializeParamsSchema =
|
|
4483
|
-
protocolVersion:
|
|
4484
|
-
client:
|
|
4454
|
+
var initializeParamsSchema = z23.object({
|
|
4455
|
+
protocolVersion: z23.number().int().positive(),
|
|
4456
|
+
client: z23.object({ name: z23.string().min(1), version: z23.string().min(1) }),
|
|
4485
4457
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4486
4458
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4487
4459
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4488
4460
|
])
|
|
4489
4461
|
}).passthrough();
|
|
4490
|
-
var initializeResultSchema =
|
|
4491
|
-
protocolVersion:
|
|
4492
|
-
capabilities:
|
|
4462
|
+
var initializeResultSchema = z23.object({
|
|
4463
|
+
protocolVersion: z23.number().int().positive(),
|
|
4464
|
+
capabilities: z23.preprocess(
|
|
4493
4465
|
(value) => value ?? {},
|
|
4494
4466
|
bridgeCapabilitiesSchema
|
|
4495
4467
|
)
|
|
4496
4468
|
}).passthrough();
|
|
4497
4469
|
|
|
4498
4470
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
4499
|
-
import { z as
|
|
4500
|
-
var bridgeExecutionOptionsSchema =
|
|
4501
|
-
model:
|
|
4471
|
+
import { z as z24 } from "zod";
|
|
4472
|
+
var bridgeExecutionOptionsSchema = z24.object({
|
|
4473
|
+
model: z24.string().min(1).optional(),
|
|
4502
4474
|
serviceTier: serviceTierSchema.optional(),
|
|
4503
4475
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4504
4476
|
promptMode: promptModeSchema.optional(),
|
|
4505
4477
|
sessionOptions: sessionOptionSelectionsSchema.optional(),
|
|
4506
|
-
instructions:
|
|
4507
|
-
envVars:
|
|
4508
|
-
providerOptions:
|
|
4478
|
+
instructions: z24.string().optional(),
|
|
4479
|
+
envVars: z24.record(z24.string(), z24.string()).optional(),
|
|
4480
|
+
providerOptions: z24.record(z24.string(), z24.unknown()).optional()
|
|
4509
4481
|
}).and(runtimePermissionPolicySchema);
|
|
4510
4482
|
|
|
4511
4483
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
4512
|
-
import { z as
|
|
4513
|
-
var providerMaintenanceParamsSchema =
|
|
4514
|
-
providerId:
|
|
4515
|
-
cwd:
|
|
4516
|
-
providerOptions:
|
|
4484
|
+
import { z as z25 } from "zod";
|
|
4485
|
+
var providerMaintenanceParamsSchema = z25.object({
|
|
4486
|
+
providerId: z25.string().min(1),
|
|
4487
|
+
cwd: z25.string().min(1).optional(),
|
|
4488
|
+
providerOptions: z25.record(z25.string(), z25.unknown()).optional()
|
|
4517
4489
|
}).passthrough();
|
|
4518
|
-
var providerInstallationRequirementSchema =
|
|
4490
|
+
var providerInstallationRequirementSchema = z25.enum(["thread_rewind"]);
|
|
4519
4491
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4520
4492
|
requirement: providerInstallationRequirementSchema.optional(),
|
|
4521
|
-
checkUpdates:
|
|
4493
|
+
checkUpdates: z25.boolean().default(true)
|
|
4522
4494
|
});
|
|
4523
|
-
var providerHealthSchema =
|
|
4524
|
-
status:
|
|
4495
|
+
var providerHealthSchema = z25.object({
|
|
4496
|
+
status: z25.enum([
|
|
4525
4497
|
"ready",
|
|
4526
4498
|
"not_installed",
|
|
4527
4499
|
"unauthenticated",
|
|
@@ -4529,115 +4501,115 @@ var providerHealthSchema = z24.object({
|
|
|
4529
4501
|
"unsupported_version",
|
|
4530
4502
|
"unknown"
|
|
4531
4503
|
]),
|
|
4532
|
-
statusMessage:
|
|
4533
|
-
accountEmail:
|
|
4534
|
-
planLabel:
|
|
4535
|
-
installedVersion:
|
|
4536
|
-
minimumSupportedVersion:
|
|
4537
|
-
canInstall:
|
|
4538
|
-
canUpdate:
|
|
4539
|
-
loginCommand:
|
|
4540
|
-
localLoginCommand:
|
|
4504
|
+
statusMessage: z25.string().min(1).nullable(),
|
|
4505
|
+
accountEmail: z25.string().nullable(),
|
|
4506
|
+
planLabel: z25.string().min(1).nullable(),
|
|
4507
|
+
installedVersion: z25.string().min(1).nullable(),
|
|
4508
|
+
minimumSupportedVersion: z25.string().min(1).nullable(),
|
|
4509
|
+
canInstall: z25.boolean(),
|
|
4510
|
+
canUpdate: z25.boolean(),
|
|
4511
|
+
loginCommand: z25.string().min(1).nullable(),
|
|
4512
|
+
localLoginCommand: z25.string().min(1).nullable().optional()
|
|
4541
4513
|
}).passthrough();
|
|
4542
|
-
var providerUsageWindowSchema =
|
|
4543
|
-
label:
|
|
4544
|
-
usedPercent:
|
|
4545
|
-
resetsAt:
|
|
4546
|
-
cost:
|
|
4547
|
-
usedUsdCents:
|
|
4548
|
-
limitUsdCents:
|
|
4514
|
+
var providerUsageWindowSchema = z25.object({
|
|
4515
|
+
label: z25.string().min(1),
|
|
4516
|
+
usedPercent: z25.number().min(0).max(100),
|
|
4517
|
+
resetsAt: z25.string().min(1).nullable(),
|
|
4518
|
+
cost: z25.object({
|
|
4519
|
+
usedUsdCents: z25.number().int().nonnegative(),
|
|
4520
|
+
limitUsdCents: z25.number().int().positive()
|
|
4549
4521
|
}).optional()
|
|
4550
4522
|
}).passthrough();
|
|
4551
|
-
var providerUsageSchema =
|
|
4552
|
-
|
|
4553
|
-
status:
|
|
4554
|
-
accountEmail:
|
|
4555
|
-
planLabel:
|
|
4556
|
-
windows:
|
|
4523
|
+
var providerUsageSchema = z25.discriminatedUnion("status", [
|
|
4524
|
+
z25.object({
|
|
4525
|
+
status: z25.literal("ok"),
|
|
4526
|
+
accountEmail: z25.string().email().nullable(),
|
|
4527
|
+
planLabel: z25.string().min(1).nullable(),
|
|
4528
|
+
windows: z25.array(providerUsageWindowSchema)
|
|
4557
4529
|
}).passthrough(),
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
status:
|
|
4563
|
-
message:
|
|
4564
|
-
planLabel:
|
|
4565
|
-
accountEmail:
|
|
4530
|
+
z25.object({ status: z25.literal("not_installed") }).passthrough(),
|
|
4531
|
+
z25.object({ status: z25.literal("unauthenticated") }).passthrough(),
|
|
4532
|
+
z25.object({ status: z25.literal("expired") }).passthrough(),
|
|
4533
|
+
z25.object({
|
|
4534
|
+
status: z25.literal("error"),
|
|
4535
|
+
message: z25.string().min(1),
|
|
4536
|
+
planLabel: z25.string().min(1).nullable().default(null),
|
|
4537
|
+
accountEmail: z25.string().nullable().default(null)
|
|
4566
4538
|
}).passthrough()
|
|
4567
4539
|
]);
|
|
4568
|
-
var providerHealthResultSchema =
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
supported:
|
|
4540
|
+
var providerHealthResultSchema = z25.discriminatedUnion("supported", [
|
|
4541
|
+
z25.object({ supported: z25.literal(false) }).passthrough(),
|
|
4542
|
+
z25.object({
|
|
4543
|
+
supported: z25.literal(true),
|
|
4572
4544
|
health: providerHealthSchema
|
|
4573
4545
|
}).passthrough()
|
|
4574
4546
|
]);
|
|
4575
|
-
var providerUsageResultSchema =
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
supported:
|
|
4547
|
+
var providerUsageResultSchema = z25.discriminatedUnion("supported", [
|
|
4548
|
+
z25.object({ supported: z25.literal(false) }).passthrough(),
|
|
4549
|
+
z25.object({
|
|
4550
|
+
supported: z25.literal(true),
|
|
4579
4551
|
usage: providerUsageSchema
|
|
4580
4552
|
}).passthrough()
|
|
4581
4553
|
]);
|
|
4582
|
-
var providerInstallationActionKindSchema =
|
|
4554
|
+
var providerInstallationActionKindSchema = z25.enum([
|
|
4583
4555
|
"install",
|
|
4584
4556
|
"update"
|
|
4585
4557
|
]);
|
|
4586
|
-
var providerInstallationActionSchema =
|
|
4558
|
+
var providerInstallationActionSchema = z25.object({
|
|
4587
4559
|
kind: providerInstallationActionKindSchema,
|
|
4588
|
-
label:
|
|
4589
|
-
command:
|
|
4560
|
+
label: z25.enum(["Install", "Update"]),
|
|
4561
|
+
command: z25.string().min(1)
|
|
4590
4562
|
}).passthrough();
|
|
4591
|
-
var providerInstallationSourceSchema =
|
|
4563
|
+
var providerInstallationSourceSchema = z25.enum([
|
|
4592
4564
|
"notInstalled",
|
|
4593
4565
|
"npmGlobal",
|
|
4594
4566
|
"external"
|
|
4595
4567
|
]);
|
|
4596
|
-
var providerInstallationStatusSchema =
|
|
4597
|
-
executableName:
|
|
4598
|
-
executablePath:
|
|
4599
|
-
installed:
|
|
4568
|
+
var providerInstallationStatusSchema = z25.object({
|
|
4569
|
+
executableName: z25.string().min(1),
|
|
4570
|
+
executablePath: z25.string().min(1).nullable(),
|
|
4571
|
+
installed: z25.boolean(),
|
|
4600
4572
|
installSource: providerInstallationSourceSchema,
|
|
4601
|
-
currentVersion:
|
|
4602
|
-
latestVersion:
|
|
4603
|
-
minimumSupportedVersion:
|
|
4604
|
-
npmPackageName:
|
|
4605
|
-
npmGlobalPackageVersion:
|
|
4573
|
+
currentVersion: z25.string().min(1).nullable(),
|
|
4574
|
+
latestVersion: z25.string().min(1).nullable(),
|
|
4575
|
+
minimumSupportedVersion: z25.string().min(1).nullable(),
|
|
4576
|
+
npmPackageName: z25.string().min(1).nullable(),
|
|
4577
|
+
npmGlobalPackageVersion: z25.string().min(1).nullable(),
|
|
4606
4578
|
installAction: providerInstallationActionSchema.nullable(),
|
|
4607
|
-
needsUpdate:
|
|
4608
|
-
versionUnsupported:
|
|
4579
|
+
needsUpdate: z25.boolean(),
|
|
4580
|
+
versionUnsupported: z25.boolean()
|
|
4609
4581
|
}).passthrough();
|
|
4610
4582
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4611
4583
|
action: providerInstallationActionKindSchema
|
|
4612
4584
|
});
|
|
4613
|
-
var providerInstallationCommandSchema =
|
|
4614
|
-
command:
|
|
4615
|
-
args:
|
|
4616
|
-
displayCommand:
|
|
4585
|
+
var providerInstallationCommandSchema = z25.object({
|
|
4586
|
+
command: z25.string().min(1),
|
|
4587
|
+
args: z25.array(z25.string()).max(64),
|
|
4588
|
+
displayCommand: z25.string().min(1)
|
|
4617
4589
|
}).passthrough();
|
|
4618
|
-
var providerInstallationVerificationSchema =
|
|
4590
|
+
var providerInstallationVerificationSchema = z25.discriminatedUnion(
|
|
4619
4591
|
"kind",
|
|
4620
4592
|
[
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
kind:
|
|
4624
|
-
previousVersion:
|
|
4593
|
+
z25.object({ kind: z25.literal("installed") }).passthrough(),
|
|
4594
|
+
z25.object({
|
|
4595
|
+
kind: z25.literal("version_changed"),
|
|
4596
|
+
previousVersion: z25.string().min(1)
|
|
4625
4597
|
}).passthrough(),
|
|
4626
|
-
|
|
4627
|
-
kind:
|
|
4628
|
-
version:
|
|
4598
|
+
z25.object({
|
|
4599
|
+
kind: z25.literal("version_at_least"),
|
|
4600
|
+
version: z25.string().min(1)
|
|
4629
4601
|
}).passthrough()
|
|
4630
4602
|
]
|
|
4631
4603
|
);
|
|
4632
|
-
var providerInstallationRunResultSchema =
|
|
4604
|
+
var providerInstallationRunResultSchema = z25.discriminatedUnion(
|
|
4633
4605
|
"available",
|
|
4634
4606
|
[
|
|
4635
|
-
|
|
4636
|
-
available:
|
|
4637
|
-
message:
|
|
4607
|
+
z25.object({
|
|
4608
|
+
available: z25.literal(false),
|
|
4609
|
+
message: z25.string().min(1)
|
|
4638
4610
|
}).passthrough(),
|
|
4639
|
-
|
|
4640
|
-
available:
|
|
4611
|
+
z25.object({
|
|
4612
|
+
available: z25.literal(true),
|
|
4641
4613
|
command: providerInstallationCommandSchema,
|
|
4642
4614
|
verification: providerInstallationVerificationSchema
|
|
4643
4615
|
}).passthrough()
|
|
@@ -4645,7 +4617,7 @@ var providerInstallationRunResultSchema = z24.discriminatedUnion(
|
|
|
4645
4617
|
);
|
|
4646
4618
|
|
|
4647
4619
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4648
|
-
import { z as
|
|
4620
|
+
import { z as z26 } from "zod";
|
|
4649
4621
|
var BRIDGE_REQUEST_METHODS = {
|
|
4650
4622
|
initialize: "initialize",
|
|
4651
4623
|
modelList: "model/list",
|
|
@@ -4668,81 +4640,81 @@ var BRIDGE_REQUEST_METHODS = {
|
|
|
4668
4640
|
skillsConfigure: "skills/configure"
|
|
4669
4641
|
};
|
|
4670
4642
|
var sessionConstructionFields = {
|
|
4671
|
-
threadId:
|
|
4672
|
-
cwd:
|
|
4643
|
+
threadId: z26.string().min(1),
|
|
4644
|
+
cwd: z26.string().min(1),
|
|
4673
4645
|
options: bridgeExecutionOptionsSchema,
|
|
4674
|
-
dynamicTools:
|
|
4675
|
-
disallowedTools:
|
|
4646
|
+
dynamicTools: z26.array(dynamicToolSchema).optional(),
|
|
4647
|
+
disallowedTools: z26.array(z26.string().min(1)).optional(),
|
|
4676
4648
|
instructionMode: instructionModeSchema
|
|
4677
4649
|
};
|
|
4678
|
-
var modelListParamsSchema =
|
|
4679
|
-
cwd:
|
|
4680
|
-
envVars:
|
|
4650
|
+
var modelListParamsSchema = z26.object({
|
|
4651
|
+
cwd: z26.string().min(1).optional(),
|
|
4652
|
+
envVars: z26.record(z26.string(), z26.string()).optional()
|
|
4681
4653
|
}).passthrough();
|
|
4682
|
-
var commandListParamsSchema =
|
|
4683
|
-
var threadStartParamsSchema =
|
|
4654
|
+
var commandListParamsSchema = z26.object({ cwd: z26.string().min(1) }).passthrough();
|
|
4655
|
+
var threadStartParamsSchema = z26.object({
|
|
4684
4656
|
...sessionConstructionFields,
|
|
4685
|
-
input:
|
|
4657
|
+
input: z26.array(promptInputSchema).optional()
|
|
4686
4658
|
}).passthrough();
|
|
4687
|
-
var threadResumeParamsSchema =
|
|
4659
|
+
var threadResumeParamsSchema = z26.object({
|
|
4688
4660
|
...sessionConstructionFields,
|
|
4689
|
-
providerThreadId:
|
|
4661
|
+
providerThreadId: z26.string().min(1)
|
|
4690
4662
|
}).passthrough();
|
|
4691
|
-
var threadForkParamsSchema =
|
|
4663
|
+
var threadForkParamsSchema = z26.object({
|
|
4692
4664
|
...sessionConstructionFields,
|
|
4693
|
-
sourceProviderThreadId:
|
|
4694
|
-
sourceProviderCheckpointId:
|
|
4665
|
+
sourceProviderThreadId: z26.string().min(1),
|
|
4666
|
+
sourceProviderCheckpointId: z26.string().min(1).optional()
|
|
4695
4667
|
}).passthrough();
|
|
4696
|
-
var threadStopParamsSchema =
|
|
4697
|
-
threadId:
|
|
4698
|
-
providerThreadId:
|
|
4699
|
-
intent:
|
|
4700
|
-
activeTurnId:
|
|
4668
|
+
var threadStopParamsSchema = z26.object({
|
|
4669
|
+
threadId: z26.string().min(1),
|
|
4670
|
+
providerThreadId: z26.string().min(1),
|
|
4671
|
+
intent: z26.enum(["interrupt", "release"]),
|
|
4672
|
+
activeTurnId: z26.string().min(1).nullable()
|
|
4701
4673
|
}).passthrough();
|
|
4702
|
-
var threadRefParams =
|
|
4703
|
-
threadId:
|
|
4704
|
-
providerThreadId:
|
|
4674
|
+
var threadRefParams = z26.object({
|
|
4675
|
+
threadId: z26.string().min(1),
|
|
4676
|
+
providerThreadId: z26.string().min(1)
|
|
4705
4677
|
}).passthrough();
|
|
4706
|
-
var threadNameSetParamsSchema =
|
|
4707
|
-
threadId:
|
|
4708
|
-
providerThreadId:
|
|
4709
|
-
title:
|
|
4678
|
+
var threadNameSetParamsSchema = z26.object({
|
|
4679
|
+
threadId: z26.string().min(1),
|
|
4680
|
+
providerThreadId: z26.string().min(1),
|
|
4681
|
+
title: z26.string().min(1)
|
|
4710
4682
|
}).passthrough();
|
|
4711
4683
|
var turnInputFields = {
|
|
4712
|
-
threadId:
|
|
4713
|
-
providerThreadId:
|
|
4714
|
-
input:
|
|
4684
|
+
threadId: z26.string().min(1),
|
|
4685
|
+
providerThreadId: z26.string().min(1),
|
|
4686
|
+
input: z26.array(promptInputSchema),
|
|
4715
4687
|
clientRequestId: clientTurnRequestIdSchema,
|
|
4716
4688
|
options: bridgeExecutionOptionsSchema
|
|
4717
4689
|
};
|
|
4718
|
-
var turnStartParamsSchema =
|
|
4719
|
-
var turnSteerParamsSchema =
|
|
4690
|
+
var turnStartParamsSchema = z26.object(turnInputFields).passthrough();
|
|
4691
|
+
var turnSteerParamsSchema = z26.object({
|
|
4720
4692
|
...turnInputFields,
|
|
4721
|
-
expectedTurnId:
|
|
4693
|
+
expectedTurnId: z26.string().min(1)
|
|
4722
4694
|
}).passthrough();
|
|
4723
|
-
var skillsConfigureRootSchema =
|
|
4724
|
-
id:
|
|
4725
|
-
path:
|
|
4726
|
-
skills:
|
|
4727
|
-
|
|
4728
|
-
name:
|
|
4729
|
-
description:
|
|
4695
|
+
var skillsConfigureRootSchema = z26.object({
|
|
4696
|
+
id: z26.string().min(1),
|
|
4697
|
+
path: z26.string().min(1),
|
|
4698
|
+
skills: z26.array(
|
|
4699
|
+
z26.object({
|
|
4700
|
+
name: z26.string().min(1),
|
|
4701
|
+
description: z26.string()
|
|
4730
4702
|
}).passthrough()
|
|
4731
4703
|
)
|
|
4732
4704
|
}).passthrough();
|
|
4733
|
-
var skillsConfigureParamsSchema =
|
|
4734
|
-
roots:
|
|
4705
|
+
var skillsConfigureParamsSchema = z26.object({
|
|
4706
|
+
roots: z26.array(skillsConfigureRootSchema)
|
|
4735
4707
|
}).passthrough();
|
|
4736
|
-
var threadIdentityResultSchema =
|
|
4737
|
-
providerThreadId:
|
|
4738
|
-
sessionRestorable:
|
|
4708
|
+
var threadIdentityResultSchema = z26.object({
|
|
4709
|
+
providerThreadId: z26.string().min(1),
|
|
4710
|
+
sessionRestorable: z26.boolean().optional()
|
|
4739
4711
|
}).passthrough();
|
|
4740
4712
|
|
|
4741
4713
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4742
|
-
import { z as
|
|
4714
|
+
import { z as z28 } from "zod";
|
|
4743
4715
|
|
|
4744
4716
|
// ../provider-bridge-protocol/src/errors.ts
|
|
4745
|
-
import { z as
|
|
4717
|
+
import { z as z27 } from "zod";
|
|
4746
4718
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
4747
4719
|
INVALID_PARAMS: -32602,
|
|
4748
4720
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -4752,12 +4724,12 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4752
4724
|
FORK_CHECKPOINT_UNSUPPORTED: -32003,
|
|
4753
4725
|
MISSING_EXECUTABLE: -32004
|
|
4754
4726
|
};
|
|
4755
|
-
var providerRecoveryHintSchema =
|
|
4727
|
+
var providerRecoveryHintSchema = z27.object({
|
|
4756
4728
|
kind: providerRecoveryKindSchema,
|
|
4757
|
-
message:
|
|
4758
|
-
retryable:
|
|
4729
|
+
message: z27.string().min(1),
|
|
4730
|
+
retryable: z27.boolean()
|
|
4759
4731
|
});
|
|
4760
|
-
var bridgeErrorDataSchema =
|
|
4732
|
+
var bridgeErrorDataSchema = z27.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4761
4733
|
|
|
4762
4734
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4763
4735
|
var BRIDGE_NOTIFICATION_METHODS = {
|
|
@@ -4767,57 +4739,57 @@ var BRIDGE_NOTIFICATION_METHODS = {
|
|
|
4767
4739
|
providerRecovery: "provider/recovery",
|
|
4768
4740
|
error: "error"
|
|
4769
4741
|
};
|
|
4770
|
-
var threadIdentityNotificationSchema =
|
|
4771
|
-
threadId:
|
|
4772
|
-
providerThreadId:
|
|
4773
|
-
sessionRestorable:
|
|
4742
|
+
var threadIdentityNotificationSchema = z28.object({
|
|
4743
|
+
threadId: z28.string().min(1),
|
|
4744
|
+
providerThreadId: z28.string().min(1),
|
|
4745
|
+
sessionRestorable: z28.boolean().optional()
|
|
4774
4746
|
}).passthrough();
|
|
4775
|
-
var sessionReplacedNotificationSchema =
|
|
4776
|
-
threadId:
|
|
4777
|
-
providerThreadId:
|
|
4778
|
-
reason:
|
|
4779
|
-
contextLost:
|
|
4780
|
-
showRuntimeNote:
|
|
4747
|
+
var sessionReplacedNotificationSchema = z28.object({
|
|
4748
|
+
threadId: z28.string().min(1),
|
|
4749
|
+
providerThreadId: z28.string().min(1).nullable(),
|
|
4750
|
+
reason: z28.string().min(1),
|
|
4751
|
+
contextLost: z28.boolean().default(false),
|
|
4752
|
+
showRuntimeNote: z28.boolean().default(false)
|
|
4781
4753
|
}).passthrough();
|
|
4782
|
-
var providerRecoveryNotificationSchema =
|
|
4783
|
-
threadId:
|
|
4754
|
+
var providerRecoveryNotificationSchema = z28.object({
|
|
4755
|
+
threadId: z28.string().min(1).optional(),
|
|
4784
4756
|
...providerRecoveryHintSchema.shape
|
|
4785
4757
|
}).passthrough();
|
|
4786
|
-
var errorNotificationSchema =
|
|
4787
|
-
threadId:
|
|
4788
|
-
providerThreadId:
|
|
4789
|
-
message:
|
|
4758
|
+
var errorNotificationSchema = z28.object({
|
|
4759
|
+
threadId: z28.string().min(1).optional(),
|
|
4760
|
+
providerThreadId: z28.string().min(1).optional(),
|
|
4761
|
+
message: z28.string().min(1)
|
|
4790
4762
|
}).passthrough();
|
|
4791
4763
|
|
|
4792
4764
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
4793
|
-
import { z as
|
|
4794
|
-
var toolCallRequestParamsSchema =
|
|
4795
|
-
providerThreadId:
|
|
4796
|
-
threadId:
|
|
4797
|
-
turnId:
|
|
4798
|
-
callId:
|
|
4799
|
-
tool:
|
|
4800
|
-
arguments:
|
|
4801
|
-
providerNativeIds:
|
|
4765
|
+
import { z as z29 } from "zod";
|
|
4766
|
+
var toolCallRequestParamsSchema = z29.object({
|
|
4767
|
+
providerThreadId: z29.string().min(1),
|
|
4768
|
+
threadId: z29.string().min(1).optional(),
|
|
4769
|
+
turnId: z29.union([z29.string().min(1), z29.null()]),
|
|
4770
|
+
callId: z29.string().min(1),
|
|
4771
|
+
tool: z29.string().min(1),
|
|
4772
|
+
arguments: z29.unknown(),
|
|
4773
|
+
providerNativeIds: z29.boolean().optional()
|
|
4802
4774
|
}).passthrough();
|
|
4803
|
-
var toolCallResultSchema =
|
|
4804
|
-
success:
|
|
4805
|
-
contentItems:
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
type:
|
|
4810
|
-
imageUrl:
|
|
4775
|
+
var toolCallResultSchema = z29.object({
|
|
4776
|
+
success: z29.boolean(),
|
|
4777
|
+
contentItems: z29.array(
|
|
4778
|
+
z29.discriminatedUnion("type", [
|
|
4779
|
+
z29.object({ type: z29.literal("inputText"), text: z29.string() }),
|
|
4780
|
+
z29.object({
|
|
4781
|
+
type: z29.literal("inputImage"),
|
|
4782
|
+
imageUrl: z29.string().min(1)
|
|
4811
4783
|
})
|
|
4812
4784
|
])
|
|
4813
4785
|
)
|
|
4814
4786
|
}).passthrough();
|
|
4815
|
-
var interactionRequestParamsSchema =
|
|
4816
|
-
providerThreadId:
|
|
4817
|
-
threadId:
|
|
4818
|
-
turnId:
|
|
4787
|
+
var interactionRequestParamsSchema = z29.object({
|
|
4788
|
+
providerThreadId: z29.string().min(1),
|
|
4789
|
+
threadId: z29.string().min(1).optional(),
|
|
4790
|
+
turnId: z29.union([z29.string().min(1), z29.null()]),
|
|
4819
4791
|
payload: pendingInteractionPayloadSchema,
|
|
4820
|
-
providerNativeIds:
|
|
4792
|
+
providerNativeIds: z29.boolean().optional()
|
|
4821
4793
|
}).passthrough();
|
|
4822
4794
|
|
|
4823
4795
|
// ../provider-bridge-protocol/src/thread-event-grammar.ts
|
|
@@ -4973,7 +4945,7 @@ var IDENTITY_RESULT_SHAPE = "{ providerThreadId, sessionRestorable? }";
|
|
|
4973
4945
|
function identityProblem(parsed, result2) {
|
|
4974
4946
|
return `the result must be ${IDENTITY_RESULT_SHAPE} \u2014 the runtime adopts no session without providerThreadId on the result (a thread/identity notification does not substitute for it); issues: ${parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")} (got ${JSON.stringify(result2)})`;
|
|
4975
4947
|
}
|
|
4976
|
-
var identityNotificationParamsSchema =
|
|
4948
|
+
var identityNotificationParamsSchema = z30.object({ threadId: z30.string(), providerThreadId: z30.string() }).passthrough();
|
|
4977
4949
|
async function checkIdentityAnnounced(context, args) {
|
|
4978
4950
|
const { client } = context;
|
|
4979
4951
|
const announced = await client.waitFor(() => {
|
|
@@ -5024,7 +4996,7 @@ function threadEvents(context, threadId) {
|
|
|
5024
4996
|
context.client.drainIntoLog();
|
|
5025
4997
|
return context.client.events.filter((entry) => entry.threadId === threadId).map((entry) => entry.event);
|
|
5026
4998
|
}
|
|
5027
|
-
var persistedEventSchema =
|
|
4999
|
+
var persistedEventSchema = z30.preprocess(
|
|
5028
5000
|
(event) => JSON.parse(JSON.stringify(event)),
|
|
5029
5001
|
threadEventSchema
|
|
5030
5002
|
);
|
|
@@ -6144,26 +6116,26 @@ function formatConformanceReport(report) {
|
|
|
6144
6116
|
}
|
|
6145
6117
|
|
|
6146
6118
|
// ../provider-bridge-protocol/src/testing/bridge-json-rpc-test-helpers.ts
|
|
6147
|
-
import { z as
|
|
6148
|
-
var bridgeJsonRpcValueSchema =
|
|
6149
|
-
() =>
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6119
|
+
import { z as z31 } from "zod";
|
|
6120
|
+
var bridgeJsonRpcValueSchema = z31.lazy(
|
|
6121
|
+
() => z31.union([
|
|
6122
|
+
z31.string(),
|
|
6123
|
+
z31.number(),
|
|
6124
|
+
z31.boolean(),
|
|
6125
|
+
z31.null(),
|
|
6126
|
+
z31.array(bridgeJsonRpcValueSchema),
|
|
6127
|
+
z31.record(z31.string(), bridgeJsonRpcValueSchema)
|
|
6156
6128
|
])
|
|
6157
6129
|
);
|
|
6158
|
-
var bridgeJsonRpcOutputSchema =
|
|
6159
|
-
jsonrpc:
|
|
6160
|
-
id:
|
|
6161
|
-
method:
|
|
6130
|
+
var bridgeJsonRpcOutputSchema = z31.object({
|
|
6131
|
+
jsonrpc: z31.literal("2.0"),
|
|
6132
|
+
id: z31.union([z31.string(), z31.number()]).optional(),
|
|
6133
|
+
method: z31.string().optional(),
|
|
6162
6134
|
params: bridgeJsonRpcValueSchema.optional(),
|
|
6163
6135
|
result: bridgeJsonRpcValueSchema.optional(),
|
|
6164
|
-
error:
|
|
6165
|
-
code:
|
|
6166
|
-
message:
|
|
6136
|
+
error: z31.object({
|
|
6137
|
+
code: z31.number(),
|
|
6138
|
+
message: z31.string(),
|
|
6167
6139
|
data: bridgeJsonRpcValueSchema.optional()
|
|
6168
6140
|
}).optional()
|
|
6169
6141
|
});
|