Skip to content

Resolve plugin-declared icons wherever a BB icon name is accepted - #3861

Merged
ymichael merged 10 commits into
mainfrom
bb/3204-plugin-declared-icons-cannot-be-used-for-si-thr_j3bafmianm
Sep 17, 2026
Merged

ymichael merged 10 commits into
mainfrom
bb/3204-plugin-declared-icons-cannot-be-used-for-si-thr_j3bafmianm

Conversation

@ymichael

@ymichael ymichael commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb had two icon vocabularies that shared one spelling, so "<pluginId>/<name>" meant different things in different fields and nothing about the name said which.

#3204 was filed 2026-09-07, between those two, and was accurate when written: app icon fields really were limited to BB's built-in names, so a plugin could not paint its own artwork on a sidebar thread row. #3513 fixed that general problem four days later — in its own words, "Plugin app icons were effectively limited to BB's built-in names" — but never referenced #3204, and documented the new registry only as something experimental_Icon renders. So the issue stayed open, the docs still read as if the stock set were the only option, and the half of the complaint that was still true (declared icons don't work there) stayed true.

What changed

Behavior. Icon (packages/shared-ui/src/components/ui/icon.tsx) now resolves a registration, then a built-in, then a manifest-declared glyph. A declared icon works everywhere a BB icon name is accepted — thread row statuses, sidebar footer items, composer + rows, message actions, nav panels, panel tabs and actions, mention rows — as well as in the declarations that already took one. One vocabulary, one resolution order.

Strictly additive: registrations still shadow built-ins and both still shadow a declared icon, so every name that resolved before resolves to the same artwork. Only names that previously fell back to Zap change.

  • icon-registry.ts gains a declared-icon store beside the app-icon store. The two sources keep distinct lifecycles rather than being merged, because they genuinely differ: declared icons come from the server inventory and exist even when a plugin ships no frontend bundle or is stopped; registrations are React components tied to a bundle generation.
  • plugin-frontend.ts pushes the declared map in the same pass that already populates plugin logos. That pass runs before any bundle loads, so a declared glyph never renders a frame of fallback first.
  • The five declaration sites keep their stricter ownership check — a glyph there must name the registering plugin and a declared icon, because those references persist in timeline rows and are revalidated at ingest. App surfaces resolve any declared glyph, matching the app icon registry, which has always been global across plugins.

Docs, now describing one vocabulary rather than a split: a module-local BbIconName alias carries the resolution order once, replacing ten near-identical comments that each restated it (and were the reason the contract drifted). It is deliberately unexported — app.ts re-exports app-contract wholesale, so exporting it would make a doc comment a public SDK member owing an experimental_ prefix and an api_to_audit.md entry. The guide references say when to register versus declare, and the quickstart's site list is corrected from three to five.

No wire change, so no HOST_DAEMON_PROTOCOL_VERSION bump. Plugin SDK bumped to 0.4.100, since JSDoc ships in bundled-types/*.d.ts.

How you verified

A probe plugin in a running dev app declaring one manifest icon and registering two, driving three sidebar rows through experimental_setThreadRowStatus:

icon passed Source Before After
"probe-flat" app.experimental_icons.register() plugin artwork plugin artwork
"icon-probe/registered" app.experimental_icons.register() plugin artwork plugin artwork
"icon-probe/declared" bb.branding.experimental_icons generic Zap plugin's SVG

Tests: the declared-glyph tier resolves, a registration of the same name shadows it, removing the registration restores it, and an undeclared namespaced glyph still falls back. Plus a ThreadRow test that a registered namespaced name draws the plugin's artwork — mutation-checked by stubbing the status-icon pass-through, which fails it along with the four existing plugin-status tests.

  • pnpm exec turbo run typecheck lint --filter='...[origin/main]' — 101 tasks, clean. The filter earned its keep: editing icon.tsx staled the checked-in @bb/plugin-registry mirror, regenerated with build-registry.mjs.
  • @bb/app 4811 passed, @get-bb/plugin-sdk 291 passed, @bb/server 2913 passed with one unrelated failure (project-attachment-accounting, a timing bound) that passes in isolation.

Fixes #3204

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 4 commits September 17, 2026 11:12
Issue #3204 reports that `experimental_setThreadRowStatus.icon` "cannot draw
a plugin's own declared icon". Probing it in a running app shows the surface
already can: `Icon` checks the `app.experimental_icons.register()` registry
before built-ins, so any name a plugin registers — flat or namespaced —
paints that plugin's artwork on every host icon surface, thread row statuses
included. What fails is only the manifest's `bb.branding.experimental_icons`
vocabulary, which shares the `"<pluginId>/<name>"` spelling but is a separate
server-resolved registry that just three declaration sites accept.

The defect is documentation. Every icon field said "BB icon name" or "icon
hint" and named no way to supply plugin-owned artwork, and the Plugin Guide
said registered names render "with experimental_Icon" while the declared-icon
entry enumerated three sites without saying what app surfaces take instead.
Read together they imply the stock icon set is the only option, which is what
the issue concluded.

Restate the eleven icon fields across the app and backend contracts, give
`ExperimentalIconRegistration` the canonical explanation of the registry's
reach and its split from the manifest map, and cross-reference the two
vocabularies in the quickstart and frontend-components references. No
behavior changes.

Covered by a ThreadRow test that renders a registered namespaced name as the
plugin's artwork and an unregistered one as the Zap fallback; it fails when
the row stops passing the status icon through.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The previous commit restated the same four-line explanation on every icon
field, which is the shape that let the contract drift out of date in the
first place: the next icon field added would have been described by whichever
neighbour got copied.

Name the concept instead. `BbIconName` is a module-local alias for `string`,
so it documents without narrowing, and each field keeps only what is specific
to its surface — that panel actions and plus-menu rows prefer the plugin's
logo, that thread row statuses do not.

Deliberately not exported: `app.ts` re-exports app-contract wholesale, so an
exported alias would be a new public `@get-bb/plugin-sdk/app` member and would
owe an `experimental_` prefix and an api_to_audit entry (AGENTS.md) for what
is really a doc comment with a name. Unexported, it still rides into
bundled-types/bb-plugin-sdk-app.d.ts with its JSDoc, which is where plugin
authors read it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The quickstart listed a bridge row, a tool presentation and
`bb.providers.register`, and the previous commit added "Those are the only
sites that resolve a declared glyph" next to that list. The list was two
short: `bb.experimental_environments.register` (concrete and composed) and
`bb.experimental_machines.register` also take a namespaced glyph and enforce
ownership, and their SDK declarations have always said so
(environment-provider.ts, machine-provider.ts).

All five funnel through `undeclaredIconProblem` in host-policy.ts, which is
the single rule; say that rather than re-deriving a count that drifts.

This list is the one the reporter of #3204 quoted to conclude thread row
statuses were excluded from something. Leaving it incomplete while adding an
"only" in front of it would have made it more authoritative and no more
correct.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The doc comments on app-contract.ts and backend-contract.ts are published
content: they ride into bundled-types/*.d.ts, which is what a plugin author
reads. 0.4.99 has been published to npm since this branch started, and a
published version is never republished, so without a bump these changes would
never reach npm consumers.

Both guards agree and both are now satisfied: check-plugin-sdk-version.mjs
(surface file touched without touching plugin-sdk-version.ts) and
check-npm-version-guard.mjs (packed content differs from the published
version).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ymichael
ymichael force-pushed the bb/3204-plugin-declared-icons-cannot-be-used-for-si-thr_j3bafmianm branch from f9d8299 to 3a875ef Compare September 17, 2026 18:13
ymichael and others added 4 commits September 17, 2026 11:23
The two additions restated things the surrounding prose already establishes
and spelled out surface lists twice. Same facts, ~30% fewer lines: the
quickstart no longer re-enumerates the app surfaces it already points at
frontend-components.md for, and frontend-components.md drops the parenthetical
repetition of which surfaces are plugin-badged.

Unchanged: that a registration beats a built-in, that the plugin-badged
surfaces prefer the plugin's own branding icon while thread row statuses do
not, that the manifest map is a separate vocabulary, and the corrected list of
all five sites that resolve a declared glyph.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
These fields said they are drawn "when the plugin ships no logo" and that the
surfaces "prefer the plugin's logo". PluginIcon never reads a logo. Its
precedence is compactIconUrl, then branding.icon, then the contribution's hint,
then Zap — and both of the first two come from the same manifest field,
`bb.branding.icon` (a `./file.svg` becomes compactIconPath, a bare name stays a
glyph). `logoUrl`/`logoDarkUrl` are in the store but PluginIcon ignores them;
logos are for roomy Settings rows.

The consequence a plugin author needs is sharper than "prefer" suggests: a
manifest that declares `bb.branding.icon` — most of them — makes these `icon`
fields dead, because the branding icon always wins. Only a plugin whose
manifest carries a logo and no icon ever sees its own hint drawn here.

Two of the five were pre-existing wording carried forward; the other three were
mine, paraphrasing the inherited claim into something more confident than the
original. Same error either way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The quickstart already tells a manifest author that app icon fields take a BB
icon name and that the two share a spelling but not a registry, and the
BbIconName alias says it for anyone reading the types. Repeating it here told
a reader who had already found `app.experimental_icons.register()` what the
other thing is not.

Leaves frontend-components.md with the one fact it owns: a registration is a
BB icon name at every host icon field, and which surfaces override it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
bb had two icon vocabularies sharing one spelling. `"<pluginId>/<name>"`
resolved at five server-side declaration sites but silently became `Zap` at
every app surface, while `app.experimental_icons.register()` names resolved at
app surfaces and nowhere else. Which registry a name landed in depended on
which field it was written into, and nothing about the name said which. That
is what #3204 hit, and documenting it only made the split easier to describe.

Make it one vocabulary. `Icon` now resolves a registration, then a built-in,
then a manifest-declared glyph, so a declared icon works everywhere a BB icon
name is accepted — thread row statuses, sidebar footer items, composer `+`
rows, message actions, nav panels, panel tabs and actions, mention rows — as
well as in the declarations that already took one.

Strictly additive: registrations still shadow built-ins, and both still
shadow a declared icon, so every name that resolved before resolves to the
same artwork. Only names that previously fell back to `Zap` change.

The two sources keep distinct lifecycles rather than being merged into one
store, because they genuinely differ: declared icons come from the server
inventory and exist even when a plugin ships no frontend bundle or is
stopped; registrations are React components tied to a bundle generation.
`plugin-frontend.ts` pushes the declared map in the same pass that already
populates plugin logos, which runs before any bundle loads, so a declared
glyph never renders a frame of fallback first.

The declaration sites keep their stricter ownership check: a glyph there must
name the registering plugin and a declared icon, because those references
persist in timeline rows and are revalidated at ingest. App surfaces resolve
any declared glyph, matching the app icon registry, which has always been
global across plugins.

Verified in a running app with a probe plugin: a manifest-declared glyph that
drew `Zap` on a sidebar thread row before now draws the plugin's own SVG,
while flat and namespaced registrations are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ymichael ymichael changed the title Document that plugin app-icon registrations are BB icon names everywhere Resolve plugin-declared icons wherever a BB icon name is accepted Sep 17, 2026
ymichael and others added 2 commits September 17, 2026 12:25
frontend-components.md listed the seven surfaces that "everywhere one is
accepted" already covers, and carried a sentence about `bb.branding.icon`
precedence that belongs on the fields it governs, where it now lives.

quickstart.md named `undeclaredIconProblem`, an internal helper no plugin
author calls, and enumerated three register() entry points to correct a list
that had named one. "A provider declaration" covers all three and cannot go
stale the way an enumeration does — the same failure that put the wrong count
there to begin with.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The same bullet already states it four sentences later, and states it better:
it names the ingest case and the `server: "bb"` nuance that a tool row is
checked against the plugin that registered the tool. Mine restated the weaker
half above it.

The quickstart edit is now the one thing that changed: a declared glyph
resolves anywhere a BB icon name is accepted, not only in the declarations
that enforce ownership.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ymichael
ymichael merged commit 370a048 into main Sep 17, 2026
16 checks passed
@ymichael
ymichael deleted the bb/3204-plugin-declared-icons-cannot-be-used-for-si-thr_j3bafmianm branch September 17, 2026 19:37
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.

Plugin-declared icons cannot be used for sidebar thread row marks (experimental_setThreadRowStatus.icon takes host glyph names only)

1 participant