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
@@ -3,7 +3,7 @@
3
3
  # 由 scripts/team 与各 cmd-*.sh source;不要直接执行。
4
4
  # 约定:所有函数名以 team_ 前缀;不依赖 jq / python / node。
5
5
 
6
- TEAM_VERSION="0.4.6"
6
+ TEAM_VERSION="0.4.8"
7
7
 
8
8
  # ---------------------------------------------------------------- 输出
9
9
  if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
@@ -772,7 +772,7 @@ team_identity_env_prefix() { # [<目标目录>]
772
772
  root="$wt"
773
773
  fi
774
774
  fi
775
- out="unset TEAM_ROOT TEAM_MAIN_ROOT TEAM_PROJECT TEAM_SESSION TEAM_SESSION_FROM TEAM_CONFIG_FILE"
775
+ out="unset TEAM_ROOT TEAM_MAIN_ROOT TEAM_PROJECT TEAM_SESSION TEAM_SESSION_FROM TEAM_CONFIG_FILE TEAM_REMINDER_ONLY_RECOVERY"
776
776
  out="$out TEAM_IDENTITY_LOCKED TEAM_IDENTITY_ROOT TEAM_IDENTITY_MAIN_ROOT TEAM_IDENTITY_PROJECT"
777
777
  out="$out TEAM_IDENTITY_INHERIT_ROOT TEAM_IDENTITY_INHERIT_MAIN_ROOT TEAM_IDENTITY_INHERIT_PROJECT TEAM_IDENTITY_INHERIT_SESSION; "
778
778
  for v in TEAM_ROOT TEAM_MAIN_ROOT TEAM_PROJECT TEAM_SESSION; do
@@ -1229,7 +1229,7 @@ team_branch_for_agent() { # <agent> <ID> → 该 agent 在这个任务上应该
1229
1229
 
1230
1230
  # 输出一份「可直接写进派单提示词」的路径清单(agent_adapter = 当前生效的 agent 适配器)
1231
1231
  team_paths_json() {
1232
- printf '{ "project": "%s", "main_root": "%s", "worktree": "%s", "docs": "%s", "worktrees": "%s", "session": "%s", "pm_window": "%s", "agent_adapter": "%s", "agent_bin": "%s", "openspec_bin": "%s", "spec_dir": "%s", "require_magic_context": "%s", "require_openspec": "%s", "pulse_window": "%s", "pulse_interval": "%s", "js_runner": "%s", "require_js": "%s" }\n' \
1232
+ printf '{ "project": "%s", "main_root": "%s", "worktree": "%s", "docs": "%s", "worktrees": "%s", "session": "%s", "pm_window": "%s", "agent_adapter": "%s", "agent_bin": "%s", "openspec_bin": "%s", "spec_dir": "%s", "require_magic_context": "%s", "require_openspec": "%s", "pulse_window": "%s", "pulse_interval": "%s", "js_runner": "%s", "require_js": "%s", "flock_runner": "%s" }\n' \
1233
1233
  "$(team_json_escape "$TEAM_PROJECT")" "$(team_json_escape "$TEAM_MAIN_ROOT")" "$(team_json_escape "$TEAM_ROOT")" \
1234
1234
  "$(team_json_escape "$TEAM_DOCS_ABS")" "$(team_json_escape "$TEAM_MAIN_ROOT/$TEAM_WORKTREES_DIR")" \
1235
1235
  "$(team_json_escape "$TEAM_SESSION")" "$(team_json_escape "$TEAM_PM_WINDOW")" \
@@ -1237,7 +1237,8 @@ team_paths_json() {
1237
1237
  "$(team_json_escape "$(team_openspec_bin_path)")" "$(team_json_escape "$(team_spec_dir_abs)")" \
1238
1238
  "$(team_json_escape "$TEAM_REQUIRE_MAGIC_CONTEXT")" "$(team_json_escape "$TEAM_REQUIRE_OPENSPEC")" \
1239
1239
  "$(team_json_escape "$(team_pulse_window)")" "$(team_json_escape "$TEAM_PULSE_INTERVAL")" \
1240
- "$(team_json_escape "$(team_js_runner)")" "$(team_json_escape "$TEAM_REQUIRE_JS")"
1240
+ "$(team_json_escape "$(team_js_runner)")" "$(team_json_escape "$TEAM_REQUIRE_JS")" \
1241
+ "$(team_json_escape "$(team_flock_runner)")"
1241
1242
  }
1242
1243
 
1243
1244
  # ---------------------------------------------------------------- JS 运行时(必需依赖,D19)
@@ -1260,6 +1261,22 @@ team_js_runner() { # → 解析出的运行时绝对路径;解析不到(含
1260
1261
  return 0
1261
1262
  }
1262
1263
 
1264
+ # flock 的解析只有 state-authority.mjs 一份:paths、doctor 与实际事务都读它。
1265
+ # 输出 <ok|missing|unusable|unavailable>\t<路径>\t<说明>;unavailable 表示连解析助手都跑不了。
1266
+ team_flock_check() {
1267
+ local runner out
1268
+ runner="$(team_js_runner)"
1269
+ if [ -z "$runner" ]; then printf 'unavailable\t\t缺 JS 运行时,无法调用共享 flock 解析器\n'; return 0; fi
1270
+ out="$("$runner" "${TEAM_SKILL_DIR:-$(team_skill_dir)}/scripts/state-authority.mjs" --flock-check 2>/dev/null)"
1271
+ if [ -n "$out" ]; then printf '%s\n' "$out"; else printf 'unavailable\t\t共享 flock 解析器执行失败\n'; fi
1272
+ }
1273
+ team_flock_runner() {
1274
+ local st path detail
1275
+ IFS=$'\t' read -r st path detail <<< "$(team_flock_check)"
1276
+ [ "$st" = "ok" ] && printf '%s\n' "$path"
1277
+ return 0
1278
+ }
1279
+
1263
1280
  team_js_version() { # <可执行路径> → 版本字符串(v24.19.0 / 1.3.14);判不出 → 空
1264
1281
  local v
1265
1282
  v="$("$1" --version 2>/dev/null | head -1 | tr -d '[:space:]' || true)" # 留:本机可能没这项能力,按回退走
@@ -1376,6 +1393,9 @@ team_inotify_probe() {
1376
1393
  # team_tmp_root_prepare,于是跑一次 doctor 就把尚未创建的默认根建出来了,与规格
1377
1394
  # `never created by a read-only surface` 相反)。根还不存在时,探针落在最近的存在祖先上:
1378
1395
  # 与「余量行按祖先判」同一个判据,同一个文件系统,注册能力也相同。
1396
+ # P427:落地目录落在祖先上还不够 —— **运行时自己**也看 TMPDIR(Node 的编译缓存、jiti 的转换
1397
+ # 缓存、pi 插件日志都写在 `os.tmpdir()` 下),所以跑它一律走 team_readonly_run(关掉那些写入,
1398
+ # 不换目录:换目录只是换个被污染的地方)。
1379
1399
  root="$(team_tmp_root)" || root=""
1380
1400
  [ -n "$root" ] || { printf 'unavailable\n'; return 0; }
1381
1401
  probe_base="$root"
@@ -1402,9 +1422,9 @@ try {
1402
1422
  process.stdout.write(verdict + '\n')
1403
1423
  TEAM_INOTIFY_PROBE_JS
1404
1424
  if command -v timeout >/dev/null 2>&1; then
1405
- out="$(TEAM_INOTIFY_ROOT="$probe_base" TEAM_INOTIFY_NS="$ns" timeout "${TEAM_INOTIFY_PROBE_TIMEOUT:-10}" "$runner" "$script" 2>/dev/null || true)" # 留:本机可能没这项能力,按回退走
1425
+ out="$(TEAM_INOTIFY_ROOT="$probe_base" TEAM_INOTIFY_NS="$ns" team_readonly_run timeout "${TEAM_INOTIFY_PROBE_TIMEOUT:-10}" "$runner" "$script" 2>/dev/null || true)" # 留:本机可能没这项能力,按回退走
1406
1426
  else
1407
- out="$(TEAM_INOTIFY_ROOT="$probe_base" TEAM_INOTIFY_NS="$ns" "$runner" "$script" 2>/dev/null || true)" # 留:本机可能没这项能力,按回退走
1427
+ out="$(TEAM_INOTIFY_ROOT="$probe_base" TEAM_INOTIFY_NS="$ns" team_readonly_run "$runner" "$script" 2>/dev/null || true)" # 留:本机可能没这项能力,按回退走
1408
1428
  fi
1409
1429
  rm -f "$script"
1410
1430
  case "$out" in
@@ -1712,6 +1732,16 @@ team_authority_cli() { # <resolve|init|read|allocate> [参数];助手自己取
1712
1732
  esac
1713
1733
  "$runner" "${TEAM_SKILL_DIR:-$(team_skill_dir)}/scripts/state-authority.mjs" --cli "$main" "$state" "$@"
1714
1734
  }
1735
+ # 只读诊断:已初始化的项目对它真实的 authority.lock 取一次排他锁,不读改快照、不建文件。
1736
+ team_authority_flock_probe() {
1737
+ local runner main state
1738
+ runner="$(team_js_runner)"
1739
+ [ -n "$runner" ] || { team_err "state-authority:缺 JS 运行时,无法验证 flock"; return 1; }
1740
+ main="$(team_authority_main_root)" || return 1
1741
+ state="${TEAM_STATE_DIR:-}"
1742
+ [ -n "$state" ] || { team_err "state-authority:TEAM_STATE_DIR 未解析"; return 1; }
1743
+ "$runner" "${TEAM_SKILL_DIR:-$(team_skill_dir)}/scripts/state-authority.mjs" --flock-lock-check "$main" "$state"
1744
+ }
1715
1745
  team_authority_state_root() { TEAM_AUTHORITY_CALL=1 team_authority_cli resolve --print stateRoot; }
1716
1746
  team_authority_init() { TEAM_AUTHORITY_CALL=1 team_authority_cli init; }
1717
1747
  team_authority_read() { TEAM_AUTHORITY_CALL=1 team_authority_cli read; }
@@ -3167,6 +3197,8 @@ team_pm_prompt() { # PM 开场/恢复提示词(模板在 skill 内,可随 sk
3167
3197
  # 优先级裁断(也写进 `team help` 的 up 行):本次启动里 --fresh-pm **最优先** —— TEAM_PM_SESSION_ID /
3168
3198
  # TEAM_PM_RESUME_ARGS 这一次都不生效(显式的人造意图 > 持久配置键)。
3169
3199
  team_pm_fresh_launch() { [ "${TEAM_PM_FRESH_LAUNCH:-0}" = "1" ]; }
3200
+ # Only the eligible-Reminder recovery path sets this for the one start. Ordinary up/watch stays promptful.
3201
+ team_pm_reminder_only() { [ "${TEAM_REMINDER_ONLY_RECOVERY:-0}" = "1" ]; }
3170
3202
 
3171
3203
  # Required independent PM policy. No worker/default fallback, even when empty.
3172
3204
  team_pm_model_resolve() { printf '%s\n' "${TEAM_PM_MODEL:-}"; }
@@ -3334,7 +3366,7 @@ team_pm_abort_uncommitted() { # only the window started by this attempt
3334
3366
  team_tmux_kill_window "$target" || { team_err "uncommitted PM stop failed: $target;检查保存的诊断"; return 1; }
3335
3367
  }
3336
3368
 
3337
- team_pm_pi_args() { # PM 定向加载 bg/inbox-watch/reply,不加载 notify;默认 -c 延续本目录上一个会话
3369
+ team_pm_pi_args() { # PM 定向加载 bg/inbox-watch/reply/remind,不加载 notify;默认 -c 延续本目录上一个会话
3338
3370
  team_pm_identity_guard || return 1
3339
3371
  local model="$(team_pm_model_resolve)" args=()
3340
3372
  args=(--provider "${model%%/*}" --model "${model#*/}")
@@ -3343,6 +3375,8 @@ team_pm_pi_args() { # PM 定向加载 bg/inbox-watch/reply,不加载 notify;
3343
3375
  # M30:PM 的收件箱监视唤醒(投递换道:pi 通道不再往输入框粘贴)
3344
3376
  [ -d "$TEAM_SKILL_DIR" ] && args+=(-e "$TEAM_SKILL_DIR/extension/team-inbox-watch.ts")
3345
3377
  [ -d "$TEAM_SKILL_DIR" ] && args+=(-e "$TEAM_SKILL_DIR/extension/team-reply.ts")
3378
+ # P442:PM 自我提醒工具只在已验证的主检出 PM 里激活;worker 与 /team 不注入。
3379
+ [ -d "$TEAM_SKILL_DIR" ] && args+=(-e "$TEAM_SKILL_DIR/extension/team-remind.ts")
3346
3380
  [ -d "$TEAM_SKILL_DIR" ] && args+=(--skill "$TEAM_SKILL_DIR")
3347
3381
  # 续跑参数(M8.1):TEAM_PM_SESSION_ID > 显式 TEAM_PM_RESUME_ARGS > 历史的 -c。
3348
3382
  # 默认三个都空 = 与历史逐字节一致;显式配了 resume 参数就换掉默认的 -c(同一套键也服务于自定义 CLI)。
@@ -3631,12 +3665,23 @@ team_pm_launch_cmd() { # <prompt_file> <spawn_file> → respawn-pane 的 shell-c
3631
3665
  if [ -z "$(team_trim "${TEAM_PM_CMD:-}")" ]; then
3632
3666
  pi_bin="$(team_pm_bin_path)"
3633
3667
  # M40:启动前先清洗身份 env(继承的 TEAM_* 一律清掉,只写本命令推导出的身份)
3634
- printf '%s%sexport TEAM_STATE_DIR=%q TEAM_CONFIG_FILE=%q TEAM_PM_WINDOW=%q; cd %q && printf "%%s\\n" $$ > %q && exec %q %s @%q' \
3635
- "$(team_identity_env_prefix "$TEAM_MAIN_ROOT")" "$(team_tmux_shim_exports)" \
3636
- "$TEAM_STATE_DIR" "${TEAM_CONFIG:-${TEAM_CONFIG_FILE:-}}" "$TEAM_PM_WINDOW" \
3637
- "$TEAM_MAIN_ROOT" "$spawnfile" "$pi_bin" "$(team_pm_pi_args)" "$pf"
3668
+ if team_pm_reminder_only; then
3669
+ printf '%s%sexport TEAM_STATE_DIR=%q TEAM_CONFIG_FILE=%q TEAM_PM_WINDOW=%q TEAM_REMINDER_ONLY_RECOVERY=1; cd %q && printf "%%s\\n" $$ > %q && exec %q %s' \
3670
+ "$(team_identity_env_prefix "$TEAM_MAIN_ROOT")" "$(team_tmux_shim_exports)" \
3671
+ "$TEAM_STATE_DIR" "${TEAM_CONFIG:-${TEAM_CONFIG_FILE:-}}" "$TEAM_PM_WINDOW" \
3672
+ "$TEAM_MAIN_ROOT" "$spawnfile" "$pi_bin" "$(team_pm_pi_args)"
3673
+ else
3674
+ printf '%s%sexport TEAM_STATE_DIR=%q TEAM_CONFIG_FILE=%q TEAM_PM_WINDOW=%q; cd %q && printf "%%s\\n" $$ > %q && exec %q %s @%q' \
3675
+ "$(team_identity_env_prefix "$TEAM_MAIN_ROOT")" "$(team_tmux_shim_exports)" \
3676
+ "$TEAM_STATE_DIR" "${TEAM_CONFIG:-${TEAM_CONFIG_FILE:-}}" "$TEAM_PM_WINDOW" \
3677
+ "$TEAM_MAIN_ROOT" "$spawnfile" "$pi_bin" "$(team_pm_pi_args)" "$pf"
3678
+ fi
3638
3679
  return 0
3639
3680
  fi
3681
+ if team_pm_reminder_only; then
3682
+ team_err 'Reminder-only recovery supports the built-in Pi PM only; a custom adapter has no verified prompt-free watcher contract'
3683
+ return 1
3684
+ fi
3640
3685
  expanded="$(team_agent_expand pm "$TEAM_PM_CMD" pm "${TEAM_PM_SESSION_ID:-}" \
3641
3686
  "$TEAM_MAIN_ROOT" "$pf" "" "" "$(team_pm_model_resolve)")" || return 1
3642
3687
  # 裸名字 → 解析出的绝对路径(M8.1 退回点 1;见 team_pm_subst_first_word 的注释)。
@@ -3720,6 +3765,7 @@ team_pm_continuity_note() { # 打在启动成功之后:延续 or 明确说「
3720
3765
  # 否则从 respawn 到拿到证据之间那一拍看起来像「没有 PM」,并发的另一拍会把刚刚起来的 PM 杀掉。
3721
3766
  team_pm_start() {
3722
3767
  local target state cmd pf i wait apid age
3768
+ TEAM_PM_START_OUTCOME=''
3723
3769
  target="$(team_pm_target)"
3724
3770
  team_pm_window_exists || return 1
3725
3771
  # 已经有一次启动在飞行中(同一窗口、标记新鲜)→ 不重复拉起:再 respawn 一次会把
@@ -3728,11 +3774,12 @@ team_pm_start() {
3728
3774
  if team_pm_starting; then
3729
3775
  age="$(team_pm_starting_age || echo '?')"
3730
3776
  team_dim " PM 正在启动(${age}s 前发起,证据:$(team_pm_evidence)):不重复拉起"
3777
+ TEAM_PM_START_OUTCOME='already-starting'
3731
3778
  return 0
3732
3779
  fi
3733
3780
  state="$(team_pm_state)"
3734
3781
  case "$state" in
3735
- running:*) team_dim " PM 已在运行(${state#running:})"; return 0 ;;
3782
+ running:*) team_dim " PM 已在运行(${state#running:})"; TEAM_PM_START_OUTCOME='already-running'; return 0 ;;
3736
3783
  idle:*) ;;
3737
3784
  unknown:*)
3738
3785
  local ucwd; ucwd="$(team_pane_cwd "$target" 2>/dev/null || echo '?')" # 留:进程/窗口可能刚消失(竞态),调用方按空值处理
@@ -3751,8 +3798,12 @@ team_pm_start() {
3751
3798
  team_pm_identity_guard || return 1
3752
3799
  team_pm_check_launch
3753
3800
  team_pm_check_bin
3801
+ if team_pm_reminder_only && [ -n "$(team_trim "${TEAM_PM_CMD:-}")" ]; then
3802
+ team_err 'Reminder-only recovery 不支持自定义 PM adapter(没有 prompt-free Pi watcher 契约)'
3803
+ return 1
3804
+ fi
3754
3805
  local pm_nonce="$(date +%s)-$BASHPID-$RANDOM-$RANDOM"
3755
- pf="$(team_pm_write_prompt)"
3806
+ if team_pm_reminder_only; then pf=''; else pf="$(team_pm_write_prompt)"; fi
3756
3807
  # spawn 证明(M6.3 F30):让 pane 里的 shell 在 exec 之前把自己的 pid 写盘。
3757
3808
  # wrapper agent(脚本最后 exec 掉自己,用来钉环境变量/flags)会换掉进程映像,
3758
3809
  # 配置的 agent 名字就看不到了 —— 但那个 pid 仍然是我们启动的、还在本项目里。
@@ -3786,6 +3837,7 @@ team_pm_start() {
3786
3837
  }
3787
3838
  team_pm_starting_end
3788
3839
  team_pm_continuity_note # 延续了就说怎么延续;没延续就明说 + 指出靠 docs/team/** 与 inbox 接手
3840
+ TEAM_PM_START_OUTCOME='started'
3789
3841
  return 0
3790
3842
  fi
3791
3843
  apid="$(team_pm_spawn_pid 2>/dev/null || true)" # 留:进程/窗口可能刚消失(竞态),调用方按空值处理
@@ -3797,6 +3849,7 @@ team_pm_start() {
3797
3849
  }
3798
3850
  team_pm_starting_end
3799
3851
  team_pm_continuity_note
3852
+ TEAM_PM_START_OUTCOME='started'
3800
3853
  return 0
3801
3854
  fi
3802
3855
  i=$((i + 1))
@@ -3814,6 +3867,7 @@ team_pm_start() {
3814
3867
  team_dim " 手工复现:在隔离窗口跑诊断中的 render;或写绝对路径:TEAM_PM_BIN=/abs/path/<cli> $TEAM_CLI up" >&2
3815
3868
  team_dim " 常见原因:CLI 在窗口的登录 PATH 里不存在(本工具已把裸名字换成解析出的绝对路径)、参数/模型不认、未登录" >&2
3816
3869
  team_pm_abort_uncommitted "$target"
3870
+ TEAM_PM_START_OUTCOME='failed'
3817
3871
  return 1
3818
3872
  }
3819
3873
 
@@ -4235,6 +4289,22 @@ team_tmp_root_ancestor_note() { # <path> → "" 或「(尚未创建,按 <祖
4235
4289
  printf '(尚未创建,按 %s 的文件系统判)' "$a"
4236
4290
  }
4237
4291
 
4292
+ # ---------------------------------------------------------------- 只读面的子进程环境(P427)
4293
+ # 只读面不许替操作者把根建出来(规格 verification:`never created by a read-only surface`),
4294
+ # 也**不许把这份写入挪到另一个目录**去换个地方污染(独立复核 2026-11-09:把子进程 TMPDIR 指到
4295
+ # 最近的存在祖先,于是缓存落在了被检的基准目录里 —— 只是换了个地方留下东西)。
4296
+ # 写入的来源是**子进程自己**:Node ≥ 23 的编译缓存、jiti 的转换缓存、pi 插件(magic-context)的
4297
+ # 日志默认都落在 `os.tmpdir()` 下,并会把那个目录递归建出来。2026-11-07 夜间实测:
4298
+ # `TMPDIR=<尚不存在的目录> pi --version` 把整个根建了出来(里面是 `node-compile-cache/`)。
4299
+ # 所以只读面交给子进程的不是「另一个临时目录」,而是**关掉这些写入的开关**(探针命令用环境变量
4300
+ # 关缓存是既有做法,同 GIT_OPTIONAL_LOCKS=0 / PIP_NO_CACHE_DIR=1);TMPDIR 原样不动。
4301
+ # 根不存在时:余量行照旧按最近的存在祖先判、报告照旧读解析出的那个根。
4302
+ # 新的写入者会被 §40 咬住(「显式根跑完仍然不存在」「默认基准下一个条目没多」)—— 到那时在这里
4303
+ # 补一个开关,而不是换目录。
4304
+ team_readonly_run() { # <cmd> [args...] → 子进程的 stdout/stderr/rc 原样
4305
+ NODE_DISABLE_COMPILE_CACHE=1 JITI_FS_CACHE=false MAGIC_CONTEXT_LOG_PATH=/dev/null "$@"
4306
+ }
4307
+
4238
4308
  # 「谁负责建这个还不存在的根」——只对**不存在**的根说话(存在时返回空串)。三条腿三种答案,
4239
4309
  # 绝不用一句话糊过去(V59 §1.4:把「不会被创建」这层意思按 source 挡住,配置来的根就只剩「还没有」,
4240
4310
  # 读者会以为它会自己出现):
@@ -78,39 +78,41 @@ window, one process, the tick keeps logging. `team pulse up` restores the consol
78
78
 
79
79
  ## The project-settings view (P22)
80
80
 
81
- The settings overlay (`,`) carries one navigation row — `项目设置` / `Project settings` — which opens the
82
- project-settings view. It replaces the page's blocks (title band, tabs and key band stay) and lists the project
83
- contract from `team __panel-data --block settings`, whose payload is exactly `team config list --json`: one row
84
- per schema key plus one per key the file carries that the schema does not know, grouped by the **functional
85
- group the command reports** (the schema row's `group`, rendered as a section rule), with the file's value, the
86
- schema's default for an unset key, the line's own inline comment, the effect-class badge and the command's
87
- warning/route text. `↑`/`↓` walk the row window (a click focuses a row, a second click opens it), `/` opens the
88
- compose editor in `filter` mode (matches label, raw key, value, category or assignment; `esc` clears), and `esc`
89
- returns to the overlay row it was opened from (`q` keeps its global collapse meaning). A `refuse` row opens no
90
- editor — the command's route is shown. An editable row opens the compose line's `setting` mode holding the
91
- file's value (or the schema default): the first `enter` runs `team config set … --dry-run` and renders the
92
- confirmation (the class's timing; a danger reply needs one more `enter`), the second `enter` runs
93
- `team config set … --yes` with the fingerprint pinned when the editor opened; the exit code maps to the receipt
94
- and every settle re-reads the list and the audit footer.
95
-
96
- Under the keys, the same view separates **future policy** from **committed records** (P232). The categories
97
- block lists one row per `TEAM_TASK_MODELS` entry in the read's own order; `enter` opens a picker built from the
98
- project's known models plus a free-text entry (no removal entry: the writer has none) and every accept writes
99
- through `team config set-task-model <category> <model>` — the pair list is never composed in the console. The
100
- category receipt says the write affects new tasks only and that a committed task keeps its model/SID. The
101
- `TEAM_TASK_MODELS` row itself routes to that block instead of opening an editor, and `TEAM_PM_MODEL` keeps its
102
- ordinary model editor (`team config set TEAM_PM_MODEL …`). The assignments block below is **read-only**: one row
103
- per seat showing the committed `state/<seat>.env` record (task, category, complete model, `selected_via`/
104
- `launch_via`, SID) plus the PM's own `state/pm-launch.env` record — a seat without a complete record says so
105
- rather than borrowing the policy's model. Nothing in the view restarts a pulse, a PM or a seat; a legacy
106
- contract (retired model keys) shows the command's migration diagnosis, naming the CLI route, and offers no
107
- seat/default editor.
108
-
109
- The view is console-only: `--print`/`--json` never read it, a parked console spawns no `settings` child (the
110
- `detail` block's on-demand rule), and the reader rides the open view, never the frame cadence.
111
-
112
- The pty fixtures for it are `tests/panel-p21.sh` (scenarios `settings write conflict categories readonly`, driven
113
- through the real CLI behind an argv-logging wrapper).
81
+ The settings overlay (',') opens **Project settings**. The default list puts every reported task category
82
+ first, followed by PM model, concurrent tasks by model, check interval, PM recoveries per hour and startup
83
+ update check. **Project commands** contains install command, acceptance command and acceptance time limit;
84
+ **Model records** contains committed assignments and the last PM startup, not live-process claims.
85
+ Esc returns to the originating entry, then the original overlay focus. No navigation is persisted.
86
+
87
+ The settings read remains `team __panel-data --block settings` / `team config list --json`. The UI selects
88
+ eight existing keys plus the actual category rows; it does not mirror the full CLI schema or use its groups
89
+ as UI headings. Excluded keys stay available through the full CLI and cannot reappear through search.
90
+ Values, defaults, choices, permissions and genuine warnings/repair routes remain command-owned.
91
+ Ordinary rows show effective values without repeated raw keys, comments, default markers or class badges.
92
+ Only the selected operation carries necessary new-task/PM/Pulse timing.
93
+
94
+ Arrows and the wheel use the current list; click once to focus and twice to open. Search matches the current
95
+ view's labels, identifiers and values; Esc clears the filter. Lists and pickers fill the card and scroll when
96
+ long. Model records expose full task/category/model/session/provenance fields; Enter opens scrollable full
97
+ details, including long values and error/repair text. Missing and unreadable assignment records remain distinct.
98
+
99
+ Ordinary options validate and save on one accept; free input opens with the original value and requires an
100
+ old/new confirmation; danger still needs its extra confirmation. The model-concurrency editor changes applicable
101
+ model and simultaneous quantity fields in one unsaved draft. Add/remove affect only that draft, 0 means no
102
+ limit from that entry, and final save confirms/writes one complete `TEAM_MODEL_LIMITS` value. Untouched tokens,
103
+ order and duplicates remain; an actual edit joins tokens with spaces. Cancel, invalid and stale writes preserve
104
+ configuration bytes. Malformed source stays available in the existing whole-value editor, without discarding
105
+ bad tokens. An empty value is not deletion or a promise to disable runtime defaults.
106
+
107
+ Writes still use only `team config set` or per-category `set-task-model`, with actor panel, the opening
108
+ fingerprint, validation and background settle re-read. The console never reads the audit log or executes
109
+ install/acceptance/restart commands. Category changes affect new tasks, PM model changes require
110
+ `team up --fresh-pm`, and check-interval changes require `team pulse restart`.
111
+ The views remain console-only: parked settings, `--print` and `--json` never request the settings block.
112
+
113
+ The existing pty batch is `tests/panel-p21.sh settings groups wheel choices choices-schema write conflict
114
+ categories readonly flip`. Implementation checks are static; an independent verifier runs that batch once
115
+ against a frozen candidate, with the original two product mutations and normal policy finish.
114
116
 
115
117
  ## Compose and the three actions (pulse-console B2)
116
118