@get-bb/plugin-sdk 0.6.65 → 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 +1192 -440
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +60 -35
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +34 -14
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +6 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +40 -11
- package/bundled-types/bb-plugin-sdk-testing.d.ts +19 -2
- package/bundled-types/bb-plugin-sdk.d.ts +6463 -5633
- package/dist/app.js +98 -4
- package/dist/index.js +16 -0
- package/dist/internal/composer-handle.js +14 -15
- package/dist/internal/plugin-app-collector.js +243 -150
- package/dist/internal/rpc-query-host.js +1987 -193
- package/dist/provider-bridge-acp-next.js +2599 -2627
- package/dist/provider-bridge-acp.js +2599 -2627
- package/dist/provider-bridge-testing.js +1210 -1238
- package/dist/provider-bridge.js +1258 -1286
- package/dist/testing/app.js +2577 -450
- package/dist/testing/index.js +69 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1,
|
|
9
|
+
import { JsonValue as JsonValue$2, PluginComposerApi as PluginComposerApi$1, PluginComposerScope as PluginComposerScope$1, ComposerDraftSnapshot as ComposerDraftSnapshot$1, ComposerSelection as ComposerSelection$1, ComposerDraftReplacement as ComposerDraftReplacement$1, ComposerDraft as ComposerDraft$1, ComposerMention as ComposerMention$1, PluginComposerTextEffect as PluginComposerTextEffect$1 } from '@get-bb/plugin-sdk';
|
|
10
10
|
|
|
11
11
|
interface JsonObject {
|
|
12
12
|
[key: string]: JsonValue$1;
|
|
@@ -295,29 +295,41 @@ interface PluginComposerApi {
|
|
|
295
295
|
/** Focus the composer caret at the end of the draft. */
|
|
296
296
|
focus(): void;
|
|
297
297
|
/**
|
|
298
|
-
* Submit this composer's draft
|
|
299
|
-
*
|
|
300
|
-
* provider handoff creates a new thread
|
|
298
|
+
* Submit this composer's draft through the composer's own send and steer
|
|
299
|
+
* handlers, the ones Enter and modifier+Enter run, including a
|
|
300
|
+
* provider handoff that creates a new thread. The draft's attachments and
|
|
301
301
|
* @-mentions, and — in the new-thread composer — the provider, model,
|
|
302
302
|
* reasoning level, service tier, permission mode and environment the user
|
|
303
303
|
* has selected on screen, all travel with it.
|
|
304
304
|
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
305
|
+
* It submits only the draft, so it rejects an empty one, even where the
|
|
306
|
+
* shortcut would steer the next queued message instead. Otherwise it runs
|
|
307
|
+
* only when the matching shortcut would. While attachments are uploading it
|
|
308
|
+
* waits for them, then checks again; it rejects if an upload fails. When
|
|
309
|
+
* the shortcut could not submit, it rejects with the reason, a message safe
|
|
310
|
+
* to show to the user. The composer must be on screen. The queued-message
|
|
311
|
+
* and sent-message editors reject.
|
|
309
312
|
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
313
|
+
* Every option combines with the others. `experimental_mode` uses the
|
|
314
|
+
* names `bb.sdk.threads.send` uses. Without it, submit does what Enter
|
|
315
|
+
* does for this user, which may be to queue or to steer.
|
|
316
|
+
* `"queue-if-active"` queues behind the running turn, or starts a turn.
|
|
317
|
+
* `"steer-if-active"` adds the message to the running turn. Where nothing
|
|
318
|
+
* can be steered, such as on an idle thread, it starts a turn.
|
|
319
|
+
* `sendAt` makes the chosen action wait until the given time; a scheduled
|
|
320
|
+
* steer steers whatever turn is running then. `experimental_data` is
|
|
321
|
+
* opaque JSON delivered to dispatch hooks together with the calling
|
|
322
|
+
* plugin's id on this initial attempt. Hooks run before operational core
|
|
323
|
+
* waits. If a hook queues the message, its existing plugin wait identifies
|
|
324
|
+
* the owner on later attempts; core does not persist or interpret the
|
|
325
|
+
* opaque data.
|
|
315
326
|
*
|
|
316
|
-
* Resolves once the
|
|
317
|
-
* Failures of the underlying request
|
|
318
|
-
*
|
|
327
|
+
* Resolves once the composer has accepted the submission and cleared the
|
|
328
|
+
* draft. Failures of the underlying request show bb's usual error toast
|
|
329
|
+
* and restore the draft, exactly as an interactive failure does, and then
|
|
330
|
+
* reject with the toast's message.
|
|
319
331
|
*/
|
|
320
|
-
submit(options
|
|
332
|
+
submit(options?: ComposerSubmitOptions): Promise<void>;
|
|
321
333
|
/**
|
|
322
334
|
* Set this composer's pickers as if each value had been picked by hand.
|
|
323
335
|
*
|
|
@@ -396,20 +408,22 @@ interface ComposerSelection {
|
|
|
396
408
|
serviceTier?: ServiceTier;
|
|
397
409
|
permissionMode?: PermissionMode;
|
|
398
410
|
}
|
|
399
|
-
/**
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
/** What `submit` adds to pressing Enter. Every field combines with the others. */
|
|
412
|
+
interface ComposerSubmitOptions {
|
|
413
|
+
/**
|
|
414
|
+
* `"queue-if-active"` queues behind the running turn and
|
|
415
|
+
* `"steer-if-active"` adds to it; both start a turn when none is running.
|
|
416
|
+
* Omitted, it does what Enter does for this user.
|
|
417
|
+
*/
|
|
418
|
+
experimental_mode?: "queue-if-active" | "steer-if-active";
|
|
419
|
+
/** Epoch ms in the future; the action waits until then. */
|
|
420
|
+
sendAt?: number;
|
|
421
|
+
/**
|
|
422
|
+
* Opaque JSON delivered to dispatch hooks with the calling plugin's id on
|
|
423
|
+
* the initial dispatch attempt.
|
|
424
|
+
*/
|
|
408
425
|
experimental_data?: JsonValue;
|
|
409
|
-
}
|
|
410
|
-
experimental_data: JsonValue;
|
|
411
|
-
sendAt?: never;
|
|
412
|
-
};
|
|
426
|
+
}
|
|
413
427
|
|
|
414
428
|
declare function reconcileComposerMentions(currentText: string, nextText: string, mentions: readonly ComposerMention[]): ComposerMention[];
|
|
415
429
|
|
|
@@ -425,6 +439,16 @@ interface ComposerEditorState {
|
|
|
425
439
|
isAttaching: boolean;
|
|
426
440
|
attachmentError: string | null;
|
|
427
441
|
}
|
|
442
|
+
interface ComposerSubmitExtras {
|
|
443
|
+
sendAt?: number;
|
|
444
|
+
pluginSubmission?: {
|
|
445
|
+
pluginId: string;
|
|
446
|
+
data: JsonValue$2;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
interface ComposerEditorSubmission extends ComposerSubmitExtras {
|
|
450
|
+
mode: "enter" | "queue-if-active" | "steer-if-active";
|
|
451
|
+
}
|
|
428
452
|
interface ComposerHandleTarget {
|
|
429
453
|
key: string;
|
|
430
454
|
scope: PluginComposerScope$1;
|
|
@@ -440,10 +464,11 @@ interface ComposerHandleTarget {
|
|
|
440
464
|
focus(): void;
|
|
441
465
|
openPopup?(pluginId: string, popupId: string): boolean;
|
|
442
466
|
closePopup?(pluginId: string): boolean;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
467
|
+
/**
|
|
468
|
+
* Runs the on-screen composer's own Enter, queue or steer handler with the
|
|
469
|
+
* submission's extras, or returns null when no composer box is mounted.
|
|
470
|
+
*/
|
|
471
|
+
editorSubmit(submission: ComposerEditorSubmission): Promise<void> | null;
|
|
447
472
|
setSelection?(selection: ComposerSelection$1): Promise<ComposerSelection$1>;
|
|
448
473
|
}
|
|
449
474
|
interface ComposerHandleController {
|
|
@@ -464,4 +489,4 @@ declare function appendComposerDraft(current: ComposerDraft$1, value: ComposerDr
|
|
|
464
489
|
declare function createComposerHandleBinding(key: string, initial: ComposerHandleController): ComposerHandleBinding;
|
|
465
490
|
|
|
466
491
|
export { OFF_SCREEN_EDITOR_STATE, appendComposerDraft, createComposerDraftActions, createComposerHandleBinding, reconcileComposerMentions };
|
|
467
|
-
export type { ComposerEditorState, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget };
|
|
492
|
+
export type { ComposerEditorState, ComposerEditorSubmission, ComposerHandleBinding, ComposerHandleController, ComposerHandleTarget, ComposerSubmitExtras };
|
|
@@ -5,8 +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 * 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';
|
|
8
11
|
import { z } from 'zod';
|
|
9
|
-
import { ExperimentalSidebarFooterActionContext, ExperimentalSidebarFooterItemRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, PluginThreadListRegistration, ExperimentalSidebarNavigationRegistration, ExperimentalSidebarNavigationPlacement, PluginThreadHeaderActionRegistration, PluginThreadActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, ExperimentalCodeFenceRendererRegistration, PluginMessageActionRegistration, PluginCommandRegistration, ExperimentalComposerCommandRegistration, PluginProviderIconRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginAppDefinition } from '@get-bb/plugin-sdk';
|
|
10
12
|
|
|
11
13
|
type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
|
|
12
14
|
interface ExperimentalSidebarFooterRuntimeSnapshot {
|
|
@@ -37,11 +39,32 @@ interface CollectedCompatibilitySidebarFooterItem {
|
|
|
37
39
|
}
|
|
38
40
|
type CollectedSidebarFooterItem = CollectedCompatibilitySidebarFooterItem | CollectedManagedSidebarFooterItem;
|
|
39
41
|
declare function adaptSidebarFooterAction(registration: PluginSidebarFooterActionRegistration): CollectedCompatibilitySidebarFooterItem;
|
|
42
|
+
declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
|
|
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
|
+
};
|
|
40
64
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
41
65
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
42
66
|
};
|
|
43
|
-
|
|
44
|
-
declare const commandShortcutSchema: z.ZodObject<{
|
|
67
|
+
declare function createCommandShortcutSchema(): z.ZodObject<{
|
|
45
68
|
alt: z.ZodDefault<z.ZodBoolean>;
|
|
46
69
|
control: z.ZodDefault<z.ZodBoolean>;
|
|
47
70
|
key: z.ZodString;
|
|
@@ -49,7 +72,7 @@ declare const commandShortcutSchema: z.ZodObject<{
|
|
|
49
72
|
mod: z.ZodDefault<z.ZodBoolean>;
|
|
50
73
|
shift: z.ZodDefault<z.ZodBoolean>;
|
|
51
74
|
}, z.core.$strict>;
|
|
52
|
-
type CollectedCommandShortcut = z.infer<typeof
|
|
75
|
+
type CollectedCommandShortcut = z.infer<ReturnType<typeof createCommandShortcutSchema>> | null;
|
|
53
76
|
type CollectedPluginCommandRegistration = (Omit<PluginCommandRegistration, "defaultShortcut"> & {
|
|
54
77
|
target: "app";
|
|
55
78
|
defaultShortcut: CollectedCommandShortcut;
|
|
@@ -61,8 +84,9 @@ interface CollectedPluginAppRegistrations {
|
|
|
61
84
|
homepageSections: PluginHomepageSectionRegistration[];
|
|
62
85
|
settingsSections: PluginSettingsSectionRegistration[];
|
|
63
86
|
appOverlays: ExperimentalAppOverlayRegistration[];
|
|
64
|
-
navPanels:
|
|
65
|
-
|
|
87
|
+
navPanels: LegacyNavPanelRegistration[];
|
|
88
|
+
tabs: ExperimentalTabRegistration[];
|
|
89
|
+
threadPanelActions: LegacyThreadPanelActionRegistration[];
|
|
66
90
|
newThreadPanelActions: PluginNewThreadPanelActionRegistration[];
|
|
67
91
|
composerCustomizations: ComposerCustomization[];
|
|
68
92
|
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
@@ -71,11 +95,14 @@ interface CollectedPluginAppRegistrations {
|
|
|
71
95
|
threadLists: PluginThreadListRegistration[];
|
|
72
96
|
experimentalSidebarNavigations: CollectedSidebarNavigationRegistration[];
|
|
73
97
|
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
98
|
+
threadInfoRows: ExperimentalThreadInfoRowRegistration[];
|
|
99
|
+
threadInfoSections: ExperimentalThreadInfoSectionRegistration[];
|
|
74
100
|
threadActions: PluginThreadActionRegistration<unknown>[];
|
|
75
101
|
browserToolbarActions: ExperimentalPluginBrowserToolbarActionRegistration[];
|
|
76
102
|
fileOpeners: PluginFileOpenerRegistration[];
|
|
77
103
|
sourceCodeRenderers: PluginSourceCodeRendererRegistration[];
|
|
78
104
|
diffRenderers: PluginDiffRendererRegistration[];
|
|
105
|
+
composers: ExperimentalComposerRegistration[];
|
|
79
106
|
messageDirectives: PluginMessageDirectiveRegistration[];
|
|
80
107
|
codeFenceRenderers: ExperimentalCodeFenceRendererRegistration[];
|
|
81
108
|
messageActions: PluginMessageActionRegistration[];
|
|
@@ -90,14 +117,7 @@ interface CollectedPluginAppRegistrations {
|
|
|
90
117
|
interface CollectedSidebarNavigationRegistration extends ExperimentalSidebarNavigationRegistration {
|
|
91
118
|
placement: ExperimentalSidebarNavigationPlacement;
|
|
92
119
|
}
|
|
93
|
-
declare function getCollectedSidebarFooterItems(registrations: object): readonly CollectedSidebarFooterItem[] | null;
|
|
94
|
-
/**
|
|
95
|
-
* Run a plugin app definition against the canonical validating collector.
|
|
96
|
-
* Both the BB app and the public test harness use this implementation so a
|
|
97
|
-
* registration accepted by one cannot be rejected or normalized differently
|
|
98
|
-
* by the other.
|
|
99
|
-
*/
|
|
100
120
|
declare function collectPluginAppRegistrations(definition: PluginAppDefinition, onWarning?: (message: string) => void): CollectedPluginAppRegistrations;
|
|
101
121
|
|
|
102
122
|
export { adaptSidebarFooterAction, collectPluginAppRegistrations, getCollectedSidebarFooterItems };
|
|
103
|
-
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 {
|
|
@@ -24,6 +25,27 @@ interface ExperimentalSidebarFooterItemRuntime {
|
|
|
24
25
|
type CollectedExperimentalSidebarFooterItem = ExperimentalSidebarFooterItemRegistration & {
|
|
25
26
|
runtime: ExperimentalSidebarFooterItemRuntime;
|
|
26
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
|
+
};
|
|
27
49
|
type CollectedPluginProviderIconRegistration = Omit<PluginProviderIconRegistration, "providerKind"> & {
|
|
28
50
|
providerKind: PluginProviderIconRegistration["providerKind"] | "all";
|
|
29
51
|
};
|
|
@@ -106,7 +128,7 @@ type NavigateCall = {
|
|
|
106
128
|
};
|
|
107
129
|
interface ExperimentalFixedTabOpenCall {
|
|
108
130
|
surface: ExperimentalOpenFixedTabOptions<JsonValue>["surface"];
|
|
109
|
-
panelId
|
|
131
|
+
panelId?: string;
|
|
110
132
|
tabId: string;
|
|
111
133
|
target?: JsonValue;
|
|
112
134
|
}
|
|
@@ -187,8 +209,9 @@ interface CapturedPluginApp {
|
|
|
187
209
|
homepageSections: PluginHomepageSectionRegistration[];
|
|
188
210
|
settingsSections: PluginSettingsSectionRegistration[];
|
|
189
211
|
appOverlays: ExperimentalAppOverlayRegistration[];
|
|
190
|
-
navPanels:
|
|
191
|
-
|
|
212
|
+
navPanels: LegacyNavPanelRegistration[];
|
|
213
|
+
tabs: ExperimentalTabRegistration[];
|
|
214
|
+
threadPanelActions: LegacyThreadPanelActionRegistration[];
|
|
192
215
|
newThreadPanelActions: PluginNewThreadPanelActionRegistration[];
|
|
193
216
|
composerCustomizations: ComposerCustomization[];
|
|
194
217
|
pendingInteractions: PluginPendingInteractionRegistration[];
|
|
@@ -197,11 +220,14 @@ interface CapturedPluginApp {
|
|
|
197
220
|
threadLists: PluginThreadListRegistration[];
|
|
198
221
|
experimentalSidebarNavigations: ExperimentalSidebarNavigationRegistration[];
|
|
199
222
|
threadHeaderActions: PluginThreadHeaderActionRegistration[];
|
|
223
|
+
threadInfoRows: ExperimentalThreadInfoRowRegistration[];
|
|
224
|
+
threadInfoSections: ExperimentalThreadInfoSectionRegistration[];
|
|
200
225
|
threadActions: PluginThreadActionRegistration<unknown>[];
|
|
201
226
|
browserToolbarActions: ExperimentalPluginBrowserToolbarActionRegistration[];
|
|
202
227
|
fileOpeners: PluginFileOpenerRegistration[];
|
|
203
228
|
sourceCodeRenderers: PluginSourceCodeRendererRegistration[];
|
|
204
229
|
diffRenderers: PluginDiffRendererRegistration[];
|
|
230
|
+
composers: ExperimentalComposerRegistration[];
|
|
205
231
|
messageDirectives: PluginMessageDirectiveRegistration[];
|
|
206
232
|
codeFenceRenderers: ExperimentalCodeFenceRendererRegistration[];
|
|
207
233
|
messageActions: PluginMessageActionRegistration[];
|
|
@@ -332,11 +358,6 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
332
358
|
branchesState?: Partial<BranchesState>;
|
|
333
359
|
/** Checkout facts `experimental_useCheckoutState()` reports. */
|
|
334
360
|
checkoutState?: Partial<CheckoutState>;
|
|
335
|
-
/**
|
|
336
|
-
* Pull requests `experimental_useSidebarThreadPullRequest()` reports, keyed
|
|
337
|
-
* by thread id. Omitted → every thread reports none.
|
|
338
|
-
*/
|
|
339
|
-
sidebarPullRequests?: Record<string, PluginSidebarPullRequest>;
|
|
340
361
|
/**
|
|
341
362
|
* Thread ids `useSidebarThreadDraft()` and `useSidebarThreadDraftIds()`
|
|
342
363
|
* report as holding an unsent draft. Omitted → none.
|
|
@@ -355,6 +376,12 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
355
376
|
sidebarShortcuts?: Record<string, PluginSidebarThreadShortcut>;
|
|
356
377
|
/** The split layout `useSidebarSplitLayout()` reports. Omitted → null. */
|
|
357
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;
|
|
358
385
|
/**
|
|
359
386
|
* Items and the active item `experimental_useSidebarNavigation()` reports.
|
|
360
387
|
* Omitted → no items. Actions are recorded in `sidebarNavigationCalls` and
|
|
@@ -399,6 +426,7 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
|
|
|
399
426
|
openTerminal?: (options: Parameters<BbNavigate["experimental_openTerminal"]>[0]) => boolean;
|
|
400
427
|
/** Host acceptance for an owner-scoped fixed-tab selection. */
|
|
401
428
|
experimental_openFixedTab?: (call: ExperimentalFixedTabOpenCall) => boolean;
|
|
429
|
+
experimental_openTab?: (call: _get_bb_plugin_sdk.ExperimentalTabOpenOptions) => boolean;
|
|
402
430
|
/** Initial session target visible to `experimental_useFixedTabTarget`. */
|
|
403
431
|
experimental_fixedTabTarget?: {
|
|
404
432
|
panelId: string;
|
|
@@ -412,7 +440,7 @@ interface RenderedSlotBehaviorDrivers {
|
|
|
412
440
|
* Push a realtime event to `useRealtime(channel, …)` subscribers, wrapped
|
|
413
441
|
* in act. The payload is JSON-round-tripped like `bb.realtime.publish`.
|
|
414
442
|
*/
|
|
415
|
-
experimental_invalidateRpc(tags: readonly string[] | null): Promise<void>;
|
|
443
|
+
experimental_invalidateRpc(tags: readonly string[] | null, pluginId?: string): Promise<void>;
|
|
416
444
|
emitRealtime(channel: string, payload: unknown): Promise<void>;
|
|
417
445
|
/** Drive the lifecycle of the same connection used by realtime events. */
|
|
418
446
|
setRealtimeConnectionState(state: PluginRealtimeConnectionState): Promise<void>;
|
|
@@ -431,6 +459,7 @@ interface RenderedSlotInspectionState {
|
|
|
431
459
|
readonly navigateCalls: NavigateCall[];
|
|
432
460
|
/** Every validated `experimental_useAppPanel().openFixedTab` call. */
|
|
433
461
|
readonly experimental_fixedTabOpenCalls: ExperimentalFixedTabOpenCall[];
|
|
462
|
+
readonly experimental_tabOpenCalls: _get_bb_plugin_sdk.ExperimentalTabOpenOptions[];
|
|
434
463
|
/**
|
|
435
464
|
* Every `experimental_useSidebarNavigation()` action and navigation split
|
|
436
465
|
* drag, in order.
|
|
@@ -5,7 +5,7 @@
|
|
|
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 { StandardSchemaV1 as StandardSchemaV1$1, StandardSchemaV1InferOutput as StandardSchemaV1InferOutput$1, PluginMachineValidateDecision, JsonValue as JsonValue$2, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, PluginEnvironmentValidateDecision, BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginRowPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, PluginMentionProviderRegistration, ExperimentalPluginRpcCaller, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginProviderEnvHealth, PluginSettingDescriptors, ExperimentalPluginWebSocketHandler, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, PluginInteractionRequest, MessageDispatchHookContext } from '@get-bb/plugin-sdk';
|
|
8
|
+
import { StandardSchemaV1 as StandardSchemaV1$1, StandardSchemaV1InferOutput as StandardSchemaV1InferOutput$1, PluginMachineValidateDecision, JsonValue as JsonValue$2, PluginEnvironmentProviderRequirements as PluginEnvironmentProviderRequirements$1, PluginEnvironmentValidateDecision, BbPluginApi, PluginSettingValue as PluginSettingValue$1, PluginSharedPortTunnelIdentity, PluginRowPresentation, PluginAgentToolContext, PluginAgentToolResult, PluginCliCommandInfo, PluginCliContext, PluginCliResult, PluginHttpAuthMode, PluginHttpHandler, PluginMentionTrigger, PluginMentionSearchContext, PluginMentionItem, PluginMentionProviderRegistration, ExperimentalPluginRpcCaller, PluginCliExecutionResult, PluginThreadEventName, PluginThreadEventPayloads, PluginAgentConfigurationContext, ExperimentalPluginProviderEnvContext, ExperimentalPluginProviderEnvEntry, ExperimentalPluginProviderEnvHealthContext, ExperimentalPluginProviderEnvHealth, PluginSettingDescriptors, ExperimentalPluginWebSocketHandler, PluginAgentConfiguration, PluginHookName, PluginHookHandler, PluginAiServiceDeclaration, InternalDoNotUsePluginNextTunnelConfig, InternalDoNotUsePluginHostNextTunnelStatus, PluginInteractionRequest, MessageDispatchHookContext } from '@get-bb/plugin-sdk';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type PluginMachineProviderResource = Exclude<JsonValue$2, null>;
|
|
@@ -1236,12 +1236,20 @@ interface FakePluginRegistrations {
|
|
|
1236
1236
|
* (normalized declarations, registration order; dispose removes). */
|
|
1237
1237
|
aiServiceRegistrations: PluginAiServiceDeclaration[];
|
|
1238
1238
|
}
|
|
1239
|
+
/** One handle opened through `bb.server.internal_DO_NOT_USE_openTunnelIngress`. */
|
|
1240
|
+
interface InternalDoNotUseFakeTunnelIngress {
|
|
1241
|
+
readonly audience: string;
|
|
1242
|
+
readonly baseUrl: string;
|
|
1243
|
+
/** True once the plugin closed the handle or the host disposed it. */
|
|
1244
|
+
readonly closed: boolean;
|
|
1245
|
+
}
|
|
1239
1246
|
/** Read-only state for assertions after a plugin registers or handles work. */
|
|
1240
1247
|
interface FakePluginInspectionState {
|
|
1241
1248
|
readonly pluginId: string;
|
|
1242
1249
|
/** Every `bb.log` line, in order. */
|
|
1243
1250
|
readonly logEntries: FakeLogEntry[];
|
|
1244
1251
|
/** Every `bb.realtime.publish`, payload normalized like the wire. */
|
|
1252
|
+
experimental_onRpcInvalidation(listener: () => void): () => void;
|
|
1245
1253
|
readonly experimental_rpcInvalidations: (readonly string[] | null)[];
|
|
1246
1254
|
readonly realtimeSignals: FakeRealtimeSignal[];
|
|
1247
1255
|
/** Every `bb.status.needsConfiguration` message, in order. */
|
|
@@ -1255,10 +1263,19 @@ interface FakePluginInspectionState {
|
|
|
1255
1263
|
/** Recorded `bb.sdk` calls + stub control. */
|
|
1256
1264
|
readonly sdk: FakeSdkHarness;
|
|
1257
1265
|
readonly registrations: FakePluginRegistrations;
|
|
1266
|
+
/** Every `bb.server.internal_DO_NOT_USE_openTunnelIngress` handle, in order. */
|
|
1267
|
+
readonly internal_DO_NOT_USE_tunnelIngresses: readonly InternalDoNotUseFakeTunnelIngress[];
|
|
1258
1268
|
readonly sharedPortDeclarations: Array<{
|
|
1259
1269
|
hostId: string;
|
|
1260
1270
|
ports: number[];
|
|
1261
1271
|
}>;
|
|
1272
|
+
/** The last `bb.hosts.internal_DO_NOT_USE_setNextTunnels` config, or null. */
|
|
1273
|
+
readonly internal_DO_NOT_USE_nextTunnelConfig: InternalDoNotUsePluginNextTunnelConfig | null;
|
|
1274
|
+
/**
|
|
1275
|
+
* Replace what `bb.hosts.internal_DO_NOT_USE_nextTunnelStatuses` returns and call
|
|
1276
|
+
* every `internal_DO_NOT_USE_onNextTunnelStatusChange` listener.
|
|
1277
|
+
*/
|
|
1278
|
+
internal_DO_NOT_USE_setNextTunnelStatuses(statuses: readonly InternalDoNotUsePluginHostNextTunnelStatus[]): void;
|
|
1262
1279
|
/** Calls made through bb.hosts.experimental_client, after input validation. */
|
|
1263
1280
|
readonly experimental_hostRpcCalls: readonly ExperimentalFakeHostRpcCall[];
|
|
1264
1281
|
readonly pendingInteractions: readonly (PluginInteractionRequest & {
|
|
@@ -1536,4 +1553,4 @@ interface PublicSdkOnlyScan {
|
|
|
1536
1553
|
declare function scanPublicSdkOnly(packageRoot: string, options?: PublicSdkOnlyScanOptions): PublicSdkOnlyScan;
|
|
1537
1554
|
|
|
1538
1555
|
export { PluginContextStaleError, createFakePluginHost, createFakeSdk, scanPublicSdkOnly as experimental_scanPublicSdkOnly, makeHostResponse, makeMessageDispatchHookContext, makePluginAgentConfigurationContext, makeQueueEntry, makeThreadResponse, makeTurnFailedEvent };
|
|
1539
|
-
export type { CreateFakePluginHostOptions, ExperimentalFakeHostRpcCall, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|
|
1556
|
+
export type { CreateFakePluginHostOptions, ExperimentalFakeHostRpcCall, FakeAgentToolRecord, FakeCliRecord, FakeHttpRouteRecord, FakeLogEntry, FakeLogLevel, FakeMentionProviderRecord, FakePluginBehaviorDrivers, FakePluginHarness, FakePluginHost, FakePluginInspectionState, FakePluginLifecycleControls, FakePluginRegistrations, FakeRealtimeSignal, FakeScheduleRecord, FakeSdkCall, FakeSdkHarness, FakeSdkOverrides, FakeServiceRecord, InternalDoNotUseFakeTunnelIngress, PublicSdkOnlyScan, PublicSdkOnlyScanOptions, PublicSdkOnlyViolation };
|