teamsmith 0.3.3 → 0.4.0

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 (82) hide show
  1. package/README.md +8 -8
  2. package/package.json +2 -6
  3. package/skills/teamsmith/CHANGELOG.md +77 -0
  4. package/skills/teamsmith/SKILL.md +83 -163
  5. package/skills/teamsmith/extension/team-inbox-watch.ts +30 -1
  6. package/skills/teamsmith/extension/team-notify.ts +162 -21
  7. package/skills/teamsmith/extension/team-reply.ts +105 -0
  8. package/skills/teamsmith/references/agent-adapters.md +4 -2
  9. package/skills/teamsmith/references/config.md +21 -12
  10. package/skills/teamsmith/references/migration.md +47 -3
  11. package/skills/teamsmith/references/protocol.md +85 -31
  12. package/skills/teamsmith/references/reminders.md +131 -0
  13. package/skills/teamsmith/references/troubleshooting.md +26 -8
  14. package/skills/teamsmith/references/workflows.md +18 -16
  15. package/skills/teamsmith/scripts/lib/cmd-agents.sh +290 -68
  16. package/skills/teamsmith/scripts/lib/cmd-config.sh +1 -1
  17. package/skills/teamsmith/scripts/lib/cmd-project.sh +193 -21
  18. package/skills/teamsmith/scripts/lib/cmd-remind.sh +103 -0
  19. package/skills/teamsmith/scripts/lib/cmd-status.sh +177 -21
  20. package/skills/teamsmith/scripts/lib/cmd-update.sh +7 -4
  21. package/skills/teamsmith/scripts/lib/cmd-watch.sh +11 -1
  22. package/skills/teamsmith/scripts/lib/common.sh +50 -6
  23. package/skills/teamsmith/scripts/lib/outbox.sh +103 -21
  24. package/skills/teamsmith/scripts/panel/panel.js +1 -1
  25. package/skills/teamsmith/scripts/panel/src/strings/en.ts +1 -1
  26. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +1 -1
  27. package/skills/teamsmith/scripts/remind-store.mjs +529 -0
  28. package/skills/teamsmith/scripts/replies.mjs +9 -3
  29. package/skills/teamsmith/scripts/reply-capture.mjs +596 -0
  30. package/skills/teamsmith/scripts/state-authority.mjs +500 -0
  31. package/skills/teamsmith/scripts/strings/commands.tsv +2 -1
  32. package/skills/teamsmith/scripts/strings/help.en.tsv +16 -2
  33. package/skills/teamsmith/scripts/strings/help.zh.tsv +16 -2
  34. package/skills/teamsmith/scripts/team +2 -0
  35. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +68 -123
  36. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +48 -55
  37. package/skills/teamsmith/templates/config.sh.tmpl +2 -1
  38. package/skills/teamsmith/templates/pm-prompt.md.tmpl +126 -119
  39. package/skills/teamsmith/tests/bg-ledger-harness.mjs +17 -6
  40. package/skills/teamsmith/tests/bg-ledger.sh +16 -5
  41. package/skills/teamsmith/tests/checkout-shape-probe.sh +6 -5
  42. package/skills/teamsmith/tests/delivery-truth.sh +82 -47
  43. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +71 -23
  44. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
  45. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-dirty-ab.py +143 -0
  46. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +26 -9
  47. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +92 -20
  48. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +47 -3
  49. package/skills/teamsmith/tests/fixtures/reply-capture-provider.ts +76 -0
  50. package/skills/teamsmith/tests/flip-p410-order2.sh +205 -0
  51. package/skills/teamsmith/tests/frames/README.md +3 -1
  52. package/skills/teamsmith/tests/gate-guard.sh +20 -4
  53. package/skills/teamsmith/tests/help-surface.sh +61 -3
  54. package/skills/teamsmith/tests/install-shape.sh +400 -38
  55. package/skills/teamsmith/tests/key-replies-pty.sh +197 -21
  56. package/skills/teamsmith/tests/key-replies.sh +187 -68
  57. package/skills/teamsmith/tests/ledger-claim.sh +8 -6
  58. package/skills/teamsmith/tests/lib/box-judge.sh +2 -1
  59. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +104 -0
  60. package/skills/teamsmith/tests/lib/pm-window.sh +127 -0
  61. package/skills/teamsmith/tests/lib/reply-fixture.sh +7 -19
  62. package/skills/teamsmith/tests/lib/reply-guard.sh +188 -0
  63. package/skills/teamsmith/tests/lib/section-calls.pl +171 -0
  64. package/skills/teamsmith/tests/loop-inventory.tsv +7 -5
  65. package/skills/teamsmith/tests/meta-suite.sh +215 -0
  66. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +154 -17
  67. package/skills/teamsmith/tests/panel-b3.sh +33 -4
  68. package/skills/teamsmith/tests/panel-choices.sh +11 -7
  69. package/skills/teamsmith/tests/remind-cli.sh +574 -0
  70. package/skills/teamsmith/tests/reply-capture-real.mjs +360 -0
  71. package/skills/teamsmith/tests/reply-capture-real.sh +5 -0
  72. package/skills/teamsmith/tests/reply-capture.mjs +622 -0
  73. package/skills/teamsmith/tests/section-paths.tsv +41 -10
  74. package/skills/teamsmith/tests/section-select.sh +180 -26
  75. package/skills/teamsmith/tests/smoke.sh +1829 -249
  76. package/skills/teamsmith/tests/state-authority-node.mjs +42 -0
  77. package/skills/teamsmith/tests/state-authority.sh +629 -0
  78. package/skills/teamsmith/tests/task-model-routing.sh +10 -1
  79. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +33 -0
  80. package/skills/teamsmith/tests/team-notify-knock-marker.mjs +91 -0
  81. package/skills/teamsmith/tests/workflow-entry.sh +123 -3
  82. package/skills/teamsmith-init/SKILL.md +1 -1
@@ -88,12 +88,14 @@ team_build_prompt() { # <agent> <ID> <taskfile-abs> <worktree> <model> [<session
88
88
  grep -qE '^[[:space:]]*issue:' "$taskfile" 2>/dev/null && \
89
89
  issue="$(grep -E '^[[:space:]]*issue:' "$taskfile" | head -1 | grep -oE '[0-9]+' | head -1 || true)"
90
90
 
91
- # 交付步骤与 forge 无关:skill 不假设任何 forge CLI(gh/glab/tea/curl 都行,由 PM 决定)
91
+ # 交付步骤与 forge 无关:skill 不假设任何 forge CLI(gh/glab/tea/curl 都行,由 PM 决定)。
92
+ # local 模式**没有远端**:不许写一条无条件的 push/PR 步骤(那是假指令,worker 会照做并失败);
93
+ # 远端模式的投递方式由 PM 指定,prompt 只说「按 PM 的方式」,不替 PM 承诺 PR。
92
94
  local pr_step
93
95
  case "$TEAM_VCS" in
94
- local|"") pr_step="本仓库是 local 模式(没有远端):**不用 push**,把分支留在本地即可,PM 复验后本地合并" ;;
95
- *) pr_step="交付方式由 PM 决定:把分支 push 到你们的远端(如有),开 PR/MR 与否听 PM 安排
96
- (skill 不代做、也不假设 gh/glab;需要你手动调 API 时按 PM 给的方式做,token 不要读进上下文)" ;;
96
+ local|"") pr_step="**不向远端收尾**:本仓库是 local 模式(没有远端)-- 不要 push、不要开 PR/MR,把工作提交在你的任务分支上即可,PM 复验后本地合并" ;;
97
+ *) pr_step="按 PM 指定的投递方式:push 到 \`$TEAM_REMOTE\`(PM 另有指定的远端就按 PM 的),开不开 PR/MR、用哪个 forge 工具都由 PM 决定
98
+ (skill 不代做、也不假设 gh/glab;要你手动调 API 时按 PM 给的方式做,token 不要读进上下文)" ;;
97
99
  esac
98
100
 
99
101
  # 通知段(F1/F7/F8):worker 的摘要是**数据**,永远走文件通道 —— 提示词里不含任何 worker 文本,
@@ -141,8 +143,7 @@ Read these first, in order:
141
143
  3. The task brief \`$taskfile\`$rel_note -- the single source of scope and acceptance commands
142
144
 
143
145
  Scope discipline: do only what the brief says, and only change directories that OWNERSHIP assigns to you.
144
- For cross-directory work, do not do it yourself: write \`BLOCKED:\` in your report naming who should change what,
145
- then end the turn.
146
+ For cross-directory work, do not do it yourself: write \`BLOCKED:\` naming who should change what, then end the turn.
146
147
 
147
148
  Red lines: never push $TEAM_PROTECTED_BRANCH, never force-push, never merge PR/MRs, never rebase or delete other
148
149
  branches, never change repository settings. Never write tokens/secrets into code, logs or commit messages; never
@@ -156,27 +157,25 @@ needs to do what -- **cross-project communication is the PM's job via \`$cli mee
156
157
  advice, problem reports); workers do not attend**. Only decisions that need the user's call go through the user.
157
158
 
158
159
  **Never stop mid-task to ask for confirmation**: end the turn in exactly three situations --
159
- (a) **delivered**: every acceptance command in the brief has been run + the report is written + the branch is pushed + the PR/MR is
160
- open (or, in local mode, the branch state is settled);
160
+ (a) **delivered**: every acceptance command in the brief has been run + the report is written + the branch is settled
161
+ (local: the commits stay on your task branch, nothing is pushed; remote: delivery as the PM directed, with any
162
+ PR/MR the PM asked for);
161
163
  (b) **hard-blocked** (missing dependency, missing permission, someone else's bug): notify the PM with
162
164
  \`$cli notify pm "<one line>"\`, state \`BLOCKED:\` clearly in the report, then end the turn;
163
165
  (c) **suspended on background jobs**: jobs this session started are still running and every step that does not depend
164
- on their results is done. A suspension is neither a delivery nor a blockage -- do not write the report's final
165
- verdict and do not notify \`BLOCKED:\` for it; end the turn with its **last line** naming every job you are
166
- waiting on (\`waiting on: <id>[, <id>…]\`), so the PM can see the ending was deliberate.
166
+ on their results is done. A suspension is neither a delivery nor a blockage: do not write the report's final
167
+ verdict or notify \`BLOCKED:\`; end the turn with its **last line** naming every awaited job
168
+ (\`waiting on: <id>[, <id>…]\`), so the PM can see the ending was deliberate.
167
169
  **Never work around a boundary on your own.**
168
170
 
169
171
  Delivery process:
170
172
  1. Actually run the acceptance commands from the brief. **Never claim something passed without running it** (the PM
171
173
  re-verifies independently; a false report fails the task).
172
174
  2. Commit every verifiable small step (\`git commit\`, Conventional Commits + task ID + trailer \`Agent: $agent\`${issue:+ + \`Refs #$issue\`}); never one big dump at the end.
173
- 3. Write the report \`$rel_report\` and commit it on your branch (format: the AGENTS.md report template; include the
174
- real commands and their output tails).
175
- For **defect-fix** tasks the report must contain **flip evidence**: red before -> green after, or
176
- "break the implementation -> the guard test must fail -> restore it"
177
- (the PM checks this section with \`$cli review $id --strong\` and will send it back if missing).
178
- 4. \`git push -u $TEAM_REMOTE HEAD\`.
179
- 5. $pr_step.
175
+ 3. Write the report \`$rel_report\` and commit it on your branch, following \`$TEAM_SKILL_DIR/templates/report.md.tmpl\`
176
+ (deliverables, the real command/output tails, the ledger-ban line, and flip evidence for a defect fix): the PM
177
+ reads it as evidence, not as intentions.
178
+ 4. Settle the branch: $pr_step
180
179
 
181
180
  Task: **$id**${issue:+ (issue #$issue)}. The brief \`$taskfile\` is the PM's read-only file -- do not modify it.${bg_block}${notify_block}
182
181
  If this is a resumed run: start with \`git status\` / \`git log --oneline -5\` to see how far you got, and continue
@@ -1621,49 +1620,61 @@ team_require_recipient() { # <recipient> <是否 --any> <命令名>
1621
1620
  return 1
1622
1621
  }
1623
1622
 
1623
+ # P393:无可用监视通道时,默认 say 直投之前的**目标资格检查**(从 team_cmd_say 原样搬来)。
1624
+ # 位置很关键:它在「选中直投之后、按任何键之前」,所以已选中的监视通道不需要看 pane,而一个不合格的
1625
+ # 注册也不可能绕过它 —— 检查与按键之间不留一个「路由又消失」的空档。
1626
+ # 返回 0 = 目标可直投;2 = 已经离线处理完(收件箱已写、原因已打印),调用方不得再追加同一份兜底。
1627
+ # 收件人(--any 越权)与目标会话边界已在调用方校验/解析过,这里只做 pane 侧的三项判断。
1628
+ team_say_prepare_direct() { # <agent> <target> <msg>
1629
+ local agent="$1" target="$2" msg="$3" w
1630
+ w="${target#*:}"
1631
+ team_tmux_has_window "$TEAM_SESSION" "$w" \
1632
+ || { team_say_offline "$agent" "$msg" "窗口 $TEAM_SESSION:$w 不在"; return 2; }
1633
+ # P55(投递换道):死 pane 不是投递目标 —— send-keys 返回 0 但文字落进虚空(探针 P5),
1634
+ # 「提示框非空确认送达」永远等不到(画面不再变)。消息走收件箱,输出点名座位已死与退出证据。
1635
+ if team_agent_pane_dead "$agent"; then
1636
+ local ev; ev="$(team_agent_pane_evidence "$agent" 2>/dev/null || echo '证据未知')"
1637
+ team_inbox_append "$agent" pm "(PM 消息,座位已死:$ev)$msg"
1638
+ team_warn "say: $agent 的 pane 已死($ev)—— 没有按任何键;消息已落 $TEAM_DOCS_DIR/inbox/$agent.md"
1639
+ team_dim " 现场:$TEAM_CLI status <ID>(或 tmux capture-pane -p -S - -t $target);恢复:$TEAM_CLI resume --agent $agent(会先抓现场再替换遗体)"
1640
+ return 2
1641
+ fi
1642
+ # 安全:空提示符时把消息 send-keys 进去会被 shell 当命令执行
1643
+ if team_is_shell_cmd "$(team_pane_cmd "$TEAM_SESSION:$w")" && ! team_pane_busy "$TEAM_SESSION:$w"; then
1644
+ team_say_offline "$agent" "$msg" "$(team_agent_cli_name) 已退出(空提示符)"
1645
+ return 2
1646
+ fi
1647
+ return 0
1648
+ }
1649
+
1624
1650
  team_cmd_say() {
1625
- local agent="" msg="" verify=1 any=0 now=0
1651
+ local agent="" msg="" verify=1 any=0
1626
1652
  while [ $# -gt 0 ]; do
1627
1653
  case "$1" in
1628
1654
  --no-verify) verify=0; shift ;;
1629
1655
  --any) any=1; shift ;;
1630
- --now) now=1; shift ;;
1656
+ # P393:公共 --now 已退休(say 默认就会在没有可用监视通道时直投)。走同一条未知参数路径:
1657
+ # 收件人校验、任何按键、任何队列/收件箱写入之前就以 rc=2 退出。
1631
1658
  -*) team_usage_die "say: 未知参数 $1" ;;
1632
1659
  *) if [ -z "$agent" ]; then agent="$1"; elif [ -z "$msg" ]; then msg="$1"; else msg="$msg $1"; fi; shift ;;
1633
1660
  esac
1634
1661
  done
1635
- [ -n "$agent" ] && [ -n "$msg" ] || team_usage_die "say <agent> <单行消息> [--no-verify] [--any] [--now]"
1662
+ [ -n "$agent" ] && [ -n "$msg" ] || team_usage_die "say <agent> <单行消息> [--no-verify] [--any]"
1636
1663
  case "$msg" in *$'\n'*) team_die "say 只能发单行:多行请写进文件,然后让 agent 去读" ;; esac
1637
1664
  team_require_recipient "$agent" "$any" say || return 1
1638
1665
  local w; w="$(team_state_get "$agent" window "$agent")"
1639
1666
  local target="$TEAM_SESSION:$w"
1640
- # M30 · pi 通道不经过 tmux:有活的收件箱监视器(inbox-watch 扩展)时,窗口/pane 的检查都不必要
1641
- # —— 「pi 通道零 tmux 调用」是 M30 的验收判据之一(消息写 durable 收件箱 + spool,由扩展唤醒)。
1642
- if ! team_inbox_watch_route "$target" >/dev/null 2>&1; then
1643
- team_tmux_has_window "$TEAM_SESSION" "$w" \
1644
- || { team_say_offline "$agent" "$msg" "窗口 $TEAM_SESSION:$w 不在"; return 0; }
1645
- # P55(投递换道):死 pane 不是投递目标 —— send-keys 返回 0 但文字落进虚空(探针 P5),
1646
- # 「提示框非空确认送达」永远等不到(画面不再变)。消息走收件箱,输出点名座位已死与退出证据。
1647
- if team_agent_pane_dead "$agent"; then
1648
- local ev; ev="$(team_agent_pane_evidence "$agent" 2>/dev/null || echo '证据未知')"
1649
- team_inbox_append "$agent" pm "(PM 消息,座位已死:$ev)$msg"
1650
- team_warn "say: $agent 的 pane 已死($ev)—— 没有按任何键;消息已落 $TEAM_DOCS_DIR/inbox/$agent.md"
1651
- team_dim " 现场:$TEAM_CLI status <ID>(或 tmux capture-pane -p -S - -t $target);恢复:$TEAM_CLI resume --agent $agent(会先抓现场再替换遗体)"
1652
- return 0
1653
- fi
1654
- # 安全:空提示符时把消息 send-keys 进去会被 shell 当命令执行
1655
- if team_is_shell_cmd "$(team_pane_cmd "$TEAM_SESSION:$w")" && ! team_pane_busy "$TEAM_SESSION:$w"; then
1656
- team_say_offline "$agent" "$msg" "$(team_agent_cli_name) 已退出(空提示符)"
1657
- return 0
1658
- fi
1659
- fi
1660
1667
 
1661
- # 投递一律走守卫(delivery-guard):输入框里有草稿 → 不写一个键,消息进 state/outbox/ 排队。
1662
- # --now 是人的显式逃生门(故意重建旧行为,留审计);--no-verify 保留旧语义。
1668
+ # 投递一律走共享发送口(delivery-guard):它先判断有没有可用的监视通道,再决定直投或排队;
1669
+ # 直投前的窗口/死 pane/空提示符检查由 team_say_prepare_direct 在那一刻做(P393)。
1663
1670
  local sargs=()
1664
1671
  [ "$verify" = "1" ] || sargs+=(--no-verify)
1665
- [ "$now" = "1" ] && sargs+=(--now)
1666
- team_send_guarded "$target" "$msg" say --from pm --inbox "$agent" ${sargs[@]+"${sargs[@]}"}
1672
+ local send_rc=0
1673
+ team_send_guarded "$target" "$msg" say --from pm --inbox "$agent" ${sargs[@]+"${sargs[@]}"} || send_rc=$?
1674
+ # 捕获返回值,才能在真实入口的 set -e 下报告持久化失败;其他非零结果仍原样失败,不能落进离线兜底。
1675
+ if [ "$send_rc" -ne 0 ] && [ "$TEAM_SEND_OUTCOME" != "persist-failed" ]; then
1676
+ return "$send_rc"
1677
+ fi
1667
1678
  case "$TEAM_SEND_OUTCOME" in
1668
1679
  delivered)
1669
1680
  team_ok "said to $target: $msg(已确认送达)"
@@ -1673,9 +1684,17 @@ team_cmd_say() {
1673
1684
  team_ok "said to $target: $msg(pi 监视通道:已写收件箱 $TEAM_DOCS_DIR/inbox/$agent.md + 唤醒指针;输入框零按键)"
1674
1685
  return 0 ;;
1675
1686
  queued)
1676
- # 契约:排队 ≠ 送达 —— 输出里只许有 queued,绝不能写「已确认送达」
1677
- team_ok "queued for $target: $msg(目标输入框里有草稿:没有写任何键;条目已入 state/outbox/,清空后自动投递)"
1678
- team_dim " 原因/条目:$TEAM_CLI outbox list | 投递未确认的兜底:消息已在 $TEAM_DOCS_DIR/inbox/$agent.md"
1687
+ # 契约:排队 ≠ 送达 —— 输出里只许有 queued,绝不能写「已确认送达」。
1688
+ # P393:默认 say 不会再因为「目标有草稿」排队;这里排队只可能是**已选中的监视通道**没走完
1689
+ # (路由消失 / 收件箱或 spool 写不进去),条目留在 outbox 走原有排水。那种情况不许假称草稿、
1690
+ # 也不许承诺「清空草稿就送达」。
1691
+ if [ "$TEAM_SEND_REASON" = "watch-pending" ]; then
1692
+ team_ok "queued for $target: $msg(监视通道这次没走完:没有写任何键;条目已入 state/outbox/,后续排水仍走守卫)"
1693
+ team_dim " 条目:$TEAM_CLI outbox list | 这与目标输入框里的草稿无关,也不承诺清空草稿就会送达"
1694
+ else
1695
+ team_ok "queued for $target: $msg(没有写任何键;条目已入 state/outbox/,清空后自动投递)"
1696
+ team_dim " 原因/条目:$TEAM_CLI outbox list | 投递未确认的兜底:消息已在 $TEAM_DOCS_DIR/inbox/$agent.md"
1697
+ fi
1679
1698
  return 0 ;;
1680
1699
  held)
1681
1700
  # delivery-truth D1/D2:geometry-untrusted / queue-stalled —— 一个键都没发,报 held + 原因 +
@@ -1684,7 +1703,8 @@ team_cmd_say() {
1684
1703
  team_dim " 条目:$(basename "${TEAM_SEND_ENTRY:--}")|durable 全文:$(team_outbox_durable_path "${TEAM_SEND_ENTRY:--}" 2>/dev/null || printf '%s' -)(payload 与条目头未改)|原因:$TEAM_CLI outbox list |恢复:$(team_outbox_recovery_hint "${TEAM_SEND_REASON:--}")"
1685
1704
  return 1 ;;
1686
1705
  forced)
1687
- team_ok "said to $target: $msg(--now:跳过守卫直投,记入 outbox/forced.log)"
1706
+ # P393:默认直投是**尝试**,不是回执 —— 不写「已确认送达」,也不承诺失败会自动入队。
1707
+ team_ok "attempted immediate send to $target: $msg(已尝试立即发送;未确认模型接收;跳过草稿守卫已记入 state/outbox/forced.log)"
1688
1708
  return 0 ;;
1689
1709
  unknown-sent)
1690
1710
  team_ok "said to $target: $msg(输入框形状未知:按旧行为投递)"
@@ -1693,6 +1713,14 @@ team_cmd_say() {
1693
1713
  team_inbox_append "$agent" pm "(PM 消息,投递未确认)$msg"
1694
1714
  team_err "投递未确认:$target(输入框形状未知且 pane 无变化;消息已写入收件箱 $TEAM_DOCS_DIR/inbox/$agent.md)"
1695
1715
  return 1 ;;
1716
+ offline-handled)
1717
+ # 发送口里的直投前检查已经处理完(收件箱已写、原因已打印):这里绝不再追加一份。
1718
+ return 0 ;;
1719
+ persist-failed)
1720
+ # 已选中监视通道,却连队列条目都没能落盘 = 真实持久化失败:不是离线,也不是「已排队」。
1721
+ team_err "say: 写不进 state/outbox/ 的队列条目(目标 $target)—— 没有按任何键,也没有离线/排队兜底"
1722
+ team_dim " 检查 $(team_state_dir)/outbox 的权限与磁盘后重发;已选中的监视通道不会退回直投"
1723
+ return 1 ;;
1696
1724
  *)
1697
1725
  team_say_offline "$agent" "$msg" "$(team_agent_cli_name) 已退出(空提示符)"
1698
1726
  return 0 ;;
@@ -1800,15 +1828,38 @@ team_notify_line_events() {
1800
1828
  printf '%s\n' "$n"
1801
1829
  }
1802
1830
 
1831
+ # 行里的 `knock=`(指针行的 run 级字段;记录行从不带它 → 空)。
1832
+ team_notify_knock_of() { # <行> → knock= 的值(没有 → 空)
1833
+ local head="${1#- }"
1834
+ head="${head%% :: *}"
1835
+ case "$head" in
1836
+ *'knock='*) head="${head#*knock=}"; printf '%s\n' "${head%% *}" ;;
1837
+ *) printf '\n' ;;
1838
+ esac
1839
+ }
1840
+
1803
1841
  # 汇总行 = **最后一条事件的行** + 首事件时间戳 + 字段区 `×N first= last=`(branch/tip/uncommitted 自动是最后一条的值)。
1804
- team_notify_line_merge() { # <新事件行> <首时间戳> <n> <末时间戳>
1805
- local c="$1" first="$2" n="$3" last="$4" head tail rest
1842
+ # 第 5 参 <已存在的行> 只服务一条 run 级字段规则:两边都有 `knock=` 时取**已存在那一行**的值 ——
1843
+ # 叫醒只发生在 run 的第一个事件上(state=new 才入队,扩展一律不入队),让扩展事件把 knock 改写会
1844
+ # 让这一行说谎。记录行从不带 knock=,所以对记录行的输出逐字节无影响。
1845
+ team_notify_line_merge() { # <新事件行> <首时间戳> <n> <末时间戳> [<已存在的行>]
1846
+ local c="$1" first="$2" n="$3" last="$4" prev="${5:-}" head tail rest pk pre post cur
1806
1847
  case "$c" in
1807
1848
  *' :: '*) head="${c%% :: *}"; tail="${c#* :: }" ;;
1808
1849
  *) head="$c"; tail='' ;;
1809
1850
  esac
1810
1851
  rest="${head#* }"
1811
1852
  head="${first} ${rest} · ×${n} first=${first} last=${last}"
1853
+ if [ -n "$prev" ]; then
1854
+ pk="$(team_notify_knock_of "$prev")"
1855
+ case "$head" in
1856
+ *'knock='*)
1857
+ if [ -n "$pk" ]; then
1858
+ pre="${head%%knock=*}"; post="${head#*knock=}"; cur="${post%% *}"
1859
+ head="${pre}knock=${pk}${post#"$cur"}"
1860
+ fi ;;
1861
+ esac
1862
+ fi
1812
1863
  if [ "${c%% :: *}" != "$c" ]; then printf '%s :: %s\n' "$head" "$tail"; else printf '%s\n' "$head"; fi
1813
1864
  }
1814
1865
 
@@ -1840,8 +1891,10 @@ team_notify_detail_events() { # <明细文件> → 事件行数(轮转头不
1840
1891
  }
1841
1892
 
1842
1893
  # 先明细:一行一事件(内容 = 该事件单发形状的收件箱行)。越界 → 轮转一代到 <file>.1 + 新代轮转头。
1843
- team_notify_detail_append() { # <事件行> <明细文件> → 0 = 已落盘;1 = 失败(调用方写 detail=unavailable)
1844
- local content="$1" file="$2" dir max count
1894
+ # 第 3 参只影响轮转在扩展日志里的名字:结果账(notify-knock.log)与明细共用这一个轮转器与同一个上界,
1895
+ # 但两件东西不是一回事,日志里点错名字会让下一次查现场的人找错文件。
1896
+ team_notify_detail_append() { # <事件行> <文件> [轮转日志里的名字=detail] → 0 = 已落盘;1 = 失败(调用方写 detail=unavailable)
1897
+ local content="$1" file="$2" label="${3:-detail}" dir max count
1845
1898
  dir="$(dirname "$file")"
1846
1899
  mkdir -p "$dir" || return 1
1847
1900
  max="$(team_notify_detail_max)"
@@ -1849,7 +1902,7 @@ team_notify_detail_append() { # <事件行> <明细文件> → 0 = 已落盘;1
1849
1902
  if [ "$count" -ge "$max" ]; then
1850
1903
  mv -f "$file" "$file.1" || return 1
1851
1904
  printf '%s\n' "# rotation $(team_timestamp) moved=${count} path=${file}.1" > "$file" || return 1
1852
- team_notify_log_line "notify detail rotated: moved=${count} to=${file}.1"
1905
+ team_notify_log_line "notify ${label} rotated: moved=${count} to=${file}.1"
1853
1906
  fi
1854
1907
  printf -- '- %s\n' "$content" >> "$file" 2>/dev/null || return 1
1855
1908
  return 0
@@ -1869,12 +1922,95 @@ team_inbox_rewrite_last() { # <收件箱文件> <新尾行> → 0 = 已重写;
1869
1922
  return 0
1870
1923
  }
1871
1924
 
1872
- # 临界区(调用方持锁):先明细 → 尾行锚判定 → 截尾重写或追加 → 打印写入结果。
1873
- team_inbox_write_locked() { # <recipient> <行> <文件> <明细> → state=new|extended first=<ISO> key=<键>
1925
+ # 指针行派生(turn-notice-in-pm-inbox · design §2):记录行 → PM 收件箱里的那一行。
1926
+ # 由**写入侧**从记录行派生,而不是在扩展里另拼一份 —— 「什么算同一个 run」只有 team_notify_line_key
1927
+ # 一份实现,两边才不可能在缺字段/awaiting 顺序/⚠ 前缀上分叉。四处变换,字段顺序写死:
1928
+ # ① 删 `⚠ 未提交 N 个文件 · ` 前缀(告警框是事件级的告警,指针不复制它);
1929
+ # ② 只留 run 级字段 `task=<ID> tip=<hex>`、`awaiting=<ids>`、`detail=unavailable`:
1930
+ # branch=/uncommitted=/unpushed= 是「last= 那一刻」的事件级快照,抄进 run 级摘要只会显示一个
1931
+ # 过期瞬间(PM 要判断这些时读的是 see= 指的那份记录);
1932
+ # ③ 插入 `knock=<outcome> · see=docs/team/inbox/<seat>.md`;
1933
+ # ④ 删 ` :: <末消息>` 尾巴(摘要在记录行与敲门载荷里各有一份;pm.md 的行数是 PM 的待办数)。
1934
+ # 记录行的状态类(design §6 的 class= 字段):[auto] → delivered、[auto·suspended] → suspended、
1935
+ # [auto·interrupted] → interrupted;其余(没有记录行 / 非 auto 行)是 `-`。
1936
+ # 与 team_inbox_line_is_record / 合并键共用同一套 tag 拼写,不另立一份。
1937
+ team_notify_line_class() { # <记录行> → delivered|suspended|interrupted|-
1938
+ local body tag
1939
+ body="${1#- }"
1940
+ case "$body" in *'['*) ;; *) printf '%s\n' '-' ; return 0 ;; esac
1941
+ tag="${body#*\[}"; tag="${tag%%\]*}"
1942
+ case "$tag" in
1943
+ auto) printf '%s\n' delivered ;;
1944
+ 'auto·suspended') printf '%s\n' suspended ;;
1945
+ 'auto·interrupted') printf '%s\n' interrupted ;;
1946
+ *) printf '%s\n' '-' ;;
1947
+ esac
1948
+ }
1949
+
1950
+ # 结果账(turn-notice-in-pm-inbox · A2):一行一次 settle —— 项目内那个跨 ack、跨轮转之后还能回答
1951
+ # 「今天 skipped 了几次、为什么」的地方。与 state/notify.log 同一个轮转器与同一个上界(不新增配置键)。
1952
+ team_notify_knock_ledger_path() { printf '%s/notify-knock.log\n' "$(team_state_dir)"; }
1953
+
1954
+ team_notify_knock_ledger_append() { # <seat> <task> <class> <outcome> <pointer> <identity> → 0 = 已落盘
1955
+ local line
1956
+ line="$(team_timestamp) seat=$1 · task=$2 · class=$3 · outcome=$4 · pointer=$5 · identity=$6"
1957
+ team_notify_detail_append "$line" "$(team_notify_knock_ledger_path)" knock
1958
+ }
1959
+
1960
+ team_notify_pointer_line() { # <记录行> <outcome> → 指针行(解析不成立 → rc 1)
1961
+ local body="$1" outcome="$2"
1962
+ local iso rest tag seat tok head f task_f='' aw_f='' ask_f='' det_f=''
1963
+ iso="${body%% *}"
1964
+ case "$iso" in ''|*[!0-9TZ:.-]*) return 1 ;; esac
1965
+ rest="${body#"$iso" }"
1966
+ [ "$rest" != "$body" ] || return 1
1967
+ case "$rest" in '⚠'*) rest="${rest#*· }" ;; esac
1968
+ case "$rest" in '['*) ;; *) return 1 ;; esac
1969
+ tag="${rest%%\]*}"; tag="${tag#\[}"
1970
+ rest="${rest#*\] }"
1971
+ case "$rest" in agent:*) ;; *) return 1 ;; esac
1972
+ seat="${rest#agent:}"; seat="${seat%% *}"
1973
+ [ -n "$seat" ] || return 1
1974
+ rest="${rest#"agent:$seat"}"
1975
+ case "$rest" in ' '*|'') ;; *) return 1 ;; esac
1976
+ rest="${rest# }"
1977
+ case "$rest" in '· '*) rest="${rest#· }" ;; *) return 1 ;; esac
1978
+ head="${rest%% :: *}"
1979
+ tok="${head%% · *}"
1980
+ [ -n "$tok" ] || return 1
1981
+ rest="${head#"$tok"}"
1982
+ case "$rest" in ' · '*) rest="${rest# · }" ;; *) rest='' ;; esac
1983
+ while [ -n "$rest" ]; do
1984
+ f="${rest%% · *}"
1985
+ if [ "$f" = "$rest" ]; then rest=''; else rest="${rest#* · }"; fi
1986
+ case "$f" in
1987
+ task=*) task_f="$f" ;;
1988
+ awaiting=*) aw_f="$f" ;;
1989
+ # notice-fulltext-and-asks:`asks=` 是**事件级**字段(跟 branch=/tip= 同类),但它是 PM 唯一可行动
1990
+ # 的信号,所以在这里被有意复制 —— PM 读的是 pm.md,不是 worker 的收件箱。branch=/uncommitted=/unpushed=
1991
+ # 仍然不复制(它们只描述 last= 那一刻的快照)。
1992
+ asks=*) ask_f="$f" ;;
1993
+ 'detail=unavailable') det_f="$f" ;;
1994
+ *) : ;; # branch=/uncommitted=/unpushed= 与未识别字段:事件级,不属于指针
1995
+ esac
1996
+ done
1997
+ printf '%s [%s] agent:%s · %s · knock=%s · see=%s/inbox/%s.md' \
1998
+ "$iso" "$tag" "$seat" "$tok" "$outcome" "$TEAM_DOCS_DIR" "$seat"
1999
+ [ -n "$task_f" ] && printf ' · %s' "$task_f"
2000
+ [ -n "$ask_f" ] && printf ' · %s' "$ask_f"
2001
+ [ -n "$aw_f" ] && printf ' · %s' "$aw_f"
2002
+ [ -n "$det_f" ] && printf ' · %s' "$det_f"
2003
+ printf '\n'
2004
+ }
2005
+
2006
+ # 临界区(调用方持锁):明细(detail=- → 不写)→ 尾行锚判定 → 截尾重写或追加 → 打印写入结果。
2007
+ # turn-notice-in-pm-inbox:记录行与指针行走**同一段**合并逻辑,唯一区别是明细写不写 —— 指针行不进
2008
+ # 明细,所以一个 run 的 ×N 仍然等于它的记录数(把指针也记进明细会让两边分家)。
2009
+ team_inbox_merge_or_append() { # <recipient> <行> <文件> <明细|-> → state=new|extended first=<ISO> key=<键>
1874
2010
  local recipient="$1" content="$2" file="$3" detail="$4"
1875
2011
  local key='' detail_failed=0 newcontent="$content" state=new first='' tail_line merged n
1876
2012
  key="$(team_notify_line_key "$content" || true)"
1877
- if [ -n "$key" ]; then
2013
+ if [ -n "$key" ] && [ "$detail" != '-' ]; then
1878
2014
  if ! team_notify_detail_append "$content" "$detail"; then
1879
2015
  detail_failed=1
1880
2016
  newcontent="$(team_notify_line_mark_detail "$content")"
@@ -1887,7 +2023,7 @@ team_inbox_write_locked() { # <recipient> <行> <文件> <明细> → state=new|
1887
2023
  if [ -n "$tail_line" ] && team_notify_line_anchor_ok "$tail_line" \
1888
2024
  && [ "$(team_notify_line_key "$tail_line" 2>/dev/null || true)" = "$key" ]; then
1889
2025
  n=$(( $(team_notify_line_events "$tail_line") + 1 ))
1890
- merged="$(team_notify_line_merge "$newcontent" "$(team_notify_line_iso "$tail_line")" "$n" "$first")"
2026
+ merged="$(team_notify_line_merge "$newcontent" "$(team_notify_line_iso "$tail_line")" "$n" "$first" "$tail_line")"
1891
2027
  if team_inbox_rewrite_last "$file" "$merged"; then
1892
2028
  state=extended
1893
2029
  first="$(team_notify_line_iso "$tail_line")"
@@ -1897,25 +2033,36 @@ team_inbox_write_locked() { # <recipient> <行> <文件> <明细> → state=new|
1897
2033
  if [ "$state" = new ]; then
1898
2034
  printf -- '- %s\n' "$newcontent" >> "$file" || return 1
1899
2035
  fi
1900
- # 写入结果协议(单行一段,扩展用 ^first=/^key= 解析):state=new|extended
1901
- printf 'state=%s\nfirst=%s\nkey=%s\n' "$state" "$first" "${key:--}"
2036
+ # 写入结果协议(单行一段,扩展用 ^state=/^first=/^key=/^lineno= 解析):state=new|extended
2037
+ # notice-fulltext-and-asks:`lineno=` = 这次写入之后那条记录在文件里的**1 基行号**(追加与截尾重写两条腿
2038
+ # 都是「文件的最后一行」)。为什么由写入侧给:敲门载荷的 `full=<文件>:<行>` 必须resolveable,
2039
+ # 而行号只有持锁的临界区里数才不会与并发追加错位(扩展自己算的数会错位 → 假定位)。
2040
+ local lineno
2041
+ lineno="$(LC_ALL=C wc -l < "$file" 2>/dev/null | tr -d ' ' || true)"
2042
+ case "$lineno" in ''|*[!0-9]*) lineno=0 ;; esac
2043
+ printf 'state=%s\nfirst=%s\nkey=%s\nlineno=%s\n' "$state" "$first" "${key:--}" "$lineno"
1902
2044
  return 0
1903
2045
  }
1904
2046
 
2047
+ # 记录行那条腿:参数与行为逐字节不变(明细 + 收件人自己的收件箱)。
2048
+ team_inbox_write_locked() { # <recipient> <行> <文件> <明细>
2049
+ team_inbox_merge_or_append "$1" "$2" "$3" "$4"
2050
+ }
2051
+
1905
2052
  # 每收件人一把锁的写入口(team_inbox_append 与扩展的 __inbox-write 共用)。
1906
- team_inbox_write_line() { # <recipient> <行> → 打印写入结果(同 team_inbox_write_locked)
1907
- local recipient="$1" content="$2"
1908
- local dir file detail lockfd rc=0
1909
- dir="$(team_inbox_dir)"; file="$dir/$recipient.md"
2053
+ # 第 4 参 = 明细文件或 `-`(指针行走的是同一个临界区,只是不写明细)。
2054
+ team_inbox_write_with_lock() { # <recipient> <行> <文件> <明细|->
2055
+ local recipient="$1" content="$2" file="$3" detail="$4"
2056
+ local dir lockfd rc=0
1910
2057
  local state; state="$(team_state_dir)"
1911
- detail="$state/notify.log"
2058
+ dir="$(dirname "$file")"
1912
2059
  mkdir -p "$dir" || return 1
1913
2060
  if command -v flock >/dev/null 2>&1; then
1914
2061
  # exec 加**不带命令**的重定向会永久改变当前 shell:`exec {fd}>&- 2>/dev/null` 会把 stderr 永久接到
1915
2062
  # /dev/null(P251 实测:say 的 team_warn 从此消失)。这里只关 fd,不带任何 stderr 重定向。
1916
2063
  if ! exec {lockfd}>"$state/inbox-$recipient.lock"; then return 1; fi
1917
2064
  if flock -w 10 "$lockfd"; then
1918
- team_inbox_write_locked "$recipient" "$content" "$file" "$detail" || rc=$?
2065
+ team_inbox_merge_or_append "$recipient" "$content" "$file" "$detail" || rc=$?
1919
2066
  else
1920
2067
  team_notify_log_line "inbox lock timeout: $state/inbox-$recipient.lock"
1921
2068
  rc=1
@@ -1923,7 +2070,24 @@ team_inbox_write_line() { # <recipient> <行> → 打印写入结果(同 team_
1923
2070
  exec {lockfd}>&-
1924
2071
  return $rc
1925
2072
  fi
1926
- team_inbox_write_locked "$recipient" "$content" "$file" "$detail"
2073
+ team_inbox_merge_or_append "$recipient" "$content" "$file" "$detail"
2074
+ }
2075
+
2076
+ team_inbox_write_line() { # <recipient> <行> → 打印写入结果(同 team_inbox_write_locked)
2077
+ local recipient="$1" content="$2" dir
2078
+ dir="$(team_inbox_dir)"
2079
+ team_inbox_write_with_lock "$recipient" "$content" "$dir/$recipient.md" "$(team_state_dir)/notify.log"
2080
+ }
2081
+
2082
+ # 指针行写进 PM 的收件箱(同一把 pm 锁;不写明细)。
2083
+ team_inbox_write_pointer_line() { # <指针行> → 0 = 已落盘;1 = 没写成
2084
+ local content="$1" file
2085
+ file="$(team_inbox_dir)/pm.md"
2086
+ # 存在却不可写 → 直接判失败:截尾重写是「mktemp + mv」,它会把一次被禁止的写入伪装成成功
2087
+ # (只读文件所在的目录可写)。指针写不进去这件事必须让调用方看得见(pointer=failed)。
2088
+ if [ -e "$file" ]; then [ -w "$file" ] || return 1; fi
2089
+ # 内层的 state=/first=/key= 是给 __inbox-write 的协议,指针腿不消费它(调用方只看 pointer=)。
2090
+ team_inbox_write_with_lock pm "$content" "$file" '-' >/dev/null
1927
2091
  }
1928
2092
 
1929
2093
  # 内部命令(扩展消费写入结果;不进 help):--agent <席位> --from-file <单行文件>
@@ -1942,10 +2106,68 @@ team_cmd_inbox_write() {
1942
2106
  [ -n "$agent" ] || team_usage_die "__inbox-write: 需要 --agent <席位>"
1943
2107
  if [ -z "$src" ] || [ ! -f "$src" ]; then team_usage_die "__inbox-write: 需要 --from-file <行文件>"; fi
1944
2108
  local content; content="$(head -n 1 "$src")"
1945
- if [ -z "$content" ]; then printf 'state=failed\nfirst=-\nkey=-\n'; return 1; fi
2109
+ if [ -z "$content" ]; then printf 'state=failed\nfirst=-\nkey=-\nlineno=0\n'; return 1; fi
1946
2110
  team_inbox_write_line "$agent" "$content"
1947
2111
  }
1948
2112
 
2113
+ # 内部命令(扩展消费;不进 help):一次 settle 的旁路记账入口。
2114
+ # --agent <seat> --outcome <enqueued|skipped:<类>> [--record-from-file <行文件>] [--identity <id>] [--task <ID>]
2115
+ # 两步,顺序写死(design §4):
2116
+ # (a) 指针腿:有记录行 → 从它派生指针行并写进 PM 的收件箱(持 pm 的收件箱锁);没有记录行 →
2117
+ # 什么都写(没有东西可以指)。
2118
+ # (b) 结果账:每一次 settle 一行 → state/notify-knock.log(与明细同一个轮转器与上界)。它必须在
2119
+ # 指针尝试**之后**写,才带得上 pointer=failed —— 反过来只能记一个假值或二次改写。
2120
+ # 两次写都是旁路:无论成败都退出 0,把结果打印成 pointer=ok|failed|none 与 ledger=ok|failed。
2121
+ team_cmd_notify_settle() {
2122
+ local agent='' outcome='' src='' identity='-' task='-'
2123
+ while [ $# -gt 0 ]; do
2124
+ case "$1" in
2125
+ --agent) agent="${2:?--agent 需要值}"; shift 2 ;;
2126
+ --agent=*) agent="${1#*=}"; shift ;;
2127
+ --outcome) outcome="${2:?--outcome 需要值}"; shift 2 ;;
2128
+ --outcome=*) outcome="${1#*=}"; shift ;;
2129
+ --record-from-file) src="${2:?--record-from-file 需要文件}"; shift 2 ;;
2130
+ --record-from-file=*) src="${1#*=}"; shift ;;
2131
+ --identity) identity="${2:?--identity 需要值}"; shift 2 ;;
2132
+ --identity=*) identity="${1#*=}"; shift ;;
2133
+ --task) task="${2:?--task 需要值}"; shift 2 ;;
2134
+ --task=*) task="${1#*=}"; shift ;;
2135
+ -*) team_usage_die "__notify-settle: 未知参数 $1" ;;
2136
+ *) team_usage_die "__notify-settle: 多余参数 $1" ;;
2137
+ esac
2138
+ done
2139
+ [ -n "$agent" ] || team_usage_die "__notify-settle: 需要 --agent <席位>"
2140
+ case "$outcome" in
2141
+ ''|-) team_usage_die "__notify-settle: 需要 --outcome <enqueued|skipped:<类>>" ;;
2142
+ enqueued) ;;
2143
+ skipped:?*) ;;
2144
+ *) team_usage_die "__notify-settle: --outcome 只有 enqueued 与 skipped:<类> 两种形状(收到 $outcome)" ;;
2145
+ esac
2146
+ local record pointer='none' cls='-'
2147
+ # 发送者是 PM 自己时没有「指针」:PM 的收件箱就是记录的落点(账照样记,它是一个 settle)。
2148
+ if [ "$agent" != pm ] && [ -n "$src" ] && [ -f "$src" ]; then
2149
+ record="$(head -n 1 "$src")"
2150
+ cls="$(team_notify_line_class "$record")"
2151
+ local pointer_line
2152
+ if ! pointer_line="$(team_notify_pointer_line "$record" "$outcome")" || [ -z "$pointer_line" ]; then
2153
+ team_notify_log_line "notify pointer derivation failed: seat=$agent outcome=$outcome"
2154
+ pointer=failed
2155
+ elif team_inbox_write_pointer_line "$pointer_line"; then
2156
+ pointer=ok
2157
+ else
2158
+ team_notify_log_line "notify pointer write failed: seat=$agent outcome=$outcome task=$task identity=$identity"
2159
+ pointer=failed
2160
+ fi
2161
+ fi
2162
+ if team_notify_knock_ledger_append "$agent" "$task" "$cls" "$outcome" "$pointer" "$identity"; then
2163
+ printf 'pointer=%s\nledger=ok\n' "$pointer"
2164
+ else
2165
+ team_notify_log_line "notify knock ledger write failed: seat=$agent outcome=$outcome pointer=$pointer"
2166
+ printf 'pointer=%s\nledger=failed\n' "$pointer"
2167
+ fi
2168
+ return 0
2169
+ }
2170
+
1949
2171
  # notify 的去重键:内容 + 长度(同一份通知在 TEAM_NOTIFY_DEDUP_SEC 内只入队/投递一次)。
1950
2172
  # 扩展走的是它自己的键(<agent>|<tag>|<summary>|<len>:<hash>),两边都进同一个队列条目。
1951
2173
  team_notify_dedup_key() { # <agent> <msg>
@@ -126,7 +126,7 @@ TEAM_ZRAM_WARN_PCT|apply|pct|0,100|plain|85|-||70,80,85,90|delivery
126
126
  TEAM_AGENT_MEM_MB|apply|mb|1,|plain|6144|-||2048,4096,6144|delivery
127
127
  TEAM_NOTIFY_TMUX|apply|bool||plain|1|-|||delivery
128
128
  TEAM_NOTIFY_DEDUP_SEC|apply|seconds|0,|plain|20|-|||delivery
129
- TEAM_INBOX_MAX_CHARS|apply|int|1,|plain|150|-||100,150,300|delivery
129
+ TEAM_INBOX_MAX_CHARS|apply|int|1,|plain|150|预览字数:敲门载荷里引用末消息的字数上限;收件箱行与 state/notify.log 存全文||100,150,300|delivery
130
130
  TEAM_NOTIFY_DETAIL_MAX|apply|int|1,|plain|2048|state/notify.log 的事件上界:越界轮转到 state/notify.log.1(只留一代)||512,2048,8192|delivery
131
131
  TEAM_NOTIFY_LOG|apply|path|file,opt|plain|/tmp/teamsmith-notify.log|-|||delivery
132
132
  TEAM_DEFER_TTL|apply|seconds|0,|plain|300|0 = 投递队列入队即过期||60,300,900|delivery