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.
Files changed (163) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +69 -0
  4. package/skills/teamsmith/SKILL.md +20 -13
  5. package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
  6. package/skills/teamsmith/extension/team-notify.ts +37 -6
  7. package/skills/teamsmith/extension/team.ts +438 -0
  8. package/skills/teamsmith/references/config.md +39 -6
  9. package/skills/teamsmith/references/migration.md +197 -47
  10. package/skills/teamsmith/references/protocol.md +201 -30
  11. package/skills/teamsmith/references/troubleshooting.md +130 -10
  12. package/skills/teamsmith/references/workflows.md +36 -2
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  16. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  17. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  18. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  19. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  20. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  21. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  22. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  23. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  24. package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
  25. package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
  26. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  27. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  28. package/skills/teamsmith/scripts/lib/common.sh +1004 -245
  29. package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
  30. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  31. package/skills/teamsmith/scripts/panel/panel.js +211 -211
  32. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  33. package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
  34. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  35. package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
  36. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  37. package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
  38. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  39. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  40. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  41. package/skills/teamsmith/scripts/replies.mjs +4 -1
  42. package/skills/teamsmith/scripts/shim/killall +10 -0
  43. package/skills/teamsmith/scripts/shim/pgrep +10 -0
  44. package/skills/teamsmith/scripts/shim/pidof +10 -0
  45. package/skills/teamsmith/scripts/shim/pkill +10 -0
  46. package/skills/teamsmith/scripts/shim/signal-gate +108 -31
  47. package/skills/teamsmith/scripts/shim/tmux +18 -0
  48. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  49. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  50. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  51. package/skills/teamsmith/scripts/team +19 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  53. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  54. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  55. package/skills/teamsmith/tests/README.md +31 -0
  56. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  57. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  58. package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
  59. package/skills/teamsmith/tests/config-cli.sh +184 -32
  60. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  61. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  62. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  63. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  64. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  65. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  66. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  67. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  68. package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
  69. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  70. package/skills/teamsmith/tests/gate-guard.sh +52 -79
  71. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  72. package/skills/teamsmith/tests/install-shape.sh +359 -22
  73. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  74. package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
  75. package/skills/teamsmith/tests/key-replies.sh +281 -28
  76. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  77. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  78. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  79. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  80. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  81. package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
  82. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  83. package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
  84. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  85. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  86. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  87. package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
  88. package/skills/teamsmith/tests/panel-b2.sh +430 -352
  89. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  90. package/skills/teamsmith/tests/panel-b3.sh +314 -62
  91. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  92. package/skills/teamsmith/tests/panel-cpu.sh +43 -130
  93. package/skills/teamsmith/tests/panel-p21.sh +251 -265
  94. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  95. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  96. package/skills/teamsmith/tests/perf.sh +187 -396
  97. package/skills/teamsmith/tests/routes.sh +440 -117
  98. package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
  99. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  100. package/skills/teamsmith/tests/section-guard.sh +13 -102
  101. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  102. package/skills/teamsmith/tests/section-paths.tsv +32 -18
  103. package/skills/teamsmith/tests/section-select.sh +371 -19
  104. package/skills/teamsmith/tests/signal-gate.sh +249 -27
  105. package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
  106. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  107. package/skills/teamsmith/tests/slash-team.sh +617 -0
  108. package/skills/teamsmith/tests/slice-coverage.sh +206 -0
  109. package/skills/teamsmith/tests/smoke.sh +3595 -788
  110. package/skills/teamsmith/tests/task-model-routing.sh +530 -15
  111. package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
  112. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  113. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  114. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  115. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  116. package/skills/teamsmith/tests/workflow-entry.sh +207 -0
  117. package/skills/teamsmith-init/SKILL.md +12 -12
  118. package/skills/teamsmith-init/references/bootstrap.md +3 -3
  119. package/skills/teamsmith/tests/flip-glue.sh +0 -162
  120. package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
  121. package/skills/teamsmith/tests/flip-m12.sh +0 -185
  122. package/skills/teamsmith/tests/flip-m16.sh +0 -166
  123. package/skills/teamsmith/tests/flip-m17.sh +0 -204
  124. package/skills/teamsmith/tests/flip-m34.sh +0 -96
  125. package/skills/teamsmith/tests/flip-m37.sh +0 -185
  126. package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
  127. package/skills/teamsmith/tests/flip-m43.sh +0 -128
  128. package/skills/teamsmith/tests/flip-m45.sh +0 -244
  129. package/skills/teamsmith/tests/flip-m46.sh +0 -238
  130. package/skills/teamsmith/tests/flip-m48.sh +0 -304
  131. package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
  132. package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
  133. package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
  134. package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
  135. package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
  136. package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
  137. package/skills/teamsmith/tests/flip-p144.sh +0 -112
  138. package/skills/teamsmith/tests/flip-p156.sh +0 -133
  139. package/skills/teamsmith/tests/flip-p160.sh +0 -182
  140. package/skills/teamsmith/tests/flip-p171.sh +0 -249
  141. package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
  142. package/skills/teamsmith/tests/flip-p20.sh +0 -286
  143. package/skills/teamsmith/tests/flip-p201.sh +0 -249
  144. package/skills/teamsmith/tests/flip-p210.sh +0 -239
  145. package/skills/teamsmith/tests/flip-p211.sh +0 -152
  146. package/skills/teamsmith/tests/flip-p217.sh +0 -288
  147. package/skills/teamsmith/tests/flip-p22.sh +0 -123
  148. package/skills/teamsmith/tests/flip-p23.sh +0 -239
  149. package/skills/teamsmith/tests/flip-p25.sh +0 -165
  150. package/skills/teamsmith/tests/flip-p71.sh +0 -184
  151. package/skills/teamsmith/tests/flip-p72.sh +0 -202
  152. package/skills/teamsmith/tests/load-experiment.sh +0 -290
  153. package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
  154. package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
  155. package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
  156. package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
  157. package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
  158. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
  159. package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
  160. package/skills/teamsmith/tests/panel-knobs.sh +0 -83
  161. package/skills/teamsmith/tests/section-budgets.tsv +0 -154
  162. package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
  163. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
@@ -131,6 +131,57 @@ elif name == 'monitor-record-drift':
131
131
  replace(root / 'skills/teamsmith/scripts/monitor.mjs',
132
132
  ' team_assignment_parse "$2" "$data" || exit 1',
133
133
  ' data="$(printf "%s" "$data" | sed "s/malformed nonce/fixture-nonce/")" # P228_FLIP_monitor-record-drift\n team_assignment_parse "$2" "$data" || exit 1')
134
+ elif name == 'migration-row-removed':
135
+ # P261 red side: the derivation table loses its only migration row -> the legacy project must be refused
136
+ # (missing-migration-row named), not silently passed through with the old keys.
137
+ replace(lib / 'cmd-config.sh', 'm1|1|2|0.2.0', '# P228_FLIP_migration-row-removed')
138
+ elif name == 'no-backup':
139
+ # P261 red side: write no timestamped backup but still report one.
140
+ replace(lib / 'cmd-config.sh',
141
+ 'cp -p "$path" "$dir/$name" || return 1',
142
+ ': # P228_FLIP_no-backup')
143
+ elif name == 'no-shape-number':
144
+ # P261 red side: init/bootstrap stop writing the configuration shape number.
145
+ replace(root / 'skills/teamsmith/scripts/lib/cmd-project.sh',
146
+ ' "CONFIG_VERSION=$TEAM_CONFIG_SHAPE_CURRENT" > "$cfg"; then',
147
+ ' > "$cfg"; then # P228_FLIP_no-shape-number')
148
+ elif name == 'missing-record-refused':
149
+ # P261 red side: restore the old single refusal for "no metadata at all".
150
+ replace(lib / 'common.sh',
151
+ ' if [ ! -f "$TEAM_STATE_DIR/pm-launch.env" ]; then\n TEAM_PM_IDENTITY_REGISTER=1',
152
+ ' if [ ! -f "$TEAM_STATE_DIR/pm-launch.env" ]; then\n team_err "PM launch identity missing"; return 1 # P228_FLIP_missing-record-refused\n TEAM_PM_IDENTITY_REGISTER=1')
153
+ elif name == 'adopt-ignores-yes':
154
+ # P261 red side: --adopt-pm-identity writes a differing record without the explicit --yes.
155
+ replace(lib / 'common.sh',
156
+ """ if [ "$yes" != "1" ]; then
157
+ team_err "--adopt-pm-identity 需要 --yes:这是把现在的解析声明成这次续跑的身份"
158
+ team_dim " 记录 model=$TEAM_PM_SELECTED_MODEL(suffix 显式)/现在 model=$want_model;记录 resume_key=$TEAM_PM_RECORDED_RESUME_KEY/现在 resume_key=$want_resume" >&2
159
+ team_dim " 要新开一场对话而不是认领:$TEAM_CLI up --fresh-pm" >&2
160
+ return 1
161
+ fi""",
162
+ ' : # P228_FLIP_adopt-ignores-yes')
163
+ elif name == 'legacy-route-placeholder':
164
+ # P261 返修(V35 F2/O1)红侧:拒绝建议退回占位符(不读项目自己的配置也不走推导表)
165
+ # → init / bootstrap / config 写路径的「推导命令逐字节」与粘贴现场必红。
166
+ function(lib / 'common.sh', 'team_legacy_model_route_lines',
167
+ " local cfg=\"${1:-${TEAM_CONFIG:-}}\"\n"
168
+ " team_dim \" 路线 ① 手工事务(先预览):$TEAM_CLI config upgrade-models --task-models '<category=provider/model …>' --pm-model '<provider/model>' --dry-run\"\n"
169
+ " team_dim \" 路线 ② 启动事务(机械形状由它迁移):$TEAM_CLI up(--print 只预告,--no-migrate 只报告)\"")
170
+ elif name == 'updatecheck-equal-prints':
171
+ # P261 red side: an equal published version is reported as newer.
172
+ replace(lib / 'cmd-watch.sh',
173
+ ' [ "$b" -gt "$a" ] && return 0',
174
+ ' [ "$b" -ge "$a" ] && return 0 # P228_FLIP_updatecheck-equal-prints')
175
+ elif name == 'updatecheck-ignores-off':
176
+ # P261 red side: TEAM_UPDATE_CHECK=0 no longer suppresses the lookup.
177
+ replace(lib / 'cmd-watch.sh',
178
+ ' [ "${TEAM_UPDATE_CHECK:-1}" = "0" ] && return 0',
179
+ ': # P228_FLIP_updatecheck-ignores-off')
180
+ elif name == 'updatecheck-print-writes-cache':
181
+ # P261 red side: the preview performs the lookup and writes the cache.
182
+ replace(lib / 'cmd-watch.sh',
183
+ " printf '(本可检查 npm 上的新版本:--print 下不联网、不写缓存)\\n'\n return 0\n fi",
184
+ " team_update_check_notice # P228_FLIP_updatecheck-print-writes-cache\n printf '(本可检查 npm 上的新版本:--print 下不联网、不写缓存)\\n'\n return 0\n fi")
134
185
  else:
135
186
  raise SystemExit('unknown mutation: ' + name)
136
187
  print(json.dumps(dict(mutation=name, changes=changes), ensure_ascii=False))
@@ -39,41 +39,15 @@
39
39
  # PTY_TRACE=0 print every wait/cleanup decision to stderr (fixture diagnostics)
40
40
  # PTY_SELFTEST_BREAK="" self-test only (`--self-test`): sabotage one rule so the guard test
41
41
  # can go red (early / nosettle / noclockmask / unguarded / noscene /
42
- # noext / alwaysext / noskip / alwaysskip / pipeshadow)
42
+ # noext / alwaysext / pipeshadow)
43
43
  #
44
- # P48 `pty-fixture-load-premise` (panel#The project-settings pty fixture judges under a machine
45
- # premise; the gate rule is verification#The correctness gate judges correctness only): the horizon
46
- # above is a **failure detector, never a judgment**. Time is the machine's dimension, so a machine
47
- # that cannot deliver a frame must not turn into a red. Two in-run instruments, both bounded:
48
- #
49
- # PTY_STALL_ROUNDS=8 the progress window, in rounds. A wait is extended only while the masked
50
- # capture changed within the last this many rounds AND at least this many
51
- # rounds have been observed — a horizon below the window (the fixture's own
52
- # site overrides at 6/8 rounds) is never extended and a scene that stopped
53
- # painting gets no extension at all, so the extension can never hide a
54
- # static failure. Measured basis: a round costs ~0.6-0.85 s, so 8 rounds is
55
- # ~5-7 s of identical masked frames.
56
- # PTY_EXT_FACTOR=3 the extension ceiling: at most this many times the base horizon (bounded
57
- # cost: a red can never take more than 3 x ~26 s per wait, and the scenario
58
- # stops at the first unattributable exhaustion)
59
- #
60
- # At that ceiling the wait asks the caller's premise hook and decides:
61
- # still painting OR pty_premise_over returns 0 (the machine's own readings are over their
62
- # ceilings) -> a **visible SKIP**: one line naming the wait, its rounds, its elapsed time, the
63
- # M59 scene report and the reason (the readings). The wait returns 3, sets PTY_SKIPPED=1 and
64
- # runs the caller's pty_on_skip when it defines one (the fixtures stop that scenario there);
65
- # a static scene with the readings under their ceilings -> the ordinary failure (rc 1) with the
66
- # M59 scene, so a real regression always reds on a healthy machine. A skip is never reported as
67
- # a pass and never as a failure by this file.
68
- #
69
- # The caller may define (both optional; absent = "the machine is under its premise"):
70
- # pty_premise_over 0 when the machine is over its premise (attributed -> SKIP), 1 otherwise
71
- # pty_premise_reason prints the one-line reason the SKIP line carries (loadavg/cores/probe)
72
- # pty_on_skip called after a skip is printed (the pty fixtures exit their scenario with 4)
73
- # PTY_INJECT_NEEDLE="" fixture/self-test only: an extra needle that can never appear, appended to
74
- # every wait — the "the state never arrives" shape the exhaustion tests need.
75
- # Wait verdict: 0 green | 1 red (the M59 failure scene) | 3 visible SKIP (machine, not code) | 2
76
- # setup (pty_cap missing).
44
+ # P316(用户裁定第二条:性能只能是参考指标,不能阻塞):**没有负载前提、没有 SKIP**。
45
+ # 等待视界是**失败探测器**(防死等),不是性能判定:
46
+ # PTY_WAIT_ITERS=100 基础视界(每轮 ~0.6-0.85 s → ~60-85 s);到点以后仍**在绘制**的现场
47
+ # 继续延长(PTY_EXT_FACTOR=5 → 最多 ~300-425 s),静态现场到点就停。
48
+ # 耗尽一律**红**:一行「没等到「X」(轮数 n/N,耗时约 Xs;最后一次状态:…;缺:…)」+ M59 现场,
49
+ # rc=1。**没有 rc=3**:机器忙不再是「没结论」的出口。
50
+ # Wait verdict: 0 green | 1 red (the M59 failure scene) | 2 setup (pty_cap missing).
77
51
  #
78
52
  # Constants, bands and how to re-derive them (design.md §3/§4; the raw table is
79
53
  # docs/team/reports/P48-dev3.md):
@@ -88,18 +62,16 @@
88
62
  # {probe,storm,burn} (owned load, owned targets, private roots).
89
63
  set -uo pipefail
90
64
 
91
- PTY_WAIT_ITERS="${PTY_WAIT_ITERS:-40}"
65
+ PTY_WAIT_ITERS="${PTY_WAIT_ITERS:-100}"
92
66
  PTY_WAIT_PAUSE="${PTY_WAIT_PAUSE:-0.35}"
93
67
  PTY_SETTLE_PAUSE="${PTY_SETTLE_PAUSE:-0.25}"
94
68
  PTY_CLEANUP_ITERS="${PTY_CLEANUP_ITERS:-4}"
95
69
  PTY_SCENE_LINES="${PTY_SCENE_LINES:-12}"
96
70
  PTY_STALL_ROUNDS="${PTY_STALL_ROUNDS:-8}"
97
- PTY_EXT_FACTOR="${PTY_EXT_FACTOR:-3}"
71
+ PTY_EXT_FACTOR="${PTY_EXT_FACTOR:-5}"
98
72
  PTY_INJECT_NEEDLE="${PTY_INJECT_NEEDLE:-}"
99
73
  PTY_TRACE="${PTY_TRACE:-0}"
100
74
  PTY_KEYS_SENT="${PTY_KEYS_SENT:-0}"
101
- PTY_SKIPPED="${PTY_SKIPPED:-0}"
102
- PTY_WAIT_PAINTING="${PTY_WAIT_PAINTING:-}"
103
75
  PTY_WAIT_CEILING="${PTY_WAIT_CEILING:-}"
104
76
  PTY_FAIL_STREAK="${PTY_FAIL_STREAK:-0}"
105
77
  PTY_WAIT_FAILED="${PTY_WAIT_FAILED:-0}"
@@ -197,51 +169,24 @@ _pty_painting_recent() {
197
169
  [ "$(( $1 - $2 ))" -le "$stall" ]
198
170
  }
199
171
 
200
- # _pty_premise_over — the caller's hook, with the two self-test sabotages: `noskip` makes an
201
- # over-premise exhaustion fail anyway (the guard test must catch a skip that stopped happening) and
202
- # `alwaysskip` skips even under the premise (the guard test must catch a skip that swallows a red).
203
- _pty_premise_over() {
204
- [ "${PTY_SELFTEST_BREAK:-}" = "alwaysskip" ] && return 0
205
- [ "${PTY_SELFTEST_BREAK:-}" = "noskip" ] && return 1
206
- declare -F pty_premise_over >/dev/null 2>&1 || return 1
207
- pty_premise_over
208
- }
209
- _pty_premise_reason() {
210
- if declare -F pty_premise_reason >/dev/null 2>&1; then pty_premise_reason
211
- else printf '机器读数超前提'; fi
212
- }
213
-
214
- # pty_skip_line — the one visible line a skip prints. It names the wait, its rounds against the
215
- # ceiling, the elapsed time, whether the scene was still painting, what was missing (the M59
216
- # report) and the caller's reason (the readings). stdout, so the gate's log carries it.
217
- pty_skip_line() {
218
- local painting='场景已静止'
219
- [ "${PTY_WAIT_PAINTING:-no}" = "yes" ] && painting='场景仍在绘制'
220
- printf ' \033[33mSKIP\033[0m 等待耗尽但归因于机器(既不是通过也不是失败):%s · 轮数 %s/%s · 耗时约 %ss · %s · %s · 归因:%s\n' \
221
- "${PTY_WAIT_LABEL:-?}" "${PTY_WAIT_ROUNDS:-?}" "${PTY_WAIT_CEILING:-?}" "${PTY_WAIT_SECONDS:-?}" \
222
- "$painting" "${PTY_WAIT_REPORT:-}" "$(_pty_premise_reason)"
223
- }
224
-
225
172
  # pty_wait_frame <outfile|-> <label> <needle...> → 0 when a settled frame carries every needle
226
173
  # (absent ones prefixed with `!`). The latest capture is written to <outfile> every round so the
227
174
  # caller's assertion can show what was on screen. The horizon is a failure detector: it is extended
228
175
  # (bounded, PTY_EXT_FACTOR) while the scene is still painting, and at the ceiling the verdict is
229
- # attributed — the machine (visible SKIP, rc 3, PTY_SKIPPED=1) or the code (the M59 failure scene,
230
- # rc 1, which the caller's bad() classifies as isolated vs cascade).
176
+ # always a failure (the M59 scene, rc 1, "没等到 X") — P316 removed the machine-attributed SKIP.
231
177
  pty_wait_frame() {
232
178
  local out="$1" label="$2"; shift 2
233
179
  declare -F pty_cap >/dev/null 2>&1 || { printf 'pty-wait: pty_cap is not defined\n' >&2; return 2; }
234
- local base="${PTY_WAIT_ITERS:-40}" extf="${PTY_EXT_FACTOR:-3}"
235
- case "$base" in ''|*[!0-9]*) base=40 ;; esac
180
+ local base="${PTY_WAIT_ITERS:-100}" extf="${PTY_EXT_FACTOR:-5}"
181
+ case "$base" in ''|*[!0-9]*) base=100 ;; esac
236
182
  [ "$base" -ge 1 ] || base=1
237
- case "$extf" in ''|*[!0-9]*) extf=3 ;; esac
183
+ case "$extf" in ''|*[!0-9]*) extf=5 ;; esac
238
184
  [ "$extf" -ge 1 ] || extf=1
239
185
  [ "${PTY_SELFTEST_BREAK:-}" = "noext" ] && extf=1
240
186
  local ceiling=$(( base * extf ))
241
187
  local extra="${PTY_INJECT_NEEDLE:-}"
242
188
  local i=0 a last_masked='' masked last_change=0 t0="$SECONDS"
243
189
  PTY_WAIT_FAILED=0
244
- PTY_SKIPPED=0
245
190
  while [ "$i" -lt "$ceiling" ]; do
246
191
  i=$((i + 1))
247
192
  a="$(pty_cap)"
@@ -250,7 +195,7 @@ pty_wait_frame() {
250
195
  PTY_WAIT_ROUNDS="$i"; PTY_WAIT_CEILING="$ceiling"
251
196
  # The trace line keeps the pre-P48 shape (`rounds=$i`): panel-p21.sh's own M59 assertion
252
197
  # (`wait picker … rounds=[0-9]+ settled=1`) pins it, and the ceiling already appears in the
253
- # exhaustion report and the skip line. A diagnostics line is no place to break a pin.
198
+ # exhaustion report. A diagnostics line is no place to break a pin.
254
199
  [ "${PTY_TRACE:-0}" = "1" ] && pty_trace "wait $label rounds=$i settled=1"
255
200
  return 0
256
201
  fi
@@ -270,12 +215,9 @@ pty_wait_frame() {
270
215
  PTY_WAIT_PAINTING="no"
271
216
  _pty_painting_recent "$i" "$last_change" && PTY_WAIT_PAINTING="yes"
272
217
  PTY_WAIT_REPORT="$(_pty_report_missing "$a" "$@" ${extra:+"$extra"})"
273
- if [ "$PTY_WAIT_PAINTING" = "yes" ] || _pty_premise_over; then
274
- PTY_SKIPPED=1
275
- pty_skip_line
276
- if declare -F pty_on_skip >/dev/null 2>&1; then pty_on_skip; fi
277
- return 3
278
- fi
218
+ # P316:耗尽就是「没等到」——一行点名等待/轮数/耗时/最后一次状态,再给 M59 现场;没有机器维度。
219
+ printf ' \033[33m没等到\033[0m %s:%s/%s 轮(耗时约 %ss;最后一次状态:%s;缺:%s)\n' \
220
+ "$label" "$i" "$ceiling" "$((SECONDS - t0))" "${PTY_WAIT_PAINTING:-no}" "${PTY_WAIT_REPORT:-?}"
279
221
  pty_wait_scene "$label" "$i" "$((SECONDS - t0))" "$a" "$@" ${extra:+"$extra"}
280
222
  return 1
281
223
  }
@@ -424,10 +366,9 @@ pty_selftest() {
424
366
  . "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmp-root.sh"
425
367
  st_dir="$(tmp_root_create pty-wait-selftest)" || return 3
426
368
  trap 'tmp_root_reap_all' EXIT
427
- local _PASS=0 _FAIL=0 _SKIP=0
369
+ local _PASS=0 _FAIL=0
428
370
  _st_ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; _PASS=$((_PASS + 1)); pty_fail_reset; }
429
371
  _st_bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; _FAIL=$((_FAIL + 1)); }
430
- _st_skip() { printf ' \033[33mSKIP\033[0m %s\n' "$1"; _SKIP=$((_SKIP + 1)); pty_fail_reset; }
431
372
 
432
373
  # The fake pane: a settings view; a picker paints one line per capture (max 4); the title clock
433
374
  # ticks every capture so only the masked comparison can settle. Keys mutate the app state:
@@ -606,38 +547,7 @@ pty_selftest() {
606
547
  _st_bad "静态场景被延长或没红(rc=$stat_rc rounds=$stat_rounds;断点=${PTY_SELFTEST_BREAK:-无})"
607
548
  fi
608
549
 
609
- # ── 判据⑤:耗尽那一刻的归因 —— 超前提是可见 SKIP(不是失败),前提之下仍是红 ──
610
- # 注入的前提钩子(真实夹具里由 panel-p21.sh 提供;这里换成一个可切换的自检读数)。
611
- _pty_selftest_premise="under"
612
- pty_premise_over() { [ "${_pty_selftest_premise:-under}" = "over" ]; }
613
- pty_premise_reason() {
614
- printf '注入读数:探针 999ms > 顶 120ms(loadavg %s · %s 核)' \
615
- "$(cut -d' ' -f1 /proc/loadavg 2>/dev/null || echo '?')" "$(nproc 2>/dev/null || echo '?')"
616
- }
617
- local skip_rc red_rc
618
- _st_reset view
619
- _pty_selftest_premise="over"
620
- PTY_WAIT_ITERS=6 PTY_STALL_ROUNDS=2 PTY_WAIT_PAUSE=0.01 PTY_SETTLE_PAUSE=0.01 \
621
- pty_wait_frame "$st_dir/skip.txt" "超前提的等待" "这条目永远不来" > "$st_dir/skip.out" 2> "$st_dir/skip.err"
622
- skip_rc=$?
623
- if [ "$skip_rc" -eq 3 ] && [ "${PTY_SKIPPED:-0}" = "1" ] \
624
- && grep -q 'SKIP' "$st_dir/skip.out" && grep -q '超前提的等待' "$st_dir/skip.out" \
625
- && grep -q '999ms' "$st_dir/skip.out" && grep -q '这条目永远不来' "$st_dir/skip.out"; then
626
- _st_skip "超前提:rc=3 + PTY_SKIPPED=1 + 一行可见 SKIP(点名等待/轮数/耗时/现场/读数)→ 记为 skip,不是失败"
627
- else
628
- _st_bad "超前提没有给出可见 SKIP(rc=$skip_rc PTY_SKIPPED=${PTY_SKIPPED:-};断点=${PTY_SELFTEST_BREAK:-无})"
629
- fi
630
- _st_reset view
631
- _pty_selftest_premise="under"
632
- PTY_WAIT_ITERS=6 PTY_STALL_ROUNDS=2 PTY_WAIT_PAUSE=0.01 PTY_SETTLE_PAUSE=0.01 \
633
- pty_wait_frame "$st_dir/red.txt" "前提之内的等待" "这条目永远不来" 2> "$st_dir/red.err"
634
- red_rc=$?
635
- if [ "$red_rc" -eq 1 ] && [ "${PTY_SKIPPED:-0}" = "0" ] && grep -q '等待超时' "$st_dir/red.err"; then
636
- _st_ok "前提之内:同一个静态现场仍是红(rc=1 + M59 现场)—— SKIP 不是逃逸门"
637
- else
638
- _st_bad "前提之内的耗尽没有红(rc=$red_rc PTY_SKIPPED=${PTY_SKIPPED:-};断点=${PTY_SELFTEST_BREAK:-无})"
639
- fi
640
-
550
+ # ── 判据⑤(P316 退役):原「超前提 → 可见 SKIP」不再存在;耗尽一律红,见判据④的静态场景。
641
551
  # ── 判据⑥:长帧(>128 KiB)的两向 —— 命中不能被 SIGPIPE 吃掉,缺失必须照缺报(P127)──
642
552
  # P124 的最小复现:帧 120607 B > 管道缓冲(64 KiB),needle 在最前面;旧写法
643
553
  # `printf '%s\n' "$c" | grep -qF` 命中即退 → 写端 SIGPIPE → pipefail 下 rc=141 → 假「没出现」。
@@ -666,7 +576,7 @@ pty_selftest() {
666
576
  _st_bad "长帧缺失没有照缺报(rc=$long_miss_rc;断点=${PTY_SELFTEST_BREAK:-无})"
667
577
  fi
668
578
 
669
- printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d SKIP %d\n' "$_PASS" "$_FAIL" "$_SKIP"
579
+ printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$_PASS" "$_FAIL"
670
580
  [ "$_FAIL" -eq 0 ] && exit 0
671
581
  exit 1
672
582
  }
@@ -193,14 +193,14 @@ kr_group_pane() {
193
193
 
194
194
  # ① 第 5 页:列表帧(两行 + 页签身份)
195
195
  keys "5"; sleep 0.6
196
- want_frame list5 "pane:第 5 页列表帧(编号 + 标题 + 自称发布者)" "#3 长正文" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
196
+ want_frame list5 "pane:第 5 页列表帧(编号 + 标题 + 发布者标签)" "#3 长正文" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
197
197
  assert_has "$tmp/$current/list5.txt" "关键回复" "pane:页签显示第 5 页身份"
198
198
  assert_has "$tmp/$current/list5.txt" "个编号槽位" "pane:列表带编号槽位计数(不冒充可读回复数)"
199
199
  ev_save "$tmp/$current/list5.txt" "pane-list5.txt"
200
200
  # ② Enter 打开焦点(最新号)→ 正文视窗;End 滚到最后一行,END-MARKER 可达
201
201
  keys Enter; sleep 0.6
202
- want_frame viewer "pane:Enter 打开焦点号的完整正文" "长正文" "自称来自 dev2"
203
- assert_has "$tmp/$current/viewer.txt" "只读 · 发布者自称,未经核验" "pane:正文视窗写明自称且只读"
202
+ want_frame viewer "pane:Enter 打开焦点号的完整正文" "长正文" "来自 dev2"
203
+ assert_has "$tmp/$current/viewer.txt" "只读 · 按发布的原文显示" "pane:正文视窗只读且按发布的原文显示(没有限定词)"
204
204
  assert_not "$tmp/$current/viewer.txt" "END-MARKER-P234" "pane:视窗打开时停在文首(长文没有被一次性铺满)"
205
205
  keys End; sleep 0.6
206
206
  want_frame viewer_end "pane:End 滚到长正文结尾,END-MARKER 可达" "END-MARKER-P234"
@@ -255,7 +255,7 @@ kr_group_demand() {
255
255
  # ③ 打开某号:多一个 reply_body --no <no>
256
256
  reset_argv
257
257
  keys Down; sleep 0.3; keys Enter; sleep 1.5
258
- want_frame body "demand:打开某号后正文视窗渲染" "只读 · 发布者自称"
258
+ want_frame body "demand:打开某号后正文视窗渲染" "只读 · 按发布的原文显示"
259
259
  assert_eq "demand:打开正文时没有 list 的新调用" "$(block_calls reply_list)" "0"
260
260
  if [ "$(block_calls reply_body)" -ge 1 ]; then ok "demand:打开正文后 body 被调度($(block_calls reply_body) 次)"; else bad "demand:打开正文后没有 body 调用"; fi
261
261
  assert_match "$(kr_argv)" 'reply_body.*--no [0-9]+' "demand:body 调用带上了要读的编号(argv 可查)"
@@ -346,7 +346,6 @@ PYW
346
346
  bad "snapshot:${w}×${t}×${l} 宽度检查器本身失败(rc=$over_rc,$over)"
347
347
  elif [ -z "$over" ]; then ok "snapshot:${w}×${t}×${l} 没有行超过 ${w} 列(显示宽度)"
348
348
  else bad "snapshot:${w}×${t}×${l} 有行超宽($over)"; fi
349
- if [ "$l" = "zh" ]; then assert_match "$f" '更早' "snapshot:${w}×${t}×${l} Older 可达"; else assert_match "$f" 'Older' "snapshot:${w}×${t}×${l} Older 可达"; fi
350
349
  # 页签身份:59 列用短标签,但活动页标签仍在
351
350
  if [ "$l" = "zh" ]; then assert_has "$f" "关键回复" "snapshot:${w}×${t}×${l} 活动页身份可见"; else assert_has "$f" "key replies" "snapshot:${w}×${t}×${l} 活动页身份可见"; fi
352
351
  done
@@ -357,15 +356,11 @@ PYW
357
356
  # 空 store / 坏 store / 长文视窗 三态
358
357
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --reply-before 10 --width 120 --height 24 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-cont.txt"
359
358
  assert_has "$tmp/snap-cont.txt" "#1 " "snapshot:第二页 cursor 渲染出 #1(更旧页真的可达)"
360
- assert_has "$tmp/snap-cont.txt" "个编号槽位" "snapshot:更旧页仍带编号槽位计数"
361
359
  ev_save "$tmp/snap-cont.txt" "snapshot-continuation.txt"
362
360
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --reply-no 2 --width 120 --height 24 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-view.txt"
363
361
  assert_has "$tmp/snap-view.txt" "长文快照" "snapshot:长文视窗渲染标题"
364
362
  mv "$state/key-replies" "$tmp/store-parked"
365
363
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --width 99 --height 20 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-empty.txt"
366
- assert_has "$tmp/snap-empty.txt" "(还没有关键回复)" "snapshot:空 store 是显式空状态"
367
- assert_has "$tmp/snap-empty.txt" "关键回复" "snapshot:空 store 时页面身份仍在"
368
- assert_not "$tmp/snap-empty.txt" "个编号槽位" "snapshot:空 store 不伪装成有槽位"
369
364
  ev_save "$tmp/snap-empty.txt" "snapshot-empty.txt"
370
365
  mv "$tmp/store-parked" "$state/key-replies"
371
366
  }