← Catalog

@hcflabs/pi-ask-question

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

Package

Install

Install with PiG

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

Install with Pi

pi install npm:@hcflabs/pi-ask-question
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/hcflabs/pi-harness/main/extensions/pi-ask-question/example.png",
  "extensions": [
    "./extensions/ask-question.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 3.3.0 (README.md). PiG does not review it.

@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.

SurfaceTypePurpose
ask_questiontoolFor 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.

SurfaceTypePurpose
askQuestion(params, ctx, signal)functionRuns the validated question flow for another extension.
AskQuestionOptiontypeDescribes a question option.
AskQuestionRequesttypeDescribes a question request.
AskQuestionResulttypeDescribes 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.