teamsmith 0.2.0 → 0.3.1

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 (163) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +69 -0
  4. package/skills/teamsmith/SKILL.md +20 -13
  5. package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
  6. package/skills/teamsmith/extension/team-notify.ts +37 -6
  7. package/skills/teamsmith/extension/team.ts +438 -0
  8. package/skills/teamsmith/references/config.md +39 -6
  9. package/skills/teamsmith/references/migration.md +197 -47
  10. package/skills/teamsmith/references/protocol.md +201 -30
  11. package/skills/teamsmith/references/troubleshooting.md +130 -10
  12. package/skills/teamsmith/references/workflows.md +36 -2
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  16. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  17. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  18. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  19. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  20. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  21. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  22. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  23. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  24. package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
  25. package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
  26. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  27. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  28. package/skills/teamsmith/scripts/lib/common.sh +1004 -245
  29. package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
  30. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  31. package/skills/teamsmith/scripts/panel/panel.js +211 -211
  32. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  33. package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
  34. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  35. package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
  36. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  37. package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
  38. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  39. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  40. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  41. package/skills/teamsmith/scripts/replies.mjs +4 -1
  42. package/skills/teamsmith/scripts/shim/killall +10 -0
  43. package/skills/teamsmith/scripts/shim/pgrep +10 -0
  44. package/skills/teamsmith/scripts/shim/pidof +10 -0
  45. package/skills/teamsmith/scripts/shim/pkill +10 -0
  46. package/skills/teamsmith/scripts/shim/signal-gate +108 -31
  47. package/skills/teamsmith/scripts/shim/tmux +18 -0
  48. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  49. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  50. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  51. package/skills/teamsmith/scripts/team +19 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  53. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  54. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  55. package/skills/teamsmith/tests/README.md +31 -0
  56. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  57. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  58. package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
  59. package/skills/teamsmith/tests/config-cli.sh +184 -32
  60. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  61. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  62. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  63. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  64. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  65. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  66. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  67. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  68. package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
  69. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  70. package/skills/teamsmith/tests/gate-guard.sh +52 -79
  71. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  72. package/skills/teamsmith/tests/install-shape.sh +359 -22
  73. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  74. package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
  75. package/skills/teamsmith/tests/key-replies.sh +281 -28
  76. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  77. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  78. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  79. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  80. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  81. package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
  82. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  83. package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
  84. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  85. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  86. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  87. package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
  88. package/skills/teamsmith/tests/panel-b2.sh +430 -352
  89. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  90. package/skills/teamsmith/tests/panel-b3.sh +314 -62
  91. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  92. package/skills/teamsmith/tests/panel-cpu.sh +43 -130
  93. package/skills/teamsmith/tests/panel-p21.sh +251 -265
  94. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  95. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  96. package/skills/teamsmith/tests/perf.sh +187 -396
  97. package/skills/teamsmith/tests/routes.sh +440 -117
  98. package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
  99. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  100. package/skills/teamsmith/tests/section-guard.sh +13 -102
  101. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  102. package/skills/teamsmith/tests/section-paths.tsv +32 -18
  103. package/skills/teamsmith/tests/section-select.sh +371 -19
  104. package/skills/teamsmith/tests/signal-gate.sh +249 -27
  105. package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
  106. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  107. package/skills/teamsmith/tests/slash-team.sh +617 -0
  108. package/skills/teamsmith/tests/slice-coverage.sh +206 -0
  109. package/skills/teamsmith/tests/smoke.sh +3595 -788
  110. package/skills/teamsmith/tests/task-model-routing.sh +530 -15
  111. package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
  112. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  113. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  114. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  115. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  116. package/skills/teamsmith/tests/workflow-entry.sh +207 -0
  117. package/skills/teamsmith-init/SKILL.md +12 -12
  118. package/skills/teamsmith-init/references/bootstrap.md +3 -3
  119. package/skills/teamsmith/tests/flip-glue.sh +0 -162
  120. package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
  121. package/skills/teamsmith/tests/flip-m12.sh +0 -185
  122. package/skills/teamsmith/tests/flip-m16.sh +0 -166
  123. package/skills/teamsmith/tests/flip-m17.sh +0 -204
  124. package/skills/teamsmith/tests/flip-m34.sh +0 -96
  125. package/skills/teamsmith/tests/flip-m37.sh +0 -185
  126. package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
  127. package/skills/teamsmith/tests/flip-m43.sh +0 -128
  128. package/skills/teamsmith/tests/flip-m45.sh +0 -244
  129. package/skills/teamsmith/tests/flip-m46.sh +0 -238
  130. package/skills/teamsmith/tests/flip-m48.sh +0 -304
  131. package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
  132. package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
  133. package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
  134. package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
  135. package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
  136. package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
  137. package/skills/teamsmith/tests/flip-p144.sh +0 -112
  138. package/skills/teamsmith/tests/flip-p156.sh +0 -133
  139. package/skills/teamsmith/tests/flip-p160.sh +0 -182
  140. package/skills/teamsmith/tests/flip-p171.sh +0 -249
  141. package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
  142. package/skills/teamsmith/tests/flip-p20.sh +0 -286
  143. package/skills/teamsmith/tests/flip-p201.sh +0 -249
  144. package/skills/teamsmith/tests/flip-p210.sh +0 -239
  145. package/skills/teamsmith/tests/flip-p211.sh +0 -152
  146. package/skills/teamsmith/tests/flip-p217.sh +0 -288
  147. package/skills/teamsmith/tests/flip-p22.sh +0 -123
  148. package/skills/teamsmith/tests/flip-p23.sh +0 -239
  149. package/skills/teamsmith/tests/flip-p25.sh +0 -165
  150. package/skills/teamsmith/tests/flip-p71.sh +0 -184
  151. package/skills/teamsmith/tests/flip-p72.sh +0 -202
  152. package/skills/teamsmith/tests/load-experiment.sh +0 -290
  153. package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
  154. package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
  155. package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
  156. package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
  157. package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
  158. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
  159. package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
  160. package/skills/teamsmith/tests/panel-knobs.sh +0 -83
  161. package/skills/teamsmith/tests/section-budgets.tsv +0 -154
  162. package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
  163. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
@@ -9,8 +9,9 @@
9
9
  #
10
10
  # 为什么要有它(design.md §D1–D3、§D8):
11
11
  # ① 根一律建在**解析后的**临时根 `${TMPDIR:-/tmp}`(写死 `/tmp` 的模板会被 --lint 判红);
12
- # 名字进一个 owned 家族 `teamsmith-<kind>.XXXXXX`(sweep 只认这个前缀,别的前缀不碰);
13
- # ② 根里写 owner 标记 `.teamsmith-tmp`(kind / 创建 pid / 该进程启动时间 / boot id / run id),
12
+ # 名字进一个 owned 家族 **并带本项目的命名空间** `teamsmith-<kind>-<ns>.XXXXXX`(P287;
13
+ # sweep 只认这个前缀,别的前缀不碰;ns 让「另一个项目的清理命令」认不出这是它的东西);
14
+ # ② 根里写 owner 标记 `.teamsmith-tmp`(kind / 创建 pid / 该进程启动时间 / boot id / run id / ns),
14
15
  # 于是 killed run 的残留**可归因**,且「owner 已死」判定对 pid 复用安全;
15
16
  # ③ 每次创建追加一条 run 台账(`$TEAM_TMP_LEDGER`,默认临时根下的点开头文件;台账头从 P122 起带
16
17
  # `repo=<主仓库>` 仓库身份)—— 门禁据此断言「本轮创建的根一个都不许留下」,而不是去猜文件系统,
@@ -38,10 +39,66 @@
38
39
  TMP_ROOT_LIB=1
39
40
  TMP_ROOT_FAMILY_PREFIX="teamsmith-"
40
41
 
42
+ # P287(change: gate-lock-external-deletion):项目命名空间 ns 的**唯一实现**在
43
+ # `scripts/lib/common.sh`(team_project_ns)—— 本文件只调它,不复制第二份。没有那份库时
44
+ # (极端手工拷贝)退到一个诚实的无签名值,绝不报错。
45
+ # P309:产品库的位置。默认按本文件的相对位置推;**部分拷贝的夹具**(自我变异副本只拷了
46
+ # `lib/tmp-root.sh`)显式给出 `TEAM_TMP_SKILL_DIR` 指回真库 —— 否则解析器不在,创建者会具名失败
47
+ # (这是刻意的:宁可具名失败也不猜一个默认根)。仍然只有**一处**实现(common.sh)。
48
+ TMP_ROOT_SKILL_DIR="${TEAM_TMP_SKILL_DIR:-$(cd -P "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd || true)}"
49
+ if [ -n "$TMP_ROOT_SKILL_DIR" ] && [ -f "$TMP_ROOT_SKILL_DIR/scripts/lib/common.sh" ]; then
50
+ # shellcheck source=../../scripts/lib/common.sh
51
+ . "$TMP_ROOT_SKILL_DIR/scripts/lib/common.sh"
52
+ fi
53
+
41
54
  _tmp_root_err() { printf 'tmp-root: %s\n' "$*" >&2; }
42
55
 
43
56
  # ---------------------------------------------------------------- 基础事实
44
- tmp_root_base() { printf '%s\n' "${TMPDIR:-/tmp}"; }
57
+ # P309:基准 = product 库里**唯一**的解析器 `team_tmp_root`(TMPDIR → TEAM_TMP_ROOT → 磁盘默认
58
+ # `/var/tmp/teamsmith-<ns>`)。创建者不自己算这个根:两处各算 = 两个答案 = 清扫器与门禁对不上基准。
59
+ # 库没 source 进来 → 具名失败(绝不猜一个默认值接着跑)。
60
+ tmp_root_base() {
61
+ if ! declare -F team_tmp_root >/dev/null 2>&1; then
62
+ _tmp_root_err "缺少解析器 team_tmp_root(scripts/lib/common.sh 没被 source 进来)—— 不猜默认值"
63
+ return 3
64
+ fi
65
+ team_tmp_root
66
+ }
67
+
68
+ # 私有 tmux socket 的**短基址**(P310 的判据、P309 起由这里统一实现):`<dir>/tmux-<uid>/<名字>` 必须
69
+ # ≤ AF_UNIX 的 107 字节,而 socket 路径的**长度不许跟着临时根变长**(临时根名带 ns + 6 位随机,嵌套一层
70
+ # 就把 83 顶到 129)。先试解析出的临时根(与夹具同一块盘),放不下再退 OS 默认临时目录;两处都不行 →
71
+ # 返回 1,由调用者决定硬停还是退回临时根下(不静默)。
72
+ # 这里是**唯一**允许直接写平台默认临时目录的地方(--lint 对本文件豁免;别处一律调 team_tmp_root)。
73
+ # 回退基址是**系统**临时目录(不是 `$TMPDIR`):判据就是「无论临时根被指到多深,socket 都放得下」,
74
+ # 回退到 `$TMPDIR` 再深一次等于没回退(flip-p158 的 case 目录 120 字节就是这样把 cleanup 顶到 158 的)。
75
+ TMP_ROOT_SOCKET_FALLBACK="${TMP_ROOT_SOCKET_FALLBACK:-/tmp}"
76
+ tmp_root_socket_dir() { # <kind> <socket 名(含 tmux-<uid>/ 前缀,取上界)> → 打印目录
77
+ local kind="${1:-tmux}" name="${2:-default}" base dir
78
+ for base in "$(tmp_root_base 2>/dev/null || true)" "$TMP_ROOT_SOCKET_FALLBACK"; do
79
+ [ -n "$base" ] && [ -d "$base" ] || continue
80
+ dir="$(mktemp -d "$base/.${kind:0:1}-$(id -u).XXXXXX" 2>/dev/null || true)"
81
+ [ -n "$dir" ] || continue
82
+ if [ $(( ${#dir} + 1 + ${#name} )) -le 107 ]; then printf '%s\n' "$dir"; return 0; fi
83
+ rmdir "$dir" 2>/dev/null || true
84
+ done
85
+ return 1
86
+ }
87
+
88
+ # 解析来源(tmpdir | config | default);库不在 → 空
89
+ tmp_root_source() { declare -F team_tmp_root_source >/dev/null 2>&1 && team_tmp_root_source; }
90
+
91
+ # 本项目的命名空间(`<slug>-<hash8>`,一处实现在 common.sh)。
92
+ tmp_root_ns() {
93
+ if [ -z "${TMP_ROOT_NS:-}" ]; then
94
+ TMP_ROOT_NS=""
95
+ if declare -F team_project_ns >/dev/null 2>&1; then
96
+ TMP_ROOT_NS="$(team_project_ns 2>/dev/null || true)"
97
+ fi
98
+ [ -n "$TMP_ROOT_NS" ] || TMP_ROOT_NS="nosig-00000000"
99
+ fi
100
+ printf '%s\n' "$TMP_ROOT_NS"
101
+ }
45
102
 
46
103
  # run id:优先 TEAM_TMP_RUN_ID;嵌套夹具会清掉 TEAM_*(身份清理),所以门禁同时给非 TEAM_ 的
47
104
  # SMOKE_TMP_RUN_ID(它不属于身份,清不掉的传播位)。都没有 → 本进程自己算一个(跨子 shell 稳定)。
@@ -88,11 +145,17 @@ _tmp_root_proc_alive() {
88
145
  return 0
89
146
  }
90
147
 
91
- # 路径是不是「解析后的临时根下的 owned 家族」——--lint/自检用;`--break=notmpdir` 模拟写死 /tmp 混过关。
148
+ # 路径是不是「解析后的临时根下的 owned 家族,且名字带本项目的 ns」——--lint/自检用;
149
+ # `--break=notmpdir` 模拟写死 /tmp 混过关。
92
150
  tmp_root_path_ok() {
93
151
  if [ "${TMP_ROOT_BREAK:-}" = "notmpdir" ]; then return 0; fi
152
+ local rest
94
153
  case "${1:-}" in
95
- "$(tmp_root_base)"/"$TMP_ROOT_FAMILY_PREFIX"*) return 0 ;;
154
+ "$(tmp_root_base)"/"$TMP_ROOT_FAMILY_PREFIX"*) rest="${1#"$(tmp_root_base)"/}" ;;
155
+ *) return 1 ;;
156
+ esac
157
+ case "$rest" in
158
+ "$TMP_ROOT_FAMILY_PREFIX"*"-$(tmp_root_ns)".*) return 0 ;;
96
159
  *) return 1 ;;
97
160
  esac
98
161
  }
@@ -106,11 +169,11 @@ _tmp_root_repo_id() {
106
169
  g="$(git -C "$lib" rev-parse --path-format=absolute --git-common-dir 2>/dev/null || true)"
107
170
  if [ -n "$g" ]; then dirname "$g"; else printf 'unknown\n'; fi
108
171
  }
109
- _tmp_root_ledger_append() { # <path> <pid> <start> <kind> <created>
172
+ _tmp_root_ledger_append() { # <path> <pid> <start> <kind> <created> <ns>
110
173
  local f; f="$(tmp_root_ledger)"
111
174
  if [ ! -f "$f" ]; then
112
- printf '# teamsmith temp ledger run=%s owner=%s started=%s repo=%s\n' \
113
- "$(tmp_root_run_id)" "$$" "$(date +%s 2>/dev/null || printf 0)" "$(_tmp_root_repo_id)" >"$f" 2>/dev/null || return 1
175
+ printf '# teamsmith temp ledger run=%s owner=%s started=%s repo=%s ns=%s\n' \
176
+ "$(tmp_root_run_id)" "$$" "$(date +%s 2>/dev/null || printf 0)" "$(_tmp_root_repo_id)" "${6:-?}" >"$f" 2>/dev/null || return 1
114
177
  fi
115
178
  printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$1" "$2" "$3" "$4" "$5" "$(tmp_root_run_id)" >>"$f" 2>/dev/null || return 1
116
179
  return 0
@@ -139,26 +202,53 @@ tmp_root_create() {
139
202
  case "$kind" in
140
203
  ''|*[!A-Za-z0-9._-]*) _tmp_root_err "非法 kind [${kind}](只允许 A-Za-z0-9._-)"; return 2 ;;
141
204
  esac
142
- local base; base="$(tmp_root_base)"
143
- if [ ! -d "$base" ]; then
144
- _tmp_root_err "临时根 $base 不存在(TMPDIR 指向不存在的目录?)"
145
- return 3
205
+ local base src; base="$(tmp_root_base)" || return 3
206
+ src="$(tmp_root_source)"
207
+ [ -n "$src" ] || src="default"
208
+ # P309:默认腿的目录由**创建者**按需建(0700,本变更里唯一被自动创建的目录);显式选定的根
209
+ # (TMPDIR / 契约的 TEAM_TMP_ROOT)必须已经存在且可写 —— 具名失败,**绝不**静默回落到 /tmp。
210
+ if [ "$src" = "default" ] && [ ! -d "$base" ]; then
211
+ if mkdir -p -m 700 -- "$base" 2>/dev/null; then
212
+ _tmp_root_err "临时根目录已创建:$base(source=default,0700)"
213
+ fi
146
214
  fi
215
+ if ! team_tmp_root_usable "$base" 2>/dev/null; then
216
+ if [ "${TMP_ROOT_BREAK:-}" = "fallback" ]; then
217
+ # 自检红侧:把「静默回落」这个缺陷形状放回来(守门断言必须因此变红)
218
+ _tmp_root_err "FLIP(fallback):$base 不可用 → 静默改用 /tmp"
219
+ base="/tmp"
220
+ else
221
+ local why="不存在"
222
+ if [ -e "$base" ]; then
223
+ if [ ! -d "$base" ]; then why="不是目录"; elif [ ! -w "$base" ]; then why="不可写"; fi
224
+ fi
225
+ _tmp_root_err "临时根不可用:$base(source=$src)$why"
226
+ _tmp_root_err " 修法:mkdir -p '$base' 并确保可写;或把 $([ "$src" = "tmpdir" ] && printf 'TMPDIR' || printf 'TEAM_TMP_ROOT') 改到已存在的可写目录"
227
+ return 3
228
+ fi
229
+ fi
230
+ local ns; ns="$(tmp_root_ns)"
231
+ # P287:根的名字带项目 ns(`teamsmith-<kind>-<ns>.XXXXXX`);自检红侧 flat-name 回到改动前的
232
+ # 平铺名(名字里没有 ns),no-ns 保留名字但让标记/台账丢掉 ns。
233
+ local tmpl="$base/$TMP_ROOT_FAMILY_PREFIX$kind-$ns.XXXXXX"
234
+ [ "${TMP_ROOT_BREAK:-}" = "flat-name" ] && tmpl="$base/$TMP_ROOT_FAMILY_PREFIX$kind.XXXXXX"
147
235
  local root
148
- root="$(mktemp -d "$base/$TMP_ROOT_FAMILY_PREFIX$kind.XXXXXX" 2>/dev/null)" || {
236
+ root="$(mktemp -d "$tmpl" 2>/dev/null)" || {
149
237
  _tmp_root_err "在 $base 下建不出根(空间/inode/权限?)"; return 3; }
150
- local pid=$$ start boot created run
238
+ local pid=$$ start boot created run marker_ns
151
239
  start="$(_tmp_root_proc_start "$pid" 2>/dev/null || true)"
152
240
  boot="$(cat /proc/sys/kernel/random/boot_id 2>/dev/null || printf 'unknown')"
153
241
  created="$(date +%s 2>/dev/null || printf 0)"
154
242
  run="$(tmp_root_run_id)"
155
- if ! { printf 'kind=%s\npid=%s\nstart=%s\nboot=%s\nrun=%s\ncreated=%s\n' \
156
- "$kind" "$pid" "${start:-unknown}" "$boot" "$run" "$created" >"$root/.teamsmith-tmp"; }; then
243
+ marker_ns="$ns"
244
+ [ "${TMP_ROOT_BREAK:-}" = "no-ns" ] && marker_ns="-"
245
+ if ! { printf 'kind=%s\npid=%s\nstart=%s\nboot=%s\nrun=%s\ncreated=%s\nns=%s\n' \
246
+ "$kind" "$pid" "${start:-unknown}" "$boot" "$run" "$created" "$marker_ns" >"$root/.teamsmith-tmp"; }; then
157
247
  _tmp_root_err "写不了 owner 标记 $root/.teamsmith-tmp"
158
248
  rm -rf -- "$root" 2>/dev/null || true
159
249
  return 3
160
250
  fi
161
- _tmp_root_ledger_append "$root" "$pid" "${start:-unknown}" "$kind" "$created" || true
251
+ _tmp_root_ledger_append "$root" "$pid" "${start:-unknown}" "$kind" "$created" "$marker_ns" || true
162
252
  printf '%s\n' "$root"
163
253
  return 0
164
254
  }
@@ -316,7 +406,7 @@ _tmp_root_selftest() {
316
406
  case "$a" in
317
407
  --break=*) break_stage="${a#--break=}" ;;
318
408
  -h|--help)
319
- printf '用法:bash %s --self-test [--break=nokill|nokeeep|notmpdir|noreap]\n' "${BASH_SOURCE[0]}"
409
+ printf '用法:bash %s --self-test [--break=nokill|nokeeep|notmpdir|noreap|flat-name|no-ns]\n' "${BASH_SOURCE[0]}"
320
410
  return 0 ;;
321
411
  *) _tmp_root_err "不认识的自检参数 [$a]"; return 2 ;;
322
412
  esac
@@ -329,33 +419,49 @@ _tmp_root_selftest() {
329
419
  local self_path
330
420
  self_path="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
331
421
  local st_dir
332
- st_dir="$(mktemp -d "$(tmp_root_base)/teamsmith-libselftest.XXXXXX" 2>/dev/null)" || {
422
+ st_dir="$(mktemp -d "$(tmp_root_base)/teamsmith-libselftest-$(tmp_root_ns).XXXXXX" 2>/dev/null)" || {
333
423
  _tmp_root_err "自检建不出临时目录"; return 3; }
334
424
  trap "rm -rf -- '$st_dir'" EXIT # 路径要内嵌:trap 在函数返回后执行,local 变量那时已经不在了
335
425
 
336
426
  printf '\n\033[1m== tmp-root.sh 自检 ==\033[0m(break=%s)\n' "${break_stage:-none}"
337
427
 
338
- # ① 创建:路径、家族名、标记、台账
428
+ # ① 创建:路径、家族名、命名空间、标记、台账
339
429
  export TMPDIR="$st_dir"
340
- local r; r="$(tmp_root_create selftest)"
341
- case "$r" in "$st_dir"/teamsmith-selftest.*) st_ok "根建在 \${TMPDIR} 下并且名字在 owned 家族($r)" ;;
342
- *) st_bad "根的路径/名字不对([$r],期望 $st_dir/teamsmith-selftest.*)" ;; esac
430
+ local r my_ns; my_ns="$(tmp_root_ns)"; r="$(tmp_root_create selftest)"
431
+ case "$r" in "$st_dir"/teamsmith-selftest-*) st_ok "根建在解析出的临时根下并且名字在 owned 家族($r)" ;;
432
+ *) st_bad "根的路径/名字不对([$r],期望 $st_dir/teamsmith-selftest-<ns>.*)" ;; esac
433
+ # P287:名字必须带本项目的 ns(flat-name 红侧会在这里变红)
434
+ if case "$r" in "$st_dir"/teamsmith-selftest-"$my_ns".*) true ;; *) false ;; esac; then
435
+ st_ok "根的名字带项目命名空间(ns=$my_ns)"
436
+ else
437
+ st_bad "根的名字没有带项目命名空间([$r],期望 $st_dir/teamsmith-selftest-$my_ns.*)"
438
+ fi
343
439
  if [ -f "$r/.teamsmith-tmp" ] && grep -q "^kind=selftest$" "$r/.teamsmith-tmp" \
344
440
  && grep -q "^pid=$$$" "$r/.teamsmith-tmp" && grep -q '^run=' "$r/.teamsmith-tmp"; then
345
- st_ok "owner 标记写全(kind / pid / start / boot / run / created)"
441
+ st_ok "owner 标记写全(kind / pid / start / boot / run / created / ns)"
346
442
  else
347
443
  st_bad "owner 标记缺字段:$(tr '\n' ' ' <"$r/.teamsmith-tmp" 2>/dev/null)"
348
444
  fi
445
+ if grep -q "^ns=$my_ns$" "$r/.teamsmith-tmp" 2>/dev/null; then
446
+ st_ok "owner 标记带 ns=$my_ns(no-ns 红侧会在这里变红)"
447
+ else
448
+ st_bad "owner 标记没带 ns(期望 ns=$my_ns,实际 $(sed -n 's/^ns=//p' "$r/.teamsmith-tmp" 2>/dev/null))"
449
+ fi
349
450
  if [ -f "$(tmp_root_ledger)" ] && grep -qF "$r $$" "$(tmp_root_ledger)"; then
350
451
  st_ok "run 台账里有这一条($(tmp_root_ledger))"
351
452
  else
352
453
  st_bad "run 台账里没有这条根"
353
454
  fi
354
455
  if head -1 "$(tmp_root_ledger)" 2>/dev/null | grep -Eq ' repo=[^ ]'; then
355
- st_ok "run 台账头记了仓库身份($(head -1 "$(tmp_root_ledger)" | sed -n 's/.* repo=//p'))"
456
+ st_ok "run 台账头记了仓库身份($(head -1 "$(tmp_root_ledger)" | sed -n 's/.* repo=\([^ ]*\).*/\1/p'))"
356
457
  else
357
458
  st_bad "run 台账头没有 repo= 仓库身份"
358
459
  fi
460
+ if head -1 "$(tmp_root_ledger)" 2>/dev/null | grep -q " ns=$my_ns"; then
461
+ st_ok "run 台账头带 ns=$my_ns"
462
+ else
463
+ st_bad "run 台账头没有 ns=(no-ns 红侧会在这里变红)"
464
+ fi
359
465
 
360
466
  # ② notmpdir:写死 /tmp 的路径不许被当成合规根
361
467
  if tmp_root_path_ok /tmp/teamsmith-whatever.1234; then
@@ -363,10 +469,16 @@ _tmp_root_selftest() {
363
469
  else
364
470
  st_ok "写死 /tmp 的路径被拒(tmp_root_path_ok 非 0)"
365
471
  fi
472
+ if tmp_root_path_ok "$st_dir/teamsmith-x-$(tmp_root_ns).1234"; then
473
+ st_ok "解析出的临时根下带 ns 的家族路径被接受"
474
+ else
475
+ st_bad "解析出的临时根下带 ns 的家族路径被误拒"
476
+ fi
477
+ # P287:家族名在但不带 ns 的路径照样不合规(no-ns 的形状)
366
478
  if tmp_root_path_ok "$st_dir/teamsmith-x.1234"; then
367
- st_ok "\${TMPDIR} 下的家族路径被接受"
479
+ st_bad "解析出的临时根下不带 ns 的家族路径被接受(命名空间规则失效)"
368
480
  else
369
- st_bad "\${TMPDIR} 下的家族路径被误拒"
481
+ st_ok "解析出的临时根下不带 ns 的家族路径被拒(tmp_root_path_ok 非 0)"
370
482
  fi
371
483
 
372
484
  # ③ 正常回收:子进程创建 → 退出 → 根消失
@@ -16,11 +16,20 @@
16
16
  # shellcheck source=tmux-iso.sh
17
17
  . "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmux-iso.sh"
18
18
 
19
+ # P287:ns(临时根名字里的项目命名空间)的唯一实现在 scripts/lib/common.sh —— 本库被 smoke 前导段
20
+ # source(tmp-root.sh 已经带进来了),独立 source 时自己补一次。
21
+ if ! declare -F team_project_ns >/dev/null 2>&1; then
22
+ _tmux_cap_lib="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/../.." 2>/dev/null && pwd)/scripts/lib/common.sh"
23
+ [ -f "$_tmux_cap_lib" ] && . "$_tmux_cap_lib"
24
+ unset _tmux_cap_lib
25
+ fi
26
+
19
27
  # M47:`#{bracket_paste_flag}` 是 tmux **3.7 起**才有的格式(同族的旧 tmux 上产品保守地走「多行落文件
20
28
  # + 一行指针」,那不是缺陷,是无从探测)。
21
29
  tmux_has_bracket_paste_format() {
22
30
  local s="bpf-$$" d v rc=1
23
- d="$(mktemp -d "${TMPDIR:-/tmp}/teamsmith-tmux-cap.XXXXXX" 2>/dev/null)" || return 1
31
+ team_tmp_root_prepare >/dev/null 2>&1 || true
32
+ d="$(mktemp -d "$(team_tmp_root)/teamsmith-tmux-cap-$(team_project_ns).XXXXXX" 2>/dev/null)" || return 1
24
33
  if env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$d" tmux new-session -d -s "$s" -x 80 -y 24 'sleep 5' 2>/dev/null; then
25
34
  v="$(env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$d" tmux display-message -p -t "$s" '#{bracket_paste_flag}' 2>/dev/null)"
26
35
  [ -n "$v" ] && rc=0
@@ -21,7 +21,9 @@
21
21
  # 硬停)。唯一的旋钮 TEAM_TMUX_ISO_LOG 只决定审计行写哪(不改判定;自检 0h 正面钉住)。
22
22
  #
23
23
  # 入口:
24
- # tmux_iso_prove [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdir C] [--argv <tmux argv…>] → 0/1(判定)
24
+ # tmux_iso_prove [--tmpdir D] [--sock-name N] [--own-root R]… [--caller-tmpdir C] [--argv <tmux argv…>] → 0/1(判定)
25
+ # (--own-root 可重复:目标 socket 落在**任一个**本轮自有目录之下即可;P310 起套件
26
+ # 同时给临时根与私有 socket 目录 —— 后者在临时根之外,见 smoke.sh 的 P310 注释)
25
27
  # tmux_iso_require <段> <用途> [同上] → 证明通过则静默返回;不通过则硬停(exit 2)
26
28
  # tmux_iso_guard_soft <段> <用途> [同上] → 不通过则「响亮拒绝但不 exit」(收尾路径用)
27
29
  # tmux_iso_argv_parse <argv…> → 解析动词/显式目标(只吃逐词 argv,产出见下)
@@ -59,6 +61,8 @@ if ! . "$TMUX_ISO_SHARED_DIR/tmux-argv.sh" 2>/dev/null || ! declare -F tmux_cls_
59
61
  exit 127
60
62
  fi
61
63
 
64
+ # P309:审计日志的默认位置在解析出的临时根下 —— 解析器只有一处,这里把它 source 进来(幂等:纯定义)。
65
+ . "$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/tmp-root.sh"
62
66
  TMUX_ISO_AF_UNIX_MAX="${TMUX_ISO_AF_UNIX_MAX:-107}" # Linux sun_path 全 108 字节(含 NUL)→ 可用 107
63
67
  TMUX_ISO_STOP_CODE="${TMUX_ISO_STOP_CODE:-2}"
64
68
 
@@ -101,7 +105,8 @@ tmux_iso_argv_parse() { # <argv…>
101
105
 
102
106
 
103
107
  tmux_iso_log() { # 审计行落点(只影响落点,不影响判定)
104
- printf '%s' "${TEAM_TMUX_ISO_LOG:-${TMPDIR:-/tmp}/teamsmith-tmux-iso-guard.$$.log}"
108
+ # P287:直接落在解析后临时根上的审计日志点开头(不是别人的前缀 glob 的猎物)
109
+ printf '%s' "${TEAM_TMUX_ISO_LOG:-$(team_tmp_root)/.teamsmith-tmux-iso-guard.$$.log}"
105
110
  }
106
111
 
107
112
  tmux_iso_audit() { # <段> <用途> <不成立> <细节> <期望 socket> <实际 socket>
@@ -149,13 +154,15 @@ tmux_iso_prove() { # [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdi
149
154
  TMUX_ISO_EFFECTIVE_TMPDIR=""
150
155
  local dir="" name="default" own="" caller=""
151
156
  TMUX_ISO_CALL_ARGV=()
157
+ # P310:--own-root 可重复(多个本轮自有目录,命中任一即可)
158
+ local -a owns=()
152
159
  # 值类选项缺值时**立刻**以 bad-option 退出(M36 的教训:`shift 2` 在 $#<2 上失败会让 while
153
160
  # 原地打转 → 挂死;这里每条路径都 shift ≥1 或 break)。
154
161
  while [ $# -gt 0 ]; do
155
162
  case "$1" in
156
163
  --tmpdir) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--tmpdir 缺值"; return 1; }; dir="${2-}"; shift 2 ;;
157
164
  --sock-name) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--sock-name 缺值"; return 1; }; name="${2-}"; [ -n "$name" ] || name="default"; shift 2 ;;
158
- --own-root) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--own-root 缺值"; return 1; }; own="${2-}"; shift 2 ;;
165
+ --own-root) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--own-root 缺值"; return 1; }; owns+=("${2-}"); shift 2 ;;
159
166
  --caller-tmpdir) [ $# -ge 2 ] || { TMUX_ISO_REASON="bad-option"; TMUX_ISO_DETAIL="--caller-tmpdir 缺值"; return 1; }; caller="${2-}"; shift 2 ;;
160
167
  --argv) shift; TMUX_ISO_CALL_ARGV=("$@"); break ;;
161
168
  *) TMUX_ISO_REASON="bad-option"
@@ -202,13 +209,20 @@ tmux_iso_prove() { # [--tmpdir D] [--sock-name N] [--own-root R] [--caller-tmpdi
202
209
  TMUX_ISO_DETAIL="socket 路径 ${#expected} 字节 > AF_UNIX 上限 $TMUX_ISO_AF_UNIX_MAX(私有 server 绑不上)"
203
210
  return 1
204
211
  fi
205
- if [ -n "$own" ]; then
212
+ # P310:多个自有目录(临时根 + 临时根之外的私有 socket 目录),**任一个**盖住目标即可。
213
+ # 空值不算数(空 own-root 会被规范化成空串,`""/*` 会匹配任何绝对路径 —— 那是假的放行)。
214
+ local _own_ok=0 _own_norm _own_list=""
215
+ for own in ${owns[@]+"${owns[@]}"}; do
216
+ [ -n "$own" ] || continue
217
+ _own_list="${_own_list:+$_own_list、}$own"
206
218
  case "$(tmux_iso_norm "$expected")" in
207
- "$(tmux_iso_norm "$own")"/*) ;;
208
- *) TMUX_ISO_REASON="outside-own-root"
209
- TMUX_ISO_DETAIL="目标 socket 不在本轮自有目录 $own 之下($expected)"
210
- return 1 ;;
219
+ "$(tmux_iso_norm "$own")"/*) _own_ok=1 ;;
211
220
  esac
221
+ done
222
+ if [ -n "$_own_list" ] && [ "$_own_ok" != "1" ]; then
223
+ TMUX_ISO_REASON="outside-own-root"
224
+ TMUX_ISO_DETAIL="目标 socket 不在本轮自有目录 ${_own_list} 之下($expected)"
225
+ return 1
212
226
  fi
213
227
  # ③ 不许是共享默认 socket(或调用者原来那份默认 socket)
214
228
  if [ "$(tmux_iso_norm "$expected")" = "$(tmux_iso_norm "$default_sock")" ]; then
@@ -310,13 +324,14 @@ tmux_iso_guard_soft() { # <段> <用途> [证明参数…]:通过 → 0;不
310
324
  # ── P180/P188 · 套件的壳函数(tmux / command tmux / builtin command tmux):同一条入口 ──────────
311
325
  # 非破坏性调用原样透传(PATH 解析与改动前一致);破坏性调用先过前置(不成立 → 硬停),再按 M23 的
312
326
  # 形态执行(env -u TMUX -u TMUX_PANE + 本轮私有 TMUX_TMPDIR)—— 那也是 tmux-lint 认的隔离证据形态。
313
- tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <argv…>
327
+ tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R… --caller-tmpdir C] -- <argv…>
314
328
  local label="${1:-?}"; shift || true
315
- local dir="" own="" caller=""
329
+ local dir="" caller=""
330
+ local -a own_args=()
316
331
  while [ $# -gt 0 ]; do
317
332
  case "$1" in
318
333
  --tmpdir) [ $# -ge 2 ] || break; dir="${2-}"; shift 2 ;;
319
- --own-root) [ $# -ge 2 ] || break; own="${2-}"; shift 2 ;;
334
+ --own-root) [ $# -ge 2 ] || break; own_args+=(--own-root "${2-}"); shift 2 ;;
320
335
  --caller-tmpdir) [ $# -ge 2 ] || break; caller="${2-}"; shift 2 ;;
321
336
  --) shift; break ;;
322
337
  *) break ;;
@@ -324,7 +339,7 @@ tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <
324
339
  done
325
340
  tmux_iso_argv_parse "$@"
326
341
  if [ "$TMUX_ISO_ARGV_DESTRUCTIVE" = "1" ]; then
327
- tmux_iso_require "$label" "tmux $*" --tmpdir "$dir" --own-root "$own" \
342
+ tmux_iso_require "$label" "tmux $*" --tmpdir "$dir" ${own_args[@]+"${own_args[@]}"} \
328
343
  --caller-tmpdir "$caller" --argv "$@" || return 1
329
344
  env -u TMUX -u TMUX_PANE TMUX_TMPDIR="$dir" "${TMUX_ISO_REAL_TMUX:-tmux}" "$@"
330
345
  else
@@ -345,7 +360,10 @@ tmux_iso_suite_call() { # <段> [--tmpdir D --own-root R --caller-tmpdir C] -- <
345
360
  tmux_iso_install_suite_guards() { # <真 tmux 路径>
346
361
  TMUX_ISO_REAL_TMUX="${1:-}"
347
362
  tmux() {
348
- tmux_iso_suite_call "${SMOKE_SEC_OPEN_ID:-?}" --tmpdir "${TMUX_TMPDIR:-}" --own-root "${TMP:-}" \
363
+ # P310:两个本轮自有目录 —— 临时根,与**临时根之外**的私有 socket 目录(后者太短不进临时根,见 smoke.sh)
364
+ local -a _iso_own=(--own-root "${TMP:-}")
365
+ [ -n "${SMOKE_TMUX_OWN_ROOT:-}" ] && _iso_own+=(--own-root "$SMOKE_TMUX_OWN_ROOT")
366
+ tmux_iso_suite_call "${SMOKE_SEC_OPEN_ID:-?}" --tmpdir "${TMUX_TMPDIR:-}" ${_iso_own[@]+"${_iso_own[@]}"} \
349
367
  --caller-tmpdir "${SMOKE_CALLER_TMUX_TMPDIR:-}" -- "$@"
350
368
  }
351
369
  command() {
@@ -5,80 +5,86 @@
5
5
  # anchor = while 原文行(checked 的锚点:与源码逐字符子串比较;换了写法 → 红并点名 file:line)
6
6
  # 范围:tests/*.sh + tests/lib/*.sh 的**自身** while+sleep 循环;heredoc/字符串里拼出来的
7
7
  # 脚本(如 container-tmux.sh 写进容器的 inner 脚本、嵌入的 python/awk)不在扫描面内。
8
- flip-m37.sh 113 cap="$m37_i" -lt 50 while [ "$m37_i" -lt 50 ] && { [ -z "$(m37_child_of "$SESS:m37w")" ] || [ -z "$(m37_child_of "$SESS:m37-lit")" ]; }; do
9
- flip-p217.sh 157 cap="$i" -lt 40 while [ "$i" -lt 40 ]; do
10
- flip-p210.sh 130 cap="$p210_i" -lt 50 while [ "$p210_i" -lt 50 ] && [ "$(tmux list-panes -t "$SESS:p210dead" -F '#{pane_dead}' 2>/dev/null | head -1)" != "1" ]; do
11
- flip-p210.sh 135 cap="$p210_j" -lt 20 while [ "$p210_j" -lt 20 ]; do
12
- flip-m4.3.sh 86 cap="$i" -lt $((n * 4)) while [ "$i" -lt $((n * 4)) ]; do
13
- flip-m7.2.sh 190 bound=夹具的停止位文件(采集器随调用方写 stop 一起退出) while [ ! -f "$stop" ]; do
14
- flip-m7.2.sh 217 cap="$i" -lt 60 while [ "$i" -lt 60 ]; do
15
- flip-p171.sh 108 cap="$i" -lt 3000 while [ "$i" -lt 3000 ]; do
16
- load-experiment.sh 128 cap=$(( $(date +%s) - start )) -lt "$secs" while [ $(( $(date +%s) - start )) -lt "$secs" ]; do
17
- panel-b3.sh 144 cap="$i" -le "${B3_FILE_ITERS:-20}" while [ "$i" -le "${B3_FILE_ITERS:-20}" ]; do
18
- panel-b3.sh 158 cap="$i" -le "${B3_ARGS_ITERS:-30}" while [ "$i" -le "${B3_ARGS_ITERS:-30}" ]; do
19
- panel-b3.sh 173 cap="$i" -le "${B3_CAP_ITERS:-30}" while [ "$i" -le "${B3_CAP_ITERS:-30}" ]; do
20
- panel-cpu.sh 311 bound=sub_end 计算出的截止时间(到点自己退出) while :; do
21
- panel-p21.sh 1728 cap="$_i" -le 15 while [ "$_i" -le 15 ]; do
22
- pm-box-real.sh 168 cap="$i" -lt "$READY_TRIES" while [ "$i" -lt "$READY_TRIES" ]; do
23
- smoke.sh 455 bound=停止位文件 SMOKE_TMP_STOP + 主 shell 寿命(M33 哨兵的文件握手) while [ ! -e "$SMOKE_TMP_STOP" ]; do
24
- smoke.sh 1546 cap="$S6_WAIT" -lt 100 while [ "$S6_WAIT" -lt 100 ] && [ ! -s "$TMP/pi-args.log" ]; do sleep 0.1; S6_WAIT=$((S6_WAIT + 1)); done
25
- smoke.sh 2035 cap="$_i" -lt 60 _i=0; while [ "$_i" -lt 60 ] && [ ! -f "$ADAPTER_DONE" ]; do sleep 0.5; _i=$((_i + 1)); done
26
- smoke.sh 2260 cap="$B4_ROUND" -le 5 while [ "$B4_ROUND" -le 5 ]; do
27
- smoke.sh 2267 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ] && ! grep -qF "exit code 7" "$TMP/m43-b4-$B4_ROUND.log"; do sleep 0.05; B4_WAIT=$((B4_WAIT + 1)); done
28
- smoke.sh 2274 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ]; do
29
- smoke.sh 2548 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do "$@" && return 0; sleep 0.1; i=$((i + 1)); done
30
- smoke.sh 2557 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
31
- smoke.sh 2649 cap="$PM_TICKS" -lt 3 while [ "$PM_TICKS" -lt 3 ]; do
32
- smoke.sh 2847 cap="$M82_WAIT" -lt 60 while [ "$M82_WAIT" -lt 60 ] && [ ! -s "$TMP/m82-bare-ran.log" ]; do sleep 0.25; M82_WAIT=$((M82_WAIT + 1)); done
33
- smoke.sh 2950 cap="$i" -lt "${2:-50}" local i=0; while [ "$i" -lt "${2:-50}" ]; do [ -n "$(m37_child_of "$1")" ] && return 0; sleep 0.1; i=$((i + 1)); done
34
- smoke.sh 4066 cap="$i" -lt "${4:-50}" while [ "$i" -lt "${4:-50}" ]; do
35
- smoke.sh 2973 cap="$i" -lt "${3:-50}" while [ "$i" -lt "${3:-50}" ]; do
36
- smoke.sh 3638 cap="$M25_CWAIT" -lt 60 while [ "$M25_CWAIT" -lt 60 ]; do
37
- smoke.sh 3659 cap="$M25_WAIT" -lt 120 while [ "$M25_WAIT" -lt 120 ]; do
38
- smoke.sh 3741 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
39
- smoke.sh 3755 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
40
- smoke.sh 3766 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
41
- smoke.sh 3776 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
42
- smoke.sh 3803 cap="$i" -lt 40 while [ "$i" -lt 40 ]; do
43
- smoke.sh 3834 cap="$i" -lt 100 while [ "$i" -lt 100 ]; do
44
- smoke.sh 3846 cap="$i" -lt "$tries" while [ "$i" -lt "$tries" ]; do
45
- smoke.sh 3855 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do [ -f "$f" ] && [ -s "$f" ] && return 0; sleep 1; i=$((i+1)); done
46
- smoke.sh 3954 cap="$WD_LOGS_WAIT" -lt 40 while [ "$WD_LOGS_WAIT" -lt 40 ]; do
47
- smoke.sh 4225 cap="$i" -lt 60 while [ "$i" -lt 60 ]; do
48
- smoke.sh 4341 cap="$i" -lt 30 while [ "$i" -lt 30 ] && [ "$(( $(start_count) - STARTS_BEFORE ))" -lt 1 ]; do sleep 0.1; i=$((i + 1)); done
49
- smoke.sh 4432 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ "$(p36_lines)" -gt "$base" ] && return 0; sleep 0.1; i=$((i + 1)); done
50
- smoke.sh 4441 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ -z "$(p36_same_cwd_pids)" ] && return 0; sleep 0.2; i=$((i + 1)); done
51
- smoke.sh 4518 cap="$R_WAIT" -lt 20 while [ "$R_WAIT" -lt 20 ] && ! $TEAM roster 2>/dev/null | grep -qF "pi 已退出"; do sleep 0.2; R_WAIT=$((R_WAIT + 1)); done
52
- smoke.sh 4990 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
53
- smoke.sh 8779 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do grep -q -- "$pat" "$f" 2>/dev/null && return 0; sleep 0.1; i=$((i + 1)); done
54
- smoke.sh 9565 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
55
- smoke.sh 9579 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
56
- smoke.sh 11415 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-worker.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
57
- smoke.sh 11425 cap="$M36_W" -lt 25 while [ "$M36_W" -lt 25 ]; do grep -q 'argv=ls' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
58
- smoke.sh 11430 cap="$M36_W" -lt 25 while [ "$M36_W" -lt 25 ]; do grep -q 'act=allowed-owned' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
59
- smoke.sh 11457 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-pm.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
60
- smoke.sh 11640 cap="$M40_W" -lt 60 while [ "$M40_W" -lt 60 ]; do
61
- smoke.sh 11658 cap="$M40_LOGS_WAIT" -lt 40 while [ "$M40_LOGS_WAIT" -lt 40 ]; do
62
- smoke.sh 11685 cap="$M40_W" -lt 100 while [ "$M40_W" -lt 100 ] && [ ! -f "$M40_D/8c-worker.done" ]; do sleep 0.2; M40_W=$((M40_W + 1)); done
63
- smoke.sh 13107 cap="$i" -lt 25 while [ "$i" -lt 25 ]; do
64
- smoke.sh 13125 cap="$P55_W" -lt 30 while [ "$P55_W" -lt 30 ]; do
65
- smoke.sh 13165 cap="$P55_W" -lt 20 while [ "$P55_W" -lt 20 ]; do
66
- smoke.sh 13303 cap="$P55_W" -lt 20 while [ "$P55_W" -lt 20 ]; do
67
- smoke.sh 13348 cap="$P55_W" -lt 25 while [ "$P55_W" -lt 25 ]; do
68
- tmp-hygiene.sh 691 cap="$_i" -lt 50 while [ "$_i" -lt 50 ] && ! grep -q '^ROOT=' "$kr_out" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
69
- tmp-hygiene.sh 1149 cap="$_j" -lt 50 while [ "$_j" -lt 50 ] && kill -0 "$orphan" 2>/dev/null; do sleep 0.1; _j=$((_j + 1)); done
70
- lib/pty-wait.sh 229 cap="$i" -lt "$ceiling" while [ "$i" -lt "$ceiling" ]; do
71
- lib/pty-wait.sh 360 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
72
- lib/pty-wait.sh 384 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
73
- lib/section-guard.sh 390 bound=停止位文件/owner 寿命(双重 fork 看门狗:裸 wait 不认它) while :; do
74
- lib/section-guard.sh 438 cap="$i" -lt $(( SG_SUITE_GRACE * 5 )) while [ "$i" -lt $(( SG_SUITE_GRACE * 5 )) ]; do
75
- lib/section-guard.sh 444 cap="$i" -lt 25 while [ "$i" -lt 25 ]; do
76
- lib/section-guard.sh 454 bound=子孙清空或 SG_DESC_GRACE 次尝试后转 KILL while :; do
77
- lib/section-guard.sh 532 cap="$round" -lt "$cap" while [ "$round" -lt "$cap" ]; do
78
- lib/section-guard.sh 663 cap="$i" -lt 40 while [ "$i" -lt 40 ]; do
79
- lib/tmp-root.sh 204 cap="$i" -lt $((grace * 5)) while [ "$i" -lt $((grace * 5)) ]; do
80
- lib/tmp-root.sh 441 cap="$_i" -lt 50 while [ "$_i" -lt 50 ]; do
81
- lib/tmp-root.sh 452 cap="$_i" -lt 100 while [ "$_i" -lt 100 ] && kill -0 "$term_pid" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
82
- lib/tmp-root.sh 478 cap="$_i" -lt 50 while [ "$_i" -lt 50 ]; do
83
- lib/tmp-root.sh 488 cap="$_i" -lt 25 while [ "$_i" -lt 25 ] && kill -0 "$fg_pid" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
84
- flip-p158.sh 109 cap="$i" -lt 500 while [ "$i" -lt 500 ] && [ -z "$fp" ]; do
8
+ panel-b3.sh 144 cap="$i" -le "${B3_FILE_ITERS:-600}" while [ "$i" -le "${B3_FILE_ITERS:-600}" ]; do
9
+ panel-b3.sh 158 cap="$i" -le "${B3_ARGS_ITERS:-600}" while [ "$i" -le "${B3_ARGS_ITERS:-600}" ]; do
10
+ panel-b3.sh 173 cap="$i" -le "${B3_CAP_ITERS:-600}" while [ "$i" -le "${B3_CAP_ITERS:-600}" ]; do
11
+ panel-cpu.sh 248 bound=sub_end 计算出的截止时间(到点自己退出) while :; do
12
+ panel-p21.sh 1813 cap="$_i" -le 15 while [ "$_i" -le 15 ]; do
13
+ pm-box-real.sh 175 cap="$i" -lt "$READY_TRIES" while [ "$i" -lt "$READY_TRIES" ]; do
14
+ smoke.sh 503 bound=等待者的耐心上限 lock_cap(每轮跟着持有者心跳现算:活 4W / 停或没有 W;到点 break 进超限分支) while :; do
15
+ smoke.sh 1277 bound=停止位文件 SMOKE_TMP_STOP + 主 shell 寿命(M33 哨兵的文件握手) while [ ! -e "$SMOKE_TMP_STOP" ]; do
16
+ smoke.sh 2977 cap="$S6_WAIT" -lt 3000 while [ "$S6_WAIT" -lt 3000 ] && [ ! -s "$TMP/pi-args.log" ]; do sleep 0.1; S6_WAIT=$((S6_WAIT + 1)); done
17
+ smoke.sh 3731 cap="$_i" -lt 60 _i=0; while [ "$_i" -lt 60 ] && [ ! -f "$ADAPTER_DONE" ]; do sleep 0.5; _i=$((_i + 1)); done
18
+ smoke.sh 3970 cap="$B4_ROUND" -le 5 while [ "$B4_ROUND" -le 5 ]; do
19
+ smoke.sh 3977 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ] && ! grep -qF "exit code 7" "$TMP/m43-b4-$B4_ROUND.log"; do sleep 0.05; B4_WAIT=$((B4_WAIT + 1)); done
20
+ smoke.sh 3984 cap="$B4_WAIT" -lt 40 while [ "$B4_WAIT" -lt 40 ]; do
21
+ smoke.sh 4268 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do "$@" && return 0; sleep 0.1; i=$((i + 1)); done
22
+ smoke.sh 4277 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
23
+ smoke.sh 4378 cap="$PM_TICKS" -lt 3 while [ "$PM_TICKS" -lt 3 ]; do
24
+ smoke.sh 4574 cap="$M82_WAIT" -lt 60 while [ "$M82_WAIT" -lt 60 ] && [ ! -s "$TMP/m82-bare-ran.log" ]; do sleep 0.25; M82_WAIT=$((M82_WAIT + 1)); done
25
+ smoke.sh 4680 cap="$i" -lt "${2:-50}" local i=0; while [ "$i" -lt "${2:-50}" ]; do [ -n "$(m37_child_of "$1")" ] && return 0; sleep 0.1; i=$((i + 1)); done
26
+ smoke.sh 4688 cap="$i" -lt "${4:-50}" local i=0; while [ "$i" -lt "${4:-50}" ]; do
27
+ smoke.sh 4713 cap="$i" -lt "${3:-3000}" while [ "$i" -lt "${3:-3000}" ]; do
28
+ smoke.sh 5461 cap="$M25_CWAIT" -lt 60 while [ "$M25_CWAIT" -lt 60 ]; do
29
+ smoke.sh 5486 cap="$M25_WAIT" -lt 120 while [ "$M25_WAIT" -lt 120 ]; do
30
+ smoke.sh 5587 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
31
+ smoke.sh 5601 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
32
+ smoke.sh 5612 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
33
+ smoke.sh 5622 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
34
+ smoke.sh 5649 cap="$i" -lt 600 while [ "$i" -lt 600 ]; do
35
+ smoke.sh 5680 cap="$i" -lt 100 while [ "$i" -lt 100 ]; do
36
+ smoke.sh 5692 cap="$i" -lt "$tries" while [ "$i" -lt "$tries" ]; do
37
+ smoke.sh 5701 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do [ -f "$f" ] && [ -s "$f" ] && return 0; sleep 1; i=$((i+1)); done
38
+ smoke.sh 5796 cap="$WD_LOGS_WAIT" -lt 40 while [ "$WD_LOGS_WAIT" -lt 40 ]; do
39
+ smoke.sh 6064 cap="$i" -lt 60 while [ "$i" -lt 60 ]; do
40
+ smoke.sh 6180 cap="$i" -lt 3000 while [ "$i" -lt 3000 ] && [ "$(( $(start_count) - STARTS_BEFORE ))" -lt 1 ]; do sleep 0.1; i=$((i + 1)); done
41
+ smoke.sh 6279 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ "$(p36_lines)" -gt "$base" ] && return 0; sleep 0.1; i=$((i + 1)); done
42
+ smoke.sh 6288 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do [ -z "$(p36_same_cwd_pids)" ] && return 0; sleep 0.2; i=$((i + 1)); done
43
+ smoke.sh 6449 cap="$R_WAIT" -lt "$R_MAX" while [ "$R_WAIT" -lt "$R_MAX" ]; do
44
+ smoke.sh 6854 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
45
+ smoke.sh 11110 cap="$i" -lt "$max" while [ "$i" -lt "$max" ]; do grep -q -- "$pat" "$f" 2>/dev/null && return 0; sleep 0.1; i=$((i + 1)); done
46
+ smoke.sh 12032 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
47
+ smoke.sh 12046 cap="$i" -lt "$ticks" while [ "$i" -lt "$ticks" ]; do
48
+ smoke.sh 15016 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-worker.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
49
+ smoke.sh 15034 cap="$M36_W" -lt 1500 while [ "$M36_W" -lt 1500 ]; do grep -q 'argv=ls' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
50
+ smoke.sh 15039 cap="$M36_W" -lt 1500 while [ "$M36_W" -lt 1500 ]; do grep -q 'act=allowed-owned' "$REPO/.pi/team/state/tmux-calls.log" 2>/dev/null && break; sleep 0.2; M36_W=$((M36_W + 1)); done
51
+ smoke.sh 15072 cap="$M36_W" -lt 100 while [ "$M36_W" -lt 100 ] && [ ! -f "$M36_D/env-pm.done" ]; do sleep 0.2; M36_W=$((M36_W + 1)); done
52
+ smoke.sh 15259 cap="$M40_W" -lt 60 while [ "$M40_W" -lt 60 ]; do
53
+ smoke.sh 15277 cap="$M40_LOGS_WAIT" -lt 40 while [ "$M40_LOGS_WAIT" -lt 40 ]; do
54
+ smoke.sh 15304 cap="$M40_W" -lt 100 while [ "$M40_W" -lt 100 ] && [ ! -f "$M40_D/8c-worker.done" ]; do sleep 0.2; M40_W=$((M40_W + 1)); done
55
+ smoke.sh 17067 bound=心跳写入器(§34b⑭ 的现场):由 p338_release kill 收尾,自己不结束 ( while :; do printf 'hb %s\n'
56
+ smoke.sh 16977 cap="$i" -lt 600 while kill -0 "$pid" 2>/dev/null && [ "$i" -lt 600 ]; do
57
+ smoke.sh 17252 cap="$i" -lt "$n" while [ "$i" -lt "$n" ]; do
58
+ smoke.sh 17265 cap="$i" -lt 6000 while [ "$i" -lt 6000 ]; do
59
+ smoke.sh 17305 cap="$i" -lt 6000 while [ "$i" -lt 6000 ]; do
60
+ smoke.sh 19104 cap="$i" -lt 1500 while [ "$i" -lt 1500 ]; do
61
+ smoke.sh 19122 cap="$P55_W" -lt 1000 while [ "$P55_W" -lt 1000 ]; do
62
+ smoke.sh 19596 cap="$P55_W" -lt "$P55_WMAX" while [ "$P55_W" -lt "$P55_WMAX" ]; do
63
+ smoke.sh 19303 cap="$P55_W" -lt 600 while [ "$P55_W" -lt 600 ]; do
64
+ smoke.sh 19348 cap="$P55_W" -lt 1000 while [ "$P55_W" -lt 1000 ]; do
65
+ smoke.sh 22875 cap="$P238_FLIP_ELAPSED" -ge 7200 while kill -0 "$P238_FLIP_PID" 2>/dev/null; do
66
+ tmp-hygiene.sh 1696 cap="$_i" -lt 50 while [ "$_i" -lt 50 ] && ! grep -q '^ROOT=' "$kr_out" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
67
+ tmp-hygiene.sh 1790 cap="$_j" -lt 50 local _j=0; while [ "$_j" -lt 50 ] && kill -0 "$orphan" 2>/dev/null; do sleep 0.1; _j=$((_j + 1)); done
68
+ tmp-hygiene.sh 1842 cap="$_w" -lt 40 while [ "$_w" -lt 40 ]; do
69
+ tmp-hygiene.sh 1849 cap="$_w" -lt 40 while [ "$_w" -lt 40 ]; do
70
+ lib/bounded-spin.sh 75 cap="$cap_s" while _bs_parent_alive "$parent"; do
71
+ lib/pty-wait.sh 190 cap="$i" -lt "$ceiling" while [ "$i" -lt "$ceiling" ]; do
72
+ lib/pty-wait.sh 318 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
73
+ lib/pty-wait.sh 342 cap="$i" -le "${PTY_CLEANUP_ITERS:-4}" while [ "$i" -le "${PTY_CLEANUP_ITERS:-4}" ]; do
74
+ lib/section-guard.sh 421 bound=停止位文件/owner 寿命(双重 fork 看门狗:裸 wait 不认它) while :; do
75
+ lib/section-guard.sh 476 cap="$i" -lt $(( SG_SUITE_GRACE * 5 )) while [ "$i" -lt $(( SG_SUITE_GRACE * 5 )) ]; do
76
+ lib/section-guard.sh 482 cap="$i" -lt 25 while [ "$i" -lt 25 ]; do
77
+ lib/section-guard.sh 492 bound=子孙清空或 SG_DESC_GRACE 次尝试后转 KILL while :; do
78
+ lib/section-guard.sh 611 cap="$round" -lt "$cap" while [ "$round" -lt "$cap" ]; do
79
+ lib/section-guard.sh 651 cap="$_n" -lt 40 while [ "$_n" -lt 40 ]; do section_guard_check; sleep 0.1; _n=$((_n + 1)); done
80
+ lib/section-guard.sh 716 cap="$i" -lt 40 while [ "$i" -lt 40 ]; do
81
+ lib/tmp-root.sh 303 cap="$i" -lt $((grace * 5)) while [ "$i" -lt $((grace * 5)) ]; do
82
+ lib/tmp-root.sh 567 cap="$_i" -lt 50 while [ "$_i" -lt 50 ]; do
83
+ lib/tmp-root.sh 578 cap="$_i" -lt 100 while [ "$_i" -lt 100 ] && kill -0 "$term_pid" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
84
+ lib/tmp-root.sh 604 cap="$_i" -lt 50 while [ "$_i" -lt 50 ]; do
85
+ lib/tmp-root.sh 614 cap="$_i" -lt 25 while [ "$_i" -lt 25 ] && kill -0 "$fg_pid" 2>/dev/null; do sleep 0.1; _i=$((_i + 1)); done
86
+ flip-p158.sh 137 cap="$i" -lt 500 while [ "$i" -lt 500 ] && [ -z "$fp" ]; do
87
+ perf.sh 174 bound=持有者公布的排队上限 cap(缺则 TEAM_PERF_LOCK_WAIT),到点 exit 3(没结论) while :; do
88
+ tmux-identity-leak.sh 389 cap="$i" -lt 300 while [ "$i" -lt 300 ] && [ ! -f "$TMP/$name.done" ]; do sleep 0.1; i=$((i + 1)); done
89
+ tmux-identity-leak.sh 459 cap="$_i" -lt 80 _i=0; while [ "$_i" -lt 80 ] && [ ! -f "$TMP/win-env.log.done" ]; do sleep 0.1; _i=$((_i + 1)); done
90
+ tmux-identity-leak.sh 499 cap="$_i" -lt 120 _i=0; while [ "$_i" -lt 120 ] && [ ! -f "$TMP/win-kill.done" ]; do sleep 0.1; _i=$((_i + 1)); done