@hcflabs/pi-ask-question

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

Packages

Package details

extension

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

$ pi install npm:@hcflabs/pi-ask-question
Package
@hcflabs/pi-ask-question
Version
3.2.4
Published
Oct 24, 2026
Downloads
229/mo · 229/wk
Author
csubj
License
MIT
Types
extension
Size
268.5 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "image": "https://raw.githubusercontent.com/hcflabs/pi-harness/main/extensions/pi-ask-question/example.png",
  "extensions": [
    "./extensions/ask-question.ts"
  ]
}

Security note

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

README

@hcflabs/pi-ask-question

Pause Pi until the user selects a question option with the keyboard or enters a custom answer. Agents and extensions get an explicit answer without parsing free-form chat.

Pi asking the user to choose a database

Install

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

Use

Call ask_question in an interactive TUI with a question and one to three options in preference order. Pi waits for the selected option or custom answer.

Surface Type Purpose
ask_question tool For agents: pause execution to get one user 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" }
  ]
}

The UI marks the first option (Recommended) and adds Something else. for custom text input. Descriptions are optional.

While a question is open, the tool publishes herdr:blocked with Input required. Completion, cancellation, or failure clears the status.

API

Import from the package root, @hcflabs/pi-ask-question.

Surface Type Purpose
askQuestion(params, ctx, signal) function Runs the validated question flow for another extension.
AskQuestionOption type Describes a question option.
AskQuestionRequest type Describes a question request.
AskQuestionResult type Describes the flow result.

The answer is null for cancellation, empty custom input, invalid requests, or non-TUI calls. Invalid requests and non-TUI calls also include error.

Limits and recovery

Questions and option labels must not be blank. Labels must be unique, without regard to case. Something else. is reserved for the custom answer option.

Non-interactive calls return UI not available (running in non-interactive mode). Ask in plain assistant text instead. Aborting the tool closes the pending question.