@tduyng/pi-ask 0.0.2 → 0.0.4
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 +24 -31
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
# @tduyng/pi-ask
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`ask_user` puts a decision in front of a person: up to four questions, each with options and an optional stated guess, answered in a dialog and returned as a tool result in the same turn.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A model that hits a decision only a person can settle does one of two things. It guesses and writes the guess in prose, where it reads like a decision. Or it stops and asks in prose, which costs a request and usually gets "go ahead" because the question arrived without the options.
|
|
6
6
|
|
|
7
|
-
## The
|
|
7
|
+
## The guess field
|
|
8
8
|
|
|
9
|
-
`
|
|
9
|
+
`guess` takes one line of reasoning, so the model has to commit before it asks. That field does two jobs:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| `question` | The question to ask |
|
|
14
|
-
| `guess` | Your best guess, one line of reasoning, shown in the dialog |
|
|
15
|
-
| `options` | Predefined choices, single select, plus a free-text escape |
|
|
11
|
+
- The dialog highlights that answer, which makes the common case one keystroke.
|
|
12
|
+
- With no UI attached, such as in a subagent, a script or `pi -p`, the tool returns a plain message: proceed on each guess and record it as an assumption. The turn never waits for a person who is not there.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
ask_user(questions: [
|
|
19
|
-
{ question: "Which Windows surface first?", guess: "WSL gwt plus Windows Terminal",
|
|
20
|
-
options: ["WSL first", "native gwt.exe first", "both"] }
|
|
21
|
-
])
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
The dialog shows the guess under the question, so a wrong guess is corrected in one keystroke. The call blocks until every question is answered or cancelled.
|
|
14
|
+
## Asking
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
One tool, up to four questions, each with `question`, optional `options` and optional `guess`.
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
A: WSL first
|
|
18
|
+
```text
|
|
19
|
+
ask_user({questions: [
|
|
20
|
+
{question: "Which auth path?", options: ["session cookie", "bearer token"], guess: "session cookie, since the rest of the app uses it"}
|
|
21
|
+
]})
|
|
33
22
|
```
|
|
34
23
|
|
|
35
|
-
A
|
|
24
|
+
A question with `options` opens a select dialog with an extra "Other: type my answer" row. A question without options opens a text field.
|
|
36
25
|
|
|
37
|
-
|
|
26
|
+
The transcript keeps two ways of not answering apart: `(cancelled)` for a dialog closed unanswered, `(skipped)` for a typed answer left blank.
|
|
38
27
|
|
|
39
|
-
|
|
28
|
+
## When to use it
|
|
29
|
+
|
|
30
|
+
When the answer changes the design and the model would need correcting anyway, or when a guess belongs on the record before code is written. Not for confirmation, and not for something the request already settled.
|
|
40
31
|
|
|
41
32
|
## Install
|
|
42
33
|
|
|
@@ -44,10 +35,12 @@ Headless, RPC, print, and subagent runs have nobody to answer. The tool says so
|
|
|
44
35
|
pi install npm:@tduyng/pi-ask
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
Local checkout: `pi install /path/to/extensions/pi-ask`
|
|
38
|
+
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-ask`
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
The schema costs 202 tokens a request. There are no hooks, no prompt text and no session entries.
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
## Limits
|
|
43
|
+
|
|
44
|
+
- Four questions per call. A fifth means the model should ask a narrower one.
|
|
45
|
+
- Options are single select. Two questions model a multiple choice.
|
|
46
|
+
- The dialog blocks the turn until it is answered or cancelled.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tduyng/pi-ask",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Ask the user up to 4 questions and wait for the answer. One tool, 202 tokens a request.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
7
7
|
"pi-package",
|