@get-bb/plugin-sdk 0.4.9 → 0.4.11
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 +43 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +253 -28
- package/bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts +42 -0
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +209 -16
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +3314 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +1362 -327
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +38 -2
- package/bundled-types/bb-plugin-sdk.d.ts +2259 -526
- package/dist/app.js +10 -0
- package/dist/internal/file-navigation-validation.js +135 -0
- package/dist/internal/host-policy.js +467 -4
- package/dist/internal/plugin-app-collector.js +22 -1
- package/dist/provider-bridge-testing.js +5777 -0
- package/dist/provider-bridge.js +2906 -2136
- package/dist/testing/app.js +334 -2
- package/dist/testing/index.js +481 -21
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -21,6 +21,42 @@ Any mounted plugin component can use
|
|
|
21
21
|
same plugin's registered thread-panel actions; it returns false when the
|
|
22
22
|
current surface has no thread side panel.
|
|
23
23
|
|
|
24
|
+
Use `experimental_UrlLink` for a real anchor that applies BB's current
|
|
25
|
+
in-app/external-browser preference on ordinary HTTP(S) activation, or
|
|
26
|
+
`useBbNavigate().experimental_openUrl(url)` for a button or menu. Internal app
|
|
27
|
+
routes, modifier clicks, explicit anchor targets, and unsupported schemes stay
|
|
28
|
+
browser-owned. A `_blank` or named target preserves supplied `rel` tokens but
|
|
29
|
+
adds `noopener noreferrer` unless `rel` explicitly contains `opener`, so a
|
|
30
|
+
newly opened page cannot control BB by accident. The frontend harness records
|
|
31
|
+
both forms in `navigateCalls` and accepts an `openUrl` behavior option.
|
|
32
|
+
|
|
33
|
+
Use `experimental_FileLink` for an explicit live workspace, host, or
|
|
34
|
+
thread-storage file. Ordinary activation opens the shared BB preview and its
|
|
35
|
+
context menu exposes built-in/plugin viewers, preferred external opening, and
|
|
36
|
+
copy actions. Valid targets expose an encoded, scheme-safe anchor href so
|
|
37
|
+
modifier clicks, downloads, and copied links cannot reinterpret a file name as
|
|
38
|
+
an external URL scheme. Malformed runtime targets—including traversal paths
|
|
39
|
+
and ill-formed Unicode—have no active href and cannot record a preview in the
|
|
40
|
+
frontend harness. Buttons and menus can call
|
|
41
|
+
`experimental_openFilePreview({ target, location })` or
|
|
42
|
+
`experimental_openFileExternally({ target, location })`; both return whether
|
|
43
|
+
the current host accepted the intent. Targets never infer an ambient workspace.
|
|
44
|
+
The frontend harness records both methods and accepts `openFilePreview` and
|
|
45
|
+
`openFileExternally` behavior options.
|
|
46
|
+
|
|
47
|
+
A nav panel's `experimental_fixedTabs` entries must include the containing nav
|
|
48
|
+
panel's `id` as `panelId`; each entry is also a stable reference to that
|
|
49
|
+
plugin's own tab. Give a targeted tab an `experimental_target.validate` type guard, call
|
|
50
|
+
`experimental_useAppPanel().openFixedTab({ surface: { kind:
|
|
51
|
+
"current" }, tab, target })`, and read the in-memory state inside the tab with
|
|
52
|
+
`experimental_useFixedTabTarget(tab)`. The target survives tab, panel, and
|
|
53
|
+
route remounts for the current app session; call `clear()` when the tab returns
|
|
54
|
+
to its untargeted state. The host validates JSON before the owner's type guard,
|
|
55
|
+
persists only selection, and returns false for an unavailable tab or invalid
|
|
56
|
+
target. The frontend harness records accepted requests in
|
|
57
|
+
`experimental_fixedTabOpenCalls`, accepts an `experimental_openFixedTab`
|
|
58
|
+
behavior, and can seed `experimental_fixedTabTarget` state.
|
|
59
|
+
|
|
24
60
|
Every panel-open entry point reports the same way: `openThreadPanel` and the
|
|
25
61
|
`openPanel` handed to `threadPanelAction`, `experimental_newThreadPanelAction`,
|
|
26
62
|
and `messageAction` `run` callbacks all return `boolean` — true when the host
|
|
@@ -45,8 +81,13 @@ reload, disable, removal, failed replacement, and app-window teardown. The old
|
|
|
45
81
|
generation is disposed before candidate mounts, so generations never overlap.
|
|
46
82
|
Content scripts are trusted same-origin page code, not a sandbox.
|
|
47
83
|
|
|
48
|
-
Static styles should stay in the normal imported `app.css
|
|
49
|
-
|
|
84
|
+
Static styles should stay in the normal imported `app.css`. The host keeps
|
|
85
|
+
that stylesheet active while the plugin has rendered slot, panel-header, or
|
|
86
|
+
portal UI, and for the full lifetime of any active content-script generation;
|
|
87
|
+
it is not an app-wide stylesheet hook. Use manifest `bb.themes` entries for
|
|
88
|
+
app-wide selectable palette CSS. Styling or decorating existing app-shell DOM
|
|
89
|
+
belongs in a content script, and scripts may own dynamic DOM/style nodes only
|
|
90
|
+
when their disposer removes them. See the
|
|
50
91
|
[`content-script` reference plugin](../../examples/plugins/content-script/README.md)
|
|
51
92
|
for a cleanup-safe editor enhancement.
|
|
52
93
|
|
|
@@ -6,9 +6,19 @@
|
|
|
6
6
|
// and read the real source: https://github.com/get-bb/bb
|
|
7
7
|
|
|
8
8
|
import * as react from 'react';
|
|
9
|
-
import { ComponentType, ReactNode } from 'react';
|
|
9
|
+
import { ComponentType, ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A value that survives a JSON round trip without coercion or data loss.
|
|
14
|
+
*
|
|
15
|
+
* Host boundaries still validate values at runtime because TypeScript cannot
|
|
16
|
+
* exclude non-finite numbers and plugin bundles can bypass static types.
|
|
17
|
+
*/
|
|
18
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
19
|
+
[key: string]: JsonValue;
|
|
20
|
+
};
|
|
21
|
+
|
|
12
22
|
/** A JSON-safe path segment reported by a Standard Schema validation issue. */
|
|
13
23
|
type PluginRpcIssuePathSegment = string | number;
|
|
14
24
|
/** Validator-neutral validation detail carried by an RPC error envelope. */
|
|
@@ -171,6 +181,80 @@ declare const promptInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
171
181
|
}, z.core.$strip>], "type">;
|
|
172
182
|
type PromptInput = z.infer<typeof promptInputSchema>;
|
|
173
183
|
|
|
184
|
+
declare const providerInfoSchema: z.ZodObject<{
|
|
185
|
+
available: z.ZodBoolean;
|
|
186
|
+
capabilities: z.ZodObject<{
|
|
187
|
+
permissionModes: z.ZodArray<z.ZodEnum<{
|
|
188
|
+
"accept-edits": "accept-edits";
|
|
189
|
+
auto: "auto";
|
|
190
|
+
full: "full";
|
|
191
|
+
}>>;
|
|
192
|
+
supportsFork: z.ZodBoolean;
|
|
193
|
+
supportsNativeUserQuestion: z.ZodBoolean;
|
|
194
|
+
supportsServiceTier: z.ZodBoolean;
|
|
195
|
+
supportsSessionRewind: z.ZodBoolean;
|
|
196
|
+
supportsThreadArchive: z.ZodBoolean;
|
|
197
|
+
supportsThreadRename: z.ZodBoolean;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
composerActions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
200
|
+
kind: z.ZodLiteral<"skills">;
|
|
201
|
+
trigger: z.ZodEnum<{
|
|
202
|
+
"/": "/";
|
|
203
|
+
}>;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
command: z.ZodObject<{
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
trailingText: z.ZodString;
|
|
208
|
+
trigger: z.ZodEnum<{
|
|
209
|
+
"/": "/";
|
|
210
|
+
}>;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
kind: z.ZodLiteral<"plan">;
|
|
213
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
214
|
+
command: z.ZodObject<{
|
|
215
|
+
name: z.ZodString;
|
|
216
|
+
trailingText: z.ZodString;
|
|
217
|
+
trigger: z.ZodEnum<{
|
|
218
|
+
"/": "/";
|
|
219
|
+
}>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
kind: z.ZodLiteral<"goal">;
|
|
222
|
+
}, z.core.$strip>], "kind">>;
|
|
223
|
+
displayName: z.ZodString;
|
|
224
|
+
experimental_providerHealth: z.ZodBoolean;
|
|
225
|
+
experimental_providerInstallation: z.ZodBoolean;
|
|
226
|
+
experimental_providerUsage: z.ZodBoolean;
|
|
227
|
+
extensionKinds: z.ZodOptional<z.ZodRecord<z.ZodString & z.ZodType<`${string}/${string}`, string, z.core.$ZodTypeInternals<`${string}/${string}`, string>>, z.ZodObject<{
|
|
228
|
+
item: z.ZodBoolean;
|
|
229
|
+
state: z.ZodBoolean;
|
|
230
|
+
}, z.core.$strip>>>;
|
|
231
|
+
family: z.ZodOptional<z.ZodString>;
|
|
232
|
+
id: z.ZodString;
|
|
233
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
234
|
+
reasoningLevels: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
235
|
+
description: z.ZodOptional<z.ZodString>;
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
label: z.ZodString;
|
|
238
|
+
}, z.core.$strip>>>;
|
|
239
|
+
serviceTiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
240
|
+
description: z.ZodOptional<z.ZodString>;
|
|
241
|
+
id: z.ZodString;
|
|
242
|
+
label: z.ZodString;
|
|
243
|
+
}, z.core.$strip>>>;
|
|
244
|
+
strings: z.ZodOptional<z.ZodObject<{
|
|
245
|
+
brandPrefix: z.ZodOptional<z.ZodString>;
|
|
246
|
+
expiredHint: z.ZodString;
|
|
247
|
+
iconTint: z.ZodOptional<z.ZodObject<{
|
|
248
|
+
dark: z.ZodString;
|
|
249
|
+
light: z.ZodString;
|
|
250
|
+
}, z.core.$strip>>;
|
|
251
|
+
installUrl: z.ZodString;
|
|
252
|
+
planModeCopy: z.ZodOptional<z.ZodString>;
|
|
253
|
+
signInHint: z.ZodString;
|
|
254
|
+
}, z.core.$strip>>;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
type ProviderInfo = z.infer<typeof providerInfoSchema>;
|
|
257
|
+
|
|
174
258
|
declare const createThreadEnvironmentArgsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
175
259
|
environmentId: z.ZodString;
|
|
176
260
|
type: z.ZodLiteral<"reuse">;
|
|
@@ -227,16 +311,6 @@ declare const createExecutionInputSourcesSchema: z.ZodObject<{
|
|
|
227
311
|
}, z.core.$strict>;
|
|
228
312
|
type CreateExecutionInputSources = z.infer<typeof createExecutionInputSourcesSchema>;
|
|
229
313
|
|
|
230
|
-
/**
|
|
231
|
-
* A value that survives a JSON round trip without coercion or data loss.
|
|
232
|
-
*
|
|
233
|
-
* Host boundaries still validate values at runtime because TypeScript cannot
|
|
234
|
-
* exclude non-finite numbers and plugin bundles can bypass static types.
|
|
235
|
-
*/
|
|
236
|
-
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
237
|
-
[key: string]: JsonValue;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
314
|
/**
|
|
241
315
|
* The `@get-bb/plugin-sdk/app` contract (plugin design §5.2) — pure types with no
|
|
242
316
|
* side effects. The BB app imports these to keep its real implementation in
|
|
@@ -376,6 +450,13 @@ interface PluginFileOpenerSource {
|
|
|
376
450
|
threadId: string | null;
|
|
377
451
|
environmentId: string | null;
|
|
378
452
|
projectId: string | null;
|
|
453
|
+
/**
|
|
454
|
+
* Explicit host selected for a project-backed workspace file. Omitted when
|
|
455
|
+
* the source is resolved by its environment/thread or the primary host.
|
|
456
|
+
*
|
|
457
|
+
* @experimental Audit before relying on this as a stable contract.
|
|
458
|
+
*/
|
|
459
|
+
experimental_hostId?: string;
|
|
379
460
|
}
|
|
380
461
|
/** Props passed to a `fileOpener` component (rendered as a panel file tab). */
|
|
381
462
|
interface PluginFileOpenerProps {
|
|
@@ -529,6 +610,38 @@ interface PluginSettingsSectionRegistration {
|
|
|
529
610
|
description?: string;
|
|
530
611
|
component: ComponentType<PluginSettingsSectionProps>;
|
|
531
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Owner-defined validator for a fixed tab's transient target. The host first
|
|
615
|
+
* verifies that the value is JSON-safe, then calls this validator before
|
|
616
|
+
* selecting the tab or delivering the target.
|
|
617
|
+
*/
|
|
618
|
+
interface ExperimentalFixedTabTargetContract<Target extends JsonValue> {
|
|
619
|
+
validate(value: JsonValue): value is Target;
|
|
620
|
+
}
|
|
621
|
+
/** Stable, owner-scoped reference used by the app-panel controller. */
|
|
622
|
+
type ExperimentalPluginFixedTabReference<Target extends JsonValue = never> = {
|
|
623
|
+
/** The owning `navPanel` id; validated against the containing registration. */
|
|
624
|
+
readonly panelId: string;
|
|
625
|
+
/** Unique within the owning nav panel; letters, digits, `-`, `_`. */
|
|
626
|
+
readonly id: string;
|
|
627
|
+
} & ([Target] extends [never] ? {
|
|
628
|
+
/** An untargeted tab cannot be opened with a target. */
|
|
629
|
+
readonly experimental_target?: never;
|
|
630
|
+
} : {
|
|
631
|
+
/** Owner validation required before the host delivers a target. */
|
|
632
|
+
readonly experimental_target: ExperimentalFixedTabTargetContract<Target>;
|
|
633
|
+
});
|
|
634
|
+
/** A fixed tab declared by a plugin nav panel. */
|
|
635
|
+
type ExperimentalPluginFixedTabRegistration<Target extends JsonValue = never> = ExperimentalPluginFixedTabReference<Target> & {
|
|
636
|
+
title: string;
|
|
637
|
+
/** Icon hint (BB icon name); unknown names fall back to a generic icon. */
|
|
638
|
+
icon: string;
|
|
639
|
+
component: ComponentType<PluginNavPanelProps>;
|
|
640
|
+
/** `flush` lets the component own padding and scrolling. */
|
|
641
|
+
layout?: "flush" | "padded";
|
|
642
|
+
};
|
|
643
|
+
/** A fixed tab with either no target or an owner-validated JSON target. */
|
|
644
|
+
type ExperimentalPluginFixedTabDeclaration = ExperimentalPluginFixedTabRegistration | ExperimentalPluginFixedTabRegistration<JsonValue>;
|
|
532
645
|
interface PluginNavPanelRegistration {
|
|
533
646
|
/** Unique within the plugin; letters, digits, `-`, `_`. */
|
|
534
647
|
id: string;
|
|
@@ -541,22 +654,14 @@ interface PluginNavPanelRegistration {
|
|
|
541
654
|
/**
|
|
542
655
|
* Ordered, non-closable tabs shown in this page's host-owned right panel.
|
|
543
656
|
* BB owns selection and persistence and always includes its native Browser
|
|
544
|
-
* and Terminal tools beside them.
|
|
545
|
-
*
|
|
546
|
-
* component
|
|
657
|
+
* and Terminal tools beside them. One tab is active in each visible split
|
|
658
|
+
* pane, so multiple fixed-tab components can be mounted concurrently. A
|
|
659
|
+
* component mounts only while its tab is active in a visible pane and the
|
|
660
|
+
* panel is open, and receives the same `subPath` as the page component.
|
|
547
661
|
*
|
|
548
662
|
* Experimental: see docs/api_to_audit.md.
|
|
549
663
|
*/
|
|
550
|
-
experimental_fixedTabs?: readonly
|
|
551
|
-
/** Unique within this nav panel; letters, digits, `-`, `_`. */
|
|
552
|
-
id: string;
|
|
553
|
-
title: string;
|
|
554
|
-
/** Icon hint (BB icon name); unknown names fall back to a generic icon. */
|
|
555
|
-
icon: string;
|
|
556
|
-
component: ComponentType<PluginNavPanelProps>;
|
|
557
|
-
/** `flush` lets the component own padding and scrolling. */
|
|
558
|
-
layout?: "flush" | "padded";
|
|
559
|
-
}[];
|
|
664
|
+
experimental_fixedTabs?: readonly ExperimentalPluginFixedTabDeclaration[];
|
|
560
665
|
/**
|
|
561
666
|
* Optional presentational component rendered at the trailing edge of this
|
|
562
667
|
* panel's sidebar row. It receives no props so it can own a narrow live
|
|
@@ -756,7 +861,8 @@ interface PluginSidebarThread {
|
|
|
756
861
|
originKind: "fork" | null;
|
|
757
862
|
/** The plugin that spawned it, or null for non-plugin origins. */
|
|
758
863
|
originPluginId: string | null;
|
|
759
|
-
/** The agent provider this thread runs on
|
|
864
|
+
/** The agent provider this thread runs on; resolve it through
|
|
865
|
+
* {@link PluginSdkApp.experimental_useProviders} for a name and icon. */
|
|
760
866
|
providerId: string;
|
|
761
867
|
/** The agent is blocked on the user: an approval or a question. */
|
|
762
868
|
hasPendingInteraction: boolean;
|
|
@@ -826,6 +932,17 @@ interface PluginSidebarThreadsState {
|
|
|
826
932
|
threads: readonly PluginSidebarThread[];
|
|
827
933
|
projects: readonly PluginSidebarProject[];
|
|
828
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* The provider directory (see {@link PluginSdkApp.experimental_useProviders}):
|
|
937
|
+
* every registered agent provider in picker order, as the same `ProviderInfo`
|
|
938
|
+
* the host's own pickers read. `logoUrl` is server-relative
|
|
939
|
+
* (`/api/v1/system/providers/<id>/logo`) or null when the provider declared a
|
|
940
|
+
* glyph or no icon; `strings` carries the provider's declared copy.
|
|
941
|
+
*/
|
|
942
|
+
interface PluginProvidersState {
|
|
943
|
+
status: "error" | "loading" | "ready";
|
|
944
|
+
providers: readonly ProviderInfo[];
|
|
945
|
+
}
|
|
829
946
|
/**
|
|
830
947
|
* Act on threads from a plugin surface. Every method routes to the host's own
|
|
831
948
|
* flow, so optimistic updates, toasts, dialogs, pane closing, and route repair
|
|
@@ -1200,7 +1317,10 @@ interface PluginContentScriptRegistration {
|
|
|
1200
1317
|
id: string;
|
|
1201
1318
|
/**
|
|
1202
1319
|
* Install behavior into the bb app shell. The host awaits a returned
|
|
1203
|
-
* promise,
|
|
1320
|
+
* promise, retains the plugin's imported frontend stylesheet for this
|
|
1321
|
+
* generation, contains failures, and calls the returned disposer exactly
|
|
1322
|
+
* once. Styling or decorating existing app-shell DOM belongs here rather
|
|
1323
|
+
* than in an always-on frontend stylesheet.
|
|
1204
1324
|
*/
|
|
1205
1325
|
mount(context: PluginContentScriptContext): void | PluginContentScriptDisposer | Promise<void | PluginContentScriptDisposer>;
|
|
1206
1326
|
}
|
|
@@ -1631,6 +1751,78 @@ interface MarkdownProps {
|
|
|
1631
1751
|
content: string;
|
|
1632
1752
|
className?: string;
|
|
1633
1753
|
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Props for BB's semantic URL link. The host owns ordinary activation while
|
|
1756
|
+
* retaining browser-owned anchor behavior for app routes, modifiers, explicit
|
|
1757
|
+
* targets, copying, and unsupported schemes. New top-level targets preserve
|
|
1758
|
+
* supplied `rel` tokens and receive safe defaults unless `opener` is explicit.
|
|
1759
|
+
* Experimental: see docs/api_to_audit.md.
|
|
1760
|
+
*/
|
|
1761
|
+
interface ExperimentalUrlLinkProps extends Omit<ComponentPropsWithoutRef<"a">, "href"> {
|
|
1762
|
+
href: string;
|
|
1763
|
+
}
|
|
1764
|
+
/** A live file whose identity is complete without ambient route context. */
|
|
1765
|
+
type ExperimentalLiveFileTarget = {
|
|
1766
|
+
kind: "workspace";
|
|
1767
|
+
environmentId: string;
|
|
1768
|
+
path: string;
|
|
1769
|
+
} | {
|
|
1770
|
+
kind: "host";
|
|
1771
|
+
hostId: string;
|
|
1772
|
+
path: string;
|
|
1773
|
+
} | {
|
|
1774
|
+
kind: "thread-storage";
|
|
1775
|
+
threadId: string;
|
|
1776
|
+
path: string;
|
|
1777
|
+
};
|
|
1778
|
+
/** One-based location to reveal after a live file opens. */
|
|
1779
|
+
type ExperimentalFileLocation = {
|
|
1780
|
+
kind: "line";
|
|
1781
|
+
line: number;
|
|
1782
|
+
column: number | null;
|
|
1783
|
+
} | {
|
|
1784
|
+
kind: "range";
|
|
1785
|
+
startLine: number;
|
|
1786
|
+
endLine: number;
|
|
1787
|
+
};
|
|
1788
|
+
/** Options shared by BB's preview and preferred-external file intents. */
|
|
1789
|
+
interface ExperimentalFileOpenOptions {
|
|
1790
|
+
target: ExperimentalLiveFileTarget;
|
|
1791
|
+
location: ExperimentalFileLocation | null;
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Props for BB's host-rendered semantic file link. Valid targets receive a
|
|
1795
|
+
* scheme-safe anchor href; traversal paths, ill-formed Unicode, and other
|
|
1796
|
+
* malformed runtime targets remain inert.
|
|
1797
|
+
*/
|
|
1798
|
+
interface ExperimentalFileLinkProps extends Omit<ComponentPropsWithoutRef<"a">, "href" | "target"> {
|
|
1799
|
+
target: ExperimentalLiveFileTarget;
|
|
1800
|
+
location?: ExperimentalFileLocation | null;
|
|
1801
|
+
}
|
|
1802
|
+
/** The panel surface resolved by the component making the request. */
|
|
1803
|
+
type ExperimentalAppPanelSurface = {
|
|
1804
|
+
kind: "current";
|
|
1805
|
+
};
|
|
1806
|
+
/**
|
|
1807
|
+
* The owning fixed tab's current memory-only target. It survives tab, panel,
|
|
1808
|
+
* and route remounts during the current app session, but is never persisted
|
|
1809
|
+
* across a refresh. Call `clear` when the owner returns to its untargeted state.
|
|
1810
|
+
*/
|
|
1811
|
+
interface ExperimentalFixedTabTargetState<Target extends JsonValue> {
|
|
1812
|
+
readonly sequence: number;
|
|
1813
|
+
readonly target: Target;
|
|
1814
|
+
clear(): void;
|
|
1815
|
+
}
|
|
1816
|
+
type ExperimentalOpenFixedTabOptions<Target extends JsonValue> = {
|
|
1817
|
+
surface: ExperimentalAppPanelSurface;
|
|
1818
|
+
tab: ExperimentalPluginFixedTabReference<Target>;
|
|
1819
|
+
/** Omit to select the tab without replacing its current session target. */
|
|
1820
|
+
target?: NoInfer<Target>;
|
|
1821
|
+
};
|
|
1822
|
+
/** Surface-aware controller for selecting owner-scoped fixed tabs. */
|
|
1823
|
+
interface ExperimentalAppPanel {
|
|
1824
|
+
openFixedTab<Target extends JsonValue = never>(options: ExperimentalOpenFixedTabOptions<Target>): boolean;
|
|
1825
|
+
}
|
|
1634
1826
|
/** Current app selection, derived from the route. */
|
|
1635
1827
|
interface BbContext {
|
|
1636
1828
|
projectId: string | null;
|
|
@@ -1665,6 +1857,16 @@ interface BbNavigate {
|
|
|
1665
1857
|
* the action is unavailable.
|
|
1666
1858
|
*/
|
|
1667
1859
|
openThreadPanel(options: PluginTargetedPanelActionOpenOptions): boolean;
|
|
1860
|
+
/**
|
|
1861
|
+
* Open an HTTP(S) URL using this client's BB browser preference. Returns
|
|
1862
|
+
* false for schemes the host does not own. Experimental: see
|
|
1863
|
+
* docs/api_to_audit.md.
|
|
1864
|
+
*/
|
|
1865
|
+
experimental_openUrl(url: string): boolean;
|
|
1866
|
+
/** Open a live file in this surface's shared BB preview panel. */
|
|
1867
|
+
experimental_openFilePreview(options: ExperimentalFileOpenOptions): boolean;
|
|
1868
|
+
/** Open a live file in this client's preferred external file target. */
|
|
1869
|
+
experimental_openFileExternally(options: ExperimentalFileOpenOptions): boolean;
|
|
1668
1870
|
}
|
|
1669
1871
|
/**
|
|
1670
1872
|
* Everything `@get-bb/plugin-sdk/app` resolves to at runtime. The BB app builds
|
|
@@ -1685,6 +1887,10 @@ interface PluginSdkApp {
|
|
|
1685
1887
|
useSettings(): PluginSettingsState;
|
|
1686
1888
|
useBbContext(): BbContext;
|
|
1687
1889
|
useBbNavigate(): BbNavigate;
|
|
1890
|
+
/** Select one of this plugin's eligible fixed tabs on the current surface. */
|
|
1891
|
+
experimental_useAppPanel(): ExperimentalAppPanel;
|
|
1892
|
+
/** Read or clear the owning tab's validated, session-scoped target. */
|
|
1893
|
+
experimental_useFixedTabTarget<Target extends JsonValue>(tab: ExperimentalPluginFixedTabReference<Target>): ExperimentalFixedTabTargetState<Target> | null;
|
|
1688
1894
|
useComposer(): PluginComposerApi;
|
|
1689
1895
|
/**
|
|
1690
1896
|
* The sidebar's live thread view (see {@link PluginSidebarThreadsState}).
|
|
@@ -1724,6 +1930,13 @@ interface PluginSdkApp {
|
|
|
1724
1930
|
* Experimental: see docs/api_to_audit.md.
|
|
1725
1931
|
*/
|
|
1726
1932
|
experimental_useSidebarThreadSplit(threadId: string): PluginSidebarThreadSplit;
|
|
1933
|
+
/**
|
|
1934
|
+
* The provider directory (see {@link PluginProvidersState}). Reads the
|
|
1935
|
+
* host's own cached provider roster, so a plugin that shows a thread's
|
|
1936
|
+
* provider never re-vendors provider names, icons, or copy. Experimental:
|
|
1937
|
+
* see docs/api_to_audit.md.
|
|
1938
|
+
*/
|
|
1939
|
+
experimental_useProviders(): PluginProvidersState;
|
|
1727
1940
|
/**
|
|
1728
1941
|
* The host-owned chat component (see {@link ThreadChatProps}). Together
|
|
1729
1942
|
* with `Markdown`, the only components the SDK ships — everything else
|
|
@@ -1735,6 +1948,13 @@ interface PluginSdkApp {
|
|
|
1735
1948
|
* {@link MarkdownProps}).
|
|
1736
1949
|
*/
|
|
1737
1950
|
Markdown: ComponentType<MarkdownProps>;
|
|
1951
|
+
/**
|
|
1952
|
+
* A real anchor whose ordinary HTTP(S) activation uses BB's URL preference.
|
|
1953
|
+
* Experimental: see docs/api_to_audit.md.
|
|
1954
|
+
*/
|
|
1955
|
+
experimental_UrlLink: ComponentType<ExperimentalUrlLinkProps>;
|
|
1956
|
+
/** Host-rendered live-file link backed by the shared navigation controller. */
|
|
1957
|
+
experimental_FileLink: ComponentType<ExperimentalFileLinkProps>;
|
|
1738
1958
|
/**
|
|
1739
1959
|
* The host-owned new-thread compose surface (see
|
|
1740
1960
|
* {@link NewThreadComposerProps}). Experimental: see
|
|
@@ -1762,6 +1982,8 @@ interface PluginSdkApp {
|
|
|
1762
1982
|
declare const definePluginApp: (setup: PluginAppSetup) => PluginAppDefinition;
|
|
1763
1983
|
declare const ThreadChat: react.ComponentType<ThreadChatProps>;
|
|
1764
1984
|
declare const Markdown: react.ComponentType<MarkdownProps>;
|
|
1985
|
+
declare const experimental_FileLink: react.ComponentType<ExperimentalFileLinkProps>;
|
|
1986
|
+
declare const experimental_UrlLink: react.ComponentType<ExperimentalUrlLinkProps>;
|
|
1765
1987
|
declare const experimental_NewThreadComposer: react.ComponentType<NewThreadComposerProps>;
|
|
1766
1988
|
declare const experimental_SourceCode: react.ComponentType<SourceCodeProps>;
|
|
1767
1989
|
declare const experimental_Diff: react.ComponentType<DiffProps>;
|
|
@@ -1771,12 +1993,15 @@ declare const useRealtimeConnectionState: () => PluginRealtimeConnectionState;
|
|
|
1771
1993
|
declare const useSettings: () => PluginSettingsState;
|
|
1772
1994
|
declare const useBbContext: () => BbContext;
|
|
1773
1995
|
declare const useBbNavigate: () => BbNavigate;
|
|
1996
|
+
declare const experimental_useAppPanel: () => ExperimentalAppPanel;
|
|
1997
|
+
declare const experimental_useFixedTabTarget: <Target extends JsonValue>(tab: ExperimentalPluginFixedTabReference<Target>) => ExperimentalFixedTabTargetState<Target> | null;
|
|
1774
1998
|
declare const useComposer: () => PluginComposerApi;
|
|
1775
1999
|
declare const useComposerView: () => ComposerView;
|
|
1776
2000
|
declare const experimental_useSidebarThreads: () => PluginSidebarThreadsState;
|
|
1777
2001
|
declare const experimental_useSidebarThreadActions: () => PluginSidebarThreadActions;
|
|
1778
2002
|
declare const experimental_useSidebarThreadPullRequest: (threadId: string) => PluginSidebarThreadPullRequestState;
|
|
1779
2003
|
declare const experimental_useSidebarThreadSplit: (threadId: string) => PluginSidebarThreadSplit;
|
|
2004
|
+
declare const experimental_useProviders: () => PluginProvidersState;
|
|
1780
2005
|
|
|
1781
|
-
export { Markdown, ThreadChat, definePluginApp, experimental_Diff, experimental_NewThreadComposer, experimental_SourceCode, experimental_useSidebarThreadActions, experimental_useSidebarThreadPullRequest, experimental_useSidebarThreadSplit, experimental_useSidebarThreads, useBbContext, useBbNavigate, useComposer, useComposerView, useRealtime, useRealtimeConnectionState, useRpc, useSettings };
|
|
1782
|
-
export type { BbContext, BbNavigate, CodeOverflowMode, ComposerCustomization, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerStructuredDraft, ComposerView, DiffProps, DiffViewMode, JsonValue, MarkdownProps, NewThreadComposerProps, NewThreadRequest, PluginAppBuilder, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginComposerTextEffect, PluginComposerThreadRowStatus, PluginContentScriptContext, PluginContentScriptDisposer, PluginContentScriptRegistration, PluginDiffRendererProps, PluginDiffRendererRegistration, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginMessageActionContext, PluginMessageActionRegistration, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginNavPanelProps, PluginNavPanelRegistration, PluginNewThreadPanelActionContext, PluginNewThreadPanelActionRegistration, PluginNewThreadPanelProps, PluginPanelActionOpenOptions, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginProviderIconRegistration, PluginRealtimeConnectionState, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginSidebarProject, PluginSidebarPullRequest, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActions, PluginSidebarThreadActivity, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSidebarWorkspaceKind, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginTargetedPanelActionOpenOptions, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps };
|
|
2006
|
+
export { Markdown, ThreadChat, definePluginApp, experimental_Diff, experimental_FileLink, experimental_NewThreadComposer, experimental_SourceCode, experimental_UrlLink, experimental_useAppPanel, experimental_useFixedTabTarget, experimental_useProviders, experimental_useSidebarThreadActions, experimental_useSidebarThreadPullRequest, experimental_useSidebarThreadSplit, experimental_useSidebarThreads, useBbContext, useBbNavigate, useComposer, useComposerView, useRealtime, useRealtimeConnectionState, useRpc, useSettings };
|
|
2007
|
+
export type { BbContext, BbNavigate, CodeOverflowMode, ComposerCustomization, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerStructuredDraft, ComposerView, DiffProps, DiffViewMode, ExperimentalAppPanel, ExperimentalAppPanelSurface, ExperimentalFileLinkProps, ExperimentalFileLocation, ExperimentalFileOpenOptions, ExperimentalFixedTabTargetContract, ExperimentalFixedTabTargetState, ExperimentalLiveFileTarget, ExperimentalOpenFixedTabOptions, ExperimentalPluginFixedTabDeclaration, ExperimentalPluginFixedTabReference, ExperimentalPluginFixedTabRegistration, ExperimentalUrlLinkProps, JsonValue, MarkdownProps, NewThreadComposerProps, NewThreadRequest, PluginAppBuilder, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginComposerTextEffect, PluginComposerThreadRowStatus, PluginContentScriptContext, PluginContentScriptDisposer, PluginContentScriptRegistration, PluginDiffRendererProps, PluginDiffRendererRegistration, PluginFileOpenerProps, PluginFileOpenerRegistration, PluginFileOpenerSource, PluginHomepageSectionProps, PluginHomepageSectionRegistration, PluginMessageActionContext, PluginMessageActionRegistration, PluginMessageDirectiveMessage, PluginMessageDirectiveOpenWorkspaceFile, PluginMessageDirectiveProps, PluginMessageDirectiveRegistration, PluginNavPanelProps, PluginNavPanelRegistration, PluginNewThreadPanelActionContext, PluginNewThreadPanelActionRegistration, PluginNewThreadPanelProps, PluginPanelActionOpenOptions, PluginPendingInteractionProps, PluginPendingInteractionRegistration, PluginPendingInteractionView, PluginProviderIconRegistration, PluginProvidersState, PluginRealtimeConnectionState, PluginRpcCallArgs, PluginRpcClient, PluginRpcContract, PluginRpcError, PluginRpcErrorCode, PluginRpcHandlers, PluginRpcIssuePathSegment, PluginRpcMethodContract, PluginRpcResult, PluginRpcValidationIssue, PluginSdkApp, PluginSettingsSectionProps, PluginSettingsSectionRegistration, PluginSettingsState, PluginSidebarFooterActionContext, PluginSidebarFooterActionProps, PluginSidebarFooterActionRegistration, PluginSidebarProject, PluginSidebarPullRequest, PluginSidebarSplitPane, PluginSidebarThread, PluginSidebarThreadActions, PluginSidebarThreadActivity, PluginSidebarThreadIndicator, PluginSidebarThreadPullRequestState, PluginSidebarThreadSplit, PluginSidebarThreadsState, PluginSidebarWorkspaceKind, PluginSourceCodeRendererProps, PluginSourceCodeRendererRegistration, PluginTargetedPanelActionOpenOptions, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, SourceCodeLineRange, SourceCodeProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Portable type declarations for `@get-bb/plugin-sdk`. Unpublished BB
|
|
2
|
+
// workspace contracts are flattened; public subpaths may reuse the
|
|
3
|
+
// package root without requiring any other @bb/* package.
|
|
4
|
+
//
|
|
5
|
+
// Confused by the API, or need a symbol that isn't here? Clone the BB repo
|
|
6
|
+
// and read the real source: https://github.com/get-bb/bb
|
|
7
|
+
|
|
8
|
+
/** A live file whose identity is complete without ambient route context. */
|
|
9
|
+
type ExperimentalLiveFileTarget = {
|
|
10
|
+
kind: "workspace";
|
|
11
|
+
environmentId: string;
|
|
12
|
+
path: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "host";
|
|
15
|
+
hostId: string;
|
|
16
|
+
path: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "thread-storage";
|
|
19
|
+
threadId: string;
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
/** One-based location to reveal after a live file opens. */
|
|
23
|
+
type ExperimentalFileLocation = {
|
|
24
|
+
kind: "line";
|
|
25
|
+
line: number;
|
|
26
|
+
column: number | null;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "range";
|
|
29
|
+
startLine: number;
|
|
30
|
+
endLine: number;
|
|
31
|
+
};
|
|
32
|
+
/** Options shared by BB's preview and preferred-external file intents. */
|
|
33
|
+
interface ExperimentalFileOpenOptions {
|
|
34
|
+
target: ExperimentalLiveFileTarget;
|
|
35
|
+
location: ExperimentalFileLocation | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function normalizeExperimentalLiveFileTarget(value: unknown): ExperimentalLiveFileTarget | null;
|
|
39
|
+
declare function normalizeExperimentalFileLocation(value: unknown): ExperimentalFileLocation | null | undefined;
|
|
40
|
+
declare function normalizeExperimentalFileOpenOptions(value: unknown): ExperimentalFileOpenOptions | null;
|
|
41
|
+
|
|
42
|
+
export { normalizeExperimentalFileLocation, normalizeExperimentalFileOpenOptions, normalizeExperimentalLiveFileTarget };
|