← Catalog

@hheei/pi-ask-user

Interactive ask_user tool for pi-coding-agent: one question or 2-4 in one prompt, multiple choice, multi-select, and freeform answers.

Extension

Install

Install with PiG

pig install npm:@hheei/pi-ask-user

Install with Pi

pi install npm:@hheei/pi-ask-user
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.

{
  "skills": [
    "./skills"
  ],
  "extensions": [
    "dist/index.js"
  ]
}

README

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

@hheei/pi-ask-user

Interactive ask_user tool for pi: one focused question, or 2-4 independent questions in one prompt, with multiple choice, multi-select, and freeform answers.

Forked from edlsh/pi-ask-user at revision df1df70 (v0.17.1). Upstream is MIT licensed; see LICENSE.

What the fork changes

  • Ships compiled dist/ through tsc instead of raw TypeScript, matching the other @hheei/pi-* packages.
  • Uses the typebox package instead of @sinclair/typebox.
  • Tests run on vitest instead of bun test.
  • Code conforms to this repo's Biome and exactOptionalPropertyTypes rules.
  • Renders only inline: upstream's centered overlay mode, its displayMode parameter, and the whole askUser settings section are gone, so the prompt always sits in pi's input dock and reports blocked to the terminal through the host.
  • Drops upstream's searchable split-pane list, optional comment stage, overlay hide shortcut, review-page scrolling, and ctrl+j/ctrl+k vim aliases: the prompt now matches pi's own select-list keys.
  • Drops the upstream pi-tern native-presentation integration. Prompts render through pi's own TUI components, and results publish presentation facts that @hheei/pi-ext-ui frames with its 0/1/2 fold levels when it is installed.

Module boundaries, invariants, and the test layout are recorded in docs/architecture/ask-user.md.

The batch contract is unchanged: context, options, allowMultiple, and allowFreeform belong on each questions entry, never at the top level. Top-level copies are ignored rather than rejected, because strict providers fill every declared property with an empty default. A one-entry questions array is unwrapped and asked as a single question instead of failing.

Install

pi install npm:@hheei/pi-ask-user

Tool

ParameterTypeDefaultNotes
questionstring?—The question. With questions, it is only the batch heading
questions{question, context?, options?, allowMultiple?, allowFreeform?}[]?—2-4 independent questions, used instead of question
contextstring?—Summary shown above the question
options{title, description?}[]?—Choices offered to the user
allowMultipleboolean?falseAllow selecting several options
allowFreeformboolean?trueAdd a freeform answer row
timeout_msinteger?—Auto-dismiss after N milliseconds; the result is cancelled

Keys

ContextKeys
List↑/↓, tab/shift+tab, 1-9 jump or toggle
Single selectenter choose (on the freeform row: open the editor)
Multi selectspace tick, enter submit
Editorenter submit, shift+enter/ctrl+j newline, esc back or cancel
Promptctrl+e expand or collapse context
Batchtab/shift+tab pages, 1-N jump from review, enter submit, esc cancel
Anywhereesc/ctrl+c cancel

ask:answered and ask:cancelled events carry only the question and the response kind; context and the actual answer stay in the tool result.

Skill

The package bundles the ask-user skill, which turns ask_user into a gate before high-stakes or ambiguous decisions. It is installed with the package; remove skills/ from your package list if you only want the tool.

Development

pnpm --filter @hheei/pi-ask-user run build
pnpm exec vitest run packages/pi-ask-user/test