Route ctx.ui.select/confirm/input dialogs to connected browser clients - #71
Open
Elompenta wants to merge 1 commit into
Open
Route ctx.ui.select/confirm/input dialogs to connected browser clients#71Elompenta wants to merge 1 commit into
Elompenta wants to merge 1 commit into
Conversation
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>
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.
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:
The same interaction, live, now also answerable from the Tau web UI - notice it's the identical prompt and options, just mirrored:
Also included