Repository navigation
Let plugins add rows to the quick palette - #2270
Merged
andrewkchan merged 3 commits intoAug 22, 2026
Merged
andrewkchan merged 3 commits into
andrewkchan merged 3 commits into
Conversation
Declare the slot, validate it at the collector boundary, carry it through the
client slot store, and document it in the authoring skill. Four members: `id`,
`title`, optional `isAvailable`, and `run`, both callbacks receiving
`{ threadId, projectId, openPanel }`.
Host-rendered chrome with no plugin component, the same shape as
`messageAction` and `sidebarFooterAction`: the plugin supplies a title and
behavior, and the host keeps matching, ordering, and recency. No icon,
description, or keywords -- every public member is surface area we maintain
forever, and a self-identifying title is what the palette matches on.
The skill lands here rather than with the later docs because
`plugin-authoring-docs.test.ts` asserts every slot and every prop field is
documented from the moment the slot exists, and its compile-time guards reject
a `PluginAppSlots` method with no entry.
`PluginRegistrationSet.commandPaletteActions` is optional so a frontend bundle
built against an older SDK, which never calls this slot, still satisfies the
set.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`openPanel` is backed by a React context provided inside ThreadDetailView, so it reaches the timeline and its message actions but nothing mounted outside that subtree. The quick palette is mounted by AppLayout beside the routes and can never read it, yet opening a plugin's panel in the thread on screen is the main thing a plugin palette row wants to do. Publish the opener to a module-level store the palette can read. Only the focused pane publishes: a split mounts one thread view per pane, each with its own panel tabs, so "the thread side panel" otherwise has no single meaning. A lone thread view counts as focused. With nothing focused the store reports null and the palette declines the open rather than pretending. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Read the slot snapshot when the palette opens, beside the app commands, and group the rows under "Plugins". `isAvailable` and `run` are plugin code running in host chrome, so both are contained: a row whose `isAvailable` throws is treated as unavailable rather than taking the palette down, and `run` failures are logged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
andrewkchan
force-pushed
the
bb/plugin-palette-actions-thr_6uabvx9wey
branch
from
August 22, 2026 00:55
4fc47bc to
b414786
Compare
andrewkchan
added a commit
that referenced
this pull request
Aug 22, 2026
now it should be impossible to accidentally change plugin API without bumping the SDK version we can delete this if later we decide actually want to iterate faster without bumping sdk version ## What was wrong #2270 added `app.slots.commandPaletteAction` — a public plugin API member — without moving `PLUGIN_SDK_VERSION`. Pre-1.0 the major is the compatibility number and never moves for additive work, so the patch is the only thing a plugin author can point `engines.bbPluginSdk` at: `isPluginSdkRangeSatisfied` reads that range as a floor within the major. Without a bump, a plugin using the new slot has no version to require, so installing it on an older bb fails at runtime instead of legibly at load. Nothing caught it. `version.test.ts` only asserts that `packages/plugin-sdk/package.json` and `PLUGIN_SDK_VERSION` agree with *each other*, never that a surface change moved either. And unlike the backend, rpc, and host contracts — each of which has an enumerated export list in `public-types.test.ts` that a new export forces you to edit — `app-contract.ts` has no such list, so nothing about the change was visible in review either. The recent history shows the convention is real: 0.4.9→0.4.10 (plugin styles), 0.4.10→0.4.11 (provider v3), 0.4.11→0.4.12 (`experimental_fullFileContents`), 0.4.12→0.4.13 (quick palette). #2270 is the break in that run, alongside `3f86b7c80` (#1469), which added 68 lines to `app-contract.ts` with no bump. ## What changed - **`packages/domain/src/plugin-sdk-version.ts`, `packages/plugin-sdk/package.json`** — 0.4.13 → 0.4.14, keeping the two in the lockstep `version.test.ts` checks. - **`.github/workflows/check-plugin-sdk-version.mjs`** — diffs the branch against its merge base and fails when it touches a published contract or entry file (`app-contract`, `backend-contract`, `host-contract`, `rpc-contract`, `provider-bridge`, and the `index`/`app`/`host` entries) without touching the version file. The message names the offending paths and what to do. An unresolvable base skips rather than failing on something the author cannot act on. - **`.github/workflows/version-lockstep.yml`** — runs it as a second job. It needs `fetch-depth: 0` for the merge base, so it is a separate job rather than a step on the existing shallow-clone one. The check is a workflow script rather than a vitest test because the signal is a diff against a base commit, which a unit test has no access to. It follows the existing `check-version-lockstep.mjs` pattern. ## How you verified Ran the script against three real branch states: - this branch (version bumped, no contract change) → "Plugin SDK surface unchanged", exit 0 - a scratch branch off `main` touching `app-contract.ts` with no bump → fails, naming the file — i.e. it reproduces exactly the miss in #2270 - the same branch with the bump added → passes Also confirmed no stale pins: `plugins/*/dist/*.meta.json` carry `0.4.13` but are untracked build artifacts that re-stamp on the next build, and `plugins/tasks` declares `bbPluginSdk: ">=0.4.13"`, a floor that 0.4.14 still satisfies. `@get-bb/plugin-sdk` 129 tests and `@bb/server` 1922 tests pass; typecheck clean for `@get-bb/plugin-sdk`, `@bb/domain`, and `@bb/server`; the workflow YAML parses. > AGENT GENERATED: by Claude Opus 5 --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
andrewkchan
added a commit
to andrewkchan/bb-plugin-monaco
that referenced
this pull request
Aug 22, 2026
Eight rows in BB's quick palette, through the `commandPaletteAction` slot (get-bb/bb#2270): fold level 1-5, fold recursively, sort selected lines ascending/descending, and copy the current file's path or relative path. The palette's `run` gets a thread id, a project id, and an `openPanel` -- nothing that reaches a file tab -- but the palette and every mounted fileOpener are one bundle in one browser context, so editors publish themselves to a module-level last-focused registry that the commands read back. Rows are hidden while no Monaco tab is visible. The slot postdates the SDK floor this plugin declares, so the registration is guarded: an unguarded call would throw out of definePluginApp and take the file opener down with it on an older host. `read` now returns the resolved absolute and root-relative paths, which the frontend otherwise has no way to compute -- BB hands the opener a workspace-relative path, and resolving it needs the environment lookup that only the server does. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Aug 25, 2026
andrewkchan
added a commit
that referenced
this pull request
Aug 25, 2026
## Human comments <img width="690" height="647" alt="Screenshot 2026-08-25 at 4 03 49 PM" src="https://github.com/user-attachments/assets/6cd7245c-286d-4d6a-9585-a40dd3da85c0" /> This basically upstreams https://github.com/andrewkchan/bb-plugin-monaco as a built-in plugin. - Optimized so that it gets bundled instead of lazy loaded with AMD loader, now it should add only ~6MB (the typescript language services are stripped) - One functional difference from external monaco is that hovering symbols in typescript files no longer shows diagnostics and CMD+click does not work to gotodef in the same file. This is because we're stripping the builtin monaco typescript language service. The plan is to make the language diagnostics optional (first, add back in the monaco builtins, then add an interface for custom LSPs as plugins, see #2438) ----- ## What was wrong BB's file panel is read-only. Opening a file from chat, the file search, or `bb thread open` gives a preview, so any edit means leaving BB for an editor — even for a one-line change to a file the agent just wrote. This upstreams the Monaco plugin I built out-of-tree ([andrewkchan/bb-plugin-monaco](https://github.com/andrewkchan/bb-plugin-monaco)) so the panel can edit as well as show. ## What changed **New builtin: `plugins/monaco-editor`.** A `fileOpener` that replaces the preview with [Monaco](https://microsoft.github.io/monaco-editor/) for ~86 text and code extensions: - Editing with <kbd>⌘S</kbd> saves guarded by `expectedSha256`, so a save that would clobber a concurrent write (usually the agent's) stops and offers Reload or Overwrite. - Find (<kbd>⌘F</kbd>), line numbers, syntax highlighting, and Monaco's usual editing affordances. - A file tree with path filtering, expand/collapse, reveal-the-open-file, and a right-click menu to copy absolute path / relative path / filename. - Quick-palette rows for folding, sorting selected lines, and copying the current file's path, via the `commandPaletteAction` slot from #2270. - Type and theme matched to BB's own preview (`font-mono text-xs leading-5`, `--font-mono`, light/dark). Registered `defaultEnabled: true` under `Interface`. That is the significant product change: **the file panel becomes an editor for nearly every text file by default.** Per-extension opt-out lives in Settings → File openers, and binaries fall through to BB's preview via the `Original` prop. **The plugin id is `monaco-editor`, not `monaco`.** The id derives from the package name, and `monaco` is what the external plugin this upstreams already uses. Reconcile refuses to displace a user's own install, so sharing the id would have meant anyone holding that plugin got the builtin silently skipped — nothing but a server log — until they removed theirs and restarted. Renaming sidesteps it: the two coexist, and removing the external one needs no special handling. The display name is "Monaco editor" so they are tellable apart in Settings during the transition. **Monaco is built here, not bundled into `app.js` and not copied from its prebuilt tree.** `scripts/stage-assets.mjs` runs esbuild over `monaco-bundle/editor.js` and emits `dist/monaco/{editor.js,editor.css,editor.worker.js}`; `lib/monaco-loader.ts` loads those from a `files.createPreview` URL the first time a file tab opens. Bundling into `app.js` is not an option: `bb plugin build` emits one file with no code splitting, so Monaco would parse at app boot for every user including those who never open a file, and its worker could not be emitted at all. Building it separately keeps it lazy — **`app.js` is 24 KB** — while letting esbuild prove reachability, which is what makes the trimming safe. **Size: the packaged builtin is 6.3 MB**, of which Monaco is 4.6 MB. The entry is Monaco's own `editor.main` — the API, its contribution modules, and every Monarch grammar — minus the CSS, HTML, JSON, and TypeScript *language services*, which this plugin has no use for (its checker sees only the open file, so its "cannot find module" errors would be wrong). An earlier revision of this branch shipped Monaco's whole prebuilt AMD tree at 25 MB. **A generic staging hook** (`apps/server/scripts/copy-builtin-plugins.ts`). Packaging copies only a builtin's `dist/` and `skills/`, and builds plugins itself without running per-plugin scripts — so a plugin needing runtime files on disk has nowhere to put them. `copyBuiltinPlugin` now runs `<pluginRoot>/scripts/stage-assets.mjs` when present. Optional, and this plugin is currently the only user. A source checkout never runs that path, so the plugin also builds its own bundle when it is missing or older than its sources. Also updated: `smoke-tarball.mjs`, and the two "declare metadata for every builtin" tables in the server tests (both failed before I added the entries, which is them working as intended). No other core code is touched — `plugin-service.ts` and `plugin-registration.ts` are unchanged from `main`. ## How you verified ``` pnpm exec turbo run typecheck test --filter=bb-plugin-monaco-editor # 11 tests pnpm exec turbo run test --filter=@bb/server -- builtin-plugins official-plugins # 33 tests pnpm exec turbo run test --filter=@bb/app -- useThreadFileTabs # 20 tests ``` Unit tests cover the tree logic that is easy to get subtly wrong — nesting flat paths, synthesising directories a truncated listing omitted, case-insensitive sorting, and filtering, which must expand every ancestor of a match or the match stays hidden behind a collapsed row. Another asserts every claimed extension maps to a language the built bundle actually registers; it failed on its first run, catching that `json` was absent from the trimmed bundle and `package.json` would have rendered as plain text. **The build script asserts the bundle is complete**, because trimming it is how this went wrong twice. It fails when the output lacks the find widget, folding, word navigation, line sorting, grammars, or contributions. An earlier entry (`editor.api` alone) shipped without Monaco's contribution modules: the editor opened, highlighted, and typed, so it looked correct, while <kbd>⌘F</kbd>, the option+arrow word motions, and every folding command silently did not exist. The guard reports that entry precisely. Note it checks for the find widget's own class name rather than `actions.find`, which is present with or without the widget and would have passed. Ran the real packaging path (`tsx apps/server/scripts/copy-builtin-plugins.ts`) and confirmed the shipped builtin contains `dist/monaco/{editor.js,editor.css,editor.worker.js}` beside `dist/server.js` and `dist/app.js`, totalling 6.3 MB, with Monaco absent from `app.js`. **Manual testing is in progress** in a dev desktop build. Two paths are new in the port and have never run: project-backed workspace sources (no environment, resolved through the project's `sources[]`) and the `experimental_hostId` field on `PluginFileOpenerSource` — the plugin's schema was `.strict()` and would have rejected those files outright before this branch. ## Known gaps Documented in the plugin README, with upstream issues where the fix is not ours: - No language server: no go-to-definition, find-references, or type checking. Monaco's own TypeScript service would restore single-file navigation, but it costs a 6.7 MB worker for one language, runs whether or not anyone wants it, and still cannot resolve an import. #2438 proposes making language intelligence plugin-contributed instead — a toggle for Monaco's in-browser services, and a contribution point so people can bring their own servers. Occurrence highlighting is restored here with a textual provider, which needs none of that. - The tree cannot show hidden files or `node_modules` (#2093), and is read-only — no rename/create/delete. - Opening a file from the tree reuses the tab, so its title goes stale (#2102). - No "open in editor" button; that capability is not exposed to plugins. Fixes # > AGENT GENERATED: by Claude Opus 5 --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
Now plugins can add commands to the quick palette too, through calling the
app.slots.commandPaletteActionAPI:The
idhas to be unique for a plugin. Therunmethod can take in thethreadId,projectId, and anopenPanelfunction which is similar to the one frommessageAction(it can be used to open a side panel for the plugin when you're looking at a thread).This is meant to be called in the
appentry point for a plugin insidedefinePluginAppfor it to register the quick palette actions on init.What was wrong
The quick palette lists bb's own commands and nothing else, so a plugin had no
way to offer a keyboard-reachable action. Its nearest existing options are a
sidebar footer icon, a per-message action, or a thread panel the user has to
find — none of which answer "I know what I want, let me type its name".
What changed
A new
app.slots.commandPaletteAction, host-rendered chrome with no plugincomponent, the same shape as
messageActionandsidebarFooterAction:Four members. No icon, description, or keywords: every public member is
surface area maintained forever, plugin rows already carry self-identifying
titles, and the palette matches on the title. Shipped without an
experimental_prefix — a deliberate exception to the AGENTS.md Plugin APIrule, on the grounds that this is two required fields and two callbacks over
types that already exist (
PluginTargetedPanelActionOpenOptionsis sharedwith
messageAction), so no bake period would answer anything.app-contract.ts,plugin-app-collector.ts,plugin-slots.ts— theslot, its validation at the collector boundary, and the client store entry.
PluginRegistrationSet.commandPaletteActionsis optional so a bundle builtagainst an older SDK still satisfies the set.
plugin-thread-panel-navigation.tsx,ThreadDetailView.tsx— the partworth review.
openPanelis backed by a React context provided insideThreadDetailView, so it reaches the timeline but nothing mounted outsidethat subtree; the palette is mounted by
AppLayoutbeside the routes and cannever read it. The focused thread view now also publishes its opener to a
module-level store the palette reads. Only the focused pane publishes: a
split mounts one thread view per pane, each with its own panel tabs, so "the
thread side panel" otherwise has no single meaning. A lone thread view counts
as focused. With nothing focused the store reports null and
openPaneldeclines instead of pretending.
palette-plugin-actions.ts,CommandPalette.tsx,AppLayout.tsx— readthe slot snapshot when the palette opens, group rows under "Plugins", contain
plugin failures. A row whose
isAvailablethrows is treated as unavailablerather than taking the palette down.
SKILL.md— the authoring entry, which ships in the same commit as theslot because
plugin-authoring-docs.test.tsasserts every slot and propfield is documented from the moment the slot exists, and its compile-time
guards reject a
PluginAppSlotsmethod with no entry there.docs/configuration.md— the user-facing note.Rows group under "Plugins" rather than the plugin's name: there is no
always-loaded plugin-name map on the client, and adding a query to the palette
for a group label is not worth it. Revisit if one appears.
No wire change;
HOST_DAEMON_PROTOCOL_VERSIONuntouched.How you verified
Five tests, scoped to what could break silently and is not covered elsewhere:
palette-plugin-actions.test.ts— anisAvailablethat declines or throwsdrops the row;
openPanelforwards to the focused view's opener with theplugin's id (the host's half of the lookup) and declines without one.
plugin-thread-panel-navigation.test.tsx— the focused pane's opener wins andrefocusing switches it; no focus reports null. Opening in the wrong pane
would be a silent, plausible-looking bug.
CommandPalette.test.tsx— a registered slot reaches the palette and runs.Deliberately no collector tests for duplicate ids or a non-function
run:those exercise
requireSlotId/requireUniqueId, shared validators alreadycovered by the app-harness tests for other slots.
pnpm exec turbo run typecheckclean across the workspace; lint 0 errors;@get-bb/plugin-sdk129 tests,@bb/serverand the app suite (3256) pass.Each of the three commits typechecks and passes the plugin-authoring docs
guard on its own.
Two unrelated failures seen locally, neither from this branch:
PluginIcon.test.tsxthrowsENOENTon a stray emptyplugins/monaco/directory in the local checkout (reproduces on clean
main), andPromptBoxInternal's selection-reveal test failed once under full-suiteparallelism but passes in isolation on this branch and on
main.