teamsmith 0.4.5 → 0.4.6
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 +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +13 -1
- package/skills/teamsmith/SKILL.md +1 -1
- package/skills/teamsmith/extension/team-bg.ts +7 -8
- package/skills/teamsmith/extension/team-inbox-watch.ts +136 -3
- package/skills/teamsmith/references/protocol.md +2 -3
- package/skills/teamsmith/references/reminders.md +55 -12
- package/skills/teamsmith/references/workflows.md +1 -3
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +18 -1
- package/skills/teamsmith/scripts/lib/cmd-project.sh +12 -9
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +49 -10
- package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +281 -155
- package/skills/teamsmith/scripts/lib/common.sh +74 -14
- package/skills/teamsmith/scripts/panel/panel.js +134 -134
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +10 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +27 -0
- package/skills/teamsmith/scripts/remind-store.mjs +362 -6
- package/skills/teamsmith/scripts/remind-tick.mjs +102 -0
- package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
- package/skills/teamsmith/scripts/state-authority.mjs +265 -17
- package/skills/teamsmith/scripts/strings/commands.tsv +3 -3
- package/skills/teamsmith/scripts/strings/help.en.tsv +12 -12
- package/skills/teamsmith/scripts/strings/help.zh.tsv +12 -12
- package/skills/teamsmith/scripts/team +3 -3
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +2 -3
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +11 -5
- package/skills/teamsmith/tests/death-cause.sh +5 -0
- package/skills/teamsmith/tests/help-surface.sh +15 -150
- package/skills/teamsmith/tests/isolation-ledger.sh +85 -0
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
- package/skills/teamsmith/tests/live-capture-probe.sh +12 -2
- package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
- package/skills/teamsmith/tests/remind-delivery-node.mjs +176 -0
- package/skills/teamsmith/tests/remind-delivery.sh +611 -0
- package/skills/teamsmith/tests/section-paths.tsv +6 -6
- package/skills/teamsmith/tests/smoke.sh +397 -107
- package/skills/teamsmith/tests/state-authority.sh +246 -26
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +58 -8
- package/skills/teamsmith/tests/tmux-identity-leak.sh +12 -16
- package/skills/teamsmith-init/SKILL.md +1 -1
|
@@ -7,14 +7,19 @@
|
|
|
7
7
|
# 别的项目的状态根都被拒绝,且拒绝发生在建目录之前。
|
|
8
8
|
# 1.2 版本化快照 + flock 事务:Bash/Node 不同 TMPDIR 并发仍然逐个序号;持锁者被杀后立刻恢复;
|
|
9
9
|
# 损坏 / 不支持版本 / 半个快照是显式失败且一个字节都不改;原子写在被杀写入者下不露半个文件。
|
|
10
|
+
# 1.3 待命:旧 state/standby 只由迁移搬一次(原因/时间保留、代次不加、重复跑不变),读/写全走
|
|
11
|
+
# 统一状态(迁移后旧文件不再是真相),只读路径不写盘,代次每次 on 递增,缺 flock 显式失败。
|
|
10
12
|
#
|
|
11
13
|
# 红侧(各自具名,都用**同一个**判据判定,变异体在 scratch 副本上,产品与工作树不动):
|
|
12
14
|
# --flip=unlocked 把事务助手换成不持锁的直写 → 并发序号断言必须红
|
|
13
15
|
# --flip=version 删掉快照版本检查 → “版本 2 必须被拒”必须红
|
|
14
16
|
# --flip=foreign 删掉外来项目检查 → “别的项目的 .pi/team 必须被拒”必须红
|
|
15
17
|
# --flip=manifest 把隔离清单退回“整段跳过 state/” → “state/ 下的杂散文件必须被报”必须红
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
+
# --flip=standby-ignore 迁移不读旧标记 → “迁移保留原因/时间”必须红
|
|
19
|
+
# --flip=standby-file 读路径退回旧标记文件 → “迁移后旧标记不再是真相”必须红
|
|
20
|
+
# --flip=standby-write 写待命退回 state/standby → “写入后统一状态记下 on”必须红
|
|
21
|
+
# 不带 --flip 时七条臂全跑;带一条时只跑那一条,其余臂跳过(跳过即不计入,不是通过)。
|
|
22
|
+
# 用法:bash tests/state-authority.sh [--flip=unlocked|version|foreign|manifest|standby-ignore|standby-file|standby-write]
|
|
18
23
|
# 退出码:0 全绿 / 1 有失败 / 2 参数不认识 / 3 前提缺失(JS 运行时或 flock;可见跳过,不算通过)
|
|
19
24
|
set -uo pipefail
|
|
20
25
|
|
|
@@ -26,15 +31,15 @@ FLIP=""
|
|
|
26
31
|
flip_err() { printf 'state-authority: %s\n' "$1" >&2; }
|
|
27
32
|
for arg in "$@"; do
|
|
28
33
|
case "$arg" in
|
|
29
|
-
--flip=unlocked|--flip=version|--flip=foreign|--flip=manifest)
|
|
34
|
+
--flip=unlocked|--flip=version|--flip=foreign|--flip=manifest|--flip=standby-ignore|--flip=standby-file|--flip=standby-write)
|
|
30
35
|
if [ -n "$FLIP" ] && [ "$FLIP" != "${arg#--flip=}" ]; then
|
|
31
36
|
flip_err "互相冲突的 --flip($FLIP / ${arg#--flip=}):一次只跑一条臂"; exit 2
|
|
32
37
|
fi
|
|
33
38
|
FLIP="${arg#--flip=}" ;;
|
|
34
39
|
--flip=*)
|
|
35
|
-
flip_err "不认识的 --flip 值 [${arg#--flip=}];只接受 unlocked|version|foreign|manifest"; exit 2 ;;
|
|
40
|
+
flip_err "不认识的 --flip 值 [${arg#--flip=}];只接受 unlocked|version|foreign|manifest|standby-ignore|standby-file|standby-write"; exit 2 ;;
|
|
36
41
|
-h|--help)
|
|
37
|
-
printf 'usage: bash tests/state-authority.sh [--flip=unlocked|version|foreign|manifest]\n'; exit 0 ;;
|
|
42
|
+
printf 'usage: bash tests/state-authority.sh [--flip=unlocked|version|foreign|manifest|standby-ignore|standby-file|standby-write]\n'; exit 0 ;;
|
|
38
43
|
*)
|
|
39
44
|
flip_err "不认识的参数 [$arg](只接受 --flip=<unlocked|version|foreign|manifest>)"; exit 2 ;;
|
|
40
45
|
esac
|
|
@@ -206,7 +211,10 @@ else
|
|
|
206
211
|
fi
|
|
207
212
|
[ ! -e "$ROOT/alt-state" ] && ok "冲突的 override 被拒绝时没有建出第二个权威目录" || bad "冲突的 override 留下了目录 $ROOT/alt-state"
|
|
208
213
|
|
|
209
|
-
|
|
214
|
+
# A caller may deliberately point at another project's state root; the authority must refuse it
|
|
215
|
+
# itself. Mark it as explicit for this invocation so the shell's inherited-value rewrite (P420) does
|
|
216
|
+
# not quietly turn it back into this project's own root before the authority sees it.
|
|
217
|
+
out="$(runchild "$C" TEAM_STATE_DIR="$B/.pi/team/state" TEAM_STATE_DIR_EXPLICIT=1 -- "$PREP; team_authority_state_root" 2>&1)"; rc=$?
|
|
210
218
|
if [ "$rc" -ne 0 ] && case "$out" in *"inside another project's .pi/team"*) true ;; *) false ;; esac; then
|
|
211
219
|
ok "别的项目的 .pi/team 作为状态根:显式拒绝(inside another project's .pi/team)"
|
|
212
220
|
else
|
|
@@ -436,16 +444,133 @@ else
|
|
|
436
444
|
note "(有残留 .tmp,但它们被忽略;上面已验证读者不受影响)"
|
|
437
445
|
fi
|
|
438
446
|
|
|
439
|
-
# ---------------------------------------------------------------- 9. 1.3
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
# ---------------------------------------------------------------- 9. 待命:唯一写点 + 一次性迁移(1.3)
|
|
448
|
+
# 旧标记的形状:`<时间戳> <原因>`(旧写入者没有原因时写 `-`)。现场由夹具自己造(不碰真项目)。
|
|
449
|
+
sb() { runchild "$1" -- "$PREP; $2"; } # <仓库> <bash 片段(在 PREP 之后)>
|
|
450
|
+
E_STATE="$E/.pi/team/state"
|
|
451
|
+
mkdir -p "$E_STATE"
|
|
452
|
+
MARKER="$E_STATE/standby"
|
|
453
|
+
printf '2026-10-29T10:00:00Z waiting for human\n' >"$MARKER"
|
|
454
|
+
pi_tree() { ( cd "$1" && find .pi -type f 2>/dev/null | sort | while IFS= read -r f; do printf '%s %s\n' "$f" "$(sha256sum "$f" | cut -d' ' -f1)"; done ); }
|
|
455
|
+
|
|
456
|
+
# ① 只读路径认旧标记(升级中的团队不许被读成「没有待命」),且不写盘
|
|
457
|
+
E_BEFORE="$(pi_tree "$E")"
|
|
458
|
+
out="$(sb "$E" 'team_standby_status')"; rc=$?
|
|
459
|
+
assert_eq_local "①a 旧标记还在时 status 读出 on 与原时间/原因(不是「没有待命」)" \
|
|
460
|
+
"$(printf '%s\n' "$out" | sed -n 1p)" "standby: on(自 2026-10-29T10:00:00Z,原因:waiting for human)"
|
|
461
|
+
assert_eq_local "①b status 读 rc" "$rc" "0"
|
|
462
|
+
assert_eq_local "①c 未迁移时如实提示迁移" "$(printf '%s\n' "$out" | sed -n 2p)" \
|
|
463
|
+
"(旧标记还没并入统一状态:跑 team standby migrate 完成迁移)"
|
|
464
|
+
out="$(sb "$E" 'team_in_standby; printf "rc=%s" "$?"')"
|
|
465
|
+
assert_eq_local "①d 巡检/面板读到同一个 on" "$out" "rc=0"
|
|
466
|
+
assert_eq_local "①e 原因原样读出" "$(sb "$E" 'team_standby_reason')" "waiting for human"
|
|
467
|
+
E_AFTER="$(pi_tree "$E")"
|
|
468
|
+
assert_eq_local "①f 只读路径不建定位器、不发布快照(展示路径不写盘)" "$E_AFTER" "$E_BEFORE"
|
|
469
|
+
[ -e "$E/.pi/team/reminder-locator.json" ] && bad "①g 只读路径建出了定位器(展示路径写盘了)" || ok "①g 只读路径没有建定位器"
|
|
470
|
+
|
|
471
|
+
# ② 写待命:旧标记在同一个事务里并被导入,快照发布后才退役(一次搬完)
|
|
472
|
+
out="$(sb "$E" 'team_standby_on "after the upgrade"')"; rc=$?
|
|
473
|
+
E_SNAP="$E_STATE/reminders/state.json"
|
|
474
|
+
assert_eq_local "②a 首次写待命 rc" "$rc" "0"
|
|
475
|
+
[ ! -e "$MARKER" ] && ok "②b 旧标记不再是真相(state/standby 已不在)" || bad "②b 旧标记还立在 state/standby"
|
|
476
|
+
[ -f "$E_STATE/standby.migrated" ] && ok "②c 旧标记改名为 standby.migrated(留证据、不删)" || bad "②c 退役时没有留下 standby.migrated"
|
|
477
|
+
assert_eq_local "②d 写入后统一状态:on" "$(jget "$(cat "$E_SNAP")" standby.on)" "true"
|
|
478
|
+
assert_eq_local "②e 写入后统一状态:代次 1(迁移不占代,on 加一代)" "$(jget "$(cat "$E_SNAP")" standby.generation)" "1"
|
|
479
|
+
assert_eq_local "②f 写入后统一状态:原因就是新给的" "$(jget "$(cat "$E_SNAP")" standby.reason)" "after the upgrade"
|
|
480
|
+
assert_eq_local "②g 统一状态记下迁移已完成" "$(jget "$(cat "$E_SNAP")" standby.migrated)" "true"
|
|
481
|
+
|
|
482
|
+
# ③ 显式迁移:原因/时间保留,代次不加(gen 仍 0)
|
|
483
|
+
I="$(make_repo I)" || { bad "夹具建不出仓库 I"; result; exit 1; }
|
|
484
|
+
I_STATE="$I/.pi/team/state"; I_SNAP="$I_STATE/reminders/state.json"
|
|
485
|
+
mkdir -p "$I_STATE"
|
|
486
|
+
printf '2026-10-30T08:30:00Z human is deciding\n' >"$I_STATE/standby"
|
|
487
|
+
out="$(sb "$I" 'team_standby_migrate')"; rc=$?
|
|
488
|
+
assert_eq_local "③a 显式迁移 rc" "$rc" "0"
|
|
489
|
+
assert_eq_local "③b 迁移后仍是 on,原因与时间都保留" "$(printf '%s\n' "$out" | sed -n 1p)" \
|
|
490
|
+
"standby: on(自 2026-10-30T08:30:00Z,原因:human is deciding)"
|
|
491
|
+
assert_eq_local "③c 迁移不加代次(仍 0)" "$(jget "$(cat "$I_SNAP")" standby.generation)" "0"
|
|
492
|
+
assert_eq_local "③d 迁移后的原因" "$(jget "$(cat "$I_SNAP")" standby.reason)" "human is deciding"
|
|
493
|
+
assert_eq_local "③e 迁移后的时间" "$(jget "$(cat "$I_SNAP")" standby.since)" "2026-10-30T08:30:00Z"
|
|
494
|
+
[ ! -e "$I_STATE/standby" ] && [ -f "$I_STATE/standby.migrated" ] && ok "③f 旧标记已退役" || bad "③f 迁移后旧标记仍立着"
|
|
495
|
+
|
|
496
|
+
# ④ 重复迁移:状态不变、代次不变、不多出第二份证据
|
|
497
|
+
I_H1="$(sha256sum "$I_SNAP" | cut -d' ' -f1)"
|
|
498
|
+
out="$(sb "$I" 'team_standby_migrate')"; rc=$?
|
|
499
|
+
I_H2="$(sha256sum "$I_SNAP" | cut -d' ' -f1)"
|
|
500
|
+
assert_eq_local "④a 重复迁移 rc" "$rc" "0"
|
|
501
|
+
assert_eq_local "④b 重复迁移一个字节都不写(快照哈希不变)" "$I_H2" "$I_H1"
|
|
502
|
+
assert_eq_local "④c 重复迁移提示无需迁移" "$(printf '%s\n' "$out" | sed -n 2p)" "迁移:无需迁移(统一状态已记录待命开启)"
|
|
503
|
+
assert_eq_local "④d 重复迁移没有多出第二份旧标记" "$(find "$I_STATE" -maxdepth 1 -name 'standby.migrated*' | wc -l | tr -d ' ')" "1"
|
|
504
|
+
assert_eq_local "④e 代次仍是 0" "$(jget "$(cat "$I_SNAP")" standby.generation)" "0"
|
|
505
|
+
|
|
506
|
+
# ⑤ 迁移之后:旧文件不再被当成真相(手写一个旧标记,读到的仍是统一状态)
|
|
507
|
+
sb "$I" 'team_standby_off' >/dev/null
|
|
508
|
+
assert_eq_local "⑤a off 之后 status 是 off" "$(sb "$I" 'team_standby_status')" "standby: off"
|
|
509
|
+
printf '2026-11-02T00:00:00Z stale marker from an old writer\n' >"$I_STATE/standby"
|
|
510
|
+
assert_eq_local "⑤b 手写旧标记改不动真相(仍 off)" "$(sb "$I" 'team_standby_status')" "standby: off"
|
|
511
|
+
assert_eq_local "⑤c 巡检也不会被旧标记叫错" "$(sb "$I" 'team_in_standby; printf "rc=%s" "$?"')" "rc=1"
|
|
512
|
+
out="$(sb "$I" 'team_standby_migrate')"
|
|
513
|
+
[ -f "$I_STATE/standby.migrated.1" ] && [ ! -e "$I_STATE/standby" ] && ok "⑤d 残留的旧标记被清掉(改名为 standby.migrated.1,不删)" \
|
|
514
|
+
|| bad "⑤d 残留的旧标记没有被清掉"
|
|
515
|
+
assert_eq_local "⑤e 清残留不改待命状态(仍 off)" "$(sb "$I" 'team_standby_status')" "standby: off"
|
|
516
|
+
assert_eq_local "⑤f 清残留不加代次" "$(jget "$(cat "$I_SNAP")" standby.generation)" "0"
|
|
517
|
+
|
|
518
|
+
# ⑥ 代次语义:每次 on 都是新的一代,off 不动代次、重复 off 不写盘
|
|
519
|
+
J="$(make_repo J)" || { bad "夹具建不出仓库 J"; result; exit 1; }
|
|
520
|
+
J_SNAP="$J/.pi/team/state/reminders/state.json"
|
|
521
|
+
sb "$J" 'team_standby_on "first"' >/dev/null
|
|
522
|
+
assert_eq_local "⑥a 第一次 on:代次 1" "$(jget "$(cat "$J_SNAP")" standby.generation)" "1"
|
|
523
|
+
sb "$J" 'team_standby_on "second"' >/dev/null
|
|
524
|
+
assert_eq_local "⑥b 已在待命时再 on:代次 2(代次不重用)" "$(jget "$(cat "$J_SNAP")" standby.generation)" "2"
|
|
525
|
+
assert_eq_local "⑥c 再 on 之后原因是新的" "$(jget "$(cat "$J_SNAP")" standby.reason)" "second"
|
|
526
|
+
sb "$J" 'team_standby_off' >/dev/null
|
|
527
|
+
assert_eq_local "⑥d off 不动代次" "$(jget "$(cat "$J_SNAP")" standby.generation)" "2"
|
|
528
|
+
J_H1="$(sha256sum "$J_SNAP" | cut -d' ' -f1)"
|
|
529
|
+
sb "$J" 'team_standby_off' >/dev/null
|
|
530
|
+
J_H2="$(sha256sum "$J_SNAP" | cut -d' ' -f1)"
|
|
531
|
+
assert_eq_local "⑥e 重复 off 不改状态(快照一字不动)" "$J_H2" "$J_H1"
|
|
532
|
+
sb "$J" 'team_standby_on "third"' >/dev/null
|
|
533
|
+
assert_eq_local "⑥f off 之后 on:代次 3" "$(jget "$(cat "$J_SNAP")" standby.generation)" "3"
|
|
534
|
+
|
|
535
|
+
# ⑦ 没有 flock:显式失败,不静默成功(也不留下半个旧标记)
|
|
536
|
+
L="$(make_repo L)" || { bad "夹具建不出仓库 L"; result; exit 1; }
|
|
537
|
+
L_STATE="$L/.pi/team/state"
|
|
538
|
+
mkdir -p "$L_STATE"
|
|
539
|
+
printf '2026-11-03T00:00:00Z no flock here\n' >"$L_STATE/standby"
|
|
540
|
+
NOFLOCK="$ROOT/flip/noflock-bin"
|
|
541
|
+
if mkdir -p "$NOFLOCK" && for f in /usr/bin/*; do b="${f##*/}"; [ "$b" = flock ] && continue; [ -e "$NOFLOCK/$b" ] || ln -s "$f" "$NOFLOCK/$b"; done; then
|
|
542
|
+
out="$(runchild "$L" NOFLOCK="$NOFLOCK" TEAM_JS_BIN="$RUNNER" -- "$PREP; PATH=\"\$NOFLOCK\" team_standby_on x >/dev/null 2>&1; printf 'rc=%s' \"\$?\"" 2>&1)"
|
|
543
|
+
if [ "$out" = "rc=1" ]; then
|
|
544
|
+
ok "⑦a 缺 flock:写待命退出码是 1(不是静默成功)"
|
|
545
|
+
else
|
|
546
|
+
bad "⑦a 缺 flock 时退出码不对([$out])"
|
|
547
|
+
fi
|
|
548
|
+
out="$(runchild "$L" NOFLOCK="$NOFLOCK" TEAM_JS_BIN="$RUNNER" -- "$PREP; PATH=\"\$NOFLOCK\" team_standby_on x 2>&1; printf ' rc=%s' \"\$?\"" 2>&1)"
|
|
549
|
+
if case "$out" in *"flock unavailable"*) true ;; *) false ;; esac; then
|
|
550
|
+
ok "⑦b 缺 flock:报错点名 flock(安装一个可用的,不落回无锁写)"
|
|
551
|
+
else
|
|
552
|
+
bad "⑦b 缺 flock 的报错没有点名 flock(输出:$(printf '%s' "$out" | tr '\n' '|'))"
|
|
553
|
+
fi
|
|
554
|
+
out="$(runchild "$J" NOFLOCK="$NOFLOCK" TEAM_JS_BIN="$RUNNER" -- "$PREP; PATH=\"\$NOFLOCK\" team_standby_status 2>&1; printf ' rc=%s' \"\$?\"" 2>&1)"
|
|
555
|
+
# 已钉住权威的项目:读要走事务锁,没有 flock 就不能算读过(不静默降级成 off)。
|
|
556
|
+
if case "$out" in *"flock unavailable"*) true ;; *) false ;; esac; then
|
|
557
|
+
ok "⑦c 缺 flock:已钉住的项目读也不静默降级成 off"
|
|
558
|
+
else
|
|
559
|
+
bad "⑦c 缺 flock 时读静默给了个结果(输出:$(printf '%s' "$out" | tr '\n' '|'))"
|
|
560
|
+
fi
|
|
561
|
+
# 未钉住的项目还没有权威快照可读:读只答旧标记(不需要锁),而且不能答成 off。
|
|
562
|
+
out="$(runchild "$L" NOFLOCK="$NOFLOCK" TEAM_JS_BIN="$RUNNER" -- "$PREP; PATH=\"\$NOFLOCK\" team_standby_status 2>&1; printf ' rc=%s' \"\$?\"" 2>&1)"
|
|
563
|
+
if case "$out" in *"standby: on(自 2026-11-03T00:00:00Z,原因:no flock here)"*) true ;; *) false ;; esac; then
|
|
564
|
+
ok "⑦d 缺 flock:未钉住的项目仍从旧标记读出 on(不需要锁,也不答成 off)"
|
|
565
|
+
else
|
|
566
|
+
bad "⑦d 缺 flock 时旧标记没被如实读出(输出:$(printf '%s' "$out" | tr '\n' '|'))"
|
|
567
|
+
fi
|
|
568
|
+
assert_eq_local "⑦e 缺 flock 时旧标记原样未动" "$(cat "$L_STATE/standby")" "2026-11-03T00:00:00Z no flock here"
|
|
569
|
+
[ ! -e "$L/.pi/team/reminder-locator.json" ] && [ ! -e "$L_STATE/reminders" ] && ok "⑦f 缺 flock 时没有建出定位器或快照" \
|
|
570
|
+
|| bad "⑦f 缺 flock 时留下了定位器/快照"
|
|
571
|
+
else
|
|
572
|
+
note "跳过 ⑦(这台机器上造不出没有 flock 的 PATH)"
|
|
573
|
+
fi
|
|
449
574
|
|
|
450
575
|
# ---------------------------------------------------------------- 10. 红侧:同一个判据,改坏实现必须红
|
|
451
576
|
flip_copy() { # <名字> <sed 表达式> —— 变异必须真的改到(否则红侧就是橡皮章)
|
|
@@ -453,6 +578,12 @@ flip_copy() { # <名字> <sed 表达式> —— 变异必须真的改到(否
|
|
|
453
578
|
sed -i "$2" "$ROOT/flip/$1.mjs" || return 1
|
|
454
579
|
! cmp -s "$SKILL/scripts/state-authority.mjs" "$ROOT/flip/$1.mjs"
|
|
455
580
|
}
|
|
581
|
+
# 直接跑 scratch 助手(不经 bash 入口):输出与退出码原样拿来比对。
|
|
582
|
+
flip_helper() { # <helper> <repo> <state> <op> [args…] → 打印输出
|
|
583
|
+
local helper="$1" repo="$2" state="$3"; shift 3
|
|
584
|
+
( cd "$repo" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_PROJECT -u TEAM_SESSION HOME="$ROOT/home" \
|
|
585
|
+
"$RUNNER" "$helper" --cli "$repo" "$state" "$@" 2>&1 )
|
|
586
|
+
}
|
|
456
587
|
# 10a. 不持锁的直写:只把生产代码里那条 flock 调用换成直接事务(一行之差,不放大任何窗口)
|
|
457
588
|
if arm_selected unlocked; then
|
|
458
589
|
FLIPS_RUN="${FLIPS_RUN:+$FLIPS_RUN,}unlocked"
|
|
@@ -503,10 +634,6 @@ if flip_copy version 's/if (snapshot.version !== SNAPSHOT_VERSION) fail/if (fals
|
|
|
503
634
|
else
|
|
504
635
|
bad "flip 变异没落地(源码形状变了,夹具需要更新)"
|
|
505
636
|
fi
|
|
506
|
-
flip_helper() { # <helper> <repo> <state> <op> → 打印输出
|
|
507
|
-
( cd "$2" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_PROJECT -u TEAM_SESSION HOME="$ROOT/home" \
|
|
508
|
-
"$RUNNER" "$1" --cli "$2" "$3" "$4" 2>&1 )
|
|
509
|
-
}
|
|
510
637
|
cp "$A_STATE/reminders/state.json" "$ROOT/state-good.json"
|
|
511
638
|
sed 's/"version":1/"version":2/' "$ROOT/state-good.json" >"$SNAP"
|
|
512
639
|
out="$(flip_helper "$NODE_HELPER" "$A" "$A_STATE" read)"; rc=$?
|
|
@@ -545,6 +672,96 @@ else
|
|
|
545
672
|
note "跳过红侧臂 foreign(本次 --flip=${FLIP})"
|
|
546
673
|
fi
|
|
547
674
|
|
|
675
|
+
# 10e. 待命迁移的三条红臂:迁移必须真的读旧标记、读/写必须真的走统一状态
|
|
676
|
+
if arm_selected standby-ignore; then
|
|
677
|
+
FLIPS_RUN="${FLIPS_RUN:+$FLIPS_RUN,}standby-ignore"
|
|
678
|
+
if flip_copy standby-ignore 's/^function legacyMarker(state) {/function legacyMarker(state) { return null;/'; then
|
|
679
|
+
ok "flip 变异已落地:迁移不再读旧标记"
|
|
680
|
+
else
|
|
681
|
+
bad "flip 变异没落地(源码形状变了,夹具需要更新)"
|
|
682
|
+
fi
|
|
683
|
+
O="$(make_repo O)" || { bad "夹具建不出仓库 O"; result; exit 1; }
|
|
684
|
+
P="$(make_repo P)" || { bad "夹具建不出仓库 P"; result; exit 1; }
|
|
685
|
+
O_STATE="$O/.pi/team/state"; P_STATE="$P/.pi/team/state"
|
|
686
|
+
mkdir -p "$O_STATE" "$P_STATE"
|
|
687
|
+
printf '2026-10-30T08:30:00Z human is deciding\n' >"$O_STATE/standby"
|
|
688
|
+
printf '2026-10-30T08:30:00Z human is deciding\n' >"$P_STATE/standby"
|
|
689
|
+
flip_helper "$NODE_HELPER" "$P" "$P_STATE" standby-import >/dev/null
|
|
690
|
+
mut_out="$(flip_helper "$ROOT/flip/standby-ignore.mjs" "$O" "$O_STATE" standby-import)"
|
|
691
|
+
orig_reason="$(jget "$(cat "$P_STATE/reminders/state.json")" standby.reason)"
|
|
692
|
+
mut_on="$(jget "$(cat "$O_STATE/reminders/state.json")" standby.on)"
|
|
693
|
+
if [ "$orig_reason" = "human is deciding" ] && [ "$mut_on" = "false" ]; then
|
|
694
|
+
ok "flip(忽略旧标记):原实现保留 on+原因,变异体成了 off、原因也没搬进来 —— ③b/③d 会红"
|
|
695
|
+
else
|
|
696
|
+
bad "flip(忽略旧标记)没被咬住(原 reason=[$orig_reason],变异 on=[$mut_on],输出:$(printf '%s' "$mut_out" | tr '\n' '|'))"
|
|
697
|
+
fi
|
|
698
|
+
else
|
|
699
|
+
note "跳过红侧臂 standby-ignore(本次 --flip=${FLIP})"
|
|
700
|
+
fi
|
|
701
|
+
|
|
702
|
+
if arm_selected standby-file; then
|
|
703
|
+
FLIPS_RUN="${FLIPS_RUN:+$FLIPS_RUN,}standby-file"
|
|
704
|
+
if flip_copy standby-file 's/^ if (snapshot.standby.migrated) return { ...snapshot.standby, legacy: false };/ if (false) return { ...snapshot.standby, legacy: false };/'; then
|
|
705
|
+
ok "flip 变异已落地:读路径退回「旧标记总是算数」"
|
|
706
|
+
else
|
|
707
|
+
bad "flip 变异没落地(源码形状变了,夹具需要更新)"
|
|
708
|
+
fi
|
|
709
|
+
Q="$(make_repo Q)" || { bad "夹具建不出仓库 Q"; result; exit 1; }
|
|
710
|
+
Q_STATE="$Q/.pi/team/state"
|
|
711
|
+
runchild "$Q" -- "$PREP; team_standby_on 'x'; team_standby_off" >/dev/null
|
|
712
|
+
printf '2026-11-02T00:00:00Z stale marker\n' >"$Q_STATE/standby"
|
|
713
|
+
orig_on="$(flip_helper "$NODE_HELPER" "$Q" "$Q_STATE" standby-read --print on)"
|
|
714
|
+
mut_on_file="$(flip_helper "$ROOT/flip/standby-file.mjs" "$Q" "$Q_STATE" standby-read --print on)"
|
|
715
|
+
if [ "$orig_on" = "false" ] && [ "$mut_on_file" = "true" ]; then
|
|
716
|
+
ok "flip(读回文件):原实现仍 off,变异体被旧标记改回 on —— ⑤b 会红"
|
|
717
|
+
else
|
|
718
|
+
bad "flip(读回文件)没被咬住(原 [$orig_on],变异 [$mut_on_file])"
|
|
719
|
+
fi
|
|
720
|
+
rm -f "$Q_STATE/standby"
|
|
721
|
+
else
|
|
722
|
+
note "跳过红侧臂 standby-file(本次 --flip=${FLIP})"
|
|
723
|
+
fi
|
|
724
|
+
|
|
725
|
+
if arm_selected standby-write; then
|
|
726
|
+
FLIPS_RUN="${FLIPS_RUN:+$FLIPS_RUN,}standby-write"
|
|
727
|
+
authority_helper_copy "$ROOT/flip/standby-write.mjs"
|
|
728
|
+
python3 - "$ROOT/flip/standby-write.mjs" <<'PYEOF'
|
|
729
|
+
import sys
|
|
730
|
+
path = sys.argv[1]
|
|
731
|
+
text = open(path).read()
|
|
732
|
+
try:
|
|
733
|
+
start = text.index(" case 'standby-on': {")
|
|
734
|
+
end = text.index(" case 'standby-off': {")
|
|
735
|
+
except ValueError:
|
|
736
|
+
sys.stderr.write('state-authority: standby-write 变异没落地(源码形状变了)\n')
|
|
737
|
+
sys.exit(1)
|
|
738
|
+
replacement = """ case 'standby-on': {
|
|
739
|
+
fs.writeFileSync(legacyMarkerFile(state), `${isoSeconds(nowMs)} ${typeof request.reason === 'string' ? request.reason : '-'}\\n`);
|
|
740
|
+
return standbyResult(snapshot, state);
|
|
741
|
+
}
|
|
742
|
+
"""
|
|
743
|
+
open(path, 'w').write(text[:start] + replacement + text[end:])
|
|
744
|
+
PYEOF
|
|
745
|
+
if [ "$?" -eq 0 ] && ! cmp -s "$SKILL/scripts/state-authority.mjs" "$ROOT/flip/standby-write.mjs"; then
|
|
746
|
+
ok "flip 变异已落地:写待命退回写 state/standby"
|
|
747
|
+
else
|
|
748
|
+
bad "flip 变异没落地(源码形状变了,夹具需要更新)"
|
|
749
|
+
fi
|
|
750
|
+
S="$(make_repo S)" || { bad "夹具建不出仓库 S"; result; exit 1; }
|
|
751
|
+
T="$(make_repo T)" || { bad "夹具建不出仓库 T"; result; exit 1; }
|
|
752
|
+
flip_helper "$NODE_HELPER" "$S" "$S/.pi/team/state" standby-on --reason proof >/dev/null
|
|
753
|
+
flip_helper "$ROOT/flip/standby-write.mjs" "$T" "$T/.pi/team/state" standby-on --reason proof >/dev/null
|
|
754
|
+
orig_snap="$(jget "$(cat "$S/.pi/team/state/reminders/state.json" 2>/dev/null)" standby.on 2>/dev/null)"
|
|
755
|
+
mut_snap="$(jget "$(cat "$T/.pi/team/state/reminders/state.json" 2>/dev/null)" standby.on 2>/dev/null)"
|
|
756
|
+
if [ "$orig_snap" = "true" ] && [ "$mut_snap" != "true" ] && [ -f "$T/.pi/team/state/standby" ]; then
|
|
757
|
+
ok "flip(写回文件):原实现的快照记 on,变异体只写了 state/standby(快照里没有 on)—— ②d 会红"
|
|
758
|
+
else
|
|
759
|
+
bad "flip(写回文件)没被咬住(原快照 on=[$orig_snap],变异快照 on=[$mut_snap],旧标记:$( [ -f "$T/.pi/team/state/standby" ] && echo 有 || echo 无))"
|
|
760
|
+
fi
|
|
761
|
+
else
|
|
762
|
+
note "跳过红侧臂 standby-write(本次 --flip=${FLIP})"
|
|
763
|
+
fi
|
|
764
|
+
|
|
548
765
|
# ---------------------------------------------------------------- 11. 事故形状的证明:主项目 .pi/team 没被碰过
|
|
549
766
|
main_team_snapshot "${REAL_MAIN:-/nonexistent}/.pi/team" >"$REAL_AFTER"
|
|
550
767
|
violations="$(main_team_violations "$REAL_BEFORE" "$REAL_AFTER")"
|
|
@@ -556,14 +773,17 @@ else
|
|
|
556
773
|
bad "主项目 .pi/team 出现了非白名单变化($(printf '%s' "$violations" | tr '\n' ' '))"
|
|
557
774
|
printf '%s\n' "$violations" | head -12 | sed 's/^/ /'
|
|
558
775
|
fi
|
|
559
|
-
# 事故形状(2026-10-31
|
|
560
|
-
|
|
561
|
-
|
|
776
|
+
# 事故形状(2026-10-31:夹具往主项目写了提醒与 Standby 状态):这次运行不许在建这些路径上留下任何动作。
|
|
777
|
+
# 判据是「本夹具没动过它」而不是「它不存在」—— 真实团队的 state/standby 在 PM 迁移前本来就在,
|
|
778
|
+
# 迁移之后 .pi/team/reminder-locator.json 与 state/reminders/ 也会是合法的。
|
|
779
|
+
for leaked in ./.pi/team/reminder-locator.json ./.pi/team/reminder-locator.lock ./.pi/team/state/reminders \
|
|
780
|
+
./.pi/team/state/standby ./.pi/team/state/standby.migrated ./reminder-locator.json; do
|
|
562
781
|
[ -n "$REAL_MAIN" ] || break
|
|
563
|
-
|
|
564
|
-
|
|
782
|
+
touched="$(main_team_touched "$REAL_BEFORE" "$REAL_AFTER" "$leaked")"
|
|
783
|
+
if [ -z "$touched" ]; then
|
|
784
|
+
ok "事故形状:这次运行没动主项目的 ${leaked#./}"
|
|
565
785
|
else
|
|
566
|
-
bad "
|
|
786
|
+
bad "事故形状:夹具写了主项目的 ${leaked#./}($(printf '%s' "$touched" | tr '\n' ' '))"
|
|
567
787
|
fi
|
|
568
788
|
done
|
|
569
789
|
note "证明对象:${REAL_MAIN:-(本检出没有主工作树)}/.pi/team(非白名单路径逐字节;白名单形状按名字放行)"
|
|
@@ -350,8 +350,8 @@ if (only('S2')) {
|
|
|
350
350
|
const ok = await waitFor(() => sent.length > before + 0)
|
|
351
351
|
check('S2 a new spool line wakes the session (fs.watch, polling disabled)', ok && sent.length === before + 1,
|
|
352
352
|
`messages=${sent.length - before}`)
|
|
353
|
-
check('S2 wake is a custom team-inbox message with triggerTurn+
|
|
354
|
-
sent.at(-1)?.msg?.customType === 'team-inbox' && sent.at(-1)?.opts?.triggerTurn === true && sent.at(-1)?.opts?.deliverAs === '
|
|
353
|
+
check('S2 wake is a custom team-inbox message with triggerTurn+steer',
|
|
354
|
+
sent.at(-1)?.msg?.customType === 'team-inbox' && sent.at(-1)?.opts?.triggerTurn === true && sent.at(-1)?.opts?.deliverAs === 'steer',
|
|
355
355
|
JSON.stringify({ customType: sent.at(-1)?.msg?.customType, ...(sent.at(-1)?.opts ?? {}) }))
|
|
356
356
|
const body = lastText()
|
|
357
357
|
check('S2 wake is a pointer to the inbox file, not the payload', body.includes('docs/team/inbox/pm.md'), body.split('\n')[0])
|
|
@@ -1037,9 +1037,9 @@ const degradedFiles = () => (existsSync(WATCH_DIR) ? readdirSync(WATCH_DIR).filt
|
|
|
1037
1037
|
check('S23 a forced-failure session still wakes within one poll interval (200 ms)',
|
|
1038
1038
|
woke && sent.length === beforeWake + 1, `messages=${sent.length - beforeWake}`)
|
|
1039
1039
|
const fallbackWake = sent.at(-1)
|
|
1040
|
-
check('S23 the fallback wake keeps the live-watcher shape (customType/triggerTurn/
|
|
1040
|
+
check('S23 the fallback wake keeps the live-watcher shape (customType/triggerTurn/steer)',
|
|
1041
1041
|
fallbackWake?.msg?.customType === 'team-inbox' && fallbackWake?.opts?.triggerTurn === true
|
|
1042
|
-
&& fallbackWake?.opts?.deliverAs === '
|
|
1042
|
+
&& fallbackWake?.opts?.deliverAs === 'steer',
|
|
1043
1043
|
JSON.stringify({ customType: fallbackWake?.msg?.customType, ...(fallbackWake?.opts ?? {}) }))
|
|
1044
1044
|
const fallbackBody = lastText()
|
|
1045
1045
|
check('S23 the fallback wake points at the inbox and truncates the payload',
|
|
@@ -1121,7 +1121,7 @@ if (only('S25j')) {
|
|
|
1121
1121
|
recs.map(r => `${r.kind}${r.fields.seq ? `=${r.fields.seq}` : ''}`).join(' '))
|
|
1122
1122
|
check('S25j every record is ISO-stamped', recs.every(r => /^\d{4}-\d{2}-\d{2}T/.test(r.ts)), recs[0]?.ts ?? '')
|
|
1123
1123
|
check('S25j the wake ledger line names seq and the identities',
|
|
1124
|
-
/ wake n=1 total=1 inbox=pm kinds=say seq=1 ids=\S
|
|
1124
|
+
/ wake n=1 total=1 inbox=pm kinds=say seq=1 ids=\S+ deliver=steer$/.test(ledger().filter(l => / wake n=/.test(l)).at(-1) ?? ''),
|
|
1125
1125
|
ledger().filter(l => / wake n=/.test(l)).at(-1) ?? '(no wake line)')
|
|
1126
1126
|
// 过期行:不写日志记录、不唤醒、只计数
|
|
1127
1127
|
const before = sent.length
|
|
@@ -1221,7 +1221,7 @@ if (only('S25a')) {
|
|
|
1221
1221
|
woke && sent.length === before + 1, `messages=${sent.length - before}`)
|
|
1222
1222
|
const wakeLine = ledger().filter(l => / wake n=/.test(l)).at(-1) ?? ''
|
|
1223
1223
|
check('S25a the ledger records it as recovery with its seq',
|
|
1224
|
-
/ wake n=1 total=1 inbox=pm kinds=say seq=\d+ ids=\S+ recovery n=1$/.test(wakeLine), wakeLine.trim())
|
|
1224
|
+
/ wake n=1 total=1 inbox=pm kinds=say seq=\d+ ids=\S+ deliver=steer recovery n=1$/.test(wakeLine), wakeLine.trim())
|
|
1225
1225
|
check('S25a the recovery is recorded in the journal as sent (at most once from now on)',
|
|
1226
1226
|
journalOf('sent').length === 1, `sent records=${journalOf('sent').length}`)
|
|
1227
1227
|
// 同一批字节再重写一次 —— **跨一次重启**(重启本身也不得再恢复):证明至多一次是由日志
|
|
@@ -1566,9 +1566,9 @@ if (only('S26')) {
|
|
|
1566
1566
|
check('S26 the wake names the delivery journal the identities were recorded in',
|
|
1567
1567
|
body.includes(journalPathOf()) && existsSync(journalPathOf()),
|
|
1568
1568
|
(body.split('\n').find(l => l.includes('Delivery journal')) ?? '(none)').slice(0, 200))
|
|
1569
|
-
check('S26 the wake shape is unchanged (customType/triggerTurn/
|
|
1569
|
+
check('S26 the wake shape is unchanged (customType/triggerTurn/steer)',
|
|
1570
1570
|
sent.at(-1)?.msg?.customType === 'team-inbox' && sent.at(-1)?.opts?.triggerTurn === true
|
|
1571
|
-
&& sent.at(-1)?.opts?.deliverAs === '
|
|
1571
|
+
&& sent.at(-1)?.opts?.deliverAs === 'steer',
|
|
1572
1572
|
JSON.stringify({ customType: sent.at(-1)?.msg?.customType, ...(sent.at(-1)?.opts ?? {}) }))
|
|
1573
1573
|
check('S26 no payload dump: the wake stays a bounded one-line pointer per line',
|
|
1574
1574
|
body.split('\n').filter(l => l.startsWith('- ')).every(l => l.length <= 220), `len=${body.length}`)
|
|
@@ -1578,6 +1578,56 @@ if (only('S26')) {
|
|
|
1578
1578
|
await shutdown()
|
|
1579
1579
|
}
|
|
1580
1580
|
|
|
1581
|
+
// ── S28(P419)· 投递模式按**消息类别**选:通知等 → followUp;含 say 的批 → steer ────────────
|
|
1582
|
+
// 为什么要按类别:`team say` 是 PM 发给席位的**指令**,`followUp` 要等席位把手上这一轮跑完才投,指令就
|
|
1583
|
+
// 只能排在这一轮之后;`steer` 落在本次工具调用结束后、下一次模型请求之前,插得进正在跑的那一轮。通知类
|
|
1584
|
+
// (notify / nudge / knock / draft 回执)不该打断正在跑的一轮,保持 followUp;混批仍然只投一次,用 steer。
|
|
1585
|
+
// 这一组走 100ms 轮询(不依赖 fs.watch 前提),三种前提(真人/机器不可用/强制失败)下都真跑真判。
|
|
1586
|
+
process.env.TEAM_INBOX_WATCH_POLL_MS = '100'
|
|
1587
|
+
if (only('S28')) {
|
|
1588
|
+
await resetState()
|
|
1589
|
+
await sessionStart()
|
|
1590
|
+
const lastOpts = () => sent.at(-1)?.opts ?? {}
|
|
1591
|
+
// (a) 只含通知的批:三类都还是 followUp(只有 triggerTurn 的老形状)
|
|
1592
|
+
for (const kind of ['notify', 'nudge', 'knock']) {
|
|
1593
|
+
const before = sent.length
|
|
1594
|
+
appendWake(kind, 'dev', 'pm', `S28-${kind}-only`)
|
|
1595
|
+
const woke = await waitFor(() => sent.length > before)
|
|
1596
|
+
check(`S28 a ${kind}-only batch is delivered as followUp`,
|
|
1597
|
+
woke && sent.length === before + 1 && lastOpts().deliverAs === 'followUp' && lastOpts().triggerTurn === true,
|
|
1598
|
+
`messages=${sent.length - before} deliverAs=${lastOpts().deliverAs} triggerTurn=${lastOpts().triggerTurn}`)
|
|
1599
|
+
}
|
|
1600
|
+
// (b) 批里只有一条 say:steer(这条红侧是「类别判定被删掉 → 恒 followUp」)
|
|
1601
|
+
{
|
|
1602
|
+
const before = sent.length
|
|
1603
|
+
appendWake('say', 'pm', 'pm', 'S28-say-instruction')
|
|
1604
|
+
const woke = await waitFor(() => sent.length > before)
|
|
1605
|
+
check('S28 a say batch is delivered as steer',
|
|
1606
|
+
woke && sent.length === before + 1 && lastOpts().deliverAs === 'steer' && lastOpts().triggerTurn === true,
|
|
1607
|
+
`messages=${sent.length - before} deliverAs=${lastOpts().deliverAs}`)
|
|
1608
|
+
check('S28 the steer wake still names its line and the inbox file, never the payload in full',
|
|
1609
|
+
lastText().includes('S28-say-instruction') && lastText().includes('docs/team/inbox/pm.md'),
|
|
1610
|
+
lastText().split('\n')[0])
|
|
1611
|
+
}
|
|
1612
|
+
// (c) 混批(一条通知 + 一条指令落在同一拍):只投一次,且用 steer
|
|
1613
|
+
{
|
|
1614
|
+
const before = sent.length
|
|
1615
|
+
appendWake('notify', 'dev', 'pm', 'S28-mixed-notify')
|
|
1616
|
+
appendWake('say', 'pm', 'pm', 'S28-mixed-say')
|
|
1617
|
+
await sleep(500)
|
|
1618
|
+
const body = lastText()
|
|
1619
|
+
const wakeLine = ledger().filter(l => / wake n=/.test(l)).at(-1) ?? ''
|
|
1620
|
+
check('S28 a mixed batch is delivered once and as steer',
|
|
1621
|
+
sent.length === before + 1 && lastOpts().deliverAs === 'steer',
|
|
1622
|
+
`messages=${sent.length - before} deliverAs=${lastOpts().deliverAs}`)
|
|
1623
|
+
check('S28 the mixed wake carries both lines and its ledger names the category decision',
|
|
1624
|
+
body.includes('S28-mixed-notify') && body.includes('S28-mixed-say')
|
|
1625
|
+
&& / wake n=2 total=\d+ inbox=pm kinds=notify,say seq=\d+ ids=\S+ deliver=steer/.test(wakeLine),
|
|
1626
|
+
wakeLine.trim())
|
|
1627
|
+
}
|
|
1628
|
+
await shutdown()
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1581
1631
|
// ── 反向守卫:真实仓库 state/ 未被触碰 ───────────────────────────────────────
|
|
1582
1632
|
{
|
|
1583
1633
|
const after = snapshot(REAL_STATE)
|
|
@@ -69,6 +69,7 @@ SKILL_DIR="$(cd -P "$SELF_DIR/.." && pwd)"
|
|
|
69
69
|
REPO_ROOT="$(cd -P "$SKILL_DIR/../.." && pwd)"
|
|
70
70
|
# shellcheck source=lib/tmp-root.sh
|
|
71
71
|
. "$SELF_DIR/lib/tmp-root.sh"
|
|
72
|
+
. "$SELF_DIR/lib/main-team-fingerprint.sh"
|
|
72
73
|
|
|
73
74
|
SELECT=""; BREAK=""; KEEP=0
|
|
74
75
|
while [ $# -gt 0 ]; do
|
|
@@ -150,19 +151,14 @@ seg_ran() { TMUX_RAN=$((TMUX_RAN + 1)); }
|
|
|
150
151
|
# ── 反向守卫(只看夹具 cwd):真项目 state 里不许出现带本夹具根的日志行 ─────────────────────────
|
|
151
152
|
REAL_LOG="$REPO_ROOT/.pi/team/state/tmux-calls.log"
|
|
152
153
|
|
|
153
|
-
# ──
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
# 本 worktree 连 .pi/team/ 都没有时,这条退化成「仍然不存在」,报告里如实写明。)
|
|
154
|
+
# ── 隔离断言:本检出的 inbox / state;活团队的具名运行日志允许变化(P426)──────────────────
|
|
155
|
+
# 复用主项目指纹的路径规则,不自建排除表;inbox 与未登记的 state 子目录仍逐文件判变。
|
|
156
|
+
# 本 worktree 没有 state 时,真实现场只证明它仍未出现;非空运行中的对照由 isolation-ledger.sh 覆盖。
|
|
157
157
|
REAL_INBOX="$REPO_ROOT/docs/team/inbox"; REAL_STATE="$REPO_ROOT/.pi/team/state"
|
|
158
|
-
ledger_manifest() { #
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
while IFS= read -r -d '' f; do
|
|
163
|
-
printf '%s\t%s\n' "${f#"$REPO_ROOT"/}" "$(sha256sum "$f" 2>/dev/null | awk '{print $1}')"
|
|
164
|
-
done < <(find "$d" -type f -print0 2>/dev/null | LC_ALL=C sort -z)
|
|
165
|
-
done
|
|
158
|
+
ledger_manifest() { # <inbox 目录> <state 目录> → 共用指纹所用的 ./inbox、./state 路径空间
|
|
159
|
+
{ main_team_snapshot "$1" | awk '{sub(/^\.\//, "./inbox/"); print}'
|
|
160
|
+
main_team_snapshot "$2" | awk '{sub(/^\.\//, "./state/"); print}'
|
|
161
|
+
} | sort -t "$(printf '\t')" -k1,1
|
|
166
162
|
}
|
|
167
163
|
LEDGER_BEFORE="$(ledger_manifest "$REAL_INBOX" "$REAL_STATE")"
|
|
168
164
|
LEDGER_N=$(printf '%s' "$LEDGER_BEFORE" | grep -c . || true)
|
|
@@ -743,11 +739,11 @@ tmp_root_reap_all 2>/dev/null || true
|
|
|
743
739
|
|
|
744
740
|
# ── 隔离断言(任务书 3.1):真实仓库账本面 hash + 本轮临时根 ─────────────────────────────────
|
|
745
741
|
LEDGER_AFTER="$(ledger_manifest "$REAL_INBOX" "$REAL_STATE")"
|
|
746
|
-
|
|
747
|
-
|
|
742
|
+
LEDGER_CHANGES="$(main_team_violations <(printf '%s\n' "$LEDGER_BEFORE") <(printf '%s\n' "$LEDGER_AFTER"))"
|
|
743
|
+
if [ -z "$LEDGER_CHANGES" ]; then
|
|
744
|
+
ok "隔离:真实仓库 inbox 与非遥测 state 未被改动(快照 $LEDGER_N 个文件;显式排除共用白名单中的运行日志)"
|
|
748
745
|
else
|
|
749
|
-
bad "
|
|
750
|
-
diff <(printf '%s\n' "$LEDGER_BEFORE") <(printf '%s\n' "$LEDGER_AFTER") 2>/dev/null | sed 's/^/ /' || true
|
|
746
|
+
bad "隔离:真实仓库 inbox 或非遥测 state 被改动:$(printf '%s' "$LEDGER_CHANGES" | tr '\n' ' ')"
|
|
751
747
|
fi
|
|
752
748
|
ROOTS_AFTER="$(ls -d "$(tmp_root_base)"/teamsmith-tmux-identity-leak-* 2>/dev/null | wc -l | tr -d ' ')"
|
|
753
749
|
if [ "${TEAM_TMP_KEEP:-0}" = "1" ]; then
|
|
@@ -3,7 +3,7 @@ name: teamsmith-init
|
|
|
3
3
|
description: teamsmith-init is the new-project entry point of the teamsmith toolkit — organize multiple agents into a team, set up an agent collaboration protocol, and bootstrap this skill into a new project. It walks the questions to settle with the user first (dependencies, session and roster, the task-category mapping and the independent PM model, gates, VCS mode, install command, and the project's ROADMAP/OWNERSHIP/AGENTS.md red lines), then runs the one command that writes `.pi/team/config.sh` + the `docs/team/` skeleton + the `AGENTS.md` protocol section and starts the pulse, and finally hands day-to-day operation to the `teamsmith` skill. Use when the user wants to bootstrap teamsmith into a new repository, set up a brand-new team, organize multiple agents into a team, or set up an agent collaboration protocol where none exists yet.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.4.
|
|
6
|
+
version: "0.4.6"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# teamsmith-init · bring a new project to "ready to dispatch"
|