@chankov/agent-fleet 1.0.0 → 1.0.2

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 (598) hide show
  1. package/.pi/agents/model-profiles.yaml +2 -2
  2. package/.pi/extensions/package-lock.json +77 -45
  3. package/.pi/harnesses/agent-hub/README.md +116 -16
  4. package/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
  5. package/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  6. package/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
  7. package/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  8. package/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  9. package/.pi/harnesses/agent-hub/hub-state-audit.js +73 -0
  10. package/.pi/harnesses/agent-hub/index.ts +1095 -465
  11. package/.pi/harnesses/agent-hub/package.json +1 -1
  12. package/.pi/harnesses/agent-hub/posture.ts +72 -17
  13. package/.pi/harnesses/agent-hub/run-budget.js +73 -13
  14. package/.pi/harnesses/agent-hub/spawn.ts +14 -2
  15. package/.pi/harnesses/ask-user-remote/index.ts +59 -4
  16. package/.pi/harnesses/coms/package.json +1 -1
  17. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  18. package/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
  19. package/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
  20. package/.pi/harnesses/lib/context-budget-view.ts +107 -0
  21. package/.pi/harnesses/lib/context-budget.ts +114 -0
  22. package/.pi/harnesses/lib/fleet-dashboard-ops.ts +37 -0
  23. package/.pi/harnesses/lib/fleet-detail-view.ts +92 -2
  24. package/.pi/harnesses/package-lock.json +73 -80
  25. package/.versions/1.0.1/.pi/agents/dispatch-policy.yaml +32 -0
  26. package/.versions/1.0.1/.pi/agents/model-profiles.yaml +27 -0
  27. package/.versions/1.0.1/.pi/agents/peers.yaml +142 -0
  28. package/.versions/1.0.1/.pi/agents/teams.yaml +41 -0
  29. package/.versions/1.0.1/.pi/damage-control-rules.yaml +297 -0
  30. package/.versions/1.0.1/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  31. package/.versions/1.0.1/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  32. package/.versions/1.0.1/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  33. package/.versions/1.0.1/.pi/extensions/btw/README.md +120 -0
  34. package/.versions/1.0.1/.pi/extensions/btw/index.ts +914 -0
  35. package/.versions/1.0.1/.pi/extensions/btw/package.json +6 -0
  36. package/.versions/1.0.1/.pi/extensions/btw/state.js +179 -0
  37. package/.versions/1.0.1/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  38. package/.versions/1.0.1/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  39. package/.versions/1.0.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  40. package/.versions/1.0.1/.pi/extensions/compact-and-continue/README.md +42 -0
  41. package/.versions/1.0.1/.pi/extensions/compact-and-continue/index.ts +120 -0
  42. package/.versions/1.0.1/.pi/extensions/compact-and-continue/package.json +6 -0
  43. package/.versions/1.0.1/.pi/extensions/mcp-bridge/README.md +46 -0
  44. package/.versions/1.0.1/.pi/extensions/mcp-bridge/index.ts +206 -0
  45. package/.versions/1.0.1/.pi/extensions/mcp-bridge/package.json +6 -0
  46. package/.versions/1.0.1/.pi/extensions/package-lock.json +1143 -0
  47. package/.versions/1.0.1/.pi/extensions/package.json +9 -0
  48. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/README.md +205 -0
  49. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/config.ts +198 -0
  50. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  51. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
  52. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/package.json +6 -0
  53. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  54. package/.versions/1.0.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  55. package/.versions/1.0.1/.pi/harnesses/agent-hub/README.md +1065 -0
  56. package/.versions/1.0.1/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  57. package/.versions/1.0.1/.pi/harnesses/agent-hub/artifacts.js +146 -0
  58. package/.versions/1.0.1/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  59. package/.versions/1.0.1/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  60. package/.versions/1.0.1/.pi/harnesses/agent-hub/context-window.js +106 -0
  61. package/.versions/1.0.1/.pi/harnesses/agent-hub/delegate.ts +435 -0
  62. package/.versions/1.0.1/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  63. package/.versions/1.0.1/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  64. package/.versions/1.0.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  65. package/.versions/1.0.1/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  66. package/.versions/1.0.1/.pi/harnesses/agent-hub/footer.ts +35 -0
  67. package/.versions/1.0.1/.pi/harnesses/agent-hub/helpers.ts +266 -0
  68. package/.versions/1.0.1/.pi/harnesses/agent-hub/hub-state-audit.js +55 -0
  69. package/.versions/1.0.1/.pi/harnesses/agent-hub/index.ts +9343 -0
  70. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  71. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  72. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  73. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  74. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  75. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  76. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  77. package/.versions/1.0.1/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  78. package/.versions/1.0.1/.pi/harnesses/agent-hub/package.json +7 -0
  79. package/.versions/1.0.1/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  80. package/.versions/1.0.1/.pi/harnesses/agent-hub/posture.ts +103 -0
  81. package/.versions/1.0.1/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  82. package/.versions/1.0.1/.pi/harnesses/agent-hub/research-retention.js +34 -0
  83. package/.versions/1.0.1/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  84. package/.versions/1.0.1/.pi/harnesses/agent-hub/return-contract.js +293 -0
  85. package/.versions/1.0.1/.pi/harnesses/agent-hub/return-extract.js +75 -0
  86. package/.versions/1.0.1/.pi/harnesses/agent-hub/review-findings.js +102 -0
  87. package/.versions/1.0.1/.pi/harnesses/agent-hub/run-budget.js +540 -0
  88. package/.versions/1.0.1/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  89. package/.versions/1.0.1/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  90. package/.versions/1.0.1/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  91. package/.versions/1.0.1/.pi/harnesses/agent-hub/session-health.js +110 -0
  92. package/.versions/1.0.1/.pi/harnesses/agent-hub/spawn.ts +354 -0
  93. package/.versions/1.0.1/.pi/harnesses/agent-hub/version.ts +42 -0
  94. package/.versions/1.0.1/.pi/harnesses/ask-user-remote/README.md +53 -0
  95. package/.versions/1.0.1/.pi/harnesses/ask-user-remote/index.ts +477 -0
  96. package/.versions/1.0.1/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  97. package/.versions/1.0.1/.pi/harnesses/coms/README.md +100 -0
  98. package/.versions/1.0.1/.pi/harnesses/coms/index.ts +1767 -0
  99. package/.versions/1.0.1/.pi/harnesses/coms/package.json +7 -0
  100. package/.versions/1.0.1/.pi/harnesses/coms/version.ts +42 -0
  101. package/.versions/1.0.1/.pi/harnesses/damage-control-continue/README.md +124 -0
  102. package/.versions/1.0.1/.pi/harnesses/damage-control-continue/index.ts +536 -0
  103. package/.versions/1.0.1/.pi/harnesses/damage-control-continue/package.json +7 -0
  104. package/.versions/1.0.1/.pi/harnesses/damage-control-continue/version.ts +42 -0
  105. package/.versions/1.0.1/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  106. package/.versions/1.0.1/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  107. package/.versions/1.0.1/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
  108. package/.versions/1.0.1/.pi/harnesses/lib/fleet-dashboard-view.ts +140 -0
  109. package/.versions/1.0.1/.pi/harnesses/lib/fleet-detail-view.ts +43 -0
  110. package/.versions/1.0.1/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  111. package/.versions/1.0.1/.pi/harnesses/lib/fleet-panel.ts +34 -0
  112. package/.versions/1.0.1/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  113. package/.versions/1.0.1/.pi/harnesses/lib/fleet-selection.ts +24 -0
  114. package/.versions/1.0.1/.pi/harnesses/lib/herdr-client.ts +472 -0
  115. package/.versions/1.0.1/.pi/harnesses/lib/herdr-presence.ts +399 -0
  116. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  117. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  118. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  119. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  120. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  121. package/.versions/1.0.1/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  122. package/.versions/1.0.1/.pi/harnesses/lib/spawned-peers.js +190 -0
  123. package/.versions/1.0.1/.pi/harnesses/package-lock.json +2046 -0
  124. package/.versions/1.0.1/.pi/harnesses/package.json +10 -0
  125. package/.versions/1.0.1/.pi/prompts/af-build.md +24 -0
  126. package/.versions/1.0.1/.pi/prompts/af-code-simplify.md +22 -0
  127. package/.versions/1.0.1/.pi/prompts/af-plan.md +16 -0
  128. package/.versions/1.0.1/.pi/prompts/af-review.md +16 -0
  129. package/.versions/1.0.1/.pi/prompts/af-set-hermes-telegram.md +15 -0
  130. package/.versions/1.0.1/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  131. package/.versions/1.0.1/.pi/prompts/af-ship.md +17 -0
  132. package/.versions/1.0.1/.pi/prompts/af-spec.md +15 -0
  133. package/.versions/1.0.1/.pi/prompts/af-test.md +19 -0
  134. package/.versions/1.0.1/.pi/skills/bowser/SKILL.md +145 -0
  135. package/.versions/1.0.1/.version +1 -0
  136. package/.versions/1.0.1/agents/architect.md +24 -0
  137. package/.versions/1.0.1/agents/bowser.md +27 -0
  138. package/.versions/1.0.1/agents/builder.md +54 -0
  139. package/.versions/1.0.1/agents/code-reviewer.md +208 -0
  140. package/.versions/1.0.1/agents/deep-researcher.md +32 -0
  141. package/.versions/1.0.1/agents/documenter.md +18 -0
  142. package/.versions/1.0.1/agents/orchestrator.md +72 -0
  143. package/.versions/1.0.1/agents/plan-reviewer.md +83 -0
  144. package/.versions/1.0.1/agents/planner.md +70 -0
  145. package/.versions/1.0.1/agents/releaser.md +24 -0
  146. package/.versions/1.0.1/agents/researcher.md +28 -0
  147. package/.versions/1.0.1/agents/security-auditor.md +167 -0
  148. package/.versions/1.0.1/agents/test-engineer.md +153 -0
  149. package/.versions/1.0.1/agents/web-debugger.md +43 -0
  150. package/.versions/1.0.1/agents/web-performance-auditor.md +193 -0
  151. package/.versions/1.0.1/bin/catalog/harness-runtime-closure.json +38 -0
  152. package/.versions/1.0.1/codex/CONDUCTOR.md +148 -0
  153. package/.versions/1.0.1/docs/ARCHITECTURE.md +337 -0
  154. package/.versions/1.0.1/docs/agent-fleet-setup.md +437 -0
  155. package/.versions/1.0.1/docs/claude-code-coms-bridge.md +128 -0
  156. package/.versions/1.0.1/docs/codex-remote-conductor.md +170 -0
  157. package/.versions/1.0.1/docs/coms-hermes-bridge.md +189 -0
  158. package/.versions/1.0.1/docs/getting-started.md +98 -0
  159. package/.versions/1.0.1/docs/npm-install.md +292 -0
  160. package/.versions/1.0.1/docs/pi-extensions.md +412 -0
  161. package/.versions/1.0.1/docs/pi-setup.md +74 -0
  162. package/.versions/1.0.1/docs/skill-anatomy.md +150 -0
  163. package/.versions/1.0.1/hermes/README.md +347 -0
  164. package/.versions/1.0.1/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  165. package/.versions/1.0.1/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  166. package/.versions/1.0.1/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  167. package/.versions/1.0.1/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  168. package/.versions/1.0.1/hermes/gates/gate-o-capability.md +8 -0
  169. package/.versions/1.0.1/hermes/gates/gate-o-validator-fixtures.json +1 -0
  170. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  171. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  172. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  173. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  174. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  175. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  176. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  177. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  178. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  179. package/.versions/1.0.1/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  180. package/.versions/1.0.1/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  181. package/.versions/1.0.1/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  182. package/.versions/1.0.1/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  183. package/.versions/1.0.1/hermes/skills/hub-conductor/SKILL.md +84 -0
  184. package/.versions/1.0.1/hermes/skills/hub-liaison/SKILL.md +84 -0
  185. package/.versions/1.0.1/hermes/skills/hub-watchdog/SKILL.md +76 -0
  186. package/.versions/1.0.1/hermes/skills/hub-watchdog/manifest.json +1 -0
  187. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  188. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  189. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  190. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  191. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  192. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  193. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  194. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  195. package/.versions/1.0.1/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  196. package/.versions/1.0.1/hermes/watchdog-tests/__init__.py +0 -0
  197. package/.versions/1.0.1/hooks/coms-stop-hook.mjs +84 -0
  198. package/.versions/1.0.1/install-manifest.json +2745 -0
  199. package/.versions/1.0.1/justfile +272 -0
  200. package/.versions/1.0.1/manifest-meta.json +882 -0
  201. package/.versions/1.0.1/references/accessibility-checklist.md +160 -0
  202. package/.versions/1.0.1/references/definition-of-done.md +67 -0
  203. package/.versions/1.0.1/references/fleet-coordination-patterns.md +151 -0
  204. package/.versions/1.0.1/references/observability-checklist.md +91 -0
  205. package/.versions/1.0.1/references/orchestration-patterns.md +370 -0
  206. package/.versions/1.0.1/references/performance-checklist.md +153 -0
  207. package/.versions/1.0.1/references/prompting-patterns.md +380 -0
  208. package/.versions/1.0.1/references/security-checklist.md +179 -0
  209. package/.versions/1.0.1/references/testing-patterns.md +236 -0
  210. package/.versions/1.0.1/scripts/codex-conductor.ts +41 -0
  211. package/.versions/1.0.1/scripts/codex-remote-control.ts +167 -0
  212. package/.versions/1.0.1/scripts/coms-claude-bridge.ts +411 -0
  213. package/.versions/1.0.1/scripts/coms-cli.ts +484 -0
  214. package/.versions/1.0.1/scripts/coms-hermes-bridge.ts +413 -0
  215. package/.versions/1.0.1/scripts/fleet.ts +185 -0
  216. package/.versions/1.0.1/scripts/hermes-monitor-capability-runner.ts +25 -0
  217. package/.versions/1.0.1/scripts/hermes-monitor-scenario.ts +474 -0
  218. package/.versions/1.0.1/scripts/hermes-watchdog-capability-probe.ts +45 -0
  219. package/.versions/1.0.1/scripts/install-hermes-plugin.sh +180 -0
  220. package/.versions/1.0.1/scripts/lib/claude-bridge-core.ts +210 -0
  221. package/.versions/1.0.1/scripts/lib/codex-conductor.ts +88 -0
  222. package/.versions/1.0.1/scripts/lib/codex-remote-control.ts +480 -0
  223. package/.versions/1.0.1/scripts/lib/coms-envelope.ts +582 -0
  224. package/.versions/1.0.1/scripts/lib/fake-herdr-server.ts +88 -0
  225. package/.versions/1.0.1/scripts/lib/fleet-command.ts +266 -0
  226. package/.versions/1.0.1/scripts/lib/herdr-layout.ts +281 -0
  227. package/.versions/1.0.1/scripts/lib/hermes-bridge-core.ts +241 -0
  228. package/.versions/1.0.1/scripts/lib/hermes-monitor-events.ts +1 -0
  229. package/.versions/1.0.1/scripts/lib/hermes-monitor-herdr.ts +2 -0
  230. package/.versions/1.0.1/scripts/lib/hermes-monitor-model.ts +3 -0
  231. package/.versions/1.0.1/scripts/lib/hermes-monitor-registry.ts +2 -0
  232. package/.versions/1.0.1/scripts/lib/hermes-monitor-socket.ts +2 -0
  233. package/.versions/1.0.1/scripts/lib/hermes-monitor-store.ts +2 -0
  234. package/.versions/1.0.1/scripts/lib/monitor-env.ts +146 -0
  235. package/.versions/1.0.1/scripts/lib/peer-launch.ts +318 -0
  236. package/.versions/1.0.1/scripts/lib/persona-banner.ts +62 -0
  237. package/.versions/1.0.1/scripts/lib/spawn-stagger.ts +101 -0
  238. package/.versions/1.0.1/scripts/lib/team-project.ts +213 -0
  239. package/.versions/1.0.1/scripts/lib/team-snapshot.ts +147 -0
  240. package/.versions/1.0.1/scripts/peer-banner.ts +40 -0
  241. package/.versions/1.0.1/scripts/peer-launch.ts +259 -0
  242. package/.versions/1.0.1/scripts/team-snapshot.ts +237 -0
  243. package/.versions/1.0.1/scripts/team-up.ts +406 -0
  244. package/.versions/1.0.1/skills/_internal/grilling.md +11 -0
  245. package/.versions/1.0.1/skills/browser-testing-with-devtools/SKILL.md +351 -0
  246. package/.versions/1.0.1/skills/code-review-and-quality/SKILL.md +381 -0
  247. package/.versions/1.0.1/skills/compound-learning/SKILL.md +137 -0
  248. package/.versions/1.0.1/skills/context-engineering/SKILL.md +291 -0
  249. package/.versions/1.0.1/skills/deprecation-and-migration/SKILL.md +206 -0
  250. package/.versions/1.0.1/skills/designing-agents/SKILL.md +394 -0
  251. package/.versions/1.0.1/skills/designing-agents/pi-harness-authoring.md +222 -0
  252. package/.versions/1.0.1/skills/frontend-ui-engineering/SKILL.md +328 -0
  253. package/.versions/1.0.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
  254. package/.versions/1.0.1/skills/idea-refine/SKILL.md +182 -0
  255. package/.versions/1.0.1/skills/idea-refine/examples.md +238 -0
  256. package/.versions/1.0.1/skills/idea-refine/frameworks.md +99 -0
  257. package/.versions/1.0.1/skills/idea-refine/refinement-criteria.md +113 -0
  258. package/.versions/1.0.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
  259. package/.versions/1.0.1/skills/incremental-implementation/SKILL.md +287 -0
  260. package/.versions/1.0.1/skills/interview-me/SKILL.md +226 -0
  261. package/.versions/1.0.1/skills/orchestration-verification/SKILL.md +181 -0
  262. package/.versions/1.0.1/skills/peer-coms/SKILL.md +90 -0
  263. package/.versions/1.0.1/skills/performance-optimization/SKILL.md +350 -0
  264. package/.versions/1.0.1/skills/planning-and-task-breakdown/SKILL.md +254 -0
  265. package/.versions/1.0.1/skills/security-and-hardening/SKILL.md +461 -0
  266. package/.versions/1.0.1/skills/spec-driven-development/SKILL.md +257 -0
  267. package/.versions/1.0.1/skills/using-agent-skills/SKILL.md +199 -0
  268. package/.versions/1.0.1/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  269. package/.versions/1.0.1/vendor/agent-skills-upstream/LICENSE +21 -0
  270. package/.versions/1.0.1/vendor/agent-skills-upstream/README.md +11 -0
  271. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  272. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  273. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  274. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  275. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  276. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  277. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  278. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  279. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  280. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  281. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  282. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  283. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  284. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  285. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  286. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  287. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  288. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  289. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  290. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  291. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  292. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  293. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  294. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  295. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  296. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  297. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  298. package/.versions/1.0.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  299. package/.versions/1.0.2/.pi/agents/dispatch-policy.yaml +32 -0
  300. package/.versions/1.0.2/.pi/agents/model-profiles.yaml +27 -0
  301. package/.versions/1.0.2/.pi/agents/peers.yaml +142 -0
  302. package/.versions/1.0.2/.pi/agents/teams.yaml +41 -0
  303. package/.versions/1.0.2/.pi/damage-control-rules.yaml +297 -0
  304. package/.versions/1.0.2/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  305. package/.versions/1.0.2/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  306. package/.versions/1.0.2/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  307. package/.versions/1.0.2/.pi/extensions/btw/README.md +120 -0
  308. package/.versions/1.0.2/.pi/extensions/btw/index.ts +914 -0
  309. package/.versions/1.0.2/.pi/extensions/btw/package.json +6 -0
  310. package/.versions/1.0.2/.pi/extensions/btw/state.js +179 -0
  311. package/.versions/1.0.2/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  312. package/.versions/1.0.2/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  313. package/.versions/1.0.2/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  314. package/.versions/1.0.2/.pi/extensions/compact-and-continue/README.md +42 -0
  315. package/.versions/1.0.2/.pi/extensions/compact-and-continue/index.ts +120 -0
  316. package/.versions/1.0.2/.pi/extensions/compact-and-continue/package.json +6 -0
  317. package/.versions/1.0.2/.pi/extensions/mcp-bridge/README.md +46 -0
  318. package/.versions/1.0.2/.pi/extensions/mcp-bridge/index.ts +206 -0
  319. package/.versions/1.0.2/.pi/extensions/mcp-bridge/package.json +6 -0
  320. package/.versions/1.0.2/.pi/extensions/package-lock.json +1175 -0
  321. package/.versions/1.0.2/.pi/extensions/package.json +9 -0
  322. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/README.md +205 -0
  323. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/config.ts +198 -0
  324. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  325. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/index.ts +248 -0
  326. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/package.json +6 -0
  327. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  328. package/.versions/1.0.2/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  329. package/.versions/1.0.2/.pi/harnesses/agent-hub/README.md +1156 -0
  330. package/.versions/1.0.2/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  331. package/.versions/1.0.2/.pi/harnesses/agent-hub/artifacts.js +146 -0
  332. package/.versions/1.0.2/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  333. package/.versions/1.0.2/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  334. package/.versions/1.0.2/.pi/harnesses/agent-hub/budget-continuation.ts +73 -0
  335. package/.versions/1.0.2/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  336. package/.versions/1.0.2/.pi/harnesses/agent-hub/capability-packs.ts +180 -0
  337. package/.versions/1.0.2/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  338. package/.versions/1.0.2/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  339. package/.versions/1.0.2/.pi/harnesses/agent-hub/context-window.js +106 -0
  340. package/.versions/1.0.2/.pi/harnesses/agent-hub/delegate.ts +435 -0
  341. package/.versions/1.0.2/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  342. package/.versions/1.0.2/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  343. package/.versions/1.0.2/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  344. package/.versions/1.0.2/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  345. package/.versions/1.0.2/.pi/harnesses/agent-hub/footer.ts +35 -0
  346. package/.versions/1.0.2/.pi/harnesses/agent-hub/helpers.ts +266 -0
  347. package/.versions/1.0.2/.pi/harnesses/agent-hub/hub-state-audit.js +73 -0
  348. package/.versions/1.0.2/.pi/harnesses/agent-hub/index.ts +9909 -0
  349. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  350. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  351. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  352. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  353. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  354. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  355. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  356. package/.versions/1.0.2/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  357. package/.versions/1.0.2/.pi/harnesses/agent-hub/package.json +7 -0
  358. package/.versions/1.0.2/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  359. package/.versions/1.0.2/.pi/harnesses/agent-hub/posture.ts +158 -0
  360. package/.versions/1.0.2/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  361. package/.versions/1.0.2/.pi/harnesses/agent-hub/research-retention.js +34 -0
  362. package/.versions/1.0.2/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  363. package/.versions/1.0.2/.pi/harnesses/agent-hub/return-contract.js +293 -0
  364. package/.versions/1.0.2/.pi/harnesses/agent-hub/return-extract.js +75 -0
  365. package/.versions/1.0.2/.pi/harnesses/agent-hub/review-findings.js +102 -0
  366. package/.versions/1.0.2/.pi/harnesses/agent-hub/run-budget.js +539 -0
  367. package/.versions/1.0.2/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  368. package/.versions/1.0.2/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  369. package/.versions/1.0.2/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  370. package/.versions/1.0.2/.pi/harnesses/agent-hub/session-health.js +110 -0
  371. package/.versions/1.0.2/.pi/harnesses/agent-hub/spawn.ts +366 -0
  372. package/.versions/1.0.2/.pi/harnesses/agent-hub/version.ts +42 -0
  373. package/.versions/1.0.2/.pi/harnesses/ask-user-remote/README.md +53 -0
  374. package/.versions/1.0.2/.pi/harnesses/ask-user-remote/index.ts +532 -0
  375. package/.versions/1.0.2/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  376. package/.versions/1.0.2/.pi/harnesses/coms/README.md +100 -0
  377. package/.versions/1.0.2/.pi/harnesses/coms/index.ts +1767 -0
  378. package/.versions/1.0.2/.pi/harnesses/coms/package.json +7 -0
  379. package/.versions/1.0.2/.pi/harnesses/coms/version.ts +42 -0
  380. package/.versions/1.0.2/.pi/harnesses/damage-control-continue/README.md +124 -0
  381. package/.versions/1.0.2/.pi/harnesses/damage-control-continue/index.ts +536 -0
  382. package/.versions/1.0.2/.pi/harnesses/damage-control-continue/package.json +7 -0
  383. package/.versions/1.0.2/.pi/harnesses/damage-control-continue/version.ts +42 -0
  384. package/.versions/1.0.2/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  385. package/.versions/1.0.2/.pi/harnesses/lib/context-budget-child-prompt.ts +179 -0
  386. package/.versions/1.0.2/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
  387. package/.versions/1.0.2/.pi/harnesses/lib/context-budget-view.ts +107 -0
  388. package/.versions/1.0.2/.pi/harnesses/lib/context-budget.ts +114 -0
  389. package/.versions/1.0.2/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  390. package/.versions/1.0.2/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  391. package/.versions/1.0.2/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  392. package/.versions/1.0.2/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  393. package/.versions/1.0.2/.pi/harnesses/lib/fleet-dashboard-ops.ts +155 -0
  394. package/.versions/1.0.2/.pi/harnesses/lib/fleet-dashboard-view.ts +140 -0
  395. package/.versions/1.0.2/.pi/harnesses/lib/fleet-detail-view.ts +133 -0
  396. package/.versions/1.0.2/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  397. package/.versions/1.0.2/.pi/harnesses/lib/fleet-panel.ts +34 -0
  398. package/.versions/1.0.2/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  399. package/.versions/1.0.2/.pi/harnesses/lib/fleet-selection.ts +24 -0
  400. package/.versions/1.0.2/.pi/harnesses/lib/herdr-client.ts +472 -0
  401. package/.versions/1.0.2/.pi/harnesses/lib/herdr-presence.ts +399 -0
  402. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  403. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  404. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  405. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  406. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  407. package/.versions/1.0.2/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  408. package/.versions/1.0.2/.pi/harnesses/lib/spawned-peers.js +190 -0
  409. package/.versions/1.0.2/.pi/harnesses/package-lock.json +2039 -0
  410. package/.versions/1.0.2/.pi/harnesses/package.json +10 -0
  411. package/.versions/1.0.2/.pi/prompts/af-build.md +24 -0
  412. package/.versions/1.0.2/.pi/prompts/af-code-simplify.md +22 -0
  413. package/.versions/1.0.2/.pi/prompts/af-plan.md +16 -0
  414. package/.versions/1.0.2/.pi/prompts/af-review.md +16 -0
  415. package/.versions/1.0.2/.pi/prompts/af-set-hermes-telegram.md +15 -0
  416. package/.versions/1.0.2/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  417. package/.versions/1.0.2/.pi/prompts/af-ship.md +17 -0
  418. package/.versions/1.0.2/.pi/prompts/af-spec.md +15 -0
  419. package/.versions/1.0.2/.pi/prompts/af-test.md +19 -0
  420. package/.versions/1.0.2/.pi/skills/bowser/SKILL.md +145 -0
  421. package/.versions/1.0.2/.version +1 -0
  422. package/.versions/1.0.2/agents/architect.md +24 -0
  423. package/.versions/1.0.2/agents/bowser.md +27 -0
  424. package/.versions/1.0.2/agents/builder.md +54 -0
  425. package/.versions/1.0.2/agents/code-reviewer.md +208 -0
  426. package/.versions/1.0.2/agents/deep-researcher.md +32 -0
  427. package/.versions/1.0.2/agents/documenter.md +18 -0
  428. package/.versions/1.0.2/agents/orchestrator.md +20 -0
  429. package/.versions/1.0.2/agents/plan-reviewer.md +83 -0
  430. package/.versions/1.0.2/agents/planner.md +70 -0
  431. package/.versions/1.0.2/agents/releaser.md +24 -0
  432. package/.versions/1.0.2/agents/researcher.md +28 -0
  433. package/.versions/1.0.2/agents/security-auditor.md +167 -0
  434. package/.versions/1.0.2/agents/test-engineer.md +153 -0
  435. package/.versions/1.0.2/agents/web-debugger.md +43 -0
  436. package/.versions/1.0.2/agents/web-performance-auditor.md +193 -0
  437. package/.versions/1.0.2/bin/catalog/harness-runtime-closure.json +38 -0
  438. package/.versions/1.0.2/codex/CONDUCTOR.md +148 -0
  439. package/.versions/1.0.2/docs/ARCHITECTURE.md +369 -0
  440. package/.versions/1.0.2/docs/agent-fleet-setup.md +468 -0
  441. package/.versions/1.0.2/docs/claude-code-coms-bridge.md +128 -0
  442. package/.versions/1.0.2/docs/codex-remote-conductor.md +170 -0
  443. package/.versions/1.0.2/docs/coms-hermes-bridge.md +189 -0
  444. package/.versions/1.0.2/docs/getting-started.md +98 -0
  445. package/.versions/1.0.2/docs/npm-install.md +292 -0
  446. package/.versions/1.0.2/docs/pi-extensions.md +439 -0
  447. package/.versions/1.0.2/docs/pi-setup.md +74 -0
  448. package/.versions/1.0.2/docs/skill-anatomy.md +150 -0
  449. package/.versions/1.0.2/hermes/README.md +347 -0
  450. package/.versions/1.0.2/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  451. package/.versions/1.0.2/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  452. package/.versions/1.0.2/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  453. package/.versions/1.0.2/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  454. package/.versions/1.0.2/hermes/gates/gate-o-capability.md +8 -0
  455. package/.versions/1.0.2/hermes/gates/gate-o-validator-fixtures.json +1 -0
  456. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  457. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  458. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  459. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  460. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  461. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  462. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  463. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  464. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  465. package/.versions/1.0.2/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  466. package/.versions/1.0.2/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  467. package/.versions/1.0.2/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  468. package/.versions/1.0.2/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  469. package/.versions/1.0.2/hermes/skills/hub-conductor/SKILL.md +84 -0
  470. package/.versions/1.0.2/hermes/skills/hub-liaison/SKILL.md +84 -0
  471. package/.versions/1.0.2/hermes/skills/hub-watchdog/SKILL.md +76 -0
  472. package/.versions/1.0.2/hermes/skills/hub-watchdog/manifest.json +1 -0
  473. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  474. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  475. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  476. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  477. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  478. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  479. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  480. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  481. package/.versions/1.0.2/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  482. package/.versions/1.0.2/hermes/watchdog-tests/__init__.py +0 -0
  483. package/.versions/1.0.2/hooks/coms-stop-hook.mjs +84 -0
  484. package/.versions/1.0.2/install-manifest.json +2745 -0
  485. package/.versions/1.0.2/justfile +272 -0
  486. package/.versions/1.0.2/manifest-meta.json +882 -0
  487. package/.versions/1.0.2/references/accessibility-checklist.md +160 -0
  488. package/.versions/1.0.2/references/definition-of-done.md +67 -0
  489. package/.versions/1.0.2/references/fleet-coordination-patterns.md +151 -0
  490. package/.versions/1.0.2/references/observability-checklist.md +91 -0
  491. package/.versions/1.0.2/references/orchestration-patterns.md +370 -0
  492. package/.versions/1.0.2/references/performance-checklist.md +153 -0
  493. package/.versions/1.0.2/references/prompting-patterns.md +380 -0
  494. package/.versions/1.0.2/references/security-checklist.md +179 -0
  495. package/.versions/1.0.2/references/testing-patterns.md +236 -0
  496. package/.versions/1.0.2/scripts/codex-conductor.ts +41 -0
  497. package/.versions/1.0.2/scripts/codex-remote-control.ts +167 -0
  498. package/.versions/1.0.2/scripts/coms-claude-bridge.ts +411 -0
  499. package/.versions/1.0.2/scripts/coms-cli.ts +484 -0
  500. package/.versions/1.0.2/scripts/coms-hermes-bridge.ts +413 -0
  501. package/.versions/1.0.2/scripts/fleet.ts +185 -0
  502. package/.versions/1.0.2/scripts/hermes-monitor-capability-runner.ts +25 -0
  503. package/.versions/1.0.2/scripts/hermes-monitor-scenario.ts +474 -0
  504. package/.versions/1.0.2/scripts/hermes-watchdog-capability-probe.ts +45 -0
  505. package/.versions/1.0.2/scripts/install-hermes-plugin.sh +180 -0
  506. package/.versions/1.0.2/scripts/lib/claude-bridge-core.ts +210 -0
  507. package/.versions/1.0.2/scripts/lib/codex-conductor.ts +88 -0
  508. package/.versions/1.0.2/scripts/lib/codex-remote-control.ts +480 -0
  509. package/.versions/1.0.2/scripts/lib/coms-envelope.ts +582 -0
  510. package/.versions/1.0.2/scripts/lib/fake-herdr-server.ts +88 -0
  511. package/.versions/1.0.2/scripts/lib/fleet-command.ts +266 -0
  512. package/.versions/1.0.2/scripts/lib/herdr-layout.ts +281 -0
  513. package/.versions/1.0.2/scripts/lib/hermes-bridge-core.ts +241 -0
  514. package/.versions/1.0.2/scripts/lib/hermes-monitor-events.ts +1 -0
  515. package/.versions/1.0.2/scripts/lib/hermes-monitor-herdr.ts +2 -0
  516. package/.versions/1.0.2/scripts/lib/hermes-monitor-model.ts +3 -0
  517. package/.versions/1.0.2/scripts/lib/hermes-monitor-registry.ts +2 -0
  518. package/.versions/1.0.2/scripts/lib/hermes-monitor-socket.ts +2 -0
  519. package/.versions/1.0.2/scripts/lib/hermes-monitor-store.ts +2 -0
  520. package/.versions/1.0.2/scripts/lib/monitor-env.ts +146 -0
  521. package/.versions/1.0.2/scripts/lib/peer-launch.ts +318 -0
  522. package/.versions/1.0.2/scripts/lib/persona-banner.ts +62 -0
  523. package/.versions/1.0.2/scripts/lib/spawn-stagger.ts +101 -0
  524. package/.versions/1.0.2/scripts/lib/team-project.ts +213 -0
  525. package/.versions/1.0.2/scripts/lib/team-snapshot.ts +147 -0
  526. package/.versions/1.0.2/scripts/peer-banner.ts +40 -0
  527. package/.versions/1.0.2/scripts/peer-launch.ts +259 -0
  528. package/.versions/1.0.2/scripts/team-snapshot.ts +237 -0
  529. package/.versions/1.0.2/scripts/team-up.ts +406 -0
  530. package/.versions/1.0.2/skills/_internal/grilling.md +11 -0
  531. package/.versions/1.0.2/skills/browser-testing-with-devtools/SKILL.md +351 -0
  532. package/.versions/1.0.2/skills/code-review-and-quality/SKILL.md +381 -0
  533. package/.versions/1.0.2/skills/compound-learning/SKILL.md +137 -0
  534. package/.versions/1.0.2/skills/context-engineering/SKILL.md +291 -0
  535. package/.versions/1.0.2/skills/deprecation-and-migration/SKILL.md +206 -0
  536. package/.versions/1.0.2/skills/designing-agents/SKILL.md +394 -0
  537. package/.versions/1.0.2/skills/designing-agents/pi-harness-authoring.md +222 -0
  538. package/.versions/1.0.2/skills/frontend-ui-engineering/SKILL.md +328 -0
  539. package/.versions/1.0.2/skills/git-workflow-and-versioning/SKILL.md +316 -0
  540. package/.versions/1.0.2/skills/idea-refine/SKILL.md +182 -0
  541. package/.versions/1.0.2/skills/idea-refine/examples.md +238 -0
  542. package/.versions/1.0.2/skills/idea-refine/frameworks.md +99 -0
  543. package/.versions/1.0.2/skills/idea-refine/refinement-criteria.md +113 -0
  544. package/.versions/1.0.2/skills/idea-refine/scripts/idea-refine.sh +15 -0
  545. package/.versions/1.0.2/skills/incremental-implementation/SKILL.md +287 -0
  546. package/.versions/1.0.2/skills/interview-me/SKILL.md +226 -0
  547. package/.versions/1.0.2/skills/orchestration-verification/SKILL.md +181 -0
  548. package/.versions/1.0.2/skills/peer-coms/SKILL.md +90 -0
  549. package/.versions/1.0.2/skills/performance-optimization/SKILL.md +350 -0
  550. package/.versions/1.0.2/skills/planning-and-task-breakdown/SKILL.md +254 -0
  551. package/.versions/1.0.2/skills/security-and-hardening/SKILL.md +461 -0
  552. package/.versions/1.0.2/skills/spec-driven-development/SKILL.md +257 -0
  553. package/.versions/1.0.2/skills/using-agent-skills/SKILL.md +199 -0
  554. package/.versions/1.0.2/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  555. package/.versions/1.0.2/vendor/agent-skills-upstream/LICENSE +21 -0
  556. package/.versions/1.0.2/vendor/agent-skills-upstream/README.md +11 -0
  557. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  558. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  559. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  560. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  561. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  562. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  563. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  564. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  565. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  566. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  567. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  568. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  569. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  570. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  571. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  572. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  573. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  574. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  575. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  576. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  577. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  578. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  579. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  580. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  581. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  582. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  583. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  584. package/.versions/1.0.2/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  585. package/CHANGELOG.md +15 -0
  586. package/README.md +4 -2
  587. package/agents/code-reviewer.md +1 -1
  588. package/agents/deep-researcher.md +1 -1
  589. package/agents/orchestrator.md +4 -56
  590. package/agents/plan-reviewer.md +1 -1
  591. package/agents/planner.md +1 -1
  592. package/agents/security-auditor.md +1 -1
  593. package/agents/test-engineer.md +1 -1
  594. package/docs/ARCHITECTURE.md +48 -16
  595. package/docs/agent-fleet-setup.md +33 -2
  596. package/docs/pi-extensions.md +29 -2
  597. package/install-manifest.json +2 -2
  598. package/package.json +2 -2
@@ -0,0 +1,539 @@
1
+ // Execution modes & per-turn budgets — the pure policy core behind the hub's
2
+ // runaway-orchestration guardrails. Budgets are PER USER TURN: a new user
3
+ // message opens a fresh window, so "budget exhausted" naturally means "stop,
4
+ // summarize, ask the user". Everything here is data + pure functions so the
5
+ // policy is unit-testable away from the 7k-line harness.
6
+ //
7
+ // A budget value of `null` means "off"/unlimited for that axis.
8
+
9
+ export const HUB_MODES = ["fast", "standard", "strict"];
10
+ export const DEFAULT_HUB_MODE = "standard";
11
+
12
+ // Task tiers — the dispatcher's per-turn complexity triage. Tier caps only
13
+ // lower the dispatch/research axes (min with the mode budget): a trivial ask
14
+ // must not burn a standard-mode budget on ceremony, while `project` defers
15
+ // entirely to the mode. Unset tier is treated as "feature".
16
+ export const TASK_TIERS = ["trivial", "small", "feature", "project"];
17
+ // The tier ASSUMED when the dispatcher never called set_task_tier. It is
18
+ // deliberately not the middle of the range: the tier is task-scoped, so a skipped
19
+ // triage latches for the whole task, and skipped triage is exactly the case where
20
+ // the dispatcher was not thinking about proportionality. Assuming `feature` there
21
+ // unlocked planner/plan-reviewer/security-auditor, loosened the review cap, and
22
+ // handed out the full feature envelope — the over-apparatus failure mode, granted
23
+ // by forgetting a tool call. Assuming `small` costs an explicit escalation (with a
24
+ // reason) when the work really is bigger, which is the cheap direction to be wrong in.
25
+ export const DEFAULT_TASK_TIER = "small";
26
+
27
+ export const TIER_CAPS = {
28
+ trivial: { maxDispatches: 1, maxResearch: 1 },
29
+ small: { maxDispatches: 2, maxResearch: 2 },
30
+ feature: { maxDispatches: 6, maxResearch: 4 },
31
+ project: { maxDispatches: null, maxResearch: null },
32
+ };
33
+
34
+ /** "Small", " TRIVIAL " → canonical tier name, or null when unrecognized. */
35
+ export function normalizeTaskTier(value) {
36
+ const v = String(value ?? "").trim().toLowerCase();
37
+ return TASK_TIERS.includes(v) ? v : null;
38
+ }
39
+
40
+ // Session-recycle context threshold (percent, measured over input+cacheRead+
41
+ // cacheWrite): beyond this, resuming the specialist session mostly re-bills
42
+ // stale context, so a fresh session is cheaper than the memory is worth.
43
+ export const RECYCLE_CONTEXT_PCT = 60;
44
+
45
+ // Hard ceiling: at or past a full window the accumulated session no longer
46
+ // fits, so no threshold override may keep it alive. Session 1 of the
47
+ // post-mortem logged 315% → 176% → 100% while the configured threshold was
48
+ // still being consulted as if it were advisory.
49
+ export const HARD_RECYCLE_CONTEXT_PCT = 100;
50
+
51
+ export const MODE_BUDGETS = {
52
+ fast: {
53
+ maxDispatches: 2,
54
+ maxResearch: 1,
55
+ wallMs: 15 * 60_000,
56
+ agentTurnMs: 10 * 60_000,
57
+ recycleRuns: 3,
58
+ delegation: false,
59
+ },
60
+ standard: {
61
+ maxDispatches: 8,
62
+ maxResearch: 4,
63
+ wallMs: 60 * 60_000,
64
+ agentTurnMs: 30 * 60_000,
65
+ recycleRuns: 5,
66
+ delegation: true,
67
+ },
68
+ strict: {
69
+ maxDispatches: 24,
70
+ maxResearch: 12,
71
+ wallMs: 240 * 60_000,
72
+ agentTurnMs: null,
73
+ recycleRuns: 5,
74
+ delegation: true,
75
+ },
76
+ };
77
+
78
+ /** "Fast", " STRICT " → canonical mode name, or null when unrecognized. */
79
+ export function normalizeHubMode(value) {
80
+ const v = String(value ?? "").trim().toLowerCase();
81
+ return HUB_MODES.includes(v) ? v : null;
82
+ }
83
+
84
+ /**
85
+ * Effective budget for a mode with per-project overrides applied.
86
+ * Override fields (all optional): maxDispatches, maxResearch, wallMs,
87
+ * agentTurnMs, recycleRuns — a number replaces the mode default, `null` turns
88
+ * the axis off, `undefined` keeps the default. `delegation` is mode-owned.
89
+ * A declared `tier` (task tier) then LOWERS the dispatch and research caps to
90
+ * the tier cap — overrides raise/disable the mode side, but the tier keeps a
91
+ * simple ask from spending the whole envelope. No tier (null/undefined) means
92
+ * no tier caps: the caller decides when to assume DEFAULT_TASK_TIER.
93
+ */
94
+ export function resolveTurnBudget(mode, overrides = {}, tier = undefined) {
95
+ const base = MODE_BUDGETS[normalizeHubMode(mode) ?? DEFAULT_HUB_MODE];
96
+ const pick = (key) => (overrides[key] === undefined ? base[key] : overrides[key]);
97
+ const caps = TIER_CAPS[normalizeTaskTier(tier)] ?? { maxDispatches: null, maxResearch: null };
98
+ const lower = (value, cap) => {
99
+ if (cap == null) return value;
100
+ if (value == null) return cap;
101
+ return Math.min(value, cap);
102
+ };
103
+ return {
104
+ maxDispatches: lower(pick("maxDispatches"), caps.maxDispatches),
105
+ maxResearch: lower(pick("maxResearch"), caps.maxResearch),
106
+ wallMs: pick("wallMs"),
107
+ agentTurnMs: pick("agentTurnMs"),
108
+ recycleRuns: pick("recycleRuns"),
109
+ delegation: base.delegation,
110
+ };
111
+ }
112
+
113
+ function refusalTail(mode) {
114
+ return "Do NOT retry this call before human confirmation. Summarize progress so far (including " +
115
+ "unproven assertions and artifact paths), then use the Hub's one-click budget continuation " +
116
+ "confirmation. Do not ask for a typed continue message or a slash command. The user can widen " +
117
+ `future budgets with /af-hub-mode (current: ${mode}) or the max-*-per-turn / turn-wall-time-s keys ` +
118
+ "in .ai/agent-fleet-overrides.md.";
119
+ }
120
+
121
+ /**
122
+ * Gate one dispatcher tool call against the turn budget.
123
+ * kind: "dispatch" | "research"; counters: { dispatches, research } — calls
124
+ * already made this turn. Returns null when allowed, else { reason, message }.
125
+ */
126
+ export function checkTurnBudget(kind, counters, budget, elapsedWallMs, mode = DEFAULT_HUB_MODE) {
127
+ if (budget.wallMs != null && elapsedWallMs >= budget.wallMs) {
128
+ return {
129
+ reason: "wall",
130
+ message: `⚠ Turn budget exhausted: wall clock at ${Math.round(elapsedWallMs / 60_000)} min ` +
131
+ `(limit ${Math.round(budget.wallMs / 60_000)} min in ${mode} mode). ${refusalTail(mode)}`,
132
+ };
133
+ }
134
+ if (kind === "dispatch" && budget.maxDispatches != null && counters.dispatches >= budget.maxDispatches) {
135
+ return {
136
+ reason: "dispatches",
137
+ message: `⚠ Turn budget exhausted: ${counters.dispatches} of ${budget.maxDispatches} ` +
138
+ `dispatch_agent calls used in ${mode} mode. ${refusalTail(mode)}`,
139
+ };
140
+ }
141
+ if (kind === "research" && budget.maxResearch != null && counters.research >= budget.maxResearch) {
142
+ return {
143
+ reason: "research",
144
+ message: `⚠ Turn budget exhausted: ${counters.research} of ${budget.maxResearch} ` +
145
+ `spawn_research calls used in ${mode} mode. ${refusalTail(mode)}`,
146
+ };
147
+ }
148
+ return null;
149
+ }
150
+
151
+ /**
152
+ * Recycle the specialist's accumulated session before this run? True when the
153
+ * session already served `recycleRuns` runs, its context reached a full window
154
+ * (HARD_RECYCLE_CONTEXT_PCT, not overridable), or it passed the configured
155
+ * RECYCLE_CONTEXT_PCT — resuming past any of those mostly re-bills stale
156
+ * context on every subsequent model call.
157
+ */
158
+ export function shouldRecycleSession(runsSinceFresh, contextPct, budget, thresholdPct = RECYCLE_CONTEXT_PCT) {
159
+ if (runsSinceFresh <= 0) return false;
160
+ if (contextPct >= HARD_RECYCLE_CONTEXT_PCT) return true;
161
+ if (budget.recycleRuns != null && runsSinceFresh >= budget.recycleRuns) return true;
162
+ return contextPct >= thresholdPct;
163
+ }
164
+
165
+ /**
166
+ * The one case recycling cannot fix: a *fresh* session already measured over a
167
+ * full window means a single run overflowed on its own, so there is no
168
+ * accumulated history to drop. Either `contextWindow` is wrong for that
169
+ * provider or the run genuinely ran over — both need a human, not a retry.
170
+ * Returns the diagnostic line, or null when recycling covers the situation.
171
+ */
172
+ export function contextOverflowDiagnostic(runsSinceFresh, contextPct, { agent = "agent", model = "unknown model" } = {}) {
173
+ if (runsSinceFresh > 0) return null;
174
+ if (!(contextPct >= HARD_RECYCLE_CONTEXT_PCT)) return null;
175
+ return (
176
+ `⚠ ${agent} measured ${Math.round(contextPct)}% context on a fresh session (${model}) — ` +
177
+ "recycling cannot help, one run overflowed the window on its own. Either the resolved " +
178
+ "contextWindow is wrong for this provider or the run genuinely ran over: check the model's " +
179
+ "declared window and narrow the task's inputs."
180
+ );
181
+ }
182
+
183
+ /** One-line status chip: "Mode: standard·small · 1/2 disp · 0/2 res · task 4/6". */
184
+ export function budgetStatusLine(mode, counters, budget, tier = null, task = null) {
185
+ const cap = (n) => (n == null ? "∞" : String(n));
186
+ const tierSuffix = tier ? `·${tier}` : "";
187
+ const taskSuffix = task
188
+ ? ` · task ${task.counters.dispatches}/${cap(task.budget.maxDispatches)}`
189
+ : "";
190
+ return `Mode: ${mode}${tierSuffix} · ${counters.dispatches}/${cap(budget.maxDispatches)} disp · ` +
191
+ `${counters.research}/${cap(budget.maxResearch)} res${taskSuffix}`;
192
+ }
193
+
194
+ // ─────────────────────────────────────────────────────────────────────────────
195
+ // Tier ratchet (the tier is TASK-scoped, not turn-scoped)
196
+ // ─────────────────────────────────────────────────────────────────────────────
197
+ //
198
+ // Turn-scoped tiers cannot bind on a steered run: every follow-up message reset
199
+ // the tier to null, the next dispatch re-assumed `feature`, and a two-word
200
+ // correction ("no, only the one line") bought six fresh dispatches. Worse, the
201
+ // reset direction was always upward — nobody re-declares `trivial` after a
202
+ // steering message, so the effective tier drifted to the ceiling.
203
+ //
204
+ // The tier now survives the turn and moves by ratchet: DOWN is free (cheap and
205
+ // self-limiting), UP costs an explicit reason that is recorded and shown. Only
206
+ // an explicit new task (`set_task_tier` with `new_task: true`) clears it.
207
+
208
+ export const TIER_RANK = { trivial: 0, small: 1, feature: 2, project: 3 };
209
+
210
+ /**
211
+ * Move the task tier from `current` to `next`.
212
+ * Returns { ok, tier, escalated, reason, message }: `tier` is always the tier
213
+ * that should be in force afterwards, so a refused escalation keeps the old one.
214
+ */
215
+ export function applyTierChange(current, next, reason = "") {
216
+ const target = normalizeTaskTier(next);
217
+ if (!target) {
218
+ return {
219
+ ok: false,
220
+ tier: current ?? null,
221
+ escalated: false,
222
+ reason: "unknown_tier",
223
+ message: `Unknown tier "${next}" — expected one of: ${TASK_TIERS.join(", ")}. ` +
224
+ `Tier unchanged (${current ?? "unset"}).`,
225
+ };
226
+ }
227
+ const from = normalizeTaskTier(current);
228
+ if (!from) {
229
+ return { ok: true, tier: target, escalated: false, reason: "initial", message: `Task tier: ${target}.` };
230
+ }
231
+ if (TIER_RANK[target] <= TIER_RANK[from]) {
232
+ return {
233
+ ok: true,
234
+ tier: target,
235
+ escalated: false,
236
+ reason: TIER_RANK[target] === TIER_RANK[from] ? "unchanged" : "lowered",
237
+ message: `Task tier: ${from} → ${target}.`,
238
+ };
239
+ }
240
+ if (!String(reason || "").trim()) {
241
+ return {
242
+ ok: false,
243
+ tier: from,
244
+ escalated: false,
245
+ reason: "raise_without_reason",
246
+ message: `⚠ Tier escalation ${from} → ${target} refused: raising the tier needs an explicit ` +
247
+ "`reason` naming what the ask turned out to contain that the lower tier does not cover. " +
248
+ `Tier stays ${from}. Lowering the tier never needs a reason.`,
249
+ };
250
+ }
251
+ return {
252
+ ok: true,
253
+ tier: target,
254
+ escalated: true,
255
+ reason: "raised",
256
+ message: `⚠ Task tier ESCALATED ${from} → ${target}: ${String(reason).trim()}`,
257
+ };
258
+ }
259
+
260
+ // ─────────────────────────────────────────────────────────────────────────────
261
+ // Task-scoped budget (the outer bound the turn budget never provided)
262
+ // ─────────────────────────────────────────────────────────────────────────────
263
+ //
264
+ // Turn budgets are a per-message allowance, and a per-message allowance cannot
265
+ // bound a task: the observed 47-hour run never hit one, because every steering
266
+ // message opened a fresh window of 8 dispatches and 60 minutes. The task budget
267
+ // is the same envelope multiplied once and NOT reset by a user message.
268
+ // Exhaustion is a hard stop until the human accepts one audited continuation
269
+ // tranche; opening a genuinely new task remains a separate lifecycle action.
270
+
271
+ export const TASK_BUDGET_MULTIPLIER = 3;
272
+
273
+ /** Task envelope = turn envelope × multiplier; `null` (off) axes stay off. */
274
+ export function resolveTaskBudget(turnBudget, multiplier = TASK_BUDGET_MULTIPLIER) {
275
+ const scale = (value) => (value == null ? null : Math.max(1, Math.round(value * multiplier)));
276
+ return {
277
+ maxDispatches: scale(turnBudget.maxDispatches),
278
+ maxResearch: scale(turnBudget.maxResearch),
279
+ wallMs: scale(turnBudget.wallMs),
280
+ };
281
+ }
282
+
283
+ function taskRefusalTail() {
284
+ return "This is a HARD STOP for the current task, not a turn refusal — another user message does " +
285
+ "NOT reopen it. Summarize what is proven (with evidence and artifact paths), what is unproven, " +
286
+ "and what remains, then use the Hub's one-click task-budget continuation confirmation. A confirmed " +
287
+ "continuation opens one audited tranche while preserving task state. Use `set_task_tier` with " +
288
+ "`new_task: true` only when the human genuinely moved to different work.";
289
+ }
290
+
291
+ /**
292
+ * ACTIVE milliseconds in one turn: wall clock minus the time the human was away.
293
+ *
294
+ * The task clock must never charge for human time. A task's wall clock spans
295
+ * every message on it, so a lunch break, an overnight pause, or a long `ask_user`
296
+ * answer would all count as budget — and at `fast` mode's 45-minute task wall a
297
+ * single coffee break would hard-stop a task with two dispatches spent. That is a
298
+ * false positive that teaches people to reset the task window reflexively, which
299
+ * costs more than the guardrail buys. Dispatch/research counts stay the honest
300
+ * hard stops; the clock only bounds time the fleet actually spent working.
301
+ */
302
+ export function turnActiveMs(turnStartedAt, now, askUserWaitMs = 0) {
303
+ if (!turnStartedAt) return 0;
304
+ return Math.max(0, now - turnStartedAt - Math.max(0, askUserWaitMs || 0));
305
+ }
306
+
307
+ /** A serializable, deterministic task clock. `active` is authoritative. */
308
+ export function createTaskClock() {
309
+ return { active: false, accumulatedMs: 0, turnStartedAt: 0, askUserWaitMs: 0 };
310
+ }
311
+
312
+ /**
313
+ * Open a task turn. A still-open prior interval is closed first as defensive
314
+ * recovery for a missing end event; normal turns are closed by agent_end.
315
+ */
316
+ export function openTaskClock(clock, now) {
317
+ const base = clock?.active ? closeTaskClock(clock, now) : { ...createTaskClock(), ...clock };
318
+ return { ...base, active: true, turnStartedAt: now, askUserWaitMs: 0 };
319
+ }
320
+
321
+ /** Add a completed ask_user wait to the currently open turn. */
322
+ export function addTaskClockWait(clock, waitMs) {
323
+ if (!clock?.active) return { ...createTaskClock(), ...clock };
324
+ return {
325
+ ...clock,
326
+ askUserWaitMs: Math.max(0, clock.askUserWaitMs || 0) + Math.max(0, waitMs || 0),
327
+ };
328
+ }
329
+
330
+ /** Finished turns plus the open turn, excluding completed and in-flight waits. */
331
+ export function taskClockElapsedMs(clock, now, openWaitMs = 0) {
332
+ if (!clock) return 0;
333
+ const accumulated = Math.max(0, clock.accumulatedMs || 0);
334
+ if (!clock.active) return accumulated;
335
+ return accumulated + turnActiveMs(
336
+ clock.turnStartedAt,
337
+ now,
338
+ Math.max(0, clock.askUserWaitMs || 0) + Math.max(0, openWaitMs || 0),
339
+ );
340
+ }
341
+
342
+ /** Close the current turn once. Repeated closes are no-ops. */
343
+ export function closeTaskClock(clock, now) {
344
+ const base = { ...createTaskClock(), ...clock };
345
+ if (!base.active) return base;
346
+ return {
347
+ active: false,
348
+ accumulatedMs: taskClockElapsedMs(base, now),
349
+ turnStartedAt: 0,
350
+ askUserWaitMs: 0,
351
+ };
352
+ }
353
+
354
+ /**
355
+ * Open a fresh task window. During an active turn, the new task begins at the
356
+ * reset instant; between turns, no timestamp is carried into the next task.
357
+ */
358
+ export function resetTaskClock(clock, now) {
359
+ const active = clock?.active === true;
360
+ return {
361
+ active,
362
+ accumulatedMs: 0,
363
+ turnStartedAt: active ? now : 0,
364
+ askUserWaitMs: 0,
365
+ };
366
+ }
367
+
368
+ /**
369
+ * Gate one dispatcher tool call against the TASK budget (checked before the
370
+ * turn budget: it is the more severe stop).
371
+ * `activeTaskMs` is ACTIVE time (see turnActiveMs), never raw wall clock.
372
+ * kind: "dispatch" | "research". Returns null when allowed, else { reason, message }.
373
+ */
374
+ export function checkTaskBudget(kind, counters, taskBudget, activeTaskMs, tier = null) {
375
+ const label = tier ? `tier ${tier}` : "current tier";
376
+ if (taskBudget.wallMs != null && activeTaskMs >= taskBudget.wallMs) {
377
+ return {
378
+ reason: "task_wall",
379
+ message: `⛔ TASK budget exhausted: ${Math.round(activeTaskMs / 60_000)} min of ACTIVE time on this task ` +
380
+ `(limit ${Math.round(taskBudget.wallMs / 60_000)} min = ${TASK_BUDGET_MULTIPLIER}× the ${label} turn envelope; ` +
381
+ `time the human was away is not charged). ` +
382
+ taskRefusalTail(),
383
+ };
384
+ }
385
+ if (kind === "dispatch" && taskBudget.maxDispatches != null && counters.dispatches >= taskBudget.maxDispatches) {
386
+ return {
387
+ reason: "task_dispatches",
388
+ message: `⛔ TASK budget exhausted: ${counters.dispatches} of ${taskBudget.maxDispatches} ` +
389
+ `dispatch_agent calls used on this task (${TASK_BUDGET_MULTIPLIER}× the ${label} turn envelope). ` +
390
+ taskRefusalTail(),
391
+ };
392
+ }
393
+ if (kind === "research" && taskBudget.maxResearch != null && counters.research >= taskBudget.maxResearch) {
394
+ return {
395
+ reason: "task_research",
396
+ message: `⛔ TASK budget exhausted: ${counters.research} of ${taskBudget.maxResearch} ` +
397
+ `spawn_research calls used on this task (${TASK_BUDGET_MULTIPLIER}× the ${label} turn envelope). ` +
398
+ taskRefusalTail(),
399
+ };
400
+ }
401
+ return null;
402
+ }
403
+
404
+ /**
405
+ * How many research runs the TASK envelope still allows; null = unlimited.
406
+ * The auto-research pipe (specialist emits NEEDS_RESEARCH, the hub fans out
407
+ * read-only helpers in code) is exempt from the TURN budget on purpose — it is
408
+ * hub mechanics, not a dispatcher decision, and it must not steal the
409
+ * dispatcher's slots. It is NOT exempt from the TASK envelope: at 2 rounds × 4
410
+ * questions per dispatch and 18 dispatches per task, an uncounted pipe is 144
411
+ * research runs inside the bound that is supposed to be the outer one.
412
+ */
413
+ export function remainingTaskResearch(taskBudget, counters) {
414
+ if (taskBudget.maxResearch == null) return null;
415
+ return Math.max(0, taskBudget.maxResearch - (counters?.research ?? 0));
416
+ }
417
+
418
+ // ─────────────────────────────────────────────────────────────────────────────
419
+ // Tier persona gate (B3) — heavy apparatus is not available at low tiers
420
+ // ─────────────────────────────────────────────────────────────────────────────
421
+ //
422
+ // "A trivial ask gets one specialist" was prose in the system prompt, and prose
423
+ // lost: a one-line Azure permission change was routed through planner →
424
+ // plan-reviewer → security-auditor and grew a 1216-line plan. These personas
425
+ // each open a pipeline (plans, reviews, findings that ratchet back into the
426
+ // plan), so at trivial/small tiers they are refused in code. The escape hatch is
427
+ // the honest one: raise the tier with a reason.
428
+
429
+ export const HEAVY_PERSONAS = ["planner", "plan-reviewer", "architect", "security-auditor", "deep-researcher"];
430
+ export const REVIEW_PERSONAS = ["code-reviewer", "plan-reviewer", "security-auditor"];
431
+ const GATED_TIERS = new Set(["trivial", "small"]);
432
+
433
+ /**
434
+ * Refuse a heavy persona at a low tier. Returns null when allowed, else
435
+ * { reason, message }. Unknown/absent tier never gates (strict mode leaves the
436
+ * tier unset on purpose).
437
+ */
438
+ export function checkTierPersonaGate(tier, persona) {
439
+ const t = normalizeTaskTier(tier);
440
+ if (!t || !GATED_TIERS.has(t)) return null;
441
+ const name = String(persona || "").trim().toLowerCase();
442
+ if (!HEAVY_PERSONAS.includes(name)) return null;
443
+ return {
444
+ reason: "tier_persona_gate",
445
+ message: `⚠ ${name} is not available at tier "${t}" — and this dispatch was NOT counted against any budget.\n` +
446
+ `At trivial/small tiers the apparatus is one specialist plus its own evidence: no planning pipeline, ` +
447
+ `no plan review, no separate audit pass. Each of those personas opens a document/finding loop whose ` +
448
+ `output then has to be executed and re-reviewed.\n` +
449
+ `Either dispatch the specialist that does the actual work (builder, test-engineer, code-reviewer, ` +
450
+ `documenter), or — if the ask really is bigger than "${t}" — call set_task_tier with a higher tier ` +
451
+ `AND a reason naming what it turned out to contain. Do not raise the tier merely to unlock a persona.`,
452
+ };
453
+ }
454
+
455
+ // ─────────────────────────────────────────────────────────────────────────────
456
+ // Review finding budget (B6) — a review is a gate, and a gate has a size
457
+ // ─────────────────────────────────────────────────────────────────────────────
458
+ //
459
+ // Unbounded review authority is a ratchet: every round produced new blocking
460
+ // findings, each finding added an invariant to the plan, and the enlarged plan
461
+ // justified another round. PLAN37 recorded P37-001…011, R37-IMM-001 and six
462
+ // script-review remediations — none of which the user asked for. The cap is on
463
+ // BLOCKING findings only; everything else still gets reported, just not as a gate.
464
+
465
+ export const BLOCKING_FINDING_CAPS = { trivial: 1, small: 2, feature: 5, project: null };
466
+
467
+ // Review ROUNDS per task. The finding cap is an instruction to the reviewer, and
468
+ // an instruction is exactly what this whole change exists to stop relying on —
469
+ // but the finding cap is also the wrong thing to enforce mechanically: no rule
470
+ // the hub can evaluate distinguishes "invents a new manifest" from "this leaks a
471
+ // credential", and silently demoting the second is worse than tolerating the
472
+ // first. What the hub CAN own is its own action. The ratchet needs a second
473
+ // round to close, so the round count is where it is cut — deterministically,
474
+ // with no judgement about finding content.
475
+ export const REVIEW_ROUND_CAPS = { trivial: 1, small: 1, feature: 2, project: null };
476
+
477
+ /** Review rounds allowed on one task at this tier; null = uncapped. */
478
+ export function reviewRoundCap(tier) {
479
+ const t = normalizeTaskTier(tier);
480
+ if (!t) return null;
481
+ return REVIEW_ROUND_CAPS[t] ?? null;
482
+ }
483
+
484
+ /**
485
+ * Refuse an (N+1)-th review dispatch on the same task.
486
+ * Returns null when allowed, else { reason, message }.
487
+ */
488
+ export function checkReviewRoundCap(tier, persona, roundsSoFar) {
489
+ if (!isReviewPersona(persona)) return null;
490
+ const cap = reviewRoundCap(tier);
491
+ if (cap == null || roundsSoFar < cap) return null;
492
+ const t = normalizeTaskTier(tier);
493
+ return {
494
+ reason: "review_round_cap",
495
+ message: `⚠ Review round cap reached: ${roundsSoFar} of ${cap} review dispatch${cap === 1 ? "" : "es"} ` +
496
+ `already spent on this task at tier "${t}" — and this dispatch was NOT counted against any budget.\n` +
497
+ `A review is a GATE, not a loop. The findings from the round you already have are the gate: fix them, ` +
498
+ `re-verify only the assertions the fix touched, and close. Re-reviewing the same work to see whether ` +
499
+ `the fix produced new findings is the ratchet — each round's findings become requirements, and the ` +
500
+ `enlarged requirement set justifies the next round.\n` +
501
+ `If this genuinely is a different review (a different subsystem, or work the earlier round never saw), ` +
502
+ `raise the tier with a reason via set_task_tier, or call it with new_task: true for genuinely different work.`,
503
+ };
504
+ }
505
+
506
+ /** Blocking-finding cap for a tier; null = uncapped (project / unset tier). */
507
+ export function blockingFindingCap(tier) {
508
+ const t = normalizeTaskTier(tier);
509
+ if (!t) return null;
510
+ return BLOCKING_FINDING_CAPS[t] ?? null;
511
+ }
512
+
513
+ /** Is this a review persona (gets the finding-budget clause)? */
514
+ export function isReviewPersona(persona) {
515
+ return REVIEW_PERSONAS.includes(String(persona || "").trim().toLowerCase());
516
+ }
517
+
518
+ /**
519
+ * The finding-budget clause appended to a review persona's task text.
520
+ * Returns null when the persona is not a reviewer or the tier is uncapped.
521
+ */
522
+ export function reviewBudgetClause(tier, persona) {
523
+ if (!isReviewPersona(persona)) return null;
524
+ const cap = blockingFindingCap(tier);
525
+ if (cap == null) return null;
526
+ return [
527
+ `## Finding budget (task tier: ${normalizeTaskTier(tier)})`,
528
+ ``,
529
+ `Report at most ${cap} BLOCKING finding${cap === 1 ? "" : "s"}. Rank by severity and put everything`,
530
+ `else under a "## Non-blocking (optional)" heading — non-blocking findings are advice, and must not`,
531
+ `gate the change or be re-raised as blockers in a later round.`,
532
+ ``,
533
+ `A blocking finding may only enforce an invariant the task, the plan, or the project rules ALREADY`,
534
+ `state. It may NOT introduce a new invariant, a new evidence artifact, a new script/manifest/fixture,`,
535
+ `or a new process requirement — that is scope growth wearing a reviewer's hat. If you believe a new`,
536
+ `invariant is genuinely needed, write it under "## Non-blocking (optional)" as a recommendation for`,
537
+ `the human to decide, and do not block on it.`,
538
+ ].join("\n");
539
+ }
@@ -0,0 +1,87 @@
1
+ // Immutable per-run artifact namespaces — the pure policy core behind "a run's
2
+ // artifacts are never overwritten by the next run".
3
+ //
4
+ // The observed failure: `.pi/agent-sessions/artifacts/` was deleted at session
5
+ // start, and specialist returns were named by a per-session counter
6
+ // (`returns/builder-run1.md`). Two consequences, both hit at once: a later
7
+ // session's `builder-run1.md` occupied the same path as an earlier one, and the
8
+ // start-of-session wipe removed eleven implementation returns and two review
9
+ // artifacts that a post-mortem then had to record as NOT RECOVERABLE.
10
+ //
11
+ // The fix is not retention-by-luck: each session archives the previous session's
12
+ // artifacts into `runs/<runId>/`, a namespace that is written once and never
13
+ // reused, and records it in `runs/index.json`. Pruning is explicit and bounded,
14
+ // so the directory cannot grow without limit either.
15
+
16
+ export const DEFAULT_RUN_HISTORY_KEEP = 10;
17
+ export const RUNS_DIRNAME = "runs";
18
+ export const RUN_INDEX_FILENAME = "index.json";
19
+
20
+ /**
21
+ * Run id: sortable UTC timestamp + a short random suffix, so two sessions
22
+ * starting in the same second still get distinct namespaces.
23
+ * `2026-08-03T09-10-42-a3f9`
24
+ */
25
+ export function makeRunId(date = new Date(), suffix = null) {
26
+ const iso = new Date(date).toISOString().replace(/\.\d+Z$/, "").replace(/:/g, "-");
27
+ const tail = suffix ?? Math.random().toString(36).slice(2, 6);
28
+ return `${iso}-${tail}`;
29
+ }
30
+
31
+ /** A run id we generated (used to filter stray directories out of `runs/`). */
32
+ export function isRunId(name) {
33
+ return /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-[a-z0-9]{2,8}$/.test(String(name || ""));
34
+ }
35
+
36
+ /**
37
+ * Which run directories to delete so at most `keep` survive.
38
+ * Run ids sort lexicographically by time, so newest = last. `keep: null`
39
+ * ("off") prunes nothing; non-run-id entries are never touched.
40
+ */
41
+ export function pruneRunDirs(names, keep = DEFAULT_RUN_HISTORY_KEEP) {
42
+ if (keep == null) return [];
43
+ const runs = (names || []).filter(isRunId).sort();
44
+ const limit = Math.max(0, keep);
45
+ if (runs.length <= limit) return [];
46
+ return runs.slice(0, runs.length - limit);
47
+ }
48
+
49
+ /**
50
+ * The metadata written once into `runs/<runId>/meta.json`. Carries the
51
+ * identifiers a post-mortem needs and could not previously recover: which
52
+ * workspace/project/repo the run belonged to, and when it started and ended.
53
+ */
54
+ export function buildRunMeta({ runId, startedAt = null, archivedAt = Date.now(), cwd = null, project = null, workspace = null, artifactCounts = null }) {
55
+ return {
56
+ runId,
57
+ startedAt: startedAt == null ? null : new Date(startedAt).toISOString(),
58
+ archivedAt: new Date(archivedAt).toISOString(),
59
+ cwd,
60
+ project,
61
+ workspace,
62
+ artifactCounts,
63
+ note: "Immutable archive of one agent-hub session's artifacts. Written once; never rewritten.",
64
+ };
65
+ }
66
+
67
+ /**
68
+ * Fold a run entry into `runs/index.json`, newest last, capped at `keep`.
69
+ * Re-indexing the same runId replaces its entry rather than duplicating it.
70
+ */
71
+ export function appendRunIndex(existing, entry, keep = DEFAULT_RUN_HISTORY_KEEP) {
72
+ const runs = Array.isArray(existing?.runs) ? existing.runs.filter((r) => r && r.runId !== entry.runId) : [];
73
+ runs.push(entry);
74
+ runs.sort((a, b) => String(a.runId).localeCompare(String(b.runId)));
75
+ const trimmed = keep == null ? runs : runs.slice(Math.max(0, runs.length - Math.max(0, keep)));
76
+ return { version: 1, updatedAt: new Date().toISOString(), runs: trimmed };
77
+ }
78
+
79
+ /** Parse the `run-history-keep:` overrides value → number, null ("off"), or undefined. */
80
+ export function normalizeRunHistoryKeep(value) {
81
+ const raw = String(value ?? "").trim().toLowerCase();
82
+ if (!raw) return undefined;
83
+ if (raw === "off" || raw === "none" || raw === "0") return null;
84
+ const n = Number(raw);
85
+ if (!Number.isFinite(n) || n < 1) return undefined;
86
+ return Math.floor(n);
87
+ }
@@ -0,0 +1,22 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+
4
+ const CONTINUE_ENTRY = /damage-control-continue[/\\]index\.ts$/;
5
+ const MISSING_SAFETY_ERROR = "damage-control-continue harness not found — guarded child dispatch refused";
6
+
7
+ /** Resolve only the surviving continue harness; never downgrade to an unguarded or hard-stop child. */
8
+ export function resolveSafetyHarness(cwd: string, argv: string[] = process.argv): string | null {
9
+ for (let i = 0; i < argv.length - 1; i++) {
10
+ if (argv[i] !== "-e" && argv[i] !== "--extension") continue;
11
+ const candidate = resolve(argv[i + 1]);
12
+ if (CONTINUE_ENTRY.test(candidate) && existsSync(candidate)) return candidate;
13
+ }
14
+ const local = join(cwd, ".pi", "harnesses", "damage-control-continue", "index.ts");
15
+ return existsSync(local) ? local : null;
16
+ }
17
+
18
+ export function requireSafetyHarness(path: string | null):
19
+ | { ok: true; extensions: string[] }
20
+ | { ok: false; error: string } {
21
+ return path ? { ok: true, extensions: [path] } : { ok: false, error: MISSING_SAFETY_ERROR };
22
+ }