Skip to content

Make the chat-surface built-in plugins forkable - #4189

Merged
SawyerHood merged 1 commit into
bb/forkable-06-monaco-editorfrom
bb/forkable-08-chat-surfaces
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-06-monaco-editorfrom
bb/forkable-08-chat-surfaces

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Seventh PR in the forkable built-ins stack; it builds on #4184. Five chat-surface built-ins couldn't be copied out of the repository:

  • side-chat
  • inline-vis
  • agent-annotations
  • scheduled-send
  • browser-automation

They imported @bb/shared-ui by package name and used vitest.shared.ts. Their tests loaded SDK harness peers they didn't declare.

What changed

  • Imports and config: UI through the registry alias, with thread-list's tsconfig paths. Test configs use defineConfig with tsconfig paths. Each plugin declares its test peers, and gets a lint script and turbo entries that depend on the SDK build.
  • browser-automation:
    • Its tsconfig no longer maps the SDK onto its bundled .d.ts files, which vitest would load as the SDK at runtime. The package's types condition already points tsc there.
    • Its process test and smoke scripts no longer pass --conditions=source, which pointed at SDK source the published package doesn't ship.
  • Lint:
    • scheduled-send's code comments are removed.
    • In agent-annotations, a test component that called a hook anonymously now has a name.
    • agent-annotations' submit subscription deliberately depends on composer.experimental_onSubmitted rather than on composer, which changes on every keystroke. The linter directive marks that.

How you verified

  • pnpm exec turbo run typecheck test lint for the five plugins.
  • pnpm check:plugin-forks: all five pass in a copy.
  • @bb/app typecheck, and @bb/plugin-api-map and @bb/scripts tests.
  • Bundle identity: app.js differs from the base only in module order, names, and the plugin's own icon. The icon now comes from the registry flavor (experimental_Icon), which the host binds to the same shared-ui Icon. scheduled-send's app.js is byte-identical. browser-automation's host bundle now includes the SDK's experimental_defineHostEntry instead of plugin-build's fallback stub; both are the same code.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 17:22
@SawyerHood
SawyerHood force-pushed the bb/forkable-08-chat-surfaces branch 2 times, most recently from 5722563 to aa7166b Compare September 23, 2026 17:53
@SawyerHood
SawyerHood force-pushed the bb/forkable-08-chat-surfaces branch from aa7166b to 18c06c2 Compare September 23, 2026 20:40
Base automatically changed from bb/forkable-07-app-builder-plugin-id to bb/forkable-06-monaco-editor September 23, 2026 20:40
@SawyerHood
SawyerHood marked this pull request as ready for review September 23, 2026 21:07
@SawyerHood
SawyerHood removed this pull request from stack #4182 September 23, 2026 21:40
@SawyerHood
SawyerHood added this pull request to stack #4220 September 23, 2026 21:41
side-chat, inline-vis, agent-annotations, scheduled-send, and
browser-automation imported shared-ui components by their workspace
package name, which a copy cannot install. They now import them through
the registry alias (`@/components/ui/*`, `@/lib/utils`) with
thread-list's tsconfig mapping, and their vitest configs use
defineConfig with tsconfig paths instead of vitest.shared.ts. Each
declares the SDK test harness's optional peers its tests load, and gets
a lint script and turbo entries that depend on the SDK build.

browser-automation's tsconfig mapped the SDK onto its bundled types,
where the package's `types` condition already points. Vitest follows
tsconfig paths, so it resolved the SDK to declaration files; the mapping
is gone. Its host bundle now includes the SDK's host entry rather than
the build's fallback stub, as it does for every plugin without the
mapping and for a copy; experimental_defineHostEntry is the same code.
Its process test and smoke scripts ran tsx with `--conditions=source`,
which points the SDK at source files the published package does not
ship; they now load the built SDK.

Linting surfaced scheduled-send's comments, now removed. In
agent-annotations, a test component called a hook anonymously and now
has a name; the submit subscription depends on
`composer.experimental_onSubmitted` rather than `composer`, which
changes with every keystroke, and is marked for the linter.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-08-chat-surfaces branch from 18c06c2 to 30a9ac3 Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit dfd5e1f into main Sep 23, 2026
23 of 34 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-08-chat-surfaces branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

Eighth PR in the forkable built-ins stack; it builds on #4189. Five
built-ins that contribute Settings sections couldn't be copied out of
the repository: keep-awake, concurrency-limit, memory, provider-usage,
and account-pool.

Beyond the shared-ui imports and `vitest.shared.ts`:

- **SDK paths in tsconfig.** keep-awake, concurrency-limit, and
account-pool mapped `@get-bb/plugin-sdk` onto its bundled `.d.ts` files,
which vitest loads as the SDK once it follows tsconfig paths.
- **App imports.** provider-usage imported
`@bb/shared-ui/lib/usage-format`, which only it used. Its story imported
the app's Ladle story card and read logo files from other plugins.
- **Tests outside the repository:** account-pool's tests read
`BB_ACCOUNT_POOL_PARENT_URL`/`_TOKEN` from the shell, which turbo strips
but a copy's `npm test` doesn't. They also ran `tsx` without declaring
it.

## What changed

- **Registry and config:**
- UI imports go through the registry alias, with thread-list's tsconfig
paths, and the SDK path entries are gone.
- Tests use `defineConfig` with tsconfig paths, and each plugin declares
its test peers.
  - Each plugin gets a lint script and turbo entries.
- **provider-usage:**
- `usage-format.ts` moves into the plugin, and its shared-ui export is
deleted.
- Its story is self-contained: it lays out its own rows and inlines the
two provider logos.
- `apps/app/.ladle` applies the forkable-plugin path mapping, so Ladle
resolves the plugin's `@/` imports the way the app's vitest config does.
- **account-pool tests:** they unset the parent-pool variables and
declare `tsx`.

## How you verified

- `pnpm exec turbo run typecheck test lint` for the five plugins.
- `pnpm check:plugin-forks`: all five pass in a copy. This run had the
pool env vars set, which is what surfaced the test-environment leak.
- `@bb/app` and `@bb/server` typecheck; `@bb/scripts`,
`@bb/plugin-api-map`, and `@bb/shared-ui`; `prepare:bundled` for the
five.
- The Ladle stories render (headless Chromium, no console errors).
- **Bundle identity:** keep-awake, concurrency-limit, and memory ship
byte-identical `app.js`, `app.css`, and `host.js`. provider-usage's and
account-pool's `app.js` differ from the base only in module paths and
the registry icon (the same host component).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> 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