teamsmith 0.3.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 +41 -0
- package/skills/teamsmith/SKILL.md +7 -7
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/references/protocol.md +33 -19
- package/skills/teamsmith/references/troubleshooting.md +6 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +15 -10
- package/skills/teamsmith/scripts/lib/cmd-status.sh +8 -4
- package/skills/teamsmith/scripts/lib/common.sh +301 -267
- package/skills/teamsmith/scripts/lib/gate-lock.sh +66 -28
- package/skills/teamsmith/scripts/panel/panel.js +64 -64
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +2 -1
- package/skills/teamsmith/scripts/panel/src/data.ts +40 -2
- package/skills/teamsmith/scripts/panel/src/main.tsx +5 -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/tests/README.md +31 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +80 -53
- package/skills/teamsmith/tests/config-cli.sh +28 -22
- package/skills/teamsmith/tests/flip-p310-lock.sh +3 -9
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +2 -2
- package/skills/teamsmith/tests/install-shape.sh +80 -2
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -1
- package/skills/teamsmith/tests/key-replies.sh +41 -27
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/section-guard.sh +104 -197
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -89
- package/skills/teamsmith/tests/panel-b2.sh +351 -376
- package/skills/teamsmith/tests/panel-b3.sh +139 -43
- package/skills/teamsmith/tests/panel-cpu.sh +41 -129
- package/skills/teamsmith/tests/panel-p21.sh +96 -193
- package/skills/teamsmith/tests/perf.sh +83 -383
- package/skills/teamsmith/tests/routes.sh +115 -26
- package/skills/teamsmith/tests/seat-interrupt.sh +20 -10
- package/skills/teamsmith/tests/seat-visibility.sh +1 -1
- package/skills/teamsmith/tests/section-guard.sh +7 -101
- package/skills/teamsmith/tests/section-paths.tsv +15 -7
- package/skills/teamsmith/tests/section-select.sh +363 -18
- 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 +4 -4
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +856 -581
- package/skills/teamsmith/tests/task-model-routing.sh +25 -7
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +1 -1
- 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 -188
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -378
- 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 -286
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -116
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -324
- 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 -242
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -291
- 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-p287-lock.sh +0 -342
- package/skills/teamsmith/tests/flip-p287-name.sh +0 -279
- package/skills/teamsmith/tests/flip-p304-read-side.sh +0 -98
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +0 -122
- 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 -89
- package/skills/teamsmith/tests/section-budgets.tsv +0 -164
- 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,133 +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
|
|
|
371
410
|
# ①半 ctrl+u(V33 第一轮 OBS-1 的缺测项):清空到行首 → **持久化为空草稿**,重开/重启都不带回。
|
|
372
411
|
# 合同:「a draft the human deleted with the compose line's own keys is not resurrected」。
|
|
373
|
-
keys Escape;
|
|
412
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
374
413
|
printf '' > "$(draft_file)"
|
|
375
|
-
keys m;
|
|
376
|
-
type_text 'half a thought';
|
|
414
|
+
keys m; wait_frame "B2 空草稿的托盘" 'Enter 发送'
|
|
415
|
+
type_text 'half a thought'; wait_draft "B2 正文已落盘" 'half a thought'
|
|
377
416
|
assert_eq "B2 ctrl+u:清空前正文已落盘" "$(draft)" "half a thought"
|
|
378
|
-
keys C-u;
|
|
417
|
+
keys C-u; wait_draft "B2 ctrl+u 清空草稿" ''
|
|
379
418
|
assert_eq "B2 ctrl+u:草稿文件 0 字节(清空是持久的)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
380
419
|
cap_to ctrl-u
|
|
381
420
|
assert_not_has "$tmp/keys/ctrl-u.txt" 'half a thought' "B2 ctrl+u:帧里不再出现被删掉的正文"
|
|
382
|
-
keys Escape;
|
|
421
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
383
422
|
start_panel
|
|
384
|
-
keys m;
|
|
423
|
+
keys m; wait_frame "B2 重开后的托盘" 'Enter 发送'
|
|
385
424
|
cap_to ctrl-u-reopen
|
|
386
425
|
assert_not_has "$tmp/keys/ctrl-u-reopen.txt" 'half a thought' "B2 ctrl+u:重开(重启后 m)不带回已删正文"
|
|
387
426
|
assert_eq "B2 ctrl+u:重开后草稿文件仍是 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
388
427
|
|
|
389
428
|
# ② 逻辑行边界:45 字符行 + second,↑ ctrl+a ctrl+k → \nsecond
|
|
390
|
-
keys Escape;
|
|
429
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
391
430
|
resize_pane 40 30
|
|
392
431
|
python3 -c 'import sys; sys.stdout.write("x"*45 + "\nsecond")' > "$(draft_file)"
|
|
393
|
-
keys m;
|
|
394
|
-
keys Up
|
|
395
|
-
keys C-a
|
|
396
|
-
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')"
|
|
397
436
|
cap_to line
|
|
398
437
|
assert_eq "B2 ctrl+k 删的是逻辑行(整行 45 字符),不是绘制行" "$(draft)" "$(printf '\nsecond')"
|
|
399
|
-
|
|
438
|
+
|
|
400
439
|
|
|
401
440
|
# ③ Kitty 编码:ctrl+b ×3 + alt+b 与 legacy 字节落在同一插入点
|
|
402
441
|
# (spec 原写 cursor_x 12;实测/算术都是 10 —— alpha beta 末尾 3×← 到 index 7、再一词到 6,
|
|
403
442
|
# `│ > alpha ` 共 10 列。两种编码必须一致,这条断言是硬约束,数值随实测修正。)
|
|
404
|
-
keys Escape;
|
|
443
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
405
444
|
resize_pane 120 30
|
|
406
445
|
printf 'alpha beta' > "$(draft_file)"
|
|
407
|
-
keys m;
|
|
408
|
-
type_text $'\x1b[98;5u\x1b[98;5u\x1b[98;5u'
|
|
409
|
-
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
|
|
410
449
|
local kitty_x
|
|
411
450
|
kitty_x="$(cursor_x)"
|
|
412
451
|
assert_eq "B2 Kitty ctrl+b×3 + alt+b 后 cursor_x=10(alpha |beta)" "$kitty_x" "10"
|
|
413
452
|
assert_eq "B2 Kitty 编码移动不改草稿" "$(draft)" "alpha beta"
|
|
414
453
|
# 同一条序列的 legacy 字节(ctrl+b = 0x02 单独发;alt+b = ESC b)必须落在同一处。
|
|
415
|
-
keys Escape;
|
|
454
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
416
455
|
printf 'alpha beta' > "$(draft_file)"
|
|
417
|
-
keys m;
|
|
418
|
-
keys C-b;
|
|
419
|
-
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"
|
|
420
459
|
assert_eq "B2 legacy 字节复跑同一条序列落点与 Kitty 相同" "$(cursor_x)" "$kitty_x"
|
|
421
460
|
|
|
422
461
|
# ④ kill ring:ctrl+w ctrl+a ctrl+k ctrl+y alt+y → ` gamma`
|
|
423
|
-
keys Escape;
|
|
462
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
424
463
|
printf 'alpha beta gamma' > "$(draft_file)"
|
|
425
|
-
keys m;
|
|
426
|
-
keys C-w
|
|
427
|
-
keys C-a
|
|
428
|
-
keys C-k
|
|
429
|
-
keys C-y
|
|
430
|
-
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'
|
|
431
470
|
cap_to ring
|
|
432
471
|
assert_eq "B2 ring:ctrl+y 放回新的,alt+y 换成旧的 → 空格+gamma" "$(draft)" " gamma"
|
|
433
472
|
|
|
434
473
|
# ⑦ 词边界用平台的 word segmenter(标点在 pi 里是停点):alt+b/alt+d 不能把 alpha-beta 当一个词
|
|
435
|
-
keys Escape;
|
|
474
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
436
475
|
printf 'alpha-beta gamma' > "$(draft_file)"
|
|
437
|
-
keys m;
|
|
438
|
-
keys C-w
|
|
439
|
-
keys M-b
|
|
440
|
-
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-'
|
|
441
480
|
cap_to punctuation
|
|
442
481
|
assert_eq "B2 标点是词停点:alpha-beta gamma → alpha-" "$(draft)" "alpha-"
|
|
443
|
-
|
|
482
|
+
|
|
444
483
|
|
|
445
484
|
# ⑦半 word segmenter 对 CJK 真的分词(pi 用 Intl.Segmenter;「白空格规则」会把整串当一个词)
|
|
446
|
-
keys Escape;
|
|
485
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
447
486
|
printf '中文中文' > "$(draft_file)"
|
|
448
|
-
keys m;
|
|
449
|
-
keys M-b
|
|
450
|
-
type_text 'X';
|
|
487
|
+
keys m; wait_frame "B2 中文草稿的托盘" '│ > 中文中文'
|
|
488
|
+
keys M-b # 词左移:pi 切出两个「中文」,回到后一个的开头
|
|
489
|
+
type_text 'X'; wait_draft "B2 CJK 词边界" '中文X中文'
|
|
451
490
|
cap_to cjk-word
|
|
452
491
|
assert_eq "B2 CJK 词边界:alt+b 只回上一个词(中文X中文)" "$(draft)" "中文X中文"
|
|
453
|
-
|
|
492
|
+
|
|
454
493
|
|
|
455
494
|
# ⑧ kill ring 累积:同方向连续切合并成一条(ctrl+w ×2 → ` beta gamma`)
|
|
456
|
-
keys Escape;
|
|
495
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
457
496
|
printf 'alpha beta gamma' > "$(draft_file)"
|
|
458
|
-
keys m;
|
|
459
|
-
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'
|
|
460
499
|
assert_eq "B2 两次 ctrl+w 后只剩 alpha" "$(draft)" "alpha"
|
|
461
|
-
keys C-a
|
|
462
|
-
keys C-k
|
|
463
|
-
keys C-y
|
|
464
|
-
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'
|
|
465
504
|
cap_to ring-accum
|
|
466
505
|
assert_eq "B2 ring 累积:alt+y 换回合并的一条(空格+beta+空格+gamma)" "$(draft)" " beta gamma"
|
|
467
506
|
|
|
468
507
|
# ⑤ undo:Z 之后 Kitty ctrl+- 恢复草稿与插入点,再按一次不变
|
|
469
|
-
keys Escape;
|
|
508
|
+
keys Escape; wait_frame "B2 写信收起" '!Enter 发送'
|
|
470
509
|
printf 'ad' > "$(draft_file)"
|
|
471
|
-
keys m;
|
|
472
|
-
keys Left
|
|
473
|
-
type_text 'Z';
|
|
474
|
-
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
|
|
475
514
|
cap_to undo
|
|
476
515
|
assert_eq "B2 ctrl+- 恢复草稿 ad" "$(draft)" "ad"
|
|
477
516
|
assert_eq "B2 ctrl+- 同时恢复插入点 cursor_x=5" "$(cursor_x)" "5"
|
|
517
|
+
# 保留(P336):第二次 ctrl+- 是幂等空操作(历史已空)—— 帧与文件都不变,没有状态可等。
|
|
478
518
|
type_text $'\x1b[45;5u'; sleep 0.6
|
|
479
519
|
cap_to undo-empty
|
|
480
520
|
assert_eq "B2 历史空了再按 ctrl+- 不变" "$(draft)" "ad"
|
|
481
521
|
assert_has "$tmp/keys/undo-empty.txt" '> ad' "B2 undo 后帧仍完好"
|
|
482
522
|
|
|
483
523
|
# ⑥ 未绑定的修饰键不插字母、不收控制台(P20 新断言:ctrl+c)
|
|
484
|
-
keys C-c;
|
|
524
|
+
keys C-c; wait_frame "B2 ctrl+c 之后面板还在" 'Enter 发送'
|
|
485
525
|
cap_to ctrlc
|
|
486
526
|
assert_eq "B2 ctrl+c 不把 c 插进草稿" "$(draft)" "ad"
|
|
487
527
|
assert_has "$tmp/keys/ctrlc.txt" 'teamsmith pulse' "B2 ctrl+c 没有收起控制台"
|
|
@@ -503,41 +543,42 @@ scenario_multiline() {
|
|
|
503
543
|
start_panel
|
|
504
544
|
|
|
505
545
|
# ① legacy `\n`(= ctrl+j)插换行;Enter 仍提交,一条两行的消息
|
|
506
|
-
keys m;
|
|
507
|
-
type_text 'ad';
|
|
508
|
-
|
|
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
|
|
509
550
|
cap_to after-lf
|
|
510
551
|
assert_eq "B3 legacy \\n 插入换行而不是提交(草稿 ad+LF)" "$(draft)" "$(printf 'ad\n')"
|
|
511
552
|
assert_has "$tmp/multiline/after-lf.txt" '> ad' "B3 换行后第一行还在"
|
|
512
|
-
type_text 'b';
|
|
553
|
+
type_text 'b'; wait_draft "B3 第二行的 b" "$(printf 'ad\nb')"
|
|
513
554
|
cap_to two-lines
|
|
514
|
-
keys Enter;
|
|
555
|
+
keys Enter; wait_frame "B3 Enter 提交拿到回执" '· queued'
|
|
515
556
|
assert_eq "B3 Enter 仍提交:恰好一条条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
516
557
|
assert_eq "B3 条目保住两行" "$(payload_of "$(entries | head -1)")" $'ad\nb'
|
|
517
558
|
assert_eq "B3 换行键没有直接提交(忙框下一次都没到 PM 框)" "$(submits)" "0"
|
|
518
559
|
|
|
519
560
|
# ② Kitty ctrl+j(CSI 106;5u)与 shift+enter(CSI 13;2u)都插换行、都不提交
|
|
520
561
|
printf 'ad' > "$(draft_file)"
|
|
521
|
-
keys m;
|
|
522
|
-
type_text $'\x1b[106;5u'
|
|
523
|
-
type_text 'b'
|
|
524
|
-
type_text $'\x1b[13;2u'
|
|
525
|
-
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')"
|
|
526
567
|
cap_to kitty
|
|
527
568
|
assert_eq "B3 Kitty ctrl+j + shift+enter → ad\\nb\\nc" "$(draft)" "$(printf 'ad\nb\nc')"
|
|
528
569
|
assert_eq "B3 Kitty 两个换行键都没有提交" "$(submits)" "0"
|
|
529
570
|
|
|
530
571
|
# ③ 粘贴三行仍是"一条草稿、一条消息"
|
|
531
|
-
keys Escape;
|
|
572
|
+
keys Escape; wait_frame "B3 写信收起" '!Enter 发送'
|
|
532
573
|
printf '' > "$(draft_file)"
|
|
533
|
-
keys m;
|
|
534
|
-
type_text $'p-one\np-two\np-three';
|
|
535
|
-
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'
|
|
536
577
|
assert_eq "B3 粘贴三行 → 新增恰好一条条目" "$(entries | wc -l | tr -d ' ')" "2"
|
|
537
578
|
assert_eq "B3 粘贴条目保住三行" "$(payload_of "$(entries | tail -1)")" $'p-one\np-two\np-three'
|
|
538
579
|
|
|
539
580
|
# ④ standby 理由单行化:三行粘贴 → 一个空格分隔的参数;消息草稿不被动
|
|
540
|
-
keys Escape;
|
|
581
|
+
keys Escape; wait_frame "B3 写信收起" '!Enter 发送'
|
|
541
582
|
printf 'half a thought' > "$(draft_file)"
|
|
542
583
|
local wrapper="$tmp/multiline/team-wrap.sh"
|
|
543
584
|
cat > "$wrapper" <<EOS
|
|
@@ -551,16 +592,17 @@ EOS
|
|
|
551
592
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
552
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"
|
|
553
594
|
wait_panel
|
|
554
|
-
keys s;
|
|
595
|
+
keys s; wait_frame "B3 理由输入行" 'Enter 进入待命'
|
|
555
596
|
cap_to reason-open
|
|
556
597
|
assert_has "$tmp/multiline/reason-open.txt" '待命原因' "B3 s 打开理由输入行"
|
|
557
|
-
type_text $'one\ntwo\nthree';
|
|
598
|
+
type_text $'one\ntwo\nthree'; wait_frame "B3 理由折成一行" 'one two three'
|
|
558
599
|
cap_to reason-typed
|
|
559
600
|
assert_has "$tmp/multiline/reason-typed.txt" 'one two three' "B3 三行粘贴在理由里变成一行(空格分隔)"
|
|
560
601
|
assert_not_has "$tmp/multiline/reason-typed.txt" ' two' "B3 理由区没有出现第二绘制行"
|
|
561
|
-
keys Enter;
|
|
602
|
+
keys Enter; wait_frame "B3 待命已开" '待命 on'
|
|
562
603
|
cap_to reason-sent
|
|
563
|
-
|
|
604
|
+
# P318:`待命 on` 的帧回执由 scenario_actions(同一个 s 键,同样的理由行)断言 —— 这里只留
|
|
605
|
+
# 多行→单行这条**本场景独有**的行为。
|
|
564
606
|
if grep -qF -- '--reason one\ two\ three' "$tmp/multiline/team.log"; then
|
|
565
607
|
ok "B3 CLI 拿到一个参数 one two three(%q 里没有换行转义)"
|
|
566
608
|
else
|
|
@@ -646,34 +688,31 @@ EOXC
|
|
|
646
688
|
reset_clip
|
|
647
689
|
start_pm '' ''
|
|
648
690
|
start_panel "$(clip_env image image)"
|
|
649
|
-
keys m;
|
|
650
|
-
keys Left
|
|
651
|
-
keys C-v;
|
|
691
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
692
|
+
keys Left
|
|
693
|
+
keys C-v; wait_frame "B4 图片落成临时文件路径" 'teamsmith-paste-'
|
|
652
694
|
cap_to image
|
|
653
695
|
local file
|
|
654
696
|
file="$(pasted_file)"
|
|
655
697
|
assert_eq "B4 TMPDIR 里恰好一个 teamsmith-paste-*.png" "$(paste_count)" "1"
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
else
|
|
659
|
-
bad "B4 没有写出 teamsmith-paste-*.png"
|
|
660
|
-
fi
|
|
698
|
+
# P318:上面 `paste_count=1` + 下面的内容断言已经要求「恰好一个文件且内容对」;
|
|
699
|
+
# 「文件名非空」是那条断言的前半,不是独立行为。
|
|
661
700
|
assert_eq "B4 文件内容就是剪贴板的 8 字节" "$(cat "$file" 2>/dev/null)" "PNGDATA8"
|
|
662
701
|
assert_eq "B4 路径插在插入点(a<path>d)" "$(draft)" "a${file}d"
|
|
663
|
-
|
|
702
|
+
|
|
664
703
|
assert_match "$fx/calls.log" '^wl-paste --list-types$' "B4 探测先问 wl-paste"
|
|
665
704
|
if grep -q '^xclip' "$fx/calls.log"; then bad "B4 Wayland 命中时不该调用 xclip"; else ok "B4 Wayland 命中时 xclip 没有被调用"; fi
|
|
666
|
-
type_text 'Z';
|
|
705
|
+
type_text 'Z'; wait_draft "B4 粘贴后继续打字落到草稿" "a${file}Zd"
|
|
667
706
|
assert_eq "B4 粘贴后继续打字落到草稿(插入点之后)" "$(draft)" "a${file}Zd"
|
|
668
707
|
|
|
669
708
|
# ② Wayland 失败 → X11:仍成图,调用日志里 wl-paste 在 xclip 之前
|
|
670
|
-
keys Escape;
|
|
709
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
671
710
|
printf 'ad' > "$(draft_file)"
|
|
672
711
|
reset_clip
|
|
673
712
|
start_panel "$(clip_env fail image)"
|
|
674
|
-
keys m;
|
|
675
|
-
keys Left
|
|
676
|
-
keys C-v;
|
|
713
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
714
|
+
keys Left
|
|
715
|
+
keys C-v; wait_frame "B4 Wayland 失败后 X11 回退成图" 'teamsmith-paste-'
|
|
677
716
|
cap_to x11
|
|
678
717
|
file="$(pasted_file)"
|
|
679
718
|
assert_eq "B4 X11 回退:文件内容 XCLIPDATA" "$(cat "$file" 2>/dev/null)" "XCLIPDATA"
|
|
@@ -688,56 +727,74 @@ EOXC
|
|
|
688
727
|
fi
|
|
689
728
|
|
|
690
729
|
# ③ 无图片 → 文本回退,且不调用 xclip
|
|
691
|
-
keys Escape;
|
|
730
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
692
731
|
printf 'ad' > "$(draft_file)"
|
|
693
732
|
reset_clip
|
|
694
733
|
start_panel "$(clip_env text image)"
|
|
695
|
-
keys m;
|
|
696
|
-
keys Left
|
|
697
|
-
keys C-v;
|
|
734
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
735
|
+
keys Left
|
|
736
|
+
keys C-v; wait_frame "B4 文本回退进草稿" '> afrom the clipboardd'
|
|
698
737
|
cap_to text-fallback
|
|
699
738
|
assert_eq "B4 文本回退:afrom the clipboardd" "$(draft)" "afrom the clipboardd"
|
|
700
739
|
assert_eq "B4 文本回退不写临时文件" "$(paste_count)" "0"
|
|
701
740
|
if grep -q '^xclip' "$fx/calls.log"; then bad "B4 文本回退不该调用 xclip"; else ok "B4 文本回退不调用 xclip"; fi
|
|
702
741
|
|
|
703
742
|
# ④ 两个工具都不给东西:什么都不变;挂死的工具在界内被放弃
|
|
704
|
-
keys Escape;
|
|
743
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
705
744
|
printf 'half a thought' > "$(draft_file)"
|
|
706
745
|
reset_clip
|
|
707
746
|
start_panel "$(clip_env fail fail)"
|
|
708
|
-
keys m;
|
|
709
|
-
keys C-v;
|
|
747
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
748
|
+
keys C-v; wait_draft "B4 无工具:探测什么都不改" 'half a thought'
|
|
710
749
|
cap_to no-tool
|
|
711
750
|
assert_eq "B4 无工具:草稿不变" "$(draft)" "half a thought"
|
|
712
751
|
assert_eq "B4 无工具:没有文件" "$(paste_count)" "0"
|
|
713
752
|
assert_has "$tmp/clipboard/no-tool.txt" '> half a thought' "B4 无工具:帧照常、没有错误行"
|
|
714
|
-
type_text 'Z';
|
|
753
|
+
type_text 'Z'; wait_draft "B4 无工具后仍能打字" 'half a thoughtZ'
|
|
715
754
|
assert_eq "B4 无工具后仍能打字" "$(draft)" "half a thoughtZ"
|
|
716
755
|
|
|
717
|
-
keys Escape;
|
|
756
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
718
757
|
printf 'half a thought' > "$(draft_file)"
|
|
719
758
|
reset_clip
|
|
720
759
|
start_panel "$(clip_env hang fail)"
|
|
721
|
-
keys m;
|
|
760
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
761
|
+
# 保留(P336):挂死的工具下探测的结果是「什么都不发生」——没有回执行、没有文件、没有忙行,
|
|
762
|
+
# 它的“结束”无处可观测;而这条要证明的正是「工具企着的时候面板照旧可输入」,所以 Z 必须落在
|
|
763
|
+
# 工具还在挂的时候,这段空闲窗口不是等一个状态。
|
|
722
764
|
keys C-v; sleep 5
|
|
723
765
|
cap_to hang
|
|
724
766
|
assert_eq "B4 挂死工具 5s 内:草稿不变" "$(draft)" "half a thought"
|
|
725
767
|
assert_eq "B4 挂死工具:没有文件" "$(paste_count)" "0"
|
|
726
|
-
type_text 'Z';
|
|
768
|
+
type_text 'Z'; wait_draft "B4 挂死工具期间仍能打字" 'half a thoughtZ'
|
|
727
769
|
assert_eq "B4 挂死工具期间仍能打字" "$(draft)" "half a thoughtZ"
|
|
728
|
-
keys Escape;
|
|
770
|
+
keys Escape; wait_frame "B4 Esc 收起写信" '!Enter 发送'
|
|
729
771
|
assert_eq "B4 Esc 仍关掉输入行并保留草稿" "$(draft)" "half a thoughtZ"
|
|
730
772
|
|
|
731
773
|
# ⑤ 理由模式:路径进理由行,消息草稿不动
|
|
732
774
|
printf 'half a thought' > "$(draft_file)"
|
|
733
775
|
reset_clip
|
|
734
776
|
start_panel "$(clip_env image image)"
|
|
735
|
-
keys s;
|
|
736
|
-
type_text 'why'
|
|
737
|
-
keys C-v;
|
|
777
|
+
keys s; wait_frame "B4 待命理由输入行" 'Enter 进入待命'
|
|
778
|
+
type_text 'why'
|
|
779
|
+
keys C-v; wait_frame "B4 理由行里出现图片路径" 'teamsmith-paste-'
|
|
738
780
|
cap_to reason
|
|
739
781
|
file="$(pasted_file)"
|
|
740
|
-
|
|
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
|
|
741
798
|
assert_eq "B4 理由模式仍不写 state/draft.md" "$(draft)" "half a thought"
|
|
742
799
|
|
|
743
800
|
# ⑥ 只读扫描:C-v 不调用任何 team 动作(数据读者不算动作)
|
|
@@ -748,7 +805,7 @@ printf '%s\n' "\$*" >> "$fx/team.log"
|
|
|
748
805
|
exec "$skill/scripts/team" "\$@"
|
|
749
806
|
EOS
|
|
750
807
|
chmod +x "$fx/teamwrap.sh"
|
|
751
|
-
keys Escape;
|
|
808
|
+
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
752
809
|
printf 'ad' > "$(draft_file)"
|
|
753
810
|
reset_clip
|
|
754
811
|
: > "$fx/team.log"
|
|
@@ -756,21 +813,30 @@ EOS
|
|
|
756
813
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
757
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"
|
|
758
815
|
wait_panel
|
|
759
|
-
keys m;
|
|
760
|
-
keys Left
|
|
816
|
+
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
817
|
+
keys Left
|
|
761
818
|
: > "$fx/team.log"
|
|
762
|
-
|
|
819
|
+
# 这里的 ___panel-data 桩**什么都不返回**(它只负责证明没有 team 动作),产品没有 temp_root 可写 →
|
|
820
|
+
# 粘贴是一次「什么都不变」的空操作(P331 的同一条件)。等的状态是草稿仍是 ad。
|
|
821
|
+
keys C-v; wait_draft "B4 只读:C-v 之后草稿仍是 ad" 'ad'
|
|
763
822
|
assert_eq "B4 只读:C-v 没有触发任何 team 动作" "$(wc -l < "$fx/team.log" 2>/dev/null | tr -d ' ')" "0"
|
|
764
|
-
|
|
823
|
+
|
|
765
824
|
|
|
766
825
|
# ⑦ 不按 C-v 就绝不起剪贴板工具:5s 空闲(写信关着、开着各一段)调用日志为空
|
|
826
|
+
# 保留(P336):这是「一段窗口里什么都没发生」的否定观察,没有状态可等(可等的那个状态就是
|
|
827
|
+
# 「窗口过去了」自己);两段 5s 就是被测的长度。
|
|
767
828
|
reset_clip
|
|
768
829
|
: > "$fx/calls.log"
|
|
769
830
|
start_panel "$(clip_env image image)"
|
|
770
831
|
sleep 5
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
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"
|
|
774
840
|
}
|
|
775
841
|
|
|
776
842
|
# ---------------------------------------------------------------- 2.2 draft persistence / \r
|
|
@@ -779,31 +845,24 @@ scenario_draft() {
|
|
|
779
845
|
server_up draft
|
|
780
846
|
start_pm '' ''
|
|
781
847
|
start_panel
|
|
782
|
-
keys m
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
sleep 0.5
|
|
786
|
-
keys Escape
|
|
787
|
-
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 发送'
|
|
788
851
|
assert_eq "2.2 Esc 后 state/draft.md 保留草稿" "$(draft)" "half a thought"
|
|
789
852
|
keys q
|
|
790
|
-
sleep 1.2
|
|
791
853
|
start_panel
|
|
792
|
-
keys m
|
|
793
|
-
sleep 0.8
|
|
854
|
+
keys m; wait_frame "2.2 重启后带出草稿" '> half a thought'
|
|
794
855
|
cap_to restored
|
|
795
856
|
assert_has "$tmp/draft/restored.txt" "> half a thought" "2.2 重启后 m 带出草稿"
|
|
796
857
|
# \r 归一:用带 CR 的粘贴进草稿(bracketed paste 里的 CR 是换行,不是提交)
|
|
797
858
|
keys Escape
|
|
798
|
-
|
|
859
|
+
wait_frame "2.2 写信收起" '!Enter 发送'
|
|
799
860
|
keys q
|
|
800
|
-
sleep 1.2
|
|
801
861
|
rm -f "$(draft_file)"
|
|
802
862
|
start_panel
|
|
803
|
-
keys m
|
|
804
|
-
sleep 0.6
|
|
863
|
+
keys m; wait_frame "2.2 空草稿的托盘" 'Enter 发送'
|
|
805
864
|
type_text $'\x1b[200~cr-one\rcr-two\rcr-three\x1b[201~'
|
|
806
|
-
|
|
865
|
+
wait_draft "2.2 CR 归一为换行" $'cr-one\ncr-two\ncr-three'
|
|
807
866
|
cap_to cr
|
|
808
867
|
assert_eq "2.2 CR 归一为换行(三行草稿)" "$(draft)" $'cr-one\ncr-two\ncr-three'
|
|
809
868
|
if printf '%s' "$(draft)" | grep -q $'\r'; then
|
|
@@ -833,13 +892,10 @@ EOS
|
|
|
833
892
|
printf 'ad' > "$(draft_file)"
|
|
834
893
|
start_pm 'PM draft' ''
|
|
835
894
|
start_panel "EDITOR=$tmp/editor.sh TEAM_B2_EDITOR_HOLD=4 TEAM_B2_EDITOR_MARKER=$tmp/editor/marker"
|
|
836
|
-
keys m
|
|
837
|
-
|
|
838
|
-
keys Left
|
|
839
|
-
sleep 0.4
|
|
895
|
+
keys m; wait_frame "B3 写信托盘" '> ad'
|
|
896
|
+
keys Left; wait_cursor "B3 插入点在 ad 中间" 5
|
|
840
897
|
assert_eq "B3 夹具:插入点在 ad 中间(cursor_x=5)" "$(cursor_x)" "5"
|
|
841
|
-
keys C-e
|
|
842
|
-
sleep 0.7
|
|
898
|
+
keys C-e; wait_cursor "B3 C-e 到行尾" 6
|
|
843
899
|
assert_eq "B3 C-e 到行尾(cursor_x=6),不是编辑器" "$(cursor_x)" "6"
|
|
844
900
|
assert_eq "B3 C-e 后草稿仍是 ad" "$(draft)" "ad"
|
|
845
901
|
if [ -f "$tmp/editor/marker" ]; then
|
|
@@ -850,7 +906,7 @@ EOS
|
|
|
850
906
|
cap_to c-e-line-end
|
|
851
907
|
assert_not_has "$tmp/editor/c-e-line-end.txt" 'EDITOR-ACTIVE' "B3 C-e 没有把终端交给编辑器"
|
|
852
908
|
keys Escape
|
|
853
|
-
|
|
909
|
+
wait_frame "B3 写信收起" '!Enter 发送'
|
|
854
910
|
|
|
855
911
|
# The handoff's raw bytes (design §6): `tmux pipe-pane` records everything the pane writes.
|
|
856
912
|
rm -f "$tmp/editor/pane-bytes.log"
|
|
@@ -858,19 +914,16 @@ EOS
|
|
|
858
914
|
|
|
859
915
|
# ── 接力本体:C-o 跑一次脚本,挂起期间不重绘,回来无损。
|
|
860
916
|
printf '' > "$(draft_file)"
|
|
861
|
-
keys m
|
|
862
|
-
|
|
863
|
-
type_text 'raw1'
|
|
864
|
-
sleep 0.5
|
|
917
|
+
keys m; wait_frame "B3 重开写信托盘" 'Enter 发送'
|
|
918
|
+
type_text 'raw1'; wait_draft "B3 raw1 落盘" 'raw1'
|
|
865
919
|
keys C-o
|
|
866
920
|
local saw_editor=1 i
|
|
867
|
-
|
|
868
|
-
if { cap || true; } | grep -q 'EDITOR-ACTIVE'; then saw_editor=0; break; fi
|
|
869
|
-
sleep 0.2
|
|
870
|
-
done
|
|
921
|
+
if wait_frame "B3 C-o 把终端交给编辑器" 'EDITOR-ACTIVE'; then saw_editor=0; fi
|
|
871
922
|
cap_to during-editor
|
|
872
923
|
assert_eq "B3 C-o 把终端交给了编辑器" "$saw_editor" "0"
|
|
873
924
|
local c1 c2
|
|
925
|
+
# 保留(P336):这条断言本身就是「一段窗口里画面没变」——「不会重绘」没有事件可等,
|
|
926
|
+
# 而 1.3s 就是被测的那段窗口(编辑器还要挂 TEAM_B2_EDITOR_HOLD=4s)。
|
|
874
927
|
c1="$(cap)"
|
|
875
928
|
sleep 1.3
|
|
876
929
|
c2="$(cap)"
|
|
@@ -880,11 +933,7 @@ EOS
|
|
|
880
933
|
bad "B3 挂起期间仍在重绘(挂起门控没生效)"
|
|
881
934
|
fi
|
|
882
935
|
assert_not_has "$tmp/editor/during-editor.txt" 'EDITOR-DONE' "B3 编辑器还在跑"
|
|
883
|
-
|
|
884
|
-
{ cap || true; } | grep -q 'EDITOR-DONE' && break
|
|
885
|
-
sleep 0.4
|
|
886
|
-
done
|
|
887
|
-
sleep 1
|
|
936
|
+
wait_frame "B3 接力回来前面板帧完好" 'teamsmith pulse' '> raw1'
|
|
888
937
|
cap_to after-editor
|
|
889
938
|
assert_has "$tmp/editor/after-editor.txt" 'teamsmith pulse' "B3 接力回来后面板帧完好"
|
|
890
939
|
assert_has "$tmp/editor/after-editor.txt" '> raw1' "B3 输入行保留 raw1"
|
|
@@ -898,8 +947,7 @@ EOS
|
|
|
898
947
|
else
|
|
899
948
|
bad "B3 Kitty 关/开字节缺失(pane-bytes.log $(wc -c < "$tmp/editor/pane-bytes.log" 2>/dev/null | tr -d ' ') 字节)"
|
|
900
949
|
fi
|
|
901
|
-
keys Enter
|
|
902
|
-
sleep 3
|
|
950
|
+
keys Enter; wait_frame "B3 忙框回执 queued" '· queued'
|
|
903
951
|
cap_to after-send
|
|
904
952
|
assert_has "$tmp/editor/after-send.txt" 'queued' "B3 忙框回执 queued"
|
|
905
953
|
local n e payload
|
|
@@ -914,32 +962,24 @@ EOS
|
|
|
914
962
|
# 夹具用 `vi -n`(无 swap 文件),只在 vi 存在时跑。
|
|
915
963
|
if command -v vi >/dev/null 2>&1; then
|
|
916
964
|
start_panel "EDITOR='vi -n'"
|
|
917
|
-
keys m
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
sleep 0.4
|
|
921
|
-
keys C-o
|
|
922
|
-
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 发送'
|
|
923
968
|
cap_to vi-open
|
|
924
969
|
assert_has "$tmp/editor/vi-open.txt" 'vi draft' "B3 真 vi:草稿真的进了编辑器"
|
|
925
970
|
keys G
|
|
926
|
-
sleep 0.3
|
|
927
971
|
keys o
|
|
928
|
-
sleep 0.3
|
|
929
972
|
type_text 'vi second line'
|
|
930
|
-
sleep 0.3
|
|
931
973
|
keys Escape
|
|
932
|
-
sleep 0.3
|
|
974
|
+
sleep 0.3 # 保留(P336):vi 的 ESC 消歧超时(ESC 紧接 `:` 前得先真正离开插入模式)
|
|
933
975
|
type_text ':wq'
|
|
934
|
-
sleep 0.2
|
|
935
976
|
keys Enter
|
|
936
|
-
|
|
977
|
+
wait_frame "B3 真 vi:退出后面板帧正常" 'teamsmith pulse' 'vi second line'
|
|
937
978
|
cap_to vi-back
|
|
938
979
|
assert_has "$tmp/editor/vi-back.txt" 'teamsmith pulse' "B3 真 vi:退出后面板帧正常"
|
|
939
980
|
assert_has "$tmp/editor/vi-back.txt" '> vi draft' "B3 真 vi:第一行无损"
|
|
940
981
|
assert_has "$tmp/editor/vi-back.txt" 'vi second line' "B3 真 vi:新增的第二行无损带回"
|
|
941
|
-
keys Enter
|
|
942
|
-
sleep 3
|
|
982
|
+
keys Enter; wait_frame "B3 真 vi:忙框回执 queued" '· queued'
|
|
943
983
|
cap_to vi-sent
|
|
944
984
|
assert_has "$tmp/editor/vi-sent.txt" 'queued' "B3 真 vi:忙框回执 queued"
|
|
945
985
|
local newest
|
|
@@ -959,12 +999,9 @@ scenario_receipt() {
|
|
|
959
999
|
start_panel
|
|
960
1000
|
local before after
|
|
961
1001
|
before="$(pm_cap)"
|
|
962
|
-
keys m
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
sleep 0.4
|
|
966
|
-
keys Enter
|
|
967
|
-
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'
|
|
968
1005
|
cap_to busy
|
|
969
1006
|
assert_has "$tmp/receipt/busy.txt" 'queued' "2.4 忙框回执 queued"
|
|
970
1007
|
assert_eq "2.4 忙框:恰好一条队列条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
@@ -977,14 +1014,11 @@ scenario_receipt() {
|
|
|
977
1014
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
978
1015
|
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
979
1016
|
start_pm '' ''
|
|
980
|
-
keys m
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
sleep 0.4
|
|
984
|
-
keys Enter
|
|
985
|
-
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'
|
|
986
1020
|
cap_to delivered
|
|
987
|
-
|
|
1021
|
+
# P318:`delivered` 回执由 2.7(settle ①)断言 —— 同一条回执契约,不按场景重复。
|
|
988
1022
|
assert_eq "2.4 空框:恰好一次提交" "$(submits)" "1"
|
|
989
1023
|
assert_eq "2.4 空框:提交内容是 hello2" "$(last_submit)" "hello2"
|
|
990
1024
|
assert_eq "2.4 空框:没有留下队列条目" "$(entries | wc -l | tr -d ' ')" "0"
|
|
@@ -993,16 +1027,14 @@ scenario_receipt() {
|
|
|
993
1027
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
994
1028
|
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
995
1029
|
start_pm '' 'FAKE_TUI_EAT_ENTER=1 FAKE_TUI_STATIC_FOOTER=1'
|
|
996
|
-
keys m
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
sleep 0.4
|
|
1000
|
-
keys Enter
|
|
1001
|
-
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'
|
|
1002
1033
|
cap_to held
|
|
1003
|
-
|
|
1034
|
+
# P318:`held` 回执与 HOLDING.log 由 2.7(settle ③)断言 —— 这里只留 2.7 没测的那一条
|
|
1035
|
+
# (活动队列为空)。
|
|
1004
1036
|
assert_eq "2.4 held:条目进了 outbox/held/" "$(held_entries | wc -l | tr -d ' ')" "1"
|
|
1005
|
-
|
|
1037
|
+
|
|
1006
1038
|
assert_eq "2.4 held:活动队列为空" "$(entries | wc -l | tr -d ' ')" "0"
|
|
1007
1039
|
}
|
|
1008
1040
|
|
|
@@ -1016,12 +1048,12 @@ scenario_pause() {
|
|
|
1016
1048
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
1017
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"
|
|
1018
1050
|
wait_panel || return 1
|
|
1019
|
-
keys m
|
|
1020
|
-
|
|
1021
|
-
type_text 'before'
|
|
1022
|
-
sleep 0.6
|
|
1051
|
+
keys m; wait_frame "2.5 写信托盘" 'Enter 发送'
|
|
1052
|
+
type_text 'before'; wait_draft "2.5 草稿落盘" 'before'
|
|
1023
1053
|
local ts1 ts2
|
|
1024
1054
|
ts1="$(stamp)"
|
|
1055
|
+
# 保留(P336):这里等的是一个**节流间隔**本身(桩每次读数据要 TEAM_B2_SLOW_SLEEP=4s,6s 是
|
|
1056
|
+
# 它的一轮加余量);「又刷了一轮」没有事件可等。
|
|
1025
1057
|
sleep 6
|
|
1026
1058
|
ts2="$(stamp)"
|
|
1027
1059
|
if [ -n "$ts1" ] && [ "$ts2" != "$ts1" ]; then
|
|
@@ -1029,13 +1061,11 @@ scenario_pause() {
|
|
|
1029
1061
|
else
|
|
1030
1062
|
bad "2.5 写信期间没有刷新($ts1 → $ts2)"
|
|
1031
1063
|
fi
|
|
1032
|
-
type_text 'after'
|
|
1033
|
-
sleep 0.6
|
|
1064
|
+
type_text 'after'; wait_draft "2.5 草稿跨刷新存活" 'beforeafter'
|
|
1034
1065
|
cap_to pause
|
|
1035
1066
|
assert_has "$tmp/pause/pause.txt" '> beforeafter' "2.5 草稿跨刷新存活(beforeafter)"
|
|
1036
1067
|
assert_eq "2.5 草稿文件也是 beforeafter" "$(draft)" "beforeafter"
|
|
1037
|
-
keys Enter
|
|
1038
|
-
sleep 3
|
|
1068
|
+
keys Enter; wait_frame "2.5 忙框回执 queued" '· queued'
|
|
1039
1069
|
assert_eq "2.5 跨刷新后的草稿仍作为一条消息入队" "$(payload_of "$(entries | head -1)")" "beforeafter"
|
|
1040
1070
|
}
|
|
1041
1071
|
|
|
@@ -1046,25 +1076,19 @@ scenario_paste() {
|
|
|
1046
1076
|
start_pm 'PM draft' ''
|
|
1047
1077
|
start_panel
|
|
1048
1078
|
# ① plain paste:一行 write 里带 LF
|
|
1049
|
-
keys m
|
|
1050
|
-
|
|
1051
|
-
type_text $'line one\nline two\nline three'
|
|
1052
|
-
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'
|
|
1053
1081
|
cap_to plain
|
|
1054
1082
|
assert_has "$tmp/paste/plain.txt" ' line three' "2.6 plain 粘贴三行都在草稿里"
|
|
1055
|
-
keys Enter
|
|
1056
|
-
sleep 3
|
|
1083
|
+
keys Enter; wait_frame "2.6 plain 的忙框回执" '· queued'
|
|
1057
1084
|
assert_eq "2.6 plain:恰好一条条目" "$(entries | wc -l | tr -d ' ')" "1"
|
|
1058
1085
|
assert_eq "2.6 plain:条目保住三行" "$(payload_of "$(entries | head -1)")" $'line one\nline two\nline three'
|
|
1059
1086
|
# ② bracketed paste:DECSET 标记包裹,里面是 CR
|
|
1060
|
-
keys m
|
|
1061
|
-
|
|
1062
|
-
type_text $'\x1b[200~b-one\rb-two\rb-three\x1b[201~'
|
|
1063
|
-
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'
|
|
1064
1089
|
cap_to bracket
|
|
1065
1090
|
assert_has "$tmp/paste/bracket.txt" ' b-three' "2.6 bracketed 粘贴三行都在草稿里"
|
|
1066
|
-
keys Enter
|
|
1067
|
-
sleep 3
|
|
1091
|
+
keys Enter; wait_frame "2.6 bracketed 的忙框回执" '· queued'
|
|
1068
1092
|
assert_eq "2.6 bracketed:两条条目(每次粘贴一条)" "$(entries | wc -l | tr -d ' ')" "2"
|
|
1069
1093
|
assert_eq "2.6 bracketed:条目保住三行" "$(payload_of "$(entries | tail -1)")" $'b-one\nb-two\nb-three'
|
|
1070
1094
|
assert_eq "2.6 两次粘贴都没有产生提交(忙框守卫)" "$(submits)" "0"
|
|
@@ -1077,92 +1101,41 @@ scenario_actions() {
|
|
|
1077
1101
|
start_pm '' ''
|
|
1078
1102
|
start_panel
|
|
1079
1103
|
# 先留一份消息草稿,证明「理由」不会覆盖它
|
|
1080
|
-
keys m
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
sleep 0.4
|
|
1084
|
-
keys Escape
|
|
1085
|
-
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 发送'
|
|
1086
1107
|
# 队列里放两条(目标窗口就是 fixture 的 PM,空框 → flush 可投)
|
|
1087
1108
|
( cd "$ROOT" && bash "$skill/scripts/team" outbox enqueue --kind say --target "$sess:pm" --from pm --payload 'q one' >/dev/null 2>&1
|
|
1088
1109
|
bash "$skill/scripts/team" outbox enqueue --kind say --target "$sess:pm" --from pm --payload 'q two' >/dev/null 2>&1 )
|
|
1089
1110
|
assert_eq "3.1 夹具:队列里两条" "$(entries | wc -l | tr -d ' ')" "2"
|
|
1090
|
-
keys f
|
|
1091
|
-
sleep 5
|
|
1111
|
+
keys f; wait_frame "3.1 f 的回执(flush 自己的日志行)" 'outbox'
|
|
1092
1112
|
cap_to flush
|
|
1093
1113
|
assert_has "$tmp/actions/flush.txt" 'outbox' "3.1 f 的回执带 flush 自己的日志行"
|
|
1094
1114
|
assert_eq "3.1 f 之后队列空了(flush 真跑了)" "$(entries | wc -l | tr -d ' ')" "0"
|
|
1095
1115
|
assert_eq "3.1 flush 投了两条" "$(submits)" "2"
|
|
1096
1116
|
# s:关 → 开(要理由)
|
|
1097
|
-
keys s
|
|
1098
|
-
sleep 0.8
|
|
1117
|
+
keys s; wait_frame "3.1 理由输入行" 'Enter 进入待命'
|
|
1099
1118
|
cap_to reason-input
|
|
1100
1119
|
assert_has "$tmp/actions/reason-input.txt" '>' "3.1 s 打开理由输入行"
|
|
1101
1120
|
type_text 'lunch'
|
|
1102
|
-
|
|
1103
|
-
keys Enter
|
|
1104
|
-
sleep 3
|
|
1121
|
+
keys Enter; wait_frame "3.1 待命 on 的回执" '待命 on'
|
|
1105
1122
|
cap_to standby-on
|
|
1106
1123
|
assert_has "$tmp/actions/standby-on.txt" '待命 on' "3.1 s 之后回执显示待命 on"
|
|
1107
1124
|
( cd "$ROOT" && bash "$skill/scripts/team" standby status ) > "$tmp/actions/status-on.txt" 2>&1 || true
|
|
1108
1125
|
assert_has "$tmp/actions/status-on.txt" 'standby: on' "3.1 CLI 报告 standby on"
|
|
1109
1126
|
assert_has "$tmp/actions/status-on.txt" 'lunch' "3.1 CLI 记下理由 lunch"
|
|
1110
1127
|
assert_eq "3.1 理由没有覆盖消息草稿" "$(draft)" "draft kept"
|
|
1111
|
-
|
|
1112
|
-
|
|
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'
|
|
1113
1133
|
cap_to standby-off
|
|
1114
1134
|
assert_has "$tmp/actions/standby-off.txt" '待命 off' "3.1 再按 s 回执显示待命 off"
|
|
1115
1135
|
( cd "$ROOT" && bash "$skill/scripts/team" standby status ) > "$tmp/actions/status-off.txt" 2>&1 || true
|
|
1116
1136
|
assert_has "$tmp/actions/status-off.txt" 'standby: off' "3.1 CLI 报告 standby off"
|
|
1117
1137
|
}
|
|
1118
1138
|
|
|
1119
|
-
# ---------------------------------------------------------------- 3.2 the write sweep
|
|
1120
|
-
scenario_readonly() {
|
|
1121
|
-
section "3.2 · 只读扫描:只有面板自己的文件会变"
|
|
1122
|
-
server_up readonly
|
|
1123
|
-
start_pm '' ''
|
|
1124
|
-
start_panel
|
|
1125
|
-
local before after
|
|
1126
|
-
before="$(snapshot)"
|
|
1127
|
-
printf '%s\n' "$before" > "$tmp/readonly/before.txt"
|
|
1128
|
-
keys r
|
|
1129
|
-
keys Up
|
|
1130
|
-
keys Down
|
|
1131
|
-
keys Tab
|
|
1132
|
-
type_text '1'
|
|
1133
|
-
type_text '2'
|
|
1134
|
-
type_text '3'
|
|
1135
|
-
for k in x z '?' '!' '~' 'w' '%' '&'; do type_text "$k"; done
|
|
1136
|
-
sleep 0.5
|
|
1137
|
-
keys m
|
|
1138
|
-
sleep 0.5
|
|
1139
|
-
type_text 'sweep draft'
|
|
1140
|
-
sleep 0.4
|
|
1141
|
-
keys Escape
|
|
1142
|
-
sleep 0.6
|
|
1143
|
-
keys q
|
|
1144
|
-
sleep 1
|
|
1145
|
-
after="$(snapshot)"
|
|
1146
|
-
printf '%s\n' "$after" > "$tmp/readonly/after.txt"
|
|
1147
|
-
local changed
|
|
1148
|
-
changed="$(diff <(printf '%s\n' "$before") <(printf '%s\n' "$after") | sed -n 's/^[<>] //p' | awk '{print $1}' | sort -u | tr '\n' ' ')"
|
|
1149
|
-
printf ' 变化过的路径:%s\n' "${changed:-(无)}" >> "$tmp/readonly/after.txt"
|
|
1150
|
-
local off=""
|
|
1151
|
-
local p
|
|
1152
|
-
for p in $changed; do
|
|
1153
|
-
case "$p" in
|
|
1154
|
-
.pi/team/state/draft.md|.pi/team/state/panel.conf|.pi/team/state/panel-page) ;;
|
|
1155
|
-
*) off="$off $p" ;;
|
|
1156
|
-
esac
|
|
1157
|
-
done
|
|
1158
|
-
if [ -z "$off" ]; then
|
|
1159
|
-
ok "3.2 只读扫描:只变了面板自己的文件(${changed:-无})"
|
|
1160
|
-
else
|
|
1161
|
-
bad "3.2 只读扫描:面板动了别人的文件:$off"
|
|
1162
|
-
fi
|
|
1163
|
-
assert_has "$(draft_file)" 'sweep draft' "3.2 草稿(允许写的文件之一)确实写了"
|
|
1164
|
-
assert_eq "3.2 文档/收件箱零改动" "$(printf '%s\n' "$after" | grep -c '^docs/team')" "$(printf '%s\n' "$before" | grep -c '^docs/team')"
|
|
1165
|
-
}
|
|
1166
1139
|
|
|
1167
1140
|
# ---------------------------------------------------------------- 2.7 the draft settle (P249)
|
|
1168
1141
|
scenario_settle() {
|
|
@@ -1173,15 +1146,15 @@ scenario_settle() {
|
|
|
1173
1146
|
# ① delivered:输入行与 state/draft.md 一起清空;重启后 m 打开空草稿(无幽灵草稿)
|
|
1174
1147
|
start_pm '' ''
|
|
1175
1148
|
start_panel
|
|
1176
|
-
keys m;
|
|
1177
|
-
type_text 'half a thought';
|
|
1149
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1150
|
+
type_text 'half a thought'; wait_draft "2.7 草稿落盘" 'half a thought'
|
|
1178
1151
|
assert_eq "2.7 delivered 发送前:文件里有原文" "$(draft)" "half a thought"
|
|
1179
|
-
keys Enter;
|
|
1152
|
+
keys Enter; wait_frame "2.7 delivered 回执" '· delivered'
|
|
1180
1153
|
cap_to delivered
|
|
1181
1154
|
assert_has "$tmp/settle/delivered.txt" 'delivered' "2.7 delivered 回执"
|
|
1182
1155
|
assert_eq "2.7 delivered:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1183
1156
|
start_panel
|
|
1184
|
-
keys m;
|
|
1157
|
+
keys m; wait_frame "2.7 重启后的空草稿" 'Enter 发送'
|
|
1185
1158
|
cap_to delivered-reopen
|
|
1186
1159
|
assert_not_has "$tmp/settle/delivered-reopen.txt" 'half a thought' "2.7 delivered:重启后 m 不带回已发正文"
|
|
1187
1160
|
|
|
@@ -1189,10 +1162,10 @@ scenario_settle() {
|
|
|
1189
1162
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1190
1163
|
start_pm '半句草稿 half a sentence' ''
|
|
1191
1164
|
start_panel
|
|
1192
|
-
keys m;
|
|
1193
|
-
type_text 'queued thought';
|
|
1165
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1166
|
+
type_text 'queued thought'; wait_draft "2.7 草稿落盘" 'queued thought'
|
|
1194
1167
|
before="$(pm_cap)"
|
|
1195
|
-
keys Enter;
|
|
1168
|
+
keys Enter; wait_frame "2.7 queued 回执" '· queued'
|
|
1196
1169
|
cap_to queued
|
|
1197
1170
|
assert_has "$tmp/settle/queued.txt" 'queued' "2.7 queued 回执"
|
|
1198
1171
|
assert_eq "2.7 queued:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
@@ -1204,9 +1177,9 @@ scenario_settle() {
|
|
|
1204
1177
|
rm -rf "$ROOT/.pi/team/state/outbox"
|
|
1205
1178
|
start_pm '' 'FAKE_TUI_EAT_ENTER=1 FAKE_TUI_STATIC_FOOTER=1'
|
|
1206
1179
|
start_panel
|
|
1207
|
-
keys m;
|
|
1208
|
-
type_text 'held candidate';
|
|
1209
|
-
keys Enter;
|
|
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'
|
|
1210
1183
|
cap_to held
|
|
1211
1184
|
assert_has "$tmp/settle/held.txt" 'held' "2.7 held 回执"
|
|
1212
1185
|
assert_eq "2.7 held:state/draft.md 0 字节(清空是结算)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
@@ -1215,13 +1188,15 @@ scenario_settle() {
|
|
|
1215
1188
|
# ④ error(没有投递目标):文字保留在输入行与文件里,下一次 Enter 从原文重试(compose 不关)
|
|
1216
1189
|
tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
|
|
1217
1190
|
start_panel
|
|
1218
|
-
keys m;
|
|
1219
|
-
type_text 'kept words';
|
|
1220
|
-
keys Enter;
|
|
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 回执" '未确认'
|
|
1221
1194
|
cap_to error
|
|
1222
1195
|
assert_has "$tmp/settle/error.txt" '未确认' "2.7 error 回执(投递未确认)"
|
|
1223
1196
|
assert_has "$tmp/settle/error.txt" 'kept words' "2.7 error:输入行仍留着原文"
|
|
1224
1197
|
assert_eq "2.7 error:state/draft.md 保留原文" "$(draft)" "kept words"
|
|
1198
|
+
# 保留(P336):重试拿到的是同一条回执(compose 不关、文字不变),帧上没有新状态可等 ——
|
|
1199
|
+
# 这两句要证明的是「上一次的保留没有自己消失」,本身就是一段无变化的窗口。
|
|
1225
1200
|
keys Enter; sleep 3
|
|
1226
1201
|
cap_to error-retry
|
|
1227
1202
|
assert_has "$tmp/settle/error-retry.txt" 'kept words' "2.7 error:下一次 Enter 从保留的原文重试"
|
|
@@ -1232,16 +1207,16 @@ scenario_settle() {
|
|
|
1232
1207
|
rm -f "$(draft_file)"
|
|
1233
1208
|
start_pm '' ''
|
|
1234
1209
|
start_panel
|
|
1235
|
-
keys m;
|
|
1236
|
-
type_text 'ghost candidate';
|
|
1210
|
+
keys m; wait_frame "2.7 写信托盘" 'Enter 发送'
|
|
1211
|
+
type_text 'ghost candidate'; wait_draft "2.7 草稿落盘" 'ghost candidate'
|
|
1237
1212
|
chmod 444 "$(draft_file)"
|
|
1238
|
-
keys Enter;
|
|
1213
|
+
keys Enter; wait_frame "2.7 写盘失败的回执点名文件" 'draft.md'
|
|
1239
1214
|
cap_to readonly
|
|
1240
1215
|
assert_has "$tmp/settle/readonly.txt" 'draft.md' "2.7 写盘失败:回执点名 state/draft.md"
|
|
1241
1216
|
assert_has "$tmp/settle/readonly.txt" 'ghost candidate' "2.7 写盘失败:输入行仍留着原文(不假装清掉)"
|
|
1242
1217
|
assert_eq "2.7 写盘失败:文件仍是原文(内存=磁盘)" "$(draft)" "ghost candidate"
|
|
1243
1218
|
chmod 644 "$(draft_file)"
|
|
1244
|
-
keys Enter;
|
|
1219
|
+
keys Enter; wait_draft "2.7 重试成功后草稿清空" ''
|
|
1245
1220
|
cap_to readonly-retry
|
|
1246
1221
|
assert_eq "2.7 清空失败后恢复可写重试:文件清空" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
|
|
1247
1222
|
assert_not_has "$tmp/settle/readonly-retry.txt" 'ghost candidate' "2.7 重试成功后输入行也空了"
|
|
@@ -1251,7 +1226,7 @@ scenario_settle() {
|
|
|
1251
1226
|
if [ "${BASH_SOURCE[0]}" != "$0" ]; then
|
|
1252
1227
|
return 0 2>/dev/null || exit 0
|
|
1253
1228
|
fi
|
|
1254
|
-
ALL="cursor keys multiline clipboard
|
|
1229
|
+
ALL="cursor keys multiline clipboard draft editor receipt settle pause paste actions"
|
|
1255
1230
|
selected="${*:-$ALL}"
|
|
1256
1231
|
# P249: `--all` is the explicit whole-suite selector the task's acceptance commands use.
|
|
1257
1232
|
[ "$selected" = "--all" ] && selected="$ALL"
|
|
@@ -1264,7 +1239,7 @@ for name in $selected; do
|
|
|
1264
1239
|
keys) scenario_keys ;;
|
|
1265
1240
|
multiline) scenario_multiline ;;
|
|
1266
1241
|
clipboard) scenario_clipboard ;;
|
|
1267
|
-
|
|
1242
|
+
|
|
1268
1243
|
draft) scenario_draft ;;
|
|
1269
1244
|
editor) scenario_editor ;;
|
|
1270
1245
|
receipt) scenario_receipt ;;
|
|
@@ -1272,7 +1247,7 @@ for name in $selected; do
|
|
|
1272
1247
|
pause) scenario_pause ;;
|
|
1273
1248
|
paste) scenario_paste ;;
|
|
1274
1249
|
actions) scenario_actions ;;
|
|
1275
|
-
|
|
1250
|
+
|
|
1276
1251
|
*) printf 'panel-b2: unknown scenario %s(known: %s)\n' "$name" "$ALL" >&2; rc=3 ;;
|
|
1277
1252
|
esac || rc=$?
|
|
1278
1253
|
done
|