@tduyng/pi-ask 0.0.3 → 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 +21 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,52 +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
|
-
|
|
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
|
-
|
|
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.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
## Asking
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
| --- | --- |
|
|
17
|
-
| `question` | The question to ask |
|
|
18
|
-
| `guess` | Your best guess, one line of reasoning, shown in the dialog |
|
|
19
|
-
| `options` | Predefined choices, single select, plus a free-text escape |
|
|
16
|
+
One tool, up to four questions, each with `question`, optional `options` and optional `guess`.
|
|
20
17
|
|
|
21
18
|
```text
|
|
22
|
-
ask_user(questions: [
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
])
|
|
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
|
+
]})
|
|
26
22
|
```
|
|
27
23
|
|
|
28
|
-
|
|
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.
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
The transcript keeps two ways of not answering apart: `(cancelled)` for a dialog closed unanswered, `(skipped)` for a typed answer left blank.
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
## When to use it
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
Q: Which Windows surface first?
|
|
36
|
-
A: WSL first
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
A cancelled dialog records `(skipped)`, so the transcript shows a question that was asked and not answered rather than nothing at all.
|
|
40
|
-
|
|
41
|
-
## Without a UI
|
|
42
|
-
|
|
43
|
-
Headless, RPC, print, and subagent runs have nobody to answer. The tool says so once and tells the model to proceed on each question's stated guess and record it as an assumption.
|
|
44
|
-
|
|
45
|
-
That is why `guess` is worth writing even when you are at the keyboard: it is the fallback the model acts on when the dialog cannot open.
|
|
46
|
-
|
|
47
|
-
## Why not just ask in prose
|
|
48
|
-
|
|
49
|
-
pi core ships no question tool. Claude Code has `AskUserQuestion`, opencode ships its own, pi has none, so a model facing a fork falls back to a paragraph: a turn spent, a block that renders badly, and a question that reads as a guess rather than a choice.
|
|
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.
|
|
50
31
|
|
|
51
32
|
## Install
|
|
52
33
|
|
|
@@ -56,8 +37,10 @@ pi install npm:@tduyng/pi-ask
|
|
|
56
37
|
|
|
57
38
|
Local checkout: `pi install /path/to/dotfiles/pi/agent/extensions/pi-ask`
|
|
58
39
|
|
|
59
|
-
|
|
40
|
+
The schema costs 202 tokens a request. There are no hooks, no prompt text and no session entries.
|
|
60
41
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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.
|