@bonesofspring/ai-rules 0.2.67 → 0.2.69

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 (775) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +5 -5
  3. package/bin/lib/engine-scripts.js +3 -6
  4. package/bin/lib/seed-ai-local-team.js +1 -1
  5. package/docs/PRESET-CONTRIBUTION.md +15 -8
  6. package/docs/TEAM-DB.md +105 -105
  7. package/docs/TOKEN-ECONOMY.md +4 -2
  8. package/docs/openapi/team-db.v1.json +3905 -1466
  9. package/package.json +5 -5
  10. package/presets/_shared/ai-local/scripts/processes.mjs +467 -55
  11. package/presets/_shared/ai-local/scripts/team-db-api.mjs +564 -10
  12. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +816 -47
  13. package/presets/_shared/ai-local/scripts/team-db-project.mjs +659 -5
  14. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +135 -0
  15. package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +11 -6
  16. package/presets/_shared/ai-local/scripts/team-db.mjs +16 -54
  17. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -5
  18. package/presets/_shared/core/architecture/feature-delivery-workflow.md +3 -7
  19. package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
  20. package/presets/_shared/core/quality/code-quality-and-refactoring.md +2 -6
  21. package/presets/_shared/core/quality/verification-before-completion.md +20 -3
  22. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +149 -5
  23. package/presets/claude/android-kotlin/REPO_AGENTS.md +7 -47
  24. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +149 -5
  25. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  26. package/presets/claude/android-kotlin/rules/tooling-and-review/code-quality.md +2 -6
  27. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  28. package/presets/claude/go/REPO_AGENTS.md +7 -47
  29. package/presets/claude/go/hooks/chain-team-phases.sh +149 -5
  30. package/presets/claude/go/rules/architecture/feature-delivery.md +3 -7
  31. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  32. package/presets/claude/go/rules/tooling-and-review/code-quality.md +2 -6
  33. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  34. package/presets/claude/ios-swift/REPO_AGENTS.md +7 -47
  35. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +149 -5
  36. package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +3 -7
  37. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  38. package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +2 -6
  39. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  40. package/presets/claude/java/REPO_AGENTS.md +7 -47
  41. package/presets/claude/java/hooks/chain-team-phases.sh +149 -5
  42. package/presets/claude/java/rules/architecture/feature-delivery.md +3 -7
  43. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  44. package/presets/claude/java/rules/tooling-and-review/code-quality.md +2 -6
  45. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  46. package/presets/claude/mcp-ts/REPO_AGENTS.md +7 -47
  47. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +149 -5
  48. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +3 -7
  49. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  50. package/presets/claude/mcp-ts/rules/tooling-and-review/code-quality.md +2 -6
  51. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  52. package/presets/claude/mol/REPO_AGENTS.md +9 -49
  53. package/presets/claude/mol/hooks/chain-team-phases.sh +149 -5
  54. package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +3 -7
  55. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  56. package/presets/claude/mol/rules/tooling-and-review/code-quality.md +2 -6
  57. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  58. package/presets/claude/next/REPO_AGENTS.md +10 -50
  59. package/presets/claude/next/agents/accessibility-reviewer.md +0 -1
  60. package/presets/claude/next/agents/api-contract-reviewer.md +0 -1
  61. package/presets/claude/next/agents/build-verifier.md +12 -8
  62. package/presets/claude/next/agents/code-reviewer.md +1 -1
  63. package/presets/claude/next/agents/codebase-analyzer.md +0 -1
  64. package/presets/claude/next/agents/feature-developer.md +6 -6
  65. package/presets/claude/next/agents/migration-specialist.md +0 -1
  66. package/presets/claude/next/agents/mockup-reviewer.md +0 -1
  67. package/presets/claude/next/agents/openspec-author.md +0 -1
  68. package/presets/claude/next/agents/performance-auditor.md +0 -1
  69. package/presets/claude/next/agents/playwright-test-generator.md +0 -1
  70. package/presets/claude/next/agents/playwright-test-healer.md +0 -1
  71. package/presets/claude/next/agents/playwright-test-planner.md +0 -1
  72. package/presets/claude/next/agents/qa-tester.md +3 -3
  73. package/presets/claude/next/agents/security-reviewer.md +0 -1
  74. package/presets/claude/next/agents/solution-architect.md +0 -1
  75. package/presets/claude/next/agents/task-analyst.md +0 -1
  76. package/presets/claude/next/agents/task-router.md +8 -7
  77. package/presets/claude/next/agents/tech-writer.md +0 -1
  78. package/presets/claude/next/agents/unit-test-generator.md +0 -1
  79. package/presets/claude/next/agents/unit-test-healer.md +0 -1
  80. package/presets/claude/next/agents/unit-test-planner.md +0 -1
  81. package/presets/claude/next/commands/README.md +0 -6
  82. package/presets/claude/next/commands/task-continue.md +17 -6
  83. package/presets/claude/next/hooks/chain-team-phases.sh +149 -5
  84. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +5 -9
  85. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  86. package/presets/claude/next/rules/tooling-and-review/code-quality.md +2 -6
  87. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +12 -16
  88. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  89. package/presets/claude/next/skills/feature-delivery/SKILL.md +1 -1
  90. package/presets/claude/next/skills/playwright-e2e/SKILL.md +1 -1
  91. package/presets/claude/next/skills/unit-testing/SKILL.md +1 -1
  92. package/presets/claude/nuxt/REPO_AGENTS.md +8 -48
  93. package/presets/claude/nuxt/agents/accessibility-reviewer.md +0 -1
  94. package/presets/claude/nuxt/agents/api-contract-reviewer.md +0 -1
  95. package/presets/claude/nuxt/agents/build-verifier.md +5 -3
  96. package/presets/claude/nuxt/agents/ci-investigator.md +1 -1
  97. package/presets/claude/nuxt/agents/code-reviewer.md +0 -1
  98. package/presets/claude/nuxt/agents/codebase-analyzer.md +0 -1
  99. package/presets/claude/nuxt/agents/debugger.md +1 -1
  100. package/presets/claude/nuxt/agents/feature-developer.md +6 -6
  101. package/presets/claude/nuxt/agents/migration-specialist.md +0 -1
  102. package/presets/claude/nuxt/agents/mockup-reviewer.md +0 -1
  103. package/presets/claude/nuxt/agents/openspec-author.md +0 -1
  104. package/presets/claude/nuxt/agents/performance-auditor.md +0 -1
  105. package/presets/claude/nuxt/agents/playwright-test-generator.md +0 -1
  106. package/presets/claude/nuxt/agents/playwright-test-healer.md +0 -1
  107. package/presets/claude/nuxt/agents/playwright-test-planner.md +0 -1
  108. package/presets/claude/nuxt/agents/qa-tester.md +3 -3
  109. package/presets/claude/nuxt/agents/security-reviewer.md +0 -1
  110. package/presets/claude/nuxt/agents/solution-architect.md +0 -1
  111. package/presets/claude/nuxt/agents/task-analyst.md +0 -1
  112. package/presets/claude/nuxt/agents/task-router.md +8 -7
  113. package/presets/claude/nuxt/agents/tech-writer.md +0 -1
  114. package/presets/claude/nuxt/agents/unit-test-generator.md +0 -1
  115. package/presets/claude/nuxt/agents/unit-test-healer.md +0 -1
  116. package/presets/claude/nuxt/agents/unit-test-planner.md +0 -1
  117. package/presets/claude/nuxt/hooks/chain-team-phases.sh +149 -5
  118. package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +3 -7
  119. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  120. package/presets/claude/nuxt/rules/tooling-and-review/code-quality.md +2 -6
  121. package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +14 -14
  122. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  123. package/presets/claude/nuxt/skills/feature-delivery/SKILL.md +1 -1
  124. package/presets/claude/nuxt/skills/playwright-e2e/SKILL.md +1 -1
  125. package/presets/claude/nuxt/skills/unit-testing/SKILL.md +1 -1
  126. package/presets/claude/php-hexagonal/REPO_AGENTS.md +7 -47
  127. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +149 -5
  128. package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +3 -7
  129. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  130. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-quality.md +2 -6
  131. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  132. package/presets/claude/php-laravel/REPO_AGENTS.md +7 -47
  133. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +149 -5
  134. package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +3 -7
  135. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  136. package/presets/claude/php-laravel/rules/tooling-and-review/code-quality.md +2 -6
  137. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  138. package/presets/claude/svelte/REPO_AGENTS.md +8 -48
  139. package/presets/claude/svelte/agents/accessibility-reviewer.md +0 -1
  140. package/presets/claude/svelte/agents/api-contract-reviewer.md +0 -1
  141. package/presets/claude/svelte/agents/build-verifier.md +5 -3
  142. package/presets/claude/svelte/agents/ci-investigator.md +1 -1
  143. package/presets/claude/svelte/agents/code-reviewer.md +0 -1
  144. package/presets/claude/svelte/agents/codebase-analyzer.md +0 -1
  145. package/presets/claude/svelte/agents/debugger.md +1 -1
  146. package/presets/claude/svelte/agents/feature-developer.md +6 -6
  147. package/presets/claude/svelte/agents/migration-specialist.md +0 -1
  148. package/presets/claude/svelte/agents/mockup-reviewer.md +0 -1
  149. package/presets/claude/svelte/agents/openspec-author.md +0 -1
  150. package/presets/claude/svelte/agents/performance-auditor.md +0 -1
  151. package/presets/claude/svelte/agents/playwright-test-generator.md +0 -1
  152. package/presets/claude/svelte/agents/playwright-test-healer.md +0 -1
  153. package/presets/claude/svelte/agents/playwright-test-planner.md +0 -1
  154. package/presets/claude/svelte/agents/qa-tester.md +3 -3
  155. package/presets/claude/svelte/agents/security-reviewer.md +0 -1
  156. package/presets/claude/svelte/agents/solution-architect.md +0 -1
  157. package/presets/claude/svelte/agents/task-analyst.md +0 -1
  158. package/presets/claude/svelte/agents/task-router.md +8 -7
  159. package/presets/claude/svelte/agents/tech-writer.md +0 -1
  160. package/presets/claude/svelte/agents/unit-test-generator.md +0 -1
  161. package/presets/claude/svelte/agents/unit-test-healer.md +0 -1
  162. package/presets/claude/svelte/agents/unit-test-planner.md +0 -1
  163. package/presets/claude/svelte/hooks/chain-team-phases.sh +149 -5
  164. package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +3 -7
  165. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
  166. package/presets/claude/svelte/rules/tooling-and-review/code-quality.md +2 -6
  167. package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +14 -14
  168. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  169. package/presets/claude/svelte/skills/feature-delivery/SKILL.md +1 -1
  170. package/presets/claude/svelte/skills/playwright-e2e/SKILL.md +1 -1
  171. package/presets/claude/svelte/skills/unit-testing/SKILL.md +1 -1
  172. package/presets/cursor/android-kotlin/AGENTS.md +0 -10
  173. package/presets/cursor/android-kotlin/REPO_AGENTS.md +7 -47
  174. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +149 -5
  175. package/presets/cursor/android-kotlin/rules/code-quality-and-refactoring.mdc +2 -6
  176. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
  177. package/presets/cursor/go/AGENTS.md +0 -8
  178. package/presets/cursor/go/REPO_AGENTS.md +7 -47
  179. package/presets/cursor/go/hooks/chain-team-phases.sh +149 -5
  180. package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +2 -6
  181. package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
  182. package/presets/cursor/ios-swift/AGENTS.md +0 -10
  183. package/presets/cursor/ios-swift/REPO_AGENTS.md +7 -47
  184. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +149 -5
  185. package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +2 -6
  186. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
  187. package/presets/cursor/java/AGENTS.md +0 -8
  188. package/presets/cursor/java/REPO_AGENTS.md +7 -47
  189. package/presets/cursor/java/hooks/chain-team-phases.sh +149 -5
  190. package/presets/cursor/java/rules/code-quality-and-refactoring.mdc +2 -6
  191. package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
  192. package/presets/cursor/mcp-ts/AGENTS.md +0 -6
  193. package/presets/cursor/mcp-ts/REPO_AGENTS.md +7 -47
  194. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +149 -5
  195. package/presets/cursor/mcp-ts/rules/code-quality-and-refactoring.mdc +2 -6
  196. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
  197. package/presets/cursor/mol/AGENTS.md +0 -11
  198. package/presets/cursor/mol/REPO_AGENTS.md +9 -49
  199. package/presets/cursor/mol/hooks/chain-team-phases.sh +149 -5
  200. package/presets/cursor/mol/rules/code-quality-and-refactoring.mdc +2 -6
  201. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
  202. package/presets/cursor/next/AGENTS.md +1 -12
  203. package/presets/cursor/next/REPO_AGENTS.md +10 -50
  204. package/presets/cursor/next/agents/build-verifier.md +11 -7
  205. package/presets/cursor/next/agents/code-reviewer.md +1 -0
  206. package/presets/cursor/next/agents/feature-developer.md +6 -6
  207. package/presets/cursor/next/agents/qa-tester.md +3 -2
  208. package/presets/cursor/next/agents/task-router.md +8 -6
  209. package/presets/cursor/next/commands/README.md +0 -6
  210. package/presets/cursor/next/commands/task-continue.md +17 -6
  211. package/presets/cursor/next/hooks/chain-team-phases.sh +149 -5
  212. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +4 -4
  213. package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +2 -6
  214. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +2 -2
  215. package/presets/cursor/next/rules/post-change-lint.mdc +12 -16
  216. package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
  217. package/presets/cursor/next/skills/feature-delivery/SKILL.md +1 -1
  218. package/presets/cursor/next/skills/playwright-e2e/SKILL.md +1 -1
  219. package/presets/cursor/next/skills/unit-testing/SKILL.md +1 -1
  220. package/presets/cursor/nuxt/AGENTS.md +1 -12
  221. package/presets/cursor/nuxt/REPO_AGENTS.md +8 -48
  222. package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
  223. package/presets/cursor/nuxt/agents/feature-developer.md +2 -2
  224. package/presets/cursor/nuxt/agents/qa-tester.md +3 -2
  225. package/presets/cursor/nuxt/agents/task-router.md +8 -6
  226. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +149 -5
  227. package/presets/cursor/nuxt/rules/code-quality-and-refactoring.mdc +2 -6
  228. package/presets/cursor/nuxt/rules/post-change-lint.mdc +14 -14
  229. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
  230. package/presets/cursor/nuxt/skills/feature-delivery/SKILL.md +1 -1
  231. package/presets/cursor/nuxt/skills/playwright-e2e/SKILL.md +1 -1
  232. package/presets/cursor/nuxt/skills/unit-testing/SKILL.md +1 -1
  233. package/presets/cursor/php-hexagonal/AGENTS.md +0 -8
  234. package/presets/cursor/php-hexagonal/REPO_AGENTS.md +7 -47
  235. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +149 -5
  236. package/presets/cursor/php-hexagonal/rules/code-quality-and-refactoring.mdc +2 -6
  237. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
  238. package/presets/cursor/php-laravel/AGENTS.md +0 -8
  239. package/presets/cursor/php-laravel/REPO_AGENTS.md +7 -47
  240. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +149 -5
  241. package/presets/cursor/php-laravel/rules/code-quality-and-refactoring.mdc +2 -6
  242. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
  243. package/presets/cursor/svelte/AGENTS.md +1 -12
  244. package/presets/cursor/svelte/REPO_AGENTS.md +8 -48
  245. package/presets/cursor/svelte/agents/build-verifier.md +1 -1
  246. package/presets/cursor/svelte/agents/feature-developer.md +2 -2
  247. package/presets/cursor/svelte/agents/qa-tester.md +3 -2
  248. package/presets/cursor/svelte/agents/task-router.md +8 -6
  249. package/presets/cursor/svelte/hooks/chain-team-phases.sh +149 -5
  250. package/presets/cursor/svelte/rules/code-quality-and-refactoring.mdc +2 -6
  251. package/presets/cursor/svelte/rules/post-change-lint.mdc +14 -14
  252. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
  253. package/presets/cursor/svelte/skills/feature-delivery/SKILL.md +1 -1
  254. package/presets/cursor/svelte/skills/playwright-e2e/SKILL.md +1 -1
  255. package/presets/cursor/svelte/skills/unit-testing/SKILL.md +1 -1
  256. package/presets/mavis/android-kotlin/MAVIS.md +0 -2
  257. package/presets/mavis/android-kotlin/REPO_AGENTS.md +7 -47
  258. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  259. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +149 -5
  260. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -5
  261. package/presets/mavis/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
  262. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
  263. package/presets/mavis/go/MAVIS.md +8 -0
  264. package/presets/mavis/go/REPO_AGENTS.md +7 -47
  265. package/presets/mavis/go/adapter-map.json +1 -1
  266. package/presets/mavis/go/hooks/chain-team-phases.sh +149 -5
  267. package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -5
  268. package/presets/mavis/go/rules/code-quality-and-refactoring.md +2 -6
  269. package/presets/mavis/go/rules/feature-delivery-workflow.md +3 -7
  270. package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
  271. package/presets/mavis/ios-swift/MAVIS.md +0 -2
  272. package/presets/mavis/ios-swift/REPO_AGENTS.md +7 -47
  273. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  274. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +149 -5
  275. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -5
  276. package/presets/mavis/ios-swift/rules/code-quality-and-refactoring.md +2 -6
  277. package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +3 -7
  278. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
  279. package/presets/mavis/java/MAVIS.md +14 -0
  280. package/presets/mavis/java/REPO_AGENTS.md +7 -47
  281. package/presets/mavis/java/adapter-map.json +1 -1
  282. package/presets/mavis/java/hooks/chain-team-phases.sh +149 -5
  283. package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -5
  284. package/presets/mavis/java/rules/code-quality-and-refactoring.md +2 -6
  285. package/presets/mavis/java/rules/feature-delivery-workflow.md +3 -7
  286. package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
  287. package/presets/mavis/mcp-ts/MAVIS.md +6 -0
  288. package/presets/mavis/mcp-ts/REPO_AGENTS.md +7 -47
  289. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  290. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +149 -5
  291. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -5
  292. package/presets/mavis/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
  293. package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +3 -7
  294. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
  295. package/presets/mavis/mol/MAVIS.md +1 -5
  296. package/presets/mavis/mol/REPO_AGENTS.md +9 -49
  297. package/presets/mavis/mol/adapter-map.json +1 -1
  298. package/presets/mavis/mol/hooks/chain-team-phases.sh +149 -5
  299. package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -5
  300. package/presets/mavis/mol/rules/code-quality-and-refactoring.md +2 -6
  301. package/presets/mavis/mol/rules/feature-delivery-workflow.md +3 -7
  302. package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
  303. package/presets/mavis/next/MAVIS.md +2 -6
  304. package/presets/mavis/next/REPO_AGENTS.md +10 -50
  305. package/presets/mavis/next/adapter-map.json +1 -17
  306. package/presets/mavis/next/agents/accessibility-reviewer.md +0 -1
  307. package/presets/mavis/next/agents/api-contract-reviewer.md +0 -1
  308. package/presets/mavis/next/agents/build-verifier.md +12 -8
  309. package/presets/mavis/next/agents/code-reviewer.md +1 -1
  310. package/presets/mavis/next/agents/codebase-analyzer.md +0 -1
  311. package/presets/mavis/next/agents/feature-developer.md +6 -6
  312. package/presets/mavis/next/agents/migration-specialist.md +0 -1
  313. package/presets/mavis/next/agents/mockup-reviewer.md +0 -1
  314. package/presets/mavis/next/agents/openspec-author.md +0 -1
  315. package/presets/mavis/next/agents/performance-auditor.md +0 -1
  316. package/presets/mavis/next/agents/playwright-test-generator.md +0 -1
  317. package/presets/mavis/next/agents/playwright-test-healer.md +0 -1
  318. package/presets/mavis/next/agents/playwright-test-planner.md +0 -1
  319. package/presets/mavis/next/agents/qa-tester.md +3 -3
  320. package/presets/mavis/next/agents/security-reviewer.md +0 -1
  321. package/presets/mavis/next/agents/solution-architect.md +0 -1
  322. package/presets/mavis/next/agents/task-analyst.md +0 -1
  323. package/presets/mavis/next/agents/task-router.md +8 -7
  324. package/presets/mavis/next/agents/tech-writer.md +0 -1
  325. package/presets/mavis/next/agents/unit-test-generator.md +0 -1
  326. package/presets/mavis/next/agents/unit-test-healer.md +0 -1
  327. package/presets/mavis/next/agents/unit-test-planner.md +0 -1
  328. package/presets/mavis/next/commands/README.md +0 -6
  329. package/presets/mavis/next/commands/task-continue.md +16 -5
  330. package/presets/mavis/next/hooks/chain-team-phases.sh +149 -5
  331. package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -5
  332. package/presets/mavis/next/rules/code-quality-and-refactoring.md +2 -6
  333. package/presets/mavis/next/rules/feature-delivery-workflow.md +5 -9
  334. package/presets/mavis/next/rules/post-change-lint.md +11 -15
  335. package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
  336. package/presets/mavis/next/skills/feature-delivery/SKILL.md +1 -1
  337. package/presets/mavis/next/skills/playwright-e2e/SKILL.md +1 -1
  338. package/presets/mavis/next/skills/unit-testing/SKILL.md +1 -1
  339. package/presets/mavis/nuxt/MAVIS.md +2 -6
  340. package/presets/mavis/nuxt/REPO_AGENTS.md +8 -48
  341. package/presets/mavis/nuxt/adapter-map.json +1 -1
  342. package/presets/mavis/nuxt/agents/accessibility-reviewer.md +0 -1
  343. package/presets/mavis/nuxt/agents/api-contract-reviewer.md +0 -1
  344. package/presets/mavis/nuxt/agents/build-verifier.md +2 -2
  345. package/presets/mavis/nuxt/agents/ci-investigator.md +1 -1
  346. package/presets/mavis/nuxt/agents/code-reviewer.md +0 -1
  347. package/presets/mavis/nuxt/agents/codebase-analyzer.md +0 -1
  348. package/presets/mavis/nuxt/agents/debugger.md +1 -1
  349. package/presets/mavis/nuxt/agents/feature-developer.md +3 -3
  350. package/presets/mavis/nuxt/agents/migration-specialist.md +0 -1
  351. package/presets/mavis/nuxt/agents/mockup-reviewer.md +0 -1
  352. package/presets/mavis/nuxt/agents/openspec-author.md +0 -1
  353. package/presets/mavis/nuxt/agents/performance-auditor.md +0 -1
  354. package/presets/mavis/nuxt/agents/playwright-test-generator.md +0 -1
  355. package/presets/mavis/nuxt/agents/playwright-test-healer.md +0 -1
  356. package/presets/mavis/nuxt/agents/playwright-test-planner.md +0 -1
  357. package/presets/mavis/nuxt/agents/qa-tester.md +3 -3
  358. package/presets/mavis/nuxt/agents/security-reviewer.md +0 -1
  359. package/presets/mavis/nuxt/agents/solution-architect.md +0 -1
  360. package/presets/mavis/nuxt/agents/task-analyst.md +0 -1
  361. package/presets/mavis/nuxt/agents/task-router.md +8 -7
  362. package/presets/mavis/nuxt/agents/tech-writer.md +0 -1
  363. package/presets/mavis/nuxt/agents/unit-test-generator.md +0 -1
  364. package/presets/mavis/nuxt/agents/unit-test-healer.md +0 -1
  365. package/presets/mavis/nuxt/agents/unit-test-planner.md +0 -1
  366. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +149 -5
  367. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -5
  368. package/presets/mavis/nuxt/rules/code-quality-and-refactoring.md +2 -6
  369. package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +3 -7
  370. package/presets/mavis/nuxt/rules/post-change-lint.md +13 -13
  371. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
  372. package/presets/mavis/nuxt/skills/feature-delivery/SKILL.md +1 -1
  373. package/presets/mavis/nuxt/skills/playwright-e2e/SKILL.md +1 -1
  374. package/presets/mavis/nuxt/skills/unit-testing/SKILL.md +1 -1
  375. package/presets/mavis/php-hexagonal/MAVIS.md +16 -0
  376. package/presets/mavis/php-hexagonal/REPO_AGENTS.md +7 -47
  377. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  378. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +149 -5
  379. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
  380. package/presets/mavis/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
  381. package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
  382. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  383. package/presets/mavis/php-laravel/MAVIS.md +16 -0
  384. package/presets/mavis/php-laravel/REPO_AGENTS.md +7 -47
  385. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  386. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +149 -5
  387. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -5
  388. package/presets/mavis/php-laravel/rules/code-quality-and-refactoring.md +2 -6
  389. package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +3 -7
  390. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
  391. package/presets/mavis/svelte/MAVIS.md +2 -6
  392. package/presets/mavis/svelte/REPO_AGENTS.md +8 -48
  393. package/presets/mavis/svelte/adapter-map.json +1 -1
  394. package/presets/mavis/svelte/agents/accessibility-reviewer.md +0 -1
  395. package/presets/mavis/svelte/agents/api-contract-reviewer.md +0 -1
  396. package/presets/mavis/svelte/agents/build-verifier.md +2 -2
  397. package/presets/mavis/svelte/agents/ci-investigator.md +1 -1
  398. package/presets/mavis/svelte/agents/code-reviewer.md +0 -1
  399. package/presets/mavis/svelte/agents/codebase-analyzer.md +0 -1
  400. package/presets/mavis/svelte/agents/debugger.md +1 -1
  401. package/presets/mavis/svelte/agents/feature-developer.md +3 -3
  402. package/presets/mavis/svelte/agents/migration-specialist.md +0 -1
  403. package/presets/mavis/svelte/agents/mockup-reviewer.md +0 -1
  404. package/presets/mavis/svelte/agents/openspec-author.md +0 -1
  405. package/presets/mavis/svelte/agents/performance-auditor.md +0 -1
  406. package/presets/mavis/svelte/agents/playwright-test-generator.md +0 -1
  407. package/presets/mavis/svelte/agents/playwright-test-healer.md +0 -1
  408. package/presets/mavis/svelte/agents/playwright-test-planner.md +0 -1
  409. package/presets/mavis/svelte/agents/qa-tester.md +3 -3
  410. package/presets/mavis/svelte/agents/security-reviewer.md +0 -1
  411. package/presets/mavis/svelte/agents/solution-architect.md +0 -1
  412. package/presets/mavis/svelte/agents/task-analyst.md +0 -1
  413. package/presets/mavis/svelte/agents/task-router.md +8 -7
  414. package/presets/mavis/svelte/agents/tech-writer.md +0 -1
  415. package/presets/mavis/svelte/agents/unit-test-generator.md +0 -1
  416. package/presets/mavis/svelte/agents/unit-test-healer.md +0 -1
  417. package/presets/mavis/svelte/agents/unit-test-planner.md +0 -1
  418. package/presets/mavis/svelte/hooks/chain-team-phases.sh +149 -5
  419. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -5
  420. package/presets/mavis/svelte/rules/code-quality-and-refactoring.md +2 -6
  421. package/presets/mavis/svelte/rules/feature-delivery-workflow.md +3 -7
  422. package/presets/mavis/svelte/rules/post-change-lint.md +13 -13
  423. package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
  424. package/presets/mavis/svelte/skills/feature-delivery/SKILL.md +1 -1
  425. package/presets/mavis/svelte/skills/playwright-e2e/SKILL.md +1 -1
  426. package/presets/mavis/svelte/skills/unit-testing/SKILL.md +1 -1
  427. package/presets/opencode/android-kotlin/OPENCODE.md +1 -43
  428. package/presets/opencode/android-kotlin/REPO_AGENTS.md +7 -47
  429. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  430. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +149 -5
  431. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
  432. package/presets/opencode/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
  433. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  434. package/presets/opencode/go/OPENCODE.md +7 -39
  435. package/presets/opencode/go/REPO_AGENTS.md +7 -47
  436. package/presets/opencode/go/adapter-map.json +1 -1
  437. package/presets/opencode/go/hooks/chain-team-phases.sh +149 -5
  438. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -5
  439. package/presets/opencode/go/rules/code-quality-and-refactoring.md +2 -6
  440. package/presets/opencode/go/rules/feature-delivery-workflow.md +3 -7
  441. package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
  442. package/presets/opencode/ios-swift/OPENCODE.md +1 -43
  443. package/presets/opencode/ios-swift/REPO_AGENTS.md +7 -47
  444. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  445. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +149 -5
  446. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -5
  447. package/presets/opencode/ios-swift/rules/code-quality-and-refactoring.md +2 -6
  448. package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +3 -7
  449. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
  450. package/presets/opencode/java/OPENCODE.md +12 -38
  451. package/presets/opencode/java/REPO_AGENTS.md +7 -47
  452. package/presets/opencode/java/adapter-map.json +1 -1
  453. package/presets/opencode/java/hooks/chain-team-phases.sh +149 -5
  454. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -5
  455. package/presets/opencode/java/rules/code-quality-and-refactoring.md +2 -6
  456. package/presets/opencode/java/rules/feature-delivery-workflow.md +3 -7
  457. package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
  458. package/presets/opencode/mcp-ts/OPENCODE.md +5 -39
  459. package/presets/opencode/mcp-ts/REPO_AGENTS.md +7 -47
  460. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  461. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +149 -5
  462. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
  463. package/presets/opencode/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
  464. package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +3 -7
  465. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  466. package/presets/opencode/mol/OPENCODE.md +1 -44
  467. package/presets/opencode/mol/REPO_AGENTS.md +9 -49
  468. package/presets/opencode/mol/adapter-map.json +1 -1
  469. package/presets/opencode/mol/hooks/chain-team-phases.sh +149 -5
  470. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -5
  471. package/presets/opencode/mol/rules/code-quality-and-refactoring.md +2 -6
  472. package/presets/opencode/mol/rules/feature-delivery-workflow.md +3 -7
  473. package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
  474. package/presets/opencode/next/OPENCODE.md +2 -45
  475. package/presets/opencode/next/REPO_AGENTS.md +10 -50
  476. package/presets/opencode/next/adapter-map.json +1 -17
  477. package/presets/opencode/next/agents/accessibility-reviewer.md +0 -1
  478. package/presets/opencode/next/agents/api-contract-reviewer.md +0 -1
  479. package/presets/opencode/next/agents/build-verifier.md +12 -8
  480. package/presets/opencode/next/agents/code-reviewer.md +1 -1
  481. package/presets/opencode/next/agents/codebase-analyzer.md +0 -1
  482. package/presets/opencode/next/agents/feature-developer.md +6 -6
  483. package/presets/opencode/next/agents/migration-specialist.md +0 -1
  484. package/presets/opencode/next/agents/mockup-reviewer.md +0 -1
  485. package/presets/opencode/next/agents/openspec-author.md +0 -1
  486. package/presets/opencode/next/agents/performance-auditor.md +0 -1
  487. package/presets/opencode/next/agents/playwright-test-generator.md +0 -1
  488. package/presets/opencode/next/agents/playwright-test-healer.md +0 -1
  489. package/presets/opencode/next/agents/playwright-test-planner.md +0 -1
  490. package/presets/opencode/next/agents/qa-tester.md +3 -3
  491. package/presets/opencode/next/agents/security-reviewer.md +0 -1
  492. package/presets/opencode/next/agents/solution-architect.md +0 -1
  493. package/presets/opencode/next/agents/task-analyst.md +0 -1
  494. package/presets/opencode/next/agents/task-router.md +8 -7
  495. package/presets/opencode/next/agents/tech-writer.md +0 -1
  496. package/presets/opencode/next/agents/unit-test-generator.md +0 -1
  497. package/presets/opencode/next/agents/unit-test-healer.md +0 -1
  498. package/presets/opencode/next/agents/unit-test-planner.md +0 -1
  499. package/presets/opencode/next/commands/README.md +0 -6
  500. package/presets/opencode/next/commands/task-continue.md +17 -6
  501. package/presets/opencode/next/hooks/chain-team-phases.sh +149 -5
  502. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -5
  503. package/presets/opencode/next/rules/code-quality-and-refactoring.md +2 -6
  504. package/presets/opencode/next/rules/feature-delivery-workflow.md +5 -9
  505. package/presets/opencode/next/rules/post-change-lint.md +11 -15
  506. package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
  507. package/presets/opencode/next/skills/feature-delivery/SKILL.md +1 -1
  508. package/presets/opencode/next/skills/playwright-e2e/SKILL.md +1 -1
  509. package/presets/opencode/next/skills/unit-testing/SKILL.md +1 -1
  510. package/presets/opencode/nuxt/OPENCODE.md +2 -45
  511. package/presets/opencode/nuxt/REPO_AGENTS.md +8 -48
  512. package/presets/opencode/nuxt/adapter-map.json +1 -1
  513. package/presets/opencode/nuxt/agents/accessibility-reviewer.md +0 -1
  514. package/presets/opencode/nuxt/agents/api-contract-reviewer.md +0 -1
  515. package/presets/opencode/nuxt/agents/build-verifier.md +2 -2
  516. package/presets/opencode/nuxt/agents/ci-investigator.md +1 -1
  517. package/presets/opencode/nuxt/agents/code-reviewer.md +0 -1
  518. package/presets/opencode/nuxt/agents/codebase-analyzer.md +0 -1
  519. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  520. package/presets/opencode/nuxt/agents/feature-developer.md +3 -3
  521. package/presets/opencode/nuxt/agents/migration-specialist.md +0 -1
  522. package/presets/opencode/nuxt/agents/mockup-reviewer.md +0 -1
  523. package/presets/opencode/nuxt/agents/openspec-author.md +0 -1
  524. package/presets/opencode/nuxt/agents/performance-auditor.md +0 -1
  525. package/presets/opencode/nuxt/agents/playwright-test-generator.md +0 -1
  526. package/presets/opencode/nuxt/agents/playwright-test-healer.md +0 -1
  527. package/presets/opencode/nuxt/agents/playwright-test-planner.md +0 -1
  528. package/presets/opencode/nuxt/agents/qa-tester.md +3 -3
  529. package/presets/opencode/nuxt/agents/security-reviewer.md +0 -1
  530. package/presets/opencode/nuxt/agents/solution-architect.md +0 -1
  531. package/presets/opencode/nuxt/agents/task-analyst.md +0 -1
  532. package/presets/opencode/nuxt/agents/task-router.md +8 -7
  533. package/presets/opencode/nuxt/agents/tech-writer.md +0 -1
  534. package/presets/opencode/nuxt/agents/unit-test-generator.md +0 -1
  535. package/presets/opencode/nuxt/agents/unit-test-healer.md +0 -1
  536. package/presets/opencode/nuxt/agents/unit-test-planner.md +0 -1
  537. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +149 -5
  538. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -5
  539. package/presets/opencode/nuxt/rules/code-quality-and-refactoring.md +2 -6
  540. package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +3 -7
  541. package/presets/opencode/nuxt/rules/post-change-lint.md +13 -13
  542. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
  543. package/presets/opencode/nuxt/skills/feature-delivery/SKILL.md +1 -1
  544. package/presets/opencode/nuxt/skills/playwright-e2e/SKILL.md +1 -1
  545. package/presets/opencode/nuxt/skills/unit-testing/SKILL.md +1 -1
  546. package/presets/opencode/php-hexagonal/OPENCODE.md +14 -38
  547. package/presets/opencode/php-hexagonal/REPO_AGENTS.md +7 -47
  548. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  549. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +149 -5
  550. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
  551. package/presets/opencode/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
  552. package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
  553. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  554. package/presets/opencode/php-laravel/OPENCODE.md +14 -38
  555. package/presets/opencode/php-laravel/REPO_AGENTS.md +7 -47
  556. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  557. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +149 -5
  558. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -5
  559. package/presets/opencode/php-laravel/rules/code-quality-and-refactoring.md +2 -6
  560. package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +3 -7
  561. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
  562. package/presets/opencode/plugins/output-guard/index.ts +7 -1
  563. package/presets/opencode/plugins/output-guard/ledger.ts +43 -0
  564. package/presets/opencode/plugins/task-status/economy.ts +112 -0
  565. package/presets/opencode/plugins/task-status/task-view.ts +28 -0
  566. package/presets/opencode/plugins/task-status/tui.tsx +14 -2
  567. package/presets/opencode/plugins/task-status/types.ts +3 -1
  568. package/presets/opencode/svelte/OPENCODE.md +2 -45
  569. package/presets/opencode/svelte/REPO_AGENTS.md +8 -48
  570. package/presets/opencode/svelte/adapter-map.json +1 -1
  571. package/presets/opencode/svelte/agents/accessibility-reviewer.md +0 -1
  572. package/presets/opencode/svelte/agents/api-contract-reviewer.md +0 -1
  573. package/presets/opencode/svelte/agents/build-verifier.md +2 -2
  574. package/presets/opencode/svelte/agents/ci-investigator.md +1 -1
  575. package/presets/opencode/svelte/agents/code-reviewer.md +0 -1
  576. package/presets/opencode/svelte/agents/codebase-analyzer.md +0 -1
  577. package/presets/opencode/svelte/agents/debugger.md +1 -1
  578. package/presets/opencode/svelte/agents/feature-developer.md +3 -3
  579. package/presets/opencode/svelte/agents/migration-specialist.md +0 -1
  580. package/presets/opencode/svelte/agents/mockup-reviewer.md +0 -1
  581. package/presets/opencode/svelte/agents/openspec-author.md +0 -1
  582. package/presets/opencode/svelte/agents/performance-auditor.md +0 -1
  583. package/presets/opencode/svelte/agents/playwright-test-generator.md +0 -1
  584. package/presets/opencode/svelte/agents/playwright-test-healer.md +0 -1
  585. package/presets/opencode/svelte/agents/playwright-test-planner.md +0 -1
  586. package/presets/opencode/svelte/agents/qa-tester.md +3 -3
  587. package/presets/opencode/svelte/agents/security-reviewer.md +0 -1
  588. package/presets/opencode/svelte/agents/solution-architect.md +0 -1
  589. package/presets/opencode/svelte/agents/task-analyst.md +0 -1
  590. package/presets/opencode/svelte/agents/task-router.md +8 -7
  591. package/presets/opencode/svelte/agents/tech-writer.md +0 -1
  592. package/presets/opencode/svelte/agents/unit-test-generator.md +0 -1
  593. package/presets/opencode/svelte/agents/unit-test-healer.md +0 -1
  594. package/presets/opencode/svelte/agents/unit-test-planner.md +0 -1
  595. package/presets/opencode/svelte/hooks/chain-team-phases.sh +149 -5
  596. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -5
  597. package/presets/opencode/svelte/rules/code-quality-and-refactoring.md +2 -6
  598. package/presets/opencode/svelte/rules/feature-delivery-workflow.md +3 -7
  599. package/presets/opencode/svelte/rules/post-change-lint.md +13 -13
  600. package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
  601. package/presets/opencode/svelte/skills/feature-delivery/SKILL.md +1 -1
  602. package/presets/opencode/svelte/skills/playwright-e2e/SKILL.md +1 -1
  603. package/presets/opencode/svelte/skills/unit-testing/SKILL.md +1 -1
  604. package/presets/zcode/android-kotlin/REPO_AGENTS.md +7 -47
  605. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  606. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +149 -5
  607. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
  608. package/presets/zcode/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
  609. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  610. package/presets/zcode/go/REPO_AGENTS.md +7 -47
  611. package/presets/zcode/go/adapter-map.json +1 -1
  612. package/presets/zcode/go/hooks/chain-team-phases.sh +149 -5
  613. package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -5
  614. package/presets/zcode/go/rules/code-quality-and-refactoring.md +2 -6
  615. package/presets/zcode/go/rules/feature-delivery-workflow.md +3 -7
  616. package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
  617. package/presets/zcode/ios-swift/REPO_AGENTS.md +7 -47
  618. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  619. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +149 -5
  620. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -5
  621. package/presets/zcode/ios-swift/rules/code-quality-and-refactoring.md +2 -6
  622. package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +3 -7
  623. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
  624. package/presets/zcode/java/REPO_AGENTS.md +7 -47
  625. package/presets/zcode/java/adapter-map.json +1 -1
  626. package/presets/zcode/java/hooks/chain-team-phases.sh +149 -5
  627. package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -5
  628. package/presets/zcode/java/rules/code-quality-and-refactoring.md +2 -6
  629. package/presets/zcode/java/rules/feature-delivery-workflow.md +3 -7
  630. package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
  631. package/presets/zcode/mcp-ts/REPO_AGENTS.md +7 -47
  632. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  633. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +149 -5
  634. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
  635. package/presets/zcode/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
  636. package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +3 -7
  637. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  638. package/presets/zcode/mol/REPO_AGENTS.md +9 -49
  639. package/presets/zcode/mol/adapter-map.json +1 -1
  640. package/presets/zcode/mol/hooks/chain-team-phases.sh +149 -5
  641. package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -5
  642. package/presets/zcode/mol/rules/code-quality-and-refactoring.md +2 -6
  643. package/presets/zcode/mol/rules/feature-delivery-workflow.md +3 -7
  644. package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
  645. package/presets/zcode/next/REPO_AGENTS.md +10 -50
  646. package/presets/zcode/next/adapter-map.json +1 -17
  647. package/presets/zcode/next/agents/accessibility-reviewer.md +0 -1
  648. package/presets/zcode/next/agents/api-contract-reviewer.md +0 -1
  649. package/presets/zcode/next/agents/build-verifier.md +12 -8
  650. package/presets/zcode/next/agents/code-reviewer.md +1 -1
  651. package/presets/zcode/next/agents/codebase-analyzer.md +0 -1
  652. package/presets/zcode/next/agents/feature-developer.md +6 -6
  653. package/presets/zcode/next/agents/migration-specialist.md +0 -1
  654. package/presets/zcode/next/agents/mockup-reviewer.md +0 -1
  655. package/presets/zcode/next/agents/openspec-author.md +0 -1
  656. package/presets/zcode/next/agents/performance-auditor.md +0 -1
  657. package/presets/zcode/next/agents/playwright-test-generator.md +0 -1
  658. package/presets/zcode/next/agents/playwright-test-healer.md +0 -1
  659. package/presets/zcode/next/agents/playwright-test-planner.md +0 -1
  660. package/presets/zcode/next/agents/qa-tester.md +3 -3
  661. package/presets/zcode/next/agents/security-reviewer.md +0 -1
  662. package/presets/zcode/next/agents/solution-architect.md +0 -1
  663. package/presets/zcode/next/agents/task-analyst.md +0 -1
  664. package/presets/zcode/next/agents/task-router.md +8 -7
  665. package/presets/zcode/next/agents/tech-writer.md +0 -1
  666. package/presets/zcode/next/agents/unit-test-generator.md +0 -1
  667. package/presets/zcode/next/agents/unit-test-healer.md +0 -1
  668. package/presets/zcode/next/agents/unit-test-planner.md +0 -1
  669. package/presets/zcode/next/commands/README.md +0 -6
  670. package/presets/zcode/next/commands/task-continue.md +17 -6
  671. package/presets/zcode/next/hooks/chain-team-phases.sh +149 -5
  672. package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -5
  673. package/presets/zcode/next/rules/code-quality-and-refactoring.md +2 -6
  674. package/presets/zcode/next/rules/feature-delivery-workflow.md +5 -9
  675. package/presets/zcode/next/rules/post-change-lint.md +11 -15
  676. package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
  677. package/presets/zcode/next/skills/feature-delivery/SKILL.md +1 -1
  678. package/presets/zcode/next/skills/playwright-e2e/SKILL.md +1 -1
  679. package/presets/zcode/next/skills/unit-testing/SKILL.md +1 -1
  680. package/presets/zcode/nuxt/REPO_AGENTS.md +8 -48
  681. package/presets/zcode/nuxt/adapter-map.json +1 -1
  682. package/presets/zcode/nuxt/agents/accessibility-reviewer.md +0 -1
  683. package/presets/zcode/nuxt/agents/api-contract-reviewer.md +0 -1
  684. package/presets/zcode/nuxt/agents/build-verifier.md +2 -2
  685. package/presets/zcode/nuxt/agents/ci-investigator.md +1 -1
  686. package/presets/zcode/nuxt/agents/code-reviewer.md +0 -1
  687. package/presets/zcode/nuxt/agents/codebase-analyzer.md +0 -1
  688. package/presets/zcode/nuxt/agents/debugger.md +1 -1
  689. package/presets/zcode/nuxt/agents/feature-developer.md +3 -3
  690. package/presets/zcode/nuxt/agents/migration-specialist.md +0 -1
  691. package/presets/zcode/nuxt/agents/mockup-reviewer.md +0 -1
  692. package/presets/zcode/nuxt/agents/openspec-author.md +0 -1
  693. package/presets/zcode/nuxt/agents/performance-auditor.md +0 -1
  694. package/presets/zcode/nuxt/agents/playwright-test-generator.md +0 -1
  695. package/presets/zcode/nuxt/agents/playwright-test-healer.md +0 -1
  696. package/presets/zcode/nuxt/agents/playwright-test-planner.md +0 -1
  697. package/presets/zcode/nuxt/agents/qa-tester.md +3 -3
  698. package/presets/zcode/nuxt/agents/security-reviewer.md +0 -1
  699. package/presets/zcode/nuxt/agents/solution-architect.md +0 -1
  700. package/presets/zcode/nuxt/agents/task-analyst.md +0 -1
  701. package/presets/zcode/nuxt/agents/task-router.md +8 -7
  702. package/presets/zcode/nuxt/agents/tech-writer.md +0 -1
  703. package/presets/zcode/nuxt/agents/unit-test-generator.md +0 -1
  704. package/presets/zcode/nuxt/agents/unit-test-healer.md +0 -1
  705. package/presets/zcode/nuxt/agents/unit-test-planner.md +0 -1
  706. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +149 -5
  707. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -5
  708. package/presets/zcode/nuxt/rules/code-quality-and-refactoring.md +2 -6
  709. package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +3 -7
  710. package/presets/zcode/nuxt/rules/post-change-lint.md +13 -13
  711. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
  712. package/presets/zcode/nuxt/skills/feature-delivery/SKILL.md +1 -1
  713. package/presets/zcode/nuxt/skills/playwright-e2e/SKILL.md +1 -1
  714. package/presets/zcode/nuxt/skills/unit-testing/SKILL.md +1 -1
  715. package/presets/zcode/php-hexagonal/REPO_AGENTS.md +7 -47
  716. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  717. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +149 -5
  718. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
  719. package/presets/zcode/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
  720. package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
  721. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  722. package/presets/zcode/php-laravel/REPO_AGENTS.md +7 -47
  723. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  724. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +149 -5
  725. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -5
  726. package/presets/zcode/php-laravel/rules/code-quality-and-refactoring.md +2 -6
  727. package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +3 -7
  728. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
  729. package/presets/zcode/svelte/REPO_AGENTS.md +8 -48
  730. package/presets/zcode/svelte/adapter-map.json +1 -1
  731. package/presets/zcode/svelte/agents/accessibility-reviewer.md +0 -1
  732. package/presets/zcode/svelte/agents/api-contract-reviewer.md +0 -1
  733. package/presets/zcode/svelte/agents/build-verifier.md +2 -2
  734. package/presets/zcode/svelte/agents/ci-investigator.md +1 -1
  735. package/presets/zcode/svelte/agents/code-reviewer.md +0 -1
  736. package/presets/zcode/svelte/agents/codebase-analyzer.md +0 -1
  737. package/presets/zcode/svelte/agents/debugger.md +1 -1
  738. package/presets/zcode/svelte/agents/feature-developer.md +3 -3
  739. package/presets/zcode/svelte/agents/migration-specialist.md +0 -1
  740. package/presets/zcode/svelte/agents/mockup-reviewer.md +0 -1
  741. package/presets/zcode/svelte/agents/openspec-author.md +0 -1
  742. package/presets/zcode/svelte/agents/performance-auditor.md +0 -1
  743. package/presets/zcode/svelte/agents/playwright-test-generator.md +0 -1
  744. package/presets/zcode/svelte/agents/playwright-test-healer.md +0 -1
  745. package/presets/zcode/svelte/agents/playwright-test-planner.md +0 -1
  746. package/presets/zcode/svelte/agents/qa-tester.md +3 -3
  747. package/presets/zcode/svelte/agents/security-reviewer.md +0 -1
  748. package/presets/zcode/svelte/agents/solution-architect.md +0 -1
  749. package/presets/zcode/svelte/agents/task-analyst.md +0 -1
  750. package/presets/zcode/svelte/agents/task-router.md +8 -7
  751. package/presets/zcode/svelte/agents/tech-writer.md +0 -1
  752. package/presets/zcode/svelte/agents/unit-test-generator.md +0 -1
  753. package/presets/zcode/svelte/agents/unit-test-healer.md +0 -1
  754. package/presets/zcode/svelte/agents/unit-test-planner.md +0 -1
  755. package/presets/zcode/svelte/hooks/chain-team-phases.sh +149 -5
  756. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -5
  757. package/presets/zcode/svelte/rules/code-quality-and-refactoring.md +2 -6
  758. package/presets/zcode/svelte/rules/feature-delivery-workflow.md +3 -7
  759. package/presets/zcode/svelte/rules/post-change-lint.md +13 -13
  760. package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
  761. package/presets/zcode/svelte/skills/feature-delivery/SKILL.md +1 -1
  762. package/presets/zcode/svelte/skills/playwright-e2e/SKILL.md +1 -1
  763. package/presets/zcode/svelte/skills/unit-testing/SKILL.md +1 -1
  764. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +0 -2103
  765. package/presets/_shared/ai-local/scripts/team-db-ui.mjs +0 -750
  766. package/presets/claude/next/commands/ui-start.md +0 -78
  767. package/presets/claude/next/commands/ui-stop.md +0 -71
  768. package/presets/cursor/next/commands/ui-start.md +0 -78
  769. package/presets/cursor/next/commands/ui-stop.md +0 -71
  770. package/presets/mavis/next/commands/ui-start.md +0 -73
  771. package/presets/mavis/next/commands/ui-stop.md +0 -66
  772. package/presets/opencode/next/commands/ui-start.md +0 -81
  773. package/presets/opencode/next/commands/ui-stop.md +0 -74
  774. package/presets/zcode/next/commands/ui-start.md +0 -81
  775. package/presets/zcode/next/commands/ui-stop.md +0 -74
@@ -1,2103 +0,0 @@
1
- /**
2
- * The no-build operator dashboard.
3
- *
4
- * Three strings and nothing else: `DASHBOARD_HTML`, `DASHBOARD_CSS`,
5
- * `DASHBOARD_JS`. The API serves them from memory, so a consumer needs no
6
- * bundler, package script, asset directory, web font or external request.
7
- *
8
- * Rules the shipped client keeps (asserted by `test-team-db-dashboard.mjs`):
9
- * same-origin relative URLs only, every dynamic value through `textContent`,
10
- * no HTML sink, and a named mutating allowlist — the task surface mutates only
11
- * through the rescan and the confirmed delete, the tracker surface never. */
12
-
13
- export const DASHBOARD_HTML = `<!doctype html>
14
- <html lang="en">
15
- <head>
16
- <meta charset="utf-8">
17
- <meta name="viewport" content="width=device-width, initial-scale=1">
18
- <title>Agent team projection</title>
19
- <link rel="stylesheet" href="/assets/app.css">
20
- <script src="/assets/app.js" defer></script>
21
- </head>
22
- <body>
23
- <a class="skip-link" href="#main">Skip to content</a>
24
- <header class="page-header">
25
- <h1>Agent team projection</h1>
26
- <p class="lede">Task files are authoritative. This page reads the local SQLite projection over the loopback API.</p>
27
- <div id="banner" class="banner" role="status" aria-live="polite" hidden></div>
28
- </header>
29
- <main id="main">
30
- <section id="view-list" aria-labelledby="list-heading">
31
- <h2 id="list-heading" tabindex="-1">Tasks</h2>
32
- <form id="filters" class="filters" role="search" aria-label="Task filters">
33
- <div class="field">
34
- <label for="filter-q">Search</label>
35
- <input id="filter-q" name="q" type="search" autocomplete="off" aria-describedby="filter-q-help">
36
- <p id="filter-q-help" class="help">Slug, title, artifact summary, document or prompt text.</p>
37
- </div>
38
- <div class="field">
39
- <label for="filter-status">Status</label>
40
- <select id="filter-status" name="status">
41
- <option value="">Any</option>
42
- <option value="in_progress">in_progress</option>
43
- <option value="completed">completed</option>
44
- <option value="changes_requested">changes_requested</option>
45
- <option value="validation_failed">validation_failed</option>
46
- <option value="blocked">blocked</option>
47
- <option value="awaiting_approval">awaiting_approval</option>
48
- <option value="awaiting_artifact_receipt">awaiting_artifact_receipt</option>
49
- </select>
50
- </div>
51
- <div class="field">
52
- <label for="filter-agent">Agent</label>
53
- <input id="filter-agent" name="agent" type="text" autocomplete="off">
54
- </div>
55
- <div class="field">
56
- <label for="filter-intent">Intent</label>
57
- <input id="filter-intent" name="intent" type="text" autocomplete="off">
58
- </div>
59
- <div class="field">
60
- <label for="filter-profile">Profile</label>
61
- <select id="filter-profile" name="profile">
62
- <option value="">Any</option>
63
- <option value="light">light</option>
64
- <option value="standard">standard</option>
65
- <option value="full">full</option>
66
- </select>
67
- </div>
68
- <div class="field">
69
- <label for="filter-from">Updated from</label>
70
- <input id="filter-from" name="from" type="date">
71
- </div>
72
- <div class="field">
73
- <label for="filter-to">Updated to</label>
74
- <input id="filter-to" name="to" type="date">
75
- </div>
76
- <div class="field">
77
- <label for="sort">Sort</label>
78
- <select id="sort" name="sort">
79
- <option value="-updatedAt">Newest update</option>
80
- <option value="updatedAt">Oldest update</option>
81
- <option value="-startAt">Newest start</option>
82
- <option value="startAt">Oldest start</option>
83
- <option value="slug">Slug A–Z</option>
84
- <option value="-slug">Slug Z–A</option>
85
- </select>
86
- </div>
87
- <div class="field checkbox">
88
- <input id="filter-absent" name="includeAbsent" type="checkbox">
89
- <label for="filter-absent">Include absent tasks</label>
90
- </div>
91
- <div class="actions">
92
- <button id="apply" type="submit">Apply</button>
93
- <button id="reset" type="button">Reset</button>
94
- <button id="rescan" type="button">Rescan</button>
95
- <a id="link-stats" href="/api/v1/stats">Stats JSON</a>
96
- </div>
97
- </form>
98
- <p id="state-loading" class="state" role="status" aria-live="polite" hidden>Loading…</p>
99
- <p id="state-empty" class="state" role="status" aria-live="polite" hidden>No tasks match these filters.</p>
100
- <p id="state-error" class="state error" role="alert" hidden></p>
101
- <table id="task-list" class="tasks">
102
- <caption>Tasks in the local projection</caption>
103
- <thead>
104
- <tr>
105
- <th scope="col">Task</th>
106
- <th scope="col">Status</th>
107
- <th scope="col">Intent</th>
108
- <th scope="col">Profile</th>
109
- <th scope="col">Stack / platform</th>
110
- <th scope="col">Current agent</th>
111
- <th scope="col">Gate</th>
112
- <th scope="col">Updated</th>
113
- <th scope="col">Start</th>
114
- <th scope="col">End</th>
115
- <th scope="col">Duration</th>
116
- <th scope="col">Attempts</th>
117
- </tr>
118
- </thead>
119
- <tbody id="task-rows"></tbody>
120
- </table>
121
- <button id="load-more" type="button" hidden>Load more</button>
122
- </section>
123
- <section id="view-detail" aria-labelledby="detail-heading" hidden>
124
- <h2 id="detail-heading">Task detail</h2>
125
- <p class="detail-nav"><a id="back-to-list" href="/">Back to all tasks</a></p>
126
- <section id="detail-status" class="panel" data-endpoint="/api/v1/tasks/{slug}" data-view="status" aria-labelledby="detail-status-title">
127
- <h3 id="detail-status-title">Status</h3>
128
- <div class="panel-body"></div>
129
- </section>
130
- <section id="detail-stats" class="panel" data-endpoint="/api/v1/tasks/{slug}" data-view="stats" aria-labelledby="detail-stats-title">
131
- <h3 id="detail-stats-title">Counts</h3>
132
- <div class="panel-body"></div>
133
- </section>
134
- <section id="detail-pipeline" class="panel" data-endpoint="/api/v1/tasks/{slug}/pipeline" data-view="pipeline" aria-labelledby="detail-pipeline-title">
135
- <h3 id="detail-pipeline-title">Pipeline</h3>
136
- <div class="panel-body"></div>
137
- </section>
138
- <section id="detail-durations" class="panel" data-endpoint="/api/v1/tasks/{slug}/metrics" data-view="durations" aria-labelledby="detail-durations-title">
139
- <h3 id="detail-durations-title">Durations</h3>
140
- <div class="panel-body"></div>
141
- </section>
142
- <section id="detail-attempts" class="panel" data-endpoint="/api/v1/tasks/{slug}/attempts?limit=200" data-view="attempts" aria-labelledby="detail-attempts-title">
143
- <h3 id="detail-attempts-title">Agent and attempt timeline</h3>
144
- <div class="panel-body"></div>
145
- </section>
146
- <section id="detail-gates" class="panel" data-endpoint="/api/v1/tasks/{slug}/gates" data-view="gates" aria-labelledby="detail-gates-title">
147
- <h3 id="detail-gates-title">Human gates</h3>
148
- <div class="panel-body"></div>
149
- </section>
150
- <section id="detail-artifacts" class="panel" data-endpoint="/api/v1/tasks/{slug}/artifacts" data-view="artifacts" aria-labelledby="detail-artifacts-title">
151
- <h3 id="detail-artifacts-title">Artifacts</h3>
152
- <div class="panel-body"></div>
153
- </section>
154
- <section id="detail-documents" class="panel" data-endpoint="/api/v1/tasks/{slug}/documents?limit=200" data-view="documents" aria-labelledby="detail-documents-title">
155
- <h3 id="detail-documents-title">Raw documents</h3>
156
- <div class="panel-body"></div>
157
- </section>
158
- <section id="detail-metrics" class="panel" data-endpoint="/api/v1/tasks/{slug}/metrics" data-view="metrics" aria-labelledby="detail-metrics-title">
159
- <h3 id="detail-metrics-title">Metrics</h3>
160
- <div class="panel-body"></div>
161
- </section>
162
- <details id="detail-prompts" class="panel" data-endpoint="/api/v1/tasks/{slug}/prompts" data-view="prompts">
163
- <summary>Prompts (verbatim, local only)</summary>
164
- <div class="panel-body"></div>
165
- </details>
166
- <p class="detail-actions"><a id="link-export" href="/api/v1/tasks">Download task JSON</a> <button id="task-delete" type="button">Delete task</button></p>
167
- <p id="task-delete-status" class="state" role="status" aria-live="polite" hidden></p>
168
- </section>
169
- <nav id="top-nav" class="top-nav" aria-label="Projection views">
170
- <a id="nav-tasks" href="/" aria-current="page">Tasks</a>
171
- <a id="nav-tracker" href="/?view=tracker">Tracker</a>
172
- <a id="nav-jobs" href="/?view=jobs">Jobs</a>
173
- </nav>
174
- <section id="view-tracker" aria-labelledby="tracker-heading" hidden>
175
- <h2 id="tracker-heading">Tracker</h2>
176
- <p class="lede">Read-only. Create, update, enqueue and cancel stay in <code>team-db.mjs tracker</code> and the API.</p>
177
- <p id="tracker-loading" class="state" role="status" aria-live="polite" hidden>Loading…</p>
178
- <p id="tracker-error" class="state error" role="alert" hidden></p>
179
- <p id="tracker-empty" class="state" role="status" aria-live="polite" hidden>No tracker items.</p>
180
- <table id="tracker-table" class="tasks" aria-label="Tracker items">
181
- <caption>Tracker items in the local projection</caption>
182
- <thead>
183
- <tr>
184
- <th scope="col">Item</th>
185
- <th scope="col">Title</th>
186
- <th scope="col">Status</th>
187
- <th scope="col">Priority</th>
188
- <th scope="col">Type</th>
189
- <th scope="col">Ready</th>
190
- <th scope="col">Updated</th>
191
- </tr>
192
- </thead>
193
- <tbody id="tracker-rows"></tbody>
194
- </table>
195
- <section id="tracker-item" class="panel" data-endpoint="/api/v1/tracker/{id}" aria-labelledby="tracker-item-title">
196
- <h3 id="tracker-item-title">Item detail</h3>
197
- <p id="tracker-item-empty" class="state">Select an item to see its dependencies, links and queue entries.</p>
198
- <div class="panel-body"></div>
199
- </section>
200
- <section id="tracker-queue" class="panel" data-endpoint="/api/v1/tracker/queue" aria-labelledby="tracker-queue-title">
201
- <h3 id="tracker-queue-title">Queue</h3>
202
- <p id="tracker-queue-empty" class="state" hidden>No queue entries.</p>
203
- <div class="panel-body"></div>
204
- </section>
205
- </section>
206
- <section id="view-jobs" aria-labelledby="jobs-heading" hidden>
207
- <h2 id="jobs-heading">Scheduled jobs</h2>
208
- <form id="jobs-filters" class="filters" role="search" aria-label="Job filters">
209
- <div class="field">
210
- <label for="filter-job-q">Filter loaded jobs</label>
211
- <input id="filter-job-q" type="search" autocomplete="off" aria-describedby="filter-job-q-help">
212
- <p id="filter-job-q-help" class="help">Filters only the jobs already loaded on this page. The API declares no search parameter.</p>
213
- </div>
214
- <div class="field checkbox">
215
- <input id="filter-job-enabled" type="checkbox">
216
- <label for="filter-job-enabled">Enabled only</label>
217
- </div>
218
- <div class="field">
219
- <label for="sort-jobs">Sort</label>
220
- <select id="sort-jobs">
221
- <option value="nextFireAt">Next fire</option>
222
- <option value="-nextFireAt">Latest fire</option>
223
- <option value="id">Id A–Z</option>
224
- <option value="-id">Id Z–A</option>
225
- <option value="updatedAt">Oldest update</option>
226
- <option value="-updatedAt">Newest update</option>
227
- </select>
228
- </div>
229
- <div class="actions">
230
- <button id="jobs-apply" type="submit">Apply</button>
231
- <button id="job-new" type="button">New job</button>
232
- </div>
233
- </form>
234
- <p id="jobs-loading" class="state" role="status" aria-live="polite" hidden>Loading jobs…</p>
235
- <p id="jobs-empty" class="state" role="status" aria-live="polite" hidden>No jobs are defined yet. Use “New job” to add the first one.</p>
236
- <p id="jobs-error" class="state error" role="alert" hidden></p>
237
- <table id="jobs-table" class="tasks">
238
- <caption>Jobs in the local projection</caption>
239
- <thead>
240
- <tr>
241
- <th scope="col">Job</th>
242
- <th scope="col">Enabled</th>
243
- <th scope="col">Schedule</th>
244
- <th scope="col">Next fire (UTC)</th>
245
- <th scope="col">Last run</th>
246
- <th scope="col">Revision</th>
247
- </tr>
248
- </thead>
249
- <tbody id="job-rows"></tbody>
250
- </table>
251
- <button id="jobs-load-more" type="button" hidden>Load more</button>
252
- </section>
253
- <section id="view-job" aria-labelledby="job-heading" hidden>
254
- <h2 id="job-heading">Job detail</h2>
255
- <p class="detail-nav"><a id="back-to-jobs" href="/?view=jobs">Back to all jobs</a></p>
256
- <p id="job-loading" class="state" role="status" aria-live="polite" hidden>Loading job…</p>
257
- <p id="job-error" class="state error" role="alert" hidden></p>
258
- <section id="job-definition" class="panel" data-endpoint="/api/v1/jobs/{id}" data-view="job-definition" aria-labelledby="job-definition-title">
259
- <h3 id="job-definition-title">Definition</h3>
260
- <div class="panel-body"></div>
261
- </section>
262
- <section id="job-schedule" class="panel" data-endpoint="/api/v1/jobs/{id}" data-view="job-schedule" aria-labelledby="job-schedule-title">
263
- <h3 id="job-schedule-title">Schedule</h3>
264
- <div class="panel-body"></div>
265
- </section>
266
- <section id="job-runs" class="panel" data-endpoint="/api/v1/jobs/{id}/runs?limit=20" data-view="job-runs" aria-labelledby="job-runs-title">
267
- <h3 id="job-runs-title">Recent runs</h3>
268
- <div class="panel-body"></div>
269
- </section>
270
- <p id="job-runs-empty" class="state" role="status" aria-live="polite" hidden>This job has not run yet.</p>
271
- <div class="actions">
272
- <button id="job-toggle" type="button">Disable</button>
273
- <button id="job-run-now" type="button">Run now</button>
274
- <button id="job-edit" type="button">Edit</button>
275
- <button id="job-delete" type="button" disabled>Delete</button>
276
- </div>
277
- </section>
278
- <section id="view-job-edit" aria-labelledby="job-edit-heading" hidden>
279
- <h2 id="job-edit-heading">Job form</h2>
280
- <p id="job-form-saving" class="state" role="status" aria-live="polite" hidden>Saving…</p>
281
- <p id="job-form-error" class="state error" role="alert" hidden></p>
282
- <form id="job-form" class="job-form" novalidate>
283
- <div class="field">
284
- <label for="job-id">Id</label>
285
- <input id="job-id" name="id" type="text" autocomplete="off" aria-describedby="job-id-help" required>
286
- <p id="job-id-help" class="help">Lower-case words separated by dashes. Immutable after create.</p>
287
- </div>
288
- <div class="field">
289
- <label for="job-title">Title</label>
290
- <input id="job-title" name="title" type="text" autocomplete="off" required>
291
- </div>
292
- <div class="field checkbox">
293
- <input id="job-enabled" name="enabled" type="checkbox" checked>
294
- <label for="job-enabled">Enabled</label>
295
- </div>
296
- <div class="field">
297
- <label for="job-schedule-kind">Schedule kind</label>
298
- <select id="job-schedule-kind" name="scheduleKind">
299
- <option value="cron">cron</option>
300
- <option value="interval">interval</option>
301
- </select>
302
- </div>
303
- <div class="field">
304
- <label for="job-cron">Cron expression</label>
305
- <input id="job-cron" name="cron" type="text" autocomplete="off" placeholder="0 3 * * *" aria-describedby="job-cron-help">
306
- <p id="job-cron-help" class="help">Five fields: minute hour day-of-month month day-of-week.</p>
307
- </div>
308
- <div class="field">
309
- <label for="job-every">Every (seconds)</label>
310
- <input id="job-every" name="everySeconds" type="number" min="60" max="2592000">
311
- </div>
312
- <div class="field">
313
- <label for="job-timezone">Timezone</label>
314
- <input id="job-timezone" name="timezone" type="text" autocomplete="off" placeholder="Europe/Berlin">
315
- </div>
316
- <div class="field">
317
- <label for="job-payload-kind">Payload kind</label>
318
- <select id="job-payload-kind" name="payloadKind">
319
- <option value="command">command</option>
320
- <option value="pipeline">pipeline</option>
321
- </select>
322
- </div>
323
- <div class="field">
324
- <label for="job-argv">Argv (one element per line)</label>
325
- <textarea id="job-argv" name="argv" rows="3" aria-describedby="job-argv-help"></textarea>
326
- <p id="job-argv-help" class="help">Executed without a shell. The first line is the executable.</p>
327
- </div>
328
- <div class="field">
329
- <label for="job-prompt-template">Prompt template</label>
330
- <input id="job-prompt-template" name="promptTemplate" type="text" autocomplete="off">
331
- </div>
332
- <div class="field">
333
- <label for="job-runner">Runner (one element per line)</label>
334
- <textarea id="job-runner" name="runner" rows="2"></textarea>
335
- </div>
336
- <div class="field">
337
- <label for="job-cwd">Working directory</label>
338
- <input id="job-cwd" name="cwd" type="text" autocomplete="off" value=".">
339
- </div>
340
- <div class="field">
341
- <label for="job-env">Environment names (comma separated)</label>
342
- <input id="job-env" name="envPassthrough" type="text" autocomplete="off">
343
- </div>
344
- <div class="field">
345
- <label for="job-timeout">Timeout (ms)</label>
346
- <input id="job-timeout" name="timeoutMs" type="number" min="1000" max="43200000" value="900000">
347
- </div>
348
- <div class="field">
349
- <label for="job-concurrency">Concurrency</label>
350
- <select id="job-concurrency" name="concurrency">
351
- <option value="skip">skip</option>
352
- <option value="queue">queue</option>
353
- <option value="allow">allow</option>
354
- </select>
355
- </div>
356
- <div class="field">
357
- <label for="job-misfire">Misfire</label>
358
- <select id="job-misfire" name="misfire">
359
- <option value="run-once">run-once</option>
360
- <option value="skip">skip</option>
361
- <option value="catch-up">catch-up</option>
362
- </select>
363
- </div>
364
- <div class="actions">
365
- <button id="job-save" type="submit">Save</button>
366
- <button id="job-cancel" type="button">Cancel</button>
367
- </div>
368
- </form>
369
- </section>
370
- <section id="view-run" aria-labelledby="run-heading" hidden>
371
- <h2 id="run-heading">Run detail</h2>
372
- <p class="detail-nav"><a id="back-to-job" href="/?view=job">Back to the job</a></p>
373
- <p id="run-loading" class="state" role="status" aria-live="polite" hidden>Loading run…</p>
374
- <p id="run-error" class="state error" role="alert" hidden></p>
375
- <section id="run-summary" class="panel" data-endpoint="/api/v1/jobs/{id}/runs/{runId}" data-view="run-summary" aria-labelledby="run-summary-title">
376
- <h3 id="run-summary-title">Summary</h3>
377
- <div class="panel-body"></div>
378
- </section>
379
- <section id="run-events" class="panel" aria-labelledby="run-events-title">
380
- <h3 id="run-events-title">Events</h3>
381
- <div class="panel-body"></div>
382
- </section>
383
- <p id="run-events-empty" class="state" role="status" aria-live="polite" hidden>This run recorded no events.</p>
384
- <section class="panel" aria-labelledby="log-title">
385
- <h3 id="log-title">Log</h3>
386
- <h4>stdout</h4>
387
- <pre id="log-stream-stdout" class="log" aria-live="off"></pre>
388
- <h4>stderr</h4>
389
- <pre id="log-stream-stderr" class="log" aria-live="off"></pre>
390
- <p id="log-empty" class="state" role="status" aria-live="polite" hidden>This run produced no output.</p>
391
- <p id="log-truncated" class="state" role="status" aria-live="polite" hidden>Output was truncated at the per-stream cap.</p>
392
- <p id="log-tail" class="help">Polling stops when the log ends and the run is terminal.</p>
393
- <div class="actions"><button id="log-refresh" type="button">Refresh log</button></div>
394
- </section>
395
- </section>
396
- </main>
397
- <footer class="page-footer">
398
- <p>Read-only surface. The only mutation is the rescan, which re-reads task files. <a href="/api/v1/sync-runs">Rescan history</a>.</p>
399
- </footer>
400
- </body>
401
- </html>
402
- `;
403
-
404
- export const DASHBOARD_CSS = `:root {
405
- color-scheme: light;
406
- --text: #111827;
407
- --muted: #4b5563;
408
- --error: #b00020;
409
- --focus: #0b57d0;
410
- --bg: #ffffff;
411
- --surface: #f8fafc;
412
- --border: #d1d5db;
413
- --badge-bg: #eef2ff;
414
- --badge-text: #1e3a8a;
415
- --radius: 8px;
416
- --space: 0.75rem;
417
- --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
418
- --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
419
- }
420
-
421
- * {
422
- box-sizing: border-box;
423
- }
424
-
425
- body {
426
- margin: 0;
427
- padding: 0 1.25rem 3rem;
428
- background: var(--bg);
429
- color: var(--text);
430
- font-family: var(--font);
431
- font-size: 16px;
432
- line-height: 1.5;
433
- }
434
-
435
- h1,
436
- h2,
437
- h3 {
438
- line-height: 1.25;
439
- }
440
-
441
- h2 {
442
- margin-top: 1.5rem;
443
- }
444
-
445
- a {
446
- color: var(--focus);
447
- }
448
-
449
- a:hover {
450
- text-decoration-thickness: 2px;
451
- }
452
-
453
- .skip-link {
454
- position: absolute;
455
- left: -9999px;
456
- top: 0;
457
- padding: 0.5rem 0.75rem;
458
- background: var(--bg);
459
- color: var(--text);
460
- border: 2px solid var(--focus);
461
- }
462
-
463
- .skip-link:focus {
464
- left: 0.5rem;
465
- z-index: 10;
466
- }
467
-
468
- :focus-visible {
469
- outline: 2px solid var(--focus);
470
- outline-offset: 2px;
471
- }
472
-
473
- .page-header .lede,
474
- .help,
475
- .page-footer,
476
- .top-nav {
477
- display: flex;
478
- gap: 1rem;
479
- margin-bottom: 1rem;
480
- border-bottom: 1px solid var(--border);
481
- padding-bottom: 0.5rem;
482
- }
483
-
484
- .top-nav a {
485
- color: inherit;
486
- text-decoration: none;
487
- padding: 0.25rem 0.5rem;
488
- border-radius: var(--radius);
489
- }
490
-
491
- .top-nav a[aria-current='page'] {
492
- background: var(--badge-bg);
493
- font-weight: 600;
494
- }
495
-
496
- .job-form {
497
- display: grid;
498
- grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
499
- gap: 1rem;
500
- }
501
-
502
- .job-form textarea {
503
- font-family: var(--mono);
504
- min-height: 4rem;
505
- }
506
-
507
- .log {
508
- max-height: 20rem;
509
- overflow: auto;
510
- background: var(--surface);
511
- padding: 0.5rem;
512
- border-radius: var(--radius);
513
- white-space: pre-wrap;
514
- word-break: break-word;
515
- }
516
-
517
- .state {
518
- color: var(--muted);
519
- }
520
-
521
- .banner {
522
- margin: 0.75rem 0;
523
- padding: 0.6rem 0.8rem;
524
- border: 1px solid var(--border);
525
- border-left: 4px solid var(--error);
526
- border-radius: var(--radius);
527
- background: var(--surface);
528
- }
529
-
530
- .filters {
531
- display: grid;
532
- grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
533
- gap: var(--space);
534
- align-items: start;
535
- margin: 1rem 0;
536
- padding: var(--space);
537
- border: 1px solid var(--border);
538
- border-radius: var(--radius);
539
- background: var(--surface);
540
- }
541
-
542
- .field {
543
- display: flex;
544
- flex-direction: column;
545
- gap: 0.25rem;
546
- min-width: 0;
547
- }
548
-
549
- .field label {
550
- font-weight: 600;
551
- font-size: 0.9rem;
552
- }
553
-
554
- .field input,
555
- .field select {
556
- font: inherit;
557
- color: var(--text);
558
- background: var(--bg);
559
- border: 1px solid var(--border);
560
- border-radius: 6px;
561
- padding: 0.35rem 0.45rem;
562
- min-width: 0;
563
- }
564
-
565
- .field.checkbox {
566
- flex-direction: row;
567
- align-items: center;
568
- gap: 0.5rem;
569
- padding-top: 1.6rem;
570
- }
571
-
572
- .help {
573
- margin: 0;
574
- font-size: 0.8rem;
575
- }
576
-
577
- .actions,
578
- .detail-actions {
579
- grid-column: 1 / -1;
580
- display: flex;
581
- flex-wrap: wrap;
582
- gap: 0.6rem;
583
- align-items: center;
584
- }
585
-
586
- button {
587
- font: inherit;
588
- padding: 0.4rem 0.8rem;
589
- border-radius: 6px;
590
- border: 1px solid var(--focus);
591
- background: var(--bg);
592
- color: var(--focus);
593
- cursor: pointer;
594
- }
595
-
596
- button:hover {
597
- background: var(--badge-bg);
598
- }
599
-
600
- .state {
601
- margin: 0.5rem 0;
602
- }
603
-
604
- .state.error {
605
- color: var(--error);
606
- font-weight: 600;
607
- }
608
-
609
- .tasks {
610
- width: 100%;
611
- border-collapse: collapse;
612
- font-size: 0.9rem;
613
- }
614
-
615
- .tasks caption {
616
- text-align: left;
617
- color: var(--muted);
618
- padding-bottom: 0.4rem;
619
- }
620
-
621
- .tasks th,
622
- .tasks td {
623
- text-align: left;
624
- vertical-align: top;
625
- padding: 0.45rem 0.5rem;
626
- border-bottom: 1px solid var(--border);
627
- }
628
-
629
- .tasks thead th {
630
- position: sticky;
631
- top: 0;
632
- background: var(--bg);
633
- white-space: nowrap;
634
- }
635
-
636
- .tasks tbody tr:hover {
637
- background: var(--surface);
638
- }
639
-
640
- .badge {
641
- display: inline-block;
642
- padding: 0.1rem 0.45rem;
643
- border-radius: 999px;
644
- background: var(--badge-bg);
645
- color: var(--badge-text);
646
- font-size: 0.8rem;
647
- font-weight: 600;
648
- white-space: nowrap;
649
- }
650
-
651
- .badge[data-state="completed"] {
652
- background: #e7f6ec;
653
- color: #14532d;
654
- }
655
-
656
- .badge[data-state="blocked"],
657
- .badge[data-state="validation_failed"],
658
- .badge[data-state="changes_requested"] {
659
- background: #fdecec;
660
- color: var(--error);
661
- }
662
-
663
- .mono {
664
- font-family: var(--mono);
665
- font-size: 0.85rem;
666
- word-break: break-word;
667
- }
668
-
669
- .panel {
670
- margin: 1rem 0;
671
- padding: var(--space);
672
- border: 1px solid var(--border);
673
- border-radius: var(--radius);
674
- }
675
-
676
- .panel h3 {
677
- margin: 0 0 0.5rem;
678
- font-size: 1rem;
679
- }
680
-
681
- .panel table {
682
- width: 100%;
683
- border-collapse: collapse;
684
- font-size: 0.85rem;
685
- }
686
-
687
- .panel th,
688
- .panel td {
689
- text-align: left;
690
- vertical-align: top;
691
- padding: 0.3rem 0.4rem;
692
- border-bottom: 1px solid var(--border);
693
- }
694
-
695
- .panel pre {
696
- margin: 0.3rem 0 0;
697
- padding: 0.6rem;
698
- max-height: 22rem;
699
- overflow: auto;
700
- background: var(--surface);
701
- border: 1px solid var(--border);
702
- border-radius: 6px;
703
- font-family: var(--mono);
704
- font-size: 0.8rem;
705
- white-space: pre-wrap;
706
- word-break: break-word;
707
- }
708
-
709
- .section-error {
710
- color: var(--error);
711
- font-weight: 600;
712
- }
713
-
714
- .kv {
715
- display: grid;
716
- grid-template-columns: minmax(9rem, 14rem) 1fr;
717
- gap: 0.2rem 0.8rem;
718
- margin: 0;
719
- }
720
-
721
- .kv dt {
722
- color: var(--muted);
723
- }
724
-
725
- .kv dd {
726
- margin: 0;
727
- overflow-wrap: anywhere;
728
- }
729
-
730
- @media (prefers-reduced-motion: reduce) {
731
- * {
732
- transition: none !important;
733
- animation: none !important;
734
- }
735
- }
736
-
737
- @media (max-width: 720px) {
738
- body {
739
- padding: 0 0.6rem 2rem;
740
- }
741
-
742
- .tasks {
743
- display: block;
744
- overflow-x: auto;
745
- }
746
-
747
- .kv {
748
- grid-template-columns: 1fr;
749
- }
750
- }
751
- `;
752
-
753
- export const DASHBOARD_JS = `(function () {
754
- 'use strict';
755
-
756
- var STATUS = ['in_progress', 'completed', 'changes_requested', 'validation_failed', 'blocked', 'awaiting_approval', 'awaiting_artifact_receipt'];
757
- var PAGE_SIZE = 50;
758
- var state = { offset: 0, total: 0, slug: '' };
759
- var cache = {};
760
-
761
- var byId = function (id) {
762
- return document.getElementById(id);
763
- };
764
-
765
- var text = function (tag, value, className) {
766
- var node = document.createElement(tag);
767
- node.textContent = value === null || value === undefined || value === '' ? '—' : String(value);
768
- if (className) node.className = className;
769
- return node;
770
- };
771
-
772
- var clear = function (node) {
773
- while (node.firstChild) node.removeChild(node.firstChild);
774
- };
775
-
776
- var describeError = function (error) {
777
- var code = error && error.code ? error.code : 'E_INTERNAL';
778
- var message = error && error.message ? error.message : 'request failed';
779
- var action = '';
780
- if (code === 'E_DB_MISSING') action = ' Run: node .ai.local/scripts/team-db.mjs sync';
781
- else if (code === 'E_SCHEMA_MISMATCH' || code === 'E_SCHEMA_OUTDATED' || code === 'E_DB_CORRUPT') action = ' Run: node .ai.local/scripts/team-db.mjs sync --rebuild';
782
- else if (code === 'E_DISABLED') action = ' Unset AI_RULES_TEAM_DB_DISABLE to enable the projection.';
783
- else if (code === 'E_BUSY') action = ' The database is busy; retry in a moment.';
784
- return { code: code, message: message + action };
785
- };
786
-
787
- var showError = function (error) {
788
- var target = byId('state-error');
789
- var described = describeError(error);
790
- target.textContent = described.code + ': ' + described.message;
791
- target.hidden = false;
792
- };
793
-
794
- var hideError = function () {
795
- var target = byId('state-error');
796
- target.hidden = true;
797
- target.textContent = '';
798
- };
799
-
800
- var setLoading = function (loading) {
801
- byId('state-loading').hidden = !loading;
802
- byId('task-list').setAttribute('aria-busy', loading ? 'true' : 'false');
803
- };
804
-
805
- var request = function (url, options) {
806
- return fetch(url, options).then(function (response) {
807
- return response.text().then(function (body) {
808
- var parsed = null;
809
- try {
810
- parsed = body ? JSON.parse(body) : null;
811
- } catch (parseError) {
812
- parsed = null;
813
- }
814
- if (!response.ok) {
815
- var envelope = parsed && parsed.error ? parsed.error : { code: 'E_INTERNAL', message: response.status + ' ' + response.statusText };
816
- var failure = new Error(envelope.message || 'request failed');
817
- failure.code = envelope.code || 'E_INTERNAL';
818
- failure.status = response.status;
819
- failure.details = envelope.details || null;
820
- throw failure;
821
- }
822
- return parsed;
823
- });
824
- });
825
- };
826
-
827
- var cached = function (url) {
828
- if (!cache[url]) cache[url] = request(url);
829
- return cache[url];
830
- };
831
-
832
- var formatDuration = function (ms) {
833
- if (ms === null || ms === undefined) return '—';
834
- var seconds = Math.round(Number(ms) / 1000);
835
- if (seconds < 60) return seconds + 's';
836
- var minutes = Math.floor(seconds / 60);
837
- if (minutes < 60) return minutes + 'm ' + (seconds % 60) + 's';
838
- var hours = Math.floor(minutes / 60);
839
- return hours + 'h ' + (minutes % 60) + 'm';
840
- };
841
-
842
- var formatDate = function (value) {
843
- if (!value) return '—';
844
- var parsed = new Date(value);
845
- if (Number.isNaN(parsed.getTime())) return value;
846
- return parsed.toISOString().replace('T', ' ').replace('.000Z', 'Z');
847
- };
848
-
849
- var isoTimestamp = function (value, endOfDay) {
850
- if (!value) return '';
851
- return value + (endOfDay ? 'T23:59:59.999Z' : 'T00:00:00.000Z');
852
- };
853
-
854
- var readFilters = function () {
855
- var params = new URLSearchParams();
856
- var q = byId('filter-q').value.trim();
857
- var status = byId('filter-status').value;
858
- var agent = byId('filter-agent').value.trim();
859
- var intent = byId('filter-intent').value.trim();
860
- var profile = byId('filter-profile').value;
861
- var from = byId('filter-from').value;
862
- var to = byId('filter-to').value;
863
- var sort = byId('sort').value;
864
- var includeAbsent = byId('filter-absent').checked;
865
- if (q) params.set('q', q);
866
- if (status) params.set('status', status);
867
- if (agent) params.set('agent', agent);
868
- if (intent) params.set('intent', intent);
869
- if (profile) params.set('profile', profile);
870
- if (from) params.set('from', isoTimestamp(from, false));
871
- if (to) params.set('to', isoTimestamp(to, true));
872
- if (sort) params.set('sort', sort);
873
- if (includeAbsent) params.set('includeAbsent', 'true');
874
- params.set('limit', String(PAGE_SIZE));
875
- params.set('offset', String(state.offset));
876
- return params;
877
- };
878
-
879
- var writeUrl = function () {
880
- var params = readFilters();
881
- params.delete('limit');
882
- params.delete('offset');
883
- if (state.slug) params.set('slug', state.slug);
884
- var next = params.toString();
885
- history.replaceState(null, '', next ? '/?' + next : '/');
886
- };
887
-
888
- var applyUrlState = function () {
889
- var params = new URLSearchParams(window.location.search);
890
- var map = {
891
- q: 'filter-q',
892
- agent: 'filter-agent',
893
- intent: 'filter-intent',
894
- from: 'filter-from',
895
- to: 'filter-to'
896
- };
897
- Object.keys(map).forEach(function (key) {
898
- var value = params.get(key);
899
- if (!value) return;
900
- byId(map[key]).value = key === 'from' || key === 'to' ? value.slice(0, 10) : value;
901
- });
902
- var status = params.get('status');
903
- if (status && STATUS.indexOf(status) !== -1) byId('filter-status').value = status;
904
- var profile = params.get('profile');
905
- if (profile) byId('filter-profile').value = profile;
906
- var sort = params.get('sort');
907
- if (sort) byId('sort').value = sort;
908
- if (params.get('includeAbsent') === 'true') byId('filter-absent').checked = true;
909
- return params.get('slug') || '';
910
- };
911
-
912
- var badge = function (value) {
913
- var node = text('span', value, 'badge');
914
- if (value) node.setAttribute('data-state', String(value));
915
- return node;
916
- };
917
-
918
- var row = function (task) {
919
- var tr = document.createElement('tr');
920
- var head = document.createElement('th');
921
- head.setAttribute('scope', 'row');
922
- var link = document.createElement('a');
923
- link.href = '/?slug=' + encodeURIComponent(task.slug);
924
- link.textContent = task.slug;
925
- link.addEventListener('click', function (event) {
926
- event.preventDefault();
927
- openDetail(task.slug);
928
- });
929
- head.appendChild(link);
930
- tr.appendChild(head);
931
- tr.appendChild((function () { var td = document.createElement('td'); td.appendChild(badge(task.state)); return td; })());
932
- tr.appendChild(text('td', task.intent));
933
- tr.appendChild(text('td', task.profile));
934
- tr.appendChild(text('td', [task.stack, task.platform].filter(Boolean).join(' / ')));
935
- tr.appendChild(text('td', task.currentAgent));
936
- tr.appendChild(text('td', task.gateState));
937
- tr.appendChild(text('td', formatDate(task.updatedAt)));
938
- tr.appendChild(text('td', formatDate(task.startAt)));
939
- tr.appendChild(text('td', formatDate(task.endAt)));
940
- tr.appendChild(text('td', formatDuration(task.durationMs)));
941
- tr.appendChild(text('td', task.attempts));
942
- return tr;
943
- };
944
-
945
- var renderList = function (payload) {
946
- var body = byId('task-rows');
947
- if (state.offset === 0) clear(body);
948
- payload.items.forEach(function (task) {
949
- body.appendChild(row(task));
950
- });
951
- state.total = payload.total;
952
- var shown = body.children.length;
953
- byId('state-empty').hidden = payload.total !== 0;
954
- byId('task-list').hidden = payload.total === 0;
955
- byId('load-more').hidden = !payload.nextOffset;
956
- byId('load-more').textContent = 'Load more (' + shown + ' of ' + payload.total + ')';
957
- };
958
-
959
- var loadList = function () {
960
- setLoading(true);
961
- hideError();
962
- var params = readFilters();
963
- return request('/api/v1/tasks?' + params.toString())
964
- .then(function (payload) {
965
- renderList(payload);
966
- writeUrl();
967
- })
968
- .catch(function (error) {
969
- showError(error);
970
- })
971
- .then(function () {
972
- setLoading(false);
973
- });
974
- };
975
-
976
- var definition = function (label, value) {
977
- var dt = text('dt', label);
978
- var dd = document.createElement('dd');
979
- if (value && typeof value === 'object' && value.nodeType) dd.appendChild(value);
980
- else dd.textContent = value === null || value === undefined || value === '' ? '—' : String(value);
981
- return [dt, dd];
982
- };
983
-
984
- var kv = function (pairs) {
985
- var list = document.createElement('dl');
986
- list.className = 'kv';
987
- pairs.forEach(function (pair) {
988
- var entry = definition(pair[0], pair[1]);
989
- list.appendChild(entry[0]);
990
- list.appendChild(entry[1]);
991
- });
992
- return list;
993
- };
994
-
995
- var miniTable = function (headers, rows) {
996
- var table = document.createElement('table');
997
- var thead = document.createElement('thead');
998
- var headRow = document.createElement('tr');
999
- headers.forEach(function (header) {
1000
- var th = text('th', header);
1001
- th.setAttribute('scope', 'col');
1002
- headRow.appendChild(th);
1003
- });
1004
- thead.appendChild(headRow);
1005
- table.appendChild(thead);
1006
- var tbody = document.createElement('tbody');
1007
- rows.forEach(function (values) {
1008
- var tr = document.createElement('tr');
1009
- values.forEach(function (value) {
1010
- var td = document.createElement('td');
1011
- if (value && typeof value === 'object' && value.nodeType) td.appendChild(value);
1012
- else td.textContent = value === null || value === undefined || value === '' ? '—' : String(value);
1013
- tr.appendChild(td);
1014
- });
1015
- tbody.appendChild(tr);
1016
- });
1017
- table.appendChild(tbody);
1018
- return table;
1019
- };
1020
-
1021
- var views = {
1022
- status: function (payload) {
1023
- var task = payload.task;
1024
- return kv([
1025
- ['Slug', task.slug],
1026
- ['State', badge(task.state)],
1027
- ['Phase', task.phase],
1028
- ['Intent', task.intent],
1029
- ['Profile', task.profile],
1030
- ['Spec mode', task.specMode],
1031
- ['Pipeline index', task.pipelineIndex],
1032
- ['Current agent', task.currentAgent],
1033
- ['Awaiting human gate', task.awaitingHumanGate ? 'yes' : 'no'],
1034
- ['Gate', task.gateState],
1035
- ['Stack / platform', [task.stack, task.platform].filter(Boolean).join(' / ')],
1036
- ['Start', formatDate(task.startAt)],
1037
- ['End', formatDate(task.endAt)],
1038
- ['Duration', formatDuration(task.durationMs)],
1039
- ['Updated', formatDate(task.updatedAt)],
1040
- ['Projected', formatDate(task.projectedAt)],
1041
- ['Last seen', formatDate(task.lastSeenAt)],
1042
- ['Absent', task.absentAt ? formatDate(task.absentAt) : 'no'],
1043
- ['Routing', payload.routing && payload.routing.summary ? payload.routing.summary : '—']
1044
- ]);
1045
- },
1046
- stats: function (payload) {
1047
- var counts = payload.counts || {};
1048
- return kv([
1049
- ['Events', counts.events],
1050
- ['Attempts', counts.attempts],
1051
- ['Gates', counts.gates],
1052
- ['Prompts', counts.prompts],
1053
- ['Documents', counts.documents],
1054
- ['Has prompt', payload.hasPrompt ? 'yes' : 'no']
1055
- ]);
1056
- },
1057
- pipeline: function (payload) {
1058
- var rows = payload.steps.map(function (step) {
1059
- return [
1060
- step.index,
1061
- step.label,
1062
- step.agents.join(', '),
1063
- step.state,
1064
- step.dependsOn.join(', '),
1065
- step.taskIds.join(', '),
1066
- step.writeScopes.join(', ')
1067
- ];
1068
- });
1069
- return miniTable(['#', 'Step', 'Agents', 'State', 'Depends on', 'Tasks', 'Write scopes'], rows);
1070
- },
1071
- durations: function (payload) {
1072
- var byAgent = payload.byAgent.map(function (entry) {
1073
- return [entry.agent, entry.attempts, formatDuration(entry.durationMs)];
1074
- });
1075
- var byStep = payload.byStep.map(function (entry) {
1076
- return [entry.stepIndex, entry.attempts, formatDuration(entry.durationMs)];
1077
- });
1078
- var wrapper = document.createElement('div');
1079
- wrapper.appendChild(kv([['Total attempt time', formatDuration(payload.totalAttemptDurationMs)]]));
1080
- wrapper.appendChild(miniTable(['Agent', 'Attempts', 'Duration'], byAgent));
1081
- wrapper.appendChild(miniTable(['Step', 'Attempts', 'Duration'], byStep));
1082
- return wrapper;
1083
- },
1084
- attempts: function (payload) {
1085
- var rows = payload.items.map(function (attempt) {
1086
- return [
1087
- attempt.agent,
1088
- attempt.role,
1089
- attempt.stepIndex,
1090
- attempt.attempt,
1091
- formatDate(attempt.startedAt),
1092
- formatDate(attempt.finishedAt),
1093
- formatDuration(attempt.durationMs),
1094
- attempt.outcome
1095
- ];
1096
- });
1097
- return miniTable(['Agent', 'Role', 'Step', 'Attempt', 'Started', 'Finished', 'Duration', 'Outcome'], rows);
1098
- },
1099
- gates: function (payload) {
1100
- var rows = payload.items.map(function (gate) {
1101
- return [formatDate(gate.startedAt), formatDate(gate.endedAt), formatDuration(gate.durationMs), gate.startEventId];
1102
- });
1103
- return miniTable(['Started', 'Ended', 'Duration', 'Start event'], rows);
1104
- },
1105
- artifacts: function (payload) {
1106
- var rows = payload.items.map(function (artifact) {
1107
- return [
1108
- artifact.id,
1109
- artifact.producer,
1110
- artifact.status,
1111
- artifact.outcome,
1112
- artifact.acceptanceCriteriaIds.join(', '),
1113
- artifact.paths.authoritative.join(', '),
1114
- artifact.paths.evidence.join(', '),
1115
- artifact.summary
1116
- ];
1117
- });
1118
- return miniTable(['Id', 'Producer', 'Status', 'Outcome', 'AC ids', 'Authoritative', 'Evidence', 'Summary'], rows);
1119
- },
1120
- documents: function (payload) {
1121
- var wrapper = document.createElement('div');
1122
- wrapper.appendChild(miniTable(['Path', 'Bytes', 'Media type', 'SHA-256', 'Omitted', 'Parse error'], payload.items.map(function (document) {
1123
- return [document.path, document.bytes, document.mediaType, document.sha256 ? document.sha256.slice(0, 12) : '—', document.contentOmitted, document.parseError];
1124
- })));
1125
- var preview = document.createElement('pre');
1126
- preview.className = 'document-preview';
1127
- preview.hidden = true;
1128
- var buttons = document.createElement('div');
1129
- buttons.className = 'actions';
1130
- payload.items.slice(0, 40).forEach(function (document) {
1131
- if (!document.isText || document.contentOmitted) return;
1132
- var open = text('button', 'Open ' + document.path);
1133
- open.type = 'button';
1134
- open.addEventListener('click', function () {
1135
- openDocument(state.slug, document.path, preview);
1136
- });
1137
- buttons.appendChild(open);
1138
- });
1139
- wrapper.appendChild(buttons);
1140
- wrapper.appendChild(preview);
1141
- return wrapper;
1142
- },
1143
- metrics: function (payload) {
1144
- var wrapper = document.createElement('div');
1145
- var counts = Object.keys(payload.eventCounts).sort().map(function (type) {
1146
- return [type, payload.eventCounts[type]];
1147
- });
1148
- wrapper.appendChild(kv([
1149
- ['Run id', payload.runId],
1150
- ['Total attempt time', formatDuration(payload.totalAttemptDurationMs)]
1151
- ]));
1152
- wrapper.appendChild(miniTable(['Event type', 'Count'], counts));
1153
- return wrapper;
1154
- },
1155
- prompts: function (payload) {
1156
- var wrapper = document.createElement('div');
1157
- if (!payload.prompt) {
1158
- wrapper.appendChild(text('p', 'No prompt recorded for this task.'));
1159
- return wrapper;
1160
- }
1161
- var entries = [payload.prompt].concat(payload.log || []);
1162
- entries.forEach(function (entry) {
1163
- var title = text('h4', (entry.kind === 'prompt' ? 'Prompt' : 'Prompt log #' + entry.seq) + ' — ' + (entry.command || entry.source || 'user'));
1164
- var meta = text('p', (entry.capturedAt || '') + ' · ' + entry.bytes + ' bytes · ' + (entry.language || 'unknown'));
1165
- var pre = text('pre', entry.content);
1166
- wrapper.appendChild(title);
1167
- wrapper.appendChild(meta);
1168
- wrapper.appendChild(pre);
1169
- });
1170
- return wrapper;
1171
- }
1172
- };
1173
-
1174
- var openDocument = function (slug, path, preview) {
1175
- var url = '/api/v1/tasks/' + encodeURIComponent(slug) + '/document?path=' + encodeURIComponent(path);
1176
- preview.hidden = false;
1177
- preview.textContent = 'Loading…';
1178
- request(url).then(function (document) {
1179
- preview.textContent = document.content + (document.truncated ? '\\n… truncated at ' + document.limit + ' bytes of ' + document.totalBytes : '');
1180
- }).catch(function (error) {
1181
- var described = describeError(error);
1182
- preview.textContent = described.code + ': ' + described.message;
1183
- });
1184
- };
1185
-
1186
- var renderSection = function (section, payload) {
1187
- var body = section.querySelector('.panel-body');
1188
- clear(body);
1189
- var view = section.getAttribute('data-view');
1190
- var render = views[view];
1191
- if (!render) {
1192
- body.appendChild(text('p', 'No renderer for ' + view));
1193
- return;
1194
- }
1195
- body.appendChild(render(payload));
1196
- };
1197
-
1198
- var loadSection = function (section, slug) {
1199
- var endpoint = section.getAttribute('data-endpoint').replace('{slug}', encodeURIComponent(slug));
1200
- var body = section.querySelector('.panel-body');
1201
- clear(body);
1202
- body.appendChild(text('p', 'Loading…', 'section-state'));
1203
- return cached(endpoint)
1204
- .then(function (payload) {
1205
- renderSection(section, payload);
1206
- })
1207
- .catch(function (error) {
1208
- var described = describeError(error);
1209
- clear(body);
1210
- body.appendChild(text('p', described.code + ': ' + described.message, 'section-error'));
1211
- });
1212
- };
1213
-
1214
- var openDetail = function (slug) {
1215
- state.slug = slug;
1216
- cache = {};
1217
- showView('view-detail');
1218
- byId('task-delete-status').hidden = true;
1219
- byId('task-delete-status').textContent = '';
1220
- byId('link-export').href = '/api/v1/tasks/' + encodeURIComponent(slug) + '/export';
1221
- writeUrl();
1222
- var sections = document.querySelectorAll('#view-detail [data-endpoint]');
1223
- Array.prototype.forEach.call(sections, function (section) {
1224
- // Prompt text is the most sensitive content: it is fetched only when the
1225
- // disclosure is opened, not on every detail view.
1226
- var disclosure = section.closest ? section.closest('details') : null;
1227
- if (disclosure && !disclosure.open) {
1228
- var onOpen = function () {
1229
- if (!disclosure.open) return;
1230
- disclosure.removeEventListener('toggle', onOpen);
1231
- loadSection(section, slug);
1232
- };
1233
- disclosure.addEventListener('toggle', onOpen);
1234
- return;
1235
- }
1236
- loadSection(section, slug);
1237
- });
1238
- request('/api/v1/tasks/' + encodeURIComponent(slug))
1239
- .then(function (payload) {
1240
- document.title = payload.task.slug + ' — agent team projection';
1241
- })
1242
- .catch(function (error) {
1243
- var described = describeError(error);
1244
- var heading = byId('detail-heading');
1245
- heading.textContent = 'Task not found';
1246
- showError(error);
1247
- var panel = byId('detail-status');
1248
- clear(panel.querySelector('.panel-body'));
1249
- panel.querySelector('.panel-body').appendChild(text('p', described.code + ': ' + described.message, 'section-error'));
1250
- });
1251
- };
1252
-
1253
- var showList = function () {
1254
- state.slug = '';
1255
- showView('view-list');
1256
- document.title = 'Agent team projection';
1257
- writeUrl();
1258
- };
1259
-
1260
- var applyFilters = function (event) {
1261
- if (event) event.preventDefault();
1262
- state.offset = 0;
1263
- showList();
1264
- loadList();
1265
- };
1266
-
1267
- var loadMore = function () {
1268
- if (state.offset + PAGE_SIZE >= state.total) return;
1269
- state.offset += PAGE_SIZE;
1270
- loadList();
1271
- };
1272
-
1273
- var rescan = function () {
1274
- if (!confirm('Re-read task files into the local database? Task files are not changed.')) return;
1275
- var button = byId('rescan');
1276
- button.disabled = true;
1277
- button.textContent = 'Rescanning…';
1278
- request('/api/v1/sync', { method: 'POST' })
1279
- .then(function (result) {
1280
- byId('banner').hidden = false;
1281
- byId('banner').textContent = 'Rescan ' + (result.mode || 'full') + ': inserted ' + result.inserted + ', updated ' + result.updated + ', unchanged ' + result.unchanged + ', failed ' + result.failed;
1282
- return state.slug ? openDetail(state.slug) : loadList();
1283
- })
1284
- .catch(function (error) {
1285
- showError(error);
1286
- })
1287
- .then(function () {
1288
- button.disabled = false;
1289
- button.textContent = 'Rescan';
1290
- });
1291
- };
1292
-
1293
- var health = function () {
1294
- request('/health')
1295
- .then(function (payload) {
1296
- if (payload.status !== 'ok') {
1297
- byId('banner').hidden = false;
1298
- byId('banner').textContent = 'Projection degraded: schema ' + payload.db.schemaVersion + ', search ' + payload.db.search;
1299
- }
1300
- })
1301
- .catch(function (error) {
1302
- var described = describeError(error);
1303
- byId('banner').hidden = false;
1304
- byId('banner').textContent = 'Projection degraded — ' + described.code + ': ' + described.message;
1305
- });
1306
- };
1307
-
1308
- var deleteTask = function () {
1309
- var slug = state.slug;
1310
- if (!slug) return;
1311
- if (!confirm('Delete task ' + slug + ' and its projection rows? The task folder is removed.')) return;
1312
- var status = byId('task-delete-status');
1313
- var button = byId('task-delete');
1314
- status.hidden = false;
1315
- status.textContent = 'Deleting ' + slug + '…';
1316
- button.disabled = true;
1317
- request('/api/v1/tasks/' + encodeURIComponent(slug), { method: 'DELETE' })
1318
- .then(function (payload) {
1319
- // The success text lands in the page-level banner, not in
1320
- // #task-delete-status: the list view replaces the detail view in this
1321
- // same task, so a live region inside it would be hidden before it is
1322
- // announced.
1323
- var removed = payload && payload.slug ? payload.slug : slug;
1324
- status.hidden = true;
1325
- status.textContent = '';
1326
- byId('banner').hidden = false;
1327
- byId('banner').textContent = 'Deleted ' + removed + '. Back to the list.';
1328
- state.slug = '';
1329
- showList();
1330
- loadList();
1331
- byId('list-heading').focus();
1332
- })
1333
- .catch(function (error) {
1334
- var described = describeError(error);
1335
- var active = error.details && error.details.activeSlug ? ' Active task: ' + error.details.activeSlug + '.' : '';
1336
- status.textContent = described.code + ': ' + described.message + active;
1337
- })
1338
- .then(function () {
1339
- button.disabled = false;
1340
- });
1341
- };
1342
-
1343
- /* -------------------------------- tracker --------------------------------- */
1344
-
1345
- var trackerState = { id: '' };
1346
-
1347
- var trackerItemView = function (payload) {
1348
- var item = payload.item;
1349
- var wrapper = document.createElement('div');
1350
- wrapper.appendChild(kv([
1351
- ['Item', item.id],
1352
- ['Title', item.title],
1353
- ['Status', badge(item.effectiveStatus)],
1354
- ['Declared status', item.status],
1355
- ['Priority', item.priority],
1356
- ['Type', item.type],
1357
- ['Ready', item.ready ? 'yes' : 'no'],
1358
- ['Waiting on', (item.waitingOn || []).join(', ')],
1359
- ['Source task', item.sourceTask],
1360
- ['Queue entry', item.queueEntryId],
1361
- ['Created', formatDate(item.createdAt)],
1362
- ['Updated', formatDate(item.updatedAt)]
1363
- ]));
1364
- if (item.description) wrapper.appendChild(text('p', item.description));
1365
- wrapper.appendChild(text('h4', 'Dependencies'));
1366
- wrapper.appendChild(
1367
- payload.dependencies.length === 0
1368
- ? text('p', 'No dependencies.')
1369
- : miniTable(['Item', 'Title', 'Status', 'Satisfied'], payload.dependencies.map(function (dependency) {
1370
- return [dependency.id, dependency.title, dependency.status, dependency.satisfied ? 'yes' : 'no'];
1371
- }))
1372
- );
1373
- wrapper.appendChild(text('h4', 'Dependents'));
1374
- wrapper.appendChild(
1375
- payload.dependents.length === 0
1376
- ? text('p', 'No dependents.')
1377
- : miniTable(['Item', 'Title', 'Status', 'Satisfied'], payload.dependents.map(function (dependent) {
1378
- return [dependent.id, dependent.title, dependent.status, dependent.satisfied ? 'yes' : 'no'];
1379
- }))
1380
- );
1381
- wrapper.appendChild(text('h4', 'Linked tasks'));
1382
- wrapper.appendChild(
1383
- payload.tasks.length === 0
1384
- ? text('p', 'No linked tasks.')
1385
- : miniTable(['Task', 'Role', 'Decision', 'State', 'Entry status'], payload.tasks.map(function (task) {
1386
- return [task.taskSlug, task.role, task.decision, task.effectiveState, task.entryStatus];
1387
- }))
1388
- );
1389
- wrapper.appendChild(text('h4', 'Queue entries'));
1390
- wrapper.appendChild(trackerQueueTable(payload.queue));
1391
- return wrapper;
1392
- };
1393
-
1394
- var trackerQueueTable = function (entries) {
1395
- if (entries.length === 0) return text('p', 'No queue entries.');
1396
- return miniTable(['Entry', 'Task', 'Status', 'Requested', 'Claimed', 'Finished'], entries.map(function (entry) {
1397
- return [entry.entryId, entry.taskSlug, entry.status, formatDate(entry.requestedAt), formatDate(entry.claimedAt), formatDate(entry.finishedAt)];
1398
- }));
1399
- };
1400
-
1401
- var openTrackerItem = function (id) {
1402
- trackerState.id = id;
1403
- var body = byId('tracker-item').querySelector('.panel-body');
1404
- byId('tracker-item-empty').hidden = true;
1405
- clear(body);
1406
- body.appendChild(text('p', 'Loading…', 'section-state'));
1407
- request('/api/v1/tracker/' + encodeURIComponent(id))
1408
- .then(function (payload) {
1409
- clear(body);
1410
- body.appendChild(trackerItemView(payload));
1411
- })
1412
- .catch(function (error) {
1413
- var described = describeError(error);
1414
- clear(body);
1415
- body.appendChild(text('p', described.code + ': ' + described.message, 'section-error'));
1416
- });
1417
- };
1418
-
1419
- var renderTrackerRows = function (payload) {
1420
- var body = byId('tracker-rows');
1421
- clear(body);
1422
- payload.items.forEach(function (item) {
1423
- var tr = document.createElement('tr');
1424
- var head = document.createElement('th');
1425
- head.setAttribute('scope', 'row');
1426
- var link = document.createElement('a');
1427
- link.href = '/?view=tracker&item=' + encodeURIComponent(item.id);
1428
- link.textContent = item.id;
1429
- link.addEventListener('click', function (event) {
1430
- event.preventDefault();
1431
- openTrackerItem(item.id);
1432
- });
1433
- head.appendChild(link);
1434
- tr.appendChild(head);
1435
- tr.appendChild(text('td', item.title));
1436
- tr.appendChild((function () { var td = document.createElement('td'); td.appendChild(badge(item.effectiveStatus)); return td; })());
1437
- tr.appendChild(text('td', item.priority));
1438
- tr.appendChild(text('td', item.type));
1439
- tr.appendChild(text('td', item.ready ? 'yes' : 'no'));
1440
- tr.appendChild(text('td', formatDate(item.updatedAt)));
1441
- body.appendChild(tr);
1442
- });
1443
- byId('tracker-empty').hidden = payload.total !== 0;
1444
- byId('tracker-table').hidden = payload.total === 0;
1445
- };
1446
-
1447
- var renderTrackerQueue = function (payload) {
1448
- var body = byId('tracker-queue').querySelector('.panel-body');
1449
- clear(body);
1450
- body.appendChild(trackerQueueTable(payload.items));
1451
- byId('tracker-queue-empty').hidden = payload.total !== 0;
1452
- };
1453
-
1454
- var loadTracker = function () {
1455
- byId('tracker-loading').hidden = false;
1456
- byId('tracker-error').hidden = true;
1457
- byId('tracker-table').setAttribute('aria-busy', 'true');
1458
- var params = new URLSearchParams();
1459
- params.set('limit', String(PAGE_SIZE));
1460
- return Promise.all([
1461
- request('/api/v1/tracker?' + params.toString()),
1462
- request('/api/v1/tracker/queue?' + params.toString())
1463
- ])
1464
- .then(function (payloads) {
1465
- renderTrackerRows(payloads[0]);
1466
- renderTrackerQueue(payloads[1]);
1467
- })
1468
- .catch(function (error) {
1469
- var described = describeError(error);
1470
- byId('tracker-error').hidden = false;
1471
- byId('tracker-error').textContent = described.code + ': ' + described.message;
1472
- })
1473
- .then(function () {
1474
- byId('tracker-loading').hidden = true;
1475
- byId('tracker-table').setAttribute('aria-busy', 'false');
1476
- });
1477
- };
1478
-
1479
- var showTracker = function () {
1480
- state.slug = '';
1481
- trackerState.id = '';
1482
- showView('view-tracker');
1483
- document.title = 'Tracker — agent team projection';
1484
- loadTracker();
1485
- };
1486
-
1487
- /* ---------------------------------- jobs ---------------------------------- */
1488
-
1489
- var JOB_COPY = {
1490
- E_CONFLICT: 'This job changed since you loaded it — reload before saving.',
1491
- E_SCHEDULER_OFFLINE: 'No scheduler is running: start team-db.mjs schedule.',
1492
- E_ORPHANED: 'The scheduler stopped before this run finished.'
1493
- };
1494
-
1495
- var copyFor = function (code, fallback) {
1496
- return JOB_COPY[code] || fallback;
1497
- };
1498
-
1499
- var RUN_STATES = ['claimed', 'running', 'succeeded', 'failed', 'timeout', 'skipped', 'interrupted'];
1500
- var jobsState = { offset: 0, total: 0, id: '', runId: '', run: null, poll: null, loaded: [], runsTotal: null, dirty: false };
1501
-
1502
- var showView = function (name) {
1503
- ['view-list', 'view-detail', 'view-tracker', 'view-jobs', 'view-job', 'view-job-edit', 'view-run'].forEach(function (id) {
1504
- var node = byId(id);
1505
- if (node) node.hidden = id !== name;
1506
- });
1507
- var jobs = name === 'view-jobs' || name === 'view-job' || name === 'view-job-edit' || name === 'view-run';
1508
- var tracker = name === 'view-tracker';
1509
- byId('nav-tasks').setAttribute('aria-current', !jobs && !tracker ? 'page' : 'false');
1510
- byId('nav-tracker').setAttribute('aria-current', tracker ? 'page' : 'false');
1511
- byId('nav-jobs').setAttribute('aria-current', jobs ? 'page' : 'false');
1512
- };
1513
-
1514
- var scheduleLabel = function (job) {
1515
- if (job.schedule.kind === 'cron') return job.schedule.expression + ' ' + job.schedule.timezone;
1516
- return 'every ' + job.schedule.everySeconds + 's ' + job.schedule.timezone;
1517
- };
1518
-
1519
- var lastRunLabel = function (lastRun) {
1520
- if (!lastRun) return 'never';
1521
- return lastRun.state + ' / ' + formatDuration(lastRun.durationMs);
1522
- };
1523
-
1524
- var renderJobs = function (payload) {
1525
- var body = byId('job-rows');
1526
- if (jobsState.offset === 0) clear(body);
1527
- jobsState.loaded = jobsState.loaded.concat(payload.items);
1528
- var query = byId('filter-job-q').value.trim().toLowerCase();
1529
- var visible = jobsState.loaded.filter(function (entry) {
1530
- if (!query) return true;
1531
- return entry.job.id.toLowerCase().indexOf(query) !== -1 || entry.job.title.toLowerCase().indexOf(query) !== -1;
1532
- });
1533
- clear(body);
1534
- visible.forEach(function (entry) {
1535
- var tr = document.createElement('tr');
1536
- var head = document.createElement('th');
1537
- head.setAttribute('scope', 'row');
1538
- var link = document.createElement('a');
1539
- link.href = '/?view=job&job=' + encodeURIComponent(entry.job.id);
1540
- link.textContent = entry.job.id;
1541
- link.addEventListener('click', function (event) {
1542
- event.preventDefault();
1543
- openJob(entry.job.id);
1544
- });
1545
- head.appendChild(link);
1546
- tr.appendChild(head);
1547
- tr.appendChild(text('td', entry.job.enabled ? 'yes' : 'no'));
1548
- tr.appendChild(text('td', scheduleLabel(entry.job)));
1549
- tr.appendChild(text('td', formatDate(entry.nextFireAt)));
1550
- tr.appendChild(text('td', lastRunLabel(entry.lastRun)));
1551
- tr.appendChild(text('td', entry.job.revision));
1552
- body.appendChild(tr);
1553
- });
1554
- jobsState.total = payload.total;
1555
- byId('jobs-empty').hidden = payload.total !== 0;
1556
- byId('jobs-table').hidden = payload.total === 0;
1557
- byId('jobs-load-more').hidden = !payload.nextOffset;
1558
- byId('jobs-load-more').textContent = 'Load more (' + visible.length + ' of ' + payload.total + ')';
1559
- };
1560
-
1561
- var loadJobs = function () {
1562
- byId('jobs-loading').hidden = false;
1563
- byId('jobs-error').hidden = true;
1564
- byId('jobs-table').setAttribute('aria-busy', 'true');
1565
- var params = new URLSearchParams();
1566
- params.set('limit', String(PAGE_SIZE));
1567
- params.set('offset', String(jobsState.offset));
1568
- params.set('sort', byId('sort-jobs').value);
1569
- if (byId('filter-job-enabled').checked) params.set('enabled', 'true');
1570
- return request('/api/v1/jobs?' + params.toString())
1571
- .then(function (payload) {
1572
- renderJobs(payload);
1573
- })
1574
- .catch(function (error) {
1575
- var described = describeError(error);
1576
- byId('jobs-error').hidden = false;
1577
- byId('jobs-error').textContent = described.code + ': ' + described.message;
1578
- })
1579
- .then(function () {
1580
- byId('jobs-loading').hidden = true;
1581
- byId('jobs-table').setAttribute('aria-busy', 'false');
1582
- });
1583
- };
1584
-
1585
- var showJobs = function () {
1586
- jobsState.id = '';
1587
- jobsState.runId = '';
1588
- jobsState.offset = 0;
1589
- jobsState.loaded = [];
1590
- showView('view-jobs');
1591
- document.title = 'Scheduled jobs — agent team projection';
1592
- loadJobs();
1593
- };
1594
-
1595
- var jobDefinitionPanel = function (payload) {
1596
- var list = document.createElement('dl');
1597
- var job = payload.job;
1598
- [
1599
- ['Id', job.id],
1600
- ['Title', job.title],
1601
- ['Enabled', job.enabled ? 'yes' : 'no'],
1602
- ['Payload kind', job.payload.kind],
1603
- ['Argv', (job.payload.argv || []).join(' ')],
1604
- ['Cwd', job.cwd],
1605
- ['Environment', (job.envPassthrough || []).join(', ')],
1606
- ['Timeout', formatDuration(job.timeoutMs)]
1607
- ].forEach(function (pair) {
1608
- list.appendChild(definition(pair[0], pair[1]));
1609
- });
1610
- return list;
1611
- };
1612
-
1613
- var jobSchedulePanel = function (payload) {
1614
- var list = document.createElement('dl');
1615
- list.appendChild(definition('Schedule', scheduleLabel(payload.job)));
1616
- list.appendChild(definition('Next fire (UTC)', formatDate(payload.nextFireAt)));
1617
- list.appendChild(definition('Misfire', payload.job.misfire));
1618
- list.appendChild(definition('Concurrency', payload.job.concurrency));
1619
- list.appendChild(definition('Last run', lastRunLabel(payload.lastRun)));
1620
- list.appendChild(definition('Revision', payload.job.revision));
1621
- return list;
1622
- };
1623
-
1624
- var jobRunsPanel = function (payload) {
1625
- var wrapper = document.createElement('div');
1626
- var table = document.createElement('table');
1627
- table.className = 'tasks';
1628
- var head = document.createElement('thead');
1629
- var headRow = document.createElement('tr');
1630
- ['Run', 'State', 'Trigger', 'Started', 'Duration', 'Exit'].forEach(function (label) {
1631
- var th = text('th', label);
1632
- th.setAttribute('scope', 'col');
1633
- headRow.appendChild(th);
1634
- });
1635
- head.appendChild(headRow);
1636
- table.appendChild(head);
1637
- var body = document.createElement('tbody');
1638
- payload.items.forEach(function (run) {
1639
- var tr = document.createElement('tr');
1640
- var cell = document.createElement('th');
1641
- cell.setAttribute('scope', 'row');
1642
- var link = document.createElement('a');
1643
- link.href = '/?view=run&job=' + encodeURIComponent(run.jobId) + '&run=' + encodeURIComponent(run.runId);
1644
- link.textContent = run.runId;
1645
- link.addEventListener('click', function (event) {
1646
- event.preventDefault();
1647
- openRun(run.jobId, run.runId);
1648
- });
1649
- cell.appendChild(link);
1650
- tr.appendChild(cell);
1651
- tr.appendChild((function () { var td = document.createElement('td'); td.appendChild(badge(run.state)); return td; })());
1652
- tr.appendChild(text('td', run.trigger));
1653
- tr.appendChild(text('td', formatDate(run.startedAt)));
1654
- tr.appendChild(text('td', formatDuration(run.durationMs)));
1655
- tr.appendChild(text('td', run.exitCode === null ? '—' : run.exitCode));
1656
- body.appendChild(tr);
1657
- });
1658
- table.appendChild(body);
1659
- wrapper.appendChild(table);
1660
- jobsState.runsTotal = payload.total;
1661
- byId('job-runs-empty').hidden = payload.total !== 0;
1662
- byId('job-delete').disabled = jobsState.runsTotal === null;
1663
- return wrapper;
1664
- };
1665
-
1666
- var jobDetailViews = {
1667
- 'job-definition': jobDefinitionPanel,
1668
- 'job-schedule': jobSchedulePanel,
1669
- 'job-runs': jobRunsPanel
1670
- };
1671
-
1672
- var loadJobSection = function (section, id) {
1673
- var endpoint = section.getAttribute('data-endpoint').replace('{id}', encodeURIComponent(id));
1674
- var body = section.querySelector('.panel-body');
1675
- clear(body);
1676
- body.appendChild(text('p', 'Loading…', 'section-state'));
1677
- return cached(endpoint)
1678
- .then(function (payload) {
1679
- clear(body);
1680
- body.appendChild(jobDetailViews[section.getAttribute('data-view')](payload));
1681
- })
1682
- .catch(function (error) {
1683
- var described = describeError(error);
1684
- clear(body);
1685
- body.appendChild(text('p', described.code + ': ' + described.message, 'section-error'));
1686
- if (described.code === 'E_SCHEDULER_OFFLINE') {
1687
- byId('job-error').hidden = false;
1688
- byId('job-error').textContent = copyFor('E_SCHEDULER_OFFLINE', described.message);
1689
- }
1690
- });
1691
- };
1692
-
1693
- var openJob = function (id) {
1694
- jobsState.id = id;
1695
- jobsState.runId = '';
1696
- jobsState.runsTotal = null;
1697
- cache = {};
1698
- showView('view-job');
1699
- byId('job-loading').hidden = false;
1700
- byId('job-error').hidden = true;
1701
- byId('job-delete').disabled = true;
1702
- byId('job-runs-empty').hidden = true;
1703
- document.title = id + ' — job detail';
1704
- var sections = document.querySelectorAll('#view-job [data-endpoint]');
1705
- Array.prototype.forEach.call(sections, function (section) {
1706
- loadJobSection(section, id);
1707
- });
1708
- request('/api/v1/jobs/' + encodeURIComponent(id))
1709
- .then(function (payload) {
1710
- jobsState.job = payload;
1711
- byId('job-toggle').textContent = payload.job.enabled ? 'Disable' : 'Enable';
1712
- })
1713
- .catch(function (error) {
1714
- var described = describeError(error);
1715
- byId('job-error').hidden = false;
1716
- byId('job-error').textContent = described.code + ': ' + described.message;
1717
- })
1718
- .then(function () {
1719
- byId('job-loading').hidden = true;
1720
- });
1721
- };
1722
-
1723
- var runEventsPanel = function (payload) {
1724
- var list = document.createElement('ol');
1725
- payload.events.forEach(function (event) {
1726
- var item = document.createElement('li');
1727
- item.textContent = formatDate(event.at) + ' · ' + event.state + (event.code ? ' · ' + event.code : '') + (event.message ? ' · ' + event.message : '');
1728
- list.appendChild(item);
1729
- });
1730
- byId('run-events-empty').hidden = payload.events.length !== 0;
1731
- return list;
1732
- };
1733
-
1734
- var runSummaryPanel = function (payload) {
1735
- var list = document.createElement('dl');
1736
- list.appendChild(definition('Run', payload.run.runId));
1737
- list.appendChild(definition('State', payload.run.state));
1738
- list.appendChild(definition('Reason', payload.run.reasonCode ? copyFor(payload.run.reasonCode, payload.run.reasonCode) : '—'));
1739
- list.appendChild(definition('Trigger', payload.run.trigger));
1740
- list.appendChild(definition('Started', formatDate(payload.run.startedAt)));
1741
- list.appendChild(definition('Finished', formatDate(payload.run.finishedAt)));
1742
- list.appendChild(definition('Duration', formatDuration(payload.run.durationMs)));
1743
- list.appendChild(definition('Exit', payload.run.exitCode === null ? '—' : payload.run.exitCode));
1744
- byId('log-truncated').hidden = !(payload.run.stdoutTruncated || payload.run.stderrTruncated);
1745
- return list;
1746
- };
1747
-
1748
- var logOffsets = { stdout: 0, stderr: 0 };
1749
-
1750
- var appendChunk = function (stream, chunk) {
1751
- var target = byId('log-stream-' + stream);
1752
- if (!chunk.text) return;
1753
- target.textContent += chunk.text;
1754
- logOffsets[stream] = chunk.offset + new TextEncoder().encode(chunk.text).length;
1755
- byId('log-empty').hidden = byId('log-stream-stdout').textContent.length + byId('log-stream-stderr').textContent.length > 0;
1756
- if (chunk.truncated) byId('log-truncated').hidden = false;
1757
- };
1758
-
1759
- var fetchStream = function (id, runId, stream) {
1760
- var url = '/api/v1/jobs/' + encodeURIComponent(id) + '/runs/' + encodeURIComponent(runId) + '/log?stream=' + stream + '&offset=' + logOffsets[stream] + '&limit=65536';
1761
- return request(url).then(function (chunk) {
1762
- appendChunk(stream, chunk);
1763
- return chunk;
1764
- });
1765
- };
1766
-
1767
- var stopPolling = function () {
1768
- if (jobsState.poll) {
1769
- clearTimeout(jobsState.poll);
1770
- jobsState.poll = null;
1771
- }
1772
- };
1773
-
1774
- var renderRun = function (payload) {
1775
- var summary = byId('run-summary').querySelector('.panel-body');
1776
- clear(summary);
1777
- summary.appendChild(runSummaryPanel(payload));
1778
- var events = byId('run-events').querySelector('.panel-body');
1779
- clear(events);
1780
- events.appendChild(runEventsPanel(payload));
1781
- };
1782
-
1783
- var isTerminalRun = function (state) {
1784
- return state !== 'claimed' && state !== 'running';
1785
- };
1786
-
1787
- var pollRun = function (id, runId) {
1788
- stopPolling();
1789
- jobsState.poll = setTimeout(function () {
1790
- request('/api/v1/jobs/' + encodeURIComponent(id) + '/runs/' + encodeURIComponent(runId))
1791
- .then(function (payload) {
1792
- // The manifest is reloaded every cycle: a run that becomes terminal
1793
- // after the page opened is observed here, not in the startup copy.
1794
- renderRun(payload);
1795
- return Promise.all([fetchStream(id, runId, 'stdout'), fetchStream(id, runId, 'stderr')]).then(function (chunks) {
1796
- var done = chunks.every(function (chunk) { return chunk.offset >= chunk.totalBytes; });
1797
- if (done && isTerminalRun(payload.run.state)) {
1798
- byId('log-tail').textContent = 'Live log: complete (' + payload.run.state + ').';
1799
- return;
1800
- }
1801
- pollRun(id, runId);
1802
- });
1803
- })
1804
- .catch(function () {
1805
- byId('log-tail').textContent = 'Live log: stopped after an error.';
1806
- });
1807
- }, 2000);
1808
- };
1809
-
1810
- var openRun = function (id, runId) {
1811
- jobsState.id = id;
1812
- jobsState.runId = runId;
1813
- stopPolling();
1814
- cache = {};
1815
- logOffsets = { stdout: 0, stderr: 0 };
1816
- byId('log-stream-stdout').textContent = '';
1817
- byId('log-stream-stderr').textContent = '';
1818
- byId('log-empty').hidden = true;
1819
- byId('log-truncated').hidden = true;
1820
- byId('log-tail').textContent = 'Live log: polling every 2 s while the run is active.';
1821
- byId('run-loading').hidden = false;
1822
- byId('run-error').hidden = true;
1823
- showView('view-run');
1824
- document.title = runId + ' — run detail';
1825
- var endpoint = '/api/v1/jobs/' + encodeURIComponent(id) + '/runs/' + encodeURIComponent(runId);
1826
- request(endpoint)
1827
- .then(function (payload) {
1828
- jobsState.run = payload.run;
1829
- renderRun(payload);
1830
- return Promise.all([fetchStream(id, runId, 'stdout'), fetchStream(id, runId, 'stderr')]).then(function () {
1831
- pollRun(id, runId);
1832
- });
1833
- })
1834
- .catch(function (error) {
1835
- var described = describeError(error);
1836
- byId('run-error').hidden = false;
1837
- byId('run-error').textContent = described.code + ': ' + described.message;
1838
- })
1839
- .then(function () {
1840
- byId('run-loading').hidden = true;
1841
- });
1842
- };
1843
-
1844
- var fillForm = function (job) {
1845
- byId('job-id').value = job ? job.id : '';
1846
- byId('job-id').readOnly = Boolean(job);
1847
- byId('job-title').value = job ? job.title : '';
1848
- byId('job-enabled').checked = job ? job.enabled : true;
1849
- byId('job-schedule-kind').value = job ? job.schedule.kind : 'cron';
1850
- byId('job-cron').value = job && job.schedule.kind === 'cron' ? job.schedule.expression : '';
1851
- byId('job-every').value = job && job.schedule.kind === 'interval' ? job.schedule.everySeconds : '';
1852
- byId('job-timezone').value = job ? job.schedule.timezone : '';
1853
- byId('job-payload-kind').value = job ? job.payload.kind : 'command';
1854
- byId('job-argv').value = job ? (job.payload.argv || []).join('\\n') : '';
1855
- byId('job-prompt-template').value = job ? job.payload.promptTemplate || '' : '';
1856
- byId('job-runner').value = job ? (job.payload.runner || []).join('\\n') : '';
1857
- byId('job-cwd').value = job ? job.cwd : '.';
1858
- byId('job-env').value = job ? (job.envPassthrough || []).join(', ') : '';
1859
- byId('job-timeout').value = job ? job.timeoutMs : 900000;
1860
- byId('job-concurrency').value = job ? job.concurrency : 'skip';
1861
- byId('job-misfire').value = job ? job.misfire : 'run-once';
1862
- byId('job-form-error').hidden = true;
1863
- jobsState.dirty = false;
1864
- };
1865
-
1866
- var openForm = function (job) {
1867
- showView('view-job-edit');
1868
- jobsState.editing = job || null;
1869
- fillForm(job || null);
1870
- document.title = job ? 'Edit ' + job.id : 'New job';
1871
- };
1872
-
1873
- var formPayload = function () {
1874
- var lines = function (value) {
1875
- return value.split('\\n').map(function (line) { return line.trim(); }).filter(Boolean);
1876
- };
1877
- var payload = {
1878
- id: byId('job-id').value.trim(),
1879
- title: byId('job-title').value.trim(),
1880
- enabled: byId('job-enabled').checked,
1881
- schedule:
1882
- byId('job-schedule-kind').value === 'cron'
1883
- ? { kind: 'cron', expression: byId('job-cron').value.trim(), timezone: byId('job-timezone').value.trim() }
1884
- : { kind: 'interval', everySeconds: Number(byId('job-every').value), timezone: byId('job-timezone').value.trim() },
1885
- payload:
1886
- byId('job-payload-kind').value === 'command'
1887
- ? { kind: 'command', argv: lines(byId('job-argv').value) }
1888
- : {
1889
- kind: 'pipeline',
1890
- promptTemplate: byId('job-prompt-template').value.trim(),
1891
- runner: lines(byId('job-runner').value)
1892
- },
1893
- cwd: byId('job-cwd').value.trim(),
1894
- envPassthrough: byId('job-env').value.split(',').map(function (name) { return name.trim(); }).filter(Boolean),
1895
- timeoutMs: Number(byId('job-timeout').value),
1896
- concurrency: byId('job-concurrency').value,
1897
- misfire: byId('job-misfire').value
1898
- };
1899
- if (jobsState.editing) payload.revision = jobsState.editing.revision;
1900
- return payload;
1901
- };
1902
-
1903
- var saveJob = function (event) {
1904
- if (event) event.preventDefault();
1905
- var editing = jobsState.editing;
1906
- var target = editing ? '/api/v1/jobs/' + encodeURIComponent(editing.id) : '/api/v1/jobs';
1907
- var options = {
1908
- method: editing ? 'PUT' : 'POST',
1909
- headers: { 'Content-Type': 'application/json' },
1910
- body: JSON.stringify(formPayload())
1911
- };
1912
- byId('job-form-saving').hidden = false;
1913
- byId('job-form-error').hidden = true;
1914
- byId('job-save').disabled = true;
1915
- request(target, options)
1916
- .then(function (payload) {
1917
- jobsState.dirty = false;
1918
- byId('job-form-saving').hidden = true;
1919
- byId('job-save').disabled = false;
1920
- byId('banner').hidden = false;
1921
- byId('banner').textContent = 'Saved ' + payload.job.id + ' at revision ' + payload.job.revision;
1922
- openJob(payload.job.id);
1923
- })
1924
- .catch(function (error) {
1925
- var described = describeError(error);
1926
- byId('job-form-saving').hidden = true;
1927
- byId('job-save').disabled = false;
1928
- byId('job-form-error').hidden = false;
1929
- byId('job-form-error').textContent =
1930
- (error.code === 'E_CONFLICT' ? copyFor('E_CONFLICT', described.message) : described.code + ': ' + described.message);
1931
- });
1932
- };
1933
-
1934
- var toggleJob = function () {
1935
- var job = jobsState.job;
1936
- if (!job) return;
1937
- if (!confirm('Change "enabled" for ' + job.job.id + '?')) return;
1938
- var body = JSON.parse(JSON.stringify(job.job));
1939
- body.enabled = !body.enabled;
1940
- body.revision = job.job.revision;
1941
- request('/api/v1/jobs/' + encodeURIComponent(job.job.id), {
1942
- method: 'PUT',
1943
- headers: { 'Content-Type': 'application/json' },
1944
- body: JSON.stringify(body)
1945
- })
1946
- .then(function () {
1947
- openJob(job.job.id);
1948
- })
1949
- .catch(function (error) {
1950
- var described = describeError(error);
1951
- byId('job-error').hidden = false;
1952
- byId('job-error').textContent = error.code === 'E_CONFLICT' ? copyFor('E_CONFLICT', described.message) : described.message;
1953
- });
1954
- };
1955
-
1956
- var runNow = function () {
1957
- var id = jobsState.id;
1958
- if (!id) return;
1959
- if (!confirm('Ask the scheduler to run ' + id + ' now?')) return;
1960
- request('/api/v1/jobs/' + encodeURIComponent(id) + '/run', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' })
1961
- .then(function () {
1962
- byId('banner').hidden = false;
1963
- byId('banner').textContent = 'Run requested for ' + id + '.';
1964
- openJob(id);
1965
- })
1966
- .catch(function (error) {
1967
- var described = describeError(error);
1968
- byId('job-error').hidden = false;
1969
- byId('job-error').textContent =
1970
- error.code === 'E_SCHEDULER_OFFLINE'
1971
- ? copyFor('E_SCHEDULER_OFFLINE', described.message)
1972
- : described.code + ': ' + described.message;
1973
- });
1974
- };
1975
-
1976
- var deleteJob = function () {
1977
- var id = jobsState.id;
1978
- if (!id || jobsState.runsTotal === null) return;
1979
- if (!confirm('Delete ' + id + ' and its ' + jobsState.runsTotal + ' recorded run(s)? This cannot be undone.')) return;
1980
- request('/api/v1/jobs/' + encodeURIComponent(id), { method: 'DELETE' })
1981
- .then(function () {
1982
- byId('banner').hidden = false;
1983
- byId('banner').textContent = 'Deleted ' + id + '.';
1984
- showJobs();
1985
- })
1986
- .catch(function (error) {
1987
- var described = describeError(error);
1988
- byId('job-error').hidden = false;
1989
- byId('job-error').textContent = described.code + ': ' + described.message;
1990
- });
1991
- };
1992
-
1993
- var cancelForm = function () {
1994
- if (jobsState.dirty && !confirm('Discard the unsaved changes to this job?')) return;
1995
- if (jobsState.editing) openJob(jobsState.editing.id);
1996
- else showJobs();
1997
- };
1998
-
1999
- var bindJobs = function () {
2000
- var filters = byId('jobs-filters');
2001
- if (filters) {
2002
- filters.addEventListener('submit', function (event) {
2003
- event.preventDefault();
2004
- jobsState.offset = 0;
2005
- jobsState.loaded = [];
2006
- loadJobs();
2007
- });
2008
- byId('filter-job-q').addEventListener('input', function () {
2009
- var table = byId('jobs-table');
2010
- var query = byId('filter-job-q').value.trim().toLowerCase();
2011
- Array.prototype.forEach.call(byId('job-rows').children, function (row) {
2012
- var label = row.textContent.toLowerCase();
2013
- row.hidden = query !== '' && label.indexOf(query) === -1;
2014
- });
2015
- table.setAttribute('data-filtered', query ? 'page' : '');
2016
- });
2017
- }
2018
- var more = byId('jobs-load-more');
2019
- if (more) more.addEventListener('click', function () {
2020
- jobsState.offset += PAGE_SIZE;
2021
- loadJobs();
2022
- });
2023
- if (byId('job-new')) byId('job-new').addEventListener('click', function () { openForm(null); });
2024
- if (byId('job-toggle')) byId('job-toggle').addEventListener('click', toggleJob);
2025
- if (byId('job-run-now')) byId('job-run-now').addEventListener('click', runNow);
2026
- if (byId('job-delete')) byId('job-delete').addEventListener('click', deleteJob);
2027
- if (byId('job-edit')) byId('job-edit').addEventListener('click', function () {
2028
- if (!jobsState.job) return;
2029
- openForm(jobsState.job.job);
2030
- });
2031
- if (byId('job-form')) {
2032
- byId('job-form').addEventListener('submit', saveJob);
2033
- byId('job-form').addEventListener('input', function () { jobsState.dirty = true; });
2034
- byId('job-cancel').addEventListener('click', cancelForm);
2035
- }
2036
- if (byId('log-refresh')) byId('log-refresh').addEventListener('click', function () {
2037
- if (jobsState.id && jobsState.runId) openRun(jobsState.id, jobsState.runId);
2038
- });
2039
- document.querySelectorAll('#nav-tasks, #nav-tracker, #nav-jobs, #back-to-jobs, #back-to-job').forEach(function (link) {
2040
- link.addEventListener('click', function (event) {
2041
- event.preventDefault();
2042
- stopPolling();
2043
- if (link.id === 'nav-tracker') showTracker();
2044
- else if (link.id === 'nav-jobs' || link.id === 'back-to-jobs') showJobs();
2045
- else if (link.id === 'back-to-job') openJob(jobsState.id);
2046
- else {
2047
- state.slug = '';
2048
- showView('view-list');
2049
- document.title = 'Agent team projection';
2050
- loadList();
2051
- }
2052
- });
2053
- });
2054
- };
2055
-
2056
- var bind = function () {
2057
- var filters = byId('filters');
2058
- if (filters) filters.addEventListener('submit', applyFilters);
2059
- var apply = byId('apply');
2060
- if (apply) apply.addEventListener('click', applyFilters);
2061
- var reset = byId('reset');
2062
- if (reset) reset.addEventListener('click', function () {
2063
- filters.reset();
2064
- state.offset = 0;
2065
- showList();
2066
- loadList();
2067
- });
2068
- var more = byId('load-more');
2069
- if (more) more.addEventListener('click', loadMore);
2070
- var re = byId('rescan');
2071
- if (re) re.addEventListener('click', rescan);
2072
- var remove = byId('task-delete');
2073
- if (remove) remove.addEventListener('click', deleteTask);
2074
- bindJobs();
2075
- };
2076
-
2077
- var start = function () {
2078
- bind();
2079
- health();
2080
- var params = new URLSearchParams(window.location.search);
2081
- var view = params.get('view');
2082
- var job = params.get('job');
2083
- var run = params.get('run');
2084
- var slug = applyUrlState();
2085
- if (view === 'run' && job && run) openRun(job, run);
2086
- else if ((view === 'edit' || params.get('edit') === '1') && job) {
2087
- request('/api/v1/jobs/' + encodeURIComponent(job))
2088
- .then(function (payload) { openForm(payload.job); })
2089
- .catch(function () { showJobs(); });
2090
- } else if (params.get('new') === '1') openForm(null);
2091
- else if (view === 'job' && job) openJob(job);
2092
- else if (view === 'jobs') showJobs();
2093
- else if (view === 'tracker') {
2094
- showTracker();
2095
- if (params.get('item')) openTrackerItem(params.get('item'));
2096
- } else if (slug) openDetail(slug);
2097
- else loadList();
2098
- };
2099
-
2100
- if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
2101
- else start();
2102
- })();
2103
- `;