@chankov/agent-fleet 2.2.0 → 2.2.3

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 (2243) hide show
  1. package/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +11 -3
  2. package/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  3. package/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +2 -2
  4. package/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +10 -7
  5. package/.pi/harnesses/agent-hub/README.md +26 -2
  6. package/.pi/harnesses/agent-hub/budget-recovery.ts +28 -0
  7. package/.pi/harnesses/agent-hub/codex-bootstrap.ts +31 -31
  8. package/.pi/harnesses/agent-hub/commands/recover.ts +28 -9
  9. package/.pi/harnesses/agent-hub/context/assertion-journal.ts +133 -0
  10. package/.pi/harnesses/agent-hub/index.ts +100 -17
  11. package/.pi/harnesses/agent-hub/no-progress.ts +133 -19
  12. package/.pi/harnesses/agent-hub/operator-current-state.ts +51 -6
  13. package/.pi/harnesses/agent-hub/package.json +1 -1
  14. package/.pi/harnesses/agent-hub/policy/work-mode.ts +2 -1
  15. package/.pi/harnesses/agent-hub/process-obligations.ts +1 -1
  16. package/.pi/harnesses/agent-hub/recover-policy.ts +1 -1
  17. package/.pi/harnesses/agent-hub/recover-state.ts +46 -6
  18. package/.pi/harnesses/agent-hub/recovery-continuation.ts +134 -0
  19. package/.pi/harnesses/agent-hub/task-triage-runtime.ts +3 -1
  20. package/.pi/harnesses/agent-hub/tools/action-executors.ts +26 -3
  21. package/.pi/harnesses/agent-hub/tools/context.ts +2 -0
  22. package/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +60 -17
  23. package/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +2 -1
  24. package/.pi/harnesses/agent-hub/tools/recover-task.ts +16 -0
  25. package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +2 -2
  26. package/.pi/harnesses/agent-hub/verification-diagnostics.ts +23 -0
  27. package/.pi/harnesses/agent-hub/work-mode.ts +4 -2
  28. package/.pi/harnesses/coms/package.json +1 -1
  29. package/.pi/harnesses/damage-control-continue/index.ts +7 -5
  30. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  31. package/.pi/harnesses/lib/bash-policy-analysis.ts +9 -1
  32. package/.pi/harnesses/lib/exact-permission-port.ts +6 -4
  33. package/.pi/harnesses/lib/fleet-codex-chat-view.ts +28 -16
  34. package/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  35. package/.pi/harnesses/lib/fleet-notification-bootstrap.ts +35 -15
  36. package/.versions/2.2.1/.pi/agent-fleet/hermes/README.md +347 -0
  37. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  38. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  39. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  40. package/.versions/2.2.1/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  41. package/.versions/2.2.1/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  42. package/.versions/2.2.1/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  43. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  44. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  45. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  46. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  47. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  48. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  49. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  50. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  51. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  52. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  53. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  54. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  55. package/.versions/2.2.1/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  56. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  57. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  58. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  59. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  60. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  61. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  62. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  63. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  64. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  65. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  66. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  67. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  68. package/.versions/2.2.1/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  69. package/.versions/2.2.1/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  70. package/.versions/2.2.1/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  71. package/.versions/2.2.1/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  72. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  73. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  74. package/.versions/2.2.1/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  75. package/.versions/2.2.1/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  76. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  77. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  78. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  79. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  80. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  81. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  82. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  83. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  84. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  85. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  86. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  87. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  88. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  89. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  90. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  91. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  92. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  93. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  94. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  95. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  96. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  97. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  98. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  99. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  100. package/.versions/2.2.1/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  101. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  102. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  103. package/.versions/2.2.1/.pi/agent-fleet/scripts/fleet.ts +244 -0
  104. package/.versions/2.2.1/.pi/agent-fleet/scripts/flow.ts +166 -0
  105. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  106. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  107. package/.versions/2.2.1/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  108. package/.versions/2.2.1/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  109. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  110. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  111. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  112. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  113. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  114. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  115. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  116. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  117. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  118. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  119. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  120. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  121. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  122. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  123. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  124. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  125. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  126. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  127. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  128. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  129. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  130. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  131. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  132. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  133. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  134. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  135. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  136. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  137. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  138. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  139. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  140. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  141. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  142. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  143. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  144. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  145. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  146. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  147. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  148. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  149. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  150. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  151. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  152. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  153. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  154. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  155. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  156. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  157. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  158. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  159. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  160. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  161. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  162. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  163. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  164. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  165. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  166. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  167. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  168. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  169. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  170. package/.versions/2.2.1/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  171. package/.versions/2.2.1/.pi/agent-fleet/scripts/package-lock.json +57 -0
  172. package/.versions/2.2.1/.pi/agent-fleet/scripts/package.json +10 -0
  173. package/.versions/2.2.1/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  174. package/.versions/2.2.1/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  175. package/.versions/2.2.1/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  176. package/.versions/2.2.1/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  177. package/.versions/2.2.1/.pi/agent-fleet/scripts/team-up.ts +378 -0
  178. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  179. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  180. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  181. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  182. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  183. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  184. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  185. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  186. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  187. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  188. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  189. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  190. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  191. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  192. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  193. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  194. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  195. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  196. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  197. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  198. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  199. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  200. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  201. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  202. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  203. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  204. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  205. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  206. package/.versions/2.2.1/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  207. package/.versions/2.2.1/.pi/agents/dispatch-policy.yaml +32 -0
  208. package/.versions/2.2.1/.pi/agents/model-profiles.yaml +132 -0
  209. package/.versions/2.2.1/.pi/agents/peers.yaml +147 -0
  210. package/.versions/2.2.1/.pi/agents/teams.yaml +41 -0
  211. package/.versions/2.2.1/.pi/agents/voices.yaml +13 -0
  212. package/.versions/2.2.1/.pi/damage-control-rules.yaml +297 -0
  213. package/.versions/2.2.1/.pi/extensions/btw/README.md +120 -0
  214. package/.versions/2.2.1/.pi/extensions/btw/index.ts +916 -0
  215. package/.versions/2.2.1/.pi/extensions/btw/package.json +6 -0
  216. package/.versions/2.2.1/.pi/extensions/btw/state.js +179 -0
  217. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  218. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  219. package/.versions/2.2.1/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  220. package/.versions/2.2.1/.pi/extensions/compact-and-continue/README.md +42 -0
  221. package/.versions/2.2.1/.pi/extensions/compact-and-continue/index.ts +136 -0
  222. package/.versions/2.2.1/.pi/extensions/compact-and-continue/package.json +6 -0
  223. package/.versions/2.2.1/.pi/extensions/mcp-bridge/README.md +46 -0
  224. package/.versions/2.2.1/.pi/extensions/mcp-bridge/index.ts +206 -0
  225. package/.versions/2.2.1/.pi/extensions/mcp-bridge/package.json +6 -0
  226. package/.versions/2.2.1/.pi/extensions/package-lock.json +1175 -0
  227. package/.versions/2.2.1/.pi/extensions/package.json +9 -0
  228. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/README.md +224 -0
  229. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/config.ts +199 -0
  230. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  231. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/index.ts +248 -0
  232. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/package.json +6 -0
  233. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  234. package/.versions/2.2.1/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  235. package/.versions/2.2.1/.pi/harnesses/agent-hub/README.md +1641 -0
  236. package/.versions/2.2.1/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  237. package/.versions/2.2.1/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  238. package/.versions/2.2.1/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  239. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  240. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  241. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  242. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  243. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  244. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  245. package/.versions/2.2.1/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  246. package/.versions/2.2.1/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  247. package/.versions/2.2.1/.pi/harnesses/agent-hub/artifacts.js +146 -0
  248. package/.versions/2.2.1/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  249. package/.versions/2.2.1/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  250. package/.versions/2.2.1/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  251. package/.versions/2.2.1/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  252. package/.versions/2.2.1/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  253. package/.versions/2.2.1/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  254. package/.versions/2.2.1/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  255. package/.versions/2.2.1/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  256. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  257. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  258. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  259. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  260. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  261. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  262. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  263. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  264. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  265. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  266. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  267. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  268. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  269. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  270. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  271. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  272. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  273. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  274. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  275. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  276. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  277. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  278. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  279. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
  280. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  281. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  282. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  283. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  284. package/.versions/2.2.1/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  285. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  286. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  287. package/.versions/2.2.1/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  288. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  289. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  290. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  291. package/.versions/2.2.1/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  292. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  293. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  294. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  295. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  296. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  297. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  298. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  299. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  300. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  301. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  302. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  303. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  304. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  305. package/.versions/2.2.1/.pi/harnesses/agent-hub/context-window.js +108 -0
  306. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  307. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  308. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  309. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  310. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  311. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  312. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  313. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  314. package/.versions/2.2.1/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  315. package/.versions/2.2.1/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  316. package/.versions/2.2.1/.pi/harnesses/agent-hub/delegate.ts +478 -0
  317. package/.versions/2.2.1/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  318. package/.versions/2.2.1/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  319. package/.versions/2.2.1/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  320. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  321. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  322. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  323. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  324. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  325. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  326. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  327. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  328. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  329. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  330. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  331. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  332. package/.versions/2.2.1/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  333. package/.versions/2.2.1/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  334. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  335. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  336. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  337. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  338. package/.versions/2.2.1/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  339. package/.versions/2.2.1/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  340. package/.versions/2.2.1/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  341. package/.versions/2.2.1/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  342. package/.versions/2.2.1/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  343. package/.versions/2.2.1/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  344. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  345. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  346. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  347. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  348. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  349. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  350. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  351. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  352. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  353. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  354. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  355. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  356. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  357. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  358. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  359. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  360. package/.versions/2.2.1/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  361. package/.versions/2.2.1/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  362. package/.versions/2.2.1/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
  363. package/.versions/2.2.1/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  364. package/.versions/2.2.1/.pi/harnesses/agent-hub/footer.ts +29 -0
  365. package/.versions/2.2.1/.pi/harnesses/agent-hub/helpers.ts +269 -0
  366. package/.versions/2.2.1/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  367. package/.versions/2.2.1/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  368. package/.versions/2.2.1/.pi/harnesses/agent-hub/index.ts +2722 -0
  369. package/.versions/2.2.1/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  370. package/.versions/2.2.1/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  371. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  372. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  373. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  374. package/.versions/2.2.1/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  375. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  376. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  377. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  378. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  379. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  380. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  381. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  382. package/.versions/2.2.1/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  383. package/.versions/2.2.1/.pi/harnesses/agent-hub/no-progress.ts +627 -0
  384. package/.versions/2.2.1/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
  385. package/.versions/2.2.1/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  386. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  387. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  388. package/.versions/2.2.1/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  389. package/.versions/2.2.1/.pi/harnesses/agent-hub/package.json +7 -0
  390. package/.versions/2.2.1/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  391. package/.versions/2.2.1/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  392. package/.versions/2.2.1/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  393. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  394. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  395. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  396. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  397. package/.versions/2.2.1/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
  398. package/.versions/2.2.1/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  399. package/.versions/2.2.1/.pi/harnesses/agent-hub/presentation.ts +54 -0
  400. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  401. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  402. package/.versions/2.2.1/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  403. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  404. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  405. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  406. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  407. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  408. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  409. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  410. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  411. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  412. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  413. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  414. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  415. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  416. package/.versions/2.2.1/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  417. package/.versions/2.2.1/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  418. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  419. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  420. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  421. package/.versions/2.2.1/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  422. package/.versions/2.2.1/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  423. package/.versions/2.2.1/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  424. package/.versions/2.2.1/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  425. package/.versions/2.2.1/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  426. package/.versions/2.2.1/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  427. package/.versions/2.2.1/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  428. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  429. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  430. package/.versions/2.2.1/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  431. package/.versions/2.2.1/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  432. package/.versions/2.2.1/.pi/harnesses/agent-hub/return-contract.js +371 -0
  433. package/.versions/2.2.1/.pi/harnesses/agent-hub/return-extract.js +77 -0
  434. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  435. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  436. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-findings.js +96 -0
  437. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  438. package/.versions/2.2.1/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  439. package/.versions/2.2.1/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  440. package/.versions/2.2.1/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  441. package/.versions/2.2.1/.pi/harnesses/agent-hub/run-budget.js +362 -0
  442. package/.versions/2.2.1/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  443. package/.versions/2.2.1/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  444. package/.versions/2.2.1/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  445. package/.versions/2.2.1/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  446. package/.versions/2.2.1/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  447. package/.versions/2.2.1/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  448. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  449. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-health.js +110 -0
  450. package/.versions/2.2.1/.pi/harnesses/agent-hub/session-start.ts +42 -0
  451. package/.versions/2.2.1/.pi/harnesses/agent-hub/spawn.ts +702 -0
  452. package/.versions/2.2.1/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  453. package/.versions/2.2.1/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  454. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  455. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  456. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  457. package/.versions/2.2.1/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  458. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  459. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  460. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  461. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  462. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  463. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  464. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  465. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  466. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  467. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  468. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  469. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  470. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-runtime.ts +132 -0
  471. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  472. package/.versions/2.2.1/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  473. package/.versions/2.2.1/.pi/harnesses/agent-hub/timeline.ts +72 -0
  474. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  475. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  476. package/.versions/2.2.1/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  477. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/action-executors.ts +216 -0
  478. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  479. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  480. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  481. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/context.ts +149 -0
  482. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  483. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
  484. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  485. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  486. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  487. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  488. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  489. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  490. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  491. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  492. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  493. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  494. package/.versions/2.2.1/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  495. package/.versions/2.2.1/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  496. package/.versions/2.2.1/.pi/harnesses/agent-hub/types.ts +66 -0
  497. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  498. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  499. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  500. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  501. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  502. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  503. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  504. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  505. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  506. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  507. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  508. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  509. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  510. package/.versions/2.2.1/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  511. package/.versions/2.2.1/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  512. package/.versions/2.2.1/.pi/harnesses/agent-hub/version.ts +42 -0
  513. package/.versions/2.2.1/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  514. package/.versions/2.2.1/.pi/harnesses/agent-hub/work-mode.ts +183 -0
  515. package/.versions/2.2.1/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  516. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/README.md +59 -0
  517. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/index.ts +571 -0
  518. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  519. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  520. package/.versions/2.2.1/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  521. package/.versions/2.2.1/.pi/harnesses/coms/README.md +105 -0
  522. package/.versions/2.2.1/.pi/harnesses/coms/index.ts +308 -0
  523. package/.versions/2.2.1/.pi/harnesses/coms/package.json +7 -0
  524. package/.versions/2.2.1/.pi/harnesses/coms/version.ts +42 -0
  525. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/README.md +161 -0
  526. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/index.ts +659 -0
  527. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/package.json +7 -0
  528. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  529. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  530. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  531. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  532. package/.versions/2.2.1/.pi/harnesses/damage-control-continue/version.ts +42 -0
  533. package/.versions/2.2.1/.pi/harnesses/lib/approval-wait.ts +17 -0
  534. package/.versions/2.2.1/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  535. package/.versions/2.2.1/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  536. package/.versions/2.2.1/.pi/harnesses/lib/clarification-policy.ts +9 -0
  537. package/.versions/2.2.1/.pi/harnesses/lib/codex-compat.ts +97 -0
  538. package/.versions/2.2.1/.pi/harnesses/lib/codex-contract.ts +259 -0
  539. package/.versions/2.2.1/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  540. package/.versions/2.2.1/.pi/harnesses/lib/coms-core-io.ts +422 -0
  541. package/.versions/2.2.1/.pi/harnesses/lib/coms-core.ts +738 -0
  542. package/.versions/2.2.1/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  543. package/.versions/2.2.1/.pi/harnesses/lib/coms-observation.ts +74 -0
  544. package/.versions/2.2.1/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  545. package/.versions/2.2.1/.pi/harnesses/lib/coms-response-read.ts +107 -0
  546. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  547. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  548. package/.versions/2.2.1/.pi/harnesses/lib/context-budget-view.ts +112 -0
  549. package/.versions/2.2.1/.pi/harnesses/lib/context-budget.ts +114 -0
  550. package/.versions/2.2.1/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  551. package/.versions/2.2.1/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  552. package/.versions/2.2.1/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  553. package/.versions/2.2.1/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  554. package/.versions/2.2.1/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  555. package/.versions/2.2.1/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  556. package/.versions/2.2.1/.pi/harnesses/lib/damage-policy.ts +35 -0
  557. package/.versions/2.2.1/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  558. package/.versions/2.2.1/.pi/harnesses/lib/damage-result-view.ts +16 -0
  559. package/.versions/2.2.1/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  560. package/.versions/2.2.1/.pi/harnesses/lib/exact-permission-port.ts +38 -0
  561. package/.versions/2.2.1/.pi/harnesses/lib/execution-trace.ts +45 -0
  562. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  563. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  564. package/.versions/2.2.1/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  565. package/.versions/2.2.1/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  566. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  567. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  568. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  569. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  570. package/.versions/2.2.1/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  571. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  572. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  573. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  574. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  575. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  576. package/.versions/2.2.1/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  577. package/.versions/2.2.1/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  578. package/.versions/2.2.1/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  579. package/.versions/2.2.1/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  580. package/.versions/2.2.1/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  581. package/.versions/2.2.1/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  582. package/.versions/2.2.1/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  583. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  584. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  585. package/.versions/2.2.1/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  586. package/.versions/2.2.1/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  587. package/.versions/2.2.1/.pi/harnesses/lib/fleet-panel.ts +34 -0
  588. package/.versions/2.2.1/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  589. package/.versions/2.2.1/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  590. package/.versions/2.2.1/.pi/harnesses/lib/fleet-selection.ts +24 -0
  591. package/.versions/2.2.1/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  592. package/.versions/2.2.1/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  593. package/.versions/2.2.1/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  594. package/.versions/2.2.1/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  595. package/.versions/2.2.1/.pi/harnesses/lib/herdr-client.ts +472 -0
  596. package/.versions/2.2.1/.pi/harnesses/lib/herdr-presence.ts +399 -0
  597. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  598. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  599. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  600. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  601. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  602. package/.versions/2.2.1/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  603. package/.versions/2.2.1/.pi/harnesses/lib/identical-dialog.ts +27 -0
  604. package/.versions/2.2.1/.pi/harnesses/lib/installation-state.js +62 -0
  605. package/.versions/2.2.1/.pi/harnesses/lib/peer-target.ts +24 -0
  606. package/.versions/2.2.1/.pi/harnesses/lib/policy-roots.js +117 -0
  607. package/.versions/2.2.1/.pi/harnesses/lib/policy-roots.ts +32 -0
  608. package/.versions/2.2.1/.pi/harnesses/lib/process-shared.ts +9 -0
  609. package/.versions/2.2.1/.pi/harnesses/lib/resource-closure.js +26 -0
  610. package/.versions/2.2.1/.pi/harnesses/lib/safe-source-read.js +29 -0
  611. package/.versions/2.2.1/.pi/harnesses/lib/semantic-approval.ts +80 -0
  612. package/.versions/2.2.1/.pi/harnesses/lib/session-target.ts +62 -0
  613. package/.versions/2.2.1/.pi/harnesses/lib/spawned-peers.js +191 -0
  614. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  615. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  616. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  617. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  618. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-json.js +37 -0
  619. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-loader.js +53 -0
  620. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  621. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-triage.js +42 -0
  622. package/.versions/2.2.1/.pi/harnesses/lib/system1/config-v2.js +112 -0
  623. package/.versions/2.2.1/.pi/harnesses/lib/system1/config.js +50 -0
  624. package/.versions/2.2.1/.pi/harnesses/lib/system1/contracts.ts +154 -0
  625. package/.versions/2.2.1/.pi/harnesses/lib/system1/demo.ts +95 -0
  626. package/.versions/2.2.1/.pi/harnesses/lib/system1/jev.ts +503 -0
  627. package/.versions/2.2.1/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  628. package/.versions/2.2.1/.pi/harnesses/lib/system1/selection.js +11 -0
  629. package/.versions/2.2.1/.pi/harnesses/lib/system1/service.ts +245 -0
  630. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  631. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  632. package/.versions/2.2.1/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  633. package/.versions/2.2.1/.pi/harnesses/lib/target-capabilities.js +7 -0
  634. package/.versions/2.2.1/.pi/harnesses/lib/update-check.ts +227 -0
  635. package/.versions/2.2.1/.pi/harnesses/lib/workspace-context.js +115 -0
  636. package/.versions/2.2.1/.pi/harnesses/lib/workspace-context.ts +22 -0
  637. package/.versions/2.2.1/.pi/harnesses/package-lock.json +2121 -0
  638. package/.versions/2.2.1/.pi/harnesses/package.json +13 -0
  639. package/.versions/2.2.1/.pi/prompts/af-build.md +27 -0
  640. package/.versions/2.2.1/.pi/prompts/af-code-simplify.md +22 -0
  641. package/.versions/2.2.1/.pi/prompts/af-constraints.md +31 -0
  642. package/.versions/2.2.1/.pi/prompts/af-plan.md +17 -0
  643. package/.versions/2.2.1/.pi/prompts/af-review.md +16 -0
  644. package/.versions/2.2.1/.pi/prompts/af-set-hermes-telegram.md +15 -0
  645. package/.versions/2.2.1/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  646. package/.versions/2.2.1/.pi/prompts/af-setup-rules.md +20 -0
  647. package/.versions/2.2.1/.pi/prompts/af-ship.md +17 -0
  648. package/.versions/2.2.1/.pi/prompts/af-spec.md +15 -0
  649. package/.versions/2.2.1/.pi/prompts/af-test.md +19 -0
  650. package/.versions/2.2.1/.pi/skills/bowser/SKILL.md +145 -0
  651. package/.versions/2.2.1/.version +1 -0
  652. package/.versions/2.2.1/agents/architect.md +24 -0
  653. package/.versions/2.2.1/agents/bowser.md +28 -0
  654. package/.versions/2.2.1/agents/builder.md +55 -0
  655. package/.versions/2.2.1/agents/code-reviewer.md +209 -0
  656. package/.versions/2.2.1/agents/deep-researcher.md +32 -0
  657. package/.versions/2.2.1/agents/documenter.md +22 -0
  658. package/.versions/2.2.1/agents/plan-reviewer.md +83 -0
  659. package/.versions/2.2.1/agents/planner.md +107 -0
  660. package/.versions/2.2.1/agents/releaser.md +24 -0
  661. package/.versions/2.2.1/agents/researcher.md +30 -0
  662. package/.versions/2.2.1/agents/security-auditor.md +167 -0
  663. package/.versions/2.2.1/agents/test-engineer.md +153 -0
  664. package/.versions/2.2.1/agents/web-debugger.md +44 -0
  665. package/.versions/2.2.1/agents/web-performance-auditor.md +194 -0
  666. package/.versions/2.2.1/bin/catalog/harness-runtime-closure.json +85 -0
  667. package/.versions/2.2.1/docs/ARCHITECTURE.md +1291 -0
  668. package/.versions/2.2.1/docs/agent-fleet-setup.md +1161 -0
  669. package/.versions/2.2.1/docs/claude-code-coms-bridge.md +147 -0
  670. package/.versions/2.2.1/docs/codex-local-mcp.md +520 -0
  671. package/.versions/2.2.1/docs/codex-session-bridge.md +44 -0
  672. package/.versions/2.2.1/docs/codex-setup.md +183 -0
  673. package/.versions/2.2.1/docs/coms-hermes-bridge.md +188 -0
  674. package/.versions/2.2.1/docs/fleet-native-voice.md +151 -0
  675. package/.versions/2.2.1/docs/getting-started.md +126 -0
  676. package/.versions/2.2.1/docs/npm-install.md +535 -0
  677. package/.versions/2.2.1/docs/pi-extensions.md +450 -0
  678. package/.versions/2.2.1/docs/pi-setup.md +92 -0
  679. package/.versions/2.2.1/docs/skill-anatomy.md +150 -0
  680. package/.versions/2.2.1/install-manifest.json +3227 -0
  681. package/.versions/2.2.1/justfile +246 -0
  682. package/.versions/2.2.1/manifest-meta.json +1099 -0
  683. package/.versions/2.2.1/references/accessibility-checklist.md +160 -0
  684. package/.versions/2.2.1/references/communication-contract.md +26 -0
  685. package/.versions/2.2.1/references/definition-of-done.md +67 -0
  686. package/.versions/2.2.1/references/fleet-coordination-patterns.md +171 -0
  687. package/.versions/2.2.1/references/observability-checklist.md +92 -0
  688. package/.versions/2.2.1/references/orchestration-patterns.md +370 -0
  689. package/.versions/2.2.1/references/performance-checklist.md +236 -0
  690. package/.versions/2.2.1/references/prompting-patterns.md +380 -0
  691. package/.versions/2.2.1/references/security-checklist.md +245 -0
  692. package/.versions/2.2.1/references/testing-patterns.md +235 -0
  693. package/.versions/2.2.1/references/workflow-authoring.md +304 -0
  694. package/.versions/2.2.1/skills/_internal/grilling.md +59 -0
  695. package/.versions/2.2.1/skills/browser-testing-with-devtools/SKILL.md +351 -0
  696. package/.versions/2.2.1/skills/code-review-and-quality/SKILL.md +396 -0
  697. package/.versions/2.2.1/skills/compound-learning/SKILL.md +137 -0
  698. package/.versions/2.2.1/skills/constraint-driven-development/SKILL.md +338 -0
  699. package/.versions/2.2.1/skills/constraint-driven-development/references/floor-guard.md +99 -0
  700. package/.versions/2.2.1/skills/context-engineering/SKILL.md +341 -0
  701. package/.versions/2.2.1/skills/deprecation-and-migration/SKILL.md +247 -0
  702. package/.versions/2.2.1/skills/designing-agents/SKILL.md +394 -0
  703. package/.versions/2.2.1/skills/designing-agents/pi-harness-authoring.md +222 -0
  704. package/.versions/2.2.1/skills/drafting-workflows/SKILL.md +143 -0
  705. package/.versions/2.2.1/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  706. package/.versions/2.2.1/skills/fleet-connect/SKILL.md +29 -0
  707. package/.versions/2.2.1/skills/fleet-connect.zip +0 -0
  708. package/.versions/2.2.1/skills/fleet-native-voice/SKILL.md +103 -0
  709. package/.versions/2.2.1/skills/fleet-native-voice/agents/openai.yaml +4 -0
  710. package/.versions/2.2.1/skills/fleet-native-voice.zip +0 -0
  711. package/.versions/2.2.1/skills/frontend-ui-engineering/SKILL.md +328 -0
  712. package/.versions/2.2.1/skills/git-workflow-and-versioning/SKILL.md +316 -0
  713. package/.versions/2.2.1/skills/idea-refine/SKILL.md +182 -0
  714. package/.versions/2.2.1/skills/idea-refine/examples.md +238 -0
  715. package/.versions/2.2.1/skills/idea-refine/frameworks.md +99 -0
  716. package/.versions/2.2.1/skills/idea-refine/refinement-criteria.md +113 -0
  717. package/.versions/2.2.1/skills/idea-refine/scripts/idea-refine.sh +15 -0
  718. package/.versions/2.2.1/skills/incremental-implementation/SKILL.md +353 -0
  719. package/.versions/2.2.1/skills/incremental-implementation.zip +0 -0
  720. package/.versions/2.2.1/skills/interview-me/SKILL.md +226 -0
  721. package/.versions/2.2.1/skills/orchestration-verification/SKILL.md +182 -0
  722. package/.versions/2.2.1/skills/peer-coms/SKILL.md +90 -0
  723. package/.versions/2.2.1/skills/performance-optimization/SKILL.md +496 -0
  724. package/.versions/2.2.1/skills/planning-and-task-breakdown/SKILL.md +318 -0
  725. package/.versions/2.2.1/skills/planning-and-task-breakdown.zip +0 -0
  726. package/.versions/2.2.1/skills/repository-ai-setup/SKILL.md +135 -0
  727. package/.versions/2.2.1/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  728. package/.versions/2.2.1/skills/repository-ai-setup/references/apply-contract.md +74 -0
  729. package/.versions/2.2.1/skills/repository-ai-setup/references/provenance-template.md +16 -0
  730. package/.versions/2.2.1/skills/repository-ai-setup/references/setup-flow.md +108 -0
  731. package/.versions/2.2.1/skills/repository-ai-setup/references/verify-setup.md +20 -0
  732. package/.versions/2.2.1/skills/repository-ai-setup.zip +0 -0
  733. package/.versions/2.2.1/skills/security-and-hardening/SKILL.md +524 -0
  734. package/.versions/2.2.1/skills/spec-driven-development/SKILL.md +295 -0
  735. package/.versions/2.2.1/skills/spec-driven-development.zip +0 -0
  736. package/.versions/2.2.1/skills/using-agent-skills/SKILL.md +198 -0
  737. package/.versions/2.2.1/vendor/agent-skills-upstream/LICENSE +21 -0
  738. package/.versions/2.2.1/vendor/agent-skills-upstream/README.md +430 -0
  739. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  740. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  741. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  742. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  743. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  744. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  745. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  746. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  747. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  748. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  749. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  750. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  751. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  752. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  753. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  754. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  755. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  756. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  757. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  758. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  759. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  760. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  761. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  762. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  763. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  764. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  765. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  766. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  767. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  768. package/.versions/2.2.1/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  769. package/.versions/2.2.2/.pi/agent-fleet/hermes/README.md +347 -0
  770. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  771. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  772. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  773. package/.versions/2.2.2/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  774. package/.versions/2.2.2/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  775. package/.versions/2.2.2/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  776. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  777. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  778. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  779. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  780. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  781. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  782. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  783. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  784. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  785. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  786. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  787. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  788. package/.versions/2.2.2/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  789. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  790. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  791. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  792. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  793. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  794. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  795. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  796. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  797. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  798. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  799. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  800. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  801. package/.versions/2.2.2/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  802. package/.versions/2.2.2/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  803. package/.versions/2.2.2/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  804. package/.versions/2.2.2/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  805. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  806. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  807. package/.versions/2.2.2/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  808. package/.versions/2.2.2/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  809. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  810. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  811. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  812. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  813. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  814. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  815. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  816. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  817. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  818. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  819. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  820. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  821. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  822. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  823. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  824. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  825. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  826. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  827. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  828. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  829. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  830. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  831. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  832. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  833. package/.versions/2.2.2/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  834. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  835. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  836. package/.versions/2.2.2/.pi/agent-fleet/scripts/fleet.ts +244 -0
  837. package/.versions/2.2.2/.pi/agent-fleet/scripts/flow.ts +166 -0
  838. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  839. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  840. package/.versions/2.2.2/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  841. package/.versions/2.2.2/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  842. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  843. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  844. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  845. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  846. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  847. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  848. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  849. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  850. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  851. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  852. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  853. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  854. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  855. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  856. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  857. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  858. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  859. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  860. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  861. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  862. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  863. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  864. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  865. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  866. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  867. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  868. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  869. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  870. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  871. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  872. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  873. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  874. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  875. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  876. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  877. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  878. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  879. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  880. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  881. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  882. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  883. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  884. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  885. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  886. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  887. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  888. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  889. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  890. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  891. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  892. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  893. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  894. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  895. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  896. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  897. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  898. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  899. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  900. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  901. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  902. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  903. package/.versions/2.2.2/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  904. package/.versions/2.2.2/.pi/agent-fleet/scripts/package-lock.json +57 -0
  905. package/.versions/2.2.2/.pi/agent-fleet/scripts/package.json +10 -0
  906. package/.versions/2.2.2/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  907. package/.versions/2.2.2/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  908. package/.versions/2.2.2/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  909. package/.versions/2.2.2/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  910. package/.versions/2.2.2/.pi/agent-fleet/scripts/team-up.ts +378 -0
  911. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  912. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  913. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  914. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  915. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  916. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  917. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  918. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  919. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  920. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  921. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  922. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  923. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  924. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  925. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  926. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  927. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  928. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  929. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  930. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  931. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  932. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  933. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  934. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  935. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  936. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  937. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  938. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  939. package/.versions/2.2.2/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  940. package/.versions/2.2.2/.pi/agents/dispatch-policy.yaml +32 -0
  941. package/.versions/2.2.2/.pi/agents/model-profiles.yaml +132 -0
  942. package/.versions/2.2.2/.pi/agents/peers.yaml +147 -0
  943. package/.versions/2.2.2/.pi/agents/teams.yaml +41 -0
  944. package/.versions/2.2.2/.pi/agents/voices.yaml +13 -0
  945. package/.versions/2.2.2/.pi/damage-control-rules.yaml +297 -0
  946. package/.versions/2.2.2/.pi/extensions/btw/README.md +120 -0
  947. package/.versions/2.2.2/.pi/extensions/btw/index.ts +916 -0
  948. package/.versions/2.2.2/.pi/extensions/btw/package.json +6 -0
  949. package/.versions/2.2.2/.pi/extensions/btw/state.js +179 -0
  950. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  951. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  952. package/.versions/2.2.2/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  953. package/.versions/2.2.2/.pi/extensions/compact-and-continue/README.md +42 -0
  954. package/.versions/2.2.2/.pi/extensions/compact-and-continue/index.ts +136 -0
  955. package/.versions/2.2.2/.pi/extensions/compact-and-continue/package.json +6 -0
  956. package/.versions/2.2.2/.pi/extensions/mcp-bridge/README.md +46 -0
  957. package/.versions/2.2.2/.pi/extensions/mcp-bridge/index.ts +206 -0
  958. package/.versions/2.2.2/.pi/extensions/mcp-bridge/package.json +6 -0
  959. package/.versions/2.2.2/.pi/extensions/package-lock.json +1175 -0
  960. package/.versions/2.2.2/.pi/extensions/package.json +9 -0
  961. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/README.md +224 -0
  962. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/config.ts +199 -0
  963. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  964. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/index.ts +248 -0
  965. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/package.json +6 -0
  966. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  967. package/.versions/2.2.2/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  968. package/.versions/2.2.2/.pi/harnesses/agent-hub/README.md +1641 -0
  969. package/.versions/2.2.2/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  970. package/.versions/2.2.2/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  971. package/.versions/2.2.2/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  972. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  973. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  974. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  975. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  976. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  977. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  978. package/.versions/2.2.2/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  979. package/.versions/2.2.2/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  980. package/.versions/2.2.2/.pi/harnesses/agent-hub/artifacts.js +146 -0
  981. package/.versions/2.2.2/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  982. package/.versions/2.2.2/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  983. package/.versions/2.2.2/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  984. package/.versions/2.2.2/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  985. package/.versions/2.2.2/.pi/harnesses/agent-hub/budget-recovery.ts +123 -0
  986. package/.versions/2.2.2/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  987. package/.versions/2.2.2/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  988. package/.versions/2.2.2/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  989. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  990. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  991. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  992. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  993. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  994. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  995. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  996. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  997. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  998. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  999. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  1000. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  1001. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  1002. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  1003. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  1004. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  1005. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  1006. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  1007. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  1008. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  1009. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  1010. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  1011. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  1012. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/recover.ts +62 -0
  1013. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  1014. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  1015. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  1016. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  1017. package/.versions/2.2.2/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  1018. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  1019. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  1020. package/.versions/2.2.2/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  1021. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  1022. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  1023. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  1024. package/.versions/2.2.2/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  1025. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  1026. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  1027. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  1028. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  1029. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  1030. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  1031. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  1032. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  1033. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  1034. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  1035. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  1036. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  1037. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  1038. package/.versions/2.2.2/.pi/harnesses/agent-hub/context-window.js +108 -0
  1039. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  1040. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  1041. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  1042. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  1043. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  1044. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  1045. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  1046. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  1047. package/.versions/2.2.2/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  1048. package/.versions/2.2.2/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  1049. package/.versions/2.2.2/.pi/harnesses/agent-hub/delegate.ts +478 -0
  1050. package/.versions/2.2.2/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  1051. package/.versions/2.2.2/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  1052. package/.versions/2.2.2/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  1053. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  1054. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  1055. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  1056. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  1057. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  1058. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  1059. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  1060. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  1061. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  1062. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  1063. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  1064. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  1065. package/.versions/2.2.2/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  1066. package/.versions/2.2.2/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  1067. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  1068. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  1069. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  1070. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  1071. package/.versions/2.2.2/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  1072. package/.versions/2.2.2/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  1073. package/.versions/2.2.2/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  1074. package/.versions/2.2.2/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  1075. package/.versions/2.2.2/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  1076. package/.versions/2.2.2/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  1077. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  1078. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  1079. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  1080. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  1081. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  1082. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  1083. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  1084. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  1085. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  1086. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  1087. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  1088. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  1089. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  1090. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  1091. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  1092. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  1093. package/.versions/2.2.2/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  1094. package/.versions/2.2.2/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  1095. package/.versions/2.2.2/.pi/harnesses/agent-hub/fixtures/registration-surface.json +68 -0
  1096. package/.versions/2.2.2/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  1097. package/.versions/2.2.2/.pi/harnesses/agent-hub/footer.ts +29 -0
  1098. package/.versions/2.2.2/.pi/harnesses/agent-hub/helpers.ts +269 -0
  1099. package/.versions/2.2.2/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  1100. package/.versions/2.2.2/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  1101. package/.versions/2.2.2/.pi/harnesses/agent-hub/index.ts +2722 -0
  1102. package/.versions/2.2.2/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  1103. package/.versions/2.2.2/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  1104. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  1105. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  1106. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  1107. package/.versions/2.2.2/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  1108. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  1109. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  1110. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  1111. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  1112. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  1113. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  1114. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  1115. package/.versions/2.2.2/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  1116. package/.versions/2.2.2/.pi/harnesses/agent-hub/no-progress.ts +627 -0
  1117. package/.versions/2.2.2/.pi/harnesses/agent-hub/operator-current-state.ts +57 -0
  1118. package/.versions/2.2.2/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  1119. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  1120. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  1121. package/.versions/2.2.2/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  1122. package/.versions/2.2.2/.pi/harnesses/agent-hub/package.json +7 -0
  1123. package/.versions/2.2.2/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  1124. package/.versions/2.2.2/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  1125. package/.versions/2.2.2/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  1126. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  1127. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  1128. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  1129. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  1130. package/.versions/2.2.2/.pi/harnesses/agent-hub/policy/work-mode.ts +103 -0
  1131. package/.versions/2.2.2/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  1132. package/.versions/2.2.2/.pi/harnesses/agent-hub/presentation.ts +54 -0
  1133. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  1134. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  1135. package/.versions/2.2.2/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  1136. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  1137. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  1138. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  1139. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  1140. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  1141. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  1142. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  1143. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  1144. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  1145. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  1146. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  1147. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  1148. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  1149. package/.versions/2.2.2/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  1150. package/.versions/2.2.2/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  1151. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  1152. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  1153. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  1154. package/.versions/2.2.2/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  1155. package/.versions/2.2.2/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  1156. package/.versions/2.2.2/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  1157. package/.versions/2.2.2/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  1158. package/.versions/2.2.2/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  1159. package/.versions/2.2.2/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  1160. package/.versions/2.2.2/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  1161. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  1162. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  1163. package/.versions/2.2.2/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  1164. package/.versions/2.2.2/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  1165. package/.versions/2.2.2/.pi/harnesses/agent-hub/return-contract.js +371 -0
  1166. package/.versions/2.2.2/.pi/harnesses/agent-hub/return-extract.js +77 -0
  1167. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  1168. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  1169. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-findings.js +96 -0
  1170. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  1171. package/.versions/2.2.2/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  1172. package/.versions/2.2.2/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  1173. package/.versions/2.2.2/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  1174. package/.versions/2.2.2/.pi/harnesses/agent-hub/run-budget.js +362 -0
  1175. package/.versions/2.2.2/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  1176. package/.versions/2.2.2/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  1177. package/.versions/2.2.2/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  1178. package/.versions/2.2.2/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  1179. package/.versions/2.2.2/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  1180. package/.versions/2.2.2/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  1181. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  1182. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-health.js +110 -0
  1183. package/.versions/2.2.2/.pi/harnesses/agent-hub/session-start.ts +42 -0
  1184. package/.versions/2.2.2/.pi/harnesses/agent-hub/spawn.ts +702 -0
  1185. package/.versions/2.2.2/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  1186. package/.versions/2.2.2/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  1187. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  1188. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  1189. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  1190. package/.versions/2.2.2/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  1191. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  1192. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  1193. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  1194. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  1195. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  1196. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  1197. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  1198. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  1199. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  1200. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  1201. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  1202. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  1203. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-runtime.ts +132 -0
  1204. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  1205. package/.versions/2.2.2/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  1206. package/.versions/2.2.2/.pi/harnesses/agent-hub/timeline.ts +72 -0
  1207. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  1208. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  1209. package/.versions/2.2.2/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  1210. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/action-executors.ts +216 -0
  1211. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  1212. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  1213. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  1214. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/context.ts +149 -0
  1215. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  1216. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +928 -0
  1217. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  1218. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  1219. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  1220. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  1221. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  1222. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  1223. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  1224. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  1225. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  1226. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  1227. package/.versions/2.2.2/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  1228. package/.versions/2.2.2/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  1229. package/.versions/2.2.2/.pi/harnesses/agent-hub/types.ts +66 -0
  1230. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  1231. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  1232. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  1233. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  1234. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  1235. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  1236. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  1237. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  1238. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  1239. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  1240. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  1241. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  1242. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  1243. package/.versions/2.2.2/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  1244. package/.versions/2.2.2/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  1245. package/.versions/2.2.2/.pi/harnesses/agent-hub/version.ts +42 -0
  1246. package/.versions/2.2.2/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  1247. package/.versions/2.2.2/.pi/harnesses/agent-hub/work-mode.ts +183 -0
  1248. package/.versions/2.2.2/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  1249. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/README.md +59 -0
  1250. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/index.ts +571 -0
  1251. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  1252. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  1253. package/.versions/2.2.2/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  1254. package/.versions/2.2.2/.pi/harnesses/coms/README.md +105 -0
  1255. package/.versions/2.2.2/.pi/harnesses/coms/index.ts +308 -0
  1256. package/.versions/2.2.2/.pi/harnesses/coms/package.json +7 -0
  1257. package/.versions/2.2.2/.pi/harnesses/coms/version.ts +42 -0
  1258. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/README.md +161 -0
  1259. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/index.ts +659 -0
  1260. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/package.json +7 -0
  1261. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  1262. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  1263. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  1264. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  1265. package/.versions/2.2.2/.pi/harnesses/damage-control-continue/version.ts +42 -0
  1266. package/.versions/2.2.2/.pi/harnesses/lib/approval-wait.ts +17 -0
  1267. package/.versions/2.2.2/.pi/harnesses/lib/bash-policy-analysis.ts +185 -0
  1268. package/.versions/2.2.2/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  1269. package/.versions/2.2.2/.pi/harnesses/lib/clarification-policy.ts +9 -0
  1270. package/.versions/2.2.2/.pi/harnesses/lib/codex-compat.ts +97 -0
  1271. package/.versions/2.2.2/.pi/harnesses/lib/codex-contract.ts +259 -0
  1272. package/.versions/2.2.2/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  1273. package/.versions/2.2.2/.pi/harnesses/lib/coms-core-io.ts +422 -0
  1274. package/.versions/2.2.2/.pi/harnesses/lib/coms-core.ts +738 -0
  1275. package/.versions/2.2.2/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  1276. package/.versions/2.2.2/.pi/harnesses/lib/coms-observation.ts +74 -0
  1277. package/.versions/2.2.2/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  1278. package/.versions/2.2.2/.pi/harnesses/lib/coms-response-read.ts +107 -0
  1279. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  1280. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  1281. package/.versions/2.2.2/.pi/harnesses/lib/context-budget-view.ts +112 -0
  1282. package/.versions/2.2.2/.pi/harnesses/lib/context-budget.ts +114 -0
  1283. package/.versions/2.2.2/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  1284. package/.versions/2.2.2/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  1285. package/.versions/2.2.2/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  1286. package/.versions/2.2.2/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  1287. package/.versions/2.2.2/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  1288. package/.versions/2.2.2/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  1289. package/.versions/2.2.2/.pi/harnesses/lib/damage-policy.ts +35 -0
  1290. package/.versions/2.2.2/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  1291. package/.versions/2.2.2/.pi/harnesses/lib/damage-result-view.ts +16 -0
  1292. package/.versions/2.2.2/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  1293. package/.versions/2.2.2/.pi/harnesses/lib/exact-permission-port.ts +38 -0
  1294. package/.versions/2.2.2/.pi/harnesses/lib/execution-trace.ts +45 -0
  1295. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  1296. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  1297. package/.versions/2.2.2/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  1298. package/.versions/2.2.2/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  1299. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  1300. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  1301. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  1302. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  1303. package/.versions/2.2.2/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  1304. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  1305. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  1306. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  1307. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  1308. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  1309. package/.versions/2.2.2/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  1310. package/.versions/2.2.2/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  1311. package/.versions/2.2.2/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  1312. package/.versions/2.2.2/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  1313. package/.versions/2.2.2/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  1314. package/.versions/2.2.2/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  1315. package/.versions/2.2.2/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  1316. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  1317. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  1318. package/.versions/2.2.2/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  1319. package/.versions/2.2.2/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  1320. package/.versions/2.2.2/.pi/harnesses/lib/fleet-panel.ts +34 -0
  1321. package/.versions/2.2.2/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  1322. package/.versions/2.2.2/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  1323. package/.versions/2.2.2/.pi/harnesses/lib/fleet-selection.ts +24 -0
  1324. package/.versions/2.2.2/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  1325. package/.versions/2.2.2/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  1326. package/.versions/2.2.2/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  1327. package/.versions/2.2.2/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  1328. package/.versions/2.2.2/.pi/harnesses/lib/herdr-client.ts +472 -0
  1329. package/.versions/2.2.2/.pi/harnesses/lib/herdr-presence.ts +399 -0
  1330. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  1331. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  1332. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  1333. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  1334. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  1335. package/.versions/2.2.2/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  1336. package/.versions/2.2.2/.pi/harnesses/lib/identical-dialog.ts +27 -0
  1337. package/.versions/2.2.2/.pi/harnesses/lib/installation-state.js +62 -0
  1338. package/.versions/2.2.2/.pi/harnesses/lib/peer-target.ts +24 -0
  1339. package/.versions/2.2.2/.pi/harnesses/lib/policy-roots.js +117 -0
  1340. package/.versions/2.2.2/.pi/harnesses/lib/policy-roots.ts +32 -0
  1341. package/.versions/2.2.2/.pi/harnesses/lib/process-shared.ts +9 -0
  1342. package/.versions/2.2.2/.pi/harnesses/lib/resource-closure.js +26 -0
  1343. package/.versions/2.2.2/.pi/harnesses/lib/safe-source-read.js +29 -0
  1344. package/.versions/2.2.2/.pi/harnesses/lib/semantic-approval.ts +80 -0
  1345. package/.versions/2.2.2/.pi/harnesses/lib/session-target.ts +62 -0
  1346. package/.versions/2.2.2/.pi/harnesses/lib/spawned-peers.js +191 -0
  1347. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  1348. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  1349. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  1350. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  1351. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-json.js +37 -0
  1352. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-loader.js +53 -0
  1353. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  1354. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-triage.js +42 -0
  1355. package/.versions/2.2.2/.pi/harnesses/lib/system1/config-v2.js +112 -0
  1356. package/.versions/2.2.2/.pi/harnesses/lib/system1/config.js +50 -0
  1357. package/.versions/2.2.2/.pi/harnesses/lib/system1/contracts.ts +154 -0
  1358. package/.versions/2.2.2/.pi/harnesses/lib/system1/demo.ts +95 -0
  1359. package/.versions/2.2.2/.pi/harnesses/lib/system1/jev.ts +503 -0
  1360. package/.versions/2.2.2/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  1361. package/.versions/2.2.2/.pi/harnesses/lib/system1/selection.js +11 -0
  1362. package/.versions/2.2.2/.pi/harnesses/lib/system1/service.ts +245 -0
  1363. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  1364. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  1365. package/.versions/2.2.2/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  1366. package/.versions/2.2.2/.pi/harnesses/lib/target-capabilities.js +7 -0
  1367. package/.versions/2.2.2/.pi/harnesses/lib/update-check.ts +227 -0
  1368. package/.versions/2.2.2/.pi/harnesses/lib/workspace-context.js +115 -0
  1369. package/.versions/2.2.2/.pi/harnesses/lib/workspace-context.ts +22 -0
  1370. package/.versions/2.2.2/.pi/harnesses/package-lock.json +2121 -0
  1371. package/.versions/2.2.2/.pi/harnesses/package.json +13 -0
  1372. package/.versions/2.2.2/.pi/prompts/af-build.md +27 -0
  1373. package/.versions/2.2.2/.pi/prompts/af-code-simplify.md +22 -0
  1374. package/.versions/2.2.2/.pi/prompts/af-constraints.md +31 -0
  1375. package/.versions/2.2.2/.pi/prompts/af-plan.md +17 -0
  1376. package/.versions/2.2.2/.pi/prompts/af-review.md +16 -0
  1377. package/.versions/2.2.2/.pi/prompts/af-set-hermes-telegram.md +15 -0
  1378. package/.versions/2.2.2/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  1379. package/.versions/2.2.2/.pi/prompts/af-setup-rules.md +20 -0
  1380. package/.versions/2.2.2/.pi/prompts/af-ship.md +17 -0
  1381. package/.versions/2.2.2/.pi/prompts/af-spec.md +15 -0
  1382. package/.versions/2.2.2/.pi/prompts/af-test.md +19 -0
  1383. package/.versions/2.2.2/.pi/skills/bowser/SKILL.md +145 -0
  1384. package/.versions/2.2.2/.version +1 -0
  1385. package/.versions/2.2.2/agents/architect.md +24 -0
  1386. package/.versions/2.2.2/agents/bowser.md +28 -0
  1387. package/.versions/2.2.2/agents/builder.md +55 -0
  1388. package/.versions/2.2.2/agents/code-reviewer.md +209 -0
  1389. package/.versions/2.2.2/agents/deep-researcher.md +32 -0
  1390. package/.versions/2.2.2/agents/documenter.md +22 -0
  1391. package/.versions/2.2.2/agents/plan-reviewer.md +83 -0
  1392. package/.versions/2.2.2/agents/planner.md +107 -0
  1393. package/.versions/2.2.2/agents/releaser.md +24 -0
  1394. package/.versions/2.2.2/agents/researcher.md +30 -0
  1395. package/.versions/2.2.2/agents/security-auditor.md +167 -0
  1396. package/.versions/2.2.2/agents/test-engineer.md +153 -0
  1397. package/.versions/2.2.2/agents/web-debugger.md +44 -0
  1398. package/.versions/2.2.2/agents/web-performance-auditor.md +194 -0
  1399. package/.versions/2.2.2/bin/catalog/harness-runtime-closure.json +85 -0
  1400. package/.versions/2.2.2/docs/ARCHITECTURE.md +1291 -0
  1401. package/.versions/2.2.2/docs/agent-fleet-setup.md +1161 -0
  1402. package/.versions/2.2.2/docs/claude-code-coms-bridge.md +147 -0
  1403. package/.versions/2.2.2/docs/codex-local-mcp.md +520 -0
  1404. package/.versions/2.2.2/docs/codex-session-bridge.md +44 -0
  1405. package/.versions/2.2.2/docs/codex-setup.md +183 -0
  1406. package/.versions/2.2.2/docs/coms-hermes-bridge.md +188 -0
  1407. package/.versions/2.2.2/docs/fleet-native-voice.md +151 -0
  1408. package/.versions/2.2.2/docs/getting-started.md +126 -0
  1409. package/.versions/2.2.2/docs/npm-install.md +535 -0
  1410. package/.versions/2.2.2/docs/pi-extensions.md +450 -0
  1411. package/.versions/2.2.2/docs/pi-setup.md +92 -0
  1412. package/.versions/2.2.2/docs/skill-anatomy.md +150 -0
  1413. package/.versions/2.2.2/install-manifest.json +3227 -0
  1414. package/.versions/2.2.2/justfile +246 -0
  1415. package/.versions/2.2.2/manifest-meta.json +1099 -0
  1416. package/.versions/2.2.2/references/accessibility-checklist.md +160 -0
  1417. package/.versions/2.2.2/references/communication-contract.md +26 -0
  1418. package/.versions/2.2.2/references/definition-of-done.md +67 -0
  1419. package/.versions/2.2.2/references/fleet-coordination-patterns.md +171 -0
  1420. package/.versions/2.2.2/references/observability-checklist.md +92 -0
  1421. package/.versions/2.2.2/references/orchestration-patterns.md +370 -0
  1422. package/.versions/2.2.2/references/performance-checklist.md +236 -0
  1423. package/.versions/2.2.2/references/prompting-patterns.md +380 -0
  1424. package/.versions/2.2.2/references/security-checklist.md +245 -0
  1425. package/.versions/2.2.2/references/testing-patterns.md +235 -0
  1426. package/.versions/2.2.2/references/workflow-authoring.md +304 -0
  1427. package/.versions/2.2.2/skills/_internal/grilling.md +59 -0
  1428. package/.versions/2.2.2/skills/browser-testing-with-devtools/SKILL.md +351 -0
  1429. package/.versions/2.2.2/skills/code-review-and-quality/SKILL.md +396 -0
  1430. package/.versions/2.2.2/skills/compound-learning/SKILL.md +137 -0
  1431. package/.versions/2.2.2/skills/constraint-driven-development/SKILL.md +338 -0
  1432. package/.versions/2.2.2/skills/constraint-driven-development/references/floor-guard.md +99 -0
  1433. package/.versions/2.2.2/skills/context-engineering/SKILL.md +341 -0
  1434. package/.versions/2.2.2/skills/deprecation-and-migration/SKILL.md +247 -0
  1435. package/.versions/2.2.2/skills/designing-agents/SKILL.md +394 -0
  1436. package/.versions/2.2.2/skills/designing-agents/pi-harness-authoring.md +222 -0
  1437. package/.versions/2.2.2/skills/drafting-workflows/SKILL.md +143 -0
  1438. package/.versions/2.2.2/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  1439. package/.versions/2.2.2/skills/fleet-connect/SKILL.md +29 -0
  1440. package/.versions/2.2.2/skills/fleet-connect.zip +0 -0
  1441. package/.versions/2.2.2/skills/fleet-native-voice/SKILL.md +103 -0
  1442. package/.versions/2.2.2/skills/fleet-native-voice/agents/openai.yaml +4 -0
  1443. package/.versions/2.2.2/skills/fleet-native-voice.zip +0 -0
  1444. package/.versions/2.2.2/skills/frontend-ui-engineering/SKILL.md +328 -0
  1445. package/.versions/2.2.2/skills/git-workflow-and-versioning/SKILL.md +316 -0
  1446. package/.versions/2.2.2/skills/idea-refine/SKILL.md +182 -0
  1447. package/.versions/2.2.2/skills/idea-refine/examples.md +238 -0
  1448. package/.versions/2.2.2/skills/idea-refine/frameworks.md +99 -0
  1449. package/.versions/2.2.2/skills/idea-refine/refinement-criteria.md +113 -0
  1450. package/.versions/2.2.2/skills/idea-refine/scripts/idea-refine.sh +15 -0
  1451. package/.versions/2.2.2/skills/incremental-implementation/SKILL.md +353 -0
  1452. package/.versions/2.2.2/skills/incremental-implementation.zip +0 -0
  1453. package/.versions/2.2.2/skills/interview-me/SKILL.md +226 -0
  1454. package/.versions/2.2.2/skills/orchestration-verification/SKILL.md +182 -0
  1455. package/.versions/2.2.2/skills/peer-coms/SKILL.md +90 -0
  1456. package/.versions/2.2.2/skills/performance-optimization/SKILL.md +496 -0
  1457. package/.versions/2.2.2/skills/planning-and-task-breakdown/SKILL.md +318 -0
  1458. package/.versions/2.2.2/skills/planning-and-task-breakdown.zip +0 -0
  1459. package/.versions/2.2.2/skills/repository-ai-setup/SKILL.md +135 -0
  1460. package/.versions/2.2.2/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  1461. package/.versions/2.2.2/skills/repository-ai-setup/references/apply-contract.md +74 -0
  1462. package/.versions/2.2.2/skills/repository-ai-setup/references/provenance-template.md +16 -0
  1463. package/.versions/2.2.2/skills/repository-ai-setup/references/setup-flow.md +108 -0
  1464. package/.versions/2.2.2/skills/repository-ai-setup/references/verify-setup.md +20 -0
  1465. package/.versions/2.2.2/skills/repository-ai-setup.zip +0 -0
  1466. package/.versions/2.2.2/skills/security-and-hardening/SKILL.md +524 -0
  1467. package/.versions/2.2.2/skills/spec-driven-development/SKILL.md +295 -0
  1468. package/.versions/2.2.2/skills/spec-driven-development.zip +0 -0
  1469. package/.versions/2.2.2/skills/using-agent-skills/SKILL.md +198 -0
  1470. package/.versions/2.2.2/vendor/agent-skills-upstream/LICENSE +21 -0
  1471. package/.versions/2.2.2/vendor/agent-skills-upstream/README.md +430 -0
  1472. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  1473. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  1474. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  1475. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  1476. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  1477. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  1478. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  1479. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  1480. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  1481. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  1482. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  1483. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  1484. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  1485. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  1486. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  1487. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  1488. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  1489. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  1490. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  1491. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  1492. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  1493. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  1494. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  1495. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  1496. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  1497. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  1498. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  1499. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  1500. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  1501. package/.versions/2.2.2/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  1502. package/.versions/2.2.3/.pi/agent-fleet/hermes/README.md +347 -0
  1503. package/.versions/2.2.3/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  1504. package/.versions/2.2.3/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  1505. package/.versions/2.2.3/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  1506. package/.versions/2.2.3/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  1507. package/.versions/2.2.3/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  1508. package/.versions/2.2.3/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  1509. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  1510. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  1511. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  1512. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  1513. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  1514. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  1515. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  1516. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  1517. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  1518. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  1519. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  1520. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  1521. package/.versions/2.2.3/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  1522. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  1523. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  1524. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  1525. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  1526. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  1527. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  1528. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  1529. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  1530. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  1531. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  1532. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  1533. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  1534. package/.versions/2.2.3/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  1535. package/.versions/2.2.3/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  1536. package/.versions/2.2.3/.pi/agent-fleet/hooks/coms-stop-hook.mjs +124 -0
  1537. package/.versions/2.2.3/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  1538. package/.versions/2.2.3/.pi/agent-fleet/scripts/coms-claude-bridge.ts +440 -0
  1539. package/.versions/2.2.3/.pi/agent-fleet/scripts/coms-cli.ts +430 -0
  1540. package/.versions/2.2.3/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +416 -0
  1541. package/.versions/2.2.3/.pi/agent-fleet/scripts/exec-at-target.ts +10 -0
  1542. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/0.167-shared.json +1900 -0
  1543. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/README.md +223 -0
  1544. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/assessment.md +83 -0
  1545. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile-0.167.json +5627 -0
  1546. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap-profile.md +43 -0
  1547. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/bootstrap.md +45 -0
  1548. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture-profile.ts +53 -0
  1549. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/capture.ts +102 -0
  1550. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/catalog.md +91 -0
  1551. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/channel.md +21 -0
  1552. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurement.md +133 -0
  1553. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/measurements.json +74 -0
  1554. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/notification-profile-0.167.json +2679 -0
  1555. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/observer.md +101 -0
  1556. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/opaque-response.md +57 -0
  1557. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/open-sent.md +68 -0
  1558. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/probe-reader.md +51 -0
  1559. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/profile.md +71 -0
  1560. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/projection.md +147 -0
  1561. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/reconnect.md +40 -0
  1562. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/response-unions.md +74 -0
  1563. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/semver.md +124 -0
  1564. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/codex-notification-contracts/surface.md +73 -0
  1565. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/fleet-codex-allowlist-store-child.ts +31 -0
  1566. package/.versions/2.2.3/.pi/agent-fleet/scripts/fixtures/response-fixture.ts +23 -0
  1567. package/.versions/2.2.3/.pi/agent-fleet/scripts/fleet-codex-local-mcp.mjs +26 -0
  1568. package/.versions/2.2.3/.pi/agent-fleet/scripts/fleet-codex-local-mcp.ts +63 -0
  1569. package/.versions/2.2.3/.pi/agent-fleet/scripts/fleet.ts +244 -0
  1570. package/.versions/2.2.3/.pi/agent-fleet/scripts/flow.ts +166 -0
  1571. package/.versions/2.2.3/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  1572. package/.versions/2.2.3/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  1573. package/.versions/2.2.3/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  1574. package/.versions/2.2.3/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  1575. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  1576. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-bootstrap-files.ts +46 -0
  1577. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-bootstrap-probe.ts +52 -0
  1578. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-bootstrap-producer.ts +131 -0
  1579. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-connection-history.ts +51 -0
  1580. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-daemon-observer.ts +137 -0
  1581. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-desktop-discovery.ts +84 -0
  1582. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-desktop-preflight.ts +130 -0
  1583. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-desktop-queue-host.ts +113 -0
  1584. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-measurement.ts +218 -0
  1585. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-native-presence.ts +61 -0
  1586. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-probe-transcript.ts +135 -0
  1587. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-send-lineage.ts +72 -0
  1588. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/codex-unix-queue-rpc.ts +101 -0
  1589. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  1590. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  1591. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist-store.ts +453 -0
  1592. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-allowlist.ts +175 -0
  1593. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-answer-transport.ts +73 -0
  1594. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-answers.ts +74 -0
  1595. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-bootstrap.ts +207 -0
  1596. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-connections.ts +76 -0
  1597. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-event-reply.ts +58 -0
  1598. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-event-runtime.ts +132 -0
  1599. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-store.ts +428 -0
  1600. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-instruction-transport.ts +160 -0
  1601. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-instructions.ts +175 -0
  1602. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-local-mcp.ts +435 -0
  1603. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-native-history.ts +215 -0
  1604. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-observation-store.ts +208 -0
  1605. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-observe-transport.ts +49 -0
  1606. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-observe.ts +93 -0
  1607. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-overview.ts +52 -0
  1608. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-permission-transport.ts +44 -0
  1609. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-permissions.ts +83 -0
  1610. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-readonly.ts +213 -0
  1611. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-relay-latency.ts +45 -0
  1612. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-response-read.ts +26 -0
  1613. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-response-transport.ts +38 -0
  1614. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-codex-resync.ts +212 -0
  1615. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/fleet-command.ts +264 -0
  1616. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/flow-command.ts +107 -0
  1617. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +239 -0
  1618. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  1619. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  1620. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  1621. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  1622. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  1623. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  1624. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  1625. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  1626. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  1627. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  1628. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/peer-target.ts +1 -0
  1629. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  1630. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  1631. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/resource-closure.js +1 -0
  1632. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  1633. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/session-launch.ts +56 -0
  1634. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  1635. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/team-project.ts +176 -0
  1636. package/.versions/2.2.3/.pi/agent-fleet/scripts/lib/team-snapshot.ts +160 -0
  1637. package/.versions/2.2.3/.pi/agent-fleet/scripts/package-lock.json +57 -0
  1638. package/.versions/2.2.3/.pi/agent-fleet/scripts/package.json +10 -0
  1639. package/.versions/2.2.3/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  1640. package/.versions/2.2.3/.pi/agent-fleet/scripts/peer-launch.ts +289 -0
  1641. package/.versions/2.2.3/.pi/agent-fleet/scripts/pi-session.ts +9 -0
  1642. package/.versions/2.2.3/.pi/agent-fleet/scripts/team-snapshot.ts +245 -0
  1643. package/.versions/2.2.3/.pi/agent-fleet/scripts/team-up.ts +378 -0
  1644. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +181 -0
  1645. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  1646. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  1647. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/env.ts +36 -0
  1648. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  1649. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  1650. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/git.ts +108 -0
  1651. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +130 -0
  1652. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  1653. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  1654. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  1655. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +137 -0
  1656. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  1657. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  1658. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +37 -0
  1659. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/quality.ts +78 -0
  1660. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/run.ts +109 -0
  1661. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  1662. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/trace.ts +52 -0
  1663. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  1664. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/writer-lease-race.worker.mjs +36 -0
  1665. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +148 -0
  1666. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  1667. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  1668. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  1669. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  1670. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  1671. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  1672. package/.versions/2.2.3/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  1673. package/.versions/2.2.3/.pi/agents/dispatch-policy.yaml +32 -0
  1674. package/.versions/2.2.3/.pi/agents/model-profiles.yaml +132 -0
  1675. package/.versions/2.2.3/.pi/agents/peers.yaml +147 -0
  1676. package/.versions/2.2.3/.pi/agents/teams.yaml +41 -0
  1677. package/.versions/2.2.3/.pi/agents/voices.yaml +13 -0
  1678. package/.versions/2.2.3/.pi/damage-control-rules.yaml +297 -0
  1679. package/.versions/2.2.3/.pi/extensions/btw/README.md +120 -0
  1680. package/.versions/2.2.3/.pi/extensions/btw/index.ts +916 -0
  1681. package/.versions/2.2.3/.pi/extensions/btw/package.json +6 -0
  1682. package/.versions/2.2.3/.pi/extensions/btw/state.js +179 -0
  1683. package/.versions/2.2.3/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  1684. package/.versions/2.2.3/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  1685. package/.versions/2.2.3/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  1686. package/.versions/2.2.3/.pi/extensions/compact-and-continue/README.md +42 -0
  1687. package/.versions/2.2.3/.pi/extensions/compact-and-continue/index.ts +136 -0
  1688. package/.versions/2.2.3/.pi/extensions/compact-and-continue/package.json +6 -0
  1689. package/.versions/2.2.3/.pi/extensions/mcp-bridge/README.md +46 -0
  1690. package/.versions/2.2.3/.pi/extensions/mcp-bridge/index.ts +206 -0
  1691. package/.versions/2.2.3/.pi/extensions/mcp-bridge/package.json +6 -0
  1692. package/.versions/2.2.3/.pi/extensions/package-lock.json +1175 -0
  1693. package/.versions/2.2.3/.pi/extensions/package.json +9 -0
  1694. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/README.md +224 -0
  1695. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/config.ts +199 -0
  1696. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  1697. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/index.ts +248 -0
  1698. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/package.json +6 -0
  1699. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  1700. package/.versions/2.2.3/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  1701. package/.versions/2.2.3/.pi/harnesses/agent-hub/README.md +1657 -0
  1702. package/.versions/2.2.3/.pi/harnesses/agent-hub/acceptance.ts +204 -0
  1703. package/.versions/2.2.3/.pi/harnesses/agent-hub/access-approval.ts +266 -0
  1704. package/.versions/2.2.3/.pi/harnesses/agent-hub/action-authorization.ts +10 -0
  1705. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  1706. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  1707. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-hub.ts +55 -0
  1708. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  1709. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  1710. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  1711. package/.versions/2.2.3/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  1712. package/.versions/2.2.3/.pi/harnesses/agent-hub/approval-wait.ts +1 -0
  1713. package/.versions/2.2.3/.pi/harnesses/agent-hub/artifacts.js +146 -0
  1714. package/.versions/2.2.3/.pi/harnesses/agent-hub/assertion-ledger.js +68 -0
  1715. package/.versions/2.2.3/.pi/harnesses/agent-hub/assist-profile.ts +19 -0
  1716. package/.versions/2.2.3/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  1717. package/.versions/2.2.3/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  1718. package/.versions/2.2.3/.pi/harnesses/agent-hub/budget-recovery.ts +151 -0
  1719. package/.versions/2.2.3/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  1720. package/.versions/2.2.3/.pi/harnesses/agent-hub/capability-packs.ts +187 -0
  1721. package/.versions/2.2.3/.pi/harnesses/agent-hub/codex-bootstrap.ts +117 -0
  1722. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  1723. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  1724. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  1725. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  1726. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  1727. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  1728. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  1729. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  1730. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  1731. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  1732. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  1733. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  1734. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  1735. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  1736. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/config.ts +9 -0
  1737. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  1738. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/context.ts +43 -0
  1739. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  1740. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  1741. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  1742. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  1743. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  1744. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  1745. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/recover.ts +81 -0
  1746. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  1747. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  1748. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  1749. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  1750. package/.versions/2.2.3/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  1751. package/.versions/2.2.3/.pi/harnesses/agent-hub/config/agents.ts +183 -0
  1752. package/.versions/2.2.3/.pi/harnesses/agent-hub/config/model-profiles.ts +240 -0
  1753. package/.versions/2.2.3/.pi/harnesses/agent-hub/config/overrides.ts +166 -0
  1754. package/.versions/2.2.3/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  1755. package/.versions/2.2.3/.pi/harnesses/agent-hub/context/assertion-journal.ts +133 -0
  1756. package/.versions/2.2.3/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +234 -0
  1757. package/.versions/2.2.3/.pi/harnesses/agent-hub/context/budgets.ts +152 -0
  1758. package/.versions/2.2.3/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  1759. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  1760. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-compaction-monitor.ts +35 -0
  1761. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-compaction-preflight.ts +21 -0
  1762. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-compaction-runtime.ts +69 -0
  1763. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-compaction.ts +34 -0
  1764. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-broker.ts +44 -0
  1765. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-child.ts +83 -0
  1766. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-client.ts +22 -0
  1767. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-compat.ts +45 -0
  1768. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-owners.ts +17 -0
  1769. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity-registry.ts +8 -0
  1770. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-continuity.ts +82 -0
  1771. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-pressure.ts +222 -0
  1772. package/.versions/2.2.3/.pi/harnesses/agent-hub/context-window.js +108 -0
  1773. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-approval.ts +83 -0
  1774. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-broker.ts +125 -0
  1775. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-contract.ts +22 -0
  1776. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-descendant.ts +76 -0
  1777. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-hub.ts +263 -0
  1778. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-identity.ts +12 -0
  1779. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-owners.ts +59 -0
  1780. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-state.ts +43 -0
  1781. package/.versions/2.2.3/.pi/harnesses/agent-hub/damage-guard-test-tsconfig.json +19 -0
  1782. package/.versions/2.2.3/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  1783. package/.versions/2.2.3/.pi/harnesses/agent-hub/delegate.ts +478 -0
  1784. package/.versions/2.2.3/.pi/harnesses/agent-hub/deterministic-fs.ts +195 -0
  1785. package/.versions/2.2.3/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  1786. package/.versions/2.2.3/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  1787. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-coms.ts +258 -0
  1788. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  1789. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-native-complete.ts +176 -0
  1790. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +318 -0
  1791. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +264 -0
  1792. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-native-types.ts +297 -0
  1793. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-native.ts +242 -0
  1794. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  1795. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  1796. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  1797. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  1798. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  1799. package/.versions/2.2.3/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  1800. package/.versions/2.2.3/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  1801. package/.versions/2.2.3/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  1802. package/.versions/2.2.3/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  1803. package/.versions/2.2.3/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  1804. package/.versions/2.2.3/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  1805. package/.versions/2.2.3/.pi/harnesses/agent-hub/drift-watchdog.js +344 -0
  1806. package/.versions/2.2.3/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  1807. package/.versions/2.2.3/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  1808. package/.versions/2.2.3/.pi/harnesses/agent-hub/execution-evidence.ts +96 -0
  1809. package/.versions/2.2.3/.pi/harnesses/agent-hub/execution-trace.ts +241 -0
  1810. package/.versions/2.2.3/.pi/harnesses/agent-hub/external-blocker.js +92 -0
  1811. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/adapters.ts +88 -0
  1812. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +62 -0
  1813. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/broker.ts +128 -0
  1814. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +42 -0
  1815. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/descendant.ts +67 -0
  1816. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  1817. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  1818. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +57 -0
  1819. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/hub.ts +170 -0
  1820. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  1821. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +108 -0
  1822. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/owners.ts +100 -0
  1823. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/results.ts +55 -0
  1824. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/runtime.ts +130 -0
  1825. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/semantic-profiles.ts +18 -0
  1826. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  1827. package/.versions/2.2.3/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  1828. package/.versions/2.2.3/.pi/harnesses/agent-hub/filesystem-tool.ts +166 -0
  1829. package/.versions/2.2.3/.pi/harnesses/agent-hub/fixtures/registration-surface.json +69 -0
  1830. package/.versions/2.2.3/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  1831. package/.versions/2.2.3/.pi/harnesses/agent-hub/footer.ts +29 -0
  1832. package/.versions/2.2.3/.pi/harnesses/agent-hub/helpers.ts +269 -0
  1833. package/.versions/2.2.3/.pi/harnesses/agent-hub/history-projection.ts +116 -0
  1834. package/.versions/2.2.3/.pi/harnesses/agent-hub/hub-state-audit.js +41 -0
  1835. package/.versions/2.2.3/.pi/harnesses/agent-hub/index.ts +2805 -0
  1836. package/.versions/2.2.3/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  1837. package/.versions/2.2.3/.pi/harnesses/agent-hub/input/shortcuts.ts +16 -0
  1838. package/.versions/2.2.3/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +231 -0
  1839. package/.versions/2.2.3/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  1840. package/.versions/2.2.3/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  1841. package/.versions/2.2.3/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +90 -0
  1842. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  1843. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  1844. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  1845. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  1846. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  1847. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  1848. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  1849. package/.versions/2.2.3/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  1850. package/.versions/2.2.3/.pi/harnesses/agent-hub/no-progress.ts +741 -0
  1851. package/.versions/2.2.3/.pi/harnesses/agent-hub/operator-current-state.ts +102 -0
  1852. package/.versions/2.2.3/.pi/harnesses/agent-hub/operator-watchdog.ts +97 -0
  1853. package/.versions/2.2.3/.pi/harnesses/agent-hub/orchestration-activation.ts +109 -0
  1854. package/.versions/2.2.3/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  1855. package/.versions/2.2.3/.pi/harnesses/agent-hub/orchestration-route.ts +68 -0
  1856. package/.versions/2.2.3/.pi/harnesses/agent-hub/package.json +7 -0
  1857. package/.versions/2.2.3/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  1858. package/.versions/2.2.3/.pi/harnesses/agent-hub/permission-channel.ts +87 -0
  1859. package/.versions/2.2.3/.pi/harnesses/agent-hub/permission-relay.ts +84 -0
  1860. package/.versions/2.2.3/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  1861. package/.versions/2.2.3/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  1862. package/.versions/2.2.3/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  1863. package/.versions/2.2.3/.pi/harnesses/agent-hub/policy/roster.ts +103 -0
  1864. package/.versions/2.2.3/.pi/harnesses/agent-hub/policy/work-mode.ts +104 -0
  1865. package/.versions/2.2.3/.pi/harnesses/agent-hub/poll-command.ts +184 -0
  1866. package/.versions/2.2.3/.pi/harnesses/agent-hub/presentation.ts +54 -0
  1867. package/.versions/2.2.3/.pi/harnesses/agent-hub/private-config-current-state.ts +81 -0
  1868. package/.versions/2.2.3/.pi/harnesses/agent-hub/private-config-fixtures.ts +26 -0
  1869. package/.versions/2.2.3/.pi/harnesses/agent-hub/private-config-review.ts +100 -0
  1870. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-config.ts +22 -0
  1871. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  1872. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  1873. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  1874. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  1875. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  1876. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  1877. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  1878. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  1879. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  1880. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  1881. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  1882. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-snapshot.ts +287 -0
  1883. package/.versions/2.2.3/.pi/harnesses/agent-hub/proactive-types.ts +70 -0
  1884. package/.versions/2.2.3/.pi/harnesses/agent-hub/process-obligations.ts +210 -0
  1885. package/.versions/2.2.3/.pi/harnesses/agent-hub/prompts/context.ts +72 -0
  1886. package/.versions/2.2.3/.pi/harnesses/agent-hub/prompts/fragments.ts +94 -0
  1887. package/.versions/2.2.3/.pi/harnesses/agent-hub/prompts/session-start.ts +89 -0
  1888. package/.versions/2.2.3/.pi/harnesses/agent-hub/prompts/system-prompt.ts +142 -0
  1889. package/.versions/2.2.3/.pi/harnesses/agent-hub/provider-semaphore.js +143 -0
  1890. package/.versions/2.2.3/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  1891. package/.versions/2.2.3/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  1892. package/.versions/2.2.3/.pi/harnesses/agent-hub/recover-state.ts +144 -0
  1893. package/.versions/2.2.3/.pi/harnesses/agent-hub/recovery-continuation.ts +134 -0
  1894. package/.versions/2.2.3/.pi/harnesses/agent-hub/recovery-contract.ts +151 -0
  1895. package/.versions/2.2.3/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  1896. package/.versions/2.2.3/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  1897. package/.versions/2.2.3/.pi/harnesses/agent-hub/research/runtime.ts +215 -0
  1898. package/.versions/2.2.3/.pi/harnesses/agent-hub/research/spawn-run.ts +221 -0
  1899. package/.versions/2.2.3/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  1900. package/.versions/2.2.3/.pi/harnesses/agent-hub/return-contract.js +371 -0
  1901. package/.versions/2.2.3/.pi/harnesses/agent-hub/return-extract.js +77 -0
  1902. package/.versions/2.2.3/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  1903. package/.versions/2.2.3/.pi/harnesses/agent-hub/review-continuity.ts +76 -0
  1904. package/.versions/2.2.3/.pi/harnesses/agent-hub/review-findings.js +96 -0
  1905. package/.versions/2.2.3/.pi/harnesses/agent-hub/review-reuse.ts +48 -0
  1906. package/.versions/2.2.3/.pi/harnesses/agent-hub/review-verdict.ts +6 -0
  1907. package/.versions/2.2.3/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  1908. package/.versions/2.2.3/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  1909. package/.versions/2.2.3/.pi/harnesses/agent-hub/run-budget.js +362 -0
  1910. package/.versions/2.2.3/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  1911. package/.versions/2.2.3/.pi/harnesses/agent-hub/runtime-receipts.ts +63 -0
  1912. package/.versions/2.2.3/.pi/harnesses/agent-hub/runtime-test-check.ts +85 -0
  1913. package/.versions/2.2.3/.pi/harnesses/agent-hub/safety-routing.ts +28 -0
  1914. package/.versions/2.2.3/.pi/harnesses/agent-hub/scope-gate.js +271 -0
  1915. package/.versions/2.2.3/.pi/harnesses/agent-hub/scope-overlap.ts +46 -0
  1916. package/.versions/2.2.3/.pi/harnesses/agent-hub/session-audit.ts +331 -0
  1917. package/.versions/2.2.3/.pi/harnesses/agent-hub/session-health.js +110 -0
  1918. package/.versions/2.2.3/.pi/harnesses/agent-hub/session-start.ts +42 -0
  1919. package/.versions/2.2.3/.pi/harnesses/agent-hub/spawn.ts +702 -0
  1920. package/.versions/2.2.3/.pi/harnesses/agent-hub/specialist-result-receipt.ts +13 -0
  1921. package/.versions/2.2.3/.pi/harnesses/agent-hub/specialist-result.ts +78 -0
  1922. package/.versions/2.2.3/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  1923. package/.versions/2.2.3/.pi/harnesses/agent-hub/system1-communication-store.ts +225 -0
  1924. package/.versions/2.2.3/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  1925. package/.versions/2.2.3/.pi/harnesses/agent-hub/system1-runtime.ts +271 -0
  1926. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-brief.ts +98 -0
  1927. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-continuation.ts +4 -0
  1928. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-resume-contract.ts +80 -0
  1929. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-authorization.ts +170 -0
  1930. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-config.ts +21 -0
  1931. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  1932. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  1933. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-obligations.ts +120 -0
  1934. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  1935. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  1936. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  1937. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  1938. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-runtime.ts +132 -0
  1939. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  1940. package/.versions/2.2.3/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  1941. package/.versions/2.2.3/.pi/harnesses/agent-hub/timeline.ts +72 -0
  1942. package/.versions/2.2.3/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +83 -0
  1943. package/.versions/2.2.3/.pi/harnesses/agent-hub/tool-catalog-state.ts +125 -0
  1944. package/.versions/2.2.3/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  1945. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/action-executors.ts +237 -0
  1946. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  1947. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  1948. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  1949. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/context.ts +151 -0
  1950. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +93 -0
  1951. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +971 -0
  1952. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  1953. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +23 -0
  1954. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/fleet-tools.ts +201 -0
  1955. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/herdr-executors.ts +100 -0
  1956. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/poll-panel-core.ts +30 -0
  1957. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/poll-panel.ts +33 -0
  1958. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/recover-task.ts +16 -0
  1959. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/run-flow.ts +177 -0
  1960. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  1961. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  1962. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  1963. package/.versions/2.2.3/.pi/harnesses/agent-hub/tools/verification-contract.ts +81 -0
  1964. package/.versions/2.2.3/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  1965. package/.versions/2.2.3/.pi/harnesses/agent-hub/types.ts +66 -0
  1966. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  1967. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/context-budget.ts +89 -0
  1968. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  1969. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  1970. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +173 -0
  1971. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  1972. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  1973. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  1974. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  1975. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  1976. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  1977. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  1978. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  1979. package/.versions/2.2.3/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  1980. package/.versions/2.2.3/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  1981. package/.versions/2.2.3/.pi/harnesses/agent-hub/verification-diagnostics.ts +23 -0
  1982. package/.versions/2.2.3/.pi/harnesses/agent-hub/version.ts +42 -0
  1983. package/.versions/2.2.3/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  1984. package/.versions/2.2.3/.pi/harnesses/agent-hub/work-mode.ts +185 -0
  1985. package/.versions/2.2.3/.pi/harnesses/agent-hub/write-isolation.ts +232 -0
  1986. package/.versions/2.2.3/.pi/harnesses/ask-user-remote/README.md +59 -0
  1987. package/.versions/2.2.3/.pi/harnesses/ask-user-remote/index.ts +571 -0
  1988. package/.versions/2.2.3/.pi/harnesses/ask-user-remote/questions.ts +206 -0
  1989. package/.versions/2.2.3/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  1990. package/.versions/2.2.3/.pi/harnesses/ask-user-remote/runtime-ask.ts +90 -0
  1991. package/.versions/2.2.3/.pi/harnesses/coms/README.md +105 -0
  1992. package/.versions/2.2.3/.pi/harnesses/coms/index.ts +308 -0
  1993. package/.versions/2.2.3/.pi/harnesses/coms/package.json +7 -0
  1994. package/.versions/2.2.3/.pi/harnesses/coms/version.ts +42 -0
  1995. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/README.md +161 -0
  1996. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/index.ts +661 -0
  1997. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/package.json +7 -0
  1998. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/result-screen.ts +98 -0
  1999. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/system1-child.ts +45 -0
  2000. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/system1-client.ts +85 -0
  2001. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/system1-guard.ts +65 -0
  2002. package/.versions/2.2.3/.pi/harnesses/damage-control-continue/version.ts +42 -0
  2003. package/.versions/2.2.3/.pi/harnesses/lib/approval-wait.ts +17 -0
  2004. package/.versions/2.2.3/.pi/harnesses/lib/bash-policy-analysis.ts +193 -0
  2005. package/.versions/2.2.3/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  2006. package/.versions/2.2.3/.pi/harnesses/lib/clarification-policy.ts +9 -0
  2007. package/.versions/2.2.3/.pi/harnesses/lib/codex-compat.ts +97 -0
  2008. package/.versions/2.2.3/.pi/harnesses/lib/codex-contract.ts +259 -0
  2009. package/.versions/2.2.3/.pi/harnesses/lib/codex-notification-profile.ts +75 -0
  2010. package/.versions/2.2.3/.pi/harnesses/lib/coms-core-io.ts +422 -0
  2011. package/.versions/2.2.3/.pi/harnesses/lib/coms-core.ts +738 -0
  2012. package/.versions/2.2.3/.pi/harnesses/lib/coms-instruction-receipts.ts +113 -0
  2013. package/.versions/2.2.3/.pi/harnesses/lib/coms-observation.ts +74 -0
  2014. package/.versions/2.2.3/.pi/harnesses/lib/coms-registry-entry.ts +99 -0
  2015. package/.versions/2.2.3/.pi/harnesses/lib/coms-response-read.ts +107 -0
  2016. package/.versions/2.2.3/.pi/harnesses/lib/context-budget-child-prompt.ts +214 -0
  2017. package/.versions/2.2.3/.pi/harnesses/lib/context-budget-hub-prompt.ts +124 -0
  2018. package/.versions/2.2.3/.pi/harnesses/lib/context-budget-view.ts +112 -0
  2019. package/.versions/2.2.3/.pi/harnesses/lib/context-budget.ts +114 -0
  2020. package/.versions/2.2.3/.pi/harnesses/lib/context-compaction-policy.js +35 -0
  2021. package/.versions/2.2.3/.pi/harnesses/lib/damage-action-hash.ts +28 -0
  2022. package/.versions/2.2.3/.pi/harnesses/lib/damage-auto-policy.ts +52 -0
  2023. package/.versions/2.2.3/.pi/harnesses/lib/damage-control-presentation.ts +14 -0
  2024. package/.versions/2.2.3/.pi/harnesses/lib/damage-control-shared.ts +276 -0
  2025. package/.versions/2.2.3/.pi/harnesses/lib/damage-guard-port.ts +25 -0
  2026. package/.versions/2.2.3/.pi/harnesses/lib/damage-policy.ts +35 -0
  2027. package/.versions/2.2.3/.pi/harnesses/lib/damage-result-evidence.ts +25 -0
  2028. package/.versions/2.2.3/.pi/harnesses/lib/damage-result-view.ts +16 -0
  2029. package/.versions/2.2.3/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  2030. package/.versions/2.2.3/.pi/harnesses/lib/exact-permission-port.ts +40 -0
  2031. package/.versions/2.2.3/.pi/harnesses/lib/execution-trace.ts +45 -0
  2032. package/.versions/2.2.3/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  2033. package/.versions/2.2.3/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  2034. package/.versions/2.2.3/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  2035. package/.versions/2.2.3/.pi/harnesses/lib/fleet-bootstrap-channel.ts +148 -0
  2036. package/.versions/2.2.3/.pi/harnesses/lib/fleet-codex-catalog.ts +30 -0
  2037. package/.versions/2.2.3/.pi/harnesses/lib/fleet-codex-chat-view.ts +55 -0
  2038. package/.versions/2.2.3/.pi/harnesses/lib/fleet-codex-event-bridge.ts +82 -0
  2039. package/.versions/2.2.3/.pi/harnesses/lib/fleet-codex-namespace.ts +2 -0
  2040. package/.versions/2.2.3/.pi/harnesses/lib/fleet-codex-policy-snapshot.ts +10 -0
  2041. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/cli-bridge.ts +111 -0
  2042. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/mutations.ts +201 -0
  2043. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/snapshot.ts +417 -0
  2044. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/transition.ts +68 -0
  2045. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/ui.ts +269 -0
  2046. package/.versions/2.2.3/.pi/harnesses/lib/fleet-config/view.ts +338 -0
  2047. package/.versions/2.2.3/.pi/harnesses/lib/fleet-connection-control.ts +94 -0
  2048. package/.versions/2.2.3/.pi/harnesses/lib/fleet-connection-diagnostics.ts +7 -0
  2049. package/.versions/2.2.3/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  2050. package/.versions/2.2.3/.pi/harnesses/lib/fleet-dashboard-view.ts +174 -0
  2051. package/.versions/2.2.3/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  2052. package/.versions/2.2.3/.pi/harnesses/lib/fleet-event-source.ts +21 -0
  2053. package/.versions/2.2.3/.pi/harnesses/lib/fleet-notification-admission.ts +32 -0
  2054. package/.versions/2.2.3/.pi/harnesses/lib/fleet-notification-bootstrap.ts +172 -0
  2055. package/.versions/2.2.3/.pi/harnesses/lib/fleet-notification-validation.ts +122 -0
  2056. package/.versions/2.2.3/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  2057. package/.versions/2.2.3/.pi/harnesses/lib/fleet-panel.ts +34 -0
  2058. package/.versions/2.2.3/.pi/harnesses/lib/fleet-question-reference.ts +42 -0
  2059. package/.versions/2.2.3/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  2060. package/.versions/2.2.3/.pi/harnesses/lib/fleet-selection.ts +24 -0
  2061. package/.versions/2.2.3/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  2062. package/.versions/2.2.3/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  2063. package/.versions/2.2.3/.pi/harnesses/lib/fleet-target-identity.ts +9 -0
  2064. package/.versions/2.2.3/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  2065. package/.versions/2.2.3/.pi/harnesses/lib/herdr-client.ts +472 -0
  2066. package/.versions/2.2.3/.pi/harnesses/lib/herdr-presence.ts +399 -0
  2067. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  2068. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  2069. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  2070. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  2071. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  2072. package/.versions/2.2.3/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  2073. package/.versions/2.2.3/.pi/harnesses/lib/identical-dialog.ts +27 -0
  2074. package/.versions/2.2.3/.pi/harnesses/lib/installation-state.js +62 -0
  2075. package/.versions/2.2.3/.pi/harnesses/lib/peer-target.ts +24 -0
  2076. package/.versions/2.2.3/.pi/harnesses/lib/policy-roots.js +117 -0
  2077. package/.versions/2.2.3/.pi/harnesses/lib/policy-roots.ts +32 -0
  2078. package/.versions/2.2.3/.pi/harnesses/lib/process-shared.ts +9 -0
  2079. package/.versions/2.2.3/.pi/harnesses/lib/resource-closure.js +26 -0
  2080. package/.versions/2.2.3/.pi/harnesses/lib/safe-source-read.js +29 -0
  2081. package/.versions/2.2.3/.pi/harnesses/lib/semantic-approval.ts +80 -0
  2082. package/.versions/2.2.3/.pi/harnesses/lib/session-target.ts +62 -0
  2083. package/.versions/2.2.3/.pi/harnesses/lib/spawned-peers.js +191 -0
  2084. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  2085. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-context-compaction.js +16 -0
  2086. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-damage-guard.js +24 -0
  2087. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-file-discovery.js +23 -0
  2088. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-json.js +37 -0
  2089. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-loader.js +53 -0
  2090. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  2091. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-triage.js +42 -0
  2092. package/.versions/2.2.3/.pi/harnesses/lib/system1/config-v2.js +112 -0
  2093. package/.versions/2.2.3/.pi/harnesses/lib/system1/config.js +50 -0
  2094. package/.versions/2.2.3/.pi/harnesses/lib/system1/contracts.ts +154 -0
  2095. package/.versions/2.2.3/.pi/harnesses/lib/system1/demo.ts +95 -0
  2096. package/.versions/2.2.3/.pi/harnesses/lib/system1/jev.ts +503 -0
  2097. package/.versions/2.2.3/.pi/harnesses/lib/system1/payload-screen.ts +65 -0
  2098. package/.versions/2.2.3/.pi/harnesses/lib/system1/selection.js +11 -0
  2099. package/.versions/2.2.3/.pi/harnesses/lib/system1/service.ts +245 -0
  2100. package/.versions/2.2.3/.pi/harnesses/lib/system1/worktree-scopes.js +110 -0
  2101. package/.versions/2.2.3/.pi/harnesses/lib/system1/worktree-scopes.ts +13 -0
  2102. package/.versions/2.2.3/.pi/harnesses/lib/system1/worktree-service.ts +24 -0
  2103. package/.versions/2.2.3/.pi/harnesses/lib/target-capabilities.js +7 -0
  2104. package/.versions/2.2.3/.pi/harnesses/lib/update-check.ts +227 -0
  2105. package/.versions/2.2.3/.pi/harnesses/lib/workspace-context.js +115 -0
  2106. package/.versions/2.2.3/.pi/harnesses/lib/workspace-context.ts +22 -0
  2107. package/.versions/2.2.3/.pi/harnesses/package-lock.json +2121 -0
  2108. package/.versions/2.2.3/.pi/harnesses/package.json +13 -0
  2109. package/.versions/2.2.3/.pi/prompts/af-build.md +27 -0
  2110. package/.versions/2.2.3/.pi/prompts/af-code-simplify.md +22 -0
  2111. package/.versions/2.2.3/.pi/prompts/af-constraints.md +31 -0
  2112. package/.versions/2.2.3/.pi/prompts/af-plan.md +17 -0
  2113. package/.versions/2.2.3/.pi/prompts/af-review.md +16 -0
  2114. package/.versions/2.2.3/.pi/prompts/af-set-hermes-telegram.md +15 -0
  2115. package/.versions/2.2.3/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  2116. package/.versions/2.2.3/.pi/prompts/af-setup-rules.md +20 -0
  2117. package/.versions/2.2.3/.pi/prompts/af-ship.md +17 -0
  2118. package/.versions/2.2.3/.pi/prompts/af-spec.md +15 -0
  2119. package/.versions/2.2.3/.pi/prompts/af-test.md +19 -0
  2120. package/.versions/2.2.3/.pi/skills/bowser/SKILL.md +145 -0
  2121. package/.versions/2.2.3/.version +1 -0
  2122. package/.versions/2.2.3/agents/architect.md +24 -0
  2123. package/.versions/2.2.3/agents/bowser.md +28 -0
  2124. package/.versions/2.2.3/agents/builder.md +55 -0
  2125. package/.versions/2.2.3/agents/code-reviewer.md +209 -0
  2126. package/.versions/2.2.3/agents/deep-researcher.md +32 -0
  2127. package/.versions/2.2.3/agents/documenter.md +22 -0
  2128. package/.versions/2.2.3/agents/plan-reviewer.md +83 -0
  2129. package/.versions/2.2.3/agents/planner.md +107 -0
  2130. package/.versions/2.2.3/agents/releaser.md +24 -0
  2131. package/.versions/2.2.3/agents/researcher.md +30 -0
  2132. package/.versions/2.2.3/agents/security-auditor.md +167 -0
  2133. package/.versions/2.2.3/agents/test-engineer.md +153 -0
  2134. package/.versions/2.2.3/agents/web-debugger.md +44 -0
  2135. package/.versions/2.2.3/agents/web-performance-auditor.md +194 -0
  2136. package/.versions/2.2.3/bin/catalog/harness-runtime-closure.json +85 -0
  2137. package/.versions/2.2.3/docs/ARCHITECTURE.md +1291 -0
  2138. package/.versions/2.2.3/docs/agent-fleet-setup.md +1161 -0
  2139. package/.versions/2.2.3/docs/claude-code-coms-bridge.md +147 -0
  2140. package/.versions/2.2.3/docs/codex-local-mcp.md +520 -0
  2141. package/.versions/2.2.3/docs/codex-session-bridge.md +44 -0
  2142. package/.versions/2.2.3/docs/codex-setup.md +183 -0
  2143. package/.versions/2.2.3/docs/coms-hermes-bridge.md +188 -0
  2144. package/.versions/2.2.3/docs/fleet-native-voice.md +151 -0
  2145. package/.versions/2.2.3/docs/getting-started.md +126 -0
  2146. package/.versions/2.2.3/docs/npm-install.md +535 -0
  2147. package/.versions/2.2.3/docs/pi-extensions.md +450 -0
  2148. package/.versions/2.2.3/docs/pi-setup.md +92 -0
  2149. package/.versions/2.2.3/docs/skill-anatomy.md +150 -0
  2150. package/.versions/2.2.3/install-manifest.json +3227 -0
  2151. package/.versions/2.2.3/justfile +246 -0
  2152. package/.versions/2.2.3/manifest-meta.json +1099 -0
  2153. package/.versions/2.2.3/references/accessibility-checklist.md +160 -0
  2154. package/.versions/2.2.3/references/communication-contract.md +26 -0
  2155. package/.versions/2.2.3/references/definition-of-done.md +67 -0
  2156. package/.versions/2.2.3/references/fleet-coordination-patterns.md +171 -0
  2157. package/.versions/2.2.3/references/observability-checklist.md +92 -0
  2158. package/.versions/2.2.3/references/orchestration-patterns.md +370 -0
  2159. package/.versions/2.2.3/references/performance-checklist.md +236 -0
  2160. package/.versions/2.2.3/references/prompting-patterns.md +380 -0
  2161. package/.versions/2.2.3/references/security-checklist.md +245 -0
  2162. package/.versions/2.2.3/references/testing-patterns.md +235 -0
  2163. package/.versions/2.2.3/references/workflow-authoring.md +304 -0
  2164. package/.versions/2.2.3/skills/_internal/grilling.md +59 -0
  2165. package/.versions/2.2.3/skills/browser-testing-with-devtools/SKILL.md +351 -0
  2166. package/.versions/2.2.3/skills/code-review-and-quality/SKILL.md +396 -0
  2167. package/.versions/2.2.3/skills/compound-learning/SKILL.md +137 -0
  2168. package/.versions/2.2.3/skills/constraint-driven-development/SKILL.md +338 -0
  2169. package/.versions/2.2.3/skills/constraint-driven-development/references/floor-guard.md +99 -0
  2170. package/.versions/2.2.3/skills/context-engineering/SKILL.md +341 -0
  2171. package/.versions/2.2.3/skills/deprecation-and-migration/SKILL.md +247 -0
  2172. package/.versions/2.2.3/skills/designing-agents/SKILL.md +394 -0
  2173. package/.versions/2.2.3/skills/designing-agents/pi-harness-authoring.md +222 -0
  2174. package/.versions/2.2.3/skills/drafting-workflows/SKILL.md +143 -0
  2175. package/.versions/2.2.3/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  2176. package/.versions/2.2.3/skills/fleet-connect/SKILL.md +29 -0
  2177. package/.versions/2.2.3/skills/fleet-connect.zip +0 -0
  2178. package/.versions/2.2.3/skills/fleet-native-voice/SKILL.md +103 -0
  2179. package/.versions/2.2.3/skills/fleet-native-voice/agents/openai.yaml +4 -0
  2180. package/.versions/2.2.3/skills/fleet-native-voice.zip +0 -0
  2181. package/.versions/2.2.3/skills/frontend-ui-engineering/SKILL.md +328 -0
  2182. package/.versions/2.2.3/skills/git-workflow-and-versioning/SKILL.md +316 -0
  2183. package/.versions/2.2.3/skills/idea-refine/SKILL.md +182 -0
  2184. package/.versions/2.2.3/skills/idea-refine/examples.md +238 -0
  2185. package/.versions/2.2.3/skills/idea-refine/frameworks.md +99 -0
  2186. package/.versions/2.2.3/skills/idea-refine/refinement-criteria.md +113 -0
  2187. package/.versions/2.2.3/skills/idea-refine/scripts/idea-refine.sh +15 -0
  2188. package/.versions/2.2.3/skills/incremental-implementation/SKILL.md +353 -0
  2189. package/.versions/2.2.3/skills/incremental-implementation.zip +0 -0
  2190. package/.versions/2.2.3/skills/interview-me/SKILL.md +226 -0
  2191. package/.versions/2.2.3/skills/orchestration-verification/SKILL.md +182 -0
  2192. package/.versions/2.2.3/skills/peer-coms/SKILL.md +90 -0
  2193. package/.versions/2.2.3/skills/performance-optimization/SKILL.md +496 -0
  2194. package/.versions/2.2.3/skills/planning-and-task-breakdown/SKILL.md +318 -0
  2195. package/.versions/2.2.3/skills/planning-and-task-breakdown.zip +0 -0
  2196. package/.versions/2.2.3/skills/repository-ai-setup/SKILL.md +135 -0
  2197. package/.versions/2.2.3/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  2198. package/.versions/2.2.3/skills/repository-ai-setup/references/apply-contract.md +74 -0
  2199. package/.versions/2.2.3/skills/repository-ai-setup/references/provenance-template.md +16 -0
  2200. package/.versions/2.2.3/skills/repository-ai-setup/references/setup-flow.md +108 -0
  2201. package/.versions/2.2.3/skills/repository-ai-setup/references/verify-setup.md +20 -0
  2202. package/.versions/2.2.3/skills/repository-ai-setup.zip +0 -0
  2203. package/.versions/2.2.3/skills/security-and-hardening/SKILL.md +524 -0
  2204. package/.versions/2.2.3/skills/spec-driven-development/SKILL.md +295 -0
  2205. package/.versions/2.2.3/skills/spec-driven-development.zip +0 -0
  2206. package/.versions/2.2.3/skills/using-agent-skills/SKILL.md +198 -0
  2207. package/.versions/2.2.3/vendor/agent-skills-upstream/LICENSE +21 -0
  2208. package/.versions/2.2.3/vendor/agent-skills-upstream/README.md +430 -0
  2209. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  2210. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  2211. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  2212. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  2213. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  2214. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  2215. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  2216. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  2217. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  2218. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  2219. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  2220. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  2221. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  2222. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  2223. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  2224. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  2225. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  2226. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  2227. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  2228. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  2229. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  2230. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  2231. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  2232. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  2233. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  2234. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  2235. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  2236. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  2237. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  2238. package/.versions/2.2.3/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  2239. package/CHANGELOG.md +48 -0
  2240. package/docs/hub-task-continuation.md +23 -0
  2241. package/install-manifest.json +2 -1
  2242. package/manifest-meta.json +1 -0
  2243. package/package.json +4 -3
@@ -0,0 +1,2805 @@
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 { createRecoveryContinuation } from './recovery-continuation.ts';
31
+ import { registerRecoverTask } from './tools/recover-task.ts';
32
+ import { createNoProgressGuard, processRecoveryAttempts } from "./no-progress.ts";
33
+ import { renderNextInvocation, renderRecoverCommands } from './recover-policy.ts';
34
+ import { closeEvidenceSession, pruneEvidenceSessions } from "./execution-evidence.ts";
35
+ import { hasExplicitDispatcher, isCompleteProfile, dispatcherSelection, type ModelProfiles } from './config/model-profiles.ts';
36
+ import { createProfileActivation } from './policy/profile-activation.ts';
37
+ import { readActiveProfile, profileWorkInFlight, withProfileWork, assertProfileModel, profilePeerGate } from './policy/profile-runtime.ts';
38
+ import { resolveAssist } from './assist-profile.ts';
39
+ import { registerFilesystemTool, FILESYSTEM_POLICY_ROOTS_ENV } from './filesystem-tool.ts';
40
+ /** Agent Hub composition root: constructs mutable state, contexts, registrars, and ordered lifecycle ports. */
41
+
42
+ import type { AgentDef, AgentState, ResearchState } from "./types.ts";
43
+ import { DEFAULT_OVERRIDES, THINKING_LEVELS, parseAgentTeamOverrides, type AgentTeamOverrides } from "./config/overrides.ts";
44
+ import { loadAgentConfiguration } from "./config/agents.ts";
45
+ import { abbrevThinking, displayName, extractAskUserQuestions, extractNeedsResearch, resolveDelegateExtension, resolveThinkingLevel } from "./presentation.ts";
46
+ import { MAX_LIVE_ENTRY_CHARS, appendTimelineEvent, appendTimelineText, flushTimelineStore } from "./timeline.ts";
47
+ import type { ExtensionAPI, ExtensionContext, Theme } from "@mariozechner/pi-coding-agent";
48
+ import { DynamicBorder, getMarkdownTheme as getPiMdTheme, copyToClipboard } from "@mariozechner/pi-coding-agent";
49
+ import {
50
+ Text, Box, Container, Spacer, Markdown, matchesKey, Key,
51
+ type AutocompleteItem, truncateToWidth, visibleWidth,
52
+ } from "@mariozechner/pi-tui";
53
+ import { spawn, type ChildProcess } from "child_process";
54
+ import { spawnPiAgent, spawnPiAgentWithModelFallback, killPiTree, type Termination } from "./spawn.ts";
55
+ import { fenceOperatorCancel } from "./drift-runtime.ts";
56
+ import { researchTerminationOutcome, researchWatchdogSpawnOptions } from "./research-watchdog.ts";
57
+ import { composeFleetFooterHint, renderHubFooterLeft } from "./footer.ts";
58
+ import { HARNESS_VERSION, registerVersionStatus } from "./version.ts";
59
+ import { cancelLocalOwnedProcess, cancelLocalWaitOnly, monitorKeyForAgent } from "./monitor-control.ts";
60
+ import { createMonitorLifecycle } from "./monitor-lifecycle.ts";
61
+ import { createMonitorSessionBridge } from "./monitor-session-bridge.ts";
62
+ import {
63
+ AGENT_ID_ENV, ASK_ENDPOINT_ENV, EXEMPTIONS_FILE_ENV,
64
+ exemptionsFilePath, type AccessRequest,
65
+ } from "../lib/damage-control-shared.ts";
66
+ import { applyModelOverride, clampDelegateDepth, fallbackModelFor, isReadOnlyToolList, MAX_DELEGATE_DEPTH, normalizeAgentInput, parseTeamsYaml, safeAgentKey, safePathWithin, taskFingerprint, upsertTeamInYaml } from "./helpers.ts";
67
+ import { DEFAULT_TASK_TIER, addTaskClockWait, applyTierChange, basePersonaName, blockingFindingCap, checkTierPersonaGate, createTaskClock, isReviewPersona, openTaskClock, reviewBudgetClause } from "./run-budget.js";
68
+ import { countReviewFindings, findingBudgetNotice } from "./review-findings.js";
69
+ import { checkDocsLane, docsLaneNotice } from "./docs-lane.js";
70
+ import { checkExternalBlockerGate, extractExternalBlockers } from "./external-blocker.js";
71
+ import { DEFAULT_RUN_HISTORY_KEEP, normalizeRunHistoryKeep } from "./run-namespace.js";
72
+ import { refreshTaskBrief } from "./task-brief.ts";
73
+ import { validateAssertionBatch } from "./assertion-ledger.js";
74
+ import { DEFAULT_PROVIDER_LIMITS, createProviderSemaphore, parseProviderLimits } from "./provider-semaphore.js";
75
+ import {
76
+ PANE_PROMPT_TIMEOUT_MS,
77
+ launchPeerInPane,
78
+ peerReadyVerdict,
79
+ unaddressedPeerSweep,
80
+ } from "../lib/spawned-peers.js";
81
+ import { contextPct, estimatePromptTokens, resolveContextWindow } from "./context-window.js";
82
+ import { DEFAULT_WATCHDOG_SETTING, WATCHDOG_SETTINGS, normalizeWatchdogSetting, resolveWatchdogActive } from "./drift-watchdog.js";
83
+ import { createWatchdogActivity, createTaskTriageActivity, type WatchdogActivity, type TaskTriageActivity } from "./system1-activity.ts";
84
+ import { createWatchdogSystem1Session, disposeWatchdogSystem1Session, readWatchdogSystem1Snapshot, type WatchdogSystem1Session } from "./system1-runtime.ts";
85
+ import { shouldExtractReturn } from "./return-extract.js";
86
+ import { crossCheck, deliveryDisposition, extractAssertionIds, parseDeliveredReturn } from "./return-contract.js";
87
+ import { checkScope, diffAgainst, revisionOf, revisionScopes, snapshotWorktree, worktreeRevision } from "./scope-gate.js";
88
+ import { validateEvidence } from "./evidence-rules.js";
89
+ import { comsRequiredRefusal, explicitComsRefusal, parseDispatchPolicy, resolveDispatchBackend } from "./backend-policy.js";
90
+ import { NATIVE_ROSTER_ENTRY_TYPE, RETIRED_WORK_MODE_NOTICE, WORK_MODE_ENTRY_TYPE, persistedNativeRosterState, resolveSessionRoster, sessionSavedInRetiredWorkMode, type WorkMode } from "./work-mode.ts";
91
+ import { registerAgentsTeam } from "./commands/agents-team.ts";
92
+ import { registerAgentsList } from "./commands/agents-list.ts";
93
+ import { registerAgentsHistory } from "./commands/agents-history.ts";
94
+ import { registerAgentsAdd } from "./commands/agents-add.ts";
95
+ import { registerAgentsDrop } from "./commands/agents-drop.ts";
96
+ import { registerAgentsSave } from "./commands/agents-save.ts";
97
+ import { registerAgentsKill } from "./commands/agents-kill.ts";
98
+ import { registerAgentsRestart } from "./commands/agents-restart.ts";
99
+ import { registerContextCommand } from "./commands/context-command.ts";
100
+ import { registerAudit } from "./commands/audit.ts";
101
+ import { registerConfig } from "./commands/config.ts";
102
+ import { showSessionAudit } from "./session-audit.ts";
103
+ import { createExecutionTrace, createNativeExecutionTrace, registerExecutionTrace, EXECUTION_TRACE_ENTRY } from "./execution-trace.ts";
104
+ import { beginRuntimeTrace } from "../lib/execution-trace.ts";
105
+ import { buildWatchdogReport, buildProactiveReport, commandProactiveLabels, readProactiveReport, formatWatchdogStatus, readWatchdogEvents } from "./system1-report.ts";
106
+ 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";
107
+ import { registerHubReport } from "./commands/hub-report.ts";
108
+ import { registerZoom } from "./commands/zoom.ts";
109
+ import { registerDispatchPolicy } from "./commands/dispatch-policy.ts";
110
+ import { registerAgentModel } from "./commands/agent-model.ts";
111
+ import { registerAgentModelThinking } from "./commands/agent-model-thinking.ts";
112
+ import { registerModels } from "./commands/models.ts";
113
+ import { registerAgentModelsSubstitute } from "./commands/agent-models-substitute.ts";
114
+ import { registerWatchdog } from "./commands/watchdog.ts";
115
+ import { registerComs } from "./commands/coms.ts";
116
+ import { registerHandoff } from "./commands/handoff.ts";
117
+ import { registerCompound } from "./commands/compound.ts";
118
+ import { registerPoll } from "./commands/poll.ts";
119
+ import { registerDebate } from "./commands/debate.ts";
120
+ import type { CommandContext } from "./commands/context.ts";
121
+ import { formatAfPollStarted, formatAfPollVoiceProgress, handleAfPoll, runAfPoll, type AfPollHandleInput } from "./poll-command.ts";
122
+ import { registerPollPanel } from "./tools/poll-panel.ts";
123
+ import { formatAfDebateStarted, formatAfDebateVoiceProgress, handleAfDebate } from "./debate-command.ts";
124
+ import { registerDispatchAgent } from "./tools/dispatch-agent.ts";
125
+ import { registerSpawnResearch } from "./tools/spawn-research.ts";
126
+ import { registerRunFlow } from "./tools/run-flow.ts";
127
+ import { resolvePersona as resolveFlowPersona } from "../../agent-fleet/scripts/workflows/lib/personas.ts";
128
+ import { assertProfileModel as assertFlowProfileModel } from "../../agent-fleet/scripts/workflows/lib/model-profile.ts";
129
+ import { registerSetTaskTier } from "./tools/set-task-tier.ts";
130
+ import { registerTeamAdjust } from "./tools/team-adjust.ts";
131
+ import { registerVerificationContract } from "./tools/verification-contract.ts";
132
+ import { registerComsTools } from "./tools/coms-tools.ts";
133
+ import { paneTail, peerManifest, peerPersonaExists, registerFleetTools, spawnDelaySeconds, STAGGER_ENV_VAR, waitForPeerRegistration } from "./tools/fleet-tools.ts";
134
+ import type { ToolContext } from "./tools/context.ts";
135
+ import { createToolExecutionOrchestration } from "./tools/execution-orchestration.ts";
136
+ import { latestPersistedCapabilityState, type ContextState, type PendingOperation } from "./capability-packs.ts";
137
+ import { contextPressureDiagnostic, createContextPressureState, pressureCapabilityState, transitionContextPressure, type ContextPressureState } from "./context-pressure.ts";
138
+ import { confirmationOutcome, capabilityConfirmationPack, capabilityConfirmationQuestion, type ConfirmableCapabilityPack } from "./capability-confirmation.ts";
139
+ import { confirmRecoverAction, confirmTaskContinuation, confirmTaskSupersession, createReservedTaskIdentityReset } from "./budget-recovery.ts";
140
+ import { requestRuntimeAsk } from "../ask-user-remote/runtime-ask.ts";
141
+ import { observeAskUserResults } from "../ask-user-remote/index.ts";
142
+ import {PermissionRelay,registerPermissionRelay,handlePermissionEnvelope} from './permission-relay.ts';
143
+ import { handleQuestionEnvelope, registerQuestionPeer, questionChannel } from "../ask-user-remote/questions.ts";
144
+ import { handleObservationEnvelope } from "../lib/coms-observation.ts";
145
+ import { handleInstructionReceipt } from "../lib/coms-instruction-receipts.ts";
146
+ import { buildHubPeerSpawnPlan, launchHubPeerInPane } from "./peer-spawn-plan.ts";
147
+ import { RESEARCH_TOOLS, createResearchRuntime, parseResearchHandle } from "./research/runtime.ts";
148
+ import { requireSafetyHarness, resolveSafetyHarness } from "./safety-routing.ts";
149
+ import { createAccessApprovalRouter } from "./access-approval.ts";
150
+ import { readdirSync, readFileSync, existsSync, mkdirSync, unlinkSync, writeFileSync, rmSync } from "fs";
151
+ import { herdrPaneId } from "../lib/herdr-presence.ts";
152
+ import { herdr as herdrApi, herdrAvailable } from "../lib/herdr-client.ts";
153
+ import {
154
+ abbreviateModel,
155
+ createComsPeer,
156
+ hexFg,
157
+ nowIso,
158
+ readAllRegistryEntries,
159
+ readAllRegistryEntriesAcrossProjects,
160
+ type ComsIdentity,
161
+ type RegistryEntry as ComsRegistryEntry,
162
+ TIMEOUT_MS,
163
+ } from "../lib/coms-core.ts";
164
+ import { createGridUI } from "./ui/grid.ts";
165
+ import { createFleetSource } from "./ui/fleet-source.ts";
166
+ import { buildFleetRows } from "../lib/fleet-read-model.ts";
167
+ import { createFleetActions } from "./ui/fleet-actions.ts";
168
+ import { createDetailPanel } from "./ui/detail-panel.ts";
169
+ import { createFleetDashboard } from "./ui/fleet-dashboard.ts";
170
+ import { createContextBudgetUi } from "./ui/context-budget.ts";
171
+ import { createFleetConfigUi } from "../lib/fleet-config/ui.ts";
172
+ import { createPoolPresentation } from "./ui/pool.ts";
173
+ import { registerInputShortcuts } from "./input/shortcuts.ts";
174
+ import { createCompletionPresentation } from "./input/completions.ts";
175
+ import { createResearchControls } from "./research/controls.ts";
176
+ import { currentPiRuntimeVersion } from "./context-continuity-compat.ts";
177
+ import { createContextPressureLifecycle, createContextPressureRootState } from "./lifecycle/context-pressure.ts";
178
+ import { createTurnLifecycleHandlers, registerTurnPresence, registerTurnSettlement } from "./lifecycle/turn-handlers.ts";
179
+ import { createMonitorSession } from "./lifecycle/monitor-session.ts";
180
+ import { applySessionOverrides, registerSessionOrchestration, resetHubSession } from "./lifecycle/session-orchestration.ts";
181
+ import { openZoom, type TimelineEntry, type Zoomable } from "./ui/zoom.ts";
182
+ import { openHistory } from "./ui/history.ts";
183
+ import { createExecutionHistoryStore, type HistoryEntry } from "./ui/history-store.ts";
184
+ import { createHistoryProjectionMemo, projectCoordinationHistory } from "./history-projection.ts";
185
+ import { isTaskContinuation } from "./task-continuation.ts";
186
+ import { registerOperatorWatchdog } from "./operator-watchdog.ts";
187
+ import type { DriftJudgeInput } from "./dispatch-coms.ts";
188
+ import { createDispatchComs, createDispatchNative, createDispatchObservability, type DelegationChild } from "./dispatch-core.ts";
189
+ import type { FleetRow } from "../lib/fleet-read-model.ts";
190
+ import { gridColumnsForSize } from "../lib/fleet-dashboard-ops.ts";
191
+ import { createFleetTranscriptStore } from "../lib/fleet-transcript-store.ts";
192
+ import type { ContextBudgetComponent } from "../lib/context-budget.ts";
193
+ import { buildHubSystemPrompt as assembleHubPrompt } from "./prompts/system-prompt.ts";
194
+ import type { HubPromptContext } from "./prompts/context.ts";
195
+ import { buildSessionStartNotice, createSessionFooter } from "./prompts/session-start.ts";
196
+ import { registerSessionStart } from "./session-start.ts";
197
+ import { createHubStateContext } from "./context/hub-state.ts";
198
+ import { createAgentStateFactory } from "./context/agent-state.ts";
199
+ import { createBudgetContext, createSessionTotals, freshTurnReport, type TurnReport } from "./context/budgets.ts";
200
+ import { createAssertionsArtifactsContext, type Assertion, type InputArtifactPreview } from "./context/assertions-artifacts.ts";
201
+ import { ASSERTION_LEDGER_ENTRY, assertionLedgerSnapshot, bootstrapLegacyAssertionLedger, restoreAssertionLedger } from "./context/assertion-journal.ts";
202
+ import { createModelPolicy } from "./policy/models.ts";
203
+ import { createRosterPolicy } from "./policy/roster.ts";
204
+ import { createWorkModePolicy } from "./policy/work-mode.ts";
205
+ import { catalogSnapshot, latestPersistedToolCatalog, toolCatalogNotice, TOOL_CATALOG_ENTRY_TYPE, type ToolCatalogDelta } from "./tool-catalog-state.ts";
206
+ import { createToolCatalogRuntime } from "./tool-catalog-runtime.ts";
207
+ import { createUnknownToolCounter, latestPersistedUnknownToolCounter, observeUnknownToolCalls, restoreUnknownToolCounter, unknownToolNotice, UNKNOWN_TOOL_COUNTER_ENTRY_TYPE } from "./unknown-tool-counter.ts";
208
+ import { buildProjectDocsProtocol, buildProjectRulesProtocol, nativeResearchSystemPrompt } from "../lib/context-budget-child-prompt.ts";
209
+ import { parseEnvFile, resolveEnvFilePath } from "../../agent-fleet/scripts/lib/herdr-layout.ts";
210
+ import { worktreeTag } from "../../agent-fleet/scripts/lib/team-project.ts";
211
+ import { join, resolve } from "path";
212
+ import * as fs from "node:fs";
213
+ import * as path from "node:path";
214
+ import * as crypto from "node:crypto";
215
+ import { fileURLToPath } from "node:url";
216
+
217
+ // ── Extension ────────────────────────────────────
218
+
219
+ const CONTEXT_WARN_THRESHOLD = 70;
220
+ const RESEARCHER_PERSONAS = new Set(["researcher", "deep-researcher"]);
221
+
222
+ /**
223
+ * Test-only transport seam for real-Pi acceptance. With the offline guard,
224
+ * the normal shared System 1 service uses deterministic wire responses rather
225
+ * than HTTPS; config, readiness, adapter, deadlines and consumers remain real.
226
+ * A profile alone cannot activate this seam outside the guarded test process.
227
+ */
228
+ let taskTriageFakeInstances = 0;
229
+ function resolveTaskTriageTestTransport(): JevTransport | undefined {
230
+ const profile = process.env.AGENT_HUB_TASK_TRIAGE_FAKE;
231
+ const guard = `--import=${fileURLToPath(new URL("../../../bin/test/helpers/system1-no-network.js", import.meta.url))}`;
232
+ if (!profile || process.env.PI_OFFLINE !== "1" || !process.env.NODE_OPTIONS?.split(/\s+/).includes(guard)) return undefined;
233
+ const hot = profile === "security" ? "security_change" : profile === "wide" ? "wide_change" : profile === "irreversible" ? "irreversible_execution" : null;
234
+ if (!hot && profile !== "plain" && profile !== "timeout" && profile !== "context-safe") return undefined;
235
+ const instanceId = ++taskTriageFakeInstances;
236
+ return async request => {
237
+ const wire = JSON.parse(request.body.toString("utf8"));
238
+ const recordPath = process.env.AGENT_HUB_TASK_TRIAGE_FAKE_RECORD;
239
+ if (recordPath) {
240
+ 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 */ }
241
+ }
242
+ if(profile === "context-safe" && wire.questions.boundary && process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS) {
243
+ const delay=Number(process.env.AGENT_HUB_CONTEXT_FAKE_DELAY_MS);
244
+ if(Number.isFinite(delay) && delay>0 && delay<=500) await new Promise(resolve=>setTimeout(resolve,delay));
245
+ }
246
+ if (profile === "timeout") {
247
+ return new Promise((_, reject) => {
248
+ if (request.signal.aborted) return reject(new Error("guarded fake transport deadline"));
249
+ request.signal.addEventListener("abort", () => reject(new Error("guarded fake transport deadline")), { once: true });
250
+ });
251
+ }
252
+ return { status: 200, headers: {}, body: JSON.stringify({ model: TASK_TRIAGE_MODEL,
253
+ answers: Object.fromEntries(Object.keys(wire.questions).map(id => {
254
+ if(profile === "context-safe" && (id === "boundary" || id === "retention")) {
255
+ const choice=id === "boundary"?"safe":"active_step";
256
+ const keys=id === "boundary"?["safe","unsafe","unknown"]:["standard","active_step","decisions","unknown"];
257
+ return [id,{type:"choice",choice,confidence:0.95,probabilities:Object.fromEntries(keys.map(key=>[key,key===choice?0.95:0.05/(keys.length-1)]))}];
258
+ }
259
+ return [id,{type:"noul",noul:id === hot?0.95:0.05}];
260
+ })),
261
+ usage: { input_tokens: 1, output_tokens: 1 },
262
+ }) };
263
+ };
264
+ }
265
+
266
+ export default function (pi: ExtensionAPI) {
267
+ // ── Embedded coms: identity CLI flags ──
268
+ // Registered here (factory load time) so pi's CLI parser accepts them. Because
269
+ // coms is EMBEDDED (one extension, not a second `-e`), these register exactly once.
270
+ pi.registerFlag("name", { description: "Coms: override agent name (else frontmatter or auto-generated)", type: "string", default: undefined });
271
+ pi.registerFlag("purpose", { description: "Coms: override agent purpose (else frontmatter description)", type: "string", default: undefined });
272
+ pi.registerFlag("project", { description: "Coms: project namespace for peer discovery", type: "string", default: "default" });
273
+ pi.registerFlag("color", { description: "Coms: hex color #RRGGBB (else frontmatter or palette fallback)", type: "string", default: undefined });
274
+ pi.registerFlag("explicit", { description: "Coms: hide from auto-discovery; addressable only by exact name", type: "boolean", default: false });
275
+ pi.registerFlag("solo", { description: "Run without the coms layer (fixed specialists + research only — `just fleet hub --solo`)", type: "boolean", default: false });
276
+ pi.registerFlag("work-mode", { description: "Deprecated and ignored: the Hub has one operator work mode", type: "string", default: undefined });
277
+ pi.registerFlag("agent-team", { description: "Internal: activate a named native roster from .pi/agents/teams.yaml", type: "string", default: undefined });
278
+
279
+ // ── Embedded coms: shared peer state ──
280
+ let currentCtx: ExtensionContext | null = null;
281
+ let refreshFleetUi = () => {};
282
+ const permissionRelay=new PermissionRelay(()=>observationOwner(),()=>accessTaskIdentity());registerPermissionRelay(pi,permissionRelay);registerPermissionRelay(pi.events,permissionRelay);
283
+ const codexControls=createCodexBootstrapControls(pi,{owner:()=>observationOwner(),context:()=>currentCtx,changed:()=>refreshFleetUi()});
284
+ const connectionControl=codexControls.control;
285
+ const refreshConnections=()=>{void codexControls.refresh();};
286
+ const coms = createComsPeer({
287
+ pi,
288
+ getContext: () => currentCtx,
289
+ instructionReceipts: true,
290
+ onPeersChanged: () => refreshFleetUi(),
291
+ handleCustomStream: (socket, envelope, buffered) => codexControls.control.handleStream(socket, envelope, buffered),
292
+ handleCustomEnvelope: (socket, envelope) => {
293
+ if(connectionControl.handle(socket,envelope))return true;
294
+ if (handleObservationEnvelope(socket, envelope, {
295
+ owner: observationOwner,
296
+ session: () => currentCtx?.sessionManager,
297
+ questions: () => { const owner = observationOwner(); return owner ? questionChannel.list(owner) : { status: 'stale' }; },
298
+ permissions:()=>permissionRelay.summary(),
299
+ })) return true;
300
+ if (handleInstructionReceipt(envelope, socket, observationOwner, currentCtx?.sessionManager)) return true;
301
+ if (handlePermissionEnvelope(socket,envelope,permissionRelay,observationOwner())) return true;
302
+ if (handleQuestionEnvelope(socket, envelope)) return true;
303
+ if (envelope.type !== "access_request") return false;
304
+ void accessApprovalRouter.handle(socket, envelope as AccessRequest);
305
+ return true;
306
+ },
307
+ });
308
+ function observationOwner() { return coms.ready && coms.identity ? {
309
+ project: coms.identity.project, peer: coms.identity.name,
310
+ sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
311
+ } : null; }
312
+ const unregisterQuestions = registerQuestionPeer(() => coms.ready && coms.identity ? {
313
+ project: coms.identity.project, peer: coms.identity.name,
314
+ sessionId: coms.identity.session_id, startedAt: coms.identity.started_at,
315
+ } : null);
316
+ let identity: ComsIdentity | null = null;
317
+ const peerCards = coms.peerCards;
318
+ const pendingReplies = coms.pendingReplies;
319
+ const inboundQueue = coms.inboundQueue;
320
+ let comsReady = false;
321
+ let monitorLifecycle: ReturnType<typeof createMonitorLifecycle> | null = null;
322
+ let monitorHubId: string | null = null;
323
+ let monitorTurnId: string | null = null;
324
+ let monitorBridge: ReturnType<typeof createMonitorSessionBridge> | null = null;
325
+ let monitorOwnerId: string | undefined;
326
+
327
+ // ── Damage-control exemptions + access escalation state ──
328
+ // exemptionsFile is the session-scoped shared exemptions file: /af-allow
329
+ // session grants (via the co-loaded damage-control-continue) and approved
330
+ // escalations land here, and spawned children read it through the
331
+ // AGENT_HUB_EXEMPTIONS_FILE env plumbing.
332
+ let exemptionsFile: string | null = null;
333
+ const accessEpochs=new Map<string,string>();
334
+ const accessTaskIdentity=()=>({taskId:noProgress.taskId(),inputRevision:crypto.createHash('sha256').update(JSON.stringify({task:hubTaskText,revision:taskTriage?.current?.revision??''})).digest('hex')});
335
+ const accessApprovalRouter = createAccessApprovalRouter({
336
+ 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',
337
+ traceBus: pi.events,
338
+ getContext: () => currentCtx,
339
+ getExemptionsFile: () => exemptionsFile,
340
+ appendLog: (entry) => { pi.appendEntry("damage-control-log", entry); },
341
+ now: nowIso,
342
+ });
343
+
344
+ const agentStates: Map<string, AgentState> = new Map();
345
+ // Live-only research helpers, keyed by numeric id (handle `rN`). Visible in the
346
+ // Fleet Dashboard (Alt+A) while running; evicted from this map on every terminal
347
+ // outcome. Session/transcript/findings files and /af-agents-history survive.
348
+ let researchStates: Map<number, ResearchState> = new Map();
349
+ // Metadata only: prompt text is never retained by this ledger.
350
+ let lastHubLedger: ContextBudgetComponent[] = [];
351
+ let nextResearchId = 1;
352
+
353
+ // ── Execution history (/af-agents-history) ──────────
354
+ // The typed store owns entries and turn/ask_user bookkeeping; index.ts owns
355
+ // composition and wires lifecycle events to its explicit API.
356
+ const executionHistory = createExecutionHistoryStore();
357
+
358
+ let researchPersonas: AgentDef[] = [];
359
+ let allAgentDefs: AgentDef[] = [];
360
+ /** Installed personas dispatch_agent may target: research personas use spawn_research, and
361
+ * `kind: orchestrator` only documents the Hub role. */
362
+ const dispatchableAgentDefs = (): AgentDef[] => allAgentDefs.filter(def => !["research", "orchestrator"].includes((def.kind || "").toLowerCase()));
363
+ let teams: Record<string, string[]> = {};
364
+ // Named model profiles from .pi/agents/model-profiles.yaml (validated at
365
+ // session start) and the session-lifetime per-persona model overrides set by
366
+ // /af-agent-model and /af-models (lowercase persona name → pi model spec). Overrides
367
+ // reset on session_start; profiles make re-applying cheap.
368
+ let modelProfiles: ModelProfiles = {};
369
+ let modelProfileErrors: string[] = [];
370
+ // Backend routing policy (.pi/agents/dispatch-policy.yaml): per dispatch, a
371
+ // member preferring coms is served by a live same-name pool peer instead of a
372
+ // native subagent spawn. Missing file → everything native (status quo).
373
+ let dispatchPolicy: {
374
+ default: string;
375
+ grace_s: number;
376
+ substitutions: Record<string, { prefer: string; fallback: string; timeout_s?: number }>;
377
+ } = { default: "native", grace_s: 30, substitutions: {} };
378
+ let dispatchPolicyWarnings: string[] = [];
379
+ // One "coms peer missing → native" notice per member per team activation.
380
+ const comsMissNotified = new Set<string>();
381
+
382
+ let activeTeamName = "";
383
+ let gridCols = 2;
384
+ let widgetCtx: any;
385
+ let sessionDir = "";
386
+ let contextWindow = 0;
387
+ // Per-provider in-flight cap for the hub's OWN spawns (specialists and
388
+ // research helpers, which the dispatcher can start in parallel). Delegate
389
+ // children are gated by the same policy inside their parent's process. The
390
+ // drift judge and the return extractor are deliberately NOT gated: both run
391
+ // while a specialist holds a permit, so queueing them behind that specialist
392
+ // would stall the very watchdog that is supposed to stop it.
393
+ const providerSemaphore = createProviderSemaphore({
394
+ ...DEFAULT_PROVIDER_LIMITS,
395
+ ...parseProviderLimits(process.env.AGENT_HUB_PROVIDER_LIMITS),
396
+ });
397
+ /**
398
+ * pi's model registry as a plain lookup — the documented source for every
399
+ * model's window, and the same one the dispatcher's own window comes from.
400
+ */
401
+ function modelWindowLookup(ctx: any): (provider: string, modelId: string) => any {
402
+ return (provider, modelId) => ctx?.modelRegistry?.find?.(provider, modelId);
403
+ }
404
+
405
+ /** Say so when a run is about to wait on a provider permit, not just hang. */
406
+ function notifyProviderQueue(model: string, label: string, ctx: any): void {
407
+ const cap = providerSemaphore.limitFor(model);
408
+ if (cap == null || providerSemaphore.inFlight(model) < cap) return;
409
+ const ahead = providerSemaphore.queued(model) + 1;
410
+ ctx?.ui?.notify(
411
+ `${label}: queued — ${cap} requests already in flight on this provider (${ahead} waiting). ` +
412
+ "Raise or disable the cap with AGENT_HUB_PROVIDER_LIMITS (e.g. custom=4, custom=off).",
413
+ "info",
414
+ );
415
+ }
416
+
417
+ let activeWritableDispatches = 0;
418
+ let writableOverlapCounter = 0;
419
+ function privateProofUse(cwd = currentCtx?.cwd || process.cwd()): PrivateProofUse {
420
+ return { cwd, taskId: noProgress.taskId(), sessionDir, declarationHash: privateDeclarationHash(assertions as any, hubTaskText), activeWriters: activeWritableDispatches, overlap: writableOverlapCounter };
421
+ }
422
+ let pendingHandoff: { target: string; token: string } | null = null;
423
+ const hubStateCtx = createHubStateContext({
424
+ getCurrentContext: () => currentCtx, setCurrentContext: value => { currentCtx = value; },
425
+ getExemptionsFile: () => exemptionsFile, setExemptionsFile: value => { exemptionsFile = value; },
426
+ getSessionDir: () => sessionDir, setSessionDir: value => { sessionDir = value; },
427
+ getWidgetContext: () => widgetCtx, setWidgetContext: value => { widgetCtx = value; },
428
+ getPendingHandoff: () => pendingHandoff, setPendingHandoff: value => { pendingHandoff = value; },
429
+ });
430
+ let userLanguage: string = DEFAULT_OVERRIDES.language;
431
+ // Project rule folders from the overrides file's `rules:` key (repo-relative,
432
+ // validated at session_start). Non-empty → every dispatched specialist gets a
433
+ // "Project rules" prompt block; personas resolve the folders index-first (a
434
+ // top-level README.md/index.md is a loading manifest) with recursive discovery
435
+ // as the no-index fallback.
436
+ let projectRulesDirs: string[] = [];
437
+ // Project documentation entry points from the overrides file's `docs:` key
438
+ // (repo-relative files or folders, validated at session_start). Non-empty →
439
+ // dispatched specialists and research helpers get a "Project docs" prompt block.
440
+ let projectDocsPaths: string[] = [];
441
+
442
+ // Prompt blocks for the project's own rules (HOW — compliance) and docs
443
+ // (WHAT/WHY — orientation). Rules discovery is index-first so a curated rule
444
+ // tree (README manifest + session bundles) is honored instead of bulk-read;
445
+ // the blind recursive find is only the no-index fallback. The validation duty
446
+ // itself is written into the planner/code-reviewer personas.
447
+ function buildRulesProtocol(): string {
448
+ return buildProjectRulesProtocol(projectRulesDirs);
449
+ }
450
+
451
+ function buildDocsProtocol(): string {
452
+ return buildProjectDocsProtocol(projectDocsPaths);
453
+ }
454
+
455
+ /** One canonical repository context file plus explicitly configured rule roots. */
456
+ function specialistProjectPolicyPaths(cwd: string): string[] {
457
+ const canonical = ["AGENTS.md", "CLAUDE.md"].find(candidate => existsSync(path.join(cwd, candidate)));
458
+ return [...new Set([...(canonical ? [canonical] : []), ...projectRulesDirs])];
459
+ }
460
+ // The one supported safety harness. Every native specialist, researcher, and
461
+ // nested delegate receives it; a missing harness refuses child dispatch.
462
+ let safetyHarnessPath: string | null = null;
463
+ // Resolved once at session_start: the delegate extension injected into
464
+ // specialists that declare `subagents:` (null → delegation disabled).
465
+ let delegateExtPath: string | null = null;
466
+ // Per-tool deadline for read/grep/find/ls in research helpers/delegates. The
467
+ // whole-run bound is separate: the turn budget's agentTurnMs (run-budget.js).
468
+ let reconSearchTimeoutMs: number | null = 120_000;
469
+ // ── Usage accounting and tier (run-budget.js) ──
470
+ // Dispatch/research counts and active time are visible accounting, never
471
+ // continuation quotas. Overrides bound only the child deadline and recycling.
472
+ // Turn counters reset in before_agent_start; task counters span the whole TASK
473
+ // and are cleared only by an explicit new task (`set_task_tier` with
474
+ // `new_task: true`), never by an ordinary user message.
475
+ let budgetOverrides: AgentTeamOverrides["budgetOverrides"] = {};
476
+ let turnDispatchCount = 0;
477
+ let turnResearchCount = 0;
478
+ let taskDispatchCount = 0;
479
+ let taskResearchCount = 0;
480
+ let taskLabel: string | null = null;
481
+ // The task clock charges ACTIVE time only — turns that ran, minus the time the
482
+ // dispatcher spent blocked on ask_user. Raw wall clock would bill the human's
483
+ // lunch break, an overnight pause, and every long answer against the task, and
484
+ // at small tier's 45-minute envelope that hard-stops a task with two dispatches
485
+ // spent. A false stop is worse than no stop: it teaches people to reset the
486
+ // task window reflexively, which is the one thing that must stay deliberate.
487
+ // The explicit clock state makes `active` authoritative: a stale timestamp can
488
+ // never turn inter-turn idle time into task work.
489
+ let taskClock = createTaskClock();
490
+ // Review dispatches spent on this task (review-round cap).
491
+ let taskReviewRounds = 0;
492
+ // Task tier (complexity triage): declared by the dispatcher via set_task_tier.
493
+ // TASK-scoped, not turn-scoped, and it moves by ratchet — down freely, up only
494
+ // with a stated reason (applyTierChange). Null until declared; the first
495
+ // dispatch assumes DEFAULT_TASK_TIER. Caps come from the tier envelope.
496
+ let taskTier: string | null = null;
497
+ // Was the tier ASSUMED by the hub rather than declared by the dispatcher? The
498
+ // distinction matters to the ratchet: an assumed tier must not turn the
499
+ // dispatcher's own first triage call into an "escalation" that needs a reason.
500
+ let taskTierAssumed = false;
501
+ // Correctness obligations are independent of the spend tier. They persist for
502
+ // the current task and reset only through the explicit new-task tool path.
503
+ let processState = createProcessState();
504
+ let taskTriage: ReturnType<typeof createTaskTriageRuntime> | null = null;
505
+ let taskTriageTestTransportActive = false;
506
+ let taskTriageActivity: TaskTriageActivity | null = null;
507
+ let taskTriageConfigStatus: "active" | "off" | "invalid" = "off";
508
+ let taskTriageConfigured = false;
509
+ let processPersistenceBlocked = false;
510
+ let pendingTaskTransition = false;
511
+ let transitionDiversions = 0;
512
+ let transitionHintDelivered = false;
513
+ let transitionBatchRefused = false;
514
+ 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;
515
+ const persistProcessVerdict = (state: ProcessObligationState, verdict: ProcessVerdict) => {
516
+ try { pi.appendEntry("agent-hub-process-state", processAuditRecord(state, verdict)); }
517
+ catch { processPersistenceBlocked = true; }
518
+ };
519
+ // Duplicate-dispatch guard: fingerprints of (agent, task) already dispatched
520
+ // THIS turn. Auto-research resumes and /af-agents-restart call dispatchAgent
521
+ // directly, so only real dispatcher tool calls are guarded.
522
+ const turnDispatchFingerprints = new Set<string>();
523
+ // ── External-blocker circuit breaker (external-blocker.js) ──
524
+ // Set when a specialist reports it needs something outside the fleet's reach;
525
+ // gates the next dispatch until the human has been addressed. Cleared by an
526
+ // ask_user call, by a new user turn (the human spoke), and by a new task.
527
+ let externalBlockers: { agent: string; what: string }[] = [];
528
+ let externalBlockerAcknowledged = false;
529
+ let externalBlockerRefusedOnce = false;
530
+ // Per-run artifact archive retention (run-namespace.js).
531
+ let runHistoryKeep: number | null = DEFAULT_RUN_HISTORY_KEEP;
532
+ // ── Drift watchdog (drift-watchdog.js) ──
533
+ // Hub-wide setting from the overrides file, live-switchable via /af-watchdog;
534
+ // per-agent overrides ("on"/"off") win over it, and a dispatch_agent
535
+ // `watchdog` param wins over both.
536
+ let watchdogSetting: string = DEFAULT_WATCHDOG_SETTING;
537
+ let watchdogJudgeModel: string | null = null;
538
+ let watchdogSystem1: WatchdogSystem1Session | null = null;
539
+ const communicationStore = createCommunicationStore();
540
+ let triageRuntime: ReturnType<typeof createTriageRuntime> | null = null;
541
+ let proactiveRuntime: ReturnType<typeof createProactiveRuntime> | null = null;
542
+ let system1Snapshot: ReturnType<typeof loadSystem1Snapshot> = normalizeSystem1Config(null);
543
+ let proactiveConfig: ProactiveConfig | null = null;
544
+ let proactiveHubDeliveries = 0;
545
+ const proactiveReportInput = () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live(), feedback: { hubDelivered: proactiveHubDeliveries, nativeDelivered: null } } : undefined;
546
+ let hubTaskText: string | undefined;
547
+ const hubCapture = createHubCapture({ root: () => currentCtx?.cwd || process.cwd(), task: () => hubTaskText, policyRoots:()=>sessionOverrides?.policyRoots });
548
+ let watchdogActivity: WatchdogActivity | null = null;
549
+ const watchdogAgentOverrides = new Map<string, "on" | "off">();
550
+ // ── Per-turn cost report (/af-hub-report) ──
551
+ let turnReport: TurnReport = freshTurnReport();
552
+ let lastTurnReport: TurnReport | null = null;
553
+ const sessionTotals = createSessionTotals();
554
+ // Session-wide delegated-spend counter (tokens across all delegate children),
555
+ // surfaced in the status line. Resets on session_start.
556
+ let delegatedTokens = 0;
557
+
558
+ const noProgress = createNoProgressGuard((type, data) => pi.appendEntry(type, data), processRecoveryAttempts());
559
+ const executionTrace = createExecutionTrace({
560
+ identity: () => ({ taskId: noProgress.taskId(), inputRevision: hubTaskText ?? "" }),
561
+ persist: row => pi.appendEntry(EXECUTION_TRACE_ENTRY, row),
562
+ });
563
+ registerExecutionTrace(pi, executionTrace);
564
+ const taskTriageMetadata = () => {
565
+ const current = taskTriage?.current;
566
+ return { taskId: noProgress.taskId(), inputRevision: taskTriage?.inputRevision, configuredStatus: taskTriageConfigStatus,
567
+ runtimeBlocks: [...(processPersistenceBlocked ? ["process_persistence_blocked" as const] : []), ...(pendingTaskTransition ? ["task_transition_pending" as const] : [])],
568
+ assessment: current ? { taskId: current.taskId, evaluationId: current.evaluationId, inputRevision: current.revision, assessment: current.assessment } : undefined };
569
+ };
570
+ let taskIdentityReset: ReturnType<typeof createReservedTaskIdentityReset>;
571
+ let unknownToolCounter = createUnknownToolCounter({ limit: 3 });
572
+ const toolCatalogRuntime = createToolCatalogRuntime(catalogSnapshot("operator", []));
573
+ let latestToolCatalogDelta: ToolCatalogDelta | null = null;
574
+ let latestUnknownToolNotice = "";
575
+ const seenUnknownToolCalls = new Set<string>();
576
+ const resetUnknownToolCounterForCurrentTask = () => {
577
+ unknownToolCounter.resetForNewTask(noProgress.taskId());
578
+ seenUnknownToolCalls.clear();
579
+ latestUnknownToolNotice = "";
580
+ };
581
+ const budgetCtx = createBudgetContext({
582
+ getBudgetOverrides: () => budgetOverrides,
583
+ getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
584
+ getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
585
+ resetNoProgress: (persistTaskIdentity) => noProgress.reset(persistTaskIdentity), resetUnknownToolCounter: resetUnknownToolCounterForCurrentTask,
586
+ getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
587
+ getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
588
+ getTaskLabel: () => taskLabel, setTaskLabel: value => { taskLabel = value; },
589
+ getTaskClock: () => taskClock, setTaskClock: value => { taskClock = value; },
590
+ getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
591
+ getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
592
+ getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
593
+ clearTurnDispatchFingerprints: () => turnDispatchFingerprints.clear(),
594
+ clearTaskCapabilities: () => workModePolicy.resetCapabilities(),
595
+ clearExternalBlockers: () => { externalBlockers = []; externalBlockerAcknowledged = false; externalBlockerRefusedOnce = false; },
596
+ resolveIncomingCapabilities: (acceptedUserInput = "") => { resolveIncomingCapabilities(acceptedUserInput, true); }, applyWorkModeTools: () => { applyWorkModeTools(); },
597
+ getTurnReport: () => turnReport,
598
+ setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
599
+ getAuditContext: () => ({ cwd: identity?.cwd ?? currentCtx?.cwd, sessionId: identity?.session_id, project: identity?.project }),
600
+ appendEntry: (type, data) => { pi.appendEntry(type, data); },
601
+ executionHistory,
602
+ });
603
+ const {
604
+ currentBudget, closeTurnActiveTime, resetTaskWindow,
605
+ hubAuditIdentity, hubLocationSuffix, taskResetSnapshot,
606
+ appendTaskResetEntry, updateModeStatus, ensureTaskTier,
607
+ } = budgetCtx;
608
+ taskIdentityReset = createReservedTaskIdentityReset(noProgress);
609
+
610
+ // ── Verification Contract: assertion ledger (advisory) ──
611
+ // Mutable ownership remains here; the extracted runtime receives explicit ports.
612
+ let assertions: Assertion[] = [];
613
+ // Why session start could not restore the ledger; shown while the ledger is empty.
614
+ let ledgerRestoreDiagnostic: string | null = null;
615
+ // Set while session start could not establish an authoritative task identity:
616
+ // journaling a ledger then would bind it to (and persist) a non-authoritative ID.
617
+ let ledgerPersistenceFence: string | null = null;
618
+ /** The authoritative, task-bound journal record. Throws when the append fails. */
619
+ function persistAssertionLedger(value: Assertion[]): void {
620
+ if (ledgerPersistenceFence) throw new Error(ledgerPersistenceFence);
621
+ // The first task has no reset event; without a saved identity a reload mints a
622
+ // new task ID and the snapshot would be refused as foreign.
623
+ noProgress.persistTaskIdentity();
624
+ pi.appendEntry(ASSERTION_LEDGER_ENTRY, assertionLedgerSnapshot(noProgress.taskId(), value));
625
+ ledgerRestoreDiagnostic = null;
626
+ }
627
+ /** Runs after the recovery guard established the authoritative task identity. */
628
+ function restoreAssertionLedgerForSession(ctx: ExtensionContext, trusted: { recovery: boolean; identity: boolean }): string | null {
629
+ assertions = []; ledgerRestoreDiagnostic = null; ledgerPersistenceFence = null;
630
+ const next = "Re-declare the same sourced assertions with set_assertions for this same task; do not open a new task or reset.";
631
+ if (!trusted.recovery || !trusted.identity) {
632
+ const cause = !trusted.recovery ? "recovery history rejected" : "saved process state names a different task";
633
+ ledgerPersistenceFence = `task identity not established at session start (${cause})`;
634
+ ledgerRestoreDiagnostic = `The assertion ledger was not restored because the task identity could not be established (${cause}). Ledger changes are refused until the session's recovery entries are repaired and the session is resumed; do not re-declare under this identity, open a new task or reset.`;
635
+ return ledgerRestoreDiagnostic;
636
+ }
637
+ // The current leaf only: sibling branches and summarized model context are not authority.
638
+ const branch = ctx.sessionManager.getBranch?.() ?? [];
639
+ const restored = restoreAssertionLedger(branch, noProgress.taskId());
640
+ if (restored.status !== "none") { assertions = restored.assertions; ledgerRestoreDiagnostic = restored.diagnostic ?? null; return ledgerRestoreDiagnostic; }
641
+ const legacy = bootstrapLegacyAssertionLedger(branch);
642
+ if (legacy.status === "bootstrapped") {
643
+ try { persistAssertionLedger(legacy.assertions); assertions = legacy.assertions; return legacy.diagnostic ?? null; }
644
+ catch { ledgerRestoreDiagnostic = `Migrated assertion declarations could not be saved to the session journal, so they were not adopted. ${next}`; return ledgerRestoreDiagnostic; }
645
+ }
646
+ ledgerRestoreDiagnostic = legacy.diagnostic ?? null;
647
+ return ledgerRestoreDiagnostic;
648
+ }
649
+ const assertionsArtifactsCtx = createAssertionsArtifactsContext({
650
+ getAssertions: () => assertions,
651
+ getSessionDir: () => sessionDir,
652
+ getRunHistoryKeep: () => runHistoryKeep,
653
+ setStatus: (key, value) => { widgetCtx?.ui?.setStatus(key, value); },
654
+ getTaskBriefPath: () => currentTaskBrief(),
655
+ });
656
+
657
+ // ── Parallel writers (plan B, phase 4): who writes where, and who is sandboxed ──
658
+ const activeWriters = new Map<number, { agent: string; scope: string[]; isolated: boolean }>();
659
+ const isolatedWriterAgents = new Set<string>();
660
+ let writerSequence = 0;
661
+
662
+ // ── Task brief: the shared record every delegated agent reads (plan B, phase 3) ──
663
+ type BriefEntry = { agent: string; kind: "specialist" | "research"; task: string; scope: string[]; researchId?: number };
664
+ let briefLog: { taskId: string; entries: BriefEntry[] } = { taskId: "", entries: [] };
665
+ const briefEntries = (): BriefEntry[] => {
666
+ const id = noProgress.taskId();
667
+ if (briefLog.taskId !== id) briefLog = { taskId: id, entries: [] };
668
+ return briefLog.entries;
669
+ };
670
+ function recordDelegation(entry: BriefEntry): void {
671
+ const entries = briefEntries();
672
+ entries.push({ ...entry, task: entry.task.slice(0, 1000), scope: entry.scope.slice(0, 32) });
673
+ if (entries.length > 40) entries.splice(0, entries.length - 40);
674
+ }
675
+ function currentTaskBrief(): string | null {
676
+ if (!sessionDir) return null;
677
+ try {
678
+ return refreshTaskBrief(artifactsRoot(), {
679
+ taskId: noProgress.taskId(), tier: taskTier ?? DEFAULT_TASK_TIER, risk: processState.risk, scope: processState.scope,
680
+ requirements: assertions.map(a => ({ id: a.id, status: a.status, text: a.text, source: a.source })),
681
+ delegations: briefEntries().map(entry => ({
682
+ ...entry,
683
+ status: entry.kind === "research"
684
+ ? (researchStates.get(entry.researchId ?? -1)?.status ?? "finished")
685
+ : (agentStates.get(entry.agent.toLowerCase())?.status ?? "finished"),
686
+ })),
687
+ });
688
+ } catch { return null; }
689
+ }
690
+ const {
691
+ persistAssertions, assertionStatusLine, renderAssertionLedgerLines, renderAssertionLedgerText,
692
+ updateAssertionStatus, artifactsRoot, ensureArtifactsLayout, archivePreviousRun,
693
+ loadInputArtifacts, appendInputArtifacts, writeRunArtifact, evidencePathExists,
694
+ listArtifactFiles, renderArtifactIndexText, appendMachineHandoffSections,
695
+ } = assertionsArtifactsCtx;
696
+
697
+ const modelPolicy = createModelPolicy<AgentDef>({
698
+ getAllDefs: () => allAgentDefs,
699
+ getActiveDef: name => agentStates.get(name)?.def,
700
+ getResearchDefs: () => researchPersonas,
701
+ refreshUi: () => updateWidget(),
702
+ });
703
+ const {
704
+ allowedModels, substitutedModel, resolvedModel, resolvedSubagentModel,
705
+ resolvedThinking, switchablePersonaDef, allKnownModels,
706
+ } = modelPolicy;
707
+
708
+ let profileCommandContext: any;
709
+ const profileActivation = createProfileActivation({
710
+ busy: () => !profileCommandContext?.isIdle?.() || profileWorkInFlight()>0 ||
711
+ Array.from(agentStates.values()).some(state=>state.status==='running') ||
712
+ Array.from(researchStates.values()).some(state=>state.status==='running'),
713
+ defs: () => allAgentDefs,
714
+ available: async () => {
715
+ await profileCommandContext.modelRegistry.refresh?.();
716
+ return (profileCommandContext.modelRegistry.getAvailable?.()??[]).map((m:any)=>`${m.provider}/${m.id}`);
717
+ },
718
+ dispatcher: () => profileCommandContext?.model ? {model:`${profileCommandContext.model.provider}/${profileCommandContext.model.id}`,thinking:pi.getThinkingLevel()} : undefined,
719
+ setDispatcher: async selection => {
720
+ const slash=selection.model.indexOf('/');
721
+ const model=profileCommandContext.modelRegistry.find(selection.model.slice(0,slash),selection.model.slice(slash+1));
722
+ if(!model || !await pi.setModel(model)) return false;
723
+ if(selection.thinking) pi.setThinkingLevel(selection.thinking as any);
724
+ return true;
725
+ },
726
+ apply: profile => modelPolicy.applyProfile(profile),
727
+ });
728
+ pi.on('model_select', async (event,ctx) => {
729
+ contextWindow=event.model.contextWindow||0;
730
+ if(profileActivation.switching()) return;
731
+ const active=readActiveProfile();if(!active || !hasExplicitDispatcher(active.profile)) return;
732
+ try { assertProfileModel(`${event.model.provider}/${event.model.id}`,active); }
733
+ catch(error) {
734
+ ctx.abort();ctx.ui.notify(String(error),'error');
735
+ if(hasExplicitDispatcher(active.profile)) {
736
+ const target=dispatcherSelection(active.profile).model, slash=target.indexOf('/');
737
+ const model=ctx.modelRegistry.find(target.slice(0,slash),target.slice(slash+1));
738
+ if(model) await pi.setModel(model);
739
+ }
740
+ }
741
+ });
742
+ pi.on('before_provider_request', async (_event,ctx) => {
743
+ const active=readActiveProfile();
744
+ if(!ctx.model || !active || !hasExplicitDispatcher(active.profile)) return;
745
+ try { assertProfileModel(`${ctx.model.provider}/${ctx.model.id}`,active); }
746
+ catch(error) {ctx.abort();ctx.ui.notify(String(error),'error');}
747
+ });
748
+
749
+ function appendDeclaredScope(task: string, scopeGlobs: string[]): string {
750
+ if (!scopeGlobs || scopeGlobs.length === 0) return task;
751
+ 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")}`;
752
+ }
753
+
754
+ function loadAgents(cwd: string): void {
755
+ if (sessionDir) closeEvidenceSession(sessionDir);
756
+ loadAgentConfiguration(cwd, {
757
+ setSessionDir: hubStateCtx.setSessionDir, getSessionDir: hubStateCtx.getSessionDir,
758
+ archivePreviousRun, ensureArtifactsLayout, resetAssertions: () => { assertions = []; },
759
+ setAgentDefs: value => { allAgentDefs = value; }, setTeams: value => { teams = value; },
760
+ setModelProfiles: value => { modelProfiles = value; }, setModelProfileErrors: errors => { modelProfileErrors=errors; }, setDispatchPolicy: value => { dispatchPolicy = value; },
761
+ setDispatchPolicyWarnings: value => { dispatchPolicyWarnings = value; },
762
+ });
763
+ pruneEvidenceSessions(sessionDir, runHistoryKeep);
764
+ }
765
+
766
+ const agentStateFactory = createAgentStateFactory(() => sessionDir);
767
+ const { sessionHealthIo, adoptableSessionFile, freshAgentState } = agentStateFactory;
768
+
769
+ // Auto-size grid columns based on team size
770
+ function recomputeGrid() {
771
+ gridCols = gridColumnsForSize(agentStates.size);
772
+ }
773
+
774
+ const rosterPolicy = createRosterPolicy<AgentDef, AgentState>({
775
+ getTeams: () => teams, getAllDefs: () => allAgentDefs, getStates: () => agentStates,
776
+ getActiveTeamName: () => activeTeamName, setActiveTeamName: value => { activeTeamName = value; },
777
+ clearBackendNotices: () => comsMissNotified.clear(), createFreshState: freshAgentState,
778
+ adoptSession: adoptableSessionFile,
779
+ quarantineSession: agentStateFactory.quarantine,
780
+ persist: team => pi.appendEntry(NATIVE_ROSTER_ENTRY_TYPE, persistedNativeRosterState(team)),
781
+ recompute: recomputeGrid, refreshUi: () => updateWidget(), displayName,
782
+ });
783
+ const { activateTeam, persistActiveRoster, add: rosterAdd, drop: rosterDrop } = rosterPolicy;
784
+
785
+ // ── Shared model presentation ─────────────────
786
+ // These formatters serve the extracted grid and the remaining composition-root
787
+ // call sites. Keep one implementation so cards, fleet rows, menus, fallback
788
+ // notices, and the footer retain the same presentation semantics.
789
+ function shortModel(model: string | undefined): string {
790
+ return model ? model.split("/").pop()! : "default";
791
+ }
792
+
793
+ // A " (code)" thinking badge for display, or "" when the level is off.
794
+ function thinkingSuffix(rawThinking: string | undefined): string {
795
+ const code = abbrevThinking(resolveThinkingLevel(rawThinking));
796
+ return code ? ` (${code})` : "";
797
+ }
798
+
799
+ // The model + thinking badge a persona would dispatch with: "gpt-5.5 (xh)".
800
+ function modelWithThinking(def: AgentDef): string {
801
+ return shortModel(resolvedModel(def)) + thinkingSuffix(resolvedThinking(def));
802
+ }
803
+
804
+ // ── Shared fleet source + below-editor widget ───────────────────────────
805
+ const fleetSource = createFleetSource({
806
+ getAgents: () => agentStates,
807
+ getResearch: () => researchStates,
808
+ getPeerInputs: format => fleetPeerInputs(format),
809
+ getPeerCards: () => peerCards,
810
+ getPendingReplies: () => pendingReplies.values(),
811
+ displayName,
812
+ modelForAgent: state => state.lastBackend === "coms" ? shortModel(state.comsPeerModel) : modelWithThinking(state.def),
813
+ modelForResearch: state => shortModel(state.model) + thinkingSuffix(resolvedThinking(state.def)),
814
+ modelForPeer: abbreviateModel,
815
+ getSystem1: () => watchdogActivity?.live() ?? null,
816
+ getTaskTriage: () => {
817
+ if (!taskTriageConfigured && !processState.additions?.length) return null;
818
+ try { return { ...taskTriageMetadata(), process: { schema: processState.schema, ...evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }) } }; }
819
+ catch { return { ...taskTriageMetadata(), process: { schema: "invalid" } }; }
820
+ },
821
+ getProactive: () => proactiveRuntime ? { records: proactiveRuntime.records, history: proactiveRuntime.findings.history, current: proactiveRuntime.findings.current, activity: proactiveRuntime.activity.live() } : null,
822
+ });
823
+ let fleetActions: ReturnType<typeof createFleetActions<AgentState, ResearchState>> | null = null;
824
+ let fleetUiGeneration = 0;
825
+ const gridUI = createGridUI({
826
+ getWidgetContext: () => widgetCtx,
827
+ getRows: now => fleetSource.rows(now, { showFinished: true }),
828
+ getSnapshot: now => { const source = fleetSource.snapshot(now); return { rows: buildFleetRows(source, { showFinished: true }), proactive: source.proactive }; },
829
+ handleIntent: async intent => {
830
+ if (!fleetActions || !widgetCtx) return;
831
+ if (intent.type === "system1") { await gridUI.withSuspended(() => openSystem1Communication(widgetCtx!, communicationStore)); return; }
832
+ if (intent.type === "open") await gridUI.withSuspended(() => fleetActions!.open(intent.key, intent.runToken, widgetCtx!));
833
+ else await fleetActions.execute(intent.type, intent.key, intent.runToken, widgetCtx);
834
+ },
835
+ });
836
+ const { updateWidget } = gridUI;
837
+ refreshFleetUi = updateWidget;
838
+
839
+ // ── Delegation observability ─────────────────
840
+ const dispatchObservability = createDispatchObservability({
841
+ getSessionDir: () => sessionDir,
842
+ getDelegatedTokens: () => delegatedTokens,
843
+ setDelegatedTokens: value => { delegatedTokens = value; },
844
+ getWidgetContext: () => widgetCtx,
845
+ executionHistory,
846
+ displayName,
847
+ safeAgentKey,
848
+ safePathWithin,
849
+ createTranscriptStore: createFleetTranscriptStore,
850
+ appendTimelineText,
851
+ appendTimelineEvent,
852
+ updateWidget,
853
+ });
854
+ const { startDelegationWatch } = dispatchObservability;
855
+
856
+ // ── Dispatch Agent (returns Promise) ─────────
857
+
858
+ // ── Extracted coms dispatch, drift judge, and return extraction ──
859
+ const dispatchComs = createDispatchComs({
860
+ getIdentity: () => identity,
861
+ resolveTarget: target => coms.resolveTarget(target),
862
+ send: (params, auditExtra) => coms.send(params, auditExtra),
863
+ getPendingReply: msgId => pendingReplies.get(msgId),
864
+ deletePendingReply: msgId => { pendingReplies.delete(msgId); },
865
+ getSessionDir: () => sessionDir,
866
+ getWatchdogJudgeModel: () => watchdogJudgeModel,
867
+ getResearcherModel: () => {
868
+ const researcherDef = allAgentDefs.find(def => def.name.toLowerCase() === "researcher");
869
+ return researcherDef ? resolvedModel(researcherDef) ?? null : null;
870
+ },
871
+ displayName,
872
+ safeAgentKey,
873
+ safePathWithin,
874
+ appendInputArtifacts,
875
+ appendDeclaredScope,
876
+ buildRulesProtocol,
877
+ buildDocsProtocol,
878
+ updateWidget,
879
+ spawnPiAgent,
880
+ });
881
+ const { dispatchViaComs, runDriftJudge, runReturnExtraction } = dispatchComs;
882
+ registerOperatorWatchdog(pi, { setting: () => watchdogSetting, taskId: () => noProgress.taskId(), task: () => hubTaskText, runDriftJudge: (input, ctx) => runDriftJudge(input as unknown as DriftJudgeInput, ctx as ExtensionContext) });
883
+
884
+ const nativeDispatch = createDispatchNative({
885
+ traceNative: (owner, actor) => createNativeExecutionTrace(executionTrace, owner, actor),
886
+ prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
887
+ prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
888
+ launchIdentity:()=>noProgress.taskToken(),
889
+ nativeAdmission:persona=>!processBlock()&&!provisionalCapabilityRefusal('fleet')&&!processPreEffectGate(processState,'child',persona),
890
+ isolationRequested: name => isolatedWriterAgents.has(String(name).trim().toLowerCase()),
891
+ getAgentState: key => agentStates.get(key),
892
+ getProcessState: () => processState,
893
+ listAgentStates: () => Array.from(agentStates.values()),
894
+ getSessionDir: () => sessionDir,
895
+ getDispatchPolicy: () => dispatchPolicy,
896
+ isComsReady: () => comsReady,
897
+ getIdentity: () => identity,
898
+ peersInScope: () => peersInScope(),
899
+ wasComsMissNotified: personaKey => comsMissNotified.has(personaKey),
900
+ markComsMissNotified: personaKey => { comsMissNotified.add(personaKey); },
901
+ startMonitorChild: (input, env) => {
902
+ const monitorStart = monitorTurnId;
903
+ return monitorStart ? monitorBridge?.startChild({ ...input, parentId: monitorStart }, env) : undefined;
904
+ },
905
+ finalizeMonitorChild: (task, output, status) => monitorBridge?.finalizeChildFor(task, output, status),
906
+ registerMonitorWaitOnly: (monitorKey, state) => monitorBridge?.registerWaitOnly(monitorKey, () => state.comsAbort?.()),
907
+ registerMonitorProcess: (task, proc) => monitorBridge?.registerOwnedProcessFor(task, proc),
908
+ appendMonitorOutput: (task, delta) => monitorBridge?.appendOutputFor(task, delta),
909
+ getContextWindow: () => contextWindow,
910
+ currentBudget,
911
+ bumpRecycle: () => { turnReport.recycles++; sessionTotals.recycles++; },
912
+ bumpDriftStop: () => { turnReport.driftStops++; sessionTotals.driftStops++; },
913
+ getSessionHealthIo: () => sessionHealthIo,
914
+ getSafetyHarnessPath: () => safetyHarnessPath,
915
+ getDelegateExtensionPath: () => delegateExtPath,
916
+ getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
917
+ getProjectDocsPaths: () => projectDocsPaths,
918
+ getUserLanguage: () => userLanguage,
919
+ getWatchdogSetting: () => watchdogSetting,
920
+ getWatchdogAgentOverride: key => watchdogAgentOverrides.get(key),
921
+ getWatchdogSystem1: () => watchdogSystem1,
922
+ getWatchdogActivity: () => watchdogActivity,
923
+ getProactiveRuntime: () => proactiveRuntime,
924
+ getProactiveConfig: () => proactiveConfig,
925
+ getProactiveCapture: () => proactiveRuntime ? hubCapture : null,
926
+ getPolicyRoots: () => sessionOverrides?.policyRoots,
927
+ getWorkMode: () => getWorkMode(),
928
+ providerSemaphore,
929
+ executionHistory,
930
+ displayName,
931
+ shortModel: model => shortModel(model),
932
+ resolvedModel,
933
+ resolvedThinking,
934
+ resolveThinkingLevel,
935
+ resolvedSubagentModel,
936
+ substitutedModel,
937
+ modelWindowLookup,
938
+ specialistProjectPolicyPaths,
939
+ guardrailEnv,
940
+ appendInputArtifacts,
941
+ appendDeclaredScope,
942
+ flushTimelineStore,
943
+ appendTimelineText,
944
+ appendTimelineEvent,
945
+ createTranscriptStore: createFleetTranscriptStore,
946
+ updateWidget,
947
+ startDelegationWatch,
948
+ dispatchViaComs,
949
+ runDriftJudge,
950
+ notifyProviderQueue,
951
+ spawnPiAgentWithModelFallback,
952
+ });
953
+ const { dispatchAgent } = nativeDispatch;
954
+
955
+ // Shared child guardrail environment. Dispatch-native and research use the
956
+ // same root-owned exemptions and coms escalation endpoint.
957
+ function guardrailEnv(agentId: string): Record<string, string> {
958
+ const epoch=crypto.randomUUID();accessEpochs.set(agentId,epoch);
959
+ const env: Record<string, string> = { [AGENT_ID_ENV]: agentId,AGENT_HUB_ACCESS_EPOCH:epoch };
960
+ if (sessionOverrides?.policyRoots) env[FILESYSTEM_POLICY_ROOTS_ENV]=JSON.stringify(sessionOverrides.policyRoots);
961
+ if (exemptionsFile) env[EXEMPTIONS_FILE_ENV] = exemptionsFile;
962
+ if (comsReady && identity) env[ASK_ENDPOINT_ENV] = identity.endpoint;
963
+ return env;
964
+ }
965
+
966
+ // ── Research helper runtime ────────────────────
967
+ // The composition root owns the mutable bindings; the runtime reaches them only
968
+ // through these explicit ports so later controls can keep stable handles.
969
+ const researchRuntime = createResearchRuntime<AgentDef>({
970
+ prepareDamageGuard:input=>prepareDamageGuardNative(pi,input),
971
+ prepareDiscovery:input=>prepareDiscoveryNative(pi,input),
972
+ launchIdentity:()=>noProgress.taskToken(),
973
+ researchAdmission:()=>!processBlock(),
974
+ getResearchStates: () => researchStates,
975
+ setResearchStates: value => { researchStates = value; },
976
+ getNextResearchId: () => nextResearchId,
977
+ setNextResearchId: value => { nextResearchId = value; },
978
+ hubState: hubStateCtx, budget: budgetCtx, artifacts: assertionsArtifactsCtx,
979
+ executionHistory, providerSemaphore,
980
+ getSafetyHarnessPath: () => safetyHarnessPath,
981
+ getReconSearchTimeoutMs: () => reconSearchTimeoutMs,
982
+ getContextWindow: () => contextWindow,
983
+ resolvedModel, resolvedThinking, resolveThinkingLevel, fallbackModelFor, substitutedModel,
984
+ modelWindowLookup, guardrailEnv, notifyProviderQueue, spawnPiAgentWithModelFallback,
985
+ getProjectPolicyPaths: specialistProjectPolicyPaths,
986
+ getProjectDocsPaths: () => projectDocsPaths,
987
+ nativeResearchSystemPrompt, requireSafetyHarness, shortModel, displayName,
988
+ flushTimelineStore, appendTimelineText, appendTimelineEvent,
989
+ createTranscriptStore: createFleetTranscriptStore,
990
+ onElapsed: () => updateWidget(),
991
+ });
992
+
993
+ // ── Embedded coms: shared registry, transport, and pool core ──
994
+ const peersInScope = () => coms.peersInScope();
995
+ const resolveTarget = (target: string) => coms.resolveTarget(target);
996
+
997
+ const poolPresentation = createPoolPresentation({
998
+ getIdentity: () => identity,
999
+ getDisplayProject: () => coms.scope.displayProject,
1000
+ includeExplicitPeers: () => coms.scope.includeExplicit,
1001
+ getPeerCards: () => peerCards,
1002
+ readProjectEntries: readAllRegistryEntries,
1003
+ readAllEntries: readAllRegistryEntriesAcrossProjects,
1004
+ truncate: truncateToWidth,
1005
+ });
1006
+ const fleetPeerInputs = poolPresentation.peerInputs;
1007
+
1008
+ // ── Extracted tool execution wiring ──
1009
+ // Mutable fleet state remains composition-owned; executor modules receive ports.
1010
+ let herdrFleetReady = false;
1011
+ const hubSpawnedPeers = new Map<string, { name: string; paneId: string | null; addressed: boolean }>();
1012
+ const markPeerAddressed = (name: string) => {
1013
+ const entry = hubSpawnedPeers.get(String(name || "").toLowerCase());
1014
+ if (entry) entry.addressed = true;
1015
+ };
1016
+ let lastHubPiSpawnAt: number | null = null;
1017
+
1018
+ let askUserAvailable = false;
1019
+ let baselineTools: string[] = [];
1020
+ let contextPressureState: ContextPressureState = createContextPressureState();
1021
+ const pressureRootState = createContextPressureRootState();
1022
+
1023
+ function pendingCapabilityOperations(): PendingOperation[] {
1024
+ const pending: PendingOperation[] = [];
1025
+ if (pendingTaskTransition) pending.push({ pack: "fleet", kind: "task-transition" });
1026
+ if (processOpenObligations(processState, undefined, privateProofUse()).some(stage => stage === "plan" || stage === "review")) pending.push({ pack: "fleet", kind: "process-stage" });
1027
+ 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" });
1028
+ if (pendingReplies.size > 0 || pendingHandoff) pending.push({ pack: "peer", kind: "message" });
1029
+ if (hubSpawnedPeers.size > 0) pending.push({ pack: "workspace", kind: "pane" });
1030
+ return pending;
1031
+ }
1032
+ function recordToolCatalogChange(change: { fromMode: WorkMode; toMode: WorkMode; previous: readonly string[]; next: readonly string[]; reason: "refresh" | "mode_switch" }): void {
1033
+ const { snapshot, delta } = toolCatalogRuntime.reconcile(change);
1034
+ latestToolCatalogDelta = delta;
1035
+ unknownToolCounter.noteCatalogChange(delta.catalogVersion);
1036
+ const evidenceRef = `session-entry:${TOOL_CATALOG_ENTRY_TYPE}:${delta.catalogVersion}`;
1037
+ let persisted = false;
1038
+ try { persisted = toolCatalogRuntime.persist({ snapshot, delta }, (type, data) => pi.appendEntry(type, data), change.reason); } catch {}
1039
+ if (persisted && delta.evidence.changed) noProgress.establishToolStateChange(delta.evidence.previousCatalogVersion, delta.evidence.catalogVersion, evidenceRef);
1040
+ }
1041
+ function capabilityContextState(): ContextState {
1042
+ return pressureCapabilityState(contextPressureState, currentCtx?.getContextUsage?.()?.percent);
1043
+ }
1044
+ const workModePolicy = createWorkModePolicy({
1045
+ getBaselineTools: () => baselineTools, getRosterSize: () => agentStates.size,
1046
+ getDeterministicToolsEnabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
1047
+ getAgenticAskEnabled: () => agenticHubEnabled(pi),
1048
+ getFileDiscoveryEnabled: () => discoveryHubEnabled(pi),
1049
+ getDispatchTriageEnabled: () => triageRuntime?.available === true,
1050
+ getRecoveryAvailable: () => noProgress.hasRecoverableOperations(),
1051
+ getActiveTeamName: () => activeTeamName, getComsReady: () => comsReady,
1052
+ getHerdrReady: () => herdrFleetReady, getAskUserAvailable: () => askUserAvailable,
1053
+ getIdentityLabel: () => identity ? `${identity.name}@${identity.project}` : null,
1054
+ getTaskTier: () => taskTier, getPendingOperations: pendingCapabilityOperations,
1055
+ getContextState: capabilityContextState, getActiveTools: () => pi.getActiveTools(), setActiveTools: tools => pi.setActiveTools(tools),
1056
+ recordToolCatalog: recordToolCatalogChange,
1057
+ persist: (type, data) => pi.appendEntry(type, data),
1058
+ });
1059
+ const {
1060
+ getWorkMode, getCapabilityResolution, resolveIncomingCapabilities, provisionalCapabilityRefusal,
1061
+ applyWorkModeTools, statusText: workModeStatusText,
1062
+ } = workModePolicy;
1063
+
1064
+
1065
+ function addParallelAgentInstance(base: string, instance: string): boolean {
1066
+ const def = dispatchableAgentDefs().find(candidate => candidate.name.toLowerCase() === base);
1067
+ if (!def) return false;
1068
+ // The instance keeps the base persona's prompt file, tools and the model and
1069
+ // thinking it resolves to now, so project model overrides still apply.
1070
+ const clone: AgentDef = { ...def, name: instance, model: resolvedModel(def) ?? def.model, thinking: resolvedThinking(def) ?? def.thinking };
1071
+ const result = rosterPolicy.addInstance(clone);
1072
+ if (result.ok) widgetCtx?.ui?.notify?.(`dispatch_agent: ${result.message}`, "info");
1073
+ return result.ok;
1074
+ }
1075
+ const toolCtx: ToolContext = createToolExecutionOrchestration({
1076
+ dispatch: {
1077
+ state: {
1078
+ getAcceptedUserInput: () => hubTaskText,
1079
+ getTurnDispatchCount: () => turnDispatchCount, setTurnDispatchCount: value => { turnDispatchCount = value; },
1080
+ getTurnResearchCount: () => turnResearchCount, setTurnResearchCount: value => { turnResearchCount = value; },
1081
+ getTaskDispatchCount: () => taskDispatchCount, setTaskDispatchCount: value => { taskDispatchCount = value; },
1082
+ getTaskResearchCount: () => taskResearchCount, setTaskResearchCount: value => { taskResearchCount = value; },
1083
+ getTaskReviewRounds: () => taskReviewRounds, setTaskReviewRounds: value => { taskReviewRounds = value; },
1084
+ getTaskTier: () => taskTier, getTurnReport: () => turnReport, getSessionTotals: () => sessionTotals,
1085
+ getProcessState: () => processState, setProcessState: value => { processState = value; }, persistProcessVerdict, processBlock,
1086
+ getTurnDispatchFingerprints: () => turnDispatchFingerprints,
1087
+ getExternalBlockers: () => externalBlockers,
1088
+ getExternalBlockerAcknowledged: () => externalBlockerAcknowledged, setExternalBlockerAcknowledged: value => { externalBlockerAcknowledged = value; },
1089
+ getExternalBlockerRefusedOnce: () => externalBlockerRefusedOnce, setExternalBlockerRefusedOnce: value => { externalBlockerRefusedOnce = value; },
1090
+ isAskUserAvailable: () => askUserAvailable, getUserLanguage: () => userLanguage, getSessionDir: () => sessionDir,
1091
+ getAgentStates: () => agentStates as any, getAssertions: () => assertions, getResearchPersonas: () => researchPersonas,
1092
+ getInstalledAgentNames: () => dispatchableAgentDefs().map(def => def.name),
1093
+ recordDelegation,
1094
+ getActiveWriters: () => Array.from(activeWriters.values()),
1095
+ addAgentInstance: (base, instance) => addParallelAgentInstance(base, instance),
1096
+ beginWriter: entry => {
1097
+ const id = ++writerSequence;
1098
+ activeWriters.set(id, entry);
1099
+ if (entry.isolated) isolatedWriterAgents.add(entry.agent.toLowerCase());
1100
+ let released = false;
1101
+ return () => {
1102
+ if (released) return;
1103
+ released = true;
1104
+ activeWriters.delete(id);
1105
+ if (entry.isolated) isolatedWriterAgents.delete(entry.agent.toLowerCase());
1106
+ };
1107
+ },
1108
+ addInstalledAgent: name => {
1109
+ const def = dispatchableAgentDefs().find(candidate => candidate.name.toLowerCase() === String(name).trim().toLowerCase());
1110
+ return def ? rosterAdd(def.name) : null;
1111
+ },
1112
+ getActiveWritableDispatches: () => activeWritableDispatches, setActiveWritableDispatches: value => { activeWritableDispatches = value; },
1113
+ getWritableOverlapCounter: () => writableOverlapCounter, setWritableOverlapCounter: value => { writableOverlapCounter = value; },
1114
+ },
1115
+ budget: budgetCtx, noProgress, artifacts: assertionsArtifactsCtx, research: researchRuntime,
1116
+ provisionalCapabilityRefusal,
1117
+ dispatchAgent: (agent, task, ...args) => dispatchAgent(agent, noProgress.recoveryTask(task), ...args),
1118
+ runReturnExtraction,
1119
+ returnExtractionAssist: () => resolveAssist(readActiveProfile()?.profile.assist)['return-extraction'],
1120
+ extractNeedsResearch, extractAskUserQuestions, contextPressure: percent => percent >= CONTEXT_WARN_THRESHOLD, displayName,
1121
+ resolvedAgentModel: (def, ctx) => resolvedModel(def as AgentDef) ?? (ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : undefined),
1122
+ getToolCatalogVersion: () => toolCatalogRuntime.catalogForMessage().catalogVersion,
1123
+ },
1124
+ actions: {
1125
+ budget: budgetCtx, artifacts: assertionsArtifactsCtx, hubState: hubStateCtx,
1126
+ getAcceptedUserInput: () => hubTaskText,
1127
+ provisionalCapabilityRefusal,
1128
+ getTaskTier: () => taskTier, setTaskTier: value => { taskTier = value; },
1129
+ getTaskTierAssumed: () => taskTierAssumed, setTaskTierAssumed: value => { taskTierAssumed = value; },
1130
+ getProcessState: () => processState, setProcessState: value => { processState = value; },
1131
+ processBlock, adoptTaskTriage: async (id, newTask, expandedScope) => {
1132
+ if (processPersistenceBlocked) throw new Error("corrupt process state");
1133
+ const next = await adoptTaskTriageState({ runtime: taskTriage, taskId: id, newTask,
1134
+ expandedScope, pendingTransition: pendingTaskTransition, state: processState,
1135
+ persist: state => pi.appendEntry("agent-hub-process-state", processAuditRecord(state, evaluateProcessObligations(state, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER }))),
1136
+ onPostCommitFailure: () => { processPersistenceBlocked = true; },
1137
+ });
1138
+ pendingTaskTransition = false;
1139
+ transitionDiversions = 0;
1140
+ transitionHintDelivered = false;
1141
+ transitionBatchRefused = false;
1142
+ try { pi.appendEntry(TASK_TRANSITION_ENTRY_TYPE, { pending: false }); } catch { processPersistenceBlocked = true; }
1143
+ return next;
1144
+ },
1145
+ persistProcessState: value => persistProcessVerdict(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() })),
1146
+ getTaskDispatchCount: () => taskDispatchCount, getTaskResearchCount: () => taskResearchCount,
1147
+ getTurnReport: () => turnReport, getAssertions: () => assertions, setAssertions: value => { assertions = value; },
1148
+ persistLedger: persistAssertionLedger, ledgerRestoreDiagnostic: () => ledgerRestoreDiagnostic,
1149
+ currentTaskId: () => noProgress.taskId(), currentRevision: ctx => { const cwd = ctx.cwd || process.cwd(); return revisionOf(cwd, revisionScopes(cwd, processState.changedFiles)); },
1150
+ revisionOf: (ctx, scopes) => revisionOf(ctx.cwd || process.cwd(), [...scopes]),
1151
+ privateProofUse: ctx => privateProofUse(ctx.cwd || process.cwd()),
1152
+ adoptReservedTaskId: (id, resetTaskWindow) => { taskIdentityReset.run(id, resetTaskWindow); bindSemanticScope(id, hubTaskText ? createHash("sha256").update(hubTaskText).digest("hex") : ""); },
1153
+ 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),
1154
+ getAgentStates: () => agentStates, rosterAdd, rosterDrop,
1155
+ getIdentity: () => identity, getComs: () => coms, resolveTarget,
1156
+ appendMachineHandoffSections, markPeerAddressed,
1157
+ },
1158
+ herdr: {
1159
+ getProcessState: () => processState, processBlock,
1160
+ provisionalCapabilityRefusal, isFleetReady: () => herdrFleetReady, isComsReady: () => comsReady,
1161
+ getIdentity: () => identity, getCurrentContext: () => currentCtx, peersInScope,
1162
+ getComsPeerNames: () => peersInScope().map(peer => peer.name), herdr: herdrApi,
1163
+ readEnvFile: file => fs.readFileSync(file, "utf-8"), envFileExists: file => fs.existsSync(file),
1164
+ getLastPiSpawnAt: () => lastHubPiSpawnAt, setLastPiSpawnAt: value => { lastHubPiSpawnAt = value; },
1165
+ recordSpawnedPeer: (name, paneId) => { hubSpawnedPeers.set(name.toLowerCase(), { name, paneId, addressed: false }); },
1166
+ },
1167
+ });
1168
+
1169
+ const continueTask = createRecoveryContinuation({
1170
+ guard: noProgress, research: toolCtx.executeRecoveryResearch, execute: toolCtx.executeDispatchAgent,
1171
+ sessionDir: () => sessionDir,
1172
+ // A recorded parallel instance (builder--p2) does not survive a restart; re-create it
1173
+ // from its base persona so the continuation keeps the original executor identity.
1174
+ prepareAgent: agent => {
1175
+ const name = normalizeAgentInput(agent), base = basePersonaName(name);
1176
+ if (base === name || agentStates.has(name)) return true;
1177
+ try { addParallelAgentInstance(base, name); } catch { return false; }
1178
+ return agentStates.has(name);
1179
+ },
1180
+ revision: (ctx, invocation) => {
1181
+ const cwd = ctx.cwd || process.cwd();
1182
+ const revision = revisionOf(cwd, revisionScopes(cwd, [...(invocation?.scope ?? []), ...processState.changedFiles]));
1183
+ if (revision === 'unavailable') return revision;
1184
+ const inputs = assertionsArtifactsCtx.loadInputArtifacts(invocation?.artifacts, ctx).map(input => [input.path, createHash('sha256').update(readFileSync(input.path)).digest('hex')]);
1185
+ return createHash('sha256').update(JSON.stringify({ revision, inputs })).digest('hex');
1186
+ },
1187
+ contextIdentity: () => createHash('sha256').update(JSON.stringify({ input: hubTaskText, assertions, assessment: taskTriage?.current?.revision, profile: readActiveProfile() })).digest('hex'),
1188
+ confirm: (input, ctx, ports) => confirmTaskContinuation(input, ctx, {
1189
+ ...ports, taskId: () => noProgress.taskId(), language: () => userLanguage,
1190
+ ask: (id, params, askCtx, signal) => requestRuntimeAsk(pi.events, id, params, askCtx, signal),
1191
+ startWait: id => executionHistory.startAskUser(id),
1192
+ endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
1193
+ }),
1194
+ });
1195
+ registerRecoverTask(pi, continueTask);
1196
+ function triageInput(task: string, scope: string[], language: string, domain: string): TriageInput {
1197
+ const candidates = [...agentStates.values()].map(s => {
1198
+ const name = s.def.name.toLowerCase();
1199
+ const research = ["researcher", "deep-researcher", ...researchPersonas.map(p => p.name.toLowerCase())].includes(name);
1200
+ const gate = processBlock() ?? processPreEffectGate(processState, "child", name) ?? (processAllowsPersona(processState,name) ? null : checkTierPersonaGate(taskTier,name)) ?? checkDocsLane(name, scope, undefined);
1201
+ return { name, description: s.def.description, ...(research ? { excluded: "research_persona" } : s.status === "running" ? { excluded: "busy" } : gate ? { excluded: gate.reason } : {}) };
1202
+ });
1203
+ 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) };
1204
+ }
1205
+ registerDamageGuardHub(pi);
1206
+ registerAgenticHub(pi);
1207
+ registerDiscoveryHub(pi);
1208
+ registerDispatchTriage(pi, { runtime: () => triageRuntime, input: triageInput, blocked: () => provisionalCapabilityRefusal("fleet") });
1209
+
1210
+ // Keep the extracted tool surface flat and greppable in this composition root.
1211
+ registerDispatchAgent(pi, toolCtx, { disposition: (id, persona, reason) => triageRuntime?.disposition(id, persona, reason) ?? false, submitted: (id, persona, status) => triageRuntime?.submitted(id, persona, status) });
1212
+ registerSpawnResearch(pi, toolCtx);
1213
+ registerRunFlow(pi, {
1214
+ sessionDir: () => sessionDir,
1215
+ taskId: () => noProgress.taskId(),
1216
+ processObligations: () => evaluateProcessObligations(processState, { writable: false, budgetTier: taskTier ?? DEFAULT_TASK_TIER }),
1217
+ nestedRepositories: () => nestedRepositoriesInUse(processState),
1218
+ effectiveScoutConfig: cwd => {
1219
+ const persona = resolveFlowPersona("researcher", cwd);
1220
+ const model = persona.model!;
1221
+ assertFlowProfileModel(model);
1222
+ return { model, profile: readActiveProfile()?.name ?? null, tools: persona.tools.split(",").map(value => value.trim()).filter(Boolean), fallback: persona.fallbackModel ?? null, allowlisted: true };
1223
+ },
1224
+ reserveBudget: async (_params, _ctx, signal) => {
1225
+ ensureTaskTier();
1226
+ if (signal?.aborted) return { charged: false, operation: "research", owner: "hub", refusal: "Flow cancelled before budget charge." };
1227
+ turnResearchCount++; taskResearchCount++; turnReport.research++; sessionTotals.research++; budgetCtx.updateModeStatus();
1228
+ return { charged: true, operation: "research", owner: "hub" };
1229
+ },
1230
+ });
1231
+ /** Panel poll ports shared by `/af-poll` and `poll_panel`; only progress delivery differs. */
1232
+ function hubPollPorts(ctx: ExtensionContext, cwd: string, progress: { started(text: string): void; voice(text: string): void }): Omit<AfPollHandleInput, "args"> {
1233
+ return {
1234
+ cwd,
1235
+ pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
1236
+ listPanels: async dir => {
1237
+ const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1238
+ return listPanelNames(dir);
1239
+ },
1240
+ preflight: async ({ panel, persona, cwd: root }) => {
1241
+ const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
1242
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1243
+ import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
1244
+ import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
1245
+ ]);
1246
+ try { resolvePersona(persona, root); }
1247
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1248
+ let voices;
1249
+ try { voices = resolvePanel(panel, root); }
1250
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1251
+ const report = checkChildVisibility(voices.map(voice => voice.model));
1252
+ if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
1253
+ const hidden = report.models.filter(model => !model.ok);
1254
+ if (hidden.length) {
1255
+ return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
1256
+ }
1257
+ return null;
1258
+ },
1259
+ checkBudget: async () => {
1260
+ ensureTaskTier();
1261
+ return null;
1262
+ },
1263
+ chargeBudget: () => {
1264
+ turnDispatchCount += 1;
1265
+ taskDispatchCount += 1;
1266
+ sessionTotals.dispatches += 1;
1267
+ updateModeStatus();
1268
+ },
1269
+ onAccepted: async ({ panel, persona, question }) => {
1270
+ let voices: { name: string; model: string }[] = [];
1271
+ try {
1272
+ const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1273
+ voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
1274
+ } catch { /* names are decorative */ }
1275
+ ctx.ui.setStatus("hub-poll", `Poll: ${panel} (${voices.length || "?"} voices) running…`);
1276
+ ctx.ui.notify(`Poll started — panel ${panel}. This can take a minute.`, "info");
1277
+ progress.started(formatAfPollStarted({ panel, persona, question, voices }));
1278
+ },
1279
+ execute: async ({ panel, persona, question }) => {
1280
+ const [{ Run }, { runPoll }, { runMerge }, { resolvePersona }] = await Promise.all([
1281
+ import("../../agent-fleet/scripts/workflows/lib/run.ts"),
1282
+ import("../../agent-fleet/scripts/workflows/lib/poll.ts"),
1283
+ import("../../agent-fleet/scripts/workflows/lib/merge.ts"),
1284
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1285
+ ]);
1286
+ const run = new Run({ cwd, command: ["/af-poll", "--panel", panel, question] });
1287
+ const personaDef = resolvePersona(persona, cwd);
1288
+ const poll = await runPoll({
1289
+ run, cwd, persona: personaDef, panel, task: question,
1290
+ onVoice: result => {
1291
+ const voice = result.ok
1292
+ ? { name: result.voice.name, model: result.voice.model, ok: true as const, position: result.report.position, confidence: result.report.confidence }
1293
+ : { name: result.voice.name, model: result.voice.model, ok: false as const, reason: result.reason };
1294
+ progress.voice(formatAfPollVoiceProgress(voice));
1295
+ },
1296
+ });
1297
+ ctx.ui.setStatus("hub-poll", `Poll: ${panel} merging…`);
1298
+ const merge = await runMerge({ run, cwd, persona: personaDef, panel, task: question, opinions: poll.results });
1299
+ const directory = path.relative(cwd, poll.directory) || poll.directory;
1300
+ return {
1301
+ panel,
1302
+ directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
1303
+ voices: poll.results.map(item => item.ok
1304
+ ? { name: item.voice.name, model: item.voice.model, ok: true as const, position: item.report.position, confidence: item.report.confidence }
1305
+ : { name: item.voice.name, model: item.voice.model, ok: false as const, reason: item.reason }),
1306
+ recommendation: merge.report.recommendation,
1307
+ integrator: merge.integrator.name,
1308
+ };
1309
+ },
1310
+ };
1311
+ }
1312
+
1313
+ registerPollPanel(pi, {
1314
+ blocked: () => provisionalCapabilityRefusal("fleet")?.content[0]?.text ?? null,
1315
+ run: (params, ctx, onProgress) => withProfileWork(async () => {
1316
+ const cwd = ctx.cwd || process.cwd();
1317
+ try { return await runAfPoll({ ...params, ...hubPollPorts(ctx, cwd, { started: onProgress, voice: onProgress }) }); }
1318
+ finally { ctx.ui.setStatus("hub-poll", ""); }
1319
+ }),
1320
+ });
1321
+ registerSetTaskTier(pi, toolCtx);
1322
+ registerTeamAdjust(pi, toolCtx);
1323
+ registerVerificationContract(pi, toolCtx);
1324
+ registerComsTools(pi, toolCtx);
1325
+ registerFleetTools(pi, toolCtx);
1326
+ registerFilesystemTool(pi, {
1327
+ enabled: () => resolveAssist(readActiveProfile()?.profile.assist)['deterministic-tools'],
1328
+ sessionDir: () => sessionDir,
1329
+ policyRoots: () => sessionOverrides?.policyRoots,
1330
+ managedReadbackAllowed: handle => discoveryManagedReadbackAllowed(pi,handle),
1331
+ });
1332
+
1333
+ const researchControls = createResearchControls({
1334
+ runtime: researchRuntime,
1335
+ refresh: () => {},
1336
+ getAgents: () => agentStates, displayName, modelWorkBlocked: () => false,
1337
+ cancelWait: (state, kind) => cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind } }),
1338
+ cancelOwned: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
1339
+ restartSpecialist: async (state: AgentState, ctx) => {
1340
+ if (state.status === "running" && (state.proc || state.comsAbort)) {
1341
+ let resolveTermination!: () => void;
1342
+ const terminated = new Promise<void>(resolve => { resolveTermination = resolve; });
1343
+ state.onTerminate = resolveTermination;
1344
+ fenceOperatorCancel(state);
1345
+ if (state.proc) { state.killedByOperator = true; state.restarting = true; if (state.dispatchId) proactiveRuntime?.abort(safeAgentKey(state.def.name), state.dispatchId); killPiTree(state.proc); }
1346
+ else await cancelLocalWaitOnly({ abort: state.comsAbort, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), event: { kind: "restart" } });
1347
+ await terminated;
1348
+ }
1349
+ state.sessionFile = null;
1350
+ const result = await dispatchAgent(state.def.name, state.task, ctx);
1351
+ 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 });
1352
+ },
1353
+ });
1354
+
1355
+ // ── ask_user Tool (dispatcher → human) ──
1356
+ //
1357
+ // We do NOT register `ask_user` here. The recommended companion package
1358
+ // `pi-ask-user` (see docs/pi-setup.md) owns that tool name with a richer
1359
+ // implementation. Registering our own conflicts regardless of load order:
1360
+ // - if we register first, pi-ask-user fails to load
1361
+ // - if pi-ask-user registers first, our registration fails
1362
+ // and pi has no synchronous probe at load time — `pi.getAllTools()` is
1363
+ // a runtime action method that throws when called from the factory.
1364
+ //
1365
+ // Instead, in `session_start` (where action methods ARE allowed) we check
1366
+ // `pi.getAllTools()`, gate `ask_user` into `setActiveTools` only if present,
1367
+ // and warn the user to `pi install npm:pi-ask-user` if it's missing.
1368
+
1369
+
1370
+ // ── Commands ─────────────────────────────────
1371
+
1372
+ // /af-config and Alt+, — read-only configuration screen (shared with coms peers via lib/fleet-config).
1373
+ const fleetConfigUi = createFleetConfigUi({
1374
+ readHubOverrides: cwd => parseAgentTeamOverrides(cwd),
1375
+ livePeerNames: () => identity ? readAllRegistryEntries(identity.project).map(entry => entry.name) : [],
1376
+ runtimeRows: () => [
1377
+ { label: "Work mode", detail: workModeStatusText(), origin: "runtime" },
1378
+ { label: "Active roster", detail: activeTeamName ? `${activeTeamName} (${agentStates.size} specialists)` : "(none)", origin: ".pi/agents/teams.yaml" },
1379
+ { label: "Coms identity", detail: identity ? `${identity.name}@${identity.project}${comsReady ? "" : " · not ready"}` : "not connected", origin: "runtime" },
1380
+ { label: "Node", detail: process.version, origin: "runtime" },
1381
+ { label: "Related screens", detail: "/af-agents-team · /af-dispatch-policy · /af-context · /af-allowed · /af-coms", origin: "runtime" },
1382
+ ],
1383
+ });
1384
+ const openFleetConfig = (ctx: ExtensionContext, args = "") => gridUI.withSuspended(() => fleetConfigUi.open(ctx, args));
1385
+
1386
+ const commandCtx: CommandContext = {
1387
+ setWidgetContext: ctx => { widgetCtx = ctx; },
1388
+ handleTaskTriageRecover: () => {
1389
+ if (!processPersistenceBlocked) return false;
1390
+ try {
1391
+ 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,
1392
+ taskId: noProgress.taskId(), budgetTier: taskTier ?? DEFAULT_TASK_TIER,
1393
+ append: record => pi.appendEntry("agent-hub-process-state", record),
1394
+ entries: () => currentCtx?.sessionManager.getEntries() ?? [],
1395
+ });
1396
+ processState = recovered;
1397
+ processPersistenceBlocked = false;
1398
+ resolveIncomingCapabilities(""); applyWorkModeTools();
1399
+ return true;
1400
+ } catch { return false; }
1401
+ },
1402
+ handleTaskTriageWaive: async (args, ctx) => {
1403
+ const [id, ...words] = args.trim().split(/\s+/);
1404
+ const addition = processState.additions?.find(a => a.id === id && a.status === "active" && a.taskId === noProgress.taskId());
1405
+ if (!addition || !words.length || processBlock()) return false;
1406
+ const next = await confirmTaskTriageWaiver(processState, { taskId: addition.taskId, evaluationId: addition.evaluationId, inputRevision: addition.inputRevision, additionId: id, reason: words.join(" ") }, {
1407
+ taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
1408
+ ask: (nonce, question, askCtx, signal) => requestRuntimeAsk(pi.events, nonce, question, askCtx, signal, undefined, 'permission'),
1409
+ startWait: nonce => executionHistory.startAskUser(nonce), endWait: (nonce, sameTask) => { const wait = executionHistory.endAskUser(nonce, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
1410
+ persist: value => pi.appendEntry("agent-hub-process-state", processAuditRecord(value, evaluateProcessObligations(value, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }))),
1411
+ }, ctx);
1412
+ if (next) processState = next;
1413
+ return !!next;
1414
+ },
1415
+ handleAudit: async (ctx, args = "") => {
1416
+ const input = proactiveReportInput();
1417
+ await showSessionAudit(ctx, sessionDir, input && { ...input, labels: commandProactiveLabels(sessionDir, args) }, {
1418
+ ...taskTriageMetadata(), activity: taskTriageActivity?.live(),
1419
+ }, executionTrace.snapshot());
1420
+ },
1421
+ handleRetry: async (args, ctx) => {
1422
+ const dispatchId = args?.trim();
1423
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(dispatchId)) { ctx.ui.notify("Usage: /af-retry <dispatchId>", "error"); return; }
1424
+ const op = noProgress.byDispatch(dispatchId), attempt = op?.attempts.find(a => a.dispatchId === dispatchId);
1425
+ if (!op || !attempt) { ctx.ui.notify("Unknown dispatch ID; no retry authorized.", "error"); return; }
1426
+ await commandCtx.handleRecover(`retry ${op.operationId} ${attempt.attemptId}`, ctx);
1427
+ },
1428
+ handleRecover: async (args, ctx) => {
1429
+ await runRecoverCommand(args, ctx, {
1430
+ noProgress,
1431
+ continueTask,
1432
+ reportContinuation: (content, details) => pi.sendMessage({ customType: 'agent-hub-recovery-continuation', content, display: true, details }, { deliverAs: 'followUp', triggerTurn: false }),
1433
+ currentRevision: cwd => scopes => revisionOf(cwd, [...scopes]),
1434
+ confirm: confirmRecoverAction,
1435
+ askPorts: (op, attempt, action) => ({
1436
+ taskId: () => noProgress.taskId(), language: () => userLanguage,
1437
+ ask: (id: string, params: any, askCtx: any, signal: AbortSignal) => requestRuntimeAsk(pi.events, id, params, askCtx, signal),
1438
+ startWait: (id: string) => executionHistory.startAskUser(id),
1439
+ endWait: (id: string, sameTask: boolean) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
1440
+ 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)); },
1441
+ 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),
1442
+ }),
1443
+ });
1444
+ },
1445
+
1446
+ handleAgentsTeam: async (_args, ctx) => {
1447
+ widgetCtx = ctx;
1448
+ const teamNames = Object.keys(teams);
1449
+ if (teamNames.length === 0) {
1450
+ ctx.ui.notify("No teams defined in .pi/agents/teams.yaml", "warning");
1451
+ return;
1452
+ }
1453
+
1454
+ const options = teamNames.map(name => {
1455
+ const members = teams[name].map(m => displayName(m));
1456
+ return `${name} — ${members.join(", ")}`;
1457
+ });
1458
+
1459
+ const choice = await ctx.ui.select("Select Team", options);
1460
+ if (choice === undefined) return;
1461
+
1462
+ const idx = options.indexOf(choice);
1463
+ const name = teamNames[idx];
1464
+ const selected = resolveSessionRoster({
1465
+ teams,
1466
+ entries: [],
1467
+ explicitRoster: name,
1468
+ availablePersonas: allAgentDefs.map(def => def.name),
1469
+ });
1470
+ if (!selected.roster) {
1471
+ ctx.ui.notify(`${selected.diagnostic} Fix .pi/agents/teams.yaml or select another team.`, "error");
1472
+ return;
1473
+ }
1474
+ activateTeam(selected.roster.name);
1475
+ persistActiveRoster();
1476
+ resolveIncomingCapabilities("");
1477
+ applyWorkModeTools();
1478
+ setTimeout(replayDeferredRecoveryInputs, 0);
1479
+ updateWidget();
1480
+ ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
1481
+ ctx.ui.notify(`Team: ${name} — ${Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ")}`, "info");
1482
+ },
1483
+ handleAgentsList: async (_args, _ctx) => {
1484
+ widgetCtx = _ctx;
1485
+ await openFleetDashboard(_ctx);
1486
+ },
1487
+ handleAgentsHistory: async (_args, ctx) => {
1488
+ widgetCtx = ctx;
1489
+ await openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub"));
1490
+ },
1491
+ handleAgentsAdd: async (args, ctx) => {
1492
+ widgetCtx = ctx;
1493
+ const names = (args || "").trim().split(/\s+/).filter(Boolean);
1494
+ if (names.length === 0) {
1495
+ const available = allAgentDefs
1496
+ .filter(d => !agentStates.has(d.name.toLowerCase()))
1497
+ .map(d => d.name).sort().join(", ") || "(all personas are already in the team)";
1498
+ ctx.ui.notify(`Usage: /af-agents-add <persona> [<persona>…]\nNot in the team yet: ${available}`, "info");
1499
+ return;
1500
+ }
1501
+ const results = names.map(n => rosterAdd(n));
1502
+ const level = results.some(r => r.ok) ? "info" : "error";
1503
+ ctx.ui.notify(results.map(r => r.message).join("\n"), level);
1504
+ ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
1505
+ },
1506
+ handleAgentsDrop: async (args, ctx) => {
1507
+ widgetCtx = ctx;
1508
+ const names = (args || "").trim().split(/\s+/).filter(Boolean);
1509
+ if (names.length === 0) {
1510
+ ctx.ui.notify(`Usage: /af-agents-drop <persona> [<persona>…]\nActive team: ${Array.from(agentStates.values()).map(s => s.def.name).join(", ")}`, "info");
1511
+ return;
1512
+ }
1513
+ const results = names.map(n => rosterDrop(n));
1514
+ const level = results.some(r => r.ok) ? "info" : "error";
1515
+ ctx.ui.notify(results.map(r => r.message).join("\n"), level);
1516
+ ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"}* (${agentStates.size})`);
1517
+ },
1518
+ handleAgentsSave: async (args, ctx) => {
1519
+ widgetCtx = ctx;
1520
+ const name = (args || "").trim();
1521
+ if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(name)) {
1522
+ ctx.ui.notify("Usage: /af-agents-save <team-name> (letters, digits, hyphens, underscores)", "error");
1523
+ return;
1524
+ }
1525
+ const members = Array.from(agentStates.values()).map(s => s.def.name);
1526
+ if (members.length === 0) {
1527
+ ctx.ui.notify("The active team is empty — nothing to save.", "error");
1528
+ return;
1529
+ }
1530
+ const teamsPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "teams.yaml");
1531
+ let raw = "";
1532
+ try { raw = existsSync(teamsPath) ? readFileSync(teamsPath, "utf-8") : ""; } catch {}
1533
+ try {
1534
+ mkdirSync(join(ctx.cwd || process.cwd(), ".pi", "agents"), { recursive: true });
1535
+ writeFileSync(teamsPath, upsertTeamInYaml(raw, name, members), "utf-8");
1536
+ } catch (err) {
1537
+ ctx.ui.notify(`Could not write ${teamsPath}: ${err instanceof Error ? err.message : String(err)}`, "error");
1538
+ return;
1539
+ }
1540
+ teams[name] = members;
1541
+ activeTeamName = name;
1542
+ persistActiveRoster();
1543
+ ctx.ui.setStatus("agent-team", `Team: ${name} (${agentStates.size})`);
1544
+ ctx.ui.notify(`Team "${name}" saved to .pi/agents/teams.yaml — ${members.join(", ")}`, "info");
1545
+ },
1546
+ handleAgentsKill: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleKill(args, ctx); },
1547
+ handleAgentsRestart: async (args, ctx) => { widgetCtx = ctx; await researchControls.handleRestart(args, ctx); },
1548
+ handleContext: async (_args, ctx) => {
1549
+ widgetCtx = ctx;
1550
+ await openContextBudget(ctx);
1551
+ },
1552
+ handleConfig: async (args, ctx) => {
1553
+ widgetCtx = ctx;
1554
+ await openFleetConfig(ctx, args);
1555
+ },
1556
+ handleHubReport: async (args, ctx) => {
1557
+ widgetCtx = ctx;
1558
+ const fmtTok = (n: number) => n >= 1_000_000 ? `${(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${Math.round(n / 1000)}k` : String(n);
1559
+ const renderReport = (label: string, r: TurnReport): string => {
1560
+ const billed = r.dispatches.reduce((n, d) => n + d.billed, 0);
1561
+ const out = r.dispatches.reduce((n, d) => n + d.out, 0);
1562
+ 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`);
1563
+ return [
1564
+ `${label} — tier ${r.tier ?? "(unset)"} · ${r.dispatches.length} dispatch(es) · ${r.research} research · ` +
1565
+ `${fmtTok(billed)} billed / ${fmtTok(out)} out · ${r.recycles} recycle(s) · ${r.driftStops} drift stop(s) · ${r.refusals} refusal(s)`,
1566
+ ...rows,
1567
+ ].join("\n");
1568
+ };
1569
+ const lines: string[] = [];
1570
+ if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) {
1571
+ lines.push(renderReport("Current turn", turnReport));
1572
+ }
1573
+ if (lastTurnReport) lines.push(renderReport("Last turn", lastTurnReport));
1574
+ lines.push(
1575
+ `Session — ${sessionTotals.turns} dispatching turn(s) · ${sessionTotals.dispatches} dispatch(es) · ${sessionTotals.research} research · ` +
1576
+ `${fmtTok(sessionTotals.billed)} billed / ${fmtTok(sessionTotals.out)} out · ${sessionTotals.recycles} recycle(s) · ` +
1577
+ `${sessionTotals.driftStops} drift stop(s) · ${sessionTotals.refusals} refusal(s)`,
1578
+ );
1579
+ const sweep = unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()));
1580
+ if (sweep) lines.push(sweep.message);
1581
+ const trace = readWatchdogEvents(sessionDir);
1582
+ lines.push(`Watchdog System 1 — ${JSON.stringify(buildWatchdogReport(trace.events, watchdogActivity?.live(), trace.integrity))}`);
1583
+ const proactiveInput = proactiveReportInput();
1584
+ lines.push(`Proactive review — ${JSON.stringify(proactiveInput ? buildProactiveReport({ ...proactiveInput, labels: commandProactiveLabels(sessionDir, args) }) : readProactiveReport(sessionDir))}`);
1585
+ ctx.ui.notify(lines.join("\n\n"), "info");
1586
+ },
1587
+ handleZoom: async (args, ctx) => {
1588
+ widgetCtx = ctx;
1589
+ const arg = args?.trim() || "";
1590
+ const rid = parseResearchHandle(arg);
1591
+ const target: Zoomable | undefined = rid != null
1592
+ ? researchStates.get(rid)
1593
+ : arg
1594
+ ? agentStates.get(arg.toLowerCase()) ?? findDelegationChild(arg)?.child
1595
+ : undefined;
1596
+ if (!target) {
1597
+ const teamKnown = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
1598
+ const researchKnown = Array.from(researchStates.values()).map(s => `r${s.id}`).join(", ");
1599
+ const childKnown = Array.from(agentStates.values())
1600
+ .flatMap(s => Array.from(s.delegations?.keys() || [])).join(", ");
1601
+ const known = [teamKnown, researchKnown, childKnown].filter(Boolean).join(", ");
1602
+ ctx.ui.notify(`Usage: /af-zoom <name|rN|child-id>. Known: ${known || "none"}`, "error");
1603
+ return;
1604
+ }
1605
+ const rowKey = (rid != null ? `r${rid}` : arg).toLowerCase();
1606
+ const row = fleetRows(true).find(r => r.key.toLowerCase() === rowKey);
1607
+ if (row) await openFleetDetail(row, ctx);
1608
+ else await openZoom(target, ctx);
1609
+ },
1610
+ handleDispatchPolicy: async (_args, ctx) => {
1611
+ widgetCtx = ctx;
1612
+ const live = new Set(comsReady && identity ? peersInScope().map(e => e.name.toLowerCase()) : []);
1613
+ const lines = Array.from(agentStates.values()).map(s => {
1614
+ const key = s.def.name.toLowerCase();
1615
+ const sub = dispatchPolicy.substitutions[key];
1616
+ const prefer = sub ? sub.prefer : dispatchPolicy.default === "coms" ? "coms" : "native";
1617
+ if (prefer !== "coms") return `${displayName(s.def.name)}: native`;
1618
+ const fb = sub?.fallback === "none" ? "coms-required" : "coms, fallback native";
1619
+ return `${displayName(s.def.name)}: ${fb} — peer ${live.has(key) ? "LIVE" : "not in pool"}`;
1620
+ });
1621
+ const policyPath = join(ctx.cwd || process.cwd(), ".pi", "agents", "dispatch-policy.yaml");
1622
+ const src = existsSync(policyPath) ? ".pi/agents/dispatch-policy.yaml" : "(no dispatch-policy.yaml — all native)";
1623
+ ctx.ui.notify(
1624
+ `Dispatch backends — ${src}, default: ${dispatchPolicy.default}\n${lines.join("\n") || "(no active team)"}\n` +
1625
+ `Routing is decided per dispatch against the live coms pool (/af-coms to refresh).`,
1626
+ "info",
1627
+ );
1628
+ },
1629
+ handleAgentModel: async (args, ctx) => {
1630
+ widgetCtx = ctx;
1631
+ const arg = (args || "").trim().toLowerCase();
1632
+
1633
+ // Dot form: <persona>.<role> targets a delegate sub-role. Candidates are
1634
+ // the role's declared model (default) + the parent's candidate list.
1635
+ if (arg.includes(".")) {
1636
+ const dot = arg.indexOf(".");
1637
+ const personaName = arg.slice(0, dot);
1638
+ const roleName = arg.slice(dot + 1);
1639
+ const parent = agentStates.get(personaName);
1640
+ const roles = parent?.def.subagents || {};
1641
+ const roleKey = Object.keys(roles).find(r => r.toLowerCase() === roleName);
1642
+ if (!parent || !roleKey) {
1643
+ const valid = Array.from(agentStates.values()).flatMap(s =>
1644
+ Object.keys(s.def.subagents || {}).map(r => `${s.def.name}.${r}`));
1645
+ ctx.ui.notify(
1646
+ `No sub-role "${arg}". Valid targets: ${valid.join(", ") || "none (no persona declares subagents:)"}`,
1647
+ "error",
1648
+ );
1649
+ return;
1650
+ }
1651
+ const role = roles[roleKey];
1652
+ const overrideKey = `${personaName}.${roleKey.toLowerCase()}`;
1653
+ const candidates: string[] = [];
1654
+ for (const m of [role.model, ...allowedModels(parent.def)]) {
1655
+ if (m && !candidates.includes(m)) candidates.push(m);
1656
+ }
1657
+ const current = resolvedSubagentModel(parent.def.name, roleKey, role.model);
1658
+ const options = candidates.map(m => {
1659
+ const tags = [m === role.model ? "default" : "", m === current ? "current" : ""].filter(Boolean);
1660
+ return tags.length ? `${m} (${tags.join(", ")})` : m;
1661
+ });
1662
+ const label = `${displayName(parent.def.name)}.${roleKey}`;
1663
+ const choice = await ctx.ui.select(`Model for ${label}`, options);
1664
+ if (choice === undefined) return;
1665
+ const picked = candidates[options.indexOf(choice)];
1666
+ const effectivePicked = substitutedModel(picked) ?? picked;
1667
+ if (effectivePicked === current) {
1668
+ ctx.ui.notify(`${label} is already on ${effectivePicked}`, "info");
1669
+ return;
1670
+ }
1671
+ if (picked === role.model) {
1672
+ modelPolicy.setSubagentOverride(personaName, roleKey, undefined);
1673
+ } else {
1674
+ modelPolicy.setSubagentOverride(personaName, roleKey, picked);
1675
+ }
1676
+ updateWidget();
1677
+ ctx.ui.notify(
1678
+ `${label} → ${effectivePicked} (applies on next dispatch of ${parent.def.name})`,
1679
+ "info",
1680
+ );
1681
+ return;
1682
+ }
1683
+
1684
+ const name = arg;
1685
+ // Team member (live state) OR a research persona — both switchable.
1686
+ const def = name ? switchablePersonaDef(name) : undefined;
1687
+ if (!def) {
1688
+ const known = [
1689
+ ...Array.from(agentStates.values()).map(s => s.def.name),
1690
+ ...researchPersonas.map(d => d.name),
1691
+ ].join(", ");
1692
+ ctx.ui.notify(`Usage: /af-agent-model <persona>[.<role>]. Known: ${known || "none"}`, "error");
1693
+ return;
1694
+ }
1695
+ if (!def.models || def.models.length === 0) {
1696
+ ctx.ui.notify(
1697
+ `${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.`,
1698
+ "warning",
1699
+ );
1700
+ return;
1701
+ }
1702
+ const candidates = allowedModels(def);
1703
+ const current = resolvedModel(def);
1704
+ // A persona without a frontmatter default runs on the dispatcher's model —
1705
+ // offer that as an explicit candidate so the override can be cleared.
1706
+ const DISPATCHER_DEFAULT = "(dispatcher's model)";
1707
+ if (!def.model) candidates.unshift(DISPATCHER_DEFAULT);
1708
+ const options = candidates.map(m => {
1709
+ const isDefault = def.model ? m === def.model : m === DISPATCHER_DEFAULT;
1710
+ const isCurrent = current ? m === current : m === DISPATCHER_DEFAULT;
1711
+ const tags = [isDefault ? "default" : "", isCurrent ? "current" : ""].filter(Boolean);
1712
+ return tags.length ? `${m} (${tags.join(", ")})` : m;
1713
+ });
1714
+ const choice = await ctx.ui.select(`Model for ${displayName(def.name)}`, options);
1715
+ if (choice === undefined) return;
1716
+ const picked = candidates[options.indexOf(choice)];
1717
+ const effectivePicked = picked === DISPATCHER_DEFAULT ? picked : (substitutedModel(picked) ?? picked);
1718
+ const pickedIsCurrent = current ? effectivePicked === current : picked === DISPATCHER_DEFAULT;
1719
+ if (pickedIsCurrent) {
1720
+ ctx.ui.notify(`${displayName(def.name)} is already on ${effectivePicked}`, "info");
1721
+ return;
1722
+ }
1723
+ if (picked === def.model || picked === DISPATCHER_DEFAULT) {
1724
+ modelPolicy.setPersonaOverride(name, undefined);
1725
+ } else {
1726
+ modelPolicy.setPersonaOverride(name, picked);
1727
+ }
1728
+ updateWidget();
1729
+ // Research helpers spawn fresh each time, so the switch lands on their
1730
+ // next spawn; team members apply on next dispatch (restartable now).
1731
+ const applyHint = (def.kind || "").toLowerCase() === "research"
1732
+ ? "applies on next spawn_research"
1733
+ : `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
1734
+ ctx.ui.notify(`${displayName(def.name)} → ${effectivePicked} (${applyHint})`, "info");
1735
+ if ((dispatchPolicy.substitutions[name]?.prefer ?? dispatchPolicy.default) === "coms") {
1736
+ ctx.ui.notify(
1737
+ `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.`,
1738
+ "info",
1739
+ );
1740
+ }
1741
+ },
1742
+ handleAgentModelThinking: async (args, ctx) => {
1743
+ widgetCtx = ctx;
1744
+ const name = (args || "").trim().toLowerCase();
1745
+ // Team member (live state) OR a research persona — both switchable.
1746
+ const def = name ? switchablePersonaDef(name) : undefined;
1747
+ if (!def) {
1748
+ const known = [
1749
+ ...Array.from(agentStates.values()).map(s => s.def.name),
1750
+ ...researchPersonas.map(d => d.name),
1751
+ ].join(", ");
1752
+ ctx.ui.notify(`Usage: /af-agent-model-thinking <persona>. Known: ${known || "none"}`, "error");
1753
+ return;
1754
+ }
1755
+ const defaultLevel = resolveThinkingLevel(def.thinking);
1756
+ const current = resolveThinkingLevel(resolvedThinking(def));
1757
+ const levels = [...THINKING_LEVELS];
1758
+ const options = levels.map(l => {
1759
+ const tags = [l === defaultLevel ? "default" : "", l === current ? "current" : ""].filter(Boolean);
1760
+ return tags.length ? `${l} (${tags.join(", ")})` : l;
1761
+ });
1762
+ const choice = await ctx.ui.select(`Thinking level for ${displayName(def.name)}`, options);
1763
+ if (choice === undefined) return;
1764
+ const picked = levels[options.indexOf(choice)];
1765
+ if (picked === current) {
1766
+ ctx.ui.notify(`${displayName(def.name)} is already on thinking: ${picked}`, "info");
1767
+ return;
1768
+ }
1769
+ if (picked === defaultLevel) {
1770
+ modelPolicy.setThinkingOverride(name, undefined);
1771
+ } else {
1772
+ modelPolicy.setThinkingOverride(name, picked);
1773
+ }
1774
+ updateWidget();
1775
+ // Research helpers spawn fresh each time, so the switch lands on their
1776
+ // next spawn; team members apply on next dispatch (restartable now).
1777
+ const applyHint = (def.kind || "").toLowerCase() === "research"
1778
+ ? "applies on next spawn_research"
1779
+ : `applies on next dispatch; /af-agents-restart ${def.name} to apply now`;
1780
+ ctx.ui.notify(`${displayName(def.name)} thinking → ${picked} (${applyHint})`, "info");
1781
+ },
1782
+ handleModels: async (args, ctx) => {
1783
+ widgetCtx = ctx;
1784
+ const names = Object.keys(modelProfiles);
1785
+ if (names.length === 0) {
1786
+ ctx.ui.notify("No model profiles loaded — define .pi/agents/model-profiles.yaml (invalid profiles are dropped at session start).", "warning");
1787
+ return;
1788
+ }
1789
+ let profileName = (args || "").trim();
1790
+ if (!profileName) {
1791
+ const options = names.map(n =>
1792
+ isCompleteProfile(modelProfiles[n])
1793
+ ? `${n} — complete fleet (${shortModel((modelProfiles[n] as any).defaults.model)} default)`
1794
+ : `${n} — ${Object.entries(modelProfiles[n]).map(([p, m]) => `${p}: ${shortModel(m)}`).join(", ")}`,
1795
+ );
1796
+ const choice = await ctx.ui.select("Select model profile", options);
1797
+ if (choice === undefined) return;
1798
+ profileName = names[options.indexOf(choice)];
1799
+ }
1800
+ const profile = modelProfiles[profileName];
1801
+ if (!profile) {
1802
+ ctx.ui.notify(`No profile "${profileName}". Known: ${names.join(", ")}`, "error");
1803
+ return;
1804
+ }
1805
+ profileCommandContext=ctx;
1806
+ try {
1807
+ const applied=await profileActivation.activate(profileName,profile);
1808
+ applyWorkModeTools();
1809
+ ctx.ui.setStatus('hub-model-profile',isCompleteProfile(profile)?`Models: ${profileName}`:undefined);
1810
+ ctx.ui.notify(`Profile "${profileName}": ${applied.length} personas${isCompleteProfile(profile)?', all children, dispatcher and auxiliary models':''} switched.`, 'info');
1811
+ } catch(error) {ctx.ui.notify(String(error),'error');}
1812
+ },
1813
+ handleAgentModelsSubstitute: async (args, ctx) => {
1814
+ widgetCtx = ctx;
1815
+ const tokens = (args || "").trim().split(/\s+/).filter(Boolean);
1816
+ if (tokens.length === 0) {
1817
+ if (allKnownModels().length === 0) {
1818
+ ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning");
1819
+ return;
1820
+ }
1821
+ await openFleetDashboard(ctx, true);
1822
+ return;
1823
+ }
1824
+ if (tokens.length !== 2) {
1825
+ ctx.ui.notify("Usage: /af-agent-models-substitute [<source> <target>]", "error");
1826
+ return;
1827
+ }
1828
+ await applySessionModelSubstitution(tokens[0], tokens[1], ctx);
1829
+ },
1830
+ handleWatchdog: async (args, ctx) => {
1831
+ widgetCtx = ctx;
1832
+ const parts = (args || "").trim().split(/\s+/).filter(Boolean);
1833
+ if (parts.length === 0) {
1834
+ const perAgent = watchdogAgentOverrides.size > 0
1835
+ ? Array.from(watchdogAgentOverrides.entries()).map(([k, v]) => `${k}: ${v}`).join(", ")
1836
+ : "(none)";
1837
+ ctx.ui.notify(
1838
+ `Drift watchdog: ${watchdogSetting} (hub-wide)\nPer-agent overrides: ${perAgent}\n` +
1839
+ `Judge model: ${watchdogJudgeModel || "(researcher persona's, else dispatcher's)"}\n` +
1840
+ `${formatWatchdogStatus(watchdogSystem1, watchdogActivity)}\n` +
1841
+ `Usage: /af-watchdog on|off|auto — or /af-watchdog <agent> on|off|clear`,
1842
+ "info",
1843
+ );
1844
+ return;
1845
+ }
1846
+ if (parts.length === 1) {
1847
+ const setting = normalizeWatchdogSetting(parts[0]);
1848
+ if (!setting) {
1849
+ ctx.ui.notify(`Unknown setting "${parts[0]}" — expected one of: ${WATCHDOG_SETTINGS.join(", ")} (or /af-watchdog <agent> on|off|clear)`, "error");
1850
+ return;
1851
+ }
1852
+ watchdogSetting = setting;
1853
+ ctx.ui.notify(`Drift watchdog → ${setting} (applies from the next dispatch)`, "info");
1854
+ return;
1855
+ }
1856
+ const agentKey = normalizeAgentInput(parts[0]);
1857
+ const value = parts[1].toLowerCase();
1858
+ if (!agentStates.has(agentKey)) {
1859
+ ctx.ui.notify(`"${parts[0]}" is not in the active team (${Array.from(agentStates.values()).map(s => s.def.name).join(", ")})`, "error");
1860
+ return;
1861
+ }
1862
+ if (value === "clear") {
1863
+ watchdogAgentOverrides.delete(agentKey);
1864
+ ctx.ui.notify(`Drift watchdog override cleared for ${agentKey} (hub-wide setting "${watchdogSetting}" applies)`, "info");
1865
+ return;
1866
+ }
1867
+ if (value !== "on" && value !== "off") {
1868
+ ctx.ui.notify(`Per-agent watchdog must be on, off, or clear — got "${parts[1]}"`, "error");
1869
+ return;
1870
+ }
1871
+ watchdogAgentOverrides.set(agentKey, value);
1872
+ ctx.ui.notify(`Drift watchdog for ${agentKey} → ${value} (overrides the hub-wide "${watchdogSetting}")`, "info");
1873
+ },
1874
+ handleComs: async (args, ctx) => {
1875
+ if (!comsReady) { ctx.ui.notify("coms is not active in this session.", "warning"); return; }
1876
+ await coms.updateScope((args ?? "").trim(), ctx);
1877
+ },
1878
+ handleHandoff: async (args, ctx) => {
1879
+ if (!comsReady) { ctx.ui.notify("coms is not active in this session — /af-handoff unavailable.", "warning"); return; }
1880
+ const target = (args ?? "").trim();
1881
+ if (!target) {
1882
+ ctx.ui.notify("Usage: /af-handoff <peer>. See the coms pool for live peer names.", "error");
1883
+ return;
1884
+ }
1885
+ const peer = resolveTarget(target);
1886
+ if (!peer) {
1887
+ ctx.ui.notify(`coms: no live peer "${target}". Use /af-coms to refresh the pool.`, "error");
1888
+ return;
1889
+ }
1890
+ const refusal=profilePeerGate({ peerModel: peer.model, targetResolved: true });if(refusal){ctx.ui.notify(refusal.content[0].text,"error");return;}
1891
+ const handoffToken = crypto.randomBytes(8).toString("hex");
1892
+ hubStateCtx.setPendingHandoff({ target: peer.name, token: handoffToken });
1893
+ pi.sendMessage({
1894
+ customType: "coms-handoff",
1895
+ content:
1896
+ `HANDOFF REQUEST → peer "${peer.name}".\n\n` +
1897
+ `Compose a SELF-CONTAINED handoff brief (the peer does NOT share your context): state the ` +
1898
+ `overall goal, what's been done so far, key decisions and constraints, the current status, ` +
1899
+ `and the concrete next steps you want the peer to take. Then call ` +
1900
+ `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 ` +
1901
+ `the peer's reply to me in ${userLanguage}.`,
1902
+ display: true,
1903
+ }, { deliverAs: "followUp", triggerTurn: true });
1904
+ ctx.ui.notify(`Handoff to ${peer.name}: asking the dispatcher to compose a brief…`, "info");
1905
+ },
1906
+ handleCompound: async (args, ctx) => {
1907
+ if (!agentStates.has("documenter")) {
1908
+ ctx.ui.notify(
1909
+ "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.",
1910
+ "warning",
1911
+ );
1912
+ return;
1913
+ }
1914
+ const focus = (args ?? "").trim();
1915
+ const rulesLine = projectRulesDirs.length > 0
1916
+ ? projectRulesDirs.join(", ")
1917
+ : "(none declared in .ai/agent-fleet-overrides.md — the documenter must locate an existing rules tree or, failing that, propose lessons without writing)";
1918
+ const docsLine = projectDocsPaths.length > 0
1919
+ ? projectDocsPaths.join(", ")
1920
+ : "(none declared)";
1921
+ pi.sendMessage({
1922
+ customType: "compound-learning",
1923
+ content:
1924
+ `COMPOUND REQUEST — capture this session's lessons into the project's rules and docs (compound-learning pass).\n\n` +
1925
+ `1. From THIS session's context, compose a candidate-lessons brief: user corrections, review findings that recurred, ` +
1926
+ `wrong assumptions that cost rework, debugging root causes, and changes that invalidated existing docs. At most 5 lessons; ` +
1927
+ `each is one imperative sentence plus a one-line Why (the failure it prevents) and a one-line Evidence (what happened this session). ` +
1928
+ `${focus ? `Focus especially on: ${focus}. ` : ""}` +
1929
+ `If nothing rises to a lesson, tell the user there is nothing worth compounding and stop.\n` +
1930
+ `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` +
1931
+ `3. Dispatch the documenter with a SELF-CONTAINED task (it shares none of your context) containing: the approved lessons verbatim ` +
1932
+ `(with Why + Evidence); the project rule folders: ${rulesLine}; the docs entry points: ${docsLine}; the assertion ledger path ` +
1933
+ `.pi/agent-sessions/assertions.json (when it exists); and the instruction to read skills/compound-learning/SKILL.md and follow it exactly — ` +
1934
+ `dedupe index-first against the existing rule tree, minimal diffs on existing files, caps of 5 lessons / 1 new file. State that the user ` +
1935
+ `already approved this lesson list, so it may apply without a second gate. Pass the relevant review/return/evidence artifact paths via the ` +
1936
+ `dispatch's artifacts array — paths only, never pasted bodies.\n` +
1937
+ `4. Relay the documenter's file-by-file result to me in ${userLanguage}.`,
1938
+ display: true,
1939
+ }, { deliverAs: "followUp", triggerTurn: true });
1940
+ ctx.ui.notify("Compound: asking the dispatcher to compose the candidate-lessons brief…", "info");
1941
+ },
1942
+ handlePoll: async (args, ctx) => {
1943
+ return withProfileWork(async () => {
1944
+ const cwd = ctx.cwd || process.cwd();
1945
+ const followUp = (customType: string) => (content: string) => pi.sendMessage({ customType, content, display: true }, { deliverAs: "followUp", triggerTurn: false });
1946
+ const result = await handleAfPoll({ args: args ?? "", ...hubPollPorts(ctx, cwd, { started: followUp("af-poll-started"), voice: followUp("af-poll-voice") }) });
1947
+ ctx.ui.setStatus("hub-poll", "");
1948
+ if (!result.ok) {
1949
+ ctx.ui.notify(result.message, "error");
1950
+ pi.sendMessage({ customType: "af-poll-failed", content: `POLL FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
1951
+ return;
1952
+ }
1953
+ ctx.ui.notify(result.digest ?? result.message, "info");
1954
+ pi.sendMessage({
1955
+ customType: "af-poll",
1956
+ content: result.dispatcherNote ?? result.message,
1957
+ display: true,
1958
+ }, { deliverAs: "followUp", triggerTurn: true });
1959
+ });
1960
+ },
1961
+ handleDebate: async (args, ctx) => {
1962
+ return withProfileWork(async () => {
1963
+ const cwd = ctx.cwd || process.cwd();
1964
+ const result = await handleAfDebate({
1965
+ args: args ?? "",
1966
+ cwd,
1967
+ pollPanelOverride: readActiveProfile()?.name ?? parseAgentTeamOverrides(cwd).pollPanel,
1968
+ listPanels: async dir => {
1969
+ const { listPanelNames } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
1970
+ return listPanelNames(dir);
1971
+ },
1972
+ preflight: async ({ panel, persona, cwd: root }) => {
1973
+ const [{ resolvePersona }, { resolvePanel }, { checkChildVisibility }] = await Promise.all([
1974
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
1975
+ import("../../agent-fleet/scripts/workflows/lib/voices.ts"),
1976
+ import("../../agent-fleet/scripts/workflows/lib/model-visibility.ts"),
1977
+ ]);
1978
+ try { resolvePersona(persona, root); }
1979
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1980
+ let voices;
1981
+ try { voices = resolvePanel(panel, root); }
1982
+ catch (error) { return error instanceof Error ? error.message : String(error); }
1983
+ const report = checkChildVisibility(voices.map(voice => voice.model));
1984
+ if (report.diagnostic) return `could not verify clean-room model visibility (${report.diagnostic})`;
1985
+ const hidden = report.models.filter(model => !model.ok);
1986
+ if (hidden.length) {
1987
+ return `panel "${panel}" has models not visible to a clean-room child: ${hidden.map(model => model.reasons[0] ?? model.model).join("; ")}`;
1988
+ }
1989
+ return null;
1990
+ },
1991
+ checkBudget: async () => {
1992
+ ensureTaskTier();
1993
+ return null;
1994
+ },
1995
+ chargeBudget: () => {
1996
+ turnDispatchCount += 1;
1997
+ taskDispatchCount += 1;
1998
+ sessionTotals.dispatches += 1;
1999
+ updateModeStatus();
2000
+ },
2001
+ onAccepted: async ({ panel, persona, question, rounds }) => {
2002
+ let voices: { name: string; model: string }[] = [];
2003
+ try {
2004
+ const { resolvePanel } = await import("../../agent-fleet/scripts/workflows/lib/voices.ts");
2005
+ voices = resolvePanel(panel, cwd).map(voice => ({ name: voice.name, model: voice.model }));
2006
+ } catch { /* names are decorative */ }
2007
+ const started = formatAfDebateStarted({ panel, persona, question, rounds, voices });
2008
+ ctx.ui.setStatus("hub-poll", `Debate: ${panel} (${rounds} rounds) running…`);
2009
+ ctx.ui.notify(`Debate started — panel ${panel}, ${rounds} rounds.`, "info");
2010
+ pi.sendMessage({ customType: "af-debate-started", content: started, display: true }, { deliverAs: "followUp", triggerTurn: false });
2011
+ },
2012
+ execute: async ({ panel, persona, question, rounds }) => {
2013
+ const [{ Run }, { runDebate }, { resolvePersona }] = await Promise.all([
2014
+ import("../../agent-fleet/scripts/workflows/lib/run.ts"),
2015
+ import("../../agent-fleet/scripts/workflows/lib/debate.ts"),
2016
+ import("../../agent-fleet/scripts/workflows/lib/personas.ts"),
2017
+ ]);
2018
+ const run = new Run({ cwd, command: ["/af-debate", "--panel", panel, "--rounds", String(rounds), question] });
2019
+ const personaDef = resolvePersona(persona, cwd);
2020
+ const debate = await runDebate({
2021
+ run, cwd, persona: personaDef, panel, task: question, rounds,
2022
+ onVoice: (result, round) => {
2023
+ const voice = result.ok
2024
+ ? { name: result.voice.name, model: result.voice.model, ok: true as const, round, position: result.report.position, changed: result.report.changed }
2025
+ : { name: result.voice.name, model: result.voice.model, ok: false as const, round, reason: result.reason };
2026
+ ctx.ui.setStatus("hub-poll", `Debate: ${panel} round ${round}…`);
2027
+ pi.sendMessage({ customType: "af-debate-voice", content: formatAfDebateVoiceProgress(voice), display: true }, { deliverAs: "followUp", triggerTurn: false });
2028
+ },
2029
+ });
2030
+ const last = debate.roundsRun.at(-1)?.results ?? [];
2031
+ const directory = path.relative(cwd, debate.directory) || debate.directory;
2032
+ return {
2033
+ panel, rounds: debate.rounds,
2034
+ directory: directory.endsWith(path.sep) ? directory : `${directory}${path.sep}`,
2035
+ voices: last.map(item => item.ok
2036
+ ? { name: item.voice.name, model: item.voice.model, ok: true as const, round: item.round, position: item.report.position, changed: item.report.changed }
2037
+ : { name: item.voice.name, model: item.voice.model, ok: false as const, round: item.round, reason: item.reason }),
2038
+ };
2039
+ },
2040
+ });
2041
+ ctx.ui.setStatus("hub-poll", "");
2042
+ if (!result.ok) {
2043
+ ctx.ui.notify(result.message, "error");
2044
+ pi.sendMessage({ customType: "af-debate-failed", content: `DEBATE FAILED\n\n${result.message}`, display: true }, { deliverAs: "followUp", triggerTurn: false });
2045
+ return;
2046
+ }
2047
+ ctx.ui.notify(result.digest ?? result.message, "info");
2048
+ pi.sendMessage({
2049
+ customType: "af-debate",
2050
+ content: result.dispatcherNote ?? result.message,
2051
+ display: true,
2052
+ }, { deliverAs: "followUp", triggerTurn: true });
2053
+ });
2054
+ },
2055
+ getAgentsKillCompletions: prefix => completions.agentsKill(prefix),
2056
+ getZoomCompletions: prefix => completions.zoom(prefix),
2057
+ getAgentModelCompletions: prefix => completions.agentModels(prefix),
2058
+ getAgentModelThinkingCompletions: prefix => completions.agentThinking(prefix),
2059
+ getModelProfileCompletions: prefix => completions.modelProfiles(prefix),
2060
+ getSubstituteCompletions: prefix => completions.substitutions(prefix),
2061
+ getComsPeerCompletions: prefix => completions.comsPeers(prefix),
2062
+ getSubagentTargetCompletions: prefix => completions.subagentTargets(prefix),
2063
+ };
2064
+
2065
+ // Keep the complete command surface flat and greppable in this composition root.
2066
+ registerAgentsTeam(pi, commandCtx);
2067
+ registerAgentsList(pi, commandCtx);
2068
+ registerAgentsHistory(pi, commandCtx);
2069
+ registerContextCommand(pi, commandCtx);
2070
+ registerAudit(pi, commandCtx);
2071
+ registerConfig(pi, commandCtx);
2072
+ registerWatchdog(pi, commandCtx);
2073
+ registerAgentsAdd(pi, commandCtx);
2074
+ registerAgentsDrop(pi, commandCtx);
2075
+ registerAgentsSave(pi, commandCtx);
2076
+ registerHubReport(pi, commandCtx);
2077
+ registerZoom(pi, commandCtx);
2078
+ registerAgentModel(pi, commandCtx);
2079
+ registerAgentModelThinking(pi, commandCtx);
2080
+ registerModels(pi, commandCtx);
2081
+ registerAgentModelsSubstitute(pi, commandCtx);
2082
+ registerDispatchPolicy(pi, commandCtx);
2083
+ registerAgentsKill(pi, commandCtx);
2084
+ registerAgentsRestart(pi, commandCtx);
2085
+ registerComs(pi, commandCtx);
2086
+ registerHandoff(pi, commandCtx);
2087
+ registerCompound(pi, commandCtx);
2088
+ registerPoll(pi, commandCtx);
2089
+ registerRetry(pi, commandCtx);
2090
+ registerRecover(pi, commandCtx);
2091
+ registerDebate(pi, commandCtx);
2092
+ registerTaskTriageRecover(pi, commandCtx);
2093
+ registerTaskTriageWaiver(pi, commandCtx);
2094
+
2095
+ const detailPanel = createDetailPanel<AgentDef, AgentState, ResearchState>({
2096
+ getAgent: key => agentStates.get(key),
2097
+ getResearch: id => researchStates.get(id),
2098
+ parseResearchHandle,
2099
+ findDelegationChild,
2100
+ modelPolicy,
2101
+ displayName,
2102
+ shortModel,
2103
+ refreshUi: updateWidget,
2104
+ getDispatchPreference: name => (dispatchPolicy.substitutions[name.toLowerCase()]?.prefer ?? dispatchPolicy.default) === "coms" ? "coms" : "native",
2105
+ maxLiveEntryChars: MAX_LIVE_ENTRY_CHARS,
2106
+ getProactive: () => fleetSource.snapshot(Date.now()).proactive,
2107
+ readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
2108
+ currentFleetRow: key => fleetSource.rows(Date.now(), { showFinished: true }).find(row => row.key === key),
2109
+ });
2110
+ const { openFleetDetail, loadAvailableModelChoices } = detailPanel;
2111
+ const applySessionModelSubstitution = (source: string, target: string, ctx: any) => modelPolicy.applySessionSubstitution(source, target, {
2112
+ loadAvailable: current => loadAvailableModelChoices(ctx, current),
2113
+ notify: (message, level) => ctx.ui.notify(message, level),
2114
+ });
2115
+
2116
+ fleetActions = createFleetActions<AgentState, ResearchState>({
2117
+ getRows: () => fleetSource.rows(Date.now(), { showFinished: true }),
2118
+ getAgents: () => agentStates,
2119
+ getResearch: () => researchStates,
2120
+ parseResearchHandle,
2121
+ displayName,
2122
+ modelWorkBlocked: () => false,
2123
+ restartSpecialist: researchControls.restartSpecialist,
2124
+ removeResearch: researchControls.remove,
2125
+ killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
2126
+ abortComs: state => { state.comsAbort?.(); },
2127
+ openDetail: openFleetDetail,
2128
+ generation: () => fleetUiGeneration,
2129
+ });
2130
+ let fleetShowFinished = false;
2131
+ let fleetFilter = "";
2132
+ const fleetDashboard = createFleetDashboard<AgentDef, AgentState, ResearchState>({
2133
+ onThinkingChanged: updateWidget,
2134
+ openSystem1: ctx => openSystem1Communication(ctx, communicationStore),
2135
+ getFleetRows: (now, unfiltered) => fleetSource.rows(now, unfiltered ? { showFinished: true } : { showFinished: fleetShowFinished, query: fleetFilter }),
2136
+ getTaskTriage: () => fleetSource.snapshot(Date.now()).taskTriage,
2137
+ getProactive: () => fleetSource.snapshot(Date.now()).proactive,
2138
+ readProactiveEvidence: (finding) => proactiveRuntime?.findings.readback(finding.snapshotHandle, finding.snapshotHash, finding.snapshotId, finding.unitId, finding.excerptHash) ?? null,
2139
+ actions: fleetActions,
2140
+ getAgents: () => agentStates,
2141
+ getResearch: () => researchStates,
2142
+ getShowFinished: () => fleetShowFinished,
2143
+ setShowFinished: value => { fleetShowFinished = value; },
2144
+ getFilter: () => fleetFilter,
2145
+ setFilter: value => { fleetFilter = value; },
2146
+ parseResearchHandle,
2147
+ displayName,
2148
+ shortModel,
2149
+ thinkingSuffix,
2150
+ modelWithThinking,
2151
+ resolvedThinking,
2152
+ abbreviatePeerModel: abbreviateModel,
2153
+ modelPolicy,
2154
+ loadAvailableModels: loadAvailableModelChoices,
2155
+ openDetail: openFleetDetail,
2156
+ openHistory: ctx => openHistory(ctx, executionHistory, () => (activeTeamName ? `Team: ${activeTeamName}` : "Agent Hub")),
2157
+ openConfig: ctx => fleetConfigUi.open(ctx as ExtensionContext),
2158
+ modelWorkBlocked: () => false,
2159
+ restartSpecialist: researchControls.restartSpecialist,
2160
+ removeResearch: researchControls.remove,
2161
+ killSpecialistProcess: state => { fenceOperatorCancel(state); cancelLocalOwnedProcess({ process: state.proc, monitorBridge, monitorKey: monitorKeyForAgent(state.def.name, state.dispatchId ?? state.runCount), treeKill: killPiTree }); },
2162
+ abortComs: state => { state.comsAbort?.(); },
2163
+ getComsLines: (width, theme) => poolPresentation.render(width, theme),
2164
+ getConnectionLines: width => codexControls.lines().map(line=>truncateToWidth(line,width)),
2165
+ getCodexChats:()=>codexControls.rows(),
2166
+ codexChatAction:async(kind,namespace)=>{if(!currentCtx)throw Error('native_pi_ui_unavailable');await codexControls.action(kind,namespace,currentCtx);},
2167
+ });
2168
+ const { fleetRows, openFleetDashboard: openFleetDashboardRaw } = fleetDashboard;
2169
+ const openFleetDashboard = (ctx: any, startSubstitution = false) => gridUI.withSuspended(() => openFleetDashboardRaw(ctx, startSubstitution));
2170
+
2171
+ const contextBudgetUi = createContextBudgetUi<AgentDef, AgentState, ResearchState>({
2172
+ getAgents: () => agentStates,
2173
+ getResearch: () => researchStates,
2174
+ getAllDefs: () => allAgentDefs,
2175
+ getResearchPersonas: () => researchPersonas,
2176
+ getPeers: () => peerCards.values(),
2177
+ modelPolicy,
2178
+ displayName,
2179
+ getProjectDocsPaths: () => projectDocsPaths,
2180
+ getUserLanguage: () => userLanguage,
2181
+ getDelegateExtensionPath: () => delegateExtPath,
2182
+ safeAgentKey,
2183
+ projectPolicyPaths: specialistProjectPolicyPaths,
2184
+ modelWindowLookup,
2185
+ getResearchTools: () => RESEARCH_TOOLS,
2186
+ getPromptLedger: () => lastHubLedger,
2187
+ getPressureState: () => contextPressureState,
2188
+ buildHubSystemPrompt: () => { buildHubSystemPrompt(); },
2189
+ getAllTools: () => typeof pi.getAllTools === "function" ? pi.getAllTools() : [],
2190
+ getActiveTools: () => typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [],
2191
+ getCommands: () => typeof pi.getCommands === "function" ? pi.getCommands() : [],
2192
+ });
2193
+ const { openContextBudget } = contextBudgetUi;
2194
+
2195
+ // A delegate child anywhere in the team, by its id (e.g. "quality-1").
2196
+ function findDelegationChild(arg: string): { child: DelegationChild; owner: AgentState } | null {
2197
+ const lower = arg.toLowerCase();
2198
+ for (const state of agentStates.values()) {
2199
+ const child = Array.from(state.delegations?.values() ?? []).find(candidate => candidate.id.toLowerCase() === lower);
2200
+ if (child) return { child, owner: state };
2201
+ }
2202
+ return null;
2203
+ }
2204
+
2205
+ const completions = createCompletionPresentation({
2206
+ getAgents: () => agentStates.values(), getResearch: () => researchStates.values(),
2207
+ getResearchPersonas: () => researchPersonas, getModelProfiles: () => modelProfiles,
2208
+ getPeers: peersInScope, displayName, shortModel, resolvedModel, resolvedThinking,
2209
+ resolveThinkingLevel, resolvedSubagentModel,
2210
+ getSubagentOverride: (persona, role) => modelPolicy.getSubagentOverride(persona, role),
2211
+ getSubstitutionSources: () => modelPolicy.allKnownModels().map(spec => {
2212
+ const target = modelPolicy.getSubstitution(spec);
2213
+ return { spec, label: target ? `${spec} → ${target} (active this session)` : spec };
2214
+ }),
2215
+ });
2216
+
2217
+ registerInputShortcuts(pi, {
2218
+ setWidgetContext: ctx => { widgetCtx = ctx; }, openFleetDashboard,
2219
+ toggleFleetWidget: () => gridUI.toggle(),
2220
+ openFleetConfig: ctx => openFleetConfig(ctx),
2221
+ });
2222
+
2223
+ // Root owns subscription order; lifecycle modules own handler bodies.
2224
+ registerTurnPresence(pi, {
2225
+ beforeAgentPresence: () => turnHandlers.beforeAgentPresence(),
2226
+ });
2227
+
2228
+ // /af-handoff <peer> — hand the session off to a coms peer. Per decision G1 we do NOT
2229
+ // extract the compaction summary; instead we ask the dispatcher LLM (next turn) to
2230
+ // compose a SELF-CONTAINED brief and coms_send it, then await + relay the reply.
2231
+ // /af-compound [focus] — end-of-session compound-learning pass. Mirrors /af-handoff's
2232
+ // shape: the dispatcher LLM (which saw the whole session) composes the
2233
+ // candidate-lessons brief itself, gates it on the user, then dispatches the
2234
+ // documenter to land the approved lessons per skills/compound-learning/SKILL.md.
2235
+ // The rules/docs targets come from the overrides file; artifacts travel as
2236
+ // paths through the dispatch's `artifacts` array, never as pasted bodies.
2237
+ // ── ask_user wait tracking (for /af-agents-history real-work) ──
2238
+ // pi-ask-user blocks the dispatcher turn while the human answers. Bracket each
2239
+ // ask_user call with its tool_execution start/end so /af-agents-history can subtract
2240
+ // that "away from keyboard" time from the dispatcher's real work.
2241
+ // T11 production pre-effect gate: operator direct side effects use the same task-scoped process state as child dispatch.
2242
+ pi.on("tool_call", async (event: any, ctx) => {
2243
+ const toolName = String(event.toolName || "").toLowerCase();
2244
+ const block = processBlock();
2245
+ const gate = ["bash", "edit", "write"].includes(toolName) ? processPreEffectGate(processState, "write") : null;
2246
+ 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 });
2247
+ try {
2248
+ // set_task_tier binds the fence. ask_user is the human supersession path. Every other tool is a diversion.
2249
+ // The first assistant step may emit several tools together. Refuse that whole step without aborting,
2250
+ // so the model can still call set_task_tier. Abort only a later step that ignores the hint; terminate
2251
+ // alone cannot stop siblings whose calls already returned.
2252
+ if (block && toolName !== "set_task_tier" && toolName !== "ask_user") {
2253
+ const decision = transitionToolDecision(transitionHintDelivered, transitionDiversions, block.message);
2254
+ transitionDiversions = decision.nextCount;
2255
+ transitionBatchRefused = true;
2256
+ if (decision.terminate) ctx?.abort?.();
2257
+ finishPolicy({ status: "blocked" });
2258
+ return { block: true, terminate: decision.terminate, reason: decision.reason };
2259
+ }
2260
+ if (!["bash", "edit", "write"].includes(toolName)) return;
2261
+ if (!gate) return;
2262
+ if (gate.reason !== "action_confirmation_unsupported") { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
2263
+ const bound = taskTriage?.current;
2264
+ // Pi's tool_call contract provides the exact call id and input; absent fields cannot be bound.
2265
+ if (!bound || bound.taskId !== noProgress.taskId() || !event.toolCallId || !event.input || !ctx) { finishPolicy({ status: "blocked" }); return { block: true, reason: gate.message }; }
2266
+ 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 };
2267
+ const observeAction = (status: TaskTriageActionObservation) => {
2268
+ try { const record = taskTriageActionAuditRecord(action, status); if (record) pi.appendEntry("agent-hub-task-triage-action-observation", record); }
2269
+ catch { /* Diagnostic trace cannot alter effect authorization. */ }
2270
+ };
2271
+ observeAction("requested");
2272
+ let presentationFailure = "";
2273
+ const grant = await confirmTaskTriageAction(action, {
2274
+ relay:permissionRelay,permissionAudit:entry=>pi.appendEntry('task-triage-permission-decision',entry),
2275
+ presentationRefused: reason => { presentationFailure = `Task-triage approval was not shown: ${reason}. Exact action presentation refused; no authorization issued.`; },
2276
+ taskId: () => noProgress.taskId(), inputRevision: () => taskTriage?.current?.revision ?? "",
2277
+ ask: (id, question, askCtx, signal) => requestRuntimeAsk(pi.events, id, question, askCtx, signal, { parentId: action.actionId, source: "task-triage" }, 'permission'),
2278
+ startWait: id => executionHistory.startAskUser(id), endWait: (id, sameTask) => { const wait = executionHistory.endAskUser(id, Date.now()); if (sameTask && wait > 0) taskClock = addTaskClockWait(taskClock, wait); },
2279
+ }, ctx, contract => { pi.appendEntry("agent-hub-task-triage-action-grant", contract); return true; }, undefined, { input: event.input, cwd: ctx.cwd });
2280
+ if (processBlock() || ctx.cwd !== action.cwd || String(event.toolName) !== action.operation || String(event.toolCallId) !== action.actionId
2281
+ || noProgress.taskId() !== action.taskId || taskTriage?.current?.revision !== action.inputRevision
2282
+ || 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." }; }
2283
+ if (!grant || !consumeActionGrant(grant, action)) { observeAction("not_granted"); finishPolicy({ status: "blocked" }); return { block: true, reason: presentationFailure || gate.message }; }
2284
+ try { pi.appendEntry("agent-hub-task-triage-action-consumed", action); }
2285
+ catch { observeAction("consumption_failed"); finishPolicy({ status: "blocked" }); return { block: true, reason: "One-use authorization consumption could not be persisted; effect refused." }; }
2286
+ } catch (error) { finishPolicy({ status: "failed" }); throw error; }
2287
+ finally { finishPolicy({ status: "allowed" }); }
2288
+ });
2289
+ pi.on("tool_execution_start", async event => turnHandlers.toolStart(event));
2290
+ observeAskUserResults(({ params, result, phase }) => {
2291
+ const pack = capabilityConfirmationPack(params.context);
2292
+ if (!pack) return;
2293
+ if (phase === "start") workModePolicy.setCapabilityConfirmation(pack, "pending");
2294
+ else {
2295
+ const outcome = confirmationOutcome(result);
2296
+ if (!outcome) return;
2297
+ workModePolicy.setCapabilityConfirmation(pack, outcome);
2298
+ resolveIncomingCapabilities("");
2299
+ applyWorkModeTools();
2300
+ }
2301
+ });
2302
+
2303
+ pi.on("tool_execution_end", async event => turnHandlers.toolEnd(event));
2304
+
2305
+ // ── System Prompt Override ───────────────────
2306
+
2307
+
2308
+ const hubPromptCtx: HubPromptContext = {
2309
+ getTriageBeforeDispatch: () => triageRuntime?.orchestratorBeforeDispatch === true,
2310
+ getAgenticAskMode: () => agenticHubRuntime(pi)?.mode ?? "off",
2311
+ getArtifactRoot: () => sessionDir ? artifactsRoot() : null,
2312
+ getCapabilityResolution,
2313
+ getActiveTools: () => pi.getActiveTools(),
2314
+ getToolCatalogNotice: () => [latestToolCatalogDelta ? toolCatalogNotice(latestToolCatalogDelta) : "", latestUnknownToolNotice].filter(Boolean).join("\n"),
2315
+ getAgents: () => dispatchableAgentDefs().map(def => ({
2316
+ name: def.name,
2317
+ displayName: displayName(def.name),
2318
+ description: def.description,
2319
+ tools: def.tools,
2320
+ model: resolvedModel(def),
2321
+ inTeam: agentStates.has(def.name.toLowerCase()),
2322
+ })),
2323
+ getTeamMembers: () => Array.from(agentStates.values(), state => displayName(state.def.name)),
2324
+ getProviderLimits: () => providerSemaphore.snapshot(),
2325
+ getResearchPersonas: () => researchPersonas.map(def => ({
2326
+ name: def.name,
2327
+ displayName: displayName(def.name),
2328
+ description: def.description,
2329
+ model: resolvedModel(def),
2330
+ thinking: resolveThinkingLevel(resolvedThinking(def)),
2331
+ })),
2332
+ getPromptState: () => ({
2333
+ 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})),
2334
+ taskTier: taskTier ?? DEFAULT_TASK_TIER,
2335
+ taskTierAssumed,
2336
+ processRisk: processState.risk,
2337
+ processScope: processState.scope,
2338
+ processOpen: Object.entries(evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }).obligations).filter(([, value]) => value.status === "open").map(([name]) => name),
2339
+ turnDispatchCount,
2340
+ turnResearchCount,
2341
+ taskDispatchCount,
2342
+ taskResearchCount,
2343
+ taskReviewRounds,
2344
+ nestedRepositories: nestedRepositoriesInUse(processState),
2345
+ provisionalConfirmations: getCapabilityResolution().provisional
2346
+ .filter(pack => workModePolicy.getCapabilityConfirmation()[pack as ConfirmableCapabilityPack] !== "declined")
2347
+ .map(pack => ({
2348
+ pack,
2349
+ reason: getCapabilityResolution().reasons[pack],
2350
+ question: capabilityConfirmationQuestion(pack as ConfirmableCapabilityPack),
2351
+ })),
2352
+ }),
2353
+ getWorkMode,
2354
+ getActiveTeamName: () => activeTeamName,
2355
+ getUserLanguage: () => userLanguage,
2356
+ getRulesProtocol: buildRulesProtocol,
2357
+ getDocsProtocol: buildDocsProtocol,
2358
+ isAskUserAvailable: () => askUserAvailable,
2359
+ isComsReady: () => comsReady,
2360
+ getIdentity: () => identity,
2361
+ isHerdrFleetReady: () => herdrFleetReady,
2362
+ };
2363
+
2364
+ // This is also called by /af-context before the first turn. Keep prompt assembly
2365
+ // in this one production path so its ledger describes the exact next replacement.
2366
+ function buildHubSystemPrompt(): { systemPrompt: string } {
2367
+ const built = assembleHubPrompt(hubPromptCtx);
2368
+ lastHubLedger = built.ledger;
2369
+ const names = new Set(Array.from(agentStates.values(), s => s.def.name.toLowerCase()));
2370
+ const missingRoles = missingProcessRoleRecoveryHints(processState, names);
2371
+ const additions = activeAdditionRecoveryHints(processState, noProgress.taskId(), taskTriage?.current?.revision);
2372
+ 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}` : ""}` };
2373
+ }
2374
+
2375
+ const turnHandlers = createTurnLifecycleHandlers({
2376
+ setTurnState: state => coms.setTurnState(state),
2377
+ finishMonitorTurn: () => { if (monitorBridge && monitorTurnId) { monitorBridge.finishParent(monitorTurnId, "completed"); monitorTurnId = null; } },
2378
+ startMonitorTurn: () => { if (monitorBridge && monitorHubId) { monitorTurnId = `hub-turn-${monitorHubId}-${crypto.randomUUID()}`; monitorBridge.startParent({ id: monitorTurnId, hubInstanceId: monitorHubId, checkoutId: currentCtx?.cwd || process.cwd() }); } },
2379
+ startAskUser: id => executionHistory.startAskUser(id), endAskUser: (id, at) => executionHistory.endAskUser(id, at),
2380
+ acknowledgeExternalBlocker: () => { externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false; },
2381
+ addAskUserWait: waitMs => { if (waitMs > 0) taskClock = addTaskClockWait(taskClock, waitMs); },
2382
+ applyWorkMode: applyWorkModeTools, closeTurnActiveTime, openTaskClock: at => { taskClock = openTaskClock(taskClock, at); }, startHistoryTurn: at => executionHistory.startTurn(at),
2383
+ resetTurnBudgetState: () => {
2384
+ turnDispatchCount = 0; turnResearchCount = 0; turnDispatchFingerprints.clear(); externalBlockerAcknowledged = true; externalBlockerRefusedOnce = false;
2385
+ if (turnReport.dispatches.length > 0 || turnReport.research > 0 || turnReport.refusals > 0) { lastTurnReport = turnReport; sessionTotals.turns++; }
2386
+ turnReport = freshTurnReport();
2387
+ },
2388
+ updateModeStatus, buildPrompt: buildHubSystemPrompt, endHistoryTurn: at => executionHistory.endTurn(at),
2389
+ unaddressedPeerWarning: () => unaddressedPeerSweep(Array.from(hubSpawnedPeers.values()))?.message ?? null,
2390
+ settlePeerTurn: ctx => coms.settleTurn(ctx, { dispatchQueued: false }),
2391
+ settlePressure: ctx => pressureLifecycle.agentSettled(ctx),
2392
+ dispatchQueuedPeerTurn: () => coms.dispatchQueued(),
2393
+ });
2394
+ pi.on("before_agent_start", async () => {
2395
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2396
+ 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 */ }
2397
+ }
2398
+ // Pressure/roster recovery gates run first; assessment runs before this model input.
2399
+ if (taskTriage && !processPersistenceBlocked) {
2400
+ // Persist the first task identity before binding a pre-model assessment:
2401
+ // compaction/resume must not mint a new ID for the same cached input.
2402
+ try { noProgress.persistTaskIdentity(); } catch { processPersistenceBlocked = true; }
2403
+ const assessment = processPersistenceBlocked ? null : await taskTriage.evaluate(noProgress.taskId());
2404
+ // Guarded offline fixture diagnostics: metadata only, never task text or provider payload.
2405
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2406
+ 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 */ }
2407
+ }
2408
+ if (assessment && !pendingTaskTransition && !processPersistenceBlocked) {
2409
+ try {
2410
+ const next = applyTaskTriageAdditions(processState, assessment.assessment, { taskId: assessment.taskId, evaluationId: assessment.evaluationId, inputRevision: assessment.revision });
2411
+ if(JSON.stringify(next)!==JSON.stringify(normalizeProcessState(processState))) {
2412
+ pi.appendEntry("agent-hub-process-state", processAuditRecord(next, evaluateProcessObligations(next, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER })));
2413
+ processState = next;
2414
+ }
2415
+ } catch { processPersistenceBlocked = true; }
2416
+ }
2417
+ }
2418
+ // Assessment can open a plan/review lease after input resolved its original packs.
2419
+ if (taskTriage) workModePolicy.refreshCapabilities();
2420
+ const result = turnHandlers.beforeAgentStart();
2421
+ toolCatalogRuntime.beginTurn();
2422
+ return result;
2423
+ });
2424
+
2425
+ const pressureLifecycle = createContextPressureLifecycle({
2426
+ 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}; }; })() },
2427
+ getState: () => pressureRootState,
2428
+ setPressure: value => { contextPressureState = value; pressureRootState.pressure = value; },
2429
+ getCurrentContext: () => currentCtx,
2430
+ appendEntry: (type, data) => pi.appendEntry(type, data),
2431
+ sendUserMessage: (content, options) => pi.sendUserMessage(content as any, options),
2432
+ resolveCapabilities: resolveIncomingCapabilities, applyWorkMode: applyWorkModeTools,
2433
+ modelWorkBlocked: () => false,
2434
+ onAcceptedInput: (text, source, replayed) => {
2435
+ if ((source === "extension" && !replayed) || !text.trim()) return;
2436
+ if(hubTaskText && isTaskContinuation(text))return;
2437
+ 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; } }
2438
+ hubTaskText = text;
2439
+ executionTrace.input(crypto.randomUUID());
2440
+ try { noProgress.persistTaskIdentity(); acceptDamageGuardInput(pi, text); bindSemanticScope(noProgress.taskId(), createHash("sha256").update(text).digest("hex")); } catch { processPersistenceBlocked = true; }
2441
+ taskTriage?.input(text, "interactive");
2442
+ },
2443
+ });
2444
+ function replayDeferredRecoveryInputs(): void { pressureLifecycle.replayDeferred(); }
2445
+ pi.on("message_end", async (event, ctx) => {
2446
+ const diagnostics = observeUnknownToolCalls({ message: event.message, catalog: toolCatalogRuntime.catalogForMessage(), taskId: unknownToolCounter.snapshot().activeTaskId || noProgress.taskId(), counter: unknownToolCounter, seenCallIds: seenUnknownToolCalls });
2447
+ for (const diagnostic of diagnostics) {
2448
+ latestUnknownToolNotice = unknownToolNotice(diagnostic);
2449
+ try { pi.appendEntry(UNKNOWN_TOOL_COUNTER_ENTRY_TYPE, { snapshot: unknownToolCounter.snapshot(), diagnostic }); } catch {}
2450
+ }
2451
+ if (event.message.role === 'toolResult' && noProgress.hasRecoverableOperations() !== pi.getActiveTools().includes('recover_task')) applyWorkModeTools();
2452
+ pressureLifecycle.messageEnd(event, ctx);
2453
+ });
2454
+ pi.on("turn_start", event => { toolCatalogRuntime.beginModelRequest(); hubCapture.start(event.turnIndex); });
2455
+ pi.on("turn_end", async (event, ctx) => {
2456
+ if (transitionBatchRefused && pendingTaskTransition) transitionHintDelivered = true;
2457
+ transitionBatchRefused = false;
2458
+ await pressureLifecycle.turnEnd(ctx);
2459
+ const text = event.message.role === "assistant" ? event.message.content.filter(c => c.type === "text").map(c => c.text).join("") : "";
2460
+ hubCapture.end(event.turnIndex, text);
2461
+ });
2462
+ // Stable historical views keep the provider prompt cache valid between turns.
2463
+ const historyProjection = createHistoryProjectionMemo();
2464
+ pi.on("context", async (event, ctx) => {
2465
+ const projection=projectCoordinationHistory(event.messages,sessionDir,historyProjection);
2466
+ 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 */}
2467
+ pressureLifecycle.context(ctx);
2468
+ const context = hubCapture.hubContext();
2469
+ const text = context && proactiveRuntime?.feedback?.take("hub", "direct", context);
2470
+ if (text) { proactiveHubDeliveries++; return { messages: [...projection.messages, { role: "custom" as const, customType: "agent-fleet.proactive-advisory", content: text, display: false, timestamp: Date.now() }] }; }
2471
+ if(projection.projected)return {messages:projection.messages};
2472
+ });
2473
+ pi.on("session_compact", async (_event, ctx) => {
2474
+ noProgress.compact(ctx.sessionManager.getEntries());
2475
+ if (!processPersistenceBlocked) persistProcessVerdict(processState, evaluateProcessObligations(processState, { writable: true, budgetTier: taskTier ?? DEFAULT_TASK_TIER, privateUse: privateProofUse() }));
2476
+ const result = toolCatalogRuntime.compact({
2477
+ mode: getWorkMode(), getEffectiveTools: () => pi.getActiveTools(),
2478
+ persist: (type, data) => pi.appendEntry(type, data), counterSnapshot: () => unknownToolCounter.snapshot(),
2479
+ retainCounter: () => unknownToolCounter.noteCompaction(),
2480
+ establishToolStateChange: (previous, next, evidenceRef) => noProgress.establishToolStateChange(previous, next, evidenceRef),
2481
+ settle: restored => pressureLifecycle.sessionCompact(restored),
2482
+ onError: error => { try { pi.appendEntry("agent-hub-tool-catalog-error", { reason: "compaction_restore", error: error instanceof Error ? error.message : String(error) }); } catch {} },
2483
+ });
2484
+ if (result) latestToolCatalogDelta = result.delta;
2485
+ });
2486
+ pi.on("input", async (event, ctx) => {
2487
+ const outcome = pressureLifecycle.input(event, ctx);
2488
+ return { action: outcome.action };
2489
+ });
2490
+
2491
+ // ── Session Start ────────────────────────────
2492
+
2493
+ let sessionOverrides: ReturnType<typeof parseAgentTeamOverrides> | undefined;
2494
+ let sessionSoloMode = false;
2495
+ const monitorSession = createMonitorSession({
2496
+ pi,
2497
+ getBridge: () => monitorBridge, setBridge: value => { monitorBridge = value; },
2498
+ getLifecycle: () => monitorLifecycle, setLifecycle: value => { monitorLifecycle = value; },
2499
+ setHubId: value => { monitorHubId = value; },
2500
+ getOwnerId: () => monitorOwnerId, setOwnerId: value => { monitorOwnerId = value; },
2501
+ queueDepth: () => inboundQueue.size,
2502
+ });
2503
+ registerSessionOrchestration(pi, {
2504
+ resetSession: async (_ctx) => { await resetDamageGuardHub(pi); resetHubSession(_ctx, {
2505
+ registerVersion: registerVersionStatus, resetPressure: pressureLifecycle.reset,
2506
+ captureBaselineTools: () => { baselineTools = pi.getActiveTools(); },
2507
+ resetAccessApproval: () => {codexControls.resetSession();accessApprovalRouter.reset();permissionRelay.reset();accessEpochs.clear();},
2508
+ terminateResearch: () => { for (const st of researchStates.values()) if (st.proc && st.status === "running") { st.killedByOperator = true; st.proc.kill("SIGTERM"); } },
2509
+ resetResearch: researchRuntime.reset, resetHistory: executionHistory.reset,
2510
+ resetBudgets: () => { hubCapture.reset(); hubTaskText = undefined; proactiveRuntime = null; proactiveConfig = null; system1Snapshot = normalizeSystem1Config(null);
2511
+ resetAgenticHub(pi); resetDiscoveryHub(pi); proactiveHubDeliveries = 0; taskClock = createTaskClock(); noProgress.prepareSessionRestore(); resetUnknownToolCounterForCurrentTask(); toolCatalogRuntime.restore(catalogSnapshot(getWorkMode(), [])); latestToolCatalogDelta = null; },
2512
+ clearWidgets: _ctx => { fleetUiGeneration++; fleetActions?.reset(); gridUI.dispose(); },
2513
+ closeDelegationWatchers: () => { for (const st of agentStates.values()) { st.delegationsWatcher?.close(); st.delegationsWatcher = undefined; } },
2514
+ resetSessionState: ctx => { delegatedTokens = 0; hubSpawnedPeers.clear(); widgetCtx = ctx; contextWindow = ctx.model?.contextWindow || 0; gridUI.reset(); },
2515
+ resolveSafety: cwd => Boolean(safetyHarnessPath = resolveSafetyHarness(cwd)), resolveDelegate: cwd => { delegateExtPath = resolveDelegateExtension(cwd); },
2516
+ }); },
2517
+ restartMonitor: _ctx => monitorSession.restart(_ctx),
2518
+ initializeComs: async (_ctx) => {
2519
+ // ── Embedded coms init ──
2520
+ // Always refresh the ctx the coms handlers use. Bind the endpoint + register
2521
+ // in the pool exactly once per process (guard on comsReady), so a /new session
2522
+ // keeps the same peer identity rather than leaking a second socket. On any
2523
+ // failure we degrade: comsReady stays false and the coms_* tools are withheld.
2524
+ hubStateCtx.setCurrentContext(_ctx);
2525
+ sessionSoloMode = pi.getFlag("solo") === true;
2526
+ if (!comsReady && !sessionSoloMode) {
2527
+ try {
2528
+ identity = await coms.connect({ ctx: _ctx, defaultNamePrefix: "hub", defaultPurpose: "agent-hub dispatcher" });
2529
+ comsReady = true;
2530
+ try {
2531
+ _ctx.ui.setStatus("coms", `📡 ${identity.name}@${identity.project}`);
2532
+ } catch { /* hasUI may be false — non-fatal */ }
2533
+ } catch (err) {
2534
+ comsReady = false;
2535
+ try { _ctx.ui?.notify?.(`📡 coms: init failed — ${err instanceof Error ? err.message : String(err)} (coms tools disabled)`, "error"); } catch { /* ignore */ }
2536
+ }
2537
+ }
2538
+ },
2539
+ initializeExemptions: (_ctx) => {
2540
+ try {
2541
+ system1Snapshot = loadSystem1Snapshot(_ctx.cwd || process.cwd());
2542
+ const config = loadProactiveConfig(_ctx.cwd || process.cwd(), system1Snapshot);
2543
+ if (isCaptureEnabled(config)) proactiveConfig = config;
2544
+ } catch { /* invalid config fails closed */ }
2545
+ // ── Damage-control shared exemptions file ──
2546
+ // One per hub session (solo mode included). Exporting the path on our own
2547
+ // process.env lets the co-loaded damage-control-continue mirror /af-allow
2548
+ // session grants into the same file the spawned children read.
2549
+ if (!exemptionsFile) {
2550
+ hubStateCtx.setExemptionsFile(exemptionsFilePath(identity?.session_id ?? `hub-solo-${process.pid}`));
2551
+ process.env[EXEMPTIONS_FILE_ENV] = exemptionsFile!;
2552
+ }
2553
+ },
2554
+ loadAgents: (_ctx) => {
2555
+ // Allocate a fresh namespace; shared legacy files belong to prior/live sessions.
2556
+ sessionOverrides = parseAgentTeamOverrides(_ctx.cwd);
2557
+ fleetConfigUi.recordBaseline(_ctx.cwd);
2558
+ try {
2559
+ const config = loadProactiveConfig(_ctx.cwd,system1Snapshot,sessionOverrides.policyRoots);
2560
+ proactiveConfig = isCaptureEnabled(config) ? config : null;
2561
+ } catch { proactiveConfig = null; /* invalid consent fails closed */ }
2562
+ runHistoryKeep = sessionOverrides.runHistoryKeep;
2563
+
2564
+ loadAgents(_ctx.cwd);
2565
+ // Composition follows applyOverrides: approved roots and the shared service do not exist yet.
2566
+
2567
+ // Surface non-fatal persona frontmatter warnings (skipped subagents roles,
2568
+ // bad delegate_depth) once per session.
2569
+ const fmWarnings = allAgentDefs.flatMap(d => (d.warnings || []).map(w => `${d.name}: ${w}`));
2570
+ if (fmWarnings.length > 0) {
2571
+ _ctx.ui.notify(`Persona frontmatter warnings:\n${fmWarnings.join("\n")}`, "warning");
2572
+ }
2573
+ if (!delegateExtPath && allAgentDefs.some(d => d.subagents)) {
2574
+ _ctx.ui.notify(
2575
+ "delegate.ts not found next to agent-hub — `subagents:` declarations are inert (specialists dispatch without a delegate tool).",
2576
+ "warning",
2577
+ );
2578
+ }
2579
+ },
2580
+ applyOverrides: (_ctx) => {
2581
+ if (!sessionOverrides) throw new Error("session_start applyOverrides ran before loadAgents");
2582
+ watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
2583
+ communicationStore.dispose();
2584
+ triageRuntime?.dispose(); triageRuntime = null;
2585
+ taskTriage?.dispose(); taskTriage = null;
2586
+ taskTriageActivity?.dispose(); taskTriageActivity = null;
2587
+ try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block the session */ }
2588
+ // Stable for a real session across snapshot replacement; G2 must not split one session into artificial samples.
2589
+ watchdogActivity = sessionDir ? createWatchdogActivity({ directory: `${sessionDir}/artifacts/watchdog`, sessionId: path.basename(sessionDir) }) : null;
2590
+ const taskTriageTestTransport = resolveTaskTriageTestTransport();
2591
+ taskTriageTestTransportActive = !!taskTriageTestTransport;
2592
+ watchdogSystem1 = createWatchdogSystem1Session({ ...readWatchdogSystem1Snapshot({
2593
+ cwd: _ctx.cwd,
2594
+ snapshot: system1Snapshot,
2595
+ configuredMode: sessionOverrides.watchdogSystem1Mode,
2596
+ watchdogSetting: sessionOverrides.watchdogSetting,
2597
+ env: process.env,
2598
+ transport: taskTriageTestTransport,
2599
+ warnings: sessionOverrides.warnings,
2600
+ }), wrapService: service => communicationStore.wrap(service, { provider: "typesafe", model: "jev-1.13.0" }) });
2601
+ const triageConfig = (system1Snapshot?.consumers.dispatchTriage.config ?? null) as TriageConfig | null;
2602
+ const taskTriageConfig = loadTaskTriageConfig(_ctx.cwd || process.cwd(), system1Snapshot);
2603
+ const sharedService = watchdogSystem1?.sharedService;
2604
+ configureAgenticHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
2605
+ configureDiscoveryHub(pi, { snapshot: system1Snapshot, service: sharedService, ctx: _ctx, sessionDir, communicationStore, taskId: () => noProgress.taskId() });
2606
+ const serviceUnavailableReason = watchdogSystem1?.readiness.status === "ready" ? "unavailable" : watchdogSystem1?.readiness.reason ?? "unavailable";
2607
+ taskTriageConfigured = taskTriageConfig.status !== "missing";
2608
+ taskTriageConfigStatus = taskTriageConfig.status === "active" ? "active" : taskTriageConfig.status === "invalid" ? "invalid" : "off";
2609
+ taskTriageActivity = taskTriageConfig.status === "active" ? createTaskTriageActivity({ directory: sessionDir ? path.join(sessionDir, "artifacts/task-triage-activity") : undefined }) : null;
2610
+ 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;
2611
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2612
+ 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 */ }
2613
+ }
2614
+ if (taskTriage && !sharedService) {
2615
+ 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"); }
2616
+ catch { /* Optional UI must not change process enforcement. The prompt retains the status. */ }
2617
+ }
2618
+ triageRuntime = createTriageRuntime({ config: triageConfig, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'dispatchTriage'),
2619
+ current: input => triageInput(input.task,input.scope,input.language,input.domain),
2620
+ trace: event => pi.appendEntry("agent-hub-triage", event),
2621
+ });
2622
+ applySessionOverrides(_ctx, sessionOverrides, {
2623
+ setLanguage: value => { userLanguage = value; },
2624
+ setReconTimeout: value => { reconSearchTimeoutMs = value; }, setBudgetOverrides: value => { budgetOverrides = value; },
2625
+ setWatchdog: (setting, judge) => { watchdogSetting = setting; watchdogJudgeModel = judge; },
2626
+ resetTurnCounts: () => { turnDispatchCount = 0; turnResearchCount = 0; },
2627
+ // Session setup clears in-memory budgets before restore, not the saved task.
2628
+ // A persisted reset here would append a new task event after the old one.
2629
+ resetTaskWindow: () => resetTaskWindow(null, Date.now(), false), updateModeStatus,
2630
+ setProjectRules: value => { projectRulesDirs = value; }, setProjectDocs: value => { projectDocsPaths = value; },
2631
+ resetModelPolicy: () => {modelPolicy.reset();profileActivation.reset();applyWorkModeTools();}, getModelProfileErrors: () => modelProfileErrors, getAgentDefs: () => allAgentDefs, getModelProfiles: () => modelProfiles,
2632
+ deleteModelProfile: name => { delete modelProfiles[name]; }, allowedModels,
2633
+ getDispatchPolicyWarnings: () => dispatchPolicyWarnings, setResearchPersonas: value => { researchPersonas = value; },
2634
+ });
2635
+ if (proactiveConfig && sessionDir) {
2636
+ try { proactiveRuntime = composeHubProactive({ config: proactiveConfig, root: _ctx.cwd, sessionDir,
2637
+ rulesRoots: sessionOverrides.rulesDirs, policyRoots: sessionOverrides.policyRoots, service: worktreeConsumerService(watchdogSystem1?.sharedService,system1Snapshot.document,'proactiveReview'), capture: hubCapture, onChange: updateWidget }); }
2638
+ catch { proactiveRuntime = null; proactiveConfig = null; } // unavailable composition never reports reviewed
2639
+ }
2640
+ },
2641
+ restoreRoster: async (_ctx) => {
2642
+ // Explicit CLI selection wins; otherwise restore only the canonical team name
2643
+ // and re-resolve it against current teams.yaml/persona files. An explicit
2644
+ // Operator work mode suppresses an ambient persisted roster unless --agent-team
2645
+ // was also supplied.
2646
+ agentStates.clear();
2647
+ activeTeamName = "";
2648
+ comsMissNotified.clear();
2649
+ recomputeGrid();
2650
+ const sessionEntries = _ctx.sessionManager.getEntries();
2651
+ // Resume restores the persisted fence. A missing entry is the legacy clear state.
2652
+ pendingTaskTransition = latestPendingTaskTransition(sessionEntries);
2653
+ transitionDiversions = 0;
2654
+ transitionHintDelivered = false;
2655
+ transitionBatchRefused = false;
2656
+ try { processState = latestProcessState(sessionEntries); processPersistenceBlocked = false; }
2657
+ catch { processState = createProcessState(); processPersistenceBlocked = true; }
2658
+ taskTriage?.restore(sessionEntries);
2659
+ const savedTaskIds = new Set(processState.additions?.map(addition => addition.taskId));
2660
+ // A rejected history keeps the guard's restore fence (dispatch refuses with
2661
+ // recovery_restore_failed) but must not abort the rest of session start.
2662
+ let recoveryRestored = true;
2663
+ try { noProgress.restore(sessionEntries, savedTaskIds.size === 1 ? [...savedTaskIds][0] : undefined); }
2664
+ catch { recoveryRestored = false; _ctx.ui?.notify?.('Recovery history could not be restored; dispatch stays refused until it is repaired. Inspect the session recovery entries.', 'error'); }
2665
+ const identityConflict = processTaskIdentityConflicts(processState, noProgress.taskId());
2666
+ if (identityConflict) processPersistenceBlocked = true;
2667
+ // The acceptance ledger follows the task identity it was saved under, never a newer evidence directory.
2668
+ const ledgerNotice = restoreAssertionLedgerForSession(_ctx, { recovery: recoveryRestored, identity: !identityConflict });
2669
+ persistAssertions(); updateAssertionStatus();
2670
+ if (ledgerNotice) { try { _ctx.ui?.notify?.(ledgerNotice, 'warning'); } catch { /* get_assertions repeats it */ } }
2671
+ await configureDamageGuardHub(pi, { snapshot: system1Snapshot, service: watchdogSystem1?.sharedService, ctx: _ctx, taskId: () => noProgress.taskId(), childAuthority: { taskToken: () => noProgress.taskToken(), admit: () => !processBlock() } });
2672
+ if (taskTriageTestTransportActive && process.env.AGENT_HUB_TASK_TRIAGE_FAKE_STATE_RECORD) {
2673
+ 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 */ }
2674
+ }
2675
+ const persistedCatalog = latestPersistedToolCatalog(sessionEntries);
2676
+ if (persistedCatalog) toolCatalogRuntime.restore(persistedCatalog);
2677
+ const persistedUnknownTools = latestPersistedUnknownToolCounter(sessionEntries);
2678
+ if (persistedUnknownTools) unknownToolCounter = restoreUnknownToolCounter(persistedUnknownTools, { limit: 3 });
2679
+ const legacyWorkModeFlag = pi.getFlag("work-mode");
2680
+ const explicitRoster = pi.getFlag("agent-team");
2681
+ const startupRoster = resolveSessionRoster({
2682
+ teams,
2683
+ entries: sessionEntries,
2684
+ explicitRoster,
2685
+ availablePersonas: allAgentDefs.map(def => def.name),
2686
+ });
2687
+ if (startupRoster.roster) {
2688
+ activateTeam(startupRoster.roster.name);
2689
+ persistActiveRoster();
2690
+ }
2691
+ if (startupRoster.diagnostic) _ctx.ui.notify(`${startupRoster.diagnostic} Continuing without that roster.`, "warning");
2692
+ // The orchestrator mode was removed (2026-11-11). Tell the human once, then
2693
+ // record the operator so a resumed session does not repeat the notice.
2694
+ const legacyFlag = typeof legacyWorkModeFlag === "string" ? legacyWorkModeFlag.trim() : "";
2695
+ if (legacyFlag || sessionSavedInRetiredWorkMode(sessionEntries)) {
2696
+ _ctx.ui.notify(legacyFlag ? `--work-mode ${legacyFlag} is ignored. ${RETIRED_WORK_MODE_NOTICE}` : RETIRED_WORK_MODE_NOTICE, "warning");
2697
+ if (sessionSavedInRetiredWorkMode(sessionEntries)) { try { pi.appendEntry(WORK_MODE_ENTRY_TYPE, { workMode: "operator" }); } catch { /* the notice repeats next resume */ } }
2698
+ }
2699
+ },
2700
+ resolveCapabilities: async (_ctx) => {
2701
+ // Probe for `ask_user` (registered by the `pi-ask-user` companion package
2702
+ // when installed). Action methods like getAllTools are runtime-only, so
2703
+ // this MUST happen at session_start, not at extension load.
2704
+ askUserAvailable = pi.getAllTools().some(t => t.name === "ask_user");
2705
+
2706
+ // Fleet tools are available only inside a herdr pane with a live server.
2707
+ // The work mode policy adds gated groups without activating unavailable tools.
2708
+ herdrFleetReady = herdrPaneId() !== null && (await herdrAvailable()) !== null;
2709
+ const persistedCapabilities = latestPersistedCapabilityState(_ctx.sessionManager.getEntries());
2710
+ workModePolicy.restoreCapabilities({ taskPacks: persistedCapabilities?.taskPacks ?? [], provisional: persistedCapabilities?.provisional ?? [], confirmation: persistedCapabilities?.confirmation ?? {} });
2711
+ resolveIncomingCapabilities("");
2712
+ applyWorkModeTools();
2713
+ if (pressureLifecycle.observe(_ctx, "session_start") === "compact-now") {
2714
+ setTimeout(() => pressureLifecycle.runCompaction(_ctx, "session_start"), 0);
2715
+ }
2716
+ workModePolicy.updateStatus(_ctx);
2717
+ },
2718
+ notifyStartup: (_ctx) => {
2719
+ _ctx.ui.setStatus("agent-team", `Native roster: ${activeTeamName || "(none)"} (${agentStates.size})`);
2720
+ const members = Array.from(agentStates.values()).map(s => displayName(s.def.name)).join(", ");
2721
+ const askUserLabel = askUserAvailable
2722
+ ? "available (via pi-ask-user)"
2723
+ : "NOT AVAILABLE — run `pi install npm:pi-ask-user`";
2724
+ const comsLabel = comsReady && identity
2725
+ ? `📡 ${identity.name}@${identity.project} — peers via coms_list; /af-handoff <peer> to delegate`
2726
+ : sessionSoloMode
2727
+ ? "off (--solo: fixed specialists + research only)"
2728
+ : "off (endpoint bind failed — coms tools disabled)";
2729
+ const fleetLabel = herdrFleetReady
2730
+ ? "herdr — spawn/read/close panes + notify (herdr_* tools active)"
2731
+ : "off (not inside a herdr pane, or no herdr server)";
2732
+ const comsPreferred = Object.entries(dispatchPolicy.substitutions)
2733
+ .filter(([, s]) => s.prefer === "coms")
2734
+ .map(([n]) => n);
2735
+ const dispatchLabel = dispatchPolicy.default === "coms"
2736
+ ? "coms default — any member with a live same-name pool peer is served by it (/af-dispatch-policy)"
2737
+ : comsPreferred.length > 0
2738
+ ? `coms-preferred: ${comsPreferred.join(", ")} (live peer wins, /af-dispatch-policy for status)`
2739
+ : "all native (no substitutions in .pi/agents/dispatch-policy.yaml)";
2740
+ _ctx.ui.notify(buildSessionStartNotice({
2741
+ workMode: getWorkMode(),
2742
+ activeTeamName,
2743
+ agentCount: agentStates.size,
2744
+ members,
2745
+ dispatchLabel,
2746
+ userLanguage,
2747
+ askUserLabel,
2748
+ comsLabel,
2749
+ fleetLabel,
2750
+ }), "info");
2751
+ },
2752
+ updateWidget: (_ctx) => {
2753
+ updateWidget();
2754
+ },
2755
+ installFooter: (_ctx) => {
2756
+ _ctx.ui.setFooter(createSessionFooter({
2757
+ ctx: _ctx,
2758
+ version: HARNESS_VERSION ?? "unknown",
2759
+ getModel: () => _ctx.model ? `${_ctx.model.provider}/${_ctx.model.id}` : "no-model",
2760
+ getThinkingLevel: () => pi.getThinkingLevel?.() ?? undefined,
2761
+ thinkingSuffix,
2762
+ getHint: () => composeFleetFooterHint(),
2763
+ renderLeft: renderHubFooterLeft,
2764
+ truncateToWidth,
2765
+ visibleWidth,
2766
+ }));
2767
+ },
2768
+ }, {
2769
+ finishEvidence: () => { if (sessionDir) closeEvidenceSession(sessionDir); },
2770
+ shutdownComs: async () => { await resetDamageGuardHub(pi); unregisterQuestions(); await coms.shutdown(); }, shutdownMonitor: () => monitorSession.shutdown(),
2771
+ removeExemptions: () => {
2772
+ if (!exemptionsFile) return;
2773
+ try { fs.unlinkSync(exemptionsFile); } catch {}
2774
+ hubStateCtx.setExemptionsFile(null);
2775
+ },
2776
+ terminateChildren: () => {
2777
+ hubCapture.reset(); proactiveRuntime = null;
2778
+ watchdogSystem1 = disposeWatchdogSystem1Session(watchdogSystem1);
2779
+ communicationStore.dispose();
2780
+ triageRuntime?.dispose(); triageRuntime = null;
2781
+ taskTriage?.dispose(); taskTriage = null;
2782
+ taskTriageActivity?.dispose(); taskTriageActivity = null;
2783
+ taskTriageConfigStatus = "off"; taskTriageConfigured = false;
2784
+ try { watchdogActivity?.dispose(); } catch { /* trace disposal must not block shutdown */ }
2785
+ watchdogActivity = null;
2786
+ for (const st of [...agentStates.values(), ...researchStates.values()]) {
2787
+ fenceOperatorCancel(st);
2788
+ if (st.proc && st.status === "running") try { st.killedByOperator = true; st.proc.kill("SIGTERM"); } catch {}
2789
+ }
2790
+ },
2791
+ clearPoolWidget: () => {
2792
+ gridUI.dispose();
2793
+ if (currentCtx?.hasUI) try { currentCtx.ui.setWidget("coms-pool", undefined); } catch {}
2794
+ },
2795
+ });
2796
+
2797
+ pi.on("agent_end", async (_event, ctx) => {
2798
+ toolCatalogRuntime.endTurn();
2799
+ await turnHandlers.agentEnd(ctx);
2800
+ });
2801
+ registerTurnSettlement(pi, {
2802
+ agentSettled: ctx => turnHandlers.agentSettled(ctx),
2803
+ });
2804
+
2805
+ }