Repository navigation
Description
Summary
BB binds Pi extensions without providing Pi’s ExtensionUIContext.
The current Pi bridge calls:
await session.bindExtensions({
mode: "rpc",
abortHandler: ...,
shutdownHandler: ...,
onError: ...,
});It does not pass uiContext.
As a result, ctx.hasUI is false inside Pi extensions.
Standard extension UI calls such as these cannot reach the BB interface:
ctx.ui.confirm()ctx.ui.select()ctx.ui.input()ctx.ui.editor()ctx.ui.notify()
Setting mode: "rpc" does not create the extension UI transport when an application embeds Pi through the SDK.
The SDK embedder must provide an ExtensionUIContext.
Related work
Issue #1391 fixed the Pi extension lifecycle by adding bindExtensions().
That fix lets extensions receive events such as session_start and session_shutdown.
However, it does not provide the UI context that extensions use for interactive requests.
This issue tracks that separate integration gap.
Current behavior
A Pi extension can call a standard UI method:
const allowed = await ctx.ui.confirm(
"Run command?",
"This command modifies files.",
);In the normal Pi TUI, the user receives a confirmation dialog.
In BB, the extension has no UI context.
The request cannot appear in BB’s pending-interaction interface.
An extension that checks ctx.hasUI can only fail closed or use its own fallback behavior.
Expected behavior
BB should provide an ExtensionUIContext when it calls session.bindExtensions().
The context should forward portable Pi extension UI requests through BB’s provider-independent interactive-request system.
The expected flow is:
Pi extension calls ctx.ui.confirm()
→ BB ExtensionUIContext creates a correlated bridge request
→ BB creates a pending interaction
→ BB shows the request to the user
→ User responds
→ BB sends the response to the Pi bridge
→ The ExtensionUIContext promise resolves
→ The Pi extension continues
Suggested implementation direction
- Implement an
ExtensionUIContextadapter in the Pi bridge. - Pass the adapter to
session.bindExtensions({ uiContext, ... }). - Send request and response messages through the BB provider bridge protocol.
- Map approval-like requests onto BB’s existing pending-interaction system.
- Keep a request ID and the applicable session, thread, and turn scope.
- Cancel unresolved requests when the session stops or is replaced.
- Validate responses before resolving the extension promise.
- Define timeout and disconnect behavior that fails closed.
Pi CLI RPC’s extension_ui_request and extension_ui_response messages can serve as a reference.
BB does not need to run the Pi CLI to implement this.
The Pi SDK already provides the required ExtensionUIContext integration point.
Scope
The first implementation should support portable UI methods:
confirmselectinputeditornotify, where applicable
TUI-only methods are not part of this request.
In particular, ctx.ui.custom() accepts an executable Pi TUI component factory and cannot be serialized into the BB interface.
Extensions that use ctx.ui.custom() must provide a portable fallback.
Acceptance criteria
- BB passes an
ExtensionUIContexttosession.bindExtensions(). ctx.hasUIis true for a Pi extension running in BB.- A fixture extension can call
ctx.ui.confirm()and receive the user’s decision. - Supported
select,input, andeditorrequests receive validated responses. - Approval-like requests use BB’s existing pending-interaction interface.
- Stopping or replacing a session cancels all unresolved requests.
- A response from an old session cannot resolve a request in a new session.
- A disconnect or timeout fails closed.
- Tests cover request correlation, user response, cancellation, and session replacement.
- The implementation does not claim support for
ctx.ui.custom().
Current code
The relevant call is in:
packages/agent-runtime/src/pi/bridge/sdk-session.ts
The current implementation calls bindExtensions() with mode: "rpc" but without uiContext.
References
- Pi bridge never calls bindExtensions(), so session_start never fires for Pi extensions #1391
- Pi SDK documentation:
https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/sdk.md - Pi RPC extension UI protocol:
https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/rpc.md#extension-ui-protocol - Provider bridge work:
Agent providers as a first-class plugin surface (provider bridge protocol) #1640
Activity
fix(provider-pi): surface Pi extension dialogs as answerable bb inter…
fix(provider-pi): surface Pi extension dialogs as answerable bb inter…
ymichael commentedon Oct 8, 2026
Fixed by #3228: Pi select/confirm/input/editor extension requests now show up as answerable bb interactions.