Skip to content

Make the Pi provider plugin forkable - #4201

Merged
SawyerHood merged 1 commit into
bb/forkable-18-provider-acpfrom
bb/forkable-19-provider-pi
Sep 23, 2026
Merged

SawyerHood merged 1 commit into
bb/forkable-18-provider-acpfrom
bb/forkable-19-provider-pi

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Second agent-provider PR in the forkable built-ins stack; it builds on #4200. plugins/provider-pi couldn't be copied out:

  • App imports: it imported Button, cn, and the question form host from @bb/shared-ui.
  • Workspace test imports: the delta translation test imported the assembler and ThreadEvent from workspace packages.
  • Recordings: the recorded-conformance test replays recordings committed under packages/provider-bridge-protocol.
  • Lint: 51 code comments.

What changed

  • App imports: they go through the registry alias. The question form host comes from the registry flavor over experimental_useQuestionFormHost (Expose the question form host through the SDK and the registry #4181), so engines.bbPluginSdk rises to >=0.5.22. The SDK path entries are gone from the tsconfig.
  • Test imports: tests use experimental_createDeltaAssembler and ThreadEvent from @get-bb/plugin-sdk/provider-bridge/testing.
  • Recorded conformance: the test moves to @bb/provider-parity, and docs/provider-bridge-protocol.md says pi's replay lives there. @bb/provider-parity#test now takes packages/plugin-sdk/src/** and packages/plugin-sdk/package.json as inputs, because the replayed bridges load SDK sources.
  • Config and lint: defineConfig, declared peers, and turbo entries; the 51 comments are removed, and the README keeps what the fake pi's header and the Bun test explained.
  • App test: the test that checks pi's answer shortcuts loads the plugin by path under the app's own plugin runtime, because the SDK test runtime backs the question form host with an empty host.
  • CI: the Plugin Fork Check job installs Bun, as the packages test shard does, because a copy runs pi's Bun runtime regression, which requires Bun in CI.

How you verified

  • pnpm exec turbo run typecheck test lint --filter=bb-plugin-provider-pi; a Bun-only case is skipped without Bun.
  • pnpm check:plugin-forks plugins/provider-pi passes in a copy.
  • @bb/provider-parity, including the moved recorded conformance and the pi parity replays; apps/app/src/components/plugin tests; and the server's first-party provider plugin tests.
  • Turbo input: without the new inputs, turbo --dry=json reported the same @bb/provider-parity#test hash after a change to an SDK source; with them, the hash changes.
  • Bundle identity: app.css is byte-identical. An unminified app.js differs only in the question-form-host source (the runtime shim became the SDK facade's hook, the same host context) and formatting.

🤖 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-19-provider-pi branch 2 times, most recently from 215ae6b to ab2aa41 Compare September 23, 2026 18:07
@SawyerHood
SawyerHood force-pushed the bb/forkable-19-provider-pi branch from ab2aa41 to 2a1d895 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-19-provider-pi branch from 2a1d895 to 78e8eb8 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
A copy of provider-pi could not install or run its tests:

- Its app imported Button, cn, and the question form host from
  @bb/shared-ui. It now imports @/components/ui/button, @/lib/utils, and
  @/components/ui/question-form-host, the registry item whose flavor
  re-exports experimental_useQuestionFormHost, so engines.bbPluginSdk
  moves to >=0.5.22. tsconfig maps @/ the way thread-list does, plus the
  question-form-host flavor. Its paths for @get-bb/plugin-sdk and
  /app are gone: vitest now follows tsconfig paths, which sent the SDK
  to its .d.ts, and the package exports' types condition already names
  the same bundled declarations for tsc.
- The delta translation test imported the assembler and ThreadEvent from
  workspace packages. It now uses experimental_createDeltaAssembler and
  ThreadEvent from @get-bb/plugin-sdk/provider-bridge/testing and builds
  its two scope literals itself.
- The recorded-conformance test replays recordings committed under
  packages/provider-bridge-protocol, which a copy does not have. It moves
  to @bb/provider-parity, whose test task already takes the plugin's
  sources as inputs and now also takes the SDK's, which the replayed
  bridges load. docs/provider-bridge-protocol.md says where it lives.

The vitest config uses defineConfig, the plugin declares the SDK test
harness's peers its tests load, and the lint script removes 51 comments;
the README keeps what the fake pi's header and the Bun test explained.
The plugin fork CI job installs Bun, like the packages test shard, because
a copy runs pi's Bun runtime regression, which requires Bun in CI.
The app test that checks pi's answer shortcuts loads the plugin by path
under the app's own plugin runtime, because the SDK test runtime backs
the question form host with an empty host.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/forkable-19-provider-pi branch from 78e8eb8 to 624475a Compare September 23, 2026 22:10
@SawyerHood
SawyerHood merged commit 6fe4b62 into main Sep 23, 2026
23 of 34 checks passed
@SawyerHood
SawyerHood deleted the bb/forkable-19-provider-pi branch September 23, 2026 22:13
SawyerHood added a commit that referenced this pull request Sep 23, 2026
## Human comments

## What was wrong

Third of four agent-provider PRs in the forkable built-ins stack; it
builds on #4201. `plugins/provider-claude-code`'s source already used
only the public SDK, but a copy failed to typecheck and test:

- Tests imported `@bb/domain` and `@bb/provider-bridge-protocol` for
vocabulary the SDK already publishes.
- The recorded-conformance test replays recordings committed under
`packages/provider-bridge-protocol` through that package's worker entry,
neither of which a copy has.
- The vitest config used `vitest.shared.ts`.
- `@anthropic-ai/sdk` is a type-only peer of the Agent SDK, and the fork
installs without peers.

## What changed

- **Imports:** tests import from `@get-bb/plugin-sdk/provider-bridge`
and `/provider-bridge/testing`, including `BRIDGE_JSON_RPC_ERRORS`,
which a bridge test added on main imported from
`@bb/provider-bridge-protocol`. `threadScope` and `turnScope` move into
the delta test harness.
- **Recorded conformance:** the test moves to `@bb/provider-parity`,
whose test task already takes the provider plugins' sources as inputs.
`docs/provider-bridge-protocol.md` says Claude Code's replay lives there
too.
- **Config:** `defineConfig`, a test entry that depends on the SDK
build, declared test peers plus `@anthropic-ai/sdk`, and a lint script.
The workspace dev dependencies are gone.

## How you verified

- `pnpm exec turbo run typecheck test lint
--filter=bb-plugin-provider-claude-code`.
- `pnpm check:plugin-forks plugins/provider-claude-code` passes in a
copy.
- `@bb/provider-parity` tests, including the moved conformance cases;
`@bb/scripts`, `bb-plugin-plugin-api-docs`, and `@bb/app` typecheck.

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

> AGENT GENERATED
SawyerHood pushed a commit that referenced this pull request Sep 24, 2026
## Human comments

Got my clanker to do some prep work for making the KB shortcut + enter
flow better and realized we could pay off some tech debit while here.
Turns out your clanker handled the "enter to submit" side of things with
#4139, this just does some prep to ensure we benefit from that on the pi
side of things too.

<img width="300" alt="image"
src="https://github.com/user-attachments/assets/2dd113cb-9837-42c8-a983-61a54b93221a"
/>

## What was wrong

Pi's RPC `select` dialogs used a separate radio-list implementation
instead of BB's shared `QuestionForm`. That duplicated choice and
shortcut handling, allowing the Pi prompt's keyboard behavior to diverge
from AskUserQuestion.

## What changed

Render Pi RPC `select` interactions with the shared `QuestionForm`.
Adapt Pi's string options to the shared question model and map the
selected answer back to the original string expected by Pi. Keep the
existing Pi-specific `confirm`, `input`, and `editor` renderers
unchanged.

The pending-interaction shell already displays the interaction title, so
the form renders only Pi's `message` as the prompt (omitted entirely
when Pi sends none), avoiding a duplicate title.

Since #4139 merged, the shared form submits after a numbered selection
with Enter, and Pi RPC selects inherit that through this integration.
The branch also adapts to #4201's forkable-plugin registry imports
(`@/components/ui/*`).

## How you verified

- `pnpm exec turbo run test --filter=@bb/app
--filter=bb-plugin-provider-pi --
src/components/plugin/PluginPendingInteractionComposer.test.tsx
app.test.tsx`
  - App integration: 13 tests passed.
  - Pi plugin: 9 tests passed.
- `pnpm exec turbo run typecheck --filter=@bb/app
--filter=bb-plugin-provider-pi` (and `@bb/shared-ui` after the title
fix)
- `git diff --check`
- Manual QA in a nested source dev instance: a Pi RPC select prompt
(Landstrip permission) rendered without a duplicate title; number
shortcut selected the option and Enter submitted it; pointer selection
and Submit answer also worked.

Related: #3719, #4137, #4139, #4201

> 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