Repository navigation
Unify plugin icon registration and provider artwork rendering - #3513
Merged
ymichael merged 6 commits intoSep 11, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/clarify-plugin-icon-api-support-thr_pfhbgascgz
branch
from
September 11, 2026 20:30
f34bf29 to
6d7d458
Compare
ymichael
deleted the
bb/clarify-plugin-icon-api-support-thr_pfhbgascgz
branch
September 11, 2026 20:45
ymichael
added a commit
that referenced
this pull request
Sep 17, 2026
) ## 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. - **Manifest-declared icons** (`bb.branding.experimental_icons`, added 2026-08-23 in #2325 for provider and tool rows) resolved at five server-side declaration sites and silently rendered `Zap` everywhere else. - **App registrations** (`app.experimental_icons.register()`, added 2026-09-11 in #3513) resolved at app surfaces and nowhere else. #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](https://claude.com/claude-code) > AGENT GENERATED --------- 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
What was wrong
Plugin app icons were effectively limited to BB's built-in names. Several callers discarded unfamiliar names before rendering, so adding artwork did not make it usable consistently across plugin UI and timeline content. Provider artwork had a separate inconsistency: BB supported frontend provider-icon overrides, but Provider Usage and Tasks implemented their own logo rendering and ignored those overrides.
What changed
Plugin SDK APIs
app.experimental_icons.register({ name, component })classNameand can inherit color withcurrentColor.experimental_Iconfrom@get-bb/plugin-sdk/appname, with optionalfallback(defaultZap),className,style,aria-label, andaria-hidden. Uses the same registry and renderer as BB.experimental_ProviderIconfrom@get-bb/plugin-sdk/app<ProviderIcon providerKind="agent" provider={provider} />. Readsid,logoUrl,icon, andstrings.iconTintdirectly. Optional props:fallback(defaultCode),className,aria-label, andaria-hidden; marks are decorative by default. Resolves kind-specific provider override → legacy unscoped override → declared logo → declared glyph → fallback. It does not fetch metadata: pass the existing provider record, or{ id }when only frontend registrations and fallback are needed.app.slots.experimental_providerIcon({ providerKind, providerId, icon })providerKind(agent,machine, orenvironment). The new shared component makes this registration effective in plugin consumers as well as BB. Artwork receives a sizing class and inherits color from its wrapper. It can render a namedexperimental_Iconor its own inline artwork.The SDK version is bumped to
0.4.84; Provider Usage and Tasks require that version. The authoring skill API index and builder-field contract check are updated alongside the Plugin Guide.New SDK types:
ExperimentalAppIcons,ExperimentalIconRegistration,ExperimentalIconProps, andExperimentalProviderIconProps. The testing harness captures icon registrations and provides stubs for both shared components. The Plugin Guide and experimental API audit document these contracts.For example, inside a plugin's app setup:
Resolution and lifecycle
void, matching app slots. BB commits registrations with plugin setup, replaces them on reload, and removes them on unload. Mounted icons update automatically; no manual disposer is needed.Zap. Render errors are contained and recursive references terminate safely. Provider override errors fall back to declared artwork. Reload remounts artwork even when its component identity is unchanged.Consumers and contract boundaries
IconNamenow accepts strings,Iconacceptsfallback, andBuiltinIconName/isBuiltinIconNameidentify the fixed built-in set.ICON_NAMESand built-in artwork remain unchanged. Host-only registry plumbing and the vendorable icon registry artifacts are updated.iconandstrings.iconTintto its computed comment-provider RPC response. Provider Usage uses those same SDK field shapes instead of flattening them intoiconGlyph/iconTint, so both plugins pass records directly to the component. No database migration, persisted icon definitions, server/daemon wire change, or protocol-version bump is needed.How you verified