@get-bb/plugin-sdk 0.6.26 → 0.6.33
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 +10 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +148 -281
- package/bundled-types/bb-plugin-sdk-host.d.ts +30 -3
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +1 -1
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +1 -3
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +27 -30
- package/bundled-types/bb-plugin-sdk.d.ts +158 -278
- package/dist/app.js +4 -12
- package/dist/host.js +111 -11
- package/dist/internal/host-policy.js +5 -2
- package/dist/internal/plugin-app-collector.js +0 -22
- package/dist/provider-bridge-acp.js +133 -42
- package/dist/provider-bridge-testing.js +8 -2
- package/dist/provider-bridge.js +3 -1
- package/dist/testing/app.js +29 -99
- package/dist/testing/index.js +7 -2
- package/package.json +1 -1
package/dist/provider-bridge.js
CHANGED
|
@@ -1763,6 +1763,7 @@ import { z as z12 } from "zod";
|
|
|
1763
1763
|
// ../domain/src/plugin-interaction-limits.ts
|
|
1764
1764
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
1765
1765
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
1766
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1766
1767
|
function jsonByteLength(value) {
|
|
1767
1768
|
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
1768
1769
|
}
|
|
@@ -11380,7 +11381,8 @@ var providerHealthSchema = z30.object({
|
|
|
11380
11381
|
minimumSupportedVersion: z30.string().min(1).nullable(),
|
|
11381
11382
|
canInstall: z30.boolean(),
|
|
11382
11383
|
canUpdate: z30.boolean(),
|
|
11383
|
-
loginCommand: z30.string().min(1).nullable()
|
|
11384
|
+
loginCommand: z30.string().min(1).nullable(),
|
|
11385
|
+
localLoginCommand: z30.string().min(1).nullable().optional()
|
|
11384
11386
|
}).passthrough();
|
|
11385
11387
|
var providerUsageWindowSchema = z30.object({
|
|
11386
11388
|
label: z30.string().min(1),
|
package/dist/testing/app.js
CHANGED
|
@@ -1174,8 +1174,6 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1174
1174
|
pendingInteractions: [],
|
|
1175
1175
|
sidebarFooterActions: [],
|
|
1176
1176
|
experimentalSidebarFooterItems: [],
|
|
1177
|
-
experimentalSidebarNavigations: [],
|
|
1178
|
-
experimentalSidebarHeaders: [],
|
|
1179
1177
|
threadLists: [],
|
|
1180
1178
|
threadHeaderActions: [],
|
|
1181
1179
|
browserToolbarActions: [],
|
|
@@ -1204,8 +1202,6 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1204
1202
|
composerPopup: /* @__PURE__ */ new Set(),
|
|
1205
1203
|
pendingInteraction: /* @__PURE__ */ new Set(),
|
|
1206
1204
|
sidebarFooterItem: /* @__PURE__ */ new Set(),
|
|
1207
|
-
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
1208
|
-
sidebarHeader: /* @__PURE__ */ new Set(),
|
|
1209
1205
|
threadList: /* @__PURE__ */ new Set(),
|
|
1210
1206
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
1211
1207
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
@@ -1425,24 +1421,6 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
1425
1421
|
collected.sidebarFooterActions.push(legacyRegistration);
|
|
1426
1422
|
sidebarFooterItems.push(adaptSidebarFooterAction(legacyRegistration));
|
|
1427
1423
|
},
|
|
1428
|
-
experimental_sidebarNavigation(registration) {
|
|
1429
|
-
collected.experimentalSidebarNavigations.push(
|
|
1430
|
-
collectTitledComponent(
|
|
1431
|
-
"slots.experimental_sidebarNavigation",
|
|
1432
|
-
seenIds.sidebarNavigation,
|
|
1433
|
-
registration
|
|
1434
|
-
)
|
|
1435
|
-
);
|
|
1436
|
-
},
|
|
1437
|
-
experimental_sidebarHeader(registration) {
|
|
1438
|
-
collected.experimentalSidebarHeaders.push(
|
|
1439
|
-
collectTitledComponent(
|
|
1440
|
-
"slots.experimental_sidebarHeader",
|
|
1441
|
-
seenIds.sidebarHeader,
|
|
1442
|
-
registration
|
|
1443
|
-
)
|
|
1444
|
-
);
|
|
1445
|
-
},
|
|
1446
1424
|
experimental_threadList(registration) {
|
|
1447
1425
|
collected.threadLists.push(
|
|
1448
1426
|
collectTitledComponent(
|
|
@@ -1716,19 +1694,6 @@ function TestThreadTitle({ threadId }) {
|
|
|
1716
1694
|
if (thread === void 0) return null;
|
|
1717
1695
|
return /* @__PURE__ */ jsx("span", { "data-thread-title": threadId, children: thread.displayTitle });
|
|
1718
1696
|
}
|
|
1719
|
-
function TestSidebarNavigationIcon({
|
|
1720
|
-
icon,
|
|
1721
|
-
className
|
|
1722
|
-
}) {
|
|
1723
|
-
return /* @__PURE__ */ jsx(
|
|
1724
|
-
"span",
|
|
1725
|
-
{
|
|
1726
|
-
"aria-hidden": "true",
|
|
1727
|
-
className,
|
|
1728
|
-
"data-sidebar-navigation-icon": icon.kind === "host" ? icon.name : `${icon.pluginId}/${icon.icon ?? ""}`
|
|
1729
|
-
}
|
|
1730
|
-
);
|
|
1731
|
-
}
|
|
1732
1697
|
function SlotLifecycleGuard({
|
|
1733
1698
|
children,
|
|
1734
1699
|
onUnmount
|
|
@@ -2162,6 +2127,15 @@ function TestDiff({
|
|
|
2162
2127
|
}
|
|
2163
2128
|
);
|
|
2164
2129
|
}
|
|
2130
|
+
var activeClipboard = null;
|
|
2131
|
+
function captureClipboardWrites(result) {
|
|
2132
|
+
const writes = [];
|
|
2133
|
+
activeClipboard = (content) => {
|
|
2134
|
+
writes.push({ ...content });
|
|
2135
|
+
return result?.(content) ?? Promise.resolve(true);
|
|
2136
|
+
};
|
|
2137
|
+
return writes;
|
|
2138
|
+
}
|
|
2165
2139
|
var testPluginSdkApp = {
|
|
2166
2140
|
definePluginApp,
|
|
2167
2141
|
useRpc() {
|
|
@@ -2297,6 +2271,9 @@ var testPluginSdkApp = {
|
|
|
2297
2271
|
experimental_useCodeTheme() {
|
|
2298
2272
|
return useSlotEnv("experimental_useCodeTheme").codeTheme;
|
|
2299
2273
|
},
|
|
2274
|
+
experimental_copyToClipboard(content) {
|
|
2275
|
+
return activeClipboard?.(content) ?? Promise.resolve(true);
|
|
2276
|
+
},
|
|
2300
2277
|
experimental_useSidebarThreadActions() {
|
|
2301
2278
|
return useSlotEnv("experimental_useSidebarThreadActions").sidebarActions;
|
|
2302
2279
|
},
|
|
@@ -2340,28 +2317,6 @@ var testPluginSdkApp = {
|
|
|
2340
2317
|
return env.sidebarShortcuts.get(threadId) ?? null;
|
|
2341
2318
|
},
|
|
2342
2319
|
ThreadTitle: TestThreadTitle,
|
|
2343
|
-
experimental_useSidebarNavigation() {
|
|
2344
|
-
return useSlotEnv("experimental_useSidebarNavigation").sidebarNavigation;
|
|
2345
|
-
},
|
|
2346
|
-
experimental_useSidebarNavigationSplit(itemId, _options) {
|
|
2347
|
-
const env = useSlotEnv("experimental_useSidebarNavigationSplit");
|
|
2348
|
-
return useMemo(
|
|
2349
|
-
() => ({
|
|
2350
|
-
splitProps: {
|
|
2351
|
-
onPointerDown: () => {
|
|
2352
|
-
env.sidebarNavigationCalls.push({
|
|
2353
|
-
method: "beginSplitDrag",
|
|
2354
|
-
itemId
|
|
2355
|
-
});
|
|
2356
|
-
}
|
|
2357
|
-
},
|
|
2358
|
-
isAvailable: true,
|
|
2359
|
-
layout: null
|
|
2360
|
-
}),
|
|
2361
|
-
[env, itemId]
|
|
2362
|
-
);
|
|
2363
|
-
},
|
|
2364
|
-
experimental_SidebarNavigationIcon: TestSidebarNavigationIcon,
|
|
2365
2320
|
useEnvironmentProviders() {
|
|
2366
2321
|
return useSlotEnv("useEnvironmentProviders").environmentProviders;
|
|
2367
2322
|
},
|
|
@@ -2426,6 +2381,9 @@ async function mountPluginContentScripts(app, options) {
|
|
|
2426
2381
|
const mounted = [];
|
|
2427
2382
|
const threadRowStatuses = /* @__PURE__ */ new Map();
|
|
2428
2383
|
const threadRowStatusCalls = [];
|
|
2384
|
+
const experimental_clipboardWrites = captureClipboardWrites(
|
|
2385
|
+
options.experimental_copyToClipboard
|
|
2386
|
+
);
|
|
2429
2387
|
let disposed = false;
|
|
2430
2388
|
const setThreadRowStatus = (threadId, status) => {
|
|
2431
2389
|
if (controller.signal.aborted) return;
|
|
@@ -2505,7 +2463,8 @@ async function mountPluginContentScripts(app, options) {
|
|
|
2505
2463
|
getThreadRowStatus(threadId) {
|
|
2506
2464
|
const status = threadRowStatuses.get(threadId);
|
|
2507
2465
|
return status === void 0 ? null : { ...status };
|
|
2508
|
-
}
|
|
2466
|
+
},
|
|
2467
|
+
experimental_clipboardWrites
|
|
2509
2468
|
},
|
|
2510
2469
|
lifecycle: { dispose }
|
|
2511
2470
|
};
|
|
@@ -2650,43 +2609,6 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2650
2609
|
}
|
|
2651
2610
|
};
|
|
2652
2611
|
const sidebarActionCalls = [];
|
|
2653
|
-
const sidebarNavigationCalls = [];
|
|
2654
|
-
const sidebarNavigation = {
|
|
2655
|
-
items: options.sidebarNavigation?.items ?? [],
|
|
2656
|
-
activeItemId: options.sidebarNavigation?.activeItemId ?? null,
|
|
2657
|
-
isShortcutModifierHeld: options.sidebarNavigation?.isShortcutModifierHeld ?? false,
|
|
2658
|
-
actions: {
|
|
2659
|
-
activate(itemId, activationOptions) {
|
|
2660
|
-
sidebarNavigationCalls.push({
|
|
2661
|
-
method: "activate",
|
|
2662
|
-
itemId,
|
|
2663
|
-
openInSplit: activationOptions.openInSplit
|
|
2664
|
-
});
|
|
2665
|
-
},
|
|
2666
|
-
setVisible(itemId, isVisible) {
|
|
2667
|
-
sidebarNavigationCalls.push({
|
|
2668
|
-
method: "setVisible",
|
|
2669
|
-
itemId,
|
|
2670
|
-
isVisible
|
|
2671
|
-
});
|
|
2672
|
-
},
|
|
2673
|
-
setOrder(itemIds) {
|
|
2674
|
-
sidebarNavigationCalls.push({
|
|
2675
|
-
method: "setOrder",
|
|
2676
|
-
itemIds: [...itemIds]
|
|
2677
|
-
});
|
|
2678
|
-
},
|
|
2679
|
-
openCustomize() {
|
|
2680
|
-
sidebarNavigationCalls.push({ method: "openCustomize" });
|
|
2681
|
-
},
|
|
2682
|
-
openDetails(itemId) {
|
|
2683
|
-
sidebarNavigationCalls.push({ method: "openDetails", itemId });
|
|
2684
|
-
},
|
|
2685
|
-
async disablePlugin(itemId) {
|
|
2686
|
-
sidebarNavigationCalls.push({ method: "disablePlugin", itemId });
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
};
|
|
2690
2612
|
const sidebarPullRequests = new Map(
|
|
2691
2613
|
Object.entries(options.sidebarPullRequests ?? {})
|
|
2692
2614
|
);
|
|
@@ -2722,6 +2644,9 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2722
2644
|
name: options.codeTheme?.name ?? "pierre-light",
|
|
2723
2645
|
theme: options.codeTheme?.theme ?? null
|
|
2724
2646
|
};
|
|
2647
|
+
const experimental_clipboardWrites = captureClipboardWrites(
|
|
2648
|
+
options.experimental_copyToClipboard
|
|
2649
|
+
);
|
|
2725
2650
|
const sidebarActions = {
|
|
2726
2651
|
open(threadId2, openOptions) {
|
|
2727
2652
|
sidebarActionCalls.push({
|
|
@@ -2802,6 +2727,13 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2802
2727
|
options: fileOptions
|
|
2803
2728
|
});
|
|
2804
2729
|
return options.openFileExternally?.(fileOptions) ?? false;
|
|
2730
|
+
},
|
|
2731
|
+
async experimental_openTerminal(terminalOptions) {
|
|
2732
|
+
navigateCalls.push({
|
|
2733
|
+
method: "experimental_openTerminal",
|
|
2734
|
+
options: terminalOptions
|
|
2735
|
+
});
|
|
2736
|
+
return options.openTerminal?.(terminalOptions) ?? false;
|
|
2805
2737
|
}
|
|
2806
2738
|
};
|
|
2807
2739
|
const projectId = options.context?.projectId ?? null;
|
|
@@ -3062,8 +2994,6 @@ ${block}
|
|
|
3062
2994
|
sidebarRowStatuses,
|
|
3063
2995
|
sidebarShortcuts,
|
|
3064
2996
|
sidebarSplitLayout: options.sidebarSplitLayout ?? null,
|
|
3065
|
-
sidebarNavigation,
|
|
3066
|
-
sidebarNavigationCalls,
|
|
3067
2997
|
environmentProviders,
|
|
3068
2998
|
sdk,
|
|
3069
2999
|
sdkCalls,
|
|
@@ -3135,8 +3065,8 @@ ${block}
|
|
|
3135
3065
|
navigateCalls,
|
|
3136
3066
|
experimental_fixedTabOpenCalls,
|
|
3137
3067
|
sidebarActionCalls,
|
|
3138
|
-
sidebarNavigationCalls,
|
|
3139
3068
|
sdkCalls,
|
|
3069
|
+
experimental_clipboardWrites,
|
|
3140
3070
|
composer: composerLog,
|
|
3141
3071
|
behavior: {
|
|
3142
3072
|
emitRealtime,
|
|
@@ -3149,8 +3079,8 @@ ${block}
|
|
|
3149
3079
|
navigateCalls,
|
|
3150
3080
|
experimental_fixedTabOpenCalls,
|
|
3151
3081
|
sidebarActionCalls,
|
|
3152
|
-
sidebarNavigationCalls,
|
|
3153
3082
|
sdkCalls,
|
|
3083
|
+
experimental_clipboardWrites,
|
|
3154
3084
|
composer: composerLog
|
|
3155
3085
|
},
|
|
3156
3086
|
lifecycle: { rerender: rerenderSlot, unmount: unmountSlot }
|
package/dist/testing/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var RESERVED_BB_CLI_COMMANDS = [
|
|
|
50
50
|
// ../domain/src/plugin-interaction-limits.ts
|
|
51
51
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
52
52
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
53
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
53
54
|
|
|
54
55
|
// ../domain/src/provider-fork.ts
|
|
55
56
|
import { z } from "zod";
|
|
@@ -2478,8 +2479,10 @@ function normalizeInteractionRequest(request) {
|
|
|
2478
2479
|
throw new Error("ui.requestInput payload must be JSON-serializable");
|
|
2479
2480
|
}
|
|
2480
2481
|
const timeoutMs = request.timeoutMs ?? 10 * 60 * 1e3;
|
|
2481
|
-
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs >
|
|
2482
|
-
throw new Error(
|
|
2482
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > PLUGIN_INTERACTION_MAX_TIMEOUT_MS) {
|
|
2483
|
+
throw new Error(
|
|
2484
|
+
`ui.requestInput timeoutMs must be between 1 and ${PLUGIN_INTERACTION_MAX_TIMEOUT_MS}`
|
|
2485
|
+
);
|
|
2483
2486
|
}
|
|
2484
2487
|
if (request.describeSubmission !== void 0 && typeof request.describeSubmission !== "function") {
|
|
2485
2488
|
throw new Error("ui.requestInput describeSubmission must be a function");
|
|
@@ -3303,6 +3306,7 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3303
3306
|
"experimental_thread.events": [],
|
|
3304
3307
|
"experimental_terminal.input": [],
|
|
3305
3308
|
"experimental_host.deleted": [],
|
|
3309
|
+
"experimental_environment.removed": [],
|
|
3306
3310
|
"thread.created": [],
|
|
3307
3311
|
"thread.active": [],
|
|
3308
3312
|
"thread.idle": [],
|
|
@@ -3740,6 +3744,7 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3740
3744
|
return {
|
|
3741
3745
|
"experimental_thread.events": threadEventHandlers["experimental_thread.events"].length,
|
|
3742
3746
|
"experimental_terminal.input": threadEventHandlers["experimental_terminal.input"].length,
|
|
3747
|
+
"experimental_environment.removed": threadEventHandlers["experimental_environment.removed"].length,
|
|
3743
3748
|
"experimental_host.deleted": threadEventHandlers["experimental_host.deleted"].length,
|
|
3744
3749
|
"thread.created": threadEventHandlers["thread.created"].length,
|
|
3745
3750
|
"thread.active": threadEventHandlers["thread.active"].length,
|