Files
my-pi/pi-ask-user
云服务部-叶林立 879fc5d37f docs(upstream): 将 UPSTREAM.md 来源记录统一改为中文维护
把 12 份 UPSTREAM.md 来源记录全部翻译为中文,并把中文定为这份仓库自有
维护文档的强制语言。

- 翻译 hippo-memory-pi、pi-ask-user、pi-chrome、pi-compaction、
  pi-extension-codex-fast-mode、pi-minimal-footer、pi-notify、
  pi-permission-system/docs/auto-review、pi-ssh、pi-subagents 与
  pi-tool-search 的来源记录。
- 在 AGENTS.md 增加纪律:每个自维护扩展目录必须保留中文 UPSTREAM.md,
  内容涵盖官方仓库、tag/commit、导入版本、导入日期、许可证归属、本地
  改动清单与同步上游时的约束。
- 明确边界:UPSTREAM.md 属于仓库自有的维护文档,因此使用中文;上游自带
  的源码、测试、文档、README、CHANGELOG 与 LICENSE 一律保持原文,不翻
  译、不改写,避免同步上游时产生无意义 diff 并破坏许可证原文完整性。
- 所有 40 位 commit、tag/版本号、仓库 URL 与许可证路径原样保留,仅翻译
  叙述性文字。

验证:12 份文件均无残留英文正文;逐份复核了 commit、版本、URL 与
LICENSES/ 路径未发生改变。
2026-10-13 23:19:01 -07:00
..

pi-ask-user

A locally maintained Pi extension that consolidates the upstream question.ts and questionnaire.ts examples into one model-initiated tool. It intentionally does not include the /qna command.

Tool

The extension registers ask_user_question. The model can present one to eight questions through an interactive Pi UI:

  • select: one to eight stable { value, label, description? } choices, always followed by a free-form choice that the model cannot disable;
  • text: a free-form answer;
  • required: false: lets the user explicitly skip the question;
  • TUI mode: one sequential custom interaction with progress tabs and a final review page;
  • RPC mode: standard Pi select / input dialogs shown one question at a time by compatible clients such as Paseo.

The model should call the tool only when a missing decision, preference, or clarification is needed to continue. It should not repeat questions already answered in the user's direct messages.

TUI controls

  • ↑ / ↓: move through choices;
  • Enter: select, edit, or submit;
  • Tab, Shift+Tab, ←, →: move between questions and review;
  • Esc: leave text entry, or cancel from a question/review page.

The outer component propagates focus to the embedded Editor for IME cursor positioning.

RPC clients use their native dialog controls. Dismissing a dialog or aborting the tool returns cancelled: true; required blank text is requested again, while optional blank text is recorded as an explicit skip.

Result contract

Successful results include readable text and structured details:

{
  "version": 1,
  "cancelled": false,
  "questions": [],
  "answers": [
    {
      "id": "language",
      "question": "Which language should be used?",
      "type": "select",
      "answer": "TypeScript",
      "value": "typescript",
      "label": "TypeScript",
      "custom": false,
      "skipped": false
    }
  ]
}

The tool name and the question / answer fields intentionally match pi-permission-system's integrated AutoReview trusted structured user-interaction envelope. Cancelled results are never treated as authorization evidence.

The tool requires dialog-capable interactive UI. TUI mode uses the custom questionnaire, RPC mode uses Pi's standard extension UI bridge, and JSON/print modes receive a tool error rather than an invented answer.

Development

npm test
npm run check

See UPSTREAM.md for the imported reference snapshot and local differences.