feat(ask): pi-web-native ask_user_question with multi-select#37
Merged
Conversation
Add a bundled pi-ask extension so pi-web ships its own ask_user_question tool (pi_web_ask_user_question) instead of depending on a third-party provider that crashes in pi-web's headless RPC worker. - Honor each question's multiSelect flag in the question card (checkbox toggling + collect-then-submit) across all three render paths, instead of inferring single/multi from question count. - Render tool results carrying details.awaitingChatReply as pending and clickable so the browser click-to-chat answer flow works. - Recognize both ask_user_question and pi_web_ask_user_question names. - Steer the model toward the pi_web_ prefix via a before_agent_start system-prompt nudge and a tool_call hard-redirect, avoiding name conflicts with other providers.
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.
Summary
pi-web previously relied on a third-party
ask_user_questionprovider thatcrashes in the headless RPC worker (it calls
ctx.ui.custom(), which returnsundefinedin RPC mode). This PR makes the interactive question card afirst-class, self-contained pi-web feature.
pi-askextension (.pi/extensions/pi-ask.ts) that registerspi_web_ask_user_question. In RPC mode it records the questions and returns adetails.awaitingChatReplyresult telling the model to stop and wait; thebrowser collects the answer and sends it back through the normal chat flow.
multiSelectflag in the card (checkbox toggling +collect-then-submit) instead of inferring single/multi from question count.
awaitingChatReplyresults as pending/clickable so the click-to-chatanswer flow works; recognize both
ask_user_questionandpi_web_ask_user_questiontool names.pi_web_prefix via abefore_agent_startsystem-prompt nudge plus a
tool_callhard-redirect, so a separatelyinstalled bare
ask_user_questionis blocked before it can crash.Related issue
Closes #
Type of change
feat— new featureLive vs. Export
internal/ui/live_templates/in sync withweb/src/session/changesTesting
make checkpasses (test + build + vet)vitest) cover the changego test ./...) cover the change