@get-bb/plugin-sdk 0.6.68 → 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.
- package/README.md +2 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +1050 -348
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +30 -4
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +39 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk.d.ts +6339 -5653
- package/dist/app.js +98 -4
- package/dist/index.js +16 -0
- package/dist/internal/composer-handle.js +1 -1
- package/dist/internal/plugin-app-collector.js +153 -63
- package/dist/internal/rpc-query-host.js +1169 -27
- package/dist/testing/app.js +1677 -185
- package/dist/testing/index.js +14 -0
- package/package.json +1 -1
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// Confused by the API, or need a symbol that isn't here? Clone the BB repo
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as _get_bb_plugin_sdk from '@get-bb/plugin-sdk';
|
|
9
|
+
import { ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterItemRegistration, PluginSidebarFooterActionRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationPlacement, PluginThreadHeaderActionRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadInfoSectionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, PluginCommandRegistration, ExperimentalComposerCommandRegistration, PluginProviderIconRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
|
|
10
|
+
import { ComponentType } from 'react';
|
|
9
11
|
import { z } from 'zod';
|
|
10
12
|
|
|
11
13
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
@@ -39,6 +41,26 @@ type CollectedSidebarFooterItem = CollectedCompatibilitySidebarFooterItem | Coll
|
|
|
39
41
|
declare function adaptSidebarFooterAction(registration: PluginSidebarFooterActionRegistration): CollectedCompatibilitySidebarFooterItem;
|
|
40
42
|
declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
|
|
41
43
|
|
|
44
|
+
interface LegacyThreadPanelActionRegistration {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
icon?: string;
|
|
48
|
+
component: ComponentType<_get_bb_plugin_sdk.ExperimentalThreadActionTabProps>;
|
|
49
|
+
layout?: "flush" | "padded";
|
|
50
|
+
run?(context: _get_bb_plugin_sdk.ExperimentalThreadTabActionContext): void | Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
type LegacyNavPanelRegistration = PluginNavPanelRegistration & {
|
|
53
|
+
fixedTabs?: readonly PluginNavPanelFixedTabRegistration[];
|
|
54
|
+
};
|
|
55
|
+
type PluginNavPanelFixedTabRegistration = {
|
|
56
|
+
id: string;
|
|
57
|
+
panelId: string;
|
|
58
|
+
title: string;
|
|
59
|
+
icon: string;
|
|
60
|
+
component: ComponentType<_get_bb_plugin_sdk.PluginNavPanelProps>;
|
|
61
|
+
layout?: "flush" | "padded";
|
|
62
|
+
experimental_target?: _get_bb_plugin_sdk.ExperimentalFixedTabTargetContract<_get_bb_plugin_sdk.JsonValue>;
|
|
63
|
+
};
|
|
42
64
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
43
65
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
44
66
|
};
|
|
@@ -62,8 +84,9 @@ interface CollectedPluginAppRegistrations {
|
|
|
62
84
|
homepageSections: PluginHomepageSectionRegistration[];
|
|
63
85
|
settingsSections: PluginSettingsSectionRegistration[];
|
|
64
86
|
appOverlays: ExperimentalAppOverlayRegistration[];
|
|
65
|
-
navPanels:
|
|
66
|
-
|
|
87
|
+
navPanels: LegacyNavPanelRegistration[];
|
|
88
|
+
tabs: ExperimentalTabRegistration[];
|
|
89
|
+
threadPanelActions: LegacyThreadPanelActionRegistration[];
|
|
67
90
|
newThreadPanelActions: PluginNewThreadPanelActionRegistration[];
|
|
68
91
|
composerCustomizations: ComposerCustomization[];
|
|
69
92
|
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
@@ -72,11 +95,14 @@ interface CollectedPluginAppRegistrations {
|
|
|
72
95
|
threadLists: PluginThreadListRegistration[];
|
|
73
96
|
experimentalSidebarNavigations: CollectedSidebarNavigationRegistration[];
|
|
74
97
|
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
98
|
+
threadInfoRows: ExperimentalThreadInfoRowRegistration[];
|
|
99
|
+
threadInfoSections: ExperimentalThreadInfoSectionRegistration[];
|
|
75
100
|
threadActions: PluginThreadActionRegistration<unknown>[];
|
|
76
101
|
browserToolbarActions: ExperimentalPluginBrowserToolbarActionRegistration[];
|
|
77
102
|
fileOpeners: PluginFileOpenerRegistration[];
|
|
78
103
|
sourceCodeRenderers: PluginSourceCodeRendererRegistration[];
|
|
79
104
|
diffRenderers: PluginDiffRendererRegistration[];
|
|
105
|
+
composers: ExperimentalComposerRegistration[];
|
|
80
106
|
messageDirectives: PluginMessageDirectiveRegistration[];
|
|
81
107
|
codeFenceRenderers: ExperimentalCodeFenceRendererRegistration[];
|
|
82
108
|
messageActions: PluginMessageActionRegistration[];
|
|
@@ -94,4 +120,4 @@ interface CollectedSidebarNavigationRegistration extends ExperimentalSidebarNavi
|
|
|
94
120
|
declare function collectPluginAppRegistrations(definition: PluginAppDefinition, onWarning?: (message: string) => void): CollectedPluginAppRegistrations;
|
|
95
121
|
|
|
96
122
|
export { adaptSidebarFooterAction, collectPluginAppRegistrations, getCollectedSidebarFooterItems };
|
|
97
|
-
export type { CollectedCompatibilitySidebarFooterItem, CollectedExperimentalSidebarFooterItem, CollectedManagedSidebarFooterItem, CollectedPluginAppRegistrations, CollectedPluginCommandRegistration, CollectedPluginProviderIconRegistration, CollectedSidebarFooterItem, CollectedSidebarNavigationRegistration, ExperimentalSidebarFooterCommandKind, ExperimentalSidebarFooterItemRuntime, ExperimentalSidebarFooterRuntimeSnapshot };
|
|
123
|
+
export type { CollectedCompatibilitySidebarFooterItem, CollectedExperimentalSidebarFooterItem, CollectedManagedSidebarFooterItem, CollectedPluginAppRegistrations, CollectedPluginCommandRegistration, CollectedPluginProviderIconRegistration, CollectedSidebarFooterItem, CollectedSidebarNavigationRegistration, ExperimentalSidebarFooterCommandKind, ExperimentalSidebarFooterItemRuntime, ExperimentalSidebarFooterRuntimeSnapshot, LegacyNavPanelRegistration, LegacyThreadPanelActionRegistration };
|
|
@@ -159,10 +159,15 @@ interface ExperimentalRpcMutationOptions<Contract extends PluginRpcContract, Met
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
interface RpcQueryHost {
|
|
162
|
-
pluginId: string;
|
|
162
|
+
pluginId: string | null;
|
|
163
163
|
queryClient: QueryClient;
|
|
164
164
|
call(pluginId: string, method: string, input: JsonValue): Promise<unknown>;
|
|
165
165
|
subscribe(pluginId: string): () => void;
|
|
166
|
+
watch?(pluginId: string, method: string, read: {
|
|
167
|
+
input: JsonValue;
|
|
168
|
+
} | {
|
|
169
|
+
key: string;
|
|
170
|
+
}): () => void;
|
|
166
171
|
}
|
|
167
172
|
|
|
168
173
|
declare function createRpcQueryHooks(useHost: () => RpcQueryHost): {
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
// Confused by the API, or need a symbol that isn't here? Clone the BB repo
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as _get_bb_plugin_sdk from '@get-bb/plugin-sdk';
|
|
9
|
+
import { ExperimentalSidebarFooterItemRegistration, PluginNavPanelRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, ExperimentalTabRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, ExperimentalThreadInfoRowRegistration, ExperimentalThreadInfoSectionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, ExperimentalComposerRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalComposerRendererApi, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalPageTitle, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
|
|
10
|
+
import { ComponentType, ReactNode } from 'react';
|
|
9
11
|
import { RenderResult } from '@testing-library/react';
|
|
10
|
-
import { ExperimentalSidebarFooterItemRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, ComposerDraftSnapshot, PluginComposerScope, ComposerSelection, PluginComposerTextEffect, PluginComposerMention, ComposerSubmitOptions, ExperimentalClipboardContent, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, ComposerMention, ComposerAttachment, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, ExperimentalSidebarNavigationItem, PluginThreadActionTarget, PluginThreadActionEntry, PluginThreadActionRegistrationInfo, PluginEnvironmentProvidersState, ExperimentalPageTitle, ExperimentalSidebarNavigationActions, ExperimentalSidebarNavigationTarget } from '@get-bb/plugin-sdk';
|
|
11
12
|
|
|
12
13
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
13
14
|
interface ExperimentalSidebarFooterRuntimeSnapshot {
|
|
@@ -25,6 +26,26 @@ type CollectedExperimentalSidebarFooterItem = ExperimentalSidebarFooterItemRegis
|
|
|
25
26
|
runtime: ExperimentalSidebarFooterItemRuntime;
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
interface LegacyThreadPanelActionRegistration {
|
|
30
|
+
id: string;
|
|
31
|
+
title: string;
|
|
32
|
+
icon?: string;
|
|
33
|
+
component: ComponentType<_get_bb_plugin_sdk.ExperimentalThreadActionTabProps>;
|
|
34
|
+
layout?: "flush" | "padded";
|
|
35
|
+
run?(context: _get_bb_plugin_sdk.ExperimentalThreadTabActionContext): void | Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
type LegacyNavPanelRegistration = PluginNavPanelRegistration & {
|
|
38
|
+
fixedTabs?: readonly PluginNavPanelFixedTabRegistration[];
|
|
39
|
+
};
|
|
40
|
+
type PluginNavPanelFixedTabRegistration = {
|
|
41
|
+
id: string;
|
|
42
|
+
panelId: string;
|
|
43
|
+
title: string;
|
|
44
|
+
icon: string;
|
|
45
|
+
component: ComponentType<_get_bb_plugin_sdk.PluginNavPanelProps>;
|
|
46
|
+
layout?: "flush" | "padded";
|
|
47
|
+
experimental_target?: _get_bb_plugin_sdk.ExperimentalFixedTabTargetContract<_get_bb_plugin_sdk.JsonValue>;
|
|
48
|
+
};
|
|
28
49
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
29
50
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
30
51
|
};
|
|
@@ -107,7 +128,7 @@ type NavigateCall = {
|
|
|
107
128
|
};
|
|
108
129
|
interface ExperimentalFixedTabOpenCall {
|
|
109
130
|
surface: ExperimentalOpenFixedTabOptions<JsonValue>["surface"];
|
|
110
|
-
panelId
|
|
131
|
+
panelId?: string;
|
|
111
132
|
tabId: string;
|
|
112
133
|
target?: JsonValue;
|
|
113
134
|
}
|
|
@@ -188,8 +209,9 @@ interface CapturedPluginApp {
|
|
|
188
209
|
homepageSections: PluginHomepageSectionRegistration[];
|
|
189
210
|
settingsSections: PluginSettingsSectionRegistration[];
|
|
190
211
|
appOverlays: ExperimentalAppOverlayRegistration[];
|
|
191
|
-
navPanels:
|
|
192
|
-
|
|
212
|
+
navPanels: LegacyNavPanelRegistration[];
|
|
213
|
+
tabs: ExperimentalTabRegistration[];
|
|
214
|
+
threadPanelActions: LegacyThreadPanelActionRegistration[];
|
|
193
215
|
newThreadPanelActions: PluginNewThreadPanelActionRegistration[];
|
|
194
216
|
composerCustomizations: ComposerCustomization[];
|
|
195
217
|
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
@@ -198,11 +220,14 @@ interface CapturedPluginApp {
|
|
|
198
220
|
threadLists: PluginThreadListRegistration[];
|
|
199
221
|
experimentalSidebarNavigations: ExperimentalSidebarNavigationRegistration[];
|
|
200
222
|
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
223
|
+
threadInfoRows: ExperimentalThreadInfoRowRegistration[];
|
|
224
|
+
threadInfoSections: ExperimentalThreadInfoSectionRegistration[];
|
|
201
225
|
threadActions: PluginThreadActionRegistration<unknown>[];
|
|
202
226
|
browserToolbarActions: ExperimentalPluginBrowserToolbarActionRegistration[];
|
|
203
227
|
fileOpeners: PluginFileOpenerRegistration[];
|
|
204
228
|
sourceCodeRenderers: PluginSourceCodeRendererRegistration[];
|
|
205
229
|
diffRenderers: PluginDiffRendererRegistration[];
|
|
230
|
+
composers: ExperimentalComposerRegistration[];
|
|
206
231
|
messageDirectives: PluginMessageDirectiveRegistration[];
|
|
207
232
|
codeFenceRenderers: ExperimentalCodeFenceRendererRegistration[];
|
|
208
233
|
messageActions: PluginMessageActionRegistration[];
|
|
@@ -333,11 +358,6 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
333
358
|
branchesState?: Partial<BranchesState>;
|
|
334
359
|
/** Checkout facts `experimental_useCheckoutState()` reports. */
|
|
335
360
|
checkoutState?: Partial<CheckoutState>;
|
|
336
|
-
/**
|
|
337
|
-
* Pull requests `experimental_useSidebarThreadPullRequest()` reports, keyed
|
|
338
|
-
* by thread id. Omitted → every thread reports none.
|
|
339
|
-
*/
|
|
340
|
-
sidebarPullRequests?: Record<string, PluginSidebarPullRequest>;
|
|
341
361
|
/**
|
|
342
362
|
* Thread ids `useSidebarThreadDraft()` and `useSidebarThreadDraftIds()`
|
|
343
363
|
* report as holding an unsent draft. Omitted → none.
|
|
@@ -356,6 +376,12 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
356
376
|
sidebarShortcuts?: Record<string, PluginSidebarThreadShortcut>;
|
|
357
377
|
/** The split layout `useSidebarSplitLayout()` reports. Omitted → null. */
|
|
358
378
|
sidebarSplitLayout?: PluginSidebarSplitLayout;
|
|
379
|
+
/**
|
|
380
|
+
* What `experimental_useComposerRenderer()` returns, as if the slot were
|
|
381
|
+
* mounted as an `experimental_composer` replacement. Omitted → the hook
|
|
382
|
+
* throws, as it does outside a composer replacement.
|
|
383
|
+
*/
|
|
384
|
+
composerRenderer?: ExperimentalComposerRendererApi;
|
|
359
385
|
/**
|
|
360
386
|
* Items and the active item `experimental_useSidebarNavigation()` reports.
|
|
361
387
|
* Omitted → no items. Actions are recorded in `sidebarNavigationCalls` and
|
|
@@ -400,6 +426,7 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
400
426
|
openTerminal?: (options: Parameters<BbNavigate["experimental_openTerminal"]>[0]) => boolean;
|
|
401
427
|
/** Host acceptance for an owner-scoped fixed-tab selection. */
|
|
402
428
|
experimental_openFixedTab?: (call: ExperimentalFixedTabOpenCall) => boolean;
|
|
429
|
+
experimental_openTab?: (call: _get_bb_plugin_sdk.ExperimentalTabOpenOptions) => boolean;
|
|
403
430
|
/** Initial session target visible to `experimental_useFixedTabTarget`. */
|
|
404
431
|
experimental_fixedTabTarget?: {
|
|
405
432
|
panelId: string;
|
|
@@ -413,7 +440,7 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
413
440
|
* Push a realtime event to `useRealtime(channel, …)` subscribers, wrapped
|
|
414
441
|
* in act. The payload is JSON-round-tripped like `bb.realtime.publish`.
|
|
415
442
|
*/
|
|
416
|
-
experimental_invalidateRpc(tags: readonly string[] | null): Promise<void>;
|
|
443
|
+
experimental_invalidateRpc(tags: readonly string[] | null, pluginId?: string): Promise<void>;
|
|
417
444
|
emitRealtime(channel: string, payload: unknown): Promise<void>;
|
|
418
445
|
/** Drive the lifecycle of the same connection used by realtime events. */
|
|
419
446
|
setRealtimeConnectionState(state: PluginRealtimeConnectionState): Promise<void>;
|
|
@@ -432,6 +459,7 @@ interface RenderedSlotInspectionState {
|
|
|
432
459
|
readonly navigateCalls: NavigateCall[];
|
|
433
460
|
/** Every validated `experimental_useAppPanel().openFixedTab` call. */
|
|
434
461
|
readonly experimental_fixedTabOpenCalls: ExperimentalFixedTabOpenCall[];
|
|
462
|
+
readonly experimental_tabOpenCalls: _get_bb_plugin_sdk.ExperimentalTabOpenOptions[];
|
|
435
463
|
/**
|
|
436
464
|
* Every `experimental_useSidebarNavigation()` action and navigation split
|
|
437
465
|
* drag, in order.
|
|
@@ -1249,6 +1249,7 @@ interface FakePluginInspectionState {
|
|
|
1249
1249
|
/** Every `bb.log` line, in order. */
|
|
1250
1250
|
readonly logEntries: FakeLogEntry[];
|
|
1251
1251
|
/** Every `bb.realtime.publish`, payload normalized like the wire. */
|
|
1252
|
+
experimental_onRpcInvalidation(listener: () => void): () => void;
|
|
1252
1253
|
readonly experimental_rpcInvalidations: (readonly string[] | null)[];
|
|
1253
1254
|
readonly realtimeSignals: FakeRealtimeSignal[];
|
|
1254
1255
|
/** Every `bb.status.needsConfiguration` message, in order. */
|