@chankov/agent-fleet 0.0.3 → 0.0.5

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 (608) hide show
  1. package/.claude/commands/set-hermes-telegram.md +15 -0
  2. package/.claude/commands/setup-agent-fleet.md +1 -1
  3. package/.opencode/commands/af-set-hermes-telegram.md +15 -0
  4. package/.opencode/commands/af-setup-agent-fleet.md +1 -1
  5. package/.pi/agents/dispatch-policy.yaml +1 -1
  6. package/.pi/agents/peers.yaml +4 -4
  7. package/.pi/extensions/chrome-devtools-mcp/README.md +1 -1
  8. package/.pi/extensions/mcp-bridge/README.md +1 -1
  9. package/.pi/harnesses/agent-hub/README.md +223 -40
  10. package/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  11. package/.pi/harnesses/agent-hub/delegate.ts +32 -9
  12. package/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
  13. package/.pi/harnesses/agent-hub/footer.ts +29 -0
  14. package/.pi/harnesses/agent-hub/helpers.ts +49 -0
  15. package/.pi/harnesses/agent-hub/index.ts +1037 -246
  16. package/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  17. package/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  18. package/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  19. package/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  20. package/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  21. package/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
  22. package/.pi/harnesses/agent-hub/package.json +5 -4
  23. package/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  24. package/.pi/harnesses/agent-hub/run-budget.js +155 -0
  25. package/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  26. package/.pi/harnesses/agent-hub/spawn.ts +161 -94
  27. package/.pi/harnesses/agent-hub/version.ts +18 -0
  28. package/.pi/harnesses/ask-user-remote/README.md +1 -0
  29. package/.pi/harnesses/ask-user-remote/index.ts +36 -8
  30. package/.pi/harnesses/coms/README.md +15 -5
  31. package/.pi/harnesses/coms/index.ts +2 -0
  32. package/.pi/harnesses/coms/package.json +5 -4
  33. package/.pi/harnesses/coms/version.ts +18 -0
  34. package/.pi/harnesses/damage-control-continue/README.md +36 -35
  35. package/.pi/harnesses/damage-control-continue/index.ts +23 -9
  36. package/.pi/harnesses/damage-control-continue/package.json +5 -4
  37. package/.pi/harnesses/damage-control-continue/version.ts +18 -0
  38. package/.pi/harnesses/{damage-control/shared.ts → lib/damage-control-shared.ts} +20 -6
  39. package/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  40. package/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
  41. package/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  42. package/.pi/harnesses/lib/hermes-monitor-socket.ts +118 -0
  43. package/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  44. package/.pi/prompts/set-hermes-telegram.md +15 -0
  45. package/.pi/prompts/setup-agent-fleet.md +1 -1
  46. package/.versions/0.0.4/.claude/commands/build.md +44 -0
  47. package/.versions/0.0.4/.claude/commands/code-simplify.md +22 -0
  48. package/.versions/0.0.4/.claude/commands/design-agent.md +14 -0
  49. package/.versions/0.0.4/.claude/commands/doctor-agent-fleet.md +17 -0
  50. package/.versions/0.0.4/.claude/commands/orchestrate.md +112 -0
  51. package/.versions/0.0.4/.claude/commands/plan.md +16 -0
  52. package/.versions/0.0.4/.claude/commands/prime.md +22 -0
  53. package/.versions/0.0.4/.claude/commands/review.md +16 -0
  54. package/.versions/0.0.4/.claude/commands/setup-agent-fleet.md +25 -0
  55. package/.versions/0.0.4/.claude/commands/ship.md +72 -0
  56. package/.versions/0.0.4/.claude/commands/spec.md +15 -0
  57. package/.versions/0.0.4/.claude/commands/test.md +19 -0
  58. package/.versions/0.0.4/.claude/commands/webperf.md +32 -0
  59. package/.versions/0.0.4/.claude/orchestrate-teams.yaml +24 -0
  60. package/.versions/0.0.4/.opencode/commands/af-build.md +17 -0
  61. package/.versions/0.0.4/.opencode/commands/af-code-simplify.md +16 -0
  62. package/.versions/0.0.4/.opencode/commands/af-compound.md +16 -0
  63. package/.versions/0.0.4/.opencode/commands/af-design-agent.md +15 -0
  64. package/.versions/0.0.4/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  65. package/.versions/0.0.4/.opencode/commands/af-orchestrate.md +112 -0
  66. package/.versions/0.0.4/.opencode/commands/af-plan.md +16 -0
  67. package/.versions/0.0.4/.opencode/commands/af-prime.md +22 -0
  68. package/.versions/0.0.4/.opencode/commands/af-review.md +15 -0
  69. package/.versions/0.0.4/.opencode/commands/af-setup-agent-fleet.md +15 -0
  70. package/.versions/0.0.4/.opencode/commands/af-ship.md +16 -0
  71. package/.versions/0.0.4/.opencode/commands/af-spec.md +16 -0
  72. package/.versions/0.0.4/.opencode/commands/af-test.md +21 -0
  73. package/.versions/0.0.4/.opencode/commands/af-webperf.md +32 -0
  74. package/.versions/0.0.4/.opencode/orchestrate-teams.yaml +24 -0
  75. package/.versions/0.0.4/.pi/agents/dispatch-policy.yaml +32 -0
  76. package/.versions/0.0.4/.pi/agents/model-profiles.yaml +20 -0
  77. package/.versions/0.0.4/.pi/agents/peers.yaml +146 -0
  78. package/.versions/0.0.4/.pi/agents/teams.yaml +39 -0
  79. package/.versions/0.0.4/.pi/damage-control-rules.yaml +297 -0
  80. package/.versions/0.0.4/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  81. package/.versions/0.0.4/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  82. package/{.pi/harnesses/damage-control → .versions/0.0.4/.pi/extensions/agent-fleet-update-check}/package.json +1 -1
  83. package/.versions/0.0.4/.pi/extensions/btw/README.md +118 -0
  84. package/.versions/0.0.4/.pi/extensions/btw/index.ts +917 -0
  85. package/.versions/0.0.4/.pi/extensions/btw/package.json +6 -0
  86. package/.versions/0.0.4/.pi/extensions/btw/state.js +179 -0
  87. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  88. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
  89. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  90. package/.versions/0.0.4/.pi/extensions/compact-and-continue/README.md +42 -0
  91. package/.versions/0.0.4/.pi/extensions/compact-and-continue/index.ts +120 -0
  92. package/.versions/0.0.4/.pi/extensions/compact-and-continue/package.json +6 -0
  93. package/.versions/0.0.4/.pi/extensions/mcp-bridge/README.md +46 -0
  94. package/.versions/0.0.4/.pi/extensions/mcp-bridge/index.ts +206 -0
  95. package/.versions/0.0.4/.pi/extensions/mcp-bridge/package.json +6 -0
  96. package/.versions/0.0.4/.pi/extensions/package-lock.json +1143 -0
  97. package/.versions/0.0.4/.pi/extensions/package.json +9 -0
  98. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/README.md +201 -0
  99. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/config.ts +198 -0
  100. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  101. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/index.ts +248 -0
  102. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/package.json +6 -0
  103. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  104. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  105. package/.versions/0.0.4/.pi/harnesses/agent-hub/README.md +798 -0
  106. package/.versions/0.0.4/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  107. package/.versions/0.0.4/.pi/harnesses/agent-hub/artifacts.js +92 -0
  108. package/.versions/0.0.4/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  109. package/.versions/0.0.4/.pi/harnesses/agent-hub/delegate.ts +386 -0
  110. package/.versions/0.0.4/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
  111. package/.versions/0.0.4/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  112. package/.versions/0.0.4/.pi/harnesses/agent-hub/footer.ts +29 -0
  113. package/.versions/0.0.4/.pi/harnesses/agent-hub/helpers.ts +214 -0
  114. package/.versions/0.0.4/.pi/harnesses/agent-hub/index.ts +8045 -0
  115. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  116. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  117. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  118. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  119. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  120. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
  121. package/.versions/0.0.4/.pi/harnesses/agent-hub/package.json +7 -0
  122. package/.versions/0.0.4/.pi/harnesses/agent-hub/research-retention.js +34 -0
  123. package/.versions/0.0.4/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  124. package/.versions/0.0.4/.pi/harnesses/agent-hub/return-contract.js +215 -0
  125. package/.versions/0.0.4/.pi/harnesses/agent-hub/run-budget.js +155 -0
  126. package/.versions/0.0.4/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  127. package/.versions/0.0.4/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  128. package/.versions/0.0.4/.pi/harnesses/agent-hub/spawn.ts +246 -0
  129. package/.versions/0.0.4/.pi/harnesses/agent-hub/version.ts +18 -0
  130. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/README.md +18 -0
  131. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/index.ts +293 -0
  132. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  133. package/.versions/0.0.4/.pi/harnesses/coms/README.md +92 -0
  134. package/.versions/0.0.4/.pi/harnesses/coms/index.ts +1745 -0
  135. package/.versions/0.0.4/.pi/harnesses/coms/package.json +7 -0
  136. package/.versions/0.0.4/.pi/harnesses/coms/version.ts +18 -0
  137. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/README.md +117 -0
  138. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/index.ts +536 -0
  139. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/package.json +7 -0
  140. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/version.ts +18 -0
  141. package/.versions/0.0.4/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  142. package/.versions/0.0.4/.pi/harnesses/lib/herdr-client.ts +458 -0
  143. package/.versions/0.0.4/.pi/harnesses/lib/herdr-presence.ts +288 -0
  144. package/.versions/0.0.4/.pi/harnesses/package-lock.json +35 -0
  145. package/.versions/0.0.4/.pi/harnesses/package.json +9 -0
  146. package/.versions/0.0.4/.pi/prompts/build.md +24 -0
  147. package/.versions/0.0.4/.pi/prompts/code-simplify.md +22 -0
  148. package/.versions/0.0.4/.pi/prompts/doctor-agent-fleet.md +15 -0
  149. package/.versions/0.0.4/.pi/prompts/plan.md +16 -0
  150. package/.versions/0.0.4/.pi/prompts/review.md +16 -0
  151. package/.versions/0.0.4/.pi/prompts/setup-agent-fleet.md +27 -0
  152. package/.versions/0.0.4/.pi/prompts/ship.md +17 -0
  153. package/.versions/0.0.4/.pi/prompts/spec.md +15 -0
  154. package/.versions/0.0.4/.pi/prompts/test.md +19 -0
  155. package/.versions/0.0.4/.pi/skills/bowser/SKILL.md +145 -0
  156. package/.versions/0.0.4/.version +1 -0
  157. package/.versions/0.0.4/agents/architect.md +23 -0
  158. package/.versions/0.0.4/agents/bowser.md +26 -0
  159. package/.versions/0.0.4/agents/builder.md +53 -0
  160. package/.versions/0.0.4/agents/code-reviewer.md +205 -0
  161. package/.versions/0.0.4/agents/deep-researcher.md +31 -0
  162. package/.versions/0.0.4/agents/documenter.md +18 -0
  163. package/.versions/0.0.4/agents/orchestrator.md +54 -0
  164. package/.versions/0.0.4/agents/plan-reviewer.md +60 -0
  165. package/.versions/0.0.4/agents/planner.md +69 -0
  166. package/.versions/0.0.4/agents/releaser.md +24 -0
  167. package/.versions/0.0.4/agents/researcher.md +28 -0
  168. package/.versions/0.0.4/agents/security-auditor.md +166 -0
  169. package/.versions/0.0.4/agents/test-engineer.md +151 -0
  170. package/.versions/0.0.4/agents/web-debugger.md +42 -0
  171. package/.versions/0.0.4/agents/web-performance-auditor.md +192 -0
  172. package/.versions/0.0.4/codex/CONDUCTOR.md +148 -0
  173. package/.versions/0.0.4/docs/ARCHITECTURE.md +210 -0
  174. package/.versions/0.0.4/docs/agent-fleet-setup.md +366 -0
  175. package/.versions/0.0.4/docs/claude-code-coms-bridge.md +103 -0
  176. package/.versions/0.0.4/docs/codex-remote-conductor.md +170 -0
  177. package/.versions/0.0.4/docs/coms-hermes-bridge.md +121 -0
  178. package/.versions/0.0.4/docs/getting-started.md +183 -0
  179. package/.versions/0.0.4/docs/npm-install.md +337 -0
  180. package/.versions/0.0.4/docs/opencode-setup.md +248 -0
  181. package/.versions/0.0.4/docs/pi-extensions.md +288 -0
  182. package/.versions/0.0.4/docs/pi-setup.md +463 -0
  183. package/.versions/0.0.4/docs/skill-anatomy.md +150 -0
  184. package/.versions/0.0.4/hermes/README.md +228 -0
  185. package/.versions/0.0.4/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  186. package/.versions/0.0.4/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  187. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +15 -0
  188. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +19 -0
  189. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +13 -0
  190. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +11 -0
  191. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +9 -0
  192. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +17 -0
  193. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +34 -0
  194. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +151 -0
  195. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +39 -0
  196. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  197. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +12 -0
  198. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  199. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +22 -0
  200. package/.versions/0.0.4/hermes/skills/hub-conductor/SKILL.md +84 -0
  201. package/.versions/0.0.4/hermes/skills/hub-liaison/SKILL.md +84 -0
  202. package/.versions/0.0.4/hooks/SIMPLIFY-IGNORE.md +90 -0
  203. package/.versions/0.0.4/hooks/coms-stop-hook.mjs +73 -0
  204. package/.versions/0.0.4/hooks/hooks.json +14 -0
  205. package/.versions/0.0.4/hooks/session-start.sh +74 -0
  206. package/.versions/0.0.4/hooks/simplify-ignore.sh +302 -0
  207. package/.versions/0.0.4/justfile +256 -0
  208. package/.versions/0.0.4/references/accessibility-checklist.md +160 -0
  209. package/.versions/0.0.4/references/definition-of-done.md +67 -0
  210. package/.versions/0.0.4/references/fleet-coordination-patterns.md +151 -0
  211. package/.versions/0.0.4/references/observability-checklist.md +91 -0
  212. package/.versions/0.0.4/references/orchestration-patterns.md +370 -0
  213. package/.versions/0.0.4/references/performance-checklist.md +153 -0
  214. package/.versions/0.0.4/references/prompting-patterns.md +380 -0
  215. package/.versions/0.0.4/references/security-checklist.md +179 -0
  216. package/.versions/0.0.4/references/testing-patterns.md +236 -0
  217. package/.versions/0.0.4/scripts/codex-conductor.ts +41 -0
  218. package/.versions/0.0.4/scripts/codex-remote-control.ts +167 -0
  219. package/.versions/0.0.4/scripts/coms-claude-bridge.ts +286 -0
  220. package/.versions/0.0.4/scripts/coms-cli.ts +484 -0
  221. package/.versions/0.0.4/scripts/coms-hermes-bridge.ts +403 -0
  222. package/.versions/0.0.4/scripts/hermes-monitor-capability-runner.ts +25 -0
  223. package/.versions/0.0.4/scripts/hermes-monitor-scenario.ts +7 -0
  224. package/.versions/0.0.4/scripts/lib/claude-bridge-core.ts +100 -0
  225. package/.versions/0.0.4/scripts/lib/codex-conductor.ts +88 -0
  226. package/.versions/0.0.4/scripts/lib/codex-remote-control.ts +480 -0
  227. package/.versions/0.0.4/scripts/lib/coms-envelope.ts +539 -0
  228. package/.versions/0.0.4/scripts/lib/fake-herdr-server.ts +88 -0
  229. package/.versions/0.0.4/scripts/lib/herdr-layout.ts +263 -0
  230. package/.versions/0.0.4/scripts/lib/hermes-bridge-core.ts +238 -0
  231. package/.versions/0.0.4/scripts/lib/hermes-monitor-herdr.ts +28 -0
  232. package/.versions/0.0.4/scripts/lib/hermes-monitor-model.ts +9 -0
  233. package/.versions/0.0.4/scripts/lib/hermes-monitor-registry.ts +6 -0
  234. package/.versions/0.0.4/scripts/lib/hermes-monitor-socket.ts +118 -0
  235. package/.versions/0.0.4/scripts/lib/hermes-monitor-store.ts +31 -0
  236. package/.versions/0.0.4/scripts/lib/persona-banner.ts +62 -0
  237. package/.versions/0.0.4/scripts/lib/spawn-stagger.ts +101 -0
  238. package/.versions/0.0.4/scripts/lib/team-project.ts +184 -0
  239. package/.versions/0.0.4/scripts/lib/team-snapshot.ts +147 -0
  240. package/.versions/0.0.4/scripts/peer-banner.ts +40 -0
  241. package/.versions/0.0.4/scripts/team-snapshot.ts +238 -0
  242. package/.versions/0.0.4/scripts/team-up.ts +333 -0
  243. package/.versions/0.0.4/skills/_internal/grilling.md +11 -0
  244. package/.versions/0.0.4/skills/browser-testing-with-devtools/SKILL.md +352 -0
  245. package/.versions/0.0.4/skills/code-review-and-quality/SKILL.md +381 -0
  246. package/.versions/0.0.4/skills/compound-learning/SKILL.md +137 -0
  247. package/.versions/0.0.4/skills/context-engineering/SKILL.md +291 -0
  248. package/.versions/0.0.4/skills/deprecation-and-migration/SKILL.md +206 -0
  249. package/.versions/0.0.4/skills/designing-agents/SKILL.md +394 -0
  250. package/.versions/0.0.4/skills/designing-agents/pi-harness-authoring.md +222 -0
  251. package/.versions/0.0.4/skills/frontend-ui-engineering/SKILL.md +328 -0
  252. package/.versions/0.0.4/skills/git-workflow-and-versioning/SKILL.md +316 -0
  253. package/.versions/0.0.4/skills/guided-workspace-setup/SKILL.md +535 -0
  254. package/.versions/0.0.4/skills/guided-workspace-setup/companion-manifest.json +33 -0
  255. package/.versions/0.0.4/skills/idea-refine/SKILL.md +182 -0
  256. package/.versions/0.0.4/skills/idea-refine/examples.md +238 -0
  257. package/.versions/0.0.4/skills/idea-refine/frameworks.md +99 -0
  258. package/.versions/0.0.4/skills/idea-refine/refinement-criteria.md +113 -0
  259. package/.versions/0.0.4/skills/idea-refine/scripts/idea-refine.sh +15 -0
  260. package/.versions/0.0.4/skills/incremental-implementation/SKILL.md +287 -0
  261. package/.versions/0.0.4/skills/interview-me/SKILL.md +226 -0
  262. package/.versions/0.0.4/skills/orchestration-verification/SKILL.md +181 -0
  263. package/.versions/0.0.4/skills/peer-coms/SKILL.md +90 -0
  264. package/.versions/0.0.4/skills/performance-optimization/SKILL.md +350 -0
  265. package/.versions/0.0.4/skills/planning-and-task-breakdown/SKILL.md +236 -0
  266. package/.versions/0.0.4/skills/security-and-hardening/SKILL.md +461 -0
  267. package/.versions/0.0.4/skills/spec-driven-development/SKILL.md +245 -0
  268. package/.versions/0.0.4/skills/using-agent-skills/SKILL.md +199 -0
  269. package/.versions/0.0.4/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  270. package/.versions/0.0.4/vendor/agent-skills-upstream/LICENSE +21 -0
  271. package/.versions/0.0.4/vendor/agent-skills-upstream/README.md +11 -0
  272. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  273. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  274. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  275. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  276. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  277. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  278. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  279. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  280. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  281. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  282. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  283. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  284. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  285. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  286. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  287. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  288. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  289. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  290. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  291. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  292. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  293. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  294. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  295. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  296. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  297. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  298. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  299. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  300. package/.versions/0.0.5/.claude/commands/build.md +44 -0
  301. package/.versions/0.0.5/.claude/commands/code-simplify.md +22 -0
  302. package/.versions/0.0.5/.claude/commands/design-agent.md +14 -0
  303. package/.versions/0.0.5/.claude/commands/doctor-agent-fleet.md +17 -0
  304. package/.versions/0.0.5/.claude/commands/orchestrate.md +112 -0
  305. package/.versions/0.0.5/.claude/commands/plan.md +16 -0
  306. package/.versions/0.0.5/.claude/commands/prime.md +22 -0
  307. package/.versions/0.0.5/.claude/commands/review.md +16 -0
  308. package/.versions/0.0.5/.claude/commands/set-hermes-telegram.md +15 -0
  309. package/.versions/0.0.5/.claude/commands/setup-agent-fleet.md +25 -0
  310. package/.versions/0.0.5/.claude/commands/ship.md +72 -0
  311. package/.versions/0.0.5/.claude/commands/spec.md +15 -0
  312. package/.versions/0.0.5/.claude/commands/test.md +19 -0
  313. package/.versions/0.0.5/.claude/commands/webperf.md +32 -0
  314. package/.versions/0.0.5/.claude/orchestrate-teams.yaml +24 -0
  315. package/.versions/0.0.5/.opencode/commands/af-build.md +17 -0
  316. package/.versions/0.0.5/.opencode/commands/af-code-simplify.md +16 -0
  317. package/.versions/0.0.5/.opencode/commands/af-compound.md +16 -0
  318. package/.versions/0.0.5/.opencode/commands/af-design-agent.md +15 -0
  319. package/.versions/0.0.5/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  320. package/.versions/0.0.5/.opencode/commands/af-orchestrate.md +112 -0
  321. package/.versions/0.0.5/.opencode/commands/af-plan.md +16 -0
  322. package/.versions/0.0.5/.opencode/commands/af-prime.md +22 -0
  323. package/.versions/0.0.5/.opencode/commands/af-review.md +15 -0
  324. package/.versions/0.0.5/.opencode/commands/af-set-hermes-telegram.md +15 -0
  325. package/.versions/0.0.5/.opencode/commands/af-setup-agent-fleet.md +15 -0
  326. package/.versions/0.0.5/.opencode/commands/af-ship.md +16 -0
  327. package/.versions/0.0.5/.opencode/commands/af-spec.md +16 -0
  328. package/.versions/0.0.5/.opencode/commands/af-test.md +21 -0
  329. package/.versions/0.0.5/.opencode/commands/af-webperf.md +32 -0
  330. package/.versions/0.0.5/.opencode/orchestrate-teams.yaml +24 -0
  331. package/.versions/0.0.5/.pi/agents/dispatch-policy.yaml +32 -0
  332. package/.versions/0.0.5/.pi/agents/model-profiles.yaml +20 -0
  333. package/.versions/0.0.5/.pi/agents/peers.yaml +146 -0
  334. package/.versions/0.0.5/.pi/agents/teams.yaml +39 -0
  335. package/.versions/0.0.5/.pi/damage-control-rules.yaml +297 -0
  336. package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  337. package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  338. package/.versions/0.0.5/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  339. package/.versions/0.0.5/.pi/extensions/btw/README.md +118 -0
  340. package/.versions/0.0.5/.pi/extensions/btw/index.ts +917 -0
  341. package/.versions/0.0.5/.pi/extensions/btw/package.json +6 -0
  342. package/.versions/0.0.5/.pi/extensions/btw/state.js +179 -0
  343. package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  344. package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
  345. package/.versions/0.0.5/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  346. package/.versions/0.0.5/.pi/extensions/compact-and-continue/README.md +42 -0
  347. package/.versions/0.0.5/.pi/extensions/compact-and-continue/index.ts +120 -0
  348. package/.versions/0.0.5/.pi/extensions/compact-and-continue/package.json +6 -0
  349. package/.versions/0.0.5/.pi/extensions/mcp-bridge/README.md +46 -0
  350. package/.versions/0.0.5/.pi/extensions/mcp-bridge/index.ts +206 -0
  351. package/.versions/0.0.5/.pi/extensions/mcp-bridge/package.json +6 -0
  352. package/.versions/0.0.5/.pi/extensions/package-lock.json +1143 -0
  353. package/.versions/0.0.5/.pi/extensions/package.json +9 -0
  354. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/README.md +201 -0
  355. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/config.ts +198 -0
  356. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  357. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/index.ts +248 -0
  358. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/package.json +6 -0
  359. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  360. package/.versions/0.0.5/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  361. package/.versions/0.0.5/.pi/harnesses/agent-hub/README.md +798 -0
  362. package/.versions/0.0.5/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  363. package/.versions/0.0.5/.pi/harnesses/agent-hub/artifacts.js +92 -0
  364. package/.versions/0.0.5/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  365. package/.versions/0.0.5/.pi/harnesses/agent-hub/delegate.ts +386 -0
  366. package/.versions/0.0.5/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
  367. package/.versions/0.0.5/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  368. package/.versions/0.0.5/.pi/harnesses/agent-hub/footer.ts +29 -0
  369. package/.versions/0.0.5/.pi/harnesses/agent-hub/helpers.ts +214 -0
  370. package/.versions/0.0.5/.pi/harnesses/agent-hub/index.ts +8045 -0
  371. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  372. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  373. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  374. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  375. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  376. package/.versions/0.0.5/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
  377. package/.versions/0.0.5/.pi/harnesses/agent-hub/package.json +7 -0
  378. package/.versions/0.0.5/.pi/harnesses/agent-hub/research-retention.js +34 -0
  379. package/.versions/0.0.5/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  380. package/.versions/0.0.5/.pi/harnesses/agent-hub/return-contract.js +215 -0
  381. package/.versions/0.0.5/.pi/harnesses/agent-hub/run-budget.js +155 -0
  382. package/.versions/0.0.5/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  383. package/.versions/0.0.5/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  384. package/.versions/0.0.5/.pi/harnesses/agent-hub/spawn.ts +246 -0
  385. package/.versions/0.0.5/.pi/harnesses/agent-hub/version.ts +18 -0
  386. package/.versions/0.0.5/.pi/harnesses/ask-user-remote/README.md +19 -0
  387. package/.versions/0.0.5/.pi/harnesses/ask-user-remote/index.ts +321 -0
  388. package/.versions/0.0.5/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  389. package/.versions/0.0.5/.pi/harnesses/coms/README.md +92 -0
  390. package/.versions/0.0.5/.pi/harnesses/coms/index.ts +1745 -0
  391. package/.versions/0.0.5/.pi/harnesses/coms/package.json +7 -0
  392. package/.versions/0.0.5/.pi/harnesses/coms/version.ts +18 -0
  393. package/.versions/0.0.5/.pi/harnesses/damage-control-continue/README.md +117 -0
  394. package/.versions/0.0.5/.pi/harnesses/damage-control-continue/index.ts +536 -0
  395. package/.versions/0.0.5/.pi/harnesses/damage-control-continue/package.json +7 -0
  396. package/.versions/0.0.5/.pi/harnesses/damage-control-continue/version.ts +18 -0
  397. package/.versions/0.0.5/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  398. package/.versions/0.0.5/.pi/harnesses/lib/herdr-client.ts +458 -0
  399. package/.versions/0.0.5/.pi/harnesses/lib/herdr-presence.ts +288 -0
  400. package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  401. package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-model.ts +9 -0
  402. package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  403. package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-socket.ts +118 -0
  404. package/.versions/0.0.5/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  405. package/.versions/0.0.5/.pi/harnesses/package-lock.json +35 -0
  406. package/.versions/0.0.5/.pi/harnesses/package.json +9 -0
  407. package/.versions/0.0.5/.pi/prompts/build.md +24 -0
  408. package/.versions/0.0.5/.pi/prompts/code-simplify.md +22 -0
  409. package/.versions/0.0.5/.pi/prompts/doctor-agent-fleet.md +15 -0
  410. package/.versions/0.0.5/.pi/prompts/plan.md +16 -0
  411. package/.versions/0.0.5/.pi/prompts/review.md +16 -0
  412. package/.versions/0.0.5/.pi/prompts/set-hermes-telegram.md +15 -0
  413. package/.versions/0.0.5/.pi/prompts/setup-agent-fleet.md +27 -0
  414. package/.versions/0.0.5/.pi/prompts/ship.md +17 -0
  415. package/.versions/0.0.5/.pi/prompts/spec.md +15 -0
  416. package/.versions/0.0.5/.pi/prompts/test.md +19 -0
  417. package/.versions/0.0.5/.pi/skills/bowser/SKILL.md +145 -0
  418. package/.versions/0.0.5/.version +1 -0
  419. package/.versions/0.0.5/agents/architect.md +23 -0
  420. package/.versions/0.0.5/agents/bowser.md +26 -0
  421. package/.versions/0.0.5/agents/builder.md +53 -0
  422. package/.versions/0.0.5/agents/code-reviewer.md +205 -0
  423. package/.versions/0.0.5/agents/deep-researcher.md +31 -0
  424. package/.versions/0.0.5/agents/documenter.md +18 -0
  425. package/.versions/0.0.5/agents/orchestrator.md +54 -0
  426. package/.versions/0.0.5/agents/plan-reviewer.md +60 -0
  427. package/.versions/0.0.5/agents/planner.md +69 -0
  428. package/.versions/0.0.5/agents/releaser.md +24 -0
  429. package/.versions/0.0.5/agents/researcher.md +28 -0
  430. package/.versions/0.0.5/agents/security-auditor.md +166 -0
  431. package/.versions/0.0.5/agents/test-engineer.md +151 -0
  432. package/.versions/0.0.5/agents/web-debugger.md +42 -0
  433. package/.versions/0.0.5/agents/web-performance-auditor.md +192 -0
  434. package/.versions/0.0.5/codex/CONDUCTOR.md +148 -0
  435. package/.versions/0.0.5/docs/ARCHITECTURE.md +210 -0
  436. package/.versions/0.0.5/docs/agent-fleet-setup.md +366 -0
  437. package/.versions/0.0.5/docs/claude-code-coms-bridge.md +103 -0
  438. package/.versions/0.0.5/docs/codex-remote-conductor.md +170 -0
  439. package/.versions/0.0.5/docs/coms-hermes-bridge.md +179 -0
  440. package/.versions/0.0.5/docs/getting-started.md +183 -0
  441. package/.versions/0.0.5/docs/npm-install.md +337 -0
  442. package/.versions/0.0.5/docs/opencode-setup.md +249 -0
  443. package/.versions/0.0.5/docs/pi-extensions.md +293 -0
  444. package/.versions/0.0.5/docs/pi-setup.md +472 -0
  445. package/.versions/0.0.5/docs/skill-anatomy.md +150 -0
  446. package/.versions/0.0.5/hermes/README.md +231 -0
  447. package/.versions/0.0.5/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  448. package/.versions/0.0.5/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  449. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +15 -0
  450. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +19 -0
  451. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +13 -0
  452. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +11 -0
  453. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +9 -0
  454. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +17 -0
  455. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +34 -0
  456. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +151 -0
  457. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +39 -0
  458. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  459. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +12 -0
  460. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  461. package/.versions/0.0.5/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +22 -0
  462. package/.versions/0.0.5/hermes/skills/hub-conductor/SKILL.md +84 -0
  463. package/.versions/0.0.5/hermes/skills/hub-liaison/SKILL.md +84 -0
  464. package/.versions/0.0.5/hooks/SIMPLIFY-IGNORE.md +90 -0
  465. package/.versions/0.0.5/hooks/coms-stop-hook.mjs +73 -0
  466. package/.versions/0.0.5/hooks/hooks.json +14 -0
  467. package/.versions/0.0.5/hooks/session-start.sh +74 -0
  468. package/.versions/0.0.5/hooks/simplify-ignore.sh +302 -0
  469. package/.versions/0.0.5/justfile +245 -0
  470. package/.versions/0.0.5/references/accessibility-checklist.md +160 -0
  471. package/.versions/0.0.5/references/definition-of-done.md +67 -0
  472. package/.versions/0.0.5/references/fleet-coordination-patterns.md +151 -0
  473. package/.versions/0.0.5/references/observability-checklist.md +91 -0
  474. package/.versions/0.0.5/references/orchestration-patterns.md +370 -0
  475. package/.versions/0.0.5/references/performance-checklist.md +153 -0
  476. package/.versions/0.0.5/references/prompting-patterns.md +380 -0
  477. package/.versions/0.0.5/references/security-checklist.md +179 -0
  478. package/.versions/0.0.5/references/testing-patterns.md +236 -0
  479. package/.versions/0.0.5/scripts/codex-conductor.ts +41 -0
  480. package/.versions/0.0.5/scripts/codex-remote-control.ts +167 -0
  481. package/.versions/0.0.5/scripts/coms-claude-bridge.ts +286 -0
  482. package/.versions/0.0.5/scripts/coms-cli.ts +484 -0
  483. package/.versions/0.0.5/scripts/coms-hermes-bridge.ts +413 -0
  484. package/.versions/0.0.5/scripts/fleet.ts +141 -0
  485. package/.versions/0.0.5/scripts/hermes-monitor-capability-runner.ts +25 -0
  486. package/.versions/0.0.5/scripts/hermes-monitor-scenario.ts +7 -0
  487. package/.versions/0.0.5/scripts/lib/claude-bridge-core.ts +100 -0
  488. package/.versions/0.0.5/scripts/lib/codex-conductor.ts +88 -0
  489. package/.versions/0.0.5/scripts/lib/codex-remote-control.ts +480 -0
  490. package/.versions/0.0.5/scripts/lib/coms-envelope.ts +539 -0
  491. package/.versions/0.0.5/scripts/lib/fake-herdr-server.ts +88 -0
  492. package/.versions/0.0.5/scripts/lib/fleet-command.ts +109 -0
  493. package/.versions/0.0.5/scripts/lib/herdr-layout.ts +263 -0
  494. package/.versions/0.0.5/scripts/lib/hermes-bridge-core.ts +241 -0
  495. package/.versions/0.0.5/scripts/lib/hermes-monitor-herdr.ts +2 -0
  496. package/.versions/0.0.5/scripts/lib/hermes-monitor-model.ts +3 -0
  497. package/.versions/0.0.5/scripts/lib/hermes-monitor-registry.ts +2 -0
  498. package/.versions/0.0.5/scripts/lib/hermes-monitor-socket.ts +2 -0
  499. package/.versions/0.0.5/scripts/lib/hermes-monitor-store.ts +2 -0
  500. package/.versions/0.0.5/scripts/lib/persona-banner.ts +62 -0
  501. package/.versions/0.0.5/scripts/lib/spawn-stagger.ts +101 -0
  502. package/.versions/0.0.5/scripts/lib/team-project.ts +191 -0
  503. package/.versions/0.0.5/scripts/lib/team-snapshot.ts +147 -0
  504. package/.versions/0.0.5/scripts/peer-banner.ts +40 -0
  505. package/.versions/0.0.5/scripts/team-snapshot.ts +237 -0
  506. package/.versions/0.0.5/scripts/team-up.ts +351 -0
  507. package/.versions/0.0.5/skills/_internal/grilling.md +11 -0
  508. package/.versions/0.0.5/skills/browser-testing-with-devtools/SKILL.md +352 -0
  509. package/.versions/0.0.5/skills/code-review-and-quality/SKILL.md +381 -0
  510. package/.versions/0.0.5/skills/compound-learning/SKILL.md +137 -0
  511. package/.versions/0.0.5/skills/context-engineering/SKILL.md +291 -0
  512. package/.versions/0.0.5/skills/deprecation-and-migration/SKILL.md +206 -0
  513. package/.versions/0.0.5/skills/designing-agents/SKILL.md +394 -0
  514. package/.versions/0.0.5/skills/designing-agents/pi-harness-authoring.md +222 -0
  515. package/.versions/0.0.5/skills/frontend-ui-engineering/SKILL.md +328 -0
  516. package/.versions/0.0.5/skills/git-workflow-and-versioning/SKILL.md +316 -0
  517. package/.versions/0.0.5/skills/guided-workspace-setup/SKILL.md +542 -0
  518. package/.versions/0.0.5/skills/guided-workspace-setup/companion-manifest.json +35 -0
  519. package/.versions/0.0.5/skills/idea-refine/SKILL.md +182 -0
  520. package/.versions/0.0.5/skills/idea-refine/examples.md +238 -0
  521. package/.versions/0.0.5/skills/idea-refine/frameworks.md +99 -0
  522. package/.versions/0.0.5/skills/idea-refine/refinement-criteria.md +113 -0
  523. package/.versions/0.0.5/skills/idea-refine/scripts/idea-refine.sh +15 -0
  524. package/.versions/0.0.5/skills/incremental-implementation/SKILL.md +287 -0
  525. package/.versions/0.0.5/skills/interview-me/SKILL.md +226 -0
  526. package/.versions/0.0.5/skills/orchestration-verification/SKILL.md +181 -0
  527. package/.versions/0.0.5/skills/peer-coms/SKILL.md +90 -0
  528. package/.versions/0.0.5/skills/performance-optimization/SKILL.md +350 -0
  529. package/.versions/0.0.5/skills/planning-and-task-breakdown/SKILL.md +236 -0
  530. package/.versions/0.0.5/skills/security-and-hardening/SKILL.md +461 -0
  531. package/.versions/0.0.5/skills/spec-driven-development/SKILL.md +245 -0
  532. package/.versions/0.0.5/skills/using-agent-skills/SKILL.md +199 -0
  533. package/.versions/0.0.5/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  534. package/.versions/0.0.5/vendor/agent-skills-upstream/LICENSE +21 -0
  535. package/.versions/0.0.5/vendor/agent-skills-upstream/README.md +11 -0
  536. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  537. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  538. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  539. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  540. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  541. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  542. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  543. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  544. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  545. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  546. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  547. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  548. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  549. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  550. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  551. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  552. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  553. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  554. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  555. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  556. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  557. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  558. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  559. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  560. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  561. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  562. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  563. package/.versions/0.0.5/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  564. package/CHANGELOG.md +62 -0
  565. package/README.md +17 -16
  566. package/agents/builder.md +1 -1
  567. package/agents/code-reviewer.md +1 -1
  568. package/agents/deep-researcher.md +3 -3
  569. package/agents/orchestrator.md +20 -11
  570. package/agents/plan-reviewer.md +3 -3
  571. package/agents/test-engineer.md +11 -4
  572. package/bin/cli.js +83 -1
  573. package/bin/lib/set-hermes-telegram.js +323 -0
  574. package/bin/lib/validate-overrides.js +19 -0
  575. package/bin/sync-harness-versions.js +94 -0
  576. package/docs/ARCHITECTURE.md +49 -4
  577. package/docs/agent-fleet-setup.md +11 -1
  578. package/docs/claude-code-coms-bridge.md +4 -4
  579. package/docs/codex-remote-conductor.md +12 -12
  580. package/docs/coms-hermes-bridge.md +62 -4
  581. package/docs/getting-started.md +4 -4
  582. package/docs/opencode-setup.md +1 -0
  583. package/docs/pi-extensions.md +73 -33
  584. package/docs/pi-setup.md +23 -8
  585. package/hermes/README.md +191 -8
  586. package/justfile +143 -158
  587. package/package.json +13 -5
  588. package/references/fleet-coordination-patterns.md +1 -1
  589. package/scripts/coms-hermes-bridge.ts +18 -8
  590. package/scripts/fleet.ts +141 -0
  591. package/scripts/lib/fake-herdr-server.ts +88 -0
  592. package/scripts/lib/fleet-command.ts +109 -0
  593. package/scripts/lib/hermes-bridge-core.ts +5 -2
  594. package/scripts/lib/hermes-monitor-herdr.ts +2 -0
  595. package/scripts/lib/hermes-monitor-model.ts +3 -0
  596. package/scripts/lib/hermes-monitor-registry.ts +2 -0
  597. package/scripts/lib/hermes-monitor-socket.ts +2 -0
  598. package/scripts/lib/hermes-monitor-store.ts +2 -0
  599. package/scripts/lib/team-project.ts +10 -3
  600. package/scripts/team-snapshot.ts +4 -5
  601. package/scripts/team-up.ts +24 -6
  602. package/skills/designing-agents/SKILL.md +2 -2
  603. package/skills/designing-agents/pi-harness-authoring.md +26 -13
  604. package/skills/guided-workspace-setup/SKILL.md +22 -12
  605. package/skills/guided-workspace-setup/companion-manifest.json +3 -1
  606. package/skills/peer-coms/SKILL.md +1 -1
  607. package/.pi/harnesses/damage-control/README.md +0 -65
  608. package/.pi/harnesses/damage-control/index.ts +0 -250
@@ -6,23 +6,26 @@ Safety auditing — blocks destructive tool calls, but lets the agent **adapt an
6
6
 
7
7
  ## What it does
8
8
 
9
- Same rule engine as [`damage-control`](../damage-control/README.md) — it loads
10
- `.pi/damage-control-rules.yaml` (`bashToolPatterns`, `zeroAccessPaths`,
9
+ It loads `.pi/damage-control-rules.yaml` (`bashToolPatterns`, `zeroAccessPaths`,
11
10
  `readOnlyPaths`, `noDeletePaths`) and checks every tool call against it.
12
11
 
13
- The difference is what happens on a match:
12
+ On a match, `damage-control-continue` replaces the tool result with **actionable
13
+ feedback** that distinguishes destructive from non-destructive intent and tells
14
+ the agent how to adapt. It does **not** call `ctx.abort()`: the blocked operation
15
+ fails closed, but the turn continues so the agent can report the block or take a
16
+ safe alternative. Protected-path calls may proceed only through the explicit
17
+ approval/exemption paths below; inherently dangerous command patterns never can.
14
18
 
15
- - **`damage-control`** replaces the tool result with a block message **and calls
16
- `ctx.abort()`**, ending the agent's turn (hard stop).
17
- - **`damage-control-continue`** replaces the tool result with **actionable
18
- feedback** that distinguishes destructive from non-destructive intent and tells
19
- the agent how to adapt — and does **not** abort. The turn continues, so the
20
- agent can recover (e.g. assume a `.env` key exists instead of reading it to
21
- verify) instead of dead-ending.
19
+ ## Version footer and provenance
22
20
 
23
- By default both variants hard-block. The choice is whether the agent's turn dies
24
- or keeps going — plus, in this variant, whether **you** let the call through via
25
- exemptions (below).
21
+ This persistent-UI harness shows `v<version>` below the prompt. It shares one common-key
22
+ status with `agent-hub` and `coms`, so a stack renders the version once. Its
23
+ version remains separate from the mutable `damage-control` status: active-rule and
24
+ last-violation feedback never replaces it. The root `package.json` is canonical;
25
+ `bin/sync-harness-versions.js` synchronizes its value into this adjacent manifest. The local
26
+ `version.ts` reader supports copied or symlinked harness directories by resolving that adjacent
27
+ stamp, but those targets still require the pre-existing full `.pi/harnesses/` dependency
28
+ installation.
26
29
 
27
30
  ## Exemptions — allow access per turn or per session
28
31
 
@@ -49,28 +52,27 @@ re-prompt you; no answer within 60s fails closed.
49
52
  **Escalation from headless children**: when this harness runs inside a subagent
50
53
  spawned by agent-hub (no UI, `AGENT_HUB_ASK_ENDPOINT` set), a path block sends an
51
54
  `access_request` to the hub's coms socket instead. The dispatcher session shows
52
- who is asking, for what, and why it was blocked — *Deny / Allow once / Allow for
53
- this agent / Allow for all agents (session)*. The child waits up to 60s and fails
54
- closed on timeout; a late answer still lands in the shared exemptions file, so
55
- the next attempt (from any child) passes. At most 3 escalations per child run;
56
- denials are cached.
55
+ who is asking, for what, and why it was blocked. Ordinary protected reads/writes
56
+ offer *Deny / Allow once / Allow for this agent / Allow for all agents (session)*.
57
+ A protected deletion offers only *Deny / Allow once*, so approving one file does
58
+ not grant its parent directory. The child waits up to 60s and fails closed on
59
+ timeout. At most 3 escalations per child run; denials are cached.
57
60
 
58
61
  **Shared exemptions file**: agent-hub keeps one session-scoped file
59
62
  (`~/.pi/coms/exemptions/<session>.json`, deleted on shutdown) and passes it to
60
63
  every spawned child via `AGENT_HUB_EXEMPTIONS_FILE`. `/allow <pattern> session`
61
- in the hub lands there, so it covers the whole team — including hard-stop
62
- [`damage-control`](../damage-control/README.md) specialists, which honor the
63
- file but never prompt or escalate. It is re-read on every block, so mid-session
64
- grants reach already-running children. Everything (grants, revokes, escalation
64
+ in the hub lands there, so it covers the whole team. Every native specialist,
65
+ research helper, and nested delegate uses this harness and re-reads the file on
66
+ every block, so mid-session grants reach already-running children. Everything
67
+ (grants, revokes, escalation
65
68
  outcomes) is logged to the `damage-control-log` session entries.
66
69
 
67
70
  ## When it's used (this repo)
68
71
 
69
- `just hub` / `just hub-solo` load this variant for the **orchestrator/dispatcher
70
- main session**, and the hub re-loads it into spawned **research helpers**
71
- (`researcher` / `deep-researcher`) — both need to recover from a blocked read and
72
- keep going rather than abort. Every other spawned specialist (builder,
73
- test-engineer, …) keeps the hard-stop `damage-control` harness.
72
+ Every `just fleet` Pi mode loads this harness: the default interactive session,
73
+ standalone peers, Hub, and Herdr Pi peers. Agent Hub additionally re-loads it into
74
+ every native **specialist, research helper, and nested delegate**. If the harness cannot be resolved, Agent Hub
75
+ refuses guarded child dispatch rather than launching an unprotected process.
74
76
 
75
77
  ## Commands & tools
76
78
 
@@ -92,12 +94,12 @@ Blocking itself runs passively on the `tool_call` event.
92
94
 
93
95
  ```bash
94
96
  # standalone continue-mode guardrail session
95
- just ext-damage-control-continue
97
+ just fleet
96
98
  pi -e .pi/harnesses/damage-control-continue/index.ts
97
99
 
98
- # the hub recipes load this variant for the main agent by default
99
- just hub
100
- just hub-solo
100
+ # Hub variants
101
+ just fleet hub
102
+ just fleet hub --solo
101
103
 
102
104
  # direct continue-guarded hub launch
103
105
  pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/agent-hub/index.ts
@@ -107,10 +109,9 @@ pi -e .pi/harnesses/damage-control-continue/index.ts -e .pi/harnesses/agent-hub/
107
109
 
108
110
  - Theme integration removed — the `themeMap.ts` import and the `applyExtensionDefaults()`
109
111
  call were stripped (this repo does not ship pi themes).
110
- - The `find` tool's `pattern` is matched against `zeroAccessPaths` (mirrors the
111
- hardening in this repo's `damage-control`), closing a gap where `find` could
112
- still locate secret files.
112
+ - The `find` tool's `pattern` is matched against `zeroAccessPaths`, closing a gap
113
+ where `find` could still locate secret files.
113
114
  - Exemption layer added (not in upstream): `/allow`/`/allowed`/`/revoke`,
114
115
  block-time approval dialog, and escalation from headless agent-hub children to
115
116
  the dispatcher — see the Exemptions section above. Shared plumbing lives in
116
- [`../damage-control/shared.ts`](../damage-control/shared.ts).
117
+ [`../lib/damage-control-shared.ts`](../lib/damage-control-shared.ts).
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Damage-Control (continue) — same rules as damage-control, but the agent keeps working
2
+ * Damage-Control (continue) — fail-closed guardrails without aborting the agent turn
3
3
  *
4
- * Difference from damage-control/index.ts:
5
- * - The blocked tool result is replaced with actionable feedback that
4
+ * On a blocked tool call:
5
+ * - The result is replaced with actionable feedback that
6
6
  * distinguishes destructive vs non-destructive intent and tells the
7
7
  * agent how to adapt.
8
8
  * - We do NOT call ctx.abort(), so the agent's turn continues and can
@@ -23,10 +23,9 @@
23
23
  * dispatcher over its coms socket and waits for the user's decision;
24
24
  * timeout or denial fails closed.
25
25
  *
26
- * In this repo it is the default guardrail for the orchestrator/dispatcher
27
- * (the agent-hub main session) and for spawned research helpers, which need
28
- * to recover from a blocked read and keep going rather than abort the turn.
29
- * Other specialists (builder, etc.) keep the hard-stop damage-control harness.
26
+ * In this repo it is the only supported safety harness: the agent-hub main
27
+ * session and every native specialist, research helper, and nested delegate
28
+ * use it. Missing safety plumbing makes Agent Hub refuse child dispatch.
30
29
  *
31
30
  * Usage: pi -e .pi/harnesses/damage-control-continue/index.ts
32
31
  */
@@ -50,7 +49,9 @@ import {
50
49
  type AccessRequest,
51
50
  type Exemption,
52
51
  type ExemptionScope,
53
- } from "../damage-control/shared.ts";
52
+ type PathRuleCategory,
53
+ } from "../lib/damage-control-shared.ts";
54
+ import { registerVersionStatus } from "./version.ts";
54
55
 
55
56
  interface Rule {
56
57
  pattern: string;
@@ -264,6 +265,7 @@ export default function (pi: ExtensionAPI) {
264
265
  });
265
266
 
266
267
  pi.on("session_start", async (_event, ctx) => {
268
+ registerVersionStatus(ctx);
267
269
  const projectRulesPath = path.join(ctx.cwd, ".pi", "damage-control-rules.yaml");
268
270
  const globalRulesPath = path.join(os.homedir(), ".pi", "damage-control-rules.yaml");
269
271
  const rulesPath = fs.existsSync(projectRulesPath) ? projectRulesPath : fs.existsSync(globalRulesPath) ? globalRulesPath : null;
@@ -297,6 +299,7 @@ export default function (pi: ExtensionAPI) {
297
299
  // those are exemptible/escalatable. Destructive bashToolPatterns leave
298
300
  // this null and can never be exempted.
299
301
  let matchedPattern: string | null = null;
302
+ let matchedCategory: PathRuleCategory | null = null;
300
303
 
301
304
  const checkPaths = (pathsToCheck: string[]) => {
302
305
  for (const p of pathsToCheck) {
@@ -304,6 +307,7 @@ export default function (pi: ExtensionAPI) {
304
307
  for (const zap of rules.zeroAccessPaths) {
305
308
  if (isPathMatch(resolved, zap, ctx.cwd)) {
306
309
  matchedPattern = zap;
310
+ matchedCategory = "zero_access";
307
311
  return `Access to zero-access path restricted: ${zap}`;
308
312
  }
309
313
  }
@@ -323,6 +327,7 @@ export default function (pi: ExtensionAPI) {
323
327
  if (event.input.glob.includes(zap) || isPathMatch(event.input.glob, zap, ctx.cwd)) {
324
328
  violationReason = `Glob matches zero-access path: ${zap}`;
325
329
  matchedPattern = zap;
330
+ matchedCategory = "zero_access";
326
331
  break;
327
332
  }
328
333
  }
@@ -335,6 +340,7 @@ export default function (pi: ExtensionAPI) {
335
340
  if (event.input.pattern.includes(zap) || isPathMatch(event.input.pattern, zap, ctx.cwd)) {
336
341
  violationReason = `Find pattern matches zero-access path: ${zap}`;
337
342
  matchedPattern = zap;
343
+ matchedCategory = "zero_access";
338
344
  break;
339
345
  }
340
346
  }
@@ -362,6 +368,7 @@ export default function (pi: ExtensionAPI) {
362
368
  if (command.includes(zap)) {
363
369
  violationReason = `Bash command references zero-access path: ${zap}`;
364
370
  matchedPattern = zap;
371
+ matchedCategory = "zero_access";
365
372
  break;
366
373
  }
367
374
  }
@@ -372,6 +379,7 @@ export default function (pi: ExtensionAPI) {
372
379
  if (command.includes(rop) && (/[\s>|]/.test(command) || command.includes("rm") || command.includes("mv") || command.includes("sed"))) {
373
380
  violationReason = `Bash command may modify read-only path: ${rop}`;
374
381
  matchedPattern = rop;
382
+ matchedCategory = "read_only";
375
383
  break;
376
384
  }
377
385
  }
@@ -386,6 +394,7 @@ export default function (pi: ExtensionAPI) {
386
394
  if (matched) {
387
395
  violationReason = `Bash command attempts to delete/move protected path: ${ndp}`;
388
396
  matchedPattern = ndp;
397
+ matchedCategory = "no_delete";
389
398
  break;
390
399
  }
391
400
  }
@@ -398,6 +407,7 @@ export default function (pi: ExtensionAPI) {
398
407
  if (isPathMatch(resolved, rop, ctx.cwd)) {
399
408
  violationReason = `Modification of read-only path restricted: ${rop}`;
400
409
  matchedPattern = rop;
410
+ matchedCategory = "read_only";
401
411
  break;
402
412
  }
403
413
  }
@@ -429,9 +439,12 @@ export default function (pi: ExtensionAPI) {
429
439
  const ONCE = "Allow once";
430
440
  const TURN = "Allow for this turn";
431
441
  const SESSION = "Allow for this session";
442
+ const choices = matchedCategory === "no_delete"
443
+ ? [KEEP, ONCE]
444
+ : [KEEP, ONCE, TURN, SESSION];
432
445
  const choice = await ctx.ui.select(
433
446
  `🛡️ Blocked: ${event.toolName} — ${violationReason}`,
434
- [KEEP, ONCE, TURN, SESSION],
447
+ choices,
435
448
  { timeout: PROMPT_TIMEOUT_MS },
436
449
  );
437
450
  if (choice === ONCE) {
@@ -468,6 +481,7 @@ export default function (pi: ExtensionAPI) {
468
481
  tool: event.toolName,
469
482
  rule: violationReason,
470
483
  pattern: matchedPattern,
484
+ category: matchedCategory!,
471
485
  invocation: invocation.slice(0, 500),
472
486
  };
473
487
  const decision = await requestAccessFromHub(endpoint, req);
@@ -1,6 +1,7 @@
1
1
  {
2
- "name": "agent-fleet-pi-damage-control-continue",
3
- "private": true,
4
- "type": "module",
5
- "main": "index.ts"
2
+ "name": "agent-fleet-pi-damage-control-continue",
3
+ "private": true,
4
+ "type": "module",
5
+ "main": "index.ts",
6
+ "version": "0.0.5"
6
7
  }
@@ -0,0 +1,18 @@
1
+ import { readFileSync } from "node:fs";
2
+
3
+ export const VERSION_STATUS_KEY = "00-agent-fleet-version";
4
+
5
+ function readAdjacentVersion(): string | null {
6
+ try {
7
+ const manifest = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8"));
8
+ return typeof manifest.version === "string" && manifest.version.length > 0 ? manifest.version : null;
9
+ } catch {
10
+ return null;
11
+ }
12
+ }
13
+
14
+ export const HARNESS_VERSION = readAdjacentVersion();
15
+
16
+ export function registerVersionStatus(ctx: { ui?: { setStatus?: (key: string, text: string) => void } }): void {
17
+ if (HARNESS_VERSION) ctx.ui?.setStatus?.(VERSION_STATUS_KEY, `v${HARNESS_VERSION}`);
18
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared exemption + escalation plumbing for the damage-control harnesses.
2
+ * Shared exemption + escalation plumbing for damage-control-continue and agent-hub.
3
3
  *
4
4
  * Exemptions are runtime, session-scoped allowances layered on top of
5
5
  * `.pi/damage-control-rules.yaml` — they never edit the rules file and only
@@ -7,11 +7,8 @@
7
7
  * noDeletePaths), never to the destructive bashToolPatterns.
8
8
  *
9
9
  * Consumers:
10
- * - damage-control-continue — full support: /allow command, block-time
11
- * prompt in interactive sessions, escalation to the agent-hub dispatcher
12
- * from headless children
13
- * - damage-control (hard stop) — honors pre-granted exemptions from the
14
- * shared file only; no prompting, no escalation
10
+ * - damage-control-continue — /allow commands, block-time prompts, and
11
+ * escalation to the agent-hub dispatcher from headless children
15
12
  * - agent-hub — computes the shared file path, passes the env plumbing to
16
13
  * spawned children, and answers access_request envelopes on its coms socket
17
14
  */
@@ -28,6 +25,7 @@ export const EXEMPTIONS_FILE_ENV = "AGENT_HUB_EXEMPTIONS_FILE";
28
25
  export const AGENT_ID_ENV = "AGENT_HUB_AGENT_ID";
29
26
 
30
27
  export type ExemptionScope = "turn" | "session";
28
+ export type PathRuleCategory = "zero_access" | "read_only" | "no_delete";
31
29
 
32
30
  export interface Exemption {
33
31
  /** The protected pattern being unlocked — same syntax as the rules file entries. */
@@ -106,11 +104,27 @@ export interface AccessRequest {
106
104
  tool: string;
107
105
  rule: string;
108
106
  pattern: string;
107
+ category: PathRuleCategory;
109
108
  invocation: string;
110
109
  }
111
110
 
112
111
  export type AccessDecisionChoice = "deny" | "allow_once" | "allow_agent" | "allow_all";
113
112
 
113
+ /** Protected deletions are approved per invocation; broader grants stay operator-explicit. */
114
+ export function accessDecisionChoices(category: PathRuleCategory): AccessDecisionChoice[] {
115
+ return category === "no_delete"
116
+ ? ["deny", "allow_once"]
117
+ : ["deny", "allow_once", "allow_agent", "allow_all"];
118
+ }
119
+
120
+ /** Coalesce identical asks without letting one delete approval cover sibling paths. */
121
+ export function accessRequestCacheKey(
122
+ request: Pick<AccessRequest, "agent" | "pattern" | "category" | "invocation">,
123
+ ): string {
124
+ const base = `${request.agent}::${request.pattern}`;
125
+ return request.category === "no_delete" ? `${base}::${request.invocation}` : base;
126
+ }
127
+
114
128
  export interface AccessDecision {
115
129
  type: "access_decision";
116
130
  msg_id: string;
@@ -0,0 +1,28 @@
1
+ import { herdr, subscribe, type HerdrClientOptions, type SubscribeHandle } from "./herdr-client.ts";
2
+
3
+ export interface HubCorrelation { workspaceId?: string; hubPaneId?: string; status: "correlated" | "uncorrelated" | "reconnecting"; }
4
+
5
+ export async function correlateHubPane(env: NodeJS.ProcessEnv = process.env, opts: HerdrClientOptions = {}): Promise<HubCorrelation> {
6
+ const hubPaneId = env.HERDR_PANE_ID;
7
+ if (env.HERDR_ENV !== "1" || !hubPaneId) return { status: "uncorrelated" };
8
+ try { const { pane } = await herdr.paneGet(hubPaneId, { socketPath: env.HERDR_SOCKET_PATH, ...opts }); return { workspaceId: pane.workspace_id, hubPaneId, status: "correlated" }; }
9
+ catch { return { hubPaneId, status: "reconnecting" }; }
10
+ }
11
+
12
+ export function watchHubMonitor(options: { env?: NodeJS.ProcessEnv; onStatus: (value: HubCorrelation) => void; onOutput?: (output: { sequence: number; text: string }) => void; initialCursor?: number; reconnectDelayMs?: number }): SubscribeHandle | null {
13
+ const env = options.env ?? process.env;
14
+ const paneId = env.HERDR_PANE_ID;
15
+ if (env.HERDR_ENV !== "1" || !paneId) { options.onStatus({ status: "uncorrelated" }); return null; }
16
+ let cursor = options.initialCursor ?? 0;
17
+ const refresh = async () => {
18
+ try {
19
+ const { pane } = await herdr.paneGet(paneId, { socketPath: env.HERDR_SOCKET_PATH });
20
+ options.onStatus({ workspaceId: pane.workspace_id, hubPaneId: paneId, status: "correlated" });
21
+ const output = (pane as { monitor_resync_output?: { sequence?: number; text?: string } }).monitor_resync_output;
22
+ if (output && typeof output.sequence === "number" && output.sequence > cursor && typeof output.text === "string") { cursor = output.sequence; options.onOutput?.({ sequence: output.sequence, text: output.text }); }
23
+ } catch { options.onStatus({ hubPaneId: paneId, status: "reconnecting" }); }
24
+ };
25
+ void refresh();
26
+ let connected = false;
27
+ return subscribe([{ type: "pane.agent_status_changed", pane_id: paneId }], () => void refresh(), { socketPath: env.HERDR_SOCKET_PATH, reconnectDelayMs: options.reconnectDelayMs, onConnect: () => { if (connected) options.onStatus({ hubPaneId: paneId, status: "reconnecting" }); connected = true; void refresh(); }, onError: () => options.onStatus({ hubPaneId: paneId, status: "reconnecting" }) });
28
+ }
@@ -0,0 +1,9 @@
1
+ export type MonitorTaskState = "starting" | "running" | "cancelling" | "completed" | "blocked" | "failed" | "cancelled" | "orphaned" | "recovering";
2
+ export const TERMINAL_TASK_STATES = new Set<MonitorTaskState>(["completed","blocked","failed","cancelled","orphaned"]);export type MonitorTaskKind="parent"|"child";
3
+ export interface MonitorTask{id:string;generation:number;kind:MonitorTaskKind;state:MonitorTaskState;parentId?:string;parentGeneration?:number;hubInstanceId?:string;checkoutId?:string;specialist?:string;workspaceId?:string;hubPaneId?:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
4
+ export interface CreateParentTaskInput{id:string;generation:number;hubInstanceId:string;checkoutId:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
5
+ export interface CreateChildTaskInput{id:string;generation:number;parentId:string;parentGeneration:number;specialist:string;workspaceId?:string;hubPaneId?:string;ownerSessionId?:string;ownerLeaseExpiresAt?:string;}
6
+ function requireStableIdentity(id:string,generation:number){if(!id)throw Error("task id is required");if(!Number.isInteger(generation)||generation<1)throw Error("task generation must be a positive integer");}const owner=(i:any)=>({...((i.ownerSessionId)?{ownerSessionId:i.ownerSessionId}:{}),...((i.ownerLeaseExpiresAt)?{ownerLeaseExpiresAt:i.ownerLeaseExpiresAt}:{})});
7
+ export function createParentTask(input:CreateParentTaskInput):MonitorTask{requireStableIdentity(input.id,input.generation);if(!input.hubInstanceId||!input.checkoutId)throw Error("parent correlation is required");return{id:input.id,generation:input.generation,kind:"parent",state:"starting",hubInstanceId:input.hubInstanceId,checkoutId:input.checkoutId,...owner(input)};}
8
+ export function createChildTask(input:CreateChildTaskInput):MonitorTask{requireStableIdentity(input.id,input.generation);if(!input.parentId||!Number.isInteger(input.parentGeneration)||input.parentGeneration<1||!input.specialist)throw Error("child hierarchy is required");return{id:input.id,generation:input.generation,kind:"child",state:"starting",parentId:input.parentId,parentGeneration:input.parentGeneration,specialist:input.specialist,...(input.workspaceId?{workspaceId:input.workspaceId}:{}),...(input.hubPaneId?{hubPaneId:input.hubPaneId}:{}),...owner(input)};}
9
+ export function transitionTask(task:MonitorTask,state:MonitorTaskState):MonitorTask{if(TERMINAL_TASK_STATES.has(task.state))throw Error(`terminal task ${task.id} cannot mutate`);if(state==="starting")throw Error("tasks cannot transition back to starting");return{...task,state};}export function continueTask(task:MonitorTask):MonitorTask{if(task.state!=="blocked")throw Error(`only blocked task ${task.id} can continue`);return{...task,generation:task.generation+1,state:"starting"};}
@@ -0,0 +1,6 @@
1
+ import * as crypto from "node:crypto"; import * as fs from "node:fs"; import * as path from "node:path";
2
+ export interface MonitorRegistration {profileKey:string;namespacePath:string;socketPath:string;socketDir:string;token:string;namespaceMode:number;tokenMode:number;discoveryPath:string;snapshot():unknown;cancel?(r:{taskId:string;generation:number}):unknown|Promise<unknown>;output?(r:{taskId:string;generation:number;afterSequence:number}):unknown|Promise<unknown>;cleanup():void;renew():void;leaseMs:number;ownerId?:string;leaseExpiresAt?:string;}
3
+ export interface MonitorRegistryOptions {runtimeDir:string;now?:()=>Date;pid?:number;leaseMs?:number;beforeRenewPublish?:()=>void;} export interface RegisterMonitorInput {profilePath:string;profileId?:string;hubInstanceId:string;snapshot:()=>unknown;}
4
+ const D=0o700,F=0o600;const validDiscovery=(d:any)=>typeof d?.owner==="string"&&/^[0-9a-f-]{36}$/i.test(d.owner)&&typeof d.token==="string"&&/^token-[0-9a-f-]{36}$/i.test(d.token)&&typeof d.socket==="string"&&/^@runtime\/s\/[a-f0-9]+\/s$/.test(d.socket)&&typeof d.lease?.hub==="string"&&/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(d.lease.hub)&&Number.isInteger(d.lease?.pid)&&d.lease.pid>0&&typeof d.lease?.startedAt==="string"&&!Number.isNaN(Date.parse(d.lease.startedAt))&&typeof d.lease?.expiresAt==="string"&&!Number.isNaN(Date.parse(d.lease.expiresAt));const mode=(p:string)=>fs.statSync(p).mode&0o777;function dir(p:string){if(!path.isAbsolute(p))throw Error("monitor runtime directory must be absolute");fs.mkdirSync(p,{recursive:true,mode:D});if(fs.lstatSync(p).isSymbolicLink())throw Error("monitor runtime directory must not be a symlink");fs.chmodSync(p,D);}export function canonicalMonitorProfileId(id:string){if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(id)||id.includes(".."))throw Error("monitor profile id is unsafe");return crypto.createHash("sha256").update(id).digest("hex");}function profile(p:string,id?:string){if(id)return canonicalMonitorProfileId(id);const real=fs.realpathSync(p);if(!fs.statSync(real).isDirectory())throw Error("monitor profile path must be a directory");return crypto.createHash("sha256").update(real).digest("hex");}function hub(id:string){if(!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(id)||id.includes(".."))throw Error("hub instance id is unsafe");return crypto.createHash("sha256").update(id).digest("hex");}function atomic(p:string,s:string){const t=`${p}.${process.pid}.${crypto.randomBytes(4).toString("hex")}.tmp`;fs.writeFileSync(t,s,{mode:F,flag:"wx"});fs.chmodSync(t,F);fs.renameSync(t,p);}
5
+ export class MonitorRegistry {private runtimeDir:string;private now:()=>Date;private pid:number;private leaseMs:number;private beforeRenewPublish?:()=>void;constructor(o:MonitorRegistryOptions){this.runtimeDir=o.runtimeDir;this.now=o.now??(()=>new Date());this.pid=o.pid??process.pid;this.leaseMs=o.leaseMs??30_000;this.beforeRenewPublish=o.beforeRenewPublish;dir(this.runtimeDir);}register(input:RegisterMonitorInput):MonitorRegistration{const key=profile(input.profilePath,input.profileId),h=hub(input.hubInstanceId),ns=path.join(this.runtimeDir,key,h);dir(path.join(this.runtimeDir,key));dir(ns);for(const file of fs.readdirSync(ns).filter(x=>x.startsWith("discovery-"))){const discoveryPath=path.join(ns,file);try{const d=JSON.parse(fs.readFileSync(discoveryPath,"utf8"));if(!validDiscovery(d)||d.token!==`token-${d.owner}`||d.socket!==`@runtime/s/${crypto.createHash("sha256").update(`${key}:${h}:${d.owner}`).digest("hex").slice(0,32)}/s`)throw new Error("monitor discovery metadata is malformed");if(new Date(d.lease?.expiresAt).getTime()>this.now().getTime()){const error:any=Error("monitor namespace is owned by an active lease");error.leaseExpiresAt=d.lease.expiresAt;throw error;}const tokenName=d.token;if(typeof tokenName==="string"&&/^token-[0-9a-f-]+$/.test(tokenName))try{fs.unlinkSync(path.join(ns,tokenName))}catch(e:any){if(e?.code!=="ENOENT")throw e;}fs.unlinkSync(discoveryPath);const socket=typeof d.socket==="string"?d.socket:"";if(socket.startsWith("@runtime/s/")&&socket.endsWith("/s")){const socketDir=path.join(this.runtimeDir,socket.slice("@runtime/".length,-2));if(socketDir.startsWith(path.join(this.runtimeDir,"s")+path.sep))try{fs.rmSync(socketDir,{recursive:true,force:true})}catch{}}}catch(e:any){if(/active lease|malformed/.test(String(e)))throw e;if(e instanceof SyntaxError||e instanceof TypeError||e instanceof RangeError)throw new Error("monitor discovery metadata is malformed");}}
6
+ const owner=crypto.randomUUID(),socketDir=path.join(this.runtimeDir,"s",crypto.createHash("sha256").update(`${key}:${h}:${owner}`).digest("hex").slice(0,32));dir(socketDir);const tokenPath=path.join(ns,`token-${owner}`),discoveryPath=path.join(ns,`discovery-${owner}.json`),socketPath=path.join(socketDir,"s"),token=crypto.randomBytes(32).toString("hex"),started=this.now();atomic(tokenPath,token);const tokenFd=fs.openSync(tokenPath,"r");const write=(issued:Date)=>atomic(discoveryPath,JSON.stringify({owner,socket:`@runtime/s/${path.basename(socketDir)}/s`,token:path.basename(tokenPath),lease:{hub:input.hubInstanceId,pid:this.pid,startedAt:started.toISOString(),expiresAt:new Date(issued.getTime()+this.leaseMs).toISOString()}}));write(started);const owns=()=>{try{return fs.fstatSync(tokenFd).nlink===1&&fs.readFileSync(tokenPath,"utf8")===token&&JSON.parse(fs.readFileSync(discoveryPath,"utf8")).owner===owner;}catch{return false;}};const cleanup=()=>{if(!owns())return;for(const p of [tokenPath,discoveryPath])try{fs.unlinkSync(p)}catch(e:any){if(e?.code!=="ENOENT")throw e;}finally{try{fs.closeSync(tokenFd)}catch{}}};return{profileKey:key,ownerId:owner,leaseExpiresAt:new Date(started.getTime()+this.leaseMs).toISOString(),namespacePath:ns,socketPath,socketDir,token,namespaceMode:mode(ns),tokenMode:mode(tokenPath),discoveryPath,snapshot:input.snapshot,cleanup,renew:()=>{if(!owns())throw Error("monitor ownership lost");this.beforeRenewPublish?.();if(!owns())throw Error("monitor ownership lost");const renewedAt=this.now();write(renewedAt);if(!owns()){try{if(JSON.parse(fs.readFileSync(discoveryPath,"utf8")).owner===owner)fs.unlinkSync(discoveryPath)}catch{}throw Error("monitor ownership lost");}return{leaseExpiresAt:new Date(renewedAt.getTime()+this.leaseMs).toISOString()};},leaseMs:this.leaseMs};} evidenceForOwner(ownerId:string,hubInstanceId:string){try{if(!/^[0-9a-f-]{36}$/i.test(ownerId))throw Error("malformed");const h=hub(hubInstanceId);for(const profileKey of fs.readdirSync(this.runtimeDir)){const p=path.join(this.runtimeDir,profileKey,h,`discovery-${ownerId}.json`);if(!fs.existsSync(p))continue;const d=JSON.parse(fs.readFileSync(p,"utf8"));if(!validDiscovery(d)||d.owner!==ownerId||d.token!==`token-${ownerId}`)throw Error("malformed");const token=path.join(path.dirname(p),d.token),socket=path.join(this.runtimeDir,d.socket.slice("@runtime/".length));return{owner:fs.existsSync(token),socket:fs.existsSync(socket),session:fs.existsSync(token),expired:new Date(d.lease.expiresAt).getTime()<=this.now().getTime()};}return{owner:false,socket:false,session:false,expired:true};}catch(error){return{transient:true,error};}}}
@@ -0,0 +1,118 @@
1
+ import * as crypto from "node:crypto";
2
+ import * as fs from "node:fs";
3
+ import * as net from "node:net";
4
+ import * as path from "node:path";
5
+
6
+ import type { MonitorRegistration } from "./hermes-monitor-registry.ts";
7
+
8
+ export const MAX_SOCKET_FRAME_BYTES = 64 * 1024;
9
+ export const MAX_SNAPSHOT_BYTES = 256 * 1024;
10
+ export const MAX_CANCEL_RESPONSE_BYTES = 16 * 1024;
11
+ export const PARTIAL_FRAME_TIMEOUT_MS = 1000;
12
+ export const MAX_SOCKET_CONNECTIONS = 32;
13
+ export const MAX_TASK_ID_LENGTH = 128;
14
+ export const MAX_AFTER_SEQUENCE = 1_000_000_000;
15
+ /** 2 MiB covers the 256 KiB retained UTF-8 output after worst-case JSON escaping plus its envelope. */
16
+ export const MAX_OUTPUT_RESPONSE_BYTES = 2 * 1024 * 1024;
17
+
18
+ interface SnapshotRequest {
19
+ type: "snapshot";
20
+ token: string;
21
+ }
22
+
23
+ function authorized(actual: string, expected: string): boolean {
24
+ const actualBytes = Buffer.from(actual);
25
+ const expectedBytes = Buffer.from(expected);
26
+ return actualBytes.length === expectedBytes.length && crypto.timingSafeEqual(actualBytes, expectedBytes);
27
+ }
28
+
29
+ function validTaskRequest(taskId: unknown, generation: unknown, afterSequence?: unknown): boolean { return typeof taskId === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(taskId) && taskId.length <= MAX_TASK_ID_LENGTH && Number.isInteger(generation) && (generation as number) >= 1 && (afterSequence === undefined || (Number.isInteger(afterSequence) && (afterSequence as number) >= 0 && (afterSequence as number) <= MAX_AFTER_SEQUENCE)); }
30
+
31
+ function parseRequest(frame: string): SnapshotRequest | null {
32
+ try {
33
+ const value = JSON.parse(frame) as Partial<SnapshotRequest>;
34
+ if (value.type !== "snapshot" || typeof value.token !== "string") return null;
35
+ return { type: "snapshot", token: value.token };
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+
41
+ export class MonitorSocketServer {
42
+ private readonly registration: MonitorRegistration;
43
+ private readonly server: net.Server;
44
+ private connections = 0;
45
+
46
+ constructor(registration: MonitorRegistration) {
47
+ this.registration = registration;
48
+ this.server = net.createServer((socket) => {
49
+ if (this.connections >= MAX_SOCKET_CONNECTIONS) { socket.destroy(); return; }
50
+ this.connections += 1;
51
+ socket.once("close", () => { this.connections -= 1; });
52
+ this.handle(socket);
53
+ });
54
+ }
55
+
56
+ private assertOwnedSocketPath(): void {
57
+ if (!this.registration.socketDir || path.resolve(this.registration.socketPath) !== path.join(path.resolve(this.registration.socketDir), "s")) throw new Error("monitor socket path is not registry-owned");
58
+ if (fs.lstatSync(this.registration.socketDir).isSymbolicLink() || (fs.statSync(this.registration.socketDir).mode & 0o777) !== 0o700) throw new Error("monitor socket directory is unsafe");
59
+ }
60
+ private async removeVerifiedStaleSocket(): Promise<void> {
61
+ this.assertOwnedSocketPath(); if (!fs.existsSync(this.registration.socketPath)) return;
62
+ const active=await new Promise<boolean>(resolve=>{const probe=net.createConnection(this.registration.socketPath);probe.once("connect",()=>{probe.destroy();resolve(true);});probe.once("error",()=>resolve(false));});
63
+ if (active) throw new Error("monitor socket is already active");
64
+ if (fs.lstatSync(this.registration.socketPath).isSymbolicLink()) throw new Error("monitor socket must not be a symlink"); fs.unlinkSync(this.registration.socketPath);
65
+ }
66
+ async listen(): Promise<void> {
67
+ await this.removeVerifiedStaleSocket(); return new Promise((resolve, reject) => { this.server.once("error", reject); this.server.listen(this.registration.socketPath, () => { this.server.off("error", reject); fs.chmodSync(this.registration.socketPath, 0o600); resolve(); }); });
68
+ }
69
+
70
+ async close(): Promise<void> {
71
+ await new Promise<void>((resolve, reject) => this.server.close((error) => error ? reject(error) : resolve()));
72
+ this.assertOwnedSocketPath(); try { fs.unlinkSync(this.registration.socketPath); } catch (error: any) { if (error?.code !== "ENOENT") throw error; }
73
+ }
74
+
75
+ mode(): number {
76
+ return fs.statSync(this.registration.socketPath).mode & 0o777;
77
+ }
78
+
79
+ private handle(socket: net.Socket): void {
80
+ let buffer = "";
81
+ let handled = false;
82
+ const deadline = setTimeout(() => { if (!handled) socket.destroy(); }, PARTIAL_FRAME_TIMEOUT_MS);
83
+ socket.on("data", (chunk) => {
84
+ if (handled) return;
85
+ buffer += chunk.toString("utf8");
86
+ if (Buffer.byteLength(buffer, "utf8") > MAX_SOCKET_FRAME_BYTES) {
87
+ socket.destroy();
88
+ return;
89
+ }
90
+ const newline = buffer.indexOf("\n");
91
+ if (newline < 0) return;
92
+ handled = true;
93
+ const request = parseRequest(buffer.slice(0, newline));
94
+ clearTimeout(deadline);
95
+ let value: { type?: string; token?: string; taskId?: string; generation?: number };
96
+ try { value = JSON.parse(buffer.slice(0, newline)) as typeof value; } catch { socket.destroy(); return; }
97
+ if (value.type === "output") {
98
+ if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
99
+ if (!this.registration.output || (value as any).afterSequence === undefined || !validTaskRequest(value.taskId, value.generation, (value as any).afterSequence)) { socket.destroy(); return; }
100
+ Promise.resolve().then(()=>this.registration.output!({ taskId: value.taskId!, generation: value.generation!, afterSequence: (value as any).afterSequence })).then((output) => { const body=JSON.stringify({ ok:true, output }); if(Buffer.byteLength(body)>MAX_OUTPUT_RESPONSE_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(body+"\n"); }).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")); return;
101
+ }
102
+ if (value.type === "cancel") {
103
+ if (!authorized(String(value.token ?? ""), this.registration.token)) { socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n"); return; }
104
+ if (!this.registration.cancel || !validTaskRequest(value.taskId, value.generation)) { socket.destroy(); return; }
105
+ Promise.resolve().then(()=>this.registration.cancel!({ taskId: value.taskId!, generation: value.generation! })).then((result) => { const body=JSON.stringify({ ok: true, result }); if (Buffer.byteLength(body, "utf8") > MAX_CANCEL_RESPONSE_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(body + "\n"); }).catch(()=>socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n")); return;
106
+ }
107
+ if (!request || !authorized(request.token, this.registration.token)) {
108
+ if (request) socket.end(JSON.stringify({ ok: false, error: "unauthorized" }) + "\n");
109
+ else socket.destroy();
110
+ return;
111
+ }
112
+ try { const response = JSON.stringify({ ok: true, snapshot: this.registration.snapshot() }); if (Buffer.byteLength(response, "utf8") > MAX_SNAPSHOT_BYTES) socket.end(JSON.stringify({ok:false,error:"response_too_large"})+"\n"); else socket.end(response + "\n"); } catch { socket.end(JSON.stringify({ok:false,error:"monitor_unavailable"})+"\n"); }
113
+ });
114
+ socket.on("end", () => {
115
+ if (!handled) socket.destroy();
116
+ });
117
+ }
118
+ }
@@ -0,0 +1,31 @@
1
+ import { createChildTask, createParentTask, type CreateChildTaskInput, type CreateParentTaskInput, type MonitorTask } from "./hermes-monitor-model.ts";
2
+ export const MAX_OUTPUT_BYTES=256*1024;
3
+ export const MONITOR_RETENTION_MS=7*24*60*60*1000;
4
+ export const MONITOR_RETENTION_MAX=200;
5
+ const terminal=new Set(["completed","blocked","failed","cancelled","orphaned","done"]);
6
+ const active=(state:string)=>state==="starting"||state==="running"||state==="cancelling"||state==="recovering";
7
+ export function pruneMonitorTasks<T extends {state:string;updatedAt?:string}>(options:{now:Date;tasks:T[]}):T[]{const cutoff=options.now.getTime()-MONITOR_RETENTION_MS;const running=options.tasks.filter(t=>active(t.state));const terminalTasks=options.tasks.filter(t=>!active(t.state)&&(!t.updatedAt||new Date(t.updatedAt).getTime()>=cutoff)).sort((a,b)=>new Date(a.updatedAt??0).getTime()-new Date(b.updatedAt??0).getTime()).slice(-MONITOR_RETENTION_MAX);return [...running,...terminalTasks];}
8
+ export interface MonitorOutput{text:string;sequence:number;firstSequence:number;truncated:boolean}
9
+ interface StoredOutput{chunks:{sequence:number;text:string}[];sequence:number;truncated:boolean}
10
+ interface StoredTask{task:MonitorTask;output:StoredOutput;createdAt:string;updatedAt:string}
11
+ function suffix(text:string,limit:number){let bytes=0;const chars:string[]=[];for(const char of Array.from(text).reverse()){const size=Buffer.byteLength(char);if(bytes+size>limit)break;chars.push(char);bytes+=size;}return chars.reverse().join("");}
12
+
13
+ export class MonitorStore {
14
+ private readonly tasks=new Map<string,StoredTask>(); private readonly now:()=>Date;
15
+ constructor(options:{now?:()=>Date}={}){this.now=options.now??(()=>new Date());}
16
+ private key(id:string,generation:number){return `${id}:${generation}`;} private stamp(){return this.now().toISOString();}
17
+ createParent(input:CreateParentTaskInput){return this.add(createParentTask(input));}
18
+ createChild(input:CreateChildTaskInput){if(![...this.tasks.values()].some(s=>s.task.id===input.parentId&&s.task.generation===input.parentGeneration&&s.task.kind==="parent"))throw new Error(`parent task ${input.parentId} was not found`);return this.add(createChildTask(input));}
19
+ patch(id:string,generation:number,values:any){const stored=this.require(id,generation);Object.assign(stored.task,values);stored.updatedAt=this.stamp();return stored.task;}
20
+ transition(id:string,generation:number,state:any){const stored=this.require(id,generation);if(terminal.has(stored.task.state))throw new Error("terminal transition");stored.task.state=state;stored.updatedAt=this.stamp();return stored.task;}
21
+ get(id:string,generation?:number){return generation===undefined?[...this.tasks.values()].find(s=>s.task.id===id)?.task:this.tasks.get(this.key(id,generation))?.task;}
22
+ appendPublicOutput(id:string,generation:number,text:string){const stored=this.require(id,generation);if(terminal.has(stored.task.state))throw new Error("terminal output");const sequence=stored.output.sequence+1, chunk=suffix(text,MAX_OUTPUT_BYTES),chunks=[...stored.output.chunks,{sequence,text:chunk}];let bytes=chunks.reduce((n,c)=>n+Buffer.byteLength(c.text),0),truncated=stored.output.truncated||bytes<Buffer.byteLength(text);while(bytes>MAX_OUTPUT_BYTES&&chunks.length>1){bytes-=Buffer.byteLength(chunks.shift()!.text);truncated=true;}stored.output={chunks,sequence,truncated};stored.updatedAt=this.stamp();return this.outputAfter(stored.output,0);}
23
+ readOutput(id:string,generation:number,afterSequence:number){return this.outputAfter(this.require(id,generation).output,afterSequence);}
24
+ snapshot(){return {tasks:[...this.tasks.values()].map(s=>this.publicTask(s))};} durableSnapshot(){return{tasks:[...this.tasks.values()].map(s=>({...this.publicTask(s),outputChunks:s.output.chunks.map(c=>({...c}),),outputLatestSequence:s.output.sequence,outputFirstSequence:s.output.chunks[0]?.sequence??0,outputTruncated:s.output.truncated}))};} restore(rows:any[]){for(const row of rows){const key=this.key(row.id,row.generation);if(this.tasks.has(key))continue;const output=row.output??"";this.tasks.set(key,{task:{...row},output:{chunks:Array.isArray(row.outputChunks)?row.outputChunks.map((c:any)=>({sequence:c.sequence,text:c.text})):output?[{sequence:row.outputSequence??1,text:output}]:[],sequence:row.outputLatestSequence??row.outputSequence??0,truncated:row.outputTruncated??!!row.truncated},createdAt:row.createdAt??this.stamp(),updatedAt:row.updatedAt??this.stamp()});}}
25
+ prune(now=this.now()){const cutoff=now.getTime()-MONITOR_RETENTION_MS;const values=[...this.tasks.values()];const protectedIds=new Set<string>();for(const s of values)if(active(s.task.state)){protectedIds.add(this.key(s.task.id,s.task.generation));if(s.task.parentId)for(const p of values)if(p.task.id===s.task.parentId)protectedIds.add(this.key(p.task.id,p.task.generation));for(const c of values)if(c.task.parentId===s.task.id)protectedIds.add(this.key(c.task.id,c.task.generation));}const candidates=values.filter(s=>!active(s.task.state)&&!protectedIds.has(this.key(s.task.id,s.task.generation))).sort((a,b)=>Date.parse(a.updatedAt)-Date.parse(b.updatedAt));const expired=candidates.filter(s=>Date.parse(s.updatedAt)<cutoff);for(const s of expired)this.tasks.delete(this.key(s.task.id,s.task.generation));const remaining=[...this.tasks.values()].filter(s=>!active(s.task.state)&&!protectedIds.has(this.key(s.task.id,s.task.generation))).sort((a,b)=>Date.parse(a.updatedAt)-Date.parse(b.updatedAt));while(remaining.length>MONITOR_RETENTION_MAX){const oldest=remaining.shift()!;this.tasks.delete(this.key(oldest.task.id,oldest.task.generation));}return this.snapshot();}
26
+ private add(task:MonitorTask){const key=this.key(task.id,task.generation);if(this.tasks.has(key))throw new Error(`task ${task.id} generation ${task.generation} already exists`);const stamp=this.stamp();this.tasks.set(key,{task,output:{chunks:[],sequence:0,truncated:false},createdAt:stamp,updatedAt:stamp});return task;}
27
+ private publicTask(s:StoredTask){const output=this.outputAfter(s.output,0);return {...s.task,createdAt:s.createdAt,updatedAt:s.updatedAt,outputSequence:output.sequence,firstSequence:output.firstSequence,truncated:output.truncated};}
28
+ private outputAfter(output:StoredOutput,after:number):MonitorOutput{return{text:output.chunks.filter(c=>c.sequence>after).map(c=>c.text).join(""),sequence:output.sequence,firstSequence:output.chunks[0]?.sequence??0,truncated:output.truncated};}
29
+ private require(id:string,generation:number){const stored=this.tasks.get(this.key(id,generation));if(!stored)throw new Error(`task ${id} generation ${generation} was not found`);return stored;}
30
+ }
31
+ export function createMonitorStore(options:{now:()=>Date}){const store=new MonitorStore(options);const baseSnapshot=store.snapshot.bind(store);return Object.assign(store,{snapshot(){const all=(baseSnapshot() as any).tasks;return{tasks:all.filter((t:any)=>t.kind==='parent').map((parent:any)=>({id:parent.id,generation:parent.generation,children:all.filter((child:any)=>child.parentId===parent.id).map((child:any)=>({id:child.id,generation:child.generation,state:child.state,workspaceId:child.workspaceId,hubPaneId:child.hubPaneId,outputSequence:child.outputSequence,updatedAt:child.updatedAt}))}))};}});}
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Install/status the Hermes liaison or turn its Telegram ask_user bridge on/off
3
+ argument-hint: "<install|status|on|off> [telegram-id] [--profile NAME] [--force] [--restart]"
4
+ ---
5
+
6
+ Run the deterministic Agent Fleet controller with the arguments from `$ARGUMENTS`. Supported forms are:
7
+
8
+ ```text
9
+ set-hermes-telegram install [--profile NAME] [--force] [--restart]
10
+ set-hermes-telegram status [--profile NAME]
11
+ set-hermes-telegram on <telegram-id[:topic-id]> [--profile NAME]
12
+ set-hermes-telegram off <telegram-id[:topic-id]> [--profile NAME]
13
+ ```
14
+
15
+ Use `node bin/cli.js set-hermes-telegram ...` when the checkout-local CLI exists; otherwise use `npx --no-install agent-fleet set-hermes-telegram ...`. Pass parsed values as separately quoted shell arguments. If neither CLI exists, report that Agent Fleet must be installed or updated. Do not reproduce installation or Herdr lifecycle with ad-hoc commands, do not bypass a `--force` refusal, and do not send a test Telegram message. Return the controller output verbatim.
@@ -20,7 +20,7 @@ Removal happens **only** on an explicit `Remove some…` multi-select (empty sel
20
20
 
21
21
  **Personas are generated for non-pi targets.** The personas group lists the full availability roster from `node <source-root>/bin/cli.js transform-persona --list --agent <agent>`. For `pi` the canonical `agents/<name>.md` installs as-is (copy or symlink). For `claude-code`/`opencode` the apply step runs `transform-persona --agent <agent> --workspace <workspace> <name…>` instead — always a generated copy, even in symlink mode — and records the rows with `transformed: true`; status checks diff against the generated output, not the raw source.
22
22
 
23
- **pi harness companions.** Installing, refreshing, or removing any pi harness also refreshes its companions in the same pass — the `justfile` launch recipes, `scripts/team-up.ts`, the peer/team YAML and personas, `.pi/damage-control-rules.yaml`, and `.pi/harnesses/package.json`. When `agent-hub` is installed or kept, keep its required launch companions together: `damage-control`, `damage-control-continue`, and `ask-user-remote`; the managed `just hub` / `hub-solo` recipes load `damage-control-continue`, then `ask-user-remote`, then `agent-hub` so the dispatcher probe sees `ask_user`. Refresh the `justfile` from the **current** source so retired-harness recipes are pruned and new ones added, rewriting only the managed region between the `agent-fleet:harnesses` sentinels so any user recipes survive. Leaving a stale `justfile` (recipes pointing at deleted harness dirs, or no recipe for a new harness) is the regression this prevents.
23
+ **pi harness companions.** Installing, refreshing, or removing any pi harness also refreshes its companions in the same pass — the `justfile` launch recipes, `scripts/team-up.ts`, the peer/team YAML and personas, `.pi/damage-control-rules.yaml`, and `.pi/harnesses/package.json`. When `agent-hub` is installed or kept, keep its required launch companions together: `damage-control-continue` and `ask-user-remote`; the managed `just hub` / `hub-solo` recipes load both before `agent-hub`, and every native child inherits continue. Treat the retired `damage-control` hard-stop directory as `gone`: remove it only when recorded and unchanged against the recorded snapshot, or when it is a symlink into the source root (including a broken retirement link); preserve every user-modified or unowned copy. Refresh the `justfile` from the **current** source so retired-harness recipes are pruned and new ones added, rewriting only the managed region between the `agent-fleet:harnesses` sentinels so any user recipes survive.
24
24
 
25
25
  **No mid-apply overwrite prompts.** The `mod` description already warns that refreshing overwrites local edits. The user's selection is the consent; the Step 9 confirmation is the single gate. During apply, refresh selected items unconditionally — never pause to ask "should I overwrite this file?". Genuine errors (permission denied, missing source) still stop and report.
26
26