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
@@ -213,7 +213,7 @@ server_up() { # <name> → fresh project + private tmux session
213
213
  tmux -L "$sock" kill-server 2>/dev/null || true
214
214
  rm -f "${TMUX_TMPDIR:-/tmp}/tmux-$(id -u)/$sock" 2>/dev/null || true
215
215
  ( cd "$ROOT" && bash "$skill/scripts/team" init --session "$sess" --agents "dev verify" --vcs local \
216
- --gates "true" --docs docs/team ) >"$tmp/$1/init.log" 2>&1 \
216
+ --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 \
217
217
  || { printf 'panel-b3: team init failed\n' >&2; tail -3 "$tmp/$1/init.log" >&2; exit 3; }
218
218
  mkdir -p "$ROOT/.pi/team/state" "$ROOT/docs/team"
219
219
  tmux -L "$sock" new-session -d -s "$sess" -x 120 -y 32 -n bootstrap -c "$ROOT" 'sleep 900'
@@ -357,7 +357,6 @@ scn_pages() {
357
357
  wait_cap_has p3-inbox "收件箱与往来" "捕获里有 [收件箱与往来]"
358
358
  if wait_frame "$tmp/$current/p3-inbox.txt" "消息页计数行(往来,无线程)" '收件箱' '往来' '!线程'; then
359
359
  assert_not "$tmp/$current/p3-inbox.txt" "线程" "捕获里没有 [线程]"
360
- assert_match "$tmp/$current/p3-inbox.txt" '收件箱 [0-9]+ 条 · 往来 [0-9]+ 条' "消息页计数行用「往来」"
361
360
  else
362
361
  b3_wait_verdict $? "捕获里没有 [线程]" "消息页计数行没有在预算内落定"
363
362
  fi
@@ -404,17 +403,17 @@ scn_settings() {
404
403
  start_panel
405
404
  cap_has "progress" relaunch.txt
406
405
  assert_match "$(conf)" '^lang=en$' "重启后语言偏好仍在"
407
- # defaultPage cycles over the four pages and wraps (P18/B2 left the cycle over three: 4 fell
408
- # through to 5 and the next launch reset the page silently — fixed and pinned in B3).
406
+ # defaultPage cycles over the five pages and wraps (P18/B2 left the cycle over three; B3 pinned
407
+ # four; pulse-key-replies made page 5 a real page and pins five).
409
408
  keys ,
410
409
  sleep 0.6
411
410
  keys Down
412
411
  sleep 0.3
413
412
  local cyc
414
- for cyc in 2 3 4 1; do
413
+ for cyc in 2 3 4 5 1; do
415
414
  keys Enter
416
415
  wait_file_has "$(conf)" "page=$cyc" "defaultPage 循环到 $cyc" || bad "defaultPage 没有在预算内循环到 $cyc"
417
- assert_eq "defaultPage 循环到 $cyc(四页 + 回绕)" "$(sed -n 's/^page=//p' "$(conf)" | tr -d '\n')" "$cyc"
416
+ assert_eq "defaultPage 循环到 $cyc(五页 + 回绕)" "$(sed -n 's/^page=//p' "$(conf)" | tr -d '\n')" "$cyc"
418
417
  done
419
418
  keys Escape
420
419
  sleep 0.4
@@ -550,46 +549,154 @@ PYW
550
549
  bad "B5 第二次点击没有打开详情"
551
550
  fi
552
551
 
553
- # ⑥ 空看板:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
552
+ # ⑥ 空看板 + 预览块也清空:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
554
553
  python3 - "$tmp/$current/empty.json" <<'PYE'
555
554
  import json, sys
556
555
  json.dump({"rows": [], "counts": {}, "total": 0, "deliveries": []}, open(sys.argv[1], "w"))
557
556
  PYE
558
557
  printf '2\n' > "$(page_file)"
559
- start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
558
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=empty"
560
559
  keys Down; sleep 0.5
561
560
  keys Enter; sleep 0.8
562
561
  wcap empty
563
- assert_eq "B5 空看板:没有焦点光标" "$(grep -o '›' "$(wfile empty)" | wc -l | tr -d ' ')" "0"
564
- assert_not "$(wfile empty)" "详情" "B5 空看板:enter 不开详情"
565
- assert_eq "B5 空看板:panel-page 仍是 2" "$(page_of)" "2"
566
- assert_has "$(wfile empty)" "看板为空" "B5 空看板:块显示空态而不是一行空行"
567
- B3_STUB_BOARD_FILE="$tmp/$current/empty.json" "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" \
562
+ assert_eq "B5 空看板 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile empty)" | wc -l | tr -d ' ')" "0"
563
+ assert_not "$(wfile empty)" "详情" "B5 空看板 + 空预览块:enter 不开详情"
564
+ assert_eq "B5 空看板 + 空预览块:panel-page 仍是 2" "$(page_of)" "2"
565
+ assert_not "$(wfile empty)" "↑/↓ 行" "B5 空看板 + 空预览块:键位带不发行键"
566
+ B3_STUB_BOARD_FILE="$tmp/$current/empty.json" B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" \
568
567
  --team-cli "$stub" --lang zh --theme dark --width 120 --height 32 --page 2 >"$tmp/$current/empty-targets.json" 2>/dev/null
569
568
  local kinds
570
569
  kinds="$(kinds_of "$tmp/$current/empty-targets.json")"
571
570
  case ",$kinds," in
572
- *",focus,"*|*",open-focused,"*) bad "B5 空看板的目标表还有 focus/open-focused($kinds)" ;;
573
- *) ok "B5 空看板的目标表没有 focus/open-focused($kinds)" ;;
571
+ *",focus,"*|*",open-focused,"*) bad "B5 空看板 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
572
+ *) ok "B5 空看板 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
574
573
  esac
575
574
 
576
- # ⑦ 60x10 降级:没有光标、没有行键、没有死项目标
577
- start_panel
575
+ # ⑥b 空看板 + 预览行(P249):↓ 落在页面行序的第一行(变更块首行),enter 开它的预览,q 原地返回
576
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
577
+ keys Down; sleep 0.6
578
+ wcap empty-preview-focus
579
+ assert_eq "B5 空看板 + 预览行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile empty-preview-focus)" | wc -l | tr -d ' ')" "1"
580
+ if grep -qE '› +pulse-console' "$(wfile empty-preview-focus)"; then
581
+ ok "B5 空看板 + 预览行:焦点落在变更块第一行(空看板不是丢掉活行的理由)"
582
+ else
583
+ bad "B5 空看板 + 预览行:焦点没有落到变更块第一行"
584
+ fi
585
+ keys Enter; sleep 1.4
586
+ wcap empty-preview-detail
587
+ assert_has "$(wfile empty-preview-detail)" "[proposal]" "B5 空看板 + 预览行:enter 打开变更预览(proposal tab)"
588
+ assert_has "$(wfile empty-preview-detail)" "the proposal body" "B5 空看板 + 预览行:变更预览渲染正文"
589
+ assert_not "$(wfile empty-preview-detail)" "任务看板" "B5 变更预览替换了工作页的块"
590
+ assert_eq "B5 打开预览后仍在第 2 页" "$(page_of)" "2"
591
+ keys q; sleep 0.8
592
+ wcap empty-preview-back
593
+ assert_has "$(wfile empty-preview-back)" "活动变更" "B5 预览 q 回工作页"
594
+ assert_not "$(wfile empty-preview-back)" "详情" "B5 预览 q 关掉了详情"
595
+ assert_eq "B5 预览返回后 panel-page 仍是 2" "$(page_of)" "2"
596
+
597
+ # ⑥c 空看板 + 只有规格块一行(P249 的第三个夹具):↓ 落到 specs 行,enter 开 spec 预览
598
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=specs-only"
599
+ keys Down; sleep 0.6
600
+ wcap specs-focus
601
+ assert_eq "B5 空看板 + 规格行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile specs-focus)" | wc -l | tr -d ' ')" "1"
602
+ if grep -qE '› +panel' "$(wfile specs-focus)"; then
603
+ ok "B5 空看板 + 规格行:焦点落在规格块的那一行"
604
+ else
605
+ bad "B5 空看板 + 规格行:焦点没有落到规格块"
606
+ fi
607
+ keys Enter; sleep 1.4
608
+ wcap specs-detail
609
+ assert_has "$(wfile specs-detail)" "[spec]" "B5 规格预览:spec tab 默认打开"
610
+ assert_has "$(wfile specs-detail)" "Requirement: One" "B5 规格预览:渲染 spec 正文"
611
+ assert_eq "B5 规格预览返回后仍在第 2 页" "$(page_of)" "2"
612
+ keys q; sleep 0.8
613
+
614
+ # ⑦ 60x10 降级 + 预览块清空:没有光标、没有行键、没有死项目标(旧断言的新夹具)
615
+ start_panel "B3_STUB_PREVIEWS=empty"
578
616
  tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
579
617
  sleep 1.4
580
618
  keys Down; sleep 0.5
581
619
  keys Enter; sleep 0.8
582
620
  wcap degraded
583
- assert_eq "B5 60x10 降级:没有焦点光标" "$(grep -o '›' "$(wfile degraded)" | wc -l | tr -d ' ')" "0"
584
- assert_not "$(wfile degraded)" "详情" "B5 60x10 降级:enter 不开详情"
585
- assert_not "$(wfile degraded)" "↑/↓ 行" "B5 60x10 降级:键位带不发行键"
586
- "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
621
+ assert_eq "B5 60x10 降级 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile degraded)" | wc -l | tr -d ' ')" "0"
622
+ assert_not "$(wfile degraded)" "详情" "B5 60x10 降级 + 空预览块:enter 不开详情"
623
+ assert_not "$(wfile degraded)" "↑/↓ 行" "B5 60x10 降级 + 空预览块:键位带不发行键"
624
+ B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
587
625
  --lang zh --theme dark --width 60 --height 10 --page 2 >"$tmp/$current/degraded-targets.json" 2>/dev/null
588
626
  kinds="$(kinds_of "$tmp/$current/degraded-targets.json")"
589
627
  case ",$kinds," in
590
- *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级的目标表还有 focus/open-focused($kinds)" ;;
591
- *) ok "B5 60x10 降级的目标表没有 focus/open-focused($kinds)" ;;
628
+ *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
629
+ *) ok "B5 60x10 降级 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
592
630
  esac
631
+
632
+ # ⑦b 60x10 降级 + 预览行:↓ 落到一盏可开的预览行,enter 打开它的预览(不留在板内死路上)
633
+ start_panel
634
+ tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
635
+ sleep 1.4
636
+ keys Down; sleep 0.6
637
+ wcap degraded-preview-focus
638
+ assert_eq "B5 60x10 降级 + 预览行:恰好一个光标" "$(grep -o '›' "$(wfile degraded-preview-focus)" | wc -l | tr -d ' ')" "1"
639
+ keys Enter; sleep 1.4
640
+ wcap degraded-preview-detail
641
+ if grep -qE '\[(proposal|spec|D[0-9]+)\]' "$(wfile degraded-preview-detail)"; then
642
+ ok "B5 60x10 降级:enter 打开的是预览(不是板内死项)"
643
+ else
644
+ bad "B5 60x10 降级:enter 没有打开预览"
645
+ fi
646
+ assert_eq "B5 60x10 降级预览返回后仍在第 2 页" "$(page_of)" "2"
647
+ keys q; sleep 0.8
648
+
649
+ # ⑧ 一页一行序(delta 的场景:板 2 行 + 规格 1 行):三↓ 依次落在板首行、板次行、规格块行
650
+ python3 - "$tmp/$current/two.json" <<'PYW2'
651
+ import json, sys
652
+ json.dump({"rows": [
653
+ {"id": "P14", "title": "一", "agent": "dev", "branch": "task/P14", "deps": "-", "state": "wip", "phase": "apply"},
654
+ {"id": "V14", "title": "二", "agent": "verify", "branch": "-", "deps": "P14", "state": "todo", "phase": "verify"},
655
+ ], "counts": {"todo": 1, "wip": 1, "review": 0, "done": 0, "blocked": 0, "dropped": 0}, "total": 2, "deliveries": []}, open(sys.argv[1], "w"))
656
+ PYW2
657
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/two.json' B3_STUB_PREVIEWS=specs-only"
658
+ keys Down; sleep 0.5
659
+ wcap walk-1
660
+ assert_eq "B5 一页一行序:第一 ↓ 落在板首行 P14" "$(focused_id "$(wfile walk-1)")" "P14"
661
+ assert_eq "B5 一页一行序:第一步恰好一个光标" "$(grep -o '›' "$(wfile walk-1)" | wc -l | tr -d ' ')" "1"
662
+ keys Down; sleep 0.4
663
+ wcap walk-2
664
+ assert_eq "B5 一页一行序:第二 ↓ 落在板次行 V14" "$(focused_id "$(wfile walk-2)")" "V14"
665
+ assert_eq "B5 一页一行序:第二步恰好一个光标" "$(grep -o '›' "$(wfile walk-2)" | wc -l | tr -d ' ')" "1"
666
+ keys Down; sleep 0.5
667
+ wcap walk-3
668
+ if grep -qE '› +panel' "$(wfile walk-3)"; then
669
+ ok "B5 一页一行序:第三 ↓ 跨块落到规格行"
670
+ else
671
+ bad "B5 一页一行序:第三 ↓ 没有跨到规格行(跨块断掉)"
672
+ fi
673
+ assert_eq "B5 一页一行序:第三步恰好一个光标" "$(grep -o '›' "$(wfile walk-3)" | wc -l | tr -d ' ')" "1"
674
+ keys Enter; sleep 1.2
675
+ wcap walk-open
676
+ assert_has "$(wfile walk-open)" "[spec]" "B5 一页一行序:规格行 enter 开 spec 预览"
677
+ assert_eq "B5 一页一行序:预览仍在第 2 页" "$(page_of)" "2"
678
+ keys q; sleep 0.7
679
+ wcap walk-back
680
+ assert_eq "B5 一页一行序:关闭后焦点仍在同一行" "$(grep -cE '› +panel' "$(wfile walk-back)")" "1"
681
+
682
+ # ⑨ 变更行与决策行各自开自己的 source(delta 的场景):默认夹具里走到 D40,enter 开决策预览
683
+ start_panel
684
+ wfocused=-1
685
+ for wi in $(seq 1 30); do
686
+ if cap | grep -qE '› +D40'; then wfocused=0; break; fi
687
+ keys Down; sleep 0.25
688
+ done
689
+ assert_eq "B5 决策行:↓ 在 30 步内走到决策块第一行 D40" "$wfocused" "0"
690
+ keys Enter; sleep 1.4
691
+ wcap decision-detail
692
+ assert_has "$(wfile decision-detail)" "[D40]" "B5 决策预览:tab 是条目号 D40"
693
+ assert_has "$(wfile decision-detail)" "D40 body" "B5 决策预览:渲染条目正文"
694
+ assert_has "$(wfile decision-detail)" "deeper addendum" "B5 决策预览:同号补记留在正文里"
695
+ assert_eq "B5 决策预览:打开后仍在第 2 页" "$(page_of)" "2"
696
+ keys q; sleep 0.8
697
+ wcap decision-back
698
+ assert_has "$(wfile decision-back)" "最近决策" "B5 决策预览:q 原地回工作页"
699
+ assert_not "$(wfile decision-back)" "详情" "B5 决策预览:q 关掉了详情"
593
700
  }
594
701
 
595
702
  scn_mouse() {
@@ -670,13 +777,16 @@ scn_resize() {
670
777
  tmux -L "$sock" resize-window -t "$sess:panel" -x 99 -y 32 2>/dev/null || true
671
778
  sleep 0.6
672
779
  cap_to narrow
673
- assert_has "$tmp/$current/narrow.txt" "代理" "99 列:单列仍渲染 agent 表"
674
780
  # Reflow to the wide tier: the agent table and the right block share a row.
675
781
  tmux -L "$sock" resize-window -t "$sess:panel" -x 160 -y 32 2>/dev/null || true
676
782
  sleep 1.2
677
783
  cap_to wide
678
- if grep -qE '代理.*活动(仅本 session' "$tmp/$current/wide.txt"; then
679
- ok "160 列:重排成双列(表头与右栏同一行)"
784
+ # Two columns sharing a row: the left column, the interior gap and the right column's own content
785
+ # on one line. (Not "both headers on one line": the columns are packed by priority and the
786
+ # overview's new latest-reply card legitimately offsets their headers — the layout's contract is
787
+ # side-by-side columns, not header pairing.)
788
+ if grep -qE '│ +│ +[^│]' "$tmp/$current/wide.txt"; then
789
+ ok "160 列:重排成双列(同一行里两列并排)"
680
790
  else
681
791
  bad "160 列:没有重排成双列"; sed -n '1,3p' "$tmp/$current/wide.txt"
682
792
  fi
@@ -690,13 +800,13 @@ scn_resize() {
690
800
  continue
691
801
  fi
692
802
  if [ "$w" = "160" ] || [ "$w" = "100" ]; then
693
- if grep -qE '代理.*活动(仅本 session' "$tmp/$current/w$w.txt"; then
694
- ok "$w 列:双列(表头与右栏同一行)"
803
+ if grep -qE '│ +│ +[^│]' "$tmp/$current/w$w.txt"; then
804
+ ok "$w 列:双列(同一行里两列并排)"
695
805
  else
696
806
  bad "$w 列:应为双列"
697
807
  fi
698
808
  elif [ "$w" = "99" ] || [ "$w" = "60" ]; then
699
- if grep -qE '代理.*活动(仅本 session' "$tmp/$current/w$w.txt"; then
809
+ if grep -qE '│ +│ +[^│]' "$tmp/$current/w$w.txt"; then
700
810
  bad "$w 列:不该是双列"
701
811
  else
702
812
  ok "$w 列:单列"
@@ -1041,6 +1151,53 @@ scn_detail() {
1041
1151
  assert_has "$(dfile back-esc)" "已放弃" "Esc 返回看板页"
1042
1152
  assert_not "$(dfile back-esc)" "详情 V14" "Esc 之后详情视图关闭"
1043
1153
 
1154
+ # P249: a preview's artifacts switch with ←/→, ↑/↓ scrolls the document and q returns to the work
1155
+ # page it was opened from — the same view and the same close contract as an entry's detail.
1156
+ printf '2\n' > "$(page_file)"
1157
+ start_panel "B3_STUB_PREVIEW_LONG=40"
1158
+ local wi wfocused=-1
1159
+ for wi in $(seq 1 16); do
1160
+ keys Down; sleep 0.25
1161
+ if cap | grep -qE '› +pulse-console'; then wfocused=0; break; fi
1162
+ done
1163
+ assert_eq "P249 预览:↓ 在 16 步内走到变更块第一行" "$wfocused" "0"
1164
+ keys Enter; sleep 1.4
1165
+ dcap preview-proposal
1166
+ assert_has "$(dfile preview-proposal)" "[proposal]" "P249 预览:变更的第一 tab 是 proposal"
1167
+ assert_has "$(dfile preview-proposal)" "the proposal body" "P249 预览:proposal 正文上屏"
1168
+ assert_eq "P249 预览:打开后仍在第 2 页" "$(page_of)" "2"
1169
+ keys Right; sleep 0.8
1170
+ dcap preview-design
1171
+ assert_has "$(dfile preview-design)" "[design]" "P249 预览:→ 切到 design tab"
1172
+ assert_has "$(dfile preview-design)" "the design body" "P249 预览:design 正文上屏"
1173
+ keys Right; sleep 0.8
1174
+ dcap preview-tasks
1175
+ assert_has "$(dfile preview-tasks)" "[tasks]" "P249 预览:再 → 切到 tasks tab"
1176
+ assert_has "$(dfile preview-tasks)" "the task body" "P249 预览:tasks 正文上屏"
1177
+ keys q; sleep 0.8
1178
+ dcap preview-back
1179
+ assert_has "$(dfile preview-back)" "活动变更" "P249 预览:q 回工作页"
1180
+ assert_not "$(dfile preview-back)" "详情" "P249 预览:q 关掉了详情"
1181
+ # 规格预览:一个 tab,长正文可滚动;Esc 同样原地返回
1182
+ wfocused=-1
1183
+ for wi in $(seq 1 6); do
1184
+ if cap | grep -qE '› +panel'; then wfocused=0; break; fi
1185
+ keys Down; sleep 0.3
1186
+ done
1187
+ assert_eq "P249 预览:关闭后继续走到规格行" "$wfocused" "0"
1188
+ keys Enter; sleep 1.4
1189
+ dcap preview-spec
1190
+ assert_has "$(dfile preview-spec)" "[spec]" "P249 预览:规格一个 tab"
1191
+ assert_has "$(dfile preview-spec)" "spec line 01" "P249 预览:规格正文第一行"
1192
+ for i in 1 2 3 4 5 6 7 8; do keys Down; sleep 0.08; done
1193
+ sleep 0.6
1194
+ dcap preview-spec-scrolled
1195
+ assert_has "$(dfile preview-spec-scrolled)" "spec line 09" "P249 预览:↓×8 滚动规格正文(第 9 行进入视图)"
1196
+ keys Escape; sleep 0.8
1197
+ dcap preview-spec-back
1198
+ assert_has "$(dfile preview-spec-back)" "任务看板" "P249 预览:Esc 回工作页"
1199
+ assert_not "$(dfile preview-spec-back)" "详情" "P249 预览:Esc 关掉了详情"
1200
+
1044
1201
  # 9.3: read-only — only the console's own three state files may differ after the session.
1045
1202
  local docs_after other_after
1046
1203
  docs_after="$(cd "$ROOT" && find docs -type f | sort | xargs -r md5sum | md5sum)"
@@ -1272,6 +1429,9 @@ PYC
1272
1429
 
1273
1430
  # ---------------------------------------------------------------- run
1274
1431
  want=("$@")
1432
+ # P249: `--all` is the explicit whole-suite selector the task's acceptance commands use; with no
1433
+ # argument the behaviour is unchanged (every scenario), and an unknown name stays a no-op.
1434
+ if [ "${want[0]:-}" = "--all" ]; then want=(); fi
1275
1435
  run_scn() {
1276
1436
  local name="$1"
1277
1437
  if [ ${#want[@]} -gt 0 ]; then
@@ -65,7 +65,7 @@ new_proj() {
65
65
  && printf '{"name":"%s","scripts":{"verify":"true"}}\n' "$name" > package.json \
66
66
  && git add -A && git commit -qm init ) >/dev/null 2>&1
67
67
  if ! ( cd "$p" && bash "$team" init --session "pc-$name" --agents "$agents" --vcs local \
68
- --gates "true" --docs docs/team ) >"$tmp/$name-init.log" 2>&1; then
68
+ --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/$name-init.log" 2>&1; then
69
69
  printf 'panel-choices: 夹具 %s 的 team init 失败\n' "$name" >&2
70
70
  tail -5 "$tmp/$name-init.log" >&2
71
71
  return 1
@@ -129,8 +129,10 @@ if want read; then
129
129
  '[k for k in d["keys"] if k["name"]=="TEAM_PI_BIN"][0]["choices"]["empty"] is False'
130
130
  json_check "$json" "TEAM_GATES(cmd)→ source none、values 空(「打开自由输入并写明原因」的那类)" \
131
131
  '[k for k in d["keys"] if k["name"]=="TEAM_GATES"][0]["choices"]=={"source":"none","values":[],"min":"","max":"","empty":True,"note":""}'
132
- json_check "$json" "TEAM_DEFAULT_MODEL(model)→ source known,值 = models.known" \
133
- '[k for k in d["keys"] if k["name"]=="TEAM_DEFAULT_MODEL"][0]["choices"]["source"]=="known" and [k for k in d["keys"] if k["name"]=="TEAM_DEFAULT_MODEL"][0]["choices"]["values"]==d["models"]["known"]'
132
+ json_check "$json" "TEAM_PM_MODEL(model)→ source known,值 = models.known" \
133
+ '[k for k in d["keys"] if k["name"]=="TEAM_PM_MODEL"][0]["choices"]["source"]=="known" and [k for k in d["keys"] if k["name"]=="TEAM_PM_MODEL"][0]["choices"]["values"]==d["models"]["known"]'
134
+ json_check "$json" "TEAM_TASK_MODELS(task-model-map)→ source known、值 = models.known、不接受空值" \
135
+ '[k for k in d["keys"] if k["name"]=="TEAM_TASK_MODELS"][0]["choices"]=={"source":"known","values":d["models"]["known"],"min":"","max":"","empty":False,"note":""}'
134
136
  json_check "$json" "schema 不认识的键也有 choices(source none、known false)" \
135
137
  '[k for k in d["keys"] if k["name"]=="TEAM_HAND_ADDED"][0]["known"] is False and [k for k in d["keys"] if k["name"]=="TEAM_HAND_ADDED"][0]["choices"]["source"]=="none"'
136
138
  json_check "$json" "每个记录都带 choices,且旧字段一个不少(只增不改;未知键本来就没有 route)" \
@@ -153,45 +155,46 @@ fi
153
155
 
154
156
  # ---------------------------------------------------------------- known
155
157
  if want known; then
156
- section "known · 模型词汇表是本项目的数据(R2:含 pm 席位,记录与解析都在,绝不读机器目录)"
158
+ section "known · 模型词汇表是本项目的数据(R2:类别策略 + 独立 PM + 已提交记录,绝不读机器目录)"
157
159
  p="$(new_proj known)" || exit 3
158
160
  cfg="$p/.pi/team/config.sh"
159
161
  state="$p/.pi/team/state"
160
- python3 - "$cfg" <<'PY'
161
- import re, sys
162
- p = sys.argv[1]
163
- s = open(p, encoding='utf-8').read()
164
- s = s.replace('TEAM_AGENT_MODELS=""', 'TEAM_AGENT_MODELS="dev=deepseek/deepseek-flash verify=openrouter/stealth/union-alpha"')
165
- s = re.sub(r'^TEAM_PM_MODEL=.*$', 'TEAM_PM_MODEL="kimi-coding/k3-256k"', s, count=1, flags=re.M)
166
- open(p, 'w', encoding='utf-8').write(s)
167
- PY
162
+ # P232:新的合法契约由真实事务入口写入(退休键必须真的不在),夹具不再手改退休键。
163
+ run_in "$p" config upgrade-models \
164
+ --task-models 'routine=deepseek/deepseek-flash analysis=openrouter/stealth/union-alpha' \
165
+ --pm-model 'kimi-coding/k3-256k' --yes >/dev/null || exit 3
168
166
  mkdir -p "$state"
169
- printf 'model=openai-codex/gpt-5.6-terra:xhigh\n' > "$state/dev.env"
167
+ # 一份**完整**的已提交记录:它的模型不在任何类别映射里(旧席位时代的三段 id 也要逐字活着)。
168
+ . "$here/lib/model-policy.sh"
169
+ routing_fixture_record "$state" dev T232 "$p" "$p/docs/team/tasks/T232-x.md" 'openai-codex/gpt-5.6-terra:xhigh' sid-dev-232 policy 2026-10-09T00:00:00Z routine
170
170
  json="$(run_in "$p" config list --json)"
171
- json_check "$json" "known = 配置 default + 席位记录 + pm 的 TEAM_PM_MODEL(各一次)" \
172
- 'sorted(d["models"]["known"])==["deepseek/deepseek-flash","kimi-coding/k3-256k","openai-codex/gpt-5.6-terra:xhigh","openrouter/stealth/union-alpha"]'
173
- json_check "$json" "三段 id 逐字进 known 与 model/pairlist 的 choices.values" \
174
- '"openrouter/stealth/union-alpha" in d["models"]["known"] and "openrouter/stealth/union-alpha" in [k for k in d["keys"] if k["name"]=="TEAM_DEFAULT_MODEL"][0]["choices"]["values"] and "openrouter/stealth/union-alpha" in [k for k in d["keys"] if k["name"]=="TEAM_AGENT_MODELS"][0]["choices"]["values"]'
175
- json_check "$json" "三段 id 的席位行也逐字(verify 行)" \
176
- '[s for s in d["models"]["seats"] if s["agent"]=="verify"][0]["model"]=="openrouter/stealth/union-alpha"'
177
- out="$(run_in "$p" config set-agent-model verify openrouter/stealth/union-alpha --dry-run)"; rc=$?
178
- assert_eq "三段 id 被写路径校验器接受(set-agent-model --dry-run → 0)" "$rc" "0"
179
- json_check "$json" "pm 的模型恰好出现一次(去重)" 'd["models"]["known"].count("kimi-coding/k3-256k")==1'
180
- json_check "$json" "models.seats 的 pm 行 = TEAM_PM_MODEL 且 override=true" \
181
- '[s for s in d["models"]["seats"] if s["agent"]=="pm"][0]["model"]=="kimi-coding/k3-256k" and [s for s in d["models"]["seats"] if s["agent"]=="pm"][0]["override"] is True'
182
- json_check "$json" "TEAM_PM_MODEL 的 choices.values 含 pm 的模型" \
183
- '"kimi-coding/k3-256k" in [k for k in d["keys"] if k["name"]=="TEAM_PM_MODEL"][0]["choices"]["values"]'
184
- # 去掉 TEAM_PM_MODEL:pm 回退默认,席位记录仍在 known,每个模型仍只出现一次。
185
- python3 - "$cfg" <<'PY'
186
- import re, sys
187
- p = sys.argv[1]
188
- s = open(p, encoding='utf-8').read()
189
- s = re.sub(r'^TEAM_PM_MODEL=.*$', 'TEAM_PM_MODEL=""', s, count=1, flags=re.M)
190
- open(p, 'w', encoding='utf-8').write(s)
191
- PY
171
+ json_check "$json" "known = 类别策略的模型 + 独立 PM 模型 + 已提交记录的模型(各一次)" \
172
+ 'sorted(d["models"]["known"])==["deepseek/deepseek-flash","kimi-coding/k3-256k","openai-codex/gpt-5.6-terra:xhigh","openrouter/stealth/union-alpha"] and d["models"]["known"].count("openai-codex/gpt-5.6-terra:xhigh")==1'
173
+ json_check "$json" "policy.categories 按映射原序(category/model 逐字)" \
174
+ 'd["models"]["policy"]["categories"]==[{"category":"routine","model":"deepseek/deepseek-flash"},{"category":"analysis","model":"openrouter/stealth/union-alpha"}]'
175
+ json_check "$json" "policy.pm = TEAM_PM_MODEL(独立 PM,不再是席位行)" \
176
+ 'd["models"]["policy"]["pm"]=="kimi-coding/k3-256k" and "seats" not in d["models"] and "default" not in d["models"]'
177
+ json_check "$json" "known 里没有退休键的残留行(schema 不认识 → refuse 行,不是模型来源)" \
178
+ 'all(k["known"] is False for k in d["keys"] if k["name"] in ("TEAM_DEFAULT_MODEL","TEAM_AGENT_MODELS"))'
179
+ json_check "$json" "三段 id 逐字进 known 与 model/task-model-map 的 choices.values" \
180
+ '"openrouter/stealth/union-alpha" in d["models"]["known"] and "openrouter/stealth/union-alpha" in [k for k in d["keys"] if k["name"]=="TEAM_PM_MODEL"][0]["choices"]["values"] and "openrouter/stealth/union-alpha" in [k for k in d["keys"] if k["name"]=="TEAM_TASK_MODELS"][0]["choices"]["values"]'
181
+ json_check "$json" "已提交记录逐字:dev 行 assigned/model/category/origin/SID" \
182
+ '[a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["assigned"] is True and [a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["model"]=="openai-codex/gpt-5.6-terra:xhigh" and [a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["category"]=="routine" and [a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["sid"]=="sid-dev-232" and [a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["selected_via"]=="policy" and [a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["launch_via"]=="assignment"'
183
+ json_check "$json" "没有记录的席位不借策略模型:model 空 + diagnostic 非空" \
184
+ '[a for a in d["models"]["assignments"] if a["agent"]=="verify"][0]["assigned"] is False and [a for a in d["models"]["assignments"] if a["agent"]=="verify"][0]["model"]=="" and bool([a for a in d["models"]["assignments"] if a["agent"]=="verify"][0]["diagnostic"])'
185
+ out="$(run_in "$p" config set-task-model routine openai-codex/gpt-5.6-terra:xhigh --dry-run)"; rc=$?
186
+ assert_eq "三段 id 被 set-task-model 的 --dry-run 接受(rc=0)" "$rc" "0"
187
+ # 合法配置删掉一个未来类别:已提交记录的模型/SID 仍在 known/assignments(恢复不看映射成员)。
188
+ run_in "$p" config set TEAM_TASK_MODELS 'analysis=openrouter/stealth/union-alpha' --yes >/dev/null || exit 3
192
189
  json="$(run_in "$p" config list --json)"
193
- json_check "$json" "去掉 TEAM_PM_MODEL 后 pm 回退默认,记录席位的模型仍在 known 且各一次" \
194
- '[s for s in d["models"]["seats"] if s["agent"]=="pm"][0]["model"]=="deepseek/deepseek-flash" and sorted(d["models"]["known"])==["deepseek/deepseek-flash","openai-codex/gpt-5.6-terra:xhigh","openrouter/stealth/union-alpha"] and d["models"]["known"].count("openai-codex/gpt-5.6-terra:xhigh")==1'
190
+ json_check "$json" "删除未来类别 routine 后:记录仍在、模型仍在 known、策略只剩 analysis" \
191
+ '[a for a in d["models"]["assignments"] if a["agent"]=="dev"][0]["model"]=="openai-codex/gpt-5.6-terra:xhigh" and "openai-codex/gpt-5.6-terra:xhigh" in d["models"]["known"] and [c["category"] for c in d["models"]["policy"]["categories"]]==["analysis"]'
192
+ # PM 启动记录(state/pm-launch.env)在 models.pm_launch 里,字段就是 starter 发布的那份。
193
+ printf 'metadata_version=1\nproject=%s\nwindow=pm\nmodel=kimi-coding/k3-256k\nnonce=fixture-nonce-232\ntime=2026-10-09T00:00:00Z\nmode=fresh\nidentity_via=provider,model,session_id\nresume_key=default\n' "$p" > "$state/pm-launch.env"
194
+ json="$(run_in "$p" config list --json)"
195
+ json_check "$json" "pm_launch 逐字:project/window/model/mode(只读面)" \
196
+ '{k:v for k,v in d["models"]["pm_launch"].items() if k!="project"}=={"window":"pm","model":"kimi-coding/k3-256k","nonce":"fixture-nonce-232","time":"2026-10-09T00:00:00Z","mode":"fresh","resume_key":"default"} and d["models"]["pm_launch"]["project"].endswith("/known")'
197
+ json_check "$json" "pm_launch 的模型不重复计进 known(去重)" 'd["models"]["known"].count("kimi-coding/k3-256k")==1'
195
198
  fi
196
199
 
197
200
  # ---------------------------------------------------------------- walk(门禁)
@@ -203,9 +206,11 @@ walk_section() { # <tree> <label>
203
206
  local wt="$1" label="$2"
204
207
  local wp json out rc
205
208
  wp="$(new_proj "walk-$label")" || exit 3
206
- # model-id-shape R1:走查的 known 里必须带一个三段 id —— 它进 model/pairlist 的 choices.values,
209
+ # model-id-shape R1:走查的 known 里必须带一个三段 id —— 它进 model/task-model-map 的 choices.values,
207
210
  # 走查作业逐条拿它去 `team config set … --dry-run`(旧校验器会在这里红,这是闸门要抓回归的方向)。
208
- run_in "$wp" config set TEAM_DEFAULT_MODEL openrouter/amazon/nova-lite-v1 --yes >/dev/null || exit 3
211
+ run_in "$wp" config upgrade-models \
212
+ --task-models 'routine=openrouter/amazon/nova-lite-v1 analysis=xai/grok-4.6' \
213
+ --pm-model 'openrouter/amazon/nova-lite-v1' --yes >/dev/null || exit 3
209
214
  json="$(run_in "$wp" config list --json)"
210
215
  printf '%s' "$json" > "$tmp/walk-list.json"
211
216
  local sha_before; sha_before="$(sha_of "$wp/.pi/team/config.sh")"
@@ -223,7 +228,6 @@ for line in m.group(1).splitlines():
223
228
  f = line.split('|')
224
229
  rows[f[0]] = f
225
230
  d = json.load(open(tmp + "/walk-list.json", encoding="utf-8"))
226
- seats = [s["agent"] for s in d["models"]["seats"]]
227
231
  jobs, empties, problems = [], [], []
228
232
  seen_keys = 0
229
233
  for k in d["keys"]:
@@ -258,7 +262,7 @@ for k in d["keys"]:
258
262
  elif kind == "bool":
259
263
  if ch["values"] != ["1", "0"]:
260
264
  problems.append("%s 的 values ≠ [1,0]" % name)
261
- elif kind in ("model", "pairlist", "winlist", "pattern"):
265
+ elif kind in ("model", "task-model-map", "winlist", "pattern"):
262
266
  if ch["values"] != d["models"]["known"]:
263
267
  problems.append("%s 的 values ≠ models.known" % name)
264
268
  if cls == "refuse":
@@ -266,11 +270,9 @@ for k in d["keys"]:
266
270
  continue
267
271
  empties.append("%s\t%s" % (name, "true" if ch["empty"] else "false"))
268
272
  for v in ch["values"]:
269
- if kind == "pairlist":
270
- if not seats:
271
- problems.append("%s 的 pairlist 词表没有席位可用(夹具缺少名册)" % name)
272
- continue
273
- whole = "%s=%s" % (seats[0], v)
273
+ if kind == "task-model-map":
274
+ # 整映射行:读给出的值是该项目的模型词表,写入形状是 category=provider/model(面板绝不组合它)。
275
+ whole = "routine=%s" % v
274
276
  elif kind in ("winlist", "pattern"):
275
277
  whole = "%s=1" % v
276
278
  else:
@@ -484,6 +486,10 @@ fi
484
486
  if want catalogue; then
485
487
  section "catalogue · 机器目录不是选项来源(R2:sub2api 那个已下线 provider 不许出现)"
486
488
  p="$(new_proj catalogue)" || exit 3
489
+ # 一份合法的类别策略(= 一个项目自己的模型词汇表);机器目录里的 provider 绝不进来。
490
+ run_in "$p" config upgrade-models \
491
+ --task-models 'routine=deepseek/deepseek-flash analysis=kimi-coding/k3-256k' \
492
+ --pm-model 'deepseek/deepseek-flash' --yes >/dev/null || exit 3
487
493
  home="$tmp/catalogue-home"
488
494
  mkdir -p "$home/.pi/agent"
489
495
  cat > "$home/.pi/agent/models-store.json" <<'JSON'
@@ -495,37 +501,48 @@ JSON
495
501
  json="$(cd "$p" && HOME="$home" bash "$team" config list --json 2>&1)"
496
502
  case "$json" in *sub2api*) bad "机器目录里的 sub2api 泄漏进了读(choices/known)" ;; *) ok "读里没有机器目录的 sub2api" ;; esac
497
503
  case "$json" in *openrouter*) bad "机器目录里的 openrouter 泄漏进了读" ;; *) ok "读里没有机器目录的 openrouter" ;; esac
498
- json_check "$json" "known 只有本项目配置/记录的模型(夹具 default)" \
499
- 'd["models"]["known"]==["deepseek/deepseek-flash"]'
500
- json_check "$json" "model/pairlist/winlist/pattern 四类的 values 都不含目录里的 provider" \
501
- 'all(all(not v.startswith("sub2api/") and not v.startswith("openrouter/") for v in k["choices"]["values"]) for k in d["keys"] if k["kind"] in ("model","pairlist","winlist","pattern"))'
504
+ json_check "$json" "known 只有本项目策略/记录的模型(夹具的类别 + PM)" \
505
+ 'sorted(d["models"]["known"])==["deepseek/deepseek-flash","kimi-coding/k3-256k"]'
506
+ json_check "$json" "model/task-model-map/winlist/pattern 四类的 values 都不含目录里的 provider" \
507
+ 'all(all(not v.startswith("sub2api/") and not v.startswith("openrouter/") for v in k["choices"]["values"]) for k in d["keys"] if k["kind"] in ("model","task-model-map","winlist","pattern"))'
502
508
  fi
503
509
 
504
510
  # ---------------------------------------------------------------- flip-drop-pm(F-A)
505
511
  if want flip-drop-pm; then
506
- section "flip F-A · 从 known 里去掉 pm 席位 → known 断言必须红且点名 pm;恢复 → 绿"
512
+ section "flip F-A · 从 known 里去掉独立 PM 模型 → known 断言必须红且点名独立 PM;恢复 → 绿"
507
513
  ft="$tmp/flip-drop-pm"
508
514
  mkdir -p "$ft/skills/teamsmith"
509
515
  cp -a "$skill/scripts" "$ft/skills/teamsmith/scripts"
510
- cp -a "$skill/templates" "$skill/references" "$ft/skills/teamsmith/"
511
- python3 - "$ft/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PY'
516
+ # P315:`team init` 现在要装 `/team` 扩展(源 = <skill>/extension/team.ts),夹具的拷贝集合要跟上;
517
+ # 少拷一层时 `new_proj` 里的 init 直接退出、走查拿不到结论,红侧就是假红。
518
+ cp -a "$skill/templates" "$skill/references" "$skill/extension" "$ft/skills/teamsmith/"
519
+ python3 - "$ft/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYPATCH'
512
520
  import sys
513
521
  p = sys.argv[1]
514
- s = open(p, encoding="utf-8").read()
515
- # P47/R4:席位行改成字段安全拆读(team_config_seat_split)——翻转仍锚在「known 走查里的 pm 席位」这一行
516
- old = ' team_config_seat_split "$(team_config_seat_state "$a")" seat_model _src _override'
517
- assert old in s, "找不到 pm 席位解析那一行"
518
- s = s.replace(old, " [ \"$a\" = \"pm\" ] && continue\n" + old, 1)
519
- open(p, "w", encoding="utf-8").write(s)
520
- PY
522
+ # P232:读侧把独立 PM 的模型从 known 里漏掉(策略行还在,词汇表缺了)——「PM 的模型也在 known 里」必须红。
523
+ # 按行改:那一行的尾部是 $'\n' 的赋值,只删中间片段会留下一个跑不起来的空命令,把整段读打断。
524
+ lines = open(p, encoding="utf-8").read().split(chr(10))
525
+ out = []
526
+ hits = 0
527
+ for line in lines:
528
+ if 'known_models="$known_models$policy_pm"' in line:
529
+ hits += 1
530
+ out.append(' policy_pm="$TEAM_PM_MODEL"')
531
+ else:
532
+ out.append(line)
533
+ assert hits == 1, "找不到 PM 模型进 known 的那一行(hits=%d)" % hits
534
+ open(p, "w", encoding="utf-8").write(chr(10).join(out))
535
+ PYPATCH
521
536
  TEAM_CHOICES_TREE="$ft" bash "$here/panel-choices.sh" known > "$tmp/flip-drop-pm-red.log" 2>&1
522
537
  rc_red=$?
523
538
  TEAM_CHOICES_TREE="$tree" bash "$here/panel-choices.sh" known > "$tmp/flip-drop-pm-green.log" 2>&1
524
539
  rc_green=$?
525
- if [ "$rc_red" -ne 0 ] && grep -a '✗' "$tmp/flip-drop-pm-red.log" | grep -q 'pm'; then
526
- ok "F-A:去掉 pm 的解析后 known 断言红且点名 pm(rc=$rc_red)"
540
+ # P315:匹配口径收窄到正文里的「独立 PM」——原来是 `grep -qi 'pm'`,而红日志里的临时路径就叫
541
+ # `teamsmith-panel-choice-pm_skills-…`,于是 `team init` 在夹具里当场失败也能把这条判成 ok(假绿)。
542
+ if [ "$rc_red" -ne 0 ] && grep -a '✗' "$tmp/flip-drop-pm-red.log" | grep -qF '独立 PM'; then
543
+ ok "F-A:去掉 PM 的 known 解析后断言红且点名独立 PM(rc=$rc_red)"
527
544
  else
528
- bad "F-A:去掉 pm 的解析后 known 断言没红/没点名 pm(rc=$rc_red)"
545
+ bad "F-A:去掉 PM 的 known 解析后断言没红/没点名独立 PM(rc=$rc_red)"
529
546
  fi
530
547
  [ "$rc_green" -eq 0 ] && ok "F-A:恢复真树后 known 断言绿" || bad "F-A:真树也红了(rc=$rc_green)"
531
548
  printf ' --- 红侧尾部 ---\n'
@@ -538,7 +555,8 @@ if want flip-suggest; then
538
555
  ft="$tmp/flip-suggest"
539
556
  mkdir -p "$ft/skills/teamsmith"
540
557
  cp -a "$skill/scripts" "$ft/skills/teamsmith/scripts"
541
- cp -a "$skill/templates" "$skill/references" "$ft/skills/teamsmith/"
558
+ # P315:与 F-A 同理 —— `team init` 要 extension/team.ts 才能装完,少拷一层就是夹具坏掉(走查 rc=3)。
559
+ cp -a "$skill/templates" "$skill/references" "$skill/extension" "$ft/skills/teamsmith/"
542
560
  flip_cfg="$ft/skills/teamsmith/scripts/lib/cmd-config.sh"
543
561
  cp -a "$cmd_config" "$flip_cfg"
544
562
  python3 - "$flip_cfg" <<'PY'
@@ -151,14 +151,15 @@ pc_init_clean=(env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_ROOT_SOURCE -u TEAM_RO
151
151
  ( cd "$neut_root" && git init -q -b main && git config user.email panel-cpu@teamsmith && git config user.name panel-cpu ) \
152
152
  >/dev/null 2>&1
153
153
  ( cd "$neut_root" && "${pc_init_clean[@]}" bash "$tree/skills/teamsmith/scripts/team" init \
154
- --session "$sess" --agents "dev verify" --vcs local --gates "true" --docs docs/team ) \
154
+ --session "$sess" --agents "dev verify" --vcs local --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' ) \
155
155
  >"$neut_root/init.log" 2>&1 \
156
156
  || { printf 'panel-cpu: 中性测量目标的 team init 失败(见 %s/init.log)\n' "$neut_root" >&2; tail -3 "$neut_root/init.log" >&2; exit 3; }
157
157
  printf '== measured project root: %s (neutral fixture project — not the caller worktree) ==\n' "$neut_root"
158
158
  printf '== console bundle under test: %s (tree under test %s) ==\n' "$panel" "$tree"
159
159
 
160
160
  hz="$(getconf CLK_TCK 2>/dev/null || echo 100)"
161
- time_out="$(mktemp "${TMPDIR:-/tmp}/p12cpu.XXXXXX")"
161
+ team_tmp_root_prepare >/dev/null 2>&1 || true
162
+ time_out="$(mktemp "$(team_tmp_root)/teamsmith-p12cpu.$(tmp_root_ns).XXXXXX")"
162
163
  # TEAM_PANEL_CPU_PAGE=<1|2|3|4> parks the measured console on that page (the board page's kanban is
163
164
  # the heaviest layout, so the red line is checked there too — P18/B2 item 6.4).
164
165
  page_flag=""
@@ -18,6 +18,11 @@ set -uo pipefail
18
18
  here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
19
  tree="${TEAM_PANEL_CPU_TREE:-$(cd -P "$here/../../.." && pwd)}"
20
20
  cpu="$here/panel-cpu.sh"
21
+
22
+ # P287:临时根名字里的项目命名空间(ns)的唯一实现在 scripts/lib/common.sh。
23
+ if ! declare -F team_project_ns >/dev/null 2>&1; then
24
+ [ -f "$here/../scripts/lib/common.sh" ] && . "$here/../scripts/lib/common.sh"
25
+ fi
21
26
  PASS=0; FAIL=0
22
27
  ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
23
28
  bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
@@ -31,7 +36,8 @@ real_load="$(cut -d' ' -f1 /proc/loadavg 2>/dev/null || printf '?')"
31
36
  real_cores="$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || printf 0)"
32
37
  case "$real_cores" in ''|*[!0-9]*) real_cores=0 ;; esac
33
38
 
34
- out="$(mktemp "${TMPDIR:-/tmp}/panel-knobs.XXXXXX")"
39
+ team_tmp_root_prepare >/dev/null 2>&1 || true
40
+ out="$(mktemp "$(team_tmp_root)/teamsmith-panel-knobs.$(team_project_ns 2>/dev/null || printf 'nosig-00000000').XXXXXX")"
35
41
  trap 'rm -f "$out"' EXIT
36
42
  # 夹具开关**显式清掉**(继承来的 TEAM_SMOKE_FIXTURE=1 会让注入被采信,那样这条检查就假绿);
37
43
  # 三个旋钮全部注入,正是 d-realpath 的形状。