@chankov/agent-fleet 0.0.3 → 0.0.4

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 (329) hide show
  1. package/.claude/commands/setup-agent-fleet.md +1 -1
  2. package/.opencode/commands/af-setup-agent-fleet.md +1 -1
  3. package/.pi/harnesses/agent-hub/README.md +199 -16
  4. package/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  5. package/.pi/harnesses/agent-hub/delegate.ts +32 -9
  6. package/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
  7. package/.pi/harnesses/agent-hub/footer.ts +29 -0
  8. package/.pi/harnesses/agent-hub/helpers.ts +49 -0
  9. package/.pi/harnesses/agent-hub/index.ts +1033 -242
  10. package/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  11. package/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  12. package/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  13. package/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  14. package/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  15. package/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
  16. package/.pi/harnesses/agent-hub/package.json +5 -4
  17. package/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  18. package/.pi/harnesses/agent-hub/run-budget.js +155 -0
  19. package/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  20. package/.pi/harnesses/agent-hub/spawn.ts +161 -94
  21. package/.pi/harnesses/agent-hub/version.ts +18 -0
  22. package/.pi/harnesses/coms/README.md +10 -0
  23. package/.pi/harnesses/coms/index.ts +2 -0
  24. package/.pi/harnesses/coms/package.json +5 -4
  25. package/.pi/harnesses/coms/version.ts +18 -0
  26. package/.pi/harnesses/damage-control-continue/README.md +32 -31
  27. package/.pi/harnesses/damage-control-continue/index.ts +23 -9
  28. package/.pi/harnesses/damage-control-continue/package.json +5 -4
  29. package/.pi/harnesses/damage-control-continue/version.ts +18 -0
  30. package/.pi/harnesses/{damage-control/shared.ts → lib/damage-control-shared.ts} +20 -6
  31. package/.pi/prompts/setup-agent-fleet.md +1 -1
  32. package/.versions/0.0.4/.claude/commands/build.md +44 -0
  33. package/.versions/0.0.4/.claude/commands/code-simplify.md +22 -0
  34. package/.versions/0.0.4/.claude/commands/design-agent.md +14 -0
  35. package/.versions/0.0.4/.claude/commands/doctor-agent-fleet.md +17 -0
  36. package/.versions/0.0.4/.claude/commands/orchestrate.md +112 -0
  37. package/.versions/0.0.4/.claude/commands/plan.md +16 -0
  38. package/.versions/0.0.4/.claude/commands/prime.md +22 -0
  39. package/.versions/0.0.4/.claude/commands/review.md +16 -0
  40. package/.versions/0.0.4/.claude/commands/setup-agent-fleet.md +25 -0
  41. package/.versions/0.0.4/.claude/commands/ship.md +72 -0
  42. package/.versions/0.0.4/.claude/commands/spec.md +15 -0
  43. package/.versions/0.0.4/.claude/commands/test.md +19 -0
  44. package/.versions/0.0.4/.claude/commands/webperf.md +32 -0
  45. package/.versions/0.0.4/.claude/orchestrate-teams.yaml +24 -0
  46. package/.versions/0.0.4/.opencode/commands/af-build.md +17 -0
  47. package/.versions/0.0.4/.opencode/commands/af-code-simplify.md +16 -0
  48. package/.versions/0.0.4/.opencode/commands/af-compound.md +16 -0
  49. package/.versions/0.0.4/.opencode/commands/af-design-agent.md +15 -0
  50. package/.versions/0.0.4/.opencode/commands/af-doctor-agent-fleet.md +17 -0
  51. package/.versions/0.0.4/.opencode/commands/af-orchestrate.md +112 -0
  52. package/.versions/0.0.4/.opencode/commands/af-plan.md +16 -0
  53. package/.versions/0.0.4/.opencode/commands/af-prime.md +22 -0
  54. package/.versions/0.0.4/.opencode/commands/af-review.md +15 -0
  55. package/.versions/0.0.4/.opencode/commands/af-setup-agent-fleet.md +15 -0
  56. package/.versions/0.0.4/.opencode/commands/af-ship.md +16 -0
  57. package/.versions/0.0.4/.opencode/commands/af-spec.md +16 -0
  58. package/.versions/0.0.4/.opencode/commands/af-test.md +21 -0
  59. package/.versions/0.0.4/.opencode/commands/af-webperf.md +32 -0
  60. package/.versions/0.0.4/.opencode/orchestrate-teams.yaml +24 -0
  61. package/.versions/0.0.4/.pi/agents/dispatch-policy.yaml +32 -0
  62. package/.versions/0.0.4/.pi/agents/model-profiles.yaml +20 -0
  63. package/.versions/0.0.4/.pi/agents/peers.yaml +146 -0
  64. package/.versions/0.0.4/.pi/agents/teams.yaml +39 -0
  65. package/.versions/0.0.4/.pi/damage-control-rules.yaml +297 -0
  66. package/.versions/0.0.4/.pi/extensions/agent-fleet-update-check/README.md +58 -0
  67. package/.versions/0.0.4/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  68. package/{.pi/harnesses/damage-control → .versions/0.0.4/.pi/extensions/agent-fleet-update-check}/package.json +1 -1
  69. package/.versions/0.0.4/.pi/extensions/btw/README.md +118 -0
  70. package/.versions/0.0.4/.pi/extensions/btw/index.ts +917 -0
  71. package/.versions/0.0.4/.pi/extensions/btw/package.json +6 -0
  72. package/.versions/0.0.4/.pi/extensions/btw/state.js +179 -0
  73. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/README.md +58 -0
  74. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/index.ts +92 -0
  75. package/.versions/0.0.4/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  76. package/.versions/0.0.4/.pi/extensions/compact-and-continue/README.md +42 -0
  77. package/.versions/0.0.4/.pi/extensions/compact-and-continue/index.ts +120 -0
  78. package/.versions/0.0.4/.pi/extensions/compact-and-continue/package.json +6 -0
  79. package/.versions/0.0.4/.pi/extensions/mcp-bridge/README.md +46 -0
  80. package/.versions/0.0.4/.pi/extensions/mcp-bridge/index.ts +206 -0
  81. package/.versions/0.0.4/.pi/extensions/mcp-bridge/package.json +6 -0
  82. package/.versions/0.0.4/.pi/extensions/package-lock.json +1143 -0
  83. package/.versions/0.0.4/.pi/extensions/package.json +9 -0
  84. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/README.md +201 -0
  85. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/config.ts +198 -0
  86. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  87. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/index.ts +248 -0
  88. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/package.json +6 -0
  89. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  90. package/.versions/0.0.4/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  91. package/.versions/0.0.4/.pi/harnesses/agent-hub/README.md +798 -0
  92. package/.versions/0.0.4/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  93. package/.versions/0.0.4/.pi/harnesses/agent-hub/artifacts.js +92 -0
  94. package/.versions/0.0.4/.pi/harnesses/agent-hub/backend-policy.js +153 -0
  95. package/.versions/0.0.4/.pi/harnesses/agent-hub/delegate.ts +386 -0
  96. package/.versions/0.0.4/.pi/harnesses/agent-hub/drift-watchdog.js +165 -0
  97. package/.versions/0.0.4/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  98. package/.versions/0.0.4/.pi/harnesses/agent-hub/footer.ts +29 -0
  99. package/.versions/0.0.4/.pi/harnesses/agent-hub/helpers.ts +214 -0
  100. package/.versions/0.0.4/.pi/harnesses/agent-hub/index.ts +8045 -0
  101. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  102. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  103. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  104. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  105. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  106. package/.versions/0.0.4/.pi/harnesses/agent-hub/monitor-session-bridge.ts +11 -0
  107. package/.versions/0.0.4/.pi/harnesses/agent-hub/package.json +7 -0
  108. package/.versions/0.0.4/.pi/harnesses/agent-hub/research-retention.js +34 -0
  109. package/.versions/0.0.4/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  110. package/.versions/0.0.4/.pi/harnesses/agent-hub/return-contract.js +215 -0
  111. package/.versions/0.0.4/.pi/harnesses/agent-hub/run-budget.js +155 -0
  112. package/.versions/0.0.4/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  113. package/.versions/0.0.4/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  114. package/.versions/0.0.4/.pi/harnesses/agent-hub/spawn.ts +246 -0
  115. package/.versions/0.0.4/.pi/harnesses/agent-hub/version.ts +18 -0
  116. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/README.md +18 -0
  117. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/index.ts +293 -0
  118. package/.versions/0.0.4/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  119. package/.versions/0.0.4/.pi/harnesses/coms/README.md +92 -0
  120. package/.versions/0.0.4/.pi/harnesses/coms/index.ts +1745 -0
  121. package/.versions/0.0.4/.pi/harnesses/coms/package.json +7 -0
  122. package/.versions/0.0.4/.pi/harnesses/coms/version.ts +18 -0
  123. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/README.md +117 -0
  124. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/index.ts +536 -0
  125. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/package.json +7 -0
  126. package/.versions/0.0.4/.pi/harnesses/damage-control-continue/version.ts +18 -0
  127. package/.versions/0.0.4/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  128. package/.versions/0.0.4/.pi/harnesses/lib/herdr-client.ts +458 -0
  129. package/.versions/0.0.4/.pi/harnesses/lib/herdr-presence.ts +288 -0
  130. package/.versions/0.0.4/.pi/harnesses/package-lock.json +35 -0
  131. package/.versions/0.0.4/.pi/harnesses/package.json +9 -0
  132. package/.versions/0.0.4/.pi/prompts/build.md +24 -0
  133. package/.versions/0.0.4/.pi/prompts/code-simplify.md +22 -0
  134. package/.versions/0.0.4/.pi/prompts/doctor-agent-fleet.md +15 -0
  135. package/.versions/0.0.4/.pi/prompts/plan.md +16 -0
  136. package/.versions/0.0.4/.pi/prompts/review.md +16 -0
  137. package/.versions/0.0.4/.pi/prompts/setup-agent-fleet.md +27 -0
  138. package/.versions/0.0.4/.pi/prompts/ship.md +17 -0
  139. package/.versions/0.0.4/.pi/prompts/spec.md +15 -0
  140. package/.versions/0.0.4/.pi/prompts/test.md +19 -0
  141. package/.versions/0.0.4/.pi/skills/bowser/SKILL.md +145 -0
  142. package/.versions/0.0.4/.version +1 -0
  143. package/.versions/0.0.4/agents/architect.md +23 -0
  144. package/.versions/0.0.4/agents/bowser.md +26 -0
  145. package/.versions/0.0.4/agents/builder.md +53 -0
  146. package/.versions/0.0.4/agents/code-reviewer.md +205 -0
  147. package/.versions/0.0.4/agents/deep-researcher.md +31 -0
  148. package/.versions/0.0.4/agents/documenter.md +18 -0
  149. package/.versions/0.0.4/agents/orchestrator.md +54 -0
  150. package/.versions/0.0.4/agents/plan-reviewer.md +60 -0
  151. package/.versions/0.0.4/agents/planner.md +69 -0
  152. package/.versions/0.0.4/agents/releaser.md +24 -0
  153. package/.versions/0.0.4/agents/researcher.md +28 -0
  154. package/.versions/0.0.4/agents/security-auditor.md +166 -0
  155. package/.versions/0.0.4/agents/test-engineer.md +151 -0
  156. package/.versions/0.0.4/agents/web-debugger.md +42 -0
  157. package/.versions/0.0.4/agents/web-performance-auditor.md +192 -0
  158. package/.versions/0.0.4/codex/CONDUCTOR.md +148 -0
  159. package/.versions/0.0.4/docs/ARCHITECTURE.md +210 -0
  160. package/.versions/0.0.4/docs/agent-fleet-setup.md +366 -0
  161. package/.versions/0.0.4/docs/claude-code-coms-bridge.md +103 -0
  162. package/.versions/0.0.4/docs/codex-remote-conductor.md +170 -0
  163. package/.versions/0.0.4/docs/coms-hermes-bridge.md +121 -0
  164. package/.versions/0.0.4/docs/getting-started.md +183 -0
  165. package/.versions/0.0.4/docs/npm-install.md +337 -0
  166. package/.versions/0.0.4/docs/opencode-setup.md +248 -0
  167. package/.versions/0.0.4/docs/pi-extensions.md +288 -0
  168. package/.versions/0.0.4/docs/pi-setup.md +463 -0
  169. package/.versions/0.0.4/docs/skill-anatomy.md +150 -0
  170. package/.versions/0.0.4/hermes/README.md +228 -0
  171. package/.versions/0.0.4/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  172. package/.versions/0.0.4/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  173. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +15 -0
  174. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +19 -0
  175. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +13 -0
  176. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +11 -0
  177. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +9 -0
  178. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +17 -0
  179. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +34 -0
  180. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +151 -0
  181. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +39 -0
  182. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  183. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +12 -0
  184. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  185. package/.versions/0.0.4/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +22 -0
  186. package/.versions/0.0.4/hermes/skills/hub-conductor/SKILL.md +84 -0
  187. package/.versions/0.0.4/hermes/skills/hub-liaison/SKILL.md +84 -0
  188. package/.versions/0.0.4/hooks/SIMPLIFY-IGNORE.md +90 -0
  189. package/.versions/0.0.4/hooks/coms-stop-hook.mjs +73 -0
  190. package/.versions/0.0.4/hooks/hooks.json +14 -0
  191. package/.versions/0.0.4/hooks/session-start.sh +74 -0
  192. package/.versions/0.0.4/hooks/simplify-ignore.sh +302 -0
  193. package/.versions/0.0.4/justfile +256 -0
  194. package/.versions/0.0.4/references/accessibility-checklist.md +160 -0
  195. package/.versions/0.0.4/references/definition-of-done.md +67 -0
  196. package/.versions/0.0.4/references/fleet-coordination-patterns.md +151 -0
  197. package/.versions/0.0.4/references/observability-checklist.md +91 -0
  198. package/.versions/0.0.4/references/orchestration-patterns.md +370 -0
  199. package/.versions/0.0.4/references/performance-checklist.md +153 -0
  200. package/.versions/0.0.4/references/prompting-patterns.md +380 -0
  201. package/.versions/0.0.4/references/security-checklist.md +179 -0
  202. package/.versions/0.0.4/references/testing-patterns.md +236 -0
  203. package/.versions/0.0.4/scripts/codex-conductor.ts +41 -0
  204. package/.versions/0.0.4/scripts/codex-remote-control.ts +167 -0
  205. package/.versions/0.0.4/scripts/coms-claude-bridge.ts +286 -0
  206. package/.versions/0.0.4/scripts/coms-cli.ts +484 -0
  207. package/.versions/0.0.4/scripts/coms-hermes-bridge.ts +403 -0
  208. package/.versions/0.0.4/scripts/hermes-monitor-capability-runner.ts +25 -0
  209. package/.versions/0.0.4/scripts/hermes-monitor-scenario.ts +7 -0
  210. package/.versions/0.0.4/scripts/lib/claude-bridge-core.ts +100 -0
  211. package/.versions/0.0.4/scripts/lib/codex-conductor.ts +88 -0
  212. package/.versions/0.0.4/scripts/lib/codex-remote-control.ts +480 -0
  213. package/.versions/0.0.4/scripts/lib/coms-envelope.ts +539 -0
  214. package/.versions/0.0.4/scripts/lib/fake-herdr-server.ts +88 -0
  215. package/.versions/0.0.4/scripts/lib/herdr-layout.ts +263 -0
  216. package/.versions/0.0.4/scripts/lib/hermes-bridge-core.ts +238 -0
  217. package/.versions/0.0.4/scripts/lib/hermes-monitor-herdr.ts +28 -0
  218. package/.versions/0.0.4/scripts/lib/hermes-monitor-model.ts +9 -0
  219. package/.versions/0.0.4/scripts/lib/hermes-monitor-registry.ts +6 -0
  220. package/.versions/0.0.4/scripts/lib/hermes-monitor-socket.ts +118 -0
  221. package/.versions/0.0.4/scripts/lib/hermes-monitor-store.ts +31 -0
  222. package/.versions/0.0.4/scripts/lib/persona-banner.ts +62 -0
  223. package/.versions/0.0.4/scripts/lib/spawn-stagger.ts +101 -0
  224. package/.versions/0.0.4/scripts/lib/team-project.ts +184 -0
  225. package/.versions/0.0.4/scripts/lib/team-snapshot.ts +147 -0
  226. package/.versions/0.0.4/scripts/peer-banner.ts +40 -0
  227. package/.versions/0.0.4/scripts/team-snapshot.ts +238 -0
  228. package/.versions/0.0.4/scripts/team-up.ts +333 -0
  229. package/.versions/0.0.4/skills/_internal/grilling.md +11 -0
  230. package/.versions/0.0.4/skills/browser-testing-with-devtools/SKILL.md +352 -0
  231. package/.versions/0.0.4/skills/code-review-and-quality/SKILL.md +381 -0
  232. package/.versions/0.0.4/skills/compound-learning/SKILL.md +137 -0
  233. package/.versions/0.0.4/skills/context-engineering/SKILL.md +291 -0
  234. package/.versions/0.0.4/skills/deprecation-and-migration/SKILL.md +206 -0
  235. package/.versions/0.0.4/skills/designing-agents/SKILL.md +394 -0
  236. package/.versions/0.0.4/skills/designing-agents/pi-harness-authoring.md +222 -0
  237. package/.versions/0.0.4/skills/frontend-ui-engineering/SKILL.md +328 -0
  238. package/.versions/0.0.4/skills/git-workflow-and-versioning/SKILL.md +316 -0
  239. package/.versions/0.0.4/skills/guided-workspace-setup/SKILL.md +535 -0
  240. package/.versions/0.0.4/skills/guided-workspace-setup/companion-manifest.json +33 -0
  241. package/.versions/0.0.4/skills/idea-refine/SKILL.md +182 -0
  242. package/.versions/0.0.4/skills/idea-refine/examples.md +238 -0
  243. package/.versions/0.0.4/skills/idea-refine/frameworks.md +99 -0
  244. package/.versions/0.0.4/skills/idea-refine/refinement-criteria.md +113 -0
  245. package/.versions/0.0.4/skills/idea-refine/scripts/idea-refine.sh +15 -0
  246. package/.versions/0.0.4/skills/incremental-implementation/SKILL.md +287 -0
  247. package/.versions/0.0.4/skills/interview-me/SKILL.md +226 -0
  248. package/.versions/0.0.4/skills/orchestration-verification/SKILL.md +181 -0
  249. package/.versions/0.0.4/skills/peer-coms/SKILL.md +90 -0
  250. package/.versions/0.0.4/skills/performance-optimization/SKILL.md +350 -0
  251. package/.versions/0.0.4/skills/planning-and-task-breakdown/SKILL.md +236 -0
  252. package/.versions/0.0.4/skills/security-and-hardening/SKILL.md +461 -0
  253. package/.versions/0.0.4/skills/spec-driven-development/SKILL.md +245 -0
  254. package/.versions/0.0.4/skills/using-agent-skills/SKILL.md +199 -0
  255. package/.versions/0.0.4/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  256. package/.versions/0.0.4/vendor/agent-skills-upstream/LICENSE +21 -0
  257. package/.versions/0.0.4/vendor/agent-skills-upstream/README.md +11 -0
  258. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  259. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  260. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  261. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  262. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  263. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  264. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  265. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  266. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  267. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  268. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  269. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  270. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  271. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  272. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  273. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  274. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  275. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  276. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  277. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  278. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  279. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  280. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  281. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  282. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  283. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  284. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  285. package/.versions/0.0.4/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  286. package/CHANGELOG.md +53 -0
  287. package/README.md +3 -3
  288. package/agents/builder.md +1 -1
  289. package/agents/code-reviewer.md +1 -1
  290. package/agents/deep-researcher.md +3 -3
  291. package/agents/orchestrator.md +20 -11
  292. package/agents/plan-reviewer.md +3 -3
  293. package/agents/test-engineer.md +11 -4
  294. package/bin/lib/validate-overrides.js +19 -0
  295. package/bin/sync-harness-versions.js +94 -0
  296. package/docs/ARCHITECTURE.md +46 -1
  297. package/docs/agent-fleet-setup.md +10 -0
  298. package/docs/pi-extensions.md +49 -14
  299. package/docs/pi-setup.md +10 -4
  300. package/hermes/README.md +180 -0
  301. package/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  302. package/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  303. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-cap.test.py +15 -0
  304. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-discovery.test.py +19 -0
  305. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-envelope.test.py +13 -0
  306. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-forged-owner.test.py +11 -0
  307. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-lease-list.test.py +9 -0
  308. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-multihub.test.py +17 -0
  309. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter-output.test.py +34 -0
  310. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +151 -0
  311. package/hermes/plugins/agent-fleet-monitor/dashboard/adapter.test.py +39 -0
  312. package/hermes/plugins/agent-fleet-monitor/dashboard/dist/index.js +10 -0
  313. package/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  314. package/hermes/plugins/agent-fleet-monitor/dashboard/plugin-api-validation.test.py +12 -0
  315. package/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  316. package/hermes/plugins/agent-fleet-monitor/dashboard/review-live-wiring.red.test.py +22 -0
  317. package/justfile +6 -10
  318. package/package.json +9 -4
  319. package/scripts/lib/fake-herdr-server.ts +88 -0
  320. package/scripts/lib/hermes-monitor-herdr.ts +28 -0
  321. package/scripts/lib/hermes-monitor-model.ts +9 -0
  322. package/scripts/lib/hermes-monitor-registry.ts +6 -0
  323. package/scripts/lib/hermes-monitor-socket.ts +118 -0
  324. package/scripts/lib/hermes-monitor-store.ts +31 -0
  325. package/skills/designing-agents/SKILL.md +2 -2
  326. package/skills/designing-agents/pi-harness-authoring.md +26 -13
  327. package/skills/guided-workspace-setup/SKILL.md +11 -8
  328. package/.pi/harnesses/damage-control/README.md +0 -65
  329. package/.pi/harnesses/damage-control/index.ts +0 -250
@@ -13,6 +13,7 @@ the runtime responsibilities and where each module lives in the repository.
13
13
  | **coms** | Peer communication protocol/data plane — envelope-based P2P messaging between agents | `.pi/harnesses/coms/`, `scripts/lib/coms-envelope.ts`, `scripts/coms-cli.ts` |
14
14
  | **Claude Code bridge** | Makes an interactive Claude Code pane a bidirectional coms peer | `scripts/coms-claude-bridge.ts`, `hooks/coms-stop-hook.mjs`, `skills/peer-coms/` — see [claude-code-coms-bridge.md](claude-code-coms-bridge.md) |
15
15
  | **Hermes bridge** | Remote human control — relays hub questions to Telegram, races phone vs. local answers, conductor/liaison skills | `scripts/coms-hermes-bridge.ts`, `.pi/harnesses/ask-user-remote/`, `hermes/skills/` — see [coms-hermes-bridge.md](coms-hermes-bridge.md) |
16
+ | **Hermes local monitor transport** | Local, authenticated visibility/control contract for hub-owned task generations; presentation is supplied by an external consumer | `.pi/harnesses/agent-hub/monitor-*.ts`, `scripts/lib/hermes-monitor-{model,store,registry,socket}.ts` — see [Hermes artifacts](../hermes/README.md#local-agent-hub-monitor-integration) |
16
17
  | **Codex remote-control conductor** | Experimental outbound-only, user-systemd-managed Android conductor; verified on Codex CLI 0.144.x | `scripts/codex-remote-control.ts`, `scripts/codex-conductor.ts`, `codex/CONDUCTOR.md`, `systemd/user/`; runtime under `~/.local/state/agent-fleet/codex-conductor/` — see [codex-remote-conductor.md](codex-remote-conductor.md) |
17
18
  | **Skill library** | Lifecycle workflows and quality gates every agent follows | `skills/` (native) + `vendor/agent-skills-upstream/skills/` (vendored) — see [UPSTREAM-SKILLS.md](UPSTREAM-SKILLS.md) |
18
19
  | **Personas** | Reusable specialist definitions, transformed per harness | `agents/`, `bin/lib/transform-persona.js` |
@@ -74,7 +75,47 @@ hub (orchestrator)
74
75
  └── Codex Remote Control (Android · outbound coms delegation)
75
76
  ```
76
77
 
77
- Composition rule: **the hub (or a slash command) orchestrates; personas do not invoke other personas as peers.** Specialists may only fan out to their configured **sub-agents**. Research helpers write findings to disk; the hub resumes specialists with paths, not raw dumps. Full pattern catalog: [references/orchestration-patterns.md](../references/orchestration-patterns.md).
78
+ Composition rule: **the hub (or a slash command) orchestrates; personas do not invoke other personas as peers.** Specialists may only fan out to their configured **sub-agents**. Research helpers write findings to disk; the hub resumes specialists with paths, not raw dumps.
79
+
80
+ ### Research search supervision
81
+
82
+ The shared `spawnPiAgent` seam supervises every `read`/`grep`/`find`/`ls` call from native
83
+ research helpers and nested delegate children. The supervisor tracks JSONL `toolCallId` values
84
+ independently, with a default 120-second deadline (`recon-search-timeout-s: 1..3600|off` under
85
+ `## agent-hub`). It is a per-tool watchdog; the whole-run bound is separate — the execution
86
+ mode's per-run deadline (`agent-turn-timeout-s`), which terminates a hung run as `turn_timeout`.
87
+ On timeout or caller cancellation it owns and terminates the child's process group (SIGTERM,
88
+ then SIGKILL after a bounded grace), has a separate settlement timer for missing `close`/pipe
89
+ drain, and reports timeout separately from cancellation. Research helpers and nested delegates
90
+ are each given safe process-group ownership; delegates forward parent termination so no detached
91
+ child is orphaned. Full pattern catalog: [references/orchestration-patterns.md](../references/orchestration-patterns.md).
92
+
93
+ ### Execution modes & turn budgets
94
+
95
+ The hub enforces per-user-turn budgets in code (`run-budget.js`): `fast`/`standard`/`strict`
96
+ modes cap `dispatch_agent` calls, `spawn_research` calls, and wall clock per turn, set the
97
+ per-run deadline above, and control nested delegation. Exhausted budgets make the dispatch
98
+ tools refuse with "summarize and ask the user"; a new user message opens a fresh window.
99
+ Specialist context pressure is measured over input + cacheRead + cacheWrite, and specialist
100
+ sessions are recycled (fresh spawn instead of `-c` resume) after `session-recycle-runs` runs
101
+ or ≥60% measured context — resumed sessions otherwise re-bill their accumulated context on
102
+ every model call. Configured under `## agent-hub` (`mode`, `max-dispatches-per-turn`,
103
+ `max-research-per-turn`, `turn-wall-time-s`, `agent-turn-timeout-s`, `session-recycle-runs`);
104
+ switched live with `/hub-mode`.
105
+
106
+ On top of the mode sit three qualitative guardrails. **Task triage**: the dispatcher
107
+ classifies each turn via the `set_task_tier` tool (`trivial`/`small`/`feature`/`project`)
108
+ and the caps drop to min(mode, tier); a duplicate-dispatch guard refuses near-identical
109
+ re-dispatches within a turn. **Drift watchdog** (`drift-watchdog.js`): armed dispatches are
110
+ observed in-flight from the JSON event stream — deterministic rules (out-of-scope writes
111
+ against the declared `scope` globs, tool-call loops, consecutive failures, tool-call cap)
112
+ escalate to a one-shot cheap LLM judge whose DRIFTING/STUCK verdict terminates the run as
113
+ `drift_stop` (exit 125, partial output preserved); enabled per hub/agent/dispatch
114
+ (`watchdog` key, `/watchdog`, `watchdog` param). **Dynamic teams**: `/agents-add`,
115
+ `/agents-drop`, `/agents-save` restructure the roster live (the system prompt rebuilds
116
+ every turn), and the gated `team_adjust` tool lets the dispatcher itself adjust the roster
117
+ outside fast mode, with user notification. `/hub-report` accounts each turn's dispatches,
118
+ tokens (billed = input + cacheRead + cacheWrite), recycles, drift stops, and refusals.
78
119
 
79
120
  ## Runtime stack (tools the fleet sits on)
80
121
 
@@ -146,6 +187,10 @@ packages/hermes-bridge/ # future Hermes integration package
146
187
  the fleet core stays agent-agnostic. Hermes remains the inbound `ask_user`/
147
188
  Telegram route; the experimental Codex conductor is outbound-initiated only,
148
189
  approval-gated, and restricted to listed peers through the validated wrapper.
190
+ - **Hermes monitor presentation is outside the fleet core.** Agent Fleet owns task state,
191
+ bounded output, leases, and generation-safe cancellation, and exposes them only through
192
+ owner-only discovery and a local Unix socket. A Hermes-facing consumer owns its UI and
193
+ reconnect behavior; no Hermes backend/Desktop plugin is bundled or installed.
149
194
  - **External conductor contracts are advisory.** Pi damage-control wraps Pi
150
195
  tool calls, not Hermes or Codex processes; human approvals and their
151
196
  contracts reduce risk but do not provide an OS command allowlist.
@@ -106,6 +106,15 @@ targets an end-of-session compound pass writes lessons to.
106
106
  | `rules` | none | Comma-separated repo-relative folders holding the project's own rule files (HOW — implementation patterns the work must comply with). Resolution is **index-first**: when a folder has a top-level `README.md`/`index.md`, personas read it first and follow its loading manifest (session bundles, conditional-load lists) instead of bulk-reading the tree; a folder without an index is searched **recursively** through all subfolders. The harness tells every dispatched specialist where the rules live and how to resolve them; the planner and code-reviewer personas read the relevant rules, validate their subject against them, and pass them on (cited in plan acceptance criteria / handed to delegate sub-reviewers). Missing folders produce a session-start warning. |
107
107
  | `docs` | none | Comma-separated repo-relative documentation **entry points** (WHAT/WHY — architecture, standards, decisions): canonical files (e.g. `Docs/AGENTS.md`) or doc folders (personas start from a folder's `README.md`/index). Unlike `rules`, docs orient rather than bind: every dispatched specialist and research helper is told to read the entry points relevant to its task and follow their links instead of bulk-reading doc trees; the code-reviewer flags changes that alter documented behavior without a doc update; the documenter treats the entry points and the trees they link as the docs it maintains. Missing paths produce a session-start warning. |
108
108
  | `research-keep` | `4` | How many **finished** manual/persona research helpers the hub retains (LRU by finish time) so they stay resumable via `/agents-cont rN`; older ones are pruned along with their session files. `all` disables the cap. Auto-research pipe helpers (spawned for `NEEDS_RESEARCH:` pauses) are always pruned as soon as they finish — their findings persist as files under `.pi/agent-sessions/findings/`. Running helpers are never pruned. An invalid value is ignored with a session-start warning. |
109
+ | `recon-search-timeout-s` | `120` | Parent-side deadline, in seconds, for each `read`, `grep`, `find`, or `ls` call made by a native research helper or nested delegate child. Accepts an integer `1`–`3600` or `off`; invalid input warns and falls back to `120`. This is **not** an agent/turn deadline: non-tool work can run indefinitely. On timeout the hub returns `tool_timeout` with call metadata, sends SIGTERM to its owned process group, escalates to SIGKILL after a finite grace period, and settles even if the child never closes or a descendant holds a pipe. If that bounded cleanup cannot confirm child/process-group death, the metadata reports `terminationConfirmed: false`; this prevents a parent hang but may indicate an uninterruptible OS-level process needing operator attention. |
110
+ | `mode` | `standard` | Execution mode for the hub's per-turn budgets: `fast` (single-specialist path, no nested delegation, assertion ledger optional), `standard` (batched execution with moderate budgets), or `strict` (full Verification Contract with wide budgets). Budgets are per **user turn** — exhausted budgets make `dispatch_agent`/`spawn_research` refuse with "summarize and ask the user"; the next user message opens a fresh window. Switchable live with `/hub-mode`. |
111
+ | `max-dispatches-per-turn` | mode default (2/8/24) | `dispatch_agent` calls allowed per user turn. Positive integer or `off` (unlimited). |
112
+ | `max-research-per-turn` | mode default (1/4/12) | `spawn_research` calls allowed per user turn (the auto-research pipe and the `/research` command are exempt). Positive integer or `off`. |
113
+ | `turn-wall-time-s` | mode default (900/3600/14400) | Wall-clock budget, in seconds, per user turn; once exceeded, further dispatch/research calls refuse. Positive integer or `off`. |
114
+ | `agent-turn-timeout-s` | mode default (600/1800/off) | Whole-run deadline, in seconds, for each spawned specialist, research helper, and nested delegate child (unlike `recon-search-timeout-s`, this bounds the entire run). On expiry the run terminates as `turn_timeout` (exit 124) with partial output preserved. Positive integer or `off`. |
115
+ | `session-recycle-runs` | mode default (3/5/5) | Recycle a specialist's accumulated session (fresh spawn instead of `-c` resume) after this many resumed runs. Context is also always recycled at ≥60% measured context (input + cacheRead + cacheWrite). Positive integer or `off` (context threshold still applies). |
116
+ | `watchdog` | `auto` | Drift watchdog default for dispatched specialists: `auto`/`on` arm the in-flight rules (out-of-scope writes, tool-call loops, repeated failures, tool-call cap) with LLM-judge escalation; `off` disarms. Overridable live per hub (`/watchdog on\|off\|auto`), per agent (`/watchdog <agent> on\|off\|clear`), and per dispatch (the `watchdog` param). A DRIFTING/STUCK verdict terminates the run as `drift_stop` (exit 125) with partial output preserved. |
117
+ | `watchdog-judge-model` | researcher persona's model | pi model spec for the one-shot drift judge (e.g. `openai-codex/gpt-5.3-codex-spark`). Falls back to the researcher persona's resolved model, then the dispatcher's. |
109
118
 
110
119
  Example — switch the dispatcher to Bulgarian, pin the builder to sonnet, raise the
111
120
  code-reviewer's thinking level, move the code-reviewer's docs sub-reviewer to a
@@ -120,6 +129,7 @@ models.builder: github-copilot/claude-sonnet-4.6, github-copilot/claude-haiku-4.
120
129
  thinking.code-reviewer: xhigh
121
130
  subagents.code-reviewer.docs: github-copilot/claude-sonnet-4.6, tools=read,grep
122
131
  delegate-depth.code-reviewer: 1
132
+ recon-search-timeout-s: 120 # or off to disable the per-tool watchdog
123
133
  rules: docs/rules, .ai/rules
124
134
  docs: Docs/AGENTS.md, Docs/architecture/ARCHITECTURE_OVERVIEW.md
125
135
  ```
@@ -57,13 +57,13 @@ all of them. If the harnesses lived there, a plain `pi` run would load them all
57
57
  same CLI flags would abort startup with duplicate registrations. So the harnesses live in
58
58
  `.pi/harnesses/` instead, and you load the desired recipe explicitly:
59
59
 
60
- - through the `justfile` — `just hub`, `just ext-damage-control`, `just safe-coms`, …
60
+ - through the `justfile` — `just hub`, `just ext-damage-control-continue`, `just safe-coms`, …
61
61
  - or directly — `pi -e .pi/harnesses/<name>/index.ts`
62
62
 
63
63
  When you consume this repo from another project, point `pi -e` at the harness file you
64
64
  want, or symlink that one directory into *its* `.pi/harnesses/` — never drop the harnesses
65
65
  into `.pi/extensions/`, and never load all of them at once. The supported multi-harness
66
- exception is loading a damage-control variant before `agent-hub` for a guarded hub session (see
66
+ exception is loading `damage-control-continue` and `ask-user-remote` before `agent-hub` for a guarded hub session (see
67
67
  [pi-setup.md](pi-setup.md#optional-pi-extensions)).
68
68
 
69
69
  ---
@@ -87,15 +87,44 @@ runtime itself.
87
87
 
88
88
  | Extension | Category | What it does | Run |
89
89
  |-----------|----------|--------------|-----|
90
- | [agent-hub](../.pi/harnesses/agent-hub/README.md) | Orchestration | Supported multi-agent hub: damage-control guardrails by default via `just hub`, dispatcher grid, specialist delegation, research helpers, persona gate, embedded coms, `/handoff`, peer-as-subagent — plus, inside a [herdr](https://herdr.dev) pane, fleet tools (`herdr_spawn_peer` / `herdr_read_pane` / `herdr_close_pane` with human confirmation / `herdr_notify`) | `just hub` |
90
+ | [agent-hub](../.pi/harnesses/agent-hub/README.md) | Orchestration | Supported multi-agent hub: damage-control guardrails by default via `just hub`, dispatcher grid, specialist delegation, research helpers, persona gate, embedded coms, `/handoff`, peer-as-subagent, and footer `v<version> · <model><thinking> · <team>` — plus, inside a [herdr](https://herdr.dev) pane, fleet tools (`herdr_spawn_peer` / `herdr_read_pane` / `herdr_close_pane` with human confirmation / `herdr_notify`) | `just hub` |
91
91
  | [ask-user-remote](../.pi/harnesses/ask-user-remote/README.md) | Orchestration | Captures stock `pi-ask-user` and registers the default `ask_user`; with `user-remote` live it races local UI against the Hermes bridge, otherwise it is stock local behavior | loaded by `just hub` / `hub-solo` |
92
- | [damage-control](../.pi/harnesses/damage-control/README.md) | Safety | Blocks destructive tool calls and aborts the turn; loaded into spawned specialists by `agent-hub`; honors pre-granted exemptions from the hub's shared exemptions file | `just ext-damage-control` |
93
- | [damage-control-continue](../.pi/harnesses/damage-control-continue/README.md) | Safety | Same rules, but blocks deliver feedback so the agent adapts and keeps working (no abort); default guardrail for the `just hub` main session + research helpers. Supports path exemptions: `/allow`/`/allowed`/`/revoke`, a block-time approval dialog, and escalation from headless children to the hub dispatcher | `just ext-damage-control-continue` |
92
+ | [damage-control-continue](../.pi/harnesses/damage-control-continue/README.md) | Safety | Only supported safety harness; guards the hub plus every native specialist, researcher, and delegate. Blocks feed back without aborting the turn; protected paths support explicit approval, while dangerous command patterns remain non-exemptible | `just ext-damage-control-continue` |
94
93
  | [coms](../.pi/harnesses/coms/README.md) | Messaging | Peer-to-peer messaging between pi agents on one machine; launches damage-control-continue-guarded under a chosen name | `just safe-coms <name>` |
94
+ | [Hermes local monitor transport](../hermes/README.md#local-agent-hub-monitor-integration) | Optional local companion | Owner-only discovery + Unix socket for agent-hub snapshots, cursor output, and exact-generation cancellation; consumed by a separate local Hermes client | Set the two monitor environment variables, then run `just hub-team <team>` |
95
95
 
96
96
  Each extension directory has its own `README.md` with the full description, command/tool
97
97
  surface, requirements, and per-extension upstream changes.
98
98
 
99
+ ### Migration: retired hard-stop harness
100
+
101
+ The former `.pi/harnesses/damage-control/` hard-stop harness and `just ext-damage-control`
102
+ recipe are retired. Refresh pi harnesses with guided setup: it removes only an unchanged,
103
+ setup-recorded copy (or an agent-fleet source symlink), preserves user-modified/unowned copies,
104
+ and refreshes the managed `justfile` region. Use `damage-control-continue` for standalone and
105
+ Agent Hub safety; missing child safety now fails closed instead of falling back or spawning
106
+ unguarded.
107
+
108
+ ### Harness version footer and provenance
109
+
110
+ The three persistent-UI harnesses — `agent-hub`, `coms`, and
111
+ `damage-control-continue` — each register `v<version>` on one shared status key. In pi's
112
+ default status footer, that shared key gives a supported stack exactly one version instead of one
113
+ copy per harness. `agent-hub` replaces the default footer: it does **not** consume that status
114
+ key. Its custom footer reads its own adjacent stamped manifest and renders one local version
115
+ first — `v<version> · <model><thinking> · <team>` — so an agent-hub stack also displays the
116
+ version exactly once.
117
+
118
+ The shared version status is independent of mutable owner status: for example, a
119
+ Damage-Control violation can replace its own safety message without overwriting the version
120
+ entry. The canonical value is the root `package.json` version. During a release,
121
+ `bin/sync-harness-versions.js` stamps that value into each adjacent persistent-harness
122
+ `package.json` after the root bump and before lockfile finalization and snapshotting. Each
123
+ harness keeps a local `version.ts` provenance reader so copied or symlinked harness directories
124
+ resolve their adjacent stamp rather than the launch directory. That local provenance does not
125
+ make a harness self-contained: copied target harnesses still require the existing full
126
+ `.pi/harnesses/` dependency installation described in [Setup](#setup).
127
+
99
128
  ### `agent-hub` components
100
129
 
101
130
  `agent-hub` is the consolidated orchestration harness. It replaces the retired standalone
@@ -123,18 +152,24 @@ harnesses:
123
152
  `damage-control-continue` safety harness and `ask-user-remote` before `agent-hub`, so the
124
153
  dispatcher's tool calls are checked against the rules file and the `askUserAvailable` probe sees
125
154
  `ask_user`. A blocked call feeds back and the turn keeps going rather than aborting. `agent-hub` also
126
- re-loads a guardrail into every spawned subagent (via an explicit `-e` that survives their
127
- `--no-extensions`): research helpers (`researcher` / `deep-researcher`) get the same continue
128
- variant, while other specialists (builder, test-engineer, …) get the hard-stop `damage-control`
129
- that aborts on a violation. Protected-path access can be granted at runtime: `/allow <pattern>
130
- [turn|session]` in the hub pre-authorizes (session grants reach every spawned child via a shared
131
- session-scoped exemptions file), a block in the hub's own session opens an approval dialog, and a
132
- block inside a headless child escalates an `access_request` to the hub's coms socket so the user
133
- decides — deny / once / this agent / all agents. Destructive bash patterns are never exemptible.
155
+ re-loads `damage-control-continue` into every native specialist, research helper, and nested
156
+ delegate (via an explicit `-e` that survives `--no-extensions`). Protected-path access can be
157
+ granted at runtime: `/allow <pattern> [turn|session]` in the hub pre-authorizes, a parent-session
158
+ block opens an approval dialog, and a headless child escalates to the hub. Protected deletion
159
+ offers only deny/once; other protected paths may be scoped to an agent or session. Denial and
160
+ timeout fail closed without aborting the child turn. Destructive bash patterns are never exemptible,
161
+ and a missing continue harness refuses child dispatch.
134
162
  - **Embedded coms** — peer discovery, `coms_list` / `coms_send` / `coms_get` / `coms_await`,
135
163
  `/handoff`, and peer-as-subagent flows.
136
164
  - **Solo mode** — `just hub-solo` keeps the dispatcher grid, delegation, research helpers, persona
137
165
  gate, and controls, but starts without the embedded coms layer.
166
+ - **Optional Hermes local monitor transport** — uses `AGENT_FLEET_PROFILE_ID`, the absolute
167
+ `AGENT_FLEET_MONITOR_RUNTIME_DIR`, and the Herdr `HERDR_WORKSPACE_ID` and `HERDR_PANE_ID`
168
+ required to establish its stable hub identity. It is a source-owned, local-only transport—not a
169
+ Hermes SDK task/lifecycle RPC or a bundled plugin—and fails closed without validated owner-only
170
+ discovery, lease, token, and socket state. Follow the
171
+ [Hermes integration guide](../hermes/README.md#local-agent-hub-monitor-integration) for startup,
172
+ wire examples, cancellation semantics, and reconnect behavior.
138
173
 
139
174
  ---
140
175
 
@@ -209,7 +244,7 @@ These ported files are runtime dependencies of the extensions above:
209
244
  extensions load into the peer process. The `web-debugger` peer uses this to get
210
245
  `chrome-devtools-mcp`'s `chrome_devtools__*` tools (see the two-browser-stacks section above).
211
246
  - **`.pi/damage-control-rules.yaml`** — the destructive-command / protected-path rule set
212
- for `damage-control`.
247
+ for `damage-control-continue`.
213
248
  - **`.pi/skills/bowser/`** — a pi-runtime skill for headless Playwright browser
214
249
  automation, used by the `bowser` agent persona. Kept separate from the core
215
250
  engineering `skills/`. It drives the external **Playwright Agent CLI**
package/docs/pi-setup.md CHANGED
@@ -177,13 +177,13 @@ Verify by starting `pi` and running `/chrome_devtools-status` — expect `Chrome
177
177
 
178
178
  #### Extension harnesses — orchestration, safety, messaging
179
179
 
180
- This repo ships **4 supported session harnesses** ported or consolidated from [disler](https://github.com/disler)'s [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) project (MIT):
180
+ This repo ships **3 supported session harnesses** ported or consolidated from [disler](https://github.com/disler)'s [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) project (MIT):
181
181
 
182
182
  - **Orchestration** — `agent-hub` (dispatcher grid, specialist delegation, research helpers, persona gate, embedded coms)
183
- - **Safety** — `damage-control` (hard-stop), `damage-control-continue` (blocks but feeds back so the agent keeps going)
183
+ - **Safety** — `damage-control-continue` (fail-closed blocks feed back so the agent can report or safely adapt)
184
184
  - **Pi-to-Pi messaging** — `coms` (launched guarded via `just safe-coms <name>`, and embedded in `agent-hub`)
185
185
 
186
- Unlike the utilities above, each harness reshapes the entire pi session, and most are loaded one per session rather than all at once. The supported stack is a damage-control variant before `agent-hub`, which the `just hub` recipes use by default — `damage-control-continue` for the main session, with the hub re-loading hard-stop `damage-control` into spawned specialists and `damage-control-continue` into research helpers. pi auto-discovers and loads *everything* under `.pi/extensions/`, so the harnesses deliberately live in a separate directory — **`.pi/harnesses/`** — which pi does *not* auto-discover. **Never copy or symlink a harness into `.pi/extensions/`**: that would load it on every plain `pi` run, and stacking all harnesses aborts startup (harnesses that register the same CLI flags clash). Load a harness recipe explicitly instead — there is nothing to symlink:
186
+ Unlike the utilities above, each harness reshapes the entire pi session, and most are loaded one per session rather than all at once. The supported stack loads `damage-control-continue` and `ask-user-remote` before `agent-hub`; the hub then re-loads continue into every native specialist, research helper, and nested delegate. Protected-path blocks can escalate for explicit approval, while dangerous command patterns remain non-exemptible. Missing child safety refuses dispatch. pi auto-discovers and loads *everything* under `.pi/extensions/`, so the harnesses deliberately live in a separate directory — **`.pi/harnesses/`** — which pi does *not* auto-discover. **Never copy or symlink a harness into `.pi/extensions/`**: that would load it on every plain `pi` run, and stacking all harnesses aborts startup (harnesses that register the same CLI flags clash). Load a harness recipe explicitly instead — there is nothing to symlink:
187
187
 
188
188
  ```bash
189
189
  # from the agent-fleet clone, via the bundled justfile
@@ -191,9 +191,15 @@ just --list # list every harness recipe
191
191
  just hub # launch the guarded consolidated multi-agent hub
192
192
 
193
193
  # or directly, from anywhere — point pi -e at the guarded harness stack
194
- pi -e /path/to/agent-fleet/.pi/harnesses/damage-control-continue/index.ts -e /path/to/agent-fleet/.pi/harnesses/agent-hub/index.ts
194
+ pi -e /path/to/agent-fleet/.pi/harnesses/damage-control-continue/index.ts -e /path/to/agent-fleet/.pi/harnesses/ask-user-remote/index.ts -e /path/to/agent-fleet/.pi/harnesses/agent-hub/index.ts
195
195
  ```
196
196
 
197
+ **Upgrading from the retired hard-stop harness:** `.pi/harnesses/damage-control/` and
198
+ `just ext-damage-control` are no longer shipped. Re-run guided setup to remove only an
199
+ unchanged setup-owned copy (or source symlink) and refresh the managed `justfile` region;
200
+ user-modified and unowned copies are preserved. Use `just ext-damage-control-continue` for
201
+ a standalone safety session.
202
+
197
203
  The harnesses have their own runtime dependencies (`yaml`, `@sinclair/typebox`) declared in `.pi/harnesses/package.json` — separate from the extension deps above. Install both at once with `just install` from the clone, or run `npm ci` in `.pi/harnesses/` as well. The [pi extension catalog](pi-extensions.md) has the full list, per-extension `README.md` pointers, required environment variables (for `chrome-devtools-mcp`), and what changed from upstream.
198
204
 
199
205
  Each extension — utility or harness — has its own `README.md` describing what it provides.
package/hermes/README.md CHANGED
@@ -25,6 +25,186 @@ cp -R hermes/skills/hub-conductor ~/.hermes/<profile>/skills/
25
25
 
26
26
  Use `hub-liaison` in the gateway-owning Telegram profile and `hub-conductor` in the human's dev/conductor profile. Verify availability with your normal Hermes skill listing command before relying on them.
27
27
 
28
+ ## Local agent-hub monitor integration
29
+
30
+ Agent Fleet exposes an optional **local monitor transport** for Hermes-facing tools. This is
31
+ separate from the Telegram/coms bridge:
32
+
33
+ - `hub-liaison` and `hub-conductor` handle human questions and delegation through coms.
34
+ - The monitor transport exposes dispatcher and specialist state through owner-only discovery,
35
+ a token file, and a Unix domain socket (UDS).
36
+
37
+ The repository does **not** ship or install a Hermes backend or Desktop plugin. A Hermes UI,
38
+ operator tool, or other local client may consume the transport contract described below, but it
39
+ owns its own presentation and lifecycle. The hub remains the source of truth for task state,
40
+ output cursors, leases, and generation-safe cancellation.
41
+
42
+ ### Integration in action
43
+
44
+ The hub can surface an `ask_user` decision in Hermes Desktop while the specialist workflow keeps
45
+ running. The prompt preserves the question and its choices instead of flattening them into an
46
+ unstructured message:
47
+
48
+ ![Hermes Desktop displaying a multiple-choice question piped from agent-hub](../docs/assets/hermes-question-in-desktop.png)
49
+
50
+ The side-by-side view shows the same live question in the Pi hub and Hermes Desktop. This is the
51
+ question-piping path used for remote human input; task monitoring remains the separate local
52
+ transport described below.
53
+
54
+ ![Pi agent-hub and Hermes Desktop showing the same piped question side by side](../docs/assets/hermes-pi-question-piping.png)
55
+
56
+ ### Start a monitored hub
57
+
58
+ Choose a stable Hermes profile ID and an absolute, owner-only runtime directory. A Herdr-backed
59
+ hub is required because the stable hub identity includes `HERDR_WORKSPACE_ID` and
60
+ `HERDR_PANE_ID`; the normal `hub-team` recipe supplies the Herdr environment.
61
+
62
+ ```bash
63
+ monitor_runtime="${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR must be set}/agent-fleet-monitor"
64
+ install -d -m 700 "$monitor_runtime"
65
+
66
+ export AGENT_FLEET_PROFILE_ID="dev"
67
+ export AGENT_FLEET_MONITOR_RUNTIME_DIR="$monitor_runtime"
68
+
69
+ just hub-team default
70
+ ```
71
+
72
+ If either monitor variable is missing or invalid, or if the hub lacks stable Herdr identity, the
73
+ monitor stays disabled while normal agent-hub orchestration continues. The profile ID must start
74
+ with an alphanumeric character and may contain only alphanumerics, `.`, `_`, or `-`; `..` is
75
+ rejected.
76
+
77
+ ### Discover the local endpoint
78
+
79
+ The hub creates mode `0700` namespaces under the runtime root. Each active registration contains
80
+ one mode `0600` discovery file and token file, plus a mode `0600` socket:
81
+
82
+ ```text
83
+ <runtime>/<profile-sha256>/<hub-sha256>/discovery-<owner-id>.json
84
+ <runtime>/<profile-sha256>/<hub-sha256>/token-<owner-id>
85
+ <runtime>/s/<registration-sha256>/s
86
+ ```
87
+
88
+ You can list discovery paths without reading or printing their tokens:
89
+
90
+ ```bash
91
+ find "$AGENT_FLEET_MONITOR_RUNTIME_DIR" -type f -name 'discovery-*.json' -print
92
+ ```
93
+
94
+ A discovery record has this shape:
95
+
96
+ ```json
97
+ {
98
+ "owner": "9db4478e-ef6e-4d5d-930b-6d637f5de4d1",
99
+ "socket": "@runtime/s/0123456789abcdef0123456789abcdef/s",
100
+ "token": "token-9db4478e-ef6e-4d5d-930b-6d637f5de4d1",
101
+ "lease": {
102
+ "hub": "<stable-hub-id>",
103
+ "pid": 12345,
104
+ "startedAt": "2026-07-21T09:00:00.000Z",
105
+ "expiresAt": "2026-07-21T09:00:30.000Z"
106
+ }
107
+ }
108
+ ```
109
+
110
+ A consumer must reject expired or malformed discovery, paths outside the configured runtime root,
111
+ symlinks, unsafe modes, and socket/token names that do not match the discovery schema. It should
112
+ re-discover after reconnect instead of caching a token or absolute socket path. Never put the token
113
+ in a URL, log, Desktop storage, or command-line argument.
114
+
115
+ ### Request snapshot, output, and cancellation
116
+
117
+ The UDS protocol is newline-delimited JSON with one request per connection. Read the token from the
118
+ discovery record's sibling token file, use it only in memory, and terminate every request with
119
+ `\n`.
120
+
121
+ ```js
122
+ import net from "node:net";
123
+
124
+ export function monitorRequest(socketPath, request) {
125
+ return new Promise((resolve, reject) => {
126
+ const client = net.createConnection(socketPath);
127
+ let body = "";
128
+ client.setTimeout(1_000, () => client.destroy(new Error("monitor timeout")));
129
+ client.on("connect", () => client.end(`${JSON.stringify(request)}\n`));
130
+ client.on("data", chunk => { body += chunk; });
131
+ client.on("error", reject);
132
+ client.on("close", () => resolve(body ? JSON.parse(body) : null));
133
+ });
134
+ }
135
+
136
+ // `token` and `socketPath` were resolved and validated from live discovery.
137
+ const current = await monitorRequest(socketPath, { type: "snapshot", token });
138
+ const delta = await monitorRequest(socketPath, {
139
+ type: "output",
140
+ token,
141
+ taskId: "builder:1",
142
+ generation: 1,
143
+ afterSequence: 0
144
+ });
145
+ ```
146
+
147
+ Example snapshot response:
148
+
149
+ ```json
150
+ {
151
+ "ok": true,
152
+ "snapshot": {
153
+ "tasks": [
154
+ {
155
+ "id": "builder:1",
156
+ "generation": 1,
157
+ "kind": "child",
158
+ "state": "running",
159
+ "outputLatestSequence": 4
160
+ }
161
+ ]
162
+ }
163
+ }
164
+ ```
165
+
166
+ Continue incremental output from the returned sequence to avoid duplicates:
167
+
168
+ ```js
169
+ const next = await monitorRequest(socketPath, {
170
+ type: "output",
171
+ token,
172
+ taskId: "builder:1",
173
+ generation: 1,
174
+ afterSequence: delta.output.sequence
175
+ });
176
+ ```
177
+
178
+ Cancellation is an explicit operator action and must use the exact displayed task ID and
179
+ generation:
180
+
181
+ ```js
182
+ const cancelled = await monitorRequest(socketPath, {
183
+ type: "cancel",
184
+ token,
185
+ taskId: "builder:1",
186
+ generation: 1
187
+ });
188
+ ```
189
+
190
+ A native specialist cancellation targets only the hub-owned process generation and validates its
191
+ process identity before signalling it. Cancelling a coms-backed run abandons the hub's local wait;
192
+ the remote peer may continue. Neither operation creates, focuses, closes, or otherwise controls a
193
+ Herdr pane or workspace.
194
+
195
+ ### Failure and reconnect behavior
196
+
197
+ - `{"ok":false,"error":"unauthorized"}` means the token does not match current ownership.
198
+ - `monitor_unavailable` means the hub-side snapshot/output/cancel handler failed closed.
199
+ - `response_too_large` means the consumer must fall back to a fresh bounded snapshot or cursor.
200
+ - An empty response indicates malformed or out-of-contract input; do not retry it unchanged.
201
+ - When the lease expires, the socket closes, or ownership changes, discard the token and repeat
202
+ discovery. Never fall back to public TCP, a gateway endpoint, or Herdr pane control.
203
+
204
+ Stopping the hub removes its owned discovery, token, and socket. Historical monitor journals under
205
+ the configured runtime root are separate from this live registration and should be removed only by
206
+ an operator who has identified the exact profile/runtime scope.
207
+
28
208
  ## Usage notes
29
209
 
30
210
  For `hub-liaison`, ensure the Telegram-capable profile has terminal/file-write tools enabled so it can create exactly `~/.pi/coms/hermes-bridge/questions/<qid>.answer.json` and nothing outside that questions directory.
@@ -0,0 +1,19 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ // Self-contained dashboard bundle: Hermes loads this file without relative-module resolution.
3
+ const present=value=>{if(value?.error)return{kind:'error',message:value.error};if(value?.loading)return{kind:'loading'};return value?.tasks?.length?{kind:'tasks',tasks:value.tasks}:{kind:'empty'};};
4
+
5
+ const bounded=(text='')=>String(text).slice(-8192);
6
+ function hierarchy(tasks){const roots=[], parents=new Map();for(const task of tasks){if(task.kind==='parent'){const row={...task,children:[]};parents.set(`${task.hubInstanceId}:${task.id}:${task.generation}`,row);roots.push(row)}}for(const task of tasks.filter(t=>t.kind!=='parent')){const parent=parents.get(`${task.hubInstanceId}:${task.parentId}:${task.parentGeneration}`);if(parent)parent.children.push(task);else roots.push({...task,children:[]})}return roots}
7
+ function Pane({ctx}) {
8
+ const [value,setValue]=useState({loading:true});
9
+ useEffect(()=>{const documentRef=globalThis.document;let live=true, visible=!!documentRef&&documentRef.visibilityState!=='hidden', timer=null, inFlight=false, epoch=0;const cursors=new Map();
10
+ const output=async(row,cursor,pollEpoch)=>{const result=await ctx.rest(`/output?task_id=${encodeURIComponent(row.id)}&generation=${encodeURIComponent(row.generation)}&after_sequence=${encodeURIComponent(cursor)}${row.hubInstanceId?`&hub_instance_id=${encodeURIComponent(row.hubInstanceId)}`:''}`);if(!live||!visible||pollEpoch!==epoch)return; cursors.set(`${row.hubInstanceId}:${row.id}:${row.generation}`,result.sequence??cursor);setValue(old=>({tasks:(old.tasks??[]).map(t=>t.hubInstanceId===row.hubInstanceId&&t.id===row.id&&t.generation===row.generation?{...t,output:bounded(`${t.output??''}${result.text??''}`),outputSequence:result.sequence??t.outputSequence,outputFirstSequence:result.firstSequence,truncated:!!result.truncated}:t)}));};
11
+ const poll=async()=>{if(!visible||inFlight)return;inFlight=true;const pollEpoch=++epoch;try{const snapshot=await ctx.rest('/snapshot');if(!live||!visible||pollEpoch!==epoch)return;const tasks=snapshot.tasks??[];setValue(old=>{const cached=new Map((old.tasks??[]).map(t=>[`${t.hubInstanceId}:${t.id}:${t.generation}`,t]));return{tasks:tasks.map(t=>{const prior=cached.get(`${t.hubInstanceId}:${t.id}:${t.generation}`);return prior&&prior.outputSequence===t.outputSequence?{...t,output:prior.output,outputFirstSequence:prior.outputFirstSequence}:t;})}});for(const row of tasks){const key=`${row.id}:${row.generation}`,cursor=cursors.get(`${row.hubInstanceId}:${key}`)??0;if((row.outputSequence??0)>cursor)await output(row,cursor,pollEpoch)}}catch(error){live&&visible&&setValue({error:String(error)})}finally{inFlight=false}};
12
+ const start=()=>{if(!timer)timer=setInterval(()=>void poll(),1000)}; const change=()=>{visible=documentRef?.visibilityState==='visible';epoch++;if(visible)start();else if(timer){clearInterval(timer);timer=null}};if(visible)start();void poll();documentRef?.addEventListener('visibilitychange',change);return()=>{live=false;if(timer)clearInterval(timer);documentRef?.removeEventListener('visibilitychange',change)};
13
+ },[ctx]);
14
+ const view=present(value);if(view.kind!=='tasks')return React.createElement('div',{role:view.kind==='error'?'alert':'status'},view.message??view.kind);
15
+ const cancel=(task)=>ctx.rest(`/cancel?task_id=${encodeURIComponent(task.id)}&generation=${encodeURIComponent(task.generation)}${task.hubInstanceId?`&hub_instance_id=${encodeURIComponent(task.hubInstanceId)}`:''}`,{method:'POST'});
16
+ const row=(task)=>React.createElement('li',{role:'treeitem',key:`${task.hubInstanceId}:${task.id}:${task.generation}`},`${task.id} · ${task.generation??''} · ${task.state}${task.state==='recovering'?' · Recovering connection':task.state==='orphaned'?' · Task orphaned':''} ${task.output??''}${task.truncated?' [output truncated]':''}`,task.canCancel&&task.state!=='orphaned'?React.createElement('button',{'aria-label':`Cancel ${task.id} generation ${task.generation}`,onClick:()=>cancel(task),onKeyDown:e=>{if(e.key==='Enter'||e.key===' '){e.preventDefault();cancel(task)}}},'Cancel'):null,task.children?.length?React.createElement('ul',{role:'group'},...task.children.map(row)):null);
17
+ return React.createElement('ul',{role:'tree','aria-label':'Agent Fleet tasks'},...hierarchy(view.tasks).map(row));
18
+ }
19
+ export default {id:'agent-fleet-monitor',register(ctx){ctx.register({id:'pane',area:'panes',title:'Agent Fleet Monitor',render:()=>React.createElement(Pane,{ctx})})}};
@@ -0,0 +1,10 @@
1
+ export function present(value) { if (value.error) return { kind: 'error', message: value.error }; if (value.loading) return { kind: 'loading' }; if (!value.tasks?.length) return { kind: 'empty' }; return { kind: 'tasks', tasks: value.tasks }; }
2
+
3
+ // The controller owns the cursor map: output is requested only for bytes newer
4
+ // than the cursor advertised by the same snapshot task generation.
5
+ export function createActiveViewController({ pollMetadata, fetchOutput, onOutput = () => {} }) {
6
+ const cursors=new Map(); let timer=null, visible=false, inFlight=null, epoch=0;
7
+ const poll=()=>{if(!visible||inFlight)return inFlight;const requestEpoch=epoch;const request=(async()=>{const result=await pollMetadata();if(!visible||requestEpoch!==epoch)return;const rows=Array.isArray(result)?result:(result.tasks??[]);for(const row of rows){const key=`${row.hubInstanceId}:${row.id}:${row.generation}`,cursor=cursors.get(key)??0;if((row.outputSequence??0)>cursor){const output=await fetchOutput(row.hubInstanceId,row.id,row.generation,cursor);if(!visible||requestEpoch!==epoch)return;cursors.set(key,output.sequence??cursor);onOutput(row,output);}}})().finally(()=>{if(inFlight===request)inFlight=null;});inFlight=request;return request;};
8
+ return { poll, setVisible(next){if(!next){visible=false;epoch++;if(timer){clearInterval(timer);timer=null}return;}visible=true;if(!timer)timer=setInterval(()=>void poll(),1000);}, dispose(){visible=false;epoch++;if(timer)clearInterval(timer);timer=null} };
9
+ }
10
+ export function aggregateTaskHierarchy(tasks){const parents=tasks.filter(t=>t.kind==='parent').map(parent=>({id:parent.id,state:parent.state,children:[]}));const byId=new Map(tasks.filter(t=>t.kind==='parent').map((parent,i)=>[`${parent.hubInstanceId}:${parent.id}:${parent.generation}`,parents[i]]));for(const child of tasks.filter(t=>t.kind!=='parent')){const item={id:child.id,generation:child.generation,state:child.state};const parent=byId.get(`${child.hubInstanceId}:${child.parentId}:${child.parentGeneration}`);if(parent)parent.children.push(item);else parents.push({...item,children:[]});}return parents;}
@@ -0,0 +1,15 @@
1
+ import json,socket,tempfile,threading,unittest
2
+ from pathlib import Path
3
+ from adapter import MonitorAdapter,MonitorUnavailable,MAX_SNAPSHOT_RESPONSE_BYTES
4
+ class CapTest(unittest.TestCase):
5
+ def request(self, frame):
6
+ with tempfile.TemporaryDirectory() as d:
7
+ p=str(Path(d)/'s');s=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM);s.bind(p);s.listen(1)
8
+ def serve(): c,_=s.accept();c.recv(4096);c.sendall(frame);c.close();s.close()
9
+ t=threading.Thread(target=serve);t.start()
10
+ try:return MonitorAdapter(p,'t')._request({'type':'snapshot'})
11
+ finally:t.join()
12
+ def test_cap_excludes_one_ndjson_delimiter(self):
13
+ base=json.dumps({'x':''},separators=(',',':')).encode();frame=json.dumps({'x':'a'*(MAX_SNAPSHOT_RESPONSE_BYTES-len(base))},separators=(',',':')).encode();self.assertEqual(len(frame),MAX_SNAPSHOT_RESPONSE_BYTES);self.assertIsInstance(self.request(frame+b'\n'),dict)
14
+ with self.assertRaises(MonitorUnavailable):self.request(frame+b'a\n')
15
+ if __name__=='__main__':unittest.main()
@@ -0,0 +1,19 @@
1
+ import json
2
+ import os
3
+ import tempfile
4
+ import unittest
5
+ from datetime import datetime, timedelta, timezone
6
+ from pathlib import Path
7
+ from adapter import MonitorAdapter
8
+
9
+ class AdapterDiscoveryTest(unittest.TestCase):
10
+ def test_discovers_local_socket_and_token_from_explicit_profile_runtime_environment(self):
11
+ with tempfile.TemporaryDirectory() as directory:
12
+ root=Path(directory)/"runtime"; root.mkdir(mode=0o700)
13
+ profile="a"*64; namespace=root/MonitorAdapter.canonical_profile_id(profile)/("b"*64); namespace.mkdir(parents=True, mode=0o700)
14
+ owner="00000000-0000-0000-0000-000000000000"; socket_id=__import__('hashlib').sha256(f"{MonitorAdapter.canonical_profile_id(profile)}:{__import__('hashlib').sha256(b'hub').hexdigest()}:{owner}".encode()).hexdigest()[:32]; token=namespace/f"token-{owner}"; token.write_text("secret"); os.chmod(token,0o600)
15
+ discovery=namespace/f"discovery-{owner}.json"; discovery.write_text(json.dumps({"owner":owner,"socket":f"@runtime/s/{socket_id}/s","token":f"token-{owner}","lease":{"hub":"hub","pid":1,"startedAt":"2020-01-01T00:00:00Z","expiresAt":(datetime.now(timezone.utc)+timedelta(minutes=1)).isoformat()}})); os.chmod(discovery,0o600)
16
+ adapter=MonitorAdapter.from_profile_environment({"AGENT_FLEET_PROFILE_ID":profile,"AGENT_FLEET_MONITOR_RUNTIME_DIR":str(root)})
17
+ self.assertEqual(adapter._socket_path,str(root/f"s/{socket_id}/s")); self.assertEqual(adapter._token,"secret")
18
+
19
+ if __name__ == "__main__": unittest.main()
@@ -0,0 +1,13 @@
1
+ import socket,tempfile,threading,unittest
2
+ from pathlib import Path
3
+ from adapter import MonitorAdapter,MonitorUnavailable
4
+ class EnvelopeTest(unittest.TestCase):
5
+ def test_rejects_non_object_json_envelope(self):
6
+ with tempfile.TemporaryDirectory() as d:
7
+ p=str(Path(d)/'s'); server=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM);server.bind(p);server.listen(1)
8
+ def serve():
9
+ c,_=server.accept();c.recv(4096);c.sendall(b'[]\n');c.close();server.close()
10
+ t=threading.Thread(target=serve);t.start()
11
+ with self.assertRaises(MonitorUnavailable): MonitorAdapter(p,'secret').snapshot()
12
+ t.join()
13
+ if __name__=='__main__':unittest.main()
@@ -0,0 +1,11 @@
1
+ import json,os,tempfile,unittest
2
+ from datetime import datetime,timedelta,timezone
3
+ from pathlib import Path
4
+ from adapter import MonitorAdapter,MonitorUnavailable
5
+ class ForgedOwnerTest(unittest.TestCase):
6
+ def test_forged_cross_owner_expired_record_is_not_cleaned(self):
7
+ with tempfile.TemporaryDirectory() as d:
8
+ root=Path(d)/'r';root.mkdir(mode=0o700);p='p';ns=root/MonitorAdapter.canonical_profile_id(p)/('a'*64);ns.mkdir(parents=True,mode=0o700);owner='00000000-0000-0000-0000-000000000000';f=ns/f'discovery-{owner}.json';f.write_text(json.dumps({'owner':owner,'token':'token-11111111-1111-1111-1111-111111111111','socket':'@runtime/s/'+'a'*32+'/s','lease':{'hub':'hub','pid':1,'startedAt':'2020-01-01T00:00:00Z','expiresAt':'2020-01-01T00:00:01Z'}}));os.chmod(f,0o600)
9
+ with self.assertRaises(MonitorUnavailable):MonitorAdapter.from_profile_environment({'AGENT_FLEET_PROFILE_ID':p,'AGENT_FLEET_MONITOR_RUNTIME_DIR':str(root)})
10
+ self.assertTrue(f.exists())
11
+ if __name__=='__main__':unittest.main()
@@ -0,0 +1,9 @@
1
+ import json,os,tempfile,unittest
2
+ from pathlib import Path
3
+ from adapter import MonitorAdapter,MonitorUnavailable
4
+ class LeaseListTest(unittest.TestCase):
5
+ def test_lease_list_is_unavailable(self):
6
+ with tempfile.TemporaryDirectory() as d:
7
+ root=Path(d)/'r';root.mkdir(mode=0o700); profile='p';ns=root/MonitorAdapter.canonical_profile_id(profile)/('a'*64);ns.mkdir(parents=True,mode=0o700);p=ns/'discovery-00000000-0000-0000-0000-000000000000.json';p.write_text(json.dumps({'lease':[]}));os.chmod(p,0o600)
8
+ with self.assertRaises(MonitorUnavailable):MonitorAdapter.from_profile_environment({'AGENT_FLEET_PROFILE_ID':profile,'AGENT_FLEET_MONITOR_RUNTIME_DIR':str(root)})
9
+ if __name__=='__main__':unittest.main()
@@ -0,0 +1,17 @@
1
+ import unittest
2
+ from adapter import FleetMonitorAdapter, MonitorUnavailable
3
+ class Hub:
4
+ def __init__(self,name,fail=False): self.name=name;self.fail=fail;self.calls=[]
5
+ def snapshot(self):
6
+ if self.fail: raise MonitorUnavailable('down')
7
+ return {'tasks':[{'id':'same','generation':1}]}
8
+ def output(self,*v): self.calls.append(('output',v));return {'text':self.name}
9
+ def cancel(self,*v): self.calls.append(('cancel',v));return {'cancelled':True}
10
+ class MultiHubTest(unittest.TestCase):
11
+ def test_colliding_ids_are_annotated_and_route_to_owner(self):
12
+ a,b=Hub('a'),Hub('b'); f=FleetMonitorAdapter([('a',a),('b',b)])
13
+ self.assertEqual({x['hubInstanceId'] for x in f.snapshot()['tasks']},{'a','b'})
14
+ self.assertEqual(f.output('same',1,0,'b'),{'text':'b'}); self.assertEqual(b.calls,[('output',('same',1,0))]);self.assertEqual(a.calls,[])
15
+ def test_failed_hub_does_not_drop_healthy_tasks(self):
16
+ result=FleetMonitorAdapter([('a',Hub('a')),('b',Hub('b',True))]).snapshot();self.assertEqual(len(result['tasks']),1);self.assertEqual(result['hubs'][0]['hubInstanceId'],'b')
17
+ if __name__=='__main__': unittest.main()
@@ -0,0 +1,34 @@
1
+ import json
2
+ import socket
3
+ import tempfile
4
+ import threading
5
+ import unittest
6
+ from pathlib import Path
7
+
8
+ from adapter import MonitorAdapter
9
+
10
+
11
+ class AdapterOutputTest(unittest.TestCase):
12
+ def test_maps_typed_output_route_to_authenticated_uds_cursor_request(self):
13
+ with tempfile.TemporaryDirectory() as directory:
14
+ socket_path = str(Path(directory) / "monitor.sock")
15
+ server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
16
+ server.bind(socket_path)
17
+ server.listen(1)
18
+
19
+ def serve():
20
+ client, _ = server.accept()
21
+ request = json.loads(client.recv(4096).decode())
22
+ self.assertEqual(request, {"type": "output", "token": "secret", "taskId": "task", "generation": 2, "afterSequence": 7})
23
+ client.sendall(b'{"ok":true,"output":{"text":"new","sequence":8,"firstSequence":8,"truncated":false}}\n')
24
+ client.close()
25
+ server.close()
26
+
27
+ thread = threading.Thread(target=serve)
28
+ thread.start()
29
+ self.assertEqual(MonitorAdapter(socket_path, "secret").output("task", 2, 7), {"text": "new", "sequence": 8, "firstSequence": 8, "truncated": False})
30
+ thread.join()
31
+
32
+
33
+ if __name__ == "__main__":
34
+ unittest.main()