@zhuxixi/pi-agent-board 0.12.1 → 0.13.1
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/CHANGELOG.md +36 -0
- package/README.md +29 -11
- package/docs/superpowers/plans/2026-10-21-issue-221-ask-user-question.md +198 -0
- package/docs/superpowers/plans/2026-10-23-issue-225-monotonic-foreground-state.md +450 -0
- package/docs/superpowers/plans/2026-10-23-issue-229-vim-jkl.md +449 -0
- package/docs/superpowers/plans/2026-10-23-issue-232-attach-bg-only-cells.md +153 -0
- package/docs/superpowers/plans/2026-10-23-lease-heartbeat-staleness.md +537 -0
- package/docs/superpowers/plans/2026-10-23-selected-row-highlight.md +405 -0
- package/docs/superpowers/plans/2026-10-24-issue-217-windows-pid-reuse-stopping.md +367 -0
- package/docs/superpowers/plans/2026-10-24-issue-230-warm-host-background-runs.md +806 -0
- package/docs/superpowers/plans/2026-10-24-issue-238-windows-process-identity-token.md +490 -0
- package/docs/superpowers/plans/2026-10-24-issue-241-coordinator-root-exit.md +461 -0
- package/docs/superpowers/plans/2026-10-25-issue-239-coordinator-replacement-identity.md +504 -0
- package/docs/superpowers/plans/2026-10-26-issue-245-key-hints-doc-sync.md +244 -0
- package/docs/superpowers/plans/2026-10-27-issue-172-fullscreen-selection-clear.md +344 -0
- package/docs/superpowers/plans/2026-10-27-issue-252-select-key-hints.md +209 -0
- package/docs/superpowers/plans/2026-10-28-issue-255-coordinator-endpoint-zombie.md +442 -0
- package/docs/superpowers/specs/2026-10-20-issue-221-ask-user-question-design.md +270 -0
- package/docs/superpowers/specs/2026-10-22-issue-225-monotonic-foreground-state-design.md +225 -0
- package/docs/superpowers/specs/2026-10-23-issue-229-vim-jkl-design.md +90 -0
- package/docs/superpowers/specs/2026-10-23-issue-232-attach-bg-only-cells-design.md +146 -0
- package/docs/superpowers/specs/2026-10-23-lease-heartbeat-staleness-design.md +271 -0
- package/docs/superpowers/specs/2026-10-23-selected-row-highlight-design.md +191 -0
- package/docs/superpowers/specs/2026-10-24-issue-217-windows-pid-reuse-stopping-design.md +334 -0
- package/docs/superpowers/specs/2026-10-24-issue-230-warm-host-background-runs-design.md +283 -0
- package/docs/superpowers/specs/2026-10-24-issue-238-windows-process-identity-token-design.md +286 -0
- package/docs/superpowers/specs/2026-10-24-issue-241-coordinator-root-exit-design.md +381 -0
- package/docs/superpowers/specs/2026-10-25-issue-239-coordinator-replacement-identity-design.md +331 -0
- package/docs/superpowers/specs/2026-10-26-issue-245-key-hints-doc-sync-design.md +72 -0
- package/docs/superpowers/specs/2026-10-27-issue-172-fullscreen-selection-clear-design.md +248 -0
- package/docs/superpowers/specs/2026-10-27-issue-252-select-key-hints-design.md +95 -0
- package/docs/superpowers/specs/2026-10-28-issue-255-coordinator-endpoint-zombie-design.md +380 -0
- package/package.json +3 -3
- package/runner/pty-runner.mjs +18 -22
- package/runner/state-coordinator.mjs +275 -31
- package/scripts/run-tests.mjs +375 -0
- package/src/core/background-runs.mjs +273 -0
- package/src/core/coordinator-client.mjs +346 -26
- package/src/core/diagnostics.mjs +24 -0
- package/src/core/events.mjs +16 -3
- package/src/core/foreground-projection-cache.mjs +99 -0
- package/src/core/host-coordination.mjs +117 -1
- package/src/core/launch.mjs +21 -1
- package/src/core/locks.mjs +176 -31
- package/src/core/pid.mjs +4 -2
- package/src/core/process-identity-probe.mjs +228 -0
- package/src/core/pty-scroll.mjs +8 -8
- package/src/core/state-commands.mjs +5 -1
- package/src/core/types.mjs +1 -0
- package/src/core/warm-host-sweeper.mjs +7 -2
- package/src/runtime/service.mjs +385 -73
- package/src/ui/dashboard.ts +55 -29
- package/src/ui/pty-attach.ts +57 -21
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,42 @@ conventional commits by `scripts/release_helper.mjs`. Entries are
|
|
|
5
5
|
forward-only: they begin with the first release after this file landed —
|
|
6
6
|
for earlier history, see the git log and the pull-request list.
|
|
7
7
|
|
|
8
|
+
## [0.13.1] - 2026-10-28
|
|
9
|
+
|
|
10
|
+
### Fixes
|
|
11
|
+
|
|
12
|
+
- **attach**: clear the fullscreen selection highlight after copy-on-release (issue #172) (#251)
|
|
13
|
+
- **coordinator**: self-supervise the endpoint and restore the #70 cleanup gate (issue #255) (#256)
|
|
14
|
+
|
|
15
|
+
### Changes
|
|
16
|
+
|
|
17
|
+
- **ui**: align SELECT hints, help overlay and ! wording with the handler (issue #252) (#253)
|
|
18
|
+
- sync key hints with the implemented bindings — peek footer, README ! rows, multi-select table (issue #245) (#249)
|
|
19
|
+
|
|
20
|
+
[0.13.1]: https://github.com/zhuxixi/pi-agent-board/compare/v0.13.0...v0.13.1
|
|
21
|
+
|
|
22
|
+
## [0.13.0] - 2026-10-26
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- **ui**: vim-style j/k/l board keys — j/k navigate, l attaches (issue #229) (#237)
|
|
27
|
+
- **ui**: paint the selected board row with selectedBg (issue #231) (#233)
|
|
28
|
+
|
|
29
|
+
### Fixes
|
|
30
|
+
|
|
31
|
+
- **coordinator**: verify lease identity before signalling (issue #239) (#247)
|
|
32
|
+
- **dashboard**: keep selected rows visible beside scroll markers (#226)
|
|
33
|
+
- **attach**: render cells that only carry a background (#235)
|
|
34
|
+
- **coordinator**: root-vanished self-exit and suite leak gate (issue #241) (#244)
|
|
35
|
+
- **host**: unify process identity tokens and produce them on win32 (issue #238) (#243)
|
|
36
|
+
- **host**: keep warm hosts alive while a background workflow run is active (issue #230) (#242)
|
|
37
|
+
- **host**: corroborate unverified process identity to unstick pid-reuse recovery (issue #217) (#240)
|
|
38
|
+
- **lease**: reclaim stale coordinator leases by heartbeat instead of pid liveness (issue #224) (#236)
|
|
39
|
+
- keep foreground rows monotonic across out-of-order state writes (#228)
|
|
40
|
+
- recognize ask_user_question and questionnaire-shaped tools as pending questions (#223)
|
|
41
|
+
|
|
42
|
+
[0.13.0]: https://github.com/zhuxixi/pi-agent-board/compare/v0.12.1...v0.13.0
|
|
43
|
+
|
|
8
44
|
## [0.12.1] - 2026-10-20
|
|
9
45
|
|
|
10
46
|
### Fixes
|
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ Session actions are deliberately confirmation-aware:
|
|
|
117
117
|
- `h` toggles the on-hold state (manual verdict — automated writers are fenced).
|
|
118
118
|
- Press `x`, then `y` to confirm deleting the selected row. `Ctrl+X` twice quickly still deletes without confirmation. Archiving removes the row from the board but preserves its underlying Pi session file.
|
|
119
119
|
- `X` archives inactive rows in the selected state; live work is skipped.
|
|
120
|
-
- `m` enters multi-select mode
|
|
120
|
+
- `m` enters multi-select mode; see [Multi-select](#multi-select) for its keys.
|
|
121
121
|
|
|
122
122
|
## Views and Actions
|
|
123
123
|
|
|
@@ -127,10 +127,10 @@ Shortcuts are scoped to the view where they are available:
|
|
|
127
127
|
|
|
128
128
|
| Key | Action |
|
|
129
129
|
| --- | --- |
|
|
130
|
-
| `Up` / `Down` | Move the selection. |
|
|
130
|
+
| `Up` / `Down` / `j` / `k` | Move the selection. |
|
|
131
131
|
| `i` | Enter INSERT mode for a new task. |
|
|
132
132
|
| `Enter` | Open Start session for a draft, or attach/resume when the input is empty. |
|
|
133
|
-
| `Right` / `>` | Attach to the selected session. |
|
|
133
|
+
| `Right` / `>` / `l` | Attach to the selected session. |
|
|
134
134
|
| `Space` | Open Peek. |
|
|
135
135
|
| `v` | Open the read-only transcript. |
|
|
136
136
|
| `e` | Open Evidence / Diagnostics. |
|
|
@@ -145,10 +145,26 @@ Shortcuts are scoped to the view where they are available:
|
|
|
145
145
|
| `Ctrl+X` twice quickly | Archive/delete the selected row without confirmation. |
|
|
146
146
|
| `X` | Delete inactive rows in the selected state. |
|
|
147
147
|
| `m` | Enter multi-select mode. |
|
|
148
|
-
| `!` | Open node-pty diagnostics and
|
|
148
|
+
| `!` | Open node-pty diagnostics and fix steps. |
|
|
149
149
|
| `?` | Open the help overlay. |
|
|
150
150
|
| `Esc` | Clear a draft, or exit when the input is empty. |
|
|
151
151
|
|
|
152
|
+
### Multi-select
|
|
153
|
+
|
|
154
|
+
Press `m` in the main list to act on several sessions at once.
|
|
155
|
+
|
|
156
|
+
| Key | Action |
|
|
157
|
+
| --- | --- |
|
|
158
|
+
| `Up` / `Down` / `j` / `k` | Move the selection. |
|
|
159
|
+
| `Space` | Toggle the current row. |
|
|
160
|
+
| `a` | Select all visible rows. |
|
|
161
|
+
| `u` | Clear the selection. |
|
|
162
|
+
| `d` | Confirm marking the selected inactive rows Done. |
|
|
163
|
+
| `Ctrl+X` | Delete the selected Done rows (confirmation prompt). |
|
|
164
|
+
| `m` / `Esc` / `Ctrl+C` | Leave multi-select mode. |
|
|
165
|
+
| `?` | Open the help overlay. |
|
|
166
|
+
| `!` | Open node-pty diagnostics and fix steps. |
|
|
167
|
+
|
|
152
168
|
### Peek
|
|
153
169
|
|
|
154
170
|
Peek shows the selected session's summary, blocker or question, latest output, and available issue/PR references.
|
|
@@ -156,12 +172,13 @@ Peek shows the selected session's summary, blocker or question, latest output, a
|
|
|
156
172
|
| Key | Action |
|
|
157
173
|
| --- | --- |
|
|
158
174
|
| `r` or `Enter` | Enter reply mode; type a follow-up and press `Enter` to send it without attaching. |
|
|
159
|
-
| `a`, `Right`, or
|
|
175
|
+
| `a`, `Right`, `>`, or `l` | Attach to the session. |
|
|
160
176
|
| `v` | Open the read-only transcript. |
|
|
161
177
|
| `e` | Open Evidence / Diagnostics. |
|
|
162
178
|
| `d` | Confirm marking the inactive session Done. |
|
|
163
179
|
| `h` | Hold or unhold the session. |
|
|
164
|
-
|
|
|
180
|
+
| `!` | Open node-pty diagnostics and fix steps. |
|
|
181
|
+
| `Up` / `Down` / `j` / `k` | Move to the previous or next session. |
|
|
165
182
|
| `Esc` | Return to the main list. |
|
|
166
183
|
|
|
167
184
|
When a Pi question or questionnaire tool is pending, inline reply is rejected; attach to answer that interactive question in the real Pi session.
|
|
@@ -172,7 +189,7 @@ The `v` view is a read-only projection of the durable Pi session JSONL. It does
|
|
|
172
189
|
|
|
173
190
|
| Key | Action |
|
|
174
191
|
| --- | --- |
|
|
175
|
-
| `Up` / `Down` | Scroll one line. |
|
|
192
|
+
| `Up` / `Down` / `j` / `k` | Scroll one line. |
|
|
176
193
|
| `PageUp` / `PageDown` | Scroll one page. |
|
|
177
194
|
| `Space` | Open Peek. |
|
|
178
195
|
| `r` | Enter reply mode. |
|
|
@@ -180,6 +197,7 @@ The `v` view is a read-only projection of the durable Pi session JSONL. It does
|
|
|
180
197
|
| `e` | Open Evidence / Diagnostics. |
|
|
181
198
|
| `d` | Confirm marking the inactive session Done. |
|
|
182
199
|
| `h` | Hold or unhold the session. |
|
|
200
|
+
| `!` | Open node-pty diagnostics and fix steps. |
|
|
183
201
|
| `Left` / `Esc` / `<` | Return to the main list. |
|
|
184
202
|
|
|
185
203
|
### Evidence / Diagnostics
|
|
@@ -188,11 +206,11 @@ The `e` view shows durable session evidence, including changed files, commands a
|
|
|
188
206
|
|
|
189
207
|
| Key | Action |
|
|
190
208
|
| --- | --- |
|
|
191
|
-
| `Up` / `Down` | Scroll one line. |
|
|
209
|
+
| `Up` / `Down` / `j` / `k` | Scroll one line. |
|
|
192
210
|
| `PageUp` / `PageDown` | Scroll one page. |
|
|
193
211
|
| `r` | Enter reply mode. |
|
|
194
212
|
| `v` | Open the read-only transcript. |
|
|
195
|
-
| `Enter`, `a`, or `
|
|
213
|
+
| `Enter`, `a`, `Right`, or `l` | Attach to the session. |
|
|
196
214
|
| `x` | Clear diagnostics; evidence is preserved. |
|
|
197
215
|
| `Left` / `Esc` / `<` | Return to the main list. |
|
|
198
216
|
|
|
@@ -268,7 +286,7 @@ For internal code platforms (non-github/gitlab hosts) or custom CLIs, add a per-
|
|
|
268
286
|
|
|
269
287
|
## Attach and Fallback Behavior
|
|
270
288
|
|
|
271
|
-
When PTY support is healthy, Agent Board uses an interactive PTY host for attach and start-and-attach. If PTY support is unavailable, eligible managed sessions can still run in the background through the JSON runner; start-and-attach falls back to background launch with a warning. Adopted external foreground sessions require PTY to continue safely. Press `!` in the dashboard for diagnosis and
|
|
289
|
+
When PTY support is healthy, Agent Board uses an interactive PTY host for attach and start-and-attach. If PTY support is unavailable, eligible managed sessions can still run in the background through the JSON runner; start-and-attach falls back to background launch with a warning. Adopted external foreground sessions require PTY to continue safely. Press `!` in the dashboard for diagnosis and fix steps.
|
|
272
290
|
|
|
273
291
|
On Windows, PTY host control uses a named pipe and spawned child console windows are hidden. Terminal behavior can still vary between terminal emulators.
|
|
274
292
|
|
|
@@ -347,7 +365,7 @@ The command should emit an assistant reply, then an `agent_end` event, and exit.
|
|
|
347
365
|
|
|
348
366
|
### `node-pty unavailable`
|
|
349
367
|
|
|
350
|
-
Press `!` in the dashboard to open the diagnostic panel and follow its
|
|
368
|
+
Press `!` in the dashboard to open the diagnostic panel and follow its fix steps. Common causes include a missing native `node-pty` binary, a Node/architecture mismatch, a missing or non-executable macOS `spawn-helper`, or macOS quarantine. You can temporarily set `AGENT_BOARD_DISABLE_PTY=1` to use background JSON-runner behavior where supported.
|
|
351
369
|
|
|
352
370
|
### Attach is slow or keeps reconnecting
|
|
353
371
|
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Recognize `ask_user_question` (name OR questionnaire shape) Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Make an interactive run blocked on `ask_user_question` — or on any tool using the questionnaire arg shape — group under "Needs answer" instead of "RUNNING".
|
|
6
|
+
|
|
7
|
+
**Architecture:** Two private helpers in `src/core/events.mjs` (`isQuestionArgShape`, `isQuestionToolCall`); the start gate uses `isQuestionToolCall(name, args)`, the end gate becomes name-agnostic and removes by `toolCallId`. Two reducer tests in `test/events.test.mjs` drive the public surface (`createRunStatus` / `reduceEvent` / `projectViewState`).
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Node 22, `node:test` + `assert/strict`, plain ESM `.mjs` (no build step).
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-10-20-issue-221-ask-user-question-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Tabs for indentation; English comments and commit messages.
|
|
16
|
+
- Conventional commit subject with the PR number appended as `(#N)` (this branch's PR number is filled in at PR time; use `(#221)` for the issue-numbered commits that predate the PR).
|
|
17
|
+
- Run `npm run verify` before claiming completion — `npm test` alone skips the perf gate and coverage thresholds.
|
|
18
|
+
- Do not touch `detectNeedsInput()`, `message_end` classification, or the `"ask_questions"` no-id fallback ids (`events.mjs:242/250`).
|
|
19
|
+
- Detached (non-interactive) runs must keep the legacy `currentTool` behavior.
|
|
20
|
+
|
|
21
|
+
## Review Focus
|
|
22
|
+
|
|
23
|
+
- A tool whose args are `{ questions: [] }` or `{ questions: "…" }` must **not** be treated as awaiting input (shape check needs a non-empty array whose first item has a string `question`).
|
|
24
|
+
- Detached runs: the shape fallback must never produce `needs_input` (headless sessions cannot answer).
|
|
25
|
+
- Parallel calls: ending one question must not clear another pending one (existing multi-question test at `test/events.test.mjs:135`).
|
|
26
|
+
- An end event for a non-question tool must be a no-op for `pendingQuestions`.
|
|
27
|
+
- `args` missing entirely on a question-tool start (`ask_questions` with `{}`) must still count via the name set.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Task 1: Hybrid question-tool detection
|
|
32
|
+
|
|
33
|
+
**Files:**
|
|
34
|
+
- Modify: `src/core/events.mjs:20-21` (set), `:86` (start gate), `:100` (end gate), add helpers near `questionFromArgs` (`:232`)
|
|
35
|
+
- Test: `test/events.test.mjs` (append after the existing `interactive pi question tool …` test at `:185-204`)
|
|
36
|
+
|
|
37
|
+
**Interfaces:**
|
|
38
|
+
- Consumes: `createRunStatus(config, pid, now)`, `reduceEvent(status, event, now, opts)`, `projectViewState(status, now)` from `src/core/events.mjs`.
|
|
39
|
+
- Produces: module-private `isQuestionArgShape(args: unknown): boolean` and `isQuestionToolCall(name: string, args: unknown): boolean`; no exports change.
|
|
40
|
+
|
|
41
|
+
- [ ] **Step 1: Write the failing tests**
|
|
42
|
+
|
|
43
|
+
Append to `test/events.test.mjs`:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
test("interactive ask_user_question waits for input and clears on end", () => {
|
|
47
|
+
const s = createRunStatus(cfg(), 1, 1000);
|
|
48
|
+
reduceEvent(s, {
|
|
49
|
+
type: "tool_execution_start",
|
|
50
|
+
toolCallId: "q1",
|
|
51
|
+
toolName: "ask_user_question",
|
|
52
|
+
args: { questions: [{ question: "Which approach?", header: "Approach", options: [{ label: "A", description: "a" }] }] },
|
|
53
|
+
}, 2000, { interactive: true });
|
|
54
|
+
assert.equal(s.semanticState, "needs_input");
|
|
55
|
+
assert.equal(s.summary, "Which approach?");
|
|
56
|
+
assert.equal(s.question, "Which approach?");
|
|
57
|
+
assert.equal(s.currentTool, null);
|
|
58
|
+
assert.deepEqual(s.pendingQuestions, [{ toolCallId: "q1", question: "Which approach?" }]);
|
|
59
|
+
assert.equal(projectViewState(s, 2100).needsInput, true);
|
|
60
|
+
|
|
61
|
+
reduceEvent(s, { type: "tool_execution_end", toolCallId: "q1", toolName: "ask_user_question", isError: false }, 2400, { interactive: true });
|
|
62
|
+
assert.equal(s.semanticState, "working");
|
|
63
|
+
assert.equal(s.question, null);
|
|
64
|
+
assert.deepEqual(s.pendingQuestions, []);
|
|
65
|
+
|
|
66
|
+
const detached = createRunStatus(cfg(), 1, 1000);
|
|
67
|
+
reduceEvent(detached, {
|
|
68
|
+
type: "tool_execution_start",
|
|
69
|
+
toolCallId: "q1",
|
|
70
|
+
toolName: "ask_user_question",
|
|
71
|
+
args: { questions: [{ question: "Which approach?" }] },
|
|
72
|
+
}, 2000);
|
|
73
|
+
assert.equal(detached.semanticState, "working");
|
|
74
|
+
assert.equal(detached.currentTool.name, "ask_user_question");
|
|
75
|
+
assert.deepEqual(detached.pendingQuestions, []);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("interactive unknown questionnaire shape is treated as a pending question", () => {
|
|
79
|
+
const s = createRunStatus(cfg(), 1, 1000);
|
|
80
|
+
reduceEvent(s, {
|
|
81
|
+
type: "tool_execution_start",
|
|
82
|
+
toolCallId: "q1",
|
|
83
|
+
toolName: "mystery_questionnaire",
|
|
84
|
+
args: { questions: [{ question: "Ship it?", header: "Release", options: [{ label: "Yes" }] }] },
|
|
85
|
+
}, 2000, { interactive: true });
|
|
86
|
+
assert.equal(s.semanticState, "needs_input");
|
|
87
|
+
assert.equal(s.question, "Ship it?");
|
|
88
|
+
assert.equal(s.currentTool, null);
|
|
89
|
+
assert.deepEqual(s.pendingQuestions, [{ toolCallId: "q1", question: "Ship it?" }]);
|
|
90
|
+
|
|
91
|
+
reduceEvent(s, { type: "tool_execution_end", toolCallId: "q1", toolName: "mystery_questionnaire", isError: false }, 2400, { interactive: true });
|
|
92
|
+
assert.equal(s.semanticState, "working");
|
|
93
|
+
assert.equal(s.question, null);
|
|
94
|
+
assert.deepEqual(s.pendingQuestions, []);
|
|
95
|
+
|
|
96
|
+
for (const args of [{ questions: [] }, { questions: "nope" }, { command: "ls" }]) {
|
|
97
|
+
const negative = createRunStatus(cfg(), 1, 1000);
|
|
98
|
+
reduceEvent(negative, { type: "tool_execution_start", toolCallId: "t1", toolName: "bash", args }, 2000, { interactive: true });
|
|
99
|
+
assert.equal(negative.semanticState, "working", JSON.stringify(args));
|
|
100
|
+
assert.deepEqual(negative.pendingQuestions, []);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- [ ] **Step 2: Run the tests to verify they fail**
|
|
106
|
+
|
|
107
|
+
Run: `npm test -- --test-name-pattern="ask_user_question|unknown questionnaire"`
|
|
108
|
+
Expected: FAIL — the first test reports `semanticState === "working"` / `summary === "Ask_user_question"`; the second reports `semanticState === "working"` for `mystery_questionnaire`.
|
|
109
|
+
|
|
110
|
+
- [ ] **Step 3: Implement the detection helpers**
|
|
111
|
+
|
|
112
|
+
In `src/core/events.mjs`, replace the set definition:
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
/** Tool names whose interactive execution blocks on a user answer. */
|
|
116
|
+
const QUESTION_TOOL_NAMES = new Set(["ask_user_question", "ask_questions", "question", "questionnaire"]);
|
|
117
|
+
|
|
118
|
+
/** Questionnaire args shared by pi/Claude-Code style question tools. */
|
|
119
|
+
function isQuestionArgShape(args) {
|
|
120
|
+
const questions = Array.isArray(args?.questions) ? args.questions : null;
|
|
121
|
+
return Boolean(questions && questions.length > 0 && typeof questions[0]?.question === "string");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** A start event is a question when its name is known or its args carry the questionnaire shape. */
|
|
125
|
+
function isQuestionToolCall(name, args) {
|
|
126
|
+
return QUESTION_TOOL_NAMES.has(name) || isQuestionArgShape(args);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- [ ] **Step 4: Wire the start and end gates**
|
|
131
|
+
|
|
132
|
+
In the `tool_execution_start` case, replace
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
if (opts.interactive && QUESTION_TOOL_NAMES.has(name)) {
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
with
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
if (opts.interactive && isQuestionToolCall(name, args)) {
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
In the `tool_execution_end` case, replace
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
if (opts.interactive && QUESTION_TOOL_NAMES.has(event.toolName ?? "")) removePendingQuestion(status, event.toolCallId);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
with
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
// The end event carries no args, so a shape-matched start cannot be recognized here;
|
|
154
|
+
// remove by call id instead (a no-op when this call had no pending question).
|
|
155
|
+
if (opts.interactive) removePendingQuestion(status, event.toolCallId);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- [ ] **Step 5: Run the reducer tests and the whole suite**
|
|
159
|
+
|
|
160
|
+
Run: `npm test`
|
|
161
|
+
Expected: PASS — the two new tests plus the existing `ask_questions` / `question` / `questionnaire` / parallel-question tests stay green. (A1–A4, A5–A7)
|
|
162
|
+
|
|
163
|
+
- [ ] **Step 6: Run the full gate**
|
|
164
|
+
|
|
165
|
+
Run: `npm run verify`
|
|
166
|
+
Expected: PASS — typecheck, perf gate, tests, coverage thresholds (85/80/70), pack dry-run. (A8)
|
|
167
|
+
|
|
168
|
+
- [ ] **Step 7: Commit**
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
git add src/core/events.mjs test/events.test.mjs
|
|
172
|
+
git commit -m "fix: recognize ask_user_question and questionnaire-shaped tools as pending questions (#221)"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Task 2: Post-merge live verification (manual, not a code task)
|
|
178
|
+
|
|
179
|
+
**Files:** none.
|
|
180
|
+
|
|
181
|
+
- [ ] **Step 1: Update the board clone the running process loads**
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cd ~/.pi/agent/git/github.com/zhuxixi/pi-agent-board
|
|
185
|
+
git checkout -- package-lock.json
|
|
186
|
+
git pull
|
|
187
|
+
git log -1 --oneline
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Expected: HEAD is the merged commit from this branch.
|
|
191
|
+
|
|
192
|
+
- [ ] **Step 2: Restart Pi / the board service**, then open the dashboard.
|
|
193
|
+
|
|
194
|
+
- [ ] **Step 3: Dispatch a session that blocks on `ask_user_question`** (the `@juicesharp/rpiv-ask-user-question` extension is installed at user level), answer it via attach.
|
|
195
|
+
|
|
196
|
+
Expected: the row sits under **Needs answer** with the question text as summary; after answering it returns to **RUNNING**. (U1)
|
|
197
|
+
|
|
198
|
+
If the merge has not happened yet, record U1 as `pending` — do not mark it passed.
|