teamsmith 0.4.6 → 0.4.7
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.
- package/README.md +6 -6
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +24 -0
- package/skills/teamsmith/SKILL.md +32 -23
- package/skills/teamsmith/extension/team-bg.ts +5 -3
- package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
- package/skills/teamsmith/extension/team-notify.ts +20 -13
- package/skills/teamsmith/extension/team-remind.ts +189 -0
- package/skills/teamsmith/extension/team-reply.ts +4 -7
- package/skills/teamsmith/references/migration.md +101 -0
- package/skills/teamsmith/references/openspec.md +43 -27
- package/skills/teamsmith/references/protocol.md +26 -15
- package/skills/teamsmith/references/reminders.md +153 -161
- package/skills/teamsmith/references/troubleshooting.md +12 -7
- package/skills/teamsmith/references/workflows.md +84 -31
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
- package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
- package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
- package/skills/teamsmith/scripts/lib/common.sh +83 -13
- package/skills/teamsmith/scripts/panel/panel.js +179 -179
- package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
- package/skills/teamsmith/scripts/panel/src/layout.ts +20 -8
- package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
- package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
- package/skills/teamsmith/scripts/remind-store.mjs +55 -24
- package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
- package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
- package/skills/teamsmith/scripts/state-authority.mjs +72 -6
- package/skills/teamsmith/scripts/team +1 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +11 -8
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
- package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +31 -19
- package/skills/teamsmith/templates/report.md.tmpl +33 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
- package/skills/teamsmith/tests/bg-ledger.sh +24 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
- package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
- package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
- package/skills/teamsmith/tests/help-surface.sh +3 -5
- package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
- package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
- package/skills/teamsmith/tests/key-replies.sh +307 -106
- package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
- package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
- package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
- package/skills/teamsmith/tests/remind-cli.sh +108 -3
- package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
- package/skills/teamsmith/tests/remind-delivery.sh +123 -35
- package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
- package/skills/teamsmith/tests/remind-pulse.sh +199 -0
- package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
- package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
- package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
- package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
- package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
- package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
- package/skills/teamsmith/tests/routes.sh +213 -293
- package/skills/teamsmith/tests/section-paths.tsv +10 -8
- package/skills/teamsmith/tests/smoke.sh +484 -28
- package/skills/teamsmith/tests/state-authority.sh +152 -8
- package/skills/teamsmith-init/SKILL.md +5 -5
- 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
|
+
TEAM_VERSION="0.4.7"
|
|
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
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
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
|
# 读者会以为它会自己出现):
|