@pi-unipi/unipi 3.0.0-alpha.5 → 3.0.0-alpha.7

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 (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +21 -21
  3. package/packages/ask-user/README.md +55 -107
  4. package/packages/ask-user/ask-ui.ts +306 -732
  5. package/packages/ask-user/clipboard.ts +50 -0
  6. package/packages/ask-user/config.ts +74 -78
  7. package/packages/ask-user/package.json +2 -2
  8. package/packages/ask-user/questions.ts +151 -0
  9. package/packages/ask-user/skills/ask-user/SKILL.md +59 -133
  10. package/packages/ask-user/tools.ts +179 -432
  11. package/packages/autocomplete/package.json +1 -1
  12. package/packages/background-tasks/package.json +2 -2
  13. package/packages/btw/package.json +2 -2
  14. package/packages/compactor/package.json +3 -3
  15. package/packages/compactor/src/compaction/source.ts +27 -8
  16. package/packages/core/index.ts +1 -0
  17. package/packages/core/package.json +1 -1
  18. package/packages/{utility → core}/src/attach/detect.ts +1 -1
  19. package/packages/footer/package.json +3 -3
  20. package/packages/fusion/package.json +3 -3
  21. package/packages/info-screen/package.json +2 -2
  22. package/packages/input-shortcuts/package.json +2 -2
  23. package/packages/kanboard/package.json +7 -7
  24. package/packages/long-horizon/package.json +2 -2
  25. package/packages/mcp/package.json +2 -2
  26. package/packages/memory/package.json +3 -3
  27. package/packages/notify/package.json +2 -2
  28. package/packages/skill-registry/package.json +2 -2
  29. package/packages/skill-registry/skills/brainstorm/SKILL.md +16 -13
  30. package/packages/skill-registry/skills/gather-context/SKILL.md +10 -8
  31. package/packages/skill-registry/skills/plan/SKILL.md +23 -20
  32. package/packages/skill-registry/skills/review-work/SKILL.md +10 -7
  33. package/packages/skill-registry/skills/work/SKILL.md +15 -12
  34. package/packages/subagents/package.json +2 -2
  35. package/packages/unipi/bundled.js +1107 -1451
  36. package/packages/updater/package.json +2 -2
  37. package/packages/utility/package.json +2 -2
  38. package/packages/utility/src/attach/index.ts +1 -1
  39. package/packages/watchdog/package.json +3 -3
  40. package/packages/web-api/package.json +2 -2
  41. package/packages/workflow/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.0.0-alpha.7] — 2026-09-28
10
+
11
+ ### Changed
12
+
13
+ - `ask-user`: `ask_user` is **off by default** (Settings → Ask User). When off, the agent is told to ask in its reply instead.
14
+
15
+ ## [3.0.0-alpha.6] — 2026-09-28
16
+
17
+ ### Changed
18
+
19
+ - `ask-user`: **rebuilt after Devin's question UI**. One `ask_user` call carries 1–4 questions (`questions: [{ header, question, options, multi_select }]`) with an automatic "Other" choice. Header chips show progress; digits pick; typing on "Other" needs no Enter and the text stays editable; ←→ switch questions; Enter moves on and submits on the last; unanswered questions are sent as skipped; `?` tells the agent you want to clarify first; Esc stops the turn. Pasted/dropped paths and Ctrl+V images in "Other" become `[Image #N]` / `[File #N]` and images reach the model. The transcript shows a short answer tree. The older single-question form is still accepted (`timeout` is ignored). Settings (/unipi:settings → Ask User): questions per call, what Esc does (stop the turn or send what's answered), whether number keys move on, "Other" agent-decided / always / never, and the "not ready" line — the old "allowed formats" switches are gone. Esc and `end_turn` options stop the turn cleanly instead of aborting it.
20
+
21
+ ### Fixed
22
+
23
+ - `ask-user`: several `ask_user` calls in one message opened their dialogs at the same time, so only the last was answerable and the turn hung forever; the tool now runs one call at a time.
24
+ - `compactor`: answers from multi-question `ask_user` results are kept as "question → answer" decisions.
25
+
9
26
  ## [3.0.0-alpha.5] — 2026-09-28
10
27
 
11
28
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/unipi",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.7",
4
4
  "description": "All-in-one extension suite for Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -83,26 +83,26 @@
83
83
  "typebox": "^1.1.38"
84
84
  },
85
85
  "dependencies": {
86
- "@pi-unipi/ask-user": "3.0.0-alpha.5",
87
- "@pi-unipi/background-tasks": "3.0.0-alpha.5",
88
- "@pi-unipi/btw": "3.0.0-alpha.5",
89
- "@pi-unipi/command-enchantment": "3.0.0-alpha.5",
90
- "@pi-unipi/compactor": "3.0.0-alpha.5",
91
- "@pi-unipi/core": "3.0.0-alpha.5",
92
- "@pi-unipi/footer": "3.0.0-alpha.5",
93
- "@pi-unipi/fusion": "3.0.0-alpha.5",
94
- "@pi-unipi/info-screen": "3.0.0-alpha.5",
95
- "@pi-unipi/input-shortcuts": "3.0.0-alpha.5",
96
- "@pi-unipi/kanboard": "3.0.0-alpha.5",
97
- "@pi-unipi/mcp": "3.0.0-alpha.5",
98
- "@pi-unipi/memory": "3.0.0-alpha.5",
99
- "@pi-unipi/notify": "3.0.0-alpha.5",
100
- "@pi-unipi/skill-registry": "3.0.0-alpha.5",
101
- "@pi-unipi/subagents": "3.0.0-alpha.5",
102
- "@pi-unipi/updater": "3.0.0-alpha.5",
103
- "@pi-unipi/utility": "3.0.0-alpha.5",
104
- "@pi-unipi/web-api": "3.0.0-alpha.5",
105
- "@pi-unipi/workflow": "3.0.0-alpha.5"
86
+ "@pi-unipi/ask-user": "3.0.0-alpha.7",
87
+ "@pi-unipi/background-tasks": "3.0.0-alpha.7",
88
+ "@pi-unipi/btw": "3.0.0-alpha.7",
89
+ "@pi-unipi/command-enchantment": "3.0.0-alpha.7",
90
+ "@pi-unipi/compactor": "3.0.0-alpha.7",
91
+ "@pi-unipi/core": "3.0.0-alpha.7",
92
+ "@pi-unipi/footer": "3.0.0-alpha.7",
93
+ "@pi-unipi/fusion": "3.0.0-alpha.7",
94
+ "@pi-unipi/info-screen": "3.0.0-alpha.7",
95
+ "@pi-unipi/input-shortcuts": "3.0.0-alpha.7",
96
+ "@pi-unipi/kanboard": "3.0.0-alpha.7",
97
+ "@pi-unipi/mcp": "3.0.0-alpha.7",
98
+ "@pi-unipi/memory": "3.0.0-alpha.7",
99
+ "@pi-unipi/notify": "3.0.0-alpha.7",
100
+ "@pi-unipi/skill-registry": "3.0.0-alpha.7",
101
+ "@pi-unipi/subagents": "3.0.0-alpha.7",
102
+ "@pi-unipi/updater": "3.0.0-alpha.7",
103
+ "@pi-unipi/utility": "3.0.0-alpha.7",
104
+ "@pi-unipi/web-api": "3.0.0-alpha.7",
105
+ "@pi-unipi/workflow": "3.0.0-alpha.7"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@earendil-works/pi-agent-core": "^0.87.1",
@@ -1,124 +1,72 @@
1
1
  # @pi-unipi/ask-user
2
2
 
3
- Structured user input for decision gates. When the agent needs you to pick between options — which database, which approach, which files to change — it calls `ask_user` instead of guessing.
3
+ The `ask_user` tool (off by default — enable it in `/unipi:settings` → Ask User): when the agent needs a decision from you, it asks 1–4 multiple-choice questions in one dialog and waits. Modelled on Devin's question UI.
4
4
 
5
- Three input modes: single-select (pick one), multi-select (toggle several), freeform (type your own). The agent presents the question, you answer, it continues.
6
-
7
- ## Commands
8
-
9
- Ask-user has no user commands. It's an agent tool package — the agent calls it when it needs input.
10
-
11
- ## Special Triggers
12
-
13
- All workflow skills detect ask-user and use it for decision gates. Instead of the agent deciding on its own, it presents options and waits for your input. This happens naturally during brainstorm, plan, work, and other skills when the agent faces ambiguity.
14
-
15
- For workflow handoffs, options can use `action: "new_session"` with a `prefill`. Selecting one opens a launcher where **Compact & run** queues the prefill after compaction (or a short fallback) and **Run directly** queues it immediately. If automatic queuing fails, the prefill is placed in the editor for you to submit manually.
16
-
17
- The bundled skill guides the agent to use `ask_user` for high-stakes decisions — architecture choices, database selection, naming decisions, anything with lasting impact.
18
-
19
- ## Agent Tool
20
-
21
- | Tool | Description |
22
- |------|-------------|
23
- | `ask_user` | Structured user input with options |
24
-
25
- ### Parameters
26
-
27
- | Parameter | Type | Default | Description |
28
- |-----------|------|---------|-------------|
29
- | `question` | string | required | The question to ask |
30
- | `context` | string? | — | Additional context shown before question |
31
- | `options` | array? | [] | Multiple-choice options |
32
- | `allowMultiple` | boolean? | false | Enable multi-select mode |
33
- | `allowFreeform` | boolean? | true | Allow freeform text input |
34
- | `timeout` | number? | — | Auto-dismiss after N ms |
35
-
36
- ### Example
37
-
38
- ```typescript
39
- ask_user({
40
- question: "Which database should we use?",
41
- options: [
42
- { label: "PostgreSQL", description: "Reliable, feature-rich" },
43
- { label: "SQLite", description: "Simple, serverless" },
44
- ],
45
- })
46
5
  ```
47
-
48
- ### `new_session` Handoffs
49
-
50
- ```typescript
51
- ask_user({
52
- question: "Continue with implementation?",
53
- options: [
54
- {
55
- label: "Proceed to work",
56
- value: "work",
57
- action: "new_session",
58
- prefill: "the implementation step specs:2026-05-06-feature-plan.md",
59
- },
60
- { label: "Done for now", value: "done", action: "end_turn" },
61
- ],
62
- allowFreeform: false,
63
- })
6
+ ── Planet ✓ · Foods 2 · Last book ─────────────────────────────────────
7
+ What was the last book you read?
8
+ Can't remember
9
+ Don't read books
10
+ ❭ Other (type your own)
11
+ └ Dune, cover: [Image #1]
12
+ [Image #1] red-cube.png · 570 KB
13
+ ───────────────────────────────────────────────────────────────────────
14
+ ↑↓ navigate · ↵ select · ctrl+v image · ←→ switch question · esc cancel
15
+ ? Not ready to answer, help me out!
64
16
  ```
65
17
 
66
- When the user chooses a `new_session` option:
67
-
68
- | Launcher choice | Behavior |
69
- |-----------------|----------|
70
- | 🧹 Compact & run | Starts context compaction, returns immediately, then queues/submits the prefill as a follow-up message from the compaction callback or a short fallback timer |
71
- | ▶ Run directly | Queues/submits the prefill immediately as a follow-up message |
72
- | ✕ Cancel | Cancels the handoff; no message is queued |
73
-
74
- The tool result is rendered as `queued compact → ...` or `queued direct → ...`. If automatic delivery fails, ask-user falls back to editor prefill and warns you to press Enter.
75
-
76
- ### History Expansion
18
+ ## Answering
77
19
 
78
- Completed `ask_user` calls stay readable in chat history. The collapsed result shows the selected answer; press Ctrl+O on the tool result to expand the original question, context, and options that were presented.
20
+ | Key | Action |
21
+ |-----|--------|
22
+ | `↑` `↓` | Move between options |
23
+ | `1`–`9` | Pick that option (single choice: picks and moves on; multi-select: toggles) |
24
+ | `space` | Toggle (multi-select) |
25
+ | `enter` | Select and go to the next question; on the last one, send everything |
26
+ | `←` `→`, `tab` | Switch question (in a non-empty "Other" they move the text cursor) |
27
+ | type | On "Other", just type — no Enter needed. The option numbers hide so digits are text |
28
+ | paste / drop / `ctrl+v` | In "Other": a pasted or dropped image/file path, or a clipboard image (Ctrl+V), becomes `[Image #N]` / `[File #N]`; images are sent to the model with your answer |
29
+ | `?` | Not ready to answer: the agent is told you want to clarify first |
30
+ | `esc` | Cancel and stop the agent's turn (or send what's answered — see Settings) |
79
31
 
80
- ### Keyboard Controls
32
+ Questions you leave unanswered are sent as **skipped** — skipping never blocks. The header chips show progress: `✓` answered, a number for multi-select picks.
81
33
 
82
- | Mode | Keys |
83
- |------|------|
84
- | Single-select | Up/Down navigate, Enter select, Esc cancel |
85
- | Multi-select | Up/Down navigate, Space toggle, Enter submit, Esc cancel |
86
- | Freeform | Type text, Enter submit, Esc back |
34
+ In the transcript the answers stay as a short tree (`● Asked user 3 questions` / `│ Planet: Mars` / `└ Last book: Dune`).
87
35
 
88
- ### TUI Display
36
+ ## For the agent
89
37
 
90
- **Single-select:**
91
- ```
92
- ─────────────────────────────
93
- Which approach should we use?
94
- ─────────────────────────────
95
- > Option A
96
- Option B
97
- Option C
98
- Type something...
99
-
100
- Up/Down navigate, Enter select, Esc cancel
101
- ─────────────────────────────
102
- ```
103
-
104
- **Multi-select:**
38
+ ```ts
39
+ ask_user({
40
+ questions: [{
41
+ header: "Database", // ≤16 chars, shown as a chip
42
+ question: "Which database should the service use?",
43
+ options: [ // 2–4; "Other" is added automatically
44
+ { label: "Postgres", description: "JSON columns, full-text search" },
45
+ { label: "SQLite", description: "Zero setup; single writer" },
46
+ ],
47
+ multi_select: false, // optional
48
+ other: true, // optional; false removes "Other"
49
+ }],
50
+ })
105
51
  ```
106
- ─────────────────────────────
107
- Which features to enable?
108
- ─────────────────────────────
109
- > [x] Logging
110
- [ ] Metrics
111
- [x] Tracing
112
- [ ] Type something...
113
52
 
114
- Up/Down navigate, Space toggle, Enter submit, Esc cancel
115
- ─────────────────────────────
116
- ```
53
+ The result is `User answered your questions:` followed by a JSON object keyed by question: `{ "selected": [...], "custom_text": "...", "skipped": false }`. Attached images follow as image content.
117
54
 
118
- ## Configurables
55
+ - Tool calls from one message run one at a time, so several `ask_user` calls can never hide each other (they used to: only the last dialog was answerable and the turn hung).
56
+ - Options can carry `action: "end_turn"` or `action: "new_session"` with a `prefill` — the workflow skills use these for handoffs; a launcher offers **Compact & run** or **Run directly**.
57
+ - The older single-question form (`question`, `context`, `options`, `allowMultiple`, `allowFreeform`) is still accepted; `timeout` is ignored — you answer in your own time.
58
+ - Inside a subagent the tool fails with instructions to report the question to the lead instead.
119
59
 
120
- Ask-user has no configuration. Input mode is determined by the `allowMultiple` and `allowFreeform` parameters the agent passes.
60
+ ## Settings
121
61
 
122
- ## License
62
+ `/unipi:settings` → Ask User (changes apply to the next question, no restart):
123
63
 
124
- MIT
64
+ | Setting | Default | What it does |
65
+ |---------|---------|--------------|
66
+ | Enable ask_user | **off** | Give the agent the tool; when off, the agent is told to ask in its reply instead |
67
+ | Notify when asked | on | Send a notification while the agent waits for you |
68
+ | Questions per call | 4 | How many questions one dialog may hold (1–4; the tool description updates in new sessions) |
69
+ | Esc | stop the agent's turn | Or: send what's answered, the rest as skipped |
70
+ | Number keys move on | on | In a single-choice question, 1–9 also goes to the next question |
71
+ | "Other" choice | agent decides | Or: always / never offer "Other (type your own)", whatever the agent asked for |
72
+ | "Not ready" line | on | Show "? Not ready to answer, help me out!" (the `?` key works either way) |