teamsmith 0.4.7 → 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 (42) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +11 -0
  4. package/skills/teamsmith/SKILL.md +12 -8
  5. package/skills/teamsmith/references/config.md +11 -12
  6. package/skills/teamsmith/scripts/lib/cmd-review.sh +21 -33
  7. package/skills/teamsmith/scripts/lib/common.sh +1 -1
  8. package/skills/teamsmith/scripts/panel/README.md +35 -33
  9. package/skills/teamsmith/scripts/panel/panel.js +217 -199
  10. package/skills/teamsmith/scripts/panel/src/App.tsx +221 -66
  11. package/skills/teamsmith/scripts/panel/src/layout.ts +139 -302
  12. package/skills/teamsmith/scripts/panel/src/project-settings.ts +46 -0
  13. package/skills/teamsmith/scripts/panel/src/strings/en.ts +71 -205
  14. package/skills/teamsmith/scripts/panel/src/strings/index.ts +3 -5
  15. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +72 -204
  16. package/skills/teamsmith/scripts/panel/src/types.ts +23 -4
  17. package/skills/teamsmith/scripts/strings/commands.tsv +1 -1
  18. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +7 -0
  19. package/skills/teamsmith/templates/pm-prompt.md.tmpl +10 -6
  20. package/skills/teamsmith/tests/help-surface.sh +75 -7
  21. package/skills/teamsmith/tests/install-shape.sh +7 -7
  22. package/skills/teamsmith/tests/key-replies-ui.sh +11 -5
  23. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +2 -0
  24. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +255 -90
  25. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +181 -61
  26. package/skills/teamsmith/tests/lib/model-routing-roles.sh +125 -67
  27. package/skills/teamsmith/tests/lib/reply-fixture.sh +14 -9
  28. package/skills/teamsmith/tests/lib/tmp-root.sh +1 -1
  29. package/skills/teamsmith/tests/loop-inventory.tsv +2 -0
  30. package/skills/teamsmith/tests/panel-b2.sh +91 -31
  31. package/skills/teamsmith/tests/panel-p21.sh +607 -1162
  32. package/skills/teamsmith/tests/panel-strings.mjs +21 -113
  33. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +65 -38
  34. package/skills/teamsmith/tests/remind-adversarial-faults.sh +64 -12
  35. package/skills/teamsmith/tests/remind-adversarial-real.sh +13 -12
  36. package/skills/teamsmith/tests/remind-tool-real.mjs +159 -112
  37. package/skills/teamsmith/tests/remind-tool-real.sh +178 -3
  38. package/skills/teamsmith/tests/section-paths.tsv +10 -10
  39. package/skills/teamsmith/tests/smoke.sh +108 -114
  40. package/skills/teamsmith/tests/task-model-routing.sh +57 -26
  41. package/skills/teamsmith/tests/tmp-hygiene.sh +1 -1
  42. package/skills/teamsmith-init/SKILL.md +1 -1
package/README.md CHANGED
@@ -57,14 +57,14 @@ than replaced (`--force` replaces only an entry recognised as this skill).
57
57
  ### As a Pi package (no global CLI)
58
58
 
59
59
  ```bash
60
- pi install git:git@github.com:Track07-cda/teamsmith@v0.4.7 # user level: every project
61
- pi install -l git:git@github.com:Track07-cda/teamsmith@v0.4.7 # project level: recorded in .pi/settings.json
60
+ pi install git:git@github.com:Track07-cda/teamsmith@v0.4.8 # user level: every project
61
+ pi install -l git:git@github.com:Track07-cda/teamsmith@v0.4.8 # project level: recorded in .pi/settings.json
62
62
  ```
63
63
 
64
64
  - **Pin a released tag**: `@v<version>`, the version `team version` prints. Latest tag:
65
65
  `git tag --sort=-v:refname | head -1`.
66
- - The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.4.7`) uses your SSH key and works
67
- whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.4.7` takes the HTTPS
66
+ - The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.4.8`) uses your SSH key and works
67
+ whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.4.8` takes the HTTPS
68
68
  route, so it works anonymously on the public repository and asks for credentials if your access is private.
69
69
  - The clone lands in `~/.pi/agent/git/<host>/<path>` (user level) or `.pi/git/<host>/<path>` (project level); the
70
70
  skill directory — the `<skill>` used in every command below — is `<clone>/skills/teamsmith`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamsmith",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Turn one agent session into a project owner: self-contained task briefs dispatched to worker agents in their own git worktrees, independent verification on a separate checkout, and an auditable ledger (BOARD / reviews / threads / DECISIONS). Runs on Pi today.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -5,6 +5,17 @@
5
5
  > `SKILL.md`/`references/**`/`templates/**`/`extension/**` 在 Pi 里输入 `/reload`(或 `/pi-team-reload`)即生效;
6
6
  > 判断自己是不是旧的:`team version --check`(按 PM 启动时刻与 skill 文件时间推导)。
7
7
 
8
+ ## v0.4.8(2026-11-23)
9
+
10
+ PM 在已授权范围内自行推进;Pulse 项目设置和消息页更容易使用;测试减少重复工作。
11
+
12
+ - 默认 `AGENTS.md` 明确 PM 可自行查证、派工、返修和安排独立复核,不为小事反复请示。只要求方案时不实施;现有合并、发布和生产操作授权要求不变。
13
+ - Pulse 项目设置优先显示常用项,名称与说明改用用户能直接理解的用语。消息页显示延后队列的受阻数量、原因和最近发现时间,普通待发消息不误报。
14
+ - `team board add` 帮助补上必填标题;复验记录区分检查未启动、确实排队超时和检查执行后失败。
15
+ - 配置、帮助、粘贴、模型参数和关键回复等检查减少重复准备、执行或等待;两份提醒测试会清理默认临时文件,保留明确指定的记录。没有新的整套耗时读数。
16
+
17
+ 升级:`npm i -g teamsmith@0.4.8`。已有项目的 `AGENTS.md` 不会自动刷新;采用新规则前按 [现有项目刷新说明](references/migration.md#1b-the-agents-managed-block-what-an-explicit-refresh-does-and-what-it-does-not) 操作。
18
+
8
19
  ## v0.4.7(2026-11-13)
9
20
 
10
21
  PM 可以用自然语言创建提醒,到点后继续处理;通知、关键回复与只读诊断完成一轮修复。
@@ -3,7 +3,7 @@ name: teamsmith
3
3
  description: teamsmith gives one agent real ownership of a project — it plans, writes self-contained task briefs, dispatches worker agents into their own tmux windows and git worktrees, accepts non-implementer verification on an independent checkout, merges, and keeps an auditable ledger (BOARD/reviews/threads/DECISIONS). A pulse window (the periodic patrol) wakes the owner only when there is pending work, and the owner can deliberately stand down. Works with Pi; the launch/notify seam is an internal seam (frozen) reserved for a possible future non-Pi adapter, with no compatibility promise. Use when the user wants an agent to own a project end to end, dispatch tasks to worker agents, run agents in parallel in tmux with git worktree isolation, act as a PM/orchestrator over other agents, review an agent's work independently, run the patrol (`pulse`) as a tmux window, wake the PM only when there is pending work, or resume and coordinate a multi-agent project. To start a new project, use the teamsmith-init skill.
4
4
  license: MIT
5
5
  metadata:
6
- version: "0.4.7"
6
+ version: "0.4.8"
7
7
  ---
8
8
 
9
9
  # teamsmith · one agent that actually owns the project
@@ -54,7 +54,7 @@ the upgrade recipe: [references/migration.md](references/migration.md) §§1b–
54
54
  | Bootstrap | `team bootstrap [--agents "dev verify"] --task-models '<map>' --pm-model '<model>' [--print]` (recommended; both model inputs are required on a fresh project, a valid policy is kept on re-entry, a legacy config is refused before any side effect and points at `team config upgrade-models`), `team init`, `team doctor` |
55
55
  | Patrol (pulse) | `team pulse up\|down\|restart\|status\|logs` (a `pulse` window in the same session runs the monitor + periodic patrol; single backend). Renamed from `watchdog` in v1.36.0: `team watchdog …`, `watchdog-status`, `install-watchdog`, `uninstall-watchdog` still work as aliases until v2.0.0 (they print a one-line deprecation notice first). `team watch [--once]` (foreground patrol) |
56
56
  | Monitor | `team monitor [--once] [--activity]` (**serves the current tmux session only**: who is running / tasks / pending / capacity; `--activity` adds per-agent activity streams, off by default), `team panel` reuses it. The TUI's own preferences live in `state/panel.conf` (language, page, activity, mouse, density, theme) — runtime state, not project config, and `--print`/`--json` never read it |
57
- | Project settings | `team config list [--json]` / `team config set <KEY> <VALUE> [--dry-run] [--fingerprint <sha256>] [--actor <name>] [--allow-danger]` / `team config log [N]` / `team config set-task-model <category> <model>` / `team config upgrade-models --task-models '<map>' --pm-model '<model>' [--dry-run\|--yes]`: the only writer of `.pi/team/config.sh` (comment/order preserving, single-quote form, value validation, danger list, sha256 CAS, one audit line per attempt in `state/config.log`). Model policy is the task-category map plus the independent PM model; the retired seat front doors (`set-agent-model`, `add-agent --model`) refuse and point here. The console's project-settings view (settings overlay → `项目设置`) lists every key with its effect class (`apply`/`restart`/`refuse`) and edits through this command; see `references/config.md` §5 |
57
+ | Project settings | `team config list [--json]` / `team config set <KEY> <VALUE> [--dry-run] [--fingerprint <sha256>] [--actor <name>] [--allow-danger]` / `team config log [N]` / `team config set-task-model <category> <model>` / `team config upgrade-models --task-models '<map>' --pm-model '<model>' [--dry-run\|--yes]`: the only writer of `.pi/team/config.sh` (comment/order preserving, single-quote form, value validation, danger list, sha256 CAS, one audit line per attempt in `state/config.log`). Model policy is the task-category map plus the independent PM model; the retired seat front doors (`set-agent-model`, `add-agent --model`) refuse and point here. The console's project-settings view (settings overlay → `项目设置`) selects model and automatic-check operations, with `项目命令` / `Project commands` and read-only `模型记录` / `Model records` entries; full keys remain in the CLI and all edits still use these owning commands; see `references/config.md` §5 |
58
58
  | PM/agent lifecycle | `team up [--agents]` (recover the PM), `team resume` (PM's tool: continue stopped agents), `team standby on\|off` (PM deliberately stands down) |
59
59
  | Cross-project meetings | `team meeting open/say/read/list/inbox/propose/agree/close` (PM-to-PM peer exchange: interface work, advice, problem reports; **not a command channel** — consensus needs both sides) |
60
60
  | Updates | `team mark-loaded` (record the version at session start), `team version --check` (should I reload?), `team changelog [--since X]`, `team reload` |
@@ -110,10 +110,12 @@ when they conflict, the creed wins and the process gets fixed.
110
110
  6. **Wrap up / report**: update `BOARD.md`, record decisions in `DECISIONS.md` with rationale and impact, and report to
111
111
  the user as "delivered + where the evidence is + next step".
112
112
 
113
- Stop and ask the user only for **shared-state changes** (merge/push — the skill expresses authorization with `--yes`),
114
- scope changes, and decisions that need their call (dispatch a research task first, then write `DECISIONS.md`). Exact
115
- sequences: [references/workflows.md](references/workflows.md) §§B–F; patrol: protocol §8, workflows §§D/§I; the gate and
116
- its queue: protocol §9b-2.
113
+ Follow **PM — proceed within authorization** under **Roles and reading order** in `AGENTS.md`. Get the user's decision
114
+ on new product trade-offs or changes in scope; dispatch a research task when needed and record the decision in
115
+ `DECISIONS.md`. Obtain any missing authorization before changing shared state, including merges and pushes. Where a
116
+ `team` command requires `--yes`, it expresses authorization already given; it does not grant authorization or apply
117
+ to direct git/forge writes. Exact sequences: [references/workflows.md](references/workflows.md) §§B–F; patrol: protocol
118
+ §8, workflows §§D/§I; the gate and its queue: protocol §9b-2.
117
119
 
118
120
  ## Specs (OpenSpec)
119
121
 
@@ -211,8 +213,10 @@ about them). They stay writable so the seam can be maintained and diagnosed; to
211
213
  agents or quota — a stopped worker is pending work, not an automatic resume (`team resume` is your call). Nothing to
212
214
  do or a human needed: `team standby on --reason "…"` stands you down until a human runs `team standby off`.
213
215
  Mechanism and boundaries: protocol §8; patrol steps: workflows §§D/§I.
214
- - **Four separate adoption gates** — changing the project's contract, launching a fresh PM, landing source on a shared
215
- branch/skill path, and adopting a shared source: preview the exact command and get authorization per operation.
216
+ - **For a Teamsmith tool-source upgrade**, keep four steps separately recorded: private source verification; landing
217
+ validated source on a shared/protected tree; writing the project's configuration and the first fresh PM launch that
218
+ reads it; and adopting a changed shared skill/copy source. Preview the exact command and obtain authorization for
219
+ each command, including both the configuration write and the first fresh launch.
216
220
 
217
221
  ## Deeper reading (read on demand, not all at once)
218
222
 
@@ -325,8 +325,10 @@ arbitrary file reader. Text is capped at 128 KiB (`TEAM_PANEL_DETAIL_CAP` overri
325
325
  console spawns no `detail` child at all.
326
326
 
327
327
  `--block settings` is the project-settings view's reader (P22/B2): its payload is exactly `team config list
328
- --json` (the contract's schema, its effect classes, each key's functional `group`, the per-seat models and the
329
- audit tail). Like `detail` it is
328
+ --json` (complete key metadata, effect classes and functional `group`, future category/PM policy and committed
329
+ model records). The selected console lists model and automatic-check operations; project commands and model
330
+ records are separate returnable views. Excluded keys remain in the full CLI, and genuine warnings and repair
331
+ routes remain accessible in settings. The audit is not read by this console view. Like `detail` it is
330
332
  requested only while the view is open — a parked console spawns no `settings` child and `--print`/`--json` never
331
333
  see it.
332
334
 
@@ -390,11 +392,9 @@ parsed from the `# ---- … ----` section comments, which stay documentation: a
390
392
  a row between headings. The fields are positional, so the ninth column (`suggest`) is written empty for a row
391
393
  that has no suggestions when the group follows; a row whose tenth field is missing or malformed is a schema
392
394
  defect, and `tests/config-cli.sh`'s `groups` section names the key and fails — the read never invents a default
393
- group or hides the row (the console shows such a row under its visible ungrouped fallback heading,
394
- `settingsGroupUngrouped` in the string tables).
395
+ group or hides the row from the complete CLI. The selected console's purpose groups do not follow this metadata.
395
396
 
396
- The vocabulary is exactly these twelve tokens; the visible heading is the table entry `group_<token>` in
397
- **both** languages (the zh and en tables are the only place a heading's words live):
397
+ The complete CLI vocabulary is these twelve tokens; it is not the console's purpose-heading list:
398
398
 
399
399
  | token | domain | example keys |
400
400
  |---|---|---|
@@ -411,12 +411,11 @@ The vocabulary is exactly these twelve tokens; the visible heading is the table
411
411
  | `session` | live sessions | the `TEAM_INBOX_WATCH_*` family |
412
412
  | `meeting` | cross-project meetings | `TEAM_MEETING_TTL_HOURS`, `TEAM_MEETING_KNOCK` |
413
413
 
414
- The token is the **only** declaration of the vocabulary: `team config list --json` reports each key record's
415
- `group` verbatim (empty string for a key the file carries and the schema does not know), the console looks its
416
- heading up by the token (`group_<token>`, falling back to the raw token when the table has none), and
417
- `tests/panel-strings.mjs` asserts the two sets equal **in both directions** — a token no row uses has no label
418
- (stale label) and a row's token without a label is a missing label. A key added to the schema therefore lands
419
- under its domain with the committed console bundle, and no group list exists anywhere else.
414
+ The token is the **only** declaration of this CLI vocabulary: `team config list --json` reports each key's
415
+ `group` verbatim, or empty for an unknown file key. New schema keys/groups remain in that complete read; they
416
+ do not automatically create console operations or headings. `tests/panel-strings.mjs` checks only displayed
417
+ references and selected-operation labels in both languages; complete schema/group validation remains in the
418
+ existing CLI fixture.
420
419
 
421
420
  ### The written form
422
421
 
@@ -90,17 +90,18 @@ team_task_title() { # <ID> → 标题(BOARD 的「任务」列,其次任务
90
90
  # 分支不是被判对象;其余任务仍是任务分支当前 tip。
91
91
  team_review_record_path() { printf '%s\n' "$TEAM_DOCS_ABS/reviews/$1.md"; }
92
92
 
93
- # root/ 一律替换;裸 root 的 ASCII 字母数字后缀,以及后随字母数字的 -_. 才算兄弟路径延续。
93
+ # root 左侧不能仍是路径字符,避免 HOME=/tmp 改坏 /var/tmp;root/ 的子路径仍可替换。
94
+ # 裸 root 的 ASCII 字母数字后缀,以及后随字母数字的 -_. 才算兄弟路径延续。
94
95
  # 句末 -_. 与其它右边界(含所有中文标点)都接受,不维护分隔符白名单,也不依赖 locale 的字符分类。
95
96
  team_review_ledger_display_root() { # <文本> <绝对根> <占位>
96
97
  local rest="$1" root="$2" marker="$3" out="" before after right continuation skip
97
98
  [ -n "$root" ] || { printf '%s' "$rest"; return 0; }
98
- rest="${rest//"${root}/"/"${marker}/"}"
99
99
  while [[ "$rest" == *"$root"* ]]; do
100
100
  before="${rest%%"$root"*}"
101
101
  after="${rest#*"$root"}"
102
102
  right="${after:0:1}"
103
103
  continuation=0
104
+ case "${before: -1}" in [A-Za-z0-9/_.-]) continuation=1 ;; esac
104
105
  case "$right" in
105
106
  [A-Za-z0-9]) continuation=1 ;;
106
107
  [-_.]) case "${after:1:1}" in [A-Za-z0-9]) continuation=1 ;; esac ;;
@@ -1063,13 +1064,17 @@ $(printf '%s\n' "$ignored_list" | head -5)
1063
1064
  team_ok "已摘录 agent 报告:${branch_report#"$revdir"/}"
1064
1065
  done
1065
1066
 
1067
+ # 门禁准备失败不算一次复验:不取锁,也不改旧记录或日志。
1068
+ if [ "$no_gates" = "0" ] && [ -n "$TEAM_GATES" ]; then
1069
+ team_tmp_root_prepare || return 1
1070
+ fi
1066
1071
  mkdir -p "$TEAM_DOCS_ABS/reviews"
1067
1072
  local log="$TEAM_DOCS_ABS/reviews/$id-verify.log"
1068
1073
  local verdict="PASS" gates_out="" gate_timeout="${TEAM_REVIEW_TIMEOUT:-1800}" gates_marker="ran"
1069
1074
  local gate_elapsed="" gate_signal="" # 门禁实际用时 / 被信号终止的信号名(写进复验记录)
1070
- # G1(P26):门禁锁的排队阶段与记账。queue_state: none(门禁没跑)/ held(祖先持有)/ queued(本
1071
- # 次自己排队)/ noqueue(没有 flock,降级)/ cap(排队超上限,门禁没跑)。
1072
- local queue_state="none" queue_marker="" queued_elapsed="" queue_holder="" used_lock="" lock_cap=""
1075
+ # G1(P26):门禁锁的排队阶段与记账。queue_state: none(不执行门禁)/ held(祖先持有)/
1076
+ # queued(本次自己排队)/ noqueue(无法取锁,降级)/ broken(入场互斥检查拒绝)。
1077
+ local queue_state="none" queued_elapsed="" queue_holder="" used_lock="" lock_cap=""
1073
1078
  local lock_note=""
1074
1079
  if [ "$no_gates" = "1" ]; then
1075
1080
  verdict="SKIPPED"; gates_marker="none"
@@ -1128,7 +1133,7 @@ $(printf '%s\n' "$ignored_list" | head -5)
1128
1133
  local lock; lock="$(gate_lock_default_path)"
1129
1134
  local lock_comp; lock_comp="$(gate_lock_companion_path "$lock")"
1130
1135
  local lock_dev_ino="" lock_cap_hit=0 lock_broken="" gate_rc=0
1131
- local queue_started gate_end marker_epoch
1136
+ local queue_started
1132
1137
  # P281:排队上限不再是「一律 W」——它跟着**持有者的心跳**(change: gate-waiter-patience · P338):
1133
1138
  # 心跳还在动(任一活登记公布的心跳文件 < W 秒前更新)→ 4×W(硬顶);
1134
1139
  # 心跳停了 / 没有可用心跳(旧记录、`heartbeat=-`、文件不在)→ W(与今天一字不改)。
@@ -1140,8 +1145,6 @@ $(printf '%s\n' "$ignored_list" | head -5)
1140
1145
  lock_wait="$lock_cap"
1141
1146
  queue_started="$(date +%s)"
1142
1147
  local lock_record_written=0
1143
- team_tmp_root_prepare >/dev/null 2>&1 || true
1144
- queue_marker="$(mktemp "$(team_tmp_root)/teamsmith-review-queue.$(team_project_ns).XXXXXX" 2>/dev/null || true)"
1145
1148
  queue_holder="$(gate_lock_describe_pair "$lock")"
1146
1149
  # P310:祖先持锁的判据 = **进程树 + starttime 的证明**(不是环境里一个可继承的标记)
1147
1150
  local lock_ancestor=""
@@ -1157,8 +1160,7 @@ $(printf '%s\n' "$ignored_list" | head -5)
1157
1160
  team_warn "锁文件 $lock 建不了 → 门禁排队未启用(并发两套门禁时可能互相干扰)"
1158
1161
  else
1159
1162
  queue_state="queued"
1160
- # 有界轮询取**两把**锁(P287)。marker 文件在排队**之前**就存在、但**只在真的拿到锁时才写入**
1161
- # (与 flock 包装器同形):没写 = 这套没跑起来(排队被上限掐掉 / 取锁起不来)。
1163
+ # 有界轮询取**两把**锁(P287);排队到取锁成功或等满上限为止。
1162
1164
  local lock_probe=0 lock_reported=0 lock_waited_path="" lock_waited_id="" lock_probe_id=""
1163
1165
  local lock_role=""
1164
1166
  while :; do
@@ -1198,6 +1200,10 @@ $(printf '%s\n' "$ignored_list" | head -5)
1198
1200
  fi
1199
1201
  sleep 1
1200
1202
  done
1203
+ if [ "$queue_state" = "queued" ]; then
1204
+ queued_elapsed=$(( $(date +%s) - queue_started ))
1205
+ [ "$queued_elapsed" -lt 0 ] && queued_elapsed=0
1206
+ fi
1201
1207
  if [ "$lock_cap_hit" = "0" ] && [ "$queue_state" = "queued" ]; then
1202
1208
  export SMOKE_LOCK_WRAPPED=1
1203
1209
  export TEAM_SMOKE_LOCK="$lock"
@@ -1220,8 +1226,6 @@ $(printf '%s\n' "$ignored_list" | head -5)
1220
1226
  else
1221
1227
  team_warn "拿到锁了,但 $(gate_lock_holder_file "$lock_comp") 里的持有记录是**另一个活着的进程**($(gate_lock_describe_one "$(gate_lock_holder_file "$lock_comp")"))→ 不覆写它"
1222
1228
  fi
1223
- # marker:真的拿到锁、接下来跑门禁(P66 语义;`<epoch> <pid>` 与 smoke.sh 同形)
1224
- printf '%s %s\n' "$(date +%s)" "$$" > "$queue_marker" 2>/dev/null || true
1225
1229
  # 入场检查(P287 §4.2):活的 top 登记记着另一个身份 ⇒ 互斥已断 ⇒ 不跑门禁
1226
1230
  local entry_chain entry_msg
1227
1231
  entry_chain="$(gate_lock_ancestry_chain "$$" | tr '\n' ' ')"
@@ -1229,7 +1233,6 @@ $(printf '%s\n' "$ignored_list" | head -5)
1229
1233
  if [ -n "$entry_msg" ]; then
1230
1234
  lock_broken="入场检查:$entry_msg"
1231
1235
  team_err "入场检查:$entry_msg → 本次**不跑门禁**(互斥已经断了;这不是对代码的判定)"
1232
- : > "$queue_marker" 2>/dev/null || true # marker 清空 = 这套没有跑起来(与排队超限同形)
1233
1236
  gate_rc=2
1234
1237
  fi
1235
1238
  fi
@@ -1257,7 +1260,10 @@ $(printf '%s\n' "$ignored_list" | head -5)
1257
1260
  : > "$log"
1258
1261
  [ -n "$lock_broken" ] && queue_state="broken"
1259
1262
  else
1263
+ # 只量实际命令,不把入场检查、排队或锁的收尾算进硬超时证据。
1264
+ gate_started="$(date +%s)"
1260
1265
  ( cd "$revdir" && "${gate_cmd[@]}" 8>&- 9>&- ) > "$log" 2>&1 < /dev/null || gate_rc=$?
1266
+ gate_elapsed=$(( $(date +%s) - gate_started ))
1261
1267
  fi
1262
1268
  # P287:收尾只删**自己**写的持有者记录(锁文件永不 unlink;别人的活记录绝不碰)——
1263
1269
  # 留下一条陈旧记录会把后来者的排队上限与点名带偏(34②/34⑦ 实测过)。
@@ -1265,36 +1271,19 @@ $(printf '%s\n' "$ignored_list" | head -5)
1265
1271
  gate_lock_remove_holder "$lock_comp"
1266
1272
  rmdir "$lock_comp.runs" 2>/dev/null || true
1267
1273
  fi
1268
- gate_end="$(date +%s)"
1269
- if [ -n "$queue_marker" ] && [ -s "$queue_marker" ]; then
1270
- marker_epoch="$(cat "$queue_marker" 2>/dev/null)"
1271
- # P281:marker 现在是 `<epoch> <pid>`(与 smoke.sh 同一约定)—— 只取第一个字段当时刻
1272
- marker_epoch="${marker_epoch%% *}"
1273
- case "$marker_epoch" in ''|*[!0-9]*) marker_epoch="$(date +%s)" ;; esac
1274
- queued_elapsed=$(( marker_epoch - queue_started ))
1275
- [ "$queued_elapsed" -lt 0 ] && queued_elapsed=0
1276
- gate_elapsed=$(( gate_end - marker_epoch ))
1277
- else
1278
- gate_elapsed=$(( gate_end - queue_started ))
1279
- fi
1280
- # 排队超上限:flock 没拿到锁(没有 marker)→ 门禁**没有运行**。判定 FAIL 而不是 TIMEOUT:
1281
- # 「没跑」和「跑了被杀」必须能分开(记录里点名持锁者与上限)。
1274
+ # 只有等待循环确实等满上限才记 queuecap;未运行的路径不填写运行用时。
1282
1275
  if [ "$queue_state" = "broken" ]; then
1283
1276
  verdict="FAIL"
1284
1277
  gates_marker="mutexbroken"
1285
1278
  queue_holder="$(gate_lock_describe_pair "$lock")"
1286
1279
  gates_out="(互斥已断:**门禁没有运行**。${lock_broken}。实际持有者(读伴生锁边上的记录):${queue_holder}。这不是对代码的判定 —— 等那个运行结束后重跑。)"
1287
- gate_elapsed=""
1288
1280
  used_timeout=0
1289
1281
  used_lock="$lock"
1290
- elif [ "$queue_state" = "queued" ] && [ -z "$(cat "$queue_marker" 2>/dev/null)" ]; then
1282
+ elif [ "$lock_cap_hit" = "1" ]; then
1291
1283
  verdict="FAIL"
1292
1284
  gates_marker="queuecap"
1293
- queued_elapsed=$(( gate_end - queue_started ))
1294
- [ "$queued_elapsed" -lt 0 ] && queued_elapsed=0
1295
1285
  queue_holder="$(gate_lock_describe_pair "$lock")" # 撞上限时**重读**:等的这段时间持有者可能换了
1296
1286
  gates_out="(门禁锁排队超过上限 ${lock_cap}s:**门禁没有运行**。持锁者:${queue_holder}。${lock_note}这不是对代码的判定 —— 等持锁者结束,或抬 TEAM_SMOKE_LOCK_WAIT 后重跑。)"
1297
- gate_elapsed=""
1298
1287
  used_timeout=0
1299
1288
  used_lock="$lock"
1300
1289
  team_err "门禁锁排队超过上限 ${lock_cap}s → 门禁没有运行(持锁者:${queue_holder};${lock_note})"
@@ -1487,7 +1476,6 @@ $(printf '%s\n' "$ignored_list" | head -5)
1487
1476
  esac
1488
1477
  } | team_review_ledger_display > "$report"
1489
1478
  team_scan_invalidate review # M50:同进程里「写完再读」必须读到新记录
1490
- [ -n "$queue_marker" ] && rm -f "$queue_marker" 2>/dev/null
1491
1479
  team_ok "复验记录:${report#"$TEAM_MAIN_ROOT"/}($verdict)"
1492
1480
 
1493
1481
  case "$verdict" in FAIL|TIMEOUT) return 1 ;; esac
@@ -3,7 +3,7 @@
3
3
  # 由 scripts/team 与各 cmd-*.sh source;不要直接执行。
4
4
  # 约定:所有函数名以 team_ 前缀;不依赖 jq / python / node。
5
5
 
6
- TEAM_VERSION="0.4.7"
6
+ TEAM_VERSION="0.4.8"
7
7
 
8
8
  # ---------------------------------------------------------------- 输出
9
9
  if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
@@ -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