@get-bb/plugin-sdk 0.4.12 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-types/bb-plugin-sdk-app.d.ts +112 -2
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +8 -0
- package/bundled-types/bb-plugin-sdk.d.ts +145 -1
- package/dist/app.js +4 -0
- package/dist/internal/plugin-app-collector.js +19 -0
- package/dist/provider-bridge-testing.js +33 -0
- package/dist/provider-bridge.js +542 -523
- package/dist/testing/app.js +148 -0
- package/package.json +1 -1
package/dist/testing/app.js
CHANGED
|
@@ -400,6 +400,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
400
400
|
diffRenderers: [],
|
|
401
401
|
messageDirectives: [],
|
|
402
402
|
messageActions: [],
|
|
403
|
+
commandPaletteActions: [],
|
|
403
404
|
providerIcons: [],
|
|
404
405
|
contentScripts: []
|
|
405
406
|
};
|
|
@@ -419,6 +420,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
419
420
|
diffRenderer: /* @__PURE__ */ new Set(),
|
|
420
421
|
messageDirective: /* @__PURE__ */ new Set(),
|
|
421
422
|
messageAction: /* @__PURE__ */ new Set(),
|
|
423
|
+
commandPaletteAction: /* @__PURE__ */ new Set(),
|
|
422
424
|
providerIcon: /* @__PURE__ */ new Set(),
|
|
423
425
|
contentScript: /* @__PURE__ */ new Set()
|
|
424
426
|
};
|
|
@@ -714,6 +716,23 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
714
716
|
run: registration.run
|
|
715
717
|
});
|
|
716
718
|
},
|
|
719
|
+
commandPaletteAction(registration) {
|
|
720
|
+
const kind = "slots.commandPaletteAction";
|
|
721
|
+
const id = requireSlotId(kind, registration?.id);
|
|
722
|
+
requireUniqueId(kind, seenIds.commandPaletteAction, id);
|
|
723
|
+
if (typeof registration.run !== "function") {
|
|
724
|
+
throw new Error(`${kind}: "run" must be a function`);
|
|
725
|
+
}
|
|
726
|
+
if (registration.isAvailable !== void 0 && typeof registration.isAvailable !== "function") {
|
|
727
|
+
throw new Error(`${kind}: "isAvailable" must be a function`);
|
|
728
|
+
}
|
|
729
|
+
collected.commandPaletteActions.push({
|
|
730
|
+
id,
|
|
731
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
732
|
+
...registration.isAvailable !== void 0 ? { isAvailable: registration.isAvailable } : {},
|
|
733
|
+
run: registration.run
|
|
734
|
+
});
|
|
735
|
+
},
|
|
717
736
|
experimental_providerIcon(registration) {
|
|
718
737
|
const kind = "slots.experimental_providerIcon";
|
|
719
738
|
const providerId = requireProviderId(kind, registration?.providerId);
|
|
@@ -957,6 +976,133 @@ function TestNewThreadComposer({
|
|
|
957
976
|
}
|
|
958
977
|
);
|
|
959
978
|
}
|
|
979
|
+
function TestProviderModelPicker({
|
|
980
|
+
value,
|
|
981
|
+
onChange,
|
|
982
|
+
routing,
|
|
983
|
+
allowProviderChange = true,
|
|
984
|
+
align = "start",
|
|
985
|
+
disabled,
|
|
986
|
+
className
|
|
987
|
+
}) {
|
|
988
|
+
const [draft, setDraft] = useState(value);
|
|
989
|
+
useEffect(() => setDraft(value), [value]);
|
|
990
|
+
const reasoningLevels = [
|
|
991
|
+
"none",
|
|
992
|
+
"low",
|
|
993
|
+
"medium",
|
|
994
|
+
"high",
|
|
995
|
+
"xhigh",
|
|
996
|
+
"ultracode",
|
|
997
|
+
"max",
|
|
998
|
+
"ultra"
|
|
999
|
+
];
|
|
1000
|
+
return /* @__PURE__ */ jsx(
|
|
1001
|
+
"div",
|
|
1002
|
+
{
|
|
1003
|
+
"data-testid": "bb-provider-model-picker",
|
|
1004
|
+
"data-routing-kind": routing?.kind ?? "primary",
|
|
1005
|
+
"data-routing-id": routing === void 0 ? "" : routing.kind === "host" ? routing.hostId : routing.environmentId,
|
|
1006
|
+
"data-disabled": disabled ? "true" : "false",
|
|
1007
|
+
"data-provider-change-allowed": allowProviderChange ? "true" : "false",
|
|
1008
|
+
"data-align": align,
|
|
1009
|
+
className,
|
|
1010
|
+
children: /* @__PURE__ */ jsxs("fieldset", { disabled, className: "contents", children: [
|
|
1011
|
+
/* @__PURE__ */ jsx(
|
|
1012
|
+
"input",
|
|
1013
|
+
{
|
|
1014
|
+
"aria-label": "Provider ID",
|
|
1015
|
+
disabled: !allowProviderChange,
|
|
1016
|
+
value: draft.providerId,
|
|
1017
|
+
onChange: (event) => setDraft((current) => ({
|
|
1018
|
+
...current,
|
|
1019
|
+
providerId: event.target.value
|
|
1020
|
+
}))
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
/* @__PURE__ */ jsx(
|
|
1024
|
+
"input",
|
|
1025
|
+
{
|
|
1026
|
+
"aria-label": "Model",
|
|
1027
|
+
value: draft.model,
|
|
1028
|
+
onChange: (event) => setDraft((current) => ({ ...current, model: event.target.value }))
|
|
1029
|
+
}
|
|
1030
|
+
),
|
|
1031
|
+
/* @__PURE__ */ jsx(
|
|
1032
|
+
"input",
|
|
1033
|
+
{
|
|
1034
|
+
"aria-label": "Reasoning level",
|
|
1035
|
+
value: draft.reasoningLevel,
|
|
1036
|
+
onChange: (event) => {
|
|
1037
|
+
const reasoningLevel = reasoningLevels.find(
|
|
1038
|
+
(candidate) => candidate === event.target.value
|
|
1039
|
+
);
|
|
1040
|
+
if (reasoningLevel === void 0) return;
|
|
1041
|
+
setDraft((current) => ({ ...current, reasoningLevel }));
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
),
|
|
1045
|
+
/* @__PURE__ */ jsxs(
|
|
1046
|
+
"select",
|
|
1047
|
+
{
|
|
1048
|
+
"aria-label": "Service tier",
|
|
1049
|
+
value: draft.serviceTier ?? "",
|
|
1050
|
+
onChange: (event) => setDraft((current) => {
|
|
1051
|
+
const serviceTier = event.target.value;
|
|
1052
|
+
if (serviceTier !== "fast" && serviceTier !== "default") {
|
|
1053
|
+
const next = { ...current };
|
|
1054
|
+
delete next.serviceTier;
|
|
1055
|
+
return next;
|
|
1056
|
+
}
|
|
1057
|
+
return { ...current, serviceTier };
|
|
1058
|
+
}),
|
|
1059
|
+
children: [
|
|
1060
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Unsupported" }),
|
|
1061
|
+
/* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
|
|
1062
|
+
/* @__PURE__ */ jsx("option", { value: "fast", children: "Fast" })
|
|
1063
|
+
]
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange(draft), children: "Apply execution selection" })
|
|
1067
|
+
] })
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
function TestPermissionModePicker({
|
|
1072
|
+
providerId,
|
|
1073
|
+
value,
|
|
1074
|
+
onChange,
|
|
1075
|
+
routing,
|
|
1076
|
+
align = "end",
|
|
1077
|
+
disabled,
|
|
1078
|
+
className
|
|
1079
|
+
}) {
|
|
1080
|
+
return /* @__PURE__ */ jsxs(
|
|
1081
|
+
"select",
|
|
1082
|
+
{
|
|
1083
|
+
"aria-label": "Permission mode",
|
|
1084
|
+
value,
|
|
1085
|
+
disabled,
|
|
1086
|
+
"data-testid": "bb-permission-mode-picker",
|
|
1087
|
+
"data-provider-id": providerId,
|
|
1088
|
+
"data-align": align,
|
|
1089
|
+
"data-routing-kind": routing?.kind ?? "primary",
|
|
1090
|
+
"data-routing-id": routing === void 0 ? "" : routing.kind === "host" ? routing.hostId : routing.environmentId,
|
|
1091
|
+
className,
|
|
1092
|
+
onChange: (event) => {
|
|
1093
|
+
const permissionMode = event.target.value;
|
|
1094
|
+
if (permissionMode === "accept-edits" || permissionMode === "auto" || permissionMode === "full") {
|
|
1095
|
+
onChange(permissionMode);
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
children: [
|
|
1099
|
+
/* @__PURE__ */ jsx("option", { value: "accept-edits", children: "Accept Edits" }),
|
|
1100
|
+
/* @__PURE__ */ jsx("option", { value: "auto", children: "Approve for me" }),
|
|
1101
|
+
/* @__PURE__ */ jsx("option", { value: "full", children: "Full Access" })
|
|
1102
|
+
]
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
}
|
|
960
1106
|
function TestSourceCode({
|
|
961
1107
|
content,
|
|
962
1108
|
path,
|
|
@@ -1087,6 +1233,8 @@ var testPluginSdkApp = {
|
|
|
1087
1233
|
experimental_FileLink: TestFileLink,
|
|
1088
1234
|
experimental_UrlLink: TestUrlLink,
|
|
1089
1235
|
experimental_NewThreadComposer: TestNewThreadComposer,
|
|
1236
|
+
experimental_ProviderModelPicker: TestProviderModelPicker,
|
|
1237
|
+
experimental_PermissionModePicker: TestPermissionModePicker,
|
|
1090
1238
|
experimental_SourceCode: TestSourceCode,
|
|
1091
1239
|
experimental_Diff: TestDiff,
|
|
1092
1240
|
experimental_useSidebarThreads() {
|