@raidou/pi-ask-user0.3.1
Ask-user-question tool for pi: lets the agent present multiple-choice questions to the user.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@raidou/pi-ask-user
An pi extension that provides the
ask_user_question tool: it lets the coding agent present one or more
multiple-choice questions to the user and collect structured answers, with a
rich TUI (options list, preview pane, scrolling and tabs).
Install
pi install npm:@raidou/pi-ask-user
Or from a local checkout:
cd path/to/pi-ask-user
pi install .
Subagent support
Subagent sessions can use ask_user_question too. Main and subagent sessions share one extension module instance, and only the real TUI session (ctx.mode === 'tui' && ctx.hasUI) registers as the owner. The tool is always registered, but sessions without an owner deactivate it via setActiveTools, so the model cannot see or call it in standalone rpc/print sessions. Sessions with a TUI owner (the TUI itself, or an in-process subagent whose main TUI session already registered as owner) keep the tool active. When a subagent asks, the tool call blocks while the question UI is rendered in the main TUI session, and the answer is returned to the subagent as the tool result (a "cancelled" result if the user cancels). If the owner session closes mid-conversation and a subagent still calls the tool, the call fails with a "requires a TUI coordinator session" error. Asks originating from a subagent are labelled with a subagent badge in the questionnaire UI.
Public event contract
The extension emits two events on pi.events:
pi-ask-user:ask_user_question:ui_start— the questionnaire UI appearedpi-ask-user:ask_user_question:ui_end— the questionnaire UI is gone (also on cancel or session end)
Payload is { id: string } where id is the tool-call id. Subscribe with pi.events.on(EVENT_KEY, listener).
Development
When started with PI_DEMO=1, the extension also registers an /ask-user-demo command that walks through the question UI (/ask-user-demo subagent previews a subagent ask).
pnpm install
pnpm test # types + lint + unit tests