@zhuxixi/pi-agent-board 0.13.0 → 0.14.0

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 (91) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +37 -12
  3. package/docs/SECTION_FOLDING.md +53 -0
  4. package/docs/superpowers/plans/2026-10-23-issue-222-attach-ready.md +290 -0
  5. package/docs/superpowers/plans/2026-10-26-issue-245-key-hints-doc-sync.md +244 -0
  6. package/docs/superpowers/plans/2026-10-27-issue-172-fullscreen-selection-clear.md +344 -0
  7. package/docs/superpowers/plans/2026-10-27-issue-252-select-key-hints.md +209 -0
  8. package/docs/superpowers/plans/2026-10-28-issue-255-coordinator-endpoint-zombie.md +442 -0
  9. package/docs/superpowers/plans/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup.md +256 -0
  10. package/docs/superpowers/plans/2026-11-03-cwd-favorites-full-pool.md +266 -0
  11. package/docs/superpowers/plans/2026-11-03-issue-266-alt-h-detach.md +467 -0
  12. package/docs/superpowers/plans/2026-11-04-issue-270-scenario-stdout-flush.md +584 -0
  13. package/docs/superpowers/plans/2026-11-05-issue-278-ctrl-g-external-editor.md +381 -0
  14. package/docs/superpowers/plans/2026-11-06-issue-280-frame-witness-delivery.md +430 -0
  15. package/docs/superpowers/plans/2026-11-07-issue-284-attach-recovery.md +115 -0
  16. package/docs/superpowers/plans/2026-11-07-issue-284-u1-u2-trial-guide.md +39 -0
  17. package/docs/superpowers/plans/2026-11-08-host-restart-model-override.md +894 -0
  18. package/docs/superpowers/plans/2026-11-08-issue-288-cap-floor.md +51 -0
  19. package/docs/superpowers/plans/2026-11-09-dashboard-fold-flake.md +166 -0
  20. package/docs/superpowers/plans/2026-11-09-issue-273-harness-console-log-exit.md +369 -0
  21. package/docs/superpowers/plans/2026-11-10-issue-258-board-selection-settle.md +760 -0
  22. package/docs/superpowers/plans/2026-11-13-issue-294-snapshot-resize-intent.md +590 -0
  23. package/docs/superpowers/plans/2026-11-16-greeting-title-poll.md +838 -0
  24. package/docs/superpowers/plans/2026-11-22-issue-297-compaction-mirror.md +797 -0
  25. package/docs/superpowers/plans/2026-11-23-issue-254-cursor-keep-position.md +663 -0
  26. package/docs/superpowers/plans/2026-11-23-issue-95-legacy-quarantine.md +320 -0
  27. package/docs/superpowers/specs/2026-10-23-issue-222-attach-ready-design.md +204 -0
  28. package/docs/superpowers/specs/2026-10-26-issue-245-key-hints-doc-sync-design.md +72 -0
  29. package/docs/superpowers/specs/2026-10-27-issue-172-fullscreen-selection-clear-design.md +248 -0
  30. package/docs/superpowers/specs/2026-10-27-issue-252-select-key-hints-design.md +95 -0
  31. package/docs/superpowers/specs/2026-10-28-issue-255-coordinator-endpoint-zombie-design.md +380 -0
  32. package/docs/superpowers/specs/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup-design.md +197 -0
  33. package/docs/superpowers/specs/2026-11-03-cwd-favorites-full-pool-design.md +106 -0
  34. package/docs/superpowers/specs/2026-11-03-issue-266-alt-h-detach-design.md +185 -0
  35. package/docs/superpowers/specs/2026-11-04-issue-270-scenario-stdout-flush-design.md +176 -0
  36. package/docs/superpowers/specs/2026-11-05-issue-278-ctrl-g-external-editor-design.md +185 -0
  37. package/docs/superpowers/specs/2026-11-07-issue-284-attach-recovery-design.md +166 -0
  38. package/docs/superpowers/specs/2026-11-08-host-restart-model-override-design.md +115 -0
  39. package/docs/superpowers/specs/2026-11-08-issue-288-cap-floor-design.md +86 -0
  40. package/docs/superpowers/specs/2026-11-09-dashboard-fold-flake-design.md +109 -0
  41. package/docs/superpowers/specs/2026-11-09-issue-273-harness-console-log-exit-design.md +182 -0
  42. package/docs/superpowers/specs/2026-11-10-issue-258-board-selection-settle-design.md +109 -0
  43. package/docs/superpowers/specs/2026-11-13-issue-294-snapshot-resize-intent-design.md +141 -0
  44. package/docs/superpowers/specs/2026-11-16-greeting-title-poll-design.md +174 -0
  45. package/docs/superpowers/specs/2026-11-22-issue-297-compaction-mirror-design.md +158 -0
  46. package/docs/superpowers/specs/2026-11-22-issue-95-legacy-quarantine-design.md +209 -0
  47. package/docs/superpowers/specs/2026-11-23-issue-254-cursor-keep-position-design.md +201 -0
  48. package/package.json +1 -1
  49. package/runner/pty-runner.mjs +526 -63
  50. package/runner/state-coordinator.mjs +62 -5
  51. package/runner/title-runner.mjs +33 -24
  52. package/src/commands/agent-board.ts +5 -1
  53. package/src/core/attach-detach.mjs +27 -0
  54. package/src/core/attach-frame-proof.mjs +897 -0
  55. package/src/core/attach-frame-reporter.mjs +738 -0
  56. package/src/core/attach-frame-stream.mjs +266 -0
  57. package/src/core/attach-pr-label.mjs +12 -0
  58. package/src/core/attach-recovery.mjs +239 -0
  59. package/src/core/attach-screen-owner.mjs +55 -0
  60. package/src/core/attach-view-proof.mjs +709 -0
  61. package/src/core/auto-state.mjs +6 -1
  62. package/src/core/cwd-stats.mjs +3 -1
  63. package/src/core/dashboard-prefs.mjs +31 -0
  64. package/src/core/derive.mjs +8 -1
  65. package/src/core/events.mjs +127 -1
  66. package/src/core/foreground-projection-cache.mjs +1 -0
  67. package/src/core/frame-witness-update.mjs +35 -0
  68. package/src/core/fullscreen-selection.mjs +60 -0
  69. package/src/core/host-coordination.mjs +48 -0
  70. package/src/core/host-protocol.mjs +13 -2
  71. package/src/core/hosted-frame-witness.mjs +60 -0
  72. package/src/core/paths.mjs +10 -3
  73. package/src/core/pty-attach-render.mjs +239 -0
  74. package/src/core/pty-kitty-images.mjs +237 -0
  75. package/src/core/pty-scroll.mjs +8 -8
  76. package/src/core/rows.mjs +43 -7
  77. package/src/core/session-entries.mjs +82 -0
  78. package/src/core/session-launch-prefs.mjs +45 -0
  79. package/src/core/session-view.mjs +3 -63
  80. package/src/core/store.mjs +1 -0
  81. package/src/core/terminal-attach-client.mjs +199 -20
  82. package/src/core/terminal-attach-protocol.mjs +221 -7
  83. package/src/core/terminal-model.mjs +24 -3
  84. package/src/core/terminal-snapshot.mjs +10 -0
  85. package/src/core/title-flow.mjs +66 -0
  86. package/src/core/title.mjs +101 -0
  87. package/src/core/types.mjs +17 -0
  88. package/src/index.ts +85 -0
  89. package/src/runtime/service.mjs +87 -18
  90. package/src/ui/dashboard.ts +206 -49
  91. package/src/ui/pty-attach.ts +1472 -99
@@ -0,0 +1,760 @@
1
+ # Board Selection Settle (issue #258) 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:** In fullscreen, clear pi-tui's selection highlight right after copy-on-select when a selection gesture ends inside the board — via a shared settle core that the attach view is also refactored onto.
6
+
7
+ **Architecture:** A new pure core module (`src/core/fullscreen-selection.mjs`) owns the deferred-settle logic (gesture serial + `shouldSettle` lifecycle gate + read/mirror/copyOnSelect/clear/repaint order) with every side effect injected. `PtyAttachComponent` deletes its inline implementation and instantiates the core; `DashboardComponent` gains a `handleMouse` observer (always returns `undefined`) plus a `disposed` gate. Four test layers: unit (core), component harness (attach regression, board wiring), real-renderer harness (SGR dispatch chain), full gate.
8
+
9
+ **Tech Stack:** TypeScript components under `src/ui/`, JS core under `src/core/`, `node:test` + `assert/strict`, child-process scenario harnesses under `test-support/` launched with `node --experimental-transform-types`.
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-11-10-issue-258-board-selection-settle-design.md` (acceptance IDs A1–A5, U1–U2 referenced per task).
12
+
13
+ ## Global Constraints
14
+
15
+ - Tabs for indentation; English comments and commit subjects; conventional commit types (`feat`/`fix`/`refactor`/`test`/`docs`).
16
+ - `node --test test/<file>` for targeted runs; every scenario harness is a child process that prints ONE JSON line consumed by its wrapper test (see `test/pty-attach-selection-mirror.test.mjs`).
17
+ - `settleFullscreenSelection` semantics must stay byte-compatible on the attach path: mirror before the `copyOnSelect` check; clear is NOT governed by `AGENT_BOARD_ATTACH_NATIVE_PASTE` (the env gate lives inside `writePrimarySelection`).
18
+ - Never call `resetTextSelection()`; only feature-detected `clearTextSelection()`.
19
+ - Existing assertions in `test/pty-attach-selection-mirror.test.mjs` and `test/dashboard-fold.test.mjs` must not be modified — only appended to / new files added.
20
+ - Work from the worktree ONLY (this directory); never touch the main checkout.
21
+
22
+ ---
23
+
24
+ ### Task 1: `FullscreenSelectionSettler` core + unit tests (A1)
25
+
26
+ **Files:**
27
+ - Create: `src/core/fullscreen-selection.mjs`
28
+ - Create: `test/fullscreen-selection.test.mjs`
29
+
30
+ **Interfaces:**
31
+ - Consumes: `isFullscreenSelectionEnd(event)` from `./pty-scroll.mjs` (exists, `src/core/pty-scroll.mjs:279`).
32
+ - Produces: `createFullscreenSelectionSettler(options) -> { observeMouse(event) }` where options = `{ host, mirror?, repaint?, schedule?, shouldSettle? }` and host = `{ getActiveSelectionText?, getCopyOnSelect?, clearTextSelection? }` (all optional, feature-detected). Tasks 2 and 3 construct it; nothing else consumes the module.
33
+
34
+ - [ ] **Step 1: Write the failing tests**
35
+
36
+ `test/fullscreen-selection.test.mjs`:
37
+
38
+ ```js
39
+ import assert from "node:assert/strict";
40
+ import test from "node:test";
41
+ import { createFullscreenSelectionSettler } from "../src/core/fullscreen-selection.mjs";
42
+
43
+ const leftEvent = (type, x = 3, y = 3) => ({ type, button: "left", x, y, screenX: x, screenY: y, width: 80, height: 22, shift: false });
44
+
45
+ /** Manual scheduler: collect callbacks, flush explicitly. Mirrors process.nextTick ordering without wall-clock. */
46
+ const manualQueue = () => {
47
+ const q = [];
48
+ return { q, schedule: (cb) => q.push(cb), flush: () => { while (q.length) q.shift()(); } };
49
+ };
50
+
51
+ /** Counting host fixture; clear invalidates text so a read-after-clear order yields no mirror text. */
52
+ const makeHost = (opts = {}) => {
53
+ const { copyOnSelect = true, withClear = true } = opts;
54
+ // Presence check, not default destructuring: { text: undefined } must stay
55
+ // genuinely absent instead of falling back to the default string.
56
+ const text = "text" in opts ? opts.text : "fixture-text";
57
+ const state = { text, copyOnSelect, reads: 0, clears: 0, repaints: 0, mirrored: [] };
58
+ return {
59
+ state,
60
+ host: {
61
+ getActiveSelectionText: () => { state.reads += 1; return state.text; },
62
+ getCopyOnSelect: () => state.copyOnSelect,
63
+ ...(withClear ? { clearTextSelection: () => { state.clears += 1; state.text = undefined; } } : {}),
64
+ },
65
+ };
66
+ };
67
+
68
+ test("settler: left release defers settle via the injected scheduler, then clears and repaints once", () => {
69
+ const { q, schedule, flush } = manualQueue();
70
+ const { state, host } = makeHost();
71
+ const s = createFullscreenSelectionSettler({ host, repaint: () => { state.repaints += 1; }, schedule });
72
+ s.observeMouse(leftEvent("release"));
73
+ assert.equal(state.reads, 0, "nothing may run synchronously");
74
+ flush();
75
+ assert.equal(state.reads, 1);
76
+ assert.equal(state.clears, 1);
77
+ assert.equal(state.repaints, 1);
78
+ });
79
+
80
+ test("settler: empty or absent selection text never clears, never mirrors", () => {
81
+ for (const text of [undefined, ""]) {
82
+ const { q, schedule, flush } = manualQueue();
83
+ const mirrored = [];
84
+ const { state, host } = makeHost({ text });
85
+ const s = createFullscreenSelectionSettler({ host, mirror: (t) => mirrored.push(t), schedule });
86
+ s.observeMouse(leftEvent("release"));
87
+ flush();
88
+ assert.equal(state.clears, 0, `text=${String(text)}`);
89
+ assert.equal(mirrored.length, 0, `text=${String(text)}`);
90
+ }
91
+ });
92
+
93
+ test("settler: copyOnSelect=false mirrors but keeps the selection for Ctrl+X", () => {
94
+ const { schedule, flush } = manualQueue();
95
+ const mirrored = [];
96
+ const { state, host } = makeHost({ copyOnSelect: false });
97
+ const s = createFullscreenSelectionSettler({ host, mirror: (t) => mirrored.push(t), schedule });
98
+ s.observeMouse(leftEvent("release"));
99
+ flush();
100
+ assert.equal(mirrored.length, 1);
101
+ assert.equal(mirrored[0], "fixture-text", "mirror runs before the copyOnSelect check and reads live text");
102
+ assert.equal(state.clears, 0);
103
+ });
104
+
105
+ test("settler: missing clearTextSelection degrades without throwing", () => {
106
+ const { schedule, flush } = manualQueue();
107
+ const { state, host } = makeHost({ withClear: false });
108
+ const s = createFullscreenSelectionSettler({ host, schedule });
109
+ s.observeMouse(leftEvent("release"));
110
+ assert.doesNotThrow(flush);
111
+ assert.equal(state.clears, 0);
112
+ });
113
+
114
+ test("settler: read-before-clear order (mirror receives live text even though clear invalidates it)", () => {
115
+ const { schedule, flush } = manualQueue();
116
+ const mirrored = [];
117
+ const { host } = makeHost();
118
+ const s = createFullscreenSelectionSettler({ host, mirror: (t) => mirrored.push(t), schedule });
119
+ s.observeMouse(leftEvent("release"));
120
+ flush();
121
+ assert.equal(mirrored[0], "fixture-text", "text was read before clearTextSelection invalidated it");
122
+ });
123
+
124
+ test("settler: a release followed by a new left press in the same tick is dropped (gesture serial)", () => {
125
+ const { q, schedule, flush } = manualQueue();
126
+ const { state, host } = makeHost();
127
+ const s = createFullscreenSelectionSettler({ host, schedule });
128
+ s.observeMouse(leftEvent("release", 3, 3));
129
+ s.observeMouse(leftEvent("press", 9, 9));
130
+ assert.equal(q.length, 1, "only the release queued a settle"); // before flush(): flush drains the queue
131
+ flush();
132
+ assert.equal(state.reads, 0, "the queued settle must not consume the new gesture");
133
+ assert.equal(state.clears, 0);
134
+ });
135
+
136
+ test("settler: left click also settles; press/move/right/middle/wheel never do", () => {
137
+ const { schedule, flush } = manualQueue();
138
+ const { state, host } = makeHost();
139
+ const s = createFullscreenSelectionSettler({ host, schedule });
140
+ s.observeMouse(leftEvent("click"));
141
+ flush();
142
+ assert.equal(state.clears, 1, "click is a selection end");
143
+ const nonEndings = [
144
+ { type: "press", button: "left" },
145
+ { type: "move", button: "left" },
146
+ { type: "press", button: "right" },
147
+ { type: "press", button: "middle" },
148
+ { type: "wheel", button: "none" },
149
+ ];
150
+ for (const ev of nonEndings) s.observeMouse({ ...leftEvent("press"), ...ev });
151
+ flush();
152
+ assert.equal(state.clears, 1, "no non-ending cleared again");
153
+ });
154
+
155
+ test("settler: shouldSettle() === false blocks before any host read, mirror, clear or repaint", () => {
156
+ const { schedule, flush } = manualQueue();
157
+ const mirrored = [];
158
+ const { state, host } = makeHost();
159
+ const s = createFullscreenSelectionSettler({
160
+ host,
161
+ mirror: (t) => mirrored.push(t),
162
+ repaint: () => { state.repaints += 1; },
163
+ schedule,
164
+ shouldSettle: () => false,
165
+ });
166
+ s.observeMouse(leftEvent("release"));
167
+ flush();
168
+ assert.equal(state.reads, 0, "gate is checked before the host read");
169
+ assert.equal(mirrored.length, 0);
170
+ assert.equal(state.clears, 0);
171
+ assert.equal(state.repaints, 0);
172
+ });
173
+ ```
174
+
175
+ - [ ] **Step 2: Run tests to verify they fail**
176
+
177
+ Run: `node --test test/fullscreen-selection.test.mjs`
178
+ Expected: FAIL — cannot find module `../src/core/fullscreen-selection.mjs`.
179
+
180
+ - [ ] **Step 3: Write the core module**
181
+
182
+ `src/core/fullscreen-selection.mjs`:
183
+
184
+ ```js
185
+ import { isFullscreenSelectionEnd } from "./pty-scroll.mjs";
186
+
187
+ /**
188
+ * Issue #258 (+ #172/#174 refactor): one place that settles pi's fullscreen
189
+ * selection after copy-on-select, so the attach overlay and the board cannot
190
+ * drift. All I/O is injected (repo convention: pure/testable core, thin shell).
191
+ *
192
+ * host: the TuiAltScreen-shaped seam — getActiveSelectionText /
193
+ * clearTextSelection are private in pi-tui typings (runtime plain methods),
194
+ * getCopyOnSelect is public. Every access is feature-detected so an older or
195
+ * newer pi-tui degrades to the pre-settle behaviour instead of throwing.
196
+ * mirror: attach passes its X11 PRIMARY write (self-gated on
197
+ * AGENT_BOARD_ATTACH_NATIVE_PASTE inside writePrimarySelection); the board omits it.
198
+ * repaint: schedules one repaint after a successful clear.
199
+ * schedule: deferral transport, defaults to process.nextTick — overlays are
200
+ * dispatched BEFORE TuiAltScreen finalizes and copies the selection, so the
201
+ * settle must run after that event completes (issue #174).
202
+ * shouldSettle: runtime lifecycle gate — checked inside the deferred callback
203
+ * before any host read. attach passes () => !this.closed; the board passes
204
+ * () => !this.disposed. The gesture serial cannot cover unmount/close: it
205
+ * only grows on presses this component still observes.
206
+ */
207
+ export function createFullscreenSelectionSettler({ host, mirror, repaint, schedule = (cb) => process.nextTick(cb), shouldSettle } = {}) {
208
+ let serial = 0;
209
+ const settle = () => {
210
+ if (typeof shouldSettle === "function" && !shouldSettle()) return;
211
+ const text = host.getActiveSelectionText?.();
212
+ if (typeof text !== "string" || text.length === 0) return;
213
+ if (mirror) mirror(text);
214
+ if (host.getCopyOnSelect?.() === false) return;
215
+ if (typeof host.clearTextSelection !== "function") return;
216
+ host.clearTextSelection();
217
+ repaint?.();
218
+ };
219
+ return {
220
+ /** Observe only — never consumes; callers return undefined for these events. */
221
+ observeMouse(event) {
222
+ if (!event || typeof event !== "object") return;
223
+ if (event.type === "press" && event.button === "left") serial += 1;
224
+ if (!isFullscreenSelectionEnd(event)) return;
225
+ const captured = serial;
226
+ schedule(() => {
227
+ if (captured !== serial) return;
228
+ settle();
229
+ });
230
+ },
231
+ };
232
+ }
233
+ ```
234
+
235
+ - [ ] **Step 4: Run tests to verify they pass**
236
+
237
+ Run: `node --test test/fullscreen-selection.test.mjs`
238
+ Expected: PASS (8 tests).
239
+
240
+ - [ ] **Step 5: Commit**
241
+
242
+ ```bash
243
+ git add src/core/fullscreen-selection.mjs test/fullscreen-selection.test.mjs
244
+ git commit -m "feat(core): shared fullscreen selection settler (issue #258)"
245
+ ```
246
+
247
+ **Acceptance: A1**
248
+
249
+ ---
250
+
251
+ ### Task 2: Refactor attach onto the core (A2)
252
+
253
+ **Files:**
254
+ - Modify: `src/ui/pty-attach.ts` (handleMouse selection block ~`:854-868`; `selectionGestureSerial` field `:555`; `settleFullscreenSelection` `:2432-2447`; export the host interface `:36`)
255
+ - Modify: `test-support/pty-attach-selection-mirror-scenario.ts` (append case 8 + two result fields)
256
+ - Modify: `test/pty-attach-selection-mirror.test.mjs` (append two assertions inside the existing test — existing assertions untouched)
257
+
258
+ **Interfaces:**
259
+ - Consumes: `createFullscreenSelectionSettler` from `../core/fullscreen-selection.mjs` (Task 1).
260
+ - Produces: `export interface FullscreenSelectionHost` in `src/ui/pty-attach.ts` — Task 3 imports this type for its own host cast.
261
+
262
+ - [ ] **Step 1: Append the failing case to the scenario**
263
+
264
+ In `test-support/pty-attach-selection-mirror-scenario.ts`, add `closedWrites: -1, closedClears: -1,` to the `result` object, then append after the last existing case (keep every existing case byte-identical):
265
+
266
+ ```ts
267
+ // 8. Issue #258 shared-core guard, attach wiring: a settle queued before
268
+ // close() must not fire after the component is closed.
269
+ await withComponent(undefined, async (c) => {
270
+ resetFixture();
271
+ const before = writes().length;
272
+ (c as any).handleMouse(leftEvent("release"));
273
+ (c as any).close();
274
+ await sleep(80);
275
+ result.closedWrites = writes().length - before;
276
+ result.closedClears = clearCalls;
277
+ });
278
+ ```
279
+
280
+ - [ ] **Step 2: Append the failing assertions to the wrapper test**
281
+
282
+ At the end of the existing `test(...)` body in `test/pty-attach-selection-mirror.test.mjs` (after the `coalescedClears` assertion):
283
+
284
+ ```js
285
+ // Issue #258: the closed-gate must survive the shared-core refactor.
286
+ assert.equal(parsed.closedWrites, 0, "a settle queued before close() must not mirror after close");
287
+ assert.equal(parsed.closedClears, 0, "a settle queued before close() must not clear after close");
288
+ ```
289
+
290
+ - [ ] **Step 3: Run to verify the new case fails**
291
+
292
+ Run: `node --test test/pty-attach-selection-mirror.test.mjs`
293
+ Expected: FAIL — `closedClears` is 1 (today's inline settle has the guard only in `settleFullscreenSelection`'s `this.closed` check, which the refactor must preserve; the failing assertion proves the case exercises the path). If it already passes, stop and re-check the case actually queues before close.
294
+
295
+ - [ ] **Step 4: Refactor `src/ui/pty-attach.ts`**
296
+
297
+ 1. Add to imports: `import { createFullscreenSelectionSettler } from "../core/fullscreen-selection.mjs";` (place alphabetically near the existing `../core/pty-scroll.mjs` import).
298
+ 2. Change `interface FullscreenSelectionHost` (`:36`) to `export interface FullscreenSelectionHost` (Task 3 imports it).
299
+ 3. Delete the `private selectionGestureSerial = 0;` field (`:555`).
300
+ 4. Add a field `private readonly selectionSettler: ReturnType<typeof createFullscreenSelectionSettler>;` and initialize it in the constructor body (after `this.tui`/fields it references exist):
301
+
302
+ ```ts
303
+ this.selectionSettler = createFullscreenSelectionSettler({
304
+ host: this.tui as FullscreenSelectionHost,
305
+ mirror: (text) => this.writePrimarySelection(text),
306
+ repaint: () => this.scheduleRender(),
307
+ shouldSettle: () => !this.closed,
308
+ });
309
+ ```
310
+
311
+ 5. In `handleMouse`, replace the `Issue #172` press-bump + `isFullscreenSelectionEnd` defer block (`:854-868`) with:
312
+
313
+ ```ts
314
+ // Issue #172 + #258: observe the gesture; the shared settler owns the
315
+ // serial guard, the deferral and the lifecycle gate.
316
+ this.selectionSettler.observeMouse(event);
317
+ if (isFullscreenSelectionEnd(event)) return undefined;
318
+ ```
319
+
320
+ (keep the surrounding `nativePasteEnabled` removal if it is no longer referenced below — verify with `rg nativePasteEnabled src/ui/pty-attach.ts` and drop dead locals).
321
+
322
+ 6. Delete the whole `settleFullscreenSelection` method (`:2432-2447`) and the `Issue #174 (B2) + #172` doc comment above it. Keep `writePrimarySelection` (the mirror target) untouched.
323
+
324
+ - [ ] **Step 5: Run the attach mirror tests to verify everything passes**
325
+
326
+ Run: `node --test test/pty-attach-selection-mirror.test.mjs`
327
+ Expected: PASS — all existing assertions AND the two new ones.
328
+
329
+ - [ ] **Step 6: Typecheck**
330
+
331
+ Run: `npm run typecheck`
332
+ Expected: exit 0.
333
+
334
+ - [ ] **Step 7: Commit**
335
+
336
+ ```bash
337
+ git add src/ui/pty-attach.ts test-support/pty-attach-selection-mirror-scenario.ts test/pty-attach-selection-mirror.test.mjs
338
+ git commit -m "refactor(attach): move the fullscreen selection settle onto the shared core (issue #258)"
339
+ ```
340
+
341
+ **Acceptance: A2**
342
+
343
+ ---
344
+
345
+ ### Task 3: Board wiring + component harness (A3)
346
+
347
+ **Files:**
348
+ - Modify: `src/ui/dashboard.ts` (constructor, `dispose()` `:1266`, add `handleMouse`, add `disposed` flag, imports)
349
+ - Create: `test-support/dashboard-selection-settle-scenario.ts`
350
+ - Create: `test/dashboard-selection-settle.test.mjs`
351
+
352
+ **Interfaces:**
353
+ - Consumes: `createFullscreenSelectionSettler` (Task 1); `FullscreenSelectionHost` type (Task 2 export); `TuiMouseEvent`/`TuiMouseEventResult` from `@earendil-works/pi-tui` (already the import source in `pty-attach.ts:6`).
354
+ - Produces: `DashboardComponent.handleMouse(event): undefined` — pi-tui's overlay dispatch calls it (Task 4 proves this through the real renderer).
355
+
356
+ - [ ] **Step 1: Write the failing scenario harness**
357
+
358
+ `test-support/dashboard-selection-settle-scenario.ts` (child process; prints one JSON line):
359
+
360
+ ```ts
361
+ // Component-level coverage for issue #258: the REAL DashboardComponent with a
362
+ // fake fullscreen TUI exposing the pi-tui selection seam, driven via handleMouse
363
+ // directly (the #172 pty-attach-selection-mirror-scenario.ts pattern).
364
+ import { mkdtempSync, rmSync } from "node:fs";
365
+ import { tmpdir } from "node:os";
366
+ import { join } from "node:path";
367
+ import { createView, listRows } from "../src/core/store.mjs";
368
+ import { DashboardComponent } from "../src/ui/dashboard.ts";
369
+
370
+ const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
371
+
372
+ const root = mkdtempSync(join(tmpdir(), "board-settle-"));
373
+ let selectionText: string | undefined = "board-fixture-text";
374
+ let clearCalls = 0;
375
+ let readCalls = 0;
376
+ let renderCalls = 0;
377
+
378
+ const resetFixture = () => {
379
+ selectionText = "board-fixture-text";
380
+ clearCalls = 0;
381
+ readCalls = 0;
382
+ renderCalls = 0;
383
+ };
384
+
385
+ const tui = {
386
+ mode: "fullscreen",
387
+ getActiveSelectionText: () => { readCalls += 1; return selectionText; },
388
+ getCopyOnSelect: () => true,
389
+ clearTextSelection: () => { clearCalls += 1; selectionText = undefined; },
390
+ requestRender: () => { renderCalls += 1; },
391
+ terminal: { rows: 24, cols: 80, columns: 80, write: () => {} },
392
+ };
393
+
394
+ const leftEvent = (type: "release" | "click" | "press" | "move", x = 3, y = 3) => ({
395
+ type, button: "left", x, y, screenX: x, screenY: y, width: 80, height: 22, shift: false,
396
+ });
397
+
398
+ const base = (() => {
399
+ createView(root, { id: "base", name: "base", cwd: root });
400
+ return listRows(root)[0];
401
+ })();
402
+ const rows = Array.from({ length: 6 }, (_, i) => ({
403
+ ...base,
404
+ meta: { ...base.meta, id: `v${i}`, name: `settle-case-${i}`, createdAt: i, cwd: root, repoCwd: root },
405
+ state: { ...base.state, semanticState: i < 3 ? "needs_input" : "idle" },
406
+ }));
407
+ const service = {
408
+ rows: () => rows,
409
+ row: (id: string) => rows.find((row) => row.meta.id === id),
410
+ prewarmHost: () => ({ ok: false }),
411
+ ptyHealth: () => ({ ok: true, reason: null, staleHosts: 0, liveHosts: 0 }),
412
+ getLaunchPrefs: () => null,
413
+ reconcile: async () => {},
414
+ };
415
+
416
+ const result = {
417
+ error: null as string | null,
418
+ releaseUndefined: false,
419
+ listClears: -1, listRenders: -1,
420
+ coalescedClears: -1,
421
+ nonEndingClears: -1,
422
+ filterMode: false, filterClears: -1,
423
+ launchMode: false, launchClears: -1,
424
+ disposeRaceReads: -1, disposeRaceClears: -1, disposeRaceRenders: -1,
425
+ };
426
+
427
+ const open = () => new DashboardComponent(
428
+ tui as never,
429
+ { fg: (_c: string, t: string) => t, bold: (t: string) => t, bg: (_c: string, t: string) => t } as never,
430
+ { matches: () => false } as never,
431
+ () => { throw new Error("unexpected attach/exit"); },
432
+ { service: service as never, root, defaultCwd: root, availableModels: [], currentModel: null, currentThinkingLevel: "off" } as never,
433
+ );
434
+
435
+ let dash: any;
436
+ try {
437
+ // 1. List mode: left release defers one tick, then clears and repaints; never consumes.
438
+ dash = open();
439
+ resetFixture();
440
+ result.releaseUndefined = dash.handleMouse(leftEvent("release")) === undefined;
441
+ await sleep(30);
442
+ result.listClears = clearCalls;
443
+ result.listRenders = renderCalls;
444
+
445
+ // 2. Release + new press in one tick: the queued settle is dropped.
446
+ resetFixture();
447
+ dash.handleMouse(leftEvent("release", 3, 3));
448
+ dash.handleMouse(leftEvent("press", 9, 9));
449
+ await sleep(30);
450
+ result.coalescedClears = clearCalls;
451
+
452
+ // 3. Non-endings never settle (right/middle press, move, wheel-shaped event).
453
+ resetFixture();
454
+ dash.handleMouse({ ...leftEvent("press"), button: "right" });
455
+ dash.handleMouse({ ...leftEvent("press"), button: "middle" });
456
+ dash.handleMouse(leftEvent("move"));
457
+ dash.handleMouse({ type: "wheel", button: "none", x: 3, y: 3, screenX: 3, screenY: 3, width: 80, height: 22, shift: false });
458
+ await sleep(30);
459
+ result.nonEndingClears = clearCalls;
460
+
461
+ // 4. Editor-bearing mode (filter): same observer, same settle (spec D6).
462
+ resetFixture();
463
+ dash.startFilter();
464
+ result.filterMode = dash.mode === "filter";
465
+ dash.handleMouse(leftEvent("release"));
466
+ await sleep(30);
467
+ result.filterClears = clearCalls;
468
+ dash.toListMode();
469
+
470
+ // 5. Editor-bearing mode (launch): same observer, same settle (spec D6).
471
+ resetFixture();
472
+ dash.input = "probe";
473
+ dash.openLaunchDialog();
474
+ result.launchMode = dash.mode === "launch";
475
+ dash.handleMouse(leftEvent("release"));
476
+ await sleep(30);
477
+ result.launchClears = clearCalls;
478
+
479
+ // 6. Unmount race (R2-D1): dispose() before flush blocks before any host
480
+ // read even when the host already carries a newer UI's selection.
481
+ resetFixture();
482
+ dash.handleMouse(leftEvent("release"));
483
+ const readsBeforeDispose = readCalls;
484
+ dash.dispose();
485
+ selectionText = "newer-ui-selection";
486
+ await sleep(30);
487
+ result.disposeRaceReads = readCalls - readsBeforeDispose;
488
+ result.disposeRaceClears = clearCalls;
489
+ result.disposeRaceRenders = renderCalls;
490
+ } catch (err) {
491
+ result.error = err instanceof Error ? err.stack : String(err);
492
+ } finally {
493
+ try { dash?.dispose(); } catch { /* already disposed in case 6 */ }
494
+ rmSync(root, { recursive: true, force: true });
495
+ }
496
+ console.log(JSON.stringify(result));
497
+ ```
498
+
499
+ - [ ] **Step 2: Write the failing wrapper test**
500
+
501
+ `test/dashboard-selection-settle.test.mjs`:
502
+
503
+ ```js
504
+ import assert from "node:assert/strict";
505
+ import test from "node:test";
506
+ import { execFileSync } from "node:child_process";
507
+ import { fileURLToPath } from "node:url";
508
+ import { join } from "node:path";
509
+
510
+ const ROOT_DIR = fileURLToPath(new URL("../", import.meta.url));
511
+ const SCENARIO = join(ROOT_DIR, "test-support", "dashboard-selection-settle-scenario.ts");
512
+
513
+ // Issue #258: the board must settle pi's fullscreen selection after
514
+ // copy-on-select, through the same shared core the attach view uses.
515
+ test("dashboard selection settle: board observes mouse, defers settle, gates on dispose", () => {
516
+ const out = execFileSync(process.execPath, ["--experimental-transform-types", SCENARIO], {
517
+ encoding: "utf8",
518
+ timeout: 60_000,
519
+ });
520
+ const parsed = JSON.parse(out.trim().split("\n").filter(Boolean).pop());
521
+ assert.equal(parsed.error, null, `scenario error: ${parsed.error}`);
522
+ assert.equal(parsed.releaseUndefined, true, "handleMouse must never consume (returns undefined)");
523
+ assert.equal(parsed.listClears, 1, "list-mode release clears pi's selection exactly once");
524
+ assert.equal(parsed.listRenders, 1, "a successful clear schedules exactly one repaint");
525
+ assert.equal(parsed.coalescedClears, 0, "a release+press in one tick must not clear the new gesture");
526
+ assert.equal(parsed.nonEndingClears, 0, "right/middle/move/wheel events never settle");
527
+ assert.equal(parsed.filterMode, true, "case 4 must actually enter filter mode");
528
+ assert.equal(parsed.filterClears, 1, "editor-bearing mode (filter) settles the same way (D6)");
529
+ assert.equal(parsed.launchMode, true, "case 5 must actually enter launch mode");
530
+ assert.equal(parsed.launchClears, 1, "editor-bearing mode (launch) settles the same way (D6)");
531
+ assert.equal(parsed.disposeRaceReads, 0, "dispose() before flush blocks before any host read (R2-D1)");
532
+ assert.equal(parsed.disposeRaceClears, 0, "dispose() before flush must not clear");
533
+ assert.equal(parsed.disposeRaceRenders, 0, "dispose() before flush must not repaint");
534
+ });
535
+ ```
536
+
537
+ - [ ] **Step 3: Run to verify it fails**
538
+
539
+ Run: `node --test test/dashboard-selection-settle.test.mjs`
540
+ Expected: FAIL — `dash.handleMouse is not a function`.
541
+
542
+ - [ ] **Step 4: Wire the board**
543
+
544
+ In `src/ui/dashboard.ts`:
545
+
546
+ 1. Imports — add near the existing pi-tui type import (`:3`): `TuiMouseEvent, TuiMouseEventResult` inside the existing `import type { ... } from "@earendil-works/pi-tui";` line. Add `import { createFullscreenSelectionSettler } from "../core/fullscreen-selection.mjs";` and `import type { FullscreenSelectionHost } from "./pty-attach.ts";` with the other core/ui imports.
547
+ 2. Fields — next to `private needsFullClear = true;`:
548
+
549
+ ```ts
550
+ /** Issue #258: set at dispose() so a settle queued before unmount cannot
551
+ * touch pi-level selection state afterwards (the gesture serial only grows
552
+ * on presses this component still observes). */
553
+ private disposed = false;
554
+ private readonly selectionSettler: ReturnType<typeof createFullscreenSelectionSettler>;
555
+ ```
556
+
557
+ 3. Constructor body — after `this.selectedId = deps.initialSelectedId ?? null;`:
558
+
559
+ ```ts
560
+ this.selectionSettler = createFullscreenSelectionSettler({
561
+ host: tui as unknown as FullscreenSelectionHost,
562
+ repaint: () => this.tui.requestRender(),
563
+ shouldSettle: () => !this.disposed,
564
+ });
565
+ ```
566
+
567
+ 4. `handleInput` (`:314`) — add a sibling method right after it:
568
+
569
+ ```ts
570
+ /** Issue #258: observe-only mouse hook. pi keeps every gesture (selection,
571
+ * copy, links); the settler only drops the stale highlight after
572
+ * copy-on-select. Always returns undefined — never consumes. */
573
+ handleMouse(_event: TuiMouseEvent): TuiMouseEventResult | undefined {
574
+ this.selectionSettler.observeMouse(_event);
575
+ return undefined;
576
+ }
577
+ ```
578
+
579
+ 5. `dispose()` (`:1266`) — set the gate first:
580
+
581
+ ```ts
582
+ dispose(): void {
583
+ /* poll interval is owned by the factory */
584
+ this.disposed = true;
585
+ this.prewarmScheduler.cancel();
586
+ }
587
+ ```
588
+
589
+ - [ ] **Step 5: Run to verify it passes**
590
+
591
+ Run: `node --test test/dashboard-selection-settle.test.mjs`
592
+ Expected: PASS.
593
+
594
+ - [ ] **Step 6: Typecheck**
595
+
596
+ Run: `npm run typecheck`
597
+ Expected: exit 0.
598
+
599
+ - [ ] **Step 7: Commit**
600
+
601
+ ```bash
602
+ git add src/ui/dashboard.ts test-support/dashboard-selection-settle-scenario.ts test/dashboard-selection-settle.test.mjs
603
+ git commit -m "fix(dashboard): settle pi's fullscreen selection highlight after copy-on-release (issue #258)"
604
+ ```
605
+
606
+ **Acceptance: A3**
607
+
608
+ ---
609
+
610
+ ### Task 4: Real dispatch chain via SGR injection (A4)
611
+
612
+ **Files:**
613
+ - Modify: `test-support/dashboard-tui-modes.ts` (fullscreen-only mouse case inside the loop, after the folded-navigation assertions and BEFORE the overlay-recreate section)
614
+ - Create: `test/dashboard-tui-modes.test.mjs`
615
+
616
+ **Interfaces:**
617
+ - Consumes: the real `TuiAltScreen` selection seam (`getActiveSelectionText`) and the board's `handleMouse` from Task 3; the existing `input`/`frame` helpers and `results` array of the scenario.
618
+ - Produces: `mouseSettleOk` field on the fullscreen result entry (`true` after the case passes; `null` for regular mode).
619
+
620
+ - [ ] **Step 1: Append the failing case to the scenario**
621
+
622
+ In `test-support/dashboard-tui-modes.ts`, just before the `// Recreate the overlay as the command does...` comment, insert:
623
+
624
+ ```ts
625
+ // Issue #258: real dispatch chain — SGR mouse into the REAL TuiAltScreen,
626
+ // overlay hit-test to DashboardComponent.handleMouse (observe only), pi
627
+ // finalizes + copies, the board's deferred settle clears the selection.
628
+ let mouseSettleOk: boolean | null = null;
629
+ if (mode === "fullscreen") {
630
+ const sel = () => (tui as any).getActiveSelectionText?.();
631
+ assert.ok(!sel(), `${mode}: no selection before the gesture`);
632
+ input("\x1b[<0;5;2M"); // left press (col 5, row 2)
633
+ input("\x1b[<32;15;2M"); // left drag (SGR button 32 = motion with button 1)
634
+ const during = sel();
635
+ assert.ok(typeof during === "string" && during.length > 0, `${mode}: drag must establish a non-empty selection (got ${JSON.stringify(during)})`);
636
+ input("\x1b[<0;15;2m"); // left release
637
+ await frame(); // repaint after clear
638
+ await new Promise<void>((resolve) => setImmediate(resolve)); // flush the nextTick settle
639
+ assert.ok(!sel(), `${mode}: release must clear the selection via the board's settler`);
640
+ mouseSettleOk = true;
641
+ }
642
+ ```
643
+
644
+ and change the closing push to carry it:
645
+
646
+ ```ts
647
+ results.push({ mode, frames, mouseSettleOk, ok: true });
648
+ ```
649
+
650
+ (Existing consumers only read `mode`/`ok` — `test/dashboard-fold.test.mjs` stays untouched and green. If the SGR coordinates fail to establish a selection on the first try, adjusting row/col numbers is acceptable; weakening either assertion is NOT — see the spec's A4 downgrade rule.)
651
+
652
+ - [ ] **Step 2: Write the failing wrapper test**
653
+
654
+ `test/dashboard-tui-modes.test.mjs`:
655
+
656
+ ```js
657
+ import assert from "node:assert/strict";
658
+ import test from "node:test";
659
+ import { execFileSync } from "node:child_process";
660
+ import { fileURLToPath } from "node:url";
661
+ import { join } from "node:path";
662
+
663
+ const ROOT_DIR = fileURLToPath(new URL("../", import.meta.url));
664
+ const SCENARIO = join(ROOT_DIR, "test-support", "dashboard-tui-modes.ts");
665
+
666
+ // Issue #258 A4: the full dispatch chain — synthetic SGR drag/release into the
667
+ // real TuiAltScreen, overlay hit-test to the board's handleMouse, deferred
668
+ // settle clearing pi's selection. Non-empty precondition first (R1-G3).
669
+ test("dashboard tui modes: fullscreen SGR drag-select settles through the board", () => {
670
+ const out = execFileSync(process.execPath, ["--experimental-transform-types", SCENARIO], {
671
+ encoding: "utf8",
672
+ timeout: 60_000,
673
+ });
674
+ const results = JSON.parse(out);
675
+ assert.deepEqual(results.map(({ mode }) => mode), ["regular", "fullscreen"]);
676
+ const fullscreen = results.find((r) => r.mode === "fullscreen");
677
+ assert.equal(fullscreen.ok, true);
678
+ assert.equal(fullscreen.mouseSettleOk, true, "fullscreen run must pass the SGR settle case");
679
+ const regular = results.find((r) => r.mode === "regular");
680
+ assert.equal(regular.mouseSettleOk, null, "regular mode has no fullscreen selection seam");
681
+ });
682
+ ```
683
+
684
+ - [ ] **Step 3: Run to verify it fails**
685
+
686
+ Run: `node --test test/dashboard-tui-modes.test.mjs`
687
+ Expected: FAIL — `mouseSettleOk` is `undefined`/`null` for fullscreen until Task 3's `handleMouse` exists (it does by now) and the scenario case is in; with the case in and something wrong it fails on one of the two assertions.
688
+
689
+ - [ ] **Step 4: Run to verify it passes (both wrappers)**
690
+
691
+ Run: `node --test test/dashboard-tui-modes.test.mjs test/dashboard-fold.test.mjs`
692
+ Expected: PASS — new wrapper green, existing fold wrapper green.
693
+
694
+ - [ ] **Step 5: Commit**
695
+
696
+ ```bash
697
+ git add test-support/dashboard-tui-modes.ts test/dashboard-tui-modes.test.mjs
698
+ git commit -m "test(dashboard): real-dispatch SGR settle case in the tui-modes harness (issue #258)"
699
+ ```
700
+
701
+ **Acceptance: A4**
702
+
703
+ ---
704
+
705
+ ### Task 5: Full gate (A5)
706
+
707
+ **Files:** none (verification only)
708
+
709
+ - [ ] **Step 1: Run the full verify suite**
710
+
711
+ Run: `npm run verify`
712
+ Expected: exit 0 — typecheck, perf gate, full tests (incl. all four new/extended test files), coverage thresholds, pack:dry.
713
+
714
+ - [ ] **Step 2: If anything reds**
715
+
716
+ Fix within the task that owns the file; re-run `npm run verify`. Known unrelated flake signatures live in issue #95's ledger — if a red matches one of those signatures (rerun green in isolation), record it in the PR body, do not chase it here.
717
+
718
+ **Acceptance: A5**
719
+
720
+ ---
721
+
722
+ ### Task 6: Post-merge manual verification (U1, U2) — cannot run pre-merge
723
+
724
+ **Files:** none — execution checklist recorded in the PR body.
725
+
726
+ - [ ] **Step 1: Update the real load checkout** (pi loads the extension from here, not the working copy):
727
+
728
+ ```bash
729
+ git -C ~/.pi/agent/git/github.com/zhuxixi/pi-agent-board restore package-lock.json # or stash — local dirty state, on record 2026-11-10
730
+ git -C ~/.pi/agent/git/github.com/zhuxixi/pi-agent-board pull --ff-only
731
+ ```
732
+
733
+ - [ ] **Step 2: U1 — drag-select copy clears the highlight**
734
+
735
+ Fully quit pi, restart in fullscreen, run `/agent-board`, drag-select a session name / log line, release. PASS = the text pastes from CLIPBOARD (Ctrl/Cmd+V — PRIMARY middle-click is NOT a condition, the board does not implement it) AND the inverse-video highlight disappears immediately without another click.
736
+
737
+ - [ ] **Step 3: U2 — double/triple-click unaffected**
738
+
739
+ On the same updated instance, double-click a word within 500 ms, then triple-click a line. PASS = word/line selection still happens and copies, and the highlight clears after each.
740
+
741
+ - [ ] **Step 4: Record results** (PASS/FAIL/pending) in the PR body acceptance ledger before merge; `pending` is acceptable pre-merge, silent skipping is not.
742
+
743
+ **Acceptance: U1, U2**
744
+
745
+ ---
746
+
747
+ ## Self-Review (run after writing — results)
748
+
749
+ - **Spec coverage:** D1→Task 1+2, D2→Task 1 (serial in core, unit-tested), D3→Task 1 (clear-only semantics preserved; no resetTextSelection anywhere), D4→Task 2 (attach-only mirror) + Task 3 (board passes no mirror), D5→Task 3 (+dispose gate from R2-D1), D6→Task 3 cases 4-5, A1→Task 1, A2→Task 2, A3→Task 3, A4→Task 4, A5→Task 5, U1/U2→Task 6. No spec acceptance item lacks a task; no task lacks an acceptance ID.
750
+ - **Placeholder scan:** no TBD/TODO; every code step carries real code; the only deliberate "adjust if needed" is A4's SGR coordinates (bounded by the no-weakening rule).
751
+ - **Type consistency:** `createFullscreenSelectionSettler` signature identical across Tasks 1-3; `FullscreenSelectionHost` exported (Task 2) before imported (Task 3); `mouseSettleOk` produced (Task 4 scenario) and consumed (Task 4 wrapper) with matching shape.
752
+
753
+ ---
754
+
755
+ ## Amendments (during implementation, all supervisor-approved)
756
+
757
+ 1. **Core module JSDoc types (Task 2, commit d3eca39).** `src/core/fullscreen-selection.mjs` now ships a doc-only `@typedef FullscreenSelectionSettlerOptions` (host / mirror / repaint / schedule / shouldSettle) plus `@param`/`@returns` on `createFullscreenSelectionSettler`, following the `JiggleRetryControllerDeps` convention. Reason: with `allowJs: true` + `checkJs: false`, tsc infers an untyped `.mjs` options parameter only from defaulted destructured properties — `host`/`mirror`/`repaint`/`shouldSettle` were absent from the inferred type and every `.ts` call site failed TS2353/TS7006. Runtime identical; Task 1 tests 8/8 after the patch. Task 3's call site typechecks naturally because of this.
758
+ 2. **Task 2 TDD evidence is mutation-RED.** Neutralizing the pre-existing closed-gate made the two new assertions fail (`1 !== 0`), then the mutation was reverted. A behavior-preserving refactor whose guard already exists cannot produce a natural RED; the brief's Step-3 FAIL prediction was self-contradictory and is superseded by this.
759
+ 3. **Task 2 scenario case numbered `// 10.`** (the scenario already had cases 1–9; brief said `// 8.`).
760
+ 4. **Task 1 test-fixture presence-check and serial-assert placement corrections** — documented in task-1-report.md; the Task 1 code blocks above already reflect them.