@chankov/agent-fleet 0.0.11 → 1.0.0

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 (494) hide show
  1. package/.pi/extensions/agent-fleet-update-check/README.md +4 -4
  2. package/.pi/extensions/btw/README.md +26 -25
  3. package/.pi/extensions/btw/index.ts +80 -83
  4. package/.pi/extensions/pi-voice-stt/README.md +4 -3
  5. package/.pi/extensions/pi-voice-stt/config.ts +1 -1
  6. package/.pi/harnesses/agent-hub/README.md +106 -54
  7. package/.pi/harnesses/agent-hub/backend-policy.js +25 -4
  8. package/.pi/harnesses/agent-hub/footer.ts +4 -0
  9. package/.pi/harnesses/agent-hub/helpers.ts +18 -0
  10. package/.pi/harnesses/agent-hub/index.ts +537 -369
  11. package/.pi/harnesses/agent-hub/monitor-session-bridge.ts +10 -1
  12. package/.pi/harnesses/agent-hub/package.json +1 -1
  13. package/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  14. package/.pi/harnesses/agent-hub/posture.ts +103 -0
  15. package/.pi/harnesses/ask-user-remote/README.md +37 -3
  16. package/.pi/harnesses/ask-user-remote/index.ts +173 -17
  17. package/.pi/harnesses/coms/package.json +1 -1
  18. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  19. package/.pi/harnesses/lib/fleet-dashboard-ops.ts +118 -0
  20. package/.pi/harnesses/lib/fleet-dashboard-view.ts +140 -0
  21. package/.pi/harnesses/lib/fleet-detail-view.ts +43 -0
  22. package/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  23. package/.pi/harnesses/lib/fleet-panel.ts +34 -0
  24. package/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  25. package/.pi/harnesses/lib/fleet-selection.ts +24 -0
  26. package/.pi/harnesses/package-lock.json +2011 -0
  27. package/.pi/harnesses/package.json +1 -0
  28. package/.versions/0.0.11/.pi/extensions/agent-fleet-update-check/README.md +4 -4
  29. package/.versions/0.0.11/.pi/extensions/pi-voice-stt/README.md +4 -3
  30. package/.versions/0.0.11/.pi/extensions/pi-voice-stt/config.ts +1 -1
  31. package/.versions/0.0.11/.pi/harnesses/agent-hub/monitor-session-bridge.ts +10 -1
  32. package/.versions/0.0.11/.pi/harnesses/ask-user-remote/README.md +37 -3
  33. package/.versions/0.0.11/.pi/harnesses/ask-user-remote/index.ts +173 -17
  34. package/.versions/0.0.11/.pi/harnesses/package-lock.json +2011 -0
  35. package/.versions/0.0.11/.pi/harnesses/package.json +1 -0
  36. package/.versions/0.0.11/docs/ARCHITECTURE.md +6 -8
  37. package/.versions/0.0.11/docs/agent-fleet-setup.md +17 -43
  38. package/.versions/0.0.11/docs/claude-code-coms-bridge.md +20 -2
  39. package/.versions/0.0.11/docs/coms-hermes-bridge.md +1 -1
  40. package/.versions/0.0.11/docs/getting-started.md +26 -237
  41. package/.versions/0.0.11/docs/npm-install.md +60 -478
  42. package/.versions/0.0.11/docs/pi-extensions.md +4 -4
  43. package/.versions/0.0.11/docs/pi-setup.md +37 -551
  44. package/.versions/0.0.11/hermes/README.md +1 -1
  45. package/.versions/0.0.11/install-manifest.json +375 -1247
  46. package/.versions/0.0.11/justfile +13 -6
  47. package/.versions/0.0.11/manifest-meta.json +543 -134
  48. package/.versions/0.0.11/scripts/lib/fleet-command.ts +8 -0
  49. package/.versions/0.0.11/scripts/lib/monitor-env.ts +18 -6
  50. package/.versions/0.0.11/skills/designing-agents/SKILL.md +1 -1
  51. package/.versions/0.0.11/skills/designing-agents/pi-harness-authoring.md +1 -1
  52. package/.versions/1.0.0/.pi/agents/dispatch-policy.yaml +32 -0
  53. package/.versions/1.0.0/.pi/agents/model-profiles.yaml +27 -0
  54. package/.versions/1.0.0/.pi/agents/peers.yaml +142 -0
  55. package/.versions/1.0.0/.pi/agents/teams.yaml +41 -0
  56. package/.versions/1.0.0/.pi/damage-control-rules.yaml +297 -0
  57. package/.versions/1.0.0/.pi/extensions/agent-fleet-update-check/README.md +57 -0
  58. package/.versions/1.0.0/.pi/extensions/agent-fleet-update-check/index.ts +161 -0
  59. package/.versions/1.0.0/.pi/extensions/agent-fleet-update-check/package.json +6 -0
  60. package/.versions/1.0.0/.pi/extensions/btw/README.md +120 -0
  61. package/.versions/1.0.0/.pi/extensions/btw/index.ts +914 -0
  62. package/.versions/1.0.0/.pi/extensions/btw/package.json +6 -0
  63. package/.versions/1.0.0/.pi/extensions/btw/state.js +179 -0
  64. package/.versions/1.0.0/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  65. package/.versions/1.0.0/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  66. package/.versions/1.0.0/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  67. package/.versions/1.0.0/.pi/extensions/compact-and-continue/README.md +42 -0
  68. package/.versions/1.0.0/.pi/extensions/compact-and-continue/index.ts +120 -0
  69. package/.versions/1.0.0/.pi/extensions/compact-and-continue/package.json +6 -0
  70. package/.versions/1.0.0/.pi/extensions/mcp-bridge/README.md +46 -0
  71. package/.versions/1.0.0/.pi/extensions/mcp-bridge/index.ts +206 -0
  72. package/.versions/1.0.0/.pi/extensions/mcp-bridge/package.json +6 -0
  73. package/.versions/1.0.0/.pi/extensions/package-lock.json +1143 -0
  74. package/.versions/1.0.0/.pi/extensions/package.json +9 -0
  75. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/README.md +205 -0
  76. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/config.ts +198 -0
  77. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  78. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/index.ts +248 -0
  79. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/package.json +6 -0
  80. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  81. package/.versions/1.0.0/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  82. package/.versions/1.0.0/.pi/harnesses/agent-hub/README.md +1056 -0
  83. package/.versions/1.0.0/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  84. package/.versions/1.0.0/.pi/harnesses/agent-hub/artifacts.js +146 -0
  85. package/.versions/1.0.0/.pi/harnesses/agent-hub/assertion-ledger.js +58 -0
  86. package/.versions/1.0.0/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  87. package/.versions/1.0.0/.pi/harnesses/agent-hub/context-window.js +106 -0
  88. package/.versions/1.0.0/.pi/harnesses/agent-hub/delegate.ts +435 -0
  89. package/.versions/1.0.0/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  90. package/.versions/1.0.0/.pi/harnesses/agent-hub/drift-watchdog.js +211 -0
  91. package/.versions/1.0.0/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  92. package/.versions/1.0.0/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  93. package/.versions/1.0.0/.pi/harnesses/agent-hub/footer.ts +35 -0
  94. package/.versions/1.0.0/.pi/harnesses/agent-hub/helpers.ts +266 -0
  95. package/.versions/1.0.0/.pi/harnesses/agent-hub/index.ts +9279 -0
  96. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  97. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  98. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  99. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  100. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  101. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  102. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  103. package/.versions/1.0.0/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  104. package/.versions/1.0.0/.pi/harnesses/agent-hub/package.json +7 -0
  105. package/.versions/1.0.0/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  106. package/.versions/1.0.0/.pi/harnesses/agent-hub/posture.ts +103 -0
  107. package/.versions/1.0.0/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  108. package/.versions/1.0.0/.pi/harnesses/agent-hub/research-retention.js +34 -0
  109. package/.versions/1.0.0/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  110. package/.versions/1.0.0/.pi/harnesses/agent-hub/return-contract.js +293 -0
  111. package/.versions/1.0.0/.pi/harnesses/agent-hub/return-extract.js +75 -0
  112. package/.versions/1.0.0/.pi/harnesses/agent-hub/review-findings.js +102 -0
  113. package/.versions/1.0.0/.pi/harnesses/agent-hub/run-budget.js +479 -0
  114. package/.versions/1.0.0/.pi/harnesses/agent-hub/run-namespace.js +87 -0
  115. package/.versions/1.0.0/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  116. package/.versions/1.0.0/.pi/harnesses/agent-hub/scope-gate.js +103 -0
  117. package/.versions/1.0.0/.pi/harnesses/agent-hub/session-health.js +110 -0
  118. package/.versions/1.0.0/.pi/harnesses/agent-hub/spawn.ts +354 -0
  119. package/.versions/1.0.0/.pi/harnesses/agent-hub/version.ts +42 -0
  120. package/.versions/1.0.0/.pi/harnesses/ask-user-remote/README.md +53 -0
  121. package/.versions/1.0.0/.pi/harnesses/ask-user-remote/index.ts +477 -0
  122. package/.versions/1.0.0/.pi/harnesses/ask-user-remote/race-core.js +106 -0
  123. package/.versions/1.0.0/.pi/harnesses/coms/README.md +100 -0
  124. package/.versions/1.0.0/.pi/harnesses/coms/index.ts +1767 -0
  125. package/.versions/1.0.0/.pi/harnesses/coms/package.json +7 -0
  126. package/.versions/1.0.0/.pi/harnesses/coms/version.ts +42 -0
  127. package/.versions/1.0.0/.pi/harnesses/damage-control-continue/README.md +124 -0
  128. package/.versions/1.0.0/.pi/harnesses/damage-control-continue/index.ts +536 -0
  129. package/.versions/1.0.0/.pi/harnesses/damage-control-continue/package.json +7 -0
  130. package/.versions/1.0.0/.pi/harnesses/damage-control-continue/version.ts +42 -0
  131. package/.versions/1.0.0/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  132. package/.versions/1.0.0/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  133. package/.versions/1.0.0/.pi/harnesses/lib/fleet-dashboard-ops.ts +118 -0
  134. package/.versions/1.0.0/.pi/harnesses/lib/fleet-dashboard-view.ts +140 -0
  135. package/.versions/1.0.0/.pi/harnesses/lib/fleet-detail-view.ts +43 -0
  136. package/.versions/1.0.0/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  137. package/.versions/1.0.0/.pi/harnesses/lib/fleet-panel.ts +34 -0
  138. package/.versions/1.0.0/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  139. package/.versions/1.0.0/.pi/harnesses/lib/fleet-selection.ts +24 -0
  140. package/.versions/1.0.0/.pi/harnesses/lib/herdr-client.ts +472 -0
  141. package/.versions/1.0.0/.pi/harnesses/lib/herdr-presence.ts +399 -0
  142. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  143. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  144. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  145. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  146. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  147. package/.versions/1.0.0/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  148. package/.versions/1.0.0/.pi/harnesses/lib/spawned-peers.js +190 -0
  149. package/.versions/1.0.0/.pi/harnesses/package-lock.json +2046 -0
  150. package/.versions/1.0.0/.pi/harnesses/package.json +10 -0
  151. package/.versions/1.0.0/.pi/prompts/af-build.md +24 -0
  152. package/{.claude/commands/code-simplify.md → .versions/1.0.0/.pi/prompts/af-code-simplify.md} +3 -3
  153. package/{.claude/commands/plan.md → .versions/1.0.0/.pi/prompts/af-plan.md} +1 -1
  154. package/.versions/{0.0.11/.claude/commands/review.md → 1.0.0/.pi/prompts/af-review.md} +3 -3
  155. package/.versions/1.0.0/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  156. package/.versions/1.0.0/.pi/prompts/af-ship.md +17 -0
  157. package/.versions/{0.0.11/.claude/commands/spec.md → 1.0.0/.pi/prompts/af-spec.md} +1 -1
  158. package/.versions/{0.0.11/.claude/commands/test.md → 1.0.0/.pi/prompts/af-test.md} +2 -2
  159. package/.versions/1.0.0/.pi/skills/bowser/SKILL.md +145 -0
  160. package/.versions/1.0.0/.version +1 -0
  161. package/.versions/1.0.0/agents/architect.md +24 -0
  162. package/.versions/1.0.0/agents/bowser.md +27 -0
  163. package/.versions/1.0.0/agents/builder.md +54 -0
  164. package/.versions/1.0.0/agents/code-reviewer.md +208 -0
  165. package/.versions/1.0.0/agents/deep-researcher.md +32 -0
  166. package/.versions/1.0.0/agents/documenter.md +18 -0
  167. package/.versions/1.0.0/agents/orchestrator.md +72 -0
  168. package/.versions/1.0.0/agents/plan-reviewer.md +83 -0
  169. package/.versions/1.0.0/agents/planner.md +70 -0
  170. package/.versions/1.0.0/agents/releaser.md +24 -0
  171. package/.versions/1.0.0/agents/researcher.md +28 -0
  172. package/.versions/1.0.0/agents/security-auditor.md +167 -0
  173. package/.versions/1.0.0/agents/test-engineer.md +153 -0
  174. package/.versions/1.0.0/agents/web-debugger.md +43 -0
  175. package/.versions/1.0.0/agents/web-performance-auditor.md +193 -0
  176. package/.versions/1.0.0/codex/CONDUCTOR.md +148 -0
  177. package/.versions/1.0.0/docs/ARCHITECTURE.md +337 -0
  178. package/.versions/1.0.0/docs/agent-fleet-setup.md +437 -0
  179. package/.versions/1.0.0/docs/claude-code-coms-bridge.md +128 -0
  180. package/.versions/1.0.0/docs/codex-remote-conductor.md +170 -0
  181. package/.versions/1.0.0/docs/coms-hermes-bridge.md +189 -0
  182. package/.versions/1.0.0/docs/getting-started.md +98 -0
  183. package/.versions/1.0.0/docs/npm-install.md +292 -0
  184. package/.versions/1.0.0/docs/pi-extensions.md +412 -0
  185. package/.versions/1.0.0/docs/pi-setup.md +74 -0
  186. package/.versions/1.0.0/docs/skill-anatomy.md +150 -0
  187. package/.versions/1.0.0/hermes/README.md +347 -0
  188. package/.versions/1.0.0/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  189. package/.versions/1.0.0/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  190. package/.versions/1.0.0/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  191. package/.versions/1.0.0/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  192. package/.versions/1.0.0/hermes/gates/gate-o-capability.md +8 -0
  193. package/.versions/1.0.0/hermes/gates/gate-o-validator-fixtures.json +1 -0
  194. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +770 -0
  195. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  196. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  197. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  198. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  199. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  200. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  201. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  202. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  203. package/.versions/1.0.0/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  204. package/.versions/1.0.0/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  205. package/.versions/1.0.0/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  206. package/.versions/1.0.0/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  207. package/.versions/1.0.0/hermes/skills/hub-conductor/SKILL.md +84 -0
  208. package/.versions/1.0.0/hermes/skills/hub-liaison/SKILL.md +84 -0
  209. package/.versions/1.0.0/hermes/skills/hub-watchdog/SKILL.md +76 -0
  210. package/.versions/1.0.0/hermes/skills/hub-watchdog/manifest.json +1 -0
  211. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  212. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  213. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  214. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  215. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  216. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  217. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  218. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  219. package/.versions/1.0.0/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  220. package/.versions/1.0.0/hermes/watchdog-tests/__init__.py +0 -0
  221. package/.versions/1.0.0/hooks/coms-stop-hook.mjs +84 -0
  222. package/.versions/1.0.0/install-manifest.json +2745 -0
  223. package/.versions/1.0.0/justfile +272 -0
  224. package/.versions/1.0.0/manifest-meta.json +882 -0
  225. package/.versions/1.0.0/references/accessibility-checklist.md +160 -0
  226. package/.versions/1.0.0/references/definition-of-done.md +67 -0
  227. package/.versions/1.0.0/references/fleet-coordination-patterns.md +151 -0
  228. package/.versions/1.0.0/references/observability-checklist.md +91 -0
  229. package/.versions/1.0.0/references/orchestration-patterns.md +370 -0
  230. package/.versions/1.0.0/references/performance-checklist.md +153 -0
  231. package/.versions/1.0.0/references/prompting-patterns.md +380 -0
  232. package/.versions/1.0.0/references/security-checklist.md +179 -0
  233. package/.versions/1.0.0/references/testing-patterns.md +236 -0
  234. package/.versions/1.0.0/scripts/codex-conductor.ts +41 -0
  235. package/.versions/1.0.0/scripts/codex-remote-control.ts +167 -0
  236. package/.versions/1.0.0/scripts/coms-claude-bridge.ts +411 -0
  237. package/.versions/1.0.0/scripts/coms-cli.ts +484 -0
  238. package/.versions/1.0.0/scripts/coms-hermes-bridge.ts +413 -0
  239. package/.versions/1.0.0/scripts/fleet.ts +185 -0
  240. package/.versions/1.0.0/scripts/hermes-monitor-capability-runner.ts +25 -0
  241. package/.versions/1.0.0/scripts/hermes-monitor-scenario.ts +474 -0
  242. package/.versions/1.0.0/scripts/hermes-watchdog-capability-probe.ts +45 -0
  243. package/.versions/1.0.0/scripts/install-hermes-plugin.sh +180 -0
  244. package/.versions/1.0.0/scripts/lib/claude-bridge-core.ts +210 -0
  245. package/.versions/1.0.0/scripts/lib/codex-conductor.ts +88 -0
  246. package/.versions/1.0.0/scripts/lib/codex-remote-control.ts +480 -0
  247. package/.versions/1.0.0/scripts/lib/coms-envelope.ts +582 -0
  248. package/.versions/1.0.0/scripts/lib/fake-herdr-server.ts +88 -0
  249. package/.versions/1.0.0/scripts/lib/fleet-command.ts +266 -0
  250. package/.versions/1.0.0/scripts/lib/herdr-layout.ts +281 -0
  251. package/.versions/1.0.0/scripts/lib/hermes-bridge-core.ts +241 -0
  252. package/.versions/1.0.0/scripts/lib/hermes-monitor-events.ts +1 -0
  253. package/.versions/1.0.0/scripts/lib/hermes-monitor-herdr.ts +2 -0
  254. package/.versions/1.0.0/scripts/lib/hermes-monitor-model.ts +3 -0
  255. package/.versions/1.0.0/scripts/lib/hermes-monitor-registry.ts +2 -0
  256. package/.versions/1.0.0/scripts/lib/hermes-monitor-socket.ts +2 -0
  257. package/.versions/1.0.0/scripts/lib/hermes-monitor-store.ts +2 -0
  258. package/.versions/1.0.0/scripts/lib/monitor-env.ts +146 -0
  259. package/.versions/1.0.0/scripts/lib/peer-launch.ts +318 -0
  260. package/.versions/1.0.0/scripts/lib/persona-banner.ts +62 -0
  261. package/.versions/1.0.0/scripts/lib/spawn-stagger.ts +101 -0
  262. package/.versions/1.0.0/scripts/lib/team-project.ts +213 -0
  263. package/.versions/1.0.0/scripts/lib/team-snapshot.ts +147 -0
  264. package/.versions/1.0.0/scripts/peer-banner.ts +40 -0
  265. package/.versions/1.0.0/scripts/peer-launch.ts +259 -0
  266. package/.versions/1.0.0/scripts/team-snapshot.ts +237 -0
  267. package/.versions/1.0.0/scripts/team-up.ts +406 -0
  268. package/.versions/1.0.0/skills/_internal/grilling.md +11 -0
  269. package/.versions/1.0.0/skills/browser-testing-with-devtools/SKILL.md +351 -0
  270. package/.versions/1.0.0/skills/code-review-and-quality/SKILL.md +381 -0
  271. package/.versions/1.0.0/skills/compound-learning/SKILL.md +137 -0
  272. package/.versions/1.0.0/skills/context-engineering/SKILL.md +291 -0
  273. package/.versions/1.0.0/skills/deprecation-and-migration/SKILL.md +206 -0
  274. package/.versions/1.0.0/skills/designing-agents/SKILL.md +394 -0
  275. package/.versions/1.0.0/skills/designing-agents/pi-harness-authoring.md +222 -0
  276. package/.versions/1.0.0/skills/frontend-ui-engineering/SKILL.md +328 -0
  277. package/.versions/1.0.0/skills/git-workflow-and-versioning/SKILL.md +316 -0
  278. package/.versions/1.0.0/skills/idea-refine/SKILL.md +182 -0
  279. package/.versions/1.0.0/skills/idea-refine/examples.md +238 -0
  280. package/.versions/1.0.0/skills/idea-refine/frameworks.md +99 -0
  281. package/.versions/1.0.0/skills/idea-refine/refinement-criteria.md +113 -0
  282. package/.versions/1.0.0/skills/idea-refine/scripts/idea-refine.sh +15 -0
  283. package/.versions/1.0.0/skills/incremental-implementation/SKILL.md +287 -0
  284. package/.versions/1.0.0/skills/interview-me/SKILL.md +226 -0
  285. package/.versions/1.0.0/skills/orchestration-verification/SKILL.md +181 -0
  286. package/.versions/1.0.0/skills/peer-coms/SKILL.md +90 -0
  287. package/.versions/1.0.0/skills/performance-optimization/SKILL.md +350 -0
  288. package/.versions/1.0.0/skills/planning-and-task-breakdown/SKILL.md +254 -0
  289. package/.versions/1.0.0/skills/security-and-hardening/SKILL.md +461 -0
  290. package/.versions/1.0.0/skills/spec-driven-development/SKILL.md +257 -0
  291. package/.versions/1.0.0/skills/using-agent-skills/SKILL.md +199 -0
  292. package/.versions/1.0.0/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
  293. package/.versions/1.0.0/vendor/agent-skills-upstream/LICENSE +21 -0
  294. package/.versions/1.0.0/vendor/agent-skills-upstream/README.md +11 -0
  295. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +294 -0
  296. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  297. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  298. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  299. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  300. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +289 -0
  301. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  302. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  303. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +278 -0
  304. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  305. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  306. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  307. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  308. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  309. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  310. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  311. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  312. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  313. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  314. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +203 -0
  315. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +350 -0
  316. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +234 -0
  317. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +467 -0
  318. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +310 -0
  319. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +194 -0
  320. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +206 -0
  321. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +383 -0
  322. package/.versions/1.0.0/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +191 -0
  323. package/CHANGELOG.md +142 -0
  324. package/README.md +117 -79
  325. package/agents/orchestrator.md +1 -1
  326. package/bin/cli.js +289 -359
  327. package/bin/force-patch-changesets.js +18 -2
  328. package/bin/lib/apply.js +86 -32
  329. package/bin/lib/desired.js +87 -0
  330. package/bin/lib/detect-agent.js +22 -38
  331. package/bin/lib/doctor.js +283 -33
  332. package/bin/lib/features.js +78 -0
  333. package/bin/lib/manifest.js +127 -48
  334. package/bin/lib/overrides.js +35 -0
  335. package/bin/lib/personas.js +37 -0
  336. package/bin/lib/plan.js +18 -9
  337. package/bin/lib/purge.js +11 -0
  338. package/bin/lib/reconcile.js +68 -0
  339. package/bin/lib/scan.js +24 -0
  340. package/bin/lib/state.js +25 -1
  341. package/bin/lib/stt-wizard.js +33 -0
  342. package/bin/lib/transaction.js +149 -0
  343. package/bin/lib/tui.js +71 -0
  344. package/bin/lib/verify.js +9 -26
  345. package/bin/snapshot-version.js +3 -6
  346. package/docs/ARCHITECTURE.md +55 -21
  347. package/docs/MIGRATION-agent-fleet.md +222 -0
  348. package/docs/agent-fleet-setup.md +124 -64
  349. package/docs/claude-code-coms-bridge.md +21 -2
  350. package/docs/coms-hermes-bridge.md +1 -1
  351. package/docs/getting-started.md +61 -217
  352. package/docs/npm-install.md +207 -429
  353. package/docs/pi-extensions.md +85 -41
  354. package/docs/pi-setup.md +48 -545
  355. package/hermes/README.md +1 -1
  356. package/install-manifest.json +385 -1255
  357. package/justfile +45 -27
  358. package/manifest-meta.json +544 -134
  359. package/node_modules/pi-ask-user/README.md +43 -5
  360. package/node_modules/pi-ask-user/index.ts +630 -75
  361. package/node_modules/pi-ask-user/package.json +1 -1
  362. package/package.json +5 -11
  363. package/scripts/coms-claude-bridge.ts +10 -0
  364. package/scripts/fleet.ts +107 -90
  365. package/scripts/lib/claude-bridge-core.ts +45 -0
  366. package/scripts/lib/fleet-command.ts +170 -15
  367. package/scripts/lib/monitor-env.ts +18 -6
  368. package/scripts/lib/peer-launch.ts +6 -2
  369. package/scripts/lib/team-project.ts +24 -4
  370. package/scripts/team-up.ts +57 -11
  371. package/skills/designing-agents/SKILL.md +1 -1
  372. package/skills/designing-agents/pi-harness-authoring.md +3 -3
  373. package/.claude/commands/build.md +0 -44
  374. package/.claude/commands/design-agent.md +0 -14
  375. package/.claude/commands/doctor-agent-fleet.md +0 -22
  376. package/.claude/commands/orchestrate.md +0 -112
  377. package/.claude/commands/prime.md +0 -22
  378. package/.claude/commands/review.md +0 -16
  379. package/.claude/commands/set-hermes-telegram.md +0 -15
  380. package/.claude/commands/set-hermes-watchdog.md +0 -6
  381. package/.claude/commands/setup-agent-fleet.md +0 -17
  382. package/.claude/commands/ship.md +0 -72
  383. package/.claude/commands/spec.md +0 -15
  384. package/.claude/commands/test.md +0 -19
  385. package/.claude/commands/webperf.md +0 -32
  386. package/.claude/orchestrate-teams.yaml +0 -24
  387. package/.opencode/commands/af-build.md +0 -17
  388. package/.opencode/commands/af-code-simplify.md +0 -16
  389. package/.opencode/commands/af-compound.md +0 -16
  390. package/.opencode/commands/af-design-agent.md +0 -15
  391. package/.opencode/commands/af-doctor-agent-fleet.md +0 -22
  392. package/.opencode/commands/af-orchestrate.md +0 -112
  393. package/.opencode/commands/af-plan.md +0 -16
  394. package/.opencode/commands/af-prime.md +0 -22
  395. package/.opencode/commands/af-review.md +0 -15
  396. package/.opencode/commands/af-set-hermes-watchdog.md +0 -6
  397. package/.opencode/commands/af-setup-agent-fleet.md +0 -17
  398. package/.opencode/commands/af-ship.md +0 -16
  399. package/.opencode/commands/af-spec.md +0 -16
  400. package/.opencode/commands/af-test.md +0 -21
  401. package/.opencode/commands/af-webperf.md +0 -32
  402. package/.opencode/orchestrate-teams.yaml +0 -24
  403. package/.pi/prompts/af-doctor-agent-fleet.md +0 -22
  404. package/.pi/prompts/af-setup-agent-fleet.md +0 -19
  405. package/.versions/0.0.1/.opencode/commands/af-doctor-agent-fleet.md +0 -15
  406. package/.versions/0.0.1/.opencode/commands/af-setup-agent-fleet.md +0 -15
  407. package/.versions/0.0.1/skills/guided-workspace-setup/SKILL.md +0 -506
  408. package/.versions/0.0.10/.opencode/commands/af-doctor-agent-fleet.md +0 -22
  409. package/.versions/0.0.10/.opencode/commands/af-setup-agent-fleet.md +0 -17
  410. package/.versions/0.0.10/.pi/prompts/af-doctor-agent-fleet.md +0 -22
  411. package/.versions/0.0.10/.pi/prompts/af-setup-agent-fleet.md +0 -19
  412. package/.versions/0.0.10/skills/guided-workspace-setup/SKILL.md +0 -226
  413. package/.versions/0.0.11/.claude/commands/build.md +0 -44
  414. package/.versions/0.0.11/.claude/commands/code-simplify.md +0 -22
  415. package/.versions/0.0.11/.claude/commands/design-agent.md +0 -14
  416. package/.versions/0.0.11/.claude/commands/doctor-agent-fleet.md +0 -22
  417. package/.versions/0.0.11/.claude/commands/orchestrate.md +0 -112
  418. package/.versions/0.0.11/.claude/commands/plan.md +0 -16
  419. package/.versions/0.0.11/.claude/commands/prime.md +0 -22
  420. package/.versions/0.0.11/.claude/commands/set-hermes-telegram.md +0 -15
  421. package/.versions/0.0.11/.claude/commands/set-hermes-watchdog.md +0 -6
  422. package/.versions/0.0.11/.claude/commands/setup-agent-fleet.md +0 -17
  423. package/.versions/0.0.11/.claude/commands/ship.md +0 -72
  424. package/.versions/0.0.11/.claude/commands/webperf.md +0 -32
  425. package/.versions/0.0.11/.claude/orchestrate-teams.yaml +0 -24
  426. package/.versions/0.0.11/.opencode/commands/af-build.md +0 -17
  427. package/.versions/0.0.11/.opencode/commands/af-code-simplify.md +0 -16
  428. package/.versions/0.0.11/.opencode/commands/af-compound.md +0 -16
  429. package/.versions/0.0.11/.opencode/commands/af-design-agent.md +0 -15
  430. package/.versions/0.0.11/.opencode/commands/af-doctor-agent-fleet.md +0 -22
  431. package/.versions/0.0.11/.opencode/commands/af-orchestrate.md +0 -112
  432. package/.versions/0.0.11/.opencode/commands/af-plan.md +0 -16
  433. package/.versions/0.0.11/.opencode/commands/af-prime.md +0 -22
  434. package/.versions/0.0.11/.opencode/commands/af-review.md +0 -15
  435. package/.versions/0.0.11/.opencode/commands/af-set-hermes-telegram.md +0 -15
  436. package/.versions/0.0.11/.opencode/commands/af-set-hermes-watchdog.md +0 -6
  437. package/.versions/0.0.11/.opencode/commands/af-setup-agent-fleet.md +0 -17
  438. package/.versions/0.0.11/.opencode/commands/af-ship.md +0 -16
  439. package/.versions/0.0.11/.opencode/commands/af-spec.md +0 -16
  440. package/.versions/0.0.11/.opencode/commands/af-test.md +0 -21
  441. package/.versions/0.0.11/.opencode/commands/af-webperf.md +0 -32
  442. package/.versions/0.0.11/.opencode/orchestrate-teams.yaml +0 -24
  443. package/.versions/0.0.11/.pi/prompts/af-doctor-agent-fleet.md +0 -22
  444. package/.versions/0.0.11/.pi/prompts/af-setup-agent-fleet.md +0 -19
  445. package/.versions/0.0.11/docs/opencode-setup.md +0 -281
  446. package/.versions/0.0.11/hooks/SIMPLIFY-IGNORE.md +0 -90
  447. package/.versions/0.0.11/hooks/hooks.json +0 -14
  448. package/.versions/0.0.11/hooks/session-start.sh +0 -74
  449. package/.versions/0.0.11/hooks/simplify-ignore.sh +0 -302
  450. package/.versions/0.0.11/skills/guided-workspace-setup/SKILL.md +0 -226
  451. package/.versions/0.0.4/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  452. package/.versions/0.0.4/.opencode/commands/af-setup-agent-fleet.md +0 -15
  453. package/.versions/0.0.4/skills/guided-workspace-setup/SKILL.md +0 -535
  454. package/.versions/0.0.4/skills/guided-workspace-setup/companion-manifest.json +0 -33
  455. package/.versions/0.0.5/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  456. package/.versions/0.0.5/.opencode/commands/af-setup-agent-fleet.md +0 -15
  457. package/.versions/0.0.5/skills/guided-workspace-setup/SKILL.md +0 -542
  458. package/.versions/0.0.5/skills/guided-workspace-setup/companion-manifest.json +0 -35
  459. package/.versions/0.0.6/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  460. package/.versions/0.0.6/.opencode/commands/af-setup-agent-fleet.md +0 -15
  461. package/.versions/0.0.6/.pi/prompts/af-doctor-agent-fleet.md +0 -15
  462. package/.versions/0.0.6/.pi/prompts/af-setup-agent-fleet.md +0 -27
  463. package/.versions/0.0.6/skills/guided-workspace-setup/SKILL.md +0 -544
  464. package/.versions/0.0.6/skills/guided-workspace-setup/companion-manifest.json +0 -35
  465. package/.versions/0.0.7/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  466. package/.versions/0.0.7/.opencode/commands/af-setup-agent-fleet.md +0 -15
  467. package/.versions/0.0.7/.pi/prompts/af-doctor-agent-fleet.md +0 -15
  468. package/.versions/0.0.7/.pi/prompts/af-setup-agent-fleet.md +0 -27
  469. package/.versions/0.0.7/skills/guided-workspace-setup/SKILL.md +0 -544
  470. package/.versions/0.0.7/skills/guided-workspace-setup/companion-manifest.json +0 -35
  471. package/.versions/0.0.8/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  472. package/.versions/0.0.8/.opencode/commands/af-setup-agent-fleet.md +0 -15
  473. package/.versions/0.0.8/.pi/prompts/af-doctor-agent-fleet.md +0 -15
  474. package/.versions/0.0.8/.pi/prompts/af-setup-agent-fleet.md +0 -27
  475. package/.versions/0.0.8/skills/guided-workspace-setup/SKILL.md +0 -544
  476. package/.versions/0.0.8/skills/guided-workspace-setup/companion-manifest.json +0 -36
  477. package/.versions/0.0.9/.opencode/commands/af-doctor-agent-fleet.md +0 -17
  478. package/.versions/0.0.9/.opencode/commands/af-setup-agent-fleet.md +0 -15
  479. package/.versions/0.0.9/.pi/prompts/af-doctor-agent-fleet.md +0 -15
  480. package/.versions/0.0.9/.pi/prompts/af-setup-agent-fleet.md +0 -27
  481. package/.versions/0.0.9/skills/guided-workspace-setup/SKILL.md +0 -544
  482. package/bin/lib/bootstrap.js +0 -323
  483. package/bin/lib/transform-persona.js +0 -180
  484. package/docs/opencode-setup.md +0 -281
  485. package/hooks/SIMPLIFY-IGNORE.md +0 -90
  486. package/hooks/hooks.json +0 -14
  487. package/hooks/session-start.sh +0 -74
  488. package/hooks/simplify-ignore.sh +0 -302
  489. package/skills/guided-workspace-setup/SKILL.md +0 -226
  490. /package/.versions/0.0.10/{skills/guided-workspace-setup/companion-manifest.json → bin/catalog/harness-runtime-closure.json} +0 -0
  491. /package/.versions/0.0.11/{skills/guided-workspace-setup/companion-manifest.json → bin/catalog/harness-runtime-closure.json} +0 -0
  492. /package/{.opencode/commands → .versions/1.0.0/.pi/prompts}/af-set-hermes-telegram.md +0 -0
  493. /package/.versions/{0.0.9/skills/guided-workspace-setup/companion-manifest.json → 1.0.0/bin/catalog/harness-runtime-closure.json} +0 -0
  494. /package/{skills/guided-workspace-setup/companion-manifest.json → bin/catalog/harness-runtime-closure.json} +0 -0
@@ -9,6 +9,11 @@
9
9
  // and the CI release workflow's changesets/action `version` command, so local
10
10
  // and CI releases agree. Remove this step (and the `minor|major` lines stay
11
11
  // honored) if you ever want changeset-authored semver back.
12
+ //
13
+ // Escape hatch: a changeset carrying KEEP_BUMP_MARKER in its body keeps the
14
+ // bump it was authored with. Reserved for releases where the version number
15
+ // is itself the signal — a removed runtime, a retired command, an install-record
16
+ // break — and a silent patch bump would tell users nothing.
12
17
 
13
18
  import { readdirSync, readFileSync, writeFileSync } from "node:fs";
14
19
  import { fileURLToPath } from "node:url";
@@ -21,7 +26,13 @@ const changesetDir = resolve(__dirname, "..", ".changeset");
21
26
  // Only the value after the colon is rewritten; the package name is preserved.
22
27
  const BUMP_LINE = /^(\s*(?:"[^"]+"|[^:\s]+)\s*:\s*)(minor|major)(\s*)$/gm;
23
28
 
29
+ // Opt out of the forced downgrade. A YAML comment in the frontmatter: the
30
+ // changesets parser ignores it, and it stays out of the body — so the
31
+ // generated CHANGELOG entry reads as written, with no marker line in it.
32
+ const KEEP_BUMP_MARKER = "# release: keep-bump";
33
+
24
34
  let changed = 0;
35
+ let kept = 0;
25
36
  let scanned = 0;
26
37
 
27
38
  for (const name of readdirSync(changesetDir)) {
@@ -29,6 +40,11 @@ for (const name of readdirSync(changesetDir)) {
29
40
  scanned++;
30
41
  const file = join(changesetDir, name);
31
42
  const text = readFileSync(file, "utf8");
43
+ if (text.includes(KEEP_BUMP_MARKER)) {
44
+ kept++;
45
+ console.log(`force-patch: ${name} → kept (opted out via keep-bump marker)`);
46
+ continue;
47
+ }
32
48
  const next = text.replace(BUMP_LINE, "$1patch$3");
33
49
  if (next !== text) {
34
50
  writeFileSync(file, next, "utf8");
@@ -39,6 +55,6 @@ for (const name of readdirSync(changesetDir)) {
39
55
 
40
56
  console.log(
41
57
  changed > 0
42
- ? `force-patch: rewrote ${changed} of ${scanned} changeset(s) to patch`
43
- : `force-patch: no minor/major changesets to downgrade (${scanned} scanned)`,
58
+ ? `force-patch: rewrote ${changed} of ${scanned} changeset(s) to patch${kept > 0 ? `, kept ${kept}` : ""}`
59
+ : `force-patch: no minor/major changesets to downgrade (${scanned} scanned${kept > 0 ? `, ${kept} kept` : ""})`,
44
60
  );
package/bin/lib/apply.js CHANGED
@@ -27,14 +27,37 @@ import { dirname, join, resolve } from "node:path";
27
27
  import { itemsForAgent } from "./manifest.js";
28
28
  import { expandBinding } from "./verify.js";
29
29
  import { extractRegion, replaceRegion, stripRegion, leafPaths, setPath, canonicalJson } from "./merge-forms.js";
30
- import { transformPersona } from "./transform-persona.js";
30
+ import { runTransaction } from "./transaction.js";
31
+ import { renderDesired } from "./desired.js";
31
32
  import {
32
33
  readState, writeState, emptyState, hashFile, hashText, walkTree,
33
- inspectPath, isInside, STATE_REL_PATH, LEGACY_RECORD_REL_PATH,
34
+ inspectPath, isInside, linkPointsInside, STATE_REL_PATH, LEGACY_RECORD_REL_PATH,
34
35
  } from "./state.js";
35
36
 
36
37
  export const APPLY_SCHEMA_VERSION = 1;
37
38
 
39
+ /** Retry only commands recorded after a previous post-commit runtime failure. */
40
+ export function retryRuntimeRepairs({ workspace, output = console.log }) {
41
+ const state = readState(workspace);
42
+ const pending = state?.runtimeRepairs ?? [];
43
+ if (pending.length === 0) return { attempted: 0, remaining: [] };
44
+
45
+ const remaining = [];
46
+ for (const repair of pending) {
47
+ const command = `${repair.command} ${(repair.args ?? []).join(" ")}`.trim();
48
+ output(command);
49
+ const run = spawnSync(repair.command, repair.args ?? [], {
50
+ cwd: insideWorkspace(workspace, repair.cwd ?? "."), stdio: "pipe", encoding: "utf8",
51
+ });
52
+ if (run.status !== 0) {
53
+ remaining.push({ ...repair, status: run.status ?? "signal", stderr: (run.stderr ?? "").trim() });
54
+ }
55
+ }
56
+ state.runtimeRepairs = remaining;
57
+ writeState(workspace, state);
58
+ return { attempted: pending.length, remaining };
59
+ }
60
+
38
61
  /**
39
62
  * Execute a plan against its workspace.
40
63
  *
@@ -45,7 +68,53 @@ export const APPLY_SCHEMA_VERSION = 1;
45
68
  * @param {() => string} [opts.now] injectable clock, for deterministic tests
46
69
  * @returns {object} result
47
70
  */
48
- export function applyPlan({ plan, manifest, allowExec = false, now = () => new Date().toISOString() }) {
71
+ export function applyPlan({ plan, manifest, allowExec = false, now = () => new Date().toISOString(), output = console.log, failAt = null }) {
72
+ const validate = () => {
73
+ if (plan.migrationBlocked) throw Object.assign(new Error(plan.migrationError), { exitCode: 1 });
74
+ if (plan.snapshotMetadataError) throw Object.assign(new Error(plan.snapshotMetadataError), { exitCode: 1 });
75
+ if ((plan.conflicts ?? []).length) throw Object.assign(new Error("unresolved conflicts"), { exitCode: 3 });
76
+ };
77
+ let result;
78
+ try {
79
+ result = runTransaction({ workspace: plan.workspace, plan, manifest, validate, failAt, commit: () => {
80
+ if (plan.writeDesired) writeFileSyncDeep(join(plan.workspace, ".ai", "agent-fleet.json"), renderDesired(plan.desired));
81
+ if (plan.overrides?.write) writeFileSyncDeep(plan.overrides.path, plan.overrides.text);
82
+ if (plan.stt) {
83
+ writeFileSyncDeep(plan.stt.path, plan.stt.text);
84
+ if (plan.stt.env.missing.length) writeFileSyncDeep(plan.stt.env.path, plan.stt.env.text);
85
+ }
86
+ return applyImmediate({ plan, manifest, allowExec: false, now });
87
+ } });
88
+ } catch (error) {
89
+ return { schemaVersion: APPLY_SCHEMA_VERSION, workspace: plan.workspace, verb: plan.verb,
90
+ results: [], conflictFiles: [], failure: { status: "failed", detail: error.message },
91
+ exitCode: error.exitCode ?? 1, summary: { applied: 0, failed: 1 } };
92
+ }
93
+ if (!allowExec) return { ...result, exitCode: 0 };
94
+
95
+ const repairs = [];
96
+ for (const action of plan.actions.filter((entry) => entry.kind === "exec")) {
97
+ const item = new Map(itemsForAgent(manifest, plan.agent).map((entry) => [entry.id, entry])).get(action.id);
98
+ const spec = item?.exec;
99
+ if (!spec) continue;
100
+ const command = `${spec.command} ${(spec.args ?? []).join(" ")}`.trim();
101
+ output(command);
102
+ const run = spawnSync(spec.command, spec.args ?? [], { cwd: insideWorkspace(plan.workspace, spec.cwd ?? "."), stdio: "pipe", encoding: "utf8" });
103
+ if (run.status !== 0) repairs.push({ id: action.id, command: spec.command, args: spec.args ?? [], cwd: spec.cwd ?? ".", display: command, status: run.status ?? "signal", stderr: (run.stderr ?? "").trim() });
104
+ }
105
+ if (repairs.length) {
106
+ const state = readState(plan.workspace);
107
+ state.runtimeRepairs = repairs;
108
+ writeState(plan.workspace, state);
109
+ return { ...result, exitCode: 1, runtimeRepairs: repairs };
110
+ }
111
+ const results = result.results.map((entry) => plan.actions.some((action) => action.id === entry.id && action.kind === "exec")
112
+ ? { ...entry, status: "applied", detail: "command ran after file commit" }
113
+ : entry);
114
+ return { ...result, results, exitCode: 0, runtimeRepairs: [] };
115
+ }
116
+
117
+ function applyImmediate({ plan, manifest, allowExec = false, now = () => new Date().toISOString() }) {
49
118
  const { workspace, sourceRoot, agent, method, packageVersion } = plan;
50
119
  const catalogue = new Map(itemsForAgent(manifest, agent).map((i) => [i.id, i]));
51
120
  const previous = readState(workspace);
@@ -83,8 +152,14 @@ export function applyPlan({ plan, manifest, allowExec = false, now = () => new D
83
152
  }
84
153
  }
85
154
 
86
- // Record the pass even on failure — see the header note.
87
- state.packageVersion = failed ? (previous?.packageVersion ?? packageVersion) : packageVersion;
155
+ // An apply failure is a transaction failure, not a partially successful
156
+ // installation. Throw before recording state so runTransaction restores every
157
+ // managed path (including desired state) to its exact pre-image.
158
+ if (failed) {
159
+ throw Object.assign(new Error(`${failed.id}: ${failed.detail}`), { actionFailure: failed });
160
+ }
161
+
162
+ state.packageVersion = packageVersion;
88
163
  state.updatedAt = now();
89
164
  state.installedAt ??= state.updatedAt;
90
165
  state.events = [...(state.events ?? []), {
@@ -235,7 +310,7 @@ function materialize({ item, workspace, sourceRoot, method, agent }) {
235
310
  const pairs = expandBinding(binding, sourceRoot);
236
311
  if (pairs.length === 0) throw new Error(`no source available for ${item.id}`);
237
312
 
238
- const link = method === "symlink" && binding.strategy !== "transform-persona";
313
+ const link = method === "symlink";
239
314
  const files = [];
240
315
 
241
316
  for (const pair of pairs) {
@@ -249,13 +324,6 @@ function materialize({ item, workspace, sourceRoot, method, agent }) {
249
324
  continue;
250
325
  }
251
326
 
252
- if (binding.strategy === "transform-persona") {
253
- const { content } = transformPersona(readFileSync(pair.sourceAbs, "utf8"), { agent });
254
- writeFileSyncDeep(targetAbs, content);
255
- files.push({ path: pair.targetRel, mode: "generated", sha256: hashText(content) });
256
- continue;
257
- }
258
-
259
327
  if (pair.isDir) {
260
328
  for (const rel of walkTree(pair.sourceAbs)) {
261
329
  const dest = insideWorkspace(workspace, `${pair.targetRel}/${rel}`);
@@ -290,11 +358,7 @@ function retireLegacyTargets({ item, workspace, sourceRoot, agent }) {
290
358
 
291
359
  const sourceRel = (item.binding.source ?? [])[0];
292
360
  const sourceAbs = sourceRel ? join(sourceRoot, sourceRel) : null;
293
- const ours = sourceAbs && existsSync(sourceAbs)
294
- ? (item.binding.strategy === "transform-persona"
295
- ? hashText(transformPersona(readFileSync(sourceAbs, "utf8"), { agent }).content)
296
- : hashFile(sourceAbs))
297
- : null;
361
+ const ours = sourceAbs && existsSync(sourceAbs) ? hashFile(sourceAbs) : null;
298
362
 
299
363
  const retired = [];
300
364
  for (const rel of legacy) {
@@ -302,7 +366,7 @@ function retireLegacyTargets({ item, workspace, sourceRoot, agent }) {
302
366
  const found = inspectPath(abs);
303
367
  if (found.kind === "absent") continue;
304
368
  if (found.kind === "symlink") {
305
- if (!found.dangling && !isInside(sourceRoot, found.linkTarget)) continue;
369
+ if (!found.dangling && !linkPointsInside(sourceRoot, found.linkTarget)) continue;
306
370
  unlinkSync(abs);
307
371
  retired.push(rel);
308
372
  continue;
@@ -355,11 +419,7 @@ function inventory({ item, workspace, sourceRoot }) {
355
419
  }
356
420
  continue;
357
421
  }
358
- files.push({
359
- path: pair.targetRel,
360
- mode: item.binding.strategy === "transform-persona" ? "generated" : "copy",
361
- sha256: hashFile(targetAbs),
362
- });
422
+ files.push({ path: pair.targetRel, mode: "copy", sha256: hashFile(targetAbs) });
363
423
  }
364
424
  return { files };
365
425
  }
@@ -442,12 +502,7 @@ function writeConflictCopies({ item, action, workspace, sourceRoot, agent }) {
442
502
  }
443
503
  continue;
444
504
  }
445
- emit(
446
- pair.targetRel,
447
- item.binding.strategy === "transform-persona"
448
- ? transformPersona(readFileSync(pair.sourceAbs, "utf8"), { agent }).content
449
- : readFileSync(pair.sourceAbs),
450
- );
505
+ emit(pair.targetRel, readFileSync(pair.sourceAbs));
451
506
  }
452
507
  return written;
453
508
  }
@@ -473,7 +528,7 @@ function removeItem({ id, state, workspace, sourceRoot }) {
473
528
  if (found.kind === "absent") continue;
474
529
 
475
530
  if (found.kind === "symlink") {
476
- if (!isInside(sourceRoot, found.linkTarget) && !found.dangling) { kept.push(file.path); continue; }
531
+ if (!linkPointsInside(sourceRoot, found.linkTarget) && !found.dangling) { kept.push(file.path); continue; }
477
532
  unlinkSync(abs); // not rmSync — see clearTarget() on dangling links
478
533
  removed++;
479
534
  continue;
@@ -617,7 +672,6 @@ function pruneEmptyDirs(workspace, relPaths) {
617
672
 
618
673
  function methodFor(item, method) {
619
674
  const strategy = item.binding.strategy;
620
- if (strategy === "transform-persona") return "generated";
621
675
  if (strategy === "managed-region" || strategy === "json-merge") return strategy;
622
676
  return method;
623
677
  }
@@ -0,0 +1,87 @@
1
+ // desired.js — strict, human-owned desired-state configuration.
2
+
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { featureNames, normalizeFeatureSet } from "./features.js";
6
+
7
+ export const DESIRED_SCHEMA_VERSION = 1;
8
+ export const DESIRED_FILE = ".ai/agent-fleet.json";
9
+
10
+ export function defaultDesired(manifest) {
11
+ return {
12
+ schemaVersion: DESIRED_SCHEMA_VERSION,
13
+ preset: "default",
14
+ features: Object.fromEntries(featureNames(manifest).map((name) => [name, false])),
15
+ };
16
+ }
17
+
18
+ export function validateDesired(value, manifest) {
19
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("desired config must be an object");
20
+ if (value.schemaVersion !== DESIRED_SCHEMA_VERSION) throw new Error(`desired schemaVersion must be ${DESIRED_SCHEMA_VERSION}`);
21
+ if (!manifest.presets?.[value.preset]) throw new Error(`unknown preset "${value.preset}"`);
22
+ if (!value.features || typeof value.features !== "object" || Array.isArray(value.features)) throw new Error("desired features must be an object");
23
+ const known = new Set(featureNames(manifest));
24
+ for (const [name, enabled] of Object.entries(value.features)) {
25
+ if (!known.has(name)) throw new Error(`unknown feature "${name}"`);
26
+ if (typeof enabled !== "boolean") throw new Error(`desired feature "${name}" must be boolean`);
27
+ }
28
+ return {
29
+ schemaVersion: DESIRED_SCHEMA_VERSION,
30
+ preset: value.preset,
31
+ features: Object.fromEntries(featureNames(manifest).map((name) => [name, value.features[name] ?? false])),
32
+ };
33
+ }
34
+
35
+ export function readDesired(workspace, manifest) {
36
+ const path = join(workspace, DESIRED_FILE);
37
+ if (!existsSync(path)) return null;
38
+ let parsed;
39
+ try { parsed = JSON.parse(readFileSync(path, "utf8")); }
40
+ catch (error) { throw new Error(`invalid desired config ${DESIRED_FILE}: ${error.message}`); }
41
+ return validateDesired(parsed, manifest);
42
+ }
43
+
44
+ function explicitFeatures(manifest, features) {
45
+ if (features === undefined || features === null) return null;
46
+ const enabled = new Set(normalizeFeatureSet(manifest, features));
47
+ return Object.fromEntries(featureNames(manifest).map((name) => [name, enabled.has(name)]));
48
+ }
49
+
50
+ /**
51
+ * Apply CLI/TUI precedence without writing the human-owned file. Phase 2 stages
52
+ * `renderDesired()` only when `writeDesired` is true and its transaction commits.
53
+ */
54
+ export function resolveDesiredState({
55
+ workspace,
56
+ manifest,
57
+ preset = undefined,
58
+ features = undefined,
59
+ saveDesired = false,
60
+ tuiDesired = null,
61
+ dryRun = false,
62
+ } = {}) {
63
+ const existing = readDesired(workspace, manifest);
64
+ const base = existing ?? defaultDesired(manifest);
65
+ const cliFeatures = explicitFeatures(manifest, features);
66
+ const effective = tuiDesired
67
+ ? validateDesired(tuiDesired, manifest)
68
+ : {
69
+ ...base,
70
+ ...(preset === undefined ? {} : { preset }),
71
+ ...(cliFeatures === null ? {} : { features: cliFeatures }),
72
+ };
73
+ const desired = validateDesired(effective, manifest);
74
+ const hasOverride = preset !== undefined || cliFeatures !== null;
75
+ return {
76
+ desired,
77
+ existing,
78
+ path: join(workspace, DESIRED_FILE),
79
+ // Missing desired state must be staged on a successful non-dry run. Existing
80
+ // config only changes via explicit persistence or confirmed TUI editing.
81
+ writeDesired: !dryRun && (!existing || Boolean(tuiDesired) || (hasOverride && saveDesired)),
82
+ };
83
+ }
84
+
85
+ export function renderDesired(desired) {
86
+ return JSON.stringify(desired, null, 2) + "\n";
87
+ }
@@ -1,49 +1,33 @@
1
- // Agent detection — used by `agent-fleet init` to pick a sensible default
2
- // for the coding agent. The user can always override with --agent.
1
+ // Coding agent identity for the installer.
2
+ //
3
+ // pi is the only coding agent Agent Fleet installs for. Claude Code still
4
+ // appears in the fleet, but strictly as a coms peer driven by
5
+ // scripts/coms-claude-bridge.ts — never as an install target. See
6
+ // docs/claude-code-coms-bridge.md.
7
+ //
8
+ // The list and the detection hook stay because the manifest, the state file,
9
+ // and every CLI verb are written per-agent: a second runtime would be a new
10
+ // entry here, not a reshape of the engine.
3
11
 
4
- import { existsSync } from "node:fs";
5
- import { join } from "node:path";
12
+ export const AGENTS = ["pi"];
6
13
 
7
- export const AGENTS = ["claude-code", "opencode", "pi"];
14
+ export const DEFAULT_AGENT = "pi";
8
15
 
9
16
  const LABELS = {
10
- "claude-code": "Claude Code",
11
- "opencode": "OpenCode",
12
- "pi": "pi",
17
+ "pi": "pi",
13
18
  };
14
19
 
15
20
  export function agentLabel(agent) {
16
21
  return LABELS[agent] ?? agent;
17
22
  }
18
23
 
19
- // Detection precedence (default):
20
- // 1. Explicit env vars from the coding agent runtime
21
- // 2. Workspace directory hints (.claude/ / .opencode/ / .pi/)
22
- // 3. Null — let the caller prompt
23
- //
24
- // `preferWorkspaceHints` flips 1 and 2. `update` uses it: the question there
25
- // is "which agent is *this workspace* configured for?", not "which agent am I
26
- // running inside?" — so a pi workspace must not resolve to claude-code just
27
- // because `update` was invoked from a Claude Code shell.
28
- export function detectAgent({ workspace, env = process.env, preferWorkspaceHints = false } = {}) {
29
- const byEnv = () => {
30
- if (env.CLAUDECODE === "1" || env.CLAUDE_CODE_ENTRYPOINT) return "claude-code";
31
- if (env.OPENCODE === "1" || env.OPENCODE_VERSION) return "opencode";
32
- if (env.PI === "1" || env.PI_SESSION_ID) return "pi";
33
- return null;
34
- };
35
-
36
- const byWorkspace = () => {
37
- // Only one match → pick it; multiple → don't guess.
38
- if (!workspace) return null;
39
- const hits = [];
40
- if (existsSync(join(workspace, ".claude"))) hits.push("claude-code");
41
- if (existsSync(join(workspace, ".opencode"))) hits.push("opencode");
42
- if (existsSync(join(workspace, ".pi"))) hits.push("pi");
43
- return hits.length === 1 ? hits[0] : null;
44
- };
45
-
46
- return preferWorkspaceHints
47
- ? (byWorkspace() ?? byEnv())
48
- : (byEnv() ?? byWorkspace());
24
+ /**
25
+ * Resolve the coding agent for a workspace.
26
+ *
27
+ * With a single supported runtime there is nothing to detect — every caller
28
+ * gets `pi`. The signature is unchanged so call sites keep reading as "ask,
29
+ * don't assume" if a second agent is ever added back.
30
+ */
31
+ export function detectAgent() {
32
+ return DEFAULT_AGENT;
49
33
  }