@zhuxixi/pi-agent-board 0.12.0 → 0.13.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.
- package/CHANGELOG.md +36 -0
- package/README.md +7 -7
- package/docs/superpowers/plans/2026-10-19-issue-213-reply-guard-csi-key.md +257 -0
- package/docs/superpowers/plans/2026-10-19-issue-214-attach-forward-alt-modifier.md +202 -0
- 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/specs/2026-10-14-issue-170-attach-reply-guard-design.md +5 -0
- package/docs/superpowers/specs/2026-10-19-issue-213-reply-guard-csi-key-design.md +165 -0
- package/docs/superpowers/specs/2026-10-19-issue-214-attach-forward-alt-modifier-design.md +131 -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/package.json +3 -3
- package/runner/pty-runner.mjs +18 -22
- package/runner/state-coordinator.mjs +213 -26
- package/scripts/release_helper.mjs +39 -7
- 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 +69 -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 +21 -14
- package/src/core/state-commands.mjs +5 -1
- package/src/core/terminal-reply-guard.mjs +26 -4
- 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 +48 -25
- package/src/ui/pty-attach.ts +18 -7
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.0] - 2026-10-26
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- **ui**: vim-style j/k/l board keys — j/k navigate, l attaches (issue #229) (#237)
|
|
13
|
+
- **ui**: paint the selected board row with selectedBg (issue #231) (#233)
|
|
14
|
+
|
|
15
|
+
### Fixes
|
|
16
|
+
|
|
17
|
+
- **coordinator**: verify lease identity before signalling (issue #239) (#247)
|
|
18
|
+
- **dashboard**: keep selected rows visible beside scroll markers (#226)
|
|
19
|
+
- **attach**: render cells that only carry a background (#235)
|
|
20
|
+
- **coordinator**: root-vanished self-exit and suite leak gate (issue #241) (#244)
|
|
21
|
+
- **host**: unify process identity tokens and produce them on win32 (issue #238) (#243)
|
|
22
|
+
- **host**: keep warm hosts alive while a background workflow run is active (issue #230) (#242)
|
|
23
|
+
- **host**: corroborate unverified process identity to unstick pid-reuse recovery (issue #217) (#240)
|
|
24
|
+
- **lease**: reclaim stale coordinator leases by heartbeat instead of pid liveness (issue #224) (#236)
|
|
25
|
+
- keep foreground rows monotonic across out-of-order state writes (#228)
|
|
26
|
+
- recognize ask_user_question and questionnaire-shaped tools as pending questions (#223)
|
|
27
|
+
|
|
28
|
+
[0.13.0]: https://github.com/zhuxixi/pi-agent-board/compare/v0.12.1...v0.13.0
|
|
29
|
+
|
|
30
|
+
## [0.12.1] - 2026-10-20
|
|
31
|
+
|
|
32
|
+
### Fixes
|
|
33
|
+
|
|
34
|
+
- **release**: collapse repeated trailing PR refs in CHANGELOG entries (#218)
|
|
35
|
+
- **attach**: keep the Alt modifier on the forwarded wheel report (#216)
|
|
36
|
+
- **attach**: stop the reply guard swallowing kitty/modifyOtherKeys PageDown (#215)
|
|
37
|
+
|
|
38
|
+
### Changes
|
|
39
|
+
|
|
40
|
+
- **attach**: tidy the mouse-enable helper placement and comment indent (#209)
|
|
41
|
+
|
|
42
|
+
[0.12.1]: https://github.com/zhuxixi/pi-agent-board/compare/v0.12.0...v0.12.1
|
|
43
|
+
|
|
8
44
|
## [0.12.0] - 2026-10-19
|
|
9
45
|
|
|
10
46
|
### Features
|
package/README.md
CHANGED
|
@@ -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. |
|
|
@@ -156,12 +156,12 @@ Peek shows the selected session's summary, blocker or question, latest output, a
|
|
|
156
156
|
| Key | Action |
|
|
157
157
|
| --- | --- |
|
|
158
158
|
| `r` or `Enter` | Enter reply mode; type a follow-up and press `Enter` to send it without attaching. |
|
|
159
|
-
| `a`, `Right`, or
|
|
159
|
+
| `a`, `Right`, `>`, or `l` | Attach to the session. |
|
|
160
160
|
| `v` | Open the read-only transcript. |
|
|
161
161
|
| `e` | Open Evidence / Diagnostics. |
|
|
162
162
|
| `d` | Confirm marking the inactive session Done. |
|
|
163
163
|
| `h` | Hold or unhold the session. |
|
|
164
|
-
| `Up` / `Down` | Move to the previous or next session. |
|
|
164
|
+
| `Up` / `Down` / `j` / `k` | Move to the previous or next session. |
|
|
165
165
|
| `Esc` | Return to the main list. |
|
|
166
166
|
|
|
167
167
|
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 +172,7 @@ The `v` view is a read-only projection of the durable Pi session JSONL. It does
|
|
|
172
172
|
|
|
173
173
|
| Key | Action |
|
|
174
174
|
| --- | --- |
|
|
175
|
-
| `Up` / `Down` | Scroll one line. |
|
|
175
|
+
| `Up` / `Down` / `j` / `k` | Scroll one line. |
|
|
176
176
|
| `PageUp` / `PageDown` | Scroll one page. |
|
|
177
177
|
| `Space` | Open Peek. |
|
|
178
178
|
| `r` | Enter reply mode. |
|
|
@@ -188,11 +188,11 @@ The `e` view shows durable session evidence, including changed files, commands a
|
|
|
188
188
|
|
|
189
189
|
| Key | Action |
|
|
190
190
|
| --- | --- |
|
|
191
|
-
| `Up` / `Down` | Scroll one line. |
|
|
191
|
+
| `Up` / `Down` / `j` / `k` | Scroll one line. |
|
|
192
192
|
| `PageUp` / `PageDown` | Scroll one page. |
|
|
193
193
|
| `r` | Enter reply mode. |
|
|
194
194
|
| `v` | Open the read-only transcript. |
|
|
195
|
-
| `Enter`, `a`, or `
|
|
195
|
+
| `Enter`, `a`, `Right`, or `l` | Attach to the session. |
|
|
196
196
|
| `x` | Clear diagnostics; evidence is preserved. |
|
|
197
197
|
| `Left` / `Esc` / `<` | Return to the main list. |
|
|
198
198
|
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# reply guard CSI-key collision — 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:** Stop the reply guard from swallowing kitty/modifyOtherKeys PageDown (`\x1b[6;<mods>u` / `\x1b[6;<mods>~`) while keeping every genuine cell-size reply fragment armed.
|
|
6
|
+
|
|
7
|
+
**Architecture:** One new pure predicate in `src/core/terminal-reply-guard.mjs`: a *complete* CSI key sequence is user input and must be classified before the `REPLY_HEADS` prefix loop. Every fragment shape the guard protects today has no `u`/`~` terminator, so the predicate cannot weaken #170's protection.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** ESM `.mjs` core module, `node:test` + `assert/strict`, TypeScript component (unchanged), `@earendil-works/pi-tui` (unchanged).
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-10-19-issue-213-reply-guard-csi-key-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Tabs for indentation; English comments and commit messages (repo AGENTS.md).
|
|
16
|
+
- No new dependencies.
|
|
17
|
+
- `npm run verify` must pass on CI (typecheck + perf gate + tests + coverage + pack dry-run). Locally only the targeted suites plus `typecheck`/`pack:dry` are authoritative — this Windows host has a pre-existing ~72-test baseline failure set that also fails on `main`.
|
|
18
|
+
- New test names carry the `#213-` prefix (spec §6 "验收 ID 作用域") to avoid colliding with the `A1:`/`A2:`/… names already in `test/terminal-reply-guard.test.mjs`.
|
|
19
|
+
- Do not change `REPLY_HEADS`, the absorption window (250 ms / 64 bytes), or the kill switch.
|
|
20
|
+
|
|
21
|
+
## Review Focus
|
|
22
|
+
|
|
23
|
+
- **A genuine cell-size fragment that looks like a key** — `\x1b[6;` and `\x1b[6;24` (no terminator) must still `reply-head` and arm; only `u`/`~`-terminated sequences are keys.
|
|
24
|
+
- **A complete reply that looks like a key** — `\x1b[6;24;80t` must still be `reply-complete`/drop (DROP_SHAPES runs first).
|
|
25
|
+
- **Other kitty functional keys that share a head prefix** — `\x1b[6;1:2;65u` (alternate keys) must also be treated as a key, which is why the predicate is `(?:[;:]\d+)*` and not the narrower form in the issue text.
|
|
26
|
+
- **A key that arrives while the guard is armed** — an armed window must not swallow it silently; the state machine's `armed + other` path drops the stale buffer and passes the event.
|
|
27
|
+
- **Plain text right after a key** — forwarding must stay byte-exact (no duplication, no reordering).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Task 1: Classify complete CSI keys before the head prefixes
|
|
32
|
+
|
|
33
|
+
**Files:**
|
|
34
|
+
- Modify: `src/core/terminal-reply-guard.mjs` (add `CSI_KEY_SEQUENCE` near the other shape constants, and one branch in `classifyReplyEvent`)
|
|
35
|
+
- Test: `test/terminal-reply-guard.test.mjs`
|
|
36
|
+
|
|
37
|
+
**Interfaces:**
|
|
38
|
+
- Produces: `classifyReplyEvent(data)` now returns `{ kind: "other" }` for `CSI <num>[;<mod>[:<event>][;<alt>]]{u,~}`. No exported symbol changes.
|
|
39
|
+
|
|
40
|
+
- [ ] **Step 1: Write the failing tests**
|
|
41
|
+
|
|
42
|
+
Append to `test/terminal-reply-guard.test.mjs`:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// Issue #213: kitty / modifyOtherKeys PageDown shares the cell-size head prefix.
|
|
46
|
+
test("#213-A1: a complete CSI key sequence is user input, never a reply head", () => {
|
|
47
|
+
for (const seq of ["\x1b[6;1u", "\x1b[6;5u", "\x1b[6;1:2u", "\x1b[6;1:2;65u", "\x1b[6;5~", "\x1b[6;2~"]) {
|
|
48
|
+
assert.deepEqual(classifyReplyEvent(seq), { kind: "other" }, `${JSON.stringify(seq)} must be a key`);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("#213-A2: neighbouring keys are unaffected", () => {
|
|
53
|
+
for (const seq of ["\x1b[5;1u", "\x1b[5;5~", "\x1b[57422u", "\x1b[57421u", "\x1b[3;5~"]) {
|
|
54
|
+
assert.deepEqual(classifyReplyEvent(seq), { kind: "other" }, `${JSON.stringify(seq)} must stay a key`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("#213-A3: genuine cell-size fragments still arm", () => {
|
|
59
|
+
for (const seq of ["\x1b[6;", "\x1b[6;24"]) {
|
|
60
|
+
assert.deepEqual(classifyReplyEvent(seq), { kind: "reply-head", family: "cell-size" });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("#213-A4: a complete cell-size reply still drops", () => {
|
|
65
|
+
assert.deepEqual(classifyReplyEvent("\x1b[6;24;80t"), { kind: "reply-complete", family: "cell-size", action: "drop" });
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- [ ] **Step 2: Run the tests to verify they fail**
|
|
70
|
+
|
|
71
|
+
Run: `node --test test/terminal-reply-guard.test.mjs`
|
|
72
|
+
Expected: FAIL — `#213-A1` reports `{ kind: "reply-head", family: "cell-size" }` for `\x1b[6;1u` / `\x1b[6;5~`.
|
|
73
|
+
|
|
74
|
+
- [ ] **Step 3: Implement the predicate**
|
|
75
|
+
|
|
76
|
+
In `src/core/terminal-reply-guard.mjs`, next to `REPLY_HEADS`:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
// Issue #213: kitty keyboard protocol keys that carry a modifier use the legacy
|
|
80
|
+
// functional-key encoding `CSI <num>;<mods>u`, and PageDown's legacy number IS 6
|
|
81
|
+
// (`\x1b[6;1u` = no modifier, mods field is bitmask+1). modifyOtherKeys uses the same
|
|
82
|
+
// prefix with `~` (`\x1b[6;5~`). Both therefore share the cell-size head prefix
|
|
83
|
+
// (`\x1b[6;`), which used to arm the guard and swallow the key — asymmetric with
|
|
84
|
+
// PageUp (key number 5) and invisible to the previous tests.
|
|
85
|
+
//
|
|
86
|
+
// A COMPLETE CSI key is user input, never a reply fragment: check it before the head
|
|
87
|
+
// prefixes. Only the terminator decides — geniune cell-size fragments (`\x1b[6;`,
|
|
88
|
+
// `\x1b[6;24`) carry no `u`/`~` and still arm below. `(?:[;:]\d+)*` also covers the
|
|
89
|
+
// alternate-key form (`\x1b[6;1:2;65u`), which a narrower `(?:;\d+)?(?::\d+)?` misses.
|
|
90
|
+
const CSI_KEY_SEQUENCE = /^\x1b\[\d+(?:[;:]\d+)*[u~]$/;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
and in `classifyReplyEvent`, after the `FORWARD_SHAPES` loop and **before** the `REPLY_HEADS` loop:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
// Issue #213: a complete CSI key wins over the head prefixes (see CSI_KEY_SEQUENCE).
|
|
97
|
+
if (CSI_KEY_SEQUENCE.test(data)) return { kind: "other" };
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- [ ] **Step 4: Run the tests to verify they pass**
|
|
101
|
+
|
|
102
|
+
Run: `node --test test/terminal-reply-guard.test.mjs test/pty-scroll.test.mjs`
|
|
103
|
+
Expected: PASS (the four new tests plus the existing 15).
|
|
104
|
+
|
|
105
|
+
- [ ] **Step 5: Commit**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git add src/core/terminal-reply-guard.mjs test/terminal-reply-guard.test.mjs
|
|
109
|
+
git commit -m "fix(attach): classify complete CSI keys before the reply-guard head prefixes (issue #213)"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### Task 2: Prove the key actually reaches the child
|
|
115
|
+
|
|
116
|
+
**Files:**
|
|
117
|
+
- Modify: `test-support/attach-reply-guard-smoke.ts` (new case + result fields)
|
|
118
|
+
- Modify: `test/pty-attach-reply-guard.test.mjs` (assertions)
|
|
119
|
+
|
|
120
|
+
**Interfaces:**
|
|
121
|
+
- Consumes: `classifyReplyEvent` behaviour from Task 1 through the real `PtyAttachComponent.handleInput`.
|
|
122
|
+
- Produces: `out.guardedPageDown: string[]`, `out.guardedPageDownThenText: string[]` in the smoke's JSON.
|
|
123
|
+
|
|
124
|
+
- [ ] **Step 1: Write the failing assertions**
|
|
125
|
+
|
|
126
|
+
In `test/pty-attach-reply-guard.test.mjs`:
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
assert.deepEqual(parsed.guardedPageDown, ["\x1b[6;1u", "\x1b[6;5~"], "kitty and modifyOtherKeys PageDown must be forwarded to the child, not swallowed");
|
|
130
|
+
assert.deepEqual(parsed.guardedPageDownThenText, ["\x1b[6;1u", "x"], "text after a key must still be forwarded verbatim");
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- [ ] **Step 2: Run to verify it fails**
|
|
134
|
+
|
|
135
|
+
Run: `node --test test/pty-attach-reply-guard.test.mjs`
|
|
136
|
+
Expected: FAIL — `parsed.guardedPageDown` is `undefined`.
|
|
137
|
+
|
|
138
|
+
- [ ] **Step 3: Implement the smoke case**
|
|
139
|
+
|
|
140
|
+
In `test-support/attach-reply-guard-smoke.ts`, next to the existing `guardedFragments` case:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
// Issue #213: a complete CSI key must reach the child, not the absorption window.
|
|
144
|
+
f.attach.handleInput("\x1b[6;1u");
|
|
145
|
+
f.attach.handleInput("\x1b[6;5~");
|
|
146
|
+
out.guardedPageDown = [...f.sent];
|
|
147
|
+
|
|
148
|
+
// …and the bytes that follow a key are still forwarded verbatim.
|
|
149
|
+
f.attach.handleInput("\x1b[6;1u");
|
|
150
|
+
f.attach.handleInput("x");
|
|
151
|
+
out.guardedPageDownThenText = [...f.sent];
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- [ ] **Step 4: Run to verify it passes**
|
|
155
|
+
|
|
156
|
+
Run: `node --test test/pty-attach-reply-guard.test.mjs`
|
|
157
|
+
Expected: PASS.
|
|
158
|
+
|
|
159
|
+
- [ ] **Step 5: Commit**
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
git add test-support/attach-reply-guard-smoke.ts test/pty-attach-reply-guard.test.mjs
|
|
163
|
+
git commit -m "test(attach): pin that kitty PageDown reaches the child through the reply guard (issue #213)"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### Task 3: Retire the pinned invariant in the docs
|
|
169
|
+
|
|
170
|
+
**Files:**
|
|
171
|
+
- Modify: `src/core/terminal-reply-guard.mjs` (module header comment)
|
|
172
|
+
- Modify: `docs/superpowers/specs/2026-10-14-issue-170-attach-reply-guard-design.md` (§3.3 design-points list)
|
|
173
|
+
|
|
174
|
+
**Interfaces:**
|
|
175
|
+
- Consumes: nothing at runtime; produces the text the A8 static check greps for.
|
|
176
|
+
|
|
177
|
+
- [ ] **Step 1: Update the module header**
|
|
178
|
+
|
|
179
|
+
In the `terminal-reply-guard.mjs` header, extend the paragraph that lists what arms a window with:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
* Issue #213: `\x1b[6;` is NOT a "can never be a key" prefix — kitty's functional-key
|
|
183
|
+
* encoding puts PageDown at `CSI 6;<mods>u` (and modifyOtherKeys at `\x1b[6;<mods>~`).
|
|
184
|
+
* The rule is therefore "a COMPLETE CSI key sequence (`u`/`~` terminated) beats the head
|
|
185
|
+
* prefixes", not "these prefixes are never keys". Fragments without a terminator still arm.
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- [ ] **Step 2: Append the correction to the #170 design doc**
|
|
189
|
+
|
|
190
|
+
In `docs/superpowers/specs/2026-10-14-issue-170-attach-reply-guard-design.md`, at the end of the §3.3 design-points list (do NOT rewrite L106 — append):
|
|
191
|
+
|
|
192
|
+
```markdown
|
|
193
|
+
7. **修正(issue #213)**:上一条「`ESC[6;` 永不可能是按键前缀」已被推翻 —— kitty 功能键编码
|
|
194
|
+
把 PageDown 放在 `CSI 6;<mods>u`(modifyOtherKeys 为 `\x1b[6;<mods>~`),与 cell-size 的
|
|
195
|
+
`ESC[6;` 共享前缀。现行规则是「**完整 CSI 键序列(以 `u`/`~` 终结)优先于 head 前缀**」,
|
|
196
|
+
不带终结符的片段仍然武装。实现见 `CSI_KEY_SEQUENCE`。
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
- [ ] **Step 3: Verify the A8 greps**
|
|
200
|
+
|
|
201
|
+
Run:
|
|
202
|
+
```bash
|
|
203
|
+
grep -n "complete CSI key" src/core/terminal-reply-guard.mjs
|
|
204
|
+
grep -n "完整 CSI 键序列优先.*#213" docs/superpowers/specs/2026-10-14-issue-170-attach-reply-guard-design.md
|
|
205
|
+
grep -c "can never be a key" src/core/terminal-reply-guard.mjs
|
|
206
|
+
```
|
|
207
|
+
Expected: the first two each match at least once (the first inside the module header, not inside a function body); the third prints 0.
|
|
208
|
+
|
|
209
|
+
- [ ] **Step 4: Commit**
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
git add src/core/terminal-reply-guard.mjs docs/superpowers/specs/2026-10-14-issue-170-attach-reply-guard-design.md
|
|
213
|
+
git commit -m "docs(attach): retire the 'ESC[6; is never a key' invariant (issue #213)"
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### Task 4: Full gate
|
|
219
|
+
|
|
220
|
+
**Files:** none (verification only).
|
|
221
|
+
|
|
222
|
+
- [ ] **Step 1: Type/static checks**
|
|
223
|
+
|
|
224
|
+
Run: `npm run typecheck && npm run pack:dry`
|
|
225
|
+
Expected: both clean.
|
|
226
|
+
|
|
227
|
+
- [ ] **Step 2: Targeted suites**
|
|
228
|
+
|
|
229
|
+
Run: `node --test test/terminal-reply-guard.test.mjs test/pty-attach-reply-guard.test.mjs test/pty-scroll.test.mjs test/pty-attach-wheel.test.mjs`
|
|
230
|
+
Expected: all green.
|
|
231
|
+
|
|
232
|
+
- [ ] **Step 3: Baseline comparison**
|
|
233
|
+
|
|
234
|
+
Run: `node --test test/pty-attach-*.test.mjs` and compare the failing set against the known Windows-host baseline (same set as on `main`; no new names).
|
|
235
|
+
Expected: no new failures.
|
|
236
|
+
|
|
237
|
+
- [ ] **Step 4: Commit**
|
|
238
|
+
|
|
239
|
+
Nothing to commit — this task is the gate the PR description cites.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### Task 5: Manual verification (U1)
|
|
244
|
+
|
|
245
|
+
**Files:** none.
|
|
246
|
+
|
|
247
|
+
- [ ] **Step 1: Load the fix into a real pi**
|
|
248
|
+
|
|
249
|
+
Per spec §6.1: `pi install "$(pwd)"` (README.md:54) or symlink the worktree to
|
|
250
|
+
`~/.pi/agent/extensions/agent-board`, **not** the `~/.pi/agent/git/...` cache clone.
|
|
251
|
+
|
|
252
|
+
- [ ] **Step 2: Restart pi completely** and open a new attach session.
|
|
253
|
+
|
|
254
|
+
- [ ] **Step 3: Press PageDown in the attach view** (WezTerm + pi fullscreen).
|
|
255
|
+
Expected: the panel scrolls one page backwards, mirroring PageUp; no swallowed key.
|
|
256
|
+
|
|
257
|
+
- [ ] **Step 4: Record the outcome** in the issue (pass/fail + observed behaviour).
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# attach forward Alt modifier — 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:** Preserve the Alt modifier when the attach view forwards a wheel notch to a fullscreen child, so Alt+wheel keeps its 5× accelerator.
|
|
6
|
+
|
|
7
|
+
**Architecture:** `encodeWheelReport` gains an optional `alt` flag that sets SGR bit 3 (`+8`); `forwardWheelToChild` passes `event.alt === true` through. Nothing else changes — the local scroll path never rebuilds the report.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** ESM `.mjs` pure helper, TypeScript component shell, `node:test` + `assert/strict`.
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-10-19-issue-214-attach-forward-alt-modifier-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Tabs for indentation; English comments and commit messages (repo AGENTS.md).
|
|
16
|
+
- No new dependencies.
|
|
17
|
+
- Local `npm run verify` cannot go green on this Windows host (pre-existing ~72-test baseline that also fails on `main`); the authoritative local gates are the targeted suites plus `npm run typecheck` and `npm run pack:dry`. CI is the final gate.
|
|
18
|
+
- `alt` must be compared strictly (`=== true`), never by truthiness: a stray `1`/`"yes"` must not set bit 3.
|
|
19
|
+
- Do not touch the local scroll path, the reply guard, or the input classifier.
|
|
20
|
+
|
|
21
|
+
## Review Focus
|
|
22
|
+
|
|
23
|
+
- **A truthy non-boolean `alt`** — `alt: 1` and `alt: "yes"` must NOT set bit 3, because the component passes `event.alt === true` (an older pi-tui could hand over something unexpected).
|
|
24
|
+
- **Plain wheel parity** — with no Alt, the encoded report must stay byte-identical to today's (`\x1b[<64;…M` / `\x1b[<65;…M`); the existing #198/#205 assertions must keep passing untouched.
|
|
25
|
+
- **The forward hop is the only seam** — the legacy regular-mode path forwards the raw SGR unchanged and already carries Alt; a change that also rewrote that path would be a scope violation.
|
|
26
|
+
- **Down direction** — `alt + down` is `73`, not `72`; an implementation that ORs the bit onto a fixed 64 would break down-scroll.
|
|
27
|
+
- **Child-side consumption** — the byte must decode as `button & 8 !== 0` under pi-tui's `parseWheelEvent`; `72`/`73` satisfy that and `64`/`65` do not.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### Task 1: Encode the Alt bit in `encodeWheelReport`
|
|
32
|
+
|
|
33
|
+
**Files:**
|
|
34
|
+
- Modify: `src/core/pty-scroll.mjs` (`encodeWheelReport`, ~L370)
|
|
35
|
+
- Test: `test/pty-scroll.test.mjs`
|
|
36
|
+
|
|
37
|
+
**Interfaces:**
|
|
38
|
+
- Produces: `encodeWheelReport(direction: "up"|"down", { col?: number, row?: number, alt?: boolean }) -> string`. Default `alt: false` keeps every existing call site identical.
|
|
39
|
+
|
|
40
|
+
- [ ] **Step 1: Write the failing tests**
|
|
41
|
+
|
|
42
|
+
Append to `test/pty-scroll.test.mjs`:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// Issue #214: Alt is SGR bit 3 (value 8); the child's pi-tui reads it to apply the
|
|
46
|
+
// 5x wheel multiplier, so the forward hop must not strip it.
|
|
47
|
+
test("#214-A1: Alt+wheel-up encodes button 72", () => {
|
|
48
|
+
assert.equal(encodeWheelReport("up", { col: 5, row: 3, alt: true }), "\x1b[<72;5;3M");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("#214-A2: Alt+wheel-down encodes button 73", () => {
|
|
52
|
+
assert.equal(encodeWheelReport("down", { col: 5, row: 3, alt: true }), "\x1b[<73;5;3M");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("#214-A3: without a strict boolean true, bit 3 stays clear", () => {
|
|
56
|
+
for (const alt of [false, undefined, null, 0, 1, "yes"]) {
|
|
57
|
+
assert.equal(encodeWheelReport("up", { col: 5, row: 3, alt }), "\x1b[<64;5;3M", `alt=${String(alt)} must not set bit 3`);
|
|
58
|
+
assert.equal(encodeWheelReport("down", { col: 5, row: 3, alt }), "\x1b[<65;5;3M", `alt=${String(alt)} must not set bit 3`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- [ ] **Step 2: Run the tests to verify they fail**
|
|
64
|
+
|
|
65
|
+
Run: `node --test test/pty-scroll.test.mjs`
|
|
66
|
+
Expected: FAIL — `#214-A1` gets `\x1b[<64;5;3M` instead of `72`.
|
|
67
|
+
|
|
68
|
+
- [ ] **Step 3: Implement**
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
export function encodeWheelReport(direction, { col, row, alt = false } = {}) {
|
|
72
|
+
const base = direction === "up" ? 64 : 65;
|
|
73
|
+
// Issue #214: SGR bit 3 (value 8) is Alt. pi-tui multiplies by 5 when it is set,
|
|
74
|
+
// so the forward hop must carry it. Strict comparison: a truthy non-boolean must
|
|
75
|
+
// not flip the bit.
|
|
76
|
+
const button = alt === true ? base + 8 : base;
|
|
77
|
+
const cell = (v) => (Number.isFinite(v) ? Math.max(1, Math.floor(v)) : 1);
|
|
78
|
+
return `\x1b[<${button};${cell(col)};${cell(row)}M`;
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Keep the existing JSDoc's description of the direction/coordinates; add one line about `alt`.
|
|
83
|
+
|
|
84
|
+
- [ ] **Step 4: Run the tests to verify they pass**
|
|
85
|
+
|
|
86
|
+
Run: `node --test test/pty-scroll.test.mjs`
|
|
87
|
+
Expected: PASS (three new tests plus the existing suite).
|
|
88
|
+
|
|
89
|
+
- [ ] **Step 5: Commit**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git add src/core/pty-scroll.mjs test/pty-scroll.test.mjs
|
|
93
|
+
git commit -m "feat(attach): carry the Alt modifier in the forwarded wheel report (issue #214)"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Task 2: Pass `event.alt` through the forward hop
|
|
99
|
+
|
|
100
|
+
**Files:**
|
|
101
|
+
- Modify: `src/ui/pty-attach.ts` (`forwardWheelToChild`, ~L1477)
|
|
102
|
+
- Modify: `test-support/pty-attach-wheel-fallback-scenario.ts` (new alt round)
|
|
103
|
+
- Modify: `test/pty-attach-wheel-fallback.test.mjs` (new assertions)
|
|
104
|
+
|
|
105
|
+
**Interfaces:**
|
|
106
|
+
- Consumes: `encodeWheelReport(…, { alt })` from Task 1.
|
|
107
|
+
- Produces: scenario result fields `forwardedAltUp` / `forwardedAltDown`.
|
|
108
|
+
|
|
109
|
+
- [ ] **Step 1: Write the failing assertion**
|
|
110
|
+
|
|
111
|
+
In `test/pty-attach-wheel-fallback.test.mjs`, after the existing plain-wheel assertions (which must stay untouched):
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
assert.equal(parsed.forwardedAltUp, "\x1b[<72;4;3M", "Alt+wheel-up must reach the child as button 72");
|
|
115
|
+
assert.equal(parsed.forwardedAltDown, "\x1b[<73;4;3M", "Alt+wheel-down must reach the child as button 73");
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- [ ] **Step 2: Run to verify it fails**
|
|
119
|
+
|
|
120
|
+
Run: `node --test test/pty-attach-wheel-fallback.test.mjs`
|
|
121
|
+
Expected: FAIL — `parsed.forwardedAltUp` is `undefined`.
|
|
122
|
+
|
|
123
|
+
- [ ] **Step 3: Implement**
|
|
124
|
+
|
|
125
|
+
In `src/ui/pty-attach.ts` `forwardWheelToChild`, add the flag:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
data: encodeWheelReport(linesUp > 0 ? "up" : "down", {
|
|
129
|
+
col: clampInt(event.x + 1, 1, this.cols),
|
|
130
|
+
row: clampInt(event.y, 1, Math.max(1, this.bodyHeight())),
|
|
131
|
+
// Issue #214: the overlay already received the Alt bit from pi-tui; carry it
|
|
132
|
+
// into the synthesized report so the child keeps its 5x wheel accelerator.
|
|
133
|
+
alt: event.alt === true,
|
|
134
|
+
}),
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
In `test-support/pty-attach-wheel-fallback-scenario.ts`, add one more round using the existing `mouseBase` (do not modify the existing rounds, whose assertions are #198's regression pins):
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
// Issue #214: Alt must survive the forward hop.
|
|
141
|
+
let beforeAlt = forwardedInputs().length;
|
|
142
|
+
(component as any).handleMouse({ ...wheelEvent(-3), alt: true });
|
|
143
|
+
if (await waitFor(() => forwardedInputs().length > beforeAlt, 3000)) {
|
|
144
|
+
result.forwardedAltUp = forwardedInputs().at(-1) ?? null;
|
|
145
|
+
}
|
|
146
|
+
beforeAlt = forwardedInputs().length;
|
|
147
|
+
(component as any).handleMouse({ ...wheelEvent(2), alt: true });
|
|
148
|
+
if (await waitFor(() => forwardedInputs().length > beforeAlt, 3000)) {
|
|
149
|
+
result.forwardedAltDown = forwardedInputs().at(-1) ?? null;
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Declare both fields in the scenario's `result` object (`null as string | null`).
|
|
154
|
+
|
|
155
|
+
- [ ] **Step 4: Run to verify it passes**
|
|
156
|
+
|
|
157
|
+
Run: `node --test test/pty-attach-wheel-fallback.test.mjs`
|
|
158
|
+
Expected: PASS — the two new assertions and every existing #198 assertion.
|
|
159
|
+
|
|
160
|
+
- [ ] **Step 5: Commit**
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git add src/ui/pty-attach.ts test-support/pty-attach-wheel-fallback-scenario.ts test/pty-attach-wheel-fallback.test.mjs
|
|
164
|
+
git commit -m "fix(attach): forward the Alt modifier on the wheel hop (issue #214)"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### Task 3: Regression gate
|
|
170
|
+
|
|
171
|
+
**Files:** none.
|
|
172
|
+
|
|
173
|
+
- [ ] **Step 1: Targeted suites**
|
|
174
|
+
|
|
175
|
+
Run: `node --test test/pty-scroll.test.mjs test/pty-attach-wheel-fallback.test.mjs test/pty-attach-wheel.test.mjs test/pty-attach-frame-overflow.test.mjs test/pty-attach-alt-wheel.test.mjs test/pty-attach-mouse-mode.test.mjs test/terminal-reply-guard.test.mjs`
|
|
176
|
+
Expected: all green.
|
|
177
|
+
|
|
178
|
+
- [ ] **Step 2: Static gates**
|
|
179
|
+
|
|
180
|
+
Run: `npm run typecheck && npm run pack:dry`
|
|
181
|
+
Expected: both clean.
|
|
182
|
+
|
|
183
|
+
- [ ] **Step 3: Baseline comparison**
|
|
184
|
+
|
|
185
|
+
Run: `node --test test/pty-attach-*.test.mjs` and compare the failing set against the known Windows-host baseline. Expected: no new names.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### Task 4: Manual verification (U1)
|
|
190
|
+
|
|
191
|
+
**Files:** none.
|
|
192
|
+
|
|
193
|
+
- [ ] **Step 1: Load this checkout into pi**
|
|
194
|
+
|
|
195
|
+
`pi install "$(pwd)"` (README.md:54) or symlink to `~/.pi/agent/extensions/agent-board` — **not** the `~/.pi/agent/git/...` cache clone.
|
|
196
|
+
|
|
197
|
+
- [ ] **Step 2: Restart pi completely**, open a new attach session on a fullscreen child.
|
|
198
|
+
|
|
199
|
+
- [ ] **Step 3: Hold Alt and roll one wheel notch** in the attach view.
|
|
200
|
+
Expected: the child scrolls 5 lines, matching the behaviour outside attach.
|
|
201
|
+
|
|
202
|
+
- [ ] **Step 4: Record the outcome** in the issue.
|