@bonesofspring/ai-rules 0.2.87 → 0.2.91

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 (470) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +9 -1
  3. package/bin/lib/engine-scripts.js +7 -0
  4. package/bin/lib/seed-ai-local-team.js +40 -0
  5. package/bin/opencode-install.js +11 -10
  6. package/docs/OPENCODE-COMPATIBILITY.md +2 -1
  7. package/docs/OPENCODE.md +27 -5
  8. package/docs/openapi/team-db.v1.json +2 -2
  9. package/package.json +1 -1
  10. package/presets/_shared/ai-local/env.example +54 -0
  11. package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +34 -5
  12. package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +25 -22
  13. package/presets/_shared/ai-local/scripts/process-lease.mjs +3 -2
  14. package/presets/_shared/ai-local/scripts/processes.mjs +52 -20
  15. package/presets/_shared/ai-local/scripts/run.mjs +38 -6
  16. package/presets/_shared/ai-local/scripts/settings.mjs +246 -0
  17. package/presets/_shared/ai-local/scripts/task-worktree.mjs +364 -0
  18. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +2 -2
  19. package/presets/_shared/ai-local/scripts/team-db-project.mjs +87 -14
  20. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +102 -12
  21. package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +35 -0
  22. package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +10 -1
  23. package/presets/_shared/ai-local/scripts/verification.mjs +106 -11
  24. package/presets/_shared/core/agent-team/agent-task-metrics.md +10 -2
  25. package/presets/_shared/core/agent-team/agent-team-intake.md +2 -0
  26. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +2 -2
  27. package/presets/_shared/core/meta/preset-writing-style.md +8 -0
  28. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +541 -61
  29. package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +733 -9
  30. package/presets/_shared/hooks/prompt-autoroute.mjs.tmpl +153 -0
  31. package/presets/claude/android-kotlin/CLAUDE.md +2 -4
  32. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +541 -61
  33. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +733 -9
  34. package/presets/claude/android-kotlin/hooks/prompt-autoroute.mjs +153 -0
  35. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -0
  36. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  37. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-writing-style.md +8 -0
  38. package/presets/claude/android-kotlin/settings.json +15 -5
  39. package/presets/claude/go/CLAUDE.md +2 -4
  40. package/presets/claude/go/hooks/chain-team-phases.sh +541 -61
  41. package/presets/claude/go/hooks/guard-shell-command.mjs +733 -9
  42. package/presets/claude/go/hooks/prompt-autoroute.mjs +153 -0
  43. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -0
  44. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  45. package/presets/claude/go/rules/tooling-and-review/preset-writing-style.md +8 -0
  46. package/presets/claude/go/settings.json +15 -5
  47. package/presets/claude/ios-swift/CLAUDE.md +2 -4
  48. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +541 -61
  49. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +733 -9
  50. package/presets/claude/ios-swift/hooks/prompt-autoroute.mjs +153 -0
  51. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -0
  52. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  53. package/presets/claude/ios-swift/rules/tooling-and-review/preset-writing-style.md +8 -0
  54. package/presets/claude/ios-swift/settings.json +15 -5
  55. package/presets/claude/java/CLAUDE.md +2 -4
  56. package/presets/claude/java/hooks/chain-team-phases.sh +541 -61
  57. package/presets/claude/java/hooks/guard-shell-command.mjs +733 -9
  58. package/presets/claude/java/hooks/prompt-autoroute.mjs +153 -0
  59. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -0
  60. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  61. package/presets/claude/java/rules/tooling-and-review/preset-writing-style.md +8 -0
  62. package/presets/claude/java/settings.json +15 -5
  63. package/presets/claude/mcp-ts/CLAUDE.md +2 -4
  64. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +541 -61
  65. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +733 -9
  66. package/presets/claude/mcp-ts/hooks/prompt-autoroute.mjs +153 -0
  67. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -0
  68. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  69. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-writing-style.md +8 -0
  70. package/presets/claude/mcp-ts/settings.json +15 -5
  71. package/presets/claude/mol/CLAUDE.md +2 -4
  72. package/presets/claude/mol/agents/feature-developer.md +1 -1
  73. package/presets/claude/mol/ai-local/rules-library/commit-hygiene.md +1 -1
  74. package/presets/claude/mol/commands/task-evil.md +8 -0
  75. package/presets/claude/mol/hooks/chain-team-phases.sh +541 -61
  76. package/presets/claude/mol/hooks/guard-shell-command.mjs +733 -9
  77. package/presets/claude/mol/hooks/prompt-autoroute.mjs +153 -0
  78. package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -0
  79. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  80. package/presets/claude/mol/rules/tooling-and-review/preset-writing-style.md +8 -0
  81. package/presets/claude/mol/settings.json +15 -4
  82. package/presets/claude/next/CLAUDE.md +2 -4
  83. package/presets/claude/next/REPO_AGENTS.md +2 -0
  84. package/presets/claude/next/agents/feature-developer.md +1 -1
  85. package/presets/claude/next/agents/task-analyst.md +1 -7
  86. package/presets/claude/next/agents/task-router.md +1 -1
  87. package/presets/claude/next/ai-local/rules-library/commit-hygiene.md +1 -1
  88. package/presets/claude/next/commands/spec-start.md +3 -4
  89. package/presets/claude/next/commands/task-continue.md +9 -8
  90. package/presets/claude/next/commands/task-evil.md +8 -0
  91. package/presets/claude/next/commands/task.md +1 -1
  92. package/presets/claude/next/hooks/chain-team-phases.sh +541 -61
  93. package/presets/claude/next/hooks/guard-shell-command.mjs +733 -9
  94. package/presets/claude/next/hooks/prompt-autoroute.mjs +153 -0
  95. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -0
  96. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  97. package/presets/claude/next/rules/tooling-and-review/preset-writing-style.md +8 -0
  98. package/presets/claude/next/settings.json +15 -4
  99. package/presets/claude/next/team/README.md +1 -1
  100. package/presets/claude/nuxt/CLAUDE.md +2 -4
  101. package/presets/claude/nuxt/hooks/chain-team-phases.sh +541 -61
  102. package/presets/claude/nuxt/hooks/guard-shell-command.mjs +733 -9
  103. package/presets/claude/nuxt/hooks/prompt-autoroute.mjs +153 -0
  104. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -0
  105. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  106. package/presets/claude/nuxt/rules/tooling-and-review/preset-writing-style.md +8 -0
  107. package/presets/claude/nuxt/settings.json +15 -4
  108. package/presets/claude/php-hexagonal/CLAUDE.md +2 -4
  109. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +541 -61
  110. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
  111. package/presets/claude/php-hexagonal/hooks/prompt-autoroute.mjs +153 -0
  112. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -0
  113. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  114. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-writing-style.md +8 -0
  115. package/presets/claude/php-hexagonal/settings.json +15 -5
  116. package/presets/claude/php-laravel/CLAUDE.md +2 -4
  117. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +541 -61
  118. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +733 -9
  119. package/presets/claude/php-laravel/hooks/prompt-autoroute.mjs +153 -0
  120. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -0
  121. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  122. package/presets/claude/php-laravel/rules/tooling-and-review/preset-writing-style.md +8 -0
  123. package/presets/claude/php-laravel/settings.json +15 -5
  124. package/presets/claude/svelte/CLAUDE.md +2 -4
  125. package/presets/claude/svelte/hooks/chain-team-phases.sh +541 -61
  126. package/presets/claude/svelte/hooks/guard-shell-command.mjs +733 -9
  127. package/presets/claude/svelte/hooks/prompt-autoroute.mjs +153 -0
  128. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -0
  129. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +2 -2
  130. package/presets/claude/svelte/rules/tooling-and-review/preset-writing-style.md +8 -0
  131. package/presets/claude/svelte/settings.json +15 -4
  132. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +541 -61
  133. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +733 -9
  134. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -0
  135. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  136. package/presets/cursor/android-kotlin/rules/preset-writing-style.mdc +8 -0
  137. package/presets/cursor/go/hooks/chain-team-phases.sh +541 -61
  138. package/presets/cursor/go/hooks/guard-shell-command.mjs +733 -9
  139. package/presets/cursor/go/rules/agent-team-intake.mdc +2 -0
  140. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  141. package/presets/cursor/go/rules/preset-writing-style.mdc +8 -0
  142. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +541 -61
  143. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +733 -9
  144. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -0
  145. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  146. package/presets/cursor/ios-swift/rules/preset-writing-style.mdc +8 -0
  147. package/presets/cursor/java/hooks/chain-team-phases.sh +541 -61
  148. package/presets/cursor/java/hooks/guard-shell-command.mjs +733 -9
  149. package/presets/cursor/java/rules/agent-team-intake.mdc +2 -0
  150. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  151. package/presets/cursor/java/rules/preset-writing-style.mdc +8 -0
  152. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +541 -61
  153. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +733 -9
  154. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -0
  155. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  156. package/presets/cursor/mcp-ts/rules/preset-writing-style.mdc +8 -0
  157. package/presets/cursor/mol/agents/feature-developer.md +1 -1
  158. package/presets/cursor/mol/ai-local/rules-library/commit-hygiene.md +1 -1
  159. package/presets/cursor/mol/commands/task-evil.md +8 -0
  160. package/presets/cursor/mol/hooks/chain-team-phases.sh +541 -61
  161. package/presets/cursor/mol/hooks/guard-shell-command.mjs +733 -9
  162. package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -0
  163. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
  164. package/presets/cursor/mol/rules/preset-writing-style.mdc +8 -0
  165. package/presets/cursor/next/REPO_AGENTS.md +2 -0
  166. package/presets/cursor/next/agents/feature-developer.md +1 -1
  167. package/presets/cursor/next/agents/task-analyst.md +1 -7
  168. package/presets/cursor/next/agents/task-router.md +1 -1
  169. package/presets/cursor/next/ai-local/rules-library/commit-hygiene.md +1 -1
  170. package/presets/cursor/next/commands/spec-start.md +3 -4
  171. package/presets/cursor/next/commands/task-continue.md +9 -8
  172. package/presets/cursor/next/commands/task-evil.md +8 -0
  173. package/presets/cursor/next/commands/task.md +1 -1
  174. package/presets/cursor/next/hooks/chain-team-phases.sh +541 -61
  175. package/presets/cursor/next/hooks/guard-shell-command.mjs +733 -9
  176. package/presets/cursor/next/rules/agent-team-intake.mdc +2 -0
  177. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +2 -2
  178. package/presets/cursor/next/rules/preset-writing-style.mdc +8 -0
  179. package/presets/cursor/next/team/README.md +1 -1
  180. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +541 -61
  181. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +733 -9
  182. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -0
  183. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  184. package/presets/cursor/nuxt/rules/preset-writing-style.mdc +8 -0
  185. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +541 -61
  186. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
  187. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -0
  188. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  189. package/presets/cursor/php-hexagonal/rules/preset-writing-style.mdc +8 -0
  190. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +541 -61
  191. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +733 -9
  192. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -0
  193. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  194. package/presets/cursor/php-laravel/rules/preset-writing-style.mdc +8 -0
  195. package/presets/cursor/svelte/hooks/chain-team-phases.sh +541 -61
  196. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +733 -9
  197. package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -0
  198. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  199. package/presets/cursor/svelte/rules/preset-writing-style.mdc +8 -0
  200. package/presets/mavis/android-kotlin/MAVIS.md +1 -1
  201. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  202. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +541 -61
  203. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -0
  204. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +2 -2
  205. package/presets/mavis/android-kotlin/rules/preset-writing-style.md +8 -0
  206. package/presets/mavis/go/MAVIS.md +1 -1
  207. package/presets/mavis/go/adapter-map.json +1 -1
  208. package/presets/mavis/go/hooks/chain-team-phases.sh +541 -61
  209. package/presets/mavis/go/rules/agent-team-intake.md +2 -0
  210. package/presets/mavis/go/rules/agent-team-orchestrator.md +2 -2
  211. package/presets/mavis/go/rules/preset-writing-style.md +8 -0
  212. package/presets/mavis/ios-swift/MAVIS.md +1 -1
  213. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  214. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +541 -61
  215. package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -0
  216. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +2 -2
  217. package/presets/mavis/ios-swift/rules/preset-writing-style.md +8 -0
  218. package/presets/mavis/java/MAVIS.md +1 -1
  219. package/presets/mavis/java/adapter-map.json +1 -1
  220. package/presets/mavis/java/hooks/chain-team-phases.sh +541 -61
  221. package/presets/mavis/java/rules/agent-team-intake.md +2 -0
  222. package/presets/mavis/java/rules/agent-team-orchestrator.md +2 -2
  223. package/presets/mavis/java/rules/preset-writing-style.md +8 -0
  224. package/presets/mavis/mcp-ts/MAVIS.md +1 -1
  225. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  226. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +541 -61
  227. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -0
  228. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +2 -2
  229. package/presets/mavis/mcp-ts/rules/preset-writing-style.md +8 -0
  230. package/presets/mavis/mol/MAVIS.md +1 -1
  231. package/presets/mavis/mol/adapter-map.json +1 -1
  232. package/presets/mavis/mol/agents/feature-developer.md +1 -1
  233. package/presets/mavis/mol/ai-local/rules-library/commit-hygiene.md +1 -1
  234. package/presets/mavis/mol/commands/task-evil.md +8 -0
  235. package/presets/mavis/mol/hooks/chain-team-phases.sh +541 -61
  236. package/presets/mavis/mol/native-skills/task-evil/SKILL.md +8 -0
  237. package/presets/mavis/mol/rules/agent-team-intake.md +2 -0
  238. package/presets/mavis/mol/rules/agent-team-orchestrator.md +2 -2
  239. package/presets/mavis/mol/rules/preset-writing-style.md +8 -0
  240. package/presets/mavis/next/MAVIS.md +1 -1
  241. package/presets/mavis/next/REPO_AGENTS.md +2 -0
  242. package/presets/mavis/next/adapter-map.json +1 -1
  243. package/presets/mavis/next/agents/feature-developer.md +1 -1
  244. package/presets/mavis/next/agents/task-analyst.md +1 -7
  245. package/presets/mavis/next/agents/task-router.md +1 -1
  246. package/presets/mavis/next/ai-local/rules-library/commit-hygiene.md +1 -1
  247. package/presets/mavis/next/commands/spec-start.md +3 -4
  248. package/presets/mavis/next/commands/task-continue.md +9 -8
  249. package/presets/mavis/next/commands/task-evil.md +8 -0
  250. package/presets/mavis/next/commands/task.md +1 -1
  251. package/presets/mavis/next/hooks/chain-team-phases.sh +541 -61
  252. package/presets/mavis/next/native-skills/spec-start/SKILL.md +3 -4
  253. package/presets/mavis/next/native-skills/task/SKILL.md +1 -1
  254. package/presets/mavis/next/native-skills/task-continue/SKILL.md +9 -8
  255. package/presets/mavis/next/native-skills/task-evil/SKILL.md +8 -0
  256. package/presets/mavis/next/rules/agent-team-intake.md +2 -0
  257. package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -2
  258. package/presets/mavis/next/rules/preset-writing-style.md +8 -0
  259. package/presets/mavis/next/team/README.md +1 -1
  260. package/presets/mavis/nuxt/MAVIS.md +1 -1
  261. package/presets/mavis/nuxt/adapter-map.json +1 -1
  262. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +541 -61
  263. package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -0
  264. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +2 -2
  265. package/presets/mavis/nuxt/rules/preset-writing-style.md +8 -0
  266. package/presets/mavis/php-hexagonal/MAVIS.md +1 -1
  267. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  268. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +541 -61
  269. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -0
  270. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
  271. package/presets/mavis/php-hexagonal/rules/preset-writing-style.md +8 -0
  272. package/presets/mavis/php-laravel/MAVIS.md +1 -1
  273. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  274. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +541 -61
  275. package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -0
  276. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +2 -2
  277. package/presets/mavis/php-laravel/rules/preset-writing-style.md +8 -0
  278. package/presets/mavis/svelte/MAVIS.md +1 -1
  279. package/presets/mavis/svelte/adapter-map.json +1 -1
  280. package/presets/mavis/svelte/hooks/chain-team-phases.sh +541 -61
  281. package/presets/mavis/svelte/rules/agent-team-intake.md +2 -0
  282. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +2 -2
  283. package/presets/mavis/svelte/rules/preset-writing-style.md +8 -0
  284. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  285. package/presets/opencode/android-kotlin/hooks/README.md +6 -5
  286. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +541 -61
  287. package/presets/opencode/android-kotlin/hooks/guard-shell-command.mjs +733 -9
  288. package/presets/opencode/android-kotlin/opencode.json +4 -4
  289. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -0
  290. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +2 -2
  291. package/presets/opencode/android-kotlin/rules/preset-writing-style.md +8 -0
  292. package/presets/opencode/go/adapter-map.json +1 -1
  293. package/presets/opencode/go/hooks/README.md +6 -5
  294. package/presets/opencode/go/hooks/chain-team-phases.sh +541 -61
  295. package/presets/opencode/go/hooks/guard-shell-command.mjs +733 -9
  296. package/presets/opencode/go/opencode.json +4 -4
  297. package/presets/opencode/go/rules/agent-team-intake.md +2 -0
  298. package/presets/opencode/go/rules/agent-team-orchestrator.md +2 -2
  299. package/presets/opencode/go/rules/preset-writing-style.md +8 -0
  300. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  301. package/presets/opencode/ios-swift/hooks/README.md +6 -5
  302. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +541 -61
  303. package/presets/opencode/ios-swift/hooks/guard-shell-command.mjs +733 -9
  304. package/presets/opencode/ios-swift/opencode.json +4 -4
  305. package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -0
  306. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +2 -2
  307. package/presets/opencode/ios-swift/rules/preset-writing-style.md +8 -0
  308. package/presets/opencode/java/adapter-map.json +1 -1
  309. package/presets/opencode/java/hooks/README.md +6 -5
  310. package/presets/opencode/java/hooks/chain-team-phases.sh +541 -61
  311. package/presets/opencode/java/hooks/guard-shell-command.mjs +733 -9
  312. package/presets/opencode/java/opencode.json +4 -4
  313. package/presets/opencode/java/rules/agent-team-intake.md +2 -0
  314. package/presets/opencode/java/rules/agent-team-orchestrator.md +2 -2
  315. package/presets/opencode/java/rules/preset-writing-style.md +8 -0
  316. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  317. package/presets/opencode/mcp-ts/hooks/README.md +6 -5
  318. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +541 -61
  319. package/presets/opencode/mcp-ts/hooks/guard-shell-command.mjs +733 -9
  320. package/presets/opencode/mcp-ts/opencode.json +4 -4
  321. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -0
  322. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +2 -2
  323. package/presets/opencode/mcp-ts/rules/preset-writing-style.md +8 -0
  324. package/presets/opencode/mol/adapter-map.json +1 -1
  325. package/presets/opencode/mol/agents/feature-developer.md +1 -1
  326. package/presets/opencode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
  327. package/presets/opencode/mol/commands/task-evil.md +8 -0
  328. package/presets/opencode/mol/hooks/README.md +6 -5
  329. package/presets/opencode/mol/hooks/chain-team-phases.sh +541 -61
  330. package/presets/opencode/mol/hooks/guard-shell-command.mjs +733 -9
  331. package/presets/opencode/mol/opencode.json +4 -4
  332. package/presets/opencode/mol/rules/agent-team-intake.md +2 -0
  333. package/presets/opencode/mol/rules/agent-team-orchestrator.md +2 -2
  334. package/presets/opencode/mol/rules/preset-writing-style.md +8 -0
  335. package/presets/opencode/next/REPO_AGENTS.md +2 -0
  336. package/presets/opencode/next/adapter-map.json +1 -1
  337. package/presets/opencode/next/agents/feature-developer.md +1 -1
  338. package/presets/opencode/next/agents/task-analyst.md +1 -7
  339. package/presets/opencode/next/agents/task-router.md +1 -1
  340. package/presets/opencode/next/ai-local/rules-library/commit-hygiene.md +1 -1
  341. package/presets/opencode/next/commands/spec-start.md +3 -4
  342. package/presets/opencode/next/commands/task-continue.md +9 -8
  343. package/presets/opencode/next/commands/task-evil.md +8 -0
  344. package/presets/opencode/next/commands/task.md +1 -1
  345. package/presets/opencode/next/hooks/README.md +6 -5
  346. package/presets/opencode/next/hooks/chain-team-phases.sh +541 -61
  347. package/presets/opencode/next/hooks/guard-shell-command.mjs +733 -9
  348. package/presets/opencode/next/opencode.json +4 -4
  349. package/presets/opencode/next/rules/agent-team-intake.md +2 -0
  350. package/presets/opencode/next/rules/agent-team-orchestrator.md +2 -2
  351. package/presets/opencode/next/rules/preset-writing-style.md +8 -0
  352. package/presets/opencode/next/team/README.md +1 -1
  353. package/presets/opencode/nuxt/adapter-map.json +1 -1
  354. package/presets/opencode/nuxt/hooks/README.md +6 -5
  355. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +541 -61
  356. package/presets/opencode/nuxt/hooks/guard-shell-command.mjs +733 -9
  357. package/presets/opencode/nuxt/opencode.json +4 -4
  358. package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -0
  359. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +2 -2
  360. package/presets/opencode/nuxt/rules/preset-writing-style.md +8 -0
  361. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  362. package/presets/opencode/php-hexagonal/hooks/README.md +6 -5
  363. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
  364. package/presets/opencode/php-hexagonal/hooks/guard-shell-command.mjs +733 -9
  365. package/presets/opencode/php-hexagonal/opencode.json +4 -4
  366. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -0
  367. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
  368. package/presets/opencode/php-hexagonal/rules/preset-writing-style.md +8 -0
  369. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  370. package/presets/opencode/php-laravel/hooks/README.md +6 -5
  371. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +541 -61
  372. package/presets/opencode/php-laravel/hooks/guard-shell-command.mjs +733 -9
  373. package/presets/opencode/php-laravel/opencode.json +4 -4
  374. package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -0
  375. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +2 -2
  376. package/presets/opencode/php-laravel/rules/preset-writing-style.md +8 -0
  377. package/presets/opencode/plugins/output-guard/README.md +4 -3
  378. package/presets/opencode/plugins/output-guard/index.ts +4 -3
  379. package/presets/opencode/plugins/output-guard/rewrite.ts +1 -2
  380. package/presets/opencode/plugins/rule-attach/README.md +1 -1
  381. package/presets/opencode/plugins/rule-attach/index.ts +23 -4
  382. package/presets/opencode/plugins/settings-guard/README.md +28 -0
  383. package/presets/opencode/plugins/settings-guard/index.ts +114 -0
  384. package/presets/opencode/plugins/settings-guard/package.json +9 -0
  385. package/presets/opencode/plugins/settings-guard/policy.mjs +85 -0
  386. package/presets/opencode/plugins/settings-guard/prompt-face.mjs +153 -0
  387. package/presets/opencode/plugins/task-status/README.md +13 -8
  388. package/presets/opencode/plugins/task-status/deepseek.ts +23 -8
  389. package/presets/opencode/plugins/task-status/eta.ts +20 -7
  390. package/presets/opencode/plugins/task-status/index.ts +14 -1
  391. package/presets/opencode/plugins/task-status/task-view.ts +168 -9
  392. package/presets/opencode/plugins/task-status/timing.ts +244 -0
  393. package/presets/opencode/plugins/task-status/tui.tsx +12 -3
  394. package/presets/opencode/plugins/task-status/types.ts +6 -0
  395. package/presets/opencode/svelte/adapter-map.json +1 -1
  396. package/presets/opencode/svelte/hooks/README.md +6 -5
  397. package/presets/opencode/svelte/hooks/chain-team-phases.sh +541 -61
  398. package/presets/opencode/svelte/hooks/guard-shell-command.mjs +733 -9
  399. package/presets/opencode/svelte/opencode.json +4 -4
  400. package/presets/opencode/svelte/rules/agent-team-intake.md +2 -0
  401. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +2 -2
  402. package/presets/opencode/svelte/rules/preset-writing-style.md +8 -0
  403. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  404. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +541 -61
  405. package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -0
  406. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +2 -2
  407. package/presets/zcode/android-kotlin/rules/preset-writing-style.md +8 -0
  408. package/presets/zcode/go/adapter-map.json +1 -1
  409. package/presets/zcode/go/hooks/chain-team-phases.sh +541 -61
  410. package/presets/zcode/go/rules/agent-team-intake.md +2 -0
  411. package/presets/zcode/go/rules/agent-team-orchestrator.md +2 -2
  412. package/presets/zcode/go/rules/preset-writing-style.md +8 -0
  413. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  414. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +541 -61
  415. package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -0
  416. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +2 -2
  417. package/presets/zcode/ios-swift/rules/preset-writing-style.md +8 -0
  418. package/presets/zcode/java/adapter-map.json +1 -1
  419. package/presets/zcode/java/hooks/chain-team-phases.sh +541 -61
  420. package/presets/zcode/java/rules/agent-team-intake.md +2 -0
  421. package/presets/zcode/java/rules/agent-team-orchestrator.md +2 -2
  422. package/presets/zcode/java/rules/preset-writing-style.md +8 -0
  423. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  424. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +541 -61
  425. package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -0
  426. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +2 -2
  427. package/presets/zcode/mcp-ts/rules/preset-writing-style.md +8 -0
  428. package/presets/zcode/mol/adapter-map.json +1 -1
  429. package/presets/zcode/mol/agents/feature-developer.md +1 -1
  430. package/presets/zcode/mol/ai-local/rules-library/commit-hygiene.md +1 -1
  431. package/presets/zcode/mol/commands/task-evil.md +8 -0
  432. package/presets/zcode/mol/hooks/chain-team-phases.sh +541 -61
  433. package/presets/zcode/mol/rules/agent-team-intake.md +2 -0
  434. package/presets/zcode/mol/rules/agent-team-orchestrator.md +2 -2
  435. package/presets/zcode/mol/rules/preset-writing-style.md +8 -0
  436. package/presets/zcode/next/REPO_AGENTS.md +2 -0
  437. package/presets/zcode/next/adapter-map.json +1 -1
  438. package/presets/zcode/next/agents/feature-developer.md +1 -1
  439. package/presets/zcode/next/agents/task-analyst.md +1 -7
  440. package/presets/zcode/next/agents/task-router.md +1 -1
  441. package/presets/zcode/next/ai-local/rules-library/commit-hygiene.md +1 -1
  442. package/presets/zcode/next/commands/spec-start.md +3 -4
  443. package/presets/zcode/next/commands/task-continue.md +9 -8
  444. package/presets/zcode/next/commands/task-evil.md +8 -0
  445. package/presets/zcode/next/commands/task.md +1 -1
  446. package/presets/zcode/next/hooks/chain-team-phases.sh +541 -61
  447. package/presets/zcode/next/rules/agent-team-intake.md +2 -0
  448. package/presets/zcode/next/rules/agent-team-orchestrator.md +2 -2
  449. package/presets/zcode/next/rules/preset-writing-style.md +8 -0
  450. package/presets/zcode/next/team/README.md +1 -1
  451. package/presets/zcode/nuxt/adapter-map.json +1 -1
  452. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +541 -61
  453. package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -0
  454. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +2 -2
  455. package/presets/zcode/nuxt/rules/preset-writing-style.md +8 -0
  456. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  457. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +541 -61
  458. package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -0
  459. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +2 -2
  460. package/presets/zcode/php-hexagonal/rules/preset-writing-style.md +8 -0
  461. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  462. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +541 -61
  463. package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -0
  464. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +2 -2
  465. package/presets/zcode/php-laravel/rules/preset-writing-style.md +8 -0
  466. package/presets/zcode/svelte/adapter-map.json +1 -1
  467. package/presets/zcode/svelte/hooks/chain-team-phases.sh +541 -61
  468. package/presets/zcode/svelte/rules/agent-team-intake.md +2 -0
  469. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +2 -2
  470. package/presets/zcode/svelte/rules/preset-writing-style.md +8 -0
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Wall-clock buckets for a task run. Every value is derived from ledger events,
3
+ * never from a single subtraction: `wallMs` is the calendar span, the rest are
4
+ * intervals that the sidebar can show apart.
5
+ */
6
+
7
+ import fs from "node:fs"
8
+ import path from "node:path"
9
+
10
+ export type Interval = { from: number; to: number }
11
+
12
+ /** A killed producer or a suspended host must not count as work. */
13
+ export const MAX_ATTEMPT_MS = (() => {
14
+ const raw = process.env.AI_RULES_ATTEMPT_MAX_MS
15
+ const value = raw === undefined || raw.trim() === "" ? Number.NaN : Number(raw)
16
+ return Number.isFinite(value) && value >= 10 * 60 * 1000 ? value : 4 * 60 * 60 * 1000
17
+ })()
18
+
19
+ /** Longer than the one-second tick plus timer jitter, shorter than any real pause. */
20
+ export const SUSPEND_GAP_MS = 60 * 1000
21
+
22
+ export type TimingEvent = {
23
+ type?: string
24
+ at?: string
25
+ eventId?: string
26
+ gateStartedEventId?: string
27
+ durationMs?: number
28
+ activeMs?: number
29
+ outcome?: string
30
+ }
31
+
32
+ export const toMs = (value?: string): number | undefined => {
33
+ if (!value) return undefined
34
+ const parsed = Date.parse(value)
35
+ return Number.isFinite(parsed) ? parsed : undefined
36
+ }
37
+
38
+ export const mergeIntervals = (intervals: readonly Interval[]): Interval[] => {
39
+ const sorted = intervals
40
+ .filter((interval) => Number.isFinite(interval.from) && Number.isFinite(interval.to) && interval.to > interval.from)
41
+ .sort((left, right) => left.from - right.from)
42
+ const merged: Interval[] = []
43
+ for (const interval of sorted) {
44
+ const last = merged.at(-1)
45
+ if (!last || interval.from > last.to) {
46
+ merged.push({ ...interval })
47
+ continue
48
+ }
49
+ last.to = Math.max(last.to, interval.to)
50
+ }
51
+ return merged
52
+ }
53
+
54
+ export const overlapMs = (intervals: readonly Interval[], from: number, to: number): number => {
55
+ if (to <= from) return 0
56
+ let total = 0
57
+ for (const interval of mergeIntervals(intervals)) {
58
+ const start = Math.max(from, interval.from)
59
+ const end = Math.min(to, interval.to)
60
+ if (end > start) total += end - start
61
+ }
62
+ return total
63
+ }
64
+
65
+ /**
66
+ * Gate waits pair on `eventId`. An unclosed gate runs to `now`: a stuck gate is
67
+ * still waiting, not free time.
68
+ */
69
+ export const gateIntervals = (events: readonly TimingEvent[], now: number): Interval[] => {
70
+ const opened = new Map<string, number>()
71
+ const closed = new Map<string, number>()
72
+ for (const event of events) {
73
+ if (event.type !== "human_gate_started" || !event.eventId) continue
74
+ const at = toMs(event.at)
75
+ if (at !== undefined) opened.set(event.eventId, at)
76
+ }
77
+ for (const event of events) {
78
+ if (event.type !== "human_gate_ended" || !event.gateStartedEventId) continue
79
+ const at = toMs(event.at)
80
+ if (at !== undefined) closed.set(event.gateStartedEventId, at)
81
+ }
82
+ return [...opened].map(([eventId, from]) => ({
83
+ from,
84
+ to: Math.max(from, closed.get(eventId) ?? now),
85
+ }))
86
+ }
87
+
88
+ /** Pauses pair as `task_paused` / `task_resumed`; the open one runs to `now`. */
89
+ export const pauseIntervals = (events: readonly TimingEvent[], now: number): Interval[] => {
90
+ const intervals: Interval[] = []
91
+ let open: number | undefined
92
+ for (const event of events) {
93
+ const at = toMs(event.at)
94
+ if (at === undefined) continue
95
+ if (event.type === "task_paused" && open === undefined) open = at
96
+ if (event.type === "task_resumed" && open !== undefined) {
97
+ intervals.push({ from: open, to: Math.max(open, at) })
98
+ open = undefined
99
+ }
100
+ }
101
+ if (open !== undefined) intervals.push({ from: open, to: Math.max(open, now) })
102
+ return intervals
103
+ }
104
+
105
+ const suspendCache = new Map<string, { size: number; value: Interval[] }>()
106
+
107
+ /**
108
+ * Intervals the host was suspended, appended by the sidebar's gap detector. The
109
+ * hook reads the same file when it closes an attempt.
110
+ */
111
+ export const readSuspendIntervals = (file: string): Interval[] => {
112
+ let size: number
113
+ try {
114
+ size = fs.statSync(file).size
115
+ } catch {
116
+ suspendCache.delete(file)
117
+ return []
118
+ }
119
+ const hit = suspendCache.get(file)
120
+ if (hit && hit.size === size) return hit.value
121
+ const value: Interval[] = []
122
+ try {
123
+ for (const line of fs.readFileSync(file, "utf8").split("\n")) {
124
+ const trimmed = line.trim()
125
+ if (trimmed === "") continue
126
+ try {
127
+ const row = JSON.parse(trimmed) as { from?: string; to?: string }
128
+ const from = toMs(row.from)
129
+ const to = toMs(row.to)
130
+ if (from !== undefined && to !== undefined && to > from) value.push({ from, to })
131
+ } catch {
132
+ // A torn last line is read again when the file grows.
133
+ }
134
+ }
135
+ } catch {
136
+ return hit?.value ?? []
137
+ }
138
+ suspendCache.set(file, { size, value })
139
+ return value
140
+ }
141
+
142
+ export const appendSuspendInterval = (file: string, interval: Interval): boolean => {
143
+ try {
144
+ fs.appendFileSync(
145
+ file,
146
+ `${JSON.stringify({ from: new Date(interval.from).toISOString(), to: new Date(interval.to).toISOString() })}\n`,
147
+ "utf8",
148
+ )
149
+ return true
150
+ } catch {
151
+ return false
152
+ }
153
+ }
154
+
155
+ export const suspendFile = (taskDir: string): string => path.join(taskDir, ".suspend.jsonl")
156
+
157
+ export type TimeBuckets = {
158
+ wallMs: number
159
+ workMs: number
160
+ gateMs: number
161
+ pausedMs: number
162
+ suspendedMs: number
163
+ idleMs: number
164
+ }
165
+
166
+ export type BucketInput = {
167
+ wallMs: number
168
+ events: readonly TimingEvent[]
169
+ /** Started-at of every in-flight attempt. */
170
+ running: readonly number[]
171
+ gate: readonly Interval[]
172
+ pause: readonly Interval[]
173
+ suspend: readonly Interval[]
174
+ now: number
175
+ }
176
+
177
+ /** The hook already removed pauses and suspends from `activeMs`; only cap. */
178
+ const attemptActive = (event: TimingEvent): number => {
179
+ const active = Number.isFinite(event.activeMs) ? event.activeMs : event.durationMs
180
+ if (!Number.isFinite(active) || !active || active <= 0) return 0
181
+ return Math.min(active, MAX_ATTEMPT_MS)
182
+ }
183
+
184
+ /**
185
+ * `workMs` is attempt time with pauses, gates and suspends already removed;
186
+ * `idleMs` is what is left of the wall clock — parent latency, a hung attempt
187
+ * past the cap, and anything the ledger cannot attribute.
188
+ */
189
+ export const timeBuckets = ({ wallMs, events, running, gate, pause, suspend, now }: BucketInput): TimeBuckets => {
190
+ const suspended = mergeIntervals(suspend)
191
+ const nonWork = mergeIntervals([...gate, ...pause, ...suspended])
192
+ let workMs = 0
193
+ for (const event of events) {
194
+ if (event.type === "attempt_finished") workMs += attemptActive(event)
195
+ }
196
+ for (const startedAt of running) {
197
+ const span = now - startedAt
198
+ if (span <= 0) continue
199
+ workMs += Math.min(Math.max(0, span - overlapMs(nonWork, startedAt, now)), MAX_ATTEMPT_MS)
200
+ }
201
+ const from = now - wallMs
202
+ const gateMs = overlapMs(gate, from, now)
203
+ const pausedMs = overlapMs(pause, from, now)
204
+ const suspendedMs = overlapMs(suspended, from, now)
205
+ // The union, not the sum: a pause during a suspend is one stretch of no work.
206
+ const idleMs = Math.max(0, wallMs - workMs - overlapMs(nonWork, from, now))
207
+ return {
208
+ wallMs: Math.max(0, wallMs),
209
+ workMs: Math.max(0, workMs),
210
+ gateMs,
211
+ pausedMs,
212
+ suspendedMs,
213
+ idleMs,
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Wall time minus monotonic time: 90 minutes of sleep shows as a ninety-minute
219
+ * gap that no timer fired during. The detector only reports; the caller persists.
220
+ */
221
+ export class SuspendTracker {
222
+ private wallAt = 0
223
+ private monotonicAt = 0
224
+ private armed = false
225
+
226
+ tick(wall: number, monotonic: number): Interval | null {
227
+ if (!this.armed) {
228
+ this.armed = true
229
+ this.wallAt = wall
230
+ this.monotonicAt = monotonic
231
+ return null
232
+ }
233
+ const wallDelta = wall - this.wallAt
234
+ const monotonicDelta = monotonic - this.monotonicAt
235
+ this.wallAt = wall
236
+ this.monotonicAt = monotonic
237
+ const gap = wallDelta - monotonicDelta
238
+ if (gap < SUSPEND_GAP_MS) return null
239
+ return { from: wall - wallDelta, to: wall - wallDelta + gap }
240
+ }
241
+ }
242
+
243
+ export const monotonicNow = (): number =>
244
+ typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now()
@@ -52,12 +52,21 @@ const TaskSidebar = () => {
52
52
  label: { confirm: "Stop", cancel: "Cancel" },
53
53
  })
54
54
  if (!confirmed) return
55
- const written = engagePause(view.root, view.slug)
55
+ let written = engagePause(view.root, view.slug)
56
56
  if (!written) {
57
- context.ui.toast.show({ title: "Task", message: "Cannot write .ai.local/STOP", variant: "error" })
57
+ const confirmedRepo = await context.ui.dialog.confirm({
58
+ title: "Stop repository",
59
+ message: `The ${view.slug} task directory is not writable. Write a repository-wide stop?`,
60
+ label: { confirm: "Stop repository", cancel: "Cancel" },
61
+ })
62
+ if (!confirmedRepo) return
63
+ written = engagePause(view.root, view.slug, "repo")
64
+ }
65
+ if (!written) {
66
+ context.ui.toast.show({ title: "Task", message: "Cannot write the stop sentinel", variant: "error" })
58
67
  return
59
68
  }
60
- const where = written === "repo" ? `repository-wide (the ${view.slug} task dir was unwritable)` : `for ${view.slug}`
69
+ const where = written === "repo" ? "repository-wide" : `for ${view.slug}`
61
70
  context.ui.toast.show({ title: "Task", message: `Soft stop engaged ${where}`, variant: "warning" })
62
71
  }
63
72
 
@@ -60,10 +60,16 @@ export type MetricEvent = {
60
60
  type?: string
61
61
  at?: string
62
62
  eventId?: string
63
+ gateStartedEventId?: string
63
64
  attemptId?: string
64
65
  agent?: string
65
66
  role?: string
66
67
  durationMs?: number
68
+ wallMs?: number
69
+ activeMs?: number
70
+ idleMs?: number
71
+ outOfBandId?: string
72
+ outcome?: string
67
73
  stepIndex?: number
68
74
  }
69
75
 
@@ -3,7 +3,7 @@
3
3
  "platform": "opencode",
4
4
  "stack": "svelte",
5
5
  "semanticSource": "cursor/svelte",
6
- "sourceRevision": "bc0301da051436857ec57f102952c82c5157d9179a4f3a5a1d457f1da9bb9e19",
6
+ "sourceRevision": "0ee4bc76f8ae9c99addaee8e5a1b99985d8965e58991c447caea624973d52bd7",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -33,8 +33,9 @@ mass-kill, package-manager mismatch and a busy dev-server port.
33
33
  - `run-hook.mjs` — not wired; no native hook schema, the chain hook stays a manual runner
34
34
  - `hooks/examples/**` — hook plugin port is a follow-up
35
35
 
36
- `guard-shell-command.mjs` ships and runs, but no host event calls it: the
37
- OpenCode v2.4.1 bridge registers `ctx.session.hook` for `context`, `compaction`,
38
- `generate`, and `prompt` only (the probe recorded all four), so a
39
- `tool.execute.after` registration is never dispatched. The enforced layer is
40
- `opencode.json` `permission.bash`. Do not describe the guard as enforcement.
36
+ `guard-shell-command.mjs` is not a registered host command. Enforcement is
37
+ `.opencode/plugins/settings-guard/`: it calls this module's `evaluate` from
38
+ `ctx.permission.hook("evaluate")` (and, when that hook is absent, from
39
+ `ctx.tool.hook("execute.before")`). `opencode.json` `permission.bash` stays
40
+ the static floor. A configured `deny` (the `task-evil` agent) never reaches
41
+ the plugin. Do not describe the unregistered CLI file itself as enforcement.