@chankov/agent-fleet 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/.pi/harnesses/agent-hub/package.json +1 -1
  2. package/.pi/harnesses/coms/package.json +1 -1
  3. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  4. package/.versions/2.0.1/.pi/agents/dispatch-policy.yaml +32 -0
  5. package/.versions/2.0.1/.pi/agents/model-profiles.yaml +27 -0
  6. package/.versions/2.0.1/.pi/agents/peers.yaml +142 -0
  7. package/.versions/2.0.1/.pi/agents/teams.yaml +41 -0
  8. package/.versions/2.0.1/.pi/damage-control-rules.yaml +297 -0
  9. package/.versions/2.0.1/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  10. package/.versions/2.0.1/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  11. package/.versions/2.0.1/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  12. package/.versions/2.0.1/.pi/extensions/btw/README.md +120 -0
  13. package/.versions/2.0.1/.pi/extensions/btw/index.ts +914 -0
  14. package/.versions/2.0.1/.pi/extensions/btw/package.json +6 -0
  15. package/.versions/2.0.1/.pi/extensions/btw/state.js +179 -0
  16. package/.versions/2.0.1/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  17. package/.versions/2.0.1/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  18. package/.versions/2.0.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  19. package/.versions/2.0.1/.pi/extensions/compact-and-continue/README.md +42 -0
  20. package/.versions/2.0.1/.pi/extensions/compact-and-continue/index.ts +120 -0
  21. package/.versions/2.0.1/.pi/extensions/compact-and-continue/package.json +6 -0
  22. package/.versions/2.0.1/.pi/extensions/mcp-bridge/README.md +46 -0
  23. package/.versions/2.0.1/.pi/extensions/mcp-bridge/index.ts +206 -0
  24. package/.versions/2.0.1/.pi/extensions/mcp-bridge/package.json +6 -0
  25. package/.versions/2.0.1/.pi/extensions/package-lock.json +1175 -0
  26. package/.versions/2.0.1/.pi/extensions/package.json +9 -0
  27. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/README.md +205 -0
  28. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/config.ts +198 -0
  29. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  30. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
  31. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/package.json +6 -0
  32. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  33. package/.versions/2.0.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  34. package/.versions/2.0.1/.pi/harnesses/agent-hub/README.md +1161 -0
  35. package/.versions/2.0.1/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  36. package/.versions/2.0.1/.pi/harnesses/agent-hub/artifacts.js +146 -0
  37. package/.versions/2.0.1/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  38. package/.versions/2.0.1/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  39. package/.versions/2.0.1/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
  40. package/.versions/2.0.1/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  41. package/.versions/2.0.1/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
  42. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  43. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  44. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  45. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  46. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  47. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  48. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  49. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  50. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  51. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  52. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  53. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  54. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  55. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  56. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/context.ts +39 -0
  57. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  58. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  59. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  60. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  61. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  62. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
  63. package/.versions/2.0.1/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  64. package/.versions/2.0.1/.pi/harnesses/agent-hub/config/agents.ts +171 -0
  65. package/.versions/2.0.1/.pi/harnesses/agent-hub/config/overrides.ts +118 -0
  66. package/.versions/2.0.1/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  67. package/.versions/2.0.1/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +211 -0
  68. package/.versions/2.0.1/.pi/harnesses/agent-hub/context/budgets.ts +208 -0
  69. package/.versions/2.0.1/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  70. package/.versions/2.0.1/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  71. package/.versions/2.0.1/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  72. package/.versions/2.0.1/.pi/harnesses/agent-hub/context-window.js +106 -0
  73. package/.versions/2.0.1/.pi/harnesses/agent-hub/delegate.ts +446 -0
  74. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-coms.ts +232 -0
  75. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  76. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-native-complete.ts +135 -0
  77. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +153 -0
  78. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +191 -0
  79. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-native-types.ts +207 -0
  80. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-native.ts +184 -0
  81. package/.versions/2.0.1/.pi/harnesses/agent-hub/dispatch-observability.ts +220 -0
  82. package/.versions/2.0.1/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  83. package/.versions/2.0.1/.pi/harnesses/agent-hub/drift-watchdog.js +218 -0
  84. package/.versions/2.0.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  85. package/.versions/2.0.1/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  86. package/.versions/2.0.1/.pi/harnesses/agent-hub/fixtures/registration-surface.json +53 -0
  87. package/.versions/2.0.1/.pi/harnesses/agent-hub/footer.ts +30 -0
  88. package/.versions/2.0.1/.pi/harnesses/agent-hub/helpers.ts +266 -0
  89. package/.versions/2.0.1/.pi/harnesses/agent-hub/hub-state-audit.js +59 -0
  90. package/.versions/2.0.1/.pi/harnesses/agent-hub/index.ts +1850 -0
  91. package/.versions/2.0.1/.pi/harnesses/agent-hub/input/completions.ts +76 -0
  92. package/.versions/2.0.1/.pi/harnesses/agent-hub/input/shortcuts.ts +47 -0
  93. package/.versions/2.0.1/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +123 -0
  94. package/.versions/2.0.1/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  95. package/.versions/2.0.1/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +139 -0
  96. package/.versions/2.0.1/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +95 -0
  97. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  98. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  99. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  100. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  101. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  102. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  103. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  104. package/.versions/2.0.1/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  105. package/.versions/2.0.1/.pi/harnesses/agent-hub/package.json +7 -0
  106. package/.versions/2.0.1/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  107. package/.versions/2.0.1/.pi/harnesses/agent-hub/policy/models.ts +126 -0
  108. package/.versions/2.0.1/.pi/harnesses/agent-hub/policy/roster.ts +79 -0
  109. package/.versions/2.0.1/.pi/harnesses/agent-hub/policy/work-mode.ts +118 -0
  110. package/.versions/2.0.1/.pi/harnesses/agent-hub/presentation.ts +48 -0
  111. package/.versions/2.0.1/.pi/harnesses/agent-hub/prompts/context.ts +46 -0
  112. package/.versions/2.0.1/.pi/harnesses/agent-hub/prompts/fragments.ts +115 -0
  113. package/.versions/2.0.1/.pi/harnesses/agent-hub/prompts/session-start.ts +88 -0
  114. package/.versions/2.0.1/.pi/harnesses/agent-hub/prompts/system-prompt.ts +110 -0
  115. package/.versions/2.0.1/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  116. package/.versions/2.0.1/.pi/harnesses/agent-hub/research/controls.ts +75 -0
  117. package/.versions/2.0.1/.pi/harnesses/agent-hub/research/runtime.ts +184 -0
  118. package/.versions/2.0.1/.pi/harnesses/agent-hub/research/spawn-run.ts +146 -0
  119. package/.versions/2.0.1/.pi/harnesses/agent-hub/research-retention.js +34 -0
  120. package/.versions/2.0.1/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  121. package/.versions/2.0.1/.pi/harnesses/agent-hub/return-contract.js +293 -0
  122. package/.versions/2.0.1/.pi/harnesses/agent-hub/return-extract.js +75 -0
  123. package/.versions/2.0.1/.pi/harnesses/agent-hub/review-findings.js +102 -0
  124. package/.versions/2.0.1/.pi/harnesses/agent-hub/run-budget.js +537 -0
  125. package/.versions/2.0.1/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  126. package/.versions/2.0.1/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  127. package/.versions/2.0.1/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  128. package/.versions/2.0.1/.pi/harnesses/agent-hub/session-health.js +110 -0
  129. package/.versions/2.0.1/.pi/harnesses/agent-hub/session-start.ts +42 -0
  130. package/.versions/2.0.1/.pi/harnesses/agent-hub/spawn.ts +388 -0
  131. package/.versions/2.0.1/.pi/harnesses/agent-hub/timeline.ts +54 -0
  132. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/action-executors.ts +146 -0
  133. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  134. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/context.ts +132 -0
  135. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +79 -0
  136. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +200 -0
  137. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  138. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/fleet-tools.ts +202 -0
  139. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/herdr-executors.ts +82 -0
  140. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/set-task-tier.ts +29 -0
  141. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/spawn-research.ts +62 -0
  142. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  143. package/.versions/2.0.1/.pi/harnesses/agent-hub/tools/verification-contract.ts +77 -0
  144. package/.versions/2.0.1/.pi/harnesses/agent-hub/types.ts +60 -0
  145. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/context-budget.ts +86 -0
  146. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/detail-panel.ts +175 -0
  147. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +130 -0
  148. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/grid.ts +306 -0
  149. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  150. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  151. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  152. package/.versions/2.0.1/.pi/harnesses/agent-hub/ui/zoom.ts +204 -0
  153. package/.versions/2.0.1/.pi/harnesses/agent-hub/version.ts +42 -0
  154. package/.versions/2.0.1/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
  155. package/.versions/2.0.1/.pi/harnesses/agent-hub/work-mode.ts +167 -0
  156. package/.versions/2.0.1/.pi/harnesses/ask-user-remote/README.md +53 -0
  157. package/.versions/2.0.1/.pi/harnesses/ask-user-remote/index.ts +532 -0
  158. package/.versions/2.0.1/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  159. package/.versions/2.0.1/.pi/harnesses/coms/README.md +100 -0
  160. package/.versions/2.0.1/.pi/harnesses/coms/index.ts +276 -0
  161. package/.versions/2.0.1/.pi/harnesses/coms/package.json +7 -0
  162. package/.versions/2.0.1/.pi/harnesses/coms/version.ts +42 -0
  163. package/.versions/2.0.1/.pi/harnesses/damage-control-continue/README.md +124 -0
  164. package/.versions/2.0.1/.pi/harnesses/damage-control-continue/index.ts +536 -0
  165. package/.versions/2.0.1/.pi/harnesses/damage-control-continue/package.json +7 -0
  166. package/.versions/2.0.1/.pi/harnesses/damage-control-continue/version.ts +42 -0
  167. package/.versions/2.0.1/.pi/harnesses/lib/coms-core-io.ts +385 -0
  168. package/.versions/2.0.1/.pi/harnesses/lib/coms-core.ts +577 -0
  169. package/.versions/2.0.1/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  170. package/.versions/2.0.1/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
  171. package/.versions/2.0.1/.pi/harnesses/lib/context-budget-hub-prompt.ts +114 -0
  172. package/.versions/2.0.1/.pi/harnesses/lib/context-budget-view.ts +107 -0
  173. package/.versions/2.0.1/.pi/harnesses/lib/context-budget.ts +114 -0
  174. package/.versions/2.0.1/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  175. package/.versions/2.0.1/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  176. package/.versions/2.0.1/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  177. package/.versions/2.0.1/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  178. package/.versions/2.0.1/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
  179. package/.versions/2.0.1/.pi/harnesses/lib/fleet-dashboard-view.ts +142 -0
  180. package/.versions/2.0.1/.pi/harnesses/lib/fleet-detail-view.ts +247 -0
  181. package/.versions/2.0.1/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  182. package/.versions/2.0.1/.pi/harnesses/lib/fleet-panel.ts +34 -0
  183. package/.versions/2.0.1/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  184. package/.versions/2.0.1/.pi/harnesses/lib/fleet-selection.ts +24 -0
  185. package/.versions/2.0.1/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  186. package/.versions/2.0.1/.pi/harnesses/lib/herdr-client.ts +472 -0
  187. package/.versions/2.0.1/.pi/harnesses/lib/herdr-presence.ts +399 -0
  188. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  189. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  190. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  191. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  192. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  193. package/.versions/2.0.1/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  194. package/.versions/2.0.1/.pi/harnesses/lib/spawned-peers.js +190 -0
  195. package/.versions/2.0.1/.pi/harnesses/package-lock.json +2039 -0
  196. package/.versions/2.0.1/.pi/harnesses/package.json +10 -0
  197. package/.versions/2.0.1/.pi/prompts/af-build.md +24 -0
  198. package/.versions/2.0.1/.pi/prompts/af-code-simplify.md +22 -0
  199. package/.versions/2.0.1/.pi/prompts/af-plan.md +17 -0
  200. package/.versions/2.0.1/.pi/prompts/af-review.md +16 -0
  201. package/.versions/2.0.1/.pi/prompts/af-set-hermes-telegram.md +15 -0
  202. package/.versions/2.0.1/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  203. package/.versions/2.0.1/.pi/prompts/af-ship.md +17 -0
  204. package/.versions/2.0.1/.pi/prompts/af-spec.md +15 -0
  205. package/.versions/2.0.1/.pi/prompts/af-test.md +19 -0
  206. package/.versions/2.0.1/.pi/skills/bowser/SKILL.md +145 -0
  207. package/.versions/2.0.1/.version +1 -0
  208. package/.versions/2.0.1/agents/architect.md +25 -0
  209. package/.versions/2.0.1/agents/bowser.md +28 -0
  210. package/.versions/2.0.1/agents/builder.md +56 -0
  211. package/.versions/2.0.1/agents/code-reviewer.md +210 -0
  212. package/.versions/2.0.1/agents/deep-researcher.md +33 -0
  213. package/.versions/2.0.1/agents/documenter.md +22 -0
  214. package/.versions/2.0.1/agents/orchestrator.md +23 -0
  215. package/.versions/2.0.1/agents/plan-reviewer.md +84 -0
  216. package/.versions/2.0.1/agents/planner.md +73 -0
  217. package/.versions/2.0.1/agents/releaser.md +25 -0
  218. package/.versions/2.0.1/agents/researcher.md +31 -0
  219. package/.versions/2.0.1/agents/security-auditor.md +168 -0
  220. package/.versions/2.0.1/agents/test-engineer.md +154 -0
  221. package/.versions/2.0.1/agents/web-debugger.md +44 -0
  222. package/.versions/2.0.1/agents/web-performance-auditor.md +194 -0
  223. package/.versions/2.0.1/bin/catalog/harness-runtime-closure.json +38 -0
  224. package/.versions/2.0.1/codex/CONDUCTOR.md +148 -0
  225. package/.versions/2.0.1/docs/ARCHITECTURE.md +407 -0
  226. package/.versions/2.0.1/docs/agent-fleet-setup.md +468 -0
  227. package/.versions/2.0.1/docs/claude-code-coms-bridge.md +128 -0
  228. package/.versions/2.0.1/docs/codex-remote-conductor.md +170 -0
  229. package/.versions/2.0.1/docs/coms-hermes-bridge.md +189 -0
  230. package/.versions/2.0.1/docs/getting-started.md +119 -0
  231. package/.versions/2.0.1/docs/npm-install.md +292 -0
  232. package/.versions/2.0.1/docs/pi-extensions.md +439 -0
  233. package/.versions/2.0.1/docs/pi-setup.md +74 -0
  234. package/.versions/2.0.1/docs/skill-anatomy.md +150 -0
  235. package/.versions/2.0.1/hermes/README.md +347 -0
  236. package/.versions/2.0.1/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  237. package/.versions/2.0.1/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  238. package/.versions/2.0.1/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  239. package/.versions/2.0.1/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  240. package/.versions/2.0.1/hermes/gates/gate-o-capability.md +8 -0
  241. package/.versions/2.0.1/hermes/gates/gate-o-validator-fixtures.json +1 -0
  242. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  243. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  244. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  245. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  246. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  247. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  248. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  249. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  250. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  251. package/.versions/2.0.1/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  252. package/.versions/2.0.1/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  253. package/.versions/2.0.1/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  254. package/.versions/2.0.1/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  255. package/.versions/2.0.1/hermes/skills/hub-conductor/SKILL.md +84 -0
  256. package/.versions/2.0.1/hermes/skills/hub-liaison/SKILL.md +84 -0
  257. package/.versions/2.0.1/hermes/skills/hub-watchdog/SKILL.md +76 -0
  258. package/.versions/2.0.1/hermes/skills/hub-watchdog/manifest.json +1 -0
  259. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  260. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  261. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  262. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  263. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  264. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  265. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  266. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  267. package/.versions/2.0.1/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  268. package/.versions/2.0.1/hermes/watchdog-tests/__init__.py +0 -0
  269. package/.versions/2.0.1/hooks/coms-stop-hook.mjs +84 -0
  270. package/.versions/2.0.1/install-manifest.json +2830 -0
  271. package/.versions/2.0.1/justfile +286 -0
  272. package/.versions/2.0.1/manifest-meta.json +913 -0
  273. package/.versions/2.0.1/references/accessibility-checklist.md +160 -0
  274. package/.versions/2.0.1/references/definition-of-done.md +67 -0
  275. package/.versions/2.0.1/references/fleet-coordination-patterns.md +151 -0
  276. package/.versions/2.0.1/references/observability-checklist.md +91 -0
  277. package/.versions/2.0.1/references/orchestration-patterns.md +370 -0
  278. package/.versions/2.0.1/references/performance-checklist.md +153 -0
  279. package/.versions/2.0.1/references/prompting-patterns.md +380 -0
  280. package/.versions/2.0.1/references/security-checklist.md +179 -0
  281. package/.versions/2.0.1/references/testing-patterns.md +236 -0
  282. package/.versions/2.0.1/references/workflow-authoring.md +304 -0
  283. package/.versions/2.0.1/scripts/codex-conductor.ts +41 -0
  284. package/.versions/2.0.1/scripts/codex-remote-control.ts +167 -0
  285. package/.versions/2.0.1/scripts/coms-claude-bridge.ts +411 -0
  286. package/.versions/2.0.1/scripts/coms-cli.ts +484 -0
  287. package/.versions/2.0.1/scripts/coms-hermes-bridge.ts +413 -0
  288. package/.versions/2.0.1/scripts/fleet.ts +198 -0
  289. package/.versions/2.0.1/scripts/flow.ts +121 -0
  290. package/.versions/2.0.1/scripts/hermes-monitor-capability-runner.ts +25 -0
  291. package/.versions/2.0.1/scripts/hermes-monitor-scenario.ts +474 -0
  292. package/.versions/2.0.1/scripts/hermes-watchdog-capability-probe.ts +45 -0
  293. package/.versions/2.0.1/scripts/install-hermes-plugin.sh +180 -0
  294. package/.versions/2.0.1/scripts/lib/claude-bridge-core.ts +210 -0
  295. package/.versions/2.0.1/scripts/lib/codex-conductor.ts +88 -0
  296. package/.versions/2.0.1/scripts/lib/codex-remote-control.ts +480 -0
  297. package/.versions/2.0.1/scripts/lib/coms-envelope.ts +582 -0
  298. package/.versions/2.0.1/scripts/lib/fake-herdr-server.ts +88 -0
  299. package/.versions/2.0.1/scripts/lib/fleet-command.ts +270 -0
  300. package/.versions/2.0.1/scripts/lib/flow-command.ts +77 -0
  301. package/.versions/2.0.1/scripts/lib/flow-maintenance.ts +230 -0
  302. package/.versions/2.0.1/scripts/lib/herdr-layout.ts +281 -0
  303. package/.versions/2.0.1/scripts/lib/hermes-bridge-core.ts +241 -0
  304. package/.versions/2.0.1/scripts/lib/hermes-monitor-events.ts +1 -0
  305. package/.versions/2.0.1/scripts/lib/hermes-monitor-herdr.ts +2 -0
  306. package/.versions/2.0.1/scripts/lib/hermes-monitor-model.ts +3 -0
  307. package/.versions/2.0.1/scripts/lib/hermes-monitor-registry.ts +2 -0
  308. package/.versions/2.0.1/scripts/lib/hermes-monitor-socket.ts +2 -0
  309. package/.versions/2.0.1/scripts/lib/hermes-monitor-store.ts +2 -0
  310. package/.versions/2.0.1/scripts/lib/monitor-env.ts +146 -0
  311. package/.versions/2.0.1/scripts/lib/peer-launch.ts +318 -0
  312. package/.versions/2.0.1/scripts/lib/persona-banner.ts +62 -0
  313. package/.versions/2.0.1/scripts/lib/spawn-stagger.ts +101 -0
  314. package/.versions/2.0.1/scripts/lib/team-project.ts +213 -0
  315. package/.versions/2.0.1/scripts/lib/team-snapshot.ts +147 -0
  316. package/.versions/2.0.1/scripts/peer-banner.ts +40 -0
  317. package/.versions/2.0.1/scripts/peer-launch.ts +259 -0
  318. package/.versions/2.0.1/scripts/team-snapshot.ts +237 -0
  319. package/.versions/2.0.1/scripts/team-up.ts +406 -0
  320. package/.versions/2.0.1/scripts/workflows/lib/agent-phase.ts +118 -0
  321. package/.versions/2.0.1/scripts/workflows/lib/changes.ts +61 -0
  322. package/.versions/2.0.1/scripts/workflows/lib/env.ts +34 -0
  323. package/.versions/2.0.1/scripts/workflows/lib/envelopes.ts +141 -0
  324. package/.versions/2.0.1/scripts/workflows/lib/gates.ts +81 -0
  325. package/.versions/2.0.1/scripts/workflows/lib/git.ts +96 -0
  326. package/.versions/2.0.1/scripts/workflows/lib/permissions.ts +130 -0
  327. package/.versions/2.0.1/scripts/workflows/lib/personas.ts +44 -0
  328. package/.versions/2.0.1/scripts/workflows/lib/quality.ts +64 -0
  329. package/.versions/2.0.1/scripts/workflows/lib/run.ts +106 -0
  330. package/.versions/2.0.1/scripts/workflows/lib/trace.ts +34 -0
  331. package/.versions/2.0.1/scripts/workflows/tsconfig.json +22 -0
  332. package/.versions/2.0.1/scripts/workflows/wf-build-test.ts +61 -0
  333. package/.versions/2.0.1/scripts/workflows/wf-document.ts +50 -0
  334. package/.versions/2.0.1/scripts/workflows/wf-quality.ts +20 -0
  335. package/.versions/2.0.1/scripts/workflows/wf-scout.ts +38 -0
  336. package/.versions/2.0.1/skills/_internal/grilling.md +59 -0
  337. package/.versions/2.0.1/skills/browser-testing-with-devtools/SKILL.md +351 -0
  338. package/.versions/2.0.1/skills/code-review-and-quality/SKILL.md +381 -0
  339. package/.versions/2.0.1/skills/compound-learning/SKILL.md +137 -0
  340. package/.versions/2.0.1/skills/context-engineering/SKILL.md +291 -0
  341. package/.versions/2.0.1/skills/deprecation-and-migration/SKILL.md +206 -0
  342. package/.versions/2.0.1/skills/designing-agents/SKILL.md +394 -0
  343. package/.versions/2.0.1/skills/designing-agents/pi-harness-authoring.md +222 -0
  344. package/.versions/2.0.1/skills/drafting-workflows/SKILL.md +143 -0
  345. package/.versions/2.0.1/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  346. package/.versions/2.0.1/skills/frontend-ui-engineering/SKILL.md +328 -0
  347. package/.versions/2.0.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
  348. package/.versions/2.0.1/skills/idea-refine/SKILL.md +182 -0
  349. package/.versions/2.0.1/skills/idea-refine/examples.md +238 -0
  350. package/.versions/2.0.1/skills/idea-refine/frameworks.md +99 -0
  351. package/.versions/2.0.1/skills/idea-refine/refinement-criteria.md +113 -0
  352. package/.versions/2.0.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
  353. package/.versions/2.0.1/skills/incremental-implementation/SKILL.md +298 -0
  354. package/.versions/2.0.1/skills/interview-me/SKILL.md +226 -0
  355. package/.versions/2.0.1/skills/orchestration-verification/SKILL.md +181 -0
  356. package/.versions/2.0.1/skills/peer-coms/SKILL.md +90 -0
  357. package/.versions/2.0.1/skills/performance-optimization/SKILL.md +350 -0
  358. package/.versions/2.0.1/skills/planning-and-task-breakdown/SKILL.md +263 -0
  359. package/.versions/2.0.1/skills/security-and-hardening/SKILL.md +461 -0
  360. package/.versions/2.0.1/skills/spec-driven-development/SKILL.md +256 -0
  361. package/.versions/2.0.1/skills/using-agent-skills/SKILL.md +197 -0
  362. package/.versions/2.0.1/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  363. package/.versions/2.0.1/vendor/agent-skills-upstream/LICENSE +21 -0
  364. package/.versions/2.0.1/vendor/agent-skills-upstream/README.md +11 -0
  365. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  366. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  367. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  368. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  369. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  370. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  371. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  372. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  373. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  374. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  375. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  376. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  377. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  378. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  379. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  380. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  381. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  382. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  383. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  384. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  385. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  386. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  387. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  388. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  389. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  390. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  391. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  392. package/.versions/2.0.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  393. package/CHANGELOG.md +7 -0
  394. package/README.md +21 -0
  395. package/agents/code-reviewer.md +1 -0
  396. package/agents/documenter.md +3 -0
  397. package/agents/planner.md +2 -0
  398. package/agents/researcher.md +2 -0
  399. package/docs/ARCHITECTURE.md +3 -0
  400. package/docs/getting-started.md +21 -0
  401. package/docs/workflows.md +136 -0
  402. package/install-manifest.json +86 -1
  403. package/justfile +14 -0
  404. package/manifest-meta.json +32 -1
  405. package/package.json +10 -3
  406. package/references/workflow-authoring.md +304 -0
  407. package/scripts/fleet.ts +13 -0
  408. package/scripts/flow.ts +121 -0
  409. package/scripts/lib/flow-command.ts +77 -0
  410. package/scripts/lib/flow-maintenance.ts +230 -0
  411. package/scripts/workflows/lib/agent-phase.ts +118 -0
  412. package/scripts/workflows/lib/changes.ts +61 -0
  413. package/scripts/workflows/lib/env.ts +34 -0
  414. package/scripts/workflows/lib/envelopes.ts +141 -0
  415. package/scripts/workflows/lib/gates.ts +81 -0
  416. package/scripts/workflows/lib/git.ts +96 -0
  417. package/scripts/workflows/lib/permissions.ts +130 -0
  418. package/scripts/workflows/lib/personas.ts +44 -0
  419. package/scripts/workflows/lib/quality.ts +64 -0
  420. package/scripts/workflows/lib/run.ts +106 -0
  421. package/scripts/workflows/lib/trace.ts +34 -0
  422. package/scripts/workflows/tsconfig.json +22 -0
  423. package/scripts/workflows/wf-build-test.ts +61 -0
  424. package/scripts/workflows/wf-document.ts +50 -0
  425. package/scripts/workflows/wf-quality.ts +20 -0
  426. package/scripts/workflows/wf-scout.ts +38 -0
  427. package/skills/drafting-workflows/SKILL.md +143 -0
  428. package/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
@@ -0,0 +1,413 @@
1
+ // scripts/coms-hermes-bridge.ts
2
+ //
3
+ // Hermes/Telegram user-remote bridge daemon. Registers a coms peer, turns
4
+ // prompt envelopes into `hermes send` messages, watches the private answer-file
5
+ // wire, and replies to the sender with the mapped answer/error envelope.
6
+
7
+ import { spawn } from "node:child_process";
8
+ import * as fs from "node:fs";
9
+ import * as path from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ import {
13
+ bindEndpoint,
14
+ ensureComsDirs,
15
+ isCancelEnvelope,
16
+ isPromptEnvelope,
17
+ makeConnHandler,
18
+ makeEndpoint,
19
+ makeResponseEnvelope,
20
+ nowIso,
21
+ removeRegistryEntry,
22
+ resolveUniqueName,
23
+ sendEnvelope,
24
+ ulid,
25
+ writeAck,
26
+ writeNack,
27
+ writeRegistryAtomic,
28
+ type AgentCard,
29
+ type PromptEnvelope,
30
+ type RegistryEntry,
31
+ type SenderIdentity,
32
+ } from "./lib/coms-envelope.ts";
33
+ import {
34
+ formatTelegramQuestion,
35
+ isValidQid,
36
+ logPath as defaultLogPath,
37
+ makeLogRecord,
38
+ mapAnswerToAskResponse,
39
+ qidFromPromptEnvelope,
40
+ questionsDir as defaultQuestionsDir,
41
+ renderLogRecord,
42
+ timeoutMsFromEnv,
43
+ timeoutOutcome,
44
+ validateAnswerFile,
45
+ type BridgeEventName,
46
+ type QuestionOption,
47
+ type QuestionState,
48
+ } from "./lib/hermes-bridge-core.ts";
49
+
50
+ const KEEPALIVE_MS = 30_000;
51
+ const DEFAULT_POLL_MS = 1_000;
52
+ const COLOR = "#38BDF8";
53
+ const DEFAULT_NAME = "user-remote";
54
+ const DEFAULT_PURPOSE = "Remote human via Hermes/Telegram";
55
+ const HERMES_PROFILE_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
56
+
57
+ interface PendingQuestion {
58
+ env: PromptEnvelope;
59
+ state: QuestionState;
60
+ options: QuestionOption[];
61
+ timer: NodeJS.Timeout;
62
+ }
63
+
64
+ interface ParsedPrompt {
65
+ question: string;
66
+ context?: string;
67
+ options: QuestionOption[];
68
+ }
69
+
70
+ function flagValue(argv: string[], flag: string): string | null {
71
+ const positions = argv.flatMap((arg, index) => arg === flag ? [index] : []);
72
+ if (positions.length > 1) die(`${flag} may only be specified once`);
73
+ const i = positions[0] ?? -1;
74
+ return i >= 0 && i + 1 < argv.length ? argv[i + 1] : null;
75
+ }
76
+
77
+ function die(msg: string): never {
78
+ console.error(`coms-hermes-bridge: ${msg}`);
79
+ process.exit(1);
80
+ }
81
+
82
+ function parsePrompt(env: PromptEnvelope): ParsedPrompt {
83
+ try {
84
+ const parsed = JSON.parse(env.prompt) as { question?: unknown; context?: unknown; options?: unknown };
85
+ if (parsed && typeof parsed === "object" && typeof parsed.question === "string") {
86
+ const rawOptions = Array.isArray(parsed.options) ? parsed.options : [];
87
+ const options = rawOptions
88
+ .map((option): QuestionOption | null => {
89
+ if (typeof option === "string") return { title: option };
90
+ if (option && typeof option === "object" && typeof (option as { title?: unknown }).title === "string") {
91
+ const desc = (option as { description?: unknown }).description;
92
+ return typeof desc === "string"
93
+ ? { title: (option as { title: string }).title, description: desc }
94
+ : { title: (option as { title: string }).title };
95
+ }
96
+ return null;
97
+ })
98
+ .filter((option): option is QuestionOption => option !== null);
99
+ const context = typeof parsed.context === "string" && parsed.context.trim() ? parsed.context : undefined;
100
+ return { question: parsed.question, context, options };
101
+ }
102
+ } catch {
103
+ // Plain coms-cli prompts are expected; fall through.
104
+ }
105
+ return {
106
+ question: env.prompt,
107
+ context: `From ${env.sender_name} @ ${env.sender_cwd}`,
108
+ options: [],
109
+ };
110
+ }
111
+
112
+ function appendLogFile(logFile: string, qid: string, event: BridgeEventName, detail?: unknown): void {
113
+ fs.mkdirSync(path.dirname(logFile), { recursive: true });
114
+ fs.appendFileSync(logFile, renderLogRecord(makeLogRecord(qid, event, detail)));
115
+ }
116
+
117
+ function appendAnswerRejectLog(logFile: string, qid: string, detail: unknown): void {
118
+ fs.mkdirSync(path.dirname(logFile), { recursive: true });
119
+ fs.appendFileSync(logFile, JSON.stringify({ at: nowIso(), qid, event: "answer_rejected", detail }) + "\n");
120
+ }
121
+
122
+ function hermesSend(to: string, text: string, profile: string | null): Promise<void> {
123
+ return new Promise((resolve, reject) => {
124
+ const args = [...(profile ? ["--profile", profile] : []), "send", "--to", to, text];
125
+ const child = spawn("hermes", args, { stdio: ["ignore", "pipe", "pipe"] });
126
+ let stderr = "";
127
+ let stdout = "";
128
+ child.stdout?.on("data", (chunk) => { stdout += chunk.toString("utf-8"); });
129
+ child.stderr?.on("data", (chunk) => { stderr += chunk.toString("utf-8"); });
130
+ child.once("error", (err) => reject(err));
131
+ child.once("close", (code) => {
132
+ if (code === 0) {
133
+ resolve();
134
+ return;
135
+ }
136
+ const detail = (stderr || stdout).trim();
137
+ reject(new Error(`hermes send failed${code === null ? "" : ` (${code})`}${detail ? `: ${detail}` : ""}`));
138
+ });
139
+ });
140
+ }
141
+
142
+ async function main(): Promise<void> {
143
+ const argv = process.argv.slice(2);
144
+ const requestedName = flagValue(argv, "--name") ?? DEFAULT_NAME;
145
+ const project = flagValue(argv, "--project") ?? "default";
146
+ const to = flagValue(argv, "--to") ?? "telegram";
147
+ const hermesProfile = flagValue(argv, "--hermes-profile");
148
+ const timeoutMs = Number(flagValue(argv, "--timeout") ?? timeoutMsFromEnv());
149
+ const pollMs = Number(flagValue(argv, "--poll-ms") ?? DEFAULT_POLL_MS);
150
+ const qDir = flagValue(argv, "--questions-dir") ?? defaultQuestionsDir();
151
+ const logFile = path.join(path.dirname(qDir), path.basename(defaultLogPath()));
152
+
153
+ if (hermesProfile && (!HERMES_PROFILE_RE.test(hermesProfile) || hermesProfile === "." || hermesProfile.includes(".."))) die("--hermes-profile must be a safe profile name");
154
+ if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) die("--timeout must be a positive number");
155
+ if (!Number.isFinite(pollMs) || pollMs <= 0) die("--poll-ms must be a positive number");
156
+
157
+ ensureComsDirs(project);
158
+ fs.mkdirSync(qDir, { recursive: true });
159
+ fs.mkdirSync(path.dirname(logFile), { recursive: true });
160
+
161
+ const sessionId = ulid();
162
+ const uniqueName = resolveUniqueName(project, requestedName);
163
+ const id: SenderIdentity = {
164
+ session_id: sessionId,
165
+ name: uniqueName,
166
+ endpoint: makeEndpoint(sessionId),
167
+ cwd: process.cwd(),
168
+ };
169
+ const pending = new Map<string, PendingQuestion>();
170
+ const closed = new Map<string, QuestionState>();
171
+ // Answer files the liaison may still be mid-write: an invalid_json file is
172
+ // kept for a short grace window (first-seen timestamps below) instead of
173
+ // being eaten while the write is still in flight.
174
+ const invalidJsonSeen = new Map<string, number>();
175
+ const invalidJsonGraceMs = Math.max(2 * pollMs, 1_000);
176
+ const CLOSED_CAP = 1_000;
177
+
178
+ function markClosed(qid: string, state: QuestionState): void {
179
+ closed.set(qid, state);
180
+ if (closed.size > CLOSED_CAP) {
181
+ const oldest = closed.keys().next().value;
182
+ if (oldest !== undefined) closed.delete(oldest);
183
+ }
184
+ }
185
+
186
+ function queueDepth(): number {
187
+ return pending.size;
188
+ }
189
+
190
+ function registryEntry(): RegistryEntry {
191
+ return {
192
+ session_id: sessionId,
193
+ name: uniqueName,
194
+ purpose: DEFAULT_PURPOSE,
195
+ model: "hermes-bridge",
196
+ color: COLOR,
197
+ pid: process.pid,
198
+ endpoint: id.endpoint,
199
+ cwd: id.cwd,
200
+ started_at: nowIso(),
201
+ explicit: false,
202
+ version: 1,
203
+ context_used_pct: 0,
204
+ queue_depth: queueDepth(),
205
+ heartbeat_at: nowIso(),
206
+ };
207
+ }
208
+
209
+ async function sendResponse(env: PromptEnvelope, response: unknown, error: string | null = null): Promise<void> {
210
+ await sendEnvelope(env.sender_endpoint, makeResponseEnvelope(id, env.msg_id, response, error));
211
+ }
212
+
213
+ async function handleTimeout(qid: string): Promise<void> {
214
+ const item = pending.get(qid);
215
+ if (!item) return;
216
+ pending.delete(qid);
217
+ markClosed(qid, "timeout");
218
+ appendLogFile(logFile, qid, "timeout", { timeout_ms: timeoutMs });
219
+ const outcome = timeoutOutcome(qid, timeoutMs);
220
+ await hermesSend(to, outcome.telegramNote, hermesProfile).catch((err) => {
221
+ appendLogFile(logFile, qid, "delivery_error", { phase: "timeout_note", error: err instanceof Error ? err.message : String(err) });
222
+ });
223
+ await sendResponse(item.env, outcome.response, outcome.error).catch((err) => {
224
+ console.error(`coms-hermes-bridge: could not deliver timeout for ${qid}: ${err instanceof Error ? err.message : String(err)}`);
225
+ });
226
+ }
227
+
228
+ async function handlePrompt(env: PromptEnvelope): Promise<void> {
229
+ let qid: string;
230
+ try {
231
+ qid = qidFromPromptEnvelope(env);
232
+ } catch (err) {
233
+ await sendResponse(env, null, err instanceof Error ? err.message : String(err)).catch(() => {});
234
+ return;
235
+ }
236
+
237
+ const parsed = parsePrompt(env);
238
+ const duplicate = pending.get(qid);
239
+ if (duplicate) clearTimeout(duplicate.timer);
240
+ appendLogFile(logFile, qid, "question_received", { from: env.sender_name });
241
+ const timer = setTimeout(() => { void handleTimeout(qid); }, timeoutMs);
242
+ timer.unref?.();
243
+ pending.set(qid, { env, state: "pending", options: parsed.options, timer });
244
+
245
+ try {
246
+ await hermesSend(to, formatTelegramQuestion({
247
+ qid,
248
+ project,
249
+ question: parsed.question,
250
+ context: parsed.context,
251
+ options: parsed.options,
252
+ }), hermesProfile);
253
+ const item = pending.get(qid);
254
+ if (!item) return;
255
+ item.state = "delivered";
256
+ appendLogFile(logFile, qid, "delivered", { to });
257
+ } catch (err) {
258
+ const message = err instanceof Error ? err.message : String(err);
259
+ const item = pending.get(qid);
260
+ if (item) {
261
+ clearTimeout(item.timer);
262
+ pending.delete(qid);
263
+ }
264
+ appendLogFile(logFile, qid, "delivery_error", { error: message });
265
+ await sendResponse(env, null, message).catch((sendErr) => {
266
+ console.error(`coms-hermes-bridge: could not deliver error for ${qid}: ${sendErr instanceof Error ? sendErr.message : String(sendErr)}`);
267
+ });
268
+ }
269
+ }
270
+
271
+ async function handleCancel(refMsgId: string): Promise<void> {
272
+ if (!isValidQid(refMsgId)) return;
273
+ const item = pending.get(refMsgId);
274
+ if (!item) return;
275
+ clearTimeout(item.timer);
276
+ pending.delete(refMsgId);
277
+ markClosed(refMsgId, "cancelled");
278
+ appendLogFile(logFile, refMsgId, "cancelled", { reason: "cancel envelope" });
279
+ await hermesSend(to, `✖ [HUB-Q:${refMsgId}] The question was cancelled — it was answered from the console.`, hermesProfile).catch((err) => {
280
+ appendLogFile(logFile, refMsgId, "delivery_error", { phase: "cancel_note", error: err instanceof Error ? err.message : String(err) });
281
+ });
282
+ }
283
+
284
+ async function handleLateAnswer(qid: string): Promise<void> {
285
+ appendLogFile(logFile, qid, "late_answer", { state: closed.get(qid) ?? "unknown" });
286
+ await hermesSend(to, `ℹ [HUB-Q:${qid}] This question is already closed; the late answer was ignored.`, hermesProfile).catch((err) => {
287
+ appendLogFile(logFile, qid, "delivery_error", { phase: "late_note", error: err instanceof Error ? err.message : String(err) });
288
+ });
289
+ }
290
+
291
+ async function consumeAnswerFile(file: string): Promise<void> {
292
+ const full = path.join(qDir, file);
293
+ let raw: string;
294
+ try {
295
+ raw = fs.readFileSync(full, "utf-8");
296
+ } catch {
297
+ return;
298
+ }
299
+
300
+ const qidFromName = file.endsWith(".answer.json") ? file.slice(0, -".answer.json".length) : file;
301
+ if (isValidQid(qidFromName) && closed.has(qidFromName)) {
302
+ invalidJsonSeen.delete(file);
303
+ try { fs.unlinkSync(full); } catch { /* ignore */ }
304
+ await handleLateAnswer(qidFromName);
305
+ return;
306
+ }
307
+
308
+ const validation = validateAnswerFile(raw, full, pending.keys());
309
+ if (!validation.ok) {
310
+ if (validation.reason === "invalid_json") {
311
+ // Possibly a partial write from the liaison; retry until the grace expires.
312
+ const firstSeen = invalidJsonSeen.get(file);
313
+ if (firstSeen === undefined) {
314
+ invalidJsonSeen.set(file, Date.now());
315
+ return;
316
+ }
317
+ if (Date.now() - firstSeen < invalidJsonGraceMs) return;
318
+ }
319
+ invalidJsonSeen.delete(file);
320
+ const logQid = validation.qid && isValidQid(validation.qid) ? validation.qid : (isValidQid(qidFromName) ? qidFromName : "00000000000000000000000000");
321
+ // Remove the rejected file before publishing the event. Consumers use the
322
+ // log as the completion signal and may immediately write a corrected file
323
+ // at the same path; logging first lets this scan delete that replacement.
324
+ try { fs.unlinkSync(full); } catch { /* ignore */ }
325
+ appendAnswerRejectLog(logFile, logQid, { reason: validation.reason, file });
326
+ return;
327
+ }
328
+
329
+ invalidJsonSeen.delete(file);
330
+ const item = pending.get(validation.qid);
331
+ if (!item) return;
332
+ clearTimeout(item.timer);
333
+ pending.delete(validation.qid);
334
+ markClosed(validation.qid, "answered");
335
+ try { fs.unlinkSync(full); } catch { /* ignore */ }
336
+ appendLogFile(logFile, validation.qid, "answered", { answered_by: validation.answer.answered_by });
337
+ const response = mapAnswerToAskResponse(validation.answer.answer, item.options);
338
+ await sendResponse(item.env, response).catch((err) => {
339
+ console.error(`coms-hermes-bridge: could not deliver answer for ${validation.qid}: ${err instanceof Error ? err.message : String(err)}`);
340
+ });
341
+ }
342
+
343
+ async function scanAnswers(): Promise<void> {
344
+ let files: string[];
345
+ try {
346
+ files = fs.readdirSync(qDir);
347
+ } catch {
348
+ return;
349
+ }
350
+ for (const file of files) {
351
+ await consumeAnswerFile(file);
352
+ }
353
+ }
354
+
355
+ const server = await bindEndpoint(
356
+ id.endpoint,
357
+ makeConnHandler((env, socket) => {
358
+ if (isPromptEnvelope(env)) {
359
+ writeAck(socket, env.msg_id);
360
+ void handlePrompt(env);
361
+ } else if (isCancelEnvelope(env)) {
362
+ writeAck(socket, env.msg_id);
363
+ void handleCancel(env.ref_msg_id);
364
+ } else if ((env as { type?: string }).type === "ping") {
365
+ const card: AgentCard = {
366
+ name: uniqueName,
367
+ purpose: DEFAULT_PURPOSE,
368
+ model: "hermes-bridge",
369
+ color: COLOR,
370
+ context_used_pct: 0,
371
+ queue_depth: queueDepth(),
372
+ };
373
+ try {
374
+ socket.write(JSON.stringify({ type: "pong", msg_id: (env as { msg_id?: string }).msg_id ?? "", agent_card: card }) + "\n");
375
+ } catch { /* ignore */ }
376
+ try { socket.end(); } catch { /* ignore */ }
377
+ } else {
378
+ writeNack(socket, (env as { msg_id?: string }).msg_id ?? "", "bridge accepts prompts, cancels, and pings");
379
+ }
380
+ }),
381
+ );
382
+
383
+ const keepalive = setInterval(() => {
384
+ try { writeRegistryAtomic(registryEntry(), project); } catch { /* best-effort */ }
385
+ }, KEEPALIVE_MS);
386
+ keepalive.unref?.();
387
+ const watcher = setInterval(() => { void scanAnswers(); }, pollMs);
388
+ watcher.unref?.();
389
+
390
+ let shuttingDown = false;
391
+ function shutdown(): void {
392
+ if (shuttingDown) return;
393
+ shuttingDown = true;
394
+ clearInterval(keepalive);
395
+ clearInterval(watcher);
396
+ for (const item of pending.values()) clearTimeout(item.timer);
397
+ try { server.close(); } catch { /* ignore */ }
398
+ try { fs.unlinkSync(id.endpoint); } catch { /* ignore */ }
399
+ removeRegistryEntry(project, uniqueName);
400
+ process.exit(0);
401
+ }
402
+ process.on("SIGTERM", shutdown);
403
+ process.on("SIGINT", shutdown);
404
+
405
+ // Publish readiness only after shutdown handlers are installed. A caller may
406
+ // terminate the bridge as soon as its registry entry appears; publishing
407
+ // earlier can bypass cleanup and leave both the entry and socket behind.
408
+ writeRegistryAtomic(registryEntry(), project);
409
+ console.error(`coms-hermes-bridge: ${uniqueName}@${project} listening (${to})`);
410
+ }
411
+
412
+ const isEntry = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
413
+ if (isEntry) void main();
@@ -0,0 +1,198 @@
1
+ // Unified `just fleet` command dispatcher. Parsing is kept pure and tested in
2
+ // scripts/lib/fleet-command.test.ts; this entrypoint only hands the resolved
3
+ // recipe back to Just so existing compatibility recipes remain one source of truth.
4
+
5
+ import { spawnSync } from "node:child_process";
6
+ import { parseFleetCommand } from "./lib/fleet-command.ts";
7
+ import { resolveMonitorEnv } from "./lib/monitor-env.ts";
8
+
9
+ const HELP = `Agent Fleet — one guarded Hub runtime, two work modes, independent topology
10
+
11
+ SET UP A NEW REPOSITORY
12
+ npx @chankov/agent-fleet@latest setup
13
+ Run this from the target repository. A repository without Agent Fleet has
14
+ no justfile yet — setup writes it — so the first install cannot use just.
15
+ Select Default/Full and optional features, inspect the exact plan, then
16
+ confirm once to apply it. Follow with just fleet deps, then just fleet doctor.
17
+ Source checkout development: node bin/cli.js setup.
18
+ Once installed, just fleet setup wraps the same command for this repository.
19
+
20
+ QUICK START
21
+ just fleet # Hub/operator, empty native roster
22
+ just fleet --agents frontend # Hub/orchestrator with native specialists
23
+ just fleet --herdr --project af
24
+ # Hub/operator in a one-pane Herdr workspace
25
+ just fleet --agents frontend --peers frontend --project af
26
+ # matching native roster + standing peers
27
+
28
+ DETERMINISTIC FLOWS
29
+ just flow quality
30
+ just flow scout "where is authentication configured?"
31
+ just flow build-test "add the validated endpoint"
32
+ Run code-owned headless phase graphs on isolated flow/<name>-<runId> branches.
33
+
34
+ just flow cleanup # list flow branches and prompt for a number
35
+ just flow cleanup 2 # safely remove empty/integrated selection 2
36
+ just flow merge # list flow branches and prompt for a number
37
+ just flow merge 2 # squash-merge accepted selection 2, then remove it
38
+ Cleanup and merge require Worktrunk. Dirty worktrees are refused; merge
39
+ targets the source branch recorded when the run started. See docs/workflows.md.
40
+
41
+ FLEET CORE — loaded in every Pi mode
42
+ Damage Control Continue · local/remote ask_user · Compact & Continue
43
+ BTW side sessions · update checker (voice is opt-in with --voice)
44
+
45
+ UNIFIED HUB
46
+ just fleet [--work-mode operator|orchestrator] [--agents <roster>]
47
+ [--herdr] [--peers <preset>] [--no-coms] [PI_ARGS...]
48
+ Bare Fleet always loads Agent Hub in operator work mode. Operator keeps
49
+ read/bash/edit/write plus orchestration; the initial native roster is empty.
50
+ --agents selects .pi/agents/teams.yaml and implies orchestrator unless an
51
+ explicit --work-mode operator is supplied. --no-coms leaves direct/native work
52
+ available while coms, peer dispatch, and handoff refuse actionably.
53
+
54
+ WORK MODE AND ROSTER
55
+ /af-work-mode # report work mode and capability state
56
+ /af-agents-add code-reviewer # add a native Pi specialist at runtime
57
+ /af-work-mode orchestrator # remove direct coding tools; keep orchestration
58
+ /af-work-mode operator # restore the approved direct tool surface
59
+
60
+ Work mode is independent from the native roster and peer topology. Budgets follow task tier.
61
+ All Hub slash commands, including /af-handoff, stay registered in both work modes;
62
+ actions whose coms/Herdr capability is unavailable return remediation guidance.
63
+
64
+ Explicit dispatch backend examples (inside the Hub):
65
+ dispatch_agent({ agent: "code-reviewer", task: "Review the diff", backend: "native" })
66
+ dispatch_agent({ agent: "code-reviewer", task: "Review the diff", backend: "coms" })
67
+ backend "auto" follows .pi/agents/dispatch-policy.yaml; native always starts
68
+ the local Pi specialist, while coms requires a live same-name peer and never
69
+ falls back to native.
70
+
71
+ HERDR TOPOLOGY — requires a running Herdr server (https://herdr.dev)
72
+ just fleet --herdr [--project <name>]
73
+ Hub-only workspace using the empty base peer preset.
74
+
75
+ just fleet --peers <preset> [--agents <roster>] [--project <name>]
76
+ Add standing Pi/Claude peers from .pi/agents/peers.yaml. Hub and every peer
77
+ receive the same project. Add --dry-run to print the redacted layout only.
78
+
79
+ Dynamic Claude reviewer from a Hub already running inside Herdr:
80
+ herdr_spawn_peer({ name: "code-reviewer" })
81
+ coms_send({ target: "code-reviewer", prompt: "Review the current diff" })
82
+ coms_await({ msg_id: "<returned-id>" })
83
+ /af-handoff code-reviewer
84
+ The declared runner may be Claude Code. Spawn requires Herdr; messaging and
85
+ handoff require coms readiness and a target visible in this Hub's project pool.
86
+ Every spawned peer gets a sibling pane and is locked to the Hub's project.
87
+
88
+ ONE STANDALONE PEER
89
+ just fleet peer <name> [--runner pi|claude-code] [--persona <p>|--no-persona]
90
+ [--model <m>] [--project <p>] [--extensions a,b]
91
+ [--browser] [--all-extensions] [--direction right|down]
92
+ [--here] [--dry-run] [-- PI_ARGS...]
93
+ A single addressable peer. Inside Herdr it splits the current pane; outside
94
+ it creates a one-pane workspace; --here uses this terminal. A peers.yaml
95
+ declaration controls runner/model/extensions/env_file. A matching persona
96
+ starts guarded Pi; --runner claude-code starts Claude Code plus its bridge.
97
+
98
+ TEAM LIFECYCLE
99
+ just fleet snapshot <preset> [--project <name>]
100
+ just fleet down <preset> [--project <name>]
101
+ just fleet resume <preset> [--project <name>]
102
+ Save session refs, close cleanly, and rebuild available Pi/Claude sessions.
103
+
104
+ HERMES CONDUCTOR
105
+ just fleet conductor hermes [preset] [--dry-run] [TEAM_ARGS...]
106
+ Start Hermes with a peer team, or preview the layout with --dry-run.
107
+
108
+ CODEX REMOTE-CONTROL CONDUCTOR
109
+ just fleet conductor codex <setup|reconfigure> [preset] [ARGS...]
110
+ just fleet conductor codex <pair|start|status|stop|recover|uninstall>
111
+ just fleet conductor codex [preset] [--dry-run] [TEAM_ARGS...]
112
+
113
+ CAPABILITY FLAGS
114
+ --browser Add Chrome DevTools MCP tools to the Hub/main Pi process.
115
+ --voice Load pi-voice-stt after selecting the voice setup feature.
116
+ --all-extensions Also auto-load project/global extensions outside Fleet Core.
117
+ --no-coms Disable only the Hub's embedded coms layer.
118
+
119
+ COMPATIBILITY ALIASES — accepted with migration warnings
120
+ just fleet hub [--solo] ... -> just fleet [--no-coms] ...
121
+ just fleet team <preset> ... -> just fleet --agents <roster> --peers <preset> ...
122
+ just fleet team <preset> --no-hub -> legacy peers-only topology
123
+ Legacy peer-only presets full/web/docs retain the default native roster.
124
+
125
+ LIFECYCLE
126
+ just fleet setup [--dry-run] [--preset default|full --features none --yes]
127
+ Reconcile desired state with the newest published package. Preset and
128
+ features are remembered in .ai/agent-fleet.json, so a plain setup needs no
129
+ flags; flags apply to one run unless --save-desired persists them.
130
+ just fleet deps
131
+ Install only .pi/extensions and .pi/harnesses Node dependencies.
132
+ Does not launch Pi, configure STT, install ffmpeg/Herdr, or pair Codex.
133
+ just fleet doctor [--fix]
134
+ just fleet uninstall --all --yes
135
+ Reinstall after self-uninstall with npx @chankov/agent-fleet@latest setup.
136
+
137
+ UPDATE NOTE
138
+ Update with: just fleet setup --dry-run, then just fleet setup, then deps+doctor.
139
+ setup reconciles TOWARD the package: an artifact you edited in place is
140
+ refreshed and your edit overwritten. --dry-run shows that before it happens;
141
+ .ai/agent-fleet-overrides.md is the customization no lifecycle command touches.
142
+ If you and the new version changed the same file, setup exits 3 having written
143
+ nothing — re-run with --on-conflict theirs or --on-conflict ours.
144
+ pi update --extensions updates pi extensions only; it does not update this npm
145
+ installer. just fleet install was removed; use setup or deps.
146
+
147
+ HELP
148
+ just Show this complete command guide.
149
+ just fleet help Show this complete command guide.
150
+ just --list Show the intentionally small public recipe surface.
151
+
152
+ Configuration:
153
+ Native rosters: .pi/agents/teams.yaml
154
+ Peer presets: .pi/agents/peers.yaml
155
+ Routing: .pi/agents/dispatch-policy.yaml
156
+ Overrides: .ai/agent-fleet-overrides.md
157
+ Safety: .pi/damage-control-rules.yaml
158
+ Full docs: docs/pi-extensions.md and docs/pi-setup.md
159
+ `;
160
+
161
+ function main(): void {
162
+ const argv = process.argv.slice(2);
163
+ if (argv[0] === "help" || argv[0] === "--help" || argv[0] === "-h") {
164
+ process.stdout.write(HELP);
165
+ return;
166
+ }
167
+ let invocation;
168
+ try {
169
+ invocation = parseFleetCommand(argv);
170
+ } catch (err) {
171
+ console.error(`fleet: ${err instanceof Error ? err.message : String(err)}\n`);
172
+ process.stderr.write(HELP);
173
+ process.exitCode = 2;
174
+ return;
175
+ }
176
+ for (const warning of invocation.warnings ?? []) {
177
+ console.error(`fleet: warning: ${warning}`);
178
+ }
179
+ // Every mode gets the monitor variables, not just `hub`: a plain `just fleet`
180
+ // or a `peer` loads no agent-hub and so reads them never, while `hub` and
181
+ // `team` both reach the hub through a Just recipe that inherits this
182
+ // environment. Deciding here rather than per recipe keeps it one line of
183
+ // truth; a null answer (opted out, or no directory we can make private)
184
+ // leaves the environment untouched and the hub unmonitored, exactly as
185
+ // before this existed.
186
+ const result = spawnSync("just", [invocation.recipe, ...invocation.args], {
187
+ stdio: "inherit",
188
+ env: { ...process.env, ...(resolveMonitorEnv() ?? {}) },
189
+ });
190
+ if (result.error) {
191
+ console.error(`fleet: could not run just: ${result.error.message}`);
192
+ process.exitCode = 1;
193
+ return;
194
+ }
195
+ process.exitCode = result.status ?? 1;
196
+ }
197
+
198
+ main();