@get-bb/plugin-sdk 0.6.79 → 0.6.89

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
@@ -20,11 +20,15 @@ layout, run and submit state, writes, effects, and input locking. Selection is
20
20
  reactive and is `null` for composers without pickers. Panels and pages that
21
21
  write into a composer the user picks use `useComposers()`, one handle per
22
22
  composer on screen.
23
- Any mounted plugin component can use
24
- `useBbNavigate().openThreadPanel(...)` to request one of the
25
- same plugin's registered panel actions: `experimental_tab` with thread context and action availability in a thread,
26
- `experimental_newThreadPanelAction` on the New thread screen. It returns false
27
- on plugin pages, which have no panel actions.
23
+ Any mounted plugin component can call `experimental_useAppPanel()` for the
24
+ side panel of the surface it renders in (a thread view, a plugin page, or the
25
+ New thread screen). `openTab({ tab, target?, params?, title? })` selects one of
26
+ the plugin's registered `experimental_tab` tabs; on the New thread screen a
27
+ thread-context action tab resolves against `experimental_newThreadPanelAction`
28
+ with the same id. `toggleTab(options)` closes the panel when that tab is
29
+ showing and otherwise opens it, and `close()` closes the panel. Commands,
30
+ thread actions, message actions and panel actions receive the same controller
31
+ as `experimental_panel`.
28
32
 
29
33
  Use `UrlLink` for a real anchor that applies BB's current
30
34
  in-app/external-browser preference on ordinary HTTP(S) activation, or
@@ -45,9 +49,13 @@ and ill-formed Unicode—have no active href and cannot record a preview in the
45
49
  frontend harness. Buttons and menus can call
46
50
  `experimental_openFilePreview({ target, location })` or
47
51
  `experimental_openFileExternally({ target, location })`; both return whether
48
- the current host accepted the intent. Targets never infer an ambient workspace.
49
- The frontend harness records both methods and accepts `openFilePreview` and
50
- `openFileExternally` behavior options.
52
+ the current host accepted the intent. The
53
+ `experimental_useCanOpenFileExternally(target)` hook reports whether the
54
+ external open can succeed now (false while loading) and re-renders the
55
+ component when that changes; use it to disable an Open externally control.
56
+ Targets never infer an ambient workspace.
57
+ The frontend harness records both methods and accepts `openFilePreview`,
58
+ `openFileExternally`, and `canOpenFileExternally` behavior options.
51
59
 
52
60
  To show a terminal beside your UI, create it with `useSdk().terminals.create`
53
61
  in the thread, environment, or host directory you want, then call
@@ -56,24 +64,19 @@ whether the current surface selected the terminal's tab; thread surfaces accept
56
64
  only their own thread's terminals. The harness records the call and accepts an
57
65
  `openTerminal` behavior option.
58
66
 
59
- A nav panel's `fixedTabs` entries must include the containing nav
60
- panel's `id` as `panelId`; each entry is also a stable reference to that
61
- plugin's own tab. Give a targeted tab an `experimental_target.validate` type guard, call
62
- `experimental_useAppPanel().openFixedTab({ surface: { kind:
63
- "current" }, tab, target })`, and read the in-memory state inside the tab with
64
- `experimental_useFixedTabTarget(tab)`. The target survives tab, panel, and
67
+ Give a fixed tab (thread or nav-panel) an `experimental_target.validate` type
68
+ guard, call `experimental_useAppPanel().openTab({ tab, target })`, and read the
69
+ in-memory state inside the tab with `experimental_useFixedTabTarget(tab)`. The target survives tab, panel, and
65
70
  route remounts for the current app session; call `clear()` when the tab returns
66
71
  to its untargeted state. The host validates JSON before the owner's type guard,
67
72
  persists only selection, and returns false for an unavailable tab or invalid
68
- target. The frontend harness records accepted requests in
69
- `experimental_fixedTabOpenCalls`, accepts an `experimental_openFixedTab`
70
- behavior, and can seed `experimental_fixedTabTarget` state.
71
-
72
- Every panel-open entry point reports the same way: `openThreadPanel` and the
73
- `openPanel` handed to `experimental_tab` with thread context and action availability, `experimental_newThreadPanelAction`,
74
- and `messageAction` `run` callbacks all return `boolean` — true when the host
75
- accepted the open, false when it declined (non-JSON `params`, an unavailable
76
- action id, or a surface with no side panel). A decline is a return value, never
73
+ target. The frontend harness records every controller call in
74
+ `experimental_panelCalls`, accepts an `experimental_panel` behavior, and can
75
+ seed `experimental_fixedTabTarget` state.
76
+
77
+ Every controller call reports the same way: `true` when the host accepted it,
78
+ `false` when it declined (non-JSON `target` or `params`, a tab the plugin did
79
+ not register for the surface, or a surface with no side panel). A decline is a return value, never
77
80
  a thrown error, so a plugin registering several kinds of action can share one
78
81
  open routine and branch on the result.
79
82