@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.
@@ -329,241 +329,291 @@ var backgroundTaskUsageSchema = z5.object({
329
329
  durationMs: z5.number()
330
330
  });
331
331
 
332
- // ../domain/src/provider-event.ts
333
- import { z as z14 } from "zod";
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/plugin-interaction-limits.ts
342
- var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
343
- var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
344
- var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
345
- function jsonByteLength(value) {
346
- return new TextEncoder().encode(JSON.stringify(value)).length;
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 z6 } from "zod";
389
+ import { z as z8 } from "zod";
351
390
  var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
352
- var threadEventItemPresentationLabelSchema = z6.object({
353
- pending: z6.string().min(1),
354
- completed: z6.string().min(1)
391
+ var threadEventItemPresentationLabelSchema = z8.object({
392
+ pending: z8.string().min(1),
393
+ completed: z8.string().min(1)
355
394
  });
356
- var threadEventItemPresentationIconSchema = z6.object({
357
- glyph: z6.string().min(1)
395
+ var threadEventItemPresentationIconSchema = z8.object({
396
+ glyph: z8.string().min(1)
358
397
  });
359
- var threadEventItemPresentationTintSchema = z6.object({
360
- light: z6.string().min(1),
361
- dark: z6.string().min(1)
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 = z6.object({
365
- glyph: z6.string().min(1),
366
- label: z6.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
367
- hint: z6.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
368
- tone: z6.enum(["neutral", "destructive"])
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 = z6.object({
409
+ var threadEventItemPresentationSchema = z8.object({
371
410
  label: threadEventItemPresentationLabelSchema,
372
411
  icon: threadEventItemPresentationIconSchema,
373
- title: z6.string().optional(),
374
- detail: z6.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
375
- suppress: z6.boolean().optional(),
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 z7 } from "zod";
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 = z7.string().refine(isExtensionKind, {
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 = z8.enum([
441
+ var pendingInteractionStatusSchema = z10.enum([
392
442
  "pending",
393
443
  "resolving",
394
444
  "resolved",
395
445
  "interrupted"
396
446
  ]);
397
- var pendingInteractionCommandActionSchema = z8.discriminatedUnion(
447
+ var pendingInteractionCommandActionSchema = z10.discriminatedUnion(
398
448
  "type",
399
449
  [
400
- z8.object({
401
- type: z8.literal("read"),
402
- command: z8.string(),
403
- name: z8.string(),
404
- path: z8.string()
450
+ z10.object({
451
+ type: z10.literal("read"),
452
+ command: z10.string(),
453
+ name: z10.string(),
454
+ path: z10.string()
405
455
  }),
406
- z8.object({
407
- type: z8.literal("listFiles"),
408
- command: z8.string(),
409
- path: z8.string().nullable()
456
+ z10.object({
457
+ type: z10.literal("listFiles"),
458
+ command: z10.string(),
459
+ path: z10.string().nullable()
410
460
  }),
411
- z8.object({
412
- type: z8.literal("search"),
413
- command: z8.string(),
414
- query: z8.string().nullable(),
415
- path: z8.string().nullable()
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
- z8.object({
418
- type: z8.literal("unknown"),
419
- command: z8.string()
467
+ z10.object({
468
+ type: z10.literal("unknown"),
469
+ command: z10.string()
420
470
  })
421
471
  ]
422
472
  );
423
- var pendingInteractionNetworkPermissionsSchema = z8.object({
424
- enabled: z8.boolean().nullable()
473
+ var pendingInteractionNetworkPermissionsSchema = z10.object({
474
+ enabled: z10.boolean().nullable()
425
475
  });
426
- var pendingInteractionFileSystemPermissionsSchema = z8.object({
427
- read: z8.array(z8.string()),
428
- write: z8.array(z8.string())
476
+ var pendingInteractionFileSystemPermissionsSchema = z10.object({
477
+ read: z10.array(z10.string()),
478
+ write: z10.array(z10.string())
429
479
  });
430
- var pendingInteractionMacOsPreferencesPermissionSchema = z8.enum([
480
+ var pendingInteractionMacOsPreferencesPermissionSchema = z10.enum([
431
481
  "none",
432
482
  "read_only",
433
483
  "read_write"
434
484
  ]);
435
- var pendingInteractionMacOsContactsPermissionSchema = z8.enum([
485
+ var pendingInteractionMacOsContactsPermissionSchema = z10.enum([
436
486
  "none",
437
487
  "read_only",
438
488
  "read_write"
439
489
  ]);
440
- var pendingInteractionMacOsAutomationPermissionSchema = z8.union([
441
- z8.literal("none"),
442
- z8.literal("all"),
443
- z8.object({
444
- kind: z8.literal("bundle_ids"),
445
- bundleIds: z8.array(z8.string())
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 = z8.object({
498
+ var pendingInteractionMacOsPermissionsSchema = z10.object({
449
499
  preferences: pendingInteractionMacOsPreferencesPermissionSchema,
450
500
  automations: pendingInteractionMacOsAutomationPermissionSchema,
451
- launchServices: z8.boolean(),
452
- accessibility: z8.boolean(),
453
- calendar: z8.boolean(),
454
- reminders: z8.boolean(),
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 = z8.object({
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 = z8.object({
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 = z8.enum([
517
+ var pendingInteractionApprovalDecisionSchema = z10.enum([
468
518
  "allow_once",
469
519
  "allow_for_session",
470
520
  "deny"
471
521
  ]);
472
- var pendingInteractionFileChangeWriteScopeSchema = z8.string().min(1);
473
- var pendingInteractionCommandApprovalSubjectSchema = z8.object({
474
- kind: z8.literal("command"),
475
- itemId: z8.string().min(1),
476
- command: z8.string().min(1),
477
- cwd: z8.string().nullable(),
478
- actions: z8.array(pendingInteractionCommandActionSchema),
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 = z8.object({
482
- kind: z8.literal("file_change"),
483
- itemId: z8.string().min(1),
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 = z8.object({
488
- kind: z8.literal("permission_grant"),
489
- itemId: z8.string().min(1),
490
- toolName: z8.string().nullable(),
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 = z8.object({
494
- kind: z8.literal("plan"),
495
- itemId: z8.string().min(1),
496
- plan: z8.string().min(1),
497
- planFilePath: z8.string().min(1).nullable()
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 = z8.object({
500
- kind: z8.literal("tool_use"),
501
- itemId: z8.string().min(1),
502
- tool: z8.string().min(1),
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 = z8.discriminatedUnion("kind", [
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 = z8.object({
513
- kind: z8.literal("approval"),
562
+ var approvalPendingInteractionPayloadSchema = z10.object({
563
+ kind: z10.literal("approval"),
514
564
  subject: pendingInteractionApprovalSubjectSchema,
515
- reason: z8.string().nullable(),
516
- availableDecisions: z8.array(pendingInteractionApprovalDecisionSchema).min(1)
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).refine((value) => value.trim().length > 0, {
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 = z8.string().min(1).max(
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 = z8.object({
596
+ var pendingInteractionUserQuestionOptionSchema = z10.object({
547
597
  value: pendingInteractionUserQuestionOptionValueSchema,
548
598
  label: pendingInteractionUserQuestionOptionLabelSchema,
549
599
  description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
550
600
  });
551
- var pendingInteractionUserQuestionQuestionSchema = z8.object({
601
+ var pendingInteractionUserQuestionQuestionSchema = z10.object({
552
602
  id: pendingInteractionUserQuestionIdSchema,
553
603
  prompt: pendingInteractionUserQuestionPromptSchema,
554
604
  shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
555
- multiSelect: z8.boolean(),
556
- options: z8.array(pendingInteractionUserQuestionOptionSchema).max(
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: z8.boolean()
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: z8.ZodIssueCode.custom,
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 = z8.object({
582
- kind: z8.literal("user_question"),
583
- questions: z8.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
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: z8.ZodIssueCode.custom,
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 = z8.object({
602
- kind: z8.literal("plugin"),
603
- title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
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 = z8.object({
657
+ var pluginExtensionInteractionRequestPayloadSchema = z10.object({
608
658
  kind: extensionKindSchema,
609
- title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
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 = z8.union([
665
+ var interactionRequestPayloadSchema = z10.union([
616
666
  userQuestionPendingInteractionPayloadSchema,
617
667
  pluginExtensionInteractionRequestPayloadSchema
618
668
  ]);
619
- var pendingInteractionPayloadSchema = z8.union([
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 = z8.discriminatedUnion(
675
+ var approvalPendingInteractionResolutionSchema = z10.discriminatedUnion(
626
676
  "decision",
627
677
  [
628
- z8.object({
629
- decision: z8.literal("allow_once"),
678
+ z10.object({
679
+ decision: z10.literal("allow_once"),
630
680
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
631
681
  }),
632
- z8.object({
633
- decision: z8.literal("allow_for_session"),
682
+ z10.object({
683
+ decision: z10.literal("allow_for_session"),
634
684
  grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
635
685
  }),
636
- z8.object({
637
- decision: z8.literal("deny")
686
+ z10.object({
687
+ decision: z10.literal("deny")
638
688
  })
639
689
  ],
640
690
  approvalDecisionDiscriminatorError
641
691
  );
642
- var pendingInteractionUserAnswerSchema = z8.object({
643
- selected: z8.array(z8.string().min(1)).max(
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 = z8.object({
650
- kind: z8.literal("user_answer"),
651
- answers: z8.record(z8.string().min(1), pendingInteractionUserAnswerSchema)
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 = z8.object({
654
- title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH).optional(),
655
- detail: z8.string().trim().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
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 = z8.object({
662
- kind: z8.literal("plugin_submitted"),
711
+ var pluginPendingInteractionResolutionSchema = z10.object({
712
+ kind: z10.literal("plugin_submitted"),
663
713
  description: pluginInteractionDescriptionSchema.optional()
664
714
  });
665
- var pluginExtensionInteractionResolutionSchema = z8.object({
666
- kind: z8.literal("request_answer"),
715
+ var pluginExtensionInteractionResolutionSchema = z10.object({
716
+ kind: z10.literal("request_answer"),
667
717
  value: jsonValueSchema
668
718
  });
669
- var pendingInteractionResolutionSchema = z8.union(
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 = z8.object({
728
+ var approvalInteractionOutcomeSchema = z10.object({
679
729
  payload: approvalPendingInteractionPayloadSchema,
680
730
  resolution: approvalPendingInteractionResolutionSchema
681
731
  });
682
- var userQuestionInteractionOutcomeSchema = z8.object({
732
+ var userQuestionInteractionOutcomeSchema = z10.object({
683
733
  payload: userQuestionPendingInteractionPayloadSchema,
684
734
  resolution: userQuestionPendingInteractionResolutionSchema
685
735
  });
686
- var pluginExtensionInteractionOutcomeSchema = z8.object({
736
+ var pluginExtensionInteractionOutcomeSchema = z10.object({
687
737
  payload: pluginExtensionInteractionRequestPayloadSchema,
688
738
  resolution: pluginExtensionInteractionResolutionSchema
689
739
  });
690
- var providerInteractionOutcomeSchema = z8.union([
740
+ var providerInteractionOutcomeSchema = z10.union([
691
741
  approvalInteractionOutcomeSchema,
692
742
  userQuestionInteractionOutcomeSchema,
693
743
  pluginExtensionInteractionOutcomeSchema
694
744
  ]);
695
- var pendingInteractionProviderOriginSchema = z8.object({
696
- kind: z8.literal("provider"),
697
- providerId: z8.string().min(1),
698
- providerThreadId: z8.string().min(1),
699
- providerRequestId: z8.string().min(1)
700
- });
701
- var pendingInteractionPluginOriginSchema = z8.object({
702
- kind: z8.literal("plugin"),
703
- pluginId: z8.string().min(1),
704
- rendererId: z8.string().min(1)
705
- });
706
- var pendingInteractionCreateSchema = z8.object({
707
- threadId: z8.string().min(1),
708
- turnId: z8.string().min(1),
709
- providerId: z8.string().min(1),
710
- providerThreadId: z8.string().min(1),
711
- providerRequestId: z8.string().min(1),
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 = z8.object({
715
- id: z8.string().min(1),
716
- threadId: z8.string().min(1),
764
+ var pendingInteractionBaseSchema = z10.object({
765
+ id: z10.string().min(1),
766
+ threadId: z10.string().min(1),
717
767
  status: pendingInteractionStatusSchema,
718
- statusReason: z8.string().nullable(),
719
- createdAt: z8.number().int().nonnegative(),
720
- expiresAt: z8.number().int().nonnegative().nullable().optional(),
721
- resolvedAt: z8.number().int().nonnegative().nullable()
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: z8.string().min(1),
725
- providerId: z8.string().min(1),
726
- providerThreadId: z8.string().min(1),
727
- providerRequestId: z8.string().min(1),
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 = z8.union([
792
+ var providerPendingInteractionSchema = z10.union([
743
793
  approvalPendingInteractionSchema,
744
794
  userQuestionPendingInteractionSchema,
745
795
  pluginExtensionPendingInteractionSchema
746
796
  ]);
747
797
  var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
748
- turnId: z8.string().min(1).nullable(),
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 = z8.union([
803
+ var pendingInteractionSchema = z10.union([
754
804
  providerPendingInteractionSchema,
755
805
  pluginPendingInteractionSchema
756
806
  ]);
757
- var interactionLifecycleRecordBaseSchema = z8.object({
758
- id: z8.string().min(1),
807
+ var interactionLifecycleRecordBaseSchema = z10.object({
808
+ id: z10.string().min(1),
759
809
  status: pendingInteractionStatusSchema,
760
- statusReason: z8.string().nullable()
810
+ statusReason: z10.string().nullable()
761
811
  });
762
- var interactionLifecycleProviderOriginSchema = z8.object({
763
- kind: z8.literal("provider"),
764
- providerId: z8.string().min(1),
765
- providerRequestId: z8.string().min(1)
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 = z8.union([
840
+ var interactionLifecycleSchema = z10.union([
791
841
  approvalInteractionLifecycleSchema,
792
842
  userQuestionInteractionLifecycleSchema,
793
843
  pluginInteractionLifecycleSchema,
794
844
  pluginExtensionInteractionLifecycleSchema
795
845
  ]);
796
846
 
797
- // ../domain/src/protocol-ids.ts
798
- import { z as z9 } from "zod";
799
- var clientTurnRequestIdSchema = z9.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
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/system-message.ts
802
- import { z as z10 } from "zod";
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
- var systemEventTypeValues = [
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 = z14.enum([
1232
+ var threadEventItemStatusSchema = z15.enum([
1228
1233
  "pending",
1229
1234
  "completed",
1230
1235
  "failed",
1231
1236
  "interrupted"
1232
1237
  ]);
1233
- var threadEventItemApprovalStatusSchema = z14.enum(["waiting_for_approval", "denied"]).nullable();
1234
- var threadEventTurnStatusSchema = z14.enum([
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 = z14.enum(providerErrorCategoryValues);
1261
- var providerErrorInfoSchema = z14.object({
1265
+ var providerErrorCategorySchema = z15.enum(providerErrorCategoryValues);
1266
+ var providerErrorInfoSchema = z15.object({
1262
1267
  category: providerErrorCategorySchema,
1263
- providerCode: z14.string().nullable(),
1264
- httpStatusCode: z14.number().nullable()
1268
+ providerCode: z15.string().nullable(),
1269
+ httpStatusCode: z15.number().nullable()
1265
1270
  });
1266
- var providerRateLimitStatusSchema = z14.enum([
1271
+ var providerRateLimitStatusSchema = z15.enum([
1267
1272
  "allowed",
1268
1273
  "warning",
1269
1274
  "blocked",
1270
1275
  "unknown"
1271
1276
  ]);
1272
- var providerRateLimitWindowSchema = z14.object({
1273
- providerKey: z14.string().min(1).nullable(),
1274
- label: z14.string().min(1).nullable(),
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: z14.number().int().nonnegative().nullable()
1281
+ resetsAtMs: z15.number().int().nonnegative().nullable()
1277
1282
  });
1278
- var providerRateLimitStateSchema = z14.object({
1279
- providerId: z14.string().min(1),
1283
+ var providerRateLimitStateSchema = z15.object({
1284
+ providerId: z15.string().min(1),
1280
1285
  status: providerRateLimitStatusSchema,
1281
- kind: z14.enum(["subscription-window", "credits", "spend-control", "unknown"]),
1282
- windows: z14.array(providerRateLimitWindowSchema),
1283
- reachedReason: z14.string().min(1).nullable(),
1284
- overageStatus: z14.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
1285
- overageReason: z14.string().min(1).nullable()
1286
- });
1287
- var threadEventFileChangeKindSchema = z14.enum(["add", "delete", "update"]);
1288
- var threadEventFileChangeSchema = z14.object({
1289
- path: z14.string(),
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: z14.string().optional(),
1292
- diff: z14.string().optional()
1296
+ movePath: z15.string().optional(),
1297
+ diff: z15.string().optional()
1293
1298
  });
1294
- var threadEventPlanStepStatusSchema = z14.enum([
1299
+ var threadEventPlanStepStatusSchema = z15.enum([
1295
1300
  "pending",
1296
1301
  "active",
1297
1302
  "completed",
1298
1303
  "failed"
1299
1304
  ]);
1300
- var threadEventPlanStepSchema = z14.object({
1301
- step: z14.string(),
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 = z14.object({
1308
- type: z14.literal("webSearch"),
1309
- id: z14.string(),
1310
- queries: z14.array(z14.string()).min(1),
1311
- resultText: z14.string().nullable(),
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: z14.string().optional()
1314
- });
1315
- var threadEventWebFetchItemSchema = z14.object({
1316
- type: z14.literal("webFetch"),
1317
- id: z14.string(),
1318
- url: z14.string(),
1319
- prompt: z14.string().nullable(),
1320
- pattern: z14.string().nullable(),
1321
- resultText: z14.string().nullable(),
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: z14.string().optional()
1328
+ parentToolCallId: z15.string().optional()
1324
1329
  });
1325
- var threadEventImageViewItemSchema = z14.object({
1326
- type: z14.literal("imageView"),
1327
- id: z14.string(),
1328
- path: z14.string(),
1330
+ var threadEventImageViewItemSchema = z15.object({
1331
+ type: z15.literal("imageView"),
1332
+ id: z15.string(),
1333
+ path: z15.string(),
1329
1334
  ...itemPresentationField,
1330
- parentToolCallId: z14.string().optional()
1335
+ parentToolCallId: z15.string().optional()
1331
1336
  });
1332
- var threadEventFileReadItemSchema = z14.object({
1333
- type: z14.literal("fileRead"),
1334
- id: z14.string(),
1335
- path: z14.string(),
1336
- cmd: z14.string().optional(),
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: z14.string().optional()
1344
+ parentToolCallId: z15.string().optional()
1340
1345
  });
1341
- var threadEventSearchModeSchema = z14.enum(["content", "path", "list"]);
1342
- var threadEventSearchItemSchema = z14.object({
1343
- type: z14.literal("search"),
1344
- id: z14.string(),
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: z14.string(),
1347
- path: z14.string().optional(),
1348
- cmd: z14.string().optional(),
1351
+ query: z15.string(),
1352
+ path: z15.string().optional(),
1353
+ cmd: z15.string().optional(),
1349
1354
  status: threadEventItemStatusSchema,
1350
1355
  ...itemPresentationField,
1351
- parentToolCallId: z14.string().optional()
1356
+ parentToolCallId: z15.string().optional()
1352
1357
  });
1353
- var threadEventDelegationItemSchema = z14.object({
1354
- type: z14.literal("delegation"),
1355
- id: z14.string(),
1356
- childRef: z14.string().min(1),
1357
- label: z14.string(),
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: z14.boolean(),
1360
- summary: z14.string().optional(),
1364
+ background: z15.boolean(),
1365
+ summary: z15.string().optional(),
1361
1366
  ...itemPresentationField,
1362
- parentToolCallId: z14.string().optional()
1367
+ parentToolCallId: z15.string().optional()
1363
1368
  });
1364
- var threadEventPlanStepsItemSchema = z14.object({
1365
- type: z14.literal("planSteps"),
1366
- id: z14.string(),
1367
- steps: z14.array(threadEventPlanStepSchema),
1368
- explanation: z14.string().optional(),
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: z14.string().optional()
1376
+ parentToolCallId: z15.string().optional()
1372
1377
  });
1373
- var threadEventExtensionItemSchema = z14.object({
1374
- type: z14.literal("extension"),
1375
- id: z14.string(),
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: z14.string().optional()
1385
+ parentToolCallId: z15.string().optional()
1381
1386
  });
1382
- var threadEventTextTruncationSchema = z14.object({
1383
- originalLength: z14.number(),
1384
- retainedHeadLength: z14.number(),
1385
- retainedTailLength: z14.number(),
1386
- truncatedAt: z14.number()
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 = z14.object({
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 = z14.object({
1394
- type: z14.literal("imageGeneration"),
1395
- id: z14.string(),
1398
+ var threadEventImageGenerationItemSchema = z15.object({
1399
+ type: z15.literal("imageGeneration"),
1400
+ id: z15.string(),
1396
1401
  status: threadEventItemStatusSchema,
1397
- prompt: z14.string().nullable(),
1398
- path: z14.string().nullable(),
1399
- result: z14.string().optional(),
1400
- error: z14.string().nullable(),
1401
- transparentBackground: z14.boolean(),
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: z14.string().optional()
1409
+ parentToolCallId: z15.string().optional()
1405
1410
  });
1406
- var threadEventUserContentSchema = z14.discriminatedUnion("type", [
1407
- z14.object({ type: z14.literal("text"), text: z14.string() }),
1408
- z14.object({ type: z14.literal("image"), url: z14.string() }),
1409
- z14.object({ type: z14.literal("localImage"), path: z14.string() }),
1410
- z14.object({ type: z14.literal("localFile"), path: z14.string() })
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 = z14.object({
1413
- totalTokens: z14.number(),
1414
- inputTokens: z14.number(),
1415
- cachedInputTokens: z14.number(),
1416
- cacheReadInputTokens: z14.number().nonnegative().optional(),
1417
- cacheWriteInputTokens: z14.number().nonnegative().optional(),
1418
- outputTokens: z14.number(),
1419
- reasoningOutputTokens: z14.number()
1420
- });
1421
- var threadUsageCostSchema = z14.object({
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: z14.number().nullable(),
1428
- modelContextWindow: z14.number().nullable(),
1429
- estimated: z14.boolean(),
1428
+ usedTokens: z15.number().nullable(),
1429
+ modelContextWindow: z15.number().nullable(),
1430
+ estimated: z15.boolean(),
1430
1431
  cost: threadUsageCostSchema.optional()
1431
1432
  });
1432
- var promptCacheTtlMsSchema = z14.number().int().positive();
1433
- var threadEventTokenUsageSchema = z14.object({
1433
+ var promptCacheTtlMsSchema = z15.number().int().positive();
1434
+ var threadEventTokenUsageSchema = z15.object({
1434
1435
  total: threadEventTokenUsageBreakdownSchema,
1435
1436
  last: threadEventTokenUsageBreakdownSchema,
1436
- modelContextWindow: z14.number().nullable(),
1437
+ modelContextWindow: z15.number().nullable(),
1437
1438
  promptCacheTtlMs: promptCacheTtlMsSchema.optional()
1438
1439
  });
1439
- var threadEventWarningCategorySchema = z14.enum([
1440
+ var threadEventWarningCategorySchema = z15.enum([
1440
1441
  "deprecation",
1441
1442
  "config",
1442
1443
  "general",
1443
1444
  "compaction-skipped"
1444
1445
  ]);
1445
- var providerRawEventSchema = z14.object({
1446
- jsonrpc: z14.literal("2.0"),
1447
- id: z14.union([z14.string(), z14.number()]).optional(),
1448
- method: z14.string(),
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 = z14.object({
1452
- type: z14.literal("provider/unhandled"),
1453
- threadId: z14.string(),
1454
- providerThreadId: z14.string(),
1455
- providerId: z14.string(),
1456
- rawType: z14.string(),
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: z14.string().optional()
1459
- });
1460
- var toolCallProgressEventSchema = z14.object({
1461
- type: z14.literal("item/toolCall/progress"),
1462
- threadId: z14.string(),
1463
- providerThreadId: z14.string(),
1464
- itemId: z14.string(),
1465
- message: z14.string().optional(),
1466
- parentToolCallId: z14.string().optional()
1467
- });
1468
- var threadEventBackgroundTaskItemSchema = z14.object({
1469
- type: z14.literal("backgroundTask"),
1470
- id: z14.string(),
1471
- familyId: z14.string().optional(),
1472
- taskType: z14.string(),
1473
- description: z14.string(),
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: z14.boolean(),
1477
- foreground: z14.boolean(),
1478
- workflowName: z14.string().optional(),
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: z14.string().optional(),
1482
- error: z14.string().optional(),
1483
- outputFile: z14.string().optional(),
1482
+ summary: z15.string().optional(),
1483
+ error: z15.string().optional(),
1484
+ outputFile: z15.string().optional(),
1484
1485
  ...itemPresentationField,
1485
- parentToolCallId: z14.string().optional()
1486
+ parentToolCallId: z15.string().optional()
1486
1487
  });
1487
- var threadEventItemSchema = z14.discriminatedUnion("type", [
1488
- z14.object({
1489
- type: z14.literal("userMessage"),
1490
- id: z14.string(),
1491
- content: z14.array(threadEventUserContentSchema),
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: z14.string().optional()
1494
+ parentToolCallId: z15.string().optional()
1494
1495
  }).strict(),
1495
- z14.object({
1496
- type: z14.literal("agentMessage"),
1497
- id: z14.string(),
1498
- text: z14.string(),
1496
+ z15.object({
1497
+ type: z15.literal("agentMessage"),
1498
+ id: z15.string(),
1499
+ text: z15.string(),
1499
1500
  ...itemPresentationField,
1500
- parentToolCallId: z14.string().optional()
1501
+ parentToolCallId: z15.string().optional()
1501
1502
  }),
1502
- z14.object({
1503
- type: z14.literal("commandExecution"),
1504
- id: z14.string(),
1505
- command: z14.string(),
1506
- cwd: z14.string(),
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: z14.string().optional(),
1510
- exitCode: z14.number().optional(),
1511
- durationMs: z14.number().optional(),
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: z14.string().optional()
1515
+ parentToolCallId: z15.string().optional()
1515
1516
  }),
1516
- z14.object({
1517
- type: z14.literal("fileChange"),
1518
- id: z14.string(),
1519
- changes: z14.array(threadEventFileChangeSchema),
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: z14.string().optional(),
1523
+ error: z15.string().optional(),
1523
1524
  ...itemPresentationField,
1524
- parentToolCallId: z14.string().optional()
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
- z14.object({
1533
- type: z14.literal("toolCall"),
1534
- id: z14.string(),
1535
- server: z14.string().optional(),
1536
- tool: z14.string(),
1537
- arguments: z14.record(z14.string(), z14.unknown()).optional(),
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: z14.unknown().optional(),
1540
- error: z14.string().optional(),
1541
- durationMs: z14.number().optional(),
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: z14.string().optional()
1545
+ parentToolCallId: z15.string().optional()
1545
1546
  }),
1546
- z14.object({
1547
- type: z14.literal("reasoning"),
1548
- id: z14.string(),
1549
- summary: z14.array(z14.string()),
1550
- content: z14.array(z14.string()),
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: z14.string().optional()
1553
+ parentToolCallId: z15.string().optional()
1553
1554
  }),
1554
- z14.object({
1555
- type: z14.literal("plan"),
1556
- id: z14.string(),
1557
- text: z14.string(),
1555
+ z15.object({
1556
+ type: z15.literal("plan"),
1557
+ id: z15.string(),
1558
+ text: z15.string(),
1558
1559
  ...itemPresentationField,
1559
- parentToolCallId: z14.string().optional()
1560
+ parentToolCallId: z15.string().optional()
1560
1561
  }),
1561
1562
  threadEventPlanStepsItemSchema,
1562
- z14.object({
1563
- type: z14.literal("contextCompaction"),
1564
- id: z14.string(),
1563
+ z15.object({
1564
+ type: z15.literal("contextCompaction"),
1565
+ id: z15.string(),
1565
1566
  ...itemPresentationField,
1566
- parentToolCallId: z14.string().optional()
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 z14.object({
1574
- type: z14.literal(type),
1575
- threadId: z14.string(),
1576
- providerThreadId: z14.string(),
1577
- itemId: z14.string(),
1578
- delta: z14.string(),
1579
- parentToolCallId: z14.string().optional()
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 = z14.discriminatedUnion("type", [
1583
- z14.object({
1584
- type: z14.literal("thread/started"),
1585
- threadId: z14.string()
1583
+ var unscopedProviderEventSchema = z15.discriminatedUnion("type", [
1584
+ z15.object({
1585
+ type: z15.literal("thread/started"),
1586
+ threadId: z15.string()
1586
1587
  }),
1587
- z14.object({
1588
- type: z14.literal("thread/identity"),
1589
- threadId: z14.string(),
1590
- providerThreadId: z14.string()
1588
+ z15.object({
1589
+ type: z15.literal("thread/identity"),
1590
+ threadId: z15.string(),
1591
+ providerThreadId: z15.string()
1591
1592
  }),
1592
- z14.object({
1593
- type: z14.literal("turn/started"),
1594
- threadId: z14.string(),
1595
- providerThreadId: z14.string(),
1596
- parentToolCallId: z14.string().optional()
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
- z14.object({
1599
- type: z14.literal("turn/completed"),
1600
- threadId: z14.string(),
1601
- providerThreadId: z14.string().nullable(),
1599
+ z15.object({
1600
+ type: z15.literal("turn/completed"),
1601
+ threadId: z15.string(),
1602
+ providerThreadId: z15.string().nullable(),
1602
1603
  status: threadEventTurnStatusSchema,
1603
- error: z14.object({ message: z14.string() }).optional(),
1604
- providerCheckpointId: z14.string().min(1).optional()
1604
+ error: z15.object({ message: z15.string() }).optional(),
1605
+ providerCheckpointId: z15.string().min(1).optional()
1605
1606
  }),
1606
- z14.object({
1607
- type: z14.literal("turn/input/accepted"),
1608
- threadId: z14.string(),
1609
- providerThreadId: z14.string(),
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
- z14.object({
1614
- type: z14.literal("thread/name/updated"),
1615
- threadId: z14.string(),
1616
- providerThreadId: z14.string(),
1617
- threadName: z14.string(),
1618
- source: z14.literal("agent").optional()
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
- z14.object({
1621
- type: z14.literal("thread/compacted"),
1622
- threadId: z14.string(),
1623
- providerThreadId: z14.string()
1621
+ z15.object({
1622
+ type: z15.literal("thread/compacted"),
1623
+ threadId: z15.string(),
1624
+ providerThreadId: z15.string()
1624
1625
  }),
1625
- z14.object({
1626
- type: z14.literal("thread/context/cleared"),
1627
- threadId: z14.string(),
1628
- providerThreadId: z14.string()
1626
+ z15.object({
1627
+ type: z15.literal("thread/context/cleared"),
1628
+ threadId: z15.string(),
1629
+ providerThreadId: z15.string()
1629
1630
  }),
1630
- z14.object({
1631
- type: z14.literal("thread/goal/updated"),
1632
- threadId: z14.string(),
1633
- providerThreadId: z14.string(),
1634
- objective: z14.string(),
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: z14.number().nullable(),
1637
- tokensUsed: z14.number(),
1638
- timeUsedSeconds: z14.number()
1637
+ tokenBudget: z15.number().nullable(),
1638
+ tokensUsed: z15.number(),
1639
+ timeUsedSeconds: z15.number()
1639
1640
  }),
1640
- z14.object({
1641
- type: z14.literal("thread/goal/cleared"),
1642
- threadId: z14.string(),
1643
- providerThreadId: z14.string()
1641
+ z15.object({
1642
+ type: z15.literal("thread/goal/cleared"),
1643
+ threadId: z15.string(),
1644
+ providerThreadId: z15.string()
1644
1645
  }),
1645
- z14.object({
1646
- type: z14.literal("item/started"),
1647
- threadId: z14.string(),
1648
- providerThreadId: z14.string(),
1646
+ z15.object({
1647
+ type: z15.literal("item/started"),
1648
+ threadId: z15.string(),
1649
+ providerThreadId: z15.string(),
1649
1650
  item: threadEventItemSchema
1650
1651
  }),
1651
- z14.object({
1652
- type: z14.literal("item/completed"),
1653
- threadId: z14.string(),
1654
- providerThreadId: z14.string(),
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
- z14.object({
1659
- type: z14.literal("item/commandExecution/outputDelta"),
1660
- threadId: z14.string(),
1661
- providerThreadId: z14.string(),
1662
- itemId: z14.string(),
1663
- delta: z14.string(),
1664
- reset: z14.boolean().optional(),
1665
- parentToolCallId: z14.string().optional()
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
- z14.object({
1672
- type: z14.literal("item/mcpToolCall/progress"),
1673
- threadId: z14.string(),
1674
- providerThreadId: z14.string(),
1675
- itemId: z14.string(),
1676
- message: z14.string().optional(),
1677
- parentToolCallId: z14.string().optional()
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
- z14.object({
1681
- type: z14.literal("item/backgroundTask/progress"),
1682
- threadId: z14.string(),
1683
- providerThreadId: z14.string(),
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
- z14.object({
1687
- type: z14.literal("item/backgroundTask/completed"),
1688
- threadId: z14.string(),
1689
- providerThreadId: z14.string(),
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
- z14.object({
1693
- type: z14.literal("item/delegation/progress"),
1694
- threadId: z14.string(),
1695
- providerThreadId: z14.string(),
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
- z14.object({
1699
- type: z14.literal("item/delegation/completed"),
1700
- threadId: z14.string(),
1701
- providerThreadId: z14.string(),
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
- z14.object({
1705
- type: z14.literal("thread/tokenUsage/updated"),
1706
- threadId: z14.string(),
1707
- providerThreadId: z14.string(),
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
- z14.object({
1711
- type: z14.literal("thread/contextWindowUsage/updated"),
1712
- threadId: z14.string(),
1713
- providerThreadId: z14.string(),
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
- z14.object({
1717
- type: z14.literal("turn/plan/updated"),
1718
- threadId: z14.string(),
1719
- providerThreadId: z14.string(),
1720
- plan: z14.array(threadEventPlanStepSchema),
1721
- explanation: z14.string().optional()
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
- z14.object({
1724
- type: z14.literal("turn/mainRun/updated"),
1725
- threadId: z14.string(),
1726
- providerThreadId: z14.string(),
1727
- state: z14.enum(["idle", "running"])
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
- z14.object({
1730
- type: z14.literal("turn/diff/updated"),
1731
- threadId: z14.string(),
1732
- providerThreadId: z14.string(),
1733
- diff: z14.string().optional()
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
- z14.object({
1736
- type: z14.literal("provider/error"),
1737
- threadId: z14.string(),
1738
- providerThreadId: z14.string(),
1739
- message: z14.string(),
1740
- detail: z14.string().optional(),
1741
- willRetry: z14.boolean().optional(),
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
- z14.object({
1745
- type: z14.literal("provider/rateLimits/updated"),
1746
- threadId: z14.string(),
1747
- providerThreadId: z14.string(),
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
- z14.object({
1751
- type: z14.literal("provider.env-resolved"),
1752
- threadId: z14.string(),
1753
- providerThreadId: z14.string(),
1754
- entries: z14.array(
1755
- z14.object({
1756
- name: z14.string(),
1757
- source: z14.union([
1758
- z14.literal("shell"),
1759
- z14.object({ plugin: z14.string() }).strict(),
1760
- z14.object({
1761
- core: z14.enum([
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: z14.union([
1769
- z14.string(),
1770
- z14.object({ masked: z14.literal(true) }).strict()
1769
+ value: z15.union([
1770
+ z15.string(),
1771
+ z15.object({ masked: z15.literal(true) }).strict()
1771
1772
  ]),
1772
- reason: z14.string().optional()
1773
+ reason: z15.string().optional()
1773
1774
  }).strict()
1774
1775
  )
1775
1776
  }),
1776
- z14.object({
1777
- type: z14.literal("thread/extensionState/updated"),
1778
- threadId: z14.string(),
1779
- providerThreadId: z14.string(),
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
- z14.object({
1784
- type: z14.literal("provider/warning"),
1785
- threadId: z14.string(),
1786
- providerThreadId: z14.string(),
1784
+ z15.object({
1785
+ type: z15.literal("provider/warning"),
1786
+ threadId: z15.string(),
1787
+ providerThreadId: z15.string(),
1787
1788
  category: threadEventWarningCategorySchema,
1788
- summary: z14.string().optional(),
1789
- details: z14.string().optional()
1789
+ summary: z15.string().optional(),
1790
+ details: z15.string().optional()
1790
1791
  }),
1791
- z14.object({
1792
- type: z14.literal("provider/modelFallback"),
1793
- threadId: z14.string(),
1794
- providerThreadId: z14.string(),
1795
- originalModel: z14.string().min(1),
1796
- fallbackModel: z14.string().min(1),
1797
- reason: z14.enum(["refusal", "provider"]),
1798
- message: z14.string()
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 = z14.object({
1803
+ var scopedEventDataSchema = z15.object({
1803
1804
  scope: threadEventScopeSchema
1804
1805
  });
1805
1806
  var providerEventSchema = unscopedProviderEventSchema.and(
1806
1807
  scopedEventDataSchema
1807
1808
  );
1808
- var providerEventTypeValues = unscopedProviderEventSchema.options.map(
1809
- (option) => option.shape.type.value
1810
- );
1811
- var unscopedSystemEventSchema = z14.discriminatedUnion("type", [
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
- z14.object({
1817
- type: z14.literal("client/turn/requested"),
1818
- threadId: z14.string()
1814
+ z15.object({
1815
+ type: z15.literal("client/turn/requested"),
1816
+ threadId: z15.string()
1819
1817
  }).merge(turnRequestEventDataSchema),
1820
- z14.object({
1821
- type: z14.literal("client/turn/rejected"),
1822
- threadId: z14.string()
1818
+ z15.object({
1819
+ type: z15.literal("client/turn/rejected"),
1820
+ threadId: z15.string()
1823
1821
  }).merge(turnRequestRejectedEventDataSchema),
1824
- z14.object({
1825
- type: z14.literal("client/turn/start"),
1826
- threadId: z14.string()
1822
+ z15.object({
1823
+ type: z15.literal("client/turn/start"),
1824
+ threadId: z15.string()
1827
1825
  }).merge(clientTurnLifecycleEventDataSchema),
1828
- z14.object({
1829
- type: z14.literal("system/error"),
1830
- threadId: z14.string()
1826
+ z15.object({
1827
+ type: z15.literal("system/error"),
1828
+ threadId: z15.string()
1831
1829
  }).merge(systemErrorEventDataSchema),
1832
- z14.object({
1833
- type: z14.literal("system/manager/user_message"),
1834
- threadId: z14.string()
1830
+ z15.object({
1831
+ type: z15.literal("system/manager/user_message"),
1832
+ threadId: z15.string()
1835
1833
  }).merge(systemLegacyUserMessageEventDataSchema),
1836
- z14.object({
1837
- type: z14.literal("system/thread/interrupted"),
1838
- threadId: z14.string()
1834
+ z15.object({
1835
+ type: z15.literal("system/thread/interrupted"),
1836
+ threadId: z15.string()
1839
1837
  }).merge(systemThreadInterruptedEventDataSchema),
1840
- z14.object({
1841
- type: z14.literal("system/operation"),
1842
- threadId: z14.string()
1838
+ z15.object({
1839
+ type: z15.literal("system/operation"),
1840
+ threadId: z15.string()
1843
1841
  }).merge(systemOperationEventDataSchema),
1844
- z14.object({
1845
- type: z14.literal("system/interaction/lifecycle"),
1846
- threadId: z14.string()
1842
+ z15.object({
1843
+ type: z15.literal("system/interaction/lifecycle"),
1844
+ threadId: z15.string()
1847
1845
  }).merge(systemInteractionLifecycleEventDataSchema),
1848
- z14.object({
1849
- type: z14.literal("system/permissionGrant/lifecycle"),
1850
- threadId: z14.string()
1846
+ z15.object({
1847
+ type: z15.literal("system/permissionGrant/lifecycle"),
1848
+ threadId: z15.string()
1851
1849
  }).merge(systemPermissionGrantLifecycleEventDataSchema),
1852
- z14.object({
1853
- type: z14.literal("system/userQuestion/lifecycle"),
1854
- threadId: z14.string()
1850
+ z15.object({
1851
+ type: z15.literal("system/userQuestion/lifecycle"),
1852
+ threadId: z15.string()
1855
1853
  }).merge(systemUserQuestionLifecycleEventDataSchema),
1856
- z14.object({
1857
- type: z14.literal("system/thread-provisioning"),
1858
- threadId: z14.string()
1854
+ z15.object({
1855
+ type: z15.literal("system/thread-provisioning"),
1856
+ threadId: z15.string()
1859
1857
  }).merge(systemThreadProvisioningEventDataSchema),
1860
- z14.object({
1861
- type: z14.literal("system/provider-turn-watchdog"),
1862
- threadId: z14.string()
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 = z14.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
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: z14.ZodIssueCode.custom,
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 z15 } from "zod";
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 = z15.object({
1925
- name: z15.string().min(1),
1926
- description: z15.string(),
1927
- inputHint: z15.string().min(1).optional()
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 = z15.object({
1930
- commands: z15.array(threadProviderCommandSchema).max(500)
1901
+ var threadProviderCommandsStateSchema = z16.object({
1902
+ commands: z16.array(threadProviderCommandSchema).max(500)
1931
1903
  });
1932
- var threadSessionOptionValueSchema = z15.object({
1933
- id: z15.string().min(1),
1934
- label: z15.string().min(1),
1935
- description: z15.string().min(1).optional(),
1936
- group: z15.string().min(1).optional()
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: z15.string().min(1),
1940
- label: z15.string().min(1),
1941
- description: z15.string().min(1).optional(),
1942
- category: z15.string().min(1).optional()
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 = z15.discriminatedUnion("type", [
1945
- z15.object({
1916
+ var threadSessionOptionSchema = z16.discriminatedUnion("type", [
1917
+ z16.object({
1946
1918
  ...threadSessionOptionBaseShape,
1947
- type: z15.literal("select"),
1948
- value: z15.string(),
1949
- values: z15.array(threadSessionOptionValueSchema).max(1e3)
1919
+ type: z16.literal("select"),
1920
+ value: z16.string(),
1921
+ values: z16.array(threadSessionOptionValueSchema).max(1e3)
1950
1922
  }),
1951
- z15.object({
1923
+ z16.object({
1952
1924
  ...threadSessionOptionBaseShape,
1953
- type: z15.literal("boolean"),
1954
- value: z15.boolean(),
1955
- fixed: z15.boolean().optional()
1925
+ type: z16.literal("boolean"),
1926
+ value: z16.boolean(),
1927
+ fixed: z16.boolean().optional()
1956
1928
  })
1957
1929
  ]);
1958
- var threadSessionOptionsStateSchema = z15.object({
1959
- options: z15.array(threadSessionOptionSchema).max(64)
1930
+ var threadSessionOptionsStateSchema = z16.object({
1931
+ options: z16.array(threadSessionOptionSchema).max(64)
1960
1932
  });
1961
- var threadSessionOptionSelectionsStateSchema = z15.object({
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 z16 } from "zod";
1942
+ import { z as z17 } from "zod";
1971
1943
  var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
1972
- var providerForkSchema = z16.enum(PROVIDER_FORK_VALUES);
1944
+ var providerForkSchema = z17.enum(PROVIDER_FORK_VALUES);
1973
1945
 
1974
1946
  // ../domain/src/provider-types.ts
1975
- import { z as z17 } from "zod";
1976
- var modelReasoningEffortSchema = z17.object({
1947
+ import { z as z18 } from "zod";
1948
+ var modelReasoningEffortSchema = z18.object({
1977
1949
  reasoningEffort: reasoningLevelSchema,
1978
- label: z17.string().min(1).optional(),
1979
- description: z17.string()
1950
+ label: z18.string().min(1).optional(),
1951
+ description: z18.string()
1980
1952
  });
1981
- var modelServiceTierSchema = z17.object({
1953
+ var modelServiceTierSchema = z18.object({
1982
1954
  id: serviceTierSchema,
1983
- label: z17.string().min(1).optional(),
1984
- description: z17.string().min(1).optional()
1985
- });
1986
- var availableModelSchema = z17.object({
1987
- id: z17.string(),
1988
- model: z17.string(),
1989
- displayName: z17.string(),
1990
- routeProviderId: z17.string().min(1).optional(),
1991
- description: z17.string(),
1992
- supportedReasoningEfforts: z17.array(modelReasoningEffortSchema),
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: z17.array(modelServiceTierSchema).optional(),
1995
- sessionOptions: z17.array(threadSessionOptionSchema).max(64).optional(),
1996
- isDefault: z17.boolean()
1997
- });
1998
- var providerModelCatalogScopeSchema = z17.enum(["host", "workspace"]);
1999
- var providerCapabilitiesSchema = z17.object({
2000
- supportsThreadArchive: z17.boolean(),
2001
- supportsThreadRename: z17.boolean(),
2002
- supportsServiceTier: z17.boolean(),
2003
- supportsNativeUserQuestion: z17.boolean(),
2004
- supportsFork: z17.boolean(),
2005
- supportsSessionRewind: z17.boolean(),
2006
- permissionModes: z17.array(permissionModeSchema).min(1),
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 = z17.object({
1981
+ var providerComposerCommandSchema = z18.object({
2010
1982
  trigger: promptMentionCommandTriggerSchema,
2011
- name: z17.string().min(1).regex(/^[^\s/$]+$/u),
2012
- trailingText: z17.string().regex(/^\s*$/u)
1983
+ name: z18.string().min(1).regex(/^[^\s/$]+$/u),
1984
+ trailingText: z18.string().regex(/^\s*$/u)
2013
1985
  });
2014
- var providerComposerActionSchema = z17.discriminatedUnion("kind", [
2015
- z17.object({
2016
- kind: z17.literal("skills"),
1986
+ var providerComposerActionSchema = z18.discriminatedUnion("kind", [
1987
+ z18.object({
1988
+ kind: z18.literal("skills"),
2017
1989
  trigger: promptMentionCommandTriggerSchema
2018
1990
  }),
2019
- z17.object({
2020
- kind: z17.literal("plan"),
1991
+ z18.object({
1992
+ kind: z18.literal("plan"),
2021
1993
  command: providerComposerCommandSchema
2022
1994
  }),
2023
- z17.object({
2024
- kind: z17.literal("goal"),
1995
+ z18.object({
1996
+ kind: z18.literal("goal"),
2025
1997
  command: providerComposerCommandSchema
2026
1998
  })
2027
1999
  ]);
2028
- var providerStringsSchema = z17.object({
2029
- signInHint: z17.string().min(1),
2030
- expiredHint: z17.string().min(1),
2031
- installUrl: z17.string().min(1),
2032
- brandPrefix: z17.string().min(1).optional(),
2033
- planModeCopy: z17.string().min(1).optional(),
2034
- iconTint: z17.object({ light: z17.string().min(1), dark: z17.string().min(1) }).optional()
2035
- });
2036
- var providerOptionDescriptorSchema = z17.object({
2037
- id: z17.string().min(1),
2038
- label: z17.string().min(1),
2039
- description: z17.string().min(1).optional()
2040
- });
2041
- var providerExtensionKindInfoSchema = z17.object({
2042
- item: z17.boolean(),
2043
- state: z17.boolean()
2044
- });
2045
- var providerExtensionKindsSchema = z17.record(
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 = z17.object({
2050
- id: z17.string(),
2051
- pluginId: z17.string().min(1),
2052
- displayName: z17.string(),
2053
- family: z17.string().min(1).optional(),
2054
- icon: z17.object({ glyph: z17.string().min(1) }).optional(),
2055
- logoUrl: z17.string().min(1).nullable(),
2056
- maintenance: z17.object({
2057
- health: z17.boolean(),
2058
- usage: z17.boolean(),
2059
- installation: z17.boolean()
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: z17.array(providerComposerActionSchema),
2034
+ composerActions: z18.array(providerComposerActionSchema),
2063
2035
  completedTurnDisplay: completedTurnDisplaySchema,
2064
- available: z17.boolean(),
2036
+ available: z18.boolean(),
2065
2037
  strings: providerStringsSchema.optional(),
2066
- serviceTiers: z17.array(providerOptionDescriptorSchema).optional(),
2067
- reasoningLevels: z17.array(providerOptionDescriptorSchema).optional(),
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 = z17.enum(providerRecoveryKindValues);
2078
- var toolCallOutputItemSchema = z17.discriminatedUnion("type", [
2079
- z17.object({
2080
- type: z17.literal("inputText"),
2081
- text: z17.string()
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
- z17.object({
2084
- type: z17.literal("inputImage"),
2085
- imageUrl: z17.string()
2055
+ z18.object({
2056
+ type: z18.literal("inputImage"),
2057
+ imageUrl: z18.string()
2086
2058
  })
2087
2059
  ]);
2088
- var toolCallRequestSchema = z17.object({
2089
- requestId: z17.union([z17.string().min(1), z17.number()]),
2090
- threadId: z17.string().min(1),
2091
- providerThreadId: z17.string().min(1),
2092
- turnId: z17.string().min(1),
2093
- callId: z17.string().min(1),
2094
- tool: z17.string().min(1),
2095
- arguments: z17.unknown().optional()
2096
- });
2097
- var toolCallResponseSchema = z17.object({
2098
- contentItems: z17.array(toolCallOutputItemSchema),
2099
- success: z17.boolean()
2100
- });
2101
- var dynamicToolSchema = z17.object({
2102
- name: z17.string(),
2103
- description: z17.string(),
2104
- inputSchema: z17.unknown(),
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 z18 } from "zod";
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 = z18.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
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 = z18.object({
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 = z18.object({
2123
- path: z18.string(),
2124
- kind: z18.enum(["add", "update", "delete"]),
2125
- movePath: z18.string().optional(),
2126
- diff: z18.string().optional(),
2127
- oldText: z18.string().optional(),
2128
- newText: z18.string().optional()
2129
- });
2130
- var deltaBackgroundTaskShapeSchema = z18.object({
2131
- type: z18.literal("backgroundTask"),
2132
- familyId: z18.string().min(1),
2133
- taskType: z18.string(),
2134
- description: z18.string(),
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: z18.boolean(),
2138
- foreground: z18.boolean().optional(),
2139
- workflowName: z18.string().optional(),
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: z18.string().optional(),
2143
- error: z18.string().optional(),
2144
- outputFile: z18.string().optional()
2114
+ summary: z19.string().optional(),
2115
+ error: z19.string().optional(),
2116
+ outputFile: z19.string().optional()
2145
2117
  });
2146
- var deltaFileReadShapeSchema = z18.object({
2147
- type: z18.literal("fileRead"),
2148
- path: z18.string(),
2149
- cmd: z18.string().optional()
2118
+ var deltaFileReadShapeSchema = z19.object({
2119
+ type: z19.literal("fileRead"),
2120
+ path: z19.string(),
2121
+ cmd: z19.string().optional()
2150
2122
  });
2151
- var deltaSearchShapeSchema = z18.object({
2152
- type: z18.literal("search"),
2123
+ var deltaSearchShapeSchema = z19.object({
2124
+ type: z19.literal("search"),
2153
2125
  mode: threadEventSearchModeSchema,
2154
- query: z18.string(),
2155
- path: z18.string().optional(),
2156
- cmd: z18.string().optional()
2126
+ query: z19.string(),
2127
+ path: z19.string().optional(),
2128
+ cmd: z19.string().optional()
2157
2129
  });
2158
- var deltaDelegationShapeSchema = z18.object({
2159
- type: z18.literal("delegation"),
2130
+ var deltaDelegationShapeSchema = z19.object({
2131
+ type: z19.literal("delegation"),
2160
2132
  childRef: deltaKeyPartSchema,
2161
- label: z18.string(),
2162
- background: z18.boolean(),
2163
- summary: z18.string().optional()
2133
+ label: z19.string(),
2134
+ background: z19.boolean(),
2135
+ summary: z19.string().optional()
2164
2136
  });
2165
- var deltaPlanStepsShapeSchema = z18.object({
2166
- type: z18.literal("planSteps"),
2167
- steps: z18.array(threadEventPlanStepSchema),
2168
- explanation: z18.string().optional()
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 = z18.object({
2171
- type: z18.literal("extension"),
2142
+ var deltaExtensionShapeSchema = z19.object({
2143
+ type: z19.literal("extension"),
2172
2144
  kind: extensionKindSchema,
2173
2145
  payload: jsonValueSchema
2174
2146
  });
2175
- var deltaItemShapeSchema = z18.discriminatedUnion("type", [
2176
- z18.object({
2177
- type: z18.literal("command"),
2178
- command: z18.string(),
2179
- cwd: z18.string(),
2180
- aggregatedOutput: z18.string().optional(),
2181
- exitCode: z18.number().optional(),
2182
- durationMs: z18.number().optional()
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
- z18.object({
2185
- type: z18.literal("fileChange"),
2186
- changes: z18.array(deltaFileChangeSchema)
2156
+ z19.object({
2157
+ type: z19.literal("fileChange"),
2158
+ changes: z19.array(deltaFileChangeSchema)
2187
2159
  }),
2188
- z18.object({
2189
- type: z18.literal("tool"),
2190
- tool: z18.string(),
2191
- server: z18.string().optional(),
2192
- args: z18.unknown().optional(),
2193
- result: z18.unknown().optional(),
2194
- error: z18.string().optional(),
2195
- durationMs: z18.number().optional()
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
- z18.object({ type: z18.literal("compaction") }),
2198
- z18.object({ type: z18.literal("agentMessage"), text: z18.string() }),
2199
- z18.object({
2200
- type: z18.literal("reasoning"),
2201
- summary: z18.array(z18.string()),
2202
- content: z18.array(z18.string())
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
- z18.object({ type: z18.literal("plan"), text: z18.string() }),
2205
- z18.object({
2206
- type: z18.literal("webSearch"),
2207
- queries: z18.array(z18.string()).min(1)
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
- z18.object({
2210
- type: z18.literal("webFetch"),
2211
- url: z18.string(),
2212
- prompt: z18.string().nullable().optional(),
2213
- pattern: z18.string().nullable()
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
- z18.object({ type: z18.literal("imageView"), path: z18.string() }),
2216
- z18.object({
2217
- type: z18.literal("imageGeneration"),
2218
- prompt: z18.string().nullable(),
2219
- path: z18.string().nullable(),
2220
- result: z18.string().optional(),
2221
- error: z18.string().nullable(),
2222
- transparentBackground: z18.boolean()
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 = z18.discriminatedUnion("type", [
2203
+ var deltaProgressSnapshotSchema = z19.discriminatedUnion("type", [
2232
2204
  deltaBackgroundTaskShapeSchema,
2233
2205
  deltaDelegationShapeSchema
2234
2206
  ]);
2235
- var deltaTextChannelSchema = z18.enum([
2207
+ var deltaTextChannelSchema = z19.enum([
2236
2208
  "agentMessage",
2237
2209
  "reasoningSummary",
2238
2210
  "reasoningText",
2239
2211
  "plan"
2240
2212
  ]);
2241
- var deltaOutputChannelSchema = z18.enum(["command", "fileChange"]);
2242
- var deltaErrorSchema = z18.object({ message: z18.string() });
2243
- var deltaAttachSchema = z18.enum(["open", "currentOrLast"]);
2244
- var deltaNoTurnFallbackSchema = z18.object({
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: z18.string()
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 = z18.discriminatedUnion("kind", [
2258
- z18.object({
2259
- kind: z18.literal("input.accepted"),
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
- z18.object({
2264
- kind: z18.literal("input.provider"),
2265
- text: z18.string().min(1),
2235
+ z19.object({
2236
+ kind: z19.literal("input.provider"),
2237
+ text: z19.string().min(1),
2266
2238
  parentRef: deltaKeyPartSchema.optional()
2267
2239
  }),
2268
- z18.object({
2269
- kind: z18.literal("turn.open"),
2240
+ z19.object({
2241
+ kind: z19.literal("turn.open"),
2270
2242
  providerTurnId: providerTurnIdSchema.optional(),
2271
2243
  parentRef: deltaKeyPartSchema.optional()
2272
2244
  }),
2273
- z18.object({
2274
- kind: z18.literal("turn.mainRun"),
2275
- state: z18.enum(["idle", "running"])
2245
+ z19.object({
2246
+ kind: z19.literal("turn.mainRun"),
2247
+ state: z19.enum(["idle", "running"])
2276
2248
  }),
2277
- z18.object({
2278
- kind: z18.literal("turn.boundary"),
2249
+ z19.object({
2250
+ kind: z19.literal("turn.boundary"),
2279
2251
  status: threadEventTurnStatusSchema,
2280
2252
  error: deltaErrorSchema.optional(),
2281
- providerCheckpointId: z18.string().min(1).optional(),
2282
- claimIfIdle: z18.boolean().optional(),
2253
+ providerCheckpointId: z19.string().min(1).optional(),
2254
+ claimIfIdle: z19.boolean().optional(),
2283
2255
  providerTurnId: providerTurnIdSchema.optional()
2284
2256
  }),
2285
- z18.object({
2286
- kind: z18.literal("item.open"),
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
- z18.object({
2295
- kind: z18.literal("item.close"),
2266
+ z19.object({
2267
+ kind: z19.literal("item.close"),
2296
2268
  key: deltaItemKeySchema,
2297
2269
  status: threadEventItemStatusSchema,
2298
- resultText: z18.string().optional(),
2299
- exitCode: z18.number().optional(),
2300
- aggregatedOutput: z18.string().optional(),
2301
- approvalStatus: z18.literal("denied").optional(),
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
- z18.object({
2308
- kind: z18.literal("item.progress"),
2279
+ z19.object({
2280
+ kind: z19.literal("item.progress"),
2309
2281
  key: deltaItemKeySchema,
2310
- message: z18.string().optional(),
2282
+ message: z19.string().optional(),
2311
2283
  snapshot: deltaProgressSnapshotSchema.optional(),
2312
- flush: z18.boolean().optional(),
2284
+ flush: z19.boolean().optional(),
2313
2285
  providerTurnId: providerTurnIdSchema.optional(),
2314
2286
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2315
2287
  }),
2316
- z18.object({
2317
- kind: z18.literal("item.textDelta"),
2288
+ z19.object({
2289
+ kind: z19.literal("item.textDelta"),
2318
2290
  key: deltaItemKeySchema,
2319
2291
  channel: deltaTextChannelSchema,
2320
- text: z18.string(),
2292
+ text: z19.string(),
2321
2293
  providerTurnId: providerTurnIdSchema.optional(),
2322
2294
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2323
2295
  }),
2324
- z18.object({
2325
- kind: z18.literal("item.textClose"),
2296
+ z19.object({
2297
+ kind: z19.literal("item.textClose"),
2326
2298
  key: deltaItemKeySchema,
2327
2299
  channel: deltaTextChannelSchema,
2328
- text: z18.string().optional(),
2300
+ text: z19.string().optional(),
2329
2301
  providerTurnId: providerTurnIdSchema.optional(),
2330
2302
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2331
2303
  }),
2332
- z18.object({
2333
- kind: z18.literal("item.outputDelta"),
2304
+ z19.object({
2305
+ kind: z19.literal("item.outputDelta"),
2334
2306
  key: deltaItemKeySchema,
2335
2307
  channel: deltaOutputChannelSchema,
2336
- text: z18.string(),
2308
+ text: z19.string(),
2337
2309
  providerTurnId: providerTurnIdSchema.optional(),
2338
2310
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2339
2311
  }),
2340
- z18.object({
2341
- kind: z18.literal("command.outputSnapshot"),
2312
+ z19.object({
2313
+ kind: z19.literal("command.outputSnapshot"),
2342
2314
  key: deltaItemKeySchema,
2343
- text: z18.string(),
2315
+ text: z19.string(),
2344
2316
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2345
2317
  }),
2346
- z18.object({
2347
- kind: z18.literal("usage"),
2318
+ z19.object({
2319
+ kind: z19.literal("usage"),
2348
2320
  total: threadEventTokenUsageBreakdownSchema,
2349
2321
  last: threadEventTokenUsageBreakdownSchema,
2350
- modelContextWindow: z18.number().nullable(),
2322
+ modelContextWindow: z19.number().nullable(),
2351
2323
  promptCacheTtlMs: promptCacheTtlMsSchema.optional(),
2352
2324
  providerTurnId: providerTurnIdSchema.optional()
2353
2325
  }),
2354
- z18.object({
2355
- kind: z18.literal("contextWindow"),
2326
+ z19.object({
2327
+ kind: z19.literal("contextWindow"),
2356
2328
  snapshot: contextSnapshotSchema.optional(),
2357
- used: z18.number().nullable(),
2358
- size: z18.number().nullable().optional(),
2359
- estimated: z18.boolean(),
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
- z18.object({
2365
- kind: z18.literal("context.compacted"),
2336
+ z19.object({
2337
+ kind: z19.literal("context.compacted"),
2366
2338
  providerTurnId: providerTurnIdSchema.optional(),
2367
2339
  noTurnFallback: deltaNoTurnFallbackSchema.optional()
2368
2340
  }),
2369
- z18.object({ kind: z18.literal("context.cleared") }),
2370
- z18.object({
2371
- kind: z18.literal("turn.diff"),
2372
- diff: z18.string(),
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
- z18.object({ kind: z18.literal("thread.started") }),
2376
- z18.object({
2377
- kind: z18.literal("thread.identity"),
2378
- providerThreadId: z18.string().min(1)
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
- z18.object({
2381
- kind: z18.literal("thread.name"),
2382
- name: z18.string().min(1),
2383
- source: z18.literal("agent").optional()
2352
+ z19.object({
2353
+ kind: z19.literal("thread.name"),
2354
+ name: z19.string().min(1),
2355
+ source: z19.literal("agent").optional()
2384
2356
  }),
2385
- z18.object({
2386
- kind: z18.literal("extension.state"),
2357
+ z19.object({
2358
+ kind: z19.literal("extension.state"),
2387
2359
  extensionKind: extensionKindSchema,
2388
2360
  payload: jsonValueSchema
2389
2361
  }),
2390
- z18.object({
2391
- kind: z18.literal("provider.rateLimits"),
2362
+ z19.object({
2363
+ kind: z19.literal("provider.rateLimits"),
2392
2364
  rateLimits: providerRateLimitStateSchema
2393
2365
  }),
2394
- z18.object({
2395
- kind: z18.literal("provider.error"),
2396
- message: z18.string(),
2397
- detail: z18.string().optional(),
2398
- willRetry: z18.boolean().optional(),
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: z18.boolean().optional(),
2373
+ settlesTurn: z19.boolean().optional(),
2402
2374
  providerTurnId: providerTurnIdSchema.optional(),
2403
- threadScoped: z18.boolean().optional()
2375
+ threadScoped: z19.boolean().optional()
2404
2376
  }),
2405
- z18.object({
2406
- kind: z18.literal("provider.modelFallback"),
2407
- originalModel: z18.string().min(1),
2408
- fallbackModel: z18.string().min(1),
2409
- reason: z18.enum(["refusal", "provider"]),
2410
- message: z18.string()
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
- z18.object({
2413
- kind: z18.literal("provider.warning"),
2414
- summary: z18.string().optional(),
2415
- details: z18.string().optional(),
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: z18.boolean().optional()
2389
+ vouchedTurn: z19.boolean().optional()
2418
2390
  }),
2419
- z18.object({
2420
- kind: z18.literal("unhandled"),
2391
+ z19.object({
2392
+ kind: z19.literal("unhandled"),
2421
2393
  raw: providerRawEventSchema,
2422
- rawType: z18.string(),
2423
- vouchedTurn: z18.boolean(),
2424
- onlyIfNoTurn: z18.boolean().optional(),
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
- z18.object({ kind: z18.literal("session.ended") }),
2429
- z18.object({ kind: z18.literal("session.reset") })
2400
+ z19.object({ kind: z19.literal("session.ended") }),
2401
+ z19.object({ kind: z19.literal("session.reset") })
2430
2402
  ]);
2431
- var threadDeltaNotificationParamsSchema = z18.object({
2432
- threadId: z18.string().min(1),
2433
- deltas: z18.array(threadDeltaSchema)
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 z20 } from "zod";
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 z19 } from "zod";
2448
- var bashArgsSchema = z19.object({
2449
- command: z19.string().optional(),
2450
- cwd: z19.string().optional()
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 = z19.object({
2453
- type: z19.literal("text"),
2454
- text: z19.string()
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 = z20.object({
2464
- content: z20.array(z20.unknown())
2435
+ var contentWrapperSchema = z21.object({
2436
+ content: z21.array(z21.unknown())
2465
2437
  }).passthrough();
2466
- var shellEnvironmentVariableKeySchema = z20.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
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 z21 } from "zod";
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 = z21.object({ threadId: z21.string() }).passthrough();
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 z29 } from "zod";
4426
+ import { z as z30 } from "zod";
4455
4427
 
4456
4428
  // ../provider-bridge-protocol/src/handshake.ts
4457
- import { z as z22 } from "zod";
4458
- var bridgeGrammarVersionsSchema = z22.tuple([z22.number().int().positive(), z22.number().int().positive()]).refine(([min, max]) => min <= max, {
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 = z22.enum(["inject", "queue"]);
4467
- var bridgeCapabilitiesSchema = z22.object({
4468
- sessionRestore: z22.boolean().default(false),
4469
- threadArchive: z22.boolean().default(false),
4470
- threadRename: z22.boolean().default(false),
4471
- threadGoalClear: z22.boolean().default(false),
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: z22.enum(["runtime", "provider"]).default("runtime"),
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: z22.object({ configure: z22.boolean().default(false) }).default({ configure: false }),
4480
- commands: z22.object({ list: z22.boolean().default(false) }).default({ list: false })
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 = z22.object({
4483
- protocolVersion: z22.number().int().positive(),
4484
- client: z22.object({ name: z22.string().min(1), version: z22.string().min(1) }),
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 = z22.object({
4491
- protocolVersion: z22.number().int().positive(),
4492
- capabilities: z22.preprocess(
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 z23 } from "zod";
4500
- var bridgeExecutionOptionsSchema = z23.object({
4501
- model: z23.string().min(1).optional(),
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: z23.string().optional(),
4507
- envVars: z23.record(z23.string(), z23.string()).optional(),
4508
- providerOptions: z23.record(z23.string(), z23.unknown()).optional()
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 z24 } from "zod";
4513
- var providerMaintenanceParamsSchema = z24.object({
4514
- providerId: z24.string().min(1),
4515
- cwd: z24.string().min(1).optional(),
4516
- providerOptions: z24.record(z24.string(), z24.unknown()).optional()
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 = z24.enum(["thread_rewind"]);
4490
+ var providerInstallationRequirementSchema = z25.enum(["thread_rewind"]);
4519
4491
  var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
4520
4492
  requirement: providerInstallationRequirementSchema.optional(),
4521
- checkUpdates: z24.boolean().default(true)
4493
+ checkUpdates: z25.boolean().default(true)
4522
4494
  });
4523
- var providerHealthSchema = z24.object({
4524
- status: z24.enum([
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: z24.string().min(1).nullable(),
4533
- accountEmail: z24.string().nullable(),
4534
- planLabel: z24.string().min(1).nullable(),
4535
- installedVersion: z24.string().min(1).nullable(),
4536
- minimumSupportedVersion: z24.string().min(1).nullable(),
4537
- canInstall: z24.boolean(),
4538
- canUpdate: z24.boolean(),
4539
- loginCommand: z24.string().min(1).nullable(),
4540
- localLoginCommand: z24.string().min(1).nullable().optional()
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 = z24.object({
4543
- label: z24.string().min(1),
4544
- usedPercent: z24.number().min(0).max(100),
4545
- resetsAt: z24.string().min(1).nullable(),
4546
- cost: z24.object({
4547
- usedUsdCents: z24.number().int().nonnegative(),
4548
- limitUsdCents: z24.number().int().positive()
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 = z24.discriminatedUnion("status", [
4552
- z24.object({
4553
- status: z24.literal("ok"),
4554
- accountEmail: z24.string().email().nullable(),
4555
- planLabel: z24.string().min(1).nullable(),
4556
- windows: z24.array(providerUsageWindowSchema)
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
- z24.object({ status: z24.literal("not_installed") }).passthrough(),
4559
- z24.object({ status: z24.literal("unauthenticated") }).passthrough(),
4560
- z24.object({ status: z24.literal("expired") }).passthrough(),
4561
- z24.object({
4562
- status: z24.literal("error"),
4563
- message: z24.string().min(1),
4564
- planLabel: z24.string().min(1).nullable().default(null),
4565
- accountEmail: z24.string().nullable().default(null)
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 = z24.discriminatedUnion("supported", [
4569
- z24.object({ supported: z24.literal(false) }).passthrough(),
4570
- z24.object({
4571
- supported: z24.literal(true),
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 = z24.discriminatedUnion("supported", [
4576
- z24.object({ supported: z24.literal(false) }).passthrough(),
4577
- z24.object({
4578
- supported: z24.literal(true),
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 = z24.enum([
4554
+ var providerInstallationActionKindSchema = z25.enum([
4583
4555
  "install",
4584
4556
  "update"
4585
4557
  ]);
4586
- var providerInstallationActionSchema = z24.object({
4558
+ var providerInstallationActionSchema = z25.object({
4587
4559
  kind: providerInstallationActionKindSchema,
4588
- label: z24.enum(["Install", "Update"]),
4589
- command: z24.string().min(1)
4560
+ label: z25.enum(["Install", "Update"]),
4561
+ command: z25.string().min(1)
4590
4562
  }).passthrough();
4591
- var providerInstallationSourceSchema = z24.enum([
4563
+ var providerInstallationSourceSchema = z25.enum([
4592
4564
  "notInstalled",
4593
4565
  "npmGlobal",
4594
4566
  "external"
4595
4567
  ]);
4596
- var providerInstallationStatusSchema = z24.object({
4597
- executableName: z24.string().min(1),
4598
- executablePath: z24.string().min(1).nullable(),
4599
- installed: z24.boolean(),
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: z24.string().min(1).nullable(),
4602
- latestVersion: z24.string().min(1).nullable(),
4603
- minimumSupportedVersion: z24.string().min(1).nullable(),
4604
- npmPackageName: z24.string().min(1).nullable(),
4605
- npmGlobalPackageVersion: z24.string().min(1).nullable(),
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: z24.boolean(),
4608
- versionUnsupported: z24.boolean()
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 = z24.object({
4614
- command: z24.string().min(1),
4615
- args: z24.array(z24.string()).max(64),
4616
- displayCommand: z24.string().min(1)
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 = z24.discriminatedUnion(
4590
+ var providerInstallationVerificationSchema = z25.discriminatedUnion(
4619
4591
  "kind",
4620
4592
  [
4621
- z24.object({ kind: z24.literal("installed") }).passthrough(),
4622
- z24.object({
4623
- kind: z24.literal("version_changed"),
4624
- previousVersion: z24.string().min(1)
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
- z24.object({
4627
- kind: z24.literal("version_at_least"),
4628
- version: z24.string().min(1)
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 = z24.discriminatedUnion(
4604
+ var providerInstallationRunResultSchema = z25.discriminatedUnion(
4633
4605
  "available",
4634
4606
  [
4635
- z24.object({
4636
- available: z24.literal(false),
4637
- message: z24.string().min(1)
4607
+ z25.object({
4608
+ available: z25.literal(false),
4609
+ message: z25.string().min(1)
4638
4610
  }).passthrough(),
4639
- z24.object({
4640
- available: z24.literal(true),
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 z25 } from "zod";
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: z25.string().min(1),
4672
- cwd: z25.string().min(1),
4643
+ threadId: z26.string().min(1),
4644
+ cwd: z26.string().min(1),
4673
4645
  options: bridgeExecutionOptionsSchema,
4674
- dynamicTools: z25.array(dynamicToolSchema).optional(),
4675
- disallowedTools: z25.array(z25.string().min(1)).optional(),
4646
+ dynamicTools: z26.array(dynamicToolSchema).optional(),
4647
+ disallowedTools: z26.array(z26.string().min(1)).optional(),
4676
4648
  instructionMode: instructionModeSchema
4677
4649
  };
4678
- var modelListParamsSchema = z25.object({
4679
- cwd: z25.string().min(1).optional(),
4680
- envVars: z25.record(z25.string(), z25.string()).optional()
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 = z25.object({ cwd: z25.string().min(1) }).passthrough();
4683
- var threadStartParamsSchema = z25.object({
4654
+ var commandListParamsSchema = z26.object({ cwd: z26.string().min(1) }).passthrough();
4655
+ var threadStartParamsSchema = z26.object({
4684
4656
  ...sessionConstructionFields,
4685
- input: z25.array(promptInputSchema).optional()
4657
+ input: z26.array(promptInputSchema).optional()
4686
4658
  }).passthrough();
4687
- var threadResumeParamsSchema = z25.object({
4659
+ var threadResumeParamsSchema = z26.object({
4688
4660
  ...sessionConstructionFields,
4689
- providerThreadId: z25.string().min(1)
4661
+ providerThreadId: z26.string().min(1)
4690
4662
  }).passthrough();
4691
- var threadForkParamsSchema = z25.object({
4663
+ var threadForkParamsSchema = z26.object({
4692
4664
  ...sessionConstructionFields,
4693
- sourceProviderThreadId: z25.string().min(1),
4694
- sourceProviderCheckpointId: z25.string().min(1).optional()
4665
+ sourceProviderThreadId: z26.string().min(1),
4666
+ sourceProviderCheckpointId: z26.string().min(1).optional()
4695
4667
  }).passthrough();
4696
- var threadStopParamsSchema = z25.object({
4697
- threadId: z25.string().min(1),
4698
- providerThreadId: z25.string().min(1),
4699
- intent: z25.enum(["interrupt", "release"]),
4700
- activeTurnId: z25.string().min(1).nullable()
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 = z25.object({
4703
- threadId: z25.string().min(1),
4704
- providerThreadId: z25.string().min(1)
4674
+ var threadRefParams = z26.object({
4675
+ threadId: z26.string().min(1),
4676
+ providerThreadId: z26.string().min(1)
4705
4677
  }).passthrough();
4706
- var threadNameSetParamsSchema = z25.object({
4707
- threadId: z25.string().min(1),
4708
- providerThreadId: z25.string().min(1),
4709
- title: z25.string().min(1)
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: z25.string().min(1),
4713
- providerThreadId: z25.string().min(1),
4714
- input: z25.array(promptInputSchema),
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 = z25.object(turnInputFields).passthrough();
4719
- var turnSteerParamsSchema = z25.object({
4690
+ var turnStartParamsSchema = z26.object(turnInputFields).passthrough();
4691
+ var turnSteerParamsSchema = z26.object({
4720
4692
  ...turnInputFields,
4721
- expectedTurnId: z25.string().min(1)
4693
+ expectedTurnId: z26.string().min(1)
4722
4694
  }).passthrough();
4723
- var skillsConfigureRootSchema = z25.object({
4724
- id: z25.string().min(1),
4725
- path: z25.string().min(1),
4726
- skills: z25.array(
4727
- z25.object({
4728
- name: z25.string().min(1),
4729
- description: z25.string()
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 = z25.object({
4734
- roots: z25.array(skillsConfigureRootSchema)
4705
+ var skillsConfigureParamsSchema = z26.object({
4706
+ roots: z26.array(skillsConfigureRootSchema)
4735
4707
  }).passthrough();
4736
- var threadIdentityResultSchema = z25.object({
4737
- providerThreadId: z25.string().min(1),
4738
- sessionRestorable: z25.boolean().optional()
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 z27 } from "zod";
4714
+ import { z as z28 } from "zod";
4743
4715
 
4744
4716
  // ../provider-bridge-protocol/src/errors.ts
4745
- import { z as z26 } from "zod";
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 = z26.object({
4727
+ var providerRecoveryHintSchema = z27.object({
4756
4728
  kind: providerRecoveryKindSchema,
4757
- message: z26.string().min(1),
4758
- retryable: z26.boolean()
4729
+ message: z27.string().min(1),
4730
+ retryable: z27.boolean()
4759
4731
  });
4760
- var bridgeErrorDataSchema = z26.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
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 = z27.object({
4771
- threadId: z27.string().min(1),
4772
- providerThreadId: z27.string().min(1),
4773
- sessionRestorable: z27.boolean().optional()
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 = z27.object({
4776
- threadId: z27.string().min(1),
4777
- providerThreadId: z27.string().min(1).nullable(),
4778
- reason: z27.string().min(1),
4779
- contextLost: z27.boolean().default(false),
4780
- showRuntimeNote: z27.boolean().default(false)
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 = z27.object({
4783
- threadId: z27.string().min(1).optional(),
4754
+ var providerRecoveryNotificationSchema = z28.object({
4755
+ threadId: z28.string().min(1).optional(),
4784
4756
  ...providerRecoveryHintSchema.shape
4785
4757
  }).passthrough();
4786
- var errorNotificationSchema = z27.object({
4787
- threadId: z27.string().min(1).optional(),
4788
- providerThreadId: z27.string().min(1).optional(),
4789
- message: z27.string().min(1)
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 z28 } from "zod";
4794
- var toolCallRequestParamsSchema = z28.object({
4795
- providerThreadId: z28.string().min(1),
4796
- threadId: z28.string().min(1).optional(),
4797
- turnId: z28.union([z28.string().min(1), z28.null()]),
4798
- callId: z28.string().min(1),
4799
- tool: z28.string().min(1),
4800
- arguments: z28.unknown(),
4801
- providerNativeIds: z28.boolean().optional()
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 = z28.object({
4804
- success: z28.boolean(),
4805
- contentItems: z28.array(
4806
- z28.discriminatedUnion("type", [
4807
- z28.object({ type: z28.literal("inputText"), text: z28.string() }),
4808
- z28.object({
4809
- type: z28.literal("inputImage"),
4810
- imageUrl: z28.string().min(1)
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 = z28.object({
4816
- providerThreadId: z28.string().min(1),
4817
- threadId: z28.string().min(1).optional(),
4818
- turnId: z28.union([z28.string().min(1), z28.null()]),
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: z28.boolean().optional()
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 = z29.object({ threadId: z29.string(), providerThreadId: z29.string() }).passthrough();
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 = z29.preprocess(
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 z30 } from "zod";
6148
- var bridgeJsonRpcValueSchema = z30.lazy(
6149
- () => z30.union([
6150
- z30.string(),
6151
- z30.number(),
6152
- z30.boolean(),
6153
- z30.null(),
6154
- z30.array(bridgeJsonRpcValueSchema),
6155
- z30.record(z30.string(), bridgeJsonRpcValueSchema)
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 = z30.object({
6159
- jsonrpc: z30.literal("2.0"),
6160
- id: z30.union([z30.string(), z30.number()]).optional(),
6161
- method: z30.string().optional(),
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: z30.object({
6165
- code: z30.number(),
6166
- message: z30.string(),
6136
+ error: z31.object({
6137
+ code: z31.number(),
6138
+ message: z31.string(),
6167
6139
  data: bridgeJsonRpcValueSchema.optional()
6168
6140
  }).optional()
6169
6141
  });