@henryqw/pi-ask-question

Ask Pi users one interactive question with choices or a custom answer.

Packages

Package details

extension

Install @henryqw/pi-ask-question from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@henryqw/pi-ask-question
Package
@henryqw/pi-ask-question
Version
1.0.2
Published
Sep 6, 2026
Downloads
3,294/mo · 611/wk
Author
henrywang
License
MIT
Types
extension
Size
9.7 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/ask-question.ts"
  ],
  "image": "https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-ask-question/example.png"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@henryqw/pi-ask-question

Pause Pi for one clear user choice, with up to three options or a custom answer. Its keyboard-selectable prompt gives agents and extensions an explicit answer without parsing free-form chat.

Pi asking the user to choose a database

Install

pi install npm:@henryqw/pi-ask-question

Use

Call ask_question to pause for one interactive answer. Pi shows the choices and returns the selected or custom answer.

{
  "question": "Which database should we use?",
  "options": [
    { "label": "PostgreSQL", "description": "Shared server database" },
    { "label": "SQLite", "description": "Local, embedded storage" },
    { "label": "File", "description": "Plain file storage" }
  ]
}
  • Supply one to three options in preference order.
  • The UI marks the first option (Recommended).
  • The UI adds Something else., which opens a text input for a custom answer.

While an interactive TUI question is open, the tool publishes herdr:blocked with the Input required label. It clears the status after completion, cancellation, or failure.

API

Extensions can reuse the validated interaction with askQuestion(params, ctx, signal). This package export returns the tool's answer details without registering another UI flow.

Limits and recovery

The tool returns an error for empty questions, blank or duplicate labels, empty lists, more than three options, and non-interactive sessions. Aborting the tool closes the pending question.