teamsmith 0.4.3 → 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 +33 -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/reply-capture.mjs +53 -8
- 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 +63 -0
- 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
|
@@ -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.6"
|
|
7
7
|
|
|
8
8
|
# ---------------------------------------------------------------- 输出
|
|
9
9
|
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
|
|
@@ -509,6 +509,7 @@ team_identity_resolve() {
|
|
|
509
509
|
TEAM_IDENTITY_INHERIT_MAIN_ROOT="${TEAM_IDENTITY_INHERIT_MAIN_ROOT-${TEAM_MAIN_ROOT:-}}"
|
|
510
510
|
TEAM_IDENTITY_INHERIT_PROJECT="${TEAM_IDENTITY_INHERIT_PROJECT-${TEAM_PROJECT:-}}"
|
|
511
511
|
TEAM_IDENTITY_INHERIT_SESSION="${TEAM_IDENTITY_INHERIT_SESSION-${TEAM_SESSION:-}}"
|
|
512
|
+
TEAM_IDENTITY_INHERIT_STATE_DIR="${TEAM_IDENTITY_INHERIT_STATE_DIR-${TEAM_STATE_DIR:-}}"
|
|
512
513
|
# 注意:这六个 TEAM_IDENTITY_* 一律**不 export** —— 它们是本进程内部的判定输入,
|
|
513
514
|
# 泄进子进程会让子进程拿父进程的冲突档案去判自己的身份(M40 实测:panel 的 __panel-data 孩子被误拒)。
|
|
514
515
|
# M50:先在父进程上下文把目录身份装进 memo($(…) 子 shell 里的 memo 写留不下来,
|
|
@@ -1147,6 +1148,25 @@ team_load_config() {
|
|
|
1147
1148
|
# TEAM_STATE_DIR 可以被显式指定(夹具把它指到临时目录 → 队列/收件箱一点都不写进真仓库;
|
|
1148
1149
|
# delivery-guard 的 spec 场景「TEAM_STATE_DIR moves the queue」就是这一条)
|
|
1149
1150
|
TEAM_STATE_DIR="${TEAM_STATE_DIR:-$TEAM_MAIN_ROOT/.pi/team/state}"
|
|
1151
|
+
# P420 · state 目录也是「调用者身份」(与上面的身份四件套同一族):继承来的 TEAM_STATE_DIR 指向
|
|
1152
|
+
# **别的项目**的 `.pi/team/state` 时不许采用 —— 否则派单会按别人的席位记录判守卫(实测:PM 窗口里跑
|
|
1153
|
+
# 门禁,沙盒派单读到了真实项目的 state/dev.env),还会把派单提示词与 assignment 写进那个项目。
|
|
1154
|
+
# 临时/替代目录形状照旧生效(夹具靠它)。唯一的例外是 reload:它整条命令就是在写这个目录,
|
|
1155
|
+
# 判据更硬(拒绝并点名两个目录,见 team_cmd_reload)—— 所以这里不替它做决定。
|
|
1156
|
+
# state-authority 自己也在例外名单里:它的定位函数要看到**原始**的 state 根才能拒绝外来项目
|
|
1157
|
+
# (P406 的「inside another project's .pi/team」断言);先在这里替换掉,它就只能看到替换后的值。
|
|
1158
|
+
# Only rewrite an **inherited** value. A caller that explicitly set TEAM_STATE_DIR for this invocation
|
|
1159
|
+
# (the authority fixture, a deliberate alternative root) is not inheritance: the authority must see it
|
|
1160
|
+
# verbatim so it can refuse a foreign root instead of silently landing on the project's own one.
|
|
1161
|
+
# An explicit per-invocation value that names another project is still rejected by the authority's own
|
|
1162
|
+
# locator, so the shell boundary does not need to rewrite it.
|
|
1163
|
+
_sa_inherited=0
|
|
1164
|
+
if [ "${TEAM_STATE_DIR_EXPLICIT:-0}" != 1 ] && [ "${TEAM_STATE_DIR:-}" = "${TEAM_IDENTITY_INHERIT_STATE_DIR:-__unset__}" ] && [ -n "${TEAM_STATE_DIR:-}" ]; then _sa_inherited=1; fi
|
|
1165
|
+
if [ "${CMD:-}" != reload ] && [ "$_sa_inherited" = 1 ] && team_state_dir_foreign; then
|
|
1166
|
+
team_warn "TEAM_STATE_DIR=$TEAM_STATE_DIR 是别的项目的 state 目录(本项目是 $TEAM_MAIN_ROOT/.pi/team/state):继承值被忽略,本命令按本项目执行"
|
|
1167
|
+
team_dim " 清掉继承变量:env -u TEAM_STATE_DIR …(或 cd 到那个项目再执行)" >&2
|
|
1168
|
+
TEAM_STATE_DIR="$TEAM_MAIN_ROOT/.pi/team/state"
|
|
1169
|
+
fi
|
|
1150
1170
|
TEAM_CLI="${TEAM_CLI:-team}"
|
|
1151
1171
|
}
|
|
1152
1172
|
|
|
@@ -1668,11 +1688,33 @@ team_authority_cli() { # <resolve|init|read|allocate> [参数];助手自己取
|
|
|
1668
1688
|
main="$(team_authority_main_root)" || return 1
|
|
1669
1689
|
state="${TEAM_STATE_DIR:-}"
|
|
1670
1690
|
[ -n "$state" ] || { team_err "state-authority:TEAM_STATE_DIR 未解析(先 team_load_config)"; return 1; }
|
|
1691
|
+
# The common layer deliberately tolerates a foreign inherited state directory (it is only a warning for
|
|
1692
|
+
# dispatch paths), but the authority must never silently adopt it: a fixture pointing at another project's
|
|
1693
|
+
# .pi/team/state would otherwise start a second authority over there. The helper's locate() refuses that
|
|
1694
|
+
# shape, so make the shell boundary fail closed as well.
|
|
1695
|
+
# Unlike the ordinary warning in the common layer, this is a fail-closed refusal: the authority must
|
|
1696
|
+
# never silently adopt a foreign root (a fixture pointing at another project's .pi/team/state would
|
|
1697
|
+
# otherwise create a second authority there). Compare canonical paths, because a worktree main root
|
|
1698
|
+
# may be a symlink target different from the directory that was passed in.
|
|
1699
|
+
# Compare against the root the helper itself resolved, not against the environment variable:
|
|
1700
|
+
# inside a fixture that runs from another project's directory the two differ, and the refusal must
|
|
1701
|
+
# fire on the project the authority would actually create.
|
|
1702
|
+
case "$state" in
|
|
1703
|
+
*/.pi/team/state)
|
|
1704
|
+
_sa_other="${state%/.pi/team/state}"
|
|
1705
|
+
if [ -n "$_sa_other" ] && { [ -d "$_sa_other/.git" ] || [ -f "$_sa_other/.git" ]; }; then
|
|
1706
|
+
if [ "$_sa_other" != "$main" ]; then
|
|
1707
|
+
team_err "state-authority:state 根在别的项目的 .pi/team 下(inside another project's .pi/team):$state(本项目 $main/.pi/team/state)——请传本项目自己的状态根"
|
|
1708
|
+
return 2
|
|
1709
|
+
fi
|
|
1710
|
+
fi
|
|
1711
|
+
;;
|
|
1712
|
+
esac
|
|
1671
1713
|
"$runner" "${TEAM_SKILL_DIR:-$(team_skill_dir)}/scripts/state-authority.mjs" --cli "$main" "$state" "$@"
|
|
1672
1714
|
}
|
|
1673
|
-
team_authority_state_root() { team_authority_cli resolve --print stateRoot; }
|
|
1674
|
-
team_authority_init() { team_authority_cli init; }
|
|
1675
|
-
team_authority_read() { team_authority_cli read; }
|
|
1715
|
+
team_authority_state_root() { TEAM_AUTHORITY_CALL=1 team_authority_cli resolve --print stateRoot; }
|
|
1716
|
+
team_authority_init() { TEAM_AUTHORITY_CALL=1 team_authority_cli init; }
|
|
1717
|
+
team_authority_read() { TEAM_AUTHORITY_CALL=1 team_authority_cli read; }
|
|
1676
1718
|
team_authority_allocate() { # <reminder|batch|queue> → 分配到的序号(持久 high-water,不重用)
|
|
1677
1719
|
local kind="${1:-}"
|
|
1678
1720
|
[ -n "$kind" ] || { team_err "state-authority:allocate 需要序号类别(reminder|batch|queue)"; return 1; }
|
|
@@ -2033,6 +2075,24 @@ team_unique_sid() {
|
|
|
2033
2075
|
}
|
|
2034
2076
|
|
|
2035
2077
|
# ---------------------------------------------------------------- 状态(PM 的仪表盘)
|
|
2078
|
+
# 项目身份(M40 同族;P417 的 reload 守卫与 P420 的派单身份共用**这一处**判据):
|
|
2079
|
+
# `<某根>/.pi/team/state` 而那个根不是本项目 = 别的项目的 state 目录。临时/替代目录形状(夹具靠它)
|
|
2080
|
+
# 不算:`TEAM_STATE_DIR` 允许被显式指到任何地方,只有「另一个项目的 state」才是继承事故的形状。
|
|
2081
|
+
team_state_dir_foreign() { # [<目录>](默认 TEAM_STATE_DIR)→ 0 = 看起来是别的项目的 state 目录
|
|
2082
|
+
local dir="${1:-${TEAM_STATE_DIR:-}}" root
|
|
2083
|
+
case "$dir" in
|
|
2084
|
+
*/.pi/team/state) root="${dir%/.pi/team/state}" ;;
|
|
2085
|
+
*) return 1 ;;
|
|
2086
|
+
esac
|
|
2087
|
+
[ -n "$root" ] || return 1
|
|
2088
|
+
root="$(cd "$root" 2>/dev/null && pwd -P)" || return 1 # 留:目录不存在=解析不出,按“不是我们的”处理
|
|
2089
|
+
[ -n "$root" ] || return 1
|
|
2090
|
+
case "$root" in
|
|
2091
|
+
"$TEAM_MAIN_ROOT"|"$TEAM_MAIN_ROOT"/*) return 1 ;;
|
|
2092
|
+
esac
|
|
2093
|
+
return 0
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2036
2096
|
team_state_dir() { mkdir -p "$TEAM_STATE_DIR"; printf '%s\n' "$TEAM_STATE_DIR"; }
|
|
2037
2097
|
|
|
2038
2098
|
team_state_set() { # <agent> <key> <value>
|
|
@@ -4658,18 +4718,18 @@ team_pending_nudge_empty() { # <counts|空=现读> → 0 = 没有正类别(空
|
|
|
4658
4718
|
}
|
|
4659
4719
|
|
|
4660
4720
|
# ---------------------------------------------------------------- 待命(PM 主动停工)
|
|
4661
|
-
|
|
4721
|
+
# 读写都走项目状态权威(scripts/state-authority.mjs 的事务) —— 统一状态里的 standby 槽位是唯一真相,
|
|
4722
|
+
# 旧的 state/standby 标记只由迁移读一次,之后就不再被当成真相。这里没有第二个文件、第二把锁;
|
|
4723
|
+
# 缺 flock / 等锁超时 / 快照读不懂都由权威层显式失败(不落回写文件,也不冒充「已关掉」)。
|
|
4724
|
+
# 读(status / in_standby / 面板)不建定位器、不发布快照:展示路径不写盘。
|
|
4662
4725
|
team_standby_on() { # <reason>
|
|
4663
|
-
|
|
4664
|
-
printf '%s %s\n' "$(team_timestamp)" "${1:--}" > "$(team_standby_file)"
|
|
4665
|
-
}
|
|
4666
|
-
team_standby_off() { rm -f "$(team_standby_file)"; }
|
|
4667
|
-
team_standby_reason() {
|
|
4668
|
-
local f; f="$(team_standby_file)"
|
|
4669
|
-
[ -f "$f" ] || return 1
|
|
4670
|
-
sed -n '1p' "$f" | cut -d' ' -f2-
|
|
4726
|
+
team_authority_cli standby-on --reason "${1:--}" >/dev/null
|
|
4671
4727
|
}
|
|
4672
|
-
|
|
4728
|
+
team_standby_off() { team_authority_cli standby-off >/dev/null; }
|
|
4729
|
+
team_standby_reason() { team_authority_cli standby-read --print reason; }
|
|
4730
|
+
team_standby_status() { team_authority_cli standby-read; } # 已渲染好的一行:standby: on(自 …,原因:…)
|
|
4731
|
+
team_standby_migrate() { team_authority_cli standby-import; }
|
|
4732
|
+
team_in_standby() { [ "$(team_authority_cli standby-read --print on)" = "true" ]; }
|
|
4673
4733
|
|
|
4674
4734
|
# 提醒(叫醒)PM:只写记录 + 尽力敲一下窗口,不靠它保证送达
|
|
4675
4735
|
# P174:第二个参数是**叫醒键**(类别集合,省略时按当前快照现算)——watchdog.nudge 与
|