@juicesharp/rpiv-ask-user-question 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -13
- package/ask-user-question.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
[](https://www.npmjs.com/package/@juicesharp/rpiv-ask-user-question)
|
|
12
12
|
[](https://opensource.org/licenses/MIT)
|
|
13
13
|
|
|
14
|
-
Let 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)
|
|
14
|
+
Let 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.
|
|
15
15
|
|
|
16
16
|

|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
- **Multi-question dialogs**
|
|
21
|
-
- **Preview pane**
|
|
22
|
-
- **Per-option notes**
|
|
23
|
-
- **Multi-select questions**
|
|
24
|
-
- **Submit tab**
|
|
25
|
-
- **Chat row on every tab**
|
|
26
|
-
- **"Other" free-text fallback**
|
|
27
|
-
- **Localized UI**
|
|
20
|
+
- **Multi-question dialogs** - ask several questions in one turn with a tab bar (`Tab` to switch).
|
|
21
|
+
- **Preview pane** - render an ASCII diagram, code snippet, or markdown next to each option, side-by-side or stacked depending on terminal width.
|
|
22
|
+
- **Per-option notes** - press `n` on a previewed option to attach a free-text note that travels back with the answer.
|
|
23
|
+
- **Multi-select questions** - checkboxes with `Space` to toggle, Enter-as-toggle on rows, a `Next` sentinel to advance, and toggles persisted across tab switches.
|
|
24
|
+
- **Submit tab** - review every answer before submitting; warns about unanswered questions and offers a Submit picker.
|
|
25
|
+
- **Chat row on every tab** - redirect the conversation without leaving the dialog.
|
|
26
|
+
- **"Other" free-text fallback** - type a custom answer when no option fits.
|
|
27
|
+
- **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.
|
|
28
28
|
|
|
29
29
|
## Screens
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ Let the model ask you structured clarifying questions instead of guessing. `rpiv
|
|
|
32
32
|
|---|---|
|
|
33
33
|
|  |  |
|
|
34
34
|
|  |  |
|
|
35
|
-
|  | |
|
|
36
36
|
|
|
37
37
|
## Install
|
|
38
38
|
|
|
@@ -44,17 +44,64 @@ Then restart your Pi session.
|
|
|
44
44
|
|
|
45
45
|
### Optional: localization
|
|
46
46
|
|
|
47
|
-
`rpiv-ask-user-question` works standalone
|
|
47
|
+
`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:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
pi install npm:@juicesharp/rpiv-i18n
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
With 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
|
|
53
|
+
With 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.
|
|
54
54
|
|
|
55
55
|
## Tool
|
|
56
56
|
|
|
57
|
-
- **`ask_user_question`**
|
|
57
|
+
- **`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.
|
|
58
|
+
|
|
59
|
+
### Schema
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
ask_user_question({
|
|
63
|
+
questions: [
|
|
64
|
+
{
|
|
65
|
+
question: string, // full question text, ends with "?"
|
|
66
|
+
header: string, // chip label, max 12 chars
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
label: string, // 1-5 words, max 60 chars
|
|
70
|
+
description: string, // explains the choice / its trade-off
|
|
71
|
+
preview?: string, // optional markdown shown next to options
|
|
72
|
+
},
|
|
73
|
+
// … 2-4 options total
|
|
74
|
+
],
|
|
75
|
+
multiSelect?: boolean, // default false
|
|
76
|
+
},
|
|
77
|
+
// … 1-4 questions total
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Reserved option labels (rejected at validation): `"Other"`, plus the runtime sentinels (`"Type something."`, `"Chat about this"`, `"Next →"`).
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
{
|
|
88
|
+
content: [{ type: "text", text: string }], // human-readable envelope or DECLINE_MESSAGE
|
|
89
|
+
details: {
|
|
90
|
+
answers: Array<{
|
|
91
|
+
questionIndex: number,
|
|
92
|
+
question: string,
|
|
93
|
+
kind: "option" | "custom" | "chat" | "multi",
|
|
94
|
+
answer: string | null,
|
|
95
|
+
selected?: string[], // present for multi-select
|
|
96
|
+
notes?: string, // free-text note, when typed
|
|
97
|
+
preview?: string, // echoed back when option carried a preview
|
|
98
|
+
}>,
|
|
99
|
+
cancelled: boolean,
|
|
100
|
+
error?: "no_ui" | "no_questions" | "empty_options" | "too_many_questions"
|
|
101
|
+
| "duplicate_question" | "duplicate_option_label" | "reserved_label",
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
58
105
|
|
|
59
106
|
## License
|
|
60
107
|
|
package/ask-user-question.ts
CHANGED
|
@@ -58,7 +58,7 @@ Preview content is rendered as markdown in a monospace box. Multi-line text with
|
|
|
58
58
|
`Use ask_user_question whenever the user's request is underspecified and you cannot proceed without concrete decisions — you can ask up to ${MAX_QUESTIONS} questions per invocation.`,
|
|
59
59
|
`Each question MUST have ${MIN_OPTIONS}-${MAX_OPTIONS} options. Every option requires a concise label (1-5 words) and a description explaining what the choice means or its trade-offs. The user can additionally type a custom answer ("Type something." row is appended automatically to single-select questions) or pick "Chat about this" to abandon the questionnaire.`,
|
|
60
60
|
`Set multiSelect: true when multiple answers are valid; this suppresses the "Type something." row. Provide an options[].preview markdown string when an option benefits from richer side-by-side context (mockups, code snippets, diagrams, configs) — single-select only. NOTE: any non-empty preview on a single-select question ALSO suppresses the "Type something." row (no room in the side-by-side layout); "Chat about this" remains the escape hatch. If you recommend a specific option, make it the first option and append "(Recommended)" to its label.`,
|
|
61
|
-
"
|
|
61
|
+
"Do not stack multiple ask_user_question calls back-to-back — group all clarifying questions into one invocation.",
|
|
62
62
|
],
|
|
63
63
|
parameters: QuestionParamsSchema,
|
|
64
64
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-ask-user-question",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Pi extension
|
|
3
|
+
"version": "1.1.5",
|
|
4
|
+
"description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"pi-extension",
|