Skip to content

Route ctx.ui.select/confirm/input dialogs to connected browser clients - #71

Open
Elompenta wants to merge 1 commit into
deflating:mainfrom
Elompenta:remote-ui-dialogs
Open

Route ctx.ui.select/confirm/input dialogs to connected browser clients#71
Elompenta wants to merge 1 commit into
deflating:mainfrom
Elompenta:remote-ui-dialogs

Conversation

@Elompenta

Copy link
Copy Markdown
Contributor

What this is

Fixes #48.

ctx.ui.select / ctx.ui.confirm / ctx.ui.input are a native part of pi-coding-agent's ExtensionUIContext, not something Tau invented. Any extension can already call them to ask the user a yes/no or multiple-choice question - a permission-gate style extension asking "run this command? [y/n]" before a risky bash call is a common example. Today that dialog only ever renders in the local TUI, so it's unanswerable when you're driving a session through Tau (e.g. headless/detached, or just on your phone).

This PR makes Tau proxy those three ctx.ui methods to a connected browser client, using the extension_ui_request / extension_ui_response protocol the frontend (dialogs.js) already implemented - that plumbing existed but was never wired up on the server side. With no browser connected, behavior is unchanged (local TUI).

Because this patches ctx.ui itself (the same object instance pi hands to every extension for a session) rather than hooking a specific event, it works for any extension that calls these methods, for any reason. No extension needs to be adapted or rewritten - confirmed end to end with an unmodified permission-gate extension.

Screenshots

Pi's native TUI confirm dialog, unchanged - this is what ctx.ui.select already rendered before this PR:

pi-without-connected-tau

The same interaction, live, now also answerable from the Tau web UI - notice it's the identical prompt and options, just mirrored:

pi-with-connected-tau

Also included

  • The dialog now docks directly above the message textarea (same width) instead of covering the whole chat behind a blurred full-screen overlay, so whatever led to the question (e.g. a drafted message asking "should I send this?") stays readable while deciding.
  • Drops the redundant Cancel button for binary (Yes/No-style) choices, since picking either option already answers the question.
  • If the last connected browser client disconnects while a dialog is pending, it resolves as cancelled instead of leaving the extension blocked forever.

Any extension calling pi's native ctx.ui.select/confirm/input (e.g. a
permission-gate style extension asking whether to run a command) now
gets answered from the Tau web UI when a browser is connected, instead
of only the local TUI - with no changes needed in the calling
extension. Falls back to the original local-TUI behavior when no
browser is connected.

Also docks the dialog above the message textarea instead of covering
the chat with a full-screen overlay, so the preceding conversation
stays readable while deciding, and drops the redundant Cancel button
for binary (Yes/No-style) choices.

Fixes deflating#48

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

Interactive console request

1 participant