@zhuxixi/pi-agent-board 0.4.3 → 0.5.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.
Files changed (39) hide show
  1. package/PROGRESS.md +18 -3
  2. package/README.md +295 -72
  3. package/VERIFY.md +3 -3
  4. package/docs/PTY_ATTACH_IMPLEMENTATION_PLAN.md +3 -3
  5. package/docs/superpowers/plans/2026-08-29-code-refs-badges.md +223 -0
  6. package/docs/superpowers/plans/2026-08-30-circular-navigation.md +308 -0
  7. package/docs/superpowers/plans/2026-08-30-post-exit-timing-fix.md +37 -0
  8. package/docs/superpowers/plans/2026-08-30-pty-attach-quality-debt.md +311 -0
  9. package/docs/superpowers/plans/2026-08-30-readme-v2.md +294 -0
  10. package/docs/superpowers/specs/2026-08-21-attach-coldstart-jiggle-rearm-design.md +4 -0
  11. package/docs/superpowers/specs/2026-08-22-jiggle-shrink-and-hold-design.md +4 -0
  12. package/docs/superpowers/specs/2026-08-29-code-refs-badges-design.md +128 -0
  13. package/docs/superpowers/specs/2026-08-30-circular-navigation-design.md +47 -0
  14. package/docs/superpowers/specs/2026-08-30-eprm-atomicwrite-race-design.md +77 -0
  15. package/docs/superpowers/specs/2026-08-30-post-exit-timing-fix-design.md +80 -0
  16. package/docs/superpowers/specs/2026-08-30-pty-attach-quality-debt-design.md +105 -0
  17. package/docs/superpowers/specs/2026-08-30-readme-v2-design.md +115 -0
  18. package/package.json +1 -1
  19. package/runner/job-runner.mjs +29 -3
  20. package/runner/pty-runner.mjs +139 -25
  21. package/runner/state-runner.mjs +7 -2
  22. package/runner/title-runner.mjs +1 -1
  23. package/src/core/atomic.mjs +40 -1
  24. package/src/core/code-refs-store.mjs +315 -0
  25. package/src/core/code-refs.mjs +861 -0
  26. package/src/core/host-crash.mjs +39 -0
  27. package/src/core/launch.mjs +6 -0
  28. package/src/core/paths.mjs +24 -1
  29. package/src/core/pty-attach-jiggle-controller.mjs +71 -17
  30. package/src/core/pty-attach-reconnect.mjs +43 -0
  31. package/src/core/pty-scroll.mjs +4 -3
  32. package/src/core/repo.mjs +56 -0
  33. package/src/core/rows.mjs +50 -0
  34. package/src/core/store.mjs +4 -1
  35. package/src/core/types.mjs +12 -0
  36. package/src/core/worktree.mjs +1 -0
  37. package/src/runtime/service.mjs +7 -1
  38. package/src/ui/dashboard.ts +20 -4
  39. package/src/ui/pty-attach.ts +124 -27
@@ -0,0 +1,311 @@
1
+ # pty-attach.ts Legacy Quality Debt Cleanup — 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:** Clear the 10 legacy quality issues in `src/ui/pty-attach.ts` flagged by issue #8 — document 9 intentional empty catches, add a SAFETY comment to 1 as-cast, drop 1 unused parameter. Zero behavior change.
6
+
7
+ **Architecture:** Single-file comment/signature cleanup. Empty catches are expanded to the repo's documented-catch house style (see `dashboard.ts` precedent); the as-cast gets an invariant comment; `project()` loses its unused `width` parameter. Existing test suite is the regression net — no new tests (no behavior change to test).
8
+
9
+ **Tech Stack:** TypeScript (strict), `node --test`, tab indentation.
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-08-30-pty-attach-quality-debt-design.md`
12
+
13
+ ## Global Constraints
14
+
15
+ - Touch ONLY `src/ui/pty-attach.ts` (plus this plan file's checkboxes).
16
+ - Zero behavior change: no logic added/removed except the parameter deletion and its call-site argument.
17
+ - Indentation is TABS. Comment style: expand `} catch {}` to multi-line with the comment INSIDE the braces, exactly like `dashboard.ts` (`} catch {` / `\t/* best effort: ... */` / `}`).
18
+ - Locate sites by method name, not line number (lines drift).
19
+ - `git add` per file only; NEVER `git add -A` (main checkout has untracked files that must not be swept — the worktree is clean, but keep the habit).
20
+ - Run all commands from the worktree root: `/home/elling/git-repo/github/pi-agent-board/.pi/worktrees/issue-8-pty-attach-quality-debt`
21
+
22
+ ---
23
+
24
+ ### Task 1: Document the 9 empty catches + the as-cast invariant
25
+
26
+ **Files:**
27
+ - Modify: `src/ui/pty-attach.ts` (9 catch sites + 1 as-cast site, by method)
28
+
29
+ **Interfaces:** none changed (comments only).
30
+
31
+ There are exactly 9 single-line `} catch {}` sites in the file. Each becomes a 3-line documented catch. The edits, by method (old → new). Match surrounding context exactly; indentation is tabs.
32
+
33
+ 1. `enableMouseScroll()` — inside `try { this.tui.terminal.write(XTSHIFTESCAPE_SELECT); this.tui.terminal.write(MOUSE_ENABLE); }`:
34
+
35
+ ```ts
36
+ // OLD
37
+ } catch {}
38
+ }
39
+
40
+ private mouseScrollEnabled(): boolean {
41
+ // NEW
42
+ } catch {
43
+ /* best-effort: some terminals reject these sequences; mouse reporting is optional */
44
+ }
45
+ }
46
+
47
+ private mouseScrollEnabled(): boolean {
48
+ ```
49
+
50
+ 2. `disableMouseScroll()`:
51
+
52
+ ```ts
53
+ // OLD
54
+ private disableMouseScroll(): void {
55
+ try {
56
+ this.tui.terminal.write(MOUSE_DISABLE);
57
+ } catch {}
58
+ }
59
+ // NEW
60
+ private disableMouseScroll(): void {
61
+ try {
62
+ this.tui.terminal.write(MOUSE_DISABLE);
63
+ } catch {
64
+ /* best-effort: terminal may already be gone at teardown */
65
+ }
66
+ }
67
+ ```
68
+
69
+ 3. `copySelectionToClipboard()` — the OSC52 write:
70
+
71
+ ```ts
72
+ // OLD
73
+ if (seq) {
74
+ try {
75
+ this.tui.terminal.write(seq);
76
+ } catch {}
77
+ }
78
+ // NEW
79
+ if (seq) {
80
+ try {
81
+ this.tui.terminal.write(seq);
82
+ } catch {
83
+ /* best-effort: OSC52 clipboard support is optional */
84
+ }
85
+ }
86
+ ```
87
+
88
+ 4. `pastePrimarySelection()` — inner timer kill:
89
+
90
+ ```ts
91
+ // OLD
92
+ const timer = setTimeout(() => {
93
+ try {
94
+ child.kill("SIGKILL");
95
+ } catch {}
96
+ }, 800);
97
+ // NEW
98
+ const timer = setTimeout(() => {
99
+ try {
100
+ child.kill("SIGKILL");
101
+ } catch {
102
+ /* the child may have already exited before the timeout fired */
103
+ }
104
+ }, 800);
105
+ ```
106
+
107
+ 5. `pastePrimarySelection()` — outer catch, at end of method (the `} catch {}` right before the method's closing `}`):
108
+
109
+ ```ts
110
+ // OLD
111
+ child.on("close", () => {
112
+ clearTimeout(timer);
113
+ if (!this.closed && out) this.send({ type: "input", data: out });
114
+ });
115
+ } catch {}
116
+ }
117
+ // NEW
118
+ child.on("close", () => {
119
+ clearTimeout(timer);
120
+ if (!this.closed && out) this.send({ type: "input", data: out });
121
+ });
122
+ } catch {
123
+ /* silent no-op when xclip is absent — documented contract of this helper */
124
+ }
125
+ }
126
+ ```
127
+
128
+ 6. `writePrimarySelection()`:
129
+
130
+ ```ts
131
+ // OLD
132
+ child.stdin?.on("error", () => {});
133
+ child.on("error", () => {});
134
+ child.stdin?.end(text);
135
+ } catch {}
136
+ }
137
+ // NEW
138
+ child.stdin?.on("error", () => {});
139
+ child.on("error", () => {});
140
+ child.stdin?.end(text);
141
+ } catch {
142
+ /* silent no-op when xclip is absent */
143
+ }
144
+ }
145
+ ```
146
+
147
+ 7. `forwardTerminalProtocols()` — the per-sequence write loop:
148
+
149
+ ```ts
150
+ // OLD
151
+ for (const seq of toWrite) {
152
+ try {
153
+ this.tui.terminal.write(seq);
154
+ } catch {}
155
+ }
156
+ // NEW
157
+ for (const seq of toWrite) {
158
+ try {
159
+ this.tui.terminal.write(seq);
160
+ } catch {
161
+ /* best-effort: forwarded sequences are enhancements, never critical */
162
+ }
163
+ }
164
+ ```
165
+
166
+ 8. `replayScreenLog()` — outer catch at end of method:
167
+
168
+ ```ts
169
+ // OLD
170
+ } finally {
171
+ closeSync(fd);
172
+ }
173
+ } catch {}
174
+ }
175
+ // NEW
176
+ } finally {
177
+ closeSync(fd);
178
+ }
179
+ } catch {
180
+ /* best-effort: a missing or racing screen.log must not block attach */
181
+ }
182
+ }
183
+ ```
184
+
185
+ 9. `close()` — socket destroy:
186
+
187
+ ```ts
188
+ // OLD
189
+ try {
190
+ this.socket?.destroy();
191
+ } catch {}
192
+ this.socket = null;
193
+ // NEW
194
+ try {
195
+ this.socket?.destroy();
196
+ } catch {
197
+ /* best-effort teardown: socket may already be destroyed */
198
+ }
199
+ this.socket = null;
200
+ ```
201
+
202
+ 10. `currentSize()` — SAFETY comment above the as-cast:
203
+
204
+ ```ts
205
+ // OLD
206
+ private currentSize(): { cols: number; rows: number } {
207
+ const term = this.tui.terminal as unknown as { cols?: number; columns?: number; rows?: number } | undefined;
208
+ // NEW
209
+ private currentSize(): { cols: number; rows: number } {
210
+ // SAFETY: duck-typed read — Pi TUI's Terminal type does not consistently expose
211
+ // cols/columns/rows across versions (see resizeIfNeeded below). Runtime
212
+ // fallbacks (120/24) keep this safe when the fields are absent.
213
+ const term = this.tui.terminal as unknown as { cols?: number; columns?: number; rows?: number } | undefined;
214
+ ```
215
+
216
+ - [ ] **Step 1: Apply all 10 edits** (by method, exact old→new above)
217
+
218
+ - [ ] **Step 2: Assert no bare `catch {}` remains**
219
+
220
+ Run: `grep -c "catch {}" src/ui/pty-attach.ts`
221
+ Expected: `0`
222
+
223
+ - [ ] **Step 3: Typecheck**
224
+
225
+ Run: `npm run typecheck`
226
+ Expected: clean exit
227
+
228
+ - [ ] **Step 4: Tests**
229
+
230
+ Run: `npm test`
231
+ Expected: all pass (no behavior change)
232
+
233
+ - [ ] **Step 5: Commit**
234
+
235
+ ```bash
236
+ git add src/ui/pty-attach.ts
237
+ git commit -m "chore: document intentional empty catches and as-cast invariant in pty-attach (issue #8)"
238
+ ```
239
+
240
+ ---
241
+
242
+ ### Task 2: Drop the unused `width` parameter from `project()`
243
+
244
+ **Files:**
245
+ - Modify: `src/ui/pty-attach.ts` (signature + single call site)
246
+
247
+ **Interfaces:**
248
+ - Changes: `private project(height: number, width: number)` → `private project(height: number)` (private; one caller)
249
+
250
+ The parameter `width` is never read in the method body. `width` at the call site remains used by `resizeIfNeeded(width)` / `renderLoading(...)` / `clip(...)` — only the `project()` argument goes away.
251
+
252
+ ```ts
253
+ // OLD (signature)
254
+ private project(height: number, width: number): { lines: string[]; cursor: { row: number; col: number } | null } {
255
+ // NEW (signature)
256
+ private project(height: number): { lines: string[]; cursor: { row: number; col: number } | null } {
257
+ ```
258
+
259
+ ```ts
260
+ // OLD (call site, in render(width: number))
261
+ const projected = this.project(bodyHeight, width);
262
+ // NEW (call site)
263
+ const projected = this.project(bodyHeight);
264
+ ```
265
+
266
+ - [ ] **Step 1: Apply both edits**
267
+
268
+ - [ ] **Step 2: Assert single-arg signature and call**
269
+
270
+ Run: `grep -n "project(" src/ui/pty-attach.ts`
271
+ Expected: exactly 2 hits — `render(...)`'s `this.project(bodyHeight);` and `private project(height: number): ...`
272
+
273
+ - [ ] **Step 3: Typecheck**
274
+
275
+ Run: `npm run typecheck`
276
+ Expected: clean exit (a missed call site would fail here)
277
+
278
+ - [ ] **Step 4: Tests**
279
+
280
+ Run: `npm test`
281
+ Expected: all pass
282
+
283
+ - [ ] **Step 5: Commit**
284
+
285
+ ```bash
286
+ git add src/ui/pty-attach.ts
287
+ git commit -m "chore: drop unused width param from PtyAttachComponent.project (issue #8)"
288
+ ```
289
+
290
+ ---
291
+
292
+ ### Task 3: Final verification sweep
293
+
294
+ **Files:** none modified.
295
+
296
+ - [ ] **Step 1: Full verify pipeline (same as CI)**
297
+
298
+ Run: `npm run verify`
299
+ Expected: typecheck + tests + coverage thresholds (lines 85 / funcs 80 / branches 70) + pack dry-run all pass.
300
+
301
+ - [ ] **Step 2: Zero-behavior diff audit**
302
+
303
+ Run: `git diff main...HEAD -- src/ui/pty-attach.ts | grep -E "^[+-]" | grep -vE "^(\+\+\+|---)" | grep -vE "^\+\s*(/\*|//|\*/?)" | grep -vE "^-.*catch \{\}" | grep -vE "^\+\s*} catch \{" | grep -vE "^\+\s*}"`
304
+ Expected: exactly 4 lines — the `project` signature and call site (`-`/`+` pairs). Everything else in the raw diff must be comment additions or `catch {}` expansions; any other code line appearing here means behavior changed — investigate before proceeding.
305
+
306
+ - [ ] **Step 3: Confirm working tree clean**
307
+
308
+ Run: `git status --short`
309
+ Expected: empty (nothing uncommitted, nothing swept in)
310
+
311
+ No commit in this task (verification only).
@@ -0,0 +1,294 @@
1
+ # README v2 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:** Rewrite `README.md` into an accurate, task-oriented English user guide for the current Pi Agent Board package, and correct the stale install command in `VERIFY.md`.
6
+
7
+ **Architecture:** This is a documentation-only change. `README.md` becomes the primary user-facing guide, organized around installation, first use, dashboard actions, reference behavior, configuration, safety, troubleshooting, and maintainer entry points. `VERIFY.md` receives one supporting-document correction so the linked verification path uses the scoped package name. Source code and `package.json` remain the behavior authority.
8
+
9
+ **Tech Stack:** Markdown, shell command examples, GitHub/Pi package links, existing Node.js verification scripts.
10
+
11
+ ## Global Constraints
12
+
13
+ - Keep all user-facing documentation in English; discuss implementation progress in Chinese.
14
+ - Work only in `/home/elling/git-repo/github/pi-agent-board/.pi/worktrees/issue-51-readme`; do not touch the main checkout.
15
+ - Use `package.json`, `src/index.ts`, `src/commands/*`, `src/ui/dashboard.ts`, `src/ui/pty-attach.ts`, `src/runtime/service.mjs`, and `src/core/*` as the source of truth.
16
+ - Do not advertise worktree isolation, plan-approval UI, provider-stall detection, or other planned/disabled behavior as shipped.
17
+ - State explicitly that worktree isolation is currently disabled and same-repository concurrent writes require user-managed isolation.
18
+ - Do not list internal child markers such as `AGENT_BOARD_CHILD`, `AGENT_BOARD_VIEW_ID`, or `AGENT_BOARD_HOSTED` as user settings.
19
+ - Do not advertise `AGENT_BOARD_ALLOW_PIPE_FALLBACK` as a normal ambient user toggle because the current service does not pass that ambient variable into the PTY runner configuration.
20
+ - Do not hard-code an unverified test count as a durable README claim; use CI and `npm run verify` as the authority.
21
+ - Do not modify runtime code, PRD/history documents, or the main checkout.
22
+ - Do not commit, push, open a PR, or merge without explicit user permission.
23
+
24
+ ## File Map
25
+
26
+ - Modify: `README.md` — complete user-first guide and reference.
27
+ - Modify: `VERIFY.md` — one stale scoped-package install command.
28
+ - Create: `docs/superpowers/specs/2026-08-30-readme-v2-design.md` — approved design copied into the worktree.
29
+ - Create: `docs/superpowers/plans/2026-08-30-readme-v2.md` — this implementation plan.
30
+ - Inspect only: `package.json`, `src/index.ts`, `src/commands/agent-board.ts`, `src/commands/bg.ts`, `src/ui/dashboard.ts`, `src/ui/pty-attach.ts`, `src/runtime/service.mjs`, `src/core/rows.mjs`, `src/core/auto-state.mjs`, `src/core/launch-options.mjs`, `src/core/code-refs*.mjs`, `.github/workflows/ci.yml`, and `VERIFY.md`.
31
+
32
+ ---
33
+
34
+ ### Task 1: Rewrite README structure and first-use path
35
+
36
+ **Files:**
37
+ - Modify: `README.md`
38
+ - Inspect: `package.json`, `src/index.ts`, `src/commands/agent-board.ts`, `src/commands/bg.ts`, `src/ui/dashboard.ts`
39
+
40
+ **Interfaces:**
41
+ - Consumes: package identity and scripts from `package.json`; registered commands/flag from `src/index.ts` and `src/commands/*`; dashboard behavior from `src/ui/dashboard.ts`.
42
+ - Produces: an English README whose first-use path is Requirements → Install → Quick start → Entry points → Dashboard workflow.
43
+
44
+ - [ ] **Step 1: Replace the product introduction and requirements sections**
45
+
46
+ Write the opening around the current value proposition: a full-screen TUI for durable background Pi sessions, global cross-project visibility, dashboard triage, inline reply/evidence, and PTY/JSON fallback. Keep the existing banner, demo, package gallery, and npm links if they remain valid.
47
+
48
+ Add requirements for Pi, Node.js 20+, working Pi provider authentication, and PTY support for live attach/start-and-attach. State that provider authentication is a Pi prerequisite, not an Agent Board credential setup.
49
+
50
+ Use this package command exactly:
51
+
52
+ ```bash
53
+ pi install npm:@zhuxixi/pi-agent-board
54
+ ```
55
+
56
+ Do not use the unscoped `pi-agent-board` package name.
57
+
58
+ - [ ] **Step 2: Add installation alternatives and auth sanity check**
59
+
60
+ Keep three clearly separated paths:
61
+
62
+ ```bash
63
+ # Published package
64
+ pi install npm:@zhuxixi/pi-agent-board
65
+
66
+ # Local package checkout
67
+ npm install
68
+ pi install "$(pwd)"
69
+
70
+ # Development auto-discovery
71
+ ln -s "$(pwd)" ~/.pi/agent/extensions/agent-board
72
+ ```
73
+
74
+ Explain that `pi remove "$(pwd)"` applies to the local path installation, while the development symlink must be removed manually. Include the existing one-shot check and explain that it should end with an assistant `message_end`, then `agent_end`, and exit. Link `VERIFY.md` for the complete diagnostic sequence.
75
+
76
+ - [ ] **Step 3: Add Quick start and entry-point differences**
77
+
78
+ Add a five-step first-task flow:
79
+
80
+ 1. Press `i` to enter INSERT mode.
81
+ 2. Type a task.
82
+ 3. Press `Enter` to open **Start session**.
83
+ 4. Review cwd, model, thinking, and action.
84
+ 5. Press `Enter` to launch.
85
+
86
+ Document `/agent-board`, `pi /agent-board`, `pi --agent-board`, and `/bg [prompt]`. State that `pi /agent-board` runs the standalone dashboard path and quitting it shuts down Pi; state that `--agent-board` cannot attach to a managed session and normal `/agent-board` is required for attach. Explain that `/bg` adopts the current interactive session and optionally queues a prompt.
87
+
88
+ - [ ] **Step 4: Verify the first-use section against source**
89
+
90
+ Check every command and behavior statement against `src/index.ts`, `src/commands/bg.ts`, `src/commands/agent-board.ts`, and the dashboard input handlers. Confirm that draft Enter opens the launch dialog, empty Enter attaches/resumes, and `i` is required before typing in Normal mode.
91
+
92
+ Run:
93
+
94
+ ```bash
95
+ grep -nE '/agent-board|/bg|agent-board|INSERT|Start session|Enter|attach' README.md src/index.ts src/commands/*.ts src/ui/dashboard.ts
96
+ ```
97
+
98
+ Expected: all advertised entry points and input transitions have matching source evidence and no unscoped install command appears in the new README.
99
+
100
+ ---
101
+
102
+ ### Task 2: Add dashboard, views, states, filters, and attach reference
103
+
104
+ **Files:**
105
+ - Modify: `README.md`
106
+ - Inspect: `src/ui/dashboard.ts`, `src/ui/pty-attach.ts`, `src/core/rows.mjs`, `src/core/types.mjs`, `src/runtime/service.mjs`, `src/ui/dashboard-evidence.mjs`
107
+
108
+ **Interfaces:**
109
+ - Consumes: dashboard modes/key handlers, row state/filter helpers, service fallback behavior, and PTY attach input handling.
110
+ - Produces: view-scoped reference sections that do not imply a key works in every dashboard mode.
111
+
112
+ - [ ] **Step 1: Document dashboard modes, launch dialog, and destructive actions**
113
+
114
+ Add Normal vs INSERT behavior, including `/` being literal in INSERT mode. Explain the launch dialog fields: cwd picker with favorites/browse and Tab completion, Pi-scoped model choices, supported thinking levels, and background versus start-and-attach. Mention persisted launch preferences and PTY-dependent start-and-attach fallback.
115
+
116
+ Document exact actions:
117
+
118
+ - `d` confirms Done for inactive sessions;
119
+ - manual completion is the default;
120
+ - `Ctrl+X` twice quickly archives/deletes a row;
121
+ - archive removes the row from the board but preserves the Pi session file;
122
+ - `X` removes inactive rows in the selected state;
123
+ - `m` enters batch selection with Space/a/u/d/Ctrl+X.
124
+
125
+ - [ ] **Step 2: Document view-specific shortcuts and capabilities**
126
+
127
+ Provide separate tables or subsections for Main list, Peek, Transcript, Evidence/Diagnostics, and PTY attach. Include:
128
+
129
+ - main-list navigation and actions;
130
+ - `Space` Peek;
131
+ - `r` reply only from Peek/Transcript/Evidence, not the main list; in Peek, it enters reply mode and the user presses Enter again after typing to send;
132
+ - `v` read-only transcript;
133
+ - `e` Evidence/Diagnostics and evidence-preserving diagnostic clear with `x`;
134
+ - attach with Enter/Right/`>`;
135
+ - PTY detach with `Left` when the child input is empty; edited input forwards the key, while a disconnected host can always be exited; `Ctrl+]` is passed through to the child Pi editor;
136
+ - attach scroll keys, mouse selection/copy, link opening, and optional middle-click paste.
137
+
138
+ State that pending Pi question/questionnaire tools require attach and cannot be answered with inline reply.
139
+
140
+ - [ ] **Step 3: Document states, grouping, unread, queue, and filters**
141
+
142
+ Document the exact display labels: Queued, Running, Needs answer, Needs instructions, Done, Failed, and Stopped. Explain semantic state versus process liveness, state/folder grouping, pinned-first stable creation ordering, unread indicators, busy follow-up FIFO queue, `qN`, and `queued:true`.
143
+
144
+ Document this filter syntax:
145
+
146
+ ```text
147
+ s:running
148
+ review:ready
149
+ diag:stalled
150
+ evidence:error
151
+ queued:true
152
+ steer:awaiting-approval
153
+ ```
154
+
155
+ Explain free-text AND matching over name, summary, and cwd, case-insensitive state aliases, and the limitation that `diag:stalled` consumes persisted diagnostics but does not represent a complete current provider-stall detector.
156
+
157
+ - [ ] **Step 4: Document evidence, code references, and persistence**
158
+
159
+ Explain Peek's summary/blocker/latest-output surface, transcript projection, Evidence/Diagnostics contents, durable artifacts, and locally extracted issue/PR badges. Mention optional per-root `providers.json` only as an extension point; do not invent an unverified schema.
160
+
161
+ Explain that busy replies are queued and drained when the session is ready. Explain the high-level store location `~/.pi/agent/agent-board/` and persistence through reload/restart/worker exit.
162
+
163
+ - [ ] **Step 5: Verify all advertised shortcuts and states**
164
+
165
+ Run:
166
+
167
+ ```bash
168
+ grep -nE 'handle(List|Select|Peek|Session|Evidence)Key|renderHelp|renderPtyHelp|Ctrl|ctrl\+|review:ready|diag:stalled|evidence:error|queued:|steer:' src/ui/dashboard.ts src/core/rows.mjs
169
+ ```
170
+
171
+ Compare every README shortcut/filter/state claim with the matching source handler. Remove any claim that only exists in PRD or planning documents.
172
+
173
+ ---
174
+
175
+ ### Task 3: Add configuration, safety, troubleshooting, and maintainer links
176
+
177
+ **Files:**
178
+ - Modify: `README.md`
179
+ - Inspect: `src/core/auto-state.mjs`, `src/core/title.mjs`, `runner/job-runner.mjs`, `runner/title-runner.mjs`, `src/runtime/service.mjs`, `src/ui/pty-attach.ts`, `src/core/pty-support.mjs`, `src/core/paths.mjs`, `.github/workflows/ci.yml`, `package.json`
180
+
181
+ **Interfaces:**
182
+ - Consumes: supported environment-variable reads, default values, PTY diagnosis behavior, package scripts, CI checks, and existing documentation links.
183
+ - Produces: a complete user-facing configuration table and explicit limitations/troubleshooting path.
184
+
185
+ - [ ] **Step 1: Replace the incomplete configuration table**
186
+
187
+ Document these supported user-facing settings with exact defaults and disable values: `AGENT_BOARD_ROOT`, `AGENT_BOARD_AUTO_STATE`, `AGENT_BOARD_AUTO_STATE_MODEL`, `AGENT_BOARD_AUTO_STATE_NO_DONE`, `AGENT_BOARD_SUMMARY_MODEL`, `AGENT_BOARD_TITLE_MODEL`, `AGENT_BOARD_TITLE_THINKING_LEVEL`, `AGENT_BOARD_CODE_REFS`, `AGENT_BOARD_DISABLE_PTY`, `AGENT_BOARD_FORCE_PTY`, `AGENT_BOARD_ATTACH_MOUSE`, `AGENT_BOARD_ENABLE_MOUSE_SCROLL`, `AGENT_BOARD_WHEEL_LINES`, `AGENT_BOARD_MAX_WARM_HOSTS`, `AGENT_BOARD_WARM_HOST_TTL_MS`, `AGENT_BOARD_ATTACH_NATIVE_PASTE`, `AGENT_BOARD_FORWARD_OSC52`, and `AGENT_BOARD_FORWARD_IMAGES`.
188
+
189
+ State the important default correctly: `AGENT_BOARD_AUTO_STATE_NO_DONE` unset means the user marks Done manually; `0`, `false`, `off`, or `no` restores automatic Done classification. Explain heuristic fallback for summary/title/state model failures where applicable.
190
+
191
+ Mention selected `AGENT_VIEW_*` names only as compatibility aliases and prefer `AGENT_BOARD_*` for new setup. Exclude internal child markers and do not present `AGENT_BOARD_ALLOW_PIPE_FALLBACK` as an ambient normal-user setting.
192
+
193
+ - [ ] **Step 2: Add safety, fallback, and troubleshooting sections**
194
+
195
+ Prominently state that worktree isolation is currently disabled and not automatically created. Same-repository concurrent sessions can run at the same time, so users must avoid overlapping writes or provide their own isolation.
196
+
197
+ Explain PTY versus JSON-runner fallback, the start-and-attach degradation, adopted external-session PTY requirement, Windows named-pipe/hidden-console capability, and `!` diagnostics. Add symptom-based troubleshooting for stuck Running/auth, `node-pty unavailable`, slow attach/reconnect, rejected inline reply, and same-repository conflicts.
198
+
199
+ - [ ] **Step 3: Simplify development, publishing, and further reading**
200
+
201
+ Keep maintainer sections concise:
202
+
203
+ ```bash
204
+ npm install
205
+ npm run verify
206
+ ```
207
+
208
+ Explain that verify runs typecheck, tests, coverage, and package dry-run. Keep publishing as verify, `npm version patch` (or minor/major), and `npm publish`. Link `VERIFY.md`, `PRD.md`, `PROGRESS.md`, and relevant deeper design material without embedding historical progress or a stale numeric test count.
209
+
210
+ - [ ] **Step 4: Validate configuration and limitation claims**
211
+
212
+ Run:
213
+
214
+ ```bash
215
+ git grep -nE 'AGENT_BOARD_[A-Z0-9_]+' -- ':!README.md' ':!coverage/**' ':!node_modules/**'
216
+ grep -nE 'DEFAULT_|AUTO_STATE_NO_DONE|AGENT_BOARD_|node-pty|worktree|windows|verify' README.md package.json src/core/*.mjs src/runtime/*.mjs src/ui/*.ts runner/*.mjs .github/workflows/ci.yml
217
+ ```
218
+
219
+ Expected: each public README variable has a source read and an accurate default; internal markers and unsupported worktree claims are absent.
220
+
221
+ ---
222
+
223
+ ### Task 4: Correct VERIFY.md and run documentation validation
224
+
225
+ **Files:**
226
+ - Modify: `VERIFY.md`
227
+ - Inspect: `README.md`, `VERIFY.md`, `package.json`, all README link targets
228
+
229
+ **Interfaces:**
230
+ - Consumes: the README's package/install path and the existing verification checklist.
231
+ - Produces: consistent scoped package installation instructions and validation evidence for the documentation change.
232
+
233
+ - [ ] **Step 1: Correct the stale published-package command**
234
+
235
+ Replace only this command in `VERIFY.md`:
236
+
237
+ ```bash
238
+ pi install npm:pi-agent-board
239
+ ```
240
+
241
+ with:
242
+
243
+ ```bash
244
+ pi install npm:@zhuxixi/pi-agent-board
245
+ ```
246
+
247
+ Do not change the verification procedure or historical notes beyond this scoped package correction.
248
+
249
+ - [ ] **Step 2: Check Markdown links and stale wording**
250
+
251
+ Run:
252
+
253
+ ```bash
254
+ python - <<'PY'
255
+ from pathlib import Path
256
+ import re
257
+
258
+ for path in (Path("README.md"), Path("VERIFY.md")):
259
+ text = path.read_text()
260
+ for line_no, line in enumerate(text.splitlines(), 1):
261
+ for target in re.findall(r"\]\(([^)]+)\)", line):
262
+ if target.startswith(("http://", "https://", "#", "mailto:")):
263
+ continue
264
+ candidate = (path.parent / target.split("#", 1)[0]).resolve()
265
+ if not candidate.exists():
266
+ raise SystemExit(f"broken link: {path}:{line_no}: {target}")
267
+ print("relative Markdown links: OK")
268
+ PY
269
+
270
+ grep -RInE 'pi install npm:pi-agent-board|default: enabled|300\+ tests|r.*reply' README.md VERIFY.md || true
271
+ ```
272
+
273
+ Expected: no broken relative links, no stale unscoped package command, no ambiguous auto-done wording, and no stale test-count claim.
274
+
275
+ - [ ] **Step 3: Run repository verification and inspect the final diff**
276
+
277
+ Run from the issue worktree:
278
+
279
+ ```bash
280
+ npm run typecheck
281
+ npm test
282
+ npm run pack:dry
283
+ git diff --check
284
+ git diff --stat
285
+ git status --short
286
+ ```
287
+
288
+ Expected: typecheck succeeds, the clean worktree baseline remains 416/416 tests with 0 failures, package dry-run succeeds, `git diff --check` is clean, and the diff contains only the approved spec/plan plus `README.md` and the one-line `VERIFY.md` correction.
289
+
290
+ Do not include the main checkout's untracked PTY tests in this evidence. Do not claim the main checkout is green while those unrelated tests remain failing.
291
+
292
+ - [ ] **Step 4: Prepare issue progress and handoff**
293
+
294
+ Record in the Issue #51 progress comment: the isolated worktree path, the documentation files changed, validation commands and results, any residual source-of-truth caveats, and the fact that no push/PR/merge was performed. Stop before pushing or opening a PR and request explicit user permission.
@@ -1,5 +1,9 @@
1
1
  # Spec:attach 冷启动双光标根治 — jiggle 重试链编排修复(issue #10)
2
2
 
3
+ > **历史设计,已被 issue #25 的 shrink-and-hold 及 issue #42 的 G6
4
+ > post-restore verify supersede。** 当前实现和测试以
5
+ > `src/core/pty-attach-jiggle-controller.mjs` 为准。
6
+
3
7
  ## 日期
4
8
  2026-08-21(v2:评审后修订,补三项编排严谨性修正)
5
9
 
@@ -1,5 +1,9 @@
1
1
  # Spec:attach jiggle 协议改造 — shrink-and-hold(issue #25)
2
2
 
3
+ > **历史设计,部分内容已被 issue #42 superseded。** 当前实现保留 G1–G5,
4
+ > 并在首帧快速 restore 后增加 G6 post-restore verify:900ms 内没有 clear
5
+ > 时重新 shrink;attach detach 只使用空输入时的 `←`,`ctrl+]` 透传给 Pi。
6
+
3
7
  ## 日期
4
8
  2026-08-22
5
9