@chankov/agent-fleet 0.0.7 → 0.0.9

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 (636) hide show
  1. package/.pi/agents/model-profiles.yaml +9 -2
  2. package/.pi/agents/peers.yaml +12 -16
  3. package/.pi/agents/teams.yaml +4 -2
  4. package/.pi/harnesses/agent-hub/README.md +20 -5
  5. package/.pi/harnesses/agent-hub/footer.ts +4 -2
  6. package/.pi/harnesses/agent-hub/index.ts +104 -11
  7. package/.pi/harnesses/agent-hub/package.json +1 -1
  8. package/.pi/harnesses/agent-hub/version.ts +25 -1
  9. package/.pi/harnesses/coms/README.md +8 -1
  10. package/.pi/harnesses/coms/package.json +1 -1
  11. package/.pi/harnesses/coms/version.ts +25 -1
  12. package/.pi/harnesses/damage-control-continue/README.md +8 -1
  13. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  14. package/.pi/harnesses/damage-control-continue/version.ts +25 -1
  15. package/.pi/harnesses/lib/herdr-client.ts +10 -1
  16. package/.pi/harnesses/lib/spawned-peers.js +190 -0
  17. package/.versions/0.0.8/.claude/commands/build.md +44 -0
  18. package/.versions/0.0.8/.claude/commands/code-simplify.md +22 -0
  19. package/.versions/0.0.8/.claude/commands/design-agent.md +14 -0
  20. package/.versions/0.0.8/.claude/commands/doctor-agent-fleet.md +17 -0
  21. package/.versions/0.0.8/.claude/commands/orchestrate.md +112 -0
  22. package/.versions/0.0.8/.claude/commands/plan.md +16 -0
  23. package/.versions/0.0.8/.claude/commands/prime.md +22 -0
  24. package/.versions/0.0.8/.claude/commands/review.md +16 -0
  25. package/.versions/0.0.8/.claude/commands/set-hermes-telegram.md +15 -0
  26. package/.versions/0.0.8/.claude/commands/set-hermes-watchdog.md +6 -0
  27. package/.versions/0.0.8/.claude/commands/setup-agent-fleet.md +25 -0
  28. package/.versions/0.0.8/.claude/commands/ship.md +72 -0
  29. package/.versions/0.0.8/.claude/commands/spec.md +15 -0
  30. package/.versions/0.0.8/.claude/commands/test.md +19 -0
  31. package/.versions/0.0.8/.claude/commands/webperf.md +32 -0
  32. package/.versions/0.0.8/.claude/orchestrate-teams.yaml +24 -0
  33. package/.versions/0.0.8/.opencode/commands/af-build.md +17 -0
  34. package/.versions/0.0.8/.opencode/commands/af-code-simplify.md +16 -0
  35. package/.versions/0.0.8/.opencode/commands/af-compound.md +16 -0
  36. package/.versions/0.0.8/.opencode/commands/af-design-agent.md +15 -0
  37. package/.versions/0.0.8/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  38. package/.versions/0.0.8/.opencode/commands/af-orchestrate.md +112 -0
  39. package/.versions/0.0.8/.opencode/commands/af-plan.md +16 -0
  40. package/.versions/0.0.8/.opencode/commands/af-prime.md +22 -0
  41. package/.versions/0.0.8/.opencode/commands/af-review.md +15 -0
  42. package/.versions/0.0.8/.opencode/commands/af-set-hermes-telegram.md +15 -0
  43. package/.versions/0.0.8/.opencode/commands/af-set-hermes-watchdog.md +6 -0
  44. package/.versions/0.0.8/.opencode/commands/af-setup-agent-fleet.md +15 -0
  45. package/.versions/0.0.8/.opencode/commands/af-ship.md +16 -0
  46. package/.versions/0.0.8/.opencode/commands/af-spec.md +16 -0
  47. package/.versions/0.0.8/.opencode/commands/af-test.md +21 -0
  48. package/.versions/0.0.8/.opencode/commands/af-webperf.md +32 -0
  49. package/.versions/0.0.8/.opencode/orchestrate-teams.yaml +24 -0
  50. package/.versions/0.0.8/.pi/agents/dispatch-policy.yaml +32 -0
  51. package/.versions/0.0.8/.pi/agents/model-profiles.yaml +20 -0
  52. package/.versions/0.0.8/.pi/agents/peers.yaml +146 -0
  53. package/.versions/0.0.8/.pi/agents/teams.yaml +39 -0
  54. package/.versions/0.0.8/.pi/damage-control-rules.yaml +297 -0
  55. package/.versions/0.0.8/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  56. package/.versions/0.0.8/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  57. package/.versions/0.0.8/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  58. package/.versions/0.0.8/.pi/extensions/btw/README.md +118 -0
  59. package/.versions/0.0.8/.pi/extensions/btw/index.ts +917 -0
  60. package/.versions/0.0.8/.pi/extensions/btw/package.json +6 -0
  61. package/.versions/0.0.8/.pi/extensions/btw/state.js +179 -0
  62. package/.versions/0.0.8/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  63. package/.versions/0.0.8/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  64. package/.versions/0.0.8/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  65. package/.versions/0.0.8/.pi/extensions/compact-and-continue/README.md +42 -0
  66. package/.versions/0.0.8/.pi/extensions/compact-and-continue/index.ts +120 -0
  67. package/.versions/0.0.8/.pi/extensions/compact-and-continue/package.json +6 -0
  68. package/.versions/0.0.8/.pi/extensions/mcp-bridge/README.md +46 -0
  69. package/.versions/0.0.8/.pi/extensions/mcp-bridge/index.ts +206 -0
  70. package/.versions/0.0.8/.pi/extensions/mcp-bridge/package.json +6 -0
  71. package/.versions/0.0.8/.pi/extensions/package-lock.json +1143 -0
  72. package/.versions/0.0.8/.pi/extensions/package.json +9 -0
  73. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/README.md +201 -0
  74. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/config.ts +198 -0
  75. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  76. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/index.ts +248 -0
  77. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/package.json +6 -0
  78. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  79. package/.versions/0.0.8/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  80. package/.versions/0.0.8/.pi/harnesses/agent-hub/README.md +857 -0
  81. package/.versions/0.0.8/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  82. package/.versions/0.0.8/.pi/harnesses/agent-hub/artifacts.js +146 -0
  83. package/.versions/0.0.8/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  84. package/.versions/0.0.8/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  85. package/.versions/0.0.8/.pi/harnesses/agent-hub/context-window.js +106 -0
  86. package/.versions/0.0.8/.pi/harnesses/agent-hub/delegate.ts +435 -0
  87. package/.versions/0.0.8/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  88. package/.versions/0.0.8/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  89. package/.versions/0.0.8/.pi/harnesses/agent-hub/footer.ts +29 -0
  90. package/.versions/0.0.8/.pi/harnesses/agent-hub/helpers.ts +248 -0
  91. package/.versions/0.0.8/.pi/harnesses/agent-hub/index.ts +8609 -0
  92. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  93. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  94. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  95. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  96. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  97. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  98. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  99. package/.versions/0.0.8/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -0
  100. package/.versions/0.0.8/.pi/harnesses/agent-hub/package.json +7 -0
  101. package/.versions/0.0.8/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  102. package/.versions/0.0.8/.pi/harnesses/agent-hub/research-retention.js +34 -0
  103. package/.versions/0.0.8/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  104. package/.versions/0.0.8/.pi/harnesses/agent-hub/return-contract.js +293 -0
  105. package/.versions/0.0.8/.pi/harnesses/agent-hub/return-extract.js +75 -0
  106. package/.versions/0.0.8/.pi/harnesses/agent-hub/run-budget.js +181 -0
  107. package/.versions/0.0.8/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  108. package/.versions/0.0.8/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  109. package/.versions/0.0.8/.pi/harnesses/agent-hub/session-health.js +110 -0
  110. package/.versions/0.0.8/.pi/harnesses/agent-hub/spawn.ts +354 -0
  111. package/.versions/0.0.8/.pi/harnesses/agent-hub/version.ts +18 -0
  112. package/.versions/0.0.8/.pi/harnesses/ask-user-remote/README.md +19 -0
  113. package/.versions/0.0.8/.pi/harnesses/ask-user-remote/index.ts +321 -0
  114. package/.versions/0.0.8/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  115. package/.versions/0.0.8/.pi/harnesses/coms/README.md +93 -0
  116. package/.versions/0.0.8/.pi/harnesses/coms/index.ts +1767 -0
  117. package/.versions/0.0.8/.pi/harnesses/coms/package.json +7 -0
  118. package/.versions/0.0.8/.pi/harnesses/coms/version.ts +18 -0
  119. package/.versions/0.0.8/.pi/harnesses/damage-control-continue/README.md +117 -0
  120. package/.versions/0.0.8/.pi/harnesses/damage-control-continue/index.ts +536 -0
  121. package/.versions/0.0.8/.pi/harnesses/damage-control-continue/package.json +7 -0
  122. package/.versions/0.0.8/.pi/harnesses/damage-control-continue/version.ts +18 -0
  123. package/.versions/0.0.8/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  124. package/.versions/0.0.8/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  125. package/.versions/0.0.8/.pi/harnesses/lib/herdr-client.ts +463 -0
  126. package/.versions/0.0.8/.pi/harnesses/lib/herdr-presence.ts +399 -0
  127. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  128. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  129. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  130. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  131. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  132. package/.versions/0.0.8/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  133. package/.versions/0.0.8/.pi/harnesses/package-lock.json +35 -0
  134. package/.versions/0.0.8/.pi/harnesses/package.json +9 -0
  135. package/.versions/0.0.8/.pi/prompts/af-build.md +24 -0
  136. package/.versions/0.0.8/.pi/prompts/af-code-simplify.md +22 -0
  137. package/.versions/0.0.8/.pi/prompts/af-doctor-agent-fleet.md +15 -0
  138. package/.versions/0.0.8/.pi/prompts/af-plan.md +16 -0
  139. package/.versions/0.0.8/.pi/prompts/af-review.md +16 -0
  140. package/.versions/0.0.8/.pi/prompts/af-set-hermes-telegram.md +15 -0
  141. package/.versions/0.0.8/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  142. package/.versions/0.0.8/.pi/prompts/af-setup-agent-fleet.md +27 -0
  143. package/.versions/0.0.8/.pi/prompts/af-ship.md +17 -0
  144. package/.versions/0.0.8/.pi/prompts/af-spec.md +15 -0
  145. package/.versions/0.0.8/.pi/prompts/af-test.md +19 -0
  146. package/.versions/0.0.8/.pi/skills/bowser/SKILL.md +145 -0
  147. package/.versions/0.0.8/.version +1 -0
  148. package/.versions/0.0.8/agents/architect.md +23 -0
  149. package/.versions/0.0.8/agents/bowser.md +26 -0
  150. package/.versions/0.0.8/agents/builder.md +53 -0
  151. package/.versions/0.0.8/agents/code-reviewer.md +205 -0
  152. package/.versions/0.0.8/agents/deep-researcher.md +31 -0
  153. package/.versions/0.0.8/agents/documenter.md +18 -0
  154. package/.versions/0.0.8/agents/orchestrator.md +65 -0
  155. package/.versions/0.0.8/agents/plan-reviewer.md +60 -0
  156. package/.versions/0.0.8/agents/planner.md +69 -0
  157. package/.versions/0.0.8/agents/releaser.md +24 -0
  158. package/.versions/0.0.8/agents/researcher.md +28 -0
  159. package/.versions/0.0.8/agents/security-auditor.md +166 -0
  160. package/.versions/0.0.8/agents/test-engineer.md +151 -0
  161. package/.versions/0.0.8/agents/web-debugger.md +42 -0
  162. package/.versions/0.0.8/agents/web-performance-auditor.md +192 -0
  163. package/.versions/0.0.8/codex/CONDUCTOR.md +148 -0
  164. package/.versions/0.0.8/docs/ARCHITECTURE.md +262 -0
  165. package/.versions/0.0.8/docs/agent-fleet-setup.md +366 -0
  166. package/.versions/0.0.8/docs/claude-code-coms-bridge.md +109 -0
  167. package/.versions/0.0.8/docs/codex-remote-conductor.md +170 -0
  168. package/.versions/0.0.8/docs/coms-hermes-bridge.md +189 -0
  169. package/.versions/0.0.8/docs/getting-started.md +231 -0
  170. package/.versions/0.0.8/docs/npm-install.md +337 -0
  171. package/.versions/0.0.8/docs/opencode-setup.md +249 -0
  172. package/.versions/0.0.8/docs/pi-extensions.md +293 -0
  173. package/.versions/0.0.8/docs/pi-setup.md +476 -0
  174. package/.versions/0.0.8/docs/skill-anatomy.md +150 -0
  175. package/.versions/0.0.8/hermes/README.md +347 -0
  176. package/.versions/0.0.8/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  177. package/.versions/0.0.8/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  178. package/.versions/0.0.8/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  179. package/.versions/0.0.8/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  180. package/.versions/0.0.8/hermes/gates/gate-o-capability.md +8 -0
  181. package/.versions/0.0.8/hermes/gates/gate-o-validator-fixtures.json +1 -0
  182. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  183. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  184. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  185. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  186. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  187. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  188. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  189. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  190. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  191. package/.versions/0.0.8/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  192. package/.versions/0.0.8/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  193. package/.versions/0.0.8/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  194. package/.versions/0.0.8/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  195. package/.versions/0.0.8/hermes/skills/hub-conductor/SKILL.md +84 -0
  196. package/.versions/0.0.8/hermes/skills/hub-liaison/SKILL.md +84 -0
  197. package/.versions/0.0.8/hermes/skills/hub-watchdog/SKILL.md +76 -0
  198. package/.versions/0.0.8/hermes/skills/hub-watchdog/manifest.json +1 -0
  199. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  200. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  201. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  202. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  203. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  204. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  205. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  206. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  207. package/.versions/0.0.8/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  208. package/.versions/0.0.8/hermes/watchdog-tests/__init__.py +0 -0
  209. package/.versions/0.0.8/hooks/SIMPLIFY-IGNORE.md +90 -0
  210. package/.versions/0.0.8/hooks/coms-stop-hook.mjs +84 -0
  211. package/.versions/0.0.8/hooks/hooks.json +14 -0
  212. package/.versions/0.0.8/hooks/session-start.sh +74 -0
  213. package/.versions/0.0.8/hooks/simplify-ignore.sh +302 -0
  214. package/.versions/0.0.8/justfile +245 -0
  215. package/.versions/0.0.8/references/accessibility-checklist.md +160 -0
  216. package/.versions/0.0.8/references/definition-of-done.md +67 -0
  217. package/.versions/0.0.8/references/fleet-coordination-patterns.md +151 -0
  218. package/.versions/0.0.8/references/observability-checklist.md +91 -0
  219. package/.versions/0.0.8/references/orchestration-patterns.md +370 -0
  220. package/.versions/0.0.8/references/performance-checklist.md +153 -0
  221. package/.versions/0.0.8/references/prompting-patterns.md +380 -0
  222. package/.versions/0.0.8/references/security-checklist.md +179 -0
  223. package/.versions/0.0.8/references/testing-patterns.md +236 -0
  224. package/.versions/0.0.8/scripts/codex-conductor.ts +41 -0
  225. package/.versions/0.0.8/scripts/codex-remote-control.ts +167 -0
  226. package/.versions/0.0.8/scripts/coms-claude-bridge.ts +401 -0
  227. package/.versions/0.0.8/scripts/coms-cli.ts +484 -0
  228. package/.versions/0.0.8/scripts/coms-hermes-bridge.ts +413 -0
  229. package/.versions/0.0.8/scripts/fleet.ts +149 -0
  230. package/.versions/0.0.8/scripts/hermes-monitor-capability-runner.ts +25 -0
  231. package/.versions/0.0.8/scripts/hermes-monitor-scenario.ts +474 -0
  232. package/.versions/0.0.8/scripts/hermes-watchdog-capability-probe.ts +45 -0
  233. package/.versions/0.0.8/scripts/install-hermes-plugin.sh +180 -0
  234. package/.versions/0.0.8/scripts/lib/claude-bridge-core.ts +165 -0
  235. package/.versions/0.0.8/scripts/lib/codex-conductor.ts +88 -0
  236. package/.versions/0.0.8/scripts/lib/codex-remote-control.ts +480 -0
  237. package/.versions/0.0.8/scripts/lib/coms-envelope.ts +582 -0
  238. package/.versions/0.0.8/scripts/lib/fake-herdr-server.ts +88 -0
  239. package/.versions/0.0.8/scripts/lib/fleet-command.ts +109 -0
  240. package/.versions/0.0.8/scripts/lib/herdr-layout.ts +263 -0
  241. package/.versions/0.0.8/scripts/lib/hermes-bridge-core.ts +241 -0
  242. package/.versions/0.0.8/scripts/lib/hermes-monitor-events.ts +1 -0
  243. package/.versions/0.0.8/scripts/lib/hermes-monitor-herdr.ts +2 -0
  244. package/.versions/0.0.8/scripts/lib/hermes-monitor-model.ts +3 -0
  245. package/.versions/0.0.8/scripts/lib/hermes-monitor-registry.ts +2 -0
  246. package/.versions/0.0.8/scripts/lib/hermes-monitor-socket.ts +2 -0
  247. package/.versions/0.0.8/scripts/lib/hermes-monitor-store.ts +2 -0
  248. package/.versions/0.0.8/scripts/lib/monitor-env.ts +120 -0
  249. package/.versions/0.0.8/scripts/lib/persona-banner.ts +62 -0
  250. package/.versions/0.0.8/scripts/lib/spawn-stagger.ts +101 -0
  251. package/.versions/0.0.8/scripts/lib/team-project.ts +191 -0
  252. package/.versions/0.0.8/scripts/lib/team-snapshot.ts +147 -0
  253. package/.versions/0.0.8/scripts/peer-banner.ts +40 -0
  254. package/.versions/0.0.8/scripts/team-snapshot.ts +237 -0
  255. package/.versions/0.0.8/scripts/team-up.ts +360 -0
  256. package/.versions/0.0.8/skills/_internal/grilling.md +11 -0
  257. package/.versions/0.0.8/skills/browser-testing-with-devtools/SKILL.md +352 -0
  258. package/.versions/0.0.8/skills/code-review-and-quality/SKILL.md +381 -0
  259. package/.versions/0.0.8/skills/compound-learning/SKILL.md +137 -0
  260. package/.versions/0.0.8/skills/context-engineering/SKILL.md +291 -0
  261. package/.versions/0.0.8/skills/deprecation-and-migration/SKILL.md +206 -0
  262. package/.versions/0.0.8/skills/designing-agents/SKILL.md +394 -0
  263. package/.versions/0.0.8/skills/designing-agents/pi-harness-authoring.md +222 -0
  264. package/.versions/0.0.8/skills/frontend-ui-engineering/SKILL.md +328 -0
  265. package/.versions/0.0.8/skills/git-workflow-and-versioning/SKILL.md +316 -0
  266. package/.versions/0.0.8/skills/guided-workspace-setup/SKILL.md +544 -0
  267. package/.versions/0.0.8/skills/guided-workspace-setup/companion-manifest.json +36 -0
  268. package/.versions/0.0.8/skills/idea-refine/SKILL.md +182 -0
  269. package/.versions/0.0.8/skills/idea-refine/examples.md +238 -0
  270. package/.versions/0.0.8/skills/idea-refine/frameworks.md +99 -0
  271. package/.versions/0.0.8/skills/idea-refine/refinement-criteria.md +113 -0
  272. package/.versions/0.0.8/skills/idea-refine/scripts/idea-refine.sh +15 -0
  273. package/.versions/0.0.8/skills/incremental-implementation/SKILL.md +287 -0
  274. package/.versions/0.0.8/skills/interview-me/SKILL.md +226 -0
  275. package/.versions/0.0.8/skills/orchestration-verification/SKILL.md +181 -0
  276. package/.versions/0.0.8/skills/peer-coms/SKILL.md +90 -0
  277. package/.versions/0.0.8/skills/performance-optimization/SKILL.md +350 -0
  278. package/.versions/0.0.8/skills/planning-and-task-breakdown/SKILL.md +236 -0
  279. package/.versions/0.0.8/skills/security-and-hardening/SKILL.md +461 -0
  280. package/.versions/0.0.8/skills/spec-driven-development/SKILL.md +245 -0
  281. package/.versions/0.0.8/skills/using-agent-skills/SKILL.md +199 -0
  282. package/.versions/0.0.8/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  283. package/.versions/0.0.8/vendor/agent-skills-upstream/LICENSE +21 -0
  284. package/.versions/0.0.8/vendor/agent-skills-upstream/README.md +11 -0
  285. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  286. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  287. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  288. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  289. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  290. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  291. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  292. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  293. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  294. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  295. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  296. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  297. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  298. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  299. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  300. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  301. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  302. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  303. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  304. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  305. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  306. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  307. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  308. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  309. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  310. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  311. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  312. package/.versions/0.0.8/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  313. package/.versions/0.0.9/.claude/commands/build.md +44 -0
  314. package/.versions/0.0.9/.claude/commands/code-simplify.md +22 -0
  315. package/.versions/0.0.9/.claude/commands/design-agent.md +14 -0
  316. package/.versions/0.0.9/.claude/commands/doctor-agent-fleet.md +17 -0
  317. package/.versions/0.0.9/.claude/commands/orchestrate.md +112 -0
  318. package/.versions/0.0.9/.claude/commands/plan.md +16 -0
  319. package/.versions/0.0.9/.claude/commands/prime.md +22 -0
  320. package/.versions/0.0.9/.claude/commands/review.md +16 -0
  321. package/.versions/0.0.9/.claude/commands/set-hermes-telegram.md +15 -0
  322. package/.versions/0.0.9/.claude/commands/set-hermes-watchdog.md +6 -0
  323. package/.versions/0.0.9/.claude/commands/setup-agent-fleet.md +25 -0
  324. package/.versions/0.0.9/.claude/commands/ship.md +72 -0
  325. package/.versions/0.0.9/.claude/commands/spec.md +15 -0
  326. package/.versions/0.0.9/.claude/commands/test.md +19 -0
  327. package/.versions/0.0.9/.claude/commands/webperf.md +32 -0
  328. package/.versions/0.0.9/.claude/orchestrate-teams.yaml +24 -0
  329. package/.versions/0.0.9/.opencode/commands/af-build.md +17 -0
  330. package/.versions/0.0.9/.opencode/commands/af-code-simplify.md +16 -0
  331. package/.versions/0.0.9/.opencode/commands/af-compound.md +16 -0
  332. package/.versions/0.0.9/.opencode/commands/af-design-agent.md +15 -0
  333. package/.versions/0.0.9/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  334. package/.versions/0.0.9/.opencode/commands/af-orchestrate.md +112 -0
  335. package/.versions/0.0.9/.opencode/commands/af-plan.md +16 -0
  336. package/.versions/0.0.9/.opencode/commands/af-prime.md +22 -0
  337. package/.versions/0.0.9/.opencode/commands/af-review.md +15 -0
  338. package/.versions/0.0.9/.opencode/commands/af-set-hermes-telegram.md +15 -0
  339. package/.versions/0.0.9/.opencode/commands/af-set-hermes-watchdog.md +6 -0
  340. package/.versions/0.0.9/.opencode/commands/af-setup-agent-fleet.md +15 -0
  341. package/.versions/0.0.9/.opencode/commands/af-ship.md +16 -0
  342. package/.versions/0.0.9/.opencode/commands/af-spec.md +16 -0
  343. package/.versions/0.0.9/.opencode/commands/af-test.md +21 -0
  344. package/.versions/0.0.9/.opencode/commands/af-webperf.md +32 -0
  345. package/.versions/0.0.9/.opencode/orchestrate-teams.yaml +24 -0
  346. package/.versions/0.0.9/.pi/agents/dispatch-policy.yaml +32 -0
  347. package/.versions/0.0.9/.pi/agents/model-profiles.yaml +27 -0
  348. package/.versions/0.0.9/.pi/agents/peers.yaml +142 -0
  349. package/.versions/0.0.9/.pi/agents/teams.yaml +41 -0
  350. package/.versions/0.0.9/.pi/damage-control-rules.yaml +297 -0
  351. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  352. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  353. package/.versions/0.0.9/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  354. package/.versions/0.0.9/.pi/extensions/btw/README.md +118 -0
  355. package/.versions/0.0.9/.pi/extensions/btw/index.ts +917 -0
  356. package/.versions/0.0.9/.pi/extensions/btw/package.json +6 -0
  357. package/.versions/0.0.9/.pi/extensions/btw/state.js +179 -0
  358. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  359. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  360. package/.versions/0.0.9/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  361. package/.versions/0.0.9/.pi/extensions/compact-and-continue/README.md +42 -0
  362. package/.versions/0.0.9/.pi/extensions/compact-and-continue/index.ts +120 -0
  363. package/.versions/0.0.9/.pi/extensions/compact-and-continue/package.json +6 -0
  364. package/.versions/0.0.9/.pi/extensions/mcp-bridge/README.md +46 -0
  365. package/.versions/0.0.9/.pi/extensions/mcp-bridge/index.ts +206 -0
  366. package/.versions/0.0.9/.pi/extensions/mcp-bridge/package.json +6 -0
  367. package/.versions/0.0.9/.pi/extensions/package-lock.json +1143 -0
  368. package/.versions/0.0.9/.pi/extensions/package.json +9 -0
  369. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/README.md +201 -0
  370. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/config.ts +198 -0
  371. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  372. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/index.ts +248 -0
  373. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/package.json +6 -0
  374. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  375. package/.versions/0.0.9/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  376. package/.versions/0.0.9/.pi/harnesses/agent-hub/README.md +872 -0
  377. package/.versions/0.0.9/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  378. package/.versions/0.0.9/.pi/harnesses/agent-hub/artifacts.js +146 -0
  379. package/.versions/0.0.9/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  380. package/.versions/0.0.9/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  381. package/.versions/0.0.9/.pi/harnesses/agent-hub/context-window.js +106 -0
  382. package/.versions/0.0.9/.pi/harnesses/agent-hub/delegate.ts +435 -0
  383. package/.versions/0.0.9/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  384. package/.versions/0.0.9/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  385. package/.versions/0.0.9/.pi/harnesses/agent-hub/footer.ts +31 -0
  386. package/.versions/0.0.9/.pi/harnesses/agent-hub/helpers.ts +248 -0
  387. package/.versions/0.0.9/.pi/harnesses/agent-hub/index.ts +8702 -0
  388. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  389. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  390. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  391. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  392. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  393. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  394. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  395. package/.versions/0.0.9/.pi/harnesses/agent-hub/monitor-session-bridge.ts +257 -0
  396. package/.versions/0.0.9/.pi/harnesses/agent-hub/package.json +7 -0
  397. package/.versions/0.0.9/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  398. package/.versions/0.0.9/.pi/harnesses/agent-hub/research-retention.js +34 -0
  399. package/.versions/0.0.9/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  400. package/.versions/0.0.9/.pi/harnesses/agent-hub/return-contract.js +293 -0
  401. package/.versions/0.0.9/.pi/harnesses/agent-hub/return-extract.js +75 -0
  402. package/.versions/0.0.9/.pi/harnesses/agent-hub/run-budget.js +181 -0
  403. package/.versions/0.0.9/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  404. package/.versions/0.0.9/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  405. package/.versions/0.0.9/.pi/harnesses/agent-hub/session-health.js +110 -0
  406. package/.versions/0.0.9/.pi/harnesses/agent-hub/spawn.ts +354 -0
  407. package/.versions/0.0.9/.pi/harnesses/agent-hub/version.ts +42 -0
  408. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/README.md +19 -0
  409. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/index.ts +321 -0
  410. package/.versions/0.0.9/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  411. package/.versions/0.0.9/.pi/harnesses/coms/README.md +100 -0
  412. package/.versions/0.0.9/.pi/harnesses/coms/index.ts +1767 -0
  413. package/.versions/0.0.9/.pi/harnesses/coms/package.json +7 -0
  414. package/.versions/0.0.9/.pi/harnesses/coms/version.ts +42 -0
  415. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/README.md +124 -0
  416. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/index.ts +536 -0
  417. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/package.json +7 -0
  418. package/.versions/0.0.9/.pi/harnesses/damage-control-continue/version.ts +42 -0
  419. package/.versions/0.0.9/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  420. package/.versions/0.0.9/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  421. package/.versions/0.0.9/.pi/harnesses/lib/herdr-client.ts +472 -0
  422. package/.versions/0.0.9/.pi/harnesses/lib/herdr-presence.ts +399 -0
  423. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  424. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  425. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  426. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  427. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  428. package/.versions/0.0.9/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  429. package/.versions/0.0.9/.pi/harnesses/lib/spawned-peers.js +190 -0
  430. package/.versions/0.0.9/.pi/harnesses/package-lock.json +35 -0
  431. package/.versions/0.0.9/.pi/harnesses/package.json +9 -0
  432. package/.versions/0.0.9/.pi/prompts/af-build.md +24 -0
  433. package/.versions/0.0.9/.pi/prompts/af-code-simplify.md +22 -0
  434. package/.versions/0.0.9/.pi/prompts/af-doctor-agent-fleet.md +15 -0
  435. package/.versions/0.0.9/.pi/prompts/af-plan.md +16 -0
  436. package/.versions/0.0.9/.pi/prompts/af-review.md +16 -0
  437. package/.versions/0.0.9/.pi/prompts/af-set-hermes-telegram.md +15 -0
  438. package/.versions/0.0.9/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  439. package/.versions/0.0.9/.pi/prompts/af-setup-agent-fleet.md +27 -0
  440. package/.versions/0.0.9/.pi/prompts/af-ship.md +17 -0
  441. package/.versions/0.0.9/.pi/prompts/af-spec.md +15 -0
  442. package/.versions/0.0.9/.pi/prompts/af-test.md +19 -0
  443. package/.versions/0.0.9/.pi/skills/bowser/SKILL.md +145 -0
  444. package/.versions/0.0.9/.version +1 -0
  445. package/.versions/0.0.9/agents/architect.md +24 -0
  446. package/.versions/0.0.9/agents/bowser.md +27 -0
  447. package/.versions/0.0.9/agents/builder.md +54 -0
  448. package/.versions/0.0.9/agents/code-reviewer.md +204 -0
  449. package/.versions/0.0.9/agents/deep-researcher.md +32 -0
  450. package/.versions/0.0.9/agents/documenter.md +18 -0
  451. package/.versions/0.0.9/agents/orchestrator.md +66 -0
  452. package/.versions/0.0.9/agents/plan-reviewer.md +62 -0
  453. package/.versions/0.0.9/agents/planner.md +70 -0
  454. package/.versions/0.0.9/agents/releaser.md +24 -0
  455. package/.versions/0.0.9/agents/researcher.md +28 -0
  456. package/.versions/0.0.9/agents/security-auditor.md +167 -0
  457. package/.versions/0.0.9/agents/test-engineer.md +153 -0
  458. package/.versions/0.0.9/agents/web-debugger.md +43 -0
  459. package/.versions/0.0.9/agents/web-performance-auditor.md +193 -0
  460. package/.versions/0.0.9/codex/CONDUCTOR.md +148 -0
  461. package/.versions/0.0.9/docs/ARCHITECTURE.md +262 -0
  462. package/.versions/0.0.9/docs/agent-fleet-setup.md +366 -0
  463. package/.versions/0.0.9/docs/claude-code-coms-bridge.md +109 -0
  464. package/.versions/0.0.9/docs/codex-remote-conductor.md +170 -0
  465. package/.versions/0.0.9/docs/coms-hermes-bridge.md +189 -0
  466. package/.versions/0.0.9/docs/getting-started.md +231 -0
  467. package/.versions/0.0.9/docs/npm-install.md +337 -0
  468. package/.versions/0.0.9/docs/opencode-setup.md +249 -0
  469. package/.versions/0.0.9/docs/pi-extensions.md +356 -0
  470. package/.versions/0.0.9/docs/pi-setup.md +476 -0
  471. package/.versions/0.0.9/docs/skill-anatomy.md +150 -0
  472. package/.versions/0.0.9/hermes/README.md +347 -0
  473. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  474. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  475. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  476. package/.versions/0.0.9/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  477. package/.versions/0.0.9/hermes/gates/gate-o-capability.md +8 -0
  478. package/.versions/0.0.9/hermes/gates/gate-o-validator-fixtures.json +1 -0
  479. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  480. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  481. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  482. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  483. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  484. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  485. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  486. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  487. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  488. package/.versions/0.0.9/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  489. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  490. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  491. package/.versions/0.0.9/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  492. package/.versions/0.0.9/hermes/skills/hub-conductor/SKILL.md +84 -0
  493. package/.versions/0.0.9/hermes/skills/hub-liaison/SKILL.md +84 -0
  494. package/.versions/0.0.9/hermes/skills/hub-watchdog/SKILL.md +76 -0
  495. package/.versions/0.0.9/hermes/skills/hub-watchdog/manifest.json +1 -0
  496. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  497. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  498. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  499. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  500. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  501. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  502. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  503. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  504. package/.versions/0.0.9/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  505. package/.versions/0.0.9/hermes/watchdog-tests/__init__.py +0 -0
  506. package/.versions/0.0.9/hooks/SIMPLIFY-IGNORE.md +90 -0
  507. package/.versions/0.0.9/hooks/coms-stop-hook.mjs +84 -0
  508. package/.versions/0.0.9/hooks/hooks.json +14 -0
  509. package/.versions/0.0.9/hooks/session-start.sh +74 -0
  510. package/.versions/0.0.9/hooks/simplify-ignore.sh +302 -0
  511. package/.versions/0.0.9/justfile +254 -0
  512. package/.versions/0.0.9/references/accessibility-checklist.md +160 -0
  513. package/.versions/0.0.9/references/definition-of-done.md +67 -0
  514. package/.versions/0.0.9/references/fleet-coordination-patterns.md +151 -0
  515. package/.versions/0.0.9/references/observability-checklist.md +91 -0
  516. package/.versions/0.0.9/references/orchestration-patterns.md +370 -0
  517. package/.versions/0.0.9/references/performance-checklist.md +153 -0
  518. package/.versions/0.0.9/references/prompting-patterns.md +380 -0
  519. package/.versions/0.0.9/references/security-checklist.md +179 -0
  520. package/.versions/0.0.9/references/testing-patterns.md +236 -0
  521. package/.versions/0.0.9/scripts/codex-conductor.ts +41 -0
  522. package/.versions/0.0.9/scripts/codex-remote-control.ts +167 -0
  523. package/.versions/0.0.9/scripts/coms-claude-bridge.ts +401 -0
  524. package/.versions/0.0.9/scripts/coms-cli.ts +484 -0
  525. package/.versions/0.0.9/scripts/coms-hermes-bridge.ts +413 -0
  526. package/.versions/0.0.9/scripts/fleet.ts +168 -0
  527. package/.versions/0.0.9/scripts/hermes-monitor-capability-runner.ts +25 -0
  528. package/.versions/0.0.9/scripts/hermes-monitor-scenario.ts +474 -0
  529. package/.versions/0.0.9/scripts/hermes-watchdog-capability-probe.ts +45 -0
  530. package/.versions/0.0.9/scripts/install-hermes-plugin.sh +180 -0
  531. package/.versions/0.0.9/scripts/lib/claude-bridge-core.ts +165 -0
  532. package/.versions/0.0.9/scripts/lib/codex-conductor.ts +88 -0
  533. package/.versions/0.0.9/scripts/lib/codex-remote-control.ts +480 -0
  534. package/.versions/0.0.9/scripts/lib/coms-envelope.ts +582 -0
  535. package/.versions/0.0.9/scripts/lib/fake-herdr-server.ts +88 -0
  536. package/.versions/0.0.9/scripts/lib/fleet-command.ts +111 -0
  537. package/.versions/0.0.9/scripts/lib/herdr-layout.ts +281 -0
  538. package/.versions/0.0.9/scripts/lib/hermes-bridge-core.ts +241 -0
  539. package/.versions/0.0.9/scripts/lib/hermes-monitor-events.ts +1 -0
  540. package/.versions/0.0.9/scripts/lib/hermes-monitor-herdr.ts +2 -0
  541. package/.versions/0.0.9/scripts/lib/hermes-monitor-model.ts +3 -0
  542. package/.versions/0.0.9/scripts/lib/hermes-monitor-registry.ts +2 -0
  543. package/.versions/0.0.9/scripts/lib/hermes-monitor-socket.ts +2 -0
  544. package/.versions/0.0.9/scripts/lib/hermes-monitor-store.ts +2 -0
  545. package/.versions/0.0.9/scripts/lib/monitor-env.ts +120 -0
  546. package/.versions/0.0.9/scripts/lib/peer-launch.ts +314 -0
  547. package/.versions/0.0.9/scripts/lib/persona-banner.ts +62 -0
  548. package/.versions/0.0.9/scripts/lib/spawn-stagger.ts +101 -0
  549. package/.versions/0.0.9/scripts/lib/team-project.ts +193 -0
  550. package/.versions/0.0.9/scripts/lib/team-snapshot.ts +147 -0
  551. package/.versions/0.0.9/scripts/peer-banner.ts +40 -0
  552. package/.versions/0.0.9/scripts/peer-launch.ts +259 -0
  553. package/.versions/0.0.9/scripts/team-snapshot.ts +237 -0
  554. package/.versions/0.0.9/scripts/team-up.ts +360 -0
  555. package/.versions/0.0.9/skills/_internal/grilling.md +11 -0
  556. package/.versions/0.0.9/skills/browser-testing-with-devtools/SKILL.md +352 -0
  557. package/.versions/0.0.9/skills/code-review-and-quality/SKILL.md +381 -0
  558. package/.versions/0.0.9/skills/compound-learning/SKILL.md +137 -0
  559. package/.versions/0.0.9/skills/context-engineering/SKILL.md +291 -0
  560. package/.versions/0.0.9/skills/deprecation-and-migration/SKILL.md +206 -0
  561. package/.versions/0.0.9/skills/designing-agents/SKILL.md +394 -0
  562. package/.versions/0.0.9/skills/designing-agents/pi-harness-authoring.md +222 -0
  563. package/.versions/0.0.9/skills/frontend-ui-engineering/SKILL.md +328 -0
  564. package/.versions/0.0.9/skills/git-workflow-and-versioning/SKILL.md +316 -0
  565. package/.versions/0.0.9/skills/guided-workspace-setup/SKILL.md +544 -0
  566. package/.versions/0.0.9/skills/guided-workspace-setup/companion-manifest.json +38 -0
  567. package/.versions/0.0.9/skills/idea-refine/SKILL.md +182 -0
  568. package/.versions/0.0.9/skills/idea-refine/examples.md +238 -0
  569. package/.versions/0.0.9/skills/idea-refine/frameworks.md +99 -0
  570. package/.versions/0.0.9/skills/idea-refine/refinement-criteria.md +113 -0
  571. package/.versions/0.0.9/skills/idea-refine/scripts/idea-refine.sh +15 -0
  572. package/.versions/0.0.9/skills/incremental-implementation/SKILL.md +287 -0
  573. package/.versions/0.0.9/skills/interview-me/SKILL.md +226 -0
  574. package/.versions/0.0.9/skills/orchestration-verification/SKILL.md +181 -0
  575. package/.versions/0.0.9/skills/peer-coms/SKILL.md +90 -0
  576. package/.versions/0.0.9/skills/performance-optimization/SKILL.md +350 -0
  577. package/.versions/0.0.9/skills/planning-and-task-breakdown/SKILL.md +236 -0
  578. package/.versions/0.0.9/skills/security-and-hardening/SKILL.md +461 -0
  579. package/.versions/0.0.9/skills/spec-driven-development/SKILL.md +245 -0
  580. package/.versions/0.0.9/skills/using-agent-skills/SKILL.md +199 -0
  581. package/.versions/0.0.9/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  582. package/.versions/0.0.9/vendor/agent-skills-upstream/LICENSE +21 -0
  583. package/.versions/0.0.9/vendor/agent-skills-upstream/README.md +11 -0
  584. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  585. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  586. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  587. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  588. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  589. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  590. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  591. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  592. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  593. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  594. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  595. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  596. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  597. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  598. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  599. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  600. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  601. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  602. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  603. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  604. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  605. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  606. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  607. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  608. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  609. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  610. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  611. package/.versions/0.0.9/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  612. package/CHANGELOG.md +44 -0
  613. package/agents/architect.md +1 -0
  614. package/agents/bowser.md +1 -0
  615. package/agents/builder.md +1 -0
  616. package/agents/code-reviewer.md +4 -5
  617. package/agents/deep-researcher.md +2 -1
  618. package/agents/orchestrator.md +1 -0
  619. package/agents/plan-reviewer.md +3 -1
  620. package/agents/planner.md +3 -2
  621. package/agents/security-auditor.md +1 -0
  622. package/agents/test-engineer.md +3 -1
  623. package/agents/web-debugger.md +1 -0
  624. package/agents/web-performance-auditor.md +1 -0
  625. package/docs/ARCHITECTURE.md +1 -1
  626. package/docs/pi-extensions.md +66 -3
  627. package/justfile +10 -1
  628. package/package.json +2 -2
  629. package/scripts/fleet.ts +22 -3
  630. package/scripts/lib/fleet-command.ts +5 -3
  631. package/scripts/lib/herdr-layout.ts +18 -0
  632. package/scripts/lib/peer-launch.ts +314 -0
  633. package/scripts/lib/team-project.ts +3 -1
  634. package/scripts/peer-launch.ts +259 -0
  635. package/skills/guided-workspace-setup/companion-manifest.json +3 -0
  636. /package/{.pi → .versions/0.0.8/.pi}/harnesses/agent-hub/spawned-peers.js +0 -0
@@ -0,0 +1,435 @@
1
+ /**
2
+ * delegate — the injected extension that gives an agent-hub specialist a
3
+ * mid-turn `delegate(role, instruction, context?, allow_write?)` tool.
4
+ *
5
+ * The hub adds `-e delegate.ts` (plus `delegate` in the child's `--tools`
6
+ * allowlist — pi's allowlist applies to extension tools too) when a dispatched
7
+ * persona declares `subagents:` in its frontmatter. Everything this extension
8
+ * may spawn comes from AGENT_HUB_DELEGATE_CONFIG (JSON, serialized by the
9
+ * hub): the declared sub-roles and their models, the remaining depth budget,
10
+ * the tree-wide remaining spawn budget, and the event directory. The child
11
+ * process NEVER re-parses persona files — model choice is configuration, not
12
+ * the LLM's whim.
13
+ *
14
+ * Budgets (readable refusals, never silent):
15
+ * - tree-wide spawn budget: at most 4 delegate children per dispatch
16
+ * - depth budget: each child receives `depth − 1`; the hub normally omits
17
+ * delegate tooling from children at remaining depth 0, so a persona with
18
+ * `delegate_depth: 1` (the default and max) can spawn terminal children
19
+ *
20
+ * Write safety: a child is read-only (read,grep,find,ls) unless it is the ONLY
21
+ * live child and the parent passed `allow_write: true` — then it inherits the
22
+ * parent's tools, intersected with the role's declared `tools:` cap when one
23
+ * exists. Concurrent children are always forced read-only (two agents editing
24
+ * the same files is not solvable with guardrails).
25
+ *
26
+ * Observability: every spawn/timeline/usage/exit is appended as JSONL to
27
+ * `<eventDir>/events.jsonl`. The hub watches that file and renders children as
28
+ * nested rows under the parent's grid card (openable via /af-zoom). Kill cascade:
29
+ * children are spawned in THIS process's group (the hub spawns specialists
30
+ * detached), so `/af-agents-kill` on the parent SIGTERMs the whole tree; a
31
+ * SIGTERM trap forwards to live children as a fallback.
32
+ */
33
+
34
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
35
+ import { Type } from "@sinclair/typebox";
36
+ import { appendFileSync, mkdirSync, writeFileSync } from "fs";
37
+ import type { ChildProcess } from "child_process";
38
+ import { spawnPiAgentWithModelFallback, killPiTree } from "./spawn.ts";
39
+ import { DEFAULT_PROVIDER_LIMITS, createProviderSemaphore, parseProviderLimits } from "./provider-semaphore.js";
40
+ import {
41
+ delegateBudgetRefusal,
42
+ DELEGATE_TREE_SPAWN_BUDGET,
43
+ isReadOnlyToolList,
44
+ normalizeDelegateRuntimeBudgets,
45
+ planDelegateSpawn,
46
+ resolveDelegateTools,
47
+ safeAgentKey,
48
+ safePathWithin,
49
+ } from "./helpers.ts";
50
+
51
+ const DEFAULT_CALL_BUDGET = DELEGATE_TREE_SPAWN_BUDGET;
52
+ const RESULT_CAP = 2000;
53
+ const DIGEST_MAX_LINES = 30;
54
+ // How often buffered text/thinking deltas are flushed into the event file.
55
+ const TIMELINE_FLUSH_MS = 700;
56
+
57
+ // Serialized by the hub into AGENT_HUB_DELEGATE_CONFIG. `tag` is this
58
+ // process's node id in the delegation tree ("root" for the specialist itself);
59
+ // nested delegate.ts instances get their child id as tag, so every event line
60
+ // carries an unambiguous parent chain.
61
+ export interface DelegateConfig {
62
+ persona: string;
63
+ tag: string;
64
+ roles: Record<string, { model: string; tools?: string; fallbackModel?: string }>;
65
+ depth: number;
66
+ callBudget: number;
67
+ remainingSpawns?: number;
68
+ parentTools: string;
69
+ personaPrompt: string;
70
+ eventDir: string;
71
+ damageControl?: string;
72
+ delegateExt: string;
73
+ /** Parent-side per-tool deadline inherited by every terminal child. */
74
+ reconSearchTimeoutMs?: number | null;
75
+ /** Whole-run deadline per delegate child (hub mode budget); null/absent = off. */
76
+ turnDeadlineMs?: number | null;
77
+ cwd: string;
78
+ }
79
+
80
+ // Appended to every child's system prompt so it knows its place in the tree
81
+ // and reports tersely (its full report returns through the tool result, which
82
+ // lands in the parent's context).
83
+ function subagentProtocol(persona: string, role: string, canDelegate: boolean): string {
84
+ return `
85
+
86
+ ## You are the "${role}" sub-agent of a ${persona} specialist
87
+ Your parent delegated ONE specific task to you. Do exactly that task — do not
88
+ widen scope, do not start unrelated work. Your full output is written to a result
89
+ file, but your parent receives only a compact digest. End your final message with
90
+ a \`DIGEST:\` section of no more than 30 lines, self-contained, with path:line
91
+ citations where relevant. Put the most important findings and next actions there.${canDelegate ? `
92
+ You may delegate narrow sub-tasks further via your own delegate tool, within
93
+ its declared roles and remaining tree budget.` : `
94
+ You CANNOT delegate further — your remaining depth is 0, so this child has no
95
+ delegate tooling. Do the work yourself with the tools you have.`}`;
96
+ }
97
+
98
+ function childResultDigest(output: string, resultPath: string): { text: string; hasDigest: boolean } {
99
+ const lines = String(output || "").split(/\r?\n/);
100
+ const marker = lines.map(l => l.trim()).findIndex(l => /^DIGEST:\s*$/i.test(l));
101
+ if (marker >= 0) {
102
+ const digestLines = lines.slice(marker, marker + DIGEST_MAX_LINES);
103
+ return {
104
+ text: capInline(`${digestLines.join("\n")}\n\nFull output: ${resultPath}\nRead the result file only if this digest is insufficient.`),
105
+ hasDigest: true,
106
+ };
107
+ }
108
+ const fallback = lines.slice(0, DIGEST_MAX_LINES).join("\n");
109
+ return {
110
+ text: capInline(`${fallback}\n\n[no DIGEST section — full output at ${resultPath}]`),
111
+ hasDigest: false,
112
+ };
113
+ }
114
+
115
+ function capInline(text: string): string {
116
+ return text.length > RESULT_CAP ? text.slice(0, RESULT_CAP) + "\n... [digest truncated]" : text;
117
+ }
118
+
119
+ export default function (pi: ExtensionAPI) {
120
+ let cfg: DelegateConfig | null = null;
121
+ try {
122
+ cfg = JSON.parse(process.env.AGENT_HUB_DELEGATE_CONFIG || "");
123
+ } catch {
124
+ cfg = null;
125
+ }
126
+ // Misconfigured (or launched outside the hub): register nothing — the
127
+ // parent simply has no delegate tool.
128
+ if (!cfg || !cfg.roles || !cfg.eventDir) return;
129
+ const config = cfg;
130
+ const budgets = normalizeDelegateRuntimeBudgets(config, DEFAULT_CALL_BUDGET);
131
+ config.depth = budgets.depth;
132
+ config.callBudget = budgets.callBudget;
133
+ config.remainingSpawns = budgets.remainingSpawns;
134
+
135
+ let callCount = 0;
136
+ let childSeq = 0;
137
+ // Synchronous reservation counter for the write-safety gate. Incremented at
138
+ // the gate (before any await), so two parallel delegate calls can never both
139
+ // observe "I am the only child" — do NOT replace this with liveChildren.size,
140
+ // which only grows once the child process actually spawns.
141
+ let liveCount = 0;
142
+ const liveChildren = new Set<ChildProcess>();
143
+
144
+ // Per-provider concurrency. Four read-only children fanning out at once is a
145
+ // feature against a hosted provider and a mid-run OOM against the local one,
146
+ // so `custom/*` queues past 2 in flight. Queued children still run — they
147
+ // just wait for a permit instead of racing for the same GPU.
148
+ const providerSemaphore = createProviderSemaphore({
149
+ ...DEFAULT_PROVIDER_LIMITS,
150
+ ...parseProviderLimits(process.env.AGENT_HUB_PROVIDER_LIMITS),
151
+ });
152
+
153
+ // Fallback cascade: the primary kill path is the process group (the hub
154
+ // signals the specialist's negative PID), but if only this process is
155
+ // terminated, forward the signal to any live children.
156
+ process.on("SIGTERM", () => {
157
+ for (const child of liveChildren) killPiTree(child, "SIGTERM");
158
+ });
159
+
160
+ const emit = (event: Record<string, unknown>) => {
161
+ try {
162
+ appendFileSync(safePathWithin(config.eventDir, "events.jsonl"), JSON.stringify(event) + "\n", "utf-8");
163
+ } catch {}
164
+ };
165
+
166
+ const roleNames = Object.keys(config.roles).filter((name) => {
167
+ try { safeAgentKey(name); return true; } catch { return false; }
168
+ });
169
+ if (roleNames.length === 0) return;
170
+
171
+ pi.registerTool({
172
+ name: "delegate",
173
+ label: "Delegate",
174
+ description:
175
+ `Spawn one of your declared sub-agents on its pre-configured model and wait for its report. ` +
176
+ `Declared roles: ${roleNames.join(", ")}. Use it to fan out scoped sub-tasks (reviews, scans, ` +
177
+ `doc checks) instead of doing everything yourself; at most ${DELEGATE_TREE_SPAWN_BUDGET} ` +
178
+ `children may be spawned per dispatch, and parallel children are forced read-only. The child ` +
179
+ `does not share your context — pass everything it needs in \`instruction\`/\`context\`.`,
180
+ parameters: Type.Object({
181
+ role: Type.String({ description: `Declared sub-role to spawn. One of: ${roleNames.join(", ")}` }),
182
+ instruction: Type.String({ description: "The specific, self-contained task for the sub-agent." }),
183
+ context: Type.Optional(Type.String({
184
+ description: "Optional background brief pasted above the instruction (the child shares none of " +
185
+ "your context). The keyword 'fork' (full context fork) is accepted but treated as a summary " +
186
+ "brief in v1 — write the brief out.",
187
+ })),
188
+ allow_write: Type.Optional(Type.Boolean({
189
+ description: "Let the child inherit your tools (including write access). Honored only while it " +
190
+ "is your ONLY live child; concurrent children are always read-only. A role-level tools cap " +
191
+ "still wins and refuses delegation if it leaves no tools.",
192
+ })),
193
+ }),
194
+
195
+ async execute(_toolCallId, params, _signal, onUpdate) {
196
+ const { role, instruction, context, allow_write } = params as {
197
+ role: string; instruction: string; context?: string; allow_write?: boolean;
198
+ };
199
+
200
+ // Readable refusals — budget exhaustion is an answer, not a mystery.
201
+ const budgetRefusal = delegateBudgetRefusal({
202
+ depth: config.depth,
203
+ callBudget: config.callBudget,
204
+ remainingSpawns: config.remainingSpawns ?? 0,
205
+ callCount,
206
+ });
207
+ if (budgetRefusal) {
208
+ return { content: [{ type: "text" as const, text: budgetRefusal }] };
209
+ }
210
+ const roleKey = roleNames.find(r => r.toLowerCase() === role.toLowerCase());
211
+ if (!roleKey) {
212
+ return {
213
+ content: [{ type: "text" as const, text:
214
+ `Delegation refused: "${role}" is not a declared sub-role. Declared roles: ` +
215
+ `${roleNames.join(", ")}.` }],
216
+ };
217
+ }
218
+ const roleDef = config.roles[roleKey];
219
+
220
+ // Write safety: read-only unless this is the only live child AND the
221
+ // parent explicitly granted write. The role's tools cap always wins.
222
+ const tools = resolveDelegateTools({
223
+ parentTools: config.parentTools,
224
+ roleTools: roleDef.tools,
225
+ allowWrite: allow_write === true,
226
+ concurrent: liveCount > 0,
227
+ });
228
+ if (tools.refused) {
229
+ return {
230
+ content: [{ type: "text" as const, text:
231
+ `Delegation refused: role "${roleKey}" declares tools "${roleDef.tools}" but none are ` +
232
+ `available under the current parent/concurrency tool policy.` }],
233
+ };
234
+ }
235
+ const effectiveTools = tools.effectiveTools;
236
+ const writeDowngraded = tools.writeDowngraded;
237
+
238
+ callCount++;
239
+ childSeq++;
240
+ const plan = planDelegateSpawn({
241
+ tag: config.tag,
242
+ roleKey,
243
+ childSeq,
244
+ depth: config.depth,
245
+ remainingSpawns: config.remainingSpawns ?? 0,
246
+ effectiveTools,
247
+ damageControl: config.damageControl,
248
+ delegateExt: config.delegateExt,
249
+ });
250
+ config.remainingSpawns = plan.nextRemainingSpawns;
251
+ const childId = plan.childId;
252
+ const childDepth = plan.childDepth;
253
+ const childRemainingSpawns = plan.childRemainingSpawns;
254
+ const childCanDelegate = plan.childCanDelegate;
255
+ const childExtensions = plan.childExtensions;
256
+ const childTools = plan.childTools;
257
+ const childConfig: DelegateConfig | null = plan.includeDelegateConfig ? {
258
+ ...config,
259
+ tag: childId,
260
+ depth: childDepth,
261
+ remainingSpawns: childRemainingSpawns,
262
+ parentTools: effectiveTools,
263
+ } : null;
264
+
265
+ const sessionsDir = safePathWithin(config.eventDir, "sessions");
266
+ const resultsDir = safePathWithin(config.eventDir, "results");
267
+ const childSessionFile = safePathWithin(sessionsDir, `${childId}.jsonl`);
268
+ const childResultFile = safePathWithin(resultsDir, `${childId}.md`);
269
+ try { mkdirSync(sessionsDir, { recursive: true }); } catch {}
270
+ try { mkdirSync(resultsDir, { recursive: true }); } catch {}
271
+
272
+ emit({
273
+ t: "spawn", id: childId, parent: config.tag, role: roleKey,
274
+ model: roleDef.model, tools: effectiveTools, remainingSpawns: childRemainingSpawns, ts: Date.now(),
275
+ });
276
+ onUpdate?.({
277
+ content: [{ type: "text", text: `Delegating to ${roleKey} (${roleDef.model})...` }],
278
+ details: { id: childId, role: roleKey, model: roleDef.model, status: "running" },
279
+ });
280
+
281
+ // Buffered timeline streaming: coalesce text/thinking deltas and flush
282
+ // them into the event file on an interval (and on tool/exit), so the
283
+ // hub can render a live /af-zoom timeline without an event per token.
284
+ let pendingKind: "text" | "thinking" | null = null;
285
+ let pendingDelta = "";
286
+ const flushTimeline = () => {
287
+ if (!pendingKind || !pendingDelta) return;
288
+ emit({ t: "timeline", id: childId, kind: pendingKind, delta: pendingDelta });
289
+ pendingDelta = "";
290
+ };
291
+ const queueDelta = (kind: "text" | "thinking", delta: string) => {
292
+ if (pendingKind !== kind) flushTimeline();
293
+ pendingKind = kind;
294
+ pendingDelta += delta;
295
+ };
296
+ const flushTimer = setInterval(flushTimeline, TIMELINE_FLUSH_MS);
297
+
298
+ const startTime = Date.now();
299
+ // Time spent waiting for a provider permit, reported alongside `elapsed`
300
+ // so a queued child is never mistaken for a slow one (the run deadline is
301
+ // measured from the spawn, not from here).
302
+ let queuedMs = 0;
303
+ let childProc: ChildProcess | null = null;
304
+ const mode = context?.trim().toLowerCase();
305
+ const brief = context && mode !== "summary" && mode !== "fork" ? context : undefined;
306
+ const prompt = brief
307
+ ? `## Context from your parent\n${brief}\n\n## Your task\n${instruction}`
308
+ : instruction;
309
+
310
+ let res;
311
+ liveCount++;
312
+ try {
313
+ const providerCap = providerSemaphore.limitFor(roleDef.model);
314
+ if (providerCap != null && providerSemaphore.inFlight(roleDef.model) >= providerCap) {
315
+ const ahead = providerSemaphore.queued(roleDef.model) + 1;
316
+ emit({ t: "queued", id: childId, model: roleDef.model, ahead, ts: Date.now() });
317
+ onUpdate?.({
318
+ content: [{ type: "text", text: `${roleKey} queued — ${providerCap} requests already in flight on this provider (${ahead} waiting)...` }],
319
+ details: { id: childId, role: roleKey, model: roleDef.model, status: "queued" },
320
+ });
321
+ }
322
+ res = await providerSemaphore.run(roleDef.model, () => {
323
+ queuedMs = Date.now() - startTime;
324
+ return spawnPiAgentWithModelFallback({
325
+ model: roleDef.model,
326
+ tools: childTools,
327
+ thinking: "off",
328
+ appendSystemPrompt: subagentProtocol(config.persona, roleKey, childCanDelegate),
329
+ sessionFile: childSessionFile,
330
+ prompt,
331
+ extensions: childExtensions,
332
+ env: childConfig ? { AGENT_HUB_DELEGATE_CONFIG: JSON.stringify(childConfig) } : undefined,
333
+ cwd: config.cwd,
334
+ // Each nested child owns its group. The SIGTERM trap above forwards
335
+ // parent cancellation so detached children cannot become orphans.
336
+ detached: true,
337
+ signal: _signal,
338
+ // `null` is the explicit `off` override; preserve it rather than
339
+ // silently restoring the default for terminal children.
340
+ toolWatchdog: { timeoutMs: config.reconSearchTimeoutMs === undefined ? 120_000 : config.reconSearchTimeoutMs },
341
+ // Whole-run bound from the hub's mode budget: a hung delegate (the
342
+ // 92-minute conventions scout) must not hold its parent hostage.
343
+ turnDeadlineMs: config.turnDeadlineMs === undefined ? null : config.turnDeadlineMs,
344
+ }, roleDef.fallbackModel, {
345
+ onProcess: (p) => {
346
+ if (childProc) liveChildren.delete(childProc);
347
+ childProc = p;
348
+ liveChildren.add(p);
349
+ },
350
+ onModelFallback: (notice) => {
351
+ emit({ t: "model_fallback", id: childId, ...notice, ts: Date.now() });
352
+ onUpdate?.({
353
+ content: [{ type: "text", text: `Override ${notice.from} failed before work began; retrying ${roleKey} with ${notice.to}...` }],
354
+ details: { id: childId, role: roleKey, model: notice.to, fallback: notice, status: "running" },
355
+ });
356
+ },
357
+ onTextDelta: (delta) => queueDelta("text", delta),
358
+ onThinkingDelta: (delta) => queueDelta("thinking", delta),
359
+ onToolStart: (toolName, argStr) => {
360
+ flushTimeline();
361
+ emit({ t: "tool", id: childId, name: toolName, args: argStr.slice(0, 500) });
362
+ },
363
+ onUsage: (usage, source) => {
364
+ if (source === "message_end") {
365
+ emit({ t: "usage", id: childId, input: usage.input || 0, output: usage.output || 0 });
366
+ }
367
+ },
368
+ }, {
369
+ // A child holding only read tools can be re-run safely, so a
370
+ // provider dying halfway through is recoverable rather than a
371
+ // discarded run. A write-capable child keeps the strict rule:
372
+ // a retry there could duplicate edits. A child that can delegate
373
+ // carries `delegate` in its tool list and so reads as non-read-only
374
+ // here — deliberately: retrying it would re-spawn its grandchildren.
375
+ midRun: isReadOnlyToolList(childTools),
376
+ });
377
+ });
378
+ } finally {
379
+ liveCount--;
380
+ clearInterval(flushTimer);
381
+ if (childProc) liveChildren.delete(childProc);
382
+ }
383
+
384
+ flushTimeline();
385
+ const elapsed = Date.now() - startTime;
386
+ const code = res.spawnError ? 1 : (res.termination ? (res.termination.reason === "cancelled" ? 130 : res.termination.reason === "drift_stop" ? 125 : 124) : (res.exitCode ?? 1));
387
+ emit({ t: "exit", id: childId, code, elapsed, ...(queuedMs > 0 ? { queuedMs } : {}), termination: res.termination, ts: Date.now() });
388
+
389
+ if (res.spawnError) {
390
+ const spawnFailure = `Delegate ${childId} failed to spawn: ${res.spawnError}`;
391
+ try { writeFileSync(childResultFile, spawnFailure + "\n", "utf-8"); } catch {}
392
+ return {
393
+ content: [{ type: "text" as const, text: `${spawnFailure}\n\nFull output: ${childResultFile}` }],
394
+ details: { id: childId, role: roleKey, status: "error", resultPath: childResultFile },
395
+ };
396
+ }
397
+
398
+ let output = res.output;
399
+ if (res.termination) {
400
+ const reason = res.termination.reason;
401
+ const tool = res.termination.tool;
402
+ const explanation = reason === "tool_timeout"
403
+ ? `exceeded its per-tool watchdog on ${tool?.toolName || "tool"} (${tool?.toolCallId || "unknown"})`
404
+ : reason === "turn_timeout"
405
+ ? "exceeded the per-run deadline (mode budget / agent-turn-timeout-s)"
406
+ : reason === "drift_stop"
407
+ ? "was stopped by the drift watchdog"
408
+ : "was cancelled by its caller";
409
+ output = `${reason}: delegate ${childId} ${explanation}; terminationConfirmed=${res.termination.confirmed}.`;
410
+ } else if (code !== 0) {
411
+ const errTail = res.stderr.trim().slice(-1000);
412
+ output = output
413
+ ? `${output}\n\n[stderr]\n${errTail}`
414
+ : `Delegate ${childId} exited with code ${code} and produced no output.\n\n[stderr]\n${errTail}`;
415
+ }
416
+ try { writeFileSync(childResultFile, output, "utf-8"); } catch {}
417
+ const digest = childResultDigest(output, childResultFile);
418
+
419
+ const notes: string[] = [];
420
+ if (writeDowngraded) notes.push("allow_write ignored — other children were live, so it ran read-only");
421
+ if (mode === "fork") notes.push("context: fork is not supported in v1 — the child started fresh from your instruction");
422
+ const noteBlock = notes.length > 0 ? `\n[note: ${notes.join("; ")}]` : "";
423
+
424
+ const fallbackNote = res.modelFallback
425
+ ? `\n[note: overridden model ${res.modelFallback.from} failed before work; retried once with original ${res.modelFallback.to}]`
426
+ : "";
427
+ return {
428
+ content: [{ type: "text" as const, text:
429
+ `[delegate ${childId} · ${res.modelUsed} · ${effectiveTools}] ${res.termination ? res.termination.reason : code === 0 ? "done" : "error"} ` +
430
+ `in ${Math.round(elapsed / 1000)}s${noteBlock}${fallbackNote}\n\n${digest.text}` }],
431
+ details: { id: childId, role: roleKey, model: res.modelUsed, fallback: res.modelFallback, status: res.termination ? res.termination.reason : code === 0 ? "done" : "error", elapsed, resultPath: childResultFile, digestFound: digest.hasDigest, termination: res.termination },
432
+ };
433
+ },
434
+ });
435
+ }
@@ -0,0 +1,211 @@
1
+ // Drift watchdog — the pure policy core behind in-flight specialist
2
+ // observation. Layer 1 is deterministic rules over the child's tool event
3
+ // stream (zero tokens); a firing rule is an ESCALATION SIGNAL, not a verdict —
4
+ // the harness then asks a cheap LLM judge (layer 2) whether the run is still
5
+ // on task, and only a DRIFTING/STUCK verdict terminates it (`drift_stop`).
6
+ // Everything here is data + pure functions so the policy is unit-testable
7
+ // away from the harness.
8
+
9
+ import { checkScope } from "./scope-gate.js";
10
+
11
+ export const WATCHDOG_SETTINGS = ["on", "off", "auto"];
12
+ export const DEFAULT_WATCHDOG_SETTING = "auto";
13
+
14
+ /** "On", " AUTO " → canonical setting, or null when unrecognized. */
15
+ export function normalizeWatchdogSetting(value) {
16
+ const v = String(value ?? "").trim().toLowerCase();
17
+ return WATCHDOG_SETTINGS.includes(v) ? v : null;
18
+ }
19
+
20
+ /**
21
+ * Is the watchdog armed for one dispatch? Precedence: the dispatch_agent
22
+ * `watchdog` param (boolean) > the per-agent /af-watchdog override ("on"/"off")
23
+ * > the hub-wide setting ("on"/"auto" arm, "off" disarms).
24
+ */
25
+ export function resolveWatchdogActive(dispatchParam, agentOverride, hubSetting) {
26
+ if (dispatchParam === true) return true;
27
+ if (dispatchParam === false) return false;
28
+ if (agentOverride === "on") return true;
29
+ if (agentOverride === "off") return false;
30
+ return normalizeWatchdogSetting(hubSetting) !== "off";
31
+ }
32
+
33
+ // Conservative thresholds: a false positive kills a productive run, so every
34
+ // rule needs sustained evidence before it fires.
35
+ export const DRIFT_DEFAULTS = {
36
+ writeTools: ["write", "edit"],
37
+ maxRepeats: 4,
38
+ maxConsecutiveFailures: 5,
39
+ maxToolCalls: 200,
40
+ trailLimit: 60,
41
+ };
42
+
43
+ /** Session subtrees the hub itself tells specialists to write into. */
44
+ export const HUB_OWNED_SUBDIRS = ["artifacts", "findings", "delegations"];
45
+
46
+ /**
47
+ * Globs for the paths the deliverable protocol ORDERS the specialist to write
48
+ * (`artifacts/<kind>/<agentKey>-run<N>.md` and friends). A dispatcher's `scope:`
49
+ * never lists them, so checking writes against the declared scope alone made the
50
+ * hub punish obedience: `planner` was killed after 1088s and `documenter` after
51
+ * 120s for writing exactly where they were told to.
52
+ *
53
+ * Pass every form the path can arrive in — the absolute session dir and its
54
+ * repo-relative twin — since the specialist may use either.
55
+ */
56
+ export function hubOwnedScopeGlobs(...sessionDirs) {
57
+ const globs = [];
58
+ for (const dir of sessionDirs) {
59
+ const base = String(dir || "").trim().replace(/\\/g, "/").replace(/\/+$/, "");
60
+ if (!base) continue;
61
+ for (const sub of HUB_OWNED_SUBDIRS) globs.push(`${base}/${sub}/**`);
62
+ }
63
+ return [...new Set(globs)];
64
+ }
65
+
66
+ const pathFromArgs = (argStr) => {
67
+ try {
68
+ const args = JSON.parse(argStr || "{}");
69
+ for (const key of ["path", "file_path", "filePath", "file", "filename"]) {
70
+ if (typeof args[key] === "string" && args[key].trim()) return args[key].trim();
71
+ }
72
+ } catch {}
73
+ return null;
74
+ };
75
+
76
+ /**
77
+ * Per-run monitor fed from the tool event stream. `onToolStart(tool, argStr)`
78
+ * and `onToolEnd(tool, isError)` return `null` while the run looks healthy, or
79
+ * `{ rule, terminal, detail }` when a rule crosses its threshold:
80
+ * scope — a write-capable tool touched a path outside the declared scope
81
+ * loop — the exact same (tool, args) call repeated maxRepeats times
82
+ * failures — maxConsecutiveFailures failed tool calls in a row
83
+ * toolcap — maxToolCalls total tool calls in one run
84
+ * Each rule instance fires once (at the crossing), so the caller escalates —
85
+ * it never gets spammed. `trail(n)` returns the recent tool trail for the judge.
86
+ *
87
+ * `terminal: false` marks a signal that must never end a run on its own: the
88
+ * post-run scope gate is advisory by design ("nothing is auto-reverted"), so the
89
+ * live rule watching the same thing cannot be a death sentence. `scope` reports;
90
+ * only the genuinely stuck rules stop work.
91
+ */
92
+ export function createDriftMonitor(cfg = {}) {
93
+ const scopeGlobs = (cfg.scopeGlobs || []).filter(Boolean);
94
+ const allowGlobs = (cfg.allowGlobs || []).filter(Boolean);
95
+ // A path in EITHER the declared scope or the hub-owned allowlist is in scope.
96
+ const effectiveScope = [...scopeGlobs, ...allowGlobs];
97
+ const writeTools = new Set(cfg.writeTools || DRIFT_DEFAULTS.writeTools);
98
+ const maxRepeats = cfg.maxRepeats ?? DRIFT_DEFAULTS.maxRepeats;
99
+ const maxConsecutiveFailures = cfg.maxConsecutiveFailures ?? DRIFT_DEFAULTS.maxConsecutiveFailures;
100
+ const maxToolCalls = cfg.maxToolCalls ?? DRIFT_DEFAULTS.maxToolCalls;
101
+ const trailLimit = cfg.trailLimit ?? DRIFT_DEFAULTS.trailLimit;
102
+
103
+ const callCounts = new Map();
104
+ const trailLines = [];
105
+ let totalCalls = 0;
106
+ let consecutiveFailures = 0;
107
+
108
+ const pushTrail = (line) => {
109
+ trailLines.push(line);
110
+ if (trailLines.length > trailLimit) trailLines.shift();
111
+ };
112
+
113
+ return {
114
+ onToolStart(toolName, argStr) {
115
+ totalCalls++;
116
+ pushTrail(`${toolName} ${String(argStr || "").slice(0, 120)}`.trim());
117
+
118
+ if (scopeGlobs.length > 0 && writeTools.has(toolName)) {
119
+ const path = pathFromArgs(argStr);
120
+ if (path && checkScope([path], effectiveScope).outOfScope.length > 0) {
121
+ return {
122
+ rule: "scope",
123
+ terminal: false,
124
+ detail: `${toolName} touched ${path} — outside the declared scope (${scopeGlobs.join(", ")})`,
125
+ };
126
+ }
127
+ }
128
+
129
+ const fingerprint = `${toolName}::${argStr || ""}`;
130
+ const count = (callCounts.get(fingerprint) || 0) + 1;
131
+ callCounts.set(fingerprint, count);
132
+ if (count === maxRepeats) {
133
+ return { rule: "loop", terminal: true, detail: `${toolName} called ${count}× with identical arguments — likely stuck in a loop` };
134
+ }
135
+
136
+ if (totalCalls === maxToolCalls) {
137
+ return { rule: "toolcap", terminal: true, detail: `${totalCalls} tool calls in one run — far beyond a focused task` };
138
+ }
139
+ return null;
140
+ },
141
+
142
+ onToolEnd(_toolName, isError) {
143
+ if (isError === true) {
144
+ consecutiveFailures++;
145
+ pushTrail(" ↳ FAILED");
146
+ if (consecutiveFailures % maxConsecutiveFailures === 0) {
147
+ return { rule: "failures", terminal: true, detail: `${consecutiveFailures} consecutive failed tool calls — no forward progress` };
148
+ }
149
+ } else if (isError === false) {
150
+ consecutiveFailures = 0;
151
+ }
152
+ // isError undefined: the stream carries no error flag — rule stays inert.
153
+ return null;
154
+ },
155
+
156
+ trail(n = 40) {
157
+ return trailLines.slice(-n);
158
+ },
159
+ };
160
+ }
161
+
162
+ /**
163
+ * The one-shot judge prompt: original task + declared scope + recent trail +
164
+ * the rule that fired. The judge answers with a single machine-parseable line.
165
+ */
166
+ export function buildJudgePrompt({ agent, task, scopeGlobs = [], hubOwnedGlobs = [], trail = [], violation }) {
167
+ const scopeBlock = scopeGlobs.length > 0
168
+ ? `\n## Declared file scope\n${scopeGlobs.map(s => `- ${s}`).join("\n")}\n`
169
+ : "";
170
+ // Without this block the judge reads a protocol-mandated artifact write as
171
+ // rogue behaviour and answers DRIFTING — which is how obedient runs got killed.
172
+ const hubOwnedBlock = hubOwnedGlobs.length > 0
173
+ ? `\n## Hub-owned paths (writing here is REQUIRED, never drift)\nThe dispatcher orders every specialist to write its deliverable to these paths. ` +
174
+ `They are outside the declared scope by design — treat writes here as on-task:\n${hubOwnedGlobs.map(s => `- ${s}`).join("\n")}\n`
175
+ : "";
176
+ const advisoryBlock = violation?.terminal === false
177
+ ? `\nThis signal is ADVISORY: it cannot stop the run by itself. Answer honestly about the whole trail, ` +
178
+ `not about this one write.\n`
179
+ : "";
180
+ return `You are a drift watchdog judging whether a running coding agent is still on task.
181
+ Do not solve the task. Judge only whether the agent's recent actions serve it.
182
+
183
+ ## Agent
184
+ ${agent}
185
+
186
+ ## Original task (verbatim)
187
+ ${task}
188
+ ${scopeBlock}${hubOwnedBlock}
189
+ ## Escalation signal
190
+ Rule "${violation?.rule || "unknown"}" fired: ${violation?.detail || "(no detail)"}
191
+ ${advisoryBlock}
192
+
193
+ ## Recent tool trail (oldest first)
194
+ ${trail.length > 0 ? trail.join("\n") : "(no tool calls recorded)"}
195
+
196
+ ## Your answer
197
+ Reply with EXACTLY one line, nothing else:
198
+ VERDICT: ON_TRACK — <why the actions still serve the task>
199
+ VERDICT: DRIFTING — <what the agent is doing instead of the task>
200
+ VERDICT: STUCK — <the loop or dead end it cannot escape>
201
+ Prefer ON_TRACK unless the trail clearly contradicts the task: false alarms kill
202
+ productive work.`;
203
+ }
204
+
205
+ /** Parse the judge's reply. Returns { verdict, reason } or null when unparseable. */
206
+ export function parseJudgeVerdict(text) {
207
+ const matches = [...String(text ?? "").matchAll(/VERDICT:\s*(ON_TRACK|DRIFTING|STUCK)\s*(?:[—:-]\s*(.*))?/gi)];
208
+ if (matches.length === 0) return null;
209
+ const last = matches[matches.length - 1];
210
+ return { verdict: last[1].toLowerCase(), reason: (last[2] || "").trim() };
211
+ }