Skip to content

Add built-in provider usage disclosure - #3100

Merged
ymichael merged 3 commits into
mainfrom
bb/builtin-provider-usage
Sep 5, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/builtin-provider-usage

Conversation

@ymichael

@ymichael ymichael commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb exposes provider rate-limit data through the CLI and Plugin SDK, but people could not see it at a glance in the app. The new sidebar-footer disclosure surface had no built-in consumer, so checking provider capacity still required leaving the sidebar workflow.

What changed

Added a built-in Provider Usage plugin that uses app.experimental_sidebarFooter.register(...) to show provider limits in a compact sidebar disclosure. It preserves provider ordering and real icons, supports multiple enrolled machines, remembers provider selection per machine, and shows plan, reset, unavailable, warning, and critical states.

The plugin loads fresh data when opened, reconciles after meaningful focus or visibility changes, performs a low-frequency safety refresh only while the app is visible, and invalidates the affected machine's cached data after thread completion. It consumes the existing bb.sdk.system.usageLimits() contract; there are no server/daemon wire changes or HOST_DAEMON_PROTOCOL_VERSION change. The plugin is bundled and auto-installed, but disabled by default on fresh databases. Existing users can enable it from Plugins settings. The existing bb settings usage --json and Plugin SDK surfaces remain the agent-accessible equivalents.

How you verified

  • pnpm exec turbo run typecheck test --filter=bb-plugin-provider-usage --force — 3 test files and 4 tests passed.
  • pnpm exec turbo run test --filter=@bb/server --force -- --run test/services/plugins/builtin-plugins.test.ts — 31 tests passed, including a fresh-database assertion that Provider Usage starts disabled.
  • pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/plugin-api-map --filter=bb-app --force — all tasks passed.
  • pnpm exec turbo run test --filter=@bb/plugin-api-map --force — 10 files and 72 tests passed.
  • pnpm exec turbo run test --filter=@bb/app --force -- --run src/components/plugin/management/UpdatePluginDialog.test.tsx — 7 tests passed.
  • env -u BB_CLI pnpm bb:dev plugin build plugins/provider-usage — app and server artifacts built against Plugin SDK 0.4.47.
  • Targeted oxfmt --check and git diff --check passed.

Fixes: no linked issue.

AGENT GENERATED

@ymichael
ymichael merged commit 43db06d into main Sep 5, 2026
16 checks passed
@ymichael
ymichael deleted the bb/builtin-provider-usage branch September 5, 2026 00:37
ymichael added a commit that referenced this pull request Sep 5, 2026
## Human comments

## What was wrong

Provider Usage displayed quota for a machine's direct provider login
without identifying which account supplied those limits. Users with
multiple provider accounts therefore could not tell which account the
card described. This is the narrow account-identity prototype requested
after #3100; Account Pool-aware effective-source reporting remains out
of scope.

## What changed

- Preserve the existing `accountEmail` field through the Provider Usage
plugin's normalization and RPC schema.
- Show the provider name with a subtle, truncated account email beneath
it and the plan pill at the right.
- Keep the full email available through the element title and omit the
row when no account email exists.
- Update backend, schema, and frontend fixtures for the explicit account
contract.

## How you verified

- `pnpm exec turbo run test typecheck --filter=bb-plugin-provider-usage
--force` (4/4 tests and typecheck passed)
- `bb plugin build plugins/provider-usage`
- Targeted `oxfmt --check`
- `git diff --check origin/main...HEAD`
- The fixer rebuilt/reloaded the plugin and captured matching
before/after UI evidence before handoff.

> AGENT GENERATED
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