Repository navigation
Carry provider extension UI through the bridge, daemon, server, and app - #2446
Closed
SawyerHood wants to merge 1 commit into
Closed
SawyerHood wants to merge 1 commit into
SawyerHood wants to merge 1 commit into
Conversation
SawyerHood
added a commit
that referenced
this pull request
Sep 8, 2026
…actions (#3228) ## Human comments yet another PR for making the pi provider more polished here. I’ve been running this and my other PRs on my local install of bb and been working fine <img width="1170" height="2205" alt="image" src="https://github.com/user-attachments/assets/d300ebf0-23ef-4cb0-9e0d-83832f61537a" /> ## What was wrong Pi extensions prompt the user through `ctx.ui.select`, `ctx.ui.confirm`, `ctx.ui.input`, and `ctx.ui.editor`. In RPC mode these emit an `extension_ui_request` line on stdout and block until an `extension_ui_response` arrives on stdin (see `docs/rpc.md`, "Extension UI Protocol"). bb's provider-pi bridge answered every such request with `{cancelled: true}`, so any extension that raises a permission prompt had it silently dismissed — [pi-landstrip](https://github.com/landstrip/landstrip) sandbox-approval prompts were unusable over bb. Investigation and reproduction trail: #1668. ## What changed - `plugins/provider-pi/src/bridge/rpc-child.ts` forwards `extension_ui_request` dialogs to an optional handler; with no handler the old auto-cancel remains, so behavior is unchanged unless the bridge opts in. - `plugins/provider-pi/src/extension-ui-contract.ts` validates dialog requests at the boundary: method enum, bounded title/options/message/placeholder/prefill, `select` requires a non-empty options list. - `plugins/provider-pi/src/bridge/extension-ui.ts` forwards each dialog as a `provider-pi/extension-ui` pending interaction and maps resolutions back (`value` for select/input/editor, `confirmed` for confirm, `cancelled` on error, unknown value, or session close). Request ids use a `pi-ui-N` string space so they cannot collide with numeric item/tool/call ids. Pending dialogs are cancelled on thread stop, session replace, and discard. Fire-and-forget methods (`notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`) are dropped. - Helper sessions such as fork helpers retain automatic dialog cancellation when no UI handler is installed. Select responses are checked against the originally offered options before reaching Pi. - `plugins/provider-pi/app.tsx` renders the four dialog shapes in the plugin pending-interaction slot. The host passes plugin components the interaction's data object rather than the stored `{kind, title, data}` wrapper, so the renderer parses the unwrapped payload directly. No protocol or wire changes: no `HOST_DAEMON_PROTOCOL_VERSION` bump, no new grammar, no new plugin API surface — this reuses the existing `interaction/request` plugin-extension payload kind and pending-interaction slot. This is deliberately the minimal bridge-only subset of #2446/#2447 (both still open): thread-scoped requests outside an active turn, withdrawal notifications, and queued-before-announcement dialogs are left as follow-ups — and the behavior is strictly better than the current always-cancelled path. ## How you verified - `pnpm exec turbo run test --filter=bb-plugin-provider-pi` (26 files, 143 tests) and `turbo run typecheck --filter=bb-plugin-provider-pi` — clean. - Both review regressions were reproduced before the fixes: helper startup timed out waiting for a dialog response, and an unoffered select string reached Pi. Both now pass; `pnpm exec turbo run test typecheck --filter=bb-plugin-provider-pi` passed with 26 test files and 143 tests. The working-tree and commit-range secret scan was clean. - New bridge round-trip tests over the fake Pi harness (`/ui` directive in `fake-pi-rpc.mjs`), rpc-child handler unit tests, and jsdom renderer tests covering select/confirm/input/editor and the host-unwrapped payload shape. - Live: pi-landstrip read/write permission prompts render the full option list over bb, and user answers propagate back and drive the sandbox decision (e.g. "Keep blocked" denies the underlying write). Fixes: partial groundwork for #1668 --- <sub><em>Generated with "Omen Alpha" (Opencode Go) via BB / Pi</em></sub> > AGENT GENERATED --------- Co-authored-by: Sawyer Hood <[email protected]>
Collaborator
Author
|
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
A provider plugin's extensions (pi's
ctx.ui) had no generic path into bb: no thread-scoped questions outside a turn, no way to cancel them, no persisted per-thread extension state with app-rendered actions, no bridge-listed slash commands, and no plugin-to-bridge RPC.What changed (no Pi code in this layer)
interaction/requestmay carryturnId: null+experimental_scope: "thread";interaction/cancelnotification;command/list;provider/custom;extension/action(packages/provider-bridge-protocol,packages/agent-runtime).experimental_responseMode: "verbatim",experimental_placeholder,experimental_prefill, answers withexperimental_verbatimText;USER_QUESTION_MAX_OPTIONS4 → 100 (packages/domain/src/pending-interactions.ts). App and mobile question forms honor verbatim mode.host.list_commandsmerges the bridge'scommand/list(withdiagnostics);provider.custom_call;thread.extension-state.action; per-interaction abort registry.extension.statesnapshots (thread/extensionState/updated, superseded-event pruning), exposesextensionStateson the timeline,POST …/extension-state/action;bb.providers.experimental_client/experimental_modelsChanged(per-host model cache invalidation);PluginSettingsSectionProps.experimental_hostId.app.slots.experimental_providerExtensionStaterenders a provider's state kinds above/below the composer.HOST_DAEMON_PROTOCOL_VERSION171 → 172.docs/provider-bridge-protocol.mdanddocs/api_to_audit.mdupdated.Prerequisite: #2445 (shares the protocol header and
routes/threads/actions.ts).Known gaps, deliberate: dialogs are thread-scoped even mid-turn; cancel is thread-wide; no runtime-level test for
interaction/cancelwiring.How you verified
turbo run typecheck;turbo run testfor@bb/agent-runtime,@bb/provider-bridge-protocol,@bb/host-daemon,@bb/server(interactions, extension-state action, project commands, model cache),@bb/app,@bb/mobile,@bb/db,@bb/domain,@bb/thread-view,@get-bb/plugin-sdk,bb-plugin-provider-codex,@bb/host-daemon-contract.Fixes: none (upstream stack split).