Skip to content

Add the disabled-by-default Prompt Library plugin - #4688

Merged
ymichael merged 7 commits into
mainfrom
bb/b4-prompt-library-plugin-thr_7jdzn724u2
Oct 5, 2026
Merged

ymichael merged 7 commits into
mainfrom
bb/b4-prompt-library-plugin-thr_7jdzn724u2

Conversation

@ymichael

@ymichael ymichael commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Reusable prompts had no bundled picker for searching history, previewing a full prompt, and keeping favorites. B1–B3 provide the paged history API, popup host, and composer command path; this slice supplies their Prompt Library consumer.

What changed

Adds the forkable Prompt Library plugin: Ctrl+R or + → Prompts…, fuzzy search with Thread/Project/All scopes, Markdown preview, persistent starred text and mentions, and insertion at the retained caret. Empty drafts restore history text, mentions, and attachment objects; nonempty drafts receive text and mentions. Insertion never sends a message.

Disabled by default. Enable Prompt Library in Settings → Plugins or run bb plugin enable bb--prompt-library to review it. Includes bb prompts search|list|star|unstar, typed plugin RPC, the plugin skill, CLI guide/configuration documentation, and bundled marketplace wiring. Uses B1's experimental_promptHistory.list, B2's experimental_popups registrations, and B3's composer command API; no new SDK surface or daemon wire change.

History attachment fields pass through the mapper and RPC, including unknown extension fields. The attachment schema follows main's mutually exclusive project/host ownership contract and accepts unknown sizes. Starred prompts store text and mentions only. The standalone Vitest configuration keeps forks independent of monorepo test tooling.

How you verified

  • Rebased onto origin/main at 95750b88485a882bf9ea954c1655797002f60836; preserved main's diagnostics documentation when resolving the only conflict.
  • Merged main at 1904796758 (picks up Temporarily raise workspace route bundle budgets by 5% #4933's workspace bundle budget, which fixed the Checks failure). Main's new public-marketplace test from Add built-in plugin pages to the public marketplace #4938 then required off-by-default builtins to be listed, so prompt-library is added to OFF_BY_DEFAULT_BUNDLED_PLUGINS in apps/web; the marketplace page now shows bb plugin enable bb--prompt-library. turbo run test typecheck lint --filter=@bb/web passes.
  • pnpm exec turbo run typecheck lint test --filter=bb-plugin-bb--prompt-library --concurrency=4: all 9 tasks passed, including 25 tests. Restore cases cover file/image attachments with project or host ownership and preservation of unknown extension fields.
  • env -u BB_CLI -u BB_SERVER_URL -u BB_ACCOUNT_POOL_PARENT_URL pnpm exec turbo run test --filter=@bb/server -- test/services/plugins/builtin-plugins.test.ts: all 28 tests passed.
  • node scripts/check-plugin-forks.mjs plugins/prompt-library --concurrency=1: independent install, typecheck, tests, and plugin build passed.
  • Earlier UI verification passed in desktop Chromium, 390px coarse-pointer Chromium, and iPhone 16 / iOS 18.4 Simulator Safari: preview, Back, insertion without sending, and starring. Rebase changes are limited to documentation resolution and attachment compatibility.
  • SDK generation dependencies remain explicit in Turbo, preserving the clean-CI fix.
  • Product path on the merged head (pnpm start:worktree, headless Chromium → server → daemon → real providers): Ctrl+R in follow-up and new-thread composers; Thread/Project/All and Project/All scopes with per-composer persistence across reload; fuzzy search; Cmd+S star/unstar and Star current draft; insertion at the caret without sending; empty-composer restore of an image; starred insert dropping attachments. Attachment ownership from Make prompt attachments portable across projects and machines #4685 was sent through real providers: a project A image restored into a project B new thread was copied byte-identically and described correctly, and an API-seeded absolute-path file restored with its hostId was read by the provider. Unknown sizes stay 0, which the SDK documents as unknown; the file chip shows no size. Not re-run on this head: compact drawer / iOS Simulator (earlier pass above), host-mismatch rejection (single machine).
  • Mention round-trip on the same server: workspace-file, cross-project thread and Agent Annotations plugin mentions keep identical resources (plugin itemId included) through empty, at-caret and starred recall. Re-sent prompts store the same resources at shifted offsets, and real providers resolved each target.
  • Known core race, not changed here: if Ctrl+R arrives within ~16 ms of an arrow-key caret move, ProseMirror has not yet synced the selection, so the prompt is inserted at the previous caret. It was reproduced only at automation speed and nothing is sent. The fix belongs in core's composer popup/selection handling.

Reviewer checklist (run CLI commands against the worktree instance):

  1. Confirm Prompt Library is initially disabled, then enable it through Settings → Plugins or bb plugin enable bb--prompt-library.
  2. Run bb prompts star 'Review the release notes before merging' --json, then bb prompts search 'rls nts' --json. Expect one fuzzy-matched starred prompt with highlighted characters.
  3. Open a new-thread composer, press Ctrl+R, and search rls nts. Expect a starred result and full preview. Select Insert: the picker closes and the draft fills without sending.
  4. With an existing draft, reopen the picker and insert a result. Expect text and mentions at the retained caret, preserving existing content. Arrow keys move selection, Tab changes scope, and Cmd/Ctrl+S toggles starring.
  5. At a compact touch width or in Simulator Safari, choose + → Prompts…. Expect the shared bottom drawer. Tap a row to preview it, use Back to return, then Insert to populate the draft and close. The app root retains neither inert nor aria-hidden in the Chromium check.

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/b3-plugin-composer-commands-thr_cdd8rwpijj branch from e2461f3 to 31d6385 Compare October 2, 2026 05:38
@ymichael
ymichael force-pushed the bb/b4-prompt-library-plugin-thr_7jdzn724u2 branch from 50e0ba0 to fd08b52 Compare October 2, 2026 05:46
Base automatically changed from bb/b3-plugin-composer-commands-thr_cdd8rwpijj to main October 2, 2026 17:36
@ymichael
ymichael force-pushed the bb/b4-prompt-library-plugin-thr_7jdzn724u2 branch from fd08b52 to 5bc7b95 Compare October 2, 2026 19:01
@ymichael
ymichael force-pushed the bb/b4-prompt-library-plugin-thr_7jdzn724u2 branch from a6e583f to efcf3c8 Compare October 5, 2026 19:28
ymichael and others added 2 commits October 5, 2026 15:46
…rketplace

The public marketplace test added in #4938 requires every disabled-by-default
builtin plugin to appear in OFF_BY_DEFAULT_BUNDLED_PLUGINS so its page shows
`bb plugin enable` instead of "included".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 3c4d610 into main Oct 5, 2026
60 of 61 checks passed
@ymichael
ymichael deleted the bb/b4-prompt-library-plugin-thr_7jdzn724u2 branch October 5, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant