@get-bb/plugin-sdk 0.4.8 → 0.4.10

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 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`; scripts may own
49
- dynamic DOM/style nodes when their disposer removes them. See the
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. */
@@ -227,16 +237,6 @@ declare const createExecutionInputSourcesSchema: z.ZodObject<{
227
237
  }, z.core.$strict>;
228
238
  type CreateExecutionInputSources = z.infer<typeof createExecutionInputSourcesSchema>;
229
239
 
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
240
  /**
241
241
  * The `@get-bb/plugin-sdk/app` contract (plugin design §5.2) — pure types with no
242
242
  * side effects. The BB app imports these to keep its real implementation in
@@ -376,6 +376,13 @@ interface PluginFileOpenerSource {
376
376
  threadId: string | null;
377
377
  environmentId: string | null;
378
378
  projectId: string | null;
379
+ /**
380
+ * Explicit host selected for a project-backed workspace file. Omitted when
381
+ * the source is resolved by its environment/thread or the primary host.
382
+ *
383
+ * @experimental Audit before relying on this as a stable contract.
384
+ */
385
+ experimental_hostId?: string;
379
386
  }
380
387
  /** Props passed to a `fileOpener` component (rendered as a panel file tab). */
381
388
  interface PluginFileOpenerProps {
@@ -389,6 +396,96 @@ interface PluginFileOpenerProps {
389
396
  */
390
397
  experimental_Original: ComponentType;
391
398
  }
399
+ /** How a code line longer than the viewport is presented. */
400
+ type CodeOverflowMode = "scroll" | "wrap";
401
+ /** How a diff presents its two sides. */
402
+ type DiffViewMode = "split" | "unified";
403
+ /** A 1-based, inclusive line range. */
404
+ interface SourceCodeLineRange {
405
+ start: number;
406
+ end: number;
407
+ }
408
+ /**
409
+ * Props of the host-owned `experimental_SourceCode` component — BB's source
410
+ * viewer. The host owns syntax highlighting, gutters, wrapping, line-selection
411
+ * presentation, and the live BB code theme; the caller owns loading the text
412
+ * and any surrounding chrome.
413
+ */
414
+ interface SourceCodeProps {
415
+ /** The complete source text to render. */
416
+ content: string;
417
+ /** File path or name. Drives language detection and the a11y label. */
418
+ path: string;
419
+ /** Long-line presentation. Defaults to `"scroll"`. */
420
+ overflow?: CodeOverflowMode;
421
+ /**
422
+ * Lines to highlight and scroll into view (1-based, inclusive). Defaults to
423
+ * `null` — nothing highlighted.
424
+ */
425
+ highlightedLines?: SourceCodeLineRange | null;
426
+ /** Applied to the renderer's root element. */
427
+ className?: string;
428
+ }
429
+ /**
430
+ * Props of the host-owned `experimental_Diff` component — BB's diff viewer.
431
+ * The host owns patch normalization (a patch without a `diff --git` header is
432
+ * completed from `path`), syntax highlighting, unified/split presentation,
433
+ * gutters, line-selection presentation, and the live BB code theme. Content
434
+ * that cannot be parsed as a patch degrades to plain monospace text.
435
+ */
436
+ interface DiffProps {
437
+ /** Unified patch text for exactly ONE file. */
438
+ patch: string;
439
+ /**
440
+ * The file the patch applies to. Used to complete a patch that arrives
441
+ * without a `diff --git` header (GitHub's REST patches, single `@@` hunks)
442
+ * and for language detection.
443
+ */
444
+ path: string;
445
+ /** Side-by-side or inline. Defaults to `"unified"`. */
446
+ view?: DiffViewMode;
447
+ /** Long-line presentation. Defaults to `"scroll"`. */
448
+ overflow?: CodeOverflowMode;
449
+ /** Whether the gutter shows line numbers. Defaults to `true`. */
450
+ showLineNumbers?: boolean;
451
+ /** Applied to the renderer's root element. */
452
+ className?: string;
453
+ }
454
+ /**
455
+ * Props passed to an `experimental_sourceCodeRenderer` component. Every value
456
+ * is already resolved — the replacement never re-applies a host default.
457
+ */
458
+ interface PluginSourceCodeRendererProps {
459
+ content: string;
460
+ path: string;
461
+ overflow: CodeOverflowMode;
462
+ highlightedLines: SourceCodeLineRange | null;
463
+ /**
464
+ * BB's source renderer, bound to this request. Render it to delegate
465
+ * conditionally without re-entering plugin replacement resolution.
466
+ *
467
+ * @experimental Audit before relying on this as a stable contract.
468
+ */
469
+ experimental_Original: ComponentType;
470
+ }
471
+ /**
472
+ * Props passed to an `experimental_diffRenderer` component. `patch` is always
473
+ * a complete single-file unified patch, whatever shape the caller supplied.
474
+ */
475
+ interface PluginDiffRendererProps {
476
+ patch: string;
477
+ path: string;
478
+ view: DiffViewMode;
479
+ overflow: CodeOverflowMode;
480
+ showLineNumbers: boolean;
481
+ /**
482
+ * BB's diff renderer, bound to this request. Render it to delegate
483
+ * conditionally without re-entering plugin replacement resolution.
484
+ *
485
+ * @experimental Audit before relying on this as a stable contract.
486
+ */
487
+ experimental_Original: ComponentType;
488
+ }
392
489
  /**
393
490
  * Message context passed to a `messageDirective` component — the assistant
394
491
  * (or nested agent) message that contained the directive.
@@ -439,6 +536,38 @@ interface PluginSettingsSectionRegistration {
439
536
  description?: string;
440
537
  component: ComponentType<PluginSettingsSectionProps>;
441
538
  }
539
+ /**
540
+ * Owner-defined validator for a fixed tab's transient target. The host first
541
+ * verifies that the value is JSON-safe, then calls this validator before
542
+ * selecting the tab or delivering the target.
543
+ */
544
+ interface ExperimentalFixedTabTargetContract<Target extends JsonValue> {
545
+ validate(value: JsonValue): value is Target;
546
+ }
547
+ /** Stable, owner-scoped reference used by the app-panel controller. */
548
+ type ExperimentalPluginFixedTabReference<Target extends JsonValue = never> = {
549
+ /** The owning `navPanel` id; validated against the containing registration. */
550
+ readonly panelId: string;
551
+ /** Unique within the owning nav panel; letters, digits, `-`, `_`. */
552
+ readonly id: string;
553
+ } & ([Target] extends [never] ? {
554
+ /** An untargeted tab cannot be opened with a target. */
555
+ readonly experimental_target?: never;
556
+ } : {
557
+ /** Owner validation required before the host delivers a target. */
558
+ readonly experimental_target: ExperimentalFixedTabTargetContract<Target>;
559
+ });
560
+ /** A fixed tab declared by a plugin nav panel. */
561
+ type ExperimentalPluginFixedTabRegistration<Target extends JsonValue = never> = ExperimentalPluginFixedTabReference<Target> & {
562
+ title: string;
563
+ /** Icon hint (BB icon name); unknown names fall back to a generic icon. */
564
+ icon: string;
565
+ component: ComponentType<PluginNavPanelProps>;
566
+ /** `flush` lets the component own padding and scrolling. */
567
+ layout?: "flush" | "padded";
568
+ };
569
+ /** A fixed tab with either no target or an owner-validated JSON target. */
570
+ type ExperimentalPluginFixedTabDeclaration = ExperimentalPluginFixedTabRegistration | ExperimentalPluginFixedTabRegistration<JsonValue>;
442
571
  interface PluginNavPanelRegistration {
443
572
  /** Unique within the plugin; letters, digits, `-`, `_`. */
444
573
  id: string;
@@ -451,22 +580,14 @@ interface PluginNavPanelRegistration {
451
580
  /**
452
581
  * Ordered, non-closable tabs shown in this page's host-owned right panel.
453
582
  * BB owns selection and persistence and always includes its native Browser
454
- * and Terminal tools beside them. Components mount only while their tab is
455
- * active and the panel is open, and receive the same `subPath` as the page
456
- * component.
583
+ * and Terminal tools beside them. One tab is active in each visible split
584
+ * pane, so multiple fixed-tab components can be mounted concurrently. A
585
+ * component mounts only while its tab is active in a visible pane and the
586
+ * panel is open, and receives the same `subPath` as the page component.
457
587
  *
458
588
  * Experimental: see docs/api_to_audit.md.
459
589
  */
460
- experimental_fixedTabs?: readonly {
461
- /** Unique within this nav panel; letters, digits, `-`, `_`. */
462
- id: string;
463
- title: string;
464
- /** Icon hint (BB icon name); unknown names fall back to a generic icon. */
465
- icon: string;
466
- component: ComponentType<PluginNavPanelProps>;
467
- /** `flush` lets the component own padding and scrolling. */
468
- layout?: "flush" | "padded";
469
- }[];
590
+ experimental_fixedTabs?: readonly ExperimentalPluginFixedTabDeclaration[];
470
591
  /**
471
592
  * Optional presentational component rendered at the trailing edge of this
472
593
  * panel's sidebar row. It receives no props so it can own a narrow live
@@ -885,6 +1006,41 @@ interface PluginFileOpenerRegistration {
885
1006
  extensions: readonly string[];
886
1007
  component: ComponentType<PluginFileOpenerProps>;
887
1008
  }
1009
+ /**
1010
+ * Replace BB's source-code renderer everywhere it renders supplied source
1011
+ * text — the native file preview and every plugin that calls
1012
+ * `experimental_SourceCode`. Like `experimental_threadList` this slot is
1013
+ * **exclusive**: one renderer at a time. Registering activates it while the
1014
+ * plugin is enabled; if several are registered the first in deterministic slot
1015
+ * order wins. A missing, disabled, or crashing replacement falls back to BB's
1016
+ * renderer, and a replacement can render `experimental_Original` to delegate
1017
+ * per call (behind its own setting, by language, by size — whatever it needs).
1018
+ */
1019
+ interface PluginSourceCodeRendererRegistration {
1020
+ /** Unique within the plugin; letters, digits, `-`, `_`. */
1021
+ id: string;
1022
+ /** Label shown in capability details. */
1023
+ title: string;
1024
+ /** Optional one-line description shown with the provider choice. */
1025
+ description?: string;
1026
+ component: ComponentType<PluginSourceCodeRendererProps>;
1027
+ }
1028
+ /**
1029
+ * Replace BB's diff renderer everywhere it renders supplied diff content — the
1030
+ * timeline file diffs, the environment diff panel's text bodies, and every
1031
+ * plugin that calls `experimental_Diff`. Exclusive, with the same activation,
1032
+ * fallback, and `experimental_Original` delegation rules as
1033
+ * {@link PluginSourceCodeRendererRegistration}.
1034
+ */
1035
+ interface PluginDiffRendererRegistration {
1036
+ /** Unique within the plugin; letters, digits, `-`, `_`. */
1037
+ id: string;
1038
+ /** Label shown in capability details. */
1039
+ title: string;
1040
+ /** Optional one-line description shown with the provider choice. */
1041
+ description?: string;
1042
+ component: ComponentType<PluginDiffRendererProps>;
1043
+ }
888
1044
  /**
889
1045
  * Register a leaf message directive rendered inside assistant (and nested
890
1046
  * agent) message Markdown. `id` is the directive name: `inline-vis` matches
@@ -1018,6 +1174,18 @@ interface PluginAppSlots {
1018
1174
  */
1019
1175
  experimental_threadHeaderAction(registration: PluginThreadHeaderActionRegistration): void;
1020
1176
  fileOpener(registration: PluginFileOpenerRegistration): void;
1177
+ /**
1178
+ * Replace BB's source-code renderer (see
1179
+ * {@link PluginSourceCodeRendererRegistration}). Experimental: see
1180
+ * docs/api_to_audit.md.
1181
+ */
1182
+ experimental_sourceCodeRenderer(registration: PluginSourceCodeRendererRegistration): void;
1183
+ /**
1184
+ * Replace BB's diff renderer (see
1185
+ * {@link PluginDiffRendererRegistration}). Experimental: see
1186
+ * docs/api_to_audit.md.
1187
+ */
1188
+ experimental_diffRenderer(registration: PluginDiffRendererRegistration): void;
1021
1189
  messageDirective(registration: PluginMessageDirectiveRegistration): void;
1022
1190
  messageAction(registration: PluginMessageActionRegistration): void;
1023
1191
  /**
@@ -1063,7 +1231,10 @@ interface PluginContentScriptRegistration {
1063
1231
  id: string;
1064
1232
  /**
1065
1233
  * Install behavior into the bb app shell. The host awaits a returned
1066
- * promise, contains failures, and calls the returned disposer exactly once.
1234
+ * promise, retains the plugin's imported frontend stylesheet for this
1235
+ * generation, contains failures, and calls the returned disposer exactly
1236
+ * once. Styling or decorating existing app-shell DOM belongs here rather
1237
+ * than in an always-on frontend stylesheet.
1067
1238
  */
1068
1239
  mount(context: PluginContentScriptContext): void | PluginContentScriptDisposer | Promise<void | PluginContentScriptDisposer>;
1069
1240
  }
@@ -1494,6 +1665,78 @@ interface MarkdownProps {
1494
1665
  content: string;
1495
1666
  className?: string;
1496
1667
  }
1668
+ /**
1669
+ * Props for BB's semantic URL link. The host owns ordinary activation while
1670
+ * retaining browser-owned anchor behavior for app routes, modifiers, explicit
1671
+ * targets, copying, and unsupported schemes. New top-level targets preserve
1672
+ * supplied `rel` tokens and receive safe defaults unless `opener` is explicit.
1673
+ * Experimental: see docs/api_to_audit.md.
1674
+ */
1675
+ interface ExperimentalUrlLinkProps extends Omit<ComponentPropsWithoutRef<"a">, "href"> {
1676
+ href: string;
1677
+ }
1678
+ /** A live file whose identity is complete without ambient route context. */
1679
+ type ExperimentalLiveFileTarget = {
1680
+ kind: "workspace";
1681
+ environmentId: string;
1682
+ path: string;
1683
+ } | {
1684
+ kind: "host";
1685
+ hostId: string;
1686
+ path: string;
1687
+ } | {
1688
+ kind: "thread-storage";
1689
+ threadId: string;
1690
+ path: string;
1691
+ };
1692
+ /** One-based location to reveal after a live file opens. */
1693
+ type ExperimentalFileLocation = {
1694
+ kind: "line";
1695
+ line: number;
1696
+ column: number | null;
1697
+ } | {
1698
+ kind: "range";
1699
+ startLine: number;
1700
+ endLine: number;
1701
+ };
1702
+ /** Options shared by BB's preview and preferred-external file intents. */
1703
+ interface ExperimentalFileOpenOptions {
1704
+ target: ExperimentalLiveFileTarget;
1705
+ location: ExperimentalFileLocation | null;
1706
+ }
1707
+ /**
1708
+ * Props for BB's host-rendered semantic file link. Valid targets receive a
1709
+ * scheme-safe anchor href; traversal paths, ill-formed Unicode, and other
1710
+ * malformed runtime targets remain inert.
1711
+ */
1712
+ interface ExperimentalFileLinkProps extends Omit<ComponentPropsWithoutRef<"a">, "href" | "target"> {
1713
+ target: ExperimentalLiveFileTarget;
1714
+ location?: ExperimentalFileLocation | null;
1715
+ }
1716
+ /** The panel surface resolved by the component making the request. */
1717
+ type ExperimentalAppPanelSurface = {
1718
+ kind: "current";
1719
+ };
1720
+ /**
1721
+ * The owning fixed tab's current memory-only target. It survives tab, panel,
1722
+ * and route remounts during the current app session, but is never persisted
1723
+ * across a refresh. Call `clear` when the owner returns to its untargeted state.
1724
+ */
1725
+ interface ExperimentalFixedTabTargetState<Target extends JsonValue> {
1726
+ readonly sequence: number;
1727
+ readonly target: Target;
1728
+ clear(): void;
1729
+ }
1730
+ type ExperimentalOpenFixedTabOptions<Target extends JsonValue> = {
1731
+ surface: ExperimentalAppPanelSurface;
1732
+ tab: ExperimentalPluginFixedTabReference<Target>;
1733
+ /** Omit to select the tab without replacing its current session target. */
1734
+ target?: NoInfer<Target>;
1735
+ };
1736
+ /** Surface-aware controller for selecting owner-scoped fixed tabs. */
1737
+ interface ExperimentalAppPanel {
1738
+ openFixedTab<Target extends JsonValue = never>(options: ExperimentalOpenFixedTabOptions<Target>): boolean;
1739
+ }
1497
1740
  /** Current app selection, derived from the route. */
1498
1741
  interface BbContext {
1499
1742
  projectId: string | null;
@@ -1528,6 +1771,16 @@ interface BbNavigate {
1528
1771
  * the action is unavailable.
1529
1772
  */
1530
1773
  openThreadPanel(options: PluginTargetedPanelActionOpenOptions): boolean;
1774
+ /**
1775
+ * Open an HTTP(S) URL using this client's BB browser preference. Returns
1776
+ * false for schemes the host does not own. Experimental: see
1777
+ * docs/api_to_audit.md.
1778
+ */
1779
+ experimental_openUrl(url: string): boolean;
1780
+ /** Open a live file in this surface's shared BB preview panel. */
1781
+ experimental_openFilePreview(options: ExperimentalFileOpenOptions): boolean;
1782
+ /** Open a live file in this client's preferred external file target. */
1783
+ experimental_openFileExternally(options: ExperimentalFileOpenOptions): boolean;
1531
1784
  }
1532
1785
  /**
1533
1786
  * Everything `@get-bb/plugin-sdk/app` resolves to at runtime. The BB app builds
@@ -1548,11 +1801,22 @@ interface PluginSdkApp {
1548
1801
  useSettings(): PluginSettingsState;
1549
1802
  useBbContext(): BbContext;
1550
1803
  useBbNavigate(): BbNavigate;
1804
+ /** Select one of this plugin's eligible fixed tabs on the current surface. */
1805
+ experimental_useAppPanel(): ExperimentalAppPanel;
1806
+ /** Read or clear the owning tab's validated, session-scoped target. */
1807
+ experimental_useFixedTabTarget<Target extends JsonValue>(tab: ExperimentalPluginFixedTabReference<Target>): ExperimentalFixedTabTargetState<Target> | null;
1551
1808
  useComposer(): PluginComposerApi;
1552
1809
  /**
1553
1810
  * The sidebar's live thread view (see {@link PluginSidebarThreadsState}).
1554
1811
  * Reads the host's own cache and realtime subscriptions, so it costs no
1555
1812
  * extra request and updates exactly when the built-in sidebar does.
1813
+ *
1814
+ * `threads` is one array of every visible thread and is not capped. Thread
1815
+ * objects keep their identity across updates while the underlying entry is
1816
+ * unchanged, so a memoized row re-renders only when its own thread changed;
1817
+ * the array itself is new on every update. Window your rows (render only
1818
+ * what is on screen) as the built-in sidebar does — a list that mounts one
1819
+ * row per thread is slow on phones with many threads.
1556
1820
  * Experimental: see docs/api_to_audit.md.
1557
1821
  */
1558
1822
  experimental_useSidebarThreads(): PluginSidebarThreadsState;
@@ -1591,25 +1855,53 @@ interface PluginSdkApp {
1591
1855
  * {@link MarkdownProps}).
1592
1856
  */
1593
1857
  Markdown: ComponentType<MarkdownProps>;
1858
+ /**
1859
+ * A real anchor whose ordinary HTTP(S) activation uses BB's URL preference.
1860
+ * Experimental: see docs/api_to_audit.md.
1861
+ */
1862
+ experimental_UrlLink: ComponentType<ExperimentalUrlLinkProps>;
1863
+ /** Host-rendered live-file link backed by the shared navigation controller. */
1864
+ experimental_FileLink: ComponentType<ExperimentalFileLinkProps>;
1594
1865
  /**
1595
1866
  * The host-owned new-thread compose surface (see
1596
1867
  * {@link NewThreadComposerProps}). Experimental: see
1597
1868
  * docs/api_to_audit.md for what to audit before the prefix drops.
1598
1869
  */
1599
1870
  experimental_NewThreadComposer: ComponentType<NewThreadComposerProps>;
1871
+ /**
1872
+ * The host-owned source viewer (see {@link SourceCodeProps}). Renders
1873
+ * supplied source text with BB's syntax highlighting, gutters, and live code
1874
+ * theme, and honours an active `experimental_sourceCodeRenderer`
1875
+ * replacement. Experimental: see docs/api_to_audit.md.
1876
+ */
1877
+ experimental_SourceCode: ComponentType<SourceCodeProps>;
1878
+ /**
1879
+ * The host-owned diff viewer (see {@link DiffProps}). Renders supplied patch
1880
+ * content with BB's normalization, syntax highlighting, unified/split
1881
+ * presentation, and live code theme, and honours an active
1882
+ * `experimental_diffRenderer` replacement. Experimental: see
1883
+ * docs/api_to_audit.md.
1884
+ */
1885
+ experimental_Diff: ComponentType<DiffProps>;
1600
1886
  useComposerView(): ComposerView;
1601
1887
  }
1602
1888
 
1603
1889
  declare const definePluginApp: (setup: PluginAppSetup) => PluginAppDefinition;
1604
1890
  declare const ThreadChat: react.ComponentType<ThreadChatProps>;
1605
1891
  declare const Markdown: react.ComponentType<MarkdownProps>;
1892
+ declare const experimental_FileLink: react.ComponentType<ExperimentalFileLinkProps>;
1893
+ declare const experimental_UrlLink: react.ComponentType<ExperimentalUrlLinkProps>;
1606
1894
  declare const experimental_NewThreadComposer: react.ComponentType<NewThreadComposerProps>;
1895
+ declare const experimental_SourceCode: react.ComponentType<SourceCodeProps>;
1896
+ declare const experimental_Diff: react.ComponentType<DiffProps>;
1607
1897
  declare const useRpc: <Contract extends PluginRpcContract = Readonly<Record<string, PluginRpcMethodContract<StandardSchemaV1<unknown, unknown>, StandardSchemaV1<unknown, unknown>>>>>() => PluginRpcClient<Contract>;
1608
1898
  declare const useRealtime: (channel: string, handler: (payload: unknown) => void) => void;
1609
1899
  declare const useRealtimeConnectionState: () => PluginRealtimeConnectionState;
1610
1900
  declare const useSettings: () => PluginSettingsState;
1611
1901
  declare const useBbContext: () => BbContext;
1612
1902
  declare const useBbNavigate: () => BbNavigate;
1903
+ declare const experimental_useAppPanel: () => ExperimentalAppPanel;
1904
+ declare const experimental_useFixedTabTarget: <Target extends JsonValue>(tab: ExperimentalPluginFixedTabReference<Target>) => ExperimentalFixedTabTargetState<Target> | null;
1613
1905
  declare const useComposer: () => PluginComposerApi;
1614
1906
  declare const useComposerView: () => ComposerView;
1615
1907
  declare const experimental_useSidebarThreads: () => PluginSidebarThreadsState;
@@ -1617,5 +1909,5 @@ declare const experimental_useSidebarThreadActions: () => PluginSidebarThreadAct
1617
1909
  declare const experimental_useSidebarThreadPullRequest: (threadId: string) => PluginSidebarThreadPullRequestState;
1618
1910
  declare const experimental_useSidebarThreadSplit: (threadId: string) => PluginSidebarThreadSplit;
1619
1911
 
1620
- export { Markdown, ThreadChat, definePluginApp, experimental_NewThreadComposer, experimental_useSidebarThreadActions, experimental_useSidebarThreadPullRequest, experimental_useSidebarThreadSplit, experimental_useSidebarThreads, useBbContext, useBbNavigate, useComposer, useComposerView, useRealtime, useRealtimeConnectionState, useRpc, useSettings };
1621
- export type { BbContext, BbNavigate, ComposerCustomization, ComposerPlusMenuItem, ComposerRichTextSpec, ComposerStructuredDraft, ComposerView, JsonValue, MarkdownProps, NewThreadComposerProps, NewThreadRequest, PluginAppBuilder, PluginAppComposer, PluginAppContentScripts, PluginAppDefinition, PluginAppSetup, PluginAppSlots, PluginComposerApi, PluginComposerMention, PluginComposerScope, PluginComposerTextEffect, PluginComposerThreadRowStatus, PluginContentScriptContext, PluginContentScriptDisposer, PluginContentScriptRegistration, 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, PluginTargetedPanelActionOpenOptions, PluginThreadHeaderActionProps, PluginThreadHeaderActionRegistration, PluginThreadListProps, PluginThreadListRegistration, PluginThreadPanelActionContext, PluginThreadPanelActionRegistration, PluginThreadPanelProps, StandardSchemaV1, StandardSchemaV1InferInput, StandardSchemaV1InferOutput, StandardSchemaV1Issue, StandardSchemaV1Result, ThreadChatMessageAction, ThreadChatMessageReference, ThreadChatProps };
1912
+ export { Markdown, ThreadChat, definePluginApp, experimental_Diff, experimental_FileLink, experimental_NewThreadComposer, experimental_SourceCode, experimental_UrlLink, experimental_useAppPanel, experimental_useFixedTabTarget, experimental_useSidebarThreadActions, experimental_useSidebarThreadPullRequest, experimental_useSidebarThreadSplit, experimental_useSidebarThreads, useBbContext, useBbNavigate, useComposer, useComposerView, useRealtime, useRealtimeConnectionState, useRpc, useSettings };
1913
+ 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, 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 };