Repository navigation
Conversation
ymichael
force-pushed
the
bb/c1-portable-prompt-attachments-with-honest-sizes-thr_9sh9gamm7y
branch
from
October 2, 2026 17:44
4e88373 to
02d4005
Compare
ymichael
force-pushed
the
bb/c1-portable-prompt-attachments-with-honest-sizes-thr_9sh9gamm7y
branch
3 times, most recently
from
October 2, 2026 23:37
f0316db to
43ddbda
Compare
2 tasks done
Prompt history now reports the machine of the thread that sent an absolute file path as experimental_hostId, mirroring experimental_sourceProjectId for uploads. Drafts preserve it, and core rejects a create, send, or queued message whose target thread runs on another machine, then strips the field before persisting, so stored and dispatched input is unchanged. ComposerAttachment is now a union that carries at most one of the two fields, and drafts, snapshots, and replacements share that exact shape. Copying an upload across projects keeps its original name and MIME type. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rename experimental_sourceProjectId and experimental_hostId on prompt inputs, uploads, drafts and ComposerAttachment to sourceProjectId and hostId, and remove their API audit entry now that they are stable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Plugins had to fill the formerly required ComposerAttachment.sizeBytes and commonly wrote 0 for an unknown size. Main dropped that 0 when converting a draft to prompt input; the portable-attachments change forwarded it, so the daemon's staging size check failed the turn. Drop 0 again: an exact empty size verifies nothing, and stored drafts already read 0 as unknown. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/c1-portable-prompt-attachments-with-honest-sizes-thr_9sh9gamm7y
branch
from
October 5, 2026 18:20
29c9d69 to
a54e7b7
Compare
ymichael
deleted the
bb/c1-portable-prompt-attachments-with-honest-sizes-thr_9sh9gamm7y
branch
October 5, 2026 18:44
This was referenced Oct 5, 2026
ymichael
added a commit
that referenced
this pull request
Oct 5, 2026
## 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 #4933's workspace bundle budget, which fixed the `Checks` failure). Main's new public-marketplace test from #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 #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 --------- Co-authored-by: Claude Opus 5.5 <[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
What was wrong
Prompt history and drafts represented uploaded files with project-relative paths, which become ambiguous when reused in another project. Absolute file paths likewise carried no record of which machine they live on. Adapters used zero for unknown sizes.
What changed
sourceProjectId: uploads and prompt history set it, drafts and previews preserve it, and core validates the source and copies the file into the destination project before accepting a create, send, or queued message, then strips the field before persisting. The destination copy survives deletion of the source project.hostIdthe same way: prompt history reports the machine of the thread that sent them, drafts preserve it, and core rejects a message whose target thread runs on another machine, then strips the field. Stored and dispatched input is unchanged, so the daemon protocol is unchanged.ComposerAttachmentis a union with at most one of the two fields; drafts, snapshots, and replacements share that shape, so returning a snapshot with new text type-checks and keeps every attachment.sizeBytesis optional: absent means unknown. A zero size in a draft is treated as unknown, both when a stored draft is read and when a draft is sent, so plugins that wrote0as a placeholder (the field used to be required) keep working instead of failing the daemon's staging size check.experimental_prefix. Updated the Plugin Guide.sourceProjectIdand needs a follow-up.This replaces the attachment-ID version of this PR. Identifying uploads by project + path needs no second identity system, so the ID routes, SDK methods, CLI syntax, dual-format history, internal type split, and client-side legacy lookup are gone. The PR goes from +3,185/−804 to +713/−107.
How you verified
Latest rebase onto
origin/main(2026-10-05): resolved the SDK version conflict by bumping both version declarations to 0.6.19. Typecheck/lint passed (132/132 Turbo tasks); focused server attachment/history/accounting tests passed (35 tests), and client-core, Plugin SDK, server-contract, and host-daemon-contract suites passed (787 tests).pnpm exec turbo run typecheck lint --filter='...[origin/main]': 131/131 tasks pass, no new lint warnings.pnpm exec turbo run test --filter='...[origin/main]': the contract allowlist failures caused by the new field were fixed; every other failure was in an untouched suite and passed when rerun in isolation.hostId, a thread on another machine rejects it, and a thread on the same machine stores the input without the field; host binding accepts a matching machine and rejects a mismatch or a machine on an uploaded path; a cross-project copy keeps the uploaded name and image type.