{"_id":"@arvoretech/pi-ask-user-question","_rev":"2-94c4edd4b5d06512f6eaf2bc3f0fcc65","name":"@arvoretech/pi-ask-user-question","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@arvoretech/pi-ask-user-question","version":"1.0.0","keywords":["pi-package","pi","extension","ask-user-question","questionnaire"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/pi-ask-user-question@1.0.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},{"name":"rafsouza","email":"rafasouza@protonmail.com"},{"name":"pedro.adas","email":"pedro.adas@gmail.com"},{"name":"guilhermebs","email":"guilhermebscontact@gmail.com"},{"name":"ricardoraposorfox","email":"ricardorbxx1@gmail.com"},{"name":"jott4","email":"jvgcunha2002@gmail.com"},{"name":"vitor.piovezan","email":"vitor.piovezan@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-pi-extensions#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-pi-extensions/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"bb446b8215f2c8a136f958461f56f9071f992d26","tarball":"https://registry.npmjs.org/@arvoretech/pi-ask-user-question/-/pi-ask-user-question-1.0.0.tgz","fileCount":49,"integrity":"sha512-Jxyf08b1bxN9/IWDqaZRBpTagKkGeXrFQY8P/kDl0VldEKNl3u9TNN4gWGU8T0Y9mp8Ok53wqCVfQFE+T9JTZg==","signatures":[{"sig":"MEUCIF7c0yKKxp3GMqYLvGha7WFQX0kpAhJReyiyscestApJAiEAkTXPUjg0NhncpCh2WqrKnTku2hic4Yd+qAFp9LA1SwQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":192496},"type":"module","exports":{".":"./index.ts","./events":"./events.ts"},"gitHead":"c59b55b8eb6a723fbea314a31489c1b3a7051b64","scripts":{"lint":"tsc --noEmit"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-pi-extensions.git","type":"git","directory":"packages/ask-user-question"},"_npmVersion":"10.9.4","description":"PI extension. A structured questionnaire the model can put to the user, answerable from the terminal overlay OR externally (e.g. Slack buttons) via an event channel. Fork of @juicesharp/rpiv-ask-user-question (MIT) with an external-answer race.","directories":{},"_nodeVersion":"22.21.1","_hasShrinkwrap":false,"devDependencies":{"typebox":"^1.2.6","typescript":"^5.3.0","@types/node":"^20.10.0","@earendil-works/pi-tui":"latest","@earendil-works/pi-coding-agent":"latest"},"peerDependencies":{"typebox":"^1.2.6","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-ask-user-question_1.0.0_1783456705986_0.6960766231442246","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arvoretech/pi-ask-user-question","version":"1.0.1","description":"PI extension. A structured questionnaire the model can put to the user, answerable from the terminal overlay OR externally (e.g. Slack buttons) via an event channel. Fork of @juicesharp/rpiv-ask-user-question (MIT) with an external-answer race.","type":"module","exports":{".":"./index.ts","./events":"./events.ts"},"license":"MIT","author":{"name":"Arvore"},"pi":{"extensions":["./index.ts"]},"peerDependencies":{"@earendil-works/pi-coding-agent":"*","@earendil-works/pi-tui":"*","typebox":"^1.2.6"},"devDependencies":{"@earendil-works/pi-coding-agent":"latest","@earendil-works/pi-tui":"latest","@types/node":"^20.10.0","typebox":"^1.2.6","typescript":"^5.3.0","vitest":"^3.2.6"},"keywords":["pi-package","pi","extension","ask-user-question","questionnaire"],"repository":{"type":"git","url":"git+https://github.com/arvoreeducacao/arvore-pi-extensions.git","directory":"packages/ask-user-question"},"scripts":{"lint":"tsc --noEmit","test":"vitest run"},"_id":"@arvoretech/pi-ask-user-question@1.0.1","bugs":{"url":"https://github.com/arvoreeducacao/arvore-pi-extensions/issues"},"homepage":"https://github.com/arvoreeducacao/arvore-pi-extensions#readme","_integrity":"sha512-oBcKXIHNjhQbCxVR+FbM1xzkH9WmmPbx/vesPNcbkomtLTKI7g5tX6d7/hOoJaN6+rOXwZtDcSfdFOq7s/Cpwg==","_resolved":"/tmp/arvoretech-pi-ask-user-question-1.0.1.tgz","_from":"file:/tmp/arvoretech-pi-ask-user-question-1.0.1.tgz","_nodeVersion":"22.23.1","_npmVersion":"11.18.0","dist":{"integrity":"sha512-oBcKXIHNjhQbCxVR+FbM1xzkH9WmmPbx/vesPNcbkomtLTKI7g5tX6d7/hOoJaN6+rOXwZtDcSfdFOq7s/Cpwg==","shasum":"5f5839bfee3687f0eb8a546139768cbbcf300603","tarball":"https://registry.npmjs.org/@arvoretech/pi-ask-user-question/-/pi-ask-user-question-1.0.1.tgz","fileCount":49,"unpackedSize":191046,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arvoretech%2fpi-ask-user-question@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCiUvEhngbI/nvhhEU5hMbuAabd7N0YhcXDCGsXCWzsCgIhAJwjj8ZRjRnUvTgN2SOm74Lkx8lyRHNR5kmwNVb1dFHK"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:64ffb0c6-f619-43a6-8372-e96efe6b80c9"}},"directories":{},"maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},{"name":"rafsouza","email":"rafasouza@protonmail.com"},{"name":"pedro.adas","email":"pedro.adas@gmail.com"},{"name":"guilhermebs","email":"guilhermebscontact@gmail.com"},{"name":"ricardoraposorfox","email":"ricardorbxx1@gmail.com"},{"name":"jott4","email":"jvgcunha2002@gmail.com"},{"name":"vitor.piovezan","email":"vitor.piovezan@arvore.com.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-ask-user-question_1.0.1_1784551291137_0.3253241284933639"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-07T20:38:25.825Z","modified":"2026-07-20T12:41:31.752Z","1.0.0":"2026-07-07T20:38:26.134Z","1.0.1":"2026-07-20T12:41:31.278Z"},"bugs":{"url":"https://github.com/arvoreeducacao/arvore-pi-extensions/issues"},"author":{"name":"Arvore"},"license":"MIT","homepage":"https://github.com/arvoreeducacao/arvore-pi-extensions#readme","keywords":["pi-package","pi","extension","ask-user-question","questionnaire"],"repository":{"type":"git","url":"git+https://github.com/arvoreeducacao/arvore-pi-extensions.git","directory":"packages/ask-user-question"},"description":"PI extension. A structured questionnaire the model can put to the user, answerable from the terminal overlay OR externally (e.g. Slack buttons) via an event channel. Fork of @juicesharp/rpiv-ask-user-question (MIT) with an external-answer race.","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},{"name":"rafsouza","email":"rafasouza@protonmail.com"},{"name":"pedro.adas","email":"pedro.adas@gmail.com"},{"name":"guilhermebs","email":"guilhermebscontact@gmail.com"},{"name":"ricardoraposorfox","email":"ricardorbxx1@gmail.com"},{"name":"jott4","email":"jvgcunha2002@gmail.com"},{"name":"vitor.piovezan","email":"vitor.piovezan@arvore.com.br"}],"readme":"# rpiv-ask-user-question\n\n<div align=\"center\">\n  <a href=\"https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question\">\n    <picture>\n      <img src=\"https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/cover.png\" alt=\"rpiv-ask-user-question cover\" width=\"50%\">\n    </picture>\n  </a>\n</div>\n\nLet the model ask you structured clarifying questions instead of guessing. `rpiv-ask-user-question` adds the `ask_user_question` tool to [Pi Agent](https://github.com/badlogic/pi-mono) - a tabbed dialog with single- and multi-select questions, side-by-side previews, per-option notes, and a Submit tab that reviews answers before they go back to the model.\n\n![Side-by-side code preview](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/code-preview.jpg)\n\n## Features\n\n- **Multi-question dialogs** - ask several questions in one turn with a tab bar (`Tab` to switch).\n- **Preview pane** - render an ASCII diagram, code snippet, or markdown next to each option, side-by-side or stacked depending on terminal width.\n- **Per-option notes** - press `n` on a previewed option to attach a free-text note that travels back with the answer.\n- **Multi-select questions** - checkboxes with `Space` to toggle, Enter-as-toggle on rows, a `Next` sentinel to advance, and toggles persisted across tab switches.\n- **Submit tab** - review every answer before submitting; warns about unanswered questions and offers a Submit picker.\n- **Chat row on every tab** - redirect the conversation without leaving the dialog.\n- **Terminal-row-aware overflow scroll** - when the dialog is taller than the terminal, the body scrolls between a sticky heading and sticky hints/border; overflow indicators (↑ / ↓ / ↕) show what's clipped.\n- **\"Other\" free-text fallback** - type a custom answer when no option fits.\n- **Localized UI** - sentinel rows, hints, submit/cancel labels, review pane, and notes affordance display in the user's chosen language via `@juicesharp/rpiv-i18n`. Ships Deutsch / English / Español / Français / Português (PT) / Português (BR) / Русский / Українська; switch with `/languages` or `pi --locale <code>`. LLM-facing copy (tool description, schemas, errors) stays English by design.\n\n## Screens\n\n| | |\n|---|---|\n| ![Single-question dialog](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/single-question.jpg) | ![Multi-tab + ASCII preview](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/multi-tab-preview.jpg) |\n| ![Multi-select with checkboxes](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/multi-select.jpg) | ![Submit tab review](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/submit-tab.jpg) |\n| ![Localized UI - German](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-ask-user-question/docs/localized-german-ui.jpg) | |\n\n## Install\n\n```bash\npi install npm:@juicesharp/rpiv-ask-user-question\n```\n\nThen restart your Pi session.\n\n### Optional: localization\n\n`rpiv-ask-user-question` works standalone - install only this package and you get the full English UI. Install `@juicesharp/rpiv-i18n` alongside it to flip sentinel labels, dialog hints, review-tab heading, and chat-summary lines to your active locale:\n\n```bash\npi install npm:@juicesharp/rpiv-i18n\n```\n\nWith the SDK present, locale resolves from `--locale <code>` → `~/.config/rpiv-i18n/locale.json` → `LANG` / `LC_ALL` → English. The `/languages` interactive picker and `pi --locale <code>` startup flag are also enabled. Without the SDK, the dialog stays online and renders English at every call site - no warning, no crash. Users who installed via `pi install npm:@juicesharp/rpiv-pi` + `/rpiv-setup` get the SDK automatically.\n\n## Tool\n\n- **`ask_user_question`** - present one or more structured questions, each with 2+ options, optional `multiSelect`, optional per-option `preview`, and an optional free-text \"Other\" fallback. Returns the user's selection(s) plus any notes. See the tool's `promptGuidelines` for usage policy.\n\n### Schema\n\n```ts\nask_user_question({\n  questions: [\n    {\n      question: string,            // full question text, ends with \"?\"\n      header: string,              // chip label, max 16 chars\n      options: [\n        {\n          label: string,           // 1-5 words, max 60 chars\n          description: string,     // explains the choice / its trade-off\n          preview?: string,        // optional markdown shown next to options\n        },\n        // … 2-4 options total\n      ],\n      multiSelect?: boolean,       // default false\n    },\n    // … 1-4 questions total\n  ]\n})\n```\n\nReserved option labels (rejected at validation): `\"Other\"`, plus the runtime sentinels (`\"Type something.\"`, `\"Chat about this\"`, `\"Next →\"`).\n\nReturns:\n\n```ts\n{\n  content: [{ type: \"text\", text: string }], // human-readable envelope or DECLINE_MESSAGE\n  details: {\n    answers: Array<{\n      questionIndex: number,\n      question: string,\n      kind: \"option\" | \"custom\" | \"chat\" | \"multi\",\n      answer: string | null,\n      selected?: string[],         // present for multi-select\n      notes?: string,              // free-text note, when typed\n      preview?: string,            // echoed back when option carried a preview\n    }>,\n    cancelled: boolean,\n    error?: \"no_ui\" | \"no_questions\" | \"empty_options\" | \"too_many_questions\"\n          | \"duplicate_question\" | \"duplicate_option_label\" | \"reserved_label\",\n  }\n}\n```\n\n## License\n\n[![npm version](https://img.shields.io/npm/v/@juicesharp/rpiv-ask-user-question.svg)](https://www.npmjs.com/package/@juicesharp/rpiv-ask-user-question)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nMIT\n","readmeFilename":"README.md"}