teamsmith 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +35 -0
  4. package/skills/teamsmith/SKILL.md +43 -30
  5. package/skills/teamsmith/extension/team-bg.ts +5 -3
  6. package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
  7. package/skills/teamsmith/extension/team-notify.ts +20 -13
  8. package/skills/teamsmith/extension/team-remind.ts +189 -0
  9. package/skills/teamsmith/extension/team-reply.ts +4 -7
  10. package/skills/teamsmith/references/config.md +11 -12
  11. package/skills/teamsmith/references/migration.md +101 -0
  12. package/skills/teamsmith/references/openspec.md +43 -27
  13. package/skills/teamsmith/references/protocol.md +26 -15
  14. package/skills/teamsmith/references/reminders.md +153 -161
  15. package/skills/teamsmith/references/troubleshooting.md +12 -7
  16. package/skills/teamsmith/references/workflows.md +84 -31
  17. package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
  18. package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
  19. package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
  20. package/skills/teamsmith/scripts/lib/cmd-review.sh +61 -35
  21. package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
  22. package/skills/teamsmith/scripts/lib/common.sh +83 -13
  23. package/skills/teamsmith/scripts/panel/README.md +35 -33
  24. package/skills/teamsmith/scripts/panel/panel.js +217 -199
  25. package/skills/teamsmith/scripts/panel/src/App.tsx +221 -66
  26. package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
  27. package/skills/teamsmith/scripts/panel/src/layout.ts +159 -310
  28. package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
  29. package/skills/teamsmith/scripts/panel/src/project-settings.ts +46 -0
  30. package/skills/teamsmith/scripts/panel/src/strings/en.ts +71 -205
  31. package/skills/teamsmith/scripts/panel/src/strings/index.ts +3 -5
  32. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +72 -204
  33. package/skills/teamsmith/scripts/panel/src/types.ts +23 -4
  34. package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
  35. package/skills/teamsmith/scripts/remind-store.mjs +55 -24
  36. package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
  37. package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
  38. package/skills/teamsmith/scripts/state-authority.mjs +72 -6
  39. package/skills/teamsmith/scripts/strings/commands.tsv +1 -1
  40. package/skills/teamsmith/scripts/team +1 -0
  41. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +18 -8
  42. package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
  43. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
  44. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
  45. package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
  46. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -25
  47. package/skills/teamsmith/templates/report.md.tmpl +33 -0
  48. package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
  49. package/skills/teamsmith/tests/bg-ledger.sh +24 -10
  50. package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
  51. package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
  52. package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
  53. package/skills/teamsmith/tests/help-surface.sh +78 -12
  54. package/skills/teamsmith/tests/install-shape.sh +7 -7
  55. package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
  56. package/skills/teamsmith/tests/key-replies-ui.sh +64 -5
  57. package/skills/teamsmith/tests/key-replies.sh +307 -106
  58. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +2 -0
  59. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +255 -90
  60. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +181 -61
  61. package/skills/teamsmith/tests/lib/model-routing-roles.sh +125 -67
  62. package/skills/teamsmith/tests/lib/reply-fixture.sh +14 -9
  63. package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
  64. package/skills/teamsmith/tests/lib/tmp-root.sh +1 -1
  65. package/skills/teamsmith/tests/loop-inventory.tsv +3 -0
  66. package/skills/teamsmith/tests/panel-b2.sh +91 -31
  67. package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
  68. package/skills/teamsmith/tests/panel-p21.sh +607 -1162
  69. package/skills/teamsmith/tests/panel-strings.mjs +21 -113
  70. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +190 -0
  71. package/skills/teamsmith/tests/remind-adversarial-faults.sh +78 -0
  72. package/skills/teamsmith/tests/remind-adversarial-real.sh +28 -0
  73. package/skills/teamsmith/tests/remind-cli.sh +108 -3
  74. package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
  75. package/skills/teamsmith/tests/remind-delivery.sh +123 -35
  76. package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
  77. package/skills/teamsmith/tests/remind-pulse.sh +199 -0
  78. package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
  79. package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
  80. package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
  81. package/skills/teamsmith/tests/remind-tool-real.mjs +801 -0
  82. package/skills/teamsmith/tests/remind-tool-real.sh +180 -0
  83. package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
  84. package/skills/teamsmith/tests/routes.sh +213 -293
  85. package/skills/teamsmith/tests/section-paths.tsv +19 -17
  86. package/skills/teamsmith/tests/smoke.sh +583 -133
  87. package/skills/teamsmith/tests/state-authority.sh +152 -8
  88. package/skills/teamsmith/tests/task-model-routing.sh +57 -26
  89. package/skills/teamsmith/tests/tmp-hygiene.sh +1 -1
  90. package/skills/teamsmith-init/SKILL.md +5 -5
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
@@ -18,8 +18,9 @@
18
18
  # 31/58、in2+证据层的 31/58、mix 的 18/19);每条断言仍读自己那段的行,用例一条不删。
19
19
  # ⑤c 反向:机器生成面在位且十个相位文件齐全 → §19 的十条照旧判定(十个 ✓、零 SKIP)
20
20
  # ⑤d 空面不算缺席(P226):机器生成面在位但是**空目录** → §19 的十条相位检查照旧判定并判红(§19 的
21
- # 账本 ✓20 ✗10 SKIP0,不是 SKIP10);同一棵树删掉这两个空面 → 回到 10 条 SKIP、绿(差别只在空目录)
22
- # (✓ 计数随 §19 的用例条数走:P404 给它加了 4 条声明面翻转用例 —— 16 → 20,下面那条断言跟着重标定)
21
+ # 账本 ✓32 ✗10 SKIP0,不是 SKIP10);同一棵树删掉这两个空面 → 回到 10 条 SKIP、绿(差别只在空目录)
22
+ # (✓ 计数随 §19 的用例条数走:P404 加 4 条声明面翻转(16 → 20),P439 再加 12 条独立流程翻转
23
+ # (20 → 32);P451 没有改 §19。十条红与零 SKIP 仍由下面两条独立断言判定,不靠总数替代。)
23
24
  # ⑤b 混合形状(P222):§19 的十条各自可见 SKIP 并点名;§31/§58 的豁免清单按「证据层缺席」跳过并点名,
24
25
  # 而两份 lint 的判定照旧;产品文件里植入真问题(裸 tmux / pkill)照旧红并点名
25
26
  # ⑥ 覆盖守门:一条旧断言被换成前提跳过 → coverage-inventory.sh --compare 点名;还原后绿
@@ -357,16 +358,16 @@ peq "⑤c 一条机器生成面前提 SKIP 都没有" \
357
358
 
358
359
  # ── ⑤d 空面不算缺席(P226 固化 P225 的实测):机器生成面**在位但是空目录**时,「整棵面不在」这个跳过
359
360
  # 前提不成立 —— 人在本机装了生成器却一个相位文件都没有,那是真问题:§19 的十条照旧判定并判红
360
- # (§19 自身的账本 = ✓20 ✗10 SKIP0,exit 1)。同一棵树删掉这两个空面 → 回到 10 条 SKIP、绿:
361
+ # (§19 自身的账本 = ✓32 ✗10 SKIP0,exit 1)。同一棵树删掉这两个空面 → 回到 10 条 SKIP、绿:
361
362
  # 差别只在空目录,证明这条控制咬的正是「面在(哪怕是空目录)就不许跳」。
362
363
  P_EMPTY="$(scratch_tree empty mixed)"
363
364
  mkdir -p "$P_EMPTY/.pi/prompts" "$P_EMPTY/.pi/skills"
364
365
  if nest "$P_EMPTY" "$T/nest-empty19.log" --select 19; then
365
366
  pbad "⑤d 空生成面(.pi/prompts、.pi/skills 都是空目录)→ §19 仍判绿(空面被当成了缺席)"
366
367
  else
367
- peq "⑤d 空生成面的 §19 账本计数 = ✓20 ✗10 SKIP0(不是 SKIP10)" \
368
- "$(sed 's/\x1b\[[0-9;]*m//g' "$T/nest-empty19.log" | grep -E '^#[0-9]+ 19 · ' | grep -o '✓20 ✗10 SKIP0' | head -1)" \
369
- "✓20 ✗10 SKIP0"
368
+ peq "⑤d 空生成面的 §19 账本计数 = ✓32 ✗10 SKIP0(不是 SKIP10)" \
369
+ "$(sed 's/\x1b\[[0-9;]*m//g' "$T/nest-empty19.log" | grep -E '^#[0-9]+ 19 · ' | grep -o '✓32 ✗10 SKIP0' | head -1)" \
370
+ "✓32 ✗10 SKIP0"
370
371
  peq "⑤d 十条相位检查照旧判定并判红(十条 ✗)" \
371
372
  "$(sed 's/\x1b\[[0-9;]*m//g' "$T/nest-empty19.log" | grep -c '^ ✗ \(本仓库为 Pi 生成了相位命令\|相位 skill \)' || true)" "10"
372
373
  peq "⑤d 一条机器生成面前提 SKIP 都没有(空面不算缺席)" \
@@ -0,0 +1,27 @@
1
+ /** Test-only earlier message_start handler for P444. Loaded before team-inbox-watch in private Pi. */
2
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent'
3
+ import { appendFileSync, existsSync, writeFileSync } from 'node:fs'
4
+ import { join } from 'node:path'
5
+ import { setTimeout as delay } from 'node:timers/promises'
6
+
7
+ export default function (pi: ExtensionAPI) {
8
+ pi.on('message_start', async (event, ctx) => {
9
+ const message: any = event.message
10
+ if (message?.role !== 'custom' || message.customType !== 'team-reminder') return
11
+ const dir = process.env.P442_EVIDENCE!
12
+ const record = {
13
+ type: 'delay_enter', pid: process.pid, sessionId: ctx.sessionManager.getSessionId(),
14
+ message: { role: message.role, customType: message.customType, content: message.content,
15
+ details: message.details, display: true },
16
+ }
17
+ appendFileSync(join(dir, 'events.jsonl'), JSON.stringify(record) + '\n')
18
+ writeFileSync(join(dir, 'delay-entered'), String(process.pid))
19
+ if (process.env.P444_KILL_AT === 'event') process.kill(process.pid, 'SIGKILL')
20
+ if (process.env.P444_DELAY === '1') {
21
+ const release = join(dir, 'release-event')
22
+ while (!existsSync(release)) await delay(25)
23
+ }
24
+ appendFileSync(join(dir, 'events.jsonl'), JSON.stringify({ type: 'delay_exit', pid: process.pid,
25
+ sessionId: ctx.sessionManager.getSessionId(), details: message.details }) + '\n')
26
+ })
27
+ }
@@ -0,0 +1,65 @@
1
+ /** Test-only controlled provider and lifecycle recorder for P442. Never injected by product defaults. */
2
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent'
3
+ import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
4
+ import { join } from 'node:path'
5
+
6
+ export default function (pi: ExtensionAPI) {
7
+ const dir = process.env.P442_EVIDENCE!
8
+ const log = (value: object) => appendFileSync(join(dir, 'events.jsonl'), JSON.stringify(value) + '\n')
9
+ pi.registerProvider('p442', {
10
+ baseUrl: process.env.P442_ENDPOINT!, apiKey: 'local-fixture-not-a-credential', api: 'openai-completions',
11
+ models: [{ id: 'controlled', name: 'Controlled loopback fixture', reasoning: false, input: ['text'],
12
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 262144, maxTokens: 8192,
13
+ compat: { supportsDeveloperRole: false, supportsStore: false } }],
14
+ })
15
+ pi.registerCommand('p442-control', {
16
+ description: 'Private P442 lifecycle driver',
17
+ handler: async (action, ctx) => {
18
+ await ctx.waitForIdle()
19
+ if (action === 'reload') await ctx.reload()
20
+ else if (action === 'new') await ctx.newSession()
21
+ else if (action === 'fork') {
22
+ const entry = ctx.sessionManager.getBranch().find((e: any) => e.type === 'message' && e.message.role === 'assistant')!
23
+ await ctx.fork(entry.id, { position: 'at' })
24
+ } else if (action.startsWith('send ')) {
25
+ // Re-submit a recorded message through Pi itself. The resulting message_start is a real Pi
26
+ // event in the current (possibly replaced) session, not a direct call to a product handler.
27
+ const message = JSON.parse(readFileSync(action.slice(5), 'utf8'))
28
+ pi.sendMessage(message, { triggerTurn: true, deliverAs: 'followUp' })
29
+ log({ type: 'fixture_send', customType: message.customType, details: message.details,
30
+ sessionId: ctx.sessionManager.getSessionId() })
31
+ } else if (action === 'busy') {
32
+ pi.sendMessage({ customType: 'p442-busy', content: 'P444 unrelated busy turn', display: true },
33
+ { triggerTurn: true, deliverAs: 'followUp' })
34
+ log({ type: 'fixture_send', customType: 'p442-busy', sessionId: ctx.sessionManager.getSessionId() })
35
+ } else if (action === 'stop') ctx.shutdown()
36
+ else throw new Error(`unknown fixture action ${action}`)
37
+ log({ type: 'command_done', action })
38
+ },
39
+ })
40
+ const state = (ctx: any) => ({
41
+ sessionId: ctx.sessionManager.getSessionId(), sessionFile: ctx.sessionManager.getSessionFile(),
42
+ reminderTools: pi.getAllTools().filter((tool: any) => tool.name === 'team_remind')
43
+ .map((tool: any) => ({ name: tool.name, exposure: tool.exposure })),
44
+ activeTools: pi.getActiveTools().filter((name: string) => name === 'team_remind'),
45
+ })
46
+ pi.on('session_start', (_event, ctx) => {
47
+ log({ type: 'session_start', pid: process.pid, ...state(ctx) })
48
+ writeFileSync(join(dir, 'session-start'), String(process.pid))
49
+ })
50
+ pi.on('before_agent_start', (_event, ctx) => { log({ type: 'before_agent_start', ...state(ctx) }) })
51
+ pi.on('message_start', (event, ctx) => {
52
+ if (event.message.role === 'custom') log({ type: 'custom_start', customType: event.message.customType,
53
+ details: event.message.details, ...state(ctx) })
54
+ })
55
+ pi.on('tool_execution_end', event => {
56
+ if (event.toolName === 'team_remind') log({ type: 'tool_end', isError: event.isError, result: event.result })
57
+ })
58
+ pi.on('agent_settled', (_event, ctx) => { log({ type: 'agent_settled', ...state(ctx) }) })
59
+ pi.on('session_shutdown', () => {
60
+ log({ type: 'shutdown' })
61
+ const file = join(process.env.TEAM_STATE_DIR ?? '', 'remind-tool/current.json')
62
+ try { log({ type: 'capability', value: JSON.parse(readFileSync(file, 'utf8')) }) }
63
+ catch (e: any) { log({ type: 'capability_missing', reason: e.code, exists: existsSync(file) }) }
64
+ })
65
+ }
@@ -759,7 +759,7 @@ check_coverage() {
759
759
  [ "$aw" = "0" ] && ok "每个别名都打印主命令的页并点名该别名"
760
760
 
761
761
  # O2 · the dispatcher's internal entries are a closed set, declared in one place (here)
762
- local internal="__inbox-write __notify-settle __panel-data"
762
+ local internal="__inbox-write __notify-settle __panel-data __remind-recover"
763
763
  local found want nm extra="" miss="" n
764
764
  found="$(team_internal_labels)"
765
765
  want="$(printf '%s\n' $internal | sort -u)"
@@ -926,7 +926,7 @@ FACE_VOCAB="state docs config worktree skills meetings"
926
926
  TEAM_HELP_AUTH_CONDITIONS="TEAM_CONFIRM_WRITES"
927
927
  EFFECT_VOCAB="read-only writes-<face> starts-process"
928
928
  # commands whose real run is a whole suite: the probe judges a bounded window (never a silent skip)
929
- BOUNDED_PROBES="smoke perf"
929
+ BOUNDED_PROBES="smoke"
930
930
 
931
931
  probe_is_bounded() { case " $BOUNDED_PROBES " in *" $1 "*) return 0 ;; esac; return 1; }
932
932
 
@@ -1041,6 +1041,53 @@ run_probe() { # <cmd> → ok/finding
1041
1041
  mkdir -p "$tmp/probe-tmp/$cmd"
1042
1042
  local eff="${MG_EFFECT[$cmd]}" faces="${MG_FACES[$cmd]}" before after i face changed missing
1043
1043
  before="$(fp_all "$d")"
1044
+
1045
+ if [ "$cmd" = perf ]; then
1046
+ # The copied CLI resolves its own sibling target; never run the measurement in this fixture.
1047
+ local private="$tmp/perf-cli" receipt="$tmp/logs/p-perf.receipt" physical expected_rc=23
1048
+ if ! physical="$(cd -P "$d" && pwd -P)" || ! mkdir "$private" "$private/tests" ||
1049
+ ! cp -a "$skill/scripts" "$private/scripts" ||
1050
+ ! cat > "$private/tests/perf.sh" <<'PERF_RECORDER'
1051
+ status=23
1052
+ cwd="$(pwd -P)" || exit 1
1053
+ # One line of shell-quoted words: status, physical cwd, argc, then the actual argv.
1054
+ printf -v record '%q ' "$status" "$cwd" "$#" "$@"
1055
+ printf '%s\n' "${record% }" >> "$HS_PERF_RECEIPT" || exit 1
1056
+ exit "$status"
1057
+ PERF_RECORDER
1058
+ then
1059
+ finding "claims: perf 无法准备私有 CLI 和交接记录器"
1060
+ return 1
1061
+ fi
1062
+ local -a perf_argv
1063
+ read -r -a perf_argv <<< "$argv"
1064
+ team="$private/scripts/team" TMPDIR="$tmp/probe-tmp/$cmd" HS_PERF_RECEIPT="$receipt" \
1065
+ env_run "$d" "${perf_argv[@]}"
1066
+ local rc="$HS_RC" handoff="已确认" status_note="" digest
1067
+ printf '%s\n' "$HS_OUT" > "$tmp/logs/p-$cmd.out"
1068
+ after="$(fp_all "$d")"
1069
+ changed=""
1070
+ while read -r face digest; do
1071
+ grep -qxF -- "$face $digest" <<< "$before" || changed="${changed:+$changed }$face"
1072
+ done <<< "$after"
1073
+ if [ ! -e "$receipt" ]; then
1074
+ handoff="未交接:没有回执"
1075
+ elif ! cmp -s "$receipt" <(printf '%q %q 1 --host\n' "$expected_rc" "$physical"); then
1076
+ handoff="回执不符:需要恰好一条完整回执,参数为 --host,目录为调用项目,状态为 $expected_rc"
1077
+ fi
1078
+ case "$rc" in
1079
+ "$expected_rc") ;;
1080
+ 124) status_note=",CLI 超时" ;;
1081
+ *) status_note=",预期退出 $expected_rc" ;;
1082
+ esac
1083
+ if [ "$handoff" = "已确认" ] && [ "$rc" = "$expected_rc" ] && [ -z "$changed" ]; then
1084
+ ok "claims: perf 交接已确认(rc=$rc),调用项目六项指纹不变:$FACE_VOCAB"
1085
+ else
1086
+ finding "claims: perf 交接:$handoff;rc=$rc$status_note;调用项目变化:${changed:-无}"
1087
+ fi
1088
+ return 0
1089
+ fi
1090
+
1044
1091
  local launch_before launch_after
1045
1092
  launch_before="$(cat "$tmp/tmux-calls.log" "$tmp/launch.log" 2>/dev/null | wc -l)"
1046
1093
 
@@ -1293,6 +1340,32 @@ check_invariants() {
1293
1340
  }
1294
1341
 
1295
1342
  # ---------------------------------------------------------------- route
1343
+ check_route_command() { # <command> — three current renders, one canonical file for both comparisons
1344
+ local c="$1" canonical_rc long_rc short_rc failed=0
1345
+ local canonical="$tmp/route-canonical.txt" long="$tmp/route-long.txt" short="$tmp/route-short.txt"
1346
+ page en help "$c" >"$canonical"; canonical_rc=$?
1347
+ page en "$c" --help >"$long"; long_rc=$?
1348
+ page en "$c" -h >"$short"; short_rc=$?
1349
+
1350
+ if [ "$canonical_rc" -ne 0 ]; then
1351
+ finding "route: $c 的 help $c 入口失败(rc=$canonical_rc)"; failed=1
1352
+ fi
1353
+ if [ "$long_rc" -ne 0 ]; then
1354
+ finding "route: $c 的 --help 入口失败(rc=$long_rc)"; failed=1
1355
+ fi
1356
+ if [ "$short_rc" -ne 0 ]; then
1357
+ finding "route: $c 的 -h 入口失败(rc=$short_rc)"; failed=1
1358
+ fi
1359
+ # A failed entry's bytes are not a page: compare only pairs that both rendered successfully.
1360
+ if [ "$canonical_rc" -eq 0 ] && [ "$long_rc" -eq 0 ] && ! cmp -s "$canonical" "$long"; then
1361
+ finding "route: $c 的两条入口不逐字节相同(--help)"; failed=1
1362
+ fi
1363
+ if [ "$canonical_rc" -eq 0 ] && [ "$short_rc" -eq 0 ] && ! cmp -s "$canonical" "$short"; then
1364
+ finding "route: $c 的 -h 入口与 help 页不同"; failed=1
1365
+ fi
1366
+ return "$failed"
1367
+ }
1368
+
1296
1369
  check_route() {
1297
1370
  section "route · 三级可达、两条入口逐字节相同、未知 token exit 2、无项目可用"
1298
1371
  local rc
@@ -1306,12 +1379,7 @@ check_route() {
1306
1379
  ok "每个分组页都列出命令"
1307
1380
  local c same=0
1308
1381
  for c in "${MG_ORDER[@]}"; do
1309
- if ! diff -q <(page en help "$c") <(page en "$c" --help) >/dev/null 2>&1; then
1310
- finding "route: $c 的两条入口不逐字节相同"; same=1
1311
- fi
1312
- if ! diff -q <(page en help "$c") <(page en "$c" -h) >/dev/null 2>&1; then
1313
- finding "route: $c 的 -h 入口与 help 页不同"; same=1
1314
- fi
1382
+ if ! check_route_command "$c"; then same=1; fi
1315
1383
  done
1316
1384
  [ "$same" = "0" ] && ok "team help <命令> 与 team <命令> --help/-h 逐字节相同(${#MG_ORDER[@]} 个命令)"
1317
1385
  # a page never falls back to the menu
@@ -1512,11 +1580,9 @@ if [ "$_TEAM_HELP_REQ" = "1" ]; then""", 1)' \
1512
1580
  coverage "__probe-x"
1513
1581
 
1514
1582
  # O2b: the declared internal set names one entry that is no longer a dispatcher label
1515
- # P417: 这里的字面量以前跟丢了声明本身(声明是三个名字 `__inbox-write __notify-settle __panel-data`,
1516
- # 而变异找的是中间没有 `__notify-settle` 的两词子串)——替换静默空转,⑪ 于是长期「没有红」:
1517
- # 一条自己什么都没测的红侧。字面量改成声明的原三词串;改完这条翻转必须变红。
1583
+ # P417: 变异必须点名声明的完整当前值;替换静默空转会让这条红侧什么都没测。
1518
1584
  flip_case "internal-list-short" "⑪声明清单里删一个内部名" "tests/help-surface.sh" \
1519
- 's = s.replace("__inbox-write __notify-settle __panel-data", "__notify-settle __panel-data", 1)' \
1585
+ 's = s.replace("__inbox-write __notify-settle __panel-data __remind-recover", "__notify-settle __panel-data __remind-recover", 1)' \
1520
1586
  coverage "__inbox-write"
1521
1587
 
1522
1588
  # O6a: a declared group disappears from the manifest while its commands still name it
@@ -849,9 +849,9 @@ agents_run_case() { # <tree> <repo> <render> <label> <head-crlf> <tail-crlf> <bo
849
849
  # 既有契约上跑裸 `team init --no-skills`,受管块写成 `pm-skills:pm` / `dev verify` —— 会话名取了目录名,
850
850
  # 名册取了硬编码默认。判据两半:既有契约 → 契约现值(整块逐字节等于同参数的显式渲染);无契约的新项目 →
851
851
  # 目录名 + 默认名册(两条路径没有合并成一条)。
852
- init_cfg_fixture() { # <tree> <repo>:把非默认的渲染参数写进契约(P402 的既有契约夹具)
853
- local t="$1" p="$2"
854
- run_tree "$t" "$p" init --no-skills --session cfg-session --agents "alice bob carol" \
852
+ init_cfg_fixture() { # <tree> <repo> [init flags]:把非默认的渲染参数写进契约(P402 的既有契约夹具)
853
+ local t="$1" p="$2"; shift 2
854
+ run_tree "$t" "$p" init "$@" --session cfg-session --agents "alice bob carol" \
855
855
  --pm-window cfg-pm --docs docs/crew --vcs local --gates "make check" \
856
856
  --task-models 'routine=deepseek/deepseek-flash analysis=xai/grok-4.6 verify=kimi-coding/k3-256k' \
857
857
  --pm-model 'deepseek/deepseek-flash'
@@ -866,7 +866,7 @@ chk_init_render_from_config() { # <tree> <已 init 的仓库>:裸 init 取契
866
866
  [ "$rc" = "0" ] || { printf '裸 init rc=%s(%s)' "$rc" "$(printf '%s\n' "$out" | tail -1)"; return 1; }
867
867
  after="$(file_hash "$cfg")"
868
868
  [ "$before" = "$after" ] || { printf '裸 init 改了既有契约(sha %s → %s)' "$before" "$after"; return 1; }
869
- # 承重判据:整块逐字节等于「同一组参数显式渲染」的结果(单项 grep 只用来点名是哪一条错)
869
+ # 承重判据:参考树与裸 init 都默认安装,整块逐字节比较;单项 grep 只用来点名是哪一条错。
870
870
  e="$p.expected"; rm -rf "$e"; git_new "$e"
871
871
  init_cfg_fixture "$t" "$e" >/dev/null 2>&1 || { printf '参考渲染(同一组参数显式 init)失败'; return 1; }
872
872
  cmp -s "$e/AGENTS.md" "$p/AGENTS.md" || {
@@ -1068,7 +1068,7 @@ if want install; then
1068
1068
  # ②b P402:既有契约 + 非 --force 的裸 init → 渲染参数取契约现值(不是目录名/硬编码默认);
1069
1069
  # 对照组是无契约的新项目:仍是目录名与默认名册(证明没有把两条路径合并成一条)。
1070
1070
  p="$tmp/p-cfg-render"; git_new "$p"; assert_isolated "$tree" "$p"
1071
- init_cfg_fixture "$tree" "$p" >/dev/null; rc=$?
1071
+ init_cfg_fixture "$tree" "$p" --no-skills >/dev/null; rc=$?
1072
1072
  assert_eq "P402 夹具:非默认渲染参数写进契约" "$rc" "0"
1073
1073
  check_holds "P402 裸 init 取契约里的 session/名册/docs/PM 窗口/门禁(整块等于同参数的显式渲染)" \
1074
1074
  chk_init_render_from_config "$tree" "$p"
@@ -1593,8 +1593,8 @@ if old not in s:
1593
1593
  print("夹具没生效:找不到 P402 的契约回落块"); sys.exit(1)
1594
1594
  open(p, "w", encoding="utf-8").write(s.replace(old, new, 1))
1595
1595
  PYINITRENDER
1596
- pg="$tmp/f-init-render-green"; git_new "$pg"; init_cfg_fixture "$tree" "$pg" >/dev/null 2>&1
1597
- pf="$tmp/f-init-render-red"; git_new "$pf"; init_cfg_fixture "$ft" "$pf" >/dev/null 2>&1
1596
+ pg="$tmp/f-init-render-green"; git_new "$pg"; init_cfg_fixture "$tree" "$pg" --no-skills >/dev/null 2>&1
1597
+ pf="$tmp/f-init-render-red"; git_new "$pf"; init_cfg_fixture "$ft" "$pf" --no-skills >/dev/null 2>&1
1598
1598
  check_holds "⑮ 对照:真实树裸 init 取契约现值" chk_init_render_from_config "$tree" "$pg"
1599
1599
  check_breaks "⑮ 翻转:回落顺序退回目录名/硬编码默认(不看契约现值)" chk_init_render_from_config "$ft" "$pf"
1600
1600
  # ⑥ 真实树没被夹具动过:git status 指纹前后一致
@@ -7,8 +7,12 @@ ROOT="$(cd "$SELF_DIR/../../.." && pwd)"
7
7
  REF=""
8
8
  if [ "${1:-}" = --ref ] && [ "$#" = 2 ]; then REF="$2"
9
9
  elif [ "$#" != 0 ]; then printf 'usage: isolation-ledger.sh [--ref <commit>]\n' >&2; exit 2; fi
10
- TMP="$(mktemp -d -p /var/tmp p426-isolation.XXXXXX)"
11
- trap 'rm -rf "$TMP"' EXIT
10
+ # P427:临时根走夹具的**唯一创建者**(tests/lib/tmp-root.sh:owned 家族 + 项目 ns + 落盘台账 + 退出回收)。
11
+ # 不自己算基准、也不写死 /var/tmp —— section 40 的临时根 lint 对这两件事都会点名(旧写法是
12
+ # `mktemp -d -p /var/tmp p426-isolation.XXXXXX`)。
13
+ . "$SELF_DIR/lib/tmp-root.sh"
14
+ TMP="$(tmp_root_create isolation)" || { printf 'isolation-ledger: 建不了临时根\n' >&2; exit 2; }
15
+ trap 'tmp_root_reap_all' EXIT
12
16
  for file in smoke.sh tmux-identity-leak.sh; do
13
17
  if [ -n "$REF" ]; then git -C "$ROOT" show "$REF:skills/teamsmith/tests/$file" > "$TMP/$file"
14
18
  else cp "$SELF_DIR/$file" "$TMP/$file"; fi
@@ -33,7 +33,7 @@ for g in "${KR_SEL[@]}"; do
33
33
  hit=0; for k in "${UI_GROUPS[@]}"; do [ "$g" = "$k" ] && hit=1; done
34
34
  [ "$hit" = "1" ] || { printf 'key-replies-ui.sh:未知组 [%s](可选:%s)\n' "$g" "${UI_GROUPS[*]}" >&2; exit 2; }
35
35
  done
36
- trap reply_fixture_cleanup EXIT
36
+ trap tmp_root_reap_all EXIT
37
37
 
38
38
  # 面板的 CLI 走记录 argv 的 shim(真 CLI 前面一行日志):块的逐条调用可查,数据仍是真读数。
39
39
  kr_panel_snapshot_raw() { # <页> <额外参数…> → 未剥 ANSI 的原始 stdout
@@ -47,11 +47,18 @@ kr_panel_snapshot() { # <页> <额外参数…> → stdout
47
47
  | sed -e 's/\x1b\[[0-9;]*m//g'
48
48
  }
49
49
 
50
+ kr_reply_time_snapshot() { # <输出> <TZ> <at|-> <省略 0|1> <页> <额外参数…>
51
+ local out="$1" tz="$2" at="$3" omit="$4" page="$5"; shift 5
52
+ "${clean_env[@]}" TZ="$tz" B3_STUB_REPLY=ok B3_STUB_REPLY_AT="$at" B3_STUB_REPLY_AT_OMIT="$omit" \
53
+ node "$panel" --root "$ROOT" --team-cli "$SELF_DIR/panel-b3-stub.sh" --snapshot --page "$page" \
54
+ --width 160 --height 30 --lang zh "$@" 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$out"
55
+ }
56
+
50
57
  # ---------------------------------------------------------------- 组:blocks
51
58
  kr_group_blocks() {
52
59
  section "blocks · 三个需求块的装配契约(3.3)"
53
60
  local b="$tmp/bl.md"; printf '块夹具正文\n' >"$b"
54
- fixture_up blocks "dev2|块夹具一号|$b" "verify|块夹具二号|$b"
61
+ fixture_prepare blocks "dev2|块夹具一号|$b" "verify|块夹具二号|$b"
55
62
  # ① 总览一次装配:只有 summary(list/body 不在 wanted 集合里)
56
63
  reset_argv
57
64
  kr_panel_snapshot 1 --width 120 --height 28 --lang zh >"$tmp/bl-ov.txt"
@@ -73,6 +80,52 @@ kr_group_blocks() {
73
80
  assert_match "$(kr_argv)" 'reply_body.*--no 1' "blocks:视窗形态出现在 argv(--no 1)"
74
81
  assert_eq "blocks:打开视窗时不调度 list(视窗取代列表)" "$(block_calls reply_list)" "0"
75
82
  assert_has "$tmp/bl-body.txt" "块夹具正文" "blocks:正文块渲染出原文"
83
+
84
+ # P436:同一 UTC 输入在两个阅读者时区下,列表/摘要保持紧凑本地时间,详情带实际偏移。
85
+ # 用固定 stub 而非真实发布时间,避免测试依赖运行时钟;KR_PANEL 可指向变异 bundle 做红侧。
86
+ local time_at='2026-09-16T09:59:00Z' zone tz compact full surface page f
87
+ for zone in shanghai new-york; do
88
+ if [ "$zone" = shanghai ]; then
89
+ tz='Asia/Shanghai'; compact='09-16 17:59'; full='2026-09-16 17:59 +08:00'
90
+ else
91
+ tz='America/New_York'; compact='09-16 05:59'; full='2026-09-16 05:59 -04:00'
92
+ fi
93
+ for surface in summary list body; do
94
+ f="$tmp/bl-time-$zone-$surface.txt"
95
+ page=5
96
+ [ "$surface" = summary ] && page=1
97
+ if [ "$surface" = body ]; then
98
+ kr_reply_time_snapshot "$f" "$tz" "$time_at" 0 "$page" --reply-no 1
99
+ else
100
+ kr_reply_time_snapshot "$f" "$tz" "$time_at" 0 "$page"
101
+ fi
102
+ assert_has "$f" "$compact" "blocks:$zone 的 $surface 与列表使用同一紧凑本地时刻"
103
+ assert_not "$f" "$time_at" "blocks:$zone 的 $surface 不直接显示原始 UTC"
104
+ assert_not "$f" 'Invalid Date' "blocks:$zone 的 $surface 没有 Invalid Date"
105
+ if [ "$surface" = body ]; then
106
+ assert_has "$f" "$full" "blocks:$zone 的详情显示完整本地时间与实际偏移"
107
+ fi
108
+ done
109
+ done
110
+ # 非法/缺失时间沿用无时间的降级:保留回复与发布者,不显示原始坏值或 Invalid Date。
111
+ local mode omit shown_at
112
+ for mode in invalid missing; do
113
+ if [ "$mode" = invalid ]; then shown_at='not-a-time'; omit=0; else shown_at='-'; omit=1; fi
114
+ for surface in summary list body; do
115
+ f="$tmp/bl-time-$mode-$surface.txt"
116
+ page=5
117
+ [ "$surface" = summary ] && page=1
118
+ if [ "$surface" = body ]; then
119
+ kr_reply_time_snapshot "$f" 'Asia/Shanghai' "$shown_at" "$omit" "$page" --reply-no 1
120
+ else
121
+ kr_reply_time_snapshot "$f" 'Asia/Shanghai' "$shown_at" "$omit" "$page"
122
+ fi
123
+ assert_not "$f" 'Invalid Date' "blocks:$mode 的 $surface 不显示 Invalid Date"
124
+ assert_not "$f" 'not-a-time' "blocks:$mode 的 $surface 不显示非法原始时间"
125
+ assert_has "$f" 'dev2' "blocks:$mode 的 $surface 仍保留回复与发布者"
126
+ done
127
+ done
128
+
76
129
  # ⑤ 慢块:子进程超时被杀(timeoutMs 10s)→ 只降级本块,其余块照常
77
130
  kr_shim_set_slow reply_list 30
78
131
  reset_argv
@@ -101,7 +154,7 @@ FLOOD
101
154
  kr_group_machine() {
102
155
  section "machine · 机器出口零 reply 读(3.3)"
103
156
  local b="$tmp/mn.md"; printf '机器出口夹具正文\n' >"$b"
104
- fixture_up machine
157
+ fixture_prepare machine
105
158
  kr_cli "$ROOT" monitor --print 2>/dev/null | kr_mask_print >"$tmp/m-print-before.txt"
106
159
  kr_cli "$ROOT" monitor --json 2>/dev/null | sed -E 's/"timestamp": *"[^"]*"/"timestamp": "T"/' >"$tmp/m-json-before.txt"
107
160
  printf 'lang=en\ndefaultPage=5\nmouse=off\n' >"$state/panel.conf"
@@ -129,7 +182,7 @@ kr_group_snapshots() {
129
182
  local b1="$tmp/s1.md" long="$tmp/s-long.md"
130
183
  printf '快照回复一\n第二行\n' >"$b1"
131
184
  { local i; for i in $(seq 1 200); do printf '滚动行 %s\n' "$i"; done; printf 'END-MARKER-P234\n'; } >"$long"
132
- fixture_up snapshots "dev2|快照标题|$b1" "verify|长文快照|$long"
185
+ fixture_prepare snapshots "dev2|快照标题|$b1" "verify|长文快照|$long"
133
186
  local i
134
187
  for i in $(seq 1 58); do kr_cli "$ROOT" reply post --from dev2 --title "槽位 $i" --stdin <"$b1" >/dev/null; done
135
188
  assert_eq "snapshots:夹具 store 有 60 个编号" "$(kr_cli "$ROOT" reply list --json | python3 -c 'import json,sys;print(json.load(sys.stdin)["total_slots"])')" "60"
@@ -311,7 +364,13 @@ PYP
311
364
  kr_run_group() { # 组名到函数(`routing-regression` 带连字符,不能靠 $var 展开)
312
365
  case "$1" in
313
366
  routing-regression) kr_group_routing_regression ;;
314
- *) "kr_group_$1" ;;
367
+ *)
368
+ # 真实面板读者仍会查询窗口状态;只查本轮私有目录,不连调用者的 server。
369
+ local -x TMUX_TMPDIR="$tmp"
370
+ local TMUX TMUX_PANE
371
+ unset TMUX TMUX_PANE
372
+ "kr_group_$1"
373
+ ;;
315
374
  esac
316
375
  }
317
376