@get-bb/plugin-sdk 0.4.56 → 0.4.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -375,6 +375,39 @@ var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
375
375
  function getCollectedSidebarFooterItems(registrations) {
376
376
  return sidebarFooterItemsByRegistrationSet.get(registrations) ?? null;
377
377
  }
378
+ function collectTitledComponent(kind, seen, registration) {
379
+ const id = requireSlotId(kind, registration?.id);
380
+ requireUniqueId(kind, seen, id);
381
+ const description = requireOptionalString(
382
+ kind,
383
+ "description",
384
+ registration.description
385
+ );
386
+ return {
387
+ id,
388
+ title: requireNonEmptyString(kind, "title", registration.title),
389
+ ...description !== void 0 ? { description } : {},
390
+ component: requireComponent(kind, registration.component)
391
+ };
392
+ }
393
+ function collectPanelAction(kind, seen, registration) {
394
+ const id = requireSlotId(kind, registration?.id);
395
+ requireUniqueId(kind, seen, id);
396
+ if (registration.run !== void 0 && typeof registration.run !== "function") {
397
+ throw new Error(`${kind}: "run" must be a function when set`);
398
+ }
399
+ if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
400
+ throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
401
+ }
402
+ return {
403
+ id,
404
+ title: requireNonEmptyString(kind, "title", registration.title),
405
+ ...registration.icon !== void 0 ? { icon: requireNonEmptyString(kind, "icon", registration.icon) } : {},
406
+ component: requireComponent(kind, registration.component),
407
+ ...registration.layout !== void 0 ? { layout: registration.layout } : {},
408
+ ...registration.run !== void 0 ? { run: registration.run } : {}
409
+ };
410
+ }
378
411
  function collectPluginAppRegistrations(definition, onComposerCustomizationRejected = (reason) => console.warn(reason)) {
379
412
  const sidebarFooterItems = [];
380
413
  const collected = {
@@ -398,8 +431,10 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
398
431
  messageActions: [],
399
432
  commandPaletteActions: [],
400
433
  providerIcons: [],
434
+ icons: [],
401
435
  timelineRenderers: [],
402
436
  environmentProviderInputs: [],
437
+ machineProviderInputs: [],
403
438
  contentScripts: []
404
439
  };
405
440
  sidebarFooterItemsByRegistrationSet.set(collected, sidebarFooterItems);
@@ -425,6 +460,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
425
460
  providerIcon: /* @__PURE__ */ new Set(),
426
461
  timelineRenderer: /* @__PURE__ */ new Set(),
427
462
  environmentProviderInputs: /* @__PURE__ */ new Set(),
463
+ machineProviderInputs: /* @__PURE__ */ new Set(),
428
464
  contentScript: /* @__PURE__ */ new Set()
429
465
  };
430
466
  definition.setup({
@@ -551,46 +587,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
551
587
  });
552
588
  },
553
589
  threadPanelAction(registration) {
554
- const kind = "slots.threadPanelAction";
555
- const id = requireSlotId(kind, registration?.id);
556
- requireUniqueId(kind, seenIds.threadPanelAction, id);
557
- if (registration.run !== void 0 && typeof registration.run !== "function") {
558
- throw new Error(`${kind}: "run" must be a function when set`);
559
- }
560
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
561
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
562
- }
563
- collected.threadPanelActions.push({
564
- id,
565
- title: requireNonEmptyString(kind, "title", registration.title),
566
- ...registration.icon !== void 0 ? {
567
- icon: requireNonEmptyString(kind, "icon", registration.icon)
568
- } : {},
569
- component: requireComponent(kind, registration.component),
570
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
571
- ...registration.run !== void 0 ? { run: registration.run } : {}
572
- });
590
+ collected.threadPanelActions.push(
591
+ collectPanelAction(
592
+ "slots.threadPanelAction",
593
+ seenIds.threadPanelAction,
594
+ registration
595
+ )
596
+ );
573
597
  },
574
598
  experimental_newThreadPanelAction(registration) {
575
- const kind = "slots.experimental_newThreadPanelAction";
576
- const id = requireSlotId(kind, registration?.id);
577
- requireUniqueId(kind, seenIds.newThreadPanelAction, id);
578
- if (registration.run !== void 0 && typeof registration.run !== "function") {
579
- throw new Error(`${kind}: "run" must be a function when set`);
580
- }
581
- if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
582
- throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
583
- }
584
- collected.newThreadPanelActions.push({
585
- id,
586
- title: requireNonEmptyString(kind, "title", registration.title),
587
- ...registration.icon !== void 0 ? {
588
- icon: requireNonEmptyString(kind, "icon", registration.icon)
589
- } : {},
590
- component: requireComponent(kind, registration.component),
591
- ...registration.layout !== void 0 ? { layout: registration.layout } : {},
592
- ...registration.run !== void 0 ? { run: registration.run } : {}
593
- });
599
+ collected.newThreadPanelActions.push(
600
+ collectPanelAction(
601
+ "slots.experimental_newThreadPanelAction",
602
+ seenIds.newThreadPanelAction,
603
+ registration
604
+ )
605
+ );
594
606
  },
595
607
  pendingInteraction(registration) {
596
608
  const kind = "slots.pendingInteraction";
@@ -618,36 +630,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
618
630
  sidebarFooterItems.push(adaptSidebarFooterAction(legacyRegistration));
619
631
  },
620
632
  experimental_sidebarNavigation(registration) {
621
- const kind = "slots.experimental_sidebarNavigation";
622
- const id = requireSlotId(kind, registration?.id);
623
- requireUniqueId(kind, seenIds.sidebarNavigation, id);
624
- const description = requireOptionalString(
625
- kind,
626
- "description",
627
- registration.description
633
+ collected.experimentalSidebarNavigations.push(
634
+ collectTitledComponent(
635
+ "slots.experimental_sidebarNavigation",
636
+ seenIds.sidebarNavigation,
637
+ registration
638
+ )
628
639
  );
629
- collected.experimentalSidebarNavigations.push({
630
- id,
631
- title: requireNonEmptyString(kind, "title", registration.title),
632
- ...description !== void 0 ? { description } : {},
633
- component: requireComponent(kind, registration.component)
634
- });
635
640
  },
636
641
  experimental_threadList(registration) {
637
- const kind = "slots.experimental_threadList";
638
- const id = requireSlotId(kind, registration?.id);
639
- requireUniqueId(kind, seenIds.threadList, id);
640
- const description = requireOptionalString(
641
- kind,
642
- "description",
643
- registration.description
642
+ collected.threadLists.push(
643
+ collectTitledComponent(
644
+ "slots.experimental_threadList",
645
+ seenIds.threadList,
646
+ registration
647
+ )
644
648
  );
645
- collected.threadLists.push({
646
- id,
647
- title: requireNonEmptyString(kind, "title", registration.title),
648
- ...description !== void 0 ? { description } : {},
649
- component: requireComponent(kind, registration.component)
650
- });
651
649
  },
652
650
  experimental_threadHeaderAction(registration) {
653
651
  const kind = "slots.experimental_threadHeaderAction";
@@ -685,36 +683,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
685
683
  });
686
684
  },
687
685
  experimental_sourceCodeRenderer(registration) {
688
- const kind = "slots.experimental_sourceCodeRenderer";
689
- const id = requireSlotId(kind, registration?.id);
690
- requireUniqueId(kind, seenIds.sourceCodeRenderer, id);
691
- const description = requireOptionalString(
692
- kind,
693
- "description",
694
- registration.description
686
+ collected.sourceCodeRenderers.push(
687
+ collectTitledComponent(
688
+ "slots.experimental_sourceCodeRenderer",
689
+ seenIds.sourceCodeRenderer,
690
+ registration
691
+ )
695
692
  );
696
- collected.sourceCodeRenderers.push({
697
- id,
698
- title: requireNonEmptyString(kind, "title", registration.title),
699
- ...description !== void 0 ? { description } : {},
700
- component: requireComponent(kind, registration.component)
701
- });
702
693
  },
703
694
  experimental_diffRenderer(registration) {
704
- const kind = "slots.experimental_diffRenderer";
705
- const id = requireSlotId(kind, registration?.id);
706
- requireUniqueId(kind, seenIds.diffRenderer, id);
707
- const description = requireOptionalString(
708
- kind,
709
- "description",
710
- registration.description
695
+ collected.diffRenderers.push(
696
+ collectTitledComponent(
697
+ "slots.experimental_diffRenderer",
698
+ seenIds.diffRenderer,
699
+ registration
700
+ )
711
701
  );
712
- collected.diffRenderers.push({
713
- id,
714
- title: requireNonEmptyString(kind, "title", registration.title),
715
- ...description !== void 0 ? { description } : {},
716
- component: requireComponent(kind, registration.component)
717
- });
718
702
  },
719
703
  messageDirective(registration) {
720
704
  const kind = "slots.messageDirective";
@@ -761,8 +745,18 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
761
745
  experimental_providerIcon(registration) {
762
746
  const kind = "slots.experimental_providerIcon";
763
747
  const providerId = requireProviderId(kind, registration?.providerId);
764
- requireUniqueId(kind, seenIds.providerIcon, providerId);
748
+ const declaredKind = registration.providerKind;
749
+ if (declaredKind !== void 0 && declaredKind !== "agent" && declaredKind !== "machine" && declaredKind !== "environment") {
750
+ throw new Error(`${kind}: invalid providerKind`);
751
+ }
752
+ const providerKind = declaredKind ?? "all";
753
+ requireUniqueId(
754
+ kind,
755
+ seenIds.providerIcon,
756
+ `${providerKind}:${providerId}`
757
+ );
765
758
  collected.providerIcons.push({
759
+ providerKind,
766
760
  providerId,
767
761
  icon: requireComponent(kind, registration.icon)
768
762
  });
@@ -791,6 +785,18 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
791
785
  environmentProviderId,
792
786
  component: requireComponent(kind, registration.component)
793
787
  });
788
+ },
789
+ experimental_machineProviderInputs(registration) {
790
+ const kind = "slots.experimental_machineProviderInputs";
791
+ const machineProviderId = requireProviderId(
792
+ kind,
793
+ registration?.machineProviderId
794
+ );
795
+ requireUniqueId(kind, seenIds.machineProviderInputs, machineProviderId);
796
+ collected.machineProviderInputs.push({
797
+ machineProviderId,
798
+ component: requireComponent(kind, registration.component)
799
+ });
794
800
  }
795
801
  },
796
802
  experimental_sidebarFooter: new SidebarFooterCollector(
@@ -810,6 +816,25 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
810
816
  }
811
817
  }
812
818
  },
819
+ experimental_icons: {
820
+ register(registration) {
821
+ const kind = "experimental_icons.register";
822
+ const name = requireNonEmptyString(
823
+ kind,
824
+ "name",
825
+ registration?.name
826
+ ).trim();
827
+ if (name.length === 0)
828
+ throw new Error(`${kind}: "name" must not be blank`);
829
+ if (collected.icons.some((icon) => icon.name === name)) {
830
+ throw new Error(`${kind}: duplicate icon name "${name}"`);
831
+ }
832
+ collected.icons.push({
833
+ name,
834
+ component: requireComponent(kind, registration.component)
835
+ });
836
+ }
837
+ },
813
838
  contentScripts: {
814
839
  register(registration) {
815
840
  const kind = "contentScripts.register";
File without changes