@chankov/agent-fleet 2.1.2 → 2.2.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 (2330) hide show
  1. package/.pi/agent-fleet/hooks/coms-stop-hook.mjs +53 -13
  2. package/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  3. package/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  4. package/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +4 -0
  5. package/.pi/agent-fleet/scripts/fleet.ts +13 -17
  6. package/.pi/agent-fleet/scripts/flow.ts +2 -2
  7. package/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  8. package/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  9. package/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  10. package/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  11. package/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  12. package/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  13. package/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  14. package/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +20 -13
  15. package/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  16. package/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  17. package/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  18. package/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  19. package/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +23 -13
  20. package/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +100 -14
  21. package/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +1 -1
  22. package/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  23. package/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +9 -3
  24. package/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +32 -16
  25. package/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +41 -21
  26. package/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +21 -0
  27. package/.pi/agent-fleet/scripts/lib/fleet-command.ts +4 -8
  28. package/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +2 -1
  29. package/.pi/agent-fleet/scripts/lib/team-project.ts +0 -2
  30. package/.pi/agent-fleet/scripts/team-up.ts +5 -12
  31. package/.pi/agent-fleet/scripts/workflows/lib/git.ts +9 -0
  32. package/.pi/agent-fleet/scripts/workflows/lib/quality.ts +17 -4
  33. package/.pi/agents/model-profiles.yaml +0 -2
  34. package/.pi/harnesses/agent-hub/README.md +124 -67
  35. package/.pi/harnesses/agent-hub/capability-packs.ts +7 -4
  36. package/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  37. package/.pi/harnesses/agent-hub/commands/context.ts +0 -4
  38. package/.pi/harnesses/agent-hub/commands/recover.ts +2 -1
  39. package/.pi/harnesses/agent-hub/config/agents.ts +3 -1
  40. package/.pi/harnesses/agent-hub/config/model-profiles.ts +3 -0
  41. package/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +14 -1
  42. package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +17 -0
  43. package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +3 -1
  44. package/.pi/harnesses/agent-hub/dispatch-native-types.ts +4 -0
  45. package/.pi/harnesses/agent-hub/dispatch-native.ts +9 -3
  46. package/.pi/harnesses/agent-hub/drift-watchdog.js +5 -10
  47. package/.pi/harnesses/agent-hub/execution-trace.ts +1 -1
  48. package/.pi/harnesses/agent-hub/filesystem-tool.ts +1 -1
  49. package/.pi/harnesses/agent-hub/footer.ts +2 -3
  50. package/.pi/harnesses/agent-hub/helpers.ts +4 -5
  51. package/.pi/harnesses/agent-hub/history-projection.ts +1 -1
  52. package/.pi/harnesses/agent-hub/index.ts +213 -196
  53. package/.pi/harnesses/agent-hub/input/shortcuts.ts +0 -7
  54. package/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +0 -2
  55. package/.pi/harnesses/agent-hub/no-progress.ts +14 -9
  56. package/.pi/harnesses/agent-hub/operator-current-state.ts +5 -1
  57. package/.pi/harnesses/agent-hub/package.json +1 -1
  58. package/.pi/harnesses/agent-hub/policy/roster.ts +12 -3
  59. package/.pi/harnesses/agent-hub/policy/work-mode.ts +10 -49
  60. package/.pi/harnesses/agent-hub/poll-command.ts +12 -4
  61. package/.pi/harnesses/agent-hub/proactive-snapshot.ts +12 -4
  62. package/.pi/harnesses/agent-hub/process-obligations.ts +42 -9
  63. package/.pi/harnesses/agent-hub/prompts/context.ts +17 -0
  64. package/.pi/harnesses/agent-hub/prompts/fragments.ts +9 -1
  65. package/.pi/harnesses/agent-hub/prompts/session-start.ts +2 -3
  66. package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +25 -8
  67. package/.pi/harnesses/agent-hub/provider-semaphore.js +5 -0
  68. package/.pi/harnesses/agent-hub/review-continuity.ts +5 -2
  69. package/.pi/harnesses/agent-hub/review-reuse.ts +2 -1
  70. package/.pi/harnesses/agent-hub/run-budget.js +22 -2
  71. package/.pi/harnesses/agent-hub/scope-gate.js +38 -0
  72. package/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  73. package/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  74. package/.pi/harnesses/agent-hub/task-triage-runtime.ts +3 -1
  75. package/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +4 -0
  76. package/.pi/harnesses/agent-hub/tool-catalog-state.ts +5 -3
  77. package/.pi/harnesses/agent-hub/tools/action-executors.ts +7 -7
  78. package/.pi/harnesses/agent-hub/tools/context.ts +2 -0
  79. package/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +2 -1
  80. package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +184 -33
  81. package/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  82. package/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  83. package/.pi/harnesses/agent-hub/tools/run-flow.ts +41 -10
  84. package/.pi/harnesses/agent-hub/tools/team-adjust.ts +1 -1
  85. package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +12 -2
  86. package/.pi/harnesses/agent-hub/work-mode.ts +44 -49
  87. package/.pi/harnesses/agent-hub/write-isolation.ts +53 -8
  88. package/.pi/harnesses/coms/package.json +1 -1
  89. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  90. package/.pi/harnesses/lib/codex-compat.ts +97 -0
  91. package/.pi/harnesses/lib/codex-contract.ts +259 -0
  92. package/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  93. package/.pi/harnesses/lib/coms-core.ts +8 -4
  94. package/.pi/harnesses/lib/context-budget-child-prompt.ts +1 -1
  95. package/.pi/harnesses/lib/context-budget-hub-prompt.ts +6 -3
  96. package/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  97. package/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  98. package/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  99. package/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  100. package/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  101. package/.pi/harnesses/lib/fleet-connection-control.ts +20 -3
  102. package/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  103. package/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  104. package/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  105. package/.pi/harnesses/lib/fleet-notification-validation.ts +80 -25
  106. package/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  107. package/.versions/2.2.0/.pi/agent-fleet/hermes/README.md +347 -0
  108. package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  109. package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  110. package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  111. package/.versions/2.2.0/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  112. package/.versions/2.2.0/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  113. package/.versions/2.2.0/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  114. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  115. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  116. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  117. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  118. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  119. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  120. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  121. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  122. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  123. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  124. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  125. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  126. package/.versions/2.2.0/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  127. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  128. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  129. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  130. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  131. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  132. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  133. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  134. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  135. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  136. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  137. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  138. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  139. package/.versions/2.2.0/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  140. package/.versions/2.2.0/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  141. package/.versions/2.2.0/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  142. package/.versions/2.2.0/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  143. package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  144. package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  145. package/.versions/2.2.0/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  146. package/.versions/2.2.0/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  147. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  148. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  149. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  150. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  151. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  152. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  153. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  154. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  155. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  156. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  157. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  158. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  159. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  160. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  161. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  162. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  163. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  164. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  165. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  166. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  167. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  168. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  169. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  170. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  171. package/.versions/2.2.0/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  172. package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  173. package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  174. package/.versions/2.2.0/.pi/agent-fleet/scripts/fleet.ts +244 -0
  175. package/.versions/2.2.0/.pi/agent-fleet/scripts/flow.ts +166 -0
  176. package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  177. package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  178. package/.versions/2.2.0/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  179. package/.versions/2.2.0/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  180. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  181. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  182. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +44 -0
  183. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  184. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  185. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  186. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  187. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  188. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  189. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  190. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  191. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  192. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  193. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  194. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  195. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  196. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  197. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  198. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  199. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +204 -0
  200. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  201. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  202. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  203. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  204. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  205. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  206. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  207. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  208. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  209. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  210. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  211. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  212. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  213. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  214. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  215. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  216. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  217. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  218. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  219. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  220. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  221. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  222. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  223. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  224. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  225. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  226. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  227. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  228. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  229. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  230. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  231. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  232. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  233. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  234. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  235. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  236. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  237. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  238. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  239. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  240. package/.versions/2.2.0/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  241. package/.versions/2.2.0/.pi/agent-fleet/scripts/package-lock.json +57 -0
  242. package/.versions/2.2.0/.pi/agent-fleet/scripts/package.json +10 -0
  243. package/.versions/2.2.0/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  244. package/.versions/2.2.0/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  245. package/.versions/2.2.0/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  246. package/.versions/2.2.0/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  247. package/.versions/2.2.0/.pi/agent-fleet/scripts/team-up.ts +378 -0
  248. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  249. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  250. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  251. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  252. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  253. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  254. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  255. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  256. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  257. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  258. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  259. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  260. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  261. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  262. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  263. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  264. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  265. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  266. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  267. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  268. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  269. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  270. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  271. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  272. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  273. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  274. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  275. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  276. package/.versions/2.2.0/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  277. package/.versions/2.2.0/.pi/agents/dispatch-policy.yaml +32 -0
  278. package/.versions/2.2.0/.pi/agents/model-profiles.yaml +132 -0
  279. package/.versions/2.2.0/.pi/agents/peers.yaml +147 -0
  280. package/.versions/2.2.0/.pi/agents/teams.yaml +41 -0
  281. package/.versions/2.2.0/.pi/agents/voices.yaml +13 -0
  282. package/.versions/2.2.0/.pi/damage-control-rules.yaml +297 -0
  283. package/.versions/2.2.0/.pi/extensions/btw/README.md +120 -0
  284. package/.versions/2.2.0/.pi/extensions/btw/index.ts +916 -0
  285. package/.versions/2.2.0/.pi/extensions/btw/package.json +6 -0
  286. package/.versions/2.2.0/.pi/extensions/btw/state.js +179 -0
  287. package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  288. package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  289. package/.versions/2.2.0/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  290. package/.versions/2.2.0/.pi/extensions/compact-and-continue/README.md +42 -0
  291. package/.versions/2.2.0/.pi/extensions/compact-and-continue/index.ts +136 -0
  292. package/.versions/2.2.0/.pi/extensions/compact-and-continue/package.json +6 -0
  293. package/.versions/2.2.0/.pi/extensions/mcp-bridge/README.md +46 -0
  294. package/.versions/2.2.0/.pi/extensions/mcp-bridge/index.ts +206 -0
  295. package/.versions/2.2.0/.pi/extensions/mcp-bridge/package.json +6 -0
  296. package/.versions/2.2.0/.pi/extensions/package-lock.json +1175 -0
  297. package/.versions/2.2.0/.pi/extensions/package.json +9 -0
  298. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/README.md +224 -0
  299. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/config.ts +199 -0
  300. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  301. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/index.ts +248 -0
  302. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/package.json +6 -0
  303. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  304. package/.versions/2.2.0/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  305. package/.versions/2.2.0/.pi/harnesses/agent-hub/README.md +1633 -0
  306. package/.versions/2.2.0/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  307. package/.versions/2.2.0/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  308. package/.versions/2.2.0/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  309. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  310. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  311. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  312. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  313. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  314. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  315. package/.versions/2.2.0/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  316. package/.versions/2.2.0/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  317. package/.versions/2.2.0/.pi/harnesses/agent-hub/artifacts.js +146 -0
  318. package/.versions/2.2.0/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  319. package/.versions/2.2.0/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  320. package/.versions/2.2.0/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  321. package/.versions/2.2.0/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  322. package/.versions/2.2.0/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  323. package/.versions/2.2.0/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  324. package/.versions/2.2.0/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  325. package/.versions/2.2.0/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  326. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  327. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  328. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  329. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  330. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  331. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  332. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  333. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  334. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  335. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  336. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  337. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  338. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  339. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  340. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  341. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  342. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  343. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  344. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  345. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  346. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  347. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  348. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  349. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
  350. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  351. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  352. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  353. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  354. package/.versions/2.2.0/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  355. package/.versions/2.2.0/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  356. package/.versions/2.2.0/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  357. package/.versions/2.2.0/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  358. package/.versions/2.2.0/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  359. package/.versions/2.2.0/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  360. package/.versions/2.2.0/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  361. package/.versions/2.2.0/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  362. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  363. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  364. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  365. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  366. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  367. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  368. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  369. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  370. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  371. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  372. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  373. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  374. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  375. package/.versions/2.2.0/.pi/harnesses/agent-hub/context-window.js +108 -0
  376. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  377. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  378. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  379. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  380. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  381. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  382. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  383. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  384. package/.versions/2.2.0/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  385. package/.versions/2.2.0/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  386. package/.versions/2.2.0/.pi/harnesses/agent-hub/delegate.ts +478 -0
  387. package/.versions/2.2.0/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  388. package/.versions/2.2.0/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  389. package/.versions/2.2.0/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  390. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  391. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  392. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  393. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  394. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  395. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  396. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  397. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  398. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  399. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  400. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  401. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  402. package/.versions/2.2.0/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  403. package/.versions/2.2.0/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  404. package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  405. package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  406. package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  407. package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  408. package/.versions/2.2.0/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  409. package/.versions/2.2.0/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  410. package/.versions/2.2.0/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  411. package/.versions/2.2.0/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  412. package/.versions/2.2.0/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  413. package/.versions/2.2.0/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  414. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  415. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  416. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  417. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  418. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  419. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  420. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  421. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  422. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  423. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  424. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  425. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  426. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  427. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  428. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  429. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  430. package/.versions/2.2.0/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  431. package/.versions/2.2.0/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  432. package/.versions/2.2.0/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
  433. package/.versions/2.2.0/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  434. package/.versions/2.2.0/.pi/harnesses/agent-hub/footer.ts +29 -0
  435. package/.versions/2.2.0/.pi/harnesses/agent-hub/helpers.ts +269 -0
  436. package/.versions/2.2.0/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  437. package/.versions/2.2.0/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  438. package/.versions/2.2.0/.pi/harnesses/agent-hub/index.ts +2722 -0
  439. package/.versions/2.2.0/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  440. package/.versions/2.2.0/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  441. package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  442. package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  443. package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  444. package/.versions/2.2.0/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  445. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  446. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  447. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  448. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  449. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  450. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  451. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  452. package/.versions/2.2.0/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  453. package/.versions/2.2.0/.pi/harnesses/agent-hub/no-progress.ts +627 -0
  454. package/.versions/2.2.0/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
  455. package/.versions/2.2.0/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  456. package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  457. package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  458. package/.versions/2.2.0/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  459. package/.versions/2.2.0/.pi/harnesses/agent-hub/package.json +7 -0
  460. package/.versions/2.2.0/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  461. package/.versions/2.2.0/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  462. package/.versions/2.2.0/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  463. package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  464. package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  465. package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  466. package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  467. package/.versions/2.2.0/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
  468. package/.versions/2.2.0/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  469. package/.versions/2.2.0/.pi/harnesses/agent-hub/presentation.ts +54 -0
  470. package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  471. package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  472. package/.versions/2.2.0/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  473. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  474. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  475. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  476. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  477. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  478. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  479. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  480. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  481. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  482. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  483. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  484. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  485. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  486. package/.versions/2.2.0/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  487. package/.versions/2.2.0/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  488. package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  489. package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  490. package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  491. package/.versions/2.2.0/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  492. package/.versions/2.2.0/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  493. package/.versions/2.2.0/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  494. package/.versions/2.2.0/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  495. package/.versions/2.2.0/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  496. package/.versions/2.2.0/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  497. package/.versions/2.2.0/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  498. package/.versions/2.2.0/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  499. package/.versions/2.2.0/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  500. package/.versions/2.2.0/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  501. package/.versions/2.2.0/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  502. package/.versions/2.2.0/.pi/harnesses/agent-hub/return-contract.js +371 -0
  503. package/.versions/2.2.0/.pi/harnesses/agent-hub/return-extract.js +77 -0
  504. package/.versions/2.2.0/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  505. package/.versions/2.2.0/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  506. package/.versions/2.2.0/.pi/harnesses/agent-hub/review-findings.js +96 -0
  507. package/.versions/2.2.0/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  508. package/.versions/2.2.0/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  509. package/.versions/2.2.0/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  510. package/.versions/2.2.0/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  511. package/.versions/2.2.0/.pi/harnesses/agent-hub/run-budget.js +362 -0
  512. package/.versions/2.2.0/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  513. package/.versions/2.2.0/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  514. package/.versions/2.2.0/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  515. package/.versions/2.2.0/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  516. package/.versions/2.2.0/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  517. package/.versions/2.2.0/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  518. package/.versions/2.2.0/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  519. package/.versions/2.2.0/.pi/harnesses/agent-hub/session-health.js +110 -0
  520. package/.versions/2.2.0/.pi/harnesses/agent-hub/session-start.ts +42 -0
  521. package/.versions/2.2.0/.pi/harnesses/agent-hub/spawn.ts +702 -0
  522. package/.versions/2.2.0/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  523. package/.versions/2.2.0/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  524. package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  525. package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  526. package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  527. package/.versions/2.2.0/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  528. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  529. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  530. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  531. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  532. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  533. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  534. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  535. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  536. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  537. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  538. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  539. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  540. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-runtime.ts +130 -0
  541. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  542. package/.versions/2.2.0/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  543. package/.versions/2.2.0/.pi/harnesses/agent-hub/timeline.ts +72 -0
  544. package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  545. package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  546. package/.versions/2.2.0/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  547. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/action-executors.ts +214 -0
  548. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  549. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  550. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  551. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/context.ts +149 -0
  552. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  553. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
  554. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  555. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  556. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  557. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  558. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  559. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  560. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  561. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  562. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  563. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  564. package/.versions/2.2.0/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  565. package/.versions/2.2.0/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  566. package/.versions/2.2.0/.pi/harnesses/agent-hub/types.ts +66 -0
  567. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  568. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  569. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  570. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  571. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  572. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  573. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  574. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  575. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  576. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  577. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  578. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  579. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  580. package/.versions/2.2.0/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  581. package/.versions/2.2.0/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  582. package/.versions/2.2.0/.pi/harnesses/agent-hub/version.ts +42 -0
  583. package/.versions/2.2.0/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  584. package/.versions/2.2.0/.pi/harnesses/agent-hub/work-mode.ts +183 -0
  585. package/.versions/2.2.0/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  586. package/.versions/2.2.0/.pi/harnesses/ask-user-remote/README.md +59 -0
  587. package/.versions/2.2.0/.pi/harnesses/ask-user-remote/index.ts +571 -0
  588. package/.versions/2.2.0/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  589. package/.versions/2.2.0/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  590. package/.versions/2.2.0/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  591. package/.versions/2.2.0/.pi/harnesses/coms/README.md +105 -0
  592. package/.versions/2.2.0/.pi/harnesses/coms/index.ts +308 -0
  593. package/.versions/2.2.0/.pi/harnesses/coms/package.json +7 -0
  594. package/.versions/2.2.0/.pi/harnesses/coms/version.ts +42 -0
  595. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/README.md +161 -0
  596. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/index.ts +659 -0
  597. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/package.json +7 -0
  598. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  599. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  600. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  601. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  602. package/.versions/2.2.0/.pi/harnesses/damage-control-continue/version.ts +42 -0
  603. package/.versions/2.2.0/.pi/harnesses/lib/approval-wait.ts +17 -0
  604. package/.versions/2.2.0/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  605. package/.versions/2.2.0/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  606. package/.versions/2.2.0/.pi/harnesses/lib/clarification-policy.ts +9 -0
  607. package/.versions/2.2.0/.pi/harnesses/lib/codex-compat.ts +97 -0
  608. package/.versions/2.2.0/.pi/harnesses/lib/codex-contract.ts +259 -0
  609. package/.versions/2.2.0/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  610. package/.versions/2.2.0/.pi/harnesses/lib/coms-core-io.ts +422 -0
  611. package/.versions/2.2.0/.pi/harnesses/lib/coms-core.ts +738 -0
  612. package/.versions/2.2.0/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  613. package/.versions/2.2.0/.pi/harnesses/lib/coms-observation.ts +74 -0
  614. package/.versions/2.2.0/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  615. package/.versions/2.2.0/.pi/harnesses/lib/coms-response-read.ts +107 -0
  616. package/.versions/2.2.0/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  617. package/.versions/2.2.0/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  618. package/.versions/2.2.0/.pi/harnesses/lib/context-budget-view.ts +112 -0
  619. package/.versions/2.2.0/.pi/harnesses/lib/context-budget.ts +114 -0
  620. package/.versions/2.2.0/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  621. package/.versions/2.2.0/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  622. package/.versions/2.2.0/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  623. package/.versions/2.2.0/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  624. package/.versions/2.2.0/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  625. package/.versions/2.2.0/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  626. package/.versions/2.2.0/.pi/harnesses/lib/damage-policy.ts +35 -0
  627. package/.versions/2.2.0/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  628. package/.versions/2.2.0/.pi/harnesses/lib/damage-result-view.ts +16 -0
  629. package/.versions/2.2.0/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  630. package/.versions/2.2.0/.pi/harnesses/lib/exact-permission-port.ts +38 -0
  631. package/.versions/2.2.0/.pi/harnesses/lib/execution-trace.ts +45 -0
  632. package/.versions/2.2.0/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  633. package/.versions/2.2.0/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  634. package/.versions/2.2.0/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  635. package/.versions/2.2.0/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  636. package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  637. package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-chat-view.ts +43 -0
  638. package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  639. package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  640. package/.versions/2.2.0/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  641. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  642. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  643. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  644. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  645. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  646. package/.versions/2.2.0/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  647. package/.versions/2.2.0/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  648. package/.versions/2.2.0/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  649. package/.versions/2.2.0/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  650. package/.versions/2.2.0/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  651. package/.versions/2.2.0/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  652. package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  653. package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-bootstrap.ts +152 -0
  654. package/.versions/2.2.0/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  655. package/.versions/2.2.0/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  656. package/.versions/2.2.0/.pi/harnesses/lib/fleet-panel.ts +34 -0
  657. package/.versions/2.2.0/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  658. package/.versions/2.2.0/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  659. package/.versions/2.2.0/.pi/harnesses/lib/fleet-selection.ts +24 -0
  660. package/.versions/2.2.0/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  661. package/.versions/2.2.0/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  662. package/.versions/2.2.0/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  663. package/.versions/2.2.0/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  664. package/.versions/2.2.0/.pi/harnesses/lib/herdr-client.ts +472 -0
  665. package/.versions/2.2.0/.pi/harnesses/lib/herdr-presence.ts +399 -0
  666. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  667. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  668. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  669. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  670. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  671. package/.versions/2.2.0/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  672. package/.versions/2.2.0/.pi/harnesses/lib/identical-dialog.ts +27 -0
  673. package/.versions/2.2.0/.pi/harnesses/lib/installation-state.js +62 -0
  674. package/.versions/2.2.0/.pi/harnesses/lib/peer-target.ts +24 -0
  675. package/.versions/2.2.0/.pi/harnesses/lib/policy-roots.js +117 -0
  676. package/.versions/2.2.0/.pi/harnesses/lib/policy-roots.ts +32 -0
  677. package/.versions/2.2.0/.pi/harnesses/lib/process-shared.ts +9 -0
  678. package/.versions/2.2.0/.pi/harnesses/lib/resource-closure.js +26 -0
  679. package/.versions/2.2.0/.pi/harnesses/lib/safe-source-read.js +29 -0
  680. package/.versions/2.2.0/.pi/harnesses/lib/semantic-approval.ts +80 -0
  681. package/.versions/2.2.0/.pi/harnesses/lib/session-target.ts +62 -0
  682. package/.versions/2.2.0/.pi/harnesses/lib/spawned-peers.js +191 -0
  683. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  684. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  685. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  686. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  687. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-json.js +37 -0
  688. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-loader.js +53 -0
  689. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  690. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-triage.js +42 -0
  691. package/.versions/2.2.0/.pi/harnesses/lib/system1/config-v2.js +112 -0
  692. package/.versions/2.2.0/.pi/harnesses/lib/system1/config.js +50 -0
  693. package/.versions/2.2.0/.pi/harnesses/lib/system1/contracts.ts +154 -0
  694. package/.versions/2.2.0/.pi/harnesses/lib/system1/demo.ts +95 -0
  695. package/.versions/2.2.0/.pi/harnesses/lib/system1/jev.ts +503 -0
  696. package/.versions/2.2.0/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  697. package/.versions/2.2.0/.pi/harnesses/lib/system1/selection.js +11 -0
  698. package/.versions/2.2.0/.pi/harnesses/lib/system1/service.ts +245 -0
  699. package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  700. package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  701. package/.versions/2.2.0/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  702. package/.versions/2.2.0/.pi/harnesses/lib/target-capabilities.js +7 -0
  703. package/.versions/2.2.0/.pi/harnesses/lib/update-check.ts +227 -0
  704. package/.versions/2.2.0/.pi/harnesses/lib/workspace-context.js +115 -0
  705. package/.versions/2.2.0/.pi/harnesses/lib/workspace-context.ts +22 -0
  706. package/.versions/2.2.0/.pi/harnesses/package-lock.json +2121 -0
  707. package/.versions/2.2.0/.pi/harnesses/package.json +13 -0
  708. package/.versions/2.2.0/.pi/prompts/af-build.md +27 -0
  709. package/.versions/2.2.0/.pi/prompts/af-code-simplify.md +22 -0
  710. package/.versions/2.2.0/.pi/prompts/af-constraints.md +31 -0
  711. package/.versions/2.2.0/.pi/prompts/af-plan.md +17 -0
  712. package/.versions/2.2.0/.pi/prompts/af-review.md +16 -0
  713. package/.versions/2.2.0/.pi/prompts/af-set-hermes-telegram.md +15 -0
  714. package/.versions/2.2.0/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  715. package/.versions/2.2.0/.pi/prompts/af-setup-rules.md +20 -0
  716. package/.versions/2.2.0/.pi/prompts/af-ship.md +17 -0
  717. package/.versions/2.2.0/.pi/prompts/af-spec.md +15 -0
  718. package/.versions/2.2.0/.pi/prompts/af-test.md +19 -0
  719. package/.versions/2.2.0/.pi/skills/bowser/SKILL.md +145 -0
  720. package/.versions/2.2.0/.version +1 -0
  721. package/.versions/2.2.0/agents/architect.md +24 -0
  722. package/.versions/2.2.0/agents/bowser.md +28 -0
  723. package/.versions/2.2.0/agents/builder.md +55 -0
  724. package/.versions/2.2.0/agents/code-reviewer.md +209 -0
  725. package/.versions/2.2.0/agents/deep-researcher.md +32 -0
  726. package/.versions/2.2.0/agents/documenter.md +22 -0
  727. package/.versions/2.2.0/agents/plan-reviewer.md +83 -0
  728. package/.versions/2.2.0/agents/planner.md +107 -0
  729. package/.versions/2.2.0/agents/releaser.md +24 -0
  730. package/.versions/2.2.0/agents/researcher.md +30 -0
  731. package/.versions/2.2.0/agents/security-auditor.md +167 -0
  732. package/.versions/2.2.0/agents/test-engineer.md +153 -0
  733. package/.versions/2.2.0/agents/web-debugger.md +44 -0
  734. package/.versions/2.2.0/agents/web-performance-auditor.md +194 -0
  735. package/.versions/2.2.0/bin/catalog/harness-runtime-closure.json +85 -0
  736. package/.versions/2.2.0/docs/ARCHITECTURE.md +1291 -0
  737. package/.versions/2.2.0/docs/agent-fleet-setup.md +1161 -0
  738. package/.versions/2.2.0/docs/claude-code-coms-bridge.md +147 -0
  739. package/.versions/2.2.0/docs/codex-local-mcp.md +520 -0
  740. package/.versions/2.2.0/docs/codex-session-bridge.md +44 -0
  741. package/.versions/2.2.0/docs/codex-setup.md +183 -0
  742. package/.versions/2.2.0/docs/coms-hermes-bridge.md +188 -0
  743. package/.versions/2.2.0/docs/fleet-native-voice.md +151 -0
  744. package/.versions/2.2.0/docs/getting-started.md +126 -0
  745. package/.versions/2.2.0/docs/npm-install.md +535 -0
  746. package/.versions/2.2.0/docs/pi-extensions.md +450 -0
  747. package/.versions/2.2.0/docs/pi-setup.md +92 -0
  748. package/.versions/2.2.0/docs/skill-anatomy.md +150 -0
  749. package/.versions/2.2.0/install-manifest.json +3226 -0
  750. package/.versions/2.2.0/justfile +246 -0
  751. package/.versions/2.2.0/manifest-meta.json +1098 -0
  752. package/.versions/2.2.0/references/accessibility-checklist.md +160 -0
  753. package/.versions/2.2.0/references/communication-contract.md +26 -0
  754. package/.versions/2.2.0/references/definition-of-done.md +67 -0
  755. package/.versions/2.2.0/references/fleet-coordination-patterns.md +171 -0
  756. package/.versions/2.2.0/references/observability-checklist.md +92 -0
  757. package/.versions/2.2.0/references/orchestration-patterns.md +370 -0
  758. package/.versions/2.2.0/references/performance-checklist.md +236 -0
  759. package/.versions/2.2.0/references/prompting-patterns.md +380 -0
  760. package/.versions/2.2.0/references/security-checklist.md +245 -0
  761. package/.versions/2.2.0/references/testing-patterns.md +235 -0
  762. package/.versions/2.2.0/references/workflow-authoring.md +304 -0
  763. package/.versions/2.2.0/skills/_internal/grilling.md +59 -0
  764. package/.versions/2.2.0/skills/browser-testing-with-devtools/SKILL.md +351 -0
  765. package/.versions/2.2.0/skills/code-review-and-quality/SKILL.md +396 -0
  766. package/.versions/2.2.0/skills/compound-learning/SKILL.md +137 -0
  767. package/.versions/2.2.0/skills/constraint-driven-development/SKILL.md +338 -0
  768. package/.versions/2.2.0/skills/constraint-driven-development/references/floor-guard.md +99 -0
  769. package/.versions/2.2.0/skills/context-engineering/SKILL.md +341 -0
  770. package/.versions/2.2.0/skills/deprecation-and-migration/SKILL.md +247 -0
  771. package/.versions/2.2.0/skills/designing-agents/SKILL.md +394 -0
  772. package/.versions/2.2.0/skills/designing-agents/pi-harness-authoring.md +222 -0
  773. package/.versions/2.2.0/skills/drafting-workflows/SKILL.md +143 -0
  774. package/.versions/2.2.0/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  775. package/.versions/2.2.0/skills/fleet-connect/SKILL.md +29 -0
  776. package/.versions/2.2.0/skills/fleet-connect.zip +0 -0
  777. package/.versions/2.2.0/skills/fleet-native-voice/SKILL.md +103 -0
  778. package/.versions/2.2.0/skills/fleet-native-voice/agents/openai.yaml +4 -0
  779. package/.versions/2.2.0/skills/fleet-native-voice.zip +0 -0
  780. package/.versions/2.2.0/skills/frontend-ui-engineering/SKILL.md +328 -0
  781. package/.versions/2.2.0/skills/git-workflow-and-versioning/SKILL.md +316 -0
  782. package/.versions/2.2.0/skills/idea-refine/SKILL.md +182 -0
  783. package/.versions/2.2.0/skills/idea-refine/examples.md +238 -0
  784. package/.versions/2.2.0/skills/idea-refine/frameworks.md +99 -0
  785. package/.versions/2.2.0/skills/idea-refine/refinement-criteria.md +113 -0
  786. package/.versions/2.2.0/skills/idea-refine/scripts/idea-refine.sh +15 -0
  787. package/.versions/2.2.0/skills/incremental-implementation/SKILL.md +353 -0
  788. package/.versions/2.2.0/skills/incremental-implementation.zip +0 -0
  789. package/.versions/2.2.0/skills/interview-me/SKILL.md +226 -0
  790. package/.versions/2.2.0/skills/orchestration-verification/SKILL.md +182 -0
  791. package/.versions/2.2.0/skills/peer-coms/SKILL.md +90 -0
  792. package/.versions/2.2.0/skills/performance-optimization/SKILL.md +496 -0
  793. package/.versions/2.2.0/skills/planning-and-task-breakdown/SKILL.md +318 -0
  794. package/.versions/2.2.0/skills/planning-and-task-breakdown.zip +0 -0
  795. package/.versions/2.2.0/skills/repository-ai-setup/SKILL.md +135 -0
  796. package/.versions/2.2.0/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  797. package/.versions/2.2.0/skills/repository-ai-setup/references/apply-contract.md +74 -0
  798. package/.versions/2.2.0/skills/repository-ai-setup/references/provenance-template.md +16 -0
  799. package/.versions/2.2.0/skills/repository-ai-setup/references/setup-flow.md +108 -0
  800. package/.versions/2.2.0/skills/repository-ai-setup/references/verify-setup.md +20 -0
  801. package/.versions/2.2.0/skills/repository-ai-setup.zip +0 -0
  802. package/.versions/2.2.0/skills/security-and-hardening/SKILL.md +524 -0
  803. package/.versions/2.2.0/skills/spec-driven-development/SKILL.md +295 -0
  804. package/.versions/2.2.0/skills/spec-driven-development.zip +0 -0
  805. package/.versions/2.2.0/skills/using-agent-skills/SKILL.md +198 -0
  806. package/.versions/2.2.0/vendor/agent-skills-upstream/LICENSE +21 -0
  807. package/.versions/2.2.0/vendor/agent-skills-upstream/README.md +430 -0
  808. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  809. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  810. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  811. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  812. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  813. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  814. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  815. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  816. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  817. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  818. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  819. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  820. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  821. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  822. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  823. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  824. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  825. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  826. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  827. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  828. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  829. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  830. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  831. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  832. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  833. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  834. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  835. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  836. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  837. package/.versions/2.2.0/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  838. package/.versions/2.2.1/.pi/agent-fleet/hermes/README.md +347 -0
  839. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  840. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  841. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  842. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  843. package/.versions/2.2.1/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  844. package/.versions/2.2.1/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  845. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  846. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  847. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  848. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  849. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  850. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  851. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  852. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  853. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  854. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  855. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  856. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  857. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  858. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  859. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  860. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  861. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  862. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  863. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  864. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  865. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  866. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  867. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  868. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  869. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  870. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  871. package/.versions/2.2.1/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  872. package/.versions/2.2.1/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  873. package/.versions/2.2.1/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  874. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  875. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  876. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  877. package/.versions/2.2.1/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  878. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  879. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  880. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  881. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  882. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  883. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  884. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  885. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  886. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  887. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  888. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  889. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  890. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  891. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  892. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  893. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  894. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  895. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  896. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  897. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  898. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  899. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  900. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  901. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  902. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  903. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  904. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  905. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet.ts +244 -0
  906. package/.versions/2.2.1/.pi/agent-fleet/scripts/flow.ts +166 -0
  907. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  908. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  909. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  910. package/.versions/2.2.1/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  911. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  912. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  913. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  914. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  915. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  916. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  917. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  918. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  919. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  920. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  921. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  922. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  923. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  924. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  925. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  926. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  927. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  928. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  929. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  930. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  931. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  932. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  933. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  934. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  935. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  936. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  937. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  938. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  939. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  940. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  941. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  942. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  943. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  944. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  945. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  946. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  947. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  948. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  949. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  950. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  951. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  952. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  953. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  954. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  955. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  956. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  957. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  958. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  959. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  960. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  961. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  962. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  963. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  964. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  965. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  966. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  967. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  968. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  969. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  970. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  971. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  972. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  973. package/.versions/2.2.1/.pi/agent-fleet/scripts/package-lock.json +57 -0
  974. package/.versions/2.2.1/.pi/agent-fleet/scripts/package.json +10 -0
  975. package/.versions/2.2.1/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  976. package/.versions/2.2.1/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  977. package/.versions/2.2.1/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  978. package/.versions/2.2.1/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  979. package/.versions/2.2.1/.pi/agent-fleet/scripts/team-up.ts +378 -0
  980. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  981. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  982. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  983. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  984. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  985. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  986. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  987. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  988. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  989. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  990. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  991. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  992. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  993. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  994. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  995. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  996. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  997. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  998. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  999. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  1000. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  1001. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  1002. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  1003. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  1004. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  1005. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  1006. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  1007. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  1008. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  1009. package/.versions/2.2.1/.pi/agents/dispatch-policy.yaml +32 -0
  1010. package/.versions/2.2.1/.pi/agents/model-profiles.yaml +132 -0
  1011. package/.versions/2.2.1/.pi/agents/peers.yaml +147 -0
  1012. package/.versions/2.2.1/.pi/agents/teams.yaml +41 -0
  1013. package/.versions/2.2.1/.pi/agents/voices.yaml +13 -0
  1014. package/.versions/2.2.1/.pi/damage-control-rules.yaml +297 -0
  1015. package/.versions/2.2.1/.pi/extensions/btw/README.md +120 -0
  1016. package/.versions/2.2.1/.pi/extensions/btw/index.ts +916 -0
  1017. package/.versions/2.2.1/.pi/extensions/btw/package.json +6 -0
  1018. package/.versions/2.2.1/.pi/extensions/btw/state.js +179 -0
  1019. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  1020. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  1021. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  1022. package/.versions/2.2.1/.pi/extensions/compact-and-continue/README.md +42 -0
  1023. package/.versions/2.2.1/.pi/extensions/compact-and-continue/index.ts +136 -0
  1024. package/.versions/2.2.1/.pi/extensions/compact-and-continue/package.json +6 -0
  1025. package/.versions/2.2.1/.pi/extensions/mcp-bridge/README.md +46 -0
  1026. package/.versions/2.2.1/.pi/extensions/mcp-bridge/index.ts +206 -0
  1027. package/.versions/2.2.1/.pi/extensions/mcp-bridge/package.json +6 -0
  1028. package/.versions/2.2.1/.pi/extensions/package-lock.json +1175 -0
  1029. package/.versions/2.2.1/.pi/extensions/package.json +9 -0
  1030. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/README.md +224 -0
  1031. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/config.ts +199 -0
  1032. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  1033. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
  1034. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/package.json +6 -0
  1035. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  1036. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  1037. package/.versions/2.2.1/.pi/harnesses/agent-hub/README.md +1641 -0
  1038. package/.versions/2.2.1/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  1039. package/.versions/2.2.1/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  1040. package/.versions/2.2.1/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  1041. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  1042. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  1043. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  1044. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  1045. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  1046. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  1047. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  1048. package/.versions/2.2.1/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  1049. package/.versions/2.2.1/.pi/harnesses/agent-hub/artifacts.js +146 -0
  1050. package/.versions/2.2.1/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  1051. package/.versions/2.2.1/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  1052. package/.versions/2.2.1/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  1053. package/.versions/2.2.1/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  1054. package/.versions/2.2.1/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  1055. package/.versions/2.2.1/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  1056. package/.versions/2.2.1/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  1057. package/.versions/2.2.1/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  1058. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  1059. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  1060. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  1061. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  1062. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  1063. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  1064. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  1065. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  1066. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  1067. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  1068. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  1069. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  1070. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  1071. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  1072. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  1073. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  1074. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  1075. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  1076. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  1077. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  1078. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  1079. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  1080. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  1081. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
  1082. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  1083. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  1084. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  1085. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  1086. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  1087. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  1088. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  1089. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  1090. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  1091. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  1092. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  1093. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  1094. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  1095. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  1096. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  1097. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  1098. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  1099. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  1100. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  1101. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  1102. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  1103. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  1104. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  1105. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  1106. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  1107. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-window.js +108 -0
  1108. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  1109. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  1110. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  1111. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  1112. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  1113. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  1114. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  1115. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  1116. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  1117. package/.versions/2.2.1/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  1118. package/.versions/2.2.1/.pi/harnesses/agent-hub/delegate.ts +478 -0
  1119. package/.versions/2.2.1/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  1120. package/.versions/2.2.1/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  1121. package/.versions/2.2.1/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  1122. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  1123. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  1124. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  1125. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  1126. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  1127. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  1128. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  1129. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  1130. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  1131. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  1132. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  1133. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  1134. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  1135. package/.versions/2.2.1/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  1136. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  1137. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  1138. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  1139. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  1140. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  1141. package/.versions/2.2.1/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  1142. package/.versions/2.2.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  1143. package/.versions/2.2.1/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  1144. package/.versions/2.2.1/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  1145. package/.versions/2.2.1/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  1146. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  1147. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  1148. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  1149. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  1150. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  1151. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  1152. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  1153. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  1154. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  1155. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  1156. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  1157. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  1158. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  1159. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  1160. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  1161. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  1162. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  1163. package/.versions/2.2.1/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  1164. package/.versions/2.2.1/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
  1165. package/.versions/2.2.1/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  1166. package/.versions/2.2.1/.pi/harnesses/agent-hub/footer.ts +29 -0
  1167. package/.versions/2.2.1/.pi/harnesses/agent-hub/helpers.ts +269 -0
  1168. package/.versions/2.2.1/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  1169. package/.versions/2.2.1/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  1170. package/.versions/2.2.1/.pi/harnesses/agent-hub/index.ts +2722 -0
  1171. package/.versions/2.2.1/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  1172. package/.versions/2.2.1/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  1173. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  1174. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  1175. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  1176. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  1177. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  1178. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  1179. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  1180. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  1181. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  1182. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  1183. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  1184. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  1185. package/.versions/2.2.1/.pi/harnesses/agent-hub/no-progress.ts +627 -0
  1186. package/.versions/2.2.1/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
  1187. package/.versions/2.2.1/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  1188. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  1189. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  1190. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  1191. package/.versions/2.2.1/.pi/harnesses/agent-hub/package.json +7 -0
  1192. package/.versions/2.2.1/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  1193. package/.versions/2.2.1/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  1194. package/.versions/2.2.1/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  1195. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  1196. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  1197. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  1198. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  1199. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
  1200. package/.versions/2.2.1/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  1201. package/.versions/2.2.1/.pi/harnesses/agent-hub/presentation.ts +54 -0
  1202. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  1203. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  1204. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  1205. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  1206. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  1207. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  1208. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  1209. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  1210. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  1211. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  1212. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  1213. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  1214. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  1215. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  1216. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  1217. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  1218. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  1219. package/.versions/2.2.1/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  1220. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  1221. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  1222. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  1223. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  1224. package/.versions/2.2.1/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  1225. package/.versions/2.2.1/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  1226. package/.versions/2.2.1/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  1227. package/.versions/2.2.1/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  1228. package/.versions/2.2.1/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  1229. package/.versions/2.2.1/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  1230. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  1231. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  1232. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  1233. package/.versions/2.2.1/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  1234. package/.versions/2.2.1/.pi/harnesses/agent-hub/return-contract.js +371 -0
  1235. package/.versions/2.2.1/.pi/harnesses/agent-hub/return-extract.js +77 -0
  1236. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  1237. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  1238. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-findings.js +96 -0
  1239. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  1240. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  1241. package/.versions/2.2.1/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  1242. package/.versions/2.2.1/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  1243. package/.versions/2.2.1/.pi/harnesses/agent-hub/run-budget.js +362 -0
  1244. package/.versions/2.2.1/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  1245. package/.versions/2.2.1/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  1246. package/.versions/2.2.1/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  1247. package/.versions/2.2.1/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  1248. package/.versions/2.2.1/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  1249. package/.versions/2.2.1/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  1250. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  1251. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-health.js +110 -0
  1252. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-start.ts +42 -0
  1253. package/.versions/2.2.1/.pi/harnesses/agent-hub/spawn.ts +702 -0
  1254. package/.versions/2.2.1/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  1255. package/.versions/2.2.1/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  1256. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  1257. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  1258. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  1259. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  1260. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  1261. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  1262. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  1263. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  1264. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  1265. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  1266. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  1267. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  1268. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  1269. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  1270. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  1271. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  1272. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-runtime.ts +132 -0
  1273. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  1274. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  1275. package/.versions/2.2.1/.pi/harnesses/agent-hub/timeline.ts +72 -0
  1276. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  1277. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  1278. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  1279. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/action-executors.ts +216 -0
  1280. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  1281. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  1282. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  1283. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/context.ts +149 -0
  1284. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  1285. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
  1286. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  1287. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  1288. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  1289. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  1290. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  1291. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  1292. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  1293. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  1294. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  1295. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  1296. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  1297. package/.versions/2.2.1/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  1298. package/.versions/2.2.1/.pi/harnesses/agent-hub/types.ts +66 -0
  1299. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  1300. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  1301. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  1302. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  1303. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  1304. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  1305. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  1306. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  1307. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  1308. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  1309. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  1310. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  1311. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  1312. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  1313. package/.versions/2.2.1/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  1314. package/.versions/2.2.1/.pi/harnesses/agent-hub/version.ts +42 -0
  1315. package/.versions/2.2.1/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  1316. package/.versions/2.2.1/.pi/harnesses/agent-hub/work-mode.ts +183 -0
  1317. package/.versions/2.2.1/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  1318. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/README.md +59 -0
  1319. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/index.ts +571 -0
  1320. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  1321. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  1322. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  1323. package/.versions/2.2.1/.pi/harnesses/coms/README.md +105 -0
  1324. package/.versions/2.2.1/.pi/harnesses/coms/index.ts +308 -0
  1325. package/.versions/2.2.1/.pi/harnesses/coms/package.json +7 -0
  1326. package/.versions/2.2.1/.pi/harnesses/coms/version.ts +42 -0
  1327. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/README.md +161 -0
  1328. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/index.ts +659 -0
  1329. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/package.json +7 -0
  1330. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  1331. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  1332. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  1333. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  1334. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/version.ts +42 -0
  1335. package/.versions/2.2.1/.pi/harnesses/lib/approval-wait.ts +17 -0
  1336. package/.versions/2.2.1/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  1337. package/.versions/2.2.1/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  1338. package/.versions/2.2.1/.pi/harnesses/lib/clarification-policy.ts +9 -0
  1339. package/.versions/2.2.1/.pi/harnesses/lib/codex-compat.ts +97 -0
  1340. package/.versions/2.2.1/.pi/harnesses/lib/codex-contract.ts +259 -0
  1341. package/.versions/2.2.1/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  1342. package/.versions/2.2.1/.pi/harnesses/lib/coms-core-io.ts +422 -0
  1343. package/.versions/2.2.1/.pi/harnesses/lib/coms-core.ts +738 -0
  1344. package/.versions/2.2.1/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  1345. package/.versions/2.2.1/.pi/harnesses/lib/coms-observation.ts +74 -0
  1346. package/.versions/2.2.1/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  1347. package/.versions/2.2.1/.pi/harnesses/lib/coms-response-read.ts +107 -0
  1348. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  1349. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  1350. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-view.ts +112 -0
  1351. package/.versions/2.2.1/.pi/harnesses/lib/context-budget.ts +114 -0
  1352. package/.versions/2.2.1/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  1353. package/.versions/2.2.1/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  1354. package/.versions/2.2.1/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  1355. package/.versions/2.2.1/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  1356. package/.versions/2.2.1/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  1357. package/.versions/2.2.1/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  1358. package/.versions/2.2.1/.pi/harnesses/lib/damage-policy.ts +35 -0
  1359. package/.versions/2.2.1/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  1360. package/.versions/2.2.1/.pi/harnesses/lib/damage-result-view.ts +16 -0
  1361. package/.versions/2.2.1/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  1362. package/.versions/2.2.1/.pi/harnesses/lib/exact-permission-port.ts +38 -0
  1363. package/.versions/2.2.1/.pi/harnesses/lib/execution-trace.ts +45 -0
  1364. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  1365. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  1366. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  1367. package/.versions/2.2.1/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  1368. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  1369. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  1370. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  1371. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  1372. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  1373. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  1374. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  1375. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  1376. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  1377. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  1378. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  1379. package/.versions/2.2.1/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  1380. package/.versions/2.2.1/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  1381. package/.versions/2.2.1/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  1382. package/.versions/2.2.1/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  1383. package/.versions/2.2.1/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  1384. package/.versions/2.2.1/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  1385. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  1386. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  1387. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  1388. package/.versions/2.2.1/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  1389. package/.versions/2.2.1/.pi/harnesses/lib/fleet-panel.ts +34 -0
  1390. package/.versions/2.2.1/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  1391. package/.versions/2.2.1/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  1392. package/.versions/2.2.1/.pi/harnesses/lib/fleet-selection.ts +24 -0
  1393. package/.versions/2.2.1/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  1394. package/.versions/2.2.1/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  1395. package/.versions/2.2.1/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  1396. package/.versions/2.2.1/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  1397. package/.versions/2.2.1/.pi/harnesses/lib/herdr-client.ts +472 -0
  1398. package/.versions/2.2.1/.pi/harnesses/lib/herdr-presence.ts +399 -0
  1399. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  1400. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  1401. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  1402. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  1403. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  1404. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  1405. package/.versions/2.2.1/.pi/harnesses/lib/identical-dialog.ts +27 -0
  1406. package/.versions/2.2.1/.pi/harnesses/lib/installation-state.js +62 -0
  1407. package/.versions/2.2.1/.pi/harnesses/lib/peer-target.ts +24 -0
  1408. package/.versions/2.2.1/.pi/harnesses/lib/policy-roots.js +117 -0
  1409. package/.versions/2.2.1/.pi/harnesses/lib/policy-roots.ts +32 -0
  1410. package/.versions/2.2.1/.pi/harnesses/lib/process-shared.ts +9 -0
  1411. package/.versions/2.2.1/.pi/harnesses/lib/resource-closure.js +26 -0
  1412. package/.versions/2.2.1/.pi/harnesses/lib/safe-source-read.js +29 -0
  1413. package/.versions/2.2.1/.pi/harnesses/lib/semantic-approval.ts +80 -0
  1414. package/.versions/2.2.1/.pi/harnesses/lib/session-target.ts +62 -0
  1415. package/.versions/2.2.1/.pi/harnesses/lib/spawned-peers.js +191 -0
  1416. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  1417. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  1418. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  1419. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  1420. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-json.js +37 -0
  1421. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-loader.js +53 -0
  1422. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  1423. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-triage.js +42 -0
  1424. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-v2.js +112 -0
  1425. package/.versions/2.2.1/.pi/harnesses/lib/system1/config.js +50 -0
  1426. package/.versions/2.2.1/.pi/harnesses/lib/system1/contracts.ts +154 -0
  1427. package/.versions/2.2.1/.pi/harnesses/lib/system1/demo.ts +95 -0
  1428. package/.versions/2.2.1/.pi/harnesses/lib/system1/jev.ts +503 -0
  1429. package/.versions/2.2.1/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  1430. package/.versions/2.2.1/.pi/harnesses/lib/system1/selection.js +11 -0
  1431. package/.versions/2.2.1/.pi/harnesses/lib/system1/service.ts +245 -0
  1432. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  1433. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  1434. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  1435. package/.versions/2.2.1/.pi/harnesses/lib/target-capabilities.js +7 -0
  1436. package/.versions/2.2.1/.pi/harnesses/lib/update-check.ts +227 -0
  1437. package/.versions/2.2.1/.pi/harnesses/lib/workspace-context.js +115 -0
  1438. package/.versions/2.2.1/.pi/harnesses/lib/workspace-context.ts +22 -0
  1439. package/.versions/2.2.1/.pi/harnesses/package-lock.json +2121 -0
  1440. package/.versions/2.2.1/.pi/harnesses/package.json +13 -0
  1441. package/.versions/2.2.1/.pi/prompts/af-build.md +27 -0
  1442. package/.versions/2.2.1/.pi/prompts/af-code-simplify.md +22 -0
  1443. package/.versions/2.2.1/.pi/prompts/af-constraints.md +31 -0
  1444. package/.versions/2.2.1/.pi/prompts/af-plan.md +17 -0
  1445. package/.versions/2.2.1/.pi/prompts/af-review.md +16 -0
  1446. package/.versions/2.2.1/.pi/prompts/af-set-hermes-telegram.md +15 -0
  1447. package/.versions/2.2.1/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  1448. package/.versions/2.2.1/.pi/prompts/af-setup-rules.md +20 -0
  1449. package/.versions/2.2.1/.pi/prompts/af-ship.md +17 -0
  1450. package/.versions/2.2.1/.pi/prompts/af-spec.md +15 -0
  1451. package/.versions/2.2.1/.pi/prompts/af-test.md +19 -0
  1452. package/.versions/2.2.1/.pi/skills/bowser/SKILL.md +145 -0
  1453. package/.versions/2.2.1/.version +1 -0
  1454. package/.versions/2.2.1/agents/architect.md +24 -0
  1455. package/.versions/2.2.1/agents/bowser.md +28 -0
  1456. package/.versions/2.2.1/agents/builder.md +55 -0
  1457. package/.versions/2.2.1/agents/code-reviewer.md +209 -0
  1458. package/.versions/2.2.1/agents/deep-researcher.md +32 -0
  1459. package/.versions/2.2.1/agents/documenter.md +22 -0
  1460. package/.versions/2.2.1/agents/plan-reviewer.md +83 -0
  1461. package/.versions/2.2.1/agents/planner.md +107 -0
  1462. package/.versions/2.2.1/agents/releaser.md +24 -0
  1463. package/.versions/2.2.1/agents/researcher.md +30 -0
  1464. package/.versions/2.2.1/agents/security-auditor.md +167 -0
  1465. package/.versions/2.2.1/agents/test-engineer.md +153 -0
  1466. package/.versions/2.2.1/agents/web-debugger.md +44 -0
  1467. package/.versions/2.2.1/agents/web-performance-auditor.md +194 -0
  1468. package/.versions/2.2.1/bin/catalog/harness-runtime-closure.json +85 -0
  1469. package/.versions/2.2.1/docs/ARCHITECTURE.md +1291 -0
  1470. package/.versions/2.2.1/docs/agent-fleet-setup.md +1161 -0
  1471. package/.versions/2.2.1/docs/claude-code-coms-bridge.md +147 -0
  1472. package/.versions/2.2.1/docs/codex-local-mcp.md +520 -0
  1473. package/.versions/2.2.1/docs/codex-session-bridge.md +44 -0
  1474. package/.versions/2.2.1/docs/codex-setup.md +183 -0
  1475. package/.versions/2.2.1/docs/coms-hermes-bridge.md +188 -0
  1476. package/.versions/2.2.1/docs/fleet-native-voice.md +151 -0
  1477. package/.versions/2.2.1/docs/getting-started.md +126 -0
  1478. package/.versions/2.2.1/docs/npm-install.md +535 -0
  1479. package/.versions/2.2.1/docs/pi-extensions.md +450 -0
  1480. package/.versions/2.2.1/docs/pi-setup.md +92 -0
  1481. package/.versions/2.2.1/docs/skill-anatomy.md +150 -0
  1482. package/.versions/2.2.1/install-manifest.json +3227 -0
  1483. package/.versions/2.2.1/justfile +246 -0
  1484. package/.versions/2.2.1/manifest-meta.json +1099 -0
  1485. package/.versions/2.2.1/references/accessibility-checklist.md +160 -0
  1486. package/.versions/2.2.1/references/communication-contract.md +26 -0
  1487. package/.versions/2.2.1/references/definition-of-done.md +67 -0
  1488. package/.versions/2.2.1/references/fleet-coordination-patterns.md +171 -0
  1489. package/.versions/2.2.1/references/observability-checklist.md +92 -0
  1490. package/.versions/2.2.1/references/orchestration-patterns.md +370 -0
  1491. package/.versions/2.2.1/references/performance-checklist.md +236 -0
  1492. package/.versions/2.2.1/references/prompting-patterns.md +380 -0
  1493. package/.versions/2.2.1/references/security-checklist.md +245 -0
  1494. package/.versions/2.2.1/references/testing-patterns.md +235 -0
  1495. package/.versions/2.2.1/references/workflow-authoring.md +304 -0
  1496. package/.versions/2.2.1/skills/_internal/grilling.md +59 -0
  1497. package/.versions/2.2.1/skills/browser-testing-with-devtools/SKILL.md +351 -0
  1498. package/.versions/2.2.1/skills/code-review-and-quality/SKILL.md +396 -0
  1499. package/.versions/2.2.1/skills/compound-learning/SKILL.md +137 -0
  1500. package/.versions/2.2.1/skills/constraint-driven-development/SKILL.md +338 -0
  1501. package/.versions/2.2.1/skills/constraint-driven-development/references/floor-guard.md +99 -0
  1502. package/.versions/2.2.1/skills/context-engineering/SKILL.md +341 -0
  1503. package/.versions/2.2.1/skills/deprecation-and-migration/SKILL.md +247 -0
  1504. package/.versions/2.2.1/skills/designing-agents/SKILL.md +394 -0
  1505. package/.versions/2.2.1/skills/designing-agents/pi-harness-authoring.md +222 -0
  1506. package/.versions/2.2.1/skills/drafting-workflows/SKILL.md +143 -0
  1507. package/.versions/2.2.1/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  1508. package/.versions/2.2.1/skills/fleet-connect/SKILL.md +29 -0
  1509. package/.versions/2.2.1/skills/fleet-connect.zip +0 -0
  1510. package/.versions/2.2.1/skills/fleet-native-voice/SKILL.md +103 -0
  1511. package/.versions/2.2.1/skills/fleet-native-voice/agents/openai.yaml +4 -0
  1512. package/.versions/2.2.1/skills/fleet-native-voice.zip +0 -0
  1513. package/.versions/2.2.1/skills/frontend-ui-engineering/SKILL.md +328 -0
  1514. package/.versions/2.2.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
  1515. package/.versions/2.2.1/skills/idea-refine/SKILL.md +182 -0
  1516. package/.versions/2.2.1/skills/idea-refine/examples.md +238 -0
  1517. package/.versions/2.2.1/skills/idea-refine/frameworks.md +99 -0
  1518. package/.versions/2.2.1/skills/idea-refine/refinement-criteria.md +113 -0
  1519. package/.versions/2.2.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
  1520. package/.versions/2.2.1/skills/incremental-implementation/SKILL.md +353 -0
  1521. package/.versions/2.2.1/skills/incremental-implementation.zip +0 -0
  1522. package/.versions/2.2.1/skills/interview-me/SKILL.md +226 -0
  1523. package/.versions/2.2.1/skills/orchestration-verification/SKILL.md +182 -0
  1524. package/.versions/2.2.1/skills/peer-coms/SKILL.md +90 -0
  1525. package/.versions/2.2.1/skills/performance-optimization/SKILL.md +496 -0
  1526. package/.versions/2.2.1/skills/planning-and-task-breakdown/SKILL.md +318 -0
  1527. package/.versions/2.2.1/skills/planning-and-task-breakdown.zip +0 -0
  1528. package/.versions/2.2.1/skills/repository-ai-setup/SKILL.md +135 -0
  1529. package/.versions/2.2.1/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  1530. package/.versions/2.2.1/skills/repository-ai-setup/references/apply-contract.md +74 -0
  1531. package/.versions/2.2.1/skills/repository-ai-setup/references/provenance-template.md +16 -0
  1532. package/.versions/2.2.1/skills/repository-ai-setup/references/setup-flow.md +108 -0
  1533. package/.versions/2.2.1/skills/repository-ai-setup/references/verify-setup.md +20 -0
  1534. package/.versions/2.2.1/skills/repository-ai-setup.zip +0 -0
  1535. package/.versions/2.2.1/skills/security-and-hardening/SKILL.md +524 -0
  1536. package/.versions/2.2.1/skills/spec-driven-development/SKILL.md +295 -0
  1537. package/.versions/2.2.1/skills/spec-driven-development.zip +0 -0
  1538. package/.versions/2.2.1/skills/using-agent-skills/SKILL.md +198 -0
  1539. package/.versions/2.2.1/vendor/agent-skills-upstream/LICENSE +21 -0
  1540. package/.versions/2.2.1/vendor/agent-skills-upstream/README.md +430 -0
  1541. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  1542. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  1543. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  1544. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  1545. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  1546. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  1547. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  1548. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  1549. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  1550. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  1551. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  1552. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  1553. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  1554. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  1555. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  1556. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  1557. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  1558. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  1559. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  1560. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  1561. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  1562. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  1563. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  1564. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  1565. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  1566. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  1567. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  1568. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  1569. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  1570. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  1571. package/.versions/2.2.2/.pi/agent-fleet/hermes/README.md +347 -0
  1572. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  1573. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  1574. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  1575. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  1576. package/.versions/2.2.2/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  1577. package/.versions/2.2.2/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  1578. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  1579. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  1580. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  1581. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  1582. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  1583. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  1584. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  1585. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  1586. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  1587. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  1588. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  1589. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  1590. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  1591. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  1592. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  1593. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  1594. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  1595. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  1596. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  1597. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  1598. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  1599. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  1600. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  1601. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  1602. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  1603. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  1604. package/.versions/2.2.2/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  1605. package/.versions/2.2.2/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  1606. package/.versions/2.2.2/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  1607. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  1608. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  1609. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  1610. package/.versions/2.2.2/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  1611. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  1612. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  1613. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  1614. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  1615. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  1616. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  1617. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  1618. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  1619. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  1620. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  1621. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  1622. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  1623. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  1624. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  1625. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  1626. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  1627. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  1628. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  1629. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  1630. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  1631. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  1632. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  1633. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  1634. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  1635. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  1636. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  1637. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  1638. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet.ts +244 -0
  1639. package/.versions/2.2.2/.pi/agent-fleet/scripts/flow.ts +166 -0
  1640. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  1641. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  1642. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  1643. package/.versions/2.2.2/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  1644. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  1645. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  1646. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  1647. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  1648. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  1649. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  1650. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  1651. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  1652. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  1653. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  1654. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  1655. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  1656. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  1657. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  1658. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  1659. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  1660. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  1661. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  1662. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  1663. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  1664. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  1665. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  1666. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  1667. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  1668. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  1669. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  1670. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  1671. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  1672. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  1673. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  1674. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  1675. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  1676. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  1677. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  1678. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  1679. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  1680. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  1681. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  1682. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  1683. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  1684. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  1685. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  1686. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  1687. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  1688. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  1689. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  1690. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  1691. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  1692. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  1693. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  1694. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  1695. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  1696. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  1697. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  1698. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  1699. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  1700. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  1701. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  1702. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  1703. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  1704. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  1705. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  1706. package/.versions/2.2.2/.pi/agent-fleet/scripts/package-lock.json +57 -0
  1707. package/.versions/2.2.2/.pi/agent-fleet/scripts/package.json +10 -0
  1708. package/.versions/2.2.2/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  1709. package/.versions/2.2.2/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  1710. package/.versions/2.2.2/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  1711. package/.versions/2.2.2/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  1712. package/.versions/2.2.2/.pi/agent-fleet/scripts/team-up.ts +378 -0
  1713. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  1714. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  1715. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  1716. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  1717. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  1718. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  1719. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  1720. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  1721. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  1722. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  1723. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  1724. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  1725. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  1726. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  1727. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  1728. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  1729. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  1730. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  1731. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  1732. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  1733. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  1734. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  1735. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  1736. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  1737. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  1738. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  1739. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  1740. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  1741. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  1742. package/.versions/2.2.2/.pi/agents/dispatch-policy.yaml +32 -0
  1743. package/.versions/2.2.2/.pi/agents/model-profiles.yaml +132 -0
  1744. package/.versions/2.2.2/.pi/agents/peers.yaml +147 -0
  1745. package/.versions/2.2.2/.pi/agents/teams.yaml +41 -0
  1746. package/.versions/2.2.2/.pi/agents/voices.yaml +13 -0
  1747. package/.versions/2.2.2/.pi/damage-control-rules.yaml +297 -0
  1748. package/.versions/2.2.2/.pi/extensions/btw/README.md +120 -0
  1749. package/.versions/2.2.2/.pi/extensions/btw/index.ts +916 -0
  1750. package/.versions/2.2.2/.pi/extensions/btw/package.json +6 -0
  1751. package/.versions/2.2.2/.pi/extensions/btw/state.js +179 -0
  1752. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  1753. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  1754. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  1755. package/.versions/2.2.2/.pi/extensions/compact-and-continue/README.md +42 -0
  1756. package/.versions/2.2.2/.pi/extensions/compact-and-continue/index.ts +136 -0
  1757. package/.versions/2.2.2/.pi/extensions/compact-and-continue/package.json +6 -0
  1758. package/.versions/2.2.2/.pi/extensions/mcp-bridge/README.md +46 -0
  1759. package/.versions/2.2.2/.pi/extensions/mcp-bridge/index.ts +206 -0
  1760. package/.versions/2.2.2/.pi/extensions/mcp-bridge/package.json +6 -0
  1761. package/.versions/2.2.2/.pi/extensions/package-lock.json +1175 -0
  1762. package/.versions/2.2.2/.pi/extensions/package.json +9 -0
  1763. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/README.md +224 -0
  1764. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/config.ts +199 -0
  1765. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  1766. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/index.ts +248 -0
  1767. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/package.json +6 -0
  1768. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  1769. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  1770. package/.versions/2.2.2/.pi/harnesses/agent-hub/README.md +1641 -0
  1771. package/.versions/2.2.2/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  1772. package/.versions/2.2.2/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  1773. package/.versions/2.2.2/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  1774. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  1775. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  1776. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  1777. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  1778. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  1779. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  1780. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  1781. package/.versions/2.2.2/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  1782. package/.versions/2.2.2/.pi/harnesses/agent-hub/artifacts.js +146 -0
  1783. package/.versions/2.2.2/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  1784. package/.versions/2.2.2/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  1785. package/.versions/2.2.2/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  1786. package/.versions/2.2.2/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  1787. package/.versions/2.2.2/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  1788. package/.versions/2.2.2/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  1789. package/.versions/2.2.2/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  1790. package/.versions/2.2.2/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  1791. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  1792. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  1793. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  1794. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  1795. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  1796. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  1797. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  1798. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  1799. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  1800. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  1801. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  1802. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  1803. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  1804. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  1805. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  1806. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  1807. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  1808. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  1809. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  1810. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  1811. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  1812. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  1813. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  1814. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
  1815. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  1816. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  1817. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  1818. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  1819. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  1820. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  1821. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  1822. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  1823. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  1824. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  1825. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  1826. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  1827. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  1828. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  1829. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  1830. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  1831. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  1832. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  1833. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  1834. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  1835. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  1836. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  1837. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  1838. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  1839. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  1840. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-window.js +108 -0
  1841. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  1842. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  1843. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  1844. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  1845. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  1846. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  1847. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  1848. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  1849. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  1850. package/.versions/2.2.2/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  1851. package/.versions/2.2.2/.pi/harnesses/agent-hub/delegate.ts +478 -0
  1852. package/.versions/2.2.2/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  1853. package/.versions/2.2.2/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  1854. package/.versions/2.2.2/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  1855. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  1856. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  1857. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  1858. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  1859. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  1860. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  1861. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  1862. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  1863. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  1864. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  1865. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  1866. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  1867. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  1868. package/.versions/2.2.2/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  1869. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  1870. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  1871. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  1872. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  1873. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  1874. package/.versions/2.2.2/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  1875. package/.versions/2.2.2/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  1876. package/.versions/2.2.2/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  1877. package/.versions/2.2.2/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  1878. package/.versions/2.2.2/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  1879. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  1880. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  1881. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  1882. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  1883. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  1884. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  1885. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  1886. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  1887. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  1888. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  1889. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  1890. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  1891. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  1892. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  1893. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  1894. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  1895. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  1896. package/.versions/2.2.2/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  1897. package/.versions/2.2.2/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
  1898. package/.versions/2.2.2/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  1899. package/.versions/2.2.2/.pi/harnesses/agent-hub/footer.ts +29 -0
  1900. package/.versions/2.2.2/.pi/harnesses/agent-hub/helpers.ts +269 -0
  1901. package/.versions/2.2.2/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  1902. package/.versions/2.2.2/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  1903. package/.versions/2.2.2/.pi/harnesses/agent-hub/index.ts +2722 -0
  1904. package/.versions/2.2.2/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  1905. package/.versions/2.2.2/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  1906. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  1907. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  1908. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  1909. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  1910. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  1911. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  1912. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  1913. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  1914. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  1915. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  1916. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  1917. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  1918. package/.versions/2.2.2/.pi/harnesses/agent-hub/no-progress.ts +627 -0
  1919. package/.versions/2.2.2/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
  1920. package/.versions/2.2.2/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  1921. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  1922. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  1923. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  1924. package/.versions/2.2.2/.pi/harnesses/agent-hub/package.json +7 -0
  1925. package/.versions/2.2.2/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  1926. package/.versions/2.2.2/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  1927. package/.versions/2.2.2/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  1928. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  1929. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  1930. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  1931. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  1932. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
  1933. package/.versions/2.2.2/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  1934. package/.versions/2.2.2/.pi/harnesses/agent-hub/presentation.ts +54 -0
  1935. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  1936. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  1937. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  1938. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  1939. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  1940. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  1941. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  1942. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  1943. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  1944. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  1945. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  1946. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  1947. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  1948. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  1949. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  1950. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  1951. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  1952. package/.versions/2.2.2/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  1953. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  1954. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  1955. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  1956. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  1957. package/.versions/2.2.2/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  1958. package/.versions/2.2.2/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  1959. package/.versions/2.2.2/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  1960. package/.versions/2.2.2/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  1961. package/.versions/2.2.2/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  1962. package/.versions/2.2.2/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  1963. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  1964. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  1965. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  1966. package/.versions/2.2.2/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  1967. package/.versions/2.2.2/.pi/harnesses/agent-hub/return-contract.js +371 -0
  1968. package/.versions/2.2.2/.pi/harnesses/agent-hub/return-extract.js +77 -0
  1969. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  1970. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  1971. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-findings.js +96 -0
  1972. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  1973. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  1974. package/.versions/2.2.2/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  1975. package/.versions/2.2.2/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  1976. package/.versions/2.2.2/.pi/harnesses/agent-hub/run-budget.js +362 -0
  1977. package/.versions/2.2.2/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  1978. package/.versions/2.2.2/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  1979. package/.versions/2.2.2/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  1980. package/.versions/2.2.2/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  1981. package/.versions/2.2.2/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  1982. package/.versions/2.2.2/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  1983. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  1984. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-health.js +110 -0
  1985. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-start.ts +42 -0
  1986. package/.versions/2.2.2/.pi/harnesses/agent-hub/spawn.ts +702 -0
  1987. package/.versions/2.2.2/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  1988. package/.versions/2.2.2/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  1989. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  1990. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  1991. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  1992. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  1993. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  1994. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  1995. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  1996. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  1997. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  1998. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  1999. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  2000. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  2001. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  2002. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  2003. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  2004. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  2005. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-runtime.ts +132 -0
  2006. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  2007. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  2008. package/.versions/2.2.2/.pi/harnesses/agent-hub/timeline.ts +72 -0
  2009. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  2010. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  2011. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  2012. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/action-executors.ts +216 -0
  2013. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  2014. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  2015. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  2016. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/context.ts +149 -0
  2017. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  2018. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
  2019. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  2020. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  2021. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  2022. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  2023. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  2024. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  2025. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  2026. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  2027. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  2028. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  2029. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  2030. package/.versions/2.2.2/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  2031. package/.versions/2.2.2/.pi/harnesses/agent-hub/types.ts +66 -0
  2032. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  2033. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  2034. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  2035. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  2036. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  2037. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  2038. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  2039. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  2040. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  2041. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  2042. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  2043. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  2044. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  2045. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  2046. package/.versions/2.2.2/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  2047. package/.versions/2.2.2/.pi/harnesses/agent-hub/version.ts +42 -0
  2048. package/.versions/2.2.2/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  2049. package/.versions/2.2.2/.pi/harnesses/agent-hub/work-mode.ts +183 -0
  2050. package/.versions/2.2.2/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  2051. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/README.md +59 -0
  2052. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/index.ts +571 -0
  2053. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  2054. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  2055. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  2056. package/.versions/2.2.2/.pi/harnesses/coms/README.md +105 -0
  2057. package/.versions/2.2.2/.pi/harnesses/coms/index.ts +308 -0
  2058. package/.versions/2.2.2/.pi/harnesses/coms/package.json +7 -0
  2059. package/.versions/2.2.2/.pi/harnesses/coms/version.ts +42 -0
  2060. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/README.md +161 -0
  2061. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/index.ts +659 -0
  2062. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/package.json +7 -0
  2063. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  2064. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  2065. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  2066. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  2067. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/version.ts +42 -0
  2068. package/.versions/2.2.2/.pi/harnesses/lib/approval-wait.ts +17 -0
  2069. package/.versions/2.2.2/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  2070. package/.versions/2.2.2/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  2071. package/.versions/2.2.2/.pi/harnesses/lib/clarification-policy.ts +9 -0
  2072. package/.versions/2.2.2/.pi/harnesses/lib/codex-compat.ts +97 -0
  2073. package/.versions/2.2.2/.pi/harnesses/lib/codex-contract.ts +259 -0
  2074. package/.versions/2.2.2/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  2075. package/.versions/2.2.2/.pi/harnesses/lib/coms-core-io.ts +422 -0
  2076. package/.versions/2.2.2/.pi/harnesses/lib/coms-core.ts +738 -0
  2077. package/.versions/2.2.2/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  2078. package/.versions/2.2.2/.pi/harnesses/lib/coms-observation.ts +74 -0
  2079. package/.versions/2.2.2/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  2080. package/.versions/2.2.2/.pi/harnesses/lib/coms-response-read.ts +107 -0
  2081. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  2082. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  2083. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-view.ts +112 -0
  2084. package/.versions/2.2.2/.pi/harnesses/lib/context-budget.ts +114 -0
  2085. package/.versions/2.2.2/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  2086. package/.versions/2.2.2/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  2087. package/.versions/2.2.2/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  2088. package/.versions/2.2.2/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  2089. package/.versions/2.2.2/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  2090. package/.versions/2.2.2/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  2091. package/.versions/2.2.2/.pi/harnesses/lib/damage-policy.ts +35 -0
  2092. package/.versions/2.2.2/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  2093. package/.versions/2.2.2/.pi/harnesses/lib/damage-result-view.ts +16 -0
  2094. package/.versions/2.2.2/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  2095. package/.versions/2.2.2/.pi/harnesses/lib/exact-permission-port.ts +38 -0
  2096. package/.versions/2.2.2/.pi/harnesses/lib/execution-trace.ts +45 -0
  2097. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  2098. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  2099. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  2100. package/.versions/2.2.2/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  2101. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  2102. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  2103. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  2104. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  2105. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  2106. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  2107. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  2108. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  2109. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  2110. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  2111. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  2112. package/.versions/2.2.2/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  2113. package/.versions/2.2.2/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  2114. package/.versions/2.2.2/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  2115. package/.versions/2.2.2/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  2116. package/.versions/2.2.2/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  2117. package/.versions/2.2.2/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  2118. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  2119. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  2120. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  2121. package/.versions/2.2.2/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  2122. package/.versions/2.2.2/.pi/harnesses/lib/fleet-panel.ts +34 -0
  2123. package/.versions/2.2.2/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  2124. package/.versions/2.2.2/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  2125. package/.versions/2.2.2/.pi/harnesses/lib/fleet-selection.ts +24 -0
  2126. package/.versions/2.2.2/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  2127. package/.versions/2.2.2/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  2128. package/.versions/2.2.2/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  2129. package/.versions/2.2.2/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  2130. package/.versions/2.2.2/.pi/harnesses/lib/herdr-client.ts +472 -0
  2131. package/.versions/2.2.2/.pi/harnesses/lib/herdr-presence.ts +399 -0
  2132. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  2133. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  2134. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  2135. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  2136. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  2137. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  2138. package/.versions/2.2.2/.pi/harnesses/lib/identical-dialog.ts +27 -0
  2139. package/.versions/2.2.2/.pi/harnesses/lib/installation-state.js +62 -0
  2140. package/.versions/2.2.2/.pi/harnesses/lib/peer-target.ts +24 -0
  2141. package/.versions/2.2.2/.pi/harnesses/lib/policy-roots.js +117 -0
  2142. package/.versions/2.2.2/.pi/harnesses/lib/policy-roots.ts +32 -0
  2143. package/.versions/2.2.2/.pi/harnesses/lib/process-shared.ts +9 -0
  2144. package/.versions/2.2.2/.pi/harnesses/lib/resource-closure.js +26 -0
  2145. package/.versions/2.2.2/.pi/harnesses/lib/safe-source-read.js +29 -0
  2146. package/.versions/2.2.2/.pi/harnesses/lib/semantic-approval.ts +80 -0
  2147. package/.versions/2.2.2/.pi/harnesses/lib/session-target.ts +62 -0
  2148. package/.versions/2.2.2/.pi/harnesses/lib/spawned-peers.js +191 -0
  2149. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  2150. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  2151. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  2152. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  2153. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-json.js +37 -0
  2154. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-loader.js +53 -0
  2155. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  2156. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-triage.js +42 -0
  2157. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-v2.js +112 -0
  2158. package/.versions/2.2.2/.pi/harnesses/lib/system1/config.js +50 -0
  2159. package/.versions/2.2.2/.pi/harnesses/lib/system1/contracts.ts +154 -0
  2160. package/.versions/2.2.2/.pi/harnesses/lib/system1/demo.ts +95 -0
  2161. package/.versions/2.2.2/.pi/harnesses/lib/system1/jev.ts +503 -0
  2162. package/.versions/2.2.2/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  2163. package/.versions/2.2.2/.pi/harnesses/lib/system1/selection.js +11 -0
  2164. package/.versions/2.2.2/.pi/harnesses/lib/system1/service.ts +245 -0
  2165. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  2166. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  2167. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  2168. package/.versions/2.2.2/.pi/harnesses/lib/target-capabilities.js +7 -0
  2169. package/.versions/2.2.2/.pi/harnesses/lib/update-check.ts +227 -0
  2170. package/.versions/2.2.2/.pi/harnesses/lib/workspace-context.js +115 -0
  2171. package/.versions/2.2.2/.pi/harnesses/lib/workspace-context.ts +22 -0
  2172. package/.versions/2.2.2/.pi/harnesses/package-lock.json +2121 -0
  2173. package/.versions/2.2.2/.pi/harnesses/package.json +13 -0
  2174. package/.versions/2.2.2/.pi/prompts/af-build.md +27 -0
  2175. package/.versions/2.2.2/.pi/prompts/af-code-simplify.md +22 -0
  2176. package/.versions/2.2.2/.pi/prompts/af-constraints.md +31 -0
  2177. package/.versions/2.2.2/.pi/prompts/af-plan.md +17 -0
  2178. package/.versions/2.2.2/.pi/prompts/af-review.md +16 -0
  2179. package/.versions/2.2.2/.pi/prompts/af-set-hermes-telegram.md +15 -0
  2180. package/.versions/2.2.2/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  2181. package/.versions/2.2.2/.pi/prompts/af-setup-rules.md +20 -0
  2182. package/.versions/2.2.2/.pi/prompts/af-ship.md +17 -0
  2183. package/.versions/2.2.2/.pi/prompts/af-spec.md +15 -0
  2184. package/.versions/2.2.2/.pi/prompts/af-test.md +19 -0
  2185. package/.versions/2.2.2/.pi/skills/bowser/SKILL.md +145 -0
  2186. package/.versions/2.2.2/.version +1 -0
  2187. package/.versions/2.2.2/agents/architect.md +24 -0
  2188. package/.versions/2.2.2/agents/bowser.md +28 -0
  2189. package/.versions/2.2.2/agents/builder.md +55 -0
  2190. package/.versions/2.2.2/agents/code-reviewer.md +209 -0
  2191. package/.versions/2.2.2/agents/deep-researcher.md +32 -0
  2192. package/.versions/2.2.2/agents/documenter.md +22 -0
  2193. package/.versions/2.2.2/agents/plan-reviewer.md +83 -0
  2194. package/.versions/2.2.2/agents/planner.md +107 -0
  2195. package/.versions/2.2.2/agents/releaser.md +24 -0
  2196. package/.versions/2.2.2/agents/researcher.md +30 -0
  2197. package/.versions/2.2.2/agents/security-auditor.md +167 -0
  2198. package/.versions/2.2.2/agents/test-engineer.md +153 -0
  2199. package/.versions/2.2.2/agents/web-debugger.md +44 -0
  2200. package/.versions/2.2.2/agents/web-performance-auditor.md +194 -0
  2201. package/.versions/2.2.2/bin/catalog/harness-runtime-closure.json +85 -0
  2202. package/.versions/2.2.2/docs/ARCHITECTURE.md +1291 -0
  2203. package/.versions/2.2.2/docs/agent-fleet-setup.md +1161 -0
  2204. package/.versions/2.2.2/docs/claude-code-coms-bridge.md +147 -0
  2205. package/.versions/2.2.2/docs/codex-local-mcp.md +520 -0
  2206. package/.versions/2.2.2/docs/codex-session-bridge.md +44 -0
  2207. package/.versions/2.2.2/docs/codex-setup.md +183 -0
  2208. package/.versions/2.2.2/docs/coms-hermes-bridge.md +188 -0
  2209. package/.versions/2.2.2/docs/fleet-native-voice.md +151 -0
  2210. package/.versions/2.2.2/docs/getting-started.md +126 -0
  2211. package/.versions/2.2.2/docs/npm-install.md +535 -0
  2212. package/.versions/2.2.2/docs/pi-extensions.md +450 -0
  2213. package/.versions/2.2.2/docs/pi-setup.md +92 -0
  2214. package/.versions/2.2.2/docs/skill-anatomy.md +150 -0
  2215. package/.versions/2.2.2/install-manifest.json +3227 -0
  2216. package/.versions/2.2.2/justfile +246 -0
  2217. package/.versions/2.2.2/manifest-meta.json +1099 -0
  2218. package/.versions/2.2.2/references/accessibility-checklist.md +160 -0
  2219. package/.versions/2.2.2/references/communication-contract.md +26 -0
  2220. package/.versions/2.2.2/references/definition-of-done.md +67 -0
  2221. package/.versions/2.2.2/references/fleet-coordination-patterns.md +171 -0
  2222. package/.versions/2.2.2/references/observability-checklist.md +92 -0
  2223. package/.versions/2.2.2/references/orchestration-patterns.md +370 -0
  2224. package/.versions/2.2.2/references/performance-checklist.md +236 -0
  2225. package/.versions/2.2.2/references/prompting-patterns.md +380 -0
  2226. package/.versions/2.2.2/references/security-checklist.md +245 -0
  2227. package/.versions/2.2.2/references/testing-patterns.md +235 -0
  2228. package/.versions/2.2.2/references/workflow-authoring.md +304 -0
  2229. package/.versions/2.2.2/skills/_internal/grilling.md +59 -0
  2230. package/.versions/2.2.2/skills/browser-testing-with-devtools/SKILL.md +351 -0
  2231. package/.versions/2.2.2/skills/code-review-and-quality/SKILL.md +396 -0
  2232. package/.versions/2.2.2/skills/compound-learning/SKILL.md +137 -0
  2233. package/.versions/2.2.2/skills/constraint-driven-development/SKILL.md +338 -0
  2234. package/.versions/2.2.2/skills/constraint-driven-development/references/floor-guard.md +99 -0
  2235. package/.versions/2.2.2/skills/context-engineering/SKILL.md +341 -0
  2236. package/.versions/2.2.2/skills/deprecation-and-migration/SKILL.md +247 -0
  2237. package/.versions/2.2.2/skills/designing-agents/SKILL.md +394 -0
  2238. package/.versions/2.2.2/skills/designing-agents/pi-harness-authoring.md +222 -0
  2239. package/.versions/2.2.2/skills/drafting-workflows/SKILL.md +143 -0
  2240. package/.versions/2.2.2/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  2241. package/.versions/2.2.2/skills/fleet-connect/SKILL.md +29 -0
  2242. package/.versions/2.2.2/skills/fleet-connect.zip +0 -0
  2243. package/.versions/2.2.2/skills/fleet-native-voice/SKILL.md +103 -0
  2244. package/.versions/2.2.2/skills/fleet-native-voice/agents/openai.yaml +4 -0
  2245. package/.versions/2.2.2/skills/fleet-native-voice.zip +0 -0
  2246. package/.versions/2.2.2/skills/frontend-ui-engineering/SKILL.md +328 -0
  2247. package/.versions/2.2.2/skills/git-workflow-and-versioning/SKILL.md +316 -0
  2248. package/.versions/2.2.2/skills/idea-refine/SKILL.md +182 -0
  2249. package/.versions/2.2.2/skills/idea-refine/examples.md +238 -0
  2250. package/.versions/2.2.2/skills/idea-refine/frameworks.md +99 -0
  2251. package/.versions/2.2.2/skills/idea-refine/refinement-criteria.md +113 -0
  2252. package/.versions/2.2.2/skills/idea-refine/scripts/idea-refine.sh +15 -0
  2253. package/.versions/2.2.2/skills/incremental-implementation/SKILL.md +353 -0
  2254. package/.versions/2.2.2/skills/incremental-implementation.zip +0 -0
  2255. package/.versions/2.2.2/skills/interview-me/SKILL.md +226 -0
  2256. package/.versions/2.2.2/skills/orchestration-verification/SKILL.md +182 -0
  2257. package/.versions/2.2.2/skills/peer-coms/SKILL.md +90 -0
  2258. package/.versions/2.2.2/skills/performance-optimization/SKILL.md +496 -0
  2259. package/.versions/2.2.2/skills/planning-and-task-breakdown/SKILL.md +318 -0
  2260. package/.versions/2.2.2/skills/planning-and-task-breakdown.zip +0 -0
  2261. package/.versions/2.2.2/skills/repository-ai-setup/SKILL.md +135 -0
  2262. package/.versions/2.2.2/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  2263. package/.versions/2.2.2/skills/repository-ai-setup/references/apply-contract.md +74 -0
  2264. package/.versions/2.2.2/skills/repository-ai-setup/references/provenance-template.md +16 -0
  2265. package/.versions/2.2.2/skills/repository-ai-setup/references/setup-flow.md +108 -0
  2266. package/.versions/2.2.2/skills/repository-ai-setup/references/verify-setup.md +20 -0
  2267. package/.versions/2.2.2/skills/repository-ai-setup.zip +0 -0
  2268. package/.versions/2.2.2/skills/security-and-hardening/SKILL.md +524 -0
  2269. package/.versions/2.2.2/skills/spec-driven-development/SKILL.md +295 -0
  2270. package/.versions/2.2.2/skills/spec-driven-development.zip +0 -0
  2271. package/.versions/2.2.2/skills/using-agent-skills/SKILL.md +198 -0
  2272. package/.versions/2.2.2/vendor/agent-skills-upstream/LICENSE +21 -0
  2273. package/.versions/2.2.2/vendor/agent-skills-upstream/README.md +430 -0
  2274. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  2275. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  2276. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  2277. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  2278. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  2279. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  2280. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  2281. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  2282. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  2283. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  2284. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  2285. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  2286. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  2287. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  2288. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  2289. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  2290. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  2291. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  2292. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  2293. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  2294. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  2295. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  2296. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  2297. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  2298. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  2299. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  2300. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  2301. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  2302. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  2303. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  2304. package/CHANGELOG.md +62 -0
  2305. package/README.md +7 -10
  2306. package/bin/lib/set-codex-mcp.js +1 -1
  2307. package/bin/lib/validate-overrides.js +8 -1
  2308. package/docs/ARCHITECTURE.md +122 -26
  2309. package/docs/MIGRATION-agent-fleet.md +26 -5
  2310. package/docs/agent-fleet-setup.md +44 -26
  2311. package/docs/claude-code-coms-bridge.md +1 -1
  2312. package/docs/codex-local-mcp.md +29 -12
  2313. package/docs/codex-session-bridge.md +2 -2
  2314. package/docs/codex-setup.md +1 -1
  2315. package/docs/fleet-native-voice.md +10 -4
  2316. package/docs/npm-install.md +1 -1
  2317. package/docs/pi-extensions.md +13 -18
  2318. package/docs/system1-agentic.md +1 -1
  2319. package/docs/system1-file-discovery.md +2 -2
  2320. package/docs/workflows.md +24 -1
  2321. package/install-manifest.json +16 -28
  2322. package/justfile +3 -4
  2323. package/manifest-meta.json +14 -2
  2324. package/package.json +4 -2
  2325. package/skills/fleet-connect/SKILL.md +20 -16
  2326. package/skills/fleet-connect.zip +0 -0
  2327. package/skills/fleet-native-voice.zip +0 -0
  2328. package/.pi/harnesses/agent-hub/commands/work-mode.ts +0 -29
  2329. package/.pi/harnesses/agent-hub/work-mode-controls.ts +0 -56
  2330. package/agents/orchestrator.md +0 -22
@@ -0,0 +1,2722 @@
1
+ import {createCodexBootstrapControls} from './codex-bootstrap.ts';
2
+ import {homedir} from 'node:os';
3
+ import { privateDeclarationHash, type PrivateProofUse } from './private-config-review.ts';
4
+ import { registerDiscoveryHub, configureDiscoveryHub, resetDiscoveryHub, discoveryHubEnabled, discoveryManagedReadbackAllowed, prepareDiscoveryNative } from './file-discovery/hub.ts';
5
+ import { registerDamageGuardHub, configureDamageGuardHub, resetDamageGuardHub, acceptDamageGuardInput, prepareDamageGuardNative } from './damage-guard-hub.ts';
6
+ import { bindSemanticScope } from '../lib/semantic-approval.ts';
7
+ import { registerAgenticHub, configureAgenticHub, agenticHubEnabled, agenticHubRuntime, resetAgenticHub } from './agentic-hub.ts';
8
+ import {worktreeConsumerService} from '../lib/system1/worktree-service.ts';
9
+ import { loadSystem1Snapshot } from "../lib/system1/config-loader.js";
10
+ import { normalizeSystem1Config } from "../lib/system1/config-v2.js";
11
+ import { registerDispatchTriage } from "./tools/dispatch-triage.ts";
12
+ import { createTriageRuntime } from "./dispatch-triage-runtime.ts";
13
+ import { type TriageConfig, type TriageInput } from "./dispatch-triage-contract.ts";
14
+ import { loadTaskTriageConfig } from "./task-triage-config.ts";
15
+ import { TASK_TRIAGE_MODEL } from "./task-triage-contract.ts";
16
+ import type { JevTransport } from "../lib/system1/jev.ts";
17
+ import { createTaskTriageRuntime, evaluatedTaskTriageInputChanged, TASK_TRIAGE_RUNTIME_ENTRY } from "./task-triage-runtime.ts";
18
+ import { adoptTaskTriageState, applyTaskTriageAdditions, recoverTaskTriageProcessState } from "./task-triage-obligations.ts";
19
+ import { confirmTaskTriageAction, confirmTaskTriageWaiver, consumeActionGrant, taskTriageActionAuditRecord, type TaskTriageActionObservation } from "./task-triage-authorization.ts";
20
+ import { registerTaskTriageRecover } from "./commands/task-triage-recover.ts";
21
+ import { registerTaskTriageWaiver } from "./commands/task-triage-waive.ts";
22
+ import { createCommunicationStore } from "./system1-communication-store.ts";
23
+ import { openSystem1Communication } from "./ui/system1-communication.ts";
24
+ import { registerRetry } from "./commands/retry.ts";
25
+ import { createHash } from "node:crypto";
26
+ import { loadProactiveConfig, isCaptureEnabled } from "./proactive-config.ts";
27
+ import { createProactiveRuntime, createHubCapture, composeHubProactive } from "./proactive-runtime.ts";
28
+ import type { ProactiveConfig } from "./proactive-types.ts";
29
+ import { registerRecover, runRecoverCommand } from "./commands/recover.ts";
30
+ import { createNoProgressGuard } from "./no-progress.ts";
31
+ import { renderNextInvocation, renderRecoverCommands } from './recover-policy.ts';
32
+ import { closeEvidenceSession, pruneEvidenceSessions } from "./execution-evidence.ts";
33
+ import { hasExplicitDispatcher, isCompleteProfile, dispatcherSelection, type ModelProfiles } from './config/model-profiles.ts';
34
+ import { createProfileActivation } from './policy/profile-activation.ts';
35
+ import { readActiveProfile, profileWorkInFlight, withProfileWork, assertProfileModel, profilePeerGate } from './policy/profile-runtime.ts';
36
+ import { resolveAssist } from './assist-profile.ts';
37
+ import { registerFilesystemTool, FILESYSTEM_POLICY_ROOTS_ENV } from './filesystem-tool.ts';
38
+ /** Agent Hub composition root: constructs mutable state, contexts, registrars, and ordered lifecycle ports. */
39
+
40
+ import type { AgentDef, AgentState, ResearchState } from "./types.ts";
41
+ import { DEFAULT_OVERRIDES, THINKING_LEVELS, parseAgentTeamOverrides, type AgentTeamOverrides } from "./config/overrides.ts";
42
+ import { loadAgentConfiguration } from "./config/agents.ts";
43
+ import { abbrevThinking, displayName, extractAskUserQuestions, extractNeedsResearch, resolveDelegateExtension, resolveThinkingLevel } from "./presentation.ts";
44
+ import { MAX_LIVE_ENTRY_CHARS, appendTimelineEvent, appendTimelineText, flushTimelineStore } from "./timeline.ts";
45
+ import type { ExtensionAPI, ExtensionContext, Theme } from "@mariozechner/pi-coding-agent";
46
+ import { DynamicBorder, getMarkdownTheme as getPiMdTheme, copyToClipboard } from "@mariozechner/pi-coding-agent";
47
+ import {
48
+ Text, Box, Container, Spacer, Markdown, matchesKey, Key,
49
+ type AutocompleteItem, truncateToWidth, visibleWidth,
50
+ } from "@mariozechner/pi-tui";
51
+ import { spawn, type ChildProcess } from "child_process";
52
+ import { spawnPiAgent, spawnPiAgentWithModelFallback, killPiTree, type Termination } from "./spawn.ts";
53
+ import { fenceOperatorCancel } from "./drift-runtime.ts";
54
+ import { researchTerminationOutcome, researchWatchdogSpawnOptions } from "./research-watchdog.ts";
55
+ import { composeFleetFooterHint, renderHubFooterLeft } from "./footer.ts";
56
+ import { HARNESS_VERSION, registerVersionStatus } from "./version.ts";
57
+ import { cancelLocalOwnedProcess, cancelLocalWaitOnly, monitorKeyForAgent } from "./monitor-control.ts";
58
+ import { createMonitorLifecycle } from "./monitor-lifecycle.ts";
59
+ import { createMonitorSessionBridge } from "./monitor-session-bridge.ts";
60
+ import {
61
+ AGENT_ID_ENV, ASK_ENDPOINT_ENV, EXEMPTIONS_FILE_ENV,
62
+ exemptionsFilePath, type AccessRequest,
63
+ } from "../lib/damage-control-shared.ts";
64
+ import { applyModelOverride, clampDelegateDepth, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
65
+ import { DEFAULT_TASK_TIER, addTaskClockWait, applyTierChange, blockingFindingCap, checkTierPersonaGate, createTaskClock, isReviewPersona, openTaskClock, reviewBudgetClause } from "./run-budget.js";
66
+ import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
67
+ import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
68
+ import { checkExternalBlockerGate, extractExternalBlockers } from "./external-blocker.js";
69
+ import { DEFAULT_RUN_HISTORY_KEEP, normalizeRunHistoryKeep } from "./run-namespace.js";
70
+ import { refreshTaskBrief } from "./task-brief.ts";
71
+ import { validateAssertionBatch } from "./assertion-ledger.js";
72
+ import { DEFAULT_PROVIDER_LIMITS, createProviderSemaphore, parseProviderLimits } from "./provider-semaphore.js";
73
+ import {
74
+ PANE_PROMPT_TIMEOUT_MS,
75
+ launchPeerInPane,
76
+ peerReadyVerdict,
77
+ unaddressedPeerSweep,
78
+ } from "../lib/spawned-peers.js";
79
+ import { contextPct, estimatePromptTokens, resolveContextWindow } from "./context-window.js";
80
+ import { DEFAULT_WATCHDOG_SETTING, WATCHDOG_SETTINGS, normalizeWatchdogSetting, resolveWatchdogActive } from "./drift-watchdog.js";
81
+ import { createWatchdogActivity, createTaskTriageActivity, type WatchdogActivity, type TaskTriageActivity } from "./system1-activity.ts";
82
+ import { createWatchdogSystem1Session, disposeWatchdogSystem1Session, readWatchdogSystem1Snapshot, type WatchdogSystem1Session } from "./system1-runtime.ts";
83
+ import { shouldExtractReturn } from "./return-extract.js";
84
+ import { crossCheck, deliveryDisposition, extractAssertionIds, parseDeliveredReturn } from "./return-contract.js";
85
+ import { checkScope, diffAgainst, revisionOf, revisionScopes, snapshotWorktree, worktreeRevision } from "./scope-gate.js";
86
+ import { validateEvidence } from "./evidence-rules.js";
87
+ import { comsRequiredRefusal, explicitComsRefusal, parseDispatchPolicy, resolveDispatchBackend } from "./backend-policy.js";
88
+ import { NATIVE_ROSTER_ENTRY_TYPE, RETIRED_WORK_MODE_NOTICE, WORK_MODE_ENTRY_TYPE, persistedNativeRosterState, resolveSessionRoster, sessionSavedInRetiredWorkMode, type WorkMode } from "./work-mode.ts";
89
+ import { registerAgentsTeam } from "./commands/agents-team.ts";
90
+ import { registerAgentsList } from "./commands/agents-list.ts";
91
+ import { registerAgentsHistory } from "./commands/agents-history.ts";
92
+ import { registerAgentsAdd } from "./commands/agents-add.ts";
93
+ import { registerAgentsDrop } from "./commands/agents-drop.ts";
94
+ import { registerAgentsSave } from "./commands/agents-save.ts";
95
+ import { registerAgentsKill } from "./commands/agents-kill.ts";
96
+ import { registerAgentsRestart } from "./commands/agents-restart.ts";
97
+ import { registerContextCommand } from "./commands/context-command.ts";
98
+ import { registerAudit } from "./commands/audit.ts";
99
+ import { registerConfig } from "./commands/config.ts";
100
+ import { showSessionAudit } from "./session-audit.ts";
101
+ import { createExecutionTrace, createNativeExecutionTrace, registerExecutionTrace, EXECUTION_TRACE_ENTRY } from "./execution-trace.ts";
102
+ import { beginRuntimeTrace } from "../lib/execution-trace.ts";
103
+ import { buildWatchdogReport, buildProactiveReport, commandProactiveLabels, readProactiveReport, formatWatchdogStatus, readWatchdogEvents } from "./system1-report.ts";
104
+ import { createProcessState, normalizeProcessState, processAllowsPersona, processOpenObligations, evaluateProcessObligations, latestProcessState, processAuditRecord, processTaskIdentityConflicts, processPreEffectGate, missingProcessRoleRecoveryHints, activeAdditionRecoveryHints, taskTransitionRecoveryHint, transitionToolDecision, latestPendingTaskTransition, nestedRepositoriesInUse, TASK_TRANSITION_ENTRY_TYPE, type ProcessObligationState, type ProcessVerdict } from "./process-obligations.ts";
105
+ import { registerHubReport } from "./commands/hub-report.ts";
106
+ import { registerZoom } from "./commands/zoom.ts";
107
+ import { registerDispatchPolicy } from "./commands/dispatch-policy.ts";
108
+ import { registerAgentModel } from "./commands/agent-model.ts";
109
+ import { registerAgentModelThinking } from "./commands/agent-model-thinking.ts";
110
+ import { registerModels } from "./commands/models.ts";
111
+ import { registerAgentModelsSubstitute } from "./commands/agent-models-substitute.ts";
112
+ import { registerWatchdog } from "./commands/watchdog.ts";
113
+ import { registerComs } from "./commands/coms.ts";
114
+ import { registerHandoff } from "./commands/handoff.ts";
115
+ import { registerCompound } from "./commands/compound.ts";
116
+ import { registerPoll } from "./commands/poll.ts";
117
+ import { registerDebate } from "./commands/debate.ts";
118
+ import type { CommandContext } from "./commands/context.ts";
119
+ import { formatAfPollStarted, formatAfPollVoiceProgress, handleAfPoll, runAfPoll, type AfPollHandleInput } from "./poll-command.ts";
120
+ import { registerPollPanel } from "./tools/poll-panel.ts";
121
+ import { formatAfDebateStarted, formatAfDebateVoiceProgress, handleAfDebate } from "./debate-command.ts";
122
+ import { registerDispatchAgent } from "./tools/dispatch-agent.ts";
123
+ import { registerSpawnResearch } from "./tools/spawn-research.ts";
124
+ import { registerRunFlow } from "./tools/run-flow.ts";
125
+ import { resolvePersona as resolveFlowPersona } from "../../agent-fleet/scripts/workflows/lib/personas.ts";
126
+ import { assertProfileModel as assertFlowProfileModel } from "../../agent-fleet/scripts/workflows/lib/model-profile.ts";
127
+ import { registerSetTaskTier } from "./tools/set-task-tier.ts";
128
+ import { registerTeamAdjust } from "./tools/team-adjust.ts";
129
+ import { registerVerificationContract } from "./tools/verification-contract.ts";
130
+ import { registerComsTools } from "./tools/coms-tools.ts";
131
+ import { paneTail, peerManifest, peerPersonaExists, registerFleetTools, spawnDelaySeconds, STAGGER_ENV_VAR, waitForPeerRegistration } from "./tools/fleet-tools.ts";
132
+ import type { ToolContext } from "./tools/context.ts";
133
+ import { createToolExecutionOrchestration } from "./tools/execution-orchestration.ts";
134
+ import { latestPersistedCapabilityState, type ContextState, type PendingOperation } from "./capability-packs.ts";
135
+ import { contextPressureDiagnostic, createContextPressureState, pressureCapabilityState, transitionContextPressure, type ContextPressureState } from "./context-pressure.ts";
136
+ import { confirmationOutcome, capabilityConfirmationPack, capabilityConfirmationQuestion, type ConfirmableCapabilityPack } from "./capability-confirmation.ts";
137
+ import { confirmRecoverAction, confirmTaskSupersession, createReservedTaskIdentityReset } from "./budget-recovery.ts";
138
+ import { requestRuntimeAsk } from "../ask-user-remote/runtime-ask.ts";
139
+ import { observeAskUserResults } from "../ask-user-remote/index.ts";
140
+ import {PermissionRelay,registerPermissionRelay,handlePermissionEnvelope} from './permission-relay.ts';
141
+ import { handleQuestionEnvelope, registerQuestionPeer, questionChannel } from "../ask-user-remote/questions.ts";
142
+ import { handleObservationEnvelope } from "../lib/coms-observation.ts";
143
+ import { handleInstructionReceipt } from "../lib/coms-instruction-receipts.ts";
144
+ import { buildHubPeerSpawnPlan, launchHubPeerInPane } from "./peer-spawn-plan.ts";
145
+ import { RESEARCH_TOOLS, createResearchRuntime, parseResearchHandle } from "./research/runtime.ts";
146
+ import { requireSafetyHarness, resolveSafetyHarness } from "./safety-routing.ts";
147
+ import { createAccessApprovalRouter } from "./access-approval.ts";
148
+ import { readdirSync, readFileSync, existsSync, mkdirSync, unlinkSync, writeFileSync, rmSync } from "fs";
149
+ import { herdrPaneId } from "../lib/herdr-presence.ts";
150
+ import { herdr as herdrApi, herdrAvailable } from "../lib/herdr-client.ts";
151
+ import {
152
+ abbreviateModel,
153
+ createComsPeer,
154
+ hexFg,
155
+ nowIso,
156
+ readAllRegistryEntries,
157
+ readAllRegistryEntriesAcrossProjects,
158
+ type ComsIdentity,
159
+ type RegistryEntry as ComsRegistryEntry,
160
+ TIMEOUT_MS,
161
+ } from "../lib/coms-core.ts";
162
+ import { createGridUI } from "./ui/grid.ts";
163
+ import { createFleetSource } from "./ui/fleet-source.ts";
164
+ import { buildFleetRows } from "../lib/fleet-read-model.ts";
165
+ import { createFleetActions } from "./ui/fleet-actions.ts";
166
+ import { createDetailPanel } from "./ui/detail-panel.ts";
167
+ import { createFleetDashboard } from "./ui/fleet-dashboard.ts";
168
+ import { createContextBudgetUi } from "./ui/context-budget.ts";
169
+ import { createFleetConfigUi } from "../lib/fleet-config/ui.ts";
170
+ import { createPoolPresentation } from "./ui/pool.ts";
171
+ import { registerInputShortcuts } from "./input/shortcuts.ts";
172
+ import { createCompletionPresentation } from "./input/completions.ts";
173
+ import { createResearchControls } from "./research/controls.ts";
174
+ import { currentPiRuntimeVersion } from "./context-continuity-compat.ts";
175
+ import { createContextPressureLifecycle, createContextPressureRootState } from "./lifecycle/context-pressure.ts";
176
+ import { createTurnLifecycleHandlers, registerTurnPresence, registerTurnSettlement } from "./lifecycle/turn-handlers.ts";
177
+ import { createMonitorSession } from "./lifecycle/monitor-session.ts";
178
+ import { applySessionOverrides, registerSessionOrchestration, resetHubSession } from "./lifecycle/session-orchestration.ts";
179
+ import { openZoom, type TimelineEntry, type Zoomable } from "./ui/zoom.ts";
180
+ import { openHistory } from "./ui/history.ts";
181
+ import { createExecutionHistoryStore, type HistoryEntry } from "./ui/history-store.ts";
182
+ import { createHistoryProjectionMemo, projectCoordinationHistory } from "./history-projection.ts";
183
+ import { isTaskContinuation } from "./task-continuation.ts";
184
+ import { registerOperatorWatchdog } from "./operator-watchdog.ts";
185
+ import type { DriftJudgeInput } from "./dispatch-coms.ts";
186
+ import { createDispatchComs, createDispatchNative, createDispatchObservability, type DelegationChild } from "./dispatch-core.ts";
187
+ import type { FleetRow } from "../lib/fleet-read-model.ts";
188
+ import { gridColumnsForSize } from "../lib/fleet-dashboard-ops.ts";
189
+ import { createFleetTranscriptStore } from "../lib/fleet-transcript-store.ts";
190
+ import type { ContextBudgetComponent } from "../lib/context-budget.ts";
191
+ import { buildHubSystemPrompt as assembleHubPrompt } from "./prompts/system-prompt.ts";
192
+ import type { HubPromptContext } from "./prompts/context.ts";
193
+ import { buildSessionStartNotice, createSessionFooter } from "./prompts/session-start.ts";
194
+ import { registerSessionStart } from "./session-start.ts";
195
+ import { createHubStateContext } from "./context/hub-state.ts";
196
+ import { createAgentStateFactory } from "./context/agent-state.ts";
197
+ import { createBudgetContext, createSessionTotals, freshTurnReport, type TurnReport } from "./context/budgets.ts";
198
+ import { createAssertionsArtifactsContext, type Assertion, type InputArtifactPreview } from "./context/assertions-artifacts.ts";
199
+ import { createModelPolicy } from "./policy/models.ts";
200
+ import { createRosterPolicy } from "./policy/roster.ts";
201
+ import { createWorkModePolicy } from "./policy/work-mode.ts";
202
+ import { catalogSnapshot, latestPersistedToolCatalog, toolCatalogNotice, TOOL_CATALOG_ENTRY_TYPE, type ToolCatalogDelta } from "./tool-catalog-state.ts";
203
+ import { createToolCatalogRuntime } from "./tool-catalog-runtime.ts";
204
+ import { createUnknownToolCounter, latestPersistedUnknownToolCounter, observeUnknownToolCalls, restoreUnknownToolCounter, unknownToolNotice, UNKNOWN_TOOL_COUNTER_ENTRY_TYPE } from "./unknown-tool-counter.ts";
205
+ import { buildProjectDocsProtocol, buildProjectRulesProtocol, nativeResearchSystemPrompt } from "../lib/context-budget-child-prompt.ts";
206
+ import { parseEnvFile, resolveEnvFilePath } from "../../agent-fleet/scripts/lib/herdr-layout.ts";
207
+ import { worktreeTag } from "../../agent-fleet/scripts/lib/team-project.ts";
208
+ import { join, resolve } from "path";
209
+ import * as fs from "node:fs";
210
+ import * as path from "node:path";
211
+ import * as crypto from "node:crypto";
212
+ import { fileURLToPath } from "node:url";
213
+
214
+ // ── Extension ────────────────────────────────────
215
+
216
+ const CONTEXT_WARN_THRESHOLD = 70;
217
+ const RESEARCHER_PERSONAS = new Set(["researcher", "deep-researcher"]);
218
+
219
+ /**
220
+ * Test-only transport seam for real-Pi acceptance. With the offline guard,
221
+ * the normal shared System 1 service uses deterministic wire responses rather
222
+ * than HTTPS; config, readiness, adapter, deadlines and consumers remain real.
223
+ * A profile alone cannot activate this seam outside the guarded test process.
224
+ */
225
+ let taskTriageFakeInstances = 0;
226
+ function resolveTaskTriageTestTransport(): JevTransport | undefined {
227
+ const profile = process.env.AGENT_HUB_TASK_TRIAGE_FAKE;
228
+ const guard = `--import=${fileURLToPath(new URL("../../../bin/test/helpers/system1-no-network.js", import.meta.url))}`;
229
+ if (!profile || process.env.PI_OFFLINE !== "1" || !process.env.NODE_OPTIONS?.split(/\s+/).includes(guard)) return undefined;
230
+ const hot = profile === "security" ? "security_change" : profile === "wide" ? "wide_change" : profile === "irreversible" ? "irreversible_execution" : null;
231
+ if (!hot && profile !== "plain" && profile !== "timeout" && profile !== "context-safe") return undefined;
232
+ const instanceId = ++taskTriageFakeInstances;
233
+ return async request => {
234
+ const wire = JSON.parse(request.body.toString("utf8"));
235
+ const recordPath = process.env.AGENT_HUB_TASK_TRIAGE_FAKE_RECORD;
236
+ if (recordPath) {
237
+ try { fs.appendFileSync(recordPath, JSON.stringify({ at: Date.now(), profile, instanceId, pid: process.pid, questions: Object.keys(wire.questions), stateFingerprint: createHash("sha256").update(JSON.stringify(wire.state)).digest("hex"), questionFingerprint: createHash("sha256").update(JSON.stringify(wire.questions)).digest("hex"), stack: (new Error("fake-transport").stack ?? "").split("\n").slice(1, 6) }) + "\n"); } catch { /* evidence best-effort */ }
238
+ }
239
+ if(profile === "context-safe" && wire.questions.boundary && process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS) {
240
+ const delay=Number(process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS);
241
+ if(Number.isFinite(delay) && delay>0 && delay<=500) await new Promise(resolve=>setTimeout(resolve,delay));
242
+ }
243
+ if (profile === "timeout") {
244
+ return new Promise((_, reject) => {
245
+ if (request.signal.aborted) return reject(new Error("guarded fake transport deadline"));
246
+ request.signal.addEventListener("abort", () => reject(new Error("guarded fake transport deadline")), { once: true });
247
+ });
248
+ }
249
+ return { status: 200, headers: {}, body: JSON.stringify({ model: TASK_TRIAGE_MODEL,
250
+ answers: Object.fromEntries(Object.keys(wire.questions).map(id => {
251
+ if(profile === "context-safe" && (id === "boundary" || id === "retention")) {
252
+ const choice=id === "boundary"?"safe":"active_step";
253
+ const keys=id === "boundary"?["safe","unsafe","unknown"]:["standard","active_step","decisions","unknown"];
254
+ return [id,{type:"choice",choice,confidence:0.95,probabilities:Object.fromEntries(keys.map(key=>[key,key===choice?0.95:0.05/(keys.length-1)]))}];
255
+ }
256
+ return [id,{type:"noul",noul:id === hot?0.95:0.05}];
257
+ })),
258
+ usage: { input_tokens: 1, output_tokens: 1 },
259
+ }) };
260
+ };
261
+ }
262
+
263
+ export default function (pi: ExtensionAPI) {
264
+ // ── Embedded coms: identity CLI flags ──
265
+ // Registered here (factory load time) so pi's CLI parser accepts them. Because
266
+ // coms is EMBEDDED (one extension, not a second `-e`), these register exactly once.
267
+ pi.registerFlag("name", { description: "Coms: override agent name (else frontmatter or auto-generated)", type: "string", default: undefined });
268
+ pi.registerFlag("purpose", { description: "Coms: override agent purpose (else frontmatter description)", type: "string", default: undefined });
269
+ pi.registerFlag("project", { description: "Coms: project namespace for peer discovery", type: "string", default: "default" });
270
+ pi.registerFlag("color", { description: "Coms: hex color #RRGGBB (else frontmatter or palette fallback)", type: "string", default: undefined });
271
+ pi.registerFlag("explicit", { description: "Coms: hide from auto-discovery; addressable only by exact name", type: "boolean", default: false });
272
+ pi.registerFlag("solo", { description: "Run without the coms layer (fixed specialists + research only — `just fleet hub --solo`)", type: "boolean", default: false });
273
+ pi.registerFlag("work-mode", { description: "Deprecated and ignored: the Hub has one operator work mode", type: "string", default: undefined });
274
+ pi.registerFlag("agent-team", { description: "Internal: activate a named native roster from .pi/agents/teams.yaml", type: "string", default: undefined });
275
+
276
+ // ── Embedded coms: shared peer state ──
277
+ let currentCtx: ExtensionContext | null = null;
278
+ let refreshFleetUi = () => {};
279
+ const permissionRelay=new PermissionRelay(()=>observationOwner(),()=>accessTaskIdentity());registerPermissionRelay(pi,permissionRelay);registerPermissionRelay(pi.events,permissionRelay);
280
+ const codexControls=createCodexBootstrapControls(pi,{owner:()=>observationOwner(),context:()=>currentCtx,changed:()=>refreshFleetUi()});
281
+ const connectionControl=codexControls.control;
282
+ const refreshConnections=()=>{void codexControls.refresh();};
283
+ const coms = createComsPeer({
284
+ pi,
285
+ getContext: () => currentCtx,
286
+ instructionReceipts: true,
287
+ onPeersChanged: () => refreshFleetUi(),
288
+ handleCustomStream: (socket, envelope, buffered) => codexControls.control.handleStream(socket, envelope, buffered),
289
+ handleCustomEnvelope: (socket, envelope) => {
290
+ if(connectionControl.handle(socket,envelope))return true;
291
+ if (handleObservationEnvelope(socket, envelope, {
292
+ owner: observationOwner,
293
+ session: () => currentCtx?.sessionManager,
294
+ questions: () => { const owner = observationOwner(); return owner ? questionChannel.list(owner) : { status: 'stale' }; },
295
+ permissions:()=>permissionRelay.summary(),
296
+ })) return true;
297
+ if (handleInstructionReceipt(envelope, socket, observationOwner, currentCtx?.sessionManager)) return true;
298
+ if (handlePermissionEnvelope(socket,envelope,permissionRelay,observationOwner())) return true;
299
+ if (handleQuestionEnvelope(socket, envelope)) return true;
300
+ if (envelope.type !== "access_request") return false;
301
+ void accessApprovalRouter.handle(socket, envelope as AccessRequest);
302
+ return true;
303
+ },
304
+ });
305
+ function observationOwner() { return coms.ready && coms.identity ? {
306
+ project: coms.identity.project, peer: coms.identity.name,
307
+ sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
308
+ } : null; }
309
+ const unregisterQuestions = registerQuestionPeer(() => coms.ready && coms.identity ? {
310
+ project: coms.identity.project, peer: coms.identity.name,
311
+ sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
312
+ } : null);
313
+ let identity: ComsIdentity | null = null;
314
+ const peerCards = coms.peerCards;
315
+ const pendingReplies = coms.pendingReplies;
316
+ const inboundQueue = coms.inboundQueue;
317
+ let comsReady = false;
318
+ let monitorLifecycle: ReturnType<typeof createMonitorLifecycle> | null = null;
319
+ let monitorHubId: string | null = null;
320
+ let monitorTurnId: string | null = null;
321
+ let monitorBridge: ReturnType<typeof createMonitorSessionBridge> | null = null;
322
+ let monitorOwnerId: string | undefined;
323
+
324
+ // ── Damage-control exemptions + access escalation state ──
325
+ // exemptionsFile is the session-scoped shared exemptions file: /af-allow
326
+ // session grants (via the co-loaded damage-control-continue) and approved
327
+ // escalations land here, and spawned children read it through the
328
+ // AGENT_HUB_EXEMPTIONS_FILE env plumbing.
329
+ let exemptionsFile: string | null = null;
330
+ const accessEpochs=new Map<string,string>();
331
+ const accessTaskIdentity=()=>({taskId:noProgress.taskId(),inputRevision:crypto.createHash('sha256').update(JSON.stringify({task:hubTaskText,revision:taskTriage?.current?.revision??''})).digest('hex')});
332
+ const accessApprovalRouter = createAccessApprovalRouter({
333
+ relay:permissionRelay,appendPermissionLog:entry=>pi.appendEntry('damage-permission-decision',entry),taskIdentity:accessTaskIdentity,currentChild:request=>accessEpochs.get(request.agent)===request.accessEpoch&&agentStates.get(request.agent)?.status==='running',
334
+ traceBus: pi.events,
335
+ getContext: () => currentCtx,
336
+ getExemptionsFile: () => exemptionsFile,
337
+ appendLog: (entry) => { pi.appendEntry("damage-control-log", entry); },
338
+ now: nowIso,
339
+ });
340
+
341
+ const agentStates: Map<string, AgentState> = new Map();
342
+ // Live-only research helpers, keyed by numeric id (handle `rN`). Visible in the
343
+ // Fleet Dashboard (Alt+A) while running; evicted from this map on every terminal
344
+ // outcome. Session/transcript/findings files and /af-agents-history survive.
345
+ let researchStates: Map<number, ResearchState> = new Map();
346
+ // Metadata only: prompt text is never retained by this ledger.
347
+ let lastHubLedger: ContextBudgetComponent[] = [];
348
+ let nextResearchId = 1;
349
+
350
+ // ── Execution history (/af-agents-history) ──────────
351
+ // The typed store owns entries and turn/ask_user bookkeeping; index.ts owns
352
+ // composition and wires lifecycle events to its explicit API.
353
+ const executionHistory = createExecutionHistoryStore();
354
+
355
+ let researchPersonas: AgentDef[] = [];
356
+ let allAgentDefs: AgentDef[] = [];
357
+ /** Installed personas dispatch_agent may target: research personas use spawn_research, and
358
+ * `kind: orchestrator` only documents the Hub role. */
359
+ const dispatchableAgentDefs = (): AgentDef[] => allAgentDefs.filter(def => !["research", "orchestrator"].includes((def.kind || "").toLowerCase()));
360
+ let teams: Record<string, string[]> = {};
361
+ // Named model profiles from .pi/agents/model-profiles.yaml (validated at
362
+ // session start) and the session-lifetime per-persona model overrides set by
363
+ // /af-agent-model and /af-models (lowercase persona name → pi model spec). Overrides
364
+ // reset on session_start; profiles make re-applying cheap.
365
+ let modelProfiles: ModelProfiles = {};
366
+ let modelProfileErrors: string[] = [];
367
+ // Backend routing policy (.pi/agents/dispatch-policy.yaml): per dispatch, a
368
+ // member preferring coms is served by a live same-name pool peer instead of a
369
+ // native subagent spawn. Missing file → everything native (status quo).
370
+ let dispatchPolicy: {
371
+ default: string;
372
+ grace_s: number;
373
+ substitutions: Record<string, { prefer: string; fallback: string; timeout_s?: number }>;
374
+ } = { default: "native", grace_s: 30, substitutions: {} };
375
+ let dispatchPolicyWarnings: string[] = [];
376
+ // One "coms peer missing → native" notice per member per team activation.
377
+ const comsMissNotified = new Set<string>();
378
+
379
+ let activeTeamName = "";
380
+ let gridCols = 2;
381
+ let widgetCtx: any;
382
+ let sessionDir = "";
383
+ let contextWindow = 0;
384
+ // Per-provider in-flight cap for the hub's OWN spawns (specialists and
385
+ // research helpers, which the dispatcher can start in parallel). Delegate
386
+ // children are gated by the same policy inside their parent's process. The
387
+ // drift judge and the return extractor are deliberately NOT gated: both run
388
+ // while a specialist holds a permit, so queueing them behind that specialist
389
+ // would stall the very watchdog that is supposed to stop it.
390
+ const providerSemaphore = createProviderSemaphore({
391
+ ...DEFAULT_PROVIDER_LIMITS,
392
+ ...parseProviderLimits(process.env.AGENT_HUB_PROVIDER_LIMITS),
393
+ });
394
+ /**
395
+ * pi's model registry as a plain lookup — the documented source for every
396
+ * model's window, and the same one the dispatcher's own window comes from.
397
+ */
398
+ function modelWindowLookup(ctx: any): (provider: string, modelId: string) => any {
399
+ return (provider, modelId) => ctx?.modelRegistry?.find?.(provider, modelId);
400
+ }
401
+
402
+ /** Say so when a run is about to wait on a provider permit, not just hang. */
403
+ function notifyProviderQueue(model: string, label: string, ctx: any): void {
404
+ const cap = providerSemaphore.limitFor(model);
405
+ if (cap == null || providerSemaphore.inFlight(model) < cap) return;
406
+ const ahead = providerSemaphore.queued(model) + 1;
407
+ ctx?.ui?.notify(
408
+ `${label}: queued — ${cap} requests already in flight on this provider (${ahead} waiting). ` +
409
+ "Raise or disable the cap with AGENT_HUB_PROVIDER_LIMITS (e.g. custom=4, custom=off).",
410
+ "info",
411
+ );
412
+ }
413
+
414
+ let activeWritableDispatches = 0;
415
+ let writableOverlapCounter = 0;
416
+ function privateProofUse(cwd = currentCtx?.cwd || process.cwd()): PrivateProofUse {
417
+ return { cwd, taskId: noProgress.taskId(), sessionDir, declarationHash: privateDeclarationHash(assertions as any, hubTaskText), activeWriters: activeWritableDispatches, overlap: writableOverlapCounter };
418
+ }
419
+ let pendingHandoff: { target: string; token: string } | null = null;
420
+ const hubStateCtx = createHubStateContext({
421
+ getCurrentContext: () => currentCtx, setCurrentContext: value => { currentCtx = value; },
422
+ getExemptionsFile: () => exemptionsFile, setExemptionsFile: value => { exemptionsFile = value; },
423
+ getSessionDir: () => sessionDir, setSessionDir: value => { sessionDir = value; },
424
+ getWidgetContext: () => widgetCtx, setWidgetContext: value => { widgetCtx = value; },
425
+ getPendingHandoff: () => pendingHandoff, setPendingHandoff: value => { pendingHandoff = value; },
426
+ });
427
+ let userLanguage: string = DEFAULT_OVERRIDES.language;
428
+ // Project rule folders from the overrides file's `rules:` key (repo-relative,
429
+ // validated at session_start). Non-empty → every dispatched specialist gets a
430
+ // "Project rules" prompt block; personas resolve the folders index-first (a
431
+ // top-level README.md/index.md is a loading manifest) with recursive discovery
432
+ // as the no-index fallback.
433
+ let projectRulesDirs: string[] = [];
434
+ // Project documentation entry points from the overrides file's `docs:` key
435
+ // (repo-relative files or folders, validated at session_start). Non-empty →
436
+ // dispatched specialists and research helpers get a "Project docs" prompt block.
437
+ let projectDocsPaths: string[] = [];
438
+
439
+ // Prompt blocks for the project's own rules (HOW — compliance) and docs
440
+ // (WHAT/WHY — orientation). Rules discovery is index-first so a curated rule
441
+ // tree (README manifest + session bundles) is honored instead of bulk-read;
442
+ // the blind recursive find is only the no-index fallback. The validation duty
443
+ // itself is written into the planner/code-reviewer personas.
444
+ function buildRulesProtocol(): string {
445
+ return buildProjectRulesProtocol(projectRulesDirs);
446
+ }
447
+
448
+ function buildDocsProtocol(): string {
449
+ return buildProjectDocsProtocol(projectDocsPaths);
450
+ }
451
+
452
+ /** One canonical repository context file plus explicitly configured rule roots. */
453
+ function specialistProjectPolicyPaths(cwd: string): string[] {
454
+ const canonical = ["AGENTS.md", "CLAUDE.md"].find(candidate => existsSync(path.join(cwd, candidate)));
455
+ return [...new Set([...(canonical ? [canonical] : []), ...projectRulesDirs])];
456
+ }
457
+ // The one supported safety harness. Every native specialist, researcher, and
458
+ // nested delegate receives it; a missing harness refuses child dispatch.
459
+ let safetyHarnessPath: string | null = null;
460
+ // Resolved once at session_start: the delegate extension injected into
461
+ // specialists that declare `subagents:` (null → delegation disabled).
462
+ let delegateExtPath: string | null = null;
463
+ // Per-tool deadline for read/grep/find/ls in research helpers/delegates. The
464
+ // whole-run bound is separate: the turn budget's agentTurnMs (run-budget.js).
465
+ let reconSearchTimeoutMs: number | null = 120_000;
466
+ // ── Usage accounting and tier (run-budget.js) ──
467
+ // Dispatch/research counts and active time are visible accounting, never
468
+ // continuation quotas. Overrides bound only the child deadline and recycling.
469
+ // Turn counters reset in before_agent_start; task counters span the whole TASK
470
+ // and are cleared only by an explicit new task (`set_task_tier` with
471
+ // `new_task: true`), never by an ordinary user message.
472
+ let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
473
+ let turnDispatchCount = 0;
474
+ let turnResearchCount = 0;
475
+ let taskDispatchCount = 0;
476
+ let taskResearchCount = 0;
477
+ let taskLabel: string | null = null;
478
+ // The task clock charges ACTIVE time only — turns that ran, minus the time the
479
+ // dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
480
+ // lunch break, an overnight pause, and every long answer against the task, and
481
+ // at small tier's 45-minute envelope that hard-stops a task with two dispatches
482
+ // spent. A false stop is worse than no stop: it teaches people to reset the
483
+ // task window reflexively, which is the one thing that must stay deliberate.
484
+ // The explicit clock state makes `active` authoritative: a stale timestamp can
485
+ // never turn inter-turn idle time into task work.
486
+ let taskClock = createTaskClock();
487
+ // Review dispatches spent on this task (review-round cap).
488
+ let taskReviewRounds = 0;
489
+ // Task tier (complexity triage): declared by the dispatcher via set_task_tier.
490
+ // TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
491
+ // with a stated reason (applyTierChange). Null until declared; the first
492
+ // dispatch assumes DEFAULT_TASK_TIER. Caps come from the tier envelope.
493
+ let taskTier: string | null = null;
494
+ // Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
495
+ // distinction matters to the ratchet: an assumed tier must not turn the
496
+ // dispatcher's own first triage call into an "escalation" that needs a reason.
497
+ let taskTierAssumed = false;
498
+ // Correctness obligations are independent of the spend tier. They persist for
499
+ // the current task and reset only through the explicit new-task tool path.
500
+ let processState = createProcessState();
501
+ let taskTriage: ReturnType<typeof createTaskTriageRuntime> | null = null;
502
+ let taskTriageTestTransportActive = false;
503
+ let taskTriageActivity: TaskTriageActivity | null = null;
504
+ let taskTriageConfigStatus: "active" | "off" | "invalid" = "off";
505
+ let taskTriageConfigured = false;
506
+ let processPersistenceBlocked = false;
507
+ let pendingTaskTransition = false;
508
+ let transitionDiversions = 0;
509
+ let transitionHintDelivered = false;
510
+ let transitionBatchRefused = false;
511
+ const processBlock = () => processPersistenceBlocked ? { reason: "process_state_corrupt", message: "Process persistence is blocked; dependent effects remain refused. Ask the human to run /af-task-triage-recover for a checked in-session append/readback; if it refuses, inspect or resume a valid session. Never edit session JSONL or reset obligations." } : pendingTaskTransition ? { reason: "task_transition_pending", message: taskTransitionRecoveryHint } : null;
512
+ const persistProcessVerdict = (state: ProcessObligationState, verdict: ProcessVerdict) => {
513
+ try { pi.appendEntry("agent-hub-process-state", processAuditRecord(state, verdict)); }
514
+ catch { processPersistenceBlocked = true; }
515
+ };
516
+ // Duplicate-dispatch guard: fingerprints of (agent, task) already dispatched
517
+ // THIS turn. Auto-research resumes and /af-agents-restart call dispatchAgent
518
+ // directly, so only real dispatcher tool calls are guarded.
519
+ const turnDispatchFingerprints = new Set<string>();
520
+ // ── External-blocker circuit breaker (external-blocker.js) ──
521
+ // Set when a specialist reports it needs something outside the fleet's reach;
522
+ // gates the next dispatch until the human has been addressed. Cleared by an
523
+ // ask_user call, by a new user turn (the human spoke), and by a new task.
524
+ let externalBlockers: { agent: string; what: string }[] = [];
525
+ let externalBlockerAcknowledged = false;
526
+ let externalBlockerRefusedOnce = false;
527
+ // Per-run artifact archive retention (run-namespace.js).
528
+ let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
529
+ // ── Drift watchdog (drift-watchdog.js) ──
530
+ // Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
531
+ // per-agent overrides ("on"/"off") win over it, and a dispatch_agent
532
+ // `watchdog` param wins over both.
533
+ let watchdogSetting: string = DEFAULT_WATCHDOG_SETTING;
534
+ let watchdogJudgeModel: string | null = null;
535
+ let watchdogSystem1: WatchdogSystem1Session | null = null;
536
+ const communicationStore = createCommunicationStore();
537
+ let triageRuntime: ReturnType<typeof createTriageRuntime> | null = null;
538
+ let proactiveRuntime: ReturnType<typeof createProactiveRuntime> | null = null;
539
+ let system1Snapshot: ReturnType<typeof loadSystem1Snapshot> = normalizeSystem1Config(null);
540
+ let proactiveConfig: ProactiveConfig | null = null;
541
+ let proactiveHubDeliveries = 0;
542
+ const proactiveReportInput = () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live(), feedback: { hubDelivered: proactiveHubDeliveries, nativeDelivered: null } } : undefined;
543
+ let hubTaskText: string | undefined;
544
+ const hubCapture = createHubCapture({ root: () => currentCtx?.cwd || process.cwd(), task: () => hubTaskText, policyRoots:()=>sessionOverrides?.policyRoots });
545
+ let watchdogActivity: WatchdogActivity | null = null;
546
+ const watchdogAgentOverrides = new Map<string, "on" | "off">();
547
+ // ── Per-turn cost report (/af-hub-report) ──
548
+ let turnReport: TurnReport = freshTurnReport();
549
+ let lastTurnReport: TurnReport | null = null;
550
+ const sessionTotals = createSessionTotals();
551
+ // Session-wide delegated-spend counter (tokens across all delegate children),
552
+ // surfaced in the status line. Resets on session_start.
553
+ let delegatedTokens = 0;
554
+
555
+ const noProgress = createNoProgressGuard((type, data) => pi.appendEntry(type, data));
556
+ const executionTrace = createExecutionTrace({
557
+ identity: () => ({ taskId: noProgress.taskId(), inputRevision: hubTaskText ?? "" }),
558
+ persist: row => pi.appendEntry(EXECUTION_TRACE_ENTRY, row),
559
+ });
560
+ registerExecutionTrace(pi, executionTrace);
561
+ const taskTriageMetadata = () => {
562
+ const current = taskTriage?.current;
563
+ return { taskId: noProgress.taskId(), inputRevision: taskTriage?.inputRevision, configuredStatus: taskTriageConfigStatus,
564
+ runtimeBlocks: [...(processPersistenceBlocked ? ["process_persistence_blocked" as const] : []), ...(pendingTaskTransition ? ["task_transition_pending" as const] : [])],
565
+ assessment: current ? { taskId: current.taskId, evaluationId: current.evaluationId, inputRevision: current.revision, assessment: current.assessment } : undefined };
566
+ };
567
+ let taskIdentityReset: ReturnType<typeof createReservedTaskIdentityReset>;
568
+ let unknownToolCounter = createUnknownToolCounter({ limit: 3 });
569
+ const toolCatalogRuntime = createToolCatalogRuntime(catalogSnapshot("operator", []));
570
+ let latestToolCatalogDelta: ToolCatalogDelta | null = null;
571
+ let latestUnknownToolNotice = "";
572
+ const seenUnknownToolCalls = new Set<string>();
573
+ const resetUnknownToolCounterForCurrentTask = () => {
574
+ unknownToolCounter.resetForNewTask(noProgress.taskId());
575
+ seenUnknownToolCalls.clear();
576
+ latestUnknownToolNotice = "";
577
+ };
578
+ const budgetCtx = createBudgetContext({
579
+ getBudgetOverrides: () => budgetOverrides,
580
+ getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
581
+ getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
582
+ resetNoProgress: (persistTaskIdentity) => noProgress.reset(persistTaskIdentity), resetUnknownToolCounter: resetUnknownToolCounterForCurrentTask,
583
+ getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
584
+ getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
585
+ getTaskLabel: () => taskLabel, setTaskLabel: value => { taskLabel = value; },
586
+ getTaskClock: () => taskClock, setTaskClock: value => { taskClock = value; },
587
+ getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
588
+ getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
589
+ getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
590
+ clearTurnDispatchFingerprints: () => turnDispatchFingerprints.clear(),
591
+ clearTaskCapabilities: () => workModePolicy.resetCapabilities(),
592
+ clearExternalBlockers: () => { externalBlockers = []; externalBlockerAcknowledged = false; externalBlockerRefusedOnce = false; },
593
+ resolveIncomingCapabilities: (acceptedUserInput = "") => { resolveIncomingCapabilities(acceptedUserInput, true); }, applyWorkModeTools: () => { applyWorkModeTools(); },
594
+ getTurnReport: () => turnReport,
595
+ setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
596
+ getAuditContext: () => ({ cwd: identity?.cwd ?? currentCtx?.cwd, sessionId: identity?.session_id, project: identity?.project }),
597
+ appendEntry: (type, data) => { pi.appendEntry(type, data); },
598
+ executionHistory,
599
+ });
600
+ const {
601
+ currentBudget, closeTurnActiveTime, resetTaskWindow,
602
+ hubAuditIdentity, hubLocationSuffix, taskResetSnapshot,
603
+ appendTaskResetEntry, updateModeStatus, ensureTaskTier,
604
+ } = budgetCtx;
605
+ taskIdentityReset = createReservedTaskIdentityReset(noProgress);
606
+
607
+ // ── Verification Contract: assertion ledger (advisory) ──
608
+ // Mutable ownership remains here; the extracted runtime receives explicit ports.
609
+ let assertions: Assertion[] = [];
610
+ const assertionsArtifactsCtx = createAssertionsArtifactsContext({
611
+ getAssertions: () => assertions,
612
+ getSessionDir: () => sessionDir,
613
+ getRunHistoryKeep: () => runHistoryKeep,
614
+ setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
615
+ getTaskBriefPath: () => currentTaskBrief(),
616
+ });
617
+
618
+ // ── Parallel writers (plan B, phase 4): who writes where, and who is sandboxed ──
619
+ const activeWriters = new Map<number, { agent: string; scope: string[]; isolated: boolean }>();
620
+ const isolatedWriterAgents = new Set<string>();
621
+ let writerSequence = 0;
622
+
623
+ // ── Task brief: the shared record every delegated agent reads (plan B, phase 3) ──
624
+ type BriefEntry = { agent: string; kind: "specialist" | "research"; task: string; scope: string[]; researchId?: number };
625
+ let briefLog: { taskId: string; entries: BriefEntry[] } = { taskId: "", entries: [] };
626
+ const briefEntries = (): BriefEntry[] => {
627
+ const id = noProgress.taskId();
628
+ if (briefLog.taskId !== id) briefLog = { taskId: id, entries: [] };
629
+ return briefLog.entries;
630
+ };
631
+ function recordDelegation(entry: BriefEntry): void {
632
+ const entries = briefEntries();
633
+ entries.push({ ...entry, task: entry.task.slice(0, 1000), scope: entry.scope.slice(0, 32) });
634
+ if (entries.length > 40) entries.splice(0, entries.length - 40);
635
+ }
636
+ function currentTaskBrief(): string | null {
637
+ if (!sessionDir) return null;
638
+ try {
639
+ return refreshTaskBrief(artifactsRoot(), {
640
+ taskId: noProgress.taskId(), tier: taskTier ?? DEFAULT_TASK_TIER, risk: processState.risk, scope: processState.scope,
641
+ requirements: assertions.map(a => ({ id: a.id, status: a.status, text: a.text, source: a.source })),
642
+ delegations: briefEntries().map(entry => ({
643
+ ...entry,
644
+ status: entry.kind === "research"
645
+ ? (researchStates.get(entry.researchId ?? -1)?.status ?? "finished")
646
+ : (agentStates.get(entry.agent.toLowerCase())?.status ?? "finished"),
647
+ })),
648
+ });
649
+ } catch { return null; }
650
+ }
651
+ const {
652
+ persistAssertions, assertionStatusLine, renderAssertionLedgerLines, renderAssertionLedgerText,
653
+ updateAssertionStatus, artifactsRoot, ensureArtifactsLayout, archivePreviousRun,
654
+ loadInputArtifacts, appendInputArtifacts, writeRunArtifact, evidencePathExists,
655
+ listArtifactFiles, renderArtifactIndexText, appendMachineHandoffSections,
656
+ } = assertionsArtifactsCtx;
657
+
658
+ const modelPolicy = createModelPolicy<AgentDef>({
659
+ getAllDefs: () => allAgentDefs,
660
+ getActiveDef: name => agentStates.get(name)?.def,
661
+ getResearchDefs: () => researchPersonas,
662
+ refreshUi: () => updateWidget(),
663
+ });
664
+ const {
665
+ allowedModels, substitutedModel, resolvedModel, resolvedSubagentModel,
666
+ resolvedThinking, switchablePersonaDef, allKnownModels,
667
+ } = modelPolicy;
668
+
669
+ let profileCommandContext: any;
670
+ const profileActivation = createProfileActivation({
671
+ busy: () => !profileCommandContext?.isIdle?.() || profileWorkInFlight()>0 ||
672
+ Array.from(agentStates.values()).some(state=>state.status==='running') ||
673
+ Array.from(researchStates.values()).some(state=>state.status==='running'),
674
+ defs: () => allAgentDefs,
675
+ available: async () => {
676
+ await profileCommandContext.modelRegistry.refresh?.();
677
+ return (profileCommandContext.modelRegistry.getAvailable?.()??[]).map((m:any)=>`${m.provider}/${m.id}`);
678
+ },
679
+ dispatcher: () => profileCommandContext?.model ? {model:`${profileCommandContext.model.provider}/${profileCommandContext.model.id}`,thinking:pi.getThinkingLevel()} : undefined,
680
+ setDispatcher: async selection => {
681
+ const slash=selection.model.indexOf('/');
682
+ const model=profileCommandContext.modelRegistry.find(selection.model.slice(0,slash),selection.model.slice(slash+1));
683
+ if(!model || !await pi.setModel(model)) return false;
684
+ if(selection.thinking) pi.setThinkingLevel(selection.thinking as any);
685
+ return true;
686
+ },
687
+ apply: profile => modelPolicy.applyProfile(profile),
688
+ });
689
+ pi.on('model_select', async (event,ctx) => {
690
+ contextWindow=event.model.contextWindow||0;
691
+ if(profileActivation.switching()) return;
692
+ const active=readActiveProfile();if(!active || !hasExplicitDispatcher(active.profile)) return;
693
+ try { assertProfileModel(`${event.model.provider}/${event.model.id}`,active); }
694
+ catch(error) {
695
+ ctx.abort();ctx.ui.notify(String(error),'error');
696
+ if(hasExplicitDispatcher(active.profile)) {
697
+ const target=dispatcherSelection(active.profile).model, slash=target.indexOf('/');
698
+ const model=ctx.modelRegistry.find(target.slice(0,slash),target.slice(slash+1));
699
+ if(model) await pi.setModel(model);
700
+ }
701
+ }
702
+ });
703
+ pi.on('before_provider_request', async (_event,ctx) => {
704
+ const active=readActiveProfile();
705
+ if(!ctx.model || !active || !hasExplicitDispatcher(active.profile)) return;
706
+ try { assertProfileModel(`${ctx.model.provider}/${ctx.model.id}`,active); }
707
+ catch(error) {ctx.abort();ctx.ui.notify(String(error),'error');}
708
+ });
709
+
710
+ function appendDeclaredScope(task: string, scopeGlobs: string[]): string {
711
+ if (!scopeGlobs || scopeGlobs.length === 0) return task;
712
+ return task + `\n\n## Declared scope — advisory guardrail\nStay within these paths/globs when changing files; changes outside them will be flagged to the dispatcher for a human decision, not auto-reverted.\n${scopeGlobs.map(s => `- ${s}`).join("\n")}`;
713
+ }
714
+
715
+ function loadAgents(cwd: string): void {
716
+ if (sessionDir) closeEvidenceSession(sessionDir);
717
+ loadAgentConfiguration(cwd, {
718
+ setSessionDir: hubStateCtx.setSessionDir, getSessionDir: hubStateCtx.getSessionDir,
719
+ archivePreviousRun, ensureArtifactsLayout, resetAssertions: () => { assertions = []; },
720
+ setAgentDefs: value => { allAgentDefs = value; }, setTeams: value => { teams = value; },
721
+ setModelProfiles: value => { modelProfiles = value; }, setModelProfileErrors: errors => { modelProfileErrors=errors; }, setDispatchPolicy: value => { dispatchPolicy = value; },
722
+ setDispatchPolicyWarnings: value => { dispatchPolicyWarnings = value; },
723
+ });
724
+ pruneEvidenceSessions(sessionDir, runHistoryKeep);
725
+ }
726
+
727
+ const agentStateFactory = createAgentStateFactory(() => sessionDir);
728
+ const { sessionHealthIo, adoptableSessionFile, freshAgentState } = agentStateFactory;
729
+
730
+ // Auto-size grid columns based on team size
731
+ function recomputeGrid() {
732
+ gridCols = gridColumnsForSize(agentStates.size);
733
+ }
734
+
735
+ const rosterPolicy = createRosterPolicy<AgentDef, AgentState>({
736
+ getTeams: () => teams, getAllDefs: () => allAgentDefs, getStates: () => agentStates,
737
+ getActiveTeamName: () => activeTeamName, setActiveTeamName: value => { activeTeamName = value; },
738
+ clearBackendNotices: () => comsMissNotified.clear(), createFreshState: freshAgentState,
739
+ adoptSession: adoptableSessionFile,
740
+ quarantineSession: agentStateFactory.quarantine,
741
+ persist: team => pi.appendEntry(NATIVE_ROSTER_ENTRY_TYPE, persistedNativeRosterState(team)),
742
+ recompute: recomputeGrid, refreshUi: () => updateWidget(), displayName,
743
+ });
744
+ const { activateTeam, persistActiveRoster, add: rosterAdd, drop: rosterDrop } = rosterPolicy;
745
+
746
+ // ── Shared model presentation ─────────────────
747
+ // These formatters serve the extracted grid and the remaining composition-root
748
+ // call sites. Keep one implementation so cards, fleet rows, menus, fallback
749
+ // notices, and the footer retain the same presentation semantics.
750
+ function shortModel(model: string | undefined): string {
751
+ return model ? model.split("/").pop()! : "default";
752
+ }
753
+
754
+ // A " (code)" thinking badge for display, or "" when the level is off.
755
+ function thinkingSuffix(rawThinking: string | undefined): string {
756
+ const code = abbrevThinking(resolveThinkingLevel(rawThinking));
757
+ return code ? ` (${code})` : "";
758
+ }
759
+
760
+ // The model + thinking badge a persona would dispatch with: "gpt-5.5 (xh)".
761
+ function modelWithThinking(def: AgentDef): string {
762
+ return shortModel(resolvedModel(def)) + thinkingSuffix(resolvedThinking(def));
763
+ }
764
+
765
+ // ── Shared fleet source + below-editor widget ───────────────────────────
766
+ const fleetSource = createFleetSource({
767
+ getAgents: () => agentStates,
768
+ getResearch: () => researchStates,
769
+ getPeerInputs: format => fleetPeerInputs(format),
770
+ getPeerCards: () => peerCards,
771
+ getPendingReplies: () => pendingReplies.values(),
772
+ displayName,
773
+ modelForAgent: state => state.lastBackend === "coms" ? shortModel(state.comsPeerModel) : modelWithThinking(state.def),
774
+ modelForResearch: state => shortModel(state.model) + thinkingSuffix(resolvedThinking(state.def)),
775
+ modelForPeer: abbreviateModel,
776
+ getSystem1: () => watchdogActivity?.live() ?? null,
777
+ getTaskTriage: () => {
778
+ if (!taskTriageConfigured && !processState.additions?.length) return null;
779
+ try { return { ...taskTriageMetadata(), process: { schema: processState.schema, ...evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }) } }; }
780
+ catch { return { ...taskTriageMetadata(), process: { schema: "invalid" } }; }
781
+ },
782
+ getProactive: () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live() } : null,
783
+ });
784
+ let fleetActions: ReturnType<typeof createFleetActions<AgentState, ResearchState>> | null = null;
785
+ let fleetUiGeneration = 0;
786
+ const gridUI = createGridUI({
787
+ getWidgetContext: () => widgetCtx,
788
+ getRows: now => fleetSource.rows(now, { showFinished: true }),
789
+ getSnapshot: now => { const source = fleetSource.snapshot(now); return { rows: buildFleetRows(source, { showFinished: true }), proactive: source.proactive }; },
790
+ handleIntent: async intent => {
791
+ if (!fleetActions || !widgetCtx) return;
792
+ if (intent.type === "system1") { await gridUI.withSuspended(() => openSystem1Communication(widgetCtx!, communicationStore)); return; }
793
+ if (intent.type === "open") await gridUI.withSuspended(() => fleetActions!.open(intent.key, intent.runToken, widgetCtx!));
794
+ else await fleetActions.execute(intent.type, intent.key, intent.runToken, widgetCtx);
795
+ },
796
+ });
797
+ const { updateWidget } = gridUI;
798
+ refreshFleetUi = updateWidget;
799
+
800
+ // ── Delegation observability ─────────────────
801
+ const dispatchObservability = createDispatchObservability({
802
+ getSessionDir: () => sessionDir,
803
+ getDelegatedTokens: () => delegatedTokens,
804
+ setDelegatedTokens: value => { delegatedTokens = value; },
805
+ getWidgetContext: () => widgetCtx,
806
+ executionHistory,
807
+ displayName,
808
+ safeAgentKey,
809
+ safePathWithin,
810
+ createTranscriptStore: createFleetTranscriptStore,
811
+ appendTimelineText,
812
+ appendTimelineEvent,
813
+ updateWidget,
814
+ });
815
+ const { startDelegationWatch } = dispatchObservability;
816
+
817
+ // ── Dispatch Agent (returns Promise) ─────────
818
+
819
+ // ── Extracted coms dispatch, drift judge, and return extraction ──
820
+ const dispatchComs = createDispatchComs({
821
+ getIdentity: () => identity,
822
+ resolveTarget: target => coms.resolveTarget(target),
823
+ send: (params, auditExtra) => coms.send(params, auditExtra),
824
+ getPendingReply: msgId => pendingReplies.get(msgId),
825
+ deletePendingReply: msgId => { pendingReplies.delete(msgId); },
826
+ getSessionDir: () => sessionDir,
827
+ getWatchdogJudgeModel: () => watchdogJudgeModel,
828
+ getResearcherModel: () => {
829
+ const researcherDef = allAgentDefs.find(def => def.name.toLowerCase() === "researcher");
830
+ return researcherDef ? resolvedModel(researcherDef) ?? null : null;
831
+ },
832
+ displayName,
833
+ safeAgentKey,
834
+ safePathWithin,
835
+ appendInputArtifacts,
836
+ appendDeclaredScope,
837
+ buildRulesProtocol,
838
+ buildDocsProtocol,
839
+ updateWidget,
840
+ spawnPiAgent,
841
+ });
842
+ const { dispatchViaComs, runDriftJudge, runReturnExtraction } = dispatchComs;
843
+ registerOperatorWatchdog(pi, { setting: () => watchdogSetting, taskId: () => noProgress.taskId(), task: () => hubTaskText, runDriftJudge: (input, ctx) => runDriftJudge(input as unknown as DriftJudgeInput, ctx as ExtensionContext) });
844
+
845
+ const nativeDispatch = createDispatchNative({
846
+ traceNative: (owner, actor) => createNativeExecutionTrace(executionTrace, owner, actor),
847
+ prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
848
+ prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
849
+ launchIdentity:()=>noProgress.taskToken(),
850
+ nativeAdmission:persona=>!processBlock()&&!provisionalCapabilityRefusal('fleet')&&!processPreEffectGate(processState,'child',persona),
851
+ isolationRequested: name => isolatedWriterAgents.has(String(name).trim().toLowerCase()),
852
+ getAgentState: key => agentStates.get(key),
853
+ getProcessState: () => processState,
854
+ listAgentStates: () => Array.from(agentStates.values()),
855
+ getSessionDir: () => sessionDir,
856
+ getDispatchPolicy: () => dispatchPolicy,
857
+ isComsReady: () => comsReady,
858
+ getIdentity: () => identity,
859
+ peersInScope: () => peersInScope(),
860
+ wasComsMissNotified: personaKey => comsMissNotified.has(personaKey),
861
+ markComsMissNotified: personaKey => { comsMissNotified.add(personaKey); },
862
+ startMonitorChild: (input, env) => {
863
+ const monitorStart = monitorTurnId;
864
+ return monitorStart ? monitorBridge?.startChild({ ...input, parentId: monitorStart }, env) : undefined;
865
+ },
866
+ finalizeMonitorChild: (task, output, status) => monitorBridge?.finalizeChildFor(task, output, status),
867
+ registerMonitorWaitOnly: (monitorKey, state) => monitorBridge?.registerWaitOnly(monitorKey, () => state.comsAbort?.()),
868
+ registerMonitorProcess: (task, proc) => monitorBridge?.registerOwnedProcessFor(task, proc),
869
+ appendMonitorOutput: (task, delta) => monitorBridge?.appendOutputFor(task, delta),
870
+ getContextWindow: () => contextWindow,
871
+ currentBudget,
872
+ bumpRecycle: () => { turnReport.recycles++; sessionTotals.recycles++; },
873
+ bumpDriftStop: () => { turnReport.driftStops++; sessionTotals.driftStops++; },
874
+ getSessionHealthIo: () => sessionHealthIo,
875
+ getSafetyHarnessPath: () => safetyHarnessPath,
876
+ getDelegateExtensionPath: () => delegateExtPath,
877
+ getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
878
+ getProjectDocsPaths: () => projectDocsPaths,
879
+ getUserLanguage: () => userLanguage,
880
+ getWatchdogSetting: () => watchdogSetting,
881
+ getWatchdogAgentOverride: key => watchdogAgentOverrides.get(key),
882
+ getWatchdogSystem1: () => watchdogSystem1,
883
+ getWatchdogActivity: () => watchdogActivity,
884
+ getProactiveRuntime: () => proactiveRuntime,
885
+ getProactiveConfig: () => proactiveConfig,
886
+ getProactiveCapture: () => proactiveRuntime ? hubCapture : null,
887
+ getPolicyRoots: () => sessionOverrides?.policyRoots,
888
+ getWorkMode: () => getWorkMode(),
889
+ providerSemaphore,
890
+ executionHistory,
891
+ displayName,
892
+ shortModel: model => shortModel(model),
893
+ resolvedModel,
894
+ resolvedThinking,
895
+ resolveThinkingLevel,
896
+ resolvedSubagentModel,
897
+ substitutedModel,
898
+ modelWindowLookup,
899
+ specialistProjectPolicyPaths,
900
+ guardrailEnv,
901
+ appendInputArtifacts,
902
+ appendDeclaredScope,
903
+ flushTimelineStore,
904
+ appendTimelineText,
905
+ appendTimelineEvent,
906
+ createTranscriptStore: createFleetTranscriptStore,
907
+ updateWidget,
908
+ startDelegationWatch,
909
+ dispatchViaComs,
910
+ runDriftJudge,
911
+ notifyProviderQueue,
912
+ spawnPiAgentWithModelFallback,
913
+ });
914
+ const { dispatchAgent } = nativeDispatch;
915
+
916
+ // Shared child guardrail environment. Dispatch-native and research use the
917
+ // same root-owned exemptions and coms escalation endpoint.
918
+ function guardrailEnv(agentId: string): Record<string, string> {
919
+ const epoch=crypto.randomUUID();accessEpochs.set(agentId,epoch);
920
+ const env: Record<string, string> = { [AGENT_ID_ENV]: agentId,AGENT_HUB_ACCESS_EPOCH:epoch };
921
+ if (sessionOverrides?.policyRoots) env[FILESYSTEM_POLICY_ROOTS_ENV]=JSON.stringify(sessionOverrides.policyRoots);
922
+ if (exemptionsFile) env[EXEMPTIONS_FILE_ENV] = exemptionsFile;
923
+ if (comsReady && identity) env[ASK_ENDPOINT_ENV] = identity.endpoint;
924
+ return env;
925
+ }
926
+
927
+ // ── Research helper runtime ────────────────────
928
+ // The composition root owns the mutable bindings; the runtime reaches them only
929
+ // through these explicit ports so later controls can keep stable handles.
930
+ const researchRuntime = createResearchRuntime<AgentDef>({
931
+ prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
932
+ prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
933
+ launchIdentity:()=>noProgress.taskToken(),
934
+ researchAdmission:()=>!processBlock(),
935
+ getResearchStates: () => researchStates,
936
+ setResearchStates: value => { researchStates = value; },
937
+ getNextResearchId: () => nextResearchId,
938
+ setNextResearchId: value => { nextResearchId = value; },
939
+ hubState: hubStateCtx, budget: budgetCtx, artifacts: assertionsArtifactsCtx,
940
+ executionHistory, providerSemaphore,
941
+ getSafetyHarnessPath: () => safetyHarnessPath,
942
+ getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
943
+ getContextWindow: () => contextWindow,
944
+ resolvedModel, resolvedThinking, resolveThinkingLevel, fallbackModelFor, substitutedModel,
945
+ modelWindowLookup, guardrailEnv, notifyProviderQueue, spawnPiAgentWithModelFallback,
946
+ getProjectPolicyPaths: specialistProjectPolicyPaths,
947
+ getProjectDocsPaths: () => projectDocsPaths,
948
+ nativeResearchSystemPrompt, requireSafetyHarness, shortModel, displayName,
949
+ flushTimelineStore, appendTimelineText, appendTimelineEvent,
950
+ createTranscriptStore: createFleetTranscriptStore,
951
+ onElapsed: () => updateWidget(),
952
+ });
953
+
954
+ // ── Embedded coms: shared registry, transport, and pool core ──
955
+ const peersInScope = () => coms.peersInScope();
956
+ const resolveTarget = (target: string) => coms.resolveTarget(target);
957
+
958
+ const poolPresentation = createPoolPresentation({
959
+ getIdentity: () => identity,
960
+ getDisplayProject: () => coms.scope.displayProject,
961
+ includeExplicitPeers: () => coms.scope.includeExplicit,
962
+ getPeerCards: () => peerCards,
963
+ readProjectEntries: readAllRegistryEntries,
964
+ readAllEntries: readAllRegistryEntriesAcrossProjects,
965
+ truncate: truncateToWidth,
966
+ });
967
+ const fleetPeerInputs = poolPresentation.peerInputs;
968
+
969
+ // ── Extracted tool execution wiring ──
970
+ // Mutable fleet state remains composition-owned; executor modules receive ports.
971
+ let herdrFleetReady = false;
972
+ const hubSpawnedPeers = new Map<string, { name: string; paneId: string | null; addressed: boolean }>();
973
+ const markPeerAddressed = (name: string) => {
974
+ const entry = hubSpawnedPeers.get(String(name || "").toLowerCase());
975
+ if (entry) entry.addressed = true;
976
+ };
977
+ let lastHubPiSpawnAt: number | null = null;
978
+
979
+ let askUserAvailable = false;
980
+ let baselineTools: string[] = [];
981
+ let contextPressureState: ContextPressureState = createContextPressureState();
982
+ const pressureRootState = createContextPressureRootState();
983
+
984
+ function pendingCapabilityOperations(): PendingOperation[] {
985
+ const pending: PendingOperation[] = [];
986
+ if (pendingTaskTransition) pending.push({ pack: "fleet", kind: "task-transition" });
987
+ if (processOpenObligations(processState, undefined, privateProofUse()).some(stage => stage === "plan" || stage === "review")) pending.push({ pack: "fleet", kind: "process-stage" });
988
+ if (Array.from(agentStates.values()).some(state => state.status === "running") || Array.from(researchStates.values()).some(state => state.status === "running")) pending.push({ pack: "fleet", kind: "child" });
989
+ if (pendingReplies.size > 0 || pendingHandoff) pending.push({ pack: "peer", kind: "message" });
990
+ if (hubSpawnedPeers.size > 0) pending.push({ pack: "workspace", kind: "pane" });
991
+ return pending;
992
+ }
993
+ function recordToolCatalogChange(change: { fromMode: WorkMode; toMode: WorkMode; previous: readonly string[]; next: readonly string[]; reason: "refresh" | "mode_switch" }): void {
994
+ const { snapshot, delta } = toolCatalogRuntime.reconcile(change);
995
+ latestToolCatalogDelta = delta;
996
+ unknownToolCounter.noteCatalogChange(delta.catalogVersion);
997
+ const evidenceRef = `session-entry:${TOOL_CATALOG_ENTRY_TYPE}:${delta.catalogVersion}`;
998
+ let persisted = false;
999
+ try { persisted = toolCatalogRuntime.persist({ snapshot, delta }, (type, data) => pi.appendEntry(type, data), change.reason); } catch {}
1000
+ if (persisted && delta.evidence.changed) noProgress.establishToolStateChange(delta.evidence.previousCatalogVersion, delta.evidence.catalogVersion, evidenceRef);
1001
+ }
1002
+ function capabilityContextState(): ContextState {
1003
+ return pressureCapabilityState(contextPressureState, currentCtx?.getContextUsage?.()?.percent);
1004
+ }
1005
+ const workModePolicy = createWorkModePolicy({
1006
+ getBaselineTools: () => baselineTools, getRosterSize: () => agentStates.size,
1007
+ getDeterministicToolsEnabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
1008
+ getAgenticAskEnabled: () => agenticHubEnabled(pi),
1009
+ getFileDiscoveryEnabled: () => discoveryHubEnabled(pi),
1010
+ getDispatchTriageEnabled: () => triageRuntime?.available === true,
1011
+ getActiveTeamName: () => activeTeamName, getComsReady: () => comsReady,
1012
+ getHerdrReady: () => herdrFleetReady, getAskUserAvailable: () => askUserAvailable,
1013
+ getIdentityLabel: () => identity ? `${identity.name}@${identity.project}` : null,
1014
+ getTaskTier: () => taskTier, getPendingOperations: pendingCapabilityOperations,
1015
+ getContextState: capabilityContextState, getActiveTools: () => pi.getActiveTools(), setActiveTools: tools => pi.setActiveTools(tools),
1016
+ recordToolCatalog: recordToolCatalogChange,
1017
+ persist: (type, data) => pi.appendEntry(type, data),
1018
+ });
1019
+ const {
1020
+ getWorkMode, getCapabilityResolution, resolveIncomingCapabilities, provisionalCapabilityRefusal,
1021
+ applyWorkModeTools, statusText: workModeStatusText,
1022
+ } = workModePolicy;
1023
+
1024
+
1025
+ const toolCtx: ToolContext = createToolExecutionOrchestration({
1026
+ dispatch: {
1027
+ state: {
1028
+ getAcceptedUserInput: () => hubTaskText,
1029
+ getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
1030
+ getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
1031
+ getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
1032
+ getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
1033
+ getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
1034
+ getTaskTier: () => taskTier, getTurnReport: () => turnReport, getSessionTotals: () => sessionTotals,
1035
+ getProcessState: () => processState, setProcessState: value => { processState = value; }, persistProcessVerdict, processBlock,
1036
+ getTurnDispatchFingerprints: () => turnDispatchFingerprints,
1037
+ getExternalBlockers: () => externalBlockers,
1038
+ getExternalBlockerAcknowledged: () => externalBlockerAcknowledged, setExternalBlockerAcknowledged: value => { externalBlockerAcknowledged = value; },
1039
+ getExternalBlockerRefusedOnce: () => externalBlockerRefusedOnce, setExternalBlockerRefusedOnce: value => { externalBlockerRefusedOnce = value; },
1040
+ isAskUserAvailable: () => askUserAvailable, getUserLanguage: () => userLanguage, getSessionDir: () => sessionDir,
1041
+ getAgentStates: () => agentStates as any, getAssertions: () => assertions, getResearchPersonas: () => researchPersonas,
1042
+ getInstalledAgentNames: () => dispatchableAgentDefs().map(def => def.name),
1043
+ recordDelegation,
1044
+ getActiveWriters: () => Array.from(activeWriters.values()),
1045
+ addAgentInstance: (base, instance) => {
1046
+ const def = dispatchableAgentDefs().find(candidate => candidate.name.toLowerCase() === base);
1047
+ if (!def) return false;
1048
+ // The instance keeps the base persona's prompt file, tools and the model and
1049
+ // thinking it resolves to now, so project model overrides still apply.
1050
+ const clone: AgentDef = { ...def, name: instance, model: resolvedModel(def) ?? def.model, thinking: resolvedThinking(def) ?? def.thinking };
1051
+ const result = rosterPolicy.addInstance(clone);
1052
+ if (result.ok) widgetCtx?.ui?.notify?.(`dispatch_agent: ${result.message}`, "info");
1053
+ return result.ok;
1054
+ },
1055
+ beginWriter: entry => {
1056
+ const id = ++writerSequence;
1057
+ activeWriters.set(id, entry);
1058
+ if (entry.isolated) isolatedWriterAgents.add(entry.agent.toLowerCase());
1059
+ let released = false;
1060
+ return () => {
1061
+ if (released) return;
1062
+ released = true;
1063
+ activeWriters.delete(id);
1064
+ if (entry.isolated) isolatedWriterAgents.delete(entry.agent.toLowerCase());
1065
+ };
1066
+ },
1067
+ addInstalledAgent: name => {
1068
+ const def = dispatchableAgentDefs().find(candidate => candidate.name.toLowerCase() === String(name).trim().toLowerCase());
1069
+ return def ? rosterAdd(def.name) : null;
1070
+ },
1071
+ getActiveWritableDispatches: () => activeWritableDispatches, setActiveWritableDispatches: value => { activeWritableDispatches = value; },
1072
+ getWritableOverlapCounter: () => writableOverlapCounter, setWritableOverlapCounter: value => { writableOverlapCounter = value; },
1073
+ },
1074
+ budget: budgetCtx, noProgress, artifacts: assertionsArtifactsCtx, research: researchRuntime,
1075
+ provisionalCapabilityRefusal, dispatchAgent, runReturnExtraction,
1076
+ returnExtractionAssist: () => resolveAssist(readActiveProfile()?.profile.assist)['return-extraction'],
1077
+ extractNeedsResearch, extractAskUserQuestions, contextPressure: percent => percent >= CONTEXT_WARN_THRESHOLD, displayName,
1078
+ resolvedAgentModel: (def, ctx) => resolvedModel(def as AgentDef) ?? (ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : undefined),
1079
+ getToolCatalogVersion: () => toolCatalogRuntime.catalogForMessage().catalogVersion,
1080
+ },
1081
+ actions: {
1082
+ budget: budgetCtx, artifacts: assertionsArtifactsCtx, hubState: hubStateCtx,
1083
+ getAcceptedUserInput: () => hubTaskText,
1084
+ provisionalCapabilityRefusal,
1085
+ getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
1086
+ getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
1087
+ getProcessState: () => processState, setProcessState: value => { processState = value; },
1088
+ processBlock, adoptTaskTriage: async (id, newTask, expandedScope) => {
1089
+ if (processPersistenceBlocked) throw new Error("corrupt process state");
1090
+ const next = await adoptTaskTriageState({ runtime: taskTriage, taskId: id, newTask,
1091
+ expandedScope, pendingTransition: pendingTaskTransition, state: processState,
1092
+ persist: state => pi.appendEntry("agent-hub-process-state", processAuditRecord(state, evaluateProcessObligations(state, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER }))),
1093
+ onPostCommitFailure: () => { processPersistenceBlocked = true; },
1094
+ });
1095
+ pendingTaskTransition = false;
1096
+ transitionDiversions = 0;
1097
+ transitionHintDelivered = false;
1098
+ transitionBatchRefused = false;
1099
+ try { pi.appendEntry(TASK_TRANSITION_ENTRY_TYPE, { pending: false }); } catch { processPersistenceBlocked = true; }
1100
+ return next;
1101
+ },
1102
+ persistProcessState: value => persistProcessVerdict(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() })),
1103
+ getTaskDispatchCount: () => taskDispatchCount, getTaskResearchCount: () => taskResearchCount,
1104
+ getTurnReport: () => turnReport, getAssertions: () => assertions, setAssertions: value => { assertions = value; },
1105
+ currentTaskId: () => noProgress.taskId(), currentRevision: ctx => { const cwd = ctx.cwd || process.cwd(); return revisionOf(cwd, revisionScopes(cwd, processState.changedFiles)); },
1106
+ revisionOf: (ctx, scopes) => revisionOf(ctx.cwd || process.cwd(), [...scopes]),
1107
+ privateProofUse: ctx => privateProofUse(ctx.cwd || process.cwd()),
1108
+ adoptReservedTaskId: (id, resetTaskWindow) => { taskIdentityReset.run(id, resetTaskWindow); bindSemanticScope(id, hubTaskText ? createHash("sha256").update(hubTaskText).digest("hex") : ""); },
1109
+ confirmTaskSupersession: (input, ctx, signal) => confirmTaskSupersession(input, ctx, { language: () => userLanguage, currentTaskId: () => noProgress.taskId(), ask: (id, params, askCtx, askSignal) => requestRuntimeAsk(pi.events, id, params, askCtx, askSignal), startWait: id => executionHistory.startAskUser(id), endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); } }, signal),
1110
+ getAgentStates: () => agentStates, rosterAdd, rosterDrop,
1111
+ getIdentity: () => identity, getComs: () => coms, resolveTarget,
1112
+ appendMachineHandoffSections, markPeerAddressed,
1113
+ },
1114
+ herdr: {
1115
+ getProcessState: () => processState, processBlock,
1116
+ provisionalCapabilityRefusal, isFleetReady: () => herdrFleetReady, isComsReady: () => comsReady,
1117
+ getIdentity: () => identity, getCurrentContext: () => currentCtx, peersInScope,
1118
+ getComsPeerNames: () => peersInScope().map(peer => peer.name), herdr: herdrApi,
1119
+ readEnvFile: file => fs.readFileSync(file, "utf-8"), envFileExists: file => fs.existsSync(file),
1120
+ getLastPiSpawnAt: () => lastHubPiSpawnAt, setLastPiSpawnAt: value => { lastHubPiSpawnAt = value; },
1121
+ recordSpawnedPeer: (name, paneId) => { hubSpawnedPeers.set(name.toLowerCase(), { name, paneId, addressed: false }); },
1122
+ },
1123
+ });
1124
+
1125
+ function triageInput(task: string, scope: string[], language: string, domain: string): TriageInput {
1126
+ const candidates = [...agentStates.values()].map(s => {
1127
+ const name = s.def.name.toLowerCase();
1128
+ const research = ["researcher", "deep-researcher", ...researchPersonas.map(p => p.name.toLowerCase())].includes(name);
1129
+ const gate = processBlock() ?? processPreEffectGate(processState, "child", name) ?? (processAllowsPersona(processState,name) ? null : checkTierPersonaGate(taskTier,name)) ?? checkDocsLane(name, scope, undefined);
1130
+ return { name, description: s.def.description, ...(research ? { excluded: "research_persona" } : s.status === "running" ? { excluded: "busy" } : gate ? { excluded: gate.reason } : {}) };
1131
+ });
1132
+ return { taskId: noProgress.taskId(), task, scope, language, domain, candidates, constraints: JSON.stringify({ tier: taskTier, process: { risk: processState.risk, scope: processState.scope }, externalBlocked: externalBlockers.length > 0 && !externalBlockerAcknowledged }), complete: !(externalBlockers.length > 0 && !externalBlockerAcknowledged) };
1133
+ }
1134
+ registerDamageGuardHub(pi);
1135
+ registerAgenticHub(pi);
1136
+ registerDiscoveryHub(pi);
1137
+ registerDispatchTriage(pi, { runtime: () => triageRuntime, input: triageInput, blocked: () => provisionalCapabilityRefusal("fleet") });
1138
+
1139
+ // Keep the extracted tool surface flat and greppable in this composition root.
1140
+ registerDispatchAgent(pi, toolCtx, { disposition: (id, persona, reason) => triageRuntime?.disposition(id, persona, reason) ?? false, submitted: (id, persona, status) => triageRuntime?.submitted(id, persona, status) });
1141
+ registerSpawnResearch(pi, toolCtx);
1142
+ registerRunFlow(pi, {
1143
+ sessionDir: () => sessionDir,
1144
+ taskId: () => noProgress.taskId(),
1145
+ processObligations: () => evaluateProcessObligations(processState, { writable: false, budgetTier: taskTier ?? DEFAULT_TASK_TIER }),
1146
+ nestedRepositories: () => nestedRepositoriesInUse(processState),
1147
+ effectiveScoutConfig: cwd => {
1148
+ const persona = resolveFlowPersona("researcher", cwd);
1149
+ const model = persona.model!;
1150
+ assertFlowProfileModel(model);
1151
+ return { model, profile: readActiveProfile()?.name ?? null, tools: persona.tools.split(",").map(value => value.trim()).filter(Boolean), fallback: persona.fallbackModel ?? null, allowlisted: true };
1152
+ },
1153
+ reserveBudget: async (_params, _ctx, signal) => {
1154
+ ensureTaskTier();
1155
+ if (signal?.aborted) return { charged: false, operation: "research", owner: "hub", refusal: "Flow cancelled before budget charge." };
1156
+ turnResearchCount++; taskResearchCount++; turnReport.research++; sessionTotals.research++; budgetCtx.updateModeStatus();
1157
+ return { charged: true, operation: "research", owner: "hub" };
1158
+ },
1159
+ });
1160
+ /** Panel poll ports shared by `/af-poll` and `poll_panel`; only progress delivery differs. */
1161
+ function hubPollPorts(ctx: ExtensionContext, cwd: string, progress: { started(text: string): void; voice(text: string): void }): Omit<AfPollHandleInput, "args"> {
1162
+ return {
1163
+ cwd,
1164
+ pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
1165
+ listPanels: async dir => {
1166
+ const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1167
+ return listPanelNames(dir);
1168
+ },
1169
+ preflight: async ({ panel, persona, cwd: root }) => {
1170
+ const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
1171
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1172
+ import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
1173
+ import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
1174
+ ]);
1175
+ try { resolvePersona(persona, root); }
1176
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1177
+ let voices;
1178
+ try { voices = resolvePanel(panel, root); }
1179
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1180
+ const report = checkChildVisibility(voices.map(voice => voice.model));
1181
+ if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
1182
+ const hidden = report.models.filter(model => !model.ok);
1183
+ if (hidden.length) {
1184
+ return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
1185
+ }
1186
+ return null;
1187
+ },
1188
+ checkBudget: async () => {
1189
+ ensureTaskTier();
1190
+ return null;
1191
+ },
1192
+ chargeBudget: () => {
1193
+ turnDispatchCount += 1;
1194
+ taskDispatchCount += 1;
1195
+ sessionTotals.dispatches += 1;
1196
+ updateModeStatus();
1197
+ },
1198
+ onAccepted: async ({ panel, persona, question }) => {
1199
+ let voices: { name: string; model: string }[] = [];
1200
+ try {
1201
+ const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1202
+ voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
1203
+ } catch { /* names are decorative */ }
1204
+ ctx.ui.setStatus("hub-poll", `Poll: ${panel} (${voices.length || "?"} voices) running…`);
1205
+ ctx.ui.notify(`Poll started — panel ${panel}. This can take a minute.`, "info");
1206
+ progress.started(formatAfPollStarted({ panel, persona, question, voices }));
1207
+ },
1208
+ execute: async ({ panel, persona, question }) => {
1209
+ const [{ Run }, { runPoll }, { runMerge }, { resolvePersona }] = await Promise.all([
1210
+ import("../../agent-fleet/scripts/workflows/lib/run.ts"),
1211
+ import("../../agent-fleet/scripts/workflows/lib/poll.ts"),
1212
+ import("../../agent-fleet/scripts/workflows/lib/merge.ts"),
1213
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1214
+ ]);
1215
+ const run = new Run({ cwd, command: ["/af-poll", "--panel", panel, question] });
1216
+ const personaDef = resolvePersona(persona, cwd);
1217
+ const poll = await runPoll({
1218
+ run, cwd, persona: personaDef, panel, task: question,
1219
+ onVoice: result => {
1220
+ const voice = result.ok
1221
+ ? { name: result.voice.name, model: result.voice.model, ok: true as const, position: result.report.position, confidence: result.report.confidence }
1222
+ : { name: result.voice.name, model: result.voice.model, ok: false as const, reason: result.reason };
1223
+ progress.voice(formatAfPollVoiceProgress(voice));
1224
+ },
1225
+ });
1226
+ ctx.ui.setStatus("hub-poll", `Poll: ${panel} merging…`);
1227
+ const merge = await runMerge({ run, cwd, persona: personaDef, panel, task: question, opinions: poll.results });
1228
+ const directory = path.relative(cwd, poll.directory) || poll.directory;
1229
+ return {
1230
+ panel,
1231
+ directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
1232
+ voices: poll.results.map(item => item.ok
1233
+ ? { name: item.voice.name, model: item.voice.model, ok: true as const, position: item.report.position, confidence: item.report.confidence }
1234
+ : { name: item.voice.name, model: item.voice.model, ok: false as const, reason: item.reason }),
1235
+ recommendation: merge.report.recommendation,
1236
+ integrator: merge.integrator.name,
1237
+ };
1238
+ },
1239
+ };
1240
+ }
1241
+
1242
+ registerPollPanel(pi, {
1243
+ blocked: () => provisionalCapabilityRefusal("fleet")?.content[0]?.text ?? null,
1244
+ run: (params, ctx, onProgress) => withProfileWork(async () => {
1245
+ const cwd = ctx.cwd || process.cwd();
1246
+ try { return await runAfPoll({ ...params, ...hubPollPorts(ctx, cwd, { started: onProgress, voice: onProgress }) }); }
1247
+ finally { ctx.ui.setStatus("hub-poll", ""); }
1248
+ }),
1249
+ });
1250
+ registerSetTaskTier(pi, toolCtx);
1251
+ registerTeamAdjust(pi, toolCtx);
1252
+ registerVerificationContract(pi, toolCtx);
1253
+ registerComsTools(pi, toolCtx);
1254
+ registerFleetTools(pi, toolCtx);
1255
+ registerFilesystemTool(pi, {
1256
+ enabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
1257
+ sessionDir: () => sessionDir,
1258
+ policyRoots: () => sessionOverrides?.policyRoots,
1259
+ managedReadbackAllowed: handle => discoveryManagedReadbackAllowed(pi,handle),
1260
+ });
1261
+
1262
+ const researchControls = createResearchControls({
1263
+ runtime: researchRuntime,
1264
+ refresh: () => {},
1265
+ getAgents: () => agentStates, displayName, modelWorkBlocked: () => false,
1266
+ cancelWait: (state, kind) => cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind } }),
1267
+ cancelOwned: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
1268
+ restartSpecialist: async (state: AgentState, ctx) => {
1269
+ if (state.status === "running" && (state.proc || state.comsAbort)) {
1270
+ let resolveTermination!: () => void;
1271
+ const terminated = new Promise<void>(resolve => { resolveTermination = resolve; });
1272
+ state.onTerminate = resolveTermination;
1273
+ fenceOperatorCancel(state);
1274
+ if (state.proc) { state.killedByOperator = true; state.restarting = true; if (state.dispatchId) proactiveRuntime?.abort(safeAgentKey(state.def.name), state.dispatchId); killPiTree(state.proc); }
1275
+ else await cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind: "restart" } });
1276
+ await terminated;
1277
+ }
1278
+ state.sessionFile = null;
1279
+ const result = await dispatchAgent(state.def.name, state.task, ctx);
1280
+ pi.sendMessage({ customType: "agent-restart-result", content: `[${displayName(state.def.name)}] restarted by operator and ${result.exitCode === 0 ? "completed" : "failed"} in ${Math.round(result.elapsed / 1000)}s.`, display: true }, { deliverAs: "followUp", triggerTurn: true });
1281
+ },
1282
+ });
1283
+
1284
+ // ── ask_user Tool (dispatcher → human) ──
1285
+ //
1286
+ // We do NOT register `ask_user` here. The recommended companion package
1287
+ // `pi-ask-user` (see docs/pi-setup.md) owns that tool name with a richer
1288
+ // implementation. Registering our own conflicts regardless of load order:
1289
+ // - if we register first, pi-ask-user fails to load
1290
+ // - if pi-ask-user registers first, our registration fails
1291
+ // and pi has no synchronous probe at load time — `pi.getAllTools()` is
1292
+ // a runtime action method that throws when called from the factory.
1293
+ //
1294
+ // Instead, in `session_start` (where action methods ARE allowed) we check
1295
+ // `pi.getAllTools()`, gate `ask_user` into `setActiveTools` only if present,
1296
+ // and warn the user to `pi install npm:pi-ask-user` if it's missing.
1297
+
1298
+
1299
+ // ── Commands ─────────────────────────────────
1300
+
1301
+ // /af-config and Alt+, — read-only configuration screen (shared with coms peers via lib/fleet-config).
1302
+ const fleetConfigUi = createFleetConfigUi({
1303
+ readHubOverrides: cwd => parseAgentTeamOverrides(cwd),
1304
+ livePeerNames: () => identity ? readAllRegistryEntries(identity.project).map(entry => entry.name) : [],
1305
+ runtimeRows: () => [
1306
+ { label: "Work mode", detail: workModeStatusText(), origin: "runtime" },
1307
+ { label: "Active roster", detail: activeTeamName ? `${activeTeamName} (${agentStates.size} specialists)` : "(none)", origin: ".pi/agents/teams.yaml" },
1308
+ { label: "Coms identity", detail: identity ? `${identity.name}@${identity.project}${comsReady ? "" : " · not ready"}` : "not connected", origin: "runtime" },
1309
+ { label: "Node", detail: process.version, origin: "runtime" },
1310
+ { label: "Related screens", detail: "/af-agents-team · /af-dispatch-policy · /af-context · /af-allowed · /af-coms", origin: "runtime" },
1311
+ ],
1312
+ });
1313
+ const openFleetConfig = (ctx: ExtensionContext, args = "") => gridUI.withSuspended(() => fleetConfigUi.open(ctx, args));
1314
+
1315
+ const commandCtx: CommandContext = {
1316
+ setWidgetContext: ctx => { widgetCtx = ctx; },
1317
+ handleTaskTriageRecover: () => {
1318
+ if (!processPersistenceBlocked) return false;
1319
+ try {
1320
+ const recovered = recoverTaskTriageProcessState({ state: processState, current: taskTriage?.current ? { taskId: taskTriage.current.taskId, evaluationId: taskTriage.current.evaluationId, inputRevision: taskTriage.current.revision, assessment: taskTriage.current.assessment } : null,
1321
+ taskId: noProgress.taskId(), budgetTier: taskTier ?? DEFAULT_TASK_TIER,
1322
+ append: record => pi.appendEntry("agent-hub-process-state", record),
1323
+ entries: () => currentCtx?.sessionManager.getEntries() ?? [],
1324
+ });
1325
+ processState = recovered;
1326
+ processPersistenceBlocked = false;
1327
+ resolveIncomingCapabilities(""); applyWorkModeTools();
1328
+ return true;
1329
+ } catch { return false; }
1330
+ },
1331
+ handleTaskTriageWaive: async (args, ctx) => {
1332
+ const [id, ...words] = args.trim().split(/\s+/);
1333
+ const addition = processState.additions?.find(a => a.id === id && a.status === "active" && a.taskId === noProgress.taskId());
1334
+ if (!addition || !words.length || processBlock()) return false;
1335
+ const next = await confirmTaskTriageWaiver(processState, { taskId: addition.taskId, evaluationId: addition.evaluationId, inputRevision: addition.inputRevision, additionId: id, reason: words.join(" ") }, {
1336
+ taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
1337
+ ask: (nonce, question, askCtx, signal) => requestRuntimeAsk(pi.events, nonce, question, askCtx, signal, undefined, 'permission'),
1338
+ startWait: nonce => executionHistory.startAskUser(nonce), endWait: (nonce, sameTask) => { const wait = executionHistory.endAskUser(nonce, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
1339
+ persist: value => pi.appendEntry("agent-hub-process-state", processAuditRecord(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }))),
1340
+ }, ctx);
1341
+ if (next) processState = next;
1342
+ return !!next;
1343
+ },
1344
+ handleAudit: async (ctx, args = "") => {
1345
+ const input = proactiveReportInput();
1346
+ await showSessionAudit(ctx, sessionDir, input && { ...input, labels: commandProactiveLabels(sessionDir, args) }, {
1347
+ ...taskTriageMetadata(), activity: taskTriageActivity?.live(),
1348
+ }, executionTrace.snapshot());
1349
+ },
1350
+ handleRetry: async (args, ctx) => {
1351
+ const dispatchId = args?.trim();
1352
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(dispatchId)) { ctx.ui.notify("Usage: /af-retry <dispatchId>", "error"); return; }
1353
+ const op = noProgress.byDispatch(dispatchId), attempt = op?.attempts.find(a => a.dispatchId === dispatchId);
1354
+ if (!op || !attempt) { ctx.ui.notify("Unknown dispatch ID; no retry authorized.", "error"); return; }
1355
+ await commandCtx.handleRecover(`retry ${op.operationId} ${attempt.attemptId}`, ctx);
1356
+ },
1357
+ handleRecover: async (args, ctx) => {
1358
+ await runRecoverCommand(args, ctx, {
1359
+ noProgress,
1360
+ currentRevision: cwd => scopes => revisionOf(cwd, [...scopes]),
1361
+ confirm: confirmRecoverAction,
1362
+ askPorts: (op, attempt, action) => ({
1363
+ taskId: () => noProgress.taskId(), language: () => userLanguage,
1364
+ ask: (id: string, params: any, askCtx: any, signal: AbortSignal) => requestRuntimeAsk(pi.events, id, params, askCtx, signal),
1365
+ startWait: (id: string) => executionHistory.startAskUser(id),
1366
+ endWait: (id: string, sameTask: boolean) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
1367
+ valid: () => { const current = noProgress.inspect(op.operationId); return current?.attempts.at(-1)?.attemptId === attempt.attemptId && (action === "abandon" ? !current.abandoned && noProgress.isIdle(op.executor) : noProgress.canAuthorize(op.operationId, attempt.attemptId)); },
1368
+ consume: (nonce: string) => action === "abandon" ? noProgress.abandon(op.operationId, attempt.attemptId, nonce) : attempt.category === "indeterminate" ? noProgress.authorizeIndeterminate(op.operationId, attempt.attemptId, nonce) : noProgress.authorize(attempt.dispatchId),
1369
+ }),
1370
+ });
1371
+ },
1372
+
1373
+ handleAgentsTeam: async (_args, ctx) => {
1374
+ widgetCtx = ctx;
1375
+ const teamNames = Object.keys(teams);
1376
+ if (teamNames.length === 0) {
1377
+ ctx.ui.notify("No teams defined in .pi/agents/teams.yaml", "warning");
1378
+ return;
1379
+ }
1380
+
1381
+ const options = teamNames.map(name => {
1382
+ const members = teams[name].map(m => displayName(m));
1383
+ return `${name} — ${members.join(", ")}`;
1384
+ });
1385
+
1386
+ const choice = await ctx.ui.select("Select Team", options);
1387
+ if (choice === undefined) return;
1388
+
1389
+ const idx = options.indexOf(choice);
1390
+ const name = teamNames[idx];
1391
+ const selected = resolveSessionRoster({
1392
+ teams,
1393
+ entries: [],
1394
+ explicitRoster: name,
1395
+ availablePersonas: allAgentDefs.map(def => def.name),
1396
+ });
1397
+ if (!selected.roster) {
1398
+ ctx.ui.notify(`${selected.diagnostic} Fix .pi/agents/teams.yaml or select another team.`, "error");
1399
+ return;
1400
+ }
1401
+ activateTeam(selected.roster.name);
1402
+ persistActiveRoster();
1403
+ resolveIncomingCapabilities("");
1404
+ applyWorkModeTools();
1405
+ setTimeout(replayDeferredRecoveryInputs, 0);
1406
+ updateWidget();
1407
+ ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
1408
+ ctx.ui.notify(`Team: ${name} — ${Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ")}`, "info");
1409
+ },
1410
+ handleAgentsList: async (_args, _ctx) => {
1411
+ widgetCtx = _ctx;
1412
+ await openFleetDashboard(_ctx);
1413
+ },
1414
+ handleAgentsHistory: async (_args, ctx) => {
1415
+ widgetCtx = ctx;
1416
+ await openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub"));
1417
+ },
1418
+ handleAgentsAdd: async (args, ctx) => {
1419
+ widgetCtx = ctx;
1420
+ const names = (args || "").trim().split(/\s+/).filter(Boolean);
1421
+ if (names.length === 0) {
1422
+ const available = allAgentDefs
1423
+ .filter(d => !agentStates.has(d.name.toLowerCase()))
1424
+ .map(d => d.name).sort().join(", ") || "(all personas are already in the team)";
1425
+ ctx.ui.notify(`Usage: /af-agents-add <persona> [<persona>…]\nNot in the team yet: ${available}`, "info");
1426
+ return;
1427
+ }
1428
+ const results = names.map(n => rosterAdd(n));
1429
+ const level = results.some(r => r.ok) ? "info" : "error";
1430
+ ctx.ui.notify(results.map(r => r.message).join("\n"), level);
1431
+ ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
1432
+ },
1433
+ handleAgentsDrop: async (args, ctx) => {
1434
+ widgetCtx = ctx;
1435
+ const names = (args || "").trim().split(/\s+/).filter(Boolean);
1436
+ if (names.length === 0) {
1437
+ ctx.ui.notify(`Usage: /af-agents-drop <persona> [<persona>…]\nActive team: ${Array.from(agentStates.values()).map(s => s.def.name).join(", ")}`, "info");
1438
+ return;
1439
+ }
1440
+ const results = names.map(n => rosterDrop(n));
1441
+ const level = results.some(r => r.ok) ? "info" : "error";
1442
+ ctx.ui.notify(results.map(r => r.message).join("\n"), level);
1443
+ ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
1444
+ },
1445
+ handleAgentsSave: async (args, ctx) => {
1446
+ widgetCtx = ctx;
1447
+ const name = (args || "").trim();
1448
+ if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(name)) {
1449
+ ctx.ui.notify("Usage: /af-agents-save <team-name> (letters, digits, hyphens, underscores)", "error");
1450
+ return;
1451
+ }
1452
+ const members = Array.from(agentStates.values()).map(s => s.def.name);
1453
+ if (members.length === 0) {
1454
+ ctx.ui.notify("The active team is empty — nothing to save.", "error");
1455
+ return;
1456
+ }
1457
+ const teamsPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "teams.yaml");
1458
+ let raw = "";
1459
+ try { raw = existsSync(teamsPath) ? readFileSync(teamsPath, "utf-8") : ""; } catch {}
1460
+ try {
1461
+ mkdirSync(join(ctx.cwd || process.cwd(), ".pi", "agents"), { recursive: true });
1462
+ writeFileSync(teamsPath, upsertTeamInYaml(raw, name, members), "utf-8");
1463
+ } catch (err) {
1464
+ ctx.ui.notify(`Could not write ${teamsPath}: ${err instanceof Error ? err.message : String(err)}`, "error");
1465
+ return;
1466
+ }
1467
+ teams[name] = members;
1468
+ activeTeamName = name;
1469
+ persistActiveRoster();
1470
+ ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
1471
+ ctx.ui.notify(`Team "${name}" saved to .pi/agents/teams.yaml — ${members.join(", ")}`, "info");
1472
+ },
1473
+ handleAgentsKill: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleKill(args, ctx); },
1474
+ handleAgentsRestart: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleRestart(args, ctx); },
1475
+ handleContext: async (_args, ctx) => {
1476
+ widgetCtx = ctx;
1477
+ await openContextBudget(ctx);
1478
+ },
1479
+ handleConfig: async (args, ctx) => {
1480
+ widgetCtx = ctx;
1481
+ await openFleetConfig(ctx, args);
1482
+ },
1483
+ handleHubReport: async (args, ctx) => {
1484
+ widgetCtx = ctx;
1485
+ const fmtTok = (n: number) => n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${Math.round(n / 1000)}k` : String(n);
1486
+ const renderReport = (label: string, r: TurnReport): string => {
1487
+ const billed = r.dispatches.reduce((n, d) => n + d.billed, 0);
1488
+ const out = r.dispatches.reduce((n, d) => n + d.out, 0);
1489
+ const rows = r.dispatches.map(d => ` ${d.agent}: ${d.status} in ${Math.round(d.elapsed / 1000)}s · ${fmtTok(d.billed)} billed / ${fmtTok(d.out)} out`);
1490
+ return [
1491
+ `${label} — tier ${r.tier ?? "(unset)"} · ${r.dispatches.length} dispatch(es) · ${r.research} research · ` +
1492
+ `${fmtTok(billed)} billed / ${fmtTok(out)} out · ${r.recycles} recycle(s) · ${r.driftStops} drift stop(s) · ${r.refusals} refusal(s)`,
1493
+ ...rows,
1494
+ ].join("\n");
1495
+ };
1496
+ const lines: string[] = [];
1497
+ if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) {
1498
+ lines.push(renderReport("Current turn", turnReport));
1499
+ }
1500
+ if (lastTurnReport) lines.push(renderReport("Last turn", lastTurnReport));
1501
+ lines.push(
1502
+ `Session — ${sessionTotals.turns} dispatching turn(s) · ${sessionTotals.dispatches} dispatch(es) · ${sessionTotals.research} research · ` +
1503
+ `${fmtTok(sessionTotals.billed)} billed / ${fmtTok(sessionTotals.out)} out · ${sessionTotals.recycles} recycle(s) · ` +
1504
+ `${sessionTotals.driftStops} drift stop(s) · ${sessionTotals.refusals} refusal(s)`,
1505
+ );
1506
+ const sweep = unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()));
1507
+ if (sweep) lines.push(sweep.message);
1508
+ const trace = readWatchdogEvents(sessionDir);
1509
+ lines.push(`Watchdog System 1 — ${JSON.stringify(buildWatchdogReport(trace.events, watchdogActivity?.live(), trace.integrity))}`);
1510
+ const proactiveInput = proactiveReportInput();
1511
+ lines.push(`Proactive review — ${JSON.stringify(proactiveInput ? buildProactiveReport({ ...proactiveInput, labels: commandProactiveLabels(sessionDir, args) }) : readProactiveReport(sessionDir))}`);
1512
+ ctx.ui.notify(lines.join("\n\n"), "info");
1513
+ },
1514
+ handleZoom: async (args, ctx) => {
1515
+ widgetCtx = ctx;
1516
+ const arg = args?.trim() || "";
1517
+ const rid = parseResearchHandle(arg);
1518
+ const target: Zoomable | undefined = rid != null
1519
+ ? researchStates.get(rid)
1520
+ : arg
1521
+ ? agentStates.get(arg.toLowerCase()) ?? findDelegationChild(arg)?.child
1522
+ : undefined;
1523
+ if (!target) {
1524
+ const teamKnown = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
1525
+ const researchKnown = Array.from(researchStates.values()).map(s => `r${s.id}`).join(", ");
1526
+ const childKnown = Array.from(agentStates.values())
1527
+ .flatMap(s => Array.from(s.delegations?.keys() || [])).join(", ");
1528
+ const known = [teamKnown, researchKnown, childKnown].filter(Boolean).join(", ");
1529
+ ctx.ui.notify(`Usage: /af-zoom <name|rN|child-id>. Known: ${known || "none"}`, "error");
1530
+ return;
1531
+ }
1532
+ const rowKey = (rid != null ? `r${rid}` : arg).toLowerCase();
1533
+ const row = fleetRows(true).find(r => r.key.toLowerCase() === rowKey);
1534
+ if (row) await openFleetDetail(row, ctx);
1535
+ else await openZoom(target, ctx);
1536
+ },
1537
+ handleDispatchPolicy: async (_args, ctx) => {
1538
+ widgetCtx = ctx;
1539
+ const live = new Set(comsReady && identity ? peersInScope().map(e => e.name.toLowerCase()) : []);
1540
+ const lines = Array.from(agentStates.values()).map(s => {
1541
+ const key = s.def.name.toLowerCase();
1542
+ const sub = dispatchPolicy.substitutions[key];
1543
+ const prefer = sub ? sub.prefer : dispatchPolicy.default === "coms" ? "coms" : "native";
1544
+ if (prefer !== "coms") return `${displayName(s.def.name)}: native`;
1545
+ const fb = sub?.fallback === "none" ? "coms-required" : "coms, fallback native";
1546
+ return `${displayName(s.def.name)}: ${fb} — peer ${live.has(key) ? "LIVE" : "not in pool"}`;
1547
+ });
1548
+ const policyPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "dispatch-policy.yaml");
1549
+ const src = existsSync(policyPath) ? ".pi/agents/dispatch-policy.yaml" : "(no dispatch-policy.yaml — all native)";
1550
+ ctx.ui.notify(
1551
+ `Dispatch backends — ${src}, default: ${dispatchPolicy.default}\n${lines.join("\n") || "(no active team)"}\n` +
1552
+ `Routing is decided per dispatch against the live coms pool (/af-coms to refresh).`,
1553
+ "info",
1554
+ );
1555
+ },
1556
+ handleAgentModel: async (args, ctx) => {
1557
+ widgetCtx = ctx;
1558
+ const arg = (args || "").trim().toLowerCase();
1559
+
1560
+ // Dot form: <persona>.<role> targets a delegate sub-role. Candidates are
1561
+ // the role's declared model (default) + the parent's candidate list.
1562
+ if (arg.includes(".")) {
1563
+ const dot = arg.indexOf(".");
1564
+ const personaName = arg.slice(0, dot);
1565
+ const roleName = arg.slice(dot + 1);
1566
+ const parent = agentStates.get(personaName);
1567
+ const roles = parent?.def.subagents || {};
1568
+ const roleKey = Object.keys(roles).find(r => r.toLowerCase() === roleName);
1569
+ if (!parent || !roleKey) {
1570
+ const valid = Array.from(agentStates.values()).flatMap(s =>
1571
+ Object.keys(s.def.subagents || {}).map(r => `${s.def.name}.${r}`));
1572
+ ctx.ui.notify(
1573
+ `No sub-role "${arg}". Valid targets: ${valid.join(", ") || "none (no persona declares subagents:)"}`,
1574
+ "error",
1575
+ );
1576
+ return;
1577
+ }
1578
+ const role = roles[roleKey];
1579
+ const overrideKey = `${personaName}.${roleKey.toLowerCase()}`;
1580
+ const candidates: string[] = [];
1581
+ for (const m of [role.model, ...allowedModels(parent.def)]) {
1582
+ if (m && !candidates.includes(m)) candidates.push(m);
1583
+ }
1584
+ const current = resolvedSubagentModel(parent.def.name, roleKey, role.model);
1585
+ const options = candidates.map(m => {
1586
+ const tags = [m === role.model ? "default" : "", m === current ? "current" : ""].filter(Boolean);
1587
+ return tags.length ? `${m} (${tags.join(", ")})` : m;
1588
+ });
1589
+ const label = `${displayName(parent.def.name)}.${roleKey}`;
1590
+ const choice = await ctx.ui.select(`Model for ${label}`, options);
1591
+ if (choice === undefined) return;
1592
+ const picked = candidates[options.indexOf(choice)];
1593
+ const effectivePicked = substitutedModel(picked) ?? picked;
1594
+ if (effectivePicked === current) {
1595
+ ctx.ui.notify(`${label} is already on ${effectivePicked}`, "info");
1596
+ return;
1597
+ }
1598
+ if (picked === role.model) {
1599
+ modelPolicy.setSubagentOverride(personaName, roleKey, undefined);
1600
+ } else {
1601
+ modelPolicy.setSubagentOverride(personaName, roleKey, picked);
1602
+ }
1603
+ updateWidget();
1604
+ ctx.ui.notify(
1605
+ `${label} → ${effectivePicked} (applies on next dispatch of ${parent.def.name})`,
1606
+ "info",
1607
+ );
1608
+ return;
1609
+ }
1610
+
1611
+ const name = arg;
1612
+ // Team member (live state) OR a research persona — both switchable.
1613
+ const def = name ? switchablePersonaDef(name) : undefined;
1614
+ if (!def) {
1615
+ const known = [
1616
+ ...Array.from(agentStates.values()).map(s => s.def.name),
1617
+ ...researchPersonas.map(d => d.name),
1618
+ ].join(", ");
1619
+ ctx.ui.notify(`Usage: /af-agent-model <persona>[.<role>]. Known: ${known || "none"}`, "error");
1620
+ return;
1621
+ }
1622
+ if (!def.models || def.models.length === 0) {
1623
+ ctx.ui.notify(
1624
+ `${displayName(def.name)} declares no model candidates — add a \`models:\` list to ${def.file} or a \`models.${def.name}:\` override in .ai/agent-fleet-overrides.md.`,
1625
+ "warning",
1626
+ );
1627
+ return;
1628
+ }
1629
+ const candidates = allowedModels(def);
1630
+ const current = resolvedModel(def);
1631
+ // A persona without a frontmatter default runs on the dispatcher's model —
1632
+ // offer that as an explicit candidate so the override can be cleared.
1633
+ const DISPATCHER_DEFAULT = "(dispatcher's model)";
1634
+ if (!def.model) candidates.unshift(DISPATCHER_DEFAULT);
1635
+ const options = candidates.map(m => {
1636
+ const isDefault = def.model ? m === def.model : m === DISPATCHER_DEFAULT;
1637
+ const isCurrent = current ? m === current : m === DISPATCHER_DEFAULT;
1638
+ const tags = [isDefault ? "default" : "", isCurrent ? "current" : ""].filter(Boolean);
1639
+ return tags.length ? `${m} (${tags.join(", ")})` : m;
1640
+ });
1641
+ const choice = await ctx.ui.select(`Model for ${displayName(def.name)}`, options);
1642
+ if (choice === undefined) return;
1643
+ const picked = candidates[options.indexOf(choice)];
1644
+ const effectivePicked = picked === DISPATCHER_DEFAULT ? picked : (substitutedModel(picked) ?? picked);
1645
+ const pickedIsCurrent = current ? effectivePicked === current : picked === DISPATCHER_DEFAULT;
1646
+ if (pickedIsCurrent) {
1647
+ ctx.ui.notify(`${displayName(def.name)} is already on ${effectivePicked}`, "info");
1648
+ return;
1649
+ }
1650
+ if (picked === def.model || picked === DISPATCHER_DEFAULT) {
1651
+ modelPolicy.setPersonaOverride(name, undefined);
1652
+ } else {
1653
+ modelPolicy.setPersonaOverride(name, picked);
1654
+ }
1655
+ updateWidget();
1656
+ // Research helpers spawn fresh each time, so the switch lands on their
1657
+ // next spawn; team members apply on next dispatch (restartable now).
1658
+ const applyHint = (def.kind || "").toLowerCase() === "research"
1659
+ ? "applies on next spawn_research"
1660
+ : `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
1661
+ ctx.ui.notify(`${displayName(def.name)} → ${effectivePicked} (${applyHint})`, "info");
1662
+ if ((dispatchPolicy.substitutions[name]?.prefer ?? dispatchPolicy.default) === "coms") {
1663
+ ctx.ui.notify(
1664
+ `Note: ${displayName(def.name)} prefers a coms peer (dispatch-policy.yaml) — this model override only applies to native(-fallback) runs; the peer keeps its own model.`,
1665
+ "info",
1666
+ );
1667
+ }
1668
+ },
1669
+ handleAgentModelThinking: async (args, ctx) => {
1670
+ widgetCtx = ctx;
1671
+ const name = (args || "").trim().toLowerCase();
1672
+ // Team member (live state) OR a research persona — both switchable.
1673
+ const def = name ? switchablePersonaDef(name) : undefined;
1674
+ if (!def) {
1675
+ const known = [
1676
+ ...Array.from(agentStates.values()).map(s => s.def.name),
1677
+ ...researchPersonas.map(d => d.name),
1678
+ ].join(", ");
1679
+ ctx.ui.notify(`Usage: /af-agent-model-thinking <persona>. Known: ${known || "none"}`, "error");
1680
+ return;
1681
+ }
1682
+ const defaultLevel = resolveThinkingLevel(def.thinking);
1683
+ const current = resolveThinkingLevel(resolvedThinking(def));
1684
+ const levels = [...THINKING_LEVELS];
1685
+ const options = levels.map(l => {
1686
+ const tags = [l === defaultLevel ? "default" : "", l === current ? "current" : ""].filter(Boolean);
1687
+ return tags.length ? `${l} (${tags.join(", ")})` : l;
1688
+ });
1689
+ const choice = await ctx.ui.select(`Thinking level for ${displayName(def.name)}`, options);
1690
+ if (choice === undefined) return;
1691
+ const picked = levels[options.indexOf(choice)];
1692
+ if (picked === current) {
1693
+ ctx.ui.notify(`${displayName(def.name)} is already on thinking: ${picked}`, "info");
1694
+ return;
1695
+ }
1696
+ if (picked === defaultLevel) {
1697
+ modelPolicy.setThinkingOverride(name, undefined);
1698
+ } else {
1699
+ modelPolicy.setThinkingOverride(name, picked);
1700
+ }
1701
+ updateWidget();
1702
+ // Research helpers spawn fresh each time, so the switch lands on their
1703
+ // next spawn; team members apply on next dispatch (restartable now).
1704
+ const applyHint = (def.kind || "").toLowerCase() === "research"
1705
+ ? "applies on next spawn_research"
1706
+ : `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
1707
+ ctx.ui.notify(`${displayName(def.name)} thinking → ${picked} (${applyHint})`, "info");
1708
+ },
1709
+ handleModels: async (args, ctx) => {
1710
+ widgetCtx = ctx;
1711
+ const names = Object.keys(modelProfiles);
1712
+ if (names.length === 0) {
1713
+ ctx.ui.notify("No model profiles loaded — define .pi/agents/model-profiles.yaml (invalid profiles are dropped at session start).", "warning");
1714
+ return;
1715
+ }
1716
+ let profileName = (args || "").trim();
1717
+ if (!profileName) {
1718
+ const options = names.map(n =>
1719
+ isCompleteProfile(modelProfiles[n])
1720
+ ? `${n} — complete fleet (${shortModel((modelProfiles[n] as any).defaults.model)} default)`
1721
+ : `${n} — ${Object.entries(modelProfiles[n]).map(([p, m]) => `${p}: ${shortModel(m)}`).join(", ")}`,
1722
+ );
1723
+ const choice = await ctx.ui.select("Select model profile", options);
1724
+ if (choice === undefined) return;
1725
+ profileName = names[options.indexOf(choice)];
1726
+ }
1727
+ const profile = modelProfiles[profileName];
1728
+ if (!profile) {
1729
+ ctx.ui.notify(`No profile "${profileName}". Known: ${names.join(", ")}`, "error");
1730
+ return;
1731
+ }
1732
+ profileCommandContext=ctx;
1733
+ try {
1734
+ const applied=await profileActivation.activate(profileName,profile);
1735
+ applyWorkModeTools();
1736
+ ctx.ui.setStatus('hub-model-profile',isCompleteProfile(profile)?`Models: ${profileName}`:undefined);
1737
+ ctx.ui.notify(`Profile "${profileName}": ${applied.length} personas${isCompleteProfile(profile)?', all children, dispatcher and auxiliary models':''} switched.`, 'info');
1738
+ } catch(error) {ctx.ui.notify(String(error),'error');}
1739
+ },
1740
+ handleAgentModelsSubstitute: async (args, ctx) => {
1741
+ widgetCtx = ctx;
1742
+ const tokens = (args || "").trim().split(/\s+/).filter(Boolean);
1743
+ if (tokens.length === 0) {
1744
+ if (allKnownModels().length === 0) {
1745
+ ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
1746
+ return;
1747
+ }
1748
+ await openFleetDashboard(ctx, true);
1749
+ return;
1750
+ }
1751
+ if (tokens.length !== 2) {
1752
+ ctx.ui.notify("Usage: /af-agent-models-substitute [<source> <target>]", "error");
1753
+ return;
1754
+ }
1755
+ await applySessionModelSubstitution(tokens[0], tokens[1], ctx);
1756
+ },
1757
+ handleWatchdog: async (args, ctx) => {
1758
+ widgetCtx = ctx;
1759
+ const parts = (args || "").trim().split(/\s+/).filter(Boolean);
1760
+ if (parts.length === 0) {
1761
+ const perAgent = watchdogAgentOverrides.size > 0
1762
+ ? Array.from(watchdogAgentOverrides.entries()).map(([k, v]) => `${k}: ${v}`).join(", ")
1763
+ : "(none)";
1764
+ ctx.ui.notify(
1765
+ `Drift watchdog: ${watchdogSetting} (hub-wide)\nPer-agent overrides: ${perAgent}\n` +
1766
+ `Judge model: ${watchdogJudgeModel || "(researcher persona's, else dispatcher's)"}\n` +
1767
+ `${formatWatchdogStatus(watchdogSystem1, watchdogActivity)}\n` +
1768
+ `Usage: /af-watchdog on|off|auto — or /af-watchdog <agent> on|off|clear`,
1769
+ "info",
1770
+ );
1771
+ return;
1772
+ }
1773
+ if (parts.length === 1) {
1774
+ const setting = normalizeWatchdogSetting(parts[0]);
1775
+ if (!setting) {
1776
+ ctx.ui.notify(`Unknown setting "${parts[0]}" — expected one of: ${WATCHDOG_SETTINGS.join(", ")} (or /af-watchdog <agent> on|off|clear)`, "error");
1777
+ return;
1778
+ }
1779
+ watchdogSetting = setting;
1780
+ ctx.ui.notify(`Drift watchdog → ${setting} (applies from the next dispatch)`, "info");
1781
+ return;
1782
+ }
1783
+ const agentKey = normalizeAgentInput(parts[0]);
1784
+ const value = parts[1].toLowerCase();
1785
+ if (!agentStates.has(agentKey)) {
1786
+ ctx.ui.notify(`"${parts[0]}" is not in the active team (${Array.from(agentStates.values()).map(s => s.def.name).join(", ")})`, "error");
1787
+ return;
1788
+ }
1789
+ if (value === "clear") {
1790
+ watchdogAgentOverrides.delete(agentKey);
1791
+ ctx.ui.notify(`Drift watchdog override cleared for ${agentKey} (hub-wide setting "${watchdogSetting}" applies)`, "info");
1792
+ return;
1793
+ }
1794
+ if (value !== "on" && value !== "off") {
1795
+ ctx.ui.notify(`Per-agent watchdog must be on, off, or clear — got "${parts[1]}"`, "error");
1796
+ return;
1797
+ }
1798
+ watchdogAgentOverrides.set(agentKey, value);
1799
+ ctx.ui.notify(`Drift watchdog for ${agentKey} → ${value} (overrides the hub-wide "${watchdogSetting}")`, "info");
1800
+ },
1801
+ handleComs: async (args, ctx) => {
1802
+ if (!comsReady) { ctx.ui.notify("coms is not active in this session.", "warning"); return; }
1803
+ await coms.updateScope((args ?? "").trim(), ctx);
1804
+ },
1805
+ handleHandoff: async (args, ctx) => {
1806
+ if (!comsReady) { ctx.ui.notify("coms is not active in this session — /af-handoff unavailable.", "warning"); return; }
1807
+ const target = (args ?? "").trim();
1808
+ if (!target) {
1809
+ ctx.ui.notify("Usage: /af-handoff <peer>. See the coms pool for live peer names.", "error");
1810
+ return;
1811
+ }
1812
+ const peer = resolveTarget(target);
1813
+ if (!peer) {
1814
+ ctx.ui.notify(`coms: no live peer "${target}". Use /af-coms to refresh the pool.`, "error");
1815
+ return;
1816
+ }
1817
+ const refusal=profilePeerGate({ peerModel: peer.model, targetResolved: true });if(refusal){ctx.ui.notify(refusal.content[0].text,"error");return;}
1818
+ const handoffToken = crypto.randomBytes(8).toString("hex");
1819
+ hubStateCtx.setPendingHandoff({ target: peer.name, token: handoffToken });
1820
+ pi.sendMessage({
1821
+ customType: "coms-handoff",
1822
+ content:
1823
+ `HANDOFF REQUEST → peer "${peer.name}".\n\n` +
1824
+ `Compose a SELF-CONTAINED handoff brief (the peer does NOT share your context): state the ` +
1825
+ `overall goal, what's been done so far, key decisions and constraints, the current status, ` +
1826
+ `and the concrete next steps you want the peer to take. Then call ` +
1827
+ `coms_send(target: "${peer.name}", handoff_token: "${handoffToken}", prompt: <the brief only; the hub appends the verification ledger and artifact index in code only when this token matches>), coms_await its msg_id, and relay ` +
1828
+ `the peer's reply to me in ${userLanguage}.`,
1829
+ display: true,
1830
+ }, { deliverAs: "followUp", triggerTurn: true });
1831
+ ctx.ui.notify(`Handoff to ${peer.name}: asking the dispatcher to compose a brief…`, "info");
1832
+ },
1833
+ handleCompound: async (args, ctx) => {
1834
+ if (!agentStates.has("documenter")) {
1835
+ ctx.ui.notify(
1836
+ "compound: the documenter persona is not in the active team — switch with /af-agents-team (e.g. default or release), then re-run /af-compound.",
1837
+ "warning",
1838
+ );
1839
+ return;
1840
+ }
1841
+ const focus = (args ?? "").trim();
1842
+ const rulesLine = projectRulesDirs.length > 0
1843
+ ? projectRulesDirs.join(", ")
1844
+ : "(none declared in .ai/agent-fleet-overrides.md — the documenter must locate an existing rules tree or, failing that, propose lessons without writing)";
1845
+ const docsLine = projectDocsPaths.length > 0
1846
+ ? projectDocsPaths.join(", ")
1847
+ : "(none declared)";
1848
+ pi.sendMessage({
1849
+ customType: "compound-learning",
1850
+ content:
1851
+ `COMPOUND REQUEST — capture this session's lessons into the project's rules and docs (compound-learning pass).\n\n` +
1852
+ `1. From THIS session's context, compose a candidate-lessons brief: user corrections, review findings that recurred, ` +
1853
+ `wrong assumptions that cost rework, debugging root causes, and changes that invalidated existing docs. At most 5 lessons; ` +
1854
+ `each is one imperative sentence plus a one-line Why (the failure it prevents) and a one-line Evidence (what happened this session). ` +
1855
+ `${focus ? `Focus especially on: ${focus}. ` : ""}` +
1856
+ `If nothing rises to a lesson, tell the user there is nothing worth compounding and stop.\n` +
1857
+ `2. Confirm the list with the user in ${userLanguage} (ask_user when available) — they approve, trim, or reword. Do not dispatch before this confirmation.\n` +
1858
+ `3. Dispatch the documenter with a SELF-CONTAINED task (it shares none of your context) containing: the approved lessons verbatim ` +
1859
+ `(with Why + Evidence); the project rule folders: ${rulesLine}; the docs entry points: ${docsLine}; the assertion ledger path ` +
1860
+ `.pi/agent-sessions/assertions.json (when it exists); and the instruction to read skills/compound-learning/SKILL.md and follow it exactly — ` +
1861
+ `dedupe index-first against the existing rule tree, minimal diffs on existing files, caps of 5 lessons / 1 new file. State that the user ` +
1862
+ `already approved this lesson list, so it may apply without a second gate. Pass the relevant review/return/evidence artifact paths via the ` +
1863
+ `dispatch's artifacts array — paths only, never pasted bodies.\n` +
1864
+ `4. Relay the documenter's file-by-file result to me in ${userLanguage}.`,
1865
+ display: true,
1866
+ }, { deliverAs: "followUp", triggerTurn: true });
1867
+ ctx.ui.notify("Compound: asking the dispatcher to compose the candidate-lessons brief…", "info");
1868
+ },
1869
+ handlePoll: async (args, ctx) => {
1870
+ return withProfileWork(async () => {
1871
+ const cwd = ctx.cwd || process.cwd();
1872
+ const followUp = (customType: string) => (content: string) => pi.sendMessage({ customType, content, display: true }, { deliverAs: "followUp", triggerTurn: false });
1873
+ const result = await handleAfPoll({ args: args ?? "", ...hubPollPorts(ctx, cwd, { started: followUp("af-poll-started"), voice: followUp("af-poll-voice") }) });
1874
+ ctx.ui.setStatus("hub-poll", "");
1875
+ if (!result.ok) {
1876
+ ctx.ui.notify(result.message, "error");
1877
+ pi.sendMessage({ customType: "af-poll-failed", content: `POLL FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
1878
+ return;
1879
+ }
1880
+ ctx.ui.notify(result.digest ?? result.message, "info");
1881
+ pi.sendMessage({
1882
+ customType: "af-poll",
1883
+ content: result.dispatcherNote ?? result.message,
1884
+ display: true,
1885
+ }, { deliverAs: "followUp", triggerTurn: true });
1886
+ });
1887
+ },
1888
+ handleDebate: async (args, ctx) => {
1889
+ return withProfileWork(async () => {
1890
+ const cwd = ctx.cwd || process.cwd();
1891
+ const result = await handleAfDebate({
1892
+ args: args ?? "",
1893
+ cwd,
1894
+ pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
1895
+ listPanels: async dir => {
1896
+ const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1897
+ return listPanelNames(dir);
1898
+ },
1899
+ preflight: async ({ panel, persona, cwd: root }) => {
1900
+ const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
1901
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1902
+ import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
1903
+ import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
1904
+ ]);
1905
+ try { resolvePersona(persona, root); }
1906
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1907
+ let voices;
1908
+ try { voices = resolvePanel(panel, root); }
1909
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1910
+ const report = checkChildVisibility(voices.map(voice => voice.model));
1911
+ if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
1912
+ const hidden = report.models.filter(model => !model.ok);
1913
+ if (hidden.length) {
1914
+ return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
1915
+ }
1916
+ return null;
1917
+ },
1918
+ checkBudget: async () => {
1919
+ ensureTaskTier();
1920
+ return null;
1921
+ },
1922
+ chargeBudget: () => {
1923
+ turnDispatchCount += 1;
1924
+ taskDispatchCount += 1;
1925
+ sessionTotals.dispatches += 1;
1926
+ updateModeStatus();
1927
+ },
1928
+ onAccepted: async ({ panel, persona, question, rounds }) => {
1929
+ let voices: { name: string; model: string }[] = [];
1930
+ try {
1931
+ const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1932
+ voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
1933
+ } catch { /* names are decorative */ }
1934
+ const started = formatAfDebateStarted({ panel, persona, question, rounds, voices });
1935
+ ctx.ui.setStatus("hub-poll", `Debate: ${panel} (${rounds} rounds) running…`);
1936
+ ctx.ui.notify(`Debate started — panel ${panel}, ${rounds} rounds.`, "info");
1937
+ pi.sendMessage({ customType: "af-debate-started", content: started, display: true }, { deliverAs: "followUp", triggerTurn: false });
1938
+ },
1939
+ execute: async ({ panel, persona, question, rounds }) => {
1940
+ const [{ Run }, { runDebate }, { resolvePersona }] = await Promise.all([
1941
+ import("../../agent-fleet/scripts/workflows/lib/run.ts"),
1942
+ import("../../agent-fleet/scripts/workflows/lib/debate.ts"),
1943
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1944
+ ]);
1945
+ const run = new Run({ cwd, command: ["/af-debate", "--panel", panel, "--rounds", String(rounds), question] });
1946
+ const personaDef = resolvePersona(persona, cwd);
1947
+ const debate = await runDebate({
1948
+ run, cwd, persona: personaDef, panel, task: question, rounds,
1949
+ onVoice: (result, round) => {
1950
+ const voice = result.ok
1951
+ ? { name: result.voice.name, model: result.voice.model, ok: true as const, round, position: result.report.position, changed: result.report.changed }
1952
+ : { name: result.voice.name, model: result.voice.model, ok: false as const, round, reason: result.reason };
1953
+ ctx.ui.setStatus("hub-poll", `Debate: ${panel} round ${round}…`);
1954
+ pi.sendMessage({ customType: "af-debate-voice", content: formatAfDebateVoiceProgress(voice), display: true }, { deliverAs: "followUp", triggerTurn: false });
1955
+ },
1956
+ });
1957
+ const last = debate.roundsRun.at(-1)?.results ?? [];
1958
+ const directory = path.relative(cwd, debate.directory) || debate.directory;
1959
+ return {
1960
+ panel, rounds: debate.rounds,
1961
+ directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
1962
+ voices: last.map(item => item.ok
1963
+ ? { name: item.voice.name, model: item.voice.model, ok: true as const, round: item.round, position: item.report.position, changed: item.report.changed }
1964
+ : { name: item.voice.name, model: item.voice.model, ok: false as const, round: item.round, reason: item.reason }),
1965
+ };
1966
+ },
1967
+ });
1968
+ ctx.ui.setStatus("hub-poll", "");
1969
+ if (!result.ok) {
1970
+ ctx.ui.notify(result.message, "error");
1971
+ pi.sendMessage({ customType: "af-debate-failed", content: `DEBATE FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
1972
+ return;
1973
+ }
1974
+ ctx.ui.notify(result.digest ?? result.message, "info");
1975
+ pi.sendMessage({
1976
+ customType: "af-debate",
1977
+ content: result.dispatcherNote ?? result.message,
1978
+ display: true,
1979
+ }, { deliverAs: "followUp", triggerTurn: true });
1980
+ });
1981
+ },
1982
+ getAgentsKillCompletions: prefix => completions.agentsKill(prefix),
1983
+ getZoomCompletions: prefix => completions.zoom(prefix),
1984
+ getAgentModelCompletions: prefix => completions.agentModels(prefix),
1985
+ getAgentModelThinkingCompletions: prefix => completions.agentThinking(prefix),
1986
+ getModelProfileCompletions: prefix => completions.modelProfiles(prefix),
1987
+ getSubstituteCompletions: prefix => completions.substitutions(prefix),
1988
+ getComsPeerCompletions: prefix => completions.comsPeers(prefix),
1989
+ getSubagentTargetCompletions: prefix => completions.subagentTargets(prefix),
1990
+ };
1991
+
1992
+ // Keep the complete command surface flat and greppable in this composition root.
1993
+ registerAgentsTeam(pi, commandCtx);
1994
+ registerAgentsList(pi, commandCtx);
1995
+ registerAgentsHistory(pi, commandCtx);
1996
+ registerContextCommand(pi, commandCtx);
1997
+ registerAudit(pi, commandCtx);
1998
+ registerConfig(pi, commandCtx);
1999
+ registerWatchdog(pi, commandCtx);
2000
+ registerAgentsAdd(pi, commandCtx);
2001
+ registerAgentsDrop(pi, commandCtx);
2002
+ registerAgentsSave(pi, commandCtx);
2003
+ registerHubReport(pi, commandCtx);
2004
+ registerZoom(pi, commandCtx);
2005
+ registerAgentModel(pi, commandCtx);
2006
+ registerAgentModelThinking(pi, commandCtx);
2007
+ registerModels(pi, commandCtx);
2008
+ registerAgentModelsSubstitute(pi, commandCtx);
2009
+ registerDispatchPolicy(pi, commandCtx);
2010
+ registerAgentsKill(pi, commandCtx);
2011
+ registerAgentsRestart(pi, commandCtx);
2012
+ registerComs(pi, commandCtx);
2013
+ registerHandoff(pi, commandCtx);
2014
+ registerCompound(pi, commandCtx);
2015
+ registerPoll(pi, commandCtx);
2016
+ registerRetry(pi, commandCtx);
2017
+ registerRecover(pi, commandCtx);
2018
+ registerDebate(pi, commandCtx);
2019
+ registerTaskTriageRecover(pi, commandCtx);
2020
+ registerTaskTriageWaiver(pi, commandCtx);
2021
+
2022
+ const detailPanel = createDetailPanel<AgentDef, AgentState, ResearchState>({
2023
+ getAgent: key => agentStates.get(key),
2024
+ getResearch: id => researchStates.get(id),
2025
+ parseResearchHandle,
2026
+ findDelegationChild,
2027
+ modelPolicy,
2028
+ displayName,
2029
+ shortModel,
2030
+ refreshUi: updateWidget,
2031
+ getDispatchPreference: name => (dispatchPolicy.substitutions[name.toLowerCase()]?.prefer ?? dispatchPolicy.default) === "coms" ? "coms" : "native",
2032
+ maxLiveEntryChars: MAX_LIVE_ENTRY_CHARS,
2033
+ getProactive: () => fleetSource.snapshot(Date.now()).proactive,
2034
+ readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
2035
+ currentFleetRow: key => fleetSource.rows(Date.now(), { showFinished: true }).find(row => row.key === key),
2036
+ });
2037
+ const { openFleetDetail, loadAvailableModelChoices } = detailPanel;
2038
+ const applySessionModelSubstitution = (source: string, target: string, ctx: any) => modelPolicy.applySessionSubstitution(source, target, {
2039
+ loadAvailable: current => loadAvailableModelChoices(ctx, current),
2040
+ notify: (message, level) => ctx.ui.notify(message, level),
2041
+ });
2042
+
2043
+ fleetActions = createFleetActions<AgentState, ResearchState>({
2044
+ getRows: () => fleetSource.rows(Date.now(), { showFinished: true }),
2045
+ getAgents: () => agentStates,
2046
+ getResearch: () => researchStates,
2047
+ parseResearchHandle,
2048
+ displayName,
2049
+ modelWorkBlocked: () => false,
2050
+ restartSpecialist: researchControls.restartSpecialist,
2051
+ removeResearch: researchControls.remove,
2052
+ killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
2053
+ abortComs: state => { state.comsAbort?.(); },
2054
+ openDetail: openFleetDetail,
2055
+ generation: () => fleetUiGeneration,
2056
+ });
2057
+ let fleetShowFinished = false;
2058
+ let fleetFilter = "";
2059
+ const fleetDashboard = createFleetDashboard<AgentDef, AgentState, ResearchState>({
2060
+ onThinkingChanged: updateWidget,
2061
+ openSystem1: ctx => openSystem1Communication(ctx, communicationStore),
2062
+ getFleetRows: (now, unfiltered) => fleetSource.rows(now, unfiltered ? { showFinished: true } : { showFinished: fleetShowFinished, query: fleetFilter }),
2063
+ getTaskTriage: () => fleetSource.snapshot(Date.now()).taskTriage,
2064
+ getProactive: () => fleetSource.snapshot(Date.now()).proactive,
2065
+ readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
2066
+ actions: fleetActions,
2067
+ getAgents: () => agentStates,
2068
+ getResearch: () => researchStates,
2069
+ getShowFinished: () => fleetShowFinished,
2070
+ setShowFinished: value => { fleetShowFinished = value; },
2071
+ getFilter: () => fleetFilter,
2072
+ setFilter: value => { fleetFilter = value; },
2073
+ parseResearchHandle,
2074
+ displayName,
2075
+ shortModel,
2076
+ thinkingSuffix,
2077
+ modelWithThinking,
2078
+ resolvedThinking,
2079
+ abbreviatePeerModel: abbreviateModel,
2080
+ modelPolicy,
2081
+ loadAvailableModels: loadAvailableModelChoices,
2082
+ openDetail: openFleetDetail,
2083
+ openHistory: ctx => openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub")),
2084
+ openConfig: ctx => fleetConfigUi.open(ctx as ExtensionContext),
2085
+ modelWorkBlocked: () => false,
2086
+ restartSpecialist: researchControls.restartSpecialist,
2087
+ removeResearch: researchControls.remove,
2088
+ killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
2089
+ abortComs: state => { state.comsAbort?.(); },
2090
+ getComsLines: (width, theme) => poolPresentation.render(width, theme),
2091
+ getConnectionLines: width => codexControls.lines().map(line=>truncateToWidth(line,width)),
2092
+ getCodexChats:()=>codexControls.rows(),
2093
+ codexChatAction:async(kind,namespace)=>{if(!currentCtx)throw Error('native_pi_ui_unavailable');await codexControls.action(kind,namespace,currentCtx);},
2094
+ });
2095
+ const { fleetRows, openFleetDashboard: openFleetDashboardRaw } = fleetDashboard;
2096
+ const openFleetDashboard = (ctx: any, startSubstitution = false) => gridUI.withSuspended(() => openFleetDashboardRaw(ctx, startSubstitution));
2097
+
2098
+ const contextBudgetUi = createContextBudgetUi<AgentDef, AgentState, ResearchState>({
2099
+ getAgents: () => agentStates,
2100
+ getResearch: () => researchStates,
2101
+ getAllDefs: () => allAgentDefs,
2102
+ getResearchPersonas: () => researchPersonas,
2103
+ getPeers: () => peerCards.values(),
2104
+ modelPolicy,
2105
+ displayName,
2106
+ getProjectDocsPaths: () => projectDocsPaths,
2107
+ getUserLanguage: () => userLanguage,
2108
+ getDelegateExtensionPath: () => delegateExtPath,
2109
+ safeAgentKey,
2110
+ projectPolicyPaths: specialistProjectPolicyPaths,
2111
+ modelWindowLookup,
2112
+ getResearchTools: () => RESEARCH_TOOLS,
2113
+ getPromptLedger: () => lastHubLedger,
2114
+ getPressureState: () => contextPressureState,
2115
+ buildHubSystemPrompt: () => { buildHubSystemPrompt(); },
2116
+ getAllTools: () => typeof pi.getAllTools === "function" ? pi.getAllTools() : [],
2117
+ getActiveTools: () => typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
2118
+ getCommands: () => typeof pi.getCommands === "function" ? pi.getCommands() : [],
2119
+ });
2120
+ const { openContextBudget } = contextBudgetUi;
2121
+
2122
+ // A delegate child anywhere in the team, by its id (e.g. "quality-1").
2123
+ function findDelegationChild(arg: string): { child: DelegationChild; owner: AgentState } | null {
2124
+ const lower = arg.toLowerCase();
2125
+ for (const state of agentStates.values()) {
2126
+ const child = Array.from(state.delegations?.values() ?? []).find(candidate => candidate.id.toLowerCase() === lower);
2127
+ if (child) return { child, owner: state };
2128
+ }
2129
+ return null;
2130
+ }
2131
+
2132
+ const completions = createCompletionPresentation({
2133
+ getAgents: () => agentStates.values(), getResearch: () => researchStates.values(),
2134
+ getResearchPersonas: () => researchPersonas, getModelProfiles: () => modelProfiles,
2135
+ getPeers: peersInScope, displayName, shortModel, resolvedModel, resolvedThinking,
2136
+ resolveThinkingLevel, resolvedSubagentModel,
2137
+ getSubagentOverride: (persona, role) => modelPolicy.getSubagentOverride(persona, role),
2138
+ getSubstitutionSources: () => modelPolicy.allKnownModels().map(spec => {
2139
+ const target = modelPolicy.getSubstitution(spec);
2140
+ return { spec, label: target ? `${spec} → ${target} (active this session)` : spec };
2141
+ }),
2142
+ });
2143
+
2144
+ registerInputShortcuts(pi, {
2145
+ setWidgetContext: ctx => { widgetCtx = ctx; }, openFleetDashboard,
2146
+ toggleFleetWidget: () => gridUI.toggle(),
2147
+ openFleetConfig: ctx => openFleetConfig(ctx),
2148
+ });
2149
+
2150
+ // Root owns subscription order; lifecycle modules own handler bodies.
2151
+ registerTurnPresence(pi, {
2152
+ beforeAgentPresence: () => turnHandlers.beforeAgentPresence(),
2153
+ });
2154
+
2155
+ // /af-handoff <peer> — hand the session off to a coms peer. Per decision G1 we do NOT
2156
+ // extract the compaction summary; instead we ask the dispatcher LLM (next turn) to
2157
+ // compose a SELF-CONTAINED brief and coms_send it, then await + relay the reply.
2158
+ // /af-compound [focus] — end-of-session compound-learning pass. Mirrors /af-handoff's
2159
+ // shape: the dispatcher LLM (which saw the whole session) composes the
2160
+ // candidate-lessons brief itself, gates it on the user, then dispatches the
2161
+ // documenter to land the approved lessons per skills/compound-learning/SKILL.md.
2162
+ // The rules/docs targets come from the overrides file; artifacts travel as
2163
+ // paths through the dispatch's `artifacts` array, never as pasted bodies.
2164
+ // ── ask_user wait tracking (for /af-agents-history real-work) ──
2165
+ // pi-ask-user blocks the dispatcher turn while the human answers. Bracket each
2166
+ // ask_user call with its tool_execution start/end so /af-agents-history can subtract
2167
+ // that "away from keyboard" time from the dispatcher's real work.
2168
+ // T11 production pre-effect gate: operator direct side effects use the same task-scoped process state as child dispatch.
2169
+ pi.on("tool_call", async (event: any, ctx) => {
2170
+ const toolName = String(event.toolName || "").toLowerCase();
2171
+ const block = processBlock();
2172
+ const gate = ["bash", "edit", "write"].includes(toolName) ? processPreEffectGate(processState, "write") : null;
2173
+ const finishPolicy = beginRuntimeTrace(pi.events, { kind: "policy", id: `process:${event.toolCallId}`, parentId: String(event.toolCallId), source: "process", tool: toolName, rule: block?.reason ?? gate?.reason ?? "no_process_hold", reason: block?.reason ?? gate?.reason });
2174
+ try {
2175
+ // set_task_tier binds the fence. ask_user is the human supersession path. Every other tool is a diversion.
2176
+ // The first assistant step may emit several tools together. Refuse that whole step without aborting,
2177
+ // so the model can still call set_task_tier. Abort only a later step that ignores the hint; terminate
2178
+ // alone cannot stop siblings whose calls already returned.
2179
+ if (block && toolName !== "set_task_tier" && toolName !== "ask_user") {
2180
+ const decision = transitionToolDecision(transitionHintDelivered, transitionDiversions, block.message);
2181
+ transitionDiversions = decision.nextCount;
2182
+ transitionBatchRefused = true;
2183
+ if (decision.terminate) ctx?.abort?.();
2184
+ finishPolicy({ status: "blocked" });
2185
+ return { block: true, terminate: decision.terminate, reason: decision.reason };
2186
+ }
2187
+ if (!["bash", "edit", "write"].includes(toolName)) return;
2188
+ if (!gate) return;
2189
+ if (gate.reason !== "action_confirmation_unsupported") { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
2190
+ const bound = taskTriage?.current;
2191
+ // Pi's tool_call contract provides the exact call id and input; absent fields cannot be bound.
2192
+ if (!bound || bound.taskId !== noProgress.taskId() || !event.toolCallId || !event.input || !ctx) { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
2193
+ const action = { taskId: bound.taskId, inputRevision: bound.revision, actionId: String(event.toolCallId), operation: String(event.toolName), target: crypto.createHash("sha256").update(JSON.stringify(event.input)).digest("hex"), cwd: ctx.cwd };
2194
+ const observeAction = (status: TaskTriageActionObservation) => {
2195
+ try { const record = taskTriageActionAuditRecord(action, status); if (record) pi.appendEntry("agent-hub-task-triage-action-observation", record); }
2196
+ catch { /* Diagnostic trace cannot alter effect authorization. */ }
2197
+ };
2198
+ observeAction("requested");
2199
+ let presentationFailure = "";
2200
+ const grant = await confirmTaskTriageAction(action, {
2201
+ relay:permissionRelay,permissionAudit:entry=>pi.appendEntry('task-triage-permission-decision',entry),
2202
+ presentationRefused: reason => { presentationFailure = `Task-triage approval was not shown: ${reason}. Exact action presentation refused; no authorization issued.`; },
2203
+ taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
2204
+ ask: (id, question, askCtx, signal) => requestRuntimeAsk(pi.events, id, question, askCtx, signal, { parentId: action.actionId, source: "task-triage" }, 'permission'),
2205
+ startWait: id => executionHistory.startAskUser(id), endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
2206
+ }, ctx, contract => { pi.appendEntry("agent-hub-task-triage-action-grant", contract); return true; }, undefined, { input: event.input, cwd: ctx.cwd });
2207
+ if (processBlock() || ctx.cwd !== action.cwd || String(event.toolName) !== action.operation || String(event.toolCallId) !== action.actionId
2208
+ || noProgress.taskId() !== action.taskId || taskTriage?.current?.revision !== action.inputRevision
2209
+ || crypto.createHash("sha256").update(JSON.stringify(event.input)).digest("hex") !== action.target) { finishPolicy({ status: "blocked" }); return { block: true, reason: "Action changed while confirmation was pending; effect refused." }; }
2210
+ if (!grant || !consumeActionGrant(grant, action)) { observeAction("not_granted"); finishPolicy({ status: "blocked" }); return { block: true, reason: presentationFailure || gate.message }; }
2211
+ try { pi.appendEntry("agent-hub-task-triage-action-consumed", action); }
2212
+ catch { observeAction("consumption_failed"); finishPolicy({ status: "blocked" }); return { block: true, reason: "One-use authorization consumption could not be persisted; effect refused." }; }
2213
+ } catch (error) { finishPolicy({ status: "failed" }); throw error; }
2214
+ finally { finishPolicy({ status: "allowed" }); }
2215
+ });
2216
+ pi.on("tool_execution_start", async event => turnHandlers.toolStart(event));
2217
+ observeAskUserResults(({ params, result, phase }) => {
2218
+ const pack = capabilityConfirmationPack(params.context);
2219
+ if (!pack) return;
2220
+ if (phase === "start") workModePolicy.setCapabilityConfirmation(pack, "pending");
2221
+ else {
2222
+ const outcome = confirmationOutcome(result);
2223
+ if (!outcome) return;
2224
+ workModePolicy.setCapabilityConfirmation(pack, outcome);
2225
+ resolveIncomingCapabilities("");
2226
+ applyWorkModeTools();
2227
+ }
2228
+ });
2229
+
2230
+ pi.on("tool_execution_end", async event => turnHandlers.toolEnd(event));
2231
+
2232
+ // ── System Prompt Override ───────────────────
2233
+
2234
+
2235
+ const hubPromptCtx: HubPromptContext = {
2236
+ getTriageBeforeDispatch: () => triageRuntime?.orchestratorBeforeDispatch === true,
2237
+ getAgenticAskMode: () => agenticHubRuntime(pi)?.mode ?? "off",
2238
+ getArtifactRoot: () => sessionDir ? artifactsRoot() : null,
2239
+ getCapabilityResolution,
2240
+ getActiveTools: () => pi.getActiveTools(),
2241
+ getToolCatalogNotice: () => [latestToolCatalogDelta ? toolCatalogNotice(latestToolCatalogDelta) : "", latestUnknownToolNotice].filter(Boolean).join("\n"),
2242
+ getAgents: () => dispatchableAgentDefs().map(def => ({
2243
+ name: def.name,
2244
+ displayName: displayName(def.name),
2245
+ description: def.description,
2246
+ tools: def.tools,
2247
+ model: resolvedModel(def),
2248
+ inTeam: agentStates.has(def.name.toLowerCase()),
2249
+ })),
2250
+ getTeamMembers: () => Array.from(agentStates.values(), state => displayName(state.def.name)),
2251
+ getProviderLimits: () => providerSemaphore.snapshot(),
2252
+ getResearchPersonas: () => researchPersonas.map(def => ({
2253
+ name: def.name,
2254
+ displayName: displayName(def.name),
2255
+ description: def.description,
2256
+ model: resolvedModel(def),
2257
+ thinking: resolveThinkingLevel(resolvedThinking(def)),
2258
+ })),
2259
+ getPromptState: () => ({
2260
+ requirements: assertions.map(a=>({id:a.id,text:a.text,source:a.source,reference:a.reference,criticalConditions:a.criticalConditions,recordedStatus:a.status,evidenceRevision:a.evidenceRevision,evidenceTaskId:a.evidenceTaskId})),
2261
+ taskTier: taskTier ?? DEFAULT_TASK_TIER,
2262
+ taskTierAssumed,
2263
+ processRisk: processState.risk,
2264
+ processScope: processState.scope,
2265
+ processOpen: Object.entries(evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }).obligations).filter(([, value]) => value.status === "open").map(([name]) => name),
2266
+ turnDispatchCount,
2267
+ turnResearchCount,
2268
+ taskDispatchCount,
2269
+ taskResearchCount,
2270
+ taskReviewRounds,
2271
+ nestedRepositories: nestedRepositoriesInUse(processState),
2272
+ provisionalConfirmations: getCapabilityResolution().provisional
2273
+ .filter(pack => workModePolicy.getCapabilityConfirmation()[pack as ConfirmableCapabilityPack] !== "declined")
2274
+ .map(pack => ({
2275
+ pack,
2276
+ reason: getCapabilityResolution().reasons[pack],
2277
+ question: capabilityConfirmationQuestion(pack as ConfirmableCapabilityPack),
2278
+ })),
2279
+ }),
2280
+ getWorkMode,
2281
+ getActiveTeamName: () => activeTeamName,
2282
+ getUserLanguage: () => userLanguage,
2283
+ getRulesProtocol: buildRulesProtocol,
2284
+ getDocsProtocol: buildDocsProtocol,
2285
+ isAskUserAvailable: () => askUserAvailable,
2286
+ isComsReady: () => comsReady,
2287
+ getIdentity: () => identity,
2288
+ isHerdrFleetReady: () => herdrFleetReady,
2289
+ };
2290
+
2291
+ // This is also called by /af-context before the first turn. Keep prompt assembly
2292
+ // in this one production path so its ledger describes the exact next replacement.
2293
+ function buildHubSystemPrompt(): { systemPrompt: string } {
2294
+ const built = assembleHubPrompt(hubPromptCtx);
2295
+ lastHubLedger = built.ledger;
2296
+ const names = new Set(Array.from(agentStates.values(), s => s.def.name.toLowerCase()));
2297
+ const missingRoles = missingProcessRoleRecoveryHints(processState, names);
2298
+ const additions = activeAdditionRecoveryHints(processState, noProgress.taskId(), taskTriage?.current?.revision);
2299
+ return { systemPrompt: `${built.systemPrompt}\n\nTask-triage (experimental, uncertain): ${JSON.stringify(taskTriage?.status ?? { status: "skipped", detail: "consumer_off" })}. This does not change budget or authorize effects.${processBlock() ? ` BLOCKED: ${processBlock()!.message}` : ""}${missingRoles ? ` ${missingRoles} Never auto-raise tier or substitute an unrelated role.` : ""}${additions ? ` ${additions}` : ""}` };
2300
+ }
2301
+
2302
+ const turnHandlers = createTurnLifecycleHandlers({
2303
+ setTurnState: state => coms.setTurnState(state),
2304
+ finishMonitorTurn: () => { if (monitorBridge && monitorTurnId) { monitorBridge.finishParent(monitorTurnId, "completed"); monitorTurnId = null; } },
2305
+ startMonitorTurn: () => { if (monitorBridge && monitorHubId) { monitorTurnId = `hub-turn-${monitorHubId}-${crypto.randomUUID()}`; monitorBridge.startParent({ id: monitorTurnId, hubInstanceId: monitorHubId, checkoutId: currentCtx?.cwd || process.cwd() }); } },
2306
+ startAskUser: id => executionHistory.startAskUser(id), endAskUser: (id, at) => executionHistory.endAskUser(id, at),
2307
+ acknowledgeExternalBlocker: () => { externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false; },
2308
+ addAskUserWait: waitMs => { if (waitMs > 0) taskClock = addTaskClockWait(taskClock, waitMs); },
2309
+ applyWorkMode: applyWorkModeTools, closeTurnActiveTime, openTaskClock: at => { taskClock = openTaskClock(taskClock, at); }, startHistoryTurn: at => executionHistory.startTurn(at),
2310
+ resetTurnBudgetState: () => {
2311
+ turnDispatchCount = 0; turnResearchCount = 0; turnDispatchFingerprints.clear(); externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false;
2312
+ if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) { lastTurnReport = turnReport; sessionTotals.turns++; }
2313
+ turnReport = freshTurnReport();
2314
+ },
2315
+ updateModeStatus, buildPrompt: buildHubSystemPrompt, endHistoryTurn: at => executionHistory.endTurn(at),
2316
+ unaddressedPeerWarning: () => unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()))?.message ?? null,
2317
+ settlePeerTurn: ctx => coms.settleTurn(ctx, { dispatchQueued: false }),
2318
+ settlePressure: ctx => pressureLifecycle.agentSettled(ctx),
2319
+ dispatchQueuedPeerTurn: () => coms.dispatchQueued(),
2320
+ });
2321
+ pi.on("before_agent_start", async () => {
2322
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2323
+ try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "before_agent_start", consumerPresent: !!taskTriage, consumerStatus: taskTriage?.status.status ?? null, consumerDetail: taskTriage?.status.detail ?? null, calls: taskTriage?.calls ?? null, processPersistenceBlocked, rosterBlocked: false, pendingTaskTransition }) + "\n"); } catch { /* diagnostic only */ }
2324
+ }
2325
+ // Pressure/roster recovery gates run first; assessment runs before this model input.
2326
+ if (taskTriage && !processPersistenceBlocked) {
2327
+ // Persist the first task identity before binding a pre-model assessment:
2328
+ // compaction/resume must not mint a new ID for the same cached input.
2329
+ try { noProgress.persistTaskIdentity(); } catch { processPersistenceBlocked = true; }
2330
+ const assessment = processPersistenceBlocked ? null : await taskTriage.evaluate(noProgress.taskId());
2331
+ // Guarded offline fixture diagnostics: metadata only, never task text or provider payload.
2332
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2333
+ try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "assessment", inputRevision: assessment?.revision ?? null, fingerprint: assessment?.fingerprint ?? null, taskId: assessment?.taskId ?? null, status: assessment?.assessment.status ?? null, calls: taskTriage.calls, pendingTaskTransition, processPersistenceBlocked }) + "\n"); } catch { /* diagnostic only */ }
2334
+ }
2335
+ if (assessment && !pendingTaskTransition && !processPersistenceBlocked) {
2336
+ try {
2337
+ const next = applyTaskTriageAdditions(processState, assessment.assessment, { taskId: assessment.taskId, evaluationId: assessment.evaluationId, inputRevision: assessment.revision });
2338
+ if(JSON.stringify(next)!==JSON.stringify(normalizeProcessState(processState))) {
2339
+ pi.appendEntry("agent-hub-process-state", processAuditRecord(next, evaluateProcessObligations(next, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER })));
2340
+ processState = next;
2341
+ }
2342
+ } catch { processPersistenceBlocked = true; }
2343
+ }
2344
+ }
2345
+ // Assessment can open a plan/review lease after input resolved its original packs.
2346
+ if (taskTriage) workModePolicy.refreshCapabilities();
2347
+ const result = turnHandlers.beforeAgentStart();
2348
+ toolCatalogRuntime.beginTurn();
2349
+ return result;
2350
+ });
2351
+
2352
+ const pressureLifecycle = createContextPressureLifecycle({
2353
+ continuity: { pi, runtimeVersion: currentPiRuntimeVersion(), taskIdentity: (() => { let token: object | undefined, revision=0; return () => { const next=noProgress.taskToken(); if(next!==token){token=next;revision++;} return {task:noProgress.taskId(),revision}; }; })() },
2354
+ getState: () => pressureRootState,
2355
+ setPressure: value => { contextPressureState = value; pressureRootState.pressure = value; },
2356
+ getCurrentContext: () => currentCtx,
2357
+ appendEntry: (type, data) => pi.appendEntry(type, data),
2358
+ sendUserMessage: (content, options) => pi.sendUserMessage(content as any, options),
2359
+ resolveCapabilities: resolveIncomingCapabilities, applyWorkMode: applyWorkModeTools,
2360
+ modelWorkBlocked: () => false,
2361
+ onAcceptedInput: (text, source, replayed) => {
2362
+ if ((source === "extension" && !replayed) || !text.trim()) return;
2363
+ if(hubTaskText && isTaskContinuation(text))return;
2364
+ if (evaluatedTaskTriageInputChanged(taskTriage?.current ?? null, text)) { pendingTaskTransition = true; transitionDiversions = 0; transitionHintDelivered = false; transitionBatchRefused = false; try { pi.appendEntry(TASK_TRANSITION_ENTRY_TYPE, { pending: true }); } catch { processPersistenceBlocked = true; } }
2365
+ hubTaskText = text;
2366
+ executionTrace.input(crypto.randomUUID());
2367
+ try { noProgress.persistTaskIdentity(); acceptDamageGuardInput(pi, text); bindSemanticScope(noProgress.taskId(), createHash("sha256").update(text).digest("hex")); } catch { processPersistenceBlocked = true; }
2368
+ taskTriage?.input(text, "interactive");
2369
+ },
2370
+ });
2371
+ function replayDeferredRecoveryInputs(): void { pressureLifecycle.replayDeferred(); }
2372
+ pi.on("message_end", async (event, ctx) => {
2373
+ const diagnostics = observeUnknownToolCalls({ message: event.message, catalog: toolCatalogRuntime.catalogForMessage(), taskId: unknownToolCounter.snapshot().activeTaskId || noProgress.taskId(), counter: unknownToolCounter, seenCallIds: seenUnknownToolCalls });
2374
+ for (const diagnostic of diagnostics) {
2375
+ latestUnknownToolNotice = unknownToolNotice(diagnostic);
2376
+ try { pi.appendEntry(UNKNOWN_TOOL_COUNTER_ENTRY_TYPE, { snapshot: unknownToolCounter.snapshot(), diagnostic }); } catch {}
2377
+ }
2378
+ pressureLifecycle.messageEnd(event, ctx);
2379
+ });
2380
+ pi.on("turn_start", event => { toolCatalogRuntime.beginModelRequest(); hubCapture.start(event.turnIndex); });
2381
+ pi.on("turn_end", async (event, ctx) => {
2382
+ if (transitionBatchRefused && pendingTaskTransition) transitionHintDelivered = true;
2383
+ transitionBatchRefused = false;
2384
+ await pressureLifecycle.turnEnd(ctx);
2385
+ const text = event.message.role === "assistant" ? event.message.content.filter(c => c.type === "text").map(c => c.text).join("") : "";
2386
+ hubCapture.end(event.turnIndex, text);
2387
+ });
2388
+ // Stable historical views keep the provider prompt cache valid between turns.
2389
+ const historyProjection = createHistoryProjectionMemo();
2390
+ pi.on("context", async (event, ctx) => {
2391
+ const projection=projectCoordinationHistory(event.messages,sessionDir,historyProjection);
2392
+ if(projection.added)try{pi.appendEntry("agent-hub-context-projection",{projected:projection.projected,added:projection.added,savedBytes:projection.savedBytes});}catch{/* diagnostics cannot alter the model view */}
2393
+ pressureLifecycle.context(ctx);
2394
+ const context = hubCapture.hubContext();
2395
+ const text = context && proactiveRuntime?.feedback?.take("hub", "direct", context);
2396
+ if (text) { proactiveHubDeliveries++; return { messages: [...projection.messages, { role: "custom" as const, customType: "agent-fleet.proactive-advisory", content: text, display: false, timestamp: Date.now() }] }; }
2397
+ if(projection.projected)return {messages:projection.messages};
2398
+ });
2399
+ pi.on("session_compact", async (_event, ctx) => {
2400
+ noProgress.compact(ctx.sessionManager.getEntries());
2401
+ if (!processPersistenceBlocked) persistProcessVerdict(processState, evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }));
2402
+ const result = toolCatalogRuntime.compact({
2403
+ mode: getWorkMode(), getEffectiveTools: () => pi.getActiveTools(),
2404
+ persist: (type, data) => pi.appendEntry(type, data), counterSnapshot: () => unknownToolCounter.snapshot(),
2405
+ retainCounter: () => unknownToolCounter.noteCompaction(),
2406
+ establishToolStateChange: (previous, next, evidenceRef) => noProgress.establishToolStateChange(previous, next, evidenceRef),
2407
+ settle: restored => pressureLifecycle.sessionCompact(restored),
2408
+ onError: error => { try { pi.appendEntry("agent-hub-tool-catalog-error", { reason: "compaction_restore", error: error instanceof Error ? error.message : String(error) }); } catch {} },
2409
+ });
2410
+ if (result) latestToolCatalogDelta = result.delta;
2411
+ });
2412
+ pi.on("input", async (event, ctx) => {
2413
+ const outcome = pressureLifecycle.input(event, ctx);
2414
+ return { action: outcome.action };
2415
+ });
2416
+
2417
+ // ── Session Start ────────────────────────────
2418
+
2419
+ let sessionOverrides: ReturnType<typeof parseAgentTeamOverrides> | undefined;
2420
+ let sessionSoloMode = false;
2421
+ const monitorSession = createMonitorSession({
2422
+ pi,
2423
+ getBridge: () => monitorBridge, setBridge: value => { monitorBridge = value; },
2424
+ getLifecycle: () => monitorLifecycle, setLifecycle: value => { monitorLifecycle = value; },
2425
+ setHubId: value => { monitorHubId = value; },
2426
+ getOwnerId: () => monitorOwnerId, setOwnerId: value => { monitorOwnerId = value; },
2427
+ queueDepth: () => inboundQueue.size,
2428
+ });
2429
+ registerSessionOrchestration(pi, {
2430
+ resetSession: async (_ctx) => { await resetDamageGuardHub(pi); resetHubSession(_ctx, {
2431
+ registerVersion: registerVersionStatus, resetPressure: pressureLifecycle.reset,
2432
+ captureBaselineTools: () => { baselineTools = pi.getActiveTools(); },
2433
+ resetAccessApproval: () => {codexControls.resetSession();accessApprovalRouter.reset();permissionRelay.reset();accessEpochs.clear();},
2434
+ terminateResearch: () => { for (const st of researchStates.values()) if (st.proc && st.status === "running") { st.killedByOperator = true; st.proc.kill("SIGTERM"); } },
2435
+ resetResearch: researchRuntime.reset, resetHistory: executionHistory.reset,
2436
+ resetBudgets: () => { hubCapture.reset(); hubTaskText = undefined; proactiveRuntime = null; proactiveConfig = null; system1Snapshot = normalizeSystem1Config(null);
2437
+ resetAgenticHub(pi); resetDiscoveryHub(pi); proactiveHubDeliveries = 0; taskClock = createTaskClock(); noProgress.prepareSessionRestore(); resetUnknownToolCounterForCurrentTask(); toolCatalogRuntime.restore(catalogSnapshot(getWorkMode(), [])); latestToolCatalogDelta = null; },
2438
+ clearWidgets: _ctx => { fleetUiGeneration++; fleetActions?.reset(); gridUI.dispose(); },
2439
+ closeDelegationWatchers: () => { for (const st of agentStates.values()) { st.delegationsWatcher?.close(); st.delegationsWatcher = undefined; } },
2440
+ resetSessionState: ctx => { delegatedTokens = 0; hubSpawnedPeers.clear(); widgetCtx = ctx; contextWindow = ctx.model?.contextWindow || 0; gridUI.reset(); },
2441
+ resolveSafety: cwd => Boolean(safetyHarnessPath = resolveSafetyHarness(cwd)), resolveDelegate: cwd => { delegateExtPath = resolveDelegateExtension(cwd); },
2442
+ }); },
2443
+ restartMonitor: _ctx => monitorSession.restart(_ctx),
2444
+ initializeComs: async (_ctx) => {
2445
+ // ── Embedded coms init ──
2446
+ // Always refresh the ctx the coms handlers use. Bind the endpoint + register
2447
+ // in the pool exactly once per process (guard on comsReady), so a /new session
2448
+ // keeps the same peer identity rather than leaking a second socket. On any
2449
+ // failure we degrade: comsReady stays false and the coms_* tools are withheld.
2450
+ hubStateCtx.setCurrentContext(_ctx);
2451
+ sessionSoloMode = pi.getFlag("solo") === true;
2452
+ if (!comsReady && !sessionSoloMode) {
2453
+ try {
2454
+ identity = await coms.connect({ ctx: _ctx, defaultNamePrefix: "hub", defaultPurpose: "agent-hub dispatcher" });
2455
+ comsReady = true;
2456
+ try {
2457
+ _ctx.ui.setStatus("coms", `📡 ${identity.name}@${identity.project}`);
2458
+ } catch { /* hasUI may be false — non-fatal */ }
2459
+ } catch (err) {
2460
+ comsReady = false;
2461
+ try { _ctx.ui?.notify?.(`📡 coms: init failed — ${err instanceof Error ? err.message : String(err)} (coms tools disabled)`, "error"); } catch { /* ignore */ }
2462
+ }
2463
+ }
2464
+ },
2465
+ initializeExemptions: (_ctx) => {
2466
+ try {
2467
+ system1Snapshot = loadSystem1Snapshot(_ctx.cwd || process.cwd());
2468
+ const config = loadProactiveConfig(_ctx.cwd || process.cwd(), system1Snapshot);
2469
+ if (isCaptureEnabled(config)) proactiveConfig = config;
2470
+ } catch { /* invalid config fails closed */ }
2471
+ // ── Damage-control shared exemptions file ──
2472
+ // One per hub session (solo mode included). Exporting the path on our own
2473
+ // process.env lets the co-loaded damage-control-continue mirror /af-allow
2474
+ // session grants into the same file the spawned children read.
2475
+ if (!exemptionsFile) {
2476
+ hubStateCtx.setExemptionsFile(exemptionsFilePath(identity?.session_id ?? `hub-solo-${process.pid}`));
2477
+ process.env[EXEMPTIONS_FILE_ENV] = exemptionsFile!;
2478
+ }
2479
+ },
2480
+ loadAgents: (_ctx) => {
2481
+ // Allocate a fresh namespace; shared legacy files belong to prior/live sessions.
2482
+ sessionOverrides = parseAgentTeamOverrides(_ctx.cwd);
2483
+ fleetConfigUi.recordBaseline(_ctx.cwd);
2484
+ try {
2485
+ const config = loadProactiveConfig(_ctx.cwd,system1Snapshot,sessionOverrides.policyRoots);
2486
+ proactiveConfig = isCaptureEnabled(config) ? config : null;
2487
+ } catch { proactiveConfig = null; /* invalid consent fails closed */ }
2488
+ runHistoryKeep = sessionOverrides.runHistoryKeep;
2489
+
2490
+ loadAgents(_ctx.cwd);
2491
+ // Composition follows applyOverrides: approved roots and the shared service do not exist yet.
2492
+
2493
+ // Surface non-fatal persona frontmatter warnings (skipped subagents roles,
2494
+ // bad delegate_depth) once per session.
2495
+ const fmWarnings = allAgentDefs.flatMap(d => (d.warnings || []).map(w => `${d.name}: ${w}`));
2496
+ if (fmWarnings.length > 0) {
2497
+ _ctx.ui.notify(`Persona frontmatter warnings:\n${fmWarnings.join("\n")}`, "warning");
2498
+ }
2499
+ if (!delegateExtPath && allAgentDefs.some(d => d.subagents)) {
2500
+ _ctx.ui.notify(
2501
+ "delegate.ts not found next to agent-hub — `subagents:` declarations are inert (specialists dispatch without a delegate tool).",
2502
+ "warning",
2503
+ );
2504
+ }
2505
+ },
2506
+ applyOverrides: (_ctx) => {
2507
+ if (!sessionOverrides) throw new Error("session_start applyOverrides ran before loadAgents");
2508
+ watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
2509
+ communicationStore.dispose();
2510
+ triageRuntime?.dispose(); triageRuntime = null;
2511
+ taskTriage?.dispose(); taskTriage = null;
2512
+ taskTriageActivity?.dispose(); taskTriageActivity = null;
2513
+ try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block the session */ }
2514
+ // Stable for a real session across snapshot replacement; G2 must not split one session into artificial samples.
2515
+ watchdogActivity = sessionDir ? createWatchdogActivity({ directory: `${sessionDir}/artifacts/watchdog`, sessionId: path.basename(sessionDir) }) : null;
2516
+ const taskTriageTestTransport = resolveTaskTriageTestTransport();
2517
+ taskTriageTestTransportActive = !!taskTriageTestTransport;
2518
+ watchdogSystem1 = createWatchdogSystem1Session({ ...readWatchdogSystem1Snapshot({
2519
+ cwd: _ctx.cwd,
2520
+ snapshot: system1Snapshot,
2521
+ configuredMode: sessionOverrides.watchdogSystem1Mode,
2522
+ watchdogSetting: sessionOverrides.watchdogSetting,
2523
+ env: process.env,
2524
+ transport: taskTriageTestTransport,
2525
+ warnings: sessionOverrides.warnings,
2526
+ }), wrapService: service => communicationStore.wrap(service, { provider: "typesafe", model: "jev-1.13.0" }) });
2527
+ const triageConfig = (system1Snapshot?.consumers.dispatchTriage.config ?? null) as TriageConfig | null;
2528
+ const taskTriageConfig = loadTaskTriageConfig(_ctx.cwd || process.cwd(), system1Snapshot);
2529
+ const sharedService = watchdogSystem1?.sharedService;
2530
+ configureAgenticHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
2531
+ configureDiscoveryHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
2532
+ const serviceUnavailableReason = watchdogSystem1?.readiness.status === "ready" ? "unavailable" : watchdogSystem1?.readiness.reason ?? "unavailable";
2533
+ taskTriageConfigured = taskTriageConfig.status !== "missing";
2534
+ taskTriageConfigStatus = taskTriageConfig.status === "active" ? "active" : taskTriageConfig.status === "invalid" ? "invalid" : "off";
2535
+ taskTriageActivity = taskTriageConfig.status === "active" ? createTaskTriageActivity({ directory: sessionDir ? path.join(sessionDir, "artifacts/task-triage-activity") : undefined }) : null;
2536
+ taskTriage = taskTriageConfig.status === "active" ? createTaskTriageRuntime({ root: _ctx.cwd || process.cwd(), service: worktreeConsumerService(sharedService,system1Snapshot.document,'taskTriage'), serviceUnavailableReason, persist: state => pi.appendEntry(TASK_TRIAGE_RUNTIME_ENTRY, state), observer: taskTriageActivity! }) : null;
2537
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2538
+ try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "service_init", configStatus: taskTriageConfig.status, consumerPresent: !!taskTriage, fakeTransportActive: taskTriageTestTransportActive, sharedServiceReady: !!sharedService, serviceUnavailableReason }) + "\n"); } catch { /* diagnostic only */ }
2539
+ }
2540
+ if (taskTriage && !sharedService) {
2541
+ try { _ctx.ui.notify(`Task triage is enabled but unavailable (${serviceUnavailableReason}); no inference or new requirements will be added. Existing process obligations remain enforced.`, "warning"); }
2542
+ catch { /* Optional UI must not change process enforcement. The prompt retains the status. */ }
2543
+ }
2544
+ triageRuntime = createTriageRuntime({ config: triageConfig, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'dispatchTriage'),
2545
+ current: input => triageInput(input.task,input.scope,input.language,input.domain),
2546
+ trace: event => pi.appendEntry("agent-hub-triage", event),
2547
+ });
2548
+ applySessionOverrides(_ctx, sessionOverrides, {
2549
+ setLanguage: value => { userLanguage = value; },
2550
+ setReconTimeout: value => { reconSearchTimeoutMs = value; }, setBudgetOverrides: value => { budgetOverrides = value; },
2551
+ setWatchdog: (setting, judge) => { watchdogSetting = setting; watchdogJudgeModel = judge; },
2552
+ resetTurnCounts: () => { turnDispatchCount = 0; turnResearchCount = 0; },
2553
+ // Session setup clears in-memory budgets before restore, not the saved task.
2554
+ // A persisted reset here would append a new task event after the old one.
2555
+ resetTaskWindow: () => resetTaskWindow(null, Date.now(), false), updateModeStatus,
2556
+ setProjectRules: value => { projectRulesDirs = value; }, setProjectDocs: value => { projectDocsPaths = value; },
2557
+ resetModelPolicy: () => {modelPolicy.reset();profileActivation.reset();applyWorkModeTools();}, getModelProfileErrors: () => modelProfileErrors, getAgentDefs: () => allAgentDefs, getModelProfiles: () => modelProfiles,
2558
+ deleteModelProfile: name => { delete modelProfiles[name]; }, allowedModels,
2559
+ getDispatchPolicyWarnings: () => dispatchPolicyWarnings, setResearchPersonas: value => { researchPersonas = value; },
2560
+ });
2561
+ if (proactiveConfig && sessionDir) {
2562
+ try { proactiveRuntime = composeHubProactive({ config: proactiveConfig, root: _ctx.cwd, sessionDir,
2563
+ rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'proactiveReview'), capture: hubCapture, onChange: updateWidget }); }
2564
+ catch { proactiveRuntime = null; proactiveConfig = null; } // unavailable composition never reports reviewed
2565
+ }
2566
+ },
2567
+ restoreRoster: async (_ctx) => {
2568
+ // Explicit CLI selection wins; otherwise restore only the canonical team name
2569
+ // and re-resolve it against current teams.yaml/persona files. An explicit
2570
+ // Operator work mode suppresses an ambient persisted roster unless --agent-team
2571
+ // was also supplied.
2572
+ agentStates.clear();
2573
+ activeTeamName = "";
2574
+ comsMissNotified.clear();
2575
+ recomputeGrid();
2576
+ const sessionEntries = _ctx.sessionManager.getEntries();
2577
+ // Resume restores the persisted fence. A missing entry is the legacy clear state.
2578
+ pendingTaskTransition = latestPendingTaskTransition(sessionEntries);
2579
+ transitionDiversions = 0;
2580
+ transitionHintDelivered = false;
2581
+ transitionBatchRefused = false;
2582
+ try { processState = latestProcessState(sessionEntries); processPersistenceBlocked = false; }
2583
+ catch { processState = createProcessState(); processPersistenceBlocked = true; }
2584
+ taskTriage?.restore(sessionEntries);
2585
+ const savedTaskIds = new Set(processState.additions?.map(addition => addition.taskId));
2586
+ noProgress.restore(sessionEntries, savedTaskIds.size === 1 ? [...savedTaskIds][0] : undefined);
2587
+ if (processTaskIdentityConflicts(processState, noProgress.taskId())) processPersistenceBlocked = true;
2588
+ await configureDamageGuardHub(pi, { snapshot: system1Snapshot, service: watchdogSystem1?.sharedService, ctx: _ctx, taskId: () => noProgress.taskId(), childAuthority: { taskToken: () => noProgress.taskToken(), admit: () => !processBlock() } });
2589
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2590
+ try { fs.appendFileSync(process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD, JSON.stringify({ pid: process.pid, phase: "restore", processPersistenceBlocked, savedTaskIdCount: savedTaskIds.size, taskIdMatchesAddition: savedTaskIds.size === 1 && savedTaskIds.has(noProgress.taskId()), consumerPresent: !!taskTriage, calls: taskTriage?.calls ?? null, consumerStatus: taskTriage?.status.status ?? null }) + "\n"); } catch { /* diagnostic only */ }
2591
+ }
2592
+ const persistedCatalog = latestPersistedToolCatalog(sessionEntries);
2593
+ if (persistedCatalog) toolCatalogRuntime.restore(persistedCatalog);
2594
+ const persistedUnknownTools = latestPersistedUnknownToolCounter(sessionEntries);
2595
+ if (persistedUnknownTools) unknownToolCounter = restoreUnknownToolCounter(persistedUnknownTools, { limit: 3 });
2596
+ const legacyWorkModeFlag = pi.getFlag("work-mode");
2597
+ const explicitRoster = pi.getFlag("agent-team");
2598
+ const startupRoster = resolveSessionRoster({
2599
+ teams,
2600
+ entries: sessionEntries,
2601
+ explicitRoster,
2602
+ availablePersonas: allAgentDefs.map(def => def.name),
2603
+ });
2604
+ if (startupRoster.roster) {
2605
+ activateTeam(startupRoster.roster.name);
2606
+ persistActiveRoster();
2607
+ }
2608
+ if (startupRoster.diagnostic) _ctx.ui.notify(`${startupRoster.diagnostic} Continuing without that roster.`, "warning");
2609
+ // The orchestrator mode was removed (2026-11-11). Tell the human once, then
2610
+ // record the operator so a resumed session does not repeat the notice.
2611
+ const legacyFlag = typeof legacyWorkModeFlag === "string" ? legacyWorkModeFlag.trim() : "";
2612
+ if (legacyFlag || sessionSavedInRetiredWorkMode(sessionEntries)) {
2613
+ _ctx.ui.notify(legacyFlag ? `--work-mode ${legacyFlag} is ignored. ${RETIRED_WORK_MODE_NOTICE}` : RETIRED_WORK_MODE_NOTICE, "warning");
2614
+ if (sessionSavedInRetiredWorkMode(sessionEntries)) { try { pi.appendEntry(WORK_MODE_ENTRY_TYPE, { workMode: "operator" }); } catch { /* the notice repeats next resume */ } }
2615
+ }
2616
+ },
2617
+ resolveCapabilities: async (_ctx) => {
2618
+ // Probe for `ask_user` (registered by the `pi-ask-user` companion package
2619
+ // when installed). Action methods like getAllTools are runtime-only, so
2620
+ // this MUST happen at session_start, not at extension load.
2621
+ askUserAvailable = pi.getAllTools().some(t => t.name === "ask_user");
2622
+
2623
+ // Fleet tools are available only inside a herdr pane with a live server.
2624
+ // The work mode policy adds gated groups without activating unavailable tools.
2625
+ herdrFleetReady = herdrPaneId() !== null && (await herdrAvailable()) !== null;
2626
+ const persistedCapabilities = latestPersistedCapabilityState(_ctx.sessionManager.getEntries());
2627
+ workModePolicy.restoreCapabilities({ taskPacks: persistedCapabilities?.taskPacks ?? [], provisional: persistedCapabilities?.provisional ?? [], confirmation: persistedCapabilities?.confirmation ?? {} });
2628
+ resolveIncomingCapabilities("");
2629
+ applyWorkModeTools();
2630
+ if (pressureLifecycle.observe(_ctx, "session_start") === "compact-now") {
2631
+ setTimeout(() => pressureLifecycle.runCompaction(_ctx, "session_start"), 0);
2632
+ }
2633
+ workModePolicy.updateStatus(_ctx);
2634
+ },
2635
+ notifyStartup: (_ctx) => {
2636
+ _ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"} (${agentStates.size})`);
2637
+ const members = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
2638
+ const askUserLabel = askUserAvailable
2639
+ ? "available (via pi-ask-user)"
2640
+ : "NOT AVAILABLE — run `pi install npm:pi-ask-user`";
2641
+ const comsLabel = comsReady && identity
2642
+ ? `📡 ${identity.name}@${identity.project} — peers via coms_list; /af-handoff <peer> to delegate`
2643
+ : sessionSoloMode
2644
+ ? "off (--solo: fixed specialists + research only)"
2645
+ : "off (endpoint bind failed — coms tools disabled)";
2646
+ const fleetLabel = herdrFleetReady
2647
+ ? "herdr — spawn/read/close panes + notify (herdr_* tools active)"
2648
+ : "off (not inside a herdr pane, or no herdr server)";
2649
+ const comsPreferred = Object.entries(dispatchPolicy.substitutions)
2650
+ .filter(([, s]) => s.prefer === "coms")
2651
+ .map(([n]) => n);
2652
+ const dispatchLabel = dispatchPolicy.default === "coms"
2653
+ ? "coms default — any member with a live same-name pool peer is served by it (/af-dispatch-policy)"
2654
+ : comsPreferred.length > 0
2655
+ ? `coms-preferred: ${comsPreferred.join(", ")} (live peer wins, /af-dispatch-policy for status)`
2656
+ : "all native (no substitutions in .pi/agents/dispatch-policy.yaml)";
2657
+ _ctx.ui.notify(buildSessionStartNotice({
2658
+ workMode: getWorkMode(),
2659
+ activeTeamName,
2660
+ agentCount: agentStates.size,
2661
+ members,
2662
+ dispatchLabel,
2663
+ userLanguage,
2664
+ askUserLabel,
2665
+ comsLabel,
2666
+ fleetLabel,
2667
+ }), "info");
2668
+ },
2669
+ updateWidget: (_ctx) => {
2670
+ updateWidget();
2671
+ },
2672
+ installFooter: (_ctx) => {
2673
+ _ctx.ui.setFooter(createSessionFooter({
2674
+ ctx: _ctx,
2675
+ version: HARNESS_VERSION ?? "unknown",
2676
+ getModel: () => _ctx.model ? `${_ctx.model.provider}/${_ctx.model.id}` : "no-model",
2677
+ getThinkingLevel: () => pi.getThinkingLevel?.() ?? undefined,
2678
+ thinkingSuffix,
2679
+ getHint: () => composeFleetFooterHint(),
2680
+ renderLeft: renderHubFooterLeft,
2681
+ truncateToWidth,
2682
+ visibleWidth,
2683
+ }));
2684
+ },
2685
+ }, {
2686
+ finishEvidence: () => { if (sessionDir) closeEvidenceSession(sessionDir); },
2687
+ shutdownComs: async () => { await resetDamageGuardHub(pi); unregisterQuestions(); await coms.shutdown(); }, shutdownMonitor: () => monitorSession.shutdown(),
2688
+ removeExemptions: () => {
2689
+ if (!exemptionsFile) return;
2690
+ try { fs.unlinkSync(exemptionsFile); } catch {}
2691
+ hubStateCtx.setExemptionsFile(null);
2692
+ },
2693
+ terminateChildren: () => {
2694
+ hubCapture.reset(); proactiveRuntime = null;
2695
+ watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
2696
+ communicationStore.dispose();
2697
+ triageRuntime?.dispose(); triageRuntime = null;
2698
+ taskTriage?.dispose(); taskTriage = null;
2699
+ taskTriageActivity?.dispose(); taskTriageActivity = null;
2700
+ taskTriageConfigStatus = "off"; taskTriageConfigured = false;
2701
+ try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block shutdown */ }
2702
+ watchdogActivity = null;
2703
+ for (const st of [...agentStates.values(), ...researchStates.values()]) {
2704
+ fenceOperatorCancel(st);
2705
+ if (st.proc && st.status === "running") try { st.killedByOperator = true; st.proc.kill("SIGTERM"); } catch {}
2706
+ }
2707
+ },
2708
+ clearPoolWidget: () => {
2709
+ gridUI.dispose();
2710
+ if (currentCtx?.hasUI) try { currentCtx.ui.setWidget("coms-pool", undefined); } catch {}
2711
+ },
2712
+ });
2713
+
2714
+ pi.on("agent_end", async (_event, ctx) => {
2715
+ toolCatalogRuntime.endTurn();
2716
+ await turnHandlers.agentEnd(ctx);
2717
+ });
2718
+ registerTurnSettlement(pi, {
2719
+ agentSettled: ctx => turnHandlers.agentSettled(ctx),
2720
+ });
2721
+
2722
+ }