@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.
Files changed (2) hide show
  1. package/README.md +21 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,52 +1,33 @@
1
1
  # @tduyng/pi-ask
2
2
 
3
- One tool that stops and waits. The model asks up to four questions, you answer with a keystroke, and the turn carries on instead of guessing.
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
- ## What it costs
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
- `ask_user` is 202 tokens a request, and it is the only thing this package adds. No system prompt block, no statusline, no background work.
7
+ ## The guess field
8
8
 
9
- The saving is the turns it removes. A model facing a fork it cannot resolve writes a paragraph of options, waits for you to answer, then re-reads that paragraph every turn after. One question in a dialog costs one exchange and leaves one short `Q:` and `A:` block in the transcript.
9
+ `guess` takes one line of reasoning, so the model has to commit before it asks. That field does two jobs:
10
10
 
11
- ## The tool
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
- `ask_user` takes `questions`, an array of at most four. Each question carries:
14
+ ## Asking
14
15
 
15
- | Field | Meaning |
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
- { question: "Which Windows surface first?", guess: "WSL gwt plus Windows Terminal",
24
- options: ["WSL first", "native gwt.exe first", "both"] }
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
- The guess sits under the question, so a wrong guess is corrected in one keystroke. The call blocks until every question is answered or cancelled.
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
- ## What lands in the transcript
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
- One `Q:` and `A:` block per question:
28
+ ## When to use it
33
29
 
34
- ```text
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
- ## Tests
40
+ The schema costs 202 tokens a request. There are no hooks, no prompt text and no session entries.
60
41
 
61
- ```bash
62
- bun test extensions/pi-ask
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tduyng/pi-ask",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
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",