teamsmith 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +69 -0
- package/skills/teamsmith/SKILL.md +20 -13
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/config.md +39 -6
- package/skills/teamsmith/references/migration.md +197 -47
- package/skills/teamsmith/references/protocol.md +201 -30
- package/skills/teamsmith/references/troubleshooting.md +130 -10
- package/skills/teamsmith/references/workflows.md +36 -2
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
- package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
- package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
- package/skills/teamsmith/scripts/lib/common.sh +1004 -245
- package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +211 -211
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
- package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
- package/skills/teamsmith/scripts/replies.mjs +4 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +19 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
- package/skills/teamsmith/templates/config.sh.tmpl +20 -1
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
- package/skills/teamsmith/tests/config-cli.sh +184 -32
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +359 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
- package/skills/teamsmith/tests/key-replies.sh +281 -28
- package/skills/teamsmith/tests/ledger-ban.sh +5 -4
- package/skills/teamsmith/tests/ledger-claim.sh +2 -1
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
- package/skills/teamsmith/tests/panel-b2.sh +430 -352
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +314 -62
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +43 -130
- package/skills/teamsmith/tests/panel-p21.sh +251 -265
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +187 -396
- package/skills/teamsmith/tests/routes.sh +440 -117
- package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-guard.sh +13 -102
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +32 -18
- package/skills/teamsmith/tests/section-select.sh +371 -19
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +3595 -788
- package/skills/teamsmith/tests/task-model-routing.sh +530 -15
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -185
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -239
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -288
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -83
- package/skills/teamsmith/tests/section-budgets.tsv +0 -154
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# and 3.1–3.2.
|
|
4
4
|
#
|
|
5
5
|
# bash skills/teamsmith/tests/panel-b2.sh # every scenario
|
|
6
|
-
# bash skills/teamsmith/tests/panel-b2.sh
|
|
6
|
+
# bash skills/teamsmith/tests/panel-b2.sh cursor draft # selected scenarios
|
|
7
7
|
# TEAM_B2_KEEP=1 bash skills/teamsmith/tests/panel-b2.sh # keep the fixture directory
|
|
8
8
|
#
|
|
9
9
|
# Every scenario runs in a **private tmux server** (`-L p13b2-$$`) and a fresh fixture project, so
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
# keys P20/B2 pi's key map: word/line/forward-delete, kill ring, Kitty encodings, undo
|
|
16
16
|
# multiline P20/B3 ctrl+j inserts a break, enter submits, Kitty shift+enter, single-line reason
|
|
17
17
|
# clipboard P20/B4 C-v: the image probe order, text fallback, the bounds, the temp file
|
|
18
|
-
# cjk
|
|
18
|
+
# (P318:`cjk` 场景并入 `cursor`;`readonly` 场景搬进 panel-p21.sh 的同一个场景 —— 那一份由
|
|
19
|
+
# §38 段执行,这一份在此之前没有任何门禁或 CI 运行过它。两个名字都不再是场景。)
|
|
19
20
|
# draft 2.2 Esc keeps the draft across a relaunch; `\r` is normalized on intake
|
|
20
21
|
# editor B3 `C-o` relays to $EDITOR (C-e is the line-end key); the relay is lossless
|
|
21
22
|
# receipt 2.4 the three honest receipts: busy → queued, empty → delivered, eaten Enter → held
|
|
22
23
|
# pause 2.5 a refresh completes mid-compose: the draft survives, the frame advanced
|
|
23
24
|
# paste 2.6 plain and bracketed three-line pastes are one message each
|
|
24
25
|
# actions 3.1 `f` runs `team outbox flush`; `s` toggles standby with a reason line
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
#
|
|
27
28
|
# Exit: 0 every selected scenario green, 1 at least one assertion failed, 3 setup failure.
|
|
28
29
|
set -uo pipefail
|
|
@@ -105,6 +106,46 @@ fi
|
|
|
105
106
|
[ -f "$panel" ] || { printf 'panel-b2: no bundle at %s\n' "$panel" >&2; exit 3; }
|
|
106
107
|
[ -f "$fake_tui" ] || { printf 'panel-b2: no fake TUI at %s\n' "$fake_tui" >&2; exit 3; }
|
|
107
108
|
|
|
109
|
+
# ── P336:等待用既有的 lib/pty-wait.sh(等「那件事为真」,不再靠固定 sleep 猜时间)───────────
|
|
110
|
+
# 引擎的契约是「caller 提供 pty_cap,它等到条件成立 **且** 帧静止」;耗尽时它打一行「没等到 …」+ 现场
|
|
111
|
+
# 并返回 1 —— 这里**不让它致命**:紧随其后的断言照旧执行,于是缺陷的样子是「没等到什么」加上那条 ✗,
|
|
112
|
+
# 而不是一个被提前放行掩盖的绿。capture 用**可见区**(不带 scrollback):上一轮留在回滚区里的旧画面
|
|
113
|
+
# 不能把这一轮的等待提前放行。
|
|
114
|
+
#
|
|
115
|
+
# 两样断言要读、却不在帧文本里的状态(插入点在这是终端光标,草稿是文件)由夹具**附在 capture 末尾**
|
|
116
|
+
# 交给同一个引擎 —— 不是第二套等待逻辑,仍是 pty_wait_frame 的「条件 + 静止」,只是条件里多一行。
|
|
117
|
+
# 行尾的 ` @@` 是收尾符:`@@draft ad @@` 不会命中 `@@draft ad\nb @@` 这种前缀。
|
|
118
|
+
. "$here/lib/pty-wait.sh"
|
|
119
|
+
b2_wait_pane=""
|
|
120
|
+
b2_wait_state=""
|
|
121
|
+
_b2_esc() { local s="${1//\\/\\\\}"; printf '%s' "${s//$'\n'/\\n}"; }
|
|
122
|
+
pty_cap() {
|
|
123
|
+
tmux -L "$sock" capture-pane -p -t "${b2_wait_pane:-$sess:panel}" 2>/dev/null
|
|
124
|
+
case "$b2_wait_state" in
|
|
125
|
+
cursor) printf '@@cursor %s %s @@\n' "$(cursor_x)" "$(cursor_y)" ;;
|
|
126
|
+
draft) printf '@@draft %s @@\n' "$(_b2_esc "$(draft)")" ;;
|
|
127
|
+
esac
|
|
128
|
+
}
|
|
129
|
+
pty_pane_state() { tmux -L "$sock" display -p -t "${b2_wait_pane:-$sess:panel}" '#{pane_dead}:#{pane_dead_status}' 2>/dev/null; }
|
|
130
|
+
# wait_frame <label> <needle…>:等到这些串落在面板的静止帧上(`!text` = 必须不在)。返回引擎的判定(0 等到 / 1 耗尽)。
|
|
131
|
+
wait_frame() { local label="$1"; shift; pty_wait_frame - "$label" "$@" || return 1; }
|
|
132
|
+
# wait_state <cursor|draft> <label> <needle…>:同上,capture 末尾多一行夹具状态。
|
|
133
|
+
wait_state() {
|
|
134
|
+
local kind="$1" label="$2" prev="$b2_wait_state"; shift 2
|
|
135
|
+
b2_wait_state="$kind"
|
|
136
|
+
pty_wait_frame - "$label" "$@" || true
|
|
137
|
+
b2_wait_state="$prev"
|
|
138
|
+
}
|
|
139
|
+
# wait_cursor <label> <x> [y]:等插入点落到这个格子(不给 y 就只看列)。
|
|
140
|
+
wait_cursor() {
|
|
141
|
+
local label="$1" x="$2" y="${3:-}"
|
|
142
|
+
if [ -n "$y" ]; then wait_state cursor "$label" "@@cursor $x $y @@"; else wait_state cursor "$label" "@@cursor $x "; fi
|
|
143
|
+
}
|
|
144
|
+
# wait_draft <label> <期望正文>:等草稿文件逐字节变成这段(换行按 capture 的转义写法比)。
|
|
145
|
+
wait_draft() { local label="$1"; shift; wait_state draft "$label" "@@draft $(_b2_esc "$1") @@"; }
|
|
146
|
+
# 标题条那条 ─ 是整幅宽的:41 个连着的 ─ 在不在,就是「帧是不是按新宽度画的」。
|
|
147
|
+
B2_RULE41="$(printf '─%.0s' $(seq 1 41))"
|
|
148
|
+
|
|
108
149
|
# ---------------------------------------------------------------- fixture plumbing
|
|
109
150
|
server_up() { # <name> → fresh project + private tmux session
|
|
110
151
|
current="$1"
|
|
@@ -132,7 +173,8 @@ start_pm() { # <draft> [extra env string]
|
|
|
132
173
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
133
174
|
tmux -L "$sock" new-window -d -t "$sess" -n pm -c "$ROOT" \
|
|
134
175
|
"FAKE_TUI_DRAFT=$(printf '%q' "$draft") FAKE_TUI_COLS=100 FAKE_TUI_SUBMIT_LOG=$(printf '%q' "$tmp/$current/submit.log") $extra python3 '$fake_tui'"
|
|
135
|
-
|
|
176
|
+
# 假 TUI 把输入框画出来才算起来了(面板的忙/闲判定读的就是这个窗格)。
|
|
177
|
+
b2_wait_pane="$sess:pm"; pty_wait_frame - "pm 窗格起来" 'fixture TUI' || true; b2_wait_pane=""
|
|
136
178
|
}
|
|
137
179
|
|
|
138
180
|
start_panel() { # [extra env string] [panel args...]
|
|
@@ -144,17 +186,10 @@ start_panel() { # [extra env string] [panel args...]
|
|
|
144
186
|
wait_panel
|
|
145
187
|
}
|
|
146
188
|
|
|
147
|
-
wait_panel() { # the first frame is on screen
|
|
148
|
-
|
|
149
|
-
for i in $(seq 1 40); do
|
|
150
|
-
if tmux -L "$sock" capture-pane -p -t "$sess:panel" 2>/dev/null | grep -qF 'teamsmith pulse'; then
|
|
151
|
-
sleep 0.4
|
|
152
|
-
return 0
|
|
153
|
-
fi
|
|
154
|
-
sleep 0.25
|
|
155
|
-
done
|
|
189
|
+
wait_panel() { # the first frame is on screen and settled (not a half paint)
|
|
190
|
+
pty_wait_frame - "控制台首帧" 'teamsmith pulse' && return 0
|
|
156
191
|
printf 'panel-b2: the console pane never rendered (%s)\n' "$current" >&2
|
|
157
|
-
|
|
192
|
+
pty_cap | tail -5 >&2
|
|
158
193
|
return 1
|
|
159
194
|
}
|
|
160
195
|
|
|
@@ -163,8 +198,28 @@ cap_to() { cap > "$tmp/$current/${1:-cap}.txt"; }
|
|
|
163
198
|
cap_has() { local f="$tmp/$current/${2:-cap}.txt"; cap >"$f"; assert_has "$f" "$1" "捕获里有 [$1]"; }
|
|
164
199
|
cap_not_has() { local f="$tmp/$current/${2:-cap}.txt"; cap >"$f"; assert_not_has "$f" "$1" "捕获里没有 [$1]"; }
|
|
165
200
|
pm_cap() { tmux -L "$sock" capture-pane -p -t "$sess:pm" -S -1000 2>/dev/null; }
|
|
166
|
-
|
|
167
|
-
|
|
201
|
+
# 两次发送之间至少留这个间隔(秒,小数):**不是**在等某个状态,而是让两次输入落进两次 stdin 读。
|
|
202
|
+
# Ink 的 `useInput` 对每个 stdin 数据块只解析一次,多字符块按「粘贴」整串交给调用方 —— 两个背靠背的
|
|
203
|
+
# `send-keys` 挨得太近就合成一次输入,`C-w`/`M-b`/`C-k` 这类控制键随之消失(V75 在不带 tmux shim 的
|
|
204
|
+
# PATH 里实测:main 的连发 0 处、本夹具 20 处;带 shim 时每次调用多 ~16 ms,所以那种绿是环境依赖的)。
|
|
205
|
+
# 很多键的效果要一串按完才可见(`C-a` 本来就在行首、`C-d` 在行尾……),挨个等状态等不到,所以这一处
|
|
206
|
+
# 只能是最短的固定间隔;它只在上一次发送同样近时才起作用 —— 中间有 `wait_*`/`cap` 时一秒也不花。
|
|
207
|
+
B2_KEY_GAP_US=200000
|
|
208
|
+
_b2_send() { # <send-keys argv…>
|
|
209
|
+
local now us rem
|
|
210
|
+
now="${EPOCHREALTIME//[!0-9]/}"
|
|
211
|
+
if [ -n "${_b2_last_send:-}" ]; then
|
|
212
|
+
us=$(( now - _b2_last_send ))
|
|
213
|
+
rem=$(( B2_KEY_GAP_US - us ))
|
|
214
|
+
if [ "$rem" -gt 0 ]; then
|
|
215
|
+
sleep "$((rem / 1000000)).$(printf '%06d' $((rem % 1000000)))"
|
|
216
|
+
fi
|
|
217
|
+
fi
|
|
218
|
+
tmux -L "$sock" send-keys -t "$sess:panel" "$@" 2>/dev/null
|
|
219
|
+
_b2_last_send="${EPOCHREALTIME//[!0-9]/}"
|
|
220
|
+
}
|
|
221
|
+
keys() { _b2_send "$@"; }
|
|
222
|
+
type_text() { _b2_send -l "$1"; }
|
|
168
223
|
cursor_x() { tmux -L "$sock" display -p -t "$sess:panel" '#{cursor_x}' 2>/dev/null | tr -d ' '; }
|
|
169
224
|
cursor_y() { tmux -L "$sock" display -p -t "$sess:panel" '#{cursor_y}' 2>/dev/null | tr -d ' '; }
|
|
170
225
|
# The visible pane only (no scrollback): tmux's `#{cursor_y}` is 0-based over exactly these rows.
|
|
@@ -175,7 +230,13 @@ vis_row() { cap_visible | grep -nF -- "$1" | head -1 | cut -d: -f1 | awk '{print
|
|
|
175
230
|
draft_rows() { cap_visible | grep -cE '^│ (>| )'; }
|
|
176
231
|
# The number the hidden-rows marker counts, or 0 when the window hides nothing above.
|
|
177
232
|
marker_n() { cap_visible | sed -n 's/.*↑\([0-9][0-9]*\) 行.*/\1/p' | head -1; }
|
|
178
|
-
|
|
233
|
+
# 改尺寸后等到面板**按新宽度重画**(整幅宽的 ─ 是宽度的直接证据:≥60 列的布局有 41 连 ─,40 列的
|
|
234
|
+
# 布局一行都装不下 41 个),再叠上引擎的「帧静止」。
|
|
235
|
+
resize_pane() {
|
|
236
|
+
tmux -L "$sock" resize-window -t "$sess:panel" -x "$1" -y "$2" 2>/dev/null || true
|
|
237
|
+
if [ "$1" -ge 60 ]; then wait_frame "尺寸 ${1}x$2" "$B2_RULE41"
|
|
238
|
+
else wait_frame "尺寸 ${1}x$2" "!$B2_RULE41"; fi
|
|
239
|
+
}
|
|
179
240
|
draft_lines_count() { grep -c '' "$(draft_file)" 2>/dev/null || printf '0'; }
|
|
180
241
|
stamp() { cap | grep -oE '[0-9]{2}:[0-9]{2}:[0-9]{2}' | head -1; }
|
|
181
242
|
draft_file() { printf '%s\n' "$ROOT/.pi/team/state/draft.md"; }
|
|
@@ -188,46 +249,9 @@ submits() {
|
|
|
188
249
|
if [ -f "$log" ]; then grep -c '^SUBMIT:' "$log" 2>/dev/null; else printf '0'; fi
|
|
189
250
|
}
|
|
190
251
|
last_submit() { sed -n 's/^SUBMIT://p' "$tmp/$current/submit.log" 2>/dev/null | tail -1; }
|
|
191
|
-
snapshot()
|
|
192
|
-
|
|
252
|
+
# P318(D-3):`snapshot()` 跟随 `readonly` 场景一起搬到了 panel-p21.sh(未绑定键扫描现在在
|
|
253
|
+
# §38 段里跑,也就是真的会被门禁执行)。
|
|
193
254
|
|
|
194
|
-
# ---------------------------------------------------------------- 2.1 CJK cursor and backspace
|
|
195
|
-
scenario_cjk() {
|
|
196
|
-
section "2.1 · m 打开输入行,中文宽字符光标与按码点退格"
|
|
197
|
-
server_up cjk
|
|
198
|
-
start_pm '' ''
|
|
199
|
-
start_panel
|
|
200
|
-
keys m
|
|
201
|
-
sleep 0.8
|
|
202
|
-
cap_to after-m
|
|
203
|
-
assert_match "$tmp/cjk/after-m.txt" '│ >' "2.1 'm' 打开底部输入行(带框托盘)"
|
|
204
|
-
type_text '中文ab'
|
|
205
|
-
sleep 0.8
|
|
206
|
-
cap_to after-cjk
|
|
207
|
-
assert_eq "2.1 中文ab 之后 cursor_x=10(托盘 │ + 空格 =2 列,> =2 列 + 中文 4 列 + ab 2 列)" "$(cursor_x)" "10"
|
|
208
|
-
assert_has "$tmp/cjk/after-cjk.txt" "> 中文ab" "2.1 输入行显示 > 中文ab"
|
|
209
|
-
keys BSpace
|
|
210
|
-
sleep 0.5
|
|
211
|
-
assert_eq "2.1 退格删掉一个半角码点:cursor_x=9" "$(cursor_x)" "9"
|
|
212
|
-
keys BSpace
|
|
213
|
-
sleep 0.5
|
|
214
|
-
cap_to after-bs
|
|
215
|
-
assert_eq "2.1 退格删掉整个宽字符(不是半个):cursor_x=8" "$(cursor_x)" "8"
|
|
216
|
-
assert_has "$tmp/cjk/after-bs.txt" "> 中文" "2.1 宽字符被整字删除"
|
|
217
|
-
keys BSpace
|
|
218
|
-
sleep 0.5
|
|
219
|
-
assert_eq "2.1 宽字符退格:中文 → 中,cursor_x=6" "$(cursor_x)" "6"
|
|
220
|
-
# astral plane: one codepoint, two UTF-16 units — a code-unit backspace would leave half
|
|
221
|
-
type_text '🙂'
|
|
222
|
-
sleep 0.6
|
|
223
|
-
assert_eq "2.1 星平面字符(emoji)按两个显示列计:cursor_x=8" "$(cursor_x)" "8"
|
|
224
|
-
keys BSpace
|
|
225
|
-
sleep 0.5
|
|
226
|
-
cap_to after-emoji-bs
|
|
227
|
-
assert_eq "2.1 emoji 退格整个码点删掉:cursor_x=6" "$(cursor_x)" "6"
|
|
228
|
-
assert_has "$tmp/cjk/after-emoji-bs.txt" "> 中" "2.1 emoji 被整字删除(没有半个代理对)"
|
|
229
|
-
assert_eq "2.1 草稿文件同步(state/draft.md)" "$(draft)" "中"
|
|
230
|
-
}
|
|
231
255
|
|
|
232
256
|
# ---------------------------------------------------------------- P20/B1 the insertion-point cursor
|
|
233
257
|
# The model's headless sibling first: the pure cases exit non-zero and name the failing case, so a
|
|
@@ -256,66 +280,66 @@ scenario_cursor() {
|
|
|
256
280
|
start_pm '' ''
|
|
257
281
|
start_panel
|
|
258
282
|
# ① `ad` → ← → 中文 → ← → Backspace:编辑发生在插入点,宽字形是一步、整字删除
|
|
259
|
-
keys m;
|
|
260
|
-
type_text 'ad'
|
|
261
|
-
keys Left
|
|
262
|
-
type_text '中文'
|
|
263
|
-
keys Left;
|
|
264
|
-
|
|
283
|
+
keys m; wait_frame "B1 写信托盘" 'Enter 发送'
|
|
284
|
+
type_text 'ad'
|
|
285
|
+
keys Left
|
|
286
|
+
type_text '中文'
|
|
287
|
+
keys Left; keys BSpace
|
|
288
|
+
wait_frame "B1 插入点退格" '> a文d'
|
|
265
289
|
cap_to after-bs
|
|
266
290
|
assert_has "$tmp/cursor/after-bs.txt" '> a文d' "B1 插入点 Backspace:草稿 a文d"
|
|
267
291
|
assert_eq "B1 草稿文件 a文d" "$(draft)" "a文d"
|
|
268
|
-
|
|
269
|
-
keys Right;
|
|
292
|
+
|
|
293
|
+
keys Right; wait_cursor "B1 跨宽字形一步" 7
|
|
270
294
|
assert_eq "B1 跨宽字形一步 → cursor_x=7" "$(cursor_x)" "7"
|
|
271
|
-
keys BSpace;
|
|
295
|
+
keys BSpace; wait_frame "B1 宽字形整字删除" '> ad'
|
|
272
296
|
cap_to after-wide-bs
|
|
273
297
|
assert_has "$tmp/cursor/after-wide-bs.txt" '> ad' "B1 宽字形整字删除(不剩半个)"
|
|
274
298
|
assert_eq "B1 草稿回到 ad" "$(draft)" "ad"
|
|
275
299
|
|
|
276
300
|
# ② 40 列 pane:40 个 x 的草稿,插入点在软换行的第二行;Home + Z 落回第一行
|
|
277
|
-
keys Escape;
|
|
301
|
+
keys Escape; wait_frame "B1 写信收起" '!Enter 发送'
|
|
278
302
|
python3 -c 'import sys; sys.stdout.write("x"*40)' > "$(draft_file)"
|
|
279
303
|
resize_pane 40 30
|
|
280
|
-
keys m;
|
|
281
|
-
|
|
282
|
-
keys Home
|
|
283
|
-
type_text 'Z';
|
|
304
|
+
keys m; wait_frame "B1 40 列写信托盘" 'Enter 发送'
|
|
305
|
+
|
|
306
|
+
keys Home
|
|
307
|
+
type_text 'Z'; wait_frame "B1 软换行首插入" '> Zxxxx'
|
|
284
308
|
cap_to wrap
|
|
285
|
-
|
|
309
|
+
|
|
286
310
|
assert_eq "B1 cursor_y 指向绘制 Z 的软换行第一行" "$(cursor_y)" "$(vis_row '> Zxxxx')"
|
|
287
311
|
assert_eq "B1 草稿 = Z + 40 个 x(插入在插入点,不在末尾)" "$(draft)" "Z$(python3 -c 'import sys; sys.stdout.write("x"*40)')"
|
|
288
312
|
|
|
289
313
|
# ③ 同一 40 列 pane:ab\nXXXXXXXX,↑ 钳到较短行
|
|
290
|
-
keys Escape;
|
|
314
|
+
keys Escape; wait_frame "B1 写信收起" '!Enter 发送'
|
|
291
315
|
printf 'ab\nXXXXXXXX' > "$(draft_file)"
|
|
292
|
-
keys m;
|
|
316
|
+
keys m; wait_cursor "B1 换行草稿的插入点" 12
|
|
293
317
|
assert_eq "B1 换行草稿:插入点在第二行 cursor_x=12" "$(cursor_x)" "12"
|
|
294
|
-
keys Up;
|
|
318
|
+
keys Up; wait_cursor "B1 ↑ 钳到较短行" 6
|
|
295
319
|
cap_to clamp
|
|
296
320
|
assert_eq "B1 ↑ 钳到较短行 cursor_x=6" "$(cursor_x)" "6"
|
|
297
321
|
assert_eq "B1 cursor_y 指向 ab 行" "$(cursor_y)" "$(vis_row '> ab')"
|
|
298
322
|
assert_has "$tmp/cursor/clamp.txt" 'XXXXXXXX' "B1 另一行原样还在"
|
|
299
323
|
|
|
300
324
|
# ④ 120x30:alpha\nbeta,Home/End/↑/X
|
|
301
|
-
keys Escape;
|
|
325
|
+
keys Escape; wait_frame "B1 写信收起" '!Enter 发送'
|
|
302
326
|
resize_pane 120 30
|
|
303
327
|
printf 'alpha\nbeta' > "$(draft_file)"
|
|
304
|
-
keys m;
|
|
305
|
-
keys Home
|
|
306
|
-
keys End
|
|
307
|
-
keys Up
|
|
308
|
-
type_text 'X';
|
|
328
|
+
keys m; wait_frame "B1 两行草稿的托盘" '> alpha'
|
|
329
|
+
keys Home
|
|
330
|
+
keys End
|
|
331
|
+
keys Up
|
|
332
|
+
type_text 'X'; wait_draft "B1 X 落在 alpha 行" "$(printf 'alphXa\nbeta')"
|
|
309
333
|
cap_to rows
|
|
310
334
|
assert_eq "B1 Home+End+↑+X → alphXa\\nbeta" "$(draft)" "$(printf 'alphXa\nbeta')"
|
|
311
|
-
|
|
335
|
+
|
|
312
336
|
assert_eq "B1 cursor_y 指向 alpha 行" "$(cursor_y)" "$(vis_row '> alphXa')"
|
|
313
337
|
|
|
314
338
|
# ⑤ 120x20 + 30 行草稿:窗口 ≤ 10 行、含插入点行、顶沿计数隐藏行
|
|
315
|
-
keys Escape;
|
|
339
|
+
keys Escape; wait_frame "B1 写信收起" '!Enter 发送'
|
|
316
340
|
resize_pane 120 20
|
|
317
341
|
python3 -c 'import sys; sys.stdout.write("\n".join("L%02d" % i for i in range(1, 31)))' > "$(draft_file)"
|
|
318
|
-
keys m;
|
|
342
|
+
keys m; wait_frame "B1 30 行草稿的窗口" 'L30'
|
|
319
343
|
cap_to window
|
|
320
344
|
local rows_n marker1
|
|
321
345
|
rows_n="$(draft_rows)"
|
|
@@ -324,7 +348,7 @@ scenario_cursor() {
|
|
|
324
348
|
else
|
|
325
349
|
bad "B1 窗口:草稿行 $rows_n 不在 1..10"
|
|
326
350
|
fi
|
|
327
|
-
|
|
351
|
+
|
|
328
352
|
marker1="$(marker_n)"
|
|
329
353
|
if [ -n "$marker1" ] && [ "$marker1" -gt 0 ]; then
|
|
330
354
|
ok "B1 窗口:顶沿标记隐藏行数(↑$marker1 行)"
|
|
@@ -335,8 +359,8 @@ scenario_cursor() {
|
|
|
335
359
|
|
|
336
360
|
# ⑥ 窗口跟随插入点:↑ 12 次到 L18,标记计数变小
|
|
337
361
|
local i
|
|
338
|
-
for i in $(seq 1 12); do keys Up;
|
|
339
|
-
|
|
362
|
+
for i in $(seq 1 12); do keys Up; done
|
|
363
|
+
wait_frame "B1 窗口跟随插入点" 'L18'
|
|
340
364
|
cap_to window-follow
|
|
341
365
|
local marker2
|
|
342
366
|
assert_has "$tmp/cursor/window-follow.txt" 'L18' "B1 窗口跟随:插入点行 L18 可见"
|
|
@@ -346,6 +370,21 @@ scenario_cursor() {
|
|
|
346
370
|
else
|
|
347
371
|
bad "B1 窗口跟随:标记没有变小(↑$marker1 → ↑${marker2:-无})"
|
|
348
372
|
fi
|
|
373
|
+
|
|
374
|
+
# ①半(P318:原 `2.1 CJK` 场景并入这里 —— 它测的宽字形列宽与整字删除已被上面 ① 的
|
|
375
|
+
# 「跨宽字形一步 / 整字删除」覆盖,只留它独有的三条:托盘把宽字符画出来、星平面字符按
|
|
376
|
+
# **一个码点**删除(UTF-16 下两个码元)、文件与画面同步)。
|
|
377
|
+
keys Escape; wait_frame "B1 写信收起" '!Enter 发送'
|
|
378
|
+
printf '中文' > "$(draft_file)"
|
|
379
|
+
resize_pane 120 30
|
|
380
|
+
keys m; wait_frame "B1 宽字符草稿的托盘" '│ > 中文'
|
|
381
|
+
cap_to cjk-tray
|
|
382
|
+
assert_has "$tmp/cursor/cjk-tray.txt" '│ > 中文' "B1 托盘把宽字符草稿画出来(│ > + 草稿)"
|
|
383
|
+
type_text '🙂'; wait_frame "B1 emoji 进草稿" '│ > 中文🙂'
|
|
384
|
+
keys BSpace; wait_frame "B1 emoji 整码点删除" '│ > 中文' '!🙂'
|
|
385
|
+
cap_to cjk-emoji
|
|
386
|
+
assert_has "$tmp/cursor/cjk-emoji.txt" '│ > 中文' "B1 星平面字符(emoji)退格整个码点删掉(不留半个代理对)"
|
|
387
|
+
assert_eq "B1 草稿文件与画面同步(中文)" "$(draft)" "中文"
|
|
349
388
|
}
|
|
350
389
|
|
|
351
390
|
# ---------------------------------------------------------------- P20/B2 the pi key map
|
|
@@ -355,115 +394,134 @@ scenario_keys() {
|
|
|
355
394
|
start_pm '' ''
|
|
356
395
|
start_panel
|
|
357
396
|
# ① 词/行/前向删除:alpha beta gamma → ctrl+w alt+b ctrl+d ctrl+k ctrl+a Z
|
|
358
|
-
keys m;
|
|
359
|
-
type_text 'alpha beta gamma'
|
|
360
|
-
keys C-w
|
|
361
|
-
keys M-b
|
|
362
|
-
keys C-d
|
|
363
|
-
keys C-k
|
|
364
|
-
keys C-a
|
|
365
|
-
type_text 'Z';
|
|
397
|
+
keys m; wait_frame "B2 写信托盘" 'Enter 发送'
|
|
398
|
+
type_text 'alpha beta gamma'
|
|
399
|
+
keys C-w # 切 ` gamma`
|
|
400
|
+
keys M-b # 词左移到 beta 开头
|
|
401
|
+
keys C-d # 删前向一个码点(b)
|
|
402
|
+
keys C-k # 删到逻辑行尾
|
|
403
|
+
keys C-a # 逻辑行首
|
|
404
|
+
type_text 'Z'; wait_draft "B2 词/行/前向删除" 'Zalpha '
|
|
366
405
|
cap_to words
|
|
367
406
|
assert_eq "B2 词/行/前向删除 → Zalpha " "$(draft)" "Zalpha "
|
|
368
|
-
|
|
407
|
+
|
|
369
408
|
assert_eq "B2 没按过 Enter(未提交)" "$(submits)" "0"
|
|
370
409
|
|
|
410
|
+
# ①半 ctrl+u(V33 第一轮 OBS-1 的缺测项):清空到行首 → **持久化为空草稿**,重开/重启都不带回。
|
|
411
|
+
# 合同:「a draft the human deleted with the compose line's own keys is not resurrected」。
|
|
412
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
413
|
+
printf '' > "$(draft_file)"
|
|
414
|
+
keys m; wait_frame "B2 空草稿的托盘" 'Enter 发送'
|
|
415
|
+
type_text 'half a thought'; wait_draft "B2 正文已落盘" 'half a thought'
|
|
416
|
+
assert_eq "B2 ctrl+u:清空前正文已落盘" "$(draft)" "half a thought"
|
|
417
|
+
keys C-u; wait_draft "B2 ctrl+u 清空草稿" ''
|
|
418
|
+
assert_eq "B2 ctrl+u:草稿文件 0 字节(清空是持久的)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
419
|
+
cap_to ctrl-u
|
|
420
|
+
assert_not_has "$tmp/keys/ctrl-u.txt" 'half a thought' "B2 ctrl+u:帧里不再出现被删掉的正文"
|
|
421
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
422
|
+
start_panel
|
|
423
|
+
keys m; wait_frame "B2 重开后的托盘" 'Enter 发送'
|
|
424
|
+
cap_to ctrl-u-reopen
|
|
425
|
+
assert_not_has "$tmp/keys/ctrl-u-reopen.txt" 'half a thought' "B2 ctrl+u:重开(重启后 m)不带回已删正文"
|
|
426
|
+
assert_eq "B2 ctrl+u:重开后草稿文件仍是 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
427
|
+
|
|
371
428
|
# ② 逻辑行边界:45 字符行 + second,↑ ctrl+a ctrl+k → \nsecond
|
|
372
|
-
keys Escape;
|
|
429
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
373
430
|
resize_pane 40 30
|
|
374
431
|
python3 -c 'import sys; sys.stdout.write("x"*45 + "\nsecond")' > "$(draft_file)"
|
|
375
|
-
keys m;
|
|
376
|
-
keys Up
|
|
377
|
-
keys C-a
|
|
378
|
-
keys C-k;
|
|
432
|
+
keys m; wait_frame "B2 长行草稿的托盘" 'second'
|
|
433
|
+
keys Up
|
|
434
|
+
keys C-a
|
|
435
|
+
keys C-k; wait_draft "B2 ctrl+k 删整逻辑行" "$(printf '\nsecond')"
|
|
379
436
|
cap_to line
|
|
380
437
|
assert_eq "B2 ctrl+k 删的是逻辑行(整行 45 字符),不是绘制行" "$(draft)" "$(printf '\nsecond')"
|
|
381
|
-
|
|
438
|
+
|
|
382
439
|
|
|
383
440
|
# ③ Kitty 编码:ctrl+b ×3 + alt+b 与 legacy 字节落在同一插入点
|
|
384
441
|
# (spec 原写 cursor_x 12;实测/算术都是 10 —— alpha beta 末尾 3×← 到 index 7、再一词到 6,
|
|
385
442
|
# `│ > alpha ` 共 10 列。两种编码必须一致,这条断言是硬约束,数值随实测修正。)
|
|
386
|
-
keys Escape;
|
|
443
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
387
444
|
resize_pane 120 30
|
|
388
445
|
printf 'alpha beta' > "$(draft_file)"
|
|
389
|
-
keys m;
|
|
390
|
-
type_text $'\x1b[98;5u\x1b[98;5u\x1b[98;5u'
|
|
391
|
-
type_text $'\x1b[98;3u';
|
|
446
|
+
keys m; wait_frame "B2 单行草稿的托盘" '> alpha beta'
|
|
447
|
+
type_text $'\x1b[98;5u\x1b[98;5u\x1b[98;5u'
|
|
448
|
+
type_text $'\x1b[98;3u'; wait_cursor "B2 Kitty ctrl+b×3+alt+b" 10
|
|
392
449
|
local kitty_x
|
|
393
450
|
kitty_x="$(cursor_x)"
|
|
394
451
|
assert_eq "B2 Kitty ctrl+b×3 + alt+b 后 cursor_x=10(alpha |beta)" "$kitty_x" "10"
|
|
395
452
|
assert_eq "B2 Kitty 编码移动不改草稿" "$(draft)" "alpha beta"
|
|
396
453
|
# 同一条序列的 legacy 字节(ctrl+b = 0x02 单独发;alt+b = ESC b)必须落在同一处。
|
|
397
|
-
keys Escape;
|
|
454
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
398
455
|
printf 'alpha beta' > "$(draft_file)"
|
|
399
|
-
keys m;
|
|
400
|
-
keys C-b;
|
|
401
|
-
keys M-b;
|
|
456
|
+
keys m; wait_frame "B2 单行草稿的托盘" '> alpha beta'
|
|
457
|
+
keys C-b; keys C-b; keys C-b
|
|
458
|
+
keys M-b; wait_cursor "B2 legacy 字节复跑同一条序列" "$kitty_x"
|
|
402
459
|
assert_eq "B2 legacy 字节复跑同一条序列落点与 Kitty 相同" "$(cursor_x)" "$kitty_x"
|
|
403
460
|
|
|
404
461
|
# ④ kill ring:ctrl+w ctrl+a ctrl+k ctrl+y alt+y → ` gamma`
|
|
405
|
-
keys Escape;
|
|
462
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
406
463
|
printf 'alpha beta gamma' > "$(draft_file)"
|
|
407
|
-
keys m;
|
|
408
|
-
keys C-w
|
|
409
|
-
keys C-a
|
|
410
|
-
keys C-k
|
|
411
|
-
keys C-y
|
|
412
|
-
keys M-y;
|
|
464
|
+
keys m; wait_frame "B2 三词草稿的托盘" '> alpha beta gamma'
|
|
465
|
+
keys C-w
|
|
466
|
+
keys C-a
|
|
467
|
+
keys C-k
|
|
468
|
+
keys C-y
|
|
469
|
+
keys M-y; wait_draft "B2 ring:alt+y 换回旧的" ' gamma'
|
|
413
470
|
cap_to ring
|
|
414
471
|
assert_eq "B2 ring:ctrl+y 放回新的,alt+y 换成旧的 → 空格+gamma" "$(draft)" " gamma"
|
|
415
472
|
|
|
416
473
|
# ⑦ 词边界用平台的 word segmenter(标点在 pi 里是停点):alt+b/alt+d 不能把 alpha-beta 当一个词
|
|
417
|
-
keys Escape;
|
|
474
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
418
475
|
printf 'alpha-beta gamma' > "$(draft_file)"
|
|
419
|
-
keys m;
|
|
420
|
-
keys C-w
|
|
421
|
-
keys M-b
|
|
422
|
-
keys M-d;
|
|
476
|
+
keys m; wait_frame "B2 带标点草稿的托盘" '> alpha-beta gamma'
|
|
477
|
+
keys C-w # 切 ` gamma`
|
|
478
|
+
keys M-b # 词左移:pi 停在 beta 开头(不是 alpha-beta 的开头)
|
|
479
|
+
keys M-d; wait_draft "B2 标点是词停点" 'alpha-'
|
|
423
480
|
cap_to punctuation
|
|
424
481
|
assert_eq "B2 标点是词停点:alpha-beta gamma → alpha-" "$(draft)" "alpha-"
|
|
425
|
-
|
|
482
|
+
|
|
426
483
|
|
|
427
484
|
# ⑦半 word segmenter 对 CJK 真的分词(pi 用 Intl.Segmenter;「白空格规则」会把整串当一个词)
|
|
428
|
-
keys Escape;
|
|
485
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
429
486
|
printf '中文中文' > "$(draft_file)"
|
|
430
|
-
keys m;
|
|
431
|
-
keys M-b
|
|
432
|
-
type_text 'X';
|
|
487
|
+
keys m; wait_frame "B2 中文草稿的托盘" '│ > 中文中文'
|
|
488
|
+
keys M-b # 词左移:pi 切出两个「中文」,回到后一个的开头
|
|
489
|
+
type_text 'X'; wait_draft "B2 CJK 词边界" '中文X中文'
|
|
433
490
|
cap_to cjk-word
|
|
434
491
|
assert_eq "B2 CJK 词边界:alt+b 只回上一个词(中文X中文)" "$(draft)" "中文X中文"
|
|
435
|
-
|
|
492
|
+
|
|
436
493
|
|
|
437
494
|
# ⑧ kill ring 累积:同方向连续切合并成一条(ctrl+w ×2 → ` beta gamma`)
|
|
438
|
-
keys Escape;
|
|
495
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
439
496
|
printf 'alpha beta gamma' > "$(draft_file)"
|
|
440
|
-
keys m;
|
|
441
|
-
keys C-w;
|
|
497
|
+
keys m; wait_frame "B2 三词草稿的托盘" '> alpha beta gamma'
|
|
498
|
+
keys C-w; keys C-w; wait_draft "B2 两次 ctrl+w" 'alpha'
|
|
442
499
|
assert_eq "B2 两次 ctrl+w 后只剩 alpha" "$(draft)" "alpha"
|
|
443
|
-
keys C-a
|
|
444
|
-
keys C-k
|
|
445
|
-
keys C-y
|
|
446
|
-
keys M-y;
|
|
500
|
+
keys C-a
|
|
501
|
+
keys C-k
|
|
502
|
+
keys C-y
|
|
503
|
+
keys M-y; wait_draft "B2 ring 累积" ' beta gamma'
|
|
447
504
|
cap_to ring-accum
|
|
448
505
|
assert_eq "B2 ring 累积:alt+y 换回合并的一条(空格+beta+空格+gamma)" "$(draft)" " beta gamma"
|
|
449
506
|
|
|
450
507
|
# ⑤ undo:Z 之后 Kitty ctrl+- 恢复草稿与插入点,再按一次不变
|
|
451
|
-
keys Escape;
|
|
508
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
452
509
|
printf 'ad' > "$(draft_file)"
|
|
453
|
-
keys m;
|
|
454
|
-
keys Left
|
|
455
|
-
type_text 'Z';
|
|
456
|
-
type_text $'\x1b[45;5u';
|
|
510
|
+
keys m; wait_frame "B2 两字草稿的托盘" '> ad'
|
|
511
|
+
keys Left
|
|
512
|
+
type_text 'Z'; wait_draft "B2 undo 之前:草稿 aZd" 'aZd'
|
|
513
|
+
type_text $'\x1b[45;5u'; wait_draft "B2 ctrl+- 恢复草稿" 'ad'; wait_cursor "B2 ctrl+- 恢复插入点" 5
|
|
457
514
|
cap_to undo
|
|
458
515
|
assert_eq "B2 ctrl+- 恢复草稿 ad" "$(draft)" "ad"
|
|
459
516
|
assert_eq "B2 ctrl+- 同时恢复插入点 cursor_x=5" "$(cursor_x)" "5"
|
|
517
|
+
# 保留(P336):第二次 ctrl+- 是幂等空操作(历史已空)—— 帧与文件都不变,没有状态可等。
|
|
460
518
|
type_text $'\x1b[45;5u'; sleep 0.6
|
|
461
519
|
cap_to undo-empty
|
|
462
520
|
assert_eq "B2 历史空了再按 ctrl+- 不变" "$(draft)" "ad"
|
|
463
521
|
assert_has "$tmp/keys/undo-empty.txt" '> ad' "B2 undo 后帧仍完好"
|
|
464
522
|
|
|
465
523
|
# ⑥ 未绑定的修饰键不插字母、不收控制台(P20 新断言:ctrl+c)
|
|
466
|
-
keys C-c;
|
|
524
|
+
keys C-c; wait_frame "B2 ctrl+c 之后面板还在" 'Enter 发送'
|
|
467
525
|
cap_to ctrlc
|
|
468
526
|
assert_eq "B2 ctrl+c 不把 c 插进草稿" "$(draft)" "ad"
|
|
469
527
|
assert_has "$tmp/keys/ctrlc.txt" 'teamsmith pulse' "B2 ctrl+c 没有收起控制台"
|
|
@@ -485,42 +543,42 @@ scenario_multiline() {
|
|
|
485
543
|
start_panel
|
|
486
544
|
|
|
487
545
|
# ① legacy `\n`(= ctrl+j)插换行;Enter 仍提交,一条两行的消息
|
|
488
|
-
keys m;
|
|
489
|
-
type_text 'ad';
|
|
490
|
-
|
|
546
|
+
keys m; wait_frame "B3 写信托盘" 'Enter 发送'
|
|
547
|
+
type_text 'ad'; wait_cursor "B3 ad 已进草稿" 6
|
|
548
|
+
# 换行落地:光标从 ad 后的 x=6 落到新一行提示符后的 x=4(草稿文件尾的 \n 会被 $() 吃掉,看不到)
|
|
549
|
+
type_text $'\n'; wait_cursor "B3 legacy \\n 插换行" 4
|
|
491
550
|
cap_to after-lf
|
|
492
551
|
assert_eq "B3 legacy \\n 插入换行而不是提交(草稿 ad+LF)" "$(draft)" "$(printf 'ad\n')"
|
|
493
552
|
assert_has "$tmp/multiline/after-lf.txt" '> ad' "B3 换行后第一行还在"
|
|
494
|
-
type_text 'b';
|
|
553
|
+
type_text 'b'; wait_draft "B3 第二行的 b" "$(printf 'ad\nb')"
|
|
495
554
|
cap_to two-lines
|
|
496
|
-
|
|
497
|
-
keys Enter; sleep 3
|
|
555
|
+
keys Enter; wait_frame "B3 Enter 提交拿到回执" '· queued'
|
|
498
556
|
assert_eq "B3 Enter 仍提交:恰好一条条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
499
557
|
assert_eq "B3 条目保住两行" "$(payload_of "$(entries | head -1)")" $'ad\nb'
|
|
500
558
|
assert_eq "B3 换行键没有直接提交(忙框下一次都没到 PM 框)" "$(submits)" "0"
|
|
501
559
|
|
|
502
560
|
# ② Kitty ctrl+j(CSI 106;5u)与 shift+enter(CSI 13;2u)都插换行、都不提交
|
|
503
561
|
printf 'ad' > "$(draft_file)"
|
|
504
|
-
keys m;
|
|
505
|
-
type_text $'\x1b[106;5u'
|
|
506
|
-
type_text 'b'
|
|
507
|
-
type_text $'\x1b[13;2u'
|
|
508
|
-
type_text 'c';
|
|
562
|
+
keys m; wait_frame "B3 重开写信托盘" '> ad'
|
|
563
|
+
type_text $'\x1b[106;5u'
|
|
564
|
+
type_text 'b'
|
|
565
|
+
type_text $'\x1b[13;2u'
|
|
566
|
+
type_text 'c'; wait_draft "B3 Kitty 两个换行键进草稿" "$(printf 'ad\nb\nc')"
|
|
509
567
|
cap_to kitty
|
|
510
568
|
assert_eq "B3 Kitty ctrl+j + shift+enter → ad\\nb\\nc" "$(draft)" "$(printf 'ad\nb\nc')"
|
|
511
569
|
assert_eq "B3 Kitty 两个换行键都没有提交" "$(submits)" "0"
|
|
512
570
|
|
|
513
571
|
# ③ 粘贴三行仍是"一条草稿、一条消息"
|
|
514
|
-
keys Escape;
|
|
572
|
+
keys Escape; wait_frame "B3 写信收起" '!Enter 发送'
|
|
515
573
|
printf '' > "$(draft_file)"
|
|
516
|
-
keys m;
|
|
517
|
-
type_text $'p-one\np-two\np-three';
|
|
518
|
-
keys Enter;
|
|
574
|
+
keys m; wait_frame "B3 重开写信托盘" 'Enter 发送'
|
|
575
|
+
type_text $'p-one\np-two\np-three'; wait_draft "B3 三行粘贴进草稿" $'p-one\np-two\np-three'
|
|
576
|
+
keys Enter; wait_frame "B3 第三条的回执" '· queued'
|
|
519
577
|
assert_eq "B3 粘贴三行 → 新增恰好一条条目" "$(entries | wc -l | tr -d ' ')" "2"
|
|
520
578
|
assert_eq "B3 粘贴条目保住三行" "$(payload_of "$(entries | tail -1)")" $'p-one\np-two\np-three'
|
|
521
579
|
|
|
522
580
|
# ④ standby 理由单行化:三行粘贴 → 一个空格分隔的参数;消息草稿不被动
|
|
523
|
-
keys Escape;
|
|
581
|
+
keys Escape; wait_frame "B3 写信收起" '!Enter 发送'
|
|
524
582
|
printf 'half a thought' > "$(draft_file)"
|
|
525
583
|
local wrapper="$tmp/multiline/team-wrap.sh"
|
|
526
584
|
cat > "$wrapper" <<EOS
|
|
@@ -534,16 +592,17 @@ EOS
|
|
|
534
592
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
535
593
|
"TEAM_JS_BIN=$(printf '%q' "$js") exec '$js' '$panel' --root '$ROOT' --team-cli '$wrapper' --state-dir '$ROOT/.pi/team/state' --no-pulse --interval 1"
|
|
536
594
|
wait_panel
|
|
537
|
-
keys s;
|
|
595
|
+
keys s; wait_frame "B3 理由输入行" 'Enter 进入待命'
|
|
538
596
|
cap_to reason-open
|
|
539
597
|
assert_has "$tmp/multiline/reason-open.txt" '待命原因' "B3 s 打开理由输入行"
|
|
540
|
-
type_text $'one\ntwo\nthree';
|
|
598
|
+
type_text $'one\ntwo\nthree'; wait_frame "B3 理由折成一行" 'one two three'
|
|
541
599
|
cap_to reason-typed
|
|
542
600
|
assert_has "$tmp/multiline/reason-typed.txt" 'one two three' "B3 三行粘贴在理由里变成一行(空格分隔)"
|
|
543
601
|
assert_not_has "$tmp/multiline/reason-typed.txt" ' two' "B3 理由区没有出现第二绘制行"
|
|
544
|
-
keys Enter;
|
|
602
|
+
keys Enter; wait_frame "B3 待命已开" '待命 on'
|
|
545
603
|
cap_to reason-sent
|
|
546
|
-
|
|
604
|
+
# P318:`待命 on` 的帧回执由 scenario_actions(同一个 s 键,同样的理由行)断言 —— 这里只留
|
|
605
|
+
# 多行→单行这条**本场景独有**的行为。
|
|
547
606
|
if grep -qF -- '--reason one\ two\ three' "$tmp/multiline/team.log"; then
|
|
548
607
|
ok "B3 CLI 拿到一个参数 one two three(%q 里没有换行转义)"
|
|
549
608
|
else
|
|
@@ -629,34 +688,31 @@ EOXC
|
|
|
629
688
|
reset_clip
|
|
630
689
|
start_pm '' ''
|
|
631
690
|
start_panel "$(clip_env image image)"
|
|
632
|
-
keys m;
|
|
633
|
-
keys Left
|
|
634
|
-
keys C-v;
|
|
691
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
692
|
+
keys Left
|
|
693
|
+
keys C-v; wait_frame "B4 图片落成临时文件路径" 'teamsmith-paste-'
|
|
635
694
|
cap_to image
|
|
636
695
|
local file
|
|
637
696
|
file="$(pasted_file)"
|
|
638
697
|
assert_eq "B4 TMPDIR 里恰好一个 teamsmith-paste-*.png" "$(paste_count)" "1"
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
else
|
|
642
|
-
bad "B4 没有写出 teamsmith-paste-*.png"
|
|
643
|
-
fi
|
|
698
|
+
# P318:上面 `paste_count=1` + 下面的内容断言已经要求「恰好一个文件且内容对」;
|
|
699
|
+
# 「文件名非空」是那条断言的前半,不是独立行为。
|
|
644
700
|
assert_eq "B4 文件内容就是剪贴板的 8 字节" "$(cat "$file" 2>/dev/null)" "PNGDATA8"
|
|
645
701
|
assert_eq "B4 路径插在插入点(a<path>d)" "$(draft)" "a${file}d"
|
|
646
|
-
|
|
702
|
+
|
|
647
703
|
assert_match "$fx/calls.log" '^wl-paste --list-types$' "B4 探测先问 wl-paste"
|
|
648
704
|
if grep -q '^xclip' "$fx/calls.log"; then bad "B4 Wayland 命中时不该调用 xclip"; else ok "B4 Wayland 命中时 xclip 没有被调用"; fi
|
|
649
|
-
type_text 'Z';
|
|
705
|
+
type_text 'Z'; wait_draft "B4 粘贴后继续打字落到草稿" "a${file}Zd"
|
|
650
706
|
assert_eq "B4 粘贴后继续打字落到草稿(插入点之后)" "$(draft)" "a${file}Zd"
|
|
651
707
|
|
|
652
708
|
# ② Wayland 失败 → X11:仍成图,调用日志里 wl-paste 在 xclip 之前
|
|
653
|
-
keys Escape;
|
|
709
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
654
710
|
printf 'ad' > "$(draft_file)"
|
|
655
711
|
reset_clip
|
|
656
712
|
start_panel "$(clip_env fail image)"
|
|
657
|
-
keys m;
|
|
658
|
-
keys Left
|
|
659
|
-
keys C-v;
|
|
713
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
714
|
+
keys Left
|
|
715
|
+
keys C-v; wait_frame "B4 Wayland 失败后 X11 回退成图" 'teamsmith-paste-'
|
|
660
716
|
cap_to x11
|
|
661
717
|
file="$(pasted_file)"
|
|
662
718
|
assert_eq "B4 X11 回退:文件内容 XCLIPDATA" "$(cat "$file" 2>/dev/null)" "XCLIPDATA"
|
|
@@ -671,56 +727,74 @@ EOXC
|
|
|
671
727
|
fi
|
|
672
728
|
|
|
673
729
|
# ③ 无图片 → 文本回退,且不调用 xclip
|
|
674
|
-
keys Escape;
|
|
730
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
675
731
|
printf 'ad' > "$(draft_file)"
|
|
676
732
|
reset_clip
|
|
677
733
|
start_panel "$(clip_env text image)"
|
|
678
|
-
keys m;
|
|
679
|
-
keys Left
|
|
680
|
-
keys C-v;
|
|
734
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
735
|
+
keys Left
|
|
736
|
+
keys C-v; wait_frame "B4 文本回退进草稿" '> afrom the clipboardd'
|
|
681
737
|
cap_to text-fallback
|
|
682
738
|
assert_eq "B4 文本回退:afrom the clipboardd" "$(draft)" "afrom the clipboardd"
|
|
683
739
|
assert_eq "B4 文本回退不写临时文件" "$(paste_count)" "0"
|
|
684
740
|
if grep -q '^xclip' "$fx/calls.log"; then bad "B4 文本回退不该调用 xclip"; else ok "B4 文本回退不调用 xclip"; fi
|
|
685
741
|
|
|
686
742
|
# ④ 两个工具都不给东西:什么都不变;挂死的工具在界内被放弃
|
|
687
|
-
keys Escape;
|
|
743
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
688
744
|
printf 'half a thought' > "$(draft_file)"
|
|
689
745
|
reset_clip
|
|
690
746
|
start_panel "$(clip_env fail fail)"
|
|
691
|
-
keys m;
|
|
692
|
-
keys C-v;
|
|
747
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
748
|
+
keys C-v; wait_draft "B4 无工具:探测什么都不改" 'half a thought'
|
|
693
749
|
cap_to no-tool
|
|
694
750
|
assert_eq "B4 无工具:草稿不变" "$(draft)" "half a thought"
|
|
695
751
|
assert_eq "B4 无工具:没有文件" "$(paste_count)" "0"
|
|
696
752
|
assert_has "$tmp/clipboard/no-tool.txt" '> half a thought' "B4 无工具:帧照常、没有错误行"
|
|
697
|
-
type_text 'Z';
|
|
753
|
+
type_text 'Z'; wait_draft "B4 无工具后仍能打字" 'half a thoughtZ'
|
|
698
754
|
assert_eq "B4 无工具后仍能打字" "$(draft)" "half a thoughtZ"
|
|
699
755
|
|
|
700
|
-
keys Escape;
|
|
756
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
701
757
|
printf 'half a thought' > "$(draft_file)"
|
|
702
758
|
reset_clip
|
|
703
759
|
start_panel "$(clip_env hang fail)"
|
|
704
|
-
keys m;
|
|
760
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
761
|
+
# 保留(P336):挂死的工具下探测的结果是「什么都不发生」——没有回执行、没有文件、没有忙行,
|
|
762
|
+
# 它的“结束”无处可观测;而这条要证明的正是「工具企着的时候面板照旧可输入」,所以 Z 必须落在
|
|
763
|
+
# 工具还在挂的时候,这段空闲窗口不是等一个状态。
|
|
705
764
|
keys C-v; sleep 5
|
|
706
765
|
cap_to hang
|
|
707
766
|
assert_eq "B4 挂死工具 5s 内:草稿不变" "$(draft)" "half a thought"
|
|
708
767
|
assert_eq "B4 挂死工具:没有文件" "$(paste_count)" "0"
|
|
709
|
-
type_text 'Z';
|
|
768
|
+
type_text 'Z'; wait_draft "B4 挂死工具期间仍能打字" 'half a thoughtZ'
|
|
710
769
|
assert_eq "B4 挂死工具期间仍能打字" "$(draft)" "half a thoughtZ"
|
|
711
|
-
keys Escape;
|
|
770
|
+
keys Escape; wait_frame "B4 Esc 收起写信" '!Enter 发送'
|
|
712
771
|
assert_eq "B4 Esc 仍关掉输入行并保留草稿" "$(draft)" "half a thoughtZ"
|
|
713
772
|
|
|
714
773
|
# ⑤ 理由模式:路径进理由行,消息草稿不动
|
|
715
774
|
printf 'half a thought' > "$(draft_file)"
|
|
716
775
|
reset_clip
|
|
717
776
|
start_panel "$(clip_env image image)"
|
|
718
|
-
keys s;
|
|
719
|
-
type_text 'why'
|
|
720
|
-
keys C-v;
|
|
777
|
+
keys s; wait_frame "B4 待命理由输入行" 'Enter 进入待命'
|
|
778
|
+
type_text 'why'
|
|
779
|
+
keys C-v; wait_frame "B4 理由行里出现图片路径" 'teamsmith-paste-'
|
|
721
780
|
cap_to reason
|
|
722
781
|
file="$(pasted_file)"
|
|
723
|
-
|
|
782
|
+
# 理由行里要有**整条**路径 —— 但路径比一行宽时产品会折行画出(P309 起临时根就比 120 列面板宽:夹具这条
|
|
783
|
+
# 156 列 > 可用的 116 列),逐行 grep 整条路径会把一条真的存在的事实判红。所以先把**理由框自己那几行**
|
|
784
|
+
# (标题行之后连续的 `│ ` 行,止于第一行别的东西)按画出的顺序拼回一行,再在这段文字里找整条路径:框外
|
|
785
|
+
# 的行不进这段文字,别处的路径顶替不了;路径为空时这条直接红,不会退化成 `grep -F ''` 的通真。
|
|
786
|
+
reason_text() { # <capture> → 待命原因框里被画的完整文本(拼成一行)
|
|
787
|
+
awk '/待命原因/{inbox=1; next}
|
|
788
|
+
inbox && /^│ /{sub(/^│ /,""); sub(/^> /,""); sub(/^ +/,""); out=out $0; next}
|
|
789
|
+
inbox{exit}
|
|
790
|
+
END{printf "%s", out}' "$1"
|
|
791
|
+
}
|
|
792
|
+
if [ -z "$file" ]; then
|
|
793
|
+
bad "B4 理由行里有图片路径(理由模式没有文件落地:路径为空)"
|
|
794
|
+
else
|
|
795
|
+
printf '%s' "$(reason_text "$tmp/clipboard/reason.txt")" > "$tmp/clipboard/reason.joined"
|
|
796
|
+
assert_has "$tmp/clipboard/reason.joined" "$file" "B4 理由行里有图片路径"
|
|
797
|
+
fi
|
|
724
798
|
assert_eq "B4 理由模式仍不写 state/draft.md" "$(draft)" "half a thought"
|
|
725
799
|
|
|
726
800
|
# ⑥ 只读扫描:C-v 不调用任何 team 动作(数据读者不算动作)
|
|
@@ -731,7 +805,7 @@ printf '%s\n' "\$*" >> "$fx/team.log"
|
|
|
731
805
|
exec "$skill/scripts/team" "\$@"
|
|
732
806
|
EOS
|
|
733
807
|
chmod +x "$fx/teamwrap.sh"
|
|
734
|
-
keys Escape;
|
|
808
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
735
809
|
printf 'ad' > "$(draft_file)"
|
|
736
810
|
reset_clip
|
|
737
811
|
: > "$fx/team.log"
|
|
@@ -739,21 +813,30 @@ EOS
|
|
|
739
813
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
740
814
|
"TEAM_JS_BIN=$(printf '%q' "$js") $(clip_env image image) exec '$js' '$panel' --root '$ROOT' --team-cli '$fx/teamwrap.sh' --state-dir '$ROOT/.pi/team/state' --no-pulse --interval 1"
|
|
741
815
|
wait_panel
|
|
742
|
-
keys m;
|
|
743
|
-
keys Left
|
|
816
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
817
|
+
keys Left
|
|
744
818
|
: > "$fx/team.log"
|
|
745
|
-
|
|
819
|
+
# 这里的 ___panel-data 桩**什么都不返回**(它只负责证明没有 team 动作),产品没有 temp_root 可写 →
|
|
820
|
+
# 粘贴是一次「什么都不变」的空操作(P331 的同一条件)。等的状态是草稿仍是 ad。
|
|
821
|
+
keys C-v; wait_draft "B4 只读:C-v 之后草稿仍是 ad" 'ad'
|
|
746
822
|
assert_eq "B4 只读:C-v 没有触发任何 team 动作" "$(wc -l < "$fx/team.log" 2>/dev/null | tr -d ' ')" "0"
|
|
747
|
-
|
|
823
|
+
|
|
748
824
|
|
|
749
825
|
# ⑦ 不按 C-v 就绝不起剪贴板工具:5s 空闲(写信关着、开着各一段)调用日志为空
|
|
826
|
+
# 保留(P336):这是「一段窗口里什么都没发生」的否定观察,没有状态可等(可等的那个状态就是
|
|
827
|
+
# 「窗口过去了」自己);两段 5s 就是被测的长度。
|
|
750
828
|
reset_clip
|
|
751
829
|
: > "$fx/calls.log"
|
|
752
830
|
start_panel "$(clip_env image image)"
|
|
753
831
|
sleep 5
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
832
|
+
local idle_idle idle_compose
|
|
833
|
+
idle_idle="$(wc -l < "$fx/calls.log" | tr -d ' ')"
|
|
834
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
835
|
+
sleep 5
|
|
836
|
+
idle_compose="$(wc -l < "$fx/calls.log" | tr -d ' ')"
|
|
837
|
+
# P318:两个状态(写信关着 / 开着)是同一条「不按 C-v 就不起工具」的两半 → 一条断言数出两处
|
|
838
|
+
# (两段各 5s 的观察都保留,少的是重复的断言而不是观察)。
|
|
839
|
+
assert_eq "B4 空闲 5s(写信关着/开着两段)都没有调用剪贴板工具" "$idle_idle|$idle_compose" "0|0"
|
|
757
840
|
}
|
|
758
841
|
|
|
759
842
|
# ---------------------------------------------------------------- 2.2 draft persistence / \r
|
|
@@ -762,31 +845,24 @@ scenario_draft() {
|
|
|
762
845
|
server_up draft
|
|
763
846
|
start_pm '' ''
|
|
764
847
|
start_panel
|
|
765
|
-
keys m
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
sleep 0.5
|
|
769
|
-
keys Escape
|
|
770
|
-
sleep 0.6
|
|
848
|
+
keys m; wait_frame "2.2 写信托盘" 'Enter 发送'
|
|
849
|
+
type_text 'half a thought'; wait_draft "2.2 草稿落盘" 'half a thought'
|
|
850
|
+
keys Escape; wait_frame "2.2 写信收起" '!Enter 发送'
|
|
771
851
|
assert_eq "2.2 Esc 后 state/draft.md 保留草稿" "$(draft)" "half a thought"
|
|
772
852
|
keys q
|
|
773
|
-
sleep 1.2
|
|
774
853
|
start_panel
|
|
775
|
-
keys m
|
|
776
|
-
sleep 0.8
|
|
854
|
+
keys m; wait_frame "2.2 重启后带出草稿" '> half a thought'
|
|
777
855
|
cap_to restored
|
|
778
856
|
assert_has "$tmp/draft/restored.txt" "> half a thought" "2.2 重启后 m 带出草稿"
|
|
779
857
|
# \r 归一:用带 CR 的粘贴进草稿(bracketed paste 里的 CR 是换行,不是提交)
|
|
780
858
|
keys Escape
|
|
781
|
-
|
|
859
|
+
wait_frame "2.2 写信收起" '!Enter 发送'
|
|
782
860
|
keys q
|
|
783
|
-
sleep 1.2
|
|
784
861
|
rm -f "$(draft_file)"
|
|
785
862
|
start_panel
|
|
786
|
-
keys m
|
|
787
|
-
sleep 0.6
|
|
863
|
+
keys m; wait_frame "2.2 空草稿的托盘" 'Enter 发送'
|
|
788
864
|
type_text $'\x1b[200~cr-one\rcr-two\rcr-three\x1b[201~'
|
|
789
|
-
|
|
865
|
+
wait_draft "2.2 CR 归一为换行" $'cr-one\ncr-two\ncr-three'
|
|
790
866
|
cap_to cr
|
|
791
867
|
assert_eq "2.2 CR 归一为换行(三行草稿)" "$(draft)" $'cr-one\ncr-two\ncr-three'
|
|
792
868
|
if printf '%s' "$(draft)" | grep -q $'\r'; then
|
|
@@ -816,13 +892,10 @@ EOS
|
|
|
816
892
|
printf 'ad' > "$(draft_file)"
|
|
817
893
|
start_pm 'PM draft' ''
|
|
818
894
|
start_panel "EDITOR=$tmp/editor.sh TEAM_B2_EDITOR_HOLD=4 TEAM_B2_EDITOR_MARKER=$tmp/editor/marker"
|
|
819
|
-
keys m
|
|
820
|
-
|
|
821
|
-
keys Left
|
|
822
|
-
sleep 0.4
|
|
895
|
+
keys m; wait_frame "B3 写信托盘" '> ad'
|
|
896
|
+
keys Left; wait_cursor "B3 插入点在 ad 中间" 5
|
|
823
897
|
assert_eq "B3 夹具:插入点在 ad 中间(cursor_x=5)" "$(cursor_x)" "5"
|
|
824
|
-
keys C-e
|
|
825
|
-
sleep 0.7
|
|
898
|
+
keys C-e; wait_cursor "B3 C-e 到行尾" 6
|
|
826
899
|
assert_eq "B3 C-e 到行尾(cursor_x=6),不是编辑器" "$(cursor_x)" "6"
|
|
827
900
|
assert_eq "B3 C-e 后草稿仍是 ad" "$(draft)" "ad"
|
|
828
901
|
if [ -f "$tmp/editor/marker" ]; then
|
|
@@ -833,7 +906,7 @@ EOS
|
|
|
833
906
|
cap_to c-e-line-end
|
|
834
907
|
assert_not_has "$tmp/editor/c-e-line-end.txt" 'EDITOR-ACTIVE' "B3 C-e 没有把终端交给编辑器"
|
|
835
908
|
keys Escape
|
|
836
|
-
|
|
909
|
+
wait_frame "B3 写信收起" '!Enter 发送'
|
|
837
910
|
|
|
838
911
|
# The handoff's raw bytes (design §6): `tmux pipe-pane` records everything the pane writes.
|
|
839
912
|
rm -f "$tmp/editor/pane-bytes.log"
|
|
@@ -841,19 +914,16 @@ EOS
|
|
|
841
914
|
|
|
842
915
|
# ── 接力本体:C-o 跑一次脚本,挂起期间不重绘,回来无损。
|
|
843
916
|
printf '' > "$(draft_file)"
|
|
844
|
-
keys m
|
|
845
|
-
|
|
846
|
-
type_text 'raw1'
|
|
847
|
-
sleep 0.5
|
|
917
|
+
keys m; wait_frame "B3 重开写信托盘" 'Enter 发送'
|
|
918
|
+
type_text 'raw1'; wait_draft "B3 raw1 落盘" 'raw1'
|
|
848
919
|
keys C-o
|
|
849
920
|
local saw_editor=1 i
|
|
850
|
-
|
|
851
|
-
if { cap || true; } | grep -q 'EDITOR-ACTIVE'; then saw_editor=0; break; fi
|
|
852
|
-
sleep 0.2
|
|
853
|
-
done
|
|
921
|
+
if wait_frame "B3 C-o 把终端交给编辑器" 'EDITOR-ACTIVE'; then saw_editor=0; fi
|
|
854
922
|
cap_to during-editor
|
|
855
923
|
assert_eq "B3 C-o 把终端交给了编辑器" "$saw_editor" "0"
|
|
856
924
|
local c1 c2
|
|
925
|
+
# 保留(P336):这条断言本身就是「一段窗口里画面没变」——「不会重绘」没有事件可等,
|
|
926
|
+
# 而 1.3s 就是被测的那段窗口(编辑器还要挂 TEAM_B2_EDITOR_HOLD=4s)。
|
|
857
927
|
c1="$(cap)"
|
|
858
928
|
sleep 1.3
|
|
859
929
|
c2="$(cap)"
|
|
@@ -863,11 +933,7 @@ EOS
|
|
|
863
933
|
bad "B3 挂起期间仍在重绘(挂起门控没生效)"
|
|
864
934
|
fi
|
|
865
935
|
assert_not_has "$tmp/editor/during-editor.txt" 'EDITOR-DONE' "B3 编辑器还在跑"
|
|
866
|
-
|
|
867
|
-
{ cap || true; } | grep -q 'EDITOR-DONE' && break
|
|
868
|
-
sleep 0.4
|
|
869
|
-
done
|
|
870
|
-
sleep 1
|
|
936
|
+
wait_frame "B3 接力回来前面板帧完好" 'teamsmith pulse' '> raw1'
|
|
871
937
|
cap_to after-editor
|
|
872
938
|
assert_has "$tmp/editor/after-editor.txt" 'teamsmith pulse' "B3 接力回来后面板帧完好"
|
|
873
939
|
assert_has "$tmp/editor/after-editor.txt" '> raw1' "B3 输入行保留 raw1"
|
|
@@ -881,8 +947,7 @@ EOS
|
|
|
881
947
|
else
|
|
882
948
|
bad "B3 Kitty 关/开字节缺失(pane-bytes.log $(wc -c < "$tmp/editor/pane-bytes.log" 2>/dev/null | tr -d ' ') 字节)"
|
|
883
949
|
fi
|
|
884
|
-
keys Enter
|
|
885
|
-
sleep 3
|
|
950
|
+
keys Enter; wait_frame "B3 忙框回执 queued" '· queued'
|
|
886
951
|
cap_to after-send
|
|
887
952
|
assert_has "$tmp/editor/after-send.txt" 'queued' "B3 忙框回执 queued"
|
|
888
953
|
local n e payload
|
|
@@ -897,32 +962,24 @@ EOS
|
|
|
897
962
|
# 夹具用 `vi -n`(无 swap 文件),只在 vi 存在时跑。
|
|
898
963
|
if command -v vi >/dev/null 2>&1; then
|
|
899
964
|
start_panel "EDITOR='vi -n'"
|
|
900
|
-
keys m
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
sleep 0.4
|
|
904
|
-
keys C-o
|
|
905
|
-
sleep 1.6
|
|
965
|
+
keys m; wait_frame "B3 真 vi:写信托盘" 'Enter 发送'
|
|
966
|
+
type_text 'vi draft'; wait_draft "B3 真 vi:草稿落盘" 'vi draft'
|
|
967
|
+
keys C-o; wait_frame "B3 真 vi:终端已交给 vi" '!Enter 发送'
|
|
906
968
|
cap_to vi-open
|
|
907
969
|
assert_has "$tmp/editor/vi-open.txt" 'vi draft' "B3 真 vi:草稿真的进了编辑器"
|
|
908
970
|
keys G
|
|
909
|
-
sleep 0.3
|
|
910
971
|
keys o
|
|
911
|
-
sleep 0.3
|
|
912
972
|
type_text 'vi second line'
|
|
913
|
-
sleep 0.3
|
|
914
973
|
keys Escape
|
|
915
|
-
sleep 0.3
|
|
974
|
+
sleep 0.3 # 保留(P336):vi 的 ESC 消歧超时(ESC 紧接 `:` 前得先真正离开插入模式)
|
|
916
975
|
type_text ':wq'
|
|
917
|
-
sleep 0.2
|
|
918
976
|
keys Enter
|
|
919
|
-
|
|
977
|
+
wait_frame "B3 真 vi:退出后面板帧正常" 'teamsmith pulse' 'vi second line'
|
|
920
978
|
cap_to vi-back
|
|
921
979
|
assert_has "$tmp/editor/vi-back.txt" 'teamsmith pulse' "B3 真 vi:退出后面板帧正常"
|
|
922
980
|
assert_has "$tmp/editor/vi-back.txt" '> vi draft' "B3 真 vi:第一行无损"
|
|
923
981
|
assert_has "$tmp/editor/vi-back.txt" 'vi second line' "B3 真 vi:新增的第二行无损带回"
|
|
924
|
-
keys Enter
|
|
925
|
-
sleep 3
|
|
982
|
+
keys Enter; wait_frame "B3 真 vi:忙框回执 queued" '· queued'
|
|
926
983
|
cap_to vi-sent
|
|
927
984
|
assert_has "$tmp/editor/vi-sent.txt" 'queued' "B3 真 vi:忙框回执 queued"
|
|
928
985
|
local newest
|
|
@@ -942,12 +999,9 @@ scenario_receipt() {
|
|
|
942
999
|
start_panel
|
|
943
1000
|
local before after
|
|
944
1001
|
before="$(pm_cap)"
|
|
945
|
-
keys m
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
sleep 0.4
|
|
949
|
-
keys Enter
|
|
950
|
-
sleep 3
|
|
1002
|
+
keys m; wait_frame "2.4 写信托盘" 'Enter 发送'
|
|
1003
|
+
type_text 'hello'; wait_draft "2.4 草稿落盘" 'hello'
|
|
1004
|
+
keys Enter; wait_frame "2.4 忙框回执" '· queued'
|
|
951
1005
|
cap_to busy
|
|
952
1006
|
assert_has "$tmp/receipt/busy.txt" 'queued' "2.4 忙框回执 queued"
|
|
953
1007
|
assert_eq "2.4 忙框:恰好一条队列条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
@@ -960,14 +1014,11 @@ scenario_receipt() {
|
|
|
960
1014
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
961
1015
|
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
962
1016
|
start_pm '' ''
|
|
963
|
-
keys m
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
sleep 0.4
|
|
967
|
-
keys Enter
|
|
968
|
-
sleep 3
|
|
1017
|
+
keys m; wait_frame "2.4 写信托盘" 'Enter 发送'
|
|
1018
|
+
type_text 'hello2'; wait_draft "2.4 草稿落盘" 'hello2'
|
|
1019
|
+
keys Enter; wait_frame "2.4 空框交付回执" '· delivered'
|
|
969
1020
|
cap_to delivered
|
|
970
|
-
|
|
1021
|
+
# P318:`delivered` 回执由 2.7(settle ①)断言 —— 同一条回执契约,不按场景重复。
|
|
971
1022
|
assert_eq "2.4 空框:恰好一次提交" "$(submits)" "1"
|
|
972
1023
|
assert_eq "2.4 空框:提交内容是 hello2" "$(last_submit)" "hello2"
|
|
973
1024
|
assert_eq "2.4 空框:没有留下队列条目" "$(entries | wc -l | tr -d ' ')" "0"
|
|
@@ -976,16 +1027,14 @@ scenario_receipt() {
|
|
|
976
1027
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
977
1028
|
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
978
1029
|
start_pm '' 'FAKE_TUI_EAT_ENTER=1 FAKE_TUI_STATIC_FOOTER=1'
|
|
979
|
-
keys m
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
sleep 0.4
|
|
983
|
-
keys Enter
|
|
984
|
-
sleep 9
|
|
1030
|
+
keys m; wait_frame "2.4 写信托盘" 'Enter 发送'
|
|
1031
|
+
type_text 'held candidate'; wait_draft "2.4 草稿落盘" 'held candidate'
|
|
1032
|
+
keys Enter; wait_frame "2.4 吞掉 Enter 的滞留回执" '· held'
|
|
985
1033
|
cap_to held
|
|
986
|
-
|
|
1034
|
+
# P318:`held` 回执与 HOLDING.log 由 2.7(settle ③)断言 —— 这里只留 2.7 没测的那一条
|
|
1035
|
+
# (活动队列为空)。
|
|
987
1036
|
assert_eq "2.4 held:条目进了 outbox/held/" "$(held_entries | wc -l | tr -d ' ')" "1"
|
|
988
|
-
|
|
1037
|
+
|
|
989
1038
|
assert_eq "2.4 held:活动队列为空" "$(entries | wc -l | tr -d ' ')" "0"
|
|
990
1039
|
}
|
|
991
1040
|
|
|
@@ -999,12 +1048,12 @@ scenario_pause() {
|
|
|
999
1048
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
1000
1049
|
"TEAM_JS_BIN=$(printf '%q' "$js") TEAM_B2_REAL_CLI=$(printf '%q' "$skill/scripts/team") TEAM_B2_SLOW_SLEEP=4 exec '$js' '$panel' --root '$ROOT' --team-cli '$stub' --state-dir '$ROOT/.pi/team/state' --no-pulse --refresh 1"
|
|
1001
1050
|
wait_panel || return 1
|
|
1002
|
-
keys m
|
|
1003
|
-
|
|
1004
|
-
type_text 'before'
|
|
1005
|
-
sleep 0.6
|
|
1051
|
+
keys m; wait_frame "2.5 写信托盘" 'Enter 发送'
|
|
1052
|
+
type_text 'before'; wait_draft "2.5 草稿落盘" 'before'
|
|
1006
1053
|
local ts1 ts2
|
|
1007
1054
|
ts1="$(stamp)"
|
|
1055
|
+
# 保留(P336):这里等的是一个**节流间隔**本身(桩每次读数据要 TEAM_B2_SLOW_SLEEP=4s,6s 是
|
|
1056
|
+
# 它的一轮加余量);「又刷了一轮」没有事件可等。
|
|
1008
1057
|
sleep 6
|
|
1009
1058
|
ts2="$(stamp)"
|
|
1010
1059
|
if [ -n "$ts1" ] && [ "$ts2" != "$ts1" ]; then
|
|
@@ -1012,13 +1061,11 @@ scenario_pause() {
|
|
|
1012
1061
|
else
|
|
1013
1062
|
bad "2.5 写信期间没有刷新($ts1 → $ts2)"
|
|
1014
1063
|
fi
|
|
1015
|
-
type_text 'after'
|
|
1016
|
-
sleep 0.6
|
|
1064
|
+
type_text 'after'; wait_draft "2.5 草稿跨刷新存活" 'beforeafter'
|
|
1017
1065
|
cap_to pause
|
|
1018
1066
|
assert_has "$tmp/pause/pause.txt" '> beforeafter' "2.5 草稿跨刷新存活(beforeafter)"
|
|
1019
1067
|
assert_eq "2.5 草稿文件也是 beforeafter" "$(draft)" "beforeafter"
|
|
1020
|
-
keys Enter
|
|
1021
|
-
sleep 3
|
|
1068
|
+
keys Enter; wait_frame "2.5 忙框回执 queued" '· queued'
|
|
1022
1069
|
assert_eq "2.5 跨刷新后的草稿仍作为一条消息入队" "$(payload_of "$(entries | head -1)")" "beforeafter"
|
|
1023
1070
|
}
|
|
1024
1071
|
|
|
@@ -1029,25 +1076,19 @@ scenario_paste() {
|
|
|
1029
1076
|
start_pm 'PM draft' ''
|
|
1030
1077
|
start_panel
|
|
1031
1078
|
# ① plain paste:一行 write 里带 LF
|
|
1032
|
-
keys m
|
|
1033
|
-
|
|
1034
|
-
type_text $'line one\nline two\nline three'
|
|
1035
|
-
sleep 0.6
|
|
1079
|
+
keys m; wait_frame "2.6 写信托盘" 'Enter 发送'
|
|
1080
|
+
type_text $'line one\nline two\nline three'; wait_draft "2.6 plain 三行进草稿" $'line one\nline two\nline three'
|
|
1036
1081
|
cap_to plain
|
|
1037
1082
|
assert_has "$tmp/paste/plain.txt" ' line three' "2.6 plain 粘贴三行都在草稿里"
|
|
1038
|
-
keys Enter
|
|
1039
|
-
sleep 3
|
|
1083
|
+
keys Enter; wait_frame "2.6 plain 的忙框回执" '· queued'
|
|
1040
1084
|
assert_eq "2.6 plain:恰好一条条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
1041
1085
|
assert_eq "2.6 plain:条目保住三行" "$(payload_of "$(entries | head -1)")" $'line one\nline two\nline three'
|
|
1042
1086
|
# ② bracketed paste:DECSET 标记包裹,里面是 CR
|
|
1043
|
-
keys m
|
|
1044
|
-
|
|
1045
|
-
type_text $'\x1b[200~b-one\rb-two\rb-three\x1b[201~'
|
|
1046
|
-
sleep 0.6
|
|
1087
|
+
keys m; wait_frame "2.6 重开写信托盘" 'Enter 发送'
|
|
1088
|
+
type_text $'\x1b[200~b-one\rb-two\rb-three\x1b[201~'; wait_draft "2.6 bracketed 三行进草稿" $'b-one\nb-two\nb-three'
|
|
1047
1089
|
cap_to bracket
|
|
1048
1090
|
assert_has "$tmp/paste/bracket.txt" ' b-three' "2.6 bracketed 粘贴三行都在草稿里"
|
|
1049
|
-
keys Enter
|
|
1050
|
-
sleep 3
|
|
1091
|
+
keys Enter; wait_frame "2.6 bracketed 的忙框回执" '· queued'
|
|
1051
1092
|
assert_eq "2.6 bracketed:两条条目(每次粘贴一条)" "$(entries | wc -l | tr -d ' ')" "2"
|
|
1052
1093
|
assert_eq "2.6 bracketed:条目保住三行" "$(payload_of "$(entries | tail -1)")" $'b-one\nb-two\nb-three'
|
|
1053
1094
|
assert_eq "2.6 两次粘贴都没有产生提交(忙框守卫)" "$(submits)" "0"
|
|
@@ -1060,99 +1101,135 @@ scenario_actions() {
|
|
|
1060
1101
|
start_pm '' ''
|
|
1061
1102
|
start_panel
|
|
1062
1103
|
# 先留一份消息草稿,证明「理由」不会覆盖它
|
|
1063
|
-
keys m
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
sleep 0.4
|
|
1067
|
-
keys Escape
|
|
1068
|
-
sleep 0.5
|
|
1104
|
+
keys m; wait_frame "3.1 写信托盘" 'Enter 发送'
|
|
1105
|
+
type_text 'draft kept'; wait_draft "3.1 草稿落盘" 'draft kept'
|
|
1106
|
+
keys Escape; wait_frame "3.1 写信收起" '!Enter 发送'
|
|
1069
1107
|
# 队列里放两条(目标窗口就是 fixture 的 PM,空框 → flush 可投)
|
|
1070
1108
|
( cd "$ROOT" && bash "$skill/scripts/team" outbox enqueue --kind say --target "$sess:pm" --from pm --payload 'q one' >/dev/null 2>&1
|
|
1071
1109
|
bash "$skill/scripts/team" outbox enqueue --kind say --target "$sess:pm" --from pm --payload 'q two' >/dev/null 2>&1 )
|
|
1072
1110
|
assert_eq "3.1 夹具:队列里两条" "$(entries | wc -l | tr -d ' ')" "2"
|
|
1073
|
-
keys f
|
|
1074
|
-
sleep 5
|
|
1111
|
+
keys f; wait_frame "3.1 f 的回执(flush 自己的日志行)" 'outbox'
|
|
1075
1112
|
cap_to flush
|
|
1076
1113
|
assert_has "$tmp/actions/flush.txt" 'outbox' "3.1 f 的回执带 flush 自己的日志行"
|
|
1077
1114
|
assert_eq "3.1 f 之后队列空了(flush 真跑了)" "$(entries | wc -l | tr -d ' ')" "0"
|
|
1078
1115
|
assert_eq "3.1 flush 投了两条" "$(submits)" "2"
|
|
1079
1116
|
# s:关 → 开(要理由)
|
|
1080
|
-
keys s
|
|
1081
|
-
sleep 0.8
|
|
1117
|
+
keys s; wait_frame "3.1 理由输入行" 'Enter 进入待命'
|
|
1082
1118
|
cap_to reason-input
|
|
1083
1119
|
assert_has "$tmp/actions/reason-input.txt" '>' "3.1 s 打开理由输入行"
|
|
1084
1120
|
type_text 'lunch'
|
|
1085
|
-
|
|
1086
|
-
keys Enter
|
|
1087
|
-
sleep 3
|
|
1121
|
+
keys Enter; wait_frame "3.1 待命 on 的回执" '待命 on'
|
|
1088
1122
|
cap_to standby-on
|
|
1089
1123
|
assert_has "$tmp/actions/standby-on.txt" '待命 on' "3.1 s 之后回执显示待命 on"
|
|
1090
1124
|
( cd "$ROOT" && bash "$skill/scripts/team" standby status ) > "$tmp/actions/status-on.txt" 2>&1 || true
|
|
1091
1125
|
assert_has "$tmp/actions/status-on.txt" 'standby: on' "3.1 CLI 报告 standby on"
|
|
1092
1126
|
assert_has "$tmp/actions/status-on.txt" 'lunch' "3.1 CLI 记下理由 lunch"
|
|
1093
1127
|
assert_eq "3.1 理由没有覆盖消息草稿" "$(draft)" "draft kept"
|
|
1094
|
-
|
|
1095
|
-
|
|
1128
|
+
# s 的开关判定读的是面板帧里的 standby.on。提交返回「✓ 待命 on」、CLI 也已是 on,并不代表帧已经带上它:
|
|
1129
|
+
# 那次读数走 team __panel-data 子进程(frame 块超时 10s),机器忙时旧值会留很久 —— 本机实测过 20s 仍读到
|
|
1130
|
+
# 旧值。所以等旗标带里真的写着 on,再按第二下。
|
|
1131
|
+
wait_frame "3.1 面板缓存看到待命 on" '· 待命 on'
|
|
1132
|
+
keys s; wait_frame "3.1 待命 off 的回执" '待命 off'
|
|
1096
1133
|
cap_to standby-off
|
|
1097
1134
|
assert_has "$tmp/actions/standby-off.txt" '待命 off' "3.1 再按 s 回执显示待命 off"
|
|
1098
1135
|
( cd "$ROOT" && bash "$skill/scripts/team" standby status ) > "$tmp/actions/status-off.txt" 2>&1 || true
|
|
1099
1136
|
assert_has "$tmp/actions/status-off.txt" 'standby: off' "3.1 CLI 报告 standby off"
|
|
1100
1137
|
}
|
|
1101
1138
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1139
|
+
|
|
1140
|
+
# ---------------------------------------------------------------- 2.7 the draft settle (P249)
|
|
1141
|
+
scenario_settle() {
|
|
1142
|
+
section "2.7 · 草稿结算:成功一起清空、error 原地保留、写盘失败不假装清掉"
|
|
1143
|
+
server_up settle
|
|
1144
|
+
local before after
|
|
1145
|
+
|
|
1146
|
+
# ① delivered:输入行与 state/draft.md 一起清空;重启后 m 打开空草稿(无幽灵草稿)
|
|
1106
1147
|
start_pm '' ''
|
|
1107
1148
|
start_panel
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
keys
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
keys
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1149
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1150
|
+
type_text 'half a thought'; wait_draft "2.7 草稿落盘" 'half a thought'
|
|
1151
|
+
assert_eq "2.7 delivered 发送前:文件里有原文" "$(draft)" "half a thought"
|
|
1152
|
+
keys Enter; wait_frame "2.7 delivered 回执" '· delivered'
|
|
1153
|
+
cap_to delivered
|
|
1154
|
+
assert_has "$tmp/settle/delivered.txt" 'delivered' "2.7 delivered 回执"
|
|
1155
|
+
assert_eq "2.7 delivered:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1156
|
+
start_panel
|
|
1157
|
+
keys m; wait_frame "2.7 重启后的空草稿" 'Enter 发送'
|
|
1158
|
+
cap_to delivered-reopen
|
|
1159
|
+
assert_not_has "$tmp/settle/delivered-reopen.txt" 'half a thought' "2.7 delivered:重启后 m 不带回已发正文"
|
|
1160
|
+
|
|
1161
|
+
# ② queued(PM 框忙):一样一起清空,PM 的草稿逐字节不变
|
|
1162
|
+
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1163
|
+
start_pm '半句草稿 half a sentence' ''
|
|
1164
|
+
start_panel
|
|
1165
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1166
|
+
type_text 'queued thought'; wait_draft "2.7 草稿落盘" 'queued thought'
|
|
1167
|
+
before="$(pm_cap)"
|
|
1168
|
+
keys Enter; wait_frame "2.7 queued 回执" '· queued'
|
|
1169
|
+
cap_to queued
|
|
1170
|
+
assert_has "$tmp/settle/queued.txt" 'queued' "2.7 queued 回执"
|
|
1171
|
+
assert_eq "2.7 queued:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1172
|
+
after="$(pm_cap)"
|
|
1173
|
+
assert_eq "2.7 queued:PM 的草稿逐字节不变" "$before" "$after"
|
|
1174
|
+
|
|
1175
|
+
# ③ held(unconfirmed,静态页脚):清空(裁定 D2:结算不是丢失,durable 副本在 outbox/held/)
|
|
1176
|
+
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1177
|
+
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
1178
|
+
start_pm '' 'FAKE_TUI_EAT_ENTER=1 FAKE_TUI_STATIC_FOOTER=1'
|
|
1179
|
+
start_panel
|
|
1180
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1181
|
+
type_text 'held candidate'; wait_draft "2.7 草稿落盘" 'held candidate'
|
|
1182
|
+
keys Enter; wait_frame "2.7 held 回执" '· held'
|
|
1183
|
+
cap_to held
|
|
1184
|
+
assert_has "$tmp/settle/held.txt" 'held' "2.7 held 回执"
|
|
1185
|
+
assert_eq "2.7 held:state/draft.md 0 字节(清空是结算)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1186
|
+
assert_has "$ROOT/.pi/team/state/outbox/HOLDING.log" 'reason=unconfirmed' "2.7 held:副本在 held/ 且记下原因"
|
|
1187
|
+
|
|
1188
|
+
# ④ error(没有投递目标):文字保留在输入行与文件里,下一次 Enter 从原文重试(compose 不关)
|
|
1189
|
+
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1190
|
+
start_panel
|
|
1191
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1192
|
+
type_text 'kept words'; wait_draft "2.7 草稿落盘" 'kept words'
|
|
1193
|
+
keys Enter; wait_frame "2.7 error 回执" '未确认'
|
|
1194
|
+
cap_to error
|
|
1195
|
+
assert_has "$tmp/settle/error.txt" '未确认' "2.7 error 回执(投递未确认)"
|
|
1196
|
+
assert_has "$tmp/settle/error.txt" 'kept words' "2.7 error:输入行仍留着原文"
|
|
1197
|
+
assert_eq "2.7 error:state/draft.md 保留原文" "$(draft)" "kept words"
|
|
1198
|
+
# 保留(P336):重试拿到的是同一条回执(compose 不关、文字不变),帧上没有新状态可等 ——
|
|
1199
|
+
# 这两句要证明的是「上一次的保留没有自己消失」,本身就是一段无变化的窗口。
|
|
1200
|
+
keys Enter; sleep 3
|
|
1201
|
+
cap_to error-retry
|
|
1202
|
+
assert_has "$tmp/settle/error-retry.txt" 'kept words' "2.7 error:下一次 Enter 从保留的原文重试"
|
|
1203
|
+
|
|
1204
|
+
# ⑤ 写盘失败(settle 已成立但清空写不进去):不假装清掉——文字与文件都还在、回执点名文件
|
|
1205
|
+
# (先把 ④ 留在闸里的草稿拿掉,让这一段从干净的一页开始)
|
|
1206
|
+
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1207
|
+
rm -f "$(draft_file)"
|
|
1208
|
+
start_pm '' ''
|
|
1209
|
+
start_panel
|
|
1210
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1211
|
+
type_text 'ghost candidate'; wait_draft "2.7 草稿落盘" 'ghost candidate'
|
|
1212
|
+
chmod 444 "$(draft_file)"
|
|
1213
|
+
keys Enter; wait_frame "2.7 写盘失败的回执点名文件" 'draft.md'
|
|
1214
|
+
cap_to readonly
|
|
1215
|
+
assert_has "$tmp/settle/readonly.txt" 'draft.md' "2.7 写盘失败:回执点名 state/draft.md"
|
|
1216
|
+
assert_has "$tmp/settle/readonly.txt" 'ghost candidate' "2.7 写盘失败:输入行仍留着原文(不假装清掉)"
|
|
1217
|
+
assert_eq "2.7 写盘失败:文件仍是原文(内存=磁盘)" "$(draft)" "ghost candidate"
|
|
1218
|
+
chmod 644 "$(draft_file)"
|
|
1219
|
+
keys Enter; wait_draft "2.7 重试成功后草稿清空" ''
|
|
1220
|
+
cap_to readonly-retry
|
|
1221
|
+
assert_eq "2.7 清空失败后恢复可写重试:文件清空" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1222
|
+
assert_not_has "$tmp/settle/readonly-retry.txt" 'ghost candidate' "2.7 重试成功后输入行也空了"
|
|
1148
1223
|
}
|
|
1149
1224
|
|
|
1150
1225
|
# ---------------------------------------------------------------- runner
|
|
1151
1226
|
if [ "${BASH_SOURCE[0]}" != "$0" ]; then
|
|
1152
1227
|
return 0 2>/dev/null || exit 0
|
|
1153
1228
|
fi
|
|
1154
|
-
ALL="cursor keys multiline clipboard
|
|
1229
|
+
ALL="cursor keys multiline clipboard draft editor receipt settle pause paste actions"
|
|
1155
1230
|
selected="${*:-$ALL}"
|
|
1231
|
+
# P249: `--all` is the explicit whole-suite selector the task's acceptance commands use.
|
|
1232
|
+
[ "$selected" = "--all" ] && selected="$ALL"
|
|
1156
1233
|
mkdir -p "$tmp"
|
|
1157
1234
|
rc=0
|
|
1158
1235
|
for name in $selected; do
|
|
@@ -1162,15 +1239,16 @@ for name in $selected; do
|
|
|
1162
1239
|
keys) scenario_keys ;;
|
|
1163
1240
|
multiline) scenario_multiline ;;
|
|
1164
1241
|
clipboard) scenario_clipboard ;;
|
|
1165
|
-
|
|
1242
|
+
|
|
1166
1243
|
draft) scenario_draft ;;
|
|
1167
1244
|
editor) scenario_editor ;;
|
|
1168
1245
|
receipt) scenario_receipt ;;
|
|
1246
|
+
settle) scenario_settle ;;
|
|
1169
1247
|
pause) scenario_pause ;;
|
|
1170
1248
|
paste) scenario_paste ;;
|
|
1171
1249
|
actions) scenario_actions ;;
|
|
1172
|
-
|
|
1173
|
-
*) printf 'panel-b2: unknown scenario %s(known: %s)\n' "$name" "$ALL" >&2;
|
|
1250
|
+
|
|
1251
|
+
*) printf 'panel-b2: unknown scenario %s(known: %s)\n' "$name" "$ALL" >&2; rc=3 ;;
|
|
1174
1252
|
esac || rc=$?
|
|
1175
1253
|
done
|
|
1176
1254
|
|