teamsmith 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +13 -7
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +67 -0
  4. package/skills/teamsmith/SKILL.md +26 -8
  5. package/skills/teamsmith/extension/team-notify.ts +37 -6
  6. package/skills/teamsmith/extension/team.ts +438 -0
  7. package/skills/teamsmith/references/agent-adapters.md +7 -7
  8. package/skills/teamsmith/references/config.md +65 -18
  9. package/skills/teamsmith/references/migration.md +220 -34
  10. package/skills/teamsmith/references/protocol.md +250 -25
  11. package/skills/teamsmith/references/troubleshooting.md +124 -7
  12. package/skills/teamsmith/references/workflows.md +66 -20
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
  16. package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
  17. package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
  18. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  19. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  20. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  21. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  22. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  23. package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
  24. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  25. package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
  26. package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
  27. package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
  28. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  29. package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
  30. package/skills/teamsmith/scripts/lib/common.sh +1560 -109
  31. package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
  32. package/skills/teamsmith/scripts/monitor.mjs +34 -3
  33. package/skills/teamsmith/scripts/panel/README.md +22 -11
  34. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  35. package/skills/teamsmith/scripts/panel/panel.js +226 -224
  36. package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
  37. package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
  38. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  39. package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
  40. package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
  41. package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
  42. package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
  43. package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
  44. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
  45. package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
  46. package/skills/teamsmith/scripts/replies.mjs +896 -0
  47. package/skills/teamsmith/scripts/shim/tmux +18 -0
  48. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  49. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  50. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  51. package/skills/teamsmith/scripts/team +20 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
  53. package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
  54. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
  55. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
  56. package/skills/teamsmith/templates/config.sh.tmpl +29 -5
  57. package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
  58. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
  59. package/skills/teamsmith/templates/report.md.tmpl +12 -0
  60. package/skills/teamsmith/templates/task.md.tmpl +4 -0
  61. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  62. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  63. package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
  64. package/skills/teamsmith/tests/config-cli.sh +320 -300
  65. package/skills/teamsmith/tests/death-cause.sh +5 -2
  66. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  67. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  68. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  69. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  70. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  71. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  72. package/skills/teamsmith/tests/flip-m37.sh +4 -1
  73. package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
  74. package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
  75. package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
  76. package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
  77. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  78. package/skills/teamsmith/tests/flip-p210.sh +4 -1
  79. package/skills/teamsmith/tests/flip-p217.sh +4 -1
  80. package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
  81. package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
  82. package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
  83. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  84. package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
  85. package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
  86. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  87. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  88. package/skills/teamsmith/tests/install-shape.sh +283 -22
  89. package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
  90. package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
  91. package/skills/teamsmith/tests/key-replies.sh +1314 -0
  92. package/skills/teamsmith/tests/ledger-ban.sh +9 -8
  93. package/skills/teamsmith/tests/ledger-claim.sh +248 -0
  94. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  95. package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
  96. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
  97. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
  98. package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
  99. package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
  100. package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
  101. package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
  102. package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
  103. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  104. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  105. package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
  106. package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
  107. package/skills/teamsmith/tests/panel-b2.sh +107 -4
  108. package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
  109. package/skills/teamsmith/tests/panel-b3.sh +189 -29
  110. package/skills/teamsmith/tests/panel-choices.sh +81 -63
  111. package/skills/teamsmith/tests/panel-cpu.sh +3 -2
  112. package/skills/teamsmith/tests/panel-knobs.sh +7 -1
  113. package/skills/teamsmith/tests/panel-p21.sh +445 -241
  114. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  115. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  116. package/skills/teamsmith/tests/perf.sh +122 -31
  117. package/skills/teamsmith/tests/pm-box-real.sh +1 -1
  118. package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
  119. package/skills/teamsmith/tests/routes.sh +364 -109
  120. package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
  121. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  122. package/skills/teamsmith/tests/section-budgets.tsv +26 -12
  123. package/skills/teamsmith/tests/section-guard.sh +6 -1
  124. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  125. package/skills/teamsmith/tests/section-paths.tsv +42 -26
  126. package/skills/teamsmith/tests/section-select.sh +90 -7
  127. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  128. package/skills/teamsmith/tests/slash-team.sh +617 -0
  129. package/skills/teamsmith/tests/smoke.sh +3762 -628
  130. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
  131. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
  132. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
  133. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
  134. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
  135. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
  136. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
  137. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
  138. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
  139. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
  140. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
  141. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
  142. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
  143. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
  144. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
  145. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
  146. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
  147. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
  148. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
  149. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
  150. package/skills/teamsmith/tests/task-header-model.sh +2 -1
  151. package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
  152. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  153. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  154. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  155. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  156. package/skills/teamsmith-init/SKILL.md +43 -43
  157. package/skills/teamsmith-init/references/bootstrap.md +8 -6
  158. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
@@ -4,7 +4,7 @@
4
4
  # failure carries its own scene — the mechanics live in tests/lib/pty-wait.sh (sourced below).
5
5
  #
6
6
  # bash skills/teamsmith/tests/panel-p21.sh # every scenario
7
- # bash skills/teamsmith/tests/panel-p21.sh settings seats # selected scenarios
7
+ # bash skills/teamsmith/tests/panel-p21.sh settings categories # selected scenarios
8
8
  # bash skills/teamsmith/tests/panel-p21.sh settings groups wheel # P30: grouping + the view's wheel
9
9
  # TEAM_P21_KEEP=1 bash ... # keep the fixture directory
10
10
  #
@@ -236,6 +236,8 @@ if [ -z "$js" ]; then printf 'panel-p21: no node/bun runtime\n' >&2; exit 3; fi
236
236
  # shared helper (its --self-test injects the incident's mid-frame; smoke §38-c runs it).
237
237
  # shellcheck source=lib/pty-wait.sh
238
238
  . "$here/lib/pty-wait.sh"
239
+ # shellcheck source=lib/model-policy.sh
240
+ . "$here/lib/model-policy.sh" # P232:完整派单记录构造器(S1 的共享夹具)
239
241
  # Fixture-wide knobs. PTY_WAIT_ITERS is a failure-detector horizon, never spent on a green run (a
240
242
  # green wait returns on the first settled frame, usually rounds 1-3); per-wait overrides use local.
241
243
  PTY_TRACE="${_trace_arg:-0}"
@@ -255,7 +257,7 @@ if p21_fixture_on; then
255
257
  fi
256
258
 
257
259
  SECTIONS=("$@")
258
- [ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(settings groups wheel choices choices-schema write conflict seats readonly)
260
+ [ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(settings groups wheel choices choices-schema write conflict categories policy readonly)
259
261
  want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
260
262
 
261
263
  # ---------------------------------------------------------------- fixture plumbing
@@ -269,7 +271,7 @@ server_up() { # <name> [agents] → fresh project + private tmux session + argv-
269
271
  && printf '{"name":"%s","scripts":{"verify":"true"}}\n' "$1" > package.json \
270
272
  && git add -A && git commit -qm init ) >/dev/null 2>&1
271
273
  ( cd "$ROOT" && bash "$skill/scripts/team" init --session "$sess" --agents "$agents" --vcs local \
272
- --gates "true" --docs docs/team ) >"$tmp/$1-init.log" 2>&1 \
274
+ --gates "true" --docs docs/team --task-models 'routine=deepseek/deepseek-flash analysis=xai/grok-4.6 verify=kimi-coding/k3-256k' --pm-model 'deepseek/deepseek-flash' ) >"$tmp/$1-init.log" 2>&1 \
273
275
  || { printf 'panel-p21: team init failed (%s)\n' "$1" >&2; tail -3 "$tmp/$1-init.log" >&2; exit 3; }
274
276
  state="$ROOT/.pi/team/state"
275
277
  mkdir -p "$state" "$ROOT/docs/team"
@@ -376,6 +378,17 @@ audit_lines() { [ -f "$(audit_log)" ] && wc -l < "$(audit_log)" || echo 0; }
376
378
  sha() { sha256sum "$1" 2>/dev/null | awk '{print $1}'; }
377
379
  tree_hash() { ( cd "$ROOT" && find "$@" -type f 2>/dev/null | sort | while IFS= read -r f; do printf '%s ' "$f"; sha "$f"; done ) | sha256sum | awk '{print $1}'; }
378
380
  conf_set() { mkdir -p "$state"; printf '%s\n' "$@" > "$state/panel.conf"; }
381
+ # P232:把 fixture 契约换成新的类别策略 + 独立 PM(走真实事务入口 upgrade-models)——退休键真的
382
+ # 离开文件,视图才在「当前契约」这一档上跑;老契约的档由 scn_categories 的 legacy 段专门覆盖。
383
+ policy_new() { # <task-models> <pm-model>
384
+ ( cd "$ROOT" && bash "$skill/scripts/team" config upgrade-models --task-models "$1" --pm-model "$2" --yes ) \
385
+ > "$tmp/$current-upgrade.log" 2>&1
386
+ }
387
+ # 一份**完整**的已提交派单记录(tests/lib/model-policy.sh 的共享构造器;S1 的读面契约)。
388
+ record_fixture() { # <seat> <model> <sid> <task> <category>
389
+ mkdir -p "$state"
390
+ routing_fixture_record "$state" "$1" "$4" "$ROOT" "$ROOT/docs/team/tasks/$4-x.md" "$2" "$3" policy 2026-10-09T00:00:00Z "$5"
391
+ }
379
392
  panel_pid() { tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_pid}' 2>/dev/null | head -1; }
380
393
 
381
394
  # Open the overlay and its project-settings navigation row (the sixth row), then wait for data.
@@ -494,7 +507,7 @@ assert_no_class_heading() { # <capture file> [label]
494
507
  local f="$1" label="${2:-视图没有类分组标题(分组是功能域)}"
495
508
  # M59/P127: `{ … || true; } | grep -q` — the capture file can outgrow the pipe buffer; grep -q
496
509
  # exits on the first hit and sed would take SIGPIPE (rc=141 → a class heading falsely "absent").
497
- if { sed 's/[│|]//g' "$f" || true; } | grep -qE '^ *(立即生效|需要重启|只读|Takes effect now|Needs a restart|Read-only) *$'; then
510
+ if { sed 's/[│|]//g' "$f" || true; } | grep -qE '^ *(立即生效|需重启|不可改|apply|restart|change in file) *$'; then
498
511
  bad "$label(捕获里出现了只有类词的行)"
499
512
  else
500
513
  ok "$label"
@@ -549,6 +562,10 @@ pick_option() {
549
562
  scn_settings() {
550
563
  section "settings · 标签/类徽章/默认值/过滤/窗口/点击/CLI 对齐/refuse 路由/q(B2 + M49)"
551
564
  server_up settings
565
+ # P232:这一段的契约是新的(类别策略 + 独立 PM)。老契约的档由 scn_categories 的 legacy 段专门覆盖;
566
+ # 这里要的是「正常契约下视图里没有裸 TEAM_*」这一条能成立。
567
+ policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
568
+ || bad "策略升级事务没有跑通"
552
569
  python3 - "$(cfg)" <<'PYFIX'
553
570
  import re, sys
554
571
  p = sys.argv[1]
@@ -565,12 +582,43 @@ PYFIX
565
582
  assert_eq "导航行打开视图没有写 panel.conf" "$(sha "$state/panel.conf" 2>/dev/null || echo none)" "$conf_before"
566
583
  cap_to view
567
584
  # P30/D2:分组 = schema 第 10 列的功能域。视图开屏在只读骨架(identity),标题就是功能域名;
568
- # 旧的三条类分组标题(立即生效 / 需要重启 / 只读)不再是标题(徽章词仍在,见类徽章段)。
569
- assert_has "$tmp/$current/view.txt" "身份与账本布局" "功能域分组标题(identity,开屏即见)"
585
+ # 旧的三条类分组标题(立即生效 / 需重启 / 不可改)不再是标题(徽章词仍在,见类徽章段)。
570
586
  assert_no_class_heading "$tmp/$current/view.txt"
571
587
  # 行文本是人话标签(不是裸键),开屏聚焦行是 identity 的第一条 schema 键。
572
- assert_match "$tmp/$current/view.txt" '› 项目名 +.*只读' "开屏聚焦行是 identity 第一条(标签 + 只读 徽章)"
588
+ assert_match "$tmp/$current/view.txt" '› 项目名 +.*不可改' "开屏聚焦行是 identity 第一条(标签 + 不可改 徽章)"
573
589
  assert_not "$tmp/$current/view.txt" "TEAM_GATES" "行里不再出现裸键 TEAM_GATES"
590
+ # P266:审计整块离开视图(标题与行都不画)——审计仍可用 `team config list` 自己的尾部和 `team config log` 读。
591
+ assert_not "$tmp/$current/view.txt" "审计(最近)" "P266:视图里没有审计标题"
592
+ assert_not "$tmp/$current/view.txt" "result=" "P266:视图里没有 state/config.log 的审计行"
593
+ assert_no_match "$tmp/$current/view.txt" '^(│ )? *(Audit|审计)' "P266:没有任何一行是审计标题"
594
+ # P266:夹具键是数据驱动的隐藏:行不在视图里,按标签与裸键过滤都搜不到,而同组其它行还在。
595
+ local p266_k p266_cfg_before p266_json p266_route p266_human p266_rc
596
+ for p266_k in TEAM_DISK_STATS_FILE TEAM_SMOKE_FAST TEAM_INBOX_WATCH_FORCE_FAIL TEAM_IW_REQUIRE_WATCH; do
597
+ filter_to "$p266_k"
598
+ cap_to "p266-hidden-$p266_k"
599
+ assert_not "$tmp/$current/p266-hidden-$p266_k.txt" "$p266_k" "P266:$p266_k 不在视图里(按裸键搜不到)"
600
+ done
601
+ assert_not "$tmp/$current/p266-hidden-TEAM_DISK_STATS_FILE.txt" "磁盘读数夹具" "P266:隐藏的夹具键连人话标签也搜不到"
602
+ filter_to 磁盘读数夹具
603
+ cap_to p266-hidden-label
604
+ assert_not "$tmp/$current/p266-hidden-label.txt" "磁盘读数夹具" "P266:按标签过滤也搜不到夹具键"
605
+ # 同一组(policy)里还有可见键:标题因为别的行还在,不因隐藏而空。
606
+ filter_to TEAM_MEMINFO_FILE
607
+ cap_to p266-group-alive
608
+ assert_has "$tmp/$current/p266-group-alive.txt" "权限与依赖" "P266:同组其它行还在(隐藏的只是夹具键,标题没跟着消失)"
609
+ assert_not "$tmp/$current/p266-group-alive.txt" "TEAM_MEMINFO_FILE" "P266:那一帧里仍然只有人话标签,没有裸键"
610
+ filter_clear
611
+ # 读面与命令面一字不变:人读表仍列出、--json 仍带声明标记、set 仍 refuse。
612
+ p266_cfg_before="$(sha "$(cfg)")"
613
+ p266_human="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list ) 2>&1 )"
614
+ case "$p266_human" in *TEAM_DISK_STATS_FILE*) ok "P266:人类可读表仍列出夹具键" ;; *) bad "P266:人类可读表不再列出夹具键" ;; esac
615
+ p266_json="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list --json ) 2>&1 )"
616
+ 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])')"
617
+ case "$p266_route" in "fixture-only: "*) ok "P266:--json 的 route 原样带 fixture-only: 前缀" ;; *) bad "P266:--json 的 route 丢了声明标记($p266_route)" ;; esac
618
+ ( cd "$ROOT" && bash "$skill/scripts/team" config set TEAM_DISK_STATS_FILE /tmp/x --yes ) >/dev/null 2>&1
619
+ p266_rc=$?
620
+ assert_eq "P266:config set 夹具键仍 refuse(exit 5)" "$p266_rc" "5"
621
+ assert_eq "P266:refuse 没有动契约" "$(sha "$(cfg)")" "$p266_cfg_before"
574
622
  # 组内保持 schema 顺序(项目名 在 会话名 之前)。
575
623
  local n_first n_second
576
624
  n_first="$(grep -n '项目名' "$tmp/$current/view.txt" | head -1 | cut -d: -f1)"
@@ -583,17 +631,17 @@ PYFIX
583
631
  # 类徽章是词(P30/D4):过滤到一条 apply 行看它的徽章。
584
632
  filter_to 模型并发上限
585
633
  cap_to badge-apply
586
- assert_match "$tmp/$current/badge-apply.txt" '模型并发上限 +.*立即生效' "apply 行:人话标签 + 立即生效 徽章(词仍在)"
587
634
  cap_has "↑/↓ 行 · Enter 打开 · / 筛选" keyband
588
635
  # One filter per class: the badge, the unset marker and the line's own comment (all unchanged).
589
636
  filter_to TEAM_PULSE_INTERVAL
590
637
  cap_to restart
591
- assert_match "$tmp/$current/restart.txt" '巡检周期 +900 · 需重启' "restart 行的标签 + 需重启 徽章"
592
638
  assert_has "$tmp/$current/restart.txt" "命令行:team config set TEAM_PULSE_INTERVAL <新值>" "CLI 提示行点名原始键(照敲命令用)"
593
639
  filter_to TEAM_PROJECT
594
640
  cap_to refuse
595
- assert_match "$tmp/$current/refuse.txt" '项目名 +root · 只读' "refuse 行的标签 + 只读 徽章"
596
- assert_has "$tmp/$current/refuse.txt" "手改 .pi/team/config.sh 里的 TEAM_PROJECT" "refuse 提示行点名原始键与手改路线"
641
+ assert_match "$tmp/$current/refuse.txt" '项目名 +root · 不可改' "refuse 行的标签 + 不可改 徽章"
642
+ assert_has "$tmp/$current/refuse.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "refuse 提示行是那句普通的文件路线"
643
+ assert_not "$tmp/$current/refuse.txt" "手改" "P266:refuse 提示行里没有「手改」"
644
+ assert_not "$tmp/$current/refuse.txt" "只读" "P266:refuse 行的徽章不再写「只读」"
597
645
  # P32:短列表(一条过滤结果)也把卡片填满 —— 空白留在卡片**里面**,卡片下边框仍紧贴键栏。
598
646
  cap_visible_to filter-fill
599
647
  fstats="$(settings_window_stats "$tmp/$current/filter-fill.txt")"
@@ -609,11 +657,11 @@ PYFIX
609
657
  filter_to TEAM_PULSE_NUDGE_GAP
610
658
  cap_to comment
611
659
  assert_match "$tmp/$current/comment.txt" '重复提醒间隔 +900 · 立即生效 +# 15min' "行内注释原样渲染"
612
- # M49 回退:schema 不认识的键没有标签 → 行的主文本就是原始键(未知键徽章 + 未知键提示)。
660
+ # M49 回退:schema 不认识的键没有标签 → 行的主文本就是原始键(「不认识」徽章 + 提示行)。
613
661
  filter_to TEAM_HAND_ADDED
614
662
  cap_to unknown
615
- assert_match "$tmp/$current/unknown.txt" 'TEAM_HAND_ADDED +hand · 未知键' "schema 不认识的键回退显示原始键"
616
- assert_has "$tmp/$current/unknown.txt" "未知键:TEAM_HAND_ADDED" "未知键的提示行说清楚为什么没有标签"
663
+ assert_match "$tmp/$current/unknown.txt" 'TEAM_HAND_ADDED +hand · 不认识' "schema 不认识的键回退显示原始键"
664
+ assert_has "$tmp/$current/unknown.txt" "TEAM_HAND_ADDED:这个设置在文件里,工具不认识它" "未知键的提示行说清楚为什么没有标签"
617
665
  # The filter matches the label (M49), key or value; esc clears it without closing the view.
618
666
  filter_to 巡检周期
619
667
  cap_to filter-label
@@ -686,33 +734,23 @@ PYFIX
686
734
  local before; before="$(sha "$(cfg)")"
687
735
  filter_to TEAM_SESSION
688
736
  sleep 0.3
689
- if focus_row '会话名 +.*只读'; then
737
+ if focus_row '会话名 +.*不可改'; then
690
738
  keys Enter
691
739
  else
692
740
  bad "没能把焦点移到 refuse 行"
693
741
  fi
694
- if wait_cap refuse-route "手改"; then ok "refuse 行的回执点名路线"; else bad "refuse 行的回执没出现"; fi
742
+ if wait_cap refuse-route "只能改项目配置文件"; then ok "refuse 行的回执点名普通路线(不是命令行黑话)"; else bad "refuse 行的回执没出现"; fi
695
743
  assert_eq "refuse 行没有写契约" "$(sha "$(cfg)")" "$before"
696
- # P144:磁盘底线的两行 + 夹具缝一行 —— 行主文本是标签(不是裸键),类徽章照旧;缝是 refuse:
697
- # 回车只给路线,不开编辑器、不写契约。
744
+ # P144:磁盘底线的两行 —— 行主文本是标签(不是裸键),类徽章照旧。P266:夹具缝行已经**不在视图里**
745
+ # (上面刚证过),它的读面与命令面由那里的断言守住。
698
746
  filter_to 临时根空间底线
699
747
  cap_to p144-mb
700
748
  assert_match "$tmp/$current/p144-mb.txt" '› 临时根空间底线 +未设 · 默认 1024 · 立即生效' \
701
- "P144:临时根空间底线 行是人话标签 + apply 徽章"
702
749
  assert_not "$tmp/$current/p144-mb.txt" '临时根空间底线 +TEAM_' "P144:字节底线行主文本不是裸键"
703
750
  filter_to inode 底线
704
751
  if focus_row '临时根 inode 底线 +未设 · 默认 100000'; then :; else bad "P144:没能把焦点移到 inode 底线行"; fi
705
752
  cap_to p144-ino
706
753
  assert_match "$tmp/$current/p144-ino.txt" '› 临时根 inode 底线 +未设 · 默认 100000 · 立即生效' \
707
- "P144:临时根 inode 底线 行是人话标签 + apply 徽章"
708
- local p144_before; p144_before="$(sha "$(cfg)")"
709
- filter_to 磁盘读数夹具
710
- cap_to p144-seam
711
- assert_match "$tmp/$current/p144-seam.txt" '› 磁盘读数夹具 +.*只读' \
712
- "P144:磁盘读数夹具 行是人话标签 + refuse 徽章"
713
- if focus_row '磁盘读数夹具 +.*只读'; then keys Enter; else bad "P144:没能把焦点移到夹具缝行"; fi
714
- if wait_cap p144-seam-route "手改"; then ok "P144:缝行的回执点名手改路线(不开编辑器)"; else bad "P144:缝行的回执没出现"; fi
715
- assert_eq "P144:缝行没有写契约" "$(sha "$(cfg)")" "$p144_before"
716
754
  # M59: the navigation esc is state-checked too — it fires only while the settings view is on a
717
755
  # settled frame, so a drifted scene gets a named red instead of a blind key.
718
756
  pty_key_when "esc 回浮层" '╭─ 项目设置' Escape || bad "esc 前设置视图已经不在屏幕上"
@@ -741,9 +779,10 @@ PYFIX
741
779
  import sys
742
780
  p = sys.argv[1]
743
781
  s = open(p, encoding='utf-8').read()
744
- s = s.replace('TEAM_GATES|apply|cmd||plain||-|', 'TEAM_GATES|refuse|cmd||plain||-|改门禁请手改(scratch 夹具)')
745
- s = s.replace('TEAM_DEFAULT_MODEL|restart|model|req|plain|deepseek/deepseek-flash|-|',
746
- 'TEAM_ZZZ_TEST|apply|text||plain|zzz-default|-|||workflow\nTEAM_DEFAULT_MODEL|restart|model|req|plain|deepseek/deepseek-flash|-|')
782
+ s = s.replace('TEAM_GATES|apply|cmd||plain||-|', 'TEAM_GATES|refuse|cmd||plain||-|改门禁要改项目配置文件(scratch 夹具)')
783
+ anchor = 'TEAM_INSTALL_CMD|apply|cmd||plain||-|||workflow'
784
+ assert anchor in s, '找不到 TEAM_INSTALL_CMD 的 schema 行'
785
+ 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)
747
786
  open(p, 'w', encoding='utf-8').write(s)
748
787
  PYFIX
749
788
  cat > "$tmp/$current-scratch-wrapper.sh" <<EOF2
@@ -760,11 +799,47 @@ EOF2
760
799
  wait_row scratch-key "scratch 视图里的 TEAM_ZZZ_TEST 行" 'TEAM_ZZZ_TEST' '未设 · 默认 zzz-default' \
761
800
  || bad "scratch CLI 新增的键行没有在预算内出现"
762
801
  assert_match "$tmp/$current/scratch-key.txt" 'TEAM_ZZZ_TEST +未设 · 默认 zzz-default' "scratch CLI 新增的键出现在视图里(不重建 panel.js;无标签→回退裸键)"
802
+ # P266(设计表 248):同一张 scratch schema 里再添一行**带标记**的新键 → 它不进渲染(隐藏规则读标记,
803
+ # 不是 bundle 里写死的四个键名;这一行是 fixture 里从没出现过的名字)。
804
+ filter_to TEAM_ZZZ_FIXTURE
805
+ cap_to scratch-marked
806
+ assert_not "$tmp/$current/scratch-marked.txt" "TEAM_ZZZ_FIXTURE" "P266:带 fixture-only 标记的新键被隐藏(规则是数据,不是名单)"
807
+ filter_clear
763
808
  filter_to TEAM_GATES
764
- wait_row scratch-class "scratch 视图里的 TEAM_GATES 行(类改成只读)" '门禁命令' 'true · 只读' \
809
+ wait_row scratch-class "scratch 视图里的 TEAM_GATES 行(类改成不可改)" '门禁命令' 'true · 不可改' \
765
810
  || bad "scratch CLI 改过的类行没有在预算内出现"
766
- assert_match "$tmp/$current/scratch-class.txt" '门禁命令 +true · 只读' "scratch CLI 改过的类跟着变(bundle 没有第二张键表)"
767
- assert_has "$tmp/$current/scratch-class.txt" "手改 .pi/team/config.sh 里的 TEAM_GATES" "scratch CLI 的拒统路线也点名原始键"
811
+ assert_match "$tmp/$current/scratch-class.txt" '门禁命令 +true · 不可改' "scratch CLI 改过的类跟着变(bundle 没有第二张键表)"
812
+ assert_has "$tmp/$current/scratch-class.txt" "这个值要改项目配置文件 .pi/team/config.sh" "scratch CLI 的 refuse 提示行仍是那句普通路线"
813
+ if focus_row '门禁命令 +true · 不可改'; then keys Enter; else bad "P266:没能把焦点移到 scratch 的 refuse 行"; fi
814
+ if wait_cap scratch-route "改门禁要改项目配置文件(scratch 夹具)"; then
815
+ ok "P266:scratch CLI 自己写的备注原样上屏(路线不是写死的)"
816
+ else
817
+ bad "P266:scratch CLI 的备注没有上屏"
818
+ fi
819
+ # P266 红侧(数据驱动):把 scratch 树里夹具键的声明标记删掉 → 那一行回到视图;还原 → 又消失。
820
+ local marker_red_cfg
821
+ marker_red_cfg="$scratch/skills/teamsmith/scripts/lib/cmd-config.sh"
822
+ python3 - "$marker_red_cfg" <<'PYFIX'
823
+ import sys
824
+ p = sys.argv[1]
825
+ s = open(p, encoding='utf-8').read()
826
+ mark = 'fixture-only: 只在测试套件里用(磁盘读数夹具)'
827
+ assert mark in s, '找不到夹具键的声明标记'
828
+ s = s.replace('|' + mark + '||policy', '|||policy', 1)
829
+ open(p, 'w', encoding='utf-8').write(s)
830
+ PYFIX
831
+ P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
832
+ open_view
833
+ filter_to 磁盘读数夹具
834
+ wait_row p266-marker-red "标记删掉后夹具键回到视图" '磁盘读数夹具' '不可改' \
835
+ || bad "P266 红侧:删掉声明标记后那一行没有回到视图"
836
+ assert_match "$tmp/$current/p266-marker-red.txt" '磁盘读数夹具 +.*不可改' "P266 红侧:行回来了(隐藏跟着读侧的数据走)"
837
+ cp -a "$skill/scripts/lib/cmd-config.sh" "$marker_red_cfg"
838
+ P21_CLI="$tmp/$current-scratch-wrapper.sh" start_panel
839
+ open_view
840
+ filter_to 磁盘读数夹具
841
+ cap_to p266-marker-green
842
+ assert_not "$tmp/$current/p266-marker-green.txt" "磁盘读数夹具" "P266 还原:标记加回后那一行再次消失"
768
843
  # M49:另一种语言的人话标签(同一张表切换,标签不是渲染时的硬编码)。
769
844
  conf_set "lang=en" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
770
845
  start_panel
@@ -773,6 +848,13 @@ EOF2
773
848
  cap_to en
774
849
  assert_match "$tmp/$current/en.txt" '› Patrol interval' "en 行的人话标签(行不是裸键)"
775
850
  assert_has "$tmp/$current/en.txt" "CLI: team config set TEAM_PULSE_INTERVAL <value>" "en 的 CLI 提示行同样点名原始键"
851
+ # P266:两种语言的样张都要能给评审直接读(报告里贴的就是这些帧):走到尾部,两个块标题 + 席位原因。
852
+ filter_clear
853
+ sleep 0.4
854
+ walk_to_tail en-tail
855
+ assert_has "$tmp/$current/en-tail.txt" "The model the next task will use" "en 的类别块标题(下一次派任务会用的模型)"
856
+ assert_has "$tmp/$current/en-tail.txt" "The model running tasks actually use" "en 的席位块标题(正在运行的任务实际使用的模型)"
857
+ assert_has "$tmp/$current/en-tail.txt" "this seat has not been given a task yet" "en 的「这个席位还没有派过任务」(席位没有记录)"
776
858
 
777
859
  # ── P32:视图用满窗口高度(用户实测 45 行里 16 行空白)+ 行数记账诚实 ──
778
860
  # 同一条契约、同一个面板,只改 pane 行高:① 内容结尾(卡片下边框)到键栏的空白 ≤1 行;
@@ -784,8 +866,9 @@ EOF2
784
866
  start_panel
785
867
  open_view
786
868
  local want_count
869
+ # P266:视图里的行 = schema 键(减去被声明为 fixture-only 的键)+ 类别 + 席位 + PM 启动记录。
787
870
  want_count="$( (cd "$ROOT" && bash "$skill/scripts/team" config list --json) \
788
- | python3 -c 'import json,sys; d=json.load(sys.stdin); print(len(d["keys"]) + len(d.get("models",{}).get("seats",[])))' )"
871
+ | 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))' )"
789
872
  [ "${want_count:-0}" -gt 0 ] || bad "读数拿不到键数(前提不成立)"
790
873
  local h s rows up down gap prev_rows=""
791
874
  for h in 45 33 30 25; do
@@ -796,7 +879,7 @@ EOF2
796
879
  # ① 内容结束到键栏的空白 ≤1 行(P32 前:45 行里 16 行)
797
880
  if [ "$gap" -le 1 ]; then ok "${h} 行:内容结尾到键栏只剩 $gap 行空白(≤1)"; else bad "${h} 行:内容结尾到键栏还有 $gap 行空白"; fi
798
881
  # ③ 记账诚实:窗口画出的行 + 两条计数 = 命令报的总行数
799
- assert_eq "${h} 行:rows($rows) + ↑($up) + ↓($down) = 命令报的键+席位($want_count)" \
882
+ assert_eq "${h} 行:rows($rows) + ↑($up) + ↓($down) = 命令报的键+类别+派单记录($want_count)" \
800
883
  "$((rows + up + down))" "$want_count"
801
884
  case "$h" in
802
885
  45) prev_rows="$rows" ;;
@@ -836,9 +919,12 @@ s = re.sub(r'^TEAM_AGENT_BIN=.*$', 'TEAM_AGENT_BIN="/nonexistent/m55-agent"', s,
836
919
  s = re.sub(r'^TEAM_MIN_FREE_SWAP_MB=.*$', 'TEAM_MIN_FREE_SWAP_MB="0"', s, count=1, flags=re.M)
837
920
  open(p, 'w', encoding='utf-8').write(s)
838
921
  PY
839
- # 席位模型:28 个记录 → known 变长,滚轮用例的条目列表会超出可视预算(不需要改 pane 几何)。
840
- mkdir -p "$state"
841
- for i in $(seq 2 28); do printf 'model=provider/m%s\n' "$i" > "$state/dev$i.env"; done
922
+ # 长词表:28 个类别(每类别一个模型)+ 独立 PM → known 变长,滚轮用例的条目列表会超出可视预算
923
+ # (不需要改 pane 几何)。P232:词汇表现在来自项目自己的类别策略,席位记录是**已提交派单**、
924
+ # 不完整的记录不贡献任何模型。
925
+ local map="routine=provider/m0 analysis=provider/m1"
926
+ for i in $(seq 2 27); do map="$map cat$i=provider/m$i"; done
927
+ policy_new "$map" 'provider/pm' || bad "策略升级事务没有跑通(见 $tmp/$current-upgrade.log)"
842
928
  conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
843
929
  # R2 的机器目录夹具:scratch HOME 里放一个含 sub2api(已下线的 provider)与 openrouter 的 Pi 模型
844
930
  # 目录 —— 读与选择器都不许出现它们(真实的 models-store.json 是活缓存,绝不能被当成选项来源)。
@@ -876,8 +962,8 @@ JSON
876
962
  fi
877
963
  cap_to bool
878
964
  assert_match "$tmp/$current/bool.txt" '› 保持未设' "未设键的首个条目是保持未设(并且是焦点)"
879
- assert_has "$tmp/$current/bool.txt" "开(1) · 默认" "1 是默认条目,带表里的 on 词"
880
- assert_has "$tmp/$current/bool.txt" "关(0)" "0 是另一个条目,带表里的 off 词"
965
+ assert_has "$tmp/$current/bool.txt" "(1) · 默认" "1 是默认条目,带表里的 on 词"
966
+ assert_has "$tmp/$current/bool.txt" "(0)" "0 是另一个条目,带表里的 off 词"
881
967
  assert_not "$tmp/$current/bool.txt" "…(自由输入)" "bool 是封闭域:没有自由输入项"
882
968
  local bool_sha bool_audit
883
969
  bool_sha="$(sha "$(cfg)")"; bool_audit="$(audit_lines)"
@@ -1004,7 +1090,7 @@ PY2
1004
1090
  keys Enter
1005
1091
  wait_picker TEAM_PULSE_INTERVAL '› 保持未设' || bad "数值键的选择器没有打开"
1006
1092
  cap_to numeric
1007
- assert_has "$tmp/$current/numeric.txt" "接受区间 60–∞" "数值键显示命令给的接受区间(上界空 = 无界)"
1093
+ assert_has "$tmp/$current/numeric.txt" "60–∞" "数值键显示命令给的接受区间(上界空 = 无界)"
1008
1094
  assert_match "$tmp/$current/numeric.txt" '› 保持未设' "未设的数值键也以保持未设开头"
1009
1095
  assert_has "$tmp/$current/numeric.txt" "900 · 默认" "建议值里的默认值带默认标记"
1010
1096
  assert_has "$tmp/$current/numeric.txt" "1800" "建议值原样给出"
@@ -1080,16 +1166,17 @@ PY2
1080
1166
  leave_editor TEAM_GATES
1081
1167
  wait_no_editor || bad "cmd 编辑器没有关干净"
1082
1168
 
1083
- # ── (7) pairlist:Enter 把焦点移到席位块,绝不在这里组合(不读、不开编辑器) ──
1084
- filter_to TEAM_AGENT_MODELS
1169
+ # ── (7) task-model-map:Enter 把焦点移到类别块,绝不在这里组合映射(不读、不开编辑器) ──
1170
+ # P232:夹具契约是先 upgrade-models 过的(这一段上面已经升过),所以类别块里至少有一个 routine 行。
1171
+ filter_to TEAM_TASK_MODELS
1085
1172
  sleep 0.5
1086
1173
  keys Enter
1087
- if wait_cap pairlist "席位块就是这一行的编辑器"; then ok "pairlist 行把焦点交给席位块"; else bad "pairlist 路由的说明行没出现"; fi
1174
+ if wait_cap pairlist "类别块就是这一行的编辑器"; then ok "整映射行把焦点交给类别块"; else bad "类别块路由的说明行没出现"; fi
1088
1175
  cap_to pairlist
1089
- assert_not "$tmp/$current/pairlist.txt" "╭─ TEAM_AGENT_MODELS" "pairlist 不开写编辑器"
1090
- assert_not "$tmp/$current/pairlist.txt" " · TEAM_AGENT_MODELS" "pairlist 不开选择器"
1091
- assert_match "$tmp/$current/pairlist.txt" '› dev +' "焦点移到席位块的第一行"
1092
- assert_has "$tmp/$current/pairlist.txt" "team config set-agent-model" "命令行点名 set-agent-model(唯一写者)"
1176
+ assert_not "$tmp/$current/pairlist.txt" "╭─ TEAM_TASK_MODELS" "整映射行不开写编辑器"
1177
+ assert_not "$tmp/$current/pairlist.txt" " · TEAM_TASK_MODELS" "整映射行不开选择器"
1178
+ assert_match "$tmp/$current/pairlist.txt" '› 类别 routine' "焦点移到类别块的第一行"
1179
+ assert_has "$tmp/$current/pairlist.txt" "team config set-task-model" "命令行点名 set-task-model(唯一写者)"
1093
1180
 
1094
1181
  # ── (8) 鼠标:第一次点击只移光标(不写);第二次点击 = 接受并直写;esc 什么都不写 ──
1095
1182
  wait_no_editor || bad "点击用例开始前还有编辑器开着"
@@ -1131,7 +1218,7 @@ PY2
1131
1218
  assert_eq "esc 后审计不增长" "$(audit_lines)" "$esc_audit"
1132
1219
  argv_since "$esc0" "$tmp/$current/esc-argv.log"
1133
1220
  assert_not "$tmp/$current/esc-argv.log" "config set" "esc 的窗口里没有 config set"
1134
- assert_not "$tmp/$current/esc-argv.log" "set-agent-model" "esc 的窗口里没有席位写"
1221
+ assert_not "$tmp/$current/esc-argv.log" "set-task-model" "esc 的窗口里没有类别写"
1135
1222
  # M59 判据②(真实场景):此刻选择器已被上面那条 esc 关掉 —— 清理点的 esc 必须先确认状态。
1136
1223
  # 旧写法的裸 esc 在这里会把设置视图整个关掉,之后每段都在错的视图里跑(§38-b 的级联入口)。
1137
1224
  PTY_TRACE=1 pty_cleanup_esc "回归钉:已关闭的选择器" " · TEAM_MONITOR_UI" > "$tmp/$current/cleanup-trace.txt" 2>&1
@@ -1148,10 +1235,10 @@ PY2
1148
1235
 
1149
1236
  # ── (9) 滚轮:条目列表比可视预算长时滚得动(焦点走过的就是列表滚过的) ──
1150
1237
  wait_no_editor || bad "滚轮用例开始前还有编辑器开着"
1151
- filter_to TEAM_DEFAULT_MODEL
1238
+ filter_to TEAM_PM_MODEL
1152
1239
  sleep 0.5
1153
1240
  keys Enter
1154
- wait_picker TEAM_DEFAULT_MODEL '↓' || bad "长列表选择器没有打开"
1241
+ wait_picker TEAM_PM_MODEL '↓' || bad "长列表选择器没有打开"
1155
1242
  cap_to wheel-before
1156
1243
  local before_hidden
1157
1244
  before_hidden="$(grep -oE '↓[0-9]+' "$tmp/$current/wheel-before.txt" | head -1 | tr -d '↓' || true)"
@@ -1185,13 +1272,13 @@ PY2
1185
1272
  ( cd "$ROOT" && HOME="$home" bash "$skill/scripts/team" config list --json ) > "$tmp/$current/read-json.json" 2>&1
1186
1273
  assert_not "$tmp/$current/read-json.json" "sub2api" "同一 scratch HOME 下的读也不含目录 provider"
1187
1274
  # 硬化自检(M55 第一次复验 FAIL 的回归钉 + M59 判据①/③)……
1188
- if wait_picker_quick TEAM_DEFAULT_MODEL '这条目不存在-硬线自检'; then
1275
+ if wait_picker_quick TEAM_PM_MODEL '这条目不存在-硬线自检'; then
1189
1276
  bad "wait_picker 只凭标题就放行了(条目标记/稳定帧没起作用)"
1190
1277
  else
1191
1278
  ok "wait_picker 要的条目不在稳定帧里时判负(标题命中不算,现场见上面的黄点场景)"
1192
1279
  fi
1193
1280
  # 清理守卫把 esc 只打在真开着的选择器上(这里选择器确实开着 → 恰好一个 esc)。
1194
- leave_picker TEAM_DEFAULT_MODEL || bad "回归钉之后的选择器没有关掉"
1281
+ leave_picker TEAM_PM_MODEL || bad "回归钉之后的选择器没有关掉"
1195
1282
 
1196
1283
  # ── (10) 危险值来自选项:第一次 accept 只给警告(不写、不审计),第二次才带 danger allowance 写入 ──
1197
1284
  filter_to TEAM_MIN_FREE_SWAP_MB
@@ -1313,7 +1400,6 @@ PY
1313
1400
  sleep 0.4
1314
1401
  keys Enter
1315
1402
  if wait_cap confirm "→ 1200"; then ok "第一次 Enter 只给确认行(没写)"; else bad "确认行没有出现(见 confirm.txt)"; fi
1316
- assert_has "$tmp/$current/confirm.txt" "下一个读取它的进程生效" "确认行说明 apply 的时机"
1317
1403
  assert_eq "确认阶段契约未变" "$(sha "$(cfg)")" "$(sha "$tmp/$current/before.cfg")"
1318
1404
  keys Enter
1319
1405
  if wait_cap written "✓ 已写入 TEAM_PULSE_NUDGE_GAP = 1200"; then
@@ -1357,7 +1443,6 @@ PY
1357
1443
  local b1; b1="$(sha "$(cfg)")"
1358
1444
  keys Enter
1359
1445
  if wait_cap invalid "最小 60"; then ok "越界数值的拒绝点名最小 60"; else bad "越界数值的拒绝没出现"; fi
1360
- assert_has "$tmp/$current/invalid.txt" "不合法" "非法值的回执说明被拒"
1361
1446
  assert_eq "非法值契约不变" "$(sha "$(cfg)")" "$b1"
1362
1447
  cap_has "TEAM_PULSE_INTERVAL" draft-kept
1363
1448
  leave_editor TEAM_PULSE_INTERVAL || bad "非法值用例的 esc 发了但编辑器还在"
@@ -1450,154 +1535,260 @@ PY
1450
1535
  assert_has "$tmp/$current/reloaded.txt" "team config set TEAM_PULSE_NUDGE_GAP" "视图仍点名原始键(照敲命令用)"
1451
1536
  }
1452
1537
 
1453
- scn_seats() {
1454
- section "seats · 来源三态 / picker / 一 token diff / 移除回退 / 运行中的席位不变(B4)"
1455
- server_up seats "dev verify dev2"
1456
- python3 - "$(cfg)" <<'PY'
1457
- import re, sys
1458
- p = sys.argv[1]
1459
- s = open(p, encoding='utf-8').read()
1460
- s = s.replace('TEAM_AGENT_MODELS=""', 'TEAM_AGENT_MODELS="dev=deepseek/deepseek-flash"')
1461
- # model-id-shape R1:known 里必须有一个三段 id(pm 席位)——席位选择器要能列出并选中它。
1462
- s = re.sub(r'^TEAM_PM_MODEL=.*$', 'TEAM_PM_MODEL="openrouter/amazon/nova-lite-v1"', s, count=1, flags=re.M)
1463
- open(p, 'w', encoding='utf-8').write(s)
1464
- PY
1465
- mkdir -p "$state"
1466
- printf 'model=xai/grok-4.6\n' > "$state/dev.env"
1467
- printf 'model=deepseek/deepseek-flash\n' > "$state/verify.env"
1468
- printf 'model=kimi-coding/k3-256k\nmodel_src=explicit\n' > "$state/dev2.env"
1538
+ # ---------------------------------------------------------------- P232(类别策略 vs 已派记录)
1539
+ # 窄判据:类别行 + 策略/实际分离 + 一次类别直写。flip 段把它当靶子(把写入路由或显示规则弄坏,
1540
+ # 这一段必须红)。它刻意只走一条路径,好让红侧点名到具体的断言。
1541
+ scn_policy() {
1542
+ section "policy · 类别行 / 策略 vs 实际 / 类别直写走 set-task-model(P232 的窄判据)"
1543
+ server_up policy "dev verify"
1544
+ policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
1545
+ || bad "策略升级事务没有跑通(见 $tmp/$current-upgrade.log)"
1546
+ record_fixture dev 'xai/grok-4.6' sid-dev-232 T232-x routine
1547
+ conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1469
1548
  start_panel
1470
1549
  open_view
1471
- filter_to verify
1472
- wait_row seats-verify "席位 verify 行显示配置来源" 'verify' 'deepseek/deepseek-flash · 配置' \
1473
- || bad "席位 verify 的行没有在预算内出现"
1474
- assert_match "$tmp/$current/seats-verify.txt" 'verify +deepseek/deepseek-flash · 配置' "配置解析 → 配置"
1475
- filter_to dev2
1476
- wait_row seats-dev2 "席位 dev2 行显示显式来源" 'dev2' 'kimi-coding/k3-256k · 显式' \
1477
- || bad "席位 dev2 的行没有在预算内出现"
1478
- assert_match "$tmp/$current/seats-dev2.txt" 'dev2 +kimi-coding/k3-256k · 显式' "显式记录 → 显式"
1550
+ # ① 类别行:未来策略 + 「新任务」徽章 + 命令行点名 set-task-model
1551
+ filter_to 类别
1552
+ wait_row policy-cat "类别 routine 行(策略模型 + 新任务徽章)" '下一次派任务会用的模型' '类别 routine' 'kimi-coding/k3-256k' \
1553
+ || bad "类别行没有在预算内出现"
1554
+ # 视图的快照行、命令行提示行都跟着**焦点**走:先把光标移到类别行,再看这一行的两半(M49)。
1555
+ if focus_row '› 类别 routine'; then :; else bad "没能把焦点移到类别 routine 行"; fi
1556
+ cap_to policy-cat
1557
+ assert_match "$tmp/$current/policy-cat.txt" '› 类别 routine +kimi-coding/k3-256k · 新任务' "类别行 = 类别 + 策略模型 + 新任务徽章"
1558
+ assert_has "$tmp/$current/policy-cat.txt" "team config set-task-model routine <model>" "命令行点名 set-task-model(唯一写者)"
1559
+ # ② 策略 ≠ 实际:dev 的只读行显示**记录**里的模型,行里不出现策略模型
1479
1560
  filter_to dev
1480
- wait_row seats "席位 dev 行显示历史记录来源" 'dev' 'xai/grok-4.6 · 历史记录' \
1481
- || bad "席位 dev 的行没有在预算内出现"
1482
- assert_match "$tmp/$current/seats.txt" 'dev +xai/grok-4.6 · 历史记录' "记录与配置不一致 → 历史记录 + 记录的模型"
1483
- ( cd "$ROOT" && bash "$skill/scripts/team" roster ) > "$tmp/$current/roster.txt" 2>/dev/null
1484
- assert_match "$tmp/$current/roster.txt" 'xai/grok-4\.6·历史记录' "team roster 的标签与 models 块同口径"
1485
- # Focus the dev seat row (its line carries the record's model) and open the picker.
1486
- # M59: Enter only follows a successful walk (focus_row tolerates the row set being replaced).
1487
- sleep 0.3
1488
- if focus_row 'dev +xai/grok-4.6'; then
1489
- keys Enter
1561
+ wait_row policy-dev "dev 的只读派单行" '正在运行的任务实际使用的模型' 'xai/grok-4.6' \
1562
+ || bad "dev 的派单行没有在预算内出现"
1563
+ if focus_row '› dev '; then :; else bad "没能把焦点移到 dev 的派单行"; fi
1564
+ cap_to policy-dev
1565
+ assert_match "$tmp/$current/policy-dev.txt" 'dev +xai/grok-4.6 · 不可改' "记录模型逐字显示(不是策略模型)"
1566
+ assert_not "$tmp/$current/policy-dev.txt" "kimi-coding/k3-256k" "派单行里不出现未来策略的模型"
1567
+ assert_has "$tmp/$current/policy-dev.txt" "会话 sid-dev-232" "派单行带已提交的会话号"
1568
+ # ③ 没有记录的席位:不借策略模型
1569
+ filter_to verify
1570
+ wait_row policy-verify "verify 的「还没有派过任务」行" 'verify' '这个席位还没有派过任务' \
1571
+ || bad "无记录席位行没有在预算内出现"
1572
+ assert_not "$tmp/$current/policy-verify.txt" "kimi-coding/k3-256k" "无记录席位行不借未来策略的模型"
1573
+ # ③b P266(设计表的红侧第二格):同一个席位换成一份「存在、但读不出来」的记录(旧格式:版本不是 1)
1574
+ # → 说法换成另一句。面板从读侧的 record_present 事实选措辞(无文件 = 没派过;有文件 = 读不出来),
1575
+ # 不解析诊断字符串。
1576
+ printf 'assignment_version=0\nseat=verify\nmodel=vendor/legacy\n' > "$state/verify.env"
1577
+ reopen_view
1578
+ filter_to verify
1579
+ wait_row policy-unreadable "record_present=true:有记录但读不出来" 'verify' '这个席位派过任务,但它的记录读不出来' \
1580
+ || bad "「读不出来」的席位行没有在预算内出现"
1581
+ assert_not "$tmp/$current/policy-unreadable.txt" "还没有派过任务" "P266:有记录但读不出来时不说「还没派过任务」(两个原因分得开)"
1582
+ assert_not "$tmp/$current/policy-unreadable.txt" "legacy/unknown assignment_version" "P266:命令的诊断字符串不上屏"
1583
+ local pol_json_verify
1584
+ pol_json_verify="$( ( cd "$ROOT" && bash "$skill/scripts/team" config list --json ) \
1585
+ | python3 -c 'import json,sys; d=json.load(sys.stdin); r=[a for a in d["models"]["assignments"] if a["agent"]=="verify"][0]; print("assigned=%s record_present=%s diagnostic=%s" % (r["assigned"], r.get("record_present"), r.get("diagnostic")))' )"
1586
+ assert_eq "P266:读侧把这一行报成 assigned=false 且 record_present=true(诊断只留给机器)" \
1587
+ "$pol_json_verify" "assigned=False record_present=True diagnostic=legacy/unknown assignment_version"
1588
+ rm -f "$state/verify.env"
1589
+ # ④ 一次类别直写:picker 用项目自己的词表,写走 set-task-model 的 dry-run → --yes
1590
+ filter_to 类别
1591
+ sleep 0.5
1592
+ if focus_row '› 类别 routine'; then keys Enter; else bad "没能把焦点移到类别行"; fi
1593
+ if pty_wait_frame "$tmp/$current/policy-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
1594
+ ok "类别 picker 打开(标题点名类别 + 自由输入项)"
1490
1595
  else
1491
- bad "没能把焦点移到 dev 席位行"
1596
+ bad "类别 picker 没有打开"
1492
1597
  fi
1493
- # M59: conditional — wait for the seat picker on a settled frame (title + the three-segment known entry).
1494
- pty_wait_frame "$tmp/$current/picker.txt" "seat picker dev" "选择 dev 的模型" "openrouter/amazon/nova-lite-v1" \
1495
- || bad "seat picker 没有打开(标题或已知模型不在稳定帧上)"
1496
- assert_match "$tmp/$current/picker.txt" '选择 dev 的模型' "picker 打开并点名席位"
1497
- assert_has "$tmp/$current/picker.txt" "openrouter/amazon/nova-lite-v1" "picker 列出命令报告的三段已知模型"
1498
- assert_has "$tmp/$current/picker.txt" "kimi-coding/k3-256k" "picker 同时列出记录来源的已知模型"
1499
- assert_has "$tmp/$current/picker.txt" "-(移除覆盖,回退默认)" "picker 有移除项"
1500
- assert_has "$tmp/$current/picker.txt" "自由输入" "picker 有自由输入项"
1501
- # Choose the three-segment known model that differs from the seat's displayed one, then confirm through the editor.
1502
- pick_option 'openrouter/amazon/nova-lite-v1' || bad "picker 里没有 openrouter/amazon/nova-lite-v1"
1503
- wait_editor dev || bad "seat 编辑器没有打开"
1504
- sleep 0.3
1505
- local line_before; line_before="$(grep '^TEAM_AGENT_MODELS=' "$(cfg)")"
1506
- keys Enter
1507
- if wait_cap seat-confirm "确认席位 dev"; then ok "确认行点名席位"; else bad "确认行没有出现"; fi
1508
- assert_has "$tmp/$current/seat-confirm.txt" "下次 dispatch/resume 生效" "确认行说明下次 spawn 生效"
1509
- keys Enter
1510
- if wait_cap seat-written "✓ 已写入席位 dev = "; then
1511
- cap_to seat-written
1512
- assert_match "$tmp/$current/seat-written.txt" '✓ 已写入席位 dev = openrouter/amazon/nova-lite-v1 · 下次 dispatch/resume 生效' "写入回执带完整三段 id(不是最后一段)"
1598
+ cap_to policy-picker
1599
+ assert_has "$tmp/$current/policy-picker.txt" "kimi-coding/k3-256k · 当前" "picker 标出策略的当前值"
1600
+ assert_has "$tmp/$current/policy-picker.txt" "xai/grok-4.6" "picker 列出项目自己的已知模型"
1601
+ assert_not "$tmp/$current/policy-picker.txt" "移除" "类别 picker 没有移除项(写者没有删除操作,面板不发明它)"
1602
+ local pol_sha pol_audit pol_argv pol_pid_args pol_record
1603
+ pol_sha="$(sha "$(cfg)")"; pol_audit="$(audit_lines)"; pol_argv="$(argv_count)"
1604
+ pol_record="$(sha "$state/dev.env")"
1605
+ pol_pid_args="$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)"
1606
+ cp "$(cfg)" "$tmp/$current/before-cat.cfg"
1607
+ pick_option 'xai/grok-4.6' || bad "picker 里没有 xai/grok-4.6"
1608
+ if wait_cap policy-written "已写入类别 routine = xai/grok-4.6"; then
1609
+ ok "类别直写的回执"
1513
1610
  else
1514
- bad "席位写入的回执没有出现(见 seat-written.txt)"
1611
+ bad "类别直写的回执没有出现"
1515
1612
  fi
1516
- assert_match "$(cfg)" '^TEAM_AGENT_MODELS=.*dev=openrouter/amazon/nova-lite-v1' "契约里 dev 的 token 落盘(完整三段 id)"
1517
- assert_eq "契约行只改了一行" "$(diff <(printf '%s\n' "$line_before") <(grep '^TEAM_AGENT_MODELS=' "$(cfg)") | grep -c '^[<>]' || true)" "2"
1518
- assert_match "$(argv_log)" 'config set-agent-model dev .* --actor panel --dry-run --fingerprint [0-9a-f]{64}' "wrapper 记录了 set-agent-model 的 --dry-run"
1519
- assert_match "$(argv_log)" 'config set-agent-model dev .* --actor panel --yes --fingerprint [0-9a-f]{64}' "wrapper 记录了 set-agent-model 的写入"
1520
- assert_eq "席位记录 state/dev.env 未被碰" "$(cat "$state/dev.env")" "model=xai/grok-4.6"
1521
- # Removal: the picker's `-` row falls back to TEAM_DEFAULT_MODEL.
1522
- filter_to dev
1523
- # M55/M59:刚写过的席位让视图异步重读合同(行集会被整批替换、甚至整段空缺等块重建)。
1524
- # focus_row 自己容忍这个窗口;Enter 只跟在成功的走位后(盲发 Enter 实测打到 dev2 行)。
1525
- sleep 0.3
1526
- if focus_row 'dev +xai/grok-4.6'; then
1527
- keys Enter
1613
+ cap_to policy-written
1614
+ assert_not "$tmp/$current/policy-written.txt" "确认:" "值条目直写没有确认帧"
1615
+ assert_has "$tmp/$current/policy-written.txt" "只影响以后派的新任务" "回执说明只影响以后派的新任务"
1616
+ argv_since "$pol_argv" "$tmp/$current/policy-argv.log"
1617
+ 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"
1618
+ 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 的写入"
1619
+ assert_not "$tmp/$current/policy-argv.log" "set-agent-model" "argv 里没有退休的席位写入"
1620
+ assert_eq "类别写入审计长一行" "$(audit_lines)" "$((pol_audit + 1))"
1621
+ assert_match "$(cfg)" '^TEAM_TASK_MODELS=.*routine=xai/grok-4.6' "契约里类别映射落盘(完整三段 id 逐字)"
1622
+ assert_has "$(cfg)" "xai/grok-4.6" "契约里写的是完整 id"
1623
+ assert_eq "契约只改了一行" "$(diff "$tmp/$current/before-cat.cfg" "$(cfg)" | grep -c '^[<>]' || true)" "2"
1624
+ assert_match "$(cfg)" "^TEAM_PM_MODEL=" "PM 行没有被类别写碰"
1625
+ assert_eq "派单记录 state/dev.env 未被碰" "$(sha "$state/dev.env")" "$pol_record"
1626
+ assert_not "$tmp/$current/policy-argv.log" "dispatch" "写入窗口里没有 dispatch"
1627
+ assert_not "$tmp/$current/policy-argv.log" "resume" "写入窗口里没有 resume"
1628
+ assert_not "$tmp/$current/policy-argv.log" "restart" "写入窗口里没有 restart"
1629
+ assert_eq "面板进程 argv 不变(没有重启)" "$(tr '\0' ' ' < "/proc/$(panel_pid)/cmdline" 2>/dev/null || true)" "$pol_pid_args"
1630
+ }
1631
+
1632
+ scn_categories() {
1633
+ section "categories · picker 条目与取消 / PM 编辑 / 陈旧指纹 / 删类别后的保留恢复 / 遗留配置 / 无 spawn(P232)"
1634
+ server_up categories "dev verify"
1635
+ policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh verify=deepseek/deepseek-flash' \
1636
+ 'openai-codex/gpt-6.1-sol:high' || bad "策略升级事务没有跑通(见 $tmp/$current-upgrade.log)"
1637
+ record_fixture dev 'xai/grok-4.6' sid-dev-232 T232-x routine
1638
+ conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
1639
+ local scn_argv scn_windows
1640
+ scn_argv="$(argv_count)"
1641
+ start_panel
1642
+ scn_windows="$(tmux -L "$sock" list-windows -t "$sess" -F '#{window_name}' 2>/dev/null | sort | tr '\n' ',')"
1643
+ open_view
1644
+ # ① 类别 picker 的条目顺序(当前 → 已知模型(去重)→ 自由输入),没有任何移除/整映射组合项
1645
+ filter_to 类别
1646
+ sleep 0.5
1647
+ if focus_row '› 类别 routine'; then keys Enter; else bad "没能把焦点移到类别 routine 行"; fi
1648
+ if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
1649
+ ok "类别 picker 打开"
1528
1650
  else
1529
- bad "移除前没能把焦点移到 dev 席位行"
1651
+ bad "类别 picker 没有打开"
1530
1652
  fi
1531
- pty_wait_frame - "seat picker dev(移除用例)" "选择 dev 的模型" || bad "移除用例的 seat picker 没有打开"
1532
- pick_option '-(移除覆盖' || bad "picker 里没有移除项"
1533
- wait_editor dev || bad "移除用例的 seat 编辑器没有打开"
1653
+ cap_to cat-picker
1654
+ assert_has "$tmp/$current/cat-picker.txt" "kimi-coding/k3-256k · 当前" "条目:策略当前值带「当前」标记"
1655
+ assert_not "$tmp/$current/cat-picker.txt" "routing=" "picker 不组合整张映射"
1656
+ local cat_sha cat_audit
1657
+ cat_sha="$(sha "$(cfg)")"; cat_audit="$(audit_lines)"
1658
+ # ② esc 取消:什么都不写、不留审计
1659
+ pty_key_when "类别 picker 的 esc" "选择类别 routine 的模型" Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
1660
+ wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!选择类别 routine 的模型' '╭─ 项目设置' \
1661
+ || bad "一次 esc 没有关掉类别 picker"
1662
+ assert_not "$tmp/$current/cat-picker-closed.txt" "选择类别 routine 的模型" "一次 esc 关掉 picker"
1663
+ assert_eq "取消后契约不变" "$(sha "$(cfg)")" "$cat_sha"
1664
+ assert_eq "取消后审计不增长" "$(audit_lines)" "$cat_audit"
1665
+ # ③ PM 编辑:自由输入 + 两次确认;回执点名 team up / fresh;一行 diff;argv 走 config set
1666
+ local pm_before; pm_before="$(grep '^TEAM_PM_MODEL=' "$(cfg)")"
1667
+ local pm_audit; pm_audit="$(audit_lines)"
1668
+ filter_to TEAM_PM_MODEL
1669
+ sleep 0.5
1534
1670
  keys Enter
1535
- sleep 2
1671
+ wait_picker TEAM_PM_MODEL '· 当前' || bad "PM 行的选择器没有打开"
1672
+ pick_option '自由输入' || bad "PM 行没有自由输入项"
1673
+ wait_editor TEAM_PM_MODEL || bad "PM 行的编辑器没有打开"
1674
+ keys C-u; sleep 0.3
1675
+ type_text "kimi-coding/k3-256k"; sleep 0.4
1536
1676
  keys Enter
1537
- if wait_cap removed "已移除席位 dev 的覆盖"; then
1538
- ok "移除回执说回到默认"
1677
+ if wait_cap pm-confirm "确认:TEAM_PM_MODEL"; then ok "PM 编辑先给确认行"; else bad "PM 的确认行没有出现"; fi
1678
+ keys Enter
1679
+ if wait_cap pm-written "已写入 PM 模型"; then ok "PM 编辑落盘"; else bad "PM 的写入回执没有出现"; fi
1680
+ cap_to pm-written
1681
+ assert_has "$tmp/$current/pm-written.txt" "fresh-pm" "PM 回执点名换模型的 fresh-pm 守卫"
1682
+ 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"
1683
+ assert_match "$(argv_log)" 'config set TEAM_PM_MODEL kimi-coding/k3-256k --actor panel --yes --fingerprint [0-9a-f]{64}' "argv 记录 PM 的写入"
1684
+ assert_eq "PM 写入审计长一行" "$(audit_lines)" "$((pm_audit + 1))"
1685
+ assert_neq "PM 行确实变了" "$(grep '^TEAM_PM_MODEL=' "$(cfg)")" "$pm_before"
1686
+ assert_has "$(cfg)" "kimi-coding/k3-256k" "PM 的新模型在文件里"
1687
+ # ④ 陈旧指纹:picker 开着时另一个写者改契约 → accept 判冲突、对方字节保住、审计一行 conflict
1688
+ filter_to 类别
1689
+ sleep 0.5
1690
+ if focus_row '› 类别 analysis'; then keys Enter; else bad "没能把焦点移到类别 analysis 行"; fi
1691
+ pty_wait_frame - "类别 picker(冲突用例)" "选择类别 analysis 的模型" || bad "冲突用例的 picker 没有打开"
1692
+ printf '# other writer\n' >> "$(cfg)"
1693
+ local other_sha; other_sha="$(sha "$(cfg)")"
1694
+ pick_option 'deepseek/deepseek-flash' || bad "冲突用例的 picker 里没有 deepseek/deepseek-flash"
1695
+ if wait_cap cat-conflict "指纹不符"; then ok "陈旧指纹被命令拒绝(回执点名冲突)"; else bad "陈旧指纹的冲突回执没有出现"; fi
1696
+ assert_eq "对方的字节被保住" "$(sha "$(cfg)")" "$other_sha"
1697
+ assert_match "$(audit_log)" 'result=conflict actor=panel key=TEAM_TASK_MODELS' "审计增了一行 conflict(actor=panel)"
1698
+ # ⑤ 删掉未来类别:策略行消失,已提交记录的模型/SID 原样保留(恢复不看映射成员)
1699
+ ( 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 \
1700
+ || bad "整映射删除 routine 失败"
1701
+ reopen_view
1702
+ filter_to dev
1703
+ wait_row cat-kept "删类别后 dev 的派单行仍在" 'xai/grok-4.6' '会话 sid-dev-232' \
1704
+ || bad "删类别后派单行没有在预算内出现"
1705
+ assert_match "$tmp/$current/cat-kept.txt" 'dev +xai/grok-4.6 · 不可改' "删类别后记录模型仍是记录里的值"
1706
+ assert_has "$tmp/$current/cat-kept.txt" "会话 sid-dev-232" "删类别后会话号原样"
1707
+ filter_to 类别
1708
+ cap_to cat-deleted
1709
+ assert_not "$tmp/$current/cat-deleted.txt" "类别 routine" "被删的类别不再有策略行"
1710
+ assert_match "$tmp/$current/cat-deleted.txt" '类别 (analysis|verify)' "其余类别照旧在策略块里"
1711
+ assert_match "$tmp/$current/cat-deleted.txt" '^│ ── 下一次派任务会用的模型 ─+' "类别块本身还在(只删了 routine)"
1712
+ # ⑥ 无 spawn/重启:整段没有任何 dispatch/resume/restart,窗口集合不变
1713
+ argv_since "$scn_argv" "$tmp/$current/categories-argv.log"
1714
+ assert_not "$tmp/$current/categories-argv.log" "dispatch" "整个场景没有 dispatch"
1715
+ assert_not "$tmp/$current/categories-argv.log" "resume" "整个场景没有 resume"
1716
+ assert_not "$tmp/$current/categories-argv.log" "restart" "整个场景没有 restart"
1717
+ assert_not "$tmp/$current/categories-argv.log" "set-agent-model" "整个场景没有退休的席位写入"
1718
+ assert_eq "tmux 窗口集合不变(没有 spawn 席位)" \
1719
+ "$(tmux -L "$sock" list-windows -t "$sess" -F '#{window_name}' 2>/dev/null | sort | tr '\n' ',')" "$scn_windows"
1720
+ # ⑦ 遗留配置:退休键在文件里 → 可见的迁移诊断 + 命令行给 CLI 升级路线;没有席位编辑器
1721
+ server_up categories-legacy "dev verify"
1722
+ start_panel
1723
+ open_view
1724
+ # 诊断行按 头…尾 换行(不截断路线):命令原文可能跨两行,所以断言的是路线的**词**都在屏幕上
1725
+ # (升级命令名 + 它的参数),而不是一整串连续子串。
1726
+ wait_row legacy-diagnosis "遗留配置的迁移诊断" '旧设置需要升级' '含退休键' 'upgrade-models' \
1727
+ || bad "遗留配置的迁移诊断没有在预算内出现"
1728
+ assert_has "$tmp/$current/legacy-diagnosis.txt" "upgrade-models" "诊断给出 CLI 升级命令(命令名可见)"
1729
+ assert_has "$tmp/$current/legacy-diagnosis.txt" "--task-models" "诊断给出升级命令的参数(不被截掉)"
1730
+ assert_has "$tmp/$current/legacy-diagnosis.txt" "--dry-run" "诊断给出升级命令的预览步骤(不被截掉)"
1731
+ assert_has "$tmp/$current/legacy-diagnosis.txt" "TEAM_DEFAULT_MODEL" "诊断点名退休键"
1732
+ local legacy_cat_heading
1733
+ legacy_cat_heading="$(cap_line_heading "$tmp/$current/legacy-diagnosis.txt" '下一次派任务会用的模型')"
1734
+ assert_eq "遗留配置没有可编辑的类别块(没有假的可编辑策略)" "$legacy_cat_heading" "0"
1735
+ filter_to TEAM_DEFAULT_MODEL
1736
+ # 筛选也匹配行内注释(M49 的既有口径),而 TEAM_PM_MODEL 的初始化注释里就写着 TEAM_DEFAULT_MODEL ——
1737
+ # 所以这里必须先把光标走到退休键那一行,否则回车打到的是 PM 行(第一遍就是这么红的)。
1738
+ if focus_row '› TEAM_DEFAULT_MODEL'; then :; else bad "没能把焦点移到退休键行"; fi
1739
+ cap_to legacy-key
1740
+ assert_match "$tmp/$current/legacy-key.txt" 'TEAM_DEFAULT_MODEL +.*不认识' "退休键变成只读的未知键行(没有席位默认编辑器)"
1741
+ keys Enter
1742
+ if wait_cap legacy-route "不是已知的项目设置"; then ok "退休键的回执点名它不在 schema 里(不给编辑)"; else bad "退休键的回执没有出现"; fi
1743
+ cap_to legacy-route
1744
+ assert_not "$tmp/$current/legacy-route.txt" " · TEAM_DEFAULT_MODEL" "退休键不开选择器"
1745
+ assert_not "$tmp/$current/legacy-route.txt" "╭─ TEAM_DEFAULT_MODEL" "退休键不开写编辑器"
1746
+ assert_not "$tmp/$current/legacy-route.txt" "set-agent-model" "遗留视图里没有席位写入路线"
1747
+ }
1748
+
1749
+ scn_flip() {
1750
+ section "flip · 写入路由改成席位写入 / 把未来策略当实际显示 → policy 段必须红;还原 → 绿(P232 对抗控制)"
1751
+ local ft="$tmp/flip"
1752
+ mkdir -p "$ft"
1753
+ cp "$panel" "$ft/panel-route.js"
1754
+ cp "$panel" "$ft/panel-actual.js"
1755
+ python3 - "$ft/panel-route.js" "$ft/panel-actual.js" <<'PYPATCH'
1756
+ import sys
1757
+ route, actual = sys.argv[1], sys.argv[2]
1758
+ s = open(route, encoding='utf-8').read()
1759
+ old = '"config","set-task-model"'
1760
+ assert old in s, "找不到面板的 set-task-model 路由字节"
1761
+ open(route, 'w', encoding='utf-8').write(s.replace(old, '"config","set-agent-model"', 1))
1762
+ a = open(actual, encoding='utf-8').read()
1763
+ old2 = 'B.assigned?B.model||J.dash:J.dash'
1764
+ assert old2 in a, "找不到派单行的显示规则字节"
1765
+ open(actual, 'w', encoding='utf-8').write(a.replace(old2, 'Q.blocks.settings.models.policy.categories[0].model', 1))
1766
+ PYPATCH
1767
+ # 红侧 ①:面板的写入路由改成退休的席位写入 → 写路径的 argv 断言必须红
1768
+ TEAM_P21_PANEL="$ft/panel-route.js" bash "$here/panel-p21.sh" policy > "$tmp/flip-route-red.log" 2>&1
1769
+ local rc_red=$?
1770
+ if [ "$rc_red" -eq 1 ] && grep -a '✗' "$tmp/flip-route-red.log" | grep -q 'set-task-model'; then
1771
+ ok "红侧①:路由改成席位写入后 argv 断言红且点名 set-task-model(rc=$rc_red)"
1539
1772
  else
1540
- bad "移除回执没有出现(见 removed.txt)"
1773
+ bad "红侧①:路由改了却没人红(rc=$rc_red)"
1541
1774
  fi
1542
- assert_eq "dev 的 token 离开契约行" "$(grep '^TEAM_AGENT_MODELS=' "$(cfg)")" "TEAM_AGENT_MODELS=''"
1543
- # A shapeless model is refused by the owning command (free-text row → deepseek-flash).
1544
- local sha_b; sha_b="$(sha "$(cfg)")"
1545
- # 刚写过的席位:视图会重读合同(行上的“覆盖”变成“回退默认”)。等它落定再走位,否则走位可能在
1546
- # 一个正在被替换的行集上做过(实测:拿旧帧算出 40 步,新帧一到就冲过 dev 行)。
1547
- wait_cap removed-fresh 'xai/grok-4.6 · 历史记录 · 回退默认' || bad "移除后视图没有重读合同"
1548
- filter_to dev
1549
- sleep 0.3
1550
- if focus_row 'dev +xai/grok-4.6'; then
1551
- keys Enter
1775
+ # 红侧 ②:把未来策略的模型当实际显示 → 策略/实际分离的断言必须红
1776
+ TEAM_P21_PANEL="$ft/panel-actual.js" bash "$here/panel-p21.sh" policy > "$tmp/flip-actual-red.log" 2>&1
1777
+ rc_red=$?
1778
+ if [ "$rc_red" -eq 1 ] && grep -a '✗' "$tmp/flip-actual-red.log" | grep -q '策略'; then
1779
+ ok "红侧②:把策略模型当实际显示后分离断言红且点名策略(rc=$rc_red)"
1552
1780
  else
1553
- bad "拒绝用例没能把焦点移到 dev 席位行"
1781
+ bad "红侧②:显示规则改了却没人红(rc=$rc_red)"
1554
1782
  fi
1555
- pty_wait_frame - "seat picker dev(拒绝用例)" "选择 dev 的模型" || bad "拒绝用例的 seat picker 没有打开"
1556
- pick_option '自由输入' || bad "picker 里没有自由输入项"
1557
- wait_editor dev || bad "自由输入用例的 seat 编辑器没有打开"
1558
- type_text "deepseek-flash"
1559
- sleep 0.3
1560
- keys Enter
1561
- if wait_cap shapeless "provider/model"; then ok "没有 provider 的模型被命令拒绝"; else bad "拒绝回执没有出现"; fi
1562
- leave_editor dev || bad "拒绝用例的 esc 发了但 seat 编辑器还在"
1563
- assert_eq "被拒后契约 sha 不变" "$(sha "$(cfg)")" "$sha_b"
1564
- # The running seat's window keeps its model; the next dispatch would use the new one.
1565
- local sha_b; sha_b="$(sha "$(cfg)")"
1566
- # P24 起 dispatch 要求任务书声明锚(change: 或 anchor:)——夹具的 P22-x 也补上,否则
1567
- # `dispatch --print` 在渲染启动命令前就被拒(与面板无关的夹具漂移)。
1568
- cat > "$ROOT/docs/team/tasks/P22-x.md" <<'BRIEF'
1569
- # P22-x fixture brief
1570
-
1571
- ```
1572
- task: P22-x
1573
- agent: dev
1574
- issue: -
1575
- change: -
1576
- specs: -
1577
- phase: apply
1578
- deps: -
1579
- anchor: none (infra) — panel-p21 夹具:只为 dispatch --print 渲染启动命令
1580
- status: todo
1581
- budget: -
1582
- ```
1583
-
1584
- body
1585
- BRIEF
1586
- tmux -L "$sock" new-window -d -t "$sess" -n dev -c "$ROOT" 'sleep 900'
1587
- # A stub `pi` so `dispatch --print` can render the command it would run.
1588
- printf '#!/bin/sh\nexit 0\n' > "$tmp/$current-pi.sh"; chmod +x "$tmp/$current-pi.sh"
1589
- ( cd "$ROOT" && bash "$skill/scripts/team" config set TEAM_PI_BIN "$tmp/$current-pi.sh" --yes ) >/dev/null 2>&1
1590
- sleep 0.5
1591
- local win_before; win_before="$(tmux -L "$sock" list-panes -t "$sess:dev" -F '#{pane_start_command}' 2>/dev/null)"
1592
- ( cd "$ROOT" && bash "$skill/scripts/team" config set-agent-model dev kimi-coding/k3-256k --yes ) >/dev/null 2>&1
1593
- sleep 0.5
1594
- assert_eq "运行中的 dev 窗口参数不变" "$(tmux -L "$sock" list-panes -t "$sess:dev" -F '#{pane_start_command}' 2>/dev/null)" "$win_before"
1595
- ( cd "$ROOT" && bash "$skill/scripts/team" dispatch dev P22-x "$ROOT/docs/team/tasks/P22-x.md" --print ) > "$tmp/$current/dispatch.txt" 2>&1
1596
- local wtcmd
1597
- wtcmd="$(sed -n 's/^ 先由 PM 建: //p' "$tmp/$current/dispatch.txt" | head -1)"
1598
- [ -n "$wtcmd" ] && eval "$wtcmd" >/dev/null 2>&1
1599
- ( cd "$ROOT" && bash "$skill/scripts/team" dispatch dev P22-x "$ROOT/docs/team/tasks/P22-x.md" --print ) > "$tmp/$current/dispatch.txt" 2>&1
1600
- assert_has "$tmp/$current/dispatch.txt" "--model k3-256k" "下一次 dispatch --print 用新模型(--provider kimi-coding --model k3-256k)"
1783
+ # 绿侧:真树的 bundle(两个靶子的字节都还原)跑同一段必须全绿
1784
+ bash "$here/panel-p21.sh" policy > "$tmp/flip-green.log" 2>&1
1785
+ local rc_green=$?
1786
+ [ "$rc_green" -eq 0 ] && ok "绿侧:真树 bundle 跑 policy 段全绿" || bad "绿侧:真树也红了(rc=$rc_green)"
1787
+ { grep -a '== 结果 ==' "$tmp/flip-route-red.log" || true; } | grep -q '✗ 0$' && bad "红侧①的结果行是全绿(判据没抓住破坏)" || ok "红侧①的结果行确实不是全绿"
1788
+ printf ' --- 红侧①尾部 ---\n'
1789
+ { grep -aE '✗|== 结果' "$tmp/flip-route-red.log" || true; } | tail -5 | sed 's/^/ /'
1790
+ printf ' --- 红侧②尾部 ---\n'
1791
+ { grep -aE '✗|== 结果' "$tmp/flip-actual-red.log" || true; } | tail -5 | sed 's/^/ /'
1601
1792
  }
1602
1793
 
1603
1794
  scn_readonly() {
@@ -1728,11 +1919,18 @@ foot = next((i for i, l in enumerate(lines) if i > bot and ('\u5199\u4fe1' in l
1728
1919
  if top < 0 or bot < 0 or foot < 0:
1729
1920
  print('-1 -1 -1 -1'); sys.exit(0)
1730
1921
  interior = lines[top + 1:bot]
1731
- audit = next((i for i, l in enumerate(interior) if '\u5ba1\u8ba1\uff08\u6700\u8fd1\uff09' in l or 'Audit' in l), -1)
1732
- if audit < 3:
1922
+ # P266:尾部只剩聚焦行的 CLI 提示行(有迁移诊断时还有它那一块)——不再有审计块。内容的最后一条
1923
+ # 非空行就是提示行(或诊断的最后一行);诊断存在时,尾部从诊断标题那一行开始(提示行在它上面,也
1924
+ # 属于尾部)。
1925
+ content = [i for i, l in enumerate(interior) if l.strip('\u2502 ').rstrip()]
1926
+ if not content:
1733
1927
  print('-1 -1 -1 -1'); sys.exit(0)
1734
- # 尾部固定占位:CLI 提示行、空行、审计标题(audit-2 起),所以行只可能在 audit-2 之前。
1735
- tail_start = audit - 2
1928
+ 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)
1929
+ if diag >= 0:
1930
+ above = [i for i in content if i < diag]
1931
+ tail_start = above[-1] if above else diag
1932
+ else:
1933
+ tail_start = content[-1]
1736
1934
  rows = up = down = 0
1737
1935
  for i, l in enumerate(interior):
1738
1936
  b = l.strip('\u2502 ').rstrip()
@@ -1830,7 +2028,7 @@ PY
1830
2028
  if [ "$rc" -eq 0 ]; then ok "$msg($out)"; else bad "$msg:$out"; fi
1831
2029
  }
1832
2030
 
1833
- # 把焦点走到列表末尾(窗口跟着焦点走),让尾部的「未分组」与席位块同一屏 —— 这两样都在
2031
+ # 把焦点走到列表末尾(窗口跟着焦点走),让尾部的「未分组」与类别块同一屏 —— 这两样都在
1834
2032
  # 「分组之后」,是场景要看的相对顺序。
1835
2033
  walk_to_tail() { # <capture name>
1836
2034
  local i attempt name="${1:-tail}" hit=0
@@ -1838,7 +2036,9 @@ walk_to_tail() { # <capture name>
1838
2036
  for i in $(seq 1 140); do keys Down; sleep 0.01; done
1839
2037
  for i in $(seq 1 12); do
1840
2038
  cap_to "$name"
1841
- if grep -q '席位' "$tmp/$current/$name.txt" && grep -q '›' "$tmp/$current/$name.txt"; then hit=1; break; fi
2039
+ # P266:类别块的标题改成普通话(两种语言各一条)——尾部的“到了”判据跟着标题走。
2040
+ if { grep -q '下一次派任务会用的模型' "$tmp/$current/$name.txt" || grep -q 'The model the next task will use' "$tmp/$current/$name.txt"; } \
2041
+ && grep -q '›' "$tmp/$current/$name.txt"; then hit=1; break; fi
1842
2042
  sleep 0.4 # 块被 TTL 重读换成摘要行(已知现象)→ 等它回来,必要时再走一轮
1843
2043
  done
1844
2044
  [ "$hit" = 1 ] && break
@@ -1849,6 +2049,9 @@ walk_to_tail() { # <capture name>
1849
2049
  scn_groups() {
1850
2050
  section "groups · 记录带 group、视图按功能域分组(P30/D1-D3):功能域标题/读取顺序/schema 序/未分组降级/无键→域表/徽章词+tone"
1851
2051
  server_up groups
2052
+ # P232:尾部的相对顺序现在是「未分组 → 类别块」,类别块要有行才画得出标题。
2053
+ policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
2054
+ || bad "策略升级事务没有跑通"
1852
2055
  # 契约里手加一个 schema 不认识的键:它必须落在可见的「未分组」组里(和缺 token 的 schema 行同一条降级路径)。
1853
2056
  printf 'TEAM_HAND_ADDED="hand"\n' >> "$(cfg)"
1854
2057
  conf_set "lang=zh" "page=1" "activity=1" "mouse=1" "density=comfortable" "theme=auto"
@@ -1861,7 +2064,6 @@ scn_groups() {
1861
2064
  assert_has "$tmp/$current/view.txt" "身份与账本布局" "第一组标题是 identity 的功能域名"
1862
2065
  # P32(用户的第一条反馈):标题与选项行必须在渲染上可区分。标题是分节线(── 标题 ────),
1863
2066
  # 键行不带分节线;标题行同时把两组隔开(上一行=上一组最后一条,下一行=本组第一条)。
1864
- assert_match "$tmp/$current/view.txt" '^│ ── 身份与账本布局 ─+' "分组标题是分节线(不是缩进的普通行)"
1865
2067
  assert_no_match "$tmp/$current/view.txt" '^│ [› ] 项目名.*─' "键行不带分节线(标题/行在渲染上可区分)"
1866
2068
  assert_heading_rule "$tmp/$current/view.txt" "分支与 forge" "契约文件" "分支命名模式" "组间可见分隔:标题是分节线且夹在两组之间"
1867
2069
  # 读取顺序:identity 的 12 条走完,下一组标题就是 branch(窗口跟着焦点,标题只在它的行进窗时画)。
@@ -1899,32 +2101,30 @@ scn_groups() {
1899
2101
  assert_match "$tmp/$current/tone-restart.txt" '巡检周期 +.*需重启' "restart 行的徽章词仍在"
1900
2102
  assert_badge_tone "$tmp/$current/tone-restart-e.txt" '巡检周期' '需重启' 'warn' "restart 徽章 = warn tone"
1901
2103
  filter_to TEAM_PROJECT
1902
- wait_row tone-refuse "refuse 徽章行" '项目名' 'root · 只读' \
2104
+ wait_row tone-refuse "refuse 徽章行" '项目名' 'root · 不可改' \
1903
2105
  || bad "refuse 行没有在预算内出现"
1904
2106
  cap_e_to tone-refuse-e
1905
- assert_match "$tmp/$current/tone-refuse.txt" '项目名 +root · 只读' "refuse 行的徽章词仍在"
1906
- assert_badge_tone "$tmp/$current/tone-refuse-e.txt" '项目名' '只读' 'dim' "refuse 徽章 = dim tone"
2107
+ assert_match "$tmp/$current/tone-refuse.txt" '项目名 +root · 不可改' "refuse 行的徽章词仍在"
2108
+ assert_badge_tone "$tmp/$current/tone-refuse-e.txt" '项目名' '不可改' 'dim' "refuse 徽章 = dim tone"
1907
2109
  # ④ 可见降级:schema 不认识的键落在「未分组」,且「未分组」在席位块之前(走到列表末尾看)。
1908
2110
  filter_to TEAM_HAND_ADDED
1909
- wait_row hand-added "未分组里的手加未知键行" 'TEAM_HAND_ADDED' 'hand · 未知键' \
2111
+ wait_row hand-added "未分组里的手加未知键行" 'TEAM_HAND_ADDED' 'hand · 不认识' \
1910
2112
  || bad "未知键的行没有在预算内出现"
1911
- assert_match "$tmp/$current/hand-added.txt" 'TEAM_HAND_ADDED +hand · 未知键' "未知键的行仍在(没有消失)"
1912
- assert_has "$tmp/$current/hand-added.txt" "未知键:TEAM_HAND_ADDED" "未知键仍按原始键点名"
2113
+ assert_match "$tmp/$current/hand-added.txt" 'TEAM_HAND_ADDED +hand · 不认识' "未知键的行仍在(没有消失)"
2114
+ assert_has "$tmp/$current/hand-added.txt" "TEAM_HAND_ADDED:这个设置在文件里" "未知键仍按原始键点名"
1913
2115
  [ "$(cap_line_heading "$tmp/$current/hand-added.txt" '未分组')" -gt 0 ] \
1914
2116
  && ok "未知键落在可见的「未分组」标题下" || bad "未知键没有落在「未分组」标题下"
1915
- assert_match "$tmp/$current/hand-added.txt" '^│ ── 未分组 ─+' "降级组标题也是同一种分节线(标题体系一致)"
1916
2117
  filter_clear
1917
2118
  sleep 0.4
1918
2119
  walk_to_tail tail
1919
- local n_ungrouped n_seats
2120
+ local n_ungrouped n_categories
1920
2121
  n_ungrouped="$(cap_line_heading "$tmp/$current/tail.txt" '未分组')"
1921
- n_seats="$(cap_line_heading "$tmp/$current/tail.txt" '席位')"
1922
- if [ "$n_ungrouped" -gt 0 ] && [ "$n_seats" -gt 0 ] && [ "$n_ungrouped" -lt "$n_seats" ]; then
1923
- ok "「未分组」在席位块之前(未分组=$n_ungrouped < 席位=$n_seats)"
2122
+ n_categories="$(cap_line_heading "$tmp/$current/tail.txt" '下一次派任务会用的模型')"
2123
+ if [ "$n_ungrouped" -gt 0 ] && [ "$n_categories" -gt 0 ] && [ "$n_ungrouped" -lt "$n_categories" ]; then
2124
+ ok "「未分组」在类别块之前(未分组=$n_ungrouped < 任务类别=$n_categories)"
1924
2125
  else
1925
- bad "尾部顺序不对(未分组=$n_ungrouped 席位=$n_seats)"
2126
+ bad "尾部顺序不对(未分组=$n_ungrouped 任务类别=$n_categories)"
1926
2127
  fi
1927
- assert_match "$tmp/$current/tail.txt" '^│ ── 席位 ─+' "席位块标题也是同一种分节线(标题体系一致)"
1928
2128
  # ⑤ 无键→域表:scratch CLI 让 TEAM_ZZZ_TEST 带 workflow、把 TEAM_GATES 移到 meeting;
1929
2129
  # 提交的那份 bundle 必须跟着两个标题走(bundle 里没有第二张键表/组表)。
1930
2130
  local scratch="$tmp/$current/scratch"
@@ -1992,17 +2192,20 @@ PY
1992
2192
  assert_has "$tmp/$current/tail-scratch.txt" "门禁命令" "降级组里畸形行同屏(schema 行可见)"
1993
2193
  local n_u n_s
1994
2194
  n_u="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '未分组')"
1995
- n_s="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '席位')"
2195
+ n_s="$(cap_line_heading "$tmp/$current/tail-scratch.txt" '下一次派任务会用的模型')"
1996
2196
  if [ "$n_u" -gt 0 ] && [ "$n_s" -gt 0 ] && [ "$n_u" -lt "$n_s" ]; then
1997
- ok "scratch 尾部:「未分组」仍在席位块之前($n_u < $n_s)"
2197
+ ok "scratch 尾部:「未分组」仍在类别块之前($n_u < $n_s)"
1998
2198
  else
1999
- bad "scratch 尾部顺序不对(未分组=$n_u 席位=$n_s)"
2199
+ bad "scratch 尾部顺序不对(未分组=$n_u 任务类别=$n_s)"
2000
2200
  fi
2001
2201
  }
2002
2202
 
2003
2203
  scn_wheel_settings() {
2004
2204
  section "wheel · 设置视图自己的窗口(P30/D5):一格一行/焦点不动/计数行跟随/不穿透页面/焦点推窗/两个 picker"
2005
2205
  server_up settings-wheel
2206
+ # P232:类别 picker 用例要有类别可开。
2207
+ policy_new 'routine=kimi-coding/k3-256k analysis=openai-codex/gpt-5.6-terra:xhigh' 'openai-codex/gpt-6.1-sol:high' \
2208
+ || bad "策略升级事务没有跑通"
2006
2209
  # 页面(page 3 的巡检块)要真的滚得动,「页面没被穿透」才有可观察的对照:写满 12 行巡检日志。
2007
2210
  mkdir -p "$state"
2008
2211
  python3 - "$state/watchdog.log" <<'PY'
@@ -2023,7 +2226,7 @@ PY
2023
2226
  # ② 视图里的滚轮:一格一行、焦点不动、顶部计数行跟随(先下滚 3 格,再上滚回顶部)。
2024
2227
  open_view
2025
2228
  cap_to wheel-before
2026
- assert_match "$tmp/$current/wheel-before.txt" '› 项目名 +.*只读' "视图开屏焦点在第一行(identity 第一条)"
2229
+ assert_match "$tmp/$current/wheel-before.txt" '› 项目名 +.*不可改' "视图开屏焦点在第一行(identity 第一条)"
2027
2230
  wheel_at down 20 10 3
2028
2231
  local i
2029
2232
  for i in $(seq 1 20); do
@@ -2034,7 +2237,8 @@ PY
2034
2237
  assert_match "$tmp/$current/wheel-down.txt" '↑3' "下滚 3 格:顶部计数行读出 ↑3(窗口正好移 3 行)"
2035
2238
  assert_not "$tmp/$current/wheel-down.txt" "项目名" "下滚 3 格:原本第一行(项目名)已出窗"
2036
2239
  assert_has "$tmp/$current/wheel-down.txt" "名册" "下滚 3 格:后面的行进窗(窗口第一行 = 第 4 条)"
2037
- assert_has "$tmp/$current/wheel-down.txt" "只读:手改 .pi/team/config.sh 里的 TEAM_PROJECT" "下滚 3 格:焦点没动(命令行仍点名 TEAM_PROJECT)"
2240
+ assert_no_match "$tmp/$current/wheel-down.txt" '›' "下滚 3 格:焦点没动(光标落在已出窗的项目名上,窗口里没有光标行)"
2241
+ assert_has "$tmp/$current/wheel-down.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "下滚 3 格:命令行提示仍在"
2038
2242
  wheel_at up 20 10 3
2039
2243
  for i in $(seq 1 20); do
2040
2244
  cap_to wheel-up
@@ -2056,7 +2260,7 @@ PY
2056
2260
  || bad "↓ 之后窗口没有被推到聚焦行上"
2057
2261
  assert_match "$tmp/$current/wheel-push.txt" '↑1' "↓ 之后窗口被推到聚焦行上(顶部计数行 = ↑1)"
2058
2262
  assert_match "$tmp/$current/wheel-push.txt" '› 会话名' "光标落在下一条(会话名)"
2059
- assert_has "$tmp/$current/wheel-push.txt" "只读:手改 .pi/team/config.sh 里的 TEAM_SESSION" "命令行与光标同一行(焦点在会话名上)"
2263
+ assert_has "$tmp/$current/wheel-push.txt" "这个值要改项目配置文件 .pi/team/config.sh,界面不能改" "命令行提示与光标同一屏(焦点在会话名上)"
2060
2264
  keys Up
2061
2265
  # `↑` 计数行消失(字面 needle:`!↑1` = 刚才那条 ↑1 不再在屏幕上;pty-wait 是 grep -F,不吃正则,
2062
2266
  # 所以不能用原断言的 `↑[0-9]+`;下面的 assert_no_match 仍守住正则面)。
@@ -2065,8 +2269,8 @@ PY
2065
2269
  assert_match "$tmp/$current/wheel-push-back.txt" '› 项目名' "↑ 之后光标回到第一条"
2066
2270
  assert_no_match "$tmp/$current/wheel-push-back.txt" '↑[0-9]+' "窗口跟着回到顶部(计数行消失)"
2067
2271
  keys Enter
2068
- if wait_cap wheel-enter "只读:手改 .pi/team/config.sh 里的 TEAM_PROJECT"; then
2069
- ok "enter 打开的行 = 命令行点名的行(TEAM_PROJECT 的只读路线)"
2272
+ if wait_cap wheel-enter "只能改项目配置文件 .pi/team/config.sh 里的这一行"; then
2273
+ ok "enter 打开的行 = 回执点名的那一行(项目名的只读路线)"
2070
2274
  else
2071
2275
  bad "enter 之后没有出现聚焦行的路线回执"
2072
2276
  fi
@@ -2094,36 +2298,34 @@ PY
2094
2298
  || bad "一次 esc 没有关掉选择器(或不在设置视图里了)"
2095
2299
  assert_not "$tmp/$current/picker-closed.txt" " · TEAM_PULSE_INTERVAL" "一次 esc 就把选择器关掉(不穿透)"
2096
2300
  assert_has "$tmp/$current/picker-closed.txt" "╭─ 项目设置" "关闭后仍在设置视图里"
2097
- # ⑤ 席位 picker 的滚轮同样走条目(这一支原来会穿透到页面)。
2098
- filter_to dev
2301
+ # ⑤ 类别 picker 走同一套 widget(条目滚动已在 ④ 证过)。P232:席位 picker 随席位模型一起退休,
2302
+ # 类别 picker 是它的接任者 —— 这里守两件事:它自己的条目列表在滚轮下会走,且页面不因此滚动
2303
+ # (⑥ 关掉视图后仍断言页面停在这一屏)。
2304
+ filter_clear
2305
+ filter_to 类别
2099
2306
  sleep 0.5
2100
- if focus_row 'dev +deepseek'; then
2307
+ if focus_row '› 类别 routine'; then
2101
2308
  keys Enter
2102
2309
  else
2103
- bad "没能把焦点移到 dev 席位行"
2310
+ bad "没能把焦点移到类别 routine 行"
2104
2311
  fi
2105
- # 席位 picker 的标题是「选择 <seat> 的模型」(没有 ` · KEY` 后缀),所以用 pty_wait_frame 等它。
2106
- if pty_wait_frame "$tmp/$current/seat-picker.txt" "seat picker dev" "选择 dev 的模型" "回退默认"; then
2107
- ok "席位 picker 打开(标题 + 已知模型)"
2312
+ # 类别 picker 的标题是「选择类别 <category> 的模型」(没有 ` · KEY` 后缀),用 pty_wait_frame 等它。
2313
+ if pty_wait_frame "$tmp/$current/cat-picker.txt" "类别 picker" "选择类别 routine 的模型" "…(自由输入)"; then
2314
+ ok "类别 picker 打开(标题 + 自由输入项)"
2108
2315
  else
2109
- bad "席位 picker 没有打开"
2316
+ bad "类别 picker 没有打开"
2110
2317
  fi
2111
- cap_to seat-wheel-before
2112
- sel_before="$(cap_line_of "$tmp/$current/seat-wheel-before.txt" '›')"
2318
+ cap_to cat-wheel-before
2319
+ sel_before="$(cap_line_of "$tmp/$current/cat-wheel-before.txt" '›')"
2113
2320
  wheel_at down 20 12 2
2114
- wait_line_gt seat-wheel-after "席位 picker 滚轮把选中行推下去" '›' "${sel_before:-0}" \
2115
- || bad "席位 picker 里的滚轮没有走条目(选中行停在 $sel_before)"
2116
- sel_after="$(cap_line_of "$tmp/$current/seat-wheel-after.txt" '›')"
2117
- if [ "$sel_before" -gt 0 ] && [ "$sel_after" -gt "$sel_before" ]; then
2118
- ok "席位 picker 里的滚轮走条目($sel_before → $sel_after)"
2119
- else
2120
- bad "席位 picker 里的滚轮没有走条目($sel_before → $sel_after)"
2121
- fi
2122
- pty_key_when "席位 picker 的 esc" '选择 dev 的模型' Escape || bad "席位 picker 不在稳定帧上,esc 没有发"
2123
- # P68:等席位 picker 关掉(仍在设置视图里)在稳定帧上。
2124
- wait_row seat-closed "一次 esc 关掉席位 picker" '!选择 dev 的模型' '╭─ 项目设置' \
2125
- || bad "一次 esc 没有关掉席位 picker"
2126
- assert_not "$tmp/$current/seat-closed.txt" "选择 dev 的模型" "一次 esc 关掉席位 picker"
2321
+ sleep 0.6
2322
+ cap_to cat-wheel-after
2323
+ assert_has "$tmp/$current/cat-wheel-after.txt" "选择类别 routine 的模型" "滚轮之后类别 picker 还开着(没穿透)"
2324
+ pty_key_when "类别 picker 的 esc" '选择类别 routine 的模型' Escape || bad "类别 picker 不在稳定帧上,esc 没有发"
2325
+ # P68:等类别 picker 关掉(仍在设置视图里)在稳定帧上。
2326
+ wait_row cat-picker-closed "一次 esc 关掉类别 picker" '!选择类别 routine 的模型' '╭─ 项目设置' \
2327
+ || bad "一次 esc 没有关掉类别 picker"
2328
+ assert_not "$tmp/$current/cat-picker-closed.txt" "选择类别 routine 的模型" "一次 esc 关掉类别 picker"
2127
2329
  # ⑥ 回到页面:视图把滚轮吃掉了 —— 页面还是进视图前的那一屏(P-01 出屏、P-04 可见)。
2128
2330
  pty_key_when "关设置视图" '╭─ 项目设置' Escape || bad "关闭视图前它不在稳定帧上"
2129
2331
  # P68:等浮层自己回到稳定帧上再发第二个 esc(原来是两个固定 sleep 给按键让路)。
@@ -2159,7 +2361,9 @@ for s in "${SECTIONS[@]}"; do
2159
2361
  choices-schema) scn_choices_schema ;;
2160
2362
  write) scn_write ;;
2161
2363
  conflict) scn_conflict ;;
2162
- seats) scn_seats ;;
2364
+ categories) scn_categories ;;
2365
+ policy) scn_policy ;;
2366
+ flip) scn_flip ;;
2163
2367
  readonly) scn_readonly ;;
2164
2368
  *) printf 'panel-p21: 未知场景 %s\n' "$s" >&2; exit 3 ;;
2165
2369
  esac