Repository navigation
Make the Ask User Question and Secrets plugins forkable - #4197
Merged
SawyerHood merged 1 commit intoSep 23, 2026
Merged
SawyerHood merged 1 commit into
SawyerHood merged 1 commit into
Conversation
SawyerHood
force-pushed
the
bb/forkable-16-interaction-forms
branch
from
September 23, 2026 17:51
adba3ea to
c4072e0
Compare
SawyerHood
force-pushed
the
bb/forkable-16-interaction-forms
branch
from
September 23, 2026 17:53
c4072e0 to
307d219
Compare
SawyerHood
force-pushed
the
bb/forkable-16-interaction-forms
branch
from
September 23, 2026 20:40
307d219 to
06046ab
Compare
SawyerHood
marked this pull request as ready for review
September 23, 2026 21:07
SawyerHood
force-pushed
the
bb/forkable-16-interaction-forms
branch
from
September 23, 2026 21:31
06046ab to
9511c92
Compare
ask-user-question and secrets render bb's in-thread forms, but a copy of either directory could not build on its own. Both imported @bb/shared-ui components and @bb/plugin-interaction-contracts, a workspace package holding their payload and response schemas, and their vitest configs imported the repository's vitest.shared.ts. - Each plugin now owns its contract: ask-user-question's schemas join src/contracts.ts and secrets' move to src/secret-request.ts, each with its half of the old contract tests. Nothing else imported the package, so it is gone. - Components come through the registry alias (@/components/ui/button, input, label, and question-form) with thread-list's tsconfig paths. The built-in bundle still takes the question form host from the app's runtime, so it keeps bb's answer shortcuts and a single React context. A copy's registry question form calls experimental_useQuestionFormHost, so the plugin's SDK engine range moves to 0.5.22. - The tsconfigs no longer map @get-bb/plugin-sdk onto its bundled declarations: with tsconfigPaths, vitest followed those paths at runtime and loaded modules with no exports. The package's types condition already gives tsc the same files. app.test.tsx and the vitest configs join the tsconfig include, and the test's submit mock gains the parameter tsc then asked for. - The fork installs without npm's peer resolution, so each plugin declares the SDK test harness peers its tests load. ask-user-question's Ladle story rendered the plugin through app source, so it moves into apps/app beside the other pending-interaction stories and passes origin="plugin", which replaced its stale dismissal prop. Both stories load their plugin with import.meta.glob, which keeps the plugins' @/ imports out of @bb/app's type program, and Ladle's Vite config applies the forkable plugin paths so those imports resolve. docs/forkable-plugins.md records both rules. The built app bundles differ from before only in module paths and in dropping the other plugin's schemas, which the shared package's index pulled into both. app.css is byte-identical. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
SawyerHood
force-pushed
the
bb/forkable-16-interaction-forms
branch
from
September 23, 2026 22:10
9511c92 to
53e7cbd
Compare
SawyerHood
added a commit
that referenced
this pull request
Sep 23, 2026
## 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](https://claude.com/claude-code) > AGENT GENERATED
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
Fourteenth PR in the forkable built-ins stack; it builds on #4196. ask-user-question and secrets render bb's in-thread forms (the
pendingInteractionslot). A copy of either couldn't build on its own:@bb/shared-uiand@bb/plugin-interaction-contracts, a workspace package holding their payload and response schemas.bb plugin buildcan swap..d.tsfiles, and their vitest configs usedvitest.shared.ts.What changed
src/contracts.ts,src/secret-request.ts) with its half of the old tests. Nothing else imported@bb/plugin-interaction-contracts, so it is deleted.question-form, whosequestion-form-hostflavor callsexperimental_useQuestionFormHost(Expose the question form host through the SDK and the registry #4181), so itsengines.bbPluginSdkis>=0.5.22. The built-in bundle still takes the question form host from the app's runtime, so it keeps bb's answer shortcuts and a single React context.typescondition already points tsc at the same files.@/*and the icon flavor. It never importsquestion-form-hostitself, so it doesn't map it.app.test.tsxand the vitest configs join the tsconfiginclude.apps/appbeside the other pending-interaction stories, withorigin="plugin"replacing a stale prop. Both stories load their plugin throughimport.meta.glob(apps/app/.ladle/plugin-app-module.ts), which keeps the plugins'@/imports out of@bb/app's type program.docs/forkable-plugins.mdrecords both rules: a listed plugin maps nothing onto@get-bb/plugin-sdk, and Ladle stories load a listed plugin withimport.meta.glob.How you verified
pnpm exec turbo run typecheck test lintfor both plugins.pnpm check:plugin-forkspasses for both. In a kept copy,app.jscallsexperimental_useQuestionFormHostand never callscreateContext.@bb/apptypecheck and tests,@bb/scripts,bb-plugin-plugin-api-docs, and the server's built-in plugin tests.app.cssis byte-identical.app.jsdiffers only in module paths and in dropping the other plugin's schemas, which the shared package's index had pulled into both bundles. Both bundles take the question form host fromruntime.questionFormHost.🤖 Generated with Claude Code