Extension UI dialogs: full-window overlay hides chat context; single-dialog limit breaks select→input flows; timeout/expiresAt unimplemented
Summary
pi-web renders extension dialogs (ctx.ui.select() / ctx.ui.confirm() / ctx.ui.input() / ctx.ui.editor()) with a UX that diverges systematically from the pi TUI. These methods are part of the public ExtensionAPI (extensions docs, delivered over the RPC sub-protocol extension_ui_request), so every third-party extension that relies on them (permission confirmations, interactive configuration, questionnaires, credential prompts, etc.) is affected on pi-web — this is a platform-level gap, not specific to any one extension.
Environment
@agegr/pi-web0.8.7 (also on main / 0.8.8-beta.1)@earendil-works/pi-coding-agent0.84.x, RPC mode
Current behavior (components/ChatWindow.tsx → ExtensionDialog)
-
Full-window overlay hides the chat context. The dialog is rendered as
position:absolute; inset:0; zIndex:90; background:rgba(0,0,0,0.18)— the entire chat area is dimmed and covered while a dialog is open, so the user cannot re-read the conversation while answering. Questions like "which approach?" or "what does this error say?" usually have the answer in the context now hidden behind the overlay; the user must answer from memory. Clicking the overlay does nothing (no cancel, no dismiss). The TUI renders the same dialogs as an overlay that does not block the conversation and supports Esc. -
Single-dialog state cannot express composed flows. The dialog is one state slot in
useAgentSession(setExtensionDialog), and the RPC sub-protocol carries one dialog at a time. But "option list + fallback free-text input" (select followed by input) is a common composition pattern for TUI extensions. On pi-web this becomes two disconnected sequential modals, and cancelling the second discards the context of the first. -
timeout/expiresAtare defined in the protocol but never implemented. Both fields exist inlib/types.ts(ExtensionUiRequest), yet the client ignores them entirely. Extensions cannot express "auto-cancel if nobody answers", which diverges from TUI behavior (and the daemon-sideextensionDialogsTimeoutMssafety valve does not cover this client-side affordance). -
selecthas no keyboard support. Options are mouse-only buttons; no arrow-key navigation and no Esc handling (input/editor do handle Escape, select does not).
Expected behavior
- Dialogs no longer hide the chat context: render them as inline cards in the conversation transcript (a design already validated by a sibling pi GUI project, where dialog cards render inline in the session and resolve with the user's actual answer), or at minimum lighten the overlay and allow click-outside-to-cancel.
- Support dialog sequences / composed flows (the select → input pattern).
- Implement the already-defined
timeout/expiresAtfields. - Keyboard navigation and Esc for
select.
Proposed solution (incremental, each step independently shippable)
- P0 (one component): add keyboard navigation + Esc to
select; click-outside = cancel; reduce overlay opacity. - P1: move dialogs from a full-window overlay to inline cards in the message stream (options + input rendered in the transcript; answers travel back over the existing
extension_ui_responsechannel). - P2: support a dialog stack (composed select → input flows) and implement
timeout/expiresAt.
Reference
- Upstream protocol:
extension_ui_requestinlib/types.ts— select/confirm/input/editor all carrytimeout/expiresAt. - Validated sibling implementation: inline dialog cards in the session transcript (jmfederico/pi-web, "Pi extension dialogs in PI WEB").
- Repro: have any extension call
ctx.ui.select()(e.g. a question tool with a couple of options), then observe the overlay and the keyboard behavior.
This is a real issue as if you ask an agent to make a change to a json file, the buttons are not shown so you cannot proceed or escape. There is no path forward.
Verified against the current main branch / v0.9.0. The problems originally reported against v0.8.7 have been addressed by #612 and commit 2356904: extension dialogs can be collapsed so the chat context remains accessible; select supports arrow keys, Home/End, and Escape; and timeout / expiresAt are enforced server-side through extension_ui_closed, with a visible countdown in the client. Sequential select -> input flows do not require a dialog stack, and the existing E2E coverage verifies that a second request remains answerable after the first one completes. All 11 targeted tests pass, as does the TypeScript check. Truly concurrent unanswered requests may still be limited by the single client-side state slot, but there is no concrete reproduction at present; that should be tracked separately if a real use case appears. Closing this issue as resolved.