@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.
- package/README.md +0 -12
- package/bundled-types/bb-plugin-sdk-app.d.ts +137 -20
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +35 -3
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +406 -52
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +8 -3
- package/bundled-types/bb-plugin-sdk-machine-provider.d.ts +84 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +57 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +131 -2
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +7 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +212 -12
- package/bundled-types/bb-plugin-sdk.d.ts +749 -49
- package/dist/app.js +4 -0
- package/dist/host.js +1 -1
- package/dist/internal/host-policy.js +855 -68
- package/dist/internal/plugin-app-collector.js +116 -91
- package/dist/machine-provider.js +0 -0
- package/dist/provider-bridge-acp.js +1964 -2045
- package/dist/provider-bridge-testing.js +1378 -1404
- package/dist/provider-bridge-worker-entry.mjs +0 -1
- package/dist/provider-bridge.js +1455 -1498
- package/dist/testing/app.js +134 -91
- package/dist/testing/index.js +1092 -730
- package/package.json +7 -2
package/dist/testing/app.js
CHANGED
|
@@ -551,6 +551,39 @@ function rejectStaleNavPanelKeys(kind, registration) {
|
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
var sidebarFooterItemsByRegistrationSet = /* @__PURE__ */ new WeakMap();
|
|
554
|
+
function collectTitledComponent(kind, seen, registration) {
|
|
555
|
+
const id = requireSlotId(kind, registration?.id);
|
|
556
|
+
requireUniqueId(kind, seen, id);
|
|
557
|
+
const description = requireOptionalString(
|
|
558
|
+
kind,
|
|
559
|
+
"description",
|
|
560
|
+
registration.description
|
|
561
|
+
);
|
|
562
|
+
return {
|
|
563
|
+
id,
|
|
564
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
565
|
+
...description !== void 0 ? { description } : {},
|
|
566
|
+
component: requireComponent(kind, registration.component)
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function collectPanelAction(kind, seen, registration) {
|
|
570
|
+
const id = requireSlotId(kind, registration?.id);
|
|
571
|
+
requireUniqueId(kind, seen, id);
|
|
572
|
+
if (registration.run !== void 0 && typeof registration.run !== "function") {
|
|
573
|
+
throw new Error(`${kind}: "run" must be a function when set`);
|
|
574
|
+
}
|
|
575
|
+
if (registration.layout !== void 0 && registration.layout !== "padded" && registration.layout !== "flush") {
|
|
576
|
+
throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
id,
|
|
580
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
581
|
+
...registration.icon !== void 0 ? { icon: requireNonEmptyString(kind, "icon", registration.icon) } : {},
|
|
582
|
+
component: requireComponent(kind, registration.component),
|
|
583
|
+
...registration.layout !== void 0 ? { layout: registration.layout } : {},
|
|
584
|
+
...registration.run !== void 0 ? { run: registration.run } : {}
|
|
585
|
+
};
|
|
586
|
+
}
|
|
554
587
|
function collectPluginAppRegistrations(definition, onComposerCustomizationRejected = (reason) => console.warn(reason)) {
|
|
555
588
|
const sidebarFooterItems = [];
|
|
556
589
|
const collected = {
|
|
@@ -574,8 +607,10 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
574
607
|
messageActions: [],
|
|
575
608
|
commandPaletteActions: [],
|
|
576
609
|
providerIcons: [],
|
|
610
|
+
icons: [],
|
|
577
611
|
timelineRenderers: [],
|
|
578
612
|
environmentProviderInputs: [],
|
|
613
|
+
machineProviderInputs: [],
|
|
579
614
|
contentScripts: []
|
|
580
615
|
};
|
|
581
616
|
sidebarFooterItemsByRegistrationSet.set(collected, sidebarFooterItems);
|
|
@@ -601,6 +636,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
601
636
|
providerIcon: /* @__PURE__ */ new Set(),
|
|
602
637
|
timelineRenderer: /* @__PURE__ */ new Set(),
|
|
603
638
|
environmentProviderInputs: /* @__PURE__ */ new Set(),
|
|
639
|
+
machineProviderInputs: /* @__PURE__ */ new Set(),
|
|
604
640
|
contentScript: /* @__PURE__ */ new Set()
|
|
605
641
|
};
|
|
606
642
|
definition.setup({
|
|
@@ -727,46 +763,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
727
763
|
});
|
|
728
764
|
},
|
|
729
765
|
threadPanelAction(registration) {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
|
|
738
|
-
}
|
|
739
|
-
collected.threadPanelActions.push({
|
|
740
|
-
id,
|
|
741
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
742
|
-
...registration.icon !== void 0 ? {
|
|
743
|
-
icon: requireNonEmptyString(kind, "icon", registration.icon)
|
|
744
|
-
} : {},
|
|
745
|
-
component: requireComponent(kind, registration.component),
|
|
746
|
-
...registration.layout !== void 0 ? { layout: registration.layout } : {},
|
|
747
|
-
...registration.run !== void 0 ? { run: registration.run } : {}
|
|
748
|
-
});
|
|
766
|
+
collected.threadPanelActions.push(
|
|
767
|
+
collectPanelAction(
|
|
768
|
+
"slots.threadPanelAction",
|
|
769
|
+
seenIds.threadPanelAction,
|
|
770
|
+
registration
|
|
771
|
+
)
|
|
772
|
+
);
|
|
749
773
|
},
|
|
750
774
|
experimental_newThreadPanelAction(registration) {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
throw new Error(`${kind}: "layout" must be "padded" or "flush"`);
|
|
759
|
-
}
|
|
760
|
-
collected.newThreadPanelActions.push({
|
|
761
|
-
id,
|
|
762
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
763
|
-
...registration.icon !== void 0 ? {
|
|
764
|
-
icon: requireNonEmptyString(kind, "icon", registration.icon)
|
|
765
|
-
} : {},
|
|
766
|
-
component: requireComponent(kind, registration.component),
|
|
767
|
-
...registration.layout !== void 0 ? { layout: registration.layout } : {},
|
|
768
|
-
...registration.run !== void 0 ? { run: registration.run } : {}
|
|
769
|
-
});
|
|
775
|
+
collected.newThreadPanelActions.push(
|
|
776
|
+
collectPanelAction(
|
|
777
|
+
"slots.experimental_newThreadPanelAction",
|
|
778
|
+
seenIds.newThreadPanelAction,
|
|
779
|
+
registration
|
|
780
|
+
)
|
|
781
|
+
);
|
|
770
782
|
},
|
|
771
783
|
pendingInteraction(registration) {
|
|
772
784
|
const kind = "slots.pendingInteraction";
|
|
@@ -794,36 +806,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
794
806
|
sidebarFooterItems.push(adaptSidebarFooterAction(legacyRegistration));
|
|
795
807
|
},
|
|
796
808
|
experimental_sidebarNavigation(registration) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
registration.description
|
|
809
|
+
collected.experimentalSidebarNavigations.push(
|
|
810
|
+
collectTitledComponent(
|
|
811
|
+
"slots.experimental_sidebarNavigation",
|
|
812
|
+
seenIds.sidebarNavigation,
|
|
813
|
+
registration
|
|
814
|
+
)
|
|
804
815
|
);
|
|
805
|
-
collected.experimentalSidebarNavigations.push({
|
|
806
|
-
id,
|
|
807
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
808
|
-
...description !== void 0 ? { description } : {},
|
|
809
|
-
component: requireComponent(kind, registration.component)
|
|
810
|
-
});
|
|
811
816
|
},
|
|
812
817
|
experimental_threadList(registration) {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
registration.description
|
|
818
|
+
collected.threadLists.push(
|
|
819
|
+
collectTitledComponent(
|
|
820
|
+
"slots.experimental_threadList",
|
|
821
|
+
seenIds.threadList,
|
|
822
|
+
registration
|
|
823
|
+
)
|
|
820
824
|
);
|
|
821
|
-
collected.threadLists.push({
|
|
822
|
-
id,
|
|
823
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
824
|
-
...description !== void 0 ? { description } : {},
|
|
825
|
-
component: requireComponent(kind, registration.component)
|
|
826
|
-
});
|
|
827
825
|
},
|
|
828
826
|
experimental_threadHeaderAction(registration) {
|
|
829
827
|
const kind = "slots.experimental_threadHeaderAction";
|
|
@@ -861,36 +859,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
861
859
|
});
|
|
862
860
|
},
|
|
863
861
|
experimental_sourceCodeRenderer(registration) {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
registration.description
|
|
862
|
+
collected.sourceCodeRenderers.push(
|
|
863
|
+
collectTitledComponent(
|
|
864
|
+
"slots.experimental_sourceCodeRenderer",
|
|
865
|
+
seenIds.sourceCodeRenderer,
|
|
866
|
+
registration
|
|
867
|
+
)
|
|
871
868
|
);
|
|
872
|
-
collected.sourceCodeRenderers.push({
|
|
873
|
-
id,
|
|
874
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
875
|
-
...description !== void 0 ? { description } : {},
|
|
876
|
-
component: requireComponent(kind, registration.component)
|
|
877
|
-
});
|
|
878
869
|
},
|
|
879
870
|
experimental_diffRenderer(registration) {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
registration.description
|
|
871
|
+
collected.diffRenderers.push(
|
|
872
|
+
collectTitledComponent(
|
|
873
|
+
"slots.experimental_diffRenderer",
|
|
874
|
+
seenIds.diffRenderer,
|
|
875
|
+
registration
|
|
876
|
+
)
|
|
887
877
|
);
|
|
888
|
-
collected.diffRenderers.push({
|
|
889
|
-
id,
|
|
890
|
-
title: requireNonEmptyString(kind, "title", registration.title),
|
|
891
|
-
...description !== void 0 ? { description } : {},
|
|
892
|
-
component: requireComponent(kind, registration.component)
|
|
893
|
-
});
|
|
894
878
|
},
|
|
895
879
|
messageDirective(registration) {
|
|
896
880
|
const kind = "slots.messageDirective";
|
|
@@ -937,8 +921,18 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
937
921
|
experimental_providerIcon(registration) {
|
|
938
922
|
const kind = "slots.experimental_providerIcon";
|
|
939
923
|
const providerId = requireProviderId(kind, registration?.providerId);
|
|
940
|
-
|
|
924
|
+
const declaredKind = registration.providerKind;
|
|
925
|
+
if (declaredKind !== void 0 && declaredKind !== "agent" && declaredKind !== "machine" && declaredKind !== "environment") {
|
|
926
|
+
throw new Error(`${kind}: invalid providerKind`);
|
|
927
|
+
}
|
|
928
|
+
const providerKind = declaredKind ?? "all";
|
|
929
|
+
requireUniqueId(
|
|
930
|
+
kind,
|
|
931
|
+
seenIds.providerIcon,
|
|
932
|
+
`${providerKind}:${providerId}`
|
|
933
|
+
);
|
|
941
934
|
collected.providerIcons.push({
|
|
935
|
+
providerKind,
|
|
942
936
|
providerId,
|
|
943
937
|
icon: requireComponent(kind, registration.icon)
|
|
944
938
|
});
|
|
@@ -967,6 +961,18 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
967
961
|
environmentProviderId,
|
|
968
962
|
component: requireComponent(kind, registration.component)
|
|
969
963
|
});
|
|
964
|
+
},
|
|
965
|
+
experimental_machineProviderInputs(registration) {
|
|
966
|
+
const kind = "slots.experimental_machineProviderInputs";
|
|
967
|
+
const machineProviderId = requireProviderId(
|
|
968
|
+
kind,
|
|
969
|
+
registration?.machineProviderId
|
|
970
|
+
);
|
|
971
|
+
requireUniqueId(kind, seenIds.machineProviderInputs, machineProviderId);
|
|
972
|
+
collected.machineProviderInputs.push({
|
|
973
|
+
machineProviderId,
|
|
974
|
+
component: requireComponent(kind, registration.component)
|
|
975
|
+
});
|
|
970
976
|
}
|
|
971
977
|
},
|
|
972
978
|
experimental_sidebarFooter: new SidebarFooterCollector(
|
|
@@ -986,6 +992,25 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
986
992
|
}
|
|
987
993
|
}
|
|
988
994
|
},
|
|
995
|
+
experimental_icons: {
|
|
996
|
+
register(registration) {
|
|
997
|
+
const kind = "experimental_icons.register";
|
|
998
|
+
const name = requireNonEmptyString(
|
|
999
|
+
kind,
|
|
1000
|
+
"name",
|
|
1001
|
+
registration?.name
|
|
1002
|
+
).trim();
|
|
1003
|
+
if (name.length === 0)
|
|
1004
|
+
throw new Error(`${kind}: "name" must not be blank`);
|
|
1005
|
+
if (collected.icons.some((icon) => icon.name === name)) {
|
|
1006
|
+
throw new Error(`${kind}: duplicate icon name "${name}"`);
|
|
1007
|
+
}
|
|
1008
|
+
collected.icons.push({
|
|
1009
|
+
name,
|
|
1010
|
+
component: requireComponent(kind, registration.component)
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
989
1014
|
contentScripts: {
|
|
990
1015
|
register(registration) {
|
|
991
1016
|
const kind = "contentScripts.register";
|
|
@@ -1499,6 +1524,24 @@ var testPluginSdkApp = {
|
|
|
1499
1524
|
ThreadChat: TestThreadChat,
|
|
1500
1525
|
Markdown: TestMarkdown,
|
|
1501
1526
|
experimental_FileLink: TestFileLink,
|
|
1527
|
+
experimental_Icon: ({ name, fallback, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "data-icon": name, "data-icon-fallback": fallback }),
|
|
1528
|
+
experimental_ProviderIcon: ({
|
|
1529
|
+
providerKind,
|
|
1530
|
+
provider,
|
|
1531
|
+
fallback,
|
|
1532
|
+
...props
|
|
1533
|
+
}) => /* @__PURE__ */ jsx(
|
|
1534
|
+
"span",
|
|
1535
|
+
{
|
|
1536
|
+
...props,
|
|
1537
|
+
"data-provider-kind": providerKind,
|
|
1538
|
+
"data-provider-id": provider.id,
|
|
1539
|
+
"data-provider-logo": provider.logoUrl ?? void 0,
|
|
1540
|
+
"data-provider-glyph": (typeof provider.icon === "string" ? provider.icon : provider.icon?.glyph) ?? void 0,
|
|
1541
|
+
"data-provider-tint": provider.strings?.iconTint == null ? void 0 : JSON.stringify(provider.strings.iconTint),
|
|
1542
|
+
"data-provider-fallback": fallback
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1502
1545
|
UrlLink: TestUrlLink,
|
|
1503
1546
|
experimental_NewThreadComposer: TestNewThreadComposer,
|
|
1504
1547
|
experimental_ProviderModelPicker: TestProviderModelPicker,
|