teamsmith 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +35 -0
  4. package/skills/teamsmith/SKILL.md +43 -30
  5. package/skills/teamsmith/extension/team-bg.ts +5 -3
  6. package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
  7. package/skills/teamsmith/extension/team-notify.ts +20 -13
  8. package/skills/teamsmith/extension/team-remind.ts +189 -0
  9. package/skills/teamsmith/extension/team-reply.ts +4 -7
  10. package/skills/teamsmith/references/config.md +11 -12
  11. package/skills/teamsmith/references/migration.md +101 -0
  12. package/skills/teamsmith/references/openspec.md +43 -27
  13. package/skills/teamsmith/references/protocol.md +26 -15
  14. package/skills/teamsmith/references/reminders.md +153 -161
  15. package/skills/teamsmith/references/troubleshooting.md +12 -7
  16. package/skills/teamsmith/references/workflows.md +84 -31
  17. package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
  18. package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
  19. package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
  20. package/skills/teamsmith/scripts/lib/cmd-review.sh +61 -35
  21. package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
  22. package/skills/teamsmith/scripts/lib/common.sh +83 -13
  23. package/skills/teamsmith/scripts/panel/README.md +35 -33
  24. package/skills/teamsmith/scripts/panel/panel.js +217 -199
  25. package/skills/teamsmith/scripts/panel/src/App.tsx +221 -66
  26. package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
  27. package/skills/teamsmith/scripts/panel/src/layout.ts +159 -310
  28. package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
  29. package/skills/teamsmith/scripts/panel/src/project-settings.ts +46 -0
  30. package/skills/teamsmith/scripts/panel/src/strings/en.ts +71 -205
  31. package/skills/teamsmith/scripts/panel/src/strings/index.ts +3 -5
  32. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +72 -204
  33. package/skills/teamsmith/scripts/panel/src/types.ts +23 -4
  34. package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
  35. package/skills/teamsmith/scripts/remind-store.mjs +55 -24
  36. package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
  37. package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
  38. package/skills/teamsmith/scripts/state-authority.mjs +72 -6
  39. package/skills/teamsmith/scripts/strings/commands.tsv +1 -1
  40. package/skills/teamsmith/scripts/team +1 -0
  41. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +18 -8
  42. package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
  43. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
  44. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
  45. package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
  46. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -25
  47. package/skills/teamsmith/templates/report.md.tmpl +33 -0
  48. package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
  49. package/skills/teamsmith/tests/bg-ledger.sh +24 -10
  50. package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
  51. package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
  52. package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
  53. package/skills/teamsmith/tests/help-surface.sh +78 -12
  54. package/skills/teamsmith/tests/install-shape.sh +7 -7
  55. package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
  56. package/skills/teamsmith/tests/key-replies-ui.sh +64 -5
  57. package/skills/teamsmith/tests/key-replies.sh +307 -106
  58. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +2 -0
  59. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +255 -90
  60. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +181 -61
  61. package/skills/teamsmith/tests/lib/model-routing-roles.sh +125 -67
  62. package/skills/teamsmith/tests/lib/reply-fixture.sh +14 -9
  63. package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
  64. package/skills/teamsmith/tests/lib/tmp-root.sh +1 -1
  65. package/skills/teamsmith/tests/loop-inventory.tsv +3 -0
  66. package/skills/teamsmith/tests/panel-b2.sh +91 -31
  67. package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
  68. package/skills/teamsmith/tests/panel-p21.sh +607 -1162
  69. package/skills/teamsmith/tests/panel-strings.mjs +21 -113
  70. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +190 -0
  71. package/skills/teamsmith/tests/remind-adversarial-faults.sh +78 -0
  72. package/skills/teamsmith/tests/remind-adversarial-real.sh +28 -0
  73. package/skills/teamsmith/tests/remind-cli.sh +108 -3
  74. package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
  75. package/skills/teamsmith/tests/remind-delivery.sh +123 -35
  76. package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
  77. package/skills/teamsmith/tests/remind-pulse.sh +199 -0
  78. package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
  79. package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
  80. package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
  81. package/skills/teamsmith/tests/remind-tool-real.mjs +801 -0
  82. package/skills/teamsmith/tests/remind-tool-real.sh +180 -0
  83. package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
  84. package/skills/teamsmith/tests/routes.sh +213 -293
  85. package/skills/teamsmith/tests/section-paths.tsv +19 -17
  86. package/skills/teamsmith/tests/smoke.sh +583 -133
  87. package/skills/teamsmith/tests/state-authority.sh +152 -8
  88. package/skills/teamsmith/tests/task-model-routing.sh +57 -26
  89. package/skills/teamsmith/tests/tmp-hygiene.sh +1 -1
  90. package/skills/teamsmith-init/SKILL.md +5 -5
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
@@ -69,7 +69,7 @@ js="${_js_arg:-$(command -v node || true)}"
69
69
  sock="p21-$$"
70
70
  sess="p21-$$"
71
71
  keep="${_keep_arg:-0}"
72
- [ "$keep" = "1" ] && export TEAM_TMP_KEEP=1
72
+ [ "$keep" = "1" ] && export TEAM_TMP_KEEP=1 TEAM_P21_KEEP=1
73
73
  tmp="$(tmp_root_create panel-p21)" || exit 3
74
74
  PASS=0
75
75
  FAIL=0
@@ -187,7 +187,7 @@ pty_pane_state() { tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_dead}:
187
187
  # paints line by line), so the frame must be settled — needles present + two consecutive captures
188
188
  # identical (title clock masked) — before the wait releases (M59).
189
189
  wait_editor() { # <tray title> [body marker]
190
- pty_wait_frame - "editor $1" "╭─ $1" "${2:-}"
190
+ pty_wait_frame - "editor $1" "╭─ $(key_label "$1")" "${2:-}"
191
191
  }
192
192
 
193
193
  # Wait for the current frame to carry <text>; writes settle asynchronously. The latest capture is
@@ -285,7 +285,7 @@ panel_pid() { tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_pid}' 2>/de
285
285
  # heading and, at the top of the list, would only appear on some badge (zh by default; the en pass
286
286
  # passes its own marker).
287
287
  open_view() {
288
- local marker="${1:-身份与账本布局}"
288
+ local marker="${1:-模型}"
289
289
  keys ,
290
290
  sleep 0.7
291
291
  keys Down Down Down Down Down
@@ -304,13 +304,43 @@ open_view() {
304
304
  # own read (M65/D11 allows it — the interaction path is what must not read). A fixture that edits the
305
305
  # contract by hand needs this to see its own bytes on screen.
306
306
  reopen_view() {
307
- keys Escape
308
- sleep 0.5
309
- keys Escape
310
- sleep 0.5
307
+ filter_clear
308
+ if cap_now | grep -qE '╭─ (项目命令|模型记录)'; then
309
+ keys Escape
310
+ pty_wait_frame - "重开前返回主设置" '╭─ 项目设置' || bad "重开前未回到主设置"
311
+ filter_clear
312
+ fi
313
+ pty_key_when "重开前退出主设置" '╭─ 项目设置' Escape || bad "重开前主设置不在屏幕上"
314
+ pty_key_when "重开前关闭浮层" '› 项目设置' Escape || bad "重开前浮层不在屏幕上"
315
+ pty_wait_frame - "重开前浮层已关闭" 'teamsmith pulse' '!› 项目设置' || bad "重开前浮层未关闭"
311
316
  open_view
312
317
  }
313
318
 
319
+ open_secondary() { # commands|records
320
+ filter_clear
321
+ local label="项目命令"
322
+ [ "$1" = records ] && label="模型记录"
323
+ filter_to "$label"
324
+ keys Enter
325
+ pty_wait_frame - "打开 $label" "╭─ $label" || bad "没有打开 $label"
326
+ _p21_filter=""
327
+ }
328
+
329
+ # Labelled widgets, not raw implementation keys.
330
+ key_label() {
331
+ case "$1" in
332
+ TEAM_PM_MODEL) printf 'PM模型' ;;
333
+ TEAM_MODEL_LIMITS) printf '模型同时运行任务数' ;;
334
+ TEAM_PULSE_INTERVAL) printf '检查间隔' ;;
335
+ TEAM_PULSE_MAX_RESTARTS) printf 'PM每小时自动恢复次数' ;;
336
+ TEAM_UPDATE_CHECK) printf '启动时检查新版本' ;;
337
+ TEAM_GATES) printf '验收命令' ;;
338
+ TEAM_INSTALL_CMD) printf '安装命令' ;;
339
+ TEAM_REVIEW_TIMEOUT) printf '验收最长时间' ;;
340
+ *) printf '%s' "$1" ;;
341
+ esac
342
+ }
343
+
314
344
  # Filter the view to <text> (the `/` line, then Enter applies). The editor opens holding the
315
345
  # previous filter, so the seed is cleared first (Backspace per codepoint).
316
346
  _p21_filter=""
@@ -366,12 +396,12 @@ focus_row() { # <grep -E pattern>
366
396
  return 1
367
397
  }
368
398
 
369
- # Wait for the choice picker (M55): its title carries the raw key after a ` · `, and the optional
399
+ # Wait for the choice picker (M55): its title carries the operation label, and the optional
370
400
  # entry marker is what the caller asserts next. Both must be in one settled frame (M59): the title
371
401
  # alone is not proof the picker is usable — Ink paints a frame line by line, so a capture can catch
372
402
  # the title before the entry lines land (the PM's review run saw exactly that and cascaded).
373
403
  wait_picker() { # <KEY> [entry marker]
374
- pty_wait_frame - "picker $1" " · $1" "${2:-}"
404
+ pty_wait_frame - "picker $1" "╭─ $(key_label "$1")" "${2:-}"
375
405
  }
376
406
  # The regression pin uses a short budget: a missing marker must fail fast, not burn the full one.
377
407
  wait_picker_quick() {
@@ -385,7 +415,7 @@ wait_picker_quick() {
385
415
  # Returns 0 when the widget is gone afterwards (closed by this esc, or already gone — no key sent),
386
416
  # 1 when an esc went out but the widget is still on screen.
387
417
  leave_picker() { # <KEY>
388
- pty_cleanup_esc "picker $1" " · $1"
418
+ pty_cleanup_esc "picker $1" "╭─ $(key_label "$1")"
389
419
  }
390
420
 
391
421
  # P30/D2: the grouping is a functional domain, the effect class lives in the row's badge. A line
@@ -415,14 +445,14 @@ wheel_at() { # <down|up> <col> <row> [n]
415
445
 
416
446
  # Same rule for the write editor's cleanup sites (the tray title is the marker).
417
447
  leave_editor() { # <tray title>
418
- pty_cleanup_esc "editor $1" "╭─ $1"
448
+ pty_cleanup_esc "editor $1" "╭─ $(key_label "$1")"
419
449
  }
420
450
 
421
451
  # Wait until the setting editor's tray is gone. The settings view's own frame also draws
422
452
  # `╭─ 项目设置`, so the probe matches the tray title the setting editor uses (the raw key), not any
423
453
  # box corner; the absence must be on a settled frame too (M59).
424
454
  wait_no_editor() {
425
- pty_wait_frame - "editor closed" '!╭─ TEAM_'
455
+ pty_wait_frame - "editor closed" '!Enter 继续' '!Enter 保存 · Esc 取消'
426
456
  }
427
457
 
428
458
  # Walk the picker's cursor to the option whose line contains <text> (grep -F) and press Enter —
@@ -448,816 +478,388 @@ pick_option() {
448
478
  # ---------------------------------------------------------------- scenarios
449
479
 
450
480
  scn_settings() {
451
- section "settings · 标签/类徽章/默认值/过滤/窗口/点击/CLI 对齐/refuse 路由/q(B2 + M49)"
481
+ section "settings · 精选操作/入口返回/过滤/错误/短长列表/填高/点击/q"
452
482
  server_up settings
453
- # P232:这一段的契约是新的(类别策略 + 独立 PM)。老契约的档由 scn_categories 的 legacy 段专门覆盖;
454
- # 这里要的是「正常契约下视图里没有裸 TEAM_*」这一条能成立。
455
- policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
456
- || bad "策略升级事务没有跑通"
457
- python3 - "$(cfg)" <<'PYFIX'
458
- import re, sys
459
- p = sys.argv[1]
460
- s = open(p, encoding='utf-8').read()
461
- s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
462
- # M49:文件里手加一个 schema 不认识的键(命令报 known=false)—— 它没有标签可用,行回退显示原始键。
463
- s = s.rstrip('\n') + '\nTEAM_HAND_ADDED="hand"\n'
464
- open(p, 'w', encoding='utf-8').write(s)
465
- PYFIX
483
+ policy_new 'routine=example/one analysis=example/two verify=example/three' 'example/pm' || bad "策略准备失败"
466
484
  start_panel
467
- local conf_before; conf_before="$(sha "$state/panel.conf" 2>/dev/null || echo none)"
468
- local fstats
485
+ local pref_before; pref_before="$(sha "$state/panel.conf")"
469
486
  open_view
470
- assert_eq "导航行打开视图没有写 panel.conf" "$(sha "$state/panel.conf" 2>/dev/null || echo none)" "$conf_before"
471
487
  cap_to view
472
- # P30/D2:分组 = schema 第 10 列的功能域。视图开屏在只读骨架(identity),标题就是功能域名;
473
- # 旧的三条类分组标题(立即生效 / 需重启 / 不可改)不再是标题(徽章词仍在,见类徽章段)。
474
- assert_no_class_heading "$tmp/$current/view.txt"
475
- # 行文本是人话标签(不是裸键),开屏聚焦行是 identity 的第一条 schema 键。
476
- assert_match "$tmp/$current/view.txt" '› 项目名 +.*不可改' "开屏聚焦行是 identity 第一条(标签 + 不可改 徽章)"
477
- assert_not "$tmp/$current/view.txt" "TEAM_GATES" "行里不再出现裸键 TEAM_GATES"
478
- # P266:审计整块离开视图(标题与行都不画)——审计仍可用 `team config list` 自己的尾部和 `team config log` 读。
479
- assert_not "$tmp/$current/view.txt" "审计(最近)" "P266:视图里没有审计标题"
480
- assert_not "$tmp/$current/view.txt" "result=" "P266:视图里没有 state/config.log 的审计行"
481
- assert_no_match "$tmp/$current/view.txt" '^(│ )? *(Audit|审计)' "P266:没有任何一行是审计标题"
482
- # P266:夹具键是数据驱动的隐藏:行不在视图里,按标签与裸键过滤都搜不到,而同组其它行还在。
483
- local p266_k p266_cfg_before p266_json p266_route p266_human p266_rc
484
- for p266_k in TEAM_DISK_STATS_FILE TEAM_SMOKE_FAST TEAM_INBOX_WATCH_FORCE_FAIL TEAM_IW_REQUIRE_WATCH; do
485
- filter_to "$p266_k"
486
- cap_to "p266-hidden-$p266_k"
487
- assert_not "$tmp/$current/p266-hidden-$p266_k.txt" "$p266_k" "P266:$p266_k 不在视图里(按裸键搜不到)"
488
- done
489
- assert_not "$tmp/$current/p266-hidden-TEAM_DISK_STATS_FILE.txt" "磁盘读数夹具" "P266:隐藏的夹具键连人话标签也搜不到"
490
- filter_to 磁盘读数夹具
491
- cap_to p266-hidden-label
492
- assert_not "$tmp/$current/p266-hidden-label.txt" "磁盘读数夹具" "P266:按标签过滤也搜不到夹具键"
493
- # 同一组(policy)里还有可见键:标题因为别的行还在,不因隐藏而空。
494
- filter_to TEAM_MEMINFO_FILE
495
- cap_to p266-group-alive
496
- assert_has "$tmp/$current/p266-group-alive.txt" "权限与依赖" "P266:同组其它行还在(隐藏的只是夹具键,标题没跟着消失)"
497
- assert_not "$tmp/$current/p266-group-alive.txt" "TEAM_MEMINFO_FILE" "P266:那一帧里仍然只有人话标签,没有裸键"
498
- filter_clear
499
- # 读面与命令面一字不变:人读表仍列出、--json 仍带声明标记、set 仍 refuse。
500
- p266_cfg_before="$(sha "$(cfg)")"
501
- p266_human="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list ) 2>&1 )"
502
- case "$p266_human" in *TEAM_DISK_STATS_FILE*) ok "P266:人类可读表仍列出夹具键" ;; *) bad "P266:人类可读表不再列出夹具键" ;; esac
503
- p266_json="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list --json ) 2>&1 )"
504
- p266_route="$(printf '%s' "$p266_json" | python3 -c 'import json,sys; d=json.load(sys.stdin); print([k["route"] for k in d["keys"] if k["name"]=="TEAM_DISK_STATS_FILE"][0])')"
505
- case "$p266_route" in "fixture-only: "*) ok "P266:--json 的 route 原样带 fixture-only: 前缀" ;; *) bad "P266:--json 的 route 丢了声明标记($p266_route)" ;; esac
506
- ( cd "$ROOT" && bash "$skill/scripts/team" config set TEAM_DISK_STATS_FILE /tmp/x --yes ) >/dev/null 2>&1
507
- p266_rc=$?
508
- assert_eq "P266:config set 夹具键仍 refuse(exit 5)" "$p266_rc" "5"
509
- assert_eq "P266:refuse 没有动契约" "$(sha "$(cfg)")" "$p266_cfg_before"
510
- # 组内保持 schema 顺序(项目名 在 会话名 之前)。
511
- local n_first n_second
512
- n_first="$(grep -n '项目名' "$tmp/$current/view.txt" | head -1 | cut -d: -f1)"
513
- n_second="$(grep -n '会话名' "$tmp/$current/view.txt" | head -1 | cut -d: -f1)"
514
- if [ -n "$n_first" ] && [ -n "$n_second" ] && [ "$n_first" -lt "$n_second" ]; then
515
- ok "同一组内保持 schema 顺序(项目名 在第 $n_first 行,会话名 在第 $n_second 行)"
516
- else
517
- bad "组内顺序不对(项目名=$n_first 会话名=$n_second)"
518
- fi
519
- # 类徽章是词(P30/D4):过滤到一条 apply 行看它的徽章。
520
- filter_to 模型并发上限
521
- cap_to badge-apply
522
- cap_has "↑/↓ 行 · Enter 打开 · / 筛选" keyband
523
- # One filter per class: the badge, the unset marker and the line's own comment (all unchanged).
488
+ assert_match "$tmp/$current/view.txt" '› routine +example/one' "默认先显示实际类别"
489
+ assert_has "$tmp/$current/view.txt" "自动检查" "默认有自动检查用途组"
490
+ assert_not "$tmp/$current/view.txt" "身份与账本布局" "全表不再占据首屏"
491
+ assert_not "$tmp/$current/view.txt" "立即生效" "普通行没有逐行生效徽章"
492
+ assert_not "$tmp/$current/view.txt" "未设 · 默认" "普通行直接给有效值"
493
+ assert_not "$tmp/$current/view.txt" "result=" "设置不显示审计"
494
+ local stats r u d gap
495
+ cap_visible_to default-count
496
+ stats="$(settings_window_stats "$tmp/$current/default-count.txt")"
497
+ read -r r u d gap <<<"$stats"
498
+ assert_eq "C3默认可选行=10(包含两个入口)" "$((r+u+d))" "10"
499
+ assert_eq "打开设置没有写偏好" "$(sha "$state/panel.conf")" "$pref_before"
524
500
  filter_to TEAM_PULSE_INTERVAL
525
- cap_to restart
526
- assert_has "$tmp/$current/restart.txt" "命令行:team config set TEAM_PULSE_INTERVAL <新值>" "CLI 提示行点名原始键(照敲命令用)"
527
- filter_to TEAM_PROJECT
528
- cap_to refuse
529
- assert_match "$tmp/$current/refuse.txt" '项目名 +root · 不可改' "refuse 行的标签 + 不可改 徽章"
530
- assert_has "$tmp/$current/refuse.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "refuse 提示行是那句普通的文件路线"
531
- assert_not "$tmp/$current/refuse.txt" "手改" "P266:refuse 提示行里没有「手改」"
532
- assert_not "$tmp/$current/refuse.txt" "只读" "P266:refuse 行的徽章不再写「只读」"
533
- # P32:短列表(一条过滤结果)也把卡片填满 —— 空白留在卡片**里面**,卡片下边框仍紧贴键栏。
501
+ wait_row interval "有效值与必要生效提示" "检查间隔" "900" "team pulse restart" || bad "检查间隔未显示"
534
502
  cap_visible_to filter-fill
535
- fstats="$(settings_window_stats "$tmp/$current/filter-fill.txt")"
536
- IFS=' ' read -r _fr _fu _fd fgap <<<"$fstats"
537
- if [ "${_fr:-0}" -ge 1 ] && [ "${fgap:-9}" -le 1 ]; then
538
- ok "过滤到一条时卡片仍填满窗口(行=$_fr 空白=$fgap)"
539
- else
540
- bad "过滤到一条时卡片没有填满窗口($fstats)"
541
- fi
542
- filter_to TEAM_PANEL_DETAIL_CAP
543
- cap_to unset
544
- assert_match "$tmp/$current/unset.txt" '详情文件读取上限 +未设 · 默认 131072' "未设的键显示 schema 默认值 + unset 标记"
545
- filter_to TEAM_PULSE_NUDGE_GAP
546
- cap_to comment
547
- assert_match "$tmp/$current/comment.txt" '重复提醒间隔 +900 · 立即生效 +# 15min' "行内注释原样渲染"
548
- # M49 回退:schema 不认识的键没有标签 → 行的主文本就是原始键(「不认识」徽章 + 提示行)。
549
- filter_to TEAM_HAND_ADDED
550
- cap_to unknown
551
- assert_match "$tmp/$current/unknown.txt" 'TEAM_HAND_ADDED +hand · 不认识' "schema 不认识的键回退显示原始键"
552
- assert_has "$tmp/$current/unknown.txt" "TEAM_HAND_ADDED:这个设置在文件里,工具不认识它" "未知键的提示行说清楚为什么没有标签"
553
- # The filter matches the label (M49), key or value; esc clears it without closing the view.
554
- filter_to 巡检周期
555
- cap_to filter-label
556
- assert_has "$tmp/$current/filter-label.txt" "巡检周期" "按标签搜到该行"
557
- assert_not "$tmp/$current/filter-label.txt" "模型并发上限" "按标签过滤掉不匹配的行"
558
- filter_to pulse
559
- cap_to filter
560
- assert_has "$tmp/$current/filter.txt" "巡检周期" "按原始键 pulse 仍能找到(行上仍是标签)"
561
- assert_not "$tmp/$current/filter.txt" "模型并发上限" "过滤掉不匹配的行"
503
+ stats="$(settings_window_stats "$tmp/$current/filter-fill.txt")"
504
+ read -r r u d gap <<<"$stats"
505
+ assert_eq "过滤短列表只一行" "$((r+u+d))" "1"
506
+ [ "$gap" -le 1 ] && ok "短列表空白在卡片里" || bad "短列表卡片未填高"
507
+ filter_to 检查间隔
508
+ cap_to label-filter
509
+ assert_has "$tmp/$current/label-filter.txt" "检查间隔" "标签可搜索"
510
+ filter_to EXAMPLE/ONE
511
+ cap_to value-filter
512
+ assert_has "$tmp/$current/value-filter.txt" "routine" "值搜索不区分大小写"
513
+ keys Escape
514
+ wait_row clear "Esc清过滤但不关闭设置" "› routine" "项目命令" || bad "Esc过滤返回错误"
515
+ # 两个入口都沿原位置返回;鼠标单击只聚焦,第二击才打开。
516
+ local y before
517
+ before="$(sha "$(cfg)")"
518
+ y="$(cap_now | grep -n '项目命令' | head -1 | cut -d: -f1)"
519
+ [ -n "$y" ] && click_at 8 "$y"
520
+ wait_row nav-focus "单击聚焦项目命令" "› 项目命令" || bad "入口未聚焦"
521
+ assert_eq "单击不改配置" "$(sha "$(cfg)")" "$before"
522
+ y="$(cap_now | grep -n '› 项目命令' | head -1 | cut -d: -f1)"
523
+ [ -n "$y" ] && click_at 8 "$y"
524
+ wait_row commands "第二击打开命令" "╭─ 项目命令" "验收命令" || bad "命令入口未打开"
525
+ cap_visible_to commands-count
526
+ stats="$(settings_window_stats "$tmp/$current/commands-count.txt")"
527
+ read -r r u d gap <<<"$stats"
528
+ assert_eq "项目命令只有3项" "$((r+u+d))" "3"
529
+ keys Escape
530
+ wait_row commands-back "命令返回原入口" "› 项目命令" "╭─ 项目设置" || bad "命令未返回"
531
+ open_secondary records
532
+ wait_row records "尚无记录保留事实" "尚无派单记录" || bad "记录原因未显示"
533
+ keys Escape
534
+ wait_row records-back "记录返回原入口" "› 模型记录" "╭─ 项目设置" || bad "记录未返回"
562
535
  filter_clear
563
- cap_to cleared
564
- assert_has "$tmp/$current/cleared.txt" "项目名" "esc 清过滤后全部行回来(回到未过滤列表的顶部)"
565
- assert_has "$tmp/$current/cleared.txt" "身份与账本布局" "清过滤后第一组标题也回来"
566
- assert_has "$tmp/$current/cleared.txt" "项目设置" "esc 没有关掉视图"
567
- # The focus window moves with the keys and counts what it hides at the top.
568
- local i
569
- for i in $(seq 1 40); do keys Down; sleep 0.02; done
570
- if wait_cap window "↑"; then ok "窗口顶部出现被隐藏的行数计数行"; else bad "窗口滚动后没有出现 ↑N 计数行"; fi
571
- assert_match "$tmp/$current/window.txt" '↑[0-9]+' "窗口顶部显示被隐藏的行数"
572
- # A click moves the focus to an unfocused row; the second click opens that row's editor. M49:行
573
- # 按**标签**认,原始键从第一次点击后的 CLI 提示行读(标签用来看,键用来敲)。
574
- # P30:视图开屏在只读骨架上,先过滤出**多条** apply 行(「上限」命中模型并发上限 / 席位内存上限 /
575
- # 详情文件读取上限…)——点击用例需要一条未聚焦的 apply 行。
576
- filter_to 上限
577
- cap_to click-set
578
- local target_line label keyname
579
- target_line="$(cap | grep -n '· 立即生效' | grep -v '›' | grep -v '命令行:' | head -1 | cut -d: -f1)"
580
- if [ -n "$target_line" ]; then
581
- label="$(cap | sed -n "${target_line}p" | sed 's/^│//' | sed -E 's/^ +//' | sed -E 's/ +.*//')"
582
- click_at 20 "$target_line"
583
- if wait_cap click "› $label"; then ok "第一次点击把光标放到那一行(按标签认行)"; else bad "第一次点击后光标没有落到那一行"; fi
584
- keyname="$(cap | grep -F 'team config set' | grep -oE 'TEAM_[A-Z0-9_]+' | head -1)"
585
- assert_has "$tmp/$current/click.txt" "team config set $keyname" "CLI 提示行跟着焦点换到该行的原始键"
586
- # The window may have scrolled with the focus: click the row the cursor is on now.
587
- target_line="$(cap | grep -n '› .*· 立即生效' | head -1 | cut -d: -f1)"
588
- [ -n "$target_line" ] && click_at 20 "$target_line"
589
- # M55:有选择集的键打开选择器(标题 `选择 … 的值 · KEY`),没有的仍是 compose 托盘。
590
- # M59: wait for THIS row's widget (tray or picker title) on a settled frame — the view can sit
591
- # settled *before* the editor paints (the row's data is re-read on open), so a settle-only
592
- # probe misjudges; the pre-M59 serial `wait_editor || wait_picker` burned two full budgets.
593
- local opened="" _probe_i c_probe
594
- for _probe_i in $(seq 1 24); do
595
- c_probe="$(cap)"
596
- # P127: here-strings, not `printf | grep -q` — the probe frame can outgrow the pipe buffer
597
- # and grep's early exit would SIGPIPE the printf writer (rc=141 → the open falsely unseen).
598
- if { grep -qF -- "╭─ $keyname" <<< "$c_probe" || grep -qF -- " · $keyname" <<< "$c_probe"; } \
599
- && pty_frame_settled "$c_probe"; then
600
- opened="$c_probe"; break
601
- fi
602
- sleep 0.3
603
- done
604
- [ -n "$opened" ] || opened="$c_probe"
605
- printf '%s\n' "$opened" > "$tmp/$current/click2.txt"
606
- if grep -qF "╭─ $keyname" "$tmp/$current/click2.txt"; then
607
- assert_has "$tmp/$current/click2.txt" "╭─ $keyname" "第二次点击打开该行的编辑器(compose 托盘,标题点名原始键)"
608
- elif grep -qF " · $keyname" "$tmp/$current/click2.txt"; then
609
- assert_has "$tmp/$current/click2.txt" " · $keyname" "第二次点击打开该行的编辑器(选择器,标题点名原始键)"
610
- else
611
- bad "第二次点击没有打开该行的编辑器"
612
- fi
613
- # M59: state-checked cleanup — whichever widget is on a settled frame gets the esc (at most one
614
- # sends; a widget that is not there gets no key, so the view can never be the esc's casualty).
615
- leave_editor "$keyname"
616
- leave_picker "$keyname"
617
- else
618
- cap | tail -5 >&2
619
- bad "窗口里没有找到可点击的 apply 行"
620
- fi
621
- # A refuse row opens no editor: the route is surfaced and the contract is untouched.
622
- local before; before="$(sha "$(cfg)")"
623
- filter_to TEAM_SESSION
624
- sleep 0.3
625
- if focus_row '会话名 +.*不可改'; then
626
- keys Enter
627
- else
628
- bad "没能把焦点移到 refuse 行"
629
- fi
630
- if wait_cap refuse-route "只能改项目配置文件"; then ok "refuse 行的回执点名普通路线(不是命令行黑话)"; else bad "refuse 行的回执没出现"; fi
631
- assert_eq "refuse 行没有写契约" "$(sha "$(cfg)")" "$before"
632
- # P144:磁盘底线的两行 —— 行主文本是标签(不是裸键),类徽章照旧。P266:夹具缝行已经**不在视图里**
633
- # (上面刚证过),它的读面与命令面由那里的断言守住。
634
- filter_to 临时根空间底线
635
- cap_to p144-mb
636
- assert_match "$tmp/$current/p144-mb.txt" '› 临时根空间底线 +未设 · 默认 1024 · 立即生效' \
637
- assert_not "$tmp/$current/p144-mb.txt" '临时根空间底线 +TEAM_' "P144:字节底线行主文本不是裸键"
638
- filter_to inode 底线
639
- if focus_row '临时根 inode 底线 +未设 · 默认 100000'; then :; else bad "P144:没能把焦点移到 inode 底线行"; fi
640
- cap_to p144-ino
641
- assert_match "$tmp/$current/p144-ino.txt" '› 临时根 inode 底线 +未设 · 默认 100000 · 立即生效' \
642
- # M59: the navigation esc is state-checked too — it fires only while the settings view is on a
643
- # settled frame, so a drifted scene gets a named red instead of a blind key.
644
- pty_key_when "esc 回浮层" '╭─ 项目设置' Escape || bad "esc 前设置视图已经不在屏幕上"
645
- # The origin is remembered (esc back to the overlay's navigation row). P68:等那一行本身在稳定帧上。
646
- wait_row overlay-back "esc 回到浮层且仍选中「项目设置」" '› 项目设置' \
647
- || bad "esc 之后浮层没有回到「项目设置」这一行"
648
- assert_has "$tmp/$current/overlay-back.txt" "项目设置" "esc 回到设置浮层"
649
- assert_match "$tmp/$current/overlay-back.txt" '› 项目设置' "回到浮层时仍选中那一行"
650
- # The current frame minus its last line (the status/receipt row, which may quote the key the user
651
- # just tried to edit): the overlay itself must list no contract key.
652
- cap_now | sed '$d' > "$tmp/$current/overlay-now.txt"
653
- assert_not "$tmp/$current/overlay-now.txt" "TEAM_" "当前这一帧的浮层没有契约的 TEAM_* 键"
536
+ # 隐藏值不因搜索而成为操作;完整CLI仍保留已有接口。
537
+ local k
538
+ for k in TEAM_PROJECT TEAM_TASK_MODELS TEAM_TMP_MIN_FREE_MB TEAM_TMP_MIN_FREE_INODES TEAM_DISK_STATS_FILE; do
539
+ filter_to "$k"; cap_to "excluded-$k"
540
+ assert_no_match "$tmp/$current/excluded-$k.txt" '^│ [› ] [^│]*[^[:space:]│]' "退出的键不会成为操作行($k)"
541
+ done
542
+ filter_clear
543
+ keys Escape
544
+ wait_row overlay-back "Esc返回原浮层入口" "› 项目设置" || bad "浮层焦点丢失"
654
545
  keys Enter
655
- pty_wait_frame - "q 用例的设置视图" '╭─ 项目设置' || bad "q 用例的设置视图没有打开"
656
- # `q` keeps its global meaning: the collapse path runs (the argv log is the observable).
657
- local q0; q0="$(wc -l < "$(argv_log)" 2>/dev/null || echo 0)"
546
+ pty_wait_frame - "再次打开设置" "╭─ 项目设置" || bad "设置未再打开"
658
547
  keys q
659
- if wait_argv q-collapse 'pulse collapse'; then ok "q 仍然触发全局的收起动作"; else bad "q 的收起动作没有进 argv 日志"; fi
660
- # The bundle carries no second key table (P22/B2): a scratch CLI whose schema gains TEAM_ZZZ_TEST
661
- # and whose TEAM_GATES class is refuse shows both through the same committed panel.js.
662
- local scratch="$tmp/$current/scratch"
663
- mkdir -p "$scratch/skills/teamsmith"
664
- cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
665
- cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
666
- python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYFIX'
667
- import sys
668
- p = sys.argv[1]
669
- s = open(p, encoding='utf-8').read()
670
- s = s.replace('TEAM_GATES|apply|cmd||plain||-|', 'TEAM_GATES|refuse|cmd||plain||-|改门禁要改项目配置文件(scratch 夹具)')
671
- anchor = 'TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'
672
- assert anchor in s, '找不到 TEAM_INSTALL_CMD 的 schema 行'
673
- s = s.replace(anchor, 'TEAM_ZZZ_TEST|apply|text||plain|zzz-default|-|||workflow\nTEAM_ZZZ_FIXTURE|refuse|path|file,opt|plain||-|fixture-only: 只在 scratch 夹具里用||policy\n' + anchor, 1)
674
- open(p, 'w', encoding='utf-8').write(s)
675
- PYFIX
676
- cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
677
- #!/usr/bin/env bash
678
- printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
679
- exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
680
- EOF2
681
- chmod +x "$tmp/$current-scratch-wrapper.sh"
682
- P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
683
- # The view opens on the overview: reach the overlay again (the panel was restarted).
548
+ wait_argv q-collapse "pulse collapse" && ok "q保留全局收起" || bad "q未收起"
549
+
550
+ # 真实未知键warning仍可达;不要求为该键造编辑行。
551
+ printf '\nTEAM_HAND_ADDED=hand\n' >> "$(cfg)"
552
+ start_panel
684
553
  open_view
685
- filter_to TEAM_ZZZ_TEST
686
- # P68:等那一行(值也在)出现在稳定帧上,不用固定 sleep 采样。
687
- wait_row scratch-key "scratch 视图里的 TEAM_ZZZ_TEST 行" 'TEAM_ZZZ_TEST' '未设 · 默认 zzz-default' \
688
- || bad "scratch CLI 新增的键行没等到(超过等待上限)"
689
- assert_match "$tmp/$current/scratch-key.txt" 'TEAM_ZZZ_TEST +未设 · 默认 zzz-default' "scratch CLI 新增的键出现在视图里(不重建 panel.js;无标签→回退裸键)"
690
- # P266(设计表 248):同一张 scratch schema 里再添一行**带标记**的新键 → 它不进渲染(隐藏规则读标记,
691
- # 不是 bundle 里写死的四个键名;这一行是 fixture 里从没出现过的名字)。
692
- filter_to TEAM_ZZZ_FIXTURE
693
- cap_to scratch-marked
694
- assert_not "$tmp/$current/scratch-marked.txt" "TEAM_ZZZ_FIXTURE" "P266:带 fixture-only 标记的新键被隐藏(规则是数据,不是名单)"
695
- filter_clear
696
- filter_to TEAM_GATES
697
- wait_row scratch-class "scratch 视图里的 TEAM_GATES 行(类改成不可改)" '门禁命令' 'true · 不可改' \
698
- || bad "scratch CLI 改过的类行没等到(超过等待上限)"
699
- assert_match "$tmp/$current/scratch-class.txt" '门禁命令 +true · 不可改' "scratch CLI 改过的类跟着变(bundle 没有第二张键表)"
700
- assert_has "$tmp/$current/scratch-class.txt" "这个值要改项目配置文件 .pi/team/config.sh" "scratch CLI 的 refuse 提示行仍是那句普通路线"
701
- if focus_row '门禁命令 +true · 不可改'; then keys Enter; else bad "P266:没能把焦点移到 scratch 的 refuse 行"; fi
702
- if wait_cap scratch-route "改门禁要改项目配置文件(scratch 夹具)"; then
703
- ok "P266:scratch CLI 自己写的备注原样上屏(路线不是写死的)"
704
- else
705
- bad "P266:scratch CLI 的备注没有上屏"
706
- fi
707
- # P266 红侧(数据驱动):把 scratch 树里夹具键的声明标记删掉 → 那一行回到视图;还原 → 又消失。
708
- local marker_red_cfg
709
- marker_red_cfg="$scratch/skills/teamsmith/scripts/lib/cmd-config.sh"
710
- python3 - "$marker_red_cfg" <<'PYFIX'
554
+ filter_to TEAM_HAND_ADDED
555
+ wait_row unknown-warning "退出行不隐藏真实warning" "不是已知的项目设置" || bad "未知键warning未显示"
556
+ cap_to unknown
557
+ assert_has "$tmp/$current/unknown.txt" "只能改项目配置文件" "未知键完整修复路线仍可达"
558
+ assert_no_match "$tmp/$current/unknown.txt" '^│ [› ] TEAM_HAND_ADDED +hand' "未知键不是配置行"
559
+ # 长列表用实际类别而非恢复全表;每个高度只观察同一列表。
560
+ local map='routine=example/one' i h want_count prev_rows
561
+ for i in $(seq 1 60); do map="$map cat$i=example/model$i"; done
562
+ policy_new "$map" 'example/pm' || bad "长类别准备失败"
563
+ python3 - "$(cfg)" <<'PYCFG'
711
564
  import sys
712
- p = sys.argv[1]
713
- s = open(p, encoding='utf-8').read()
714
- mark = 'fixture-only: 只在测试套件里用(磁盘读数夹具)'
715
- assert mark in s, '找不到夹具键的声明标记'
716
- s = s.replace('|' + mark + '||policy', '|||policy', 1)
717
- open(p, 'w', encoding='utf-8').write(s)
718
- PYFIX
719
- P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
720
- open_view
721
- filter_to 磁盘读数夹具
722
- wait_row p266-marker-red "标记删掉后夹具键回到视图" '磁盘读数夹具' '不可改' \
723
- || bad "P266 红侧:删掉声明标记后那一行没有回到视图"
724
- assert_match "$tmp/$current/p266-marker-red.txt" '磁盘读数夹具 +.*不可改' "P266 红侧:行回来了(隐藏跟着读侧的数据走)"
725
- cp -a "$skill/scripts/lib/cmd-config.sh" "$marker_red_cfg"
726
- P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
727
- open_view
728
- filter_to 磁盘读数夹具
729
- cap_to p266-marker-green
730
- assert_not "$tmp/$current/p266-marker-green.txt" "磁盘读数夹具" "P266 还原:标记加回后那一行再次消失"
731
- # M49:另一种语言的人话标签(同一张表切换,标签不是渲染时的硬编码)。
732
- conf_set "lang=en" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
733
- start_panel
734
- open_view 'Identity & ledger layout'
735
- filter_to TEAM_PULSE_INTERVAL
736
- cap_to en
737
- assert_match "$tmp/$current/en.txt" '› Patrol interval' "en 行的人话标签(行不是裸键)"
738
- assert_has "$tmp/$current/en.txt" "CLI: team config set TEAM_PULSE_INTERVAL <value>" "en 的 CLI 提示行同样点名原始键"
739
- # P266:两种语言的样张都要能给评审直接读(报告里贴的就是这些帧):走到尾部,两个块标题 + 席位原因。
740
- filter_clear
741
- sleep 0.4
742
- walk_to_tail en-tail
743
- assert_has "$tmp/$current/en-tail.txt" "The model the next task will use" "en 的类别块标题(下一次派任务会用的模型)"
744
- assert_has "$tmp/$current/en-tail.txt" "The model running tasks actually use" "en 的席位块标题(正在运行的任务实际使用的模型)"
745
- assert_has "$tmp/$current/en-tail.txt" "this seat has not been given a task yet" "en 的「这个席位还没有派过任务」(席位没有记录)"
746
-
747
- # ── P32:视图用满窗口高度(用户实测 45 行里 16 行空白)+ 行数记账诚实 ──
748
- # 同一条契约、同一个面板,只改 pane 行高:① 内容结尾(卡片下边框)到键栏的空白 ≤1 行;
749
- # ② 画出的行数随行高长(45 vs 30 的差 ≥8);③ rows + ↑N + ↓N 恰好等于命令报的键+席位总数
750
- # (窗口的计数行必须与窗口实际画出的行数一致 —— P30/D5 的成本模型曾经按「带注释的行占两行」
751
- # 记账,虚报了 15 行,那 15 行就是用户看到的空白)。
752
- conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
753
- unset P21_CLI
565
+ p=sys.argv[1]; s=open(p).read(); s='\n'.join(l for l in s.split('\n') if not l.startswith('TEAM_HAND_ADDED='))
566
+ open(p,'w').write(s)
567
+ PYCFG
754
568
  start_panel
755
569
  open_view
756
- local want_count
757
- # P266:视图里的行 = schema 键(减去被声明为 fixture-only 的键)+ 类别 + 席位 + PM 启动记录。
758
- want_count="$( (cd "$ROOT" && bash "$skill/scripts/team" config list --json) \
759
- | python3 -c 'import json,sys; d=json.load(sys.stdin); m=d.get("models",{}); keys=[k for k in d["keys"] if not str(k.get("route","")).startswith("fixture-only: ")]; print(len(keys) + len(m.get("policy",{}).get("categories",[])) + len(m.get("assignments",[])) + (1 if m.get("pm_launch") else 0))' )"
760
- [ "${want_count:-0}" -gt 0 ] || bad "读数拿不到键数(前提不成立)"
761
- local h s rows up down gap prev_rows=""
570
+ want_count=68
762
571
  for h in 45 33 30 25; do
763
- if resize_panel 120 "$h"; then
764
- if wait_settings_frame "$h" "height$h"; then
765
- s="$(settings_window_stats "$tmp/$current/height$h.txt")"
766
- IFS=' ' read -r rows up down gap <<<"$s"
767
- # ① 内容结束到键栏的空白 ≤1 行(P32 前:45 行里 16 行)
768
- if [ "$gap" -le 1 ]; then ok "${h} 行:内容结尾到键栏只剩 $gap 行空白(≤1)"; else bad "${h} 行:内容结尾到键栏还有 $gap 行空白"; fi
769
- # ③ 记账诚实:窗口画出的行 + 两条计数 = 命令报的总行数
770
- assert_eq "${h} 行:rows($rows) + ↑($up) + ↓($down) = 命令报的键+类别+派单记录($want_count)" \
771
- "$((rows + up + down))" "$want_count"
772
- case "$h" in
773
- 45) prev_rows="$rows" ;;
774
- 30) if [ -n "$prev_rows" ] && [ "$((prev_rows - rows))" -ge 8 ]; then
775
- ok "窗口随行高长:45 行 $prev_rows → 30 行 $rows(差 $((prev_rows - rows)) ≥ 8)"
776
- else
777
- bad "窗口没有随行高长:45 行 $prev_rows → 30 行 $rows"
778
- fi ;;
779
- esac
780
- else
781
- cap_visible_to "height$h-fail"
782
- bad "缩到 120×${h} 之后没有画出完整的设置视图帧($(settings_window_stats "$tmp/$current/height$h-fail.txt"))"
572
+ resize_panel 120 "$h" || bad "resize失败"
573
+ if wait_settings_frame "$h" "height$h"; then
574
+ stats="$(settings_window_stats "$tmp/$current/height$h.txt")"; read -r r u d gap <<<"$stats"
575
+ assert_eq "$h行:可见+上下隐藏=当前68操作" "$((r+u+d))" "$want_count"
576
+ [ "$gap" -le 1 ] && ok "$h行卡片填高" || bad "$h行卡片未填高"
577
+ [ "$h" = 45 ] && prev_rows="$r"
578
+ if [ "$h" = 30 ]; then
579
+ [ "$((prev_rows-r))" -ge 8 ] && ok "45比30至少多8行" || bad "窗口没有随高度增长"
783
580
  fi
784
- else
785
- bad "pane 缩到 120×${h} 没有生效"
786
- fi
581
+ else bad "$h行完整设置帧未落定"; fi
787
582
  done
788
- resize_panel 160 40 || true
583
+ # 同批英文窄屏:只走入口与返回,不重复整套。
584
+ conf_set "lang=en" "page=1" "activity=1" "mouse=1" "density=comfortable"
585
+ start_panel
586
+ resize_panel 70 25 || bad "英文窄屏resize失败"
587
+ open_view Models
588
+ filter_to 'Project commands'; keys Enter
589
+ wait_row en-commands "英文命令入口" "╭─ Project commands" "Acceptance command" || bad "英文命令入口失败"
590
+ keys Escape
591
+ wait_row en-back "英文入口返回" "Project settings" "Project commands" || bad "英文返回失败"
592
+ filter_to 'Model records'; keys Enter
593
+ wait_row en-records "英文记录入口" "╭─ Model records" "No dispatch record" || bad "英文记录入口失败"
594
+ keys Escape
595
+ wait_row en-records-back "英文记录返回" "Project settings" "Model records" || bad "英文记录返回失败"
789
596
  }
790
597
 
791
598
  scn_choices() {
792
- section "choices · 选择器(M55 的选项 + M65 的直写:一次 accept = 校验+写入 / 交互路径零读取 / 危险值一次确认 / 只有自由输入进编辑器)"
793
- local agents="dev verify" i
794
- for i in $(seq 2 28); do agents="$agents dev$i"; done
795
- server_up choices "$agents"
796
- python3 - "$(cfg)" <<'PY'
797
- import re, sys
798
- p = sys.argv[1]
799
- s = open(p, encoding='utf-8').read()
800
- # 未设的 bool(默认 1)/ seconds(默认 300)/ 数值(默认 900):删掉模板里的行,让前提真的成立。
801
- s = re.sub(r'^TEAM_NOTIFY_TMUX=.*\n?', '', s, flags=re.M)
802
- s = re.sub(r'^TEAM_DEFER_TTL=.*\n?', '', s, flags=re.M)
803
- s = re.sub(r'^TEAM_PULSE_INTERVAL=.*\n?', '', s, flags=re.M)
804
- # path exec,opt 指向一个不存在的文件:存在性标记要看得见。
805
- s = re.sub(r'^TEAM_AGENT_BIN=.*$', 'TEAM_AGENT_BIN="/nonexistent/m55-agent"', s, count=1, flags=re.M)
806
- # 危险值当「当前」选项:M65 的危险例外必须对来自选项的值同样生效(第一次 accept 只警告、不写)。
807
- s = re.sub(r'^TEAM_MIN_FREE_SWAP_MB=.*$', 'TEAM_MIN_FREE_SWAP_MB="0"', s, count=1, flags=re.M)
808
- open(p, 'w', encoding='utf-8').write(s)
809
- PY
810
- # 长词表:28 个类别(每类别一个模型)+ 独立 PM → known 变长,滚轮用例的条目列表会超出可视预算
811
- # (不需要改 pane 几何)。P232:词汇表现在来自项目自己的类别策略,席位记录是**已提交派单**、
812
- # 不完整的记录不贡献任何模型。
813
- local map="routine=provider/m0 analysis=provider/m1"
814
- for i in $(seq 2 27); do map="$map cat$i=provider/m$i"; done
815
- policy_new "$map" 'provider/pm' || bad "策略升级事务没有跑通(见 $tmp/$current-upgrade.log)"
816
- conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
817
- # R2 的机器目录夹具:scratch HOME 里放一个含 sub2api(已下线的 provider)与 openrouter 的 Pi 模型
818
- # 目录 —— 读与选择器都不许出现它们(真实的 models-store.json 是活缓存,绝不能被当成选项来源)。
599
+ section "choices · 原选择保存/取消/范围/危险/响应性与模型数量字段草稿"
600
+ server_up choices
601
+ local map='routine=example/m0 analysis=example/m1' i
602
+ for i in $(seq 2 28); do map="$map cat$i=example/m$i"; done
603
+ policy_new "$map" 'example/pm' || bad "策略准备失败"
604
+ python3 - "$(cfg)" <<'PYCFG'
605
+ import re,sys
606
+ p=sys.argv[1]; s=open(p).read()
607
+ s=re.sub(r'^TEAM_UPDATE_CHECK=.*\n?', '', s, flags=re.M)
608
+ s=re.sub(r'^TEAM_PULSE_INTERVAL=.*\n?', '', s, flags=re.M)
609
+ s=re.sub(r'^TEAM_REVIEW_TIMEOUT=.*$', 'TEAM_REVIEW_TIMEOUT=30', s, flags=re.M)
610
+ s=re.sub(r'^TEAM_MODEL_LIMITS=.*$', "TEAM_MODEL_LIMITS='example/m0=2 example/*=1 example/m0=4'", s, flags=re.M)
611
+ open(p,'w').write(s)
612
+ PYCFG
819
613
  local home="$tmp/$current-home"
820
614
  mkdir -p "$home/.pi/agent"
821
- cat > "$home/.pi/agent/models-store.json" <<'JSON'
822
- { "sub2api": { "models": { "gpt-5.6-luna": { "name": "gpt-5.6-luna", "baseUrl": "http://127.0.0.1:8080/v1" } } },
823
- "openrouter": { "models": { "anthropic/claude-x": { "name": "claude-x" } } } }
824
- JSON
825
- # M65/D11:读取窗口的判据是「按键与帧之间没有读取」。后台节拍(activity 块 3s TTL)会无关地
826
- # spawn `__panel-data` —— 本段的面板跑在 P21_REFRESH=3600 下(`--refresh` 才是 panel 自己的刷新
827
- # 区间;`--interval` 是 `team monitor` 的旗标,panel 忽略它),窗口里出现的任何子进程都是这次
828
- # 交互因果产生的。
615
+ printf '%s\n' '{"machine-only":{"models":{"unrelated":{}}}}' > "$home/.pi/agent/models-store.json"
829
616
  P21_REFRESH=3600 P21_HOME="$home" start_panel
830
617
  open_view
831
- local gap0 acc0
832
-
833
- # ── (1) bool:两个带标签的条目;一次 accept = 校验 + 直写(无确认帧、无编辑器) ──
834
- filter_to TEAM_NOTIFY_TMUX
835
- # P68:断言那一行本身之前先等数据态(未设 bool 行 + 它的默认值)落定。
836
- wait_row bool-row "未设 bool 行显示「未设 · 默认 1」" '走 tmux 投递' '未设 · 默认 1' \
837
- || bad "未设的 bool 行没等到显示默认值"
838
- assert_match "$tmp/$current/bool-row.txt" '走 tmux 投递 +未设 · 默认 1' "未设的 bool 行显示 未设 · 默认 1"
839
- gap0="$(argv_count)"
618
+ filter_to TEAM_UPDATE_CHECK
619
+ wait_row bool-row "bool默认有效值" "启动时检查新版本" "开" || bad "bool未落定"
620
+ local gap0 before audit0
621
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"; gap0="$(argv_count)"
840
622
  keys Enter
841
- wait_picker TEAM_NOTIFY_TMUX '› 保持未设' || bad "bool 的选择器没有打开"
842
- argv_since "$gap0" "$tmp/$current/gap-open.log"
843
- local gap_reads gap_total
844
- gap_reads="$(argv_reads "$tmp/$current/gap-open.log")"; [ -n "$gap_reads" ] || gap_reads=0
845
- gap_total="$(wc -l < "$tmp/$current/gap-open.log")"
846
- if [ "$gap_reads" = "0" ] && [ "$gap_total" = "0" ]; then
847
- ok "打开选择器:按键→帧之间零读取、零子进程(编辑器只用屏幕上的 settings 块)"
848
- else
849
- bad "打开选择器:按键→帧之间零读取、零子进程(读=$gap_reads 总=$gap_total):$(head -3 "$tmp/$current/gap-open.log" 2>/dev/null | tr '\n' ';')"
850
- fi
623
+ wait_picker TEAM_UPDATE_CHECK "› 保持默认值" || bad "bool选择器未打开"
624
+ argv_since "$gap0" "$tmp/$current/open.log"
625
+ assert_eq "打开选择器零读取零子进程" "$(wc -l < "$tmp/$current/open.log")" "0"
851
626
  cap_to bool
852
- assert_match "$tmp/$current/bool.txt" '› 保持未设' "未设键的首个条目是保持未设(并且是焦点)"
853
- assert_has "$tmp/$current/bool.txt" "(1) · 默认" "1 是默认条目,带表里的 on 词"
854
- assert_has "$tmp/$current/bool.txt" "(0)" "0 是另一个条目,带表里的 off 词"
855
- assert_not "$tmp/$current/bool.txt" "…(自由输入)" "bool 是封闭域:没有自由输入项"
856
- local bool_sha bool_audit
857
- bool_sha="$(sha "$(cfg)")"; bool_audit="$(audit_lines)"
858
- acc0="$(argv_count)"
859
- pick_option '关(0)' || bad "bool 选择器里没有 关(0)"
860
- if wait_cap bool-written "已写入 TEAM_NOTIFY_TMUX = 0"; then ok "bool 选项在一次 accept 上写入(直写)"; else bad "bool 的直写回执没出现"; fi
861
- cap_to bool-written
862
- assert_not "$tmp/$current/bool-written.txt" "确认:" "直写没有确认帧"
863
- assert_not "$tmp/$current/bool-written.txt" "╭─ TEAM_NOTIFY_TMUX" "直写没有打开编辑器"
864
- assert_not "$tmp/$current/bool-written.txt" " · TEAM_NOTIFY_TMUX" "直写之后选择器已关闭"
865
- assert_match "$(cfg)" "^TEAM_NOTIFY_TMUX=.0.\$" "契约里落了规范值 0"
866
- assert_eq "直写让审计长一行" "$(audit_lines)" "$((bool_audit + 1))"
867
- argv_since "$acc0" "$tmp/$current/bool-argv.log"
868
- assert_eq "accept 的第 1 个子进程是 --dry-run(校验)" "$(sed -n '1p' "$tmp/$current/bool-argv.log" | grep -c -- '--dry-run')" "1"
869
- assert_eq "accept 的第 2 个子进程是 --yes 写入" "$(sed -n '2p' "$tmp/$current/bool-argv.log" | grep -c -- '--yes')" "1"
870
- assert_eq "accept 之前没有读子进程(第 1 行不是 config list/__panel-data)" "$(sed -n '1p' "$tmp/$current/bool-argv.log" | grep -cE 'config list|__panel-data' || true)" "0"
871
- local accept_tail
872
- accept_tail="$(tail -n +3 "$tmp/$current/bool-argv.log" 2>/dev/null | grep -v -- '__panel-data --block settings' || true)"
873
- if [ -z "$accept_tail" ]; then
874
- ok "accept 之后只剩 settings 块的 settle 重读(没有别的块、没有第二次写)"
875
- else
876
- bad "accept 之后还有别的子进程:$(printf '%s' "$accept_tail" | head -3 | tr '\n' ';')"
877
- fi
878
- filter_to TEAM_NOTIFY_TMUX
879
- # P68:等那一行真的显示刚写下的规范值(accept 后的 settle 重读落定),再按 Enter ——
880
- # 选择器是一次成形的快照(D43),不等读就会从旧块开(CI 那三条红就是这个形状)。
881
- wait_row bool-set-row "写入后的 bool 行显示新值 0" '走 tmux 投递' '0 · 立即生效' \
882
- || bad "写入后的设置行没等到显示新值"
883
- keys Enter
884
- wait_picker TEAM_NOTIFY_TMUX '关(0) · 当前' || bad "bool 选择器第二次没有打开"
885
- cap_to bool-set
886
- assert_has "$tmp/$current/bool-set.txt" "关(0) · 当前" "已设的 bool 把文件里的值标成当前"
887
- assert_has "$tmp/$current/bool-set.txt" "开(1) · 默认" "默认标记移到 1 上"
888
- assert_not "$tmp/$current/bool-set.txt" "保持未设" "已设的键没有保持未设条目"
889
- leave_picker TEAM_NOTIFY_TMUX
890
- # 非规范拼写(手改出来的 true):当前条目原样显示,不许被贴成「关(0)」(命令写入时才 canonical 化)。
891
- python3 - "$(cfg)" <<'PY2'
892
- import re, sys
893
- p = sys.argv[1]
894
- s = open(p, encoding='utf-8').read()
895
- s = re.sub(r'^TEAM_NOTIFY_TMUX=.*$', 'TEAM_NOTIFY_TMUX=true', s, count=1, flags=re.M)
896
- open(p, 'w', encoding='utf-8').write(s)
897
- PY2
898
- # 手改之后要用视图自己的读取把它读进来(M65/D11:进入视图是视图自己的读取;交互路径没有读取)
899
- reopen_view
900
- filter_to TEAM_NOTIFY_TMUX
901
- # P68(本变更的主目标):等那一行**本身**显示手改后的值(视图打开时那次强制读落定)再按 Enter。
902
- # 等待名把被等的状态写清楚;耗尽时引擎打一行 `等待超时:数据态:…(缺 [走 tmux 投递 true · 立即生效])`,
903
- # 骨架标记(分组标题)与固定 sleep 都不再是证据。
904
- wait_row bool-spelling-row "设置行显示手改后的值 true" '走 tmux 投递' 'true · 立即生效' \
905
- || bad "手改后的设置行没等到显示新值"
627
+ assert_has "$tmp/$current/bool.txt" "开 · 默认" "bool默认标记"
628
+ assert_has "$tmp/$current/bool.txt" "关" "bool另一规范值"
629
+ assert_not "$tmp/$current/bool.txt" "输入其它值" "bool不提供自由输入"
906
630
  keys Enter
907
- wait_picker TEAM_NOTIFY_TMUX 'true · 当前' || bad "非规范 bool 的选择器没有打开"
908
- cap_to bool-spelling
909
- assert_has "$tmp/$current/bool-spelling.txt" "true · 当前" "非规范拼写的手改值原样显示成当前条目"
910
- assert_not "$tmp/$current/bool-spelling.txt" "关(0) · 当前" "非规范拼写不许被贴成规范值的标签"
911
- assert_has "$tmp/$current/bool-spelling.txt" "开(1) · 默认" "规范默认值仍在"
912
- leave_picker TEAM_NOTIFY_TMUX
913
-
914
- # ── (2) enum:只给 constraints 里的取值,原序;接受即写(直写,restart 回执说明时机) ──
915
- filter_to TEAM_MONITOR_UI
916
- sleep 0.5
917
- keys Enter
918
- wait_picker TEAM_MONITOR_UI 'auto · 默认' || bad "enum 的选择器没有打开"
919
- cap_to enum
920
- assert_match "$tmp/$current/enum.txt" '› 保持未设' "未设的 enum 也以保持未设开头"
921
- assert_has "$tmp/$current/enum.txt" "auto · 默认" "默认标记在 auto 上"
922
- assert_has "$tmp/$current/enum.txt" "tui" "enum 给出 constraints 里的 tui"
923
- assert_has "$tmp/$current/enum.txt" "text" "enum 给出 constraints 里的 text"
924
- assert_not "$tmp/$current/enum.txt" "…(自由输入)" "enum 是封闭域:没有自由输入项"
925
- local enum_sha enum_audit
926
- enum_sha="$(sha "$(cfg)")"; enum_audit="$(audit_lines)"
927
- pick_option 'tui' || bad "enum 选择器里没有 tui"
928
- if wait_cap enum-written "已写入 TEAM_MONITOR_UI = tui"; then ok "enum 选项在一次 accept 上写入(直写)"; else bad "enum 的直写回执没出现"; fi
929
- cap_to enum-written
930
- assert_has "$tmp/$current/enum-written.txt" "需要重启才生效" "restart 类的回执说明重启时机"
931
- assert_not "$tmp/$current/enum-written.txt" "确认:" "enum 直写没有确认帧"
932
- assert_not "$tmp/$current/enum-written.txt" "╭─ TEAM_MONITOR_UI" "enum 直写没有编辑器"
933
- assert_eq "enum 一次 accept 只审计一行" "$(audit_lines)" "$((enum_audit + 1))"
934
- assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI tui --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 --dry-run"
935
- assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI tui --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了 --yes + 指纹"
936
-
937
- # ── (3) 未设键:编辑器开在「保持未设」上,接受 = 取消(不写、不留审计、不留临时文件);再接受 300 = 直写 ──
938
- filter_to TEAM_DEFER_TTL
939
- wait_row defer-row "未设 seconds 行显示「未设 · 默认 300」" '排队过期时间' '未设 · 默认 300' \
940
- || bad "未设键的行没等到显示默认值"
941
- assert_match "$tmp/$current/defer-row.txt" '排队过期时间 +未设 · 默认 300' "未设键的行显示 未设 · 默认 300"
942
- local defer_sha defer_audit
943
- defer_sha="$(sha "$(cfg)")"; defer_audit="$(audit_lines)"
631
+ wait_row keep-default "保持默认只取消" "╭─ 项目设置" "启动时检查新版本" || bad "保持默认未返回"
632
+ assert_eq "保持默认配置不变" "$(sha "$(cfg)")" "$before"
633
+ assert_eq "保持默认不增审计" "$(audit_lines)" "$audit0"
634
+ assert_eq "保持默认没有临时文件" "$(find "$ROOT/.pi/team" -name 'config.sh.tmp.*' | wc -l)" "0"
944
635
  keys Enter
945
- wait_picker TEAM_DEFER_TTL '› 保持未设' || bad "未设键的选择器没有打开"
946
- cap_to defer
947
- assert_match "$tmp/$current/defer.txt" '› 保持未设' "未设键的编辑器开在保持未设上"
636
+ wait_picker TEAM_UPDATE_CHECK "关" || bad "第二次bool未打开"
637
+ gap0="$(argv_count)"
638
+ pick_option 关 || bad "找不到关"
639
+ wait_cap bool-written "已保存启动时检查新版本" || bad "bool直写没有回执"
640
+ assert_match "$(cfg)" "^TEAM_UPDATE_CHECK=.0.$" "bool落规范0"
641
+ assert_eq "一次accept审计一行" "$(audit_lines)" "$((audit0+1))"
642
+ argv_since "$gap0" "$tmp/$current/accept.log"
643
+ assert_match "$tmp/$current/accept.log" 'config set TEAM_UPDATE_CHECK 0 --actor panel --dry-run --fingerprint [0-9a-f]{64}' "dry-run带actor和原指纹"
644
+ assert_match "$tmp/$current/accept.log" 'config set TEAM_UPDATE_CHECK 0 --actor panel --yes --fingerprint [0-9a-f]{64}' "直写带actor和原指纹"
645
+ assert_not "$tmp/$current/bool-written.txt" "原值" "普通选择不多一轮确认"
646
+ wait_row bool-new "后台读回规范0" "启动时检查新版本" "关" || bad "bool没有读回"
948
647
  keys Enter
949
- # M59: conditional — 保持未设 accepts = the picker closes with no editor; wait for BOTH the tray
950
- # and the picker title to be absent on a settled frame, instead of a fixed sleep.
951
- pty_wait_frame "$tmp/$current/defer-cancel.txt" "保持未设接受(无编辑器无选择器)" '!╭─ TEAM_DEFER_TTL' '! · TEAM_DEFER_TTL' \
952
- || bad "保持未设没有干净地回到行列表"
953
- assert_not "$tmp/$current/defer-cancel.txt" "╭─ TEAM_DEFER_TTL" "保持未设不打开写编辑器"
954
- assert_not "$tmp/$current/defer-cancel.txt" " · TEAM_DEFER_TTL" "保持未设关掉了选择器(回到行列表)"
955
- assert_eq "保持未设后契约不变" "$(sha "$(cfg)")" "$defer_sha"
956
- assert_eq "保持未设后审计不增长" "$(audit_lines)" "$defer_audit"
957
- assert_eq "保持未设后没有临时文件" "$(ls "$ROOT/.pi/team/"config.sh.tmp.* 2>/dev/null | wc -l)" "0"
958
- # 再开一次:接受「300」这一项 → 一次 accept 直写(M65/D10;视图不说这是 unset)
959
- filter_to TEAM_DEFER_TTL
960
- sleep 0.5
648
+ wait_picker TEAM_UPDATE_CHECK "关 · 当前" || bad "bool当前标记错误"
649
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"
650
+ local y
651
+ y="$(cap_now | grep -n '开 · 默认' | head -1 | cut -d: -f1)"
652
+ [ -n "$y" ] && click_at 5 "$y"
653
+ wait_row click-first "单击选择" "› 开" || bad "单击未选择"
654
+ assert_eq "单击未写" "$(sha "$(cfg)")" "$before"
655
+ y="$(cap_now | grep -n '› 开' | head -1 | cut -d: -f1)"
656
+ [ -n "$y" ] && click_at 5 "$y"
657
+ wait_cap click-written "已保存启动时检查新版本" || bad "二击未直写"
658
+ assert_eq "二击只增一次审计" "$(audit_lines)" "$((audit0+1))"
659
+ wait_row bool-one "bool读回1" "启动时检查新版本" "开" || bad "bool读回失败"
660
+ keys Enter; wait_picker TEAM_UPDATE_CHECK "开 · 当前" || bad "取消picker未打开"
661
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"; gap0="$(argv_count)"
662
+ leave_picker TEAM_UPDATE_CHECK || bad "picker取消失败"
663
+ assert_eq "取消不写" "$(sha "$(cfg)")" "$before"
664
+ assert_eq "取消不增审计" "$(audit_lines)" "$audit0"
665
+ argv_since "$gap0" "$tmp/$current/cancel.log"
666
+ assert_not "$tmp/$current/cancel.log" "config set" "取消不调用writer"
667
+ PTY_TRACE=1 pty_cleanup_esc "已关闭的选择器" "╭─ 启动时检查新版本" > "$tmp/$current/cleanup-trace.txt" 2>&1
668
+ assert_has "$tmp/$current/cleanup-trace.txt" "action=none" "已关闭选择器清理不发Esc"
669
+ assert_has "$tmp/$current/cleanup-trace.txt" "reason=not-settled" "清理依据稳定帧而非等待上限"
670
+ cap_to cleanup
671
+ assert_has "$tmp/$current/cleanup.txt" "╭─ 项目设置" "清理未穿透设置"
961
672
  keys Enter
962
- wait_picker TEAM_DEFER_TTL '› 保持未设' || bad "未设键的选择器第二次没有打开"
963
- pick_option '300' || bad "未设键的选择器里没有 300 项"
964
- if wait_cap defer-written "已写入 TEAM_DEFER_TTL = 300"; then
965
- ok "未设键选默认值 = 一次 accept 直写(视图没有把这次写入说成 unset)"
966
- else
967
- bad "未设键选默认值的直写回执没出现"
968
- fi
969
- cap_to defer-written
970
- assert_not "$tmp/$current/defer-written.txt" "确认:" "未设键直写没有确认帧"
971
- assert_not "$tmp/$current/defer-written.txt" "╭─ TEAM_DEFER_TTL" "未设键直写没有编辑器"
972
- assert_match "$(cfg)" "^TEAM_DEFER_TTL=.300.\$" "契约里显式写上 300"
973
- assert_eq "未设键直写审计长一行" "$(audit_lines)" "$((defer_audit + 1))"
673
+ PTY_TRACE=1 wait_picker TEAM_UPDATE_CHECK '开 · 当前' > "$tmp/$current/wait-trace.txt" 2>&1 || bad "正常trace选择器未打开"
674
+ assert_match "$tmp/$current/wait-trace.txt" 'wait picker TEAM_UPDATE_CHECK rounds=[0-9]+ settled=1' "正常等待放行仍来自稳定帧"
675
+ leave_picker TEAM_UPDATE_CHECK || bad "正常trace选择器未关闭"
974
676
 
975
- # ── (4) 数值键:区间 + 建议值 + 自由输入(唯一进编辑器的路径);非法值被拒且保留草稿;建议值直写 ──
976
- filter_to TEAM_PULSE_INTERVAL
977
- sleep 0.5
978
- keys Enter
979
- wait_picker TEAM_PULSE_INTERVAL '› 保持未设' || bad "数值键的选择器没有打开"
677
+ filter_to TEAM_PULSE_INTERVAL; keys Enter
678
+ wait_picker TEAM_PULSE_INTERVAL "保持默认值" || bad "数值未打开"
980
679
  cap_to numeric
981
- assert_has "$tmp/$current/numeric.txt" "60–∞" "数值键显示命令给的接受区间(上界空 = 无界)"
982
- assert_match "$tmp/$current/numeric.txt" '› 保持未设' "未设的数值键也以保持未设开头"
983
- assert_has "$tmp/$current/numeric.txt" "900 · 默认" "建议值里的默认值带默认标记"
984
- assert_has "$tmp/$current/numeric.txt" "1800" "建议值原样给出"
985
- assert_has "$tmp/$current/numeric.txt" "…(自由输入)" "数值键有自由输入项"
986
- local num_sha num_audit
987
- num_sha="$(sha "$(cfg)")"; num_audit="$(audit_lines)"
988
- pick_option '自由输入' || bad "数值选择器里没有自由输入项"
989
- wait_editor TEAM_PULSE_INTERVAL || bad "数值自由输入没有打开写编辑器"
990
- keys C-u; sleep 0.3
991
- type_text "30"; sleep 0.4
992
- keys Enter
993
- if wait_cap numeric-invalid "最小 60"; then ok "越界的数值被命令拒绝并点名最小 60"; else bad "越界数值的拒绝没出现"; fi
994
- assert_eq "被拒后契约不变" "$(sha "$(cfg)")" "$num_sha"
995
- cap_has "TEAM_PULSE_INTERVAL" numeric-draft
996
- leave_editor TEAM_PULSE_INTERVAL
997
- # 4b)建议值也是值条目:一次 accept 直写,不进编辑器(M65/D10)
998
- filter_to TEAM_PULSE_INTERVAL
999
- sleep 0.5
1000
- keys Enter
1001
- wait_picker TEAM_PULSE_INTERVAL '› 保持未设' || bad "数值键的选择器第二次没有打开"
1002
- pick_option '1800' || bad "数值选择器里没有 1800"
1003
- if wait_cap num-written "已写入 TEAM_PULSE_INTERVAL = 1800"; then ok "建议值条目一次 accept 直写"; else bad "建议值条目的直写回执没出现"; fi
1004
- cap_to num-written
1005
- assert_not "$tmp/$current/num-written.txt" "确认:" "建议值直写没有确认帧"
1006
- assert_not "$tmp/$current/num-written.txt" "╭─ TEAM_PULSE_INTERVAL" "建议值直写没有编辑器"
1007
- assert_eq "建议值直写审计长一行" "$(audit_lines)" "$((num_audit + 1))"
1008
-
1009
- # ── (5) path:存在性标记 / 只有命令接受空值时才给清空项 / 清空也是直写 / 自由输入的确认行重复标记 ──
1010
- filter_to TEAM_AGENT_BIN
1011
- sleep 0.5
1012
- keys Enter
1013
- wait_picker TEAM_AGENT_BIN 'nonexistent/m55-agent' || bad "path 选择器没有打开"
1014
- cap_to path
1015
- assert_match "$tmp/$current/path.txt" '/nonexistent/m55-agent · 当前 · 不存在' "path 当前值带着缺失标记"
1016
- assert_has "$tmp/$current/path.txt" "清空(写入空值)" "exec,opt 的 path 给出清空项"
1017
- assert_has "$tmp/$current/path.txt" "…(自由输入)" "path 给出自由输入项"
1018
- local path_audit
1019
- path_audit="$(audit_lines)"
1020
- pick_option '清空(写入空值)' || bad "path 选择器里没有清空项"
1021
- if wait_cap path-cleared "已写入 TEAM_AGENT_BIN"; then ok "清空项也是一次 accept 直写"; else bad "清空项的直写回执没出现"; fi
1022
- cap_to path-cleared
1023
- assert_not "$tmp/$current/path-cleared.txt" "确认:" "清空直写没有确认帧"
1024
- assert_not "$(cfg)" "/nonexistent/m55-agent" "清空把文件里的当前值写掉"
1025
- assert_eq "清空直写审计长一行" "$(audit_lines)" "$((path_audit + 1))"
1026
- filter_to TEAM_PI_BIN
1027
- sleep 0.5
1028
- keys Enter
1029
- wait_picker TEAM_PI_BIN '· 当前' || bad "必填 path 的选择器没有打开"
1030
- cap_to path-required
1031
- assert_not "$tmp/$current/path-required.txt" "清空" "必填 path 不给清空项(命令不接受空值)"
1032
- pick_option '自由输入' || bad "必填 path 没有自由输入项"
1033
- wait_editor TEAM_PI_BIN || bad "必填 path 的自由输入没有打开写编辑器"
1034
- keys C-u; sleep 0.3
1035
- type_text "/nonexistent/m55-pi"; sleep 0.4
680
+ assert_has "$tmp/$current/numeric.txt" "60–" "原读的最小值可见"
681
+ assert_has "$tmp/$current/numeric.txt" "900 秒 · 默认" "原默认值及单位可见"
682
+ assert_has "$tmp/$current/numeric.txt" "1800" "原建议值可见"
683
+ pick_option 输入其它值 || bad "没有自由输入"
684
+ wait_editor TEAM_PULSE_INTERVAL "900" || bad "原有效值不可编辑"
685
+ keys C-u; sleep 0.3; type_text 30; sleep 0.3; keys Enter
686
+ wait_cap invalid "最小 60" || bad "真实范围错误消失"
687
+ assert_eq "非法值保留配置" "$(sha "$(cfg)")" "$before"
688
+ assert_eq "非法值没有审计" "$(audit_lines)" "$audit0"
689
+ leave_editor TEAM_PULSE_INTERVAL || bad "非法草稿取消失败"
690
+ filter_to TEAM_PULSE_INTERVAL; keys Enter
691
+ wait_picker TEAM_PULSE_INTERVAL "1800" || bad "数值重开失败"
692
+ pick_option 1800 || bad "建议值不可选择"
693
+ wait_cap suggestion "已保存检查间隔" || bad "建议值没有直写"
694
+ assert_has "$tmp/$current/suggestion.txt" "team pulse restart" "间隔保存提示真实重启条件"
695
+ assert_match "$(cfg)" "^TEAM_PULSE_INTERVAL=.1800.$" "建议值落盘"
696
+
697
+ filter_to TEAM_PM_MODEL; keys Enter
698
+ wait_picker TEAM_PM_MODEL "↓" || bad "长模型词表未打开"
699
+ cap_to wheel-before
700
+ for i in $(seq 1 35); do wheel_at down 20 12; done
701
+ wait_row wheel-after "长模型词表末尾" "输入其它值" "↑" || bad "长词表不能滚到尾部"
702
+ assert_not "$tmp/$current/wheel-before.txt" "machine-only" "开屏词表不列机器目录模型"
703
+ assert_not "$tmp/$current/wheel-after.txt" "machine-only" "项目选项不读机器目录"
704
+ ( cd "$ROOT" && HOME="$home" bash "$skill/scripts/team" config list --json ) > "$tmp/$current/read-json.json" 2>&1
705
+ assert_not "$tmp/$current/read-json.json" "machine-only" "同一机器目录下的实际读也只含项目词表"
706
+ if wait_picker_quick TEAM_PM_MODEL "不存在的条目"; then bad "缺条目仍被当作已到达"; else ok "等待须命中实际条目"; fi
707
+ leave_picker TEAM_PM_MODEL || bad "长词表退出失败"
708
+
709
+ open_secondary commands
710
+ filter_to TEAM_GATES; gap0="$(argv_count)"; keys Enter
711
+ wait_editor TEAM_GATES "true" || bad "命令原值未打开"
712
+ argv_since "$gap0" "$tmp/$current/command-open.log"
713
+ assert_eq "命令自由输入打开零读取" "$(argv_reads "$tmp/$current/command-open.log")" "0"
714
+ leave_editor TEAM_GATES || bad "命令取消失败"
715
+ filter_to TEAM_REVIEW_TIMEOUT; keys Enter
716
+ wait_picker TEAM_REVIEW_TIMEOUT "30 · 当前" || bad "危险选项未打开"
717
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"; gap0="$(argv_count)"
718
+ pick_option "30 · 当前" || bad "危险当前值不存在"
719
+ wait_cap danger "危险:" || bad "危险未要求确认"
720
+ assert_eq "危险首次accept不写" "$(sha "$(cfg)")" "$before"
721
+ assert_eq "危险首次accept无审计" "$(audit_lines)" "$audit0"
722
+ argv_since "$gap0" "$tmp/$current/danger.log"
723
+ assert_not "$tmp/$current/danger.log" "--yes" "危险首次accept没有yes"
1036
724
  keys Enter
1037
- if wait_cap path-confirm "不存在"; then ok "确认行重复存在性标记(命令不拒写,视图也不谎称拒绝)"; else bad "确认行的存在性标记没出现"; fi
1038
- leave_editor TEAM_PI_BIN
1039
- wait_no_editor || bad "path 编辑器没有关干净"
1040
-
1041
- # ── (6) 没有选项集的 kind:打开自由输入并写明原因,不渲染条目列表 ──
1042
- filter_to TEAM_GATES
1043
- sleep 0.5
1044
- gap0="$(argv_count)"
725
+ wait_cap danger-saved "已保存验收最长时间" || bad "危险确认未保存"
726
+ assert_match "$(argv_log)" 'config set TEAM_REVIEW_TIMEOUT 30 --actor panel --yes --fingerprint [0-9a-f]{64} --allow-danger' "危险值仍带allow-danger"
727
+ filter_clear; keys Escape; sleep 0.4
728
+
729
+ # 所有字段修改只留草稿;完整旧/新确认后一次写回,重复、原序和其它token必须保留。
730
+ filter_to TEAM_MODEL_LIMITS; keys Enter
731
+ wait_row rules "规则字段入口" "模型同时运行任务数" "example/m0" "example/*" "添加限制" || bad "规则列表未打开"
732
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"
1045
733
  keys Enter
1046
- wait_editor TEAM_GATES "没有选项集" || bad "cmd 键没有打开自由输入"
1047
- argv_since "$gap0" "$tmp/$current/gap-editor.log"
1048
- local ed_reads
1049
- ed_reads="$(argv_reads "$tmp/$current/gap-editor.log")"; [ -n "$ed_reads" ] || ed_reads=0
1050
- assert_eq "打开自由输入:按键→帧之间零读取(现场:$(head -2 "$tmp/$current/gap-editor.log" 2>/dev/null | tr '\n' ';'))" "$ed_reads" "0"
1051
- cap_to no-choice
1052
- assert_has "$tmp/$current/no-choice.txt" "╭─ TEAM_GATES" "cmd 键直接打开自由输入"
1053
- assert_has "$tmp/$current/no-choice.txt" "没有选项集" "编辑器上方写明原因(kind 没有选项集,写入仍由命令校验)"
1054
- leave_editor TEAM_GATES
1055
- wait_no_editor || bad "cmd 编辑器没有关干净"
1056
-
1057
- # ── (7) task-model-map:Enter 把焦点移到类别块,绝不在这里组合映射(不读、不开编辑器) ──
1058
- # P232:夹具契约是先 upgrade-models 过的(这一段上面已经升过),所以类别块里至少有一个 routine 行。
1059
- filter_to TEAM_TASK_MODELS
1060
- sleep 0.5
734
+ wait_row fields "模型数量字段" "适用模型" "同时运行数量" "删除限制" || bad "未显示两个字段"
735
+ keys Down; sleep 0.3; keys Enter
736
+ wait_editor 同时运行数量 "2" || bad "数量字段没有原值"
737
+ keys C-u; sleep 0.3; type_text -1; sleep 0.3; keys Enter
738
+ wait_cap count-invalid "请输入非负整数" || bad "数量字段非法值未保留"
739
+ assert_eq "字段非法配置不变" "$(sha "$(cfg)")" "$before"
740
+ keys C-u; sleep 0.3; type_text 0; sleep 0.3; keys Enter
741
+ wait_row unlimited "0的业务标签" "此项不限制" || bad "0未显示此项不限制"
742
+ assert_eq "字段完成仍未写" "$(sha "$(cfg)")" "$before"
743
+ keys Escape; sleep 0.4
744
+ focus_row '› 保存' || bad "保存行不可达"
1061
745
  keys Enter
1062
- if wait_cap pairlist "类别块就是这一行的编辑器"; then ok "整映射行把焦点交给类别块"; else bad "类别块路由的说明行没出现"; fi
1063
- cap_to pairlist
1064
- assert_not "$tmp/$current/pairlist.txt" "╭─ TEAM_TASK_MODELS" "整映射行不开写编辑器"
1065
- assert_not "$tmp/$current/pairlist.txt" " · TEAM_TASK_MODELS" "整映射行不开选择器"
1066
- assert_match "$tmp/$current/pairlist.txt" '› 类别 routine' "焦点移到类别块的第一行"
1067
- assert_has "$tmp/$current/pairlist.txt" "team config set-task-model" "命令行点名 set-task-model(唯一写者)"
1068
-
1069
- # ── (8) 鼠标:第一次点击只移光标(不写);第二次点击 = 接受并直写;esc 什么都不写 ──
1070
- wait_no_editor || bad "点击用例开始前还有编辑器开着"
1071
- filter_to TEAM_MONITOR_UI
1072
- sleep 0.5
746
+ wait_row rules-confirm "完整旧新规则" "原值" "新值" "example/*" "此项不限制" || bad "完整规则确认未显示"
747
+ assert_eq "整组确认阶段不写" "$(sha "$(cfg)")" "$before"
1073
748
  keys Enter
1074
- wait_picker TEAM_MONITOR_UI 'tui · 当前' || bad "点击用例的选择器没有打开"
1075
- local click_sha click_audit target_line
1076
- click_sha="$(sha "$(cfg)")"; click_audit="$(audit_lines)"
1077
- target_line="$(cap | grep -n 'text' | grep -v '›' | head -1 | cut -d: -f1)"
1078
- [ -n "$target_line" ] || bad "选择器里找不到可点击的 text 条目"
1079
- [ -n "$target_line" ] && click_at 4 "$target_line"
1080
- # P68:等点击的光标移动在稳定帧上(原来是固定 sleep + 单次采样)。
1081
- wait_row click-move "第一次点击把光标移到该条目" '› text' \
1082
- || bad "第一次点击后光标没有落到该条目"
1083
- assert_match "$tmp/$current/click-move.txt" '› text' "第一次点击把光标移到该条目(D7 的规矩)"
1084
- assert_eq "第一次点击不写契约" "$(sha "$(cfg)")" "$click_sha"
1085
- assert_eq "第一次点击不增审计" "$(audit_lines)" "$click_audit"
1086
- click_at 4 "$target_line"
1087
- if wait_cap click-written "已写入 TEAM_MONITOR_UI = text"; then ok "第二次点击与 Enter 一样接受并直写"; else bad "第二次点击的直写回执没出现"; fi
1088
- assert_eq "第二次点击审计长一行" "$(audit_lines)" "$((click_audit + 1))"
1089
- assert_match "$(argv_log)" 'config set TEAM_MONITOR_UI text --actor panel --yes --fingerprint [0-9a-f]{64}' "第二次点击走了直写(--yes + 指纹)"
1090
- # esc:打开选择器 → esc → 什么都不写
1091
- filter_to TEAM_MONITOR_UI
1092
- sleep 0.5
1093
- local esc_audit esc0 esc_sha
1094
- esc_audit="$(audit_lines)"; esc0="$(argv_count)"; esc_sha="$(sha "$(cfg)")"
749
+ wait_cap rules-written "已保存模型同时运行任务数" || bad "完整规则未保存"
750
+ assert_match "$(cfg)" "^TEAM_MODEL_LIMITS='example/m0=0 example/\*=1 example/m0=4'$" "只改一个token,重复及顺序保留"
751
+ assert_eq "完整规则只审计一行" "$(audit_lines)" "$((audit0+1))"
752
+ assert_match "$(argv_log)" 'config set TEAM_MODEL_LIMITS .* --actor panel --yes --fingerprint [0-9a-f]{64}' "完整键writer带CAS与actor"
753
+ # 添加/删除/取消与冲突:不另写每模型文件,也不碰原配置。
754
+ filter_to TEAM_MODEL_LIMITS; keys Enter
755
+ wait_row rules-again "规则重新打开" "添加限制" || bad "规则未重开"
756
+ before="$(sha "$(cfg)")"; audit0="$(audit_lines)"
757
+ focus_row '› 添加限制'; keys Enter
758
+ wait_row added "新增草稿字段" "适用模型" "同时运行数量" || bad "新增字段未打开"
1095
759
  keys Enter
1096
- wait_picker TEAM_MONITOR_UI 'text · 当前' || bad "esc 用例的选择器没有打开"
1097
- # M59: the test-action esc is also state-checked — if the picker is not on a settled frame the
1098
- # key is not sent and the miss is named, instead of the esc closing whatever is underneath.
1099
- pty_key_when "esc 用例" " · TEAM_MONITOR_UI" Escape || bad "esc 用例:选择器不在稳定帧上,esc 没有发"
1100
- # P68:等 esc 的效果(选择器关掉、回到行列表)在稳定帧上,不用固定 sleep 采样。
1101
- wait_row picker-esc "esc 后选择器关掉、回到行列表那一行" '! · TEAM_MONITOR_UI' 'team config set TEAM_MONITOR_UI' \
1102
- || bad "esc 之后选择器没有关掉(或行列表没有回来)"
1103
- assert_not "$tmp/$current/picker-esc.txt" " · TEAM_MONITOR_UI" "esc 关掉选择器"
1104
- assert_has "$tmp/$current/picker-esc.txt" "team config set TEAM_MONITOR_UI" "回到行列表且焦点仍在原来那一行"
1105
- assert_eq "esc 后契约不变" "$(sha "$(cfg)")" "$esc_sha"
1106
- assert_eq "esc 后审计不增长" "$(audit_lines)" "$esc_audit"
1107
- argv_since "$esc0" "$tmp/$current/esc-argv.log"
1108
- assert_not "$tmp/$current/esc-argv.log" "config set" "esc 的窗口里没有 config set"
1109
- assert_not "$tmp/$current/esc-argv.log" "set-task-model" "esc 的窗口里没有类别写"
1110
- # M59 判据②(真实场景):此刻选择器已被上面那条 esc 关掉 —— 清理点的 esc 必须先确认状态。
1111
- # 旧写法的裸 esc 在这里会把设置视图整个关掉,之后每段都在错的视图里跑(§38-b 的级联入口)。
1112
- PTY_TRACE=1 pty_cleanup_esc "回归钉:已关闭的选择器" " · TEAM_MONITOR_UI" > "$tmp/$current/cleanup-trace.txt" 2>&1
1113
- assert_has "$tmp/$current/cleanup-trace.txt" "action=none" "已关闭的选择器:清理守卫一个键都不发"
1114
- assert_has "$tmp/$current/cleanup-trace.txt" "reason=not-settled" " 守卫的理由是「标记不在稳定帧上」,不是预算"
1115
- cap_to cleanup-after
1116
- assert_has "$tmp/$current/cleanup-after.txt" "╭─ 项目设置" "设置视图还开着(没有裸 esc 打到它身上)"
1117
- # M59 判据①的 trace 面:一次正常等待的放行点在 trace 里可见(命中 + 稳定确认,轮数自适应)。
760
+ wait_picker 适用模型 "example/m0" || bad "适用模型picker未打开"
761
+ for i in $(seq 1 35); do wheel_at down 20 12; done
762
+ wait_row model-other "长词表中的其它适用模型" "› 其它适用模型" || bad "其它适用模型不可达"
1118
763
  keys Enter
1119
- PTY_TRACE=1 wait_picker TEAM_MONITOR_UI 'text · 当前' > "$tmp/$current/wait-trace.txt" 2>&1 \
1120
- || bad "trace 探针的选择器没有打开"
1121
- assert_match "$tmp/$current/wait-trace.txt" 'wait picker TEAM_MONITOR_UI rounds=[0-9]+ settled=1' "正常等待放行在稳定帧上(trace 可见轮数)"
1122
- leave_picker TEAM_MONITOR_UI || bad "trace 探针的选择器没有关掉"
1123
-
1124
- # ── (9) 滚轮:条目列表比可视预算长时滚得动(焦点走过的就是列表滚过的) ──
1125
- wait_no_editor || bad "滚轮用例开始前还有编辑器开着"
1126
- filter_to TEAM_PM_MODEL
1127
- sleep 0.5
764
+ wait_editor 适用模型 || bad "表达式输入未打开"
765
+ type_text 'example/new*'; sleep 0.3; keys Enter
766
+ wait_row added-model "新增表达式只改草稿" "example/new*" || bad "表达式草稿未显示"
767
+ focus_row '› 删除限制'; keys Enter
768
+ wait_row deleted "删除返回列表" "添加限制" || bad "删除未返回列表"
769
+ keys Escape
770
+ wait_row rules-cancel "整组取消" "╭─ 项目设置" || bad "整组取消未返回"
771
+ assert_eq "新增删除取消保留字节" "$(sha "$(cfg)")" "$before"
772
+ assert_eq "新增删除取消无审计" "$(audit_lines)" "$audit0"
1128
773
  keys Enter
1129
- wait_picker TEAM_PM_MODEL '↓' || bad "长列表选择器没有打开"
1130
- cap_to wheel-before
1131
- local before_hidden
1132
- before_hidden="$(grep -oE '↓[0-9]+' "$tmp/$current/wheel-before.txt" | head -1 | tr -d '↓' || true)"
1133
- [ -n "$before_hidden" ] && ok "长列表在可视预算之外还有 $before_hidden 个条目(计数行)" \
1134
- || bad "长列表没有被窗口截断(滚轮用例前提不成立)"
1135
- assert_not "$tmp/$current/wheel-before.txt" "…(自由输入)" "滚动前看不到列表末尾的自由输入项"
1136
- local w
1137
- for w in $(seq 1 32); do
1138
- tmux -L "$sock" send-keys -t "$sess:panel" -l "$(printf '\033[<65;20;20M')" 2>/dev/null || true
1139
- sleep 0.1
1140
- done
1141
- # M59: conditional — wait for the wheel's repaint to settle AND the hidden count to drop.
1142
- local after_hidden=""
1143
- for w in $(seq 1 20); do
1144
- cap_to wheel-after
1145
- after_hidden="$(grep -oE '↓[0-9]+' "$tmp/$current/wheel-after.txt" | head -1 | tr -d '↓' || true)"
1146
- { [ -n "$after_hidden" ] && [ "$after_hidden" -lt "$before_hidden" ]; } && break
1147
- sleep 0.2
1148
- done
1149
- if [ -n "$before_hidden" ] && [ "${after_hidden:-0}" -lt "$before_hidden" ]; then
1150
- ok "滚轮把可见窗口往下推了(↓$before_hidden → ↓${after_hidden:-0})"
1151
- else
1152
- bad "滚轮没有推动可见窗口(↓$before_hidden → ↓${after_hidden:-0})"
1153
- fi
1154
- assert_has "$tmp/$current/wheel-after.txt" "…(自由输入)" "滚轮一直滚到列表末尾(自由输入项可见)"
1155
- assert_match "$tmp/$current/wheel-after.txt" "↑[0-9]+" "滚过之后列表上方也有被隐藏的条目"
1156
- # R2 的入口断言:scratch HOME 的目录(sub2api / openrouter)不在选择器里,也不在读里。
1157
- assert_not "$tmp/$current/wheel-before.txt" "sub2api" "选择器开屏不列机器目录里的 sub2api(词表只有项目数据)"
1158
- assert_not "$tmp/$current/wheel-after.txt" "sub2api" "滚到底也不列机器目录里的 sub2api"
1159
- assert_not "$tmp/$current/wheel-after.txt" "openrouter" "选择器不列机器目录里的 openrouter"
1160
- ( cd "$ROOT" && HOME="$home" bash "$skill/scripts/team" config list --json ) > "$tmp/$current/read-json.json" 2>&1
1161
- assert_not "$tmp/$current/read-json.json" "sub2api" "同一 scratch HOME 下的读也不含目录 provider"
1162
- # 硬化自检(M55 第一次复验 FAIL 的回归钉 + M59 判据①/③)……
1163
- if wait_picker_quick TEAM_PM_MODEL '这条目不存在-硬线自检'; then
1164
- bad "wait_picker 只凭标题就放行了(条目标记/稳定帧没起作用)"
1165
- else
1166
- ok "wait_picker 要的条目不在稳定帧里时判负(标题命中不算,现场见上面的黄点场景)"
1167
- fi
1168
- # 清理守卫把 esc 只打在真开着的选择器上(这里选择器确实开着 → 恰好一个 esc)。
1169
- leave_picker TEAM_PM_MODEL || bad "回归钉之后的选择器没有关掉"
1170
-
1171
- # ── (10) 危险值来自选项:第一次 accept 只给警告(不写、不审计),第二次才带 danger allowance 写入 ──
1172
- filter_to TEAM_MIN_FREE_SWAP_MB
1173
- sleep 0.5
774
+ wait_row rules-stale "冲突规则列表" "添加限制" || bad "冲突规则未打开"
775
+ printf '# other writer\n' >> "$(cfg)"
776
+ local other; other="$(sha "$(cfg)")"
777
+ focus_row '› 保存'; keys Enter
778
+ wait_cap rules-stale-confirm "设置已被修改,未保存" || bad "规则旧指纹未提示冲突"
1174
779
  keys Enter
1175
- wait_picker TEAM_MIN_FREE_SWAP_MB '0 · 当前' || bad "danger 用例的选择器没有打开"
1176
- cap_to danger
1177
- assert_has "$tmp/$current/danger.txt" "0 · 当前" "文件里的 0 在选项里就是「当前」(选项也可以是危险值)"
1178
- local d_sha d_audit d0
1179
- d_sha="$(sha "$(cfg)")"; d_audit="$(audit_lines)"; d0="$(argv_count)"
1180
- pick_option '0 · 当前' || bad "danger 用例里没有 0 条目"
1181
- if wait_cap danger-warn "危险:"; then ok "选项里的危险值先要一次确认(第一次 accept 不写)"; else bad "危险值的警告没出现"; fi
1182
- assert_eq "警告后契约不变" "$(sha "$(cfg)")" "$d_sha"
1183
- assert_eq "警告后审计不增长" "$(audit_lines)" "$d_audit"
1184
- cap_to danger-warn
1185
- assert_has "$tmp/$current/danger-warn.txt" " · TEAM_MIN_FREE_SWAP_MB" "警告之后选择器还开着(第二次 accept 在同一处)"
1186
- argv_since "$d0" "$tmp/$current/danger-argv.log"
1187
- assert_not "$tmp/$current/danger-argv.log" "--yes" "警告这一次没有 --yes(什么都没写)"
780
+ wait_cap rules-stale-result "设置已被修改,未保存" || bad "规则冲突未保留"
781
+ assert_eq "规则CAS保住另一个写者字节" "$(sha "$(cfg)")" "$other"
782
+ assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_MODEL_LIMITS' "规则冲突有原审计"
783
+ assert_not "$(argv_log)" "pulse restart" "设置未执行重启命令"
784
+ # 同批英文窄屏只走字段/非法/返回,不重复完整保存场景。
785
+ conf_set "lang=en" "page=1" "activity=1" "mouse=1" "density=comfortable"
786
+ start_panel
787
+ resize_panel 70 25 || bad "英文表单resize失败"
788
+ open_view Models
789
+ filter_to TEAM_MODEL_LIMITS; keys Enter
790
+ wait_row en-rules "英文规则入口" "Add limit" || bad "英文规则未打开"
791
+ before="$(sha "$(cfg)")"
1188
792
  keys Enter
1189
- if wait_cap danger-written "已写入 TEAM_MIN_FREE_SWAP_MB = 0"; then ok "第二次 accept 带 danger allowance 写入"; else bad "危险值的第二次 accept 没有落盘"; fi
1190
- assert_match "$(argv_log)" 'config set TEAM_MIN_FREE_SWAP_MB 0 --actor panel --yes --fingerprint [0-9a-f]{64} --allow-danger' "写入带 --allow-danger(命令的 danger 例外)"
1191
- assert_eq "危险值第二次 accept 审计长一行" "$(audit_lines)" "$((d_audit + 1))"
793
+ wait_row en-fields "英文规则字段" "Applicable model" "Simultaneous quantity" || bad "英文规则字段缺失"
794
+ keys Down; sleep 0.3; keys Enter
795
+ wait_editor "Simultaneous quantity" || bad "英文数量字段未打开"
796
+ keys C-u; sleep 0.3; type_text -1; sleep 0.3; keys Enter
797
+ wait_cap en-invalid "Enter a non-negative integer" || bad "英文真实字段错误未显示"
798
+ keys Escape
799
+ wait_row en-field-back "英文字段返回" "Applicable model" "Simultaneous quantity" || bad "英文字段未返回"
800
+ keys Escape; sleep 0.4; keys Escape
801
+ wait_row en-cancel "英文草稿取消" "╭─ Project settings" || bad "英文草稿未取消"
802
+ assert_eq "英文非法与取消保留原字节" "$(sha "$(cfg)")" "$before"
1192
803
  }
1193
804
 
1194
805
  scn_choices_schema() {
1195
- section "choices-schema · 新增 enum 键零代码出现 / 去掉 constraints 可见降级(M55 的核心卖点)"
1196
- server_up choices-schema "dev verify"
1197
- conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1198
- # scratch CLI:schema 里临时加一个 enum 键 TEAM_ZZZ_MODE —— bundle 就是提交的那份(不重建、不改一行 TS)。
806
+ section "choices-schema · 新键不自动显示;保留键选项/权限/异常整值仍来自真实CLI"
807
+ server_up choices-schema
808
+ policy_new 'routine=example/one' 'example/pm' || bad "策略准备失败"
1199
809
  local scratch="$tmp/$current/scratch"
1200
810
  mkdir -p "$scratch/skills/teamsmith"
1201
811
  cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
1202
812
  cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
1203
- python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
813
+ python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYCFG'
1204
814
  import sys
1205
- p = sys.argv[1]
1206
- s = open(p, encoding='utf-8').read()
1207
- old = "TEAM_MEETING_ALLOW_USER_ID|"
1208
- new = "TEAM_ZZZ_MODE|apply|enum|red,blue|plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现|||workflow\nTEAM_MEETING_ALLOW_USER_ID|"
1209
- assert old in s, "找不到 schema 尾部锚"
1210
- open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
1211
- PY
1212
- cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
815
+ p=sys.argv[1]; s=open(p).read()
816
+ anchor='TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'
817
+ assert anchor in s
818
+ s=s.replace(anchor,'TEAM_ZZZ_MODE|apply|enum|red,blue|plain|red|-|||workflow\n'+anchor)
819
+ old='TEAM_PULSE_INTERVAL|restart|seconds|60,|plain|900|低于 60 秒 = 巡检转成忙等||300,900,1800,3600|panel'
820
+ assert old in s
821
+ s=s.replace(old,old.replace('300,900,1800,3600','300,900,1800,3600,7200'))
822
+ open(p,'w').write(s)
823
+ PYCFG
824
+ cat > "$tmp/$current-scratch-wrapper.sh" <<EOF
1213
825
  #!/usr/bin/env bash
1214
826
  printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
1215
827
  exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
1216
- EOF2
828
+ EOF
1217
829
  chmod +x "$tmp/$current-scratch-wrapper.sh"
1218
- # 注意:`VAR=x func` 的赋值只活到函数返回 —— 本场景要起两次面板,所以先赋再调,末尾清掉。
1219
- P21_CLI="$tmp/$current-scratch-wrapper.sh"
1220
- start_panel
1221
- open_view
1222
- filter_to TEAM_ZZZ_MODE
1223
- wait_row zzz-row "scratch 新增 enum 键的行(裸键 + red 默认)" 'TEAM_ZZZ_MODE' '未设 · 默认 red' \
1224
- || bad "scratch CLI 新增的 enum 键行没等到(超过等待上限)"
1225
- assert_has "$tmp/$current/zzz-row.txt" "TEAM_ZZZ_MODE" "scratch CLI 新增的 enum 键出现在视图里(无标签→回退裸键)"
1226
- assert_has "$tmp/$current/zzz-row.txt" "未设 · 默认 red" "新键的默认值来自 schema"
1227
- keys Enter
1228
- wait_picker TEAM_ZZZ_MODE 'red · 默认' || bad "新增 enum 键的选择器没有打开(要重建 bundle = 反硬编码判据失败)"
1229
- cap_to zzz-picker
1230
- assert_match "$tmp/$current/zzz-picker.txt" '› 保持未设' "未设的新键也以保持未设开头"
1231
- assert_has "$tmp/$current/zzz-picker.txt" "red · 默认" "constraints 里的 red 是默认条目"
1232
- assert_has "$tmp/$current/zzz-picker.txt" "blue" "constraints 里的 blue 也在(原序,零代码改动)"
1233
- # 针是「…(自由输入)」条目形(不是裸词):选择器的页脚帮助行本身就写着「『自由输入』才进编辑器」
1234
- # (M68 a36a7c0c 起),裸针会把页脚当命中 —— 这条断言关的是封闭域**没有那个条目**。
1235
- assert_not "$tmp/$current/zzz-picker.txt" "…(自由输入)" "enum 是封闭域:没有自由输入项"
1236
- leave_picker TEAM_ZZZ_MODE
1237
- # 去掉 constraints:同一个 bundle 必须可见地退回自由输入并写明原因(不是静默空白框)。
1238
- python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
1239
- import sys
1240
- p = sys.argv[1]
1241
- s = open(p, encoding='utf-8').read()
1242
- old = "TEAM_ZZZ_MODE|apply|enum|red,blue|plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现"
1243
- new = "TEAM_ZZZ_MODE|apply|enum||plain|red|scratch 夹具:验证 schema 新增 enum 键零改动出现"
1244
- assert old in s, "找不到刚加的 scratch 行"
1245
- open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
1246
- PY
1247
- start_panel
830
+ P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
1248
831
  open_view
1249
- filter_to TEAM_ZZZ_MODE
1250
- wait_row zzz-row2 "第二次起的面板仍显示 scratch 新增键" 'TEAM_ZZZ_MODE' \
1251
- || bad "第二次起的面板没有用 scratch CLI(新键没等到(超过等待上限))"
1252
- assert_has "$tmp/$current/zzz-row2.txt" "TEAM_ZZZ_MODE" "第二次起的面板仍用 scratch CLI(新键还在)"
832
+ filter_to TEAM_ZZZ_MODE; cap_to excluded
833
+ assert_no_match "$tmp/$current/excluded.txt" '^│ [› ] [^│]*[^[:space:]│]' "新enum键不成为设置操作"
834
+ filter_to TEAM_PULSE_INTERVAL; keys Enter
835
+ wait_picker TEAM_PULSE_INTERVAL "7200" || bad "保留键新choice没有出现"
836
+ cap_to choices
837
+ assert_has "$tmp/$current/choices.txt" "7200" "保留键choices变更无需重建bundle"
838
+ leave_picker TEAM_PULSE_INTERVAL
839
+ # 源不能表示成字段时完整保留原值,交原writer校验;不丢弃坏token。
840
+ python3 - "$(cfg)" <<'PYCFG'
841
+ import re,sys
842
+ p=sys.argv[1]; s=open(p).read()
843
+ s,n=re.subn(r'^TEAM_MODEL_LIMITS=.*$', "TEAM_MODEL_LIMITS='example/one=2 malformed example/*=1'", s, flags=re.M)
844
+ assert n == 1, '异常样例必须替换唯一原配置行'
845
+ open(p,'w').write(s)
846
+ PYCFG
847
+ ( cd "$ROOT" && bash "$scratch/skills/teamsmith/scripts/team" config list --json ) > "$tmp/$current/malformed-read.json"
848
+ assert_eq "异常整值确实从原配置行读出" "$(python3 - "$tmp/$current/malformed-read.json" <<'PYVALUE'
849
+ import json,sys
850
+ j=json.load(open(sys.argv[1]))
851
+ print(next(k['value'] for k in j['keys'] if k['name'] == 'TEAM_MODEL_LIMITS'))
852
+ PYVALUE
853
+ )" 'example/one=2 malformed example/*=1'
854
+ start_panel; open_view
855
+ filter_to TEAM_MODEL_LIMITS; keys Enter
856
+ wait_editor TEAM_MODEL_LIMITS "malformed" || bad "异常完整值没有进入原输入器"
857
+ local before; before="$(sha "$(cfg)")"
1253
858
  keys Enter
1254
- wait_editor TEAM_ZZZ_MODE "没有选项集" || bad "去掉 constraints 后没有打开自由输入"
1255
- cap_to zzz-noconstraints
1256
- assert_has "$tmp/$current/zzz-noconstraints.txt" "╭─ TEAM_ZZZ_MODE" "enum 没有选项集时打开自由输入"
1257
- assert_has "$tmp/$current/zzz-noconstraints.txt" "没有选项集" "降级是可见的并写明原因(kind 没有选项集)"
1258
- leave_editor TEAM_ZZZ_MODE
1259
- wait_no_editor || bad "降级用例的编辑器没有关干净"
1260
- P21_CLI=""
859
+ wait_cap malformed "malformed" || bad "整值校验错误消失"
860
+ assert_eq "异常原值非法提交保持字节" "$(sha "$(cfg)")" "$before"
861
+ leave_editor TEAM_MODEL_LIMITS
862
+ unset P21_CLI
1261
863
  }
1262
864
 
1263
865
  scn_write() {
@@ -1267,52 +869,52 @@ scn_write() {
1267
869
  import re, sys
1268
870
  p = sys.argv[1]
1269
871
  s = open(p, encoding='utf-8').read()
1270
- s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
872
+ s = re.sub(r'^TEAM_PULSE_INTERVAL=.*$', 'TEAM_PULSE_INTERVAL="900" # 15min', s, count=1, flags=re.M)
1271
873
  open(p, 'w', encoding='utf-8').write(s)
1272
874
  PY
1273
875
  conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1274
876
  start_panel
1275
877
  open_view
1276
878
  cp "$(cfg)" "$tmp/$current/before.cfg"
1277
- filter_to TEAM_PULSE_NUDGE_GAP
879
+ filter_to TEAM_PULSE_INTERVAL
1278
880
  sleep 0.5
1279
881
  keys Enter
1280
- # M55:数值键现在先开选择器(建议值 + 自由输入),写路径本身没变 —— 走进自由输入那一项。
1281
- wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "写用例的选择器没有打开"
1282
- pick_option '自由输入' || bad "写用例的选择器里没有自由输入项"
1283
- wait_editor TEAM_PULSE_NUDGE_GAP || bad "写用例的编辑器没有打开"
1284
- cap_has "TEAM_PULSE_NUDGE_GAP" editor
882
+ # M55:数值键现在先开选择器(建议值 + 输入其它值),写路径本身没变 —— 走进输入其它值那一项。
883
+ wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "写用例的选择器没有打开"
884
+ pick_option '输入其它值' || bad "写用例的选择器里没有输入其它值项"
885
+ wait_editor TEAM_PULSE_INTERVAL || bad "写用例的编辑器没有打开"
886
+ cap_has "检查间隔" editor
1285
887
  keys BSpace BSpace BSpace
1286
888
  sleep 0.3
1287
889
  type_text "1200"
1288
890
  sleep 0.4
1289
891
  keys Enter
1290
- if wait_cap confirm "→ 1200"; then ok "第一次 Enter 只给确认行(没写)"; else bad "确认行没有出现(见 confirm.txt)"; fi
892
+ if wait_cap confirm "新值 1200"; then ok "第一次 Enter 只给确认行(没写)"; else bad "确认行没有出现(见 confirm.txt)"; fi
1291
893
  assert_eq "确认阶段契约未变" "$(sha "$(cfg)")" "$(sha "$tmp/$current/before.cfg")"
1292
894
  keys Enter
1293
- if wait_cap written "✓ 已写入 TEAM_PULSE_NUDGE_GAP = 1200"; then
895
+ if wait_cap written "已保存检查间隔"; then
1294
896
  ok "第二次 Enter 的回执说已写入"
1295
897
  else
1296
898
  bad "第二次 Enter 的回执没有出现(见 written.txt)"
1297
899
  fi
1298
900
  assert_eq "只改了一行" "$(diff "$tmp/$current/before.cfg" "$(cfg)" | grep -c '^[<>]' || true)" "2"
1299
- assert_eq "注释原样保留" "$(grep -c "^TEAM_PULSE_NUDGE_GAP='1200' # 15min\$" "$(cfg)" || true)" "1"
901
+ assert_eq "注释原样保留" "$(grep -c "^TEAM_PULSE_INTERVAL='1200' # 15min\$" "$(cfg)" || true)" "1"
1300
902
  ( cd "$ROOT" && bash -n .pi/team/config.sh ) && ok "写入后 bash -n 通过" || bad "写入后 bash -n 失败"
1301
- assert_match "$(argv_log)" 'config set TEAM_PULSE_NUDGE_GAP 1200 --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 --dry-run 调用"
1302
- assert_match "$(argv_log)" 'config set TEAM_PULSE_NUDGE_GAP 1200 --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了写入调用"
903
+ assert_match "$(argv_log)" 'config set TEAM_PULSE_INTERVAL 1200 --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 --dry-run 调用"
904
+ assert_match "$(argv_log)" 'config set TEAM_PULSE_INTERVAL 1200 --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了写入调用"
1303
905
  # Cancel: esc writes nothing and audits nothing.
1304
906
  local a0 b0
1305
907
  a0="$(audit_lines)"
1306
908
  b0="$(sha "$(cfg)")"
1307
- filter_to TEAM_PULSE_NUDGE_GAP
909
+ filter_to TEAM_PULSE_INTERVAL
1308
910
  sleep 0.5
1309
911
  keys Enter
1310
- wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "取消用例的选择器没有打开"
1311
- pick_option '自由输入' || bad "取消用例的选择器里没有自由输入项"
1312
- wait_editor TEAM_PULSE_NUDGE_GAP || bad "取消用例的编辑器没有打开"
912
+ wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "取消用例的选择器没有打开"
913
+ pick_option '输入其它值' || bad "取消用例的选择器里没有输入其它值项"
914
+ wait_editor TEAM_PULSE_INTERVAL || bad "取消用例的编辑器没有打开"
1313
915
  type_text "x"
1314
916
  sleep 0.4
1315
- leave_editor TEAM_PULSE_NUDGE_GAP || bad "取消用例的 esc 发了但编辑器还在"
917
+ leave_editor TEAM_PULSE_INTERVAL || bad "取消用例的 esc 发了但编辑器还在"
1316
918
  wait_no_editor || bad "取消用例的编辑器没有关干净"
1317
919
  assert_eq "取消后契约不变" "$(sha "$(cfg)")" "$b0"
1318
920
  assert_eq "取消后审计不增长" "$(audit_lines)" "$a0"
@@ -1322,7 +924,7 @@ PY
1322
924
  sleep 0.5
1323
925
  keys Enter
1324
926
  wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "非法值用例的选择器没有打开"
1325
- pick_option '自由输入' || bad "非法值用例的选择器里没有自由输入项"
927
+ pick_option '输入其它值' || bad "非法值用例的选择器里没有输入其它值项"
1326
928
  wait_editor TEAM_PULSE_INTERVAL || bad "非法值用例的编辑器没有打开"
1327
929
  keys BSpace BSpace BSpace BSpace
1328
930
  sleep 0.3
@@ -1332,54 +934,61 @@ PY
1332
934
  keys Enter
1333
935
  if wait_cap invalid "最小 60"; then ok "越界数值的拒绝点名最小 60"; else bad "越界数值的拒绝没出现"; fi
1334
936
  assert_eq "非法值契约不变" "$(sha "$(cfg)")" "$b1"
1335
- cap_has "TEAM_PULSE_INTERVAL" draft-kept
937
+ cap_has "检查间隔" draft-kept
1336
938
  leave_editor TEAM_PULSE_INTERVAL || bad "非法值用例的 esc 发了但编辑器还在"
1337
939
  wait_no_editor || bad "非法值用例的编辑器没有关干净"
1338
- # Danger: TEAM_MIN_FREE_SWAP_MB=0 needs one more Enter.
1339
- filter_to TEAM_MIN_FREE_SWAP_MB
940
+ # Danger: TEAM_REVIEW_TIMEOUT=30 needs one more Enter.
941
+ open_secondary commands
942
+ filter_to TEAM_REVIEW_TIMEOUT
1340
943
  sleep 0.5
1341
944
  keys Enter
1342
- wait_picker TEAM_MIN_FREE_SWAP_MB '· 当前' || bad "danger 用例的选择器没有打开"
1343
- pick_option '自由输入' || bad "danger 用例的选择器里没有自由输入项"
1344
- wait_editor TEAM_MIN_FREE_SWAP_MB || bad "danger 用例的编辑器没有打开"
945
+ wait_picker TEAM_REVIEW_TIMEOUT '· 当前' || bad "danger 用例的选择器没有打开"
946
+ pick_option '输入其它值' || bad "danger 用例的选择器里没有输入其它值项"
947
+ wait_editor TEAM_REVIEW_TIMEOUT || bad "danger 用例的编辑器没有打开"
1345
948
  keys BSpace BSpace BSpace BSpace
1346
949
  sleep 0.3
1347
- type_text "0"
950
+ type_text "30"
1348
951
  sleep 0.4
1349
952
  local b2; b2="$(sha "$(cfg)")"
1350
953
  keys Enter
1351
954
  if wait_cap danger "危险:"; then ok "危险值先要一个额外确认"; else bad "危险值的确认提示没出现"; fi
1352
955
  assert_eq "危险确认前契约不变" "$(sha "$(cfg)")" "$b2"
1353
956
  keys Enter
1354
- if wait_cap danger-written "已写入 TEAM_MIN_FREE_SWAP_MB = 0"; then
957
+ if wait_cap danger-written "已保存验收最长时间"; then
1355
958
  ok "第二次 Enter 写入危险值"
1356
959
  else
1357
960
  bad "危险值的第二次 Enter 没有落盘(见 danger-written.txt)"
1358
961
  fi
1359
- # Restart honesty: the running console keeps its argv while a fresh reader sees the new value.
962
+ # 保存间隔不重启Pulse;新读值可见。
963
+ filter_clear; keys Escape; sleep 0.4
1360
964
  local pid_args_before
1361
- pid_args_before="$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)"
1362
- filter_to TEAM_MONITOR_REFRESH
1363
- sleep 0.5
965
+ pid_args_before="$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline")"
966
+ filter_to TEAM_PULSE_INTERVAL; keys Enter
967
+ wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "restart选择器未打开"
968
+ pick_option 输入其它值
969
+ wait_editor TEAM_PULSE_INTERVAL || bad "restart编辑器未打开"
970
+ keys C-u; sleep 0.3; type_text 1500; sleep 0.3; keys Enter
971
+ wait_cap restart-confirm "新值 1500" || bad "restart未确认"
1364
972
  keys Enter
1365
- wait_picker TEAM_MONITOR_REFRESH '· 当前' || bad "restart 用例的选择器没有打开"
1366
- pick_option '自由输入' || bad "restart 用例的选择器里没有自由输入项"
1367
- wait_editor TEAM_MONITOR_REFRESH || bad "restart 用例的编辑器没有打开"
1368
- keys BSpace
1369
- sleep 0.3
1370
- type_text "7"
1371
- sleep 0.4
973
+ wait_cap restart "已保存检查间隔" || bad "restart未保存"
974
+ assert_has "$tmp/$current/restart.txt" "team pulse restart" "回执点名Pulse实际生效条件"
975
+ assert_eq "现有面板argv没有变化" "$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline")" "$pid_args_before"
976
+ assert_match "$(cfg)" "^TEAM_PULSE_INTERVAL=.1500." "新读者看见1500"
977
+ assert_not "$(argv_log)" "pulse restart" "设置没有自动重启"
978
+ # 真实文件故障,非伪造失败退出码:writer无法把目录作为配置文件。
979
+ filter_to TEAM_PULSE_INTERVAL; keys Enter
980
+ wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "失败用例未打开"
981
+ pick_option 输入其它值; wait_editor TEAM_PULSE_INTERVAL || bad "失败输入未打开"
982
+ keys C-u; sleep 0.3; type_text 1600; sleep 0.3; keys Enter
983
+ wait_cap failure-confirm "新值 1600" || bad "失败前确认缺失"
984
+ mv "$(cfg)" "$tmp/$current/saved.cfg"; mkdir "$(cfg)"
1372
985
  keys Enter
1373
- if wait_cap restart-confirm "→ 7"; then ok "restart 值先给确认行"; else bad "restart 的确认行没出现"; fi
1374
- keys Enter
1375
- if wait_cap restart "已写入 TEAM_MONITOR_REFRESH = 7"; then
1376
- ok "restart 值已写入"
1377
- else
1378
- bad "restart 值没有写进去(见 restart.txt)"
1379
- fi
1380
- assert_eq "运行中的控制台仍拿着旧 argv" "$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)" "$pid_args_before"
1381
- ( cd "$ROOT" && bash "$skill/scripts/team" monitor --json ) > "$tmp/$current/monitor.json" 2>/dev/null
1382
- assert_has "$tmp/$current/monitor.json" '"refresh_s":7' "下一个读契约的进程看到 7(team monitor --json)"
986
+ wait_cap write-failed "保存失败:" || bad "真实writer失败未显示"
987
+ cap_to failure-draft
988
+ assert_has "$tmp/$current/failure-draft.txt" "1600" "失败仍保留草稿"
989
+ rmdir "$(cfg)"; mv "$tmp/$current/saved.cfg" "$(cfg)"
990
+ leave_editor TEAM_PULSE_INTERVAL
991
+
1383
992
  }
1384
993
 
1385
994
  scn_conflict() {
@@ -1389,17 +998,17 @@ scn_conflict() {
1389
998
  import re, sys
1390
999
  p = sys.argv[1]
1391
1000
  s = open(p, encoding='utf-8').read()
1392
- s = re.sub(r'^TEAM_PULSE_NUDGE_GAP=.*$', 'TEAM_PULSE_NUDGE_GAP="900" # 15min', s, count=1, flags=re.M)
1001
+ s = re.sub(r'^TEAM_PULSE_INTERVAL=.*$', 'TEAM_PULSE_INTERVAL="900" # 15min', s, count=1, flags=re.M)
1393
1002
  open(p, 'w', encoding='utf-8').write(s)
1394
1003
  PY
1395
1004
  start_panel
1396
1005
  open_view
1397
- filter_to TEAM_PULSE_NUDGE_GAP
1006
+ filter_to TEAM_PULSE_INTERVAL
1398
1007
  sleep 0.5
1399
1008
  keys Enter
1400
- wait_picker TEAM_PULSE_NUDGE_GAP '· 当前' || bad "冲突用例的选择器没有打开"
1401
- pick_option '自由输入' || bad "冲突用例的选择器里没有自由输入项"
1402
- wait_editor TEAM_PULSE_NUDGE_GAP || bad "冲突用例的编辑器没有打开"
1009
+ wait_picker TEAM_PULSE_INTERVAL '· 当前' || bad "冲突用例的选择器没有打开"
1010
+ pick_option '输入其它值' || bad "冲突用例的选择器里没有输入其它值项"
1011
+ wait_editor TEAM_PULSE_INTERVAL || bad "冲突用例的编辑器没有打开"
1403
1012
  keys BSpace BSpace BSpace
1404
1013
  sleep 0.3
1405
1014
  type_text "1200"
@@ -1411,16 +1020,15 @@ PY
1411
1020
  sleep 2
1412
1021
  keys Enter
1413
1022
  # M59: conditional — the conflict receipt must land on a settled frame (was: fixed 2.5s).
1414
- if wait_cap conflict "指纹不符"; then ok "回执点名指纹冲突"; else bad "冲突的回执没出现"; fi
1023
+ if wait_cap conflict "设置已被修改,未保存"; then ok "回执点名指纹冲突"; else bad "冲突的回执没出现"; fi
1415
1024
  assert_eq "对方的字节被保住" "$(sha "$(cfg)")" "$other"
1416
- assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_PULSE_NUDGE_GAP' "审计增了一行 conflict"
1417
- # The view reloaded and shows the other writer's value (1200 was never written). M49:行上是标签,
1418
- # 原始键在 CLI 提示行里(重读后仍与命令对齐)。M59: wait_cap 的字面针用「值 · 立即生效」,
1419
- # 行标签与值之间的留白宽度交给后面的 assert_match(ERE)去验。
1420
- if wait_cap reloaded "900 · 立即生效"; then ok "视图重读后显示对方的 900"; else bad "视图重读后没有显示对方的 900"; fi
1421
- assert_match "$tmp/$current/reloaded.txt" '重复提醒间隔 +900' "视图重读后显示对方的 900(标签 + 值)"
1422
- assert_not "$tmp/$current/reloaded.txt" "重复提醒间隔 +1200" "视图没有显示未写入的 1200"
1423
- assert_has "$tmp/$current/reloaded.txt" "team config set TEAM_PULSE_NUDGE_GAP" "视图仍点名原始键(照敲命令用)"
1025
+ assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_PULSE_INTERVAL' "审计增了一行 conflict"
1026
+ # 后台读回另一个写者的900;必要生效信息仍在,未保存的1200不能变成行值。
1027
+ leave_editor TEAM_PULSE_INTERVAL
1028
+ if wait_cap reloaded "900"; then ok "视图重读后显示对方的 900"; else bad "视图重读后没有显示对方的 900"; fi
1029
+ assert_match "$tmp/$current/reloaded.txt" '检查间隔 +900' "视图重读后显示对方的 900(标签 + 值)"
1030
+ assert_not "$tmp/$current/reloaded.txt" "检查间隔 +1200" "视图没有显示未写入的 1200"
1031
+ assert_has "$tmp/$current/reloaded.txt" "team pulse restart" "必要生效条件仍可见"
1424
1032
  }
1425
1033
 
1426
1034
  # ---------------------------------------------------------------- P232(类别策略 vs 已派记录)
@@ -1435,27 +1043,28 @@ scn_policy() {
1435
1043
  conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1436
1044
  start_panel
1437
1045
  open_view
1438
- # ① 类别行:未来策略 + 「新任务」徽章 + 命令行点名 set-task-model
1439
- filter_to 类别
1440
- wait_row policy-cat "类别 routine 行(策略模型 + 新任务徽章)" '下一次派任务会用的模型' '类别 routine' 'kimi-coding/k3-256k' \
1046
+ # ① 类别行:未来策略模型;选中后显示新任务生效。
1047
+ filter_clear
1048
+ wait_row policy-cat "routine 行(未来策略模型)" '模型' 'routine' 'kimi-coding/k3-256k' \
1441
1049
  || bad "类别行没等到(超过等待上限)"
1442
1050
  # 视图的快照行、命令行提示行都跟着**焦点**走:先把光标移到类别行,再看这一行的两半(M49)。
1443
- if focus_row '› 类别 routine'; then :; else bad "没能把焦点移到类别 routine 行"; fi
1051
+ if focus_row '› routine'; then :; else bad "没能把焦点移到routine 行"; fi
1444
1052
  cap_to policy-cat
1445
- assert_match "$tmp/$current/policy-cat.txt" '› 类别 routine +kimi-coding/k3-256k · 新任务' "类别行 = 类别 + 策略模型 + 新任务徽章"
1446
- assert_has "$tmp/$current/policy-cat.txt" "team config set-task-model routine <model>" "命令行点名 set-task-model(唯一写者)"
1053
+ assert_match "$tmp/$current/policy-cat.txt" '› routine +kimi-coding/k3-256k' "类别行 = 类别 + 策略模型"
1054
+ assert_has "$tmp/$current/policy-cat.txt" "新任务生效" "类别选中显示实际生效时间"
1447
1055
  # ② 策略 ≠ 实际:dev 的只读行显示**记录**里的模型,行里不出现策略模型
1056
+ open_secondary records
1448
1057
  filter_to dev
1449
- wait_row policy-dev "dev 的只读派单行" '正在运行的任务实际使用的模型' 'xai/grok-4.6' \
1058
+ wait_row policy-dev "dev 的只读派单行" '模型记录' 'xai/grok-4.6' \
1450
1059
  || bad "dev 的派单行没等到(超过等待上限)"
1451
1060
  if focus_row '› dev '; then :; else bad "没能把焦点移到 dev 的派单行"; fi
1452
1061
  cap_to policy-dev
1453
- assert_match "$tmp/$current/policy-dev.txt" 'dev +xai/grok-4.6 · 不可改' "记录模型逐字显示(不是策略模型)"
1062
+ assert_match "$tmp/$current/policy-dev.txt" 'dev +T232-x +xai/grok-4.6' "记录模型逐字显示(不是策略模型)"
1454
1063
  assert_not "$tmp/$current/policy-dev.txt" "kimi-coding/k3-256k" "派单行里不出现未来策略的模型"
1455
- assert_has "$tmp/$current/policy-dev.txt" "会话 sid-dev-232" "派单行带已提交的会话号"
1064
+ assert_has "$tmp/$current/policy-dev.txt" "会话编号: sid-dev-232" "派单行带已提交的会话号"
1456
1065
  # ③ 没有记录的席位:不借策略模型
1457
1066
  filter_to verify
1458
- wait_row policy-verify "verify 的「还没有派过任务」行" 'verify' '这个席位还没有派过任务' \
1067
+ wait_row policy-verify "verify 的「尚无派单记录」行" 'verify' '尚无派单记录' \
1459
1068
  || bad "无记录席位行没等到(超过等待上限)"
1460
1069
  assert_not "$tmp/$current/policy-verify.txt" "kimi-coding/k3-256k" "无记录席位行不借未来策略的模型"
1461
1070
  # ③b P266(设计表的红侧第二格):同一个席位换成一份「存在、但读不出来」的记录(旧格式:版本不是 1)
@@ -1463,10 +1072,11 @@ scn_policy() {
1463
1072
  # 不解析诊断字符串。
1464
1073
  printf 'assignment_version=0\nseat=verify\nmodel=vendor/legacy\n' > "$state/verify.env"
1465
1074
  reopen_view
1075
+ open_secondary records
1466
1076
  filter_to verify
1467
- wait_row policy-unreadable "record_present=true:有记录但读不出来" 'verify' '这个席位派过任务,但它的记录读不出来' \
1077
+ wait_row policy-unreadable "record_present=true:有记录但读不出来" 'verify' '记录读取失败' \
1468
1078
  || bad "「读不出来」的席位行没等到(超过等待上限)"
1469
- assert_not "$tmp/$current/policy-unreadable.txt" "还没有派过任务" "P266:有记录但读不出来时不说「还没派过任务」(两个原因分得开)"
1079
+ assert_not "$tmp/$current/policy-unreadable.txt" "尚无派单记录" "P266:有记录但读不出来时不说「还没派过任务」(两个原因分得开)"
1470
1080
  assert_not "$tmp/$current/policy-unreadable.txt" "legacy/unknown assignment_version" "P266:命令的诊断字符串不上屏"
1471
1081
  local pol_json_verify
1472
1082
  pol_json_verify="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list --json ) \
@@ -1474,11 +1084,12 @@ scn_policy() {
1474
1084
  assert_eq "P266:读侧把这一行报成 assigned=false 且 record_present=true(诊断只留给机器)" \
1475
1085
  "$pol_json_verify" "assigned=False record_present=True diagnostic=legacy/unknown assignment_version"
1476
1086
  rm -f "$state/verify.env"
1087
+ filter_clear; keys Escape; sleep 0.4
1477
1088
  # ④ 一次类别直写:picker 用项目自己的词表,写走 set-task-model 的 dry-run → --yes
1478
- filter_to 类别
1089
+ filter_clear
1479
1090
  sleep 0.5
1480
- if focus_row '› 类别 routine'; then keys Enter; else bad "没能把焦点移到类别行"; fi
1481
- if pty_wait_frame "$tmp/$current/policy-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
1091
+ if focus_row '› routine'; then keys Enter; else bad "没能把焦点移到类别行"; fi
1092
+ if pty_wait_frame "$tmp/$current/policy-picker.txt" "类别 picker" "╭─ routine" "输入其它值"; then
1482
1093
  ok "类别 picker 打开(标题点名类别 + 自由输入项)"
1483
1094
  else
1484
1095
  bad "类别 picker 没有打开"
@@ -1493,14 +1104,14 @@ scn_policy() {
1493
1104
  pol_pid_args="$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)"
1494
1105
  cp "$(cfg)" "$tmp/$current/before-cat.cfg"
1495
1106
  pick_option 'xai/grok-4.6' || bad "picker 里没有 xai/grok-4.6"
1496
- if wait_cap policy-written "已写入类别 routine = xai/grok-4.6"; then
1107
+ if wait_cap policy-written "已保存routine模型"; then
1497
1108
  ok "类别直写的回执"
1498
1109
  else
1499
1110
  bad "类别直写的回执没有出现"
1500
1111
  fi
1501
1112
  cap_to policy-written
1502
1113
  assert_not "$tmp/$current/policy-written.txt" "确认:" "值条目直写没有确认帧"
1503
- assert_has "$tmp/$current/policy-written.txt" "只影响以后派的新任务" "回执说明只影响以后派的新任务"
1114
+ assert_has "$tmp/$current/policy-written.txt" "新任务生效" "回执说明只影响以后派的新任务"
1504
1115
  argv_since "$pol_argv" "$tmp/$current/policy-argv.log"
1505
1116
  assert_match "$tmp/$current/policy-argv.log" 'config set-task-model routine xai/grok-4.6 --actor panel --dry-run --fingerprint [0-9a-f]{64}' "argv 记录 set-task-model --dry-run"
1506
1117
  assert_match "$tmp/$current/policy-argv.log" 'config set-task-model routine xai/grok-4.6 --actor panel --yes --fingerprint [0-9a-f]{64}' "argv 记录 set-task-model 的写入"
@@ -1523,6 +1134,7 @@ scn_categories() {
1523
1134
  policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh verify=deepseek/deepseek-flash' \
1524
1135
  'openai-codex/gpt-6.1-sol:high' || bad "策略升级事务没有跑通(见 $tmp/$current-upgrade.log)"
1525
1136
  record_fixture dev 'xai/grok-4.6' sid-dev-232 T232-x routine
1137
+ printf 'metadata_version=1\nproject=%s\nwindow=pm\nmodel=example/last-pm\nnonce=p471-fixture\ntime=2026-11-17T00:00:00Z\nmode=fresh\nresume_key=default\nidentity_via=provider,model,session_id\n' "$ROOT" > "$state/pm-launch.env"
1526
1138
  conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1527
1139
  local scn_argv scn_windows
1528
1140
  scn_argv="$(argv_count)"
@@ -1530,10 +1142,10 @@ scn_categories() {
1530
1142
  scn_windows="$(tmux -L "$sock" list-windows -t "$sess" -F '#{window_name}' 2>/dev/null | sort | tr '\n' ',')"
1531
1143
  open_view
1532
1144
  # ① 类别 picker 的条目顺序(当前 → 已知模型(去重)→ 自由输入),没有任何移除/整映射组合项
1533
- filter_to 类别
1145
+ filter_clear
1534
1146
  sleep 0.5
1535
- if focus_row '› 类别 routine'; then keys Enter; else bad "没能把焦点移到类别 routine 行"; fi
1536
- if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
1147
+ if focus_row '› routine'; then keys Enter; else bad "没能把焦点移到routine 行"; fi
1148
+ if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "╭─ routine" "输入其它值"; then
1537
1149
  ok "类别 picker 打开"
1538
1150
  else
1539
1151
  bad "类别 picker 没有打开"
@@ -1544,10 +1156,10 @@ scn_categories() {
1544
1156
  local cat_sha cat_audit
1545
1157
  cat_sha="$(sha "$(cfg)")"; cat_audit="$(audit_lines)"
1546
1158
  # ② esc 取消:什么都不写、不留审计
1547
- pty_key_when "类别 picker 的 esc" "选择类别 routine 的模型" Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
1548
- wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!选择类别 routine 的模型' '╭─ 项目设置' \
1159
+ pty_key_when "类别 picker 的 esc" "╭─ routine" Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
1160
+ wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!╭─ routine' '╭─ 项目设置' \
1549
1161
  || bad "一次 esc 没有关掉类别 picker"
1550
- assert_not "$tmp/$current/cat-picker-closed.txt" "选择类别 routine 的模型" "一次 esc 关掉 picker"
1162
+ assert_not "$tmp/$current/cat-picker-closed.txt" "╭─ routine" "一次 esc 关掉 picker"
1551
1163
  assert_eq "取消后契约不变" "$(sha "$(cfg)")" "$cat_sha"
1552
1164
  assert_eq "取消后审计不增长" "$(audit_lines)" "$cat_audit"
1553
1165
  # ③ PM 编辑:自由输入 + 两次确认;回执点名 team up / fresh;一行 diff;argv 走 config set
@@ -1557,46 +1169,62 @@ scn_categories() {
1557
1169
  sleep 0.5
1558
1170
  keys Enter
1559
1171
  wait_picker TEAM_PM_MODEL '· 当前' || bad "PM 行的选择器没有打开"
1560
- pick_option '自由输入' || bad "PM 行没有自由输入项"
1172
+ pick_option '输入其它值' || bad "PM 行没有自由输入项"
1561
1173
  wait_editor TEAM_PM_MODEL || bad "PM 行的编辑器没有打开"
1562
1174
  keys C-u; sleep 0.3
1563
1175
  type_text "kimi-coding/k3-256k"; sleep 0.4
1564
1176
  keys Enter
1565
- if wait_cap pm-confirm "确认:TEAM_PM_MODEL"; then ok "PM 编辑先给确认行"; else bad "PM 的确认行没有出现"; fi
1177
+ if wait_cap pm-confirm "新值 kimi-coding/k3-256k"; then ok "PM 编辑先给确认行"; else bad "PM 的确认行没有出现"; fi
1566
1178
  keys Enter
1567
- if wait_cap pm-written "已写入 PM 模型"; then ok "PM 编辑落盘"; else bad "PM 的写入回执没有出现"; fi
1179
+ if wait_cap pm-written "已保存PM模型"; then ok "PM 编辑落盘"; else bad "PM 的写入回执没有出现"; fi
1568
1180
  cap_to pm-written
1569
1181
  assert_has "$tmp/$current/pm-written.txt" "fresh-pm" "PM 回执点名换模型的 fresh-pm 守卫"
1570
1182
  assert_match "$(argv_log)" 'config set TEAM_PM_MODEL kimi-coding/k3-256k --actor panel --dry-run --fingerprint [0-9a-f]{64}' "argv 记录 PM 的 --dry-run"
1571
1183
  assert_match "$(argv_log)" 'config set TEAM_PM_MODEL kimi-coding/k3-256k --actor panel --yes --fingerprint [0-9a-f]{64}' "argv 记录 PM 的写入"
1572
1184
  assert_eq "PM 写入审计长一行" "$(audit_lines)" "$((pm_audit + 1))"
1573
- assert_neq "PM 行确实变了" "$(grep '^TEAM_PM_MODEL=' "$(cfg)")" "$pm_before"
1185
+ if [ "$(grep '^TEAM_PM_MODEL=' "$(cfg)")" != "$pm_before" ]; then
1186
+ ok "PM 行确实变了"
1187
+ else
1188
+ bad "PM 行没有变"
1189
+ fi
1574
1190
  assert_has "$(cfg)" "kimi-coding/k3-256k" "PM 的新模型在文件里"
1575
1191
  # ④ 陈旧指纹:picker 开着时另一个写者改契约 → accept 判冲突、对方字节保住、审计一行 conflict
1576
- filter_to 类别
1192
+ filter_clear
1577
1193
  sleep 0.5
1578
- if focus_row '› 类别 analysis'; then keys Enter; else bad "没能把焦点移到类别 analysis 行"; fi
1579
- pty_wait_frame - "类别 picker(冲突用例)" "选择类别 analysis 的模型" || bad "冲突用例的 picker 没有打开"
1194
+ if focus_row '› analysis'; then keys Enter; else bad "没能把焦点移到analysis 行"; fi
1195
+ pty_wait_frame - "类别 picker(冲突用例)" "╭─ analysis" || bad "冲突用例的 picker 没有打开"
1580
1196
  printf '# other writer\n' >> "$(cfg)"
1581
1197
  local other_sha; other_sha="$(sha "$(cfg)")"
1582
1198
  pick_option 'deepseek/deepseek-flash' || bad "冲突用例的 picker 里没有 deepseek/deepseek-flash"
1583
- if wait_cap cat-conflict "指纹不符"; then ok "陈旧指纹被命令拒绝(回执点名冲突)"; else bad "陈旧指纹的冲突回执没有出现"; fi
1199
+ if wait_cap cat-conflict "设置已被修改,未保存"; then ok "陈旧指纹被命令拒绝(回执点名冲突)"; else bad "陈旧指纹的冲突回执没有出现"; fi
1584
1200
  assert_eq "对方的字节被保住" "$(sha "$(cfg)")" "$other_sha"
1585
1201
  assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_TASK_MODELS' "审计增了一行 conflict(actor=panel)"
1586
1202
  # ⑤ 删掉未来类别:策略行消失,已提交记录的模型/SID 原样保留(恢复不看映射成员)
1587
1203
  ( cd "$ROOT" && bash "$skill/scripts/team" config set TEAM_TASK_MODELS 'analysis=openai-codex/gpt-5.6-terra:xhigh verify=deepseek/deepseek-flash' --yes ) >/dev/null 2>&1 \
1588
1204
  || bad "整映射删除 routine 失败"
1589
1205
  reopen_view
1206
+ open_secondary records
1590
1207
  filter_to dev
1591
- wait_row cat-kept "删类别后 dev 的派单行仍在" 'xai/grok-4.6' '会话 sid-dev-232' \
1208
+ wait_row cat-kept "删类别后 dev 的派单行仍在" 'xai/grok-4.6' '会话编号: sid-dev-232' \
1592
1209
  || bad "删类别后派单行没等到(超过等待上限)"
1593
- assert_match "$tmp/$current/cat-kept.txt" 'dev +xai/grok-4.6 · 不可改' "删类别后记录模型仍是记录里的值"
1594
- assert_has "$tmp/$current/cat-kept.txt" "会话 sid-dev-232" "删类别后会话号原样"
1595
- filter_to 类别
1210
+ assert_match "$tmp/$current/cat-kept.txt" 'dev +T232-x +xai/grok-4.6' "删类别后记录模型仍是记录里的值"
1211
+ assert_has "$tmp/$current/cat-kept.txt" "会话编号: sid-dev-232" "删类别后会话号原样"
1212
+ filter_clear
1213
+ pty_key_when "删类别后返回主设置" '╭─ 模型记录' Escape || bad "删类别后记录页不在屏幕上"
1214
+ pty_wait_frame - "删类别后主设置" '╭─ 项目设置' || bad "删类别后未回主设置"
1215
+ filter_clear
1596
1216
  cap_to cat-deleted
1597
- assert_not "$tmp/$current/cat-deleted.txt" "类别 routine" "被删的类别不再有策略行"
1598
- assert_match "$tmp/$current/cat-deleted.txt" '类别 (analysis|verify)' "其余类别照旧在策略块里"
1599
- assert_match "$tmp/$current/cat-deleted.txt" '^│ ── 下一次派任务会用的模型 ─+' "类别块本身还在(只删了 routine)"
1217
+ assert_not "$tmp/$current/cat-deleted.txt" "routine" "被删的类别不再有策略行"
1218
+ assert_match "$tmp/$current/cat-deleted.txt" '(analysis|verify)' "其余类别照旧在策略块里"
1219
+ assert_match "$tmp/$current/cat-deleted.txt" '^│ ── 模型 ─+' "类别块本身还在(只删了 routine)"
1220
+ # PM记录只报告上次启动,不把未来策略当成运行模型。
1221
+ open_secondary records
1222
+ filter_to PM上次启动
1223
+ wait_row pm-record "上次PM记录与未来策略分离" "PM上次启动" "example/last-pm" || bad "PM上次启动记录缺失"
1224
+ keys Enter
1225
+ wait_row pm-record-detail "原PM启动字段" "2026-11-17T00:00:00Z" "全新启动" || bad "PM启动详细字段缺失"
1226
+ keys Escape; sleep 0.4
1227
+ filter_clear; keys Escape; sleep 0.4
1600
1228
  # ⑥ 无 spawn/重启:整段没有任何 dispatch/resume/restart,窗口集合不变
1601
1229
  argv_since "$scn_argv" "$tmp/$current/categories-argv.log"
1602
1230
  assert_not "$tmp/$current/categories-argv.log" "dispatch" "整个场景没有 dispatch"
@@ -1605,33 +1233,20 @@ scn_categories() {
1605
1233
  assert_not "$tmp/$current/categories-argv.log" "set-agent-model" "整个场景没有退休的席位写入"
1606
1234
  assert_eq "tmux 窗口集合不变(没有 spawn 席位)" \
1607
1235
  "$(tmux -L "$sock" list-windows -t "$sess" -F '#{window_name}' 2>/dev/null | sort | tr '\n' ',')" "$scn_windows"
1608
- # ⑦ 遗留配置:退休键在文件里 → 可见的迁移诊断 + 命令行给 CLI 升级路线;没有席位编辑器
1236
+ # 遗留配置保留完整诊断/修复路径,但退休键没有编辑行。
1609
1237
  server_up categories-legacy "dev verify"
1610
- start_panel
1611
- open_view
1612
- # 诊断行按 头…尾 换行(不截断路线):命令原文可能跨两行,所以断言的是路线的**词**都在屏幕上
1613
- # (升级命令名 + 它的参数),而不是一整串连续子串。
1614
- wait_row legacy-diagnosis "遗留配置的迁移诊断" '旧设置需要升级' '含退休键' 'upgrade-models' \
1615
- || bad "遗留配置的迁移诊断没等到(超过等待上限)"
1616
- assert_has "$tmp/$current/legacy-diagnosis.txt" "upgrade-models" "诊断给出 CLI 升级命令(命令名可见)"
1617
- assert_has "$tmp/$current/legacy-diagnosis.txt" "--task-models" "诊断给出升级命令的参数(不被截掉)"
1618
- assert_has "$tmp/$current/legacy-diagnosis.txt" "--dry-run" "诊断给出升级命令的预览步骤(不被截掉)"
1619
- assert_has "$tmp/$current/legacy-diagnosis.txt" "TEAM_DEFAULT_MODEL" "诊断点名退休键"
1620
- local legacy_cat_heading
1621
- legacy_cat_heading="$(cap_line_heading "$tmp/$current/legacy-diagnosis.txt" '下一次派任务会用的模型')"
1622
- assert_eq "遗留配置没有可编辑的类别块(没有假的可编辑策略)" "$legacy_cat_heading" "0"
1623
- filter_to TEAM_DEFAULT_MODEL
1624
- # 筛选也匹配行内注释(M49 的既有口径),而 TEAM_PM_MODEL 的初始化注释里就写着 TEAM_DEFAULT_MODEL ——
1625
- # 所以这里必须先把光标走到退休键那一行,否则回车打到的是 PM 行(第一遍就是这么红的)。
1626
- if focus_row '› TEAM_DEFAULT_MODEL'; then :; else bad "没能把焦点移到退休键行"; fi
1627
- cap_to legacy-key
1628
- assert_match "$tmp/$current/legacy-key.txt" 'TEAM_DEFAULT_MODEL +.*不认识' "退休键变成只读的未知键行(没有席位默认编辑器)"
1238
+ printf "\nTEAM_DEFAULT_MODEL=example/legacy\n" >> "$(cfg)"
1239
+ start_panel; open_view
1240
+ wait_row legacy "真实迁移诊断" "配置需要更新" "含退休键" || bad "迁移诊断未显示"
1241
+ focus_row '› .*upgrade-models' || bad "迁移命令行不可达"
1629
1242
  keys Enter
1630
- if wait_cap legacy-route "不是已知的项目设置"; then ok "退休键的回执点名它不在 schema 里(不给编辑)"; else bad "退休键的回执没有出现"; fi
1631
- cap_to legacy-route
1632
- assert_not "$tmp/$current/legacy-route.txt" " · TEAM_DEFAULT_MODEL" "退休键不开选择器"
1633
- assert_not "$tmp/$current/legacy-route.txt" "╭─ TEAM_DEFAULT_MODEL" "退休键不开写编辑器"
1634
- assert_not "$tmp/$current/legacy-route.txt" "set-agent-model" "遗留视图里没有席位写入路线"
1243
+ wait_row legacy-detail "完整迁移路线" "upgrade-models" "--task-models" "--dry-run" || bad "迁移路线不可达"
1244
+ cap_to legacy-detail
1245
+ keys Escape; sleep 0.4
1246
+ filter_to TEAM_DEFAULT_MODEL; cap_to legacy-key
1247
+ assert_has "$tmp/$current/legacy-key.txt" "TEAM_DEFAULT_MODEL" "诊断保留原退休键事实"
1248
+ assert_no_match "$tmp/$current/legacy-key.txt" '^│ [› ] TEAM_DEFAULT_MODEL +' "退休键没有编辑行"
1249
+ assert_not "$tmp/$current/legacy-key.txt" "set-agent-model" "没有退休写路线"
1635
1250
  }
1636
1251
 
1637
1252
  scn_flip() {
@@ -1648,9 +1263,9 @@ old = '"config","set-task-model"'
1648
1263
  assert old in s, "找不到面板的 set-task-model 路由字节"
1649
1264
  open(route, 'w', encoding='utf-8').write(s.replace(old, '"config","set-agent-model"', 1))
1650
1265
  a = open(actual, encoding='utf-8').read()
1651
- old2 = 'B.assigned?B.model||J.dash:J.dash'
1652
- assert old2 in a, "找不到派单行的显示规则字节"
1653
- open(actual, 'w', encoding='utf-8').write(a.replace(old2, 'Q.blocks.settings.models.policy.categories[0].model', 1))
1266
+ old2 = 'B.assigned?B.model||J.dash:B.record_present===!1?J.settingsAssignmentNone:J.settingsAssignmentUnreadable'
1267
+ assert a.count(old2) == 1, "找不到唯一派单行的显示规则字节"
1268
+ open(actual, 'w', encoding='utf-8').write(a.replace(old2, 'I.blocks.settings.models.policy.categories[0].model', 1))
1654
1269
  PYPATCH
1655
1270
  # 红侧 ①:面板的写入路由改成退休的席位写入 → 写路径的 argv 断言必须红
1656
1271
  TEAM_P21_PANEL="$ft/panel-route.js" bash "$here/panel-p21.sh" policy > "$tmp/flip-route-red.log" 2>&1
@@ -1692,15 +1307,25 @@ scn_readonly() {
1692
1307
  keys 3; sleep 0.5
1693
1308
  keys 1; sleep 0.5
1694
1309
  open_view
1310
+ open_secondary records
1311
+ local records_before; records_before="$(sha "$(cfg)")"
1312
+ keys Enter; sleep 0.4; keys Escape; sleep 0.4
1313
+ assert_eq "记录打开与返回不写配置" "$(sha "$(cfg)")" "$records_before"
1314
+ keys Escape; sleep 0.4
1315
+ open_secondary commands
1695
1316
  filter_to TEAM_GATES
1696
1317
  sleep 0.5
1697
1318
  keys Enter
1698
- wait_editor TEAM_GATES "没有选项集" || bad "readonly 用例的编辑器没有打开"
1319
+ wait_editor TEAM_GATES "true" || bad "readonly 用例的编辑器没有打开"
1699
1320
  type_text "changed"
1700
1321
  sleep 0.3
1701
1322
  # The three unwind escs are the test action, but each is still state-checked (M59): a drifted
1702
1323
  # scene gets a named red instead of a blind key closing whatever happens to be on screen.
1703
1324
  leave_editor TEAM_GATES || bad "readonly:编辑器 esc 后还在"
1325
+ filter_clear
1326
+ pty_key_when "readonly 返回主设置" '╭─ 项目命令' Escape || bad "readonly:命令页不在屏幕上"
1327
+ pty_wait_frame - "readonly 主设置" '╭─ 项目设置' || bad "readonly:未回主设置"
1328
+ filter_clear
1704
1329
  pty_key_when "readonly 退回浮层" '╭─ 项目设置' Escape || bad "readonly:esc 前设置视图不在屏幕上"
1705
1330
  sleep 0.6
1706
1331
  pty_key_when "readonly 关闭浮层" '› 项目设置' Escape || bad "readonly:第二次 esc 前浮层不在屏幕上"
@@ -1822,38 +1447,24 @@ wait_settings_frame() { # <rows> <cap name> → 0 = 帧按新行高画完整
1822
1447
  # 键栏之间的空白行数。打印 "<rows> <hidden_up> <hidden_down> <gap>"(认不出来打印 "-1 -1 -1 -1")。
1823
1448
  settings_window_stats() { # <capture file>
1824
1449
  python3 - "$1" <<'PY'
1825
- import re, sys
1826
- lines = open(sys.argv[1], encoding='utf-8', errors='replace').read().split('\n')
1827
- top = next((i for i, l in enumerate(lines) if l.lstrip().startswith('\u256d\u2500 项目设置') or l.lstrip().startswith('\u256d\u2500 Project settings')), -1)
1828
- bot = next((i for i, l in enumerate(lines) if i > top and l.lstrip().startswith('\u2570')), -1)
1829
- foot = next((i for i, l in enumerate(lines) if i > bot and ('\u5199\u4fe1' in l or 'compose' in l)), -1)
1830
- if top < 0 or bot < 0 or foot < 0:
1831
- print('-1 -1 -1 -1'); sys.exit(0)
1832
- interior = lines[top + 1:bot]
1833
- # P266:尾部只剩聚焦行的 CLI 提示行(有迁移诊断时还有它那一块)——不再有审计块。内容的最后一条
1834
- # 非空行就是提示行(或诊断的最后一行);诊断存在时,尾部从诊断标题那一行开始(提示行在它上面,也
1835
- # 属于尾部)。
1836
- content = [i for i, l in enumerate(interior) if l.strip('\u2502 ').rstrip()]
1837
- if not content:
1838
- print('-1 -1 -1 -1'); sys.exit(0)
1839
- diag = next((i for i, l in enumerate(interior) if '\u65e7\u8bbe\u7f6e\u9700\u8981\u5347\u7ea7' in l or 'need an upgrade' in l), -1)
1840
- if diag >= 0:
1841
- above = [i for i in content if i < diag]
1842
- tail_start = above[-1] if above else diag
1843
- else:
1844
- tail_start = content[-1]
1845
- rows = up = down = 0
1846
- for i, l in enumerate(interior):
1847
- b = l.strip('\u2502 ').rstrip()
1848
- m = re.fullmatch(r'([\u2191\u2193])(\d+)', b)
1450
+ import re,sys
1451
+ lines=open(sys.argv[1],encoding='utf-8',errors='replace').read().splitlines()
1452
+ titles=('项目设置','Project settings','项目命令','Project commands','模型记录','Model records','模型同时运行任务数','Concurrent tasks by model','编辑限制','Edit limit')
1453
+ top=next((i for i,l in enumerate(lines) if any(l.lstrip().startswith('╭─ '+t) for t in titles)),-1)
1454
+ bot=next((i for i,l in enumerate(lines) if i>top and l.lstrip().startswith('╰')),-1)
1455
+ foot=next((i for i,l in enumerate(lines) if i>bot and ('写信' in l or 'compose' in l)),-1)
1456
+ if min(top,bot,foot)<0:
1457
+ print('-1 -1 -1 -1'); sys.exit()
1458
+ rows=up=down=0
1459
+ for l in lines[top+1:bot]:
1460
+ text=l.strip('│ ').rstrip()
1461
+ m=re.fullmatch(r'([↑↓])(\d+)',text)
1849
1462
  if m:
1850
- if m.group(1) == '\u2191': up = int(m.group(2))
1851
- else: down = int(m.group(2))
1852
- continue
1853
- if i >= tail_start or not b or '\u2500' in b:
1854
- continue
1855
- rows += 1
1856
- print('%d %d %d %d' % (rows, up, down, foot - bot - 1))
1463
+ if m[1]=='↑': up=int(m[2])
1464
+ else: down=int(m[2])
1465
+ elif re.match(r'^│ [› ] ',l) and text:
1466
+ rows+=1
1467
+ print(rows,up,down,foot-bot-1)
1857
1468
  PY
1858
1469
  }
1859
1470
 
@@ -1884,231 +1495,66 @@ wait_line_gt() { # <name> <label> <needle> <threshold>
1884
1495
 
1885
1496
  # The same capture with SGR runs (`capture-pane -e`): tmux restores each cell's truecolor
1886
1497
  # sequence, which is what the tone assertion reads (without rebuilding the bundle by hand).
1887
- cap_e_to() { tmux -L "$sock" capture-pane -p -e -t "$sess:panel" > "$tmp/$current/${1:-cap-e}.txt" 2>/dev/null; }
1888
-
1889
1498
  assert_no_match() { # <file> <ere> <message>
1890
1499
  grep -qE -- "$2" "$1" 2>/dev/null && bad "$3(不该匹配 [$2])" || ok "$3"
1891
1500
  }
1892
1501
 
1893
- # P30/D4 tone: the badge's colour must be the class's tone **and** the value beside it must stay in
1894
- # the palette's text tone. Colours come from the bundle's own `--palette` (nothing hardcoded; the
1895
- # active theme is identified by which palette's text tone the value's colour is).
1896
- assert_badge_tone() { # <capture-e file> <row label> <badge word> <tone key> <message>
1897
- local msg="$5" out rc
1898
- out="$(python3 - "$1" "$2" "$3" "$4" "$tmp/$current/palette.json" <<'PY'
1899
- import json, re, sys
1900
- cap_file, label, badge, tone_key, palette_file = sys.argv[1:6]
1901
- SGR = re.compile(r'\x1b\[[0-9;]*m')
1902
-
1903
- def runs(line):
1904
- out, last, pos = [], '', 0
1905
- for m in SGR.finditer(line):
1906
- if line[pos:m.start()]:
1907
- out.append((last, line[pos:m.start()]))
1908
- last = m.group(0)
1909
- pos = m.end()
1910
- if line[pos:]:
1911
- out.append((last, line[pos:]))
1912
- return out
1913
-
1914
- def color(sgr):
1915
- m = re.search(r'38;2;(\d+);(\d+);(\d+)', sgr)
1916
- return '#%02x%02x%02x' % tuple(int(x) for x in m.groups()) if m else 'default'
1917
-
1918
- line = next((l for l in open(cap_file, encoding='utf-8', errors='replace') if label in l and badge in l), '')
1919
- if not line:
1920
- print('找不到同时含 %r 与 %r 的行' % (label, badge)); sys.exit(1)
1921
- rs = runs(line)
1922
- li = next((i for i, (_, t) in enumerate(rs) if label in t), None)
1923
- bi = next((i for i, (_, t) in enumerate(rs) if badge in t), None)
1924
- if li is None or bi is None or bi <= li:
1925
- print('run 结构不对(label=%s badge=%s)' % (li, bi)); sys.exit(1)
1926
- vi = next((i for i in range(li + 1, bi) if rs[i][1].strip()), bi)
1927
- value_color, badge_color = color(rs[vi][0]), color(rs[bi][0])
1928
- palettes = json.load(open(palette_file, encoding='utf-8'))['palettes']
1929
- active = next((p for p in palettes.values() if p['tones']['text'].lower() == value_color), None)
1930
- if active is None:
1931
- print('值的颜色 %s 不在任何调色板的 text tone 里' % value_color); sys.exit(1)
1932
- want = active['tones'][tone_key].lower()
1933
- if badge_color != want:
1934
- print('badge 颜色 %s ≠ %s tone %s(调色板 %s)' % (badge_color, tone_key, want, active['name'])); sys.exit(1)
1935
- print('%s badge=%s value=%s(text)palette=%s' % (badge, badge_color, value_color, active['name']))
1936
- PY
1937
- )"
1938
- rc=$?
1939
- if [ "$rc" -eq 0 ]; then ok "$msg($out)"; else bad "$msg:$out"; fi
1940
- }
1941
-
1942
- # 把焦点走到列表末尾(窗口跟着焦点走),让尾部的「未分组」与类别块同一屏 —— 这两样都在
1943
- # 「分组之后」,是场景要看的相对顺序。
1944
- walk_to_tail() { # <capture name>
1945
- local i attempt name="${1:-tail}" hit=0
1946
- for attempt in $(seq 1 6); do
1947
- for i in $(seq 1 140); do keys Down; sleep 0.01; done
1948
- for i in $(seq 1 12); do
1949
- cap_to "$name"
1950
- # P266:类别块的标题改成普通话(两种语言各一条)——尾部的“到了”判据跟着标题走。
1951
- if { grep -q '下一次派任务会用的模型' "$tmp/$current/$name.txt" || grep -q 'The model the next task will use' "$tmp/$current/$name.txt"; } \
1952
- && grep -q '›' "$tmp/$current/$name.txt"; then hit=1; break; fi
1953
- sleep 0.4 # 块被 TTL 重读换成摘要行(已知现象)→ 等它回来,必要时再走一轮
1954
- done
1955
- [ "$hit" = 1 ] && break
1956
- done
1957
- return 0
1958
- }
1959
-
1960
1502
  scn_groups() {
1961
- section "groups · 记录带 group、视图按功能域分组(P30/D1-D3):功能域标题/读取顺序/schema 序/未分组降级/无键→域表/徽章词+tone"
1503
+ section "groups · 用途标题/源顺序类别/非交互标题/新键隐藏/保留键权限"
1962
1504
  server_up groups
1963
- # P232:尾部的相对顺序现在是「未分组 → 类别块」,类别块要有行才画得出标题。
1964
- policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
1965
- || bad "策略升级事务没有跑通"
1966
- # 契约里手加一个 schema 不认识的键:它必须落在可见的「未分组」组里(和缺 token 的 schema 行同一条降级路径)。
1967
- printf 'TEAM_HAND_ADDED="hand"\n' >> "$(cfg)"
1968
- conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1969
- start_panel
1970
- local bundle_sha; bundle_sha="$(sha "$panel")"
1971
- "$js" "$panel" --palette > "$tmp/$current/palette.json" 2>/dev/null
1972
- open_view
1505
+ policy_new 'custom=example/custom routine=example/one verify=example/two' 'example/pm' || bad "策略准备失败"
1506
+ start_panel; open_view
1973
1507
  cap_to view
1974
- # ① 标题 = 功能域、按读取顺序;类词只活在行徽章里(没有「只有类词」的行)。
1975
- assert_has "$tmp/$current/view.txt" "身份与账本布局" "第一组标题是 identity 的功能域名"
1976
- # P32(用户的第一条反馈):标题与选项行必须在渲染上可区分。标题是分节线(── 标题 ────),
1977
- # 键行不带分节线;标题行同时把两组隔开(上一行=上一组最后一条,下一行=本组第一条)。
1978
- assert_no_match "$tmp/$current/view.txt" '^│ [› ] 项目名.*─' "键行不带分节线(标题/行在渲染上可区分)"
1979
- assert_heading_rule "$tmp/$current/view.txt" "分支与 forge" "契约文件" "分支命名模式" "组间可见分隔:标题是分节线且夹在两组之间"
1980
- # 读取顺序:identity 的 12 条走完,下一组标题就是 branch(窗口跟着焦点,标题只在它的行进窗时画)。
1981
- # 带注释的行是两行,窗口按**画出的行数**装(P30/D5 的账),所以这里一步一步走,不假设一屏能装两组。
1982
- local k
1983
- for k in $(seq 1 12); do keys Down; sleep 0.05; done
1984
- # P68:等那一行(下一组标题)在稳定帧上出现,不用固定 sleep + 单次采样。
1985
- wait_row group-order "第 13 行进窗时的下一组标题" '分支与 forge' \
1986
- || bad "第 13 行进窗后没有出现下一组标题"
1987
- assert_has "$tmp/$current/group-order.txt" "分支与 forge" "第 13 行进窗时出现下一组标题(读取顺序 identity → branch)"
1988
- for k in $(seq 1 12); do keys Up; sleep 0.05; done
1989
- sleep 0.4
1508
+ assert_has "$tmp/$current/view.txt" "模型" "第一用途模型"
1509
+ assert_heading_rule "$tmp/$current/view.txt" "自动检查" "模型同时运行任务数" "检查间隔" "两个用途用分节线隔开"
1990
1510
  assert_no_class_heading "$tmp/$current/view.txt"
1991
- # ② 组内保持 schema 顺序(identity:项目名 → 会话名 → PM 窗口)。
1992
- local n_proj n_sess n_pm
1993
- n_proj="$(cap_line_of "$tmp/$current/view.txt" '项目名')"
1994
- n_sess="$(cap_line_of "$tmp/$current/view.txt" '会话名')"
1995
- n_pm="$(cap_line_of "$tmp/$current/view.txt" 'PM 窗口')"
1996
- if [ "$n_proj" -gt 0 ] && [ "$n_proj" -lt "$n_sess" ] && [ "$n_sess" -lt "$n_pm" ]; then
1997
- ok "组内是 schema 顺序(项目名=$n_proj < 会话名=$n_sess < PM 窗口=$n_pm)"
1998
- else
1999
- bad "组内顺序不对(项目名=$n_proj 会话名=$n_sess PM 窗口=$n_pm)"
2000
- fi
2001
- # ③ 类徽章是词 + tone(D4):三类各过滤一行;词在,tone = 调色板里该类的 tone,值必须是 text tone。
2002
- filter_to TEAM_MODEL_LIMITS
2003
- wait_row tone-apply "apply 徽章行" '模型并发上限' '立即生效' \
2004
- || bad "apply 行没等到(超过等待上限)"
2005
- cap_e_to tone-apply-e
2006
- assert_match "$tmp/$current/tone-apply.txt" '模型并发上限 +.*立即生效' "apply 行的徽章词仍在(颜色不是唯一通道)"
2007
- assert_badge_tone "$tmp/$current/tone-apply-e.txt" '模型并发上限' '立即生效' 'text' "apply 徽章 = 普通文本 tone"
2008
- filter_to TEAM_PULSE_INTERVAL
2009
- wait_row tone-restart "restart 徽章行" '巡检周期' '需重启' \
2010
- || bad "restart 行没等到(超过等待上限)"
2011
- cap_e_to tone-restart-e
2012
- assert_match "$tmp/$current/tone-restart.txt" '巡检周期 +.*需重启' "restart 行的徽章词仍在"
2013
- assert_badge_tone "$tmp/$current/tone-restart-e.txt" '巡检周期' '需重启' 'warn' "restart 徽章 = warn tone"
2014
- filter_to TEAM_PROJECT
2015
- wait_row tone-refuse "refuse 徽章行" '项目名' 'root · 不可改' \
2016
- || bad "refuse 行没等到(超过等待上限)"
2017
- cap_e_to tone-refuse-e
2018
- assert_match "$tmp/$current/tone-refuse.txt" '项目名 +root · 不可改' "refuse 行的徽章词仍在"
2019
- assert_badge_tone "$tmp/$current/tone-refuse-e.txt" '项目名' '不可改' 'dim' "refuse 徽章 = dim tone"
2020
- # ④ 可见降级:schema 不认识的键落在「未分组」,且「未分组」在席位块之前(走到列表末尾看)。
2021
- filter_to TEAM_HAND_ADDED
2022
- wait_row hand-added "未分组里的手加未知键行" 'TEAM_HAND_ADDED' 'hand · 不认识' \
2023
- || bad "未知键的行没等到(超过等待上限)"
2024
- assert_match "$tmp/$current/hand-added.txt" 'TEAM_HAND_ADDED +hand · 不认识' "未知键的行仍在(没有消失)"
2025
- assert_has "$tmp/$current/hand-added.txt" "TEAM_HAND_ADDED:这个设置在文件里" "未知键仍按原始键点名"
2026
- [ "$(cap_line_heading "$tmp/$current/hand-added.txt" '未分组')" -gt 0 ] \
2027
- && ok "未知键落在可见的「未分组」标题下" || bad "未知键没有落在「未分组」标题下"
2028
- filter_clear
2029
- sleep 0.4
2030
- walk_to_tail tail
2031
- local n_ungrouped n_categories
2032
- n_ungrouped="$(cap_line_heading "$tmp/$current/tail.txt" '未分组')"
2033
- n_categories="$(cap_line_heading "$tmp/$current/tail.txt" '下一次派任务会用的模型')"
2034
- if [ "$n_ungrouped" -gt 0 ] && [ "$n_categories" -gt 0 ] && [ "$n_ungrouped" -lt "$n_categories" ]; then
2035
- ok "「未分组」在类别块之前(未分组=$n_ungrouped < 任务类别=$n_categories)"
2036
- else
2037
- bad "尾部顺序不对(未分组=$n_ungrouped 任务类别=$n_categories)"
2038
- fi
2039
- # ⑤ 无键→域表:scratch CLI 让 TEAM_ZZZ_TEST 带 workflow、把 TEAM_GATES 移到 meeting;
2040
- # 提交的那份 bundle 必须跟着两个标题走(bundle 里没有第二张键表/组表)。
1511
+ assert_match "$tmp/$current/view.txt" '› custom +example/custom' "自定义类别按源顺序先显示"
1512
+ keys Down
1513
+ wait_row next-category "标题不是焦点停点" "› routine" || bad "类别焦点越过标题失败"
1514
+ cap_to order
1515
+ assert_match "$tmp/$current/order.txt" '› routine' "第二类别是实际源的routine"
1516
+ local before y
1517
+ before="$(sha "$(cfg)")"; y="$(cap_line_heading "$tmp/$current/view.txt" 模型)"
1518
+ click_at 8 "$y"; sleep 0.4; cap_to heading-click
1519
+ assert_match "$tmp/$current/heading-click.txt" '› routine' "标题不是点击目标"
1520
+ assert_eq "标题点击不写" "$(sha "$(cfg)")" "$before"
2041
1521
  local scratch="$tmp/$current/scratch"
2042
1522
  mkdir -p "$scratch/skills/teamsmith"
2043
1523
  cp -a "$skill/scripts" "$scratch/skills/teamsmith/scripts"
2044
1524
  cp -a "$skill/templates" "$skill/references" "$scratch/skills/teamsmith/"
2045
- python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
1525
+ python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYCFG'
2046
1526
  import sys
2047
- p = sys.argv[1]
2048
- s = open(p, encoding='utf-8').read()
2049
- gates = 'TEAM_GATES|apply|cmd||plain||-|||workflow'
2050
- assert gates in s, '找不到 TEAM_GATES 的 10 列 schema 行'
2051
- s = s.replace(gates, gates.replace('|workflow', '|meeting'), 1)
2052
- anchor = 'TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'
2053
- assert anchor in s, '找不到 TEAM_INSTALL_CMD 的 schema 行'
2054
- s = s.replace(anchor, 'TEAM_ZZZ_TEST|apply|text||plain|zzz-default|-|||workflow\n' + anchor, 1)
2055
- open(p, 'w', encoding='utf-8').write(s)
2056
- PY
2057
- cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
1527
+ p=sys.argv[1]; s=open(p).read()
1528
+ gates='TEAM_GATES|apply|cmd||plain||-|||workflow'; assert gates in s
1529
+ s=s.replace(gates,'TEAM_GATES|refuse|cmd||plain||-|change acceptance in config||meeting')
1530
+ anchor='TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'; assert anchor in s
1531
+ s=s.replace(anchor,'TEAM_ZZZ_TEST|apply|text||plain|zzz|-|||meeting\n'+anchor)
1532
+ # 取消fixture标记也不能使未精选键变成操作。
1533
+ s=s.replace('fixture-only: 只在测试套件里用(磁盘读数夹具)','')
1534
+ open(p,'w').write(s)
1535
+ PYCFG
1536
+ cat > "$tmp/$current-scratch-wrapper.sh" <<EOF
2058
1537
  #!/usr/bin/env bash
2059
1538
  printf '%s\n' "\$*" >> "$tmp/$current-scratch-argv.log"
2060
1539
  exec bash "$scratch/skills/teamsmith/scripts/team" "\$@"
2061
- EOF2
1540
+ EOF
2062
1541
  chmod +x "$tmp/$current-scratch-wrapper.sh"
2063
- # `VAR=x func` 的赋值只活到函数返回 —— 本段要起两次面板(同 scn_choices_schema 的教训)。
2064
- P21_CLI="$tmp/$current-scratch-wrapper.sh"
2065
- start_panel
2066
- open_view
2067
- filter_to TEAM_ZZZ_TEST
2068
- wait_row zzz-group "scratch 新增键落在 workflow 域标题下" '工作流与门禁' 'TEAM_ZZZ_TEST' \
2069
- || bad "新键的域标题/行没等到(超过等待上限)"
2070
- assert_has "$tmp/$current/zzz-group.txt" "工作流与门禁" "schema 新增键落在它声明的 workflow 域下(bundle 未重建)"
2071
- assert_match "$tmp/$current/zzz-group.txt" 'TEAM_ZZZ_TEST +未设 · 默认 zzz-default' "新键的行完整(值/默认来自 schema)"
2072
- filter_to TEAM_GATES
2073
- wait_row gates-moved "TEAM_GATES 跟到 meeting 域标题下" '跨项目会议' '门禁命令' \
2074
- || bad "TEAM_GATES 的新域标题/行没等到(超过等待上限)"
2075
- assert_has "$tmp/$current/gates-moved.txt" "跨项目会议" "TEAM_GATES 的 token 改成 meeting 后跟到新标题下(bundle 里没有键→域表)"
2076
- assert_match "$tmp/$current/gates-moved.txt" '门禁命令 +true · 立即生效' "同一行仍按 schema 渲染(标签/值/徽章)"
2077
- assert_eq "三次运行之间 bundle 逐字节不变" "$(sha "$panel")" "$bundle_sha"
2078
- # ⑥ 第 10 列缺失 = 畸形行:走查那边判红(config-cli.sh 的 groups 段),视图这边可见降级到「未分组」,
2079
- # 行本身(标签/值/徽章/命令行)一个字不少。
2080
- python3 - "$scratch/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
2081
- import sys
2082
- p = sys.argv[1]
2083
- s = open(p, encoding='utf-8').read()
2084
- row = 'TEAM_GATES|apply|cmd||plain||-|||meeting'
2085
- assert row in s, '找不到移动后的 TEAM_GATES 行'
2086
- s = s.replace(row, 'TEAM_GATES|apply|cmd||plain||-|', 1)
2087
- open(p, 'w', encoding='utf-8').write(s)
2088
- PY
2089
- start_panel
1542
+ P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
2090
1543
  open_view
1544
+ for k in TEAM_ZZZ_TEST TEAM_DISK_STATS_FILE; do
1545
+ filter_to "$k"; cap_to "$k"
1546
+ assert_no_match "$tmp/$current/$k.txt" '^│ [› ] [^│]*[^[:space:]│]' "新键或取消标记不会自动显示($k)"
1547
+ done
1548
+ open_secondary commands
2091
1549
  filter_to TEAM_GATES
2092
- wait_row gates-fallback "畸形 schema 行落在「未分组」里" '未分组' '门禁命令' \
2093
- || bad "降级组的行没等到(超过等待上限)"
1550
+ wait_row permission "保留键仍跟源权限/route" "验收命令" "change acceptance in config" || bad "原权限/route未显示"
1551
+ local h; h="$(sha "$(cfg)")"
1552
+ keys Enter
1553
+ wait_cap refused "change acceptance in config" || bad "refuse没有真实route"
1554
+ assert_eq "refuse没有写" "$(sha "$(cfg)")" "$h"
1555
+ cap_to refusal
1556
+ assert_not "$tmp/$current/refusal.txt" "Enter 继续" "refuse没有可写输入"
2094
1557
  unset P21_CLI
2095
- assert_has "$tmp/$current/gates-fallback.txt" "未分组" "第 10 列缺失的 schema 行落在可见的降级组里(不消失)"
2096
- assert_match "$tmp/$current/gates-fallback.txt" '门禁命令 +true · 立即生效' "降级组里的行仍完整(标签/值/徽章)"
2097
- assert_has "$tmp/$current/gates-fallback.txt" "命令行:team config set TEAM_GATES <新值>" "降级组里的行仍给出命令行"
2098
- # 同一个 scratch 树里,「未分组」现在同时装着手加的未知键与畸形行:走到末尾,两者同屏且在席位之前。
2099
- filter_clear
2100
- sleep 0.4
2101
- walk_to_tail tail-scratch
2102
- assert_has "$tmp/$current/tail-scratch.txt" "TEAM_HAND_ADDED" "降级组里未知键与畸形行同屏(未知键可见)"
2103
- assert_has "$tmp/$current/tail-scratch.txt" "门禁命令" "降级组里畸形行同屏(schema 行可见)"
2104
- local n_u n_s
2105
- n_u="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '未分组')"
2106
- n_s="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '下一次派任务会用的模型')"
2107
- if [ "$n_u" -gt 0 ] && [ "$n_s" -gt 0 ] && [ "$n_u" -lt "$n_s" ]; then
2108
- ok "scratch 尾部:「未分组」仍在类别块之前($n_u < $n_s)"
2109
- else
2110
- bad "scratch 尾部顺序不对(未分组=$n_u 任务类别=$n_s)"
2111
- fi
2112
1558
  }
2113
1559
 
2114
1560
  scn_wheel_settings() {
@@ -2117,6 +1563,9 @@ scn_wheel_settings() {
2117
1563
  # P232:类别 picker 用例要有类别可开。
2118
1564
  policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
2119
1565
  || bad "策略升级事务没有跑通"
1566
+ local map='routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' k
1567
+ for k in $(seq 1 60); do map="$map cat$k=example/model$k"; done
1568
+ policy_new "$map" 'openai-codex/gpt-6.1-sol:high' || bad "长列表准备失败"
2120
1569
  # 页面(page 3 的巡检块)要真的滚得动,「页面没被穿透」才有可观察的对照:写满 12 行巡检日志。
2121
1570
  mkdir -p "$state"
2122
1571
  python3 - "$state/watchdog.log" <<'PY'
@@ -2137,7 +1586,7 @@ PY
2137
1586
  # ② 视图里的滚轮:一格一行、焦点不动、顶部计数行跟随(先下滚 3 格,再上滚回顶部)。
2138
1587
  open_view
2139
1588
  cap_to wheel-before
2140
- assert_match "$tmp/$current/wheel-before.txt" '› 项目名 +.*不可改' "视图开屏焦点在第一行(identity 第一条)"
1589
+ assert_match "$tmp/$current/wheel-before.txt" '› routine +kimi-coding/k3-256k' "视图开屏焦点在第一行(identity 第一条)"
2141
1590
  wheel_at down 20 10 3
2142
1591
  local i
2143
1592
  for i in $(seq 1 20); do
@@ -2146,17 +1595,17 @@ PY
2146
1595
  sleep 0.25
2147
1596
  done
2148
1597
  assert_match "$tmp/$current/wheel-down.txt" '↑3' "下滚 3 格:顶部计数行读出 ↑3(窗口正好移 3 行)"
2149
- assert_not "$tmp/$current/wheel-down.txt" "项目名" "下滚 3 格:原本第一行(项目名)已出窗"
2150
- assert_has "$tmp/$current/wheel-down.txt" "名册" "下滚 3 格:后面的行进窗(窗口第一行 = 第 4 条)"
2151
- assert_no_match "$tmp/$current/wheel-down.txt" '›' "下滚 3 格:焦点没动(光标落在已出窗的项目名上,窗口里没有光标行)"
2152
- assert_has "$tmp/$current/wheel-down.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "下滚 3 格:命令行提示仍在"
1598
+ assert_not "$tmp/$current/wheel-down.txt" "routine" "下滚 3 格:原本第一行(routine)已出窗"
1599
+ assert_has "$tmp/$current/wheel-down.txt" "cat2" "下滚 3 格:后面的行进窗(窗口第一行 = 第 4 条)"
1600
+ assert_no_match "$tmp/$current/wheel-down.txt" '›' "下滚 3 格:焦点没动(光标落在已出窗的routine上,窗口里没有光标行)"
1601
+ assert_has "$tmp/$current/wheel-down.txt" "新任务生效" "下滚 3 格:命令行提示仍在"
2153
1602
  wheel_at up 20 10 3
2154
1603
  for i in $(seq 1 20); do
2155
1604
  cap_to wheel-up
2156
1605
  grep -qE '↑[0-9]+' "$tmp/$current/wheel-up.txt" || break
2157
1606
  sleep 0.25
2158
1607
  done
2159
- assert_match "$tmp/$current/wheel-up.txt" '› 项目名' "上滚 3 格:窗口回到顶部,第一行回来"
1608
+ assert_match "$tmp/$current/wheel-up.txt" '› routine' "上滚 3 格:窗口回到顶部,第一行回来"
2160
1609
  assert_no_match "$tmp/$current/wheel-up.txt" '↑[0-9]+' "上滚 3 格:顶部计数行消失"
2161
1610
  # ③ 焦点键把窗口推到聚焦行(滚开之后 enter 打开的就是命令行点名的那一行)。
2162
1611
  wheel_at down 20 10 3
@@ -2166,25 +1615,22 @@ PY
2166
1615
  sleep 0.25
2167
1616
  done
2168
1617
  keys Down
2169
- # P68:等窗口被推到聚焦行(↑1 + 光标在会话名)在稳定帧上,不用固定 sleep 采样。
2170
- wait_row wheel-push "↓ 之后窗口被推到聚焦行(↑1 + › 会话名)" '↑1' '› 会话名' \
1618
+ # P68:等窗口被推到聚焦行(↑1 + 光标在analysis)在稳定帧上,不用固定 sleep 采样。
1619
+ wait_row wheel-push "↓ 之后窗口被推到聚焦行(↑1 + › analysis)" '↑1' '› analysis' \
2171
1620
  || bad "↓ 之后窗口没有被推到聚焦行上"
2172
1621
  assert_match "$tmp/$current/wheel-push.txt" '↑1' "↓ 之后窗口被推到聚焦行上(顶部计数行 = ↑1)"
2173
- assert_match "$tmp/$current/wheel-push.txt" '› 会话名' "光标落在下一条(会话名)"
2174
- assert_has "$tmp/$current/wheel-push.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "命令行提示与光标同一屏(焦点在会话名上)"
1622
+ assert_match "$tmp/$current/wheel-push.txt" '› analysis' "光标落在下一条(analysis)"
1623
+ assert_has "$tmp/$current/wheel-push.txt" "新任务生效" "命令行提示与光标同一屏(焦点在analysis上)"
2175
1624
  keys Up
2176
1625
  # `↑` 计数行消失(字面 needle:`!↑1` = 刚才那条 ↑1 不再在屏幕上;pty-wait 是 grep -F,不吃正则,
2177
1626
  # 所以不能用原断言的 `↑[0-9]+`;下面的 assert_no_match 仍守住正则面)。
2178
- wait_row wheel-push-back "↑ 之后窗口回到顶部(↑1 计数行消失)" '› 项目名' '!↑1' \
1627
+ wait_row wheel-push-back "↑ 之后窗口回到顶部(↑1 计数行消失)" '› routine' '!↑1' \
2179
1628
  || bad "↑ 之后窗口没有回到顶部"
2180
- assert_match "$tmp/$current/wheel-push-back.txt" '› 项目名' "↑ 之后光标回到第一条"
1629
+ assert_match "$tmp/$current/wheel-push-back.txt" '› routine' "↑ 之后光标回到第一条"
2181
1630
  assert_no_match "$tmp/$current/wheel-push-back.txt" '↑[0-9]+' "窗口跟着回到顶部(计数行消失)"
2182
1631
  keys Enter
2183
- if wait_cap wheel-enter "只能改项目配置文件 .pi/team/config.sh 里的这一行"; then
2184
- ok "enter 打开的行 = 回执点名的那一行(项目名的只读路线)"
2185
- else
2186
- bad "enter 之后没有出现聚焦行的路线回执"
2187
- fi
1632
+ wait_picker routine "kimi-coding/k3-256k" || bad "Enter没有打开聚焦类别"
1633
+ leave_picker routine || bad "类别picker未返回"
2188
1634
  # ④ 选择器开着时滚轮走条目、页面不动;esc 之后选择器是关着的(一次 esc 就够)。
2189
1635
  filter_to TEAM_PULSE_INTERVAL
2190
1636
  sleep 0.5
@@ -2203,25 +1649,23 @@ PY
2203
1649
  else
2204
1650
  bad "选择器里的滚轮没有走条目(选中行 $sel_before → $sel_after)"
2205
1651
  fi
2206
- pty_key_when "选选择器的 esc" ' · TEAM_PULSE_INTERVAL' Escape || bad "选择器不在稳定帧上,esc 没有发"
1652
+ pty_key_when "选选择器的 esc" '╭─ 检查间隔' Escape || bad "选择器不在稳定帧上,esc 没有发"
2207
1653
  # P68:等 esc 的效果(选择器关掉、仍在设置视图里)在稳定帧上。
2208
- wait_row picker-closed "一次 esc 关掉选择器且仍在设置视图里" '! · TEAM_PULSE_INTERVAL' '╭─ 项目设置' \
1654
+ wait_row picker-closed "一次 esc 关掉选择器且仍在设置视图里" '!╭─ 检查间隔' '╭─ 项目设置' \
2209
1655
  || bad "一次 esc 没有关掉选择器(或不在设置视图里了)"
2210
- assert_not "$tmp/$current/picker-closed.txt" " · TEAM_PULSE_INTERVAL" "一次 esc 就把选择器关掉(不穿透)"
1656
+ assert_not "$tmp/$current/picker-closed.txt" "╭─ 检查间隔" "一次 esc 就把选择器关掉(不穿透)"
2211
1657
  assert_has "$tmp/$current/picker-closed.txt" "╭─ 项目设置" "关闭后仍在设置视图里"
2212
1658
  # ⑤ 类别 picker 走同一套 widget(条目滚动已在 ④ 证过)。P232:席位 picker 随席位模型一起退休,
2213
1659
  # 类别 picker 是它的接任者 —— 这里守两件事:它自己的条目列表在滚轮下会走,且页面不因此滚动
2214
1660
  # (⑥ 关掉视图后仍断言页面停在这一屏)。
2215
- filter_clear
2216
- filter_to 类别
2217
- sleep 0.5
2218
- if focus_row '› 类别 routine'; then
1661
+ filter_to routine
1662
+ if focus_row '› routine'; then
2219
1663
  keys Enter
2220
1664
  else
2221
- bad "没能把焦点移到类别 routine 行"
1665
+ bad "没能把焦点移到routine 行"
2222
1666
  fi
2223
1667
  # 类别 picker 的标题是「选择类别 <category> 的模型」(没有 ` · KEY` 后缀),用 pty_wait_frame 等它。
2224
- if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
1668
+ if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "╭─ routine" "· 当前"; then
2225
1669
  ok "类别 picker 打开(标题 + 自由输入项)"
2226
1670
  else
2227
1671
  bad "类别 picker 没有打开"
@@ -2231,13 +1675,14 @@ PY
2231
1675
  wheel_at down 20 12 2
2232
1676
  sleep 0.6
2233
1677
  cap_to cat-wheel-after
2234
- assert_has "$tmp/$current/cat-wheel-after.txt" "选择类别 routine 的模型" "滚轮之后类别 picker 还开着(没穿透)"
2235
- pty_key_when "类别 picker 的 esc" '选择类别 routine 的模型' Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
1678
+ assert_has "$tmp/$current/cat-wheel-after.txt" "╭─ routine" "滚轮之后类别 picker 还开着(没穿透)"
1679
+ pty_key_when "类别 picker 的 esc" '╭─ routine' Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
2236
1680
  # P68:等类别 picker 关掉(仍在设置视图里)在稳定帧上。
2237
- wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!选择类别 routine 的模型' '╭─ 项目设置' \
1681
+ wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!╭─ routine' '╭─ 项目设置' \
2238
1682
  || bad "一次 esc 没有关掉类别 picker"
2239
- assert_not "$tmp/$current/cat-picker-closed.txt" "选择类别 routine 的模型" "一次 esc 关掉类别 picker"
1683
+ assert_not "$tmp/$current/cat-picker-closed.txt" "╭─ routine" "一次 esc 关掉类别 picker"
2240
1684
  # ⑥ 回到页面:视图把滚轮吃掉了 —— 页面还是进视图前的那一屏(P-01 出屏、P-04 可见)。
1685
+ filter_clear
2241
1686
  pty_key_when "关设置视图" '╭─ 项目设置' Escape || bad "关闭视图前它不在稳定帧上"
2242
1687
  # P68:等浮层自己回到稳定帧上再发第二个 esc(原来是两个固定 sleep 给按键让路)。
2243
1688
  pty_wait_frame - "关设置视图后的浮层" '› 项目设置' '!╭─ 项目设置' \