Skip to content

Make the Automations plugin forkable - #4199

Merged
SawyerHood merged 1 commit into
bb/forkable-16-interaction-formsfrom
bb/forkable-17-automations
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-16-interaction-formsfrom
bb/forkable-17-automations

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Fifteenth PR in the forkable built-ins stack; it builds on #4197. A copy of plugins/automations couldn't install. It imported:

  • fourteen @bb/shared-ui components;
  • shared-ui's automation edit-prompt builder;
  • @bb/domain's run-state presentation.

Its own @/src/rpc-types alias clashed with the registry alias, and its tsconfig mapped the SDK onto bundled .d.ts files.

The app also typechecked and tested the plugin's views by importing bb-plugin-automations/detail-view and overview-view, which pulls the plugin's @/ imports into @bb/app's type program. Two Ladle stories did the same.

What changed

  • Imports: components come through the registry alias, and the plugin's own @/ import becomes relative.
  • Moved into the plugin: the run-state labels and icons (detail-view.tsx) and the edit-prompt builder (lib/edit-prompt.ts, with its test), which only the plugin used. shared-ui drops buildAutomationEditThreadPrompt, and @bb/domain drops RUN_STATE_PRESENTATION; its only other reader was UPDATE_STATE_PRESENTATION's three icon names, now written out.
  • Config:
    • The SDK path entries are gone.
    • The tsconfig include names every root module that imports @/, because Vite applies tsconfig paths only to included files. The fork check caught this; the in-repo run did not. It also includes automations.stories.tsx, so tsc checks the story.
    • Tests use defineConfig and declare their peers.
    • The package drops @bb/domain and the exports map only the app used.
  • Tests: the app's two automation view tests move into the plugin and render through the SDK test runtime. Their one host assertion, that a registered provider icon replaces the caller's fallback, moves to a new ProviderIcon.test.tsx case in apps/app.
  • Stories:
    • The Ladle stories move to plugins/automations/automations.stories.tsx. The story imports nothing outside the plugin: it lays out its own rows, and it requests the model picker catalog through its Ladle meta (modelPickerCatalog).
    • Ladle's global provider reads that meta and wraps the story in the app's ModelPickerStoryQueryProvider.
    • apps/app no longer depends on the plugin.
  • frontend-imports test: frontend-imports.test.ts keeps zod out of the app bundle, and it now resolves @/ through the plugin's own tsconfig, so it runs in a copy.
  • Lint:
    • A comment in startup reconciliation becomes a pending-thread case in its test.
    • A deliberate field-level dependency list is marked for the linter.
  • Docs: docs/forkable-plugins.md adds the include rule, that tests of a plugin's own components live in the plugin, and how a plugin-hosted Ladle story asks for app data through its meta.

How you verified

  • pnpm exec turbo run typecheck test lint --filter=bb-plugin-automations; @bb/domain, @bb/shared-ui, and @bb/scripts; @bb/app and @bb/integration-tests typecheck; the legacy automations round-trip integration test.
  • pnpm check:plugin-forks plugins/automations passes in a copy.
  • All five Automations stories render in the Ladle dev server with no errors, showing the host model picker's labels.
  • Mutation checks: treating pending like error fails the new reconcile case, and changing ProviderIcon's name={glyph ?? fallback} to name={glyph ?? "Code"} fails the new fallback case.
  • Bundle identity: app.css is byte-identical; app.js drops the unused update-state table.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4182 September 23, 2026 17:51
@SawyerHood
SawyerHood force-pushed the bb/forkable-17-automations branch 2 times, most recently from cd917c5 to b100690 Compare September 23, 2026 20:40
@SawyerHood
SawyerHood marked this pull request as ready for review September 23, 2026 21:07
@SawyerHood
SawyerHood force-pushed the bb/forkable-17-automations branch from b100690 to d5620e0 Compare September 23, 2026 21:31
@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
plugins/automations imported fourteen @bb/shared-ui components and
helpers, shared-ui's automation edit prompt, and @bb/domain's run-state
presentation, so a copy of its directory could not install. It now
imports every component through the registry alias
(@/components/ui/button, @/lib/utils, and so on; all are registry items)
with thread-list's tsconfig paths. The run-state labels and icons and
the edit prompt builder, which only the plugin used, move into it:
detail-view names the four run states itself, and lib/edit-prompt.ts
builds the "Edit the bb automation" prompt, with its test. shared-ui
drops buildAutomationEditThreadPrompt, and @bb/domain drops
RUN_STATE_PRESENTATION, whose only other reader was
UPDATE_STATE_PRESENTATION's three icon names, now written out.

The plugin's own @/src/rpc-types import becomes relative, since @/ now
means the registry. Its tsconfig no longer maps @get-bb/plugin-sdk onto
bundled-types: the SDK's exports already resolve its types there, a fork
resolves the published package the same way, and the mapping made
bb plugin build warn about a legacy vendored SDK layout. The include
list names every root module that imports @/, because Vite applies
tsconfig paths only to included files; the fork check caught what the
in-repo run did not. The vitest config uses defineConfig, and the
package declares @testing-library/dom, @types/react-dom, and hono for
the SDK test harness. It drops @bb/domain and its exports map, which
only the app used.

The app typechecked and tested the plugin's views by importing
bb-plugin-automations/detail-view and overview-view, which pulls the
plugin's @/ imports into @bb/app's program, where @/ means the app.
Those tests now live in the plugin: automation-overview.test.tsx as
src/overview-view.test.tsx, and the automation half of
detail-page-recipes.test.tsx as src/detail-view.test.tsx, rendering
through the SDK test runtime. Their one host assertion, that a
registered provider icon replaces the fallback, moves to the app's
ProviderIcon tests; the plugin test checks that the prompt footer asks
the host for the personal-workspace environment icon. The
Automations Ladle stories and the gallery's Automations control table
move to plugins/automations/automations.stories.tsx, which Ladle lists
like the other plugin-hosted stories and resolves through the forkable
paths plugin, and the plugin's tsconfig includes it so tsc checks it.
The story imports nothing outside the plugin: it lays out
its own rows, and it asks for the host model picker's catalog through
its Ladle meta (modelPickerCatalog, with the reused environment's id).
Ladle's global provider reads that and wraps the story in the app's
ModelPickerStoryQueryProvider, which now seeds the catalog for primary
routing plus the listed environments. The app no longer depends on the
plugin.

frontend-imports.test.ts, which keeps zod out of the app
bundle, resolves @/ through the plugin's own tsconfig paths instead of
workspace package links, so it runs in a copy too. The lint script
surfaced a comment in startup reconciliation, now a pending-thread case
in its test, and a deliberate field-level dependency list in
AgentAutomationDefinition, now marked for the linter.

The built bundle is unchanged apart from module order and names:
app.css is byte-identical, and app.js drops the unused update-state table it carried
from @bb/domain.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-17-automations branch from d5620e0 to a3b5666 Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit 9243dd0 into main Sep 23, 2026
11 of 22 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-17-automations branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

First of four agent-provider PRs at the top of the forkable built-ins
stack; it builds on #4199. `plugins/provider-acp` imports only the
public SDK, but a copy of its directory failed its tests:

- its vitest config used `vitest.shared.ts`;
- the SDK test harness's optional peers (`better-sqlite3`,
`cron-parser`, `hono`) weren't declared, and the fork installs without
peer resolution.

## What changed

- **Config:** `defineConfig`, declared test peers, a lint script, and a
turbo test entry that depends on the SDK build. The tsconfig covers
`server.test.ts`.
- **Removed test:** `public-sdk-only.test.ts` is gone. The lint rule and
the fork check enforce the same boundary, and its dev-dependency
assertion fails in a copy. The README now points at those checks.

## How you verified

- `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-provider-acp`. Its `omp` native-roots test needs a
TMPDIR with no `.agents` directory above it, as on `main`.
- `pnpm check:plugin-forks plugins/provider-acp` passes in a copy.
- `@bb/provider-parity` (the parity replays of the acp-cursor
recordings) and the native-roots golden tests.

🤖 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