@chankov/agent-fleet 2.0.12 → 2.0.13

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 (616) hide show
  1. package/.pi/agent-fleet/scripts/flow.ts +5 -3
  2. package/.pi/agent-fleet/scripts/lib/flow-command.ts +9 -4
  3. package/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +3 -1
  4. package/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
  5. package/.pi/agents/model-profiles.yaml +80 -29
  6. package/.pi/agents/peers.yaml +18 -18
  7. package/.pi/agents/voices.yaml +2 -2
  8. package/.pi/harnesses/agent-hub/README.md +55 -4
  9. package/.pi/harnesses/agent-hub/commands/audit.ts +1 -1
  10. package/.pi/harnesses/agent-hub/commands/context.ts +1 -1
  11. package/.pi/harnesses/agent-hub/config/model-profiles.ts +1 -0
  12. package/.pi/harnesses/agent-hub/delegate.ts +5 -3
  13. package/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +27 -2
  14. package/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +29 -0
  15. package/.pi/harnesses/agent-hub/dispatch-native-types.ts +6 -0
  16. package/.pi/harnesses/agent-hub/index.ts +75 -40
  17. package/.pi/harnesses/agent-hub/package.json +1 -1
  18. package/.pi/harnesses/agent-hub/policy/profile-activation.ts +2 -2
  19. package/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
  20. package/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  21. package/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  22. package/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  23. package/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
  24. package/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
  25. package/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
  26. package/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
  27. package/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  28. package/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  29. package/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
  30. package/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
  31. package/.pi/harnesses/agent-hub/prompts/context.ts +2 -0
  32. package/.pi/harnesses/agent-hub/prompts/system-prompt.ts +3 -0
  33. package/.pi/harnesses/agent-hub/research/runtime.ts +3 -1
  34. package/.pi/harnesses/agent-hub/research/spawn-run.ts +4 -1
  35. package/.pi/harnesses/agent-hub/return-extract.js +1 -1
  36. package/.pi/harnesses/agent-hub/session-audit.ts +6 -5
  37. package/.pi/harnesses/agent-hub/system1-activity.ts +67 -0
  38. package/.pi/harnesses/agent-hub/system1-report.ts +142 -1
  39. package/.pi/harnesses/agent-hub/system1-runtime.ts +3 -0
  40. package/.pi/harnesses/agent-hub/tools/run-flow.ts +16 -2
  41. package/.pi/harnesses/agent-hub/ui/detail-panel.ts +26 -5
  42. package/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +30 -5
  43. package/.pi/harnesses/agent-hub/ui/fleet-source.ts +7 -2
  44. package/.pi/harnesses/agent-hub/ui/grid.ts +12 -7
  45. package/.pi/harnesses/coms/package.json +1 -1
  46. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  47. package/.pi/harnesses/lib/context-budget-child-prompt.ts +41 -2
  48. package/.pi/harnesses/lib/context-budget-hub-prompt.ts +4 -2
  49. package/.pi/harnesses/lib/fleet-dashboard-view.ts +14 -3
  50. package/.pi/harnesses/lib/fleet-detail-view.ts +68 -7
  51. package/.pi/harnesses/lib/fleet-read-model.ts +131 -0
  52. package/.pi/harnesses/lib/fleet-strip-view.ts +44 -9
  53. package/.pi/prompts/af-setup-rules.md +20 -0
  54. package/.versions/2.0.13/.pi/agent-fleet/hermes/README.md +347 -0
  55. package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  56. package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  57. package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  58. package/.versions/2.0.13/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  59. package/.versions/2.0.13/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  60. package/.versions/2.0.13/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  61. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  62. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  63. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  64. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  65. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  66. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  67. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  68. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  69. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  70. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  71. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  72. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  73. package/.versions/2.0.13/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  74. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  75. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  76. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  77. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  78. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  79. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  80. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  81. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  82. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  83. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  84. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  85. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  86. package/.versions/2.0.13/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  87. package/.versions/2.0.13/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  88. package/.versions/2.0.13/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
  89. package/.versions/2.0.13/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  90. package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-claude-bridge.ts +411 -0
  91. package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
  92. package/.versions/2.0.13/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
  93. package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
  94. package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
  95. package/.versions/2.0.13/.pi/agent-fleet/scripts/fleet.ts +216 -0
  96. package/.versions/2.0.13/.pi/agent-fleet/scripts/flow.ts +157 -0
  97. package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  98. package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  99. package/.versions/2.0.13/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  100. package/.versions/2.0.13/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  101. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +210 -0
  102. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  103. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  104. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
  105. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
  106. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
  107. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
  108. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
  109. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
  110. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
  111. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  112. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  113. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  114. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  115. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  116. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  117. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  118. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  119. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  120. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  121. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  122. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  123. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  124. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  125. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
  126. package/.versions/2.0.13/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
  127. package/.versions/2.0.13/.pi/agent-fleet/scripts/package-lock.json +35 -0
  128. package/.versions/2.0.13/.pi/agent-fleet/scripts/package.json +9 -0
  129. package/.versions/2.0.13/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  130. package/.versions/2.0.13/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
  131. package/.versions/2.0.13/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
  132. package/.versions/2.0.13/.pi/agent-fleet/scripts/team-up.ts +378 -0
  133. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
  134. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  135. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  136. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
  137. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  138. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  139. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
  140. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
  141. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  142. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  143. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  144. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
  145. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  146. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  147. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +34 -0
  148. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
  149. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
  150. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  151. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
  152. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  153. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
  154. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  155. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  156. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  157. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  158. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  159. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  160. package/.versions/2.0.13/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  161. package/.versions/2.0.13/.pi/agents/dispatch-policy.yaml +32 -0
  162. package/.versions/2.0.13/.pi/agents/model-profiles.yaml +134 -0
  163. package/.versions/2.0.13/.pi/agents/peers.yaml +147 -0
  164. package/.versions/2.0.13/.pi/agents/teams.yaml +41 -0
  165. package/.versions/2.0.13/.pi/agents/voices.yaml +13 -0
  166. package/.versions/2.0.13/.pi/damage-control-rules.yaml +297 -0
  167. package/.versions/2.0.13/.pi/extensions/btw/README.md +120 -0
  168. package/.versions/2.0.13/.pi/extensions/btw/index.ts +914 -0
  169. package/.versions/2.0.13/.pi/extensions/btw/package.json +6 -0
  170. package/.versions/2.0.13/.pi/extensions/btw/state.js +179 -0
  171. package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  172. package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  173. package/.versions/2.0.13/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  174. package/.versions/2.0.13/.pi/extensions/compact-and-continue/README.md +42 -0
  175. package/.versions/2.0.13/.pi/extensions/compact-and-continue/index.ts +120 -0
  176. package/.versions/2.0.13/.pi/extensions/compact-and-continue/package.json +6 -0
  177. package/.versions/2.0.13/.pi/extensions/mcp-bridge/README.md +46 -0
  178. package/.versions/2.0.13/.pi/extensions/mcp-bridge/index.ts +206 -0
  179. package/.versions/2.0.13/.pi/extensions/mcp-bridge/package.json +6 -0
  180. package/.versions/2.0.13/.pi/extensions/package-lock.json +1175 -0
  181. package/.versions/2.0.13/.pi/extensions/package.json +9 -0
  182. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/README.md +224 -0
  183. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/config.ts +198 -0
  184. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  185. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/index.ts +248 -0
  186. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/package.json +6 -0
  187. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  188. package/.versions/2.0.13/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  189. package/.versions/2.0.13/.pi/harnesses/agent-hub/README.md +1360 -0
  190. package/.versions/2.0.13/.pi/harnesses/agent-hub/acceptance.ts +199 -0
  191. package/.versions/2.0.13/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  192. package/.versions/2.0.13/.pi/harnesses/agent-hub/artifacts.js +146 -0
  193. package/.versions/2.0.13/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
  194. package/.versions/2.0.13/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
  195. package/.versions/2.0.13/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  196. package/.versions/2.0.13/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  197. package/.versions/2.0.13/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
  198. package/.versions/2.0.13/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
  199. package/.versions/2.0.13/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  200. package/.versions/2.0.13/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
  201. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  202. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  203. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  204. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  205. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  206. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  207. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  208. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  209. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  210. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  211. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  212. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  213. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
  214. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  215. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  216. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  217. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/context.ts +45 -0
  218. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  219. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  220. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  221. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  222. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  223. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  224. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/recover.ts +52 -0
  225. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  226. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  227. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
  228. package/.versions/2.0.13/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  229. package/.versions/2.0.13/.pi/harnesses/agent-hub/config/agents.ts +178 -0
  230. package/.versions/2.0.13/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
  231. package/.versions/2.0.13/.pi/harnesses/agent-hub/config/overrides.ts +160 -0
  232. package/.versions/2.0.13/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  233. package/.versions/2.0.13/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
  234. package/.versions/2.0.13/.pi/harnesses/agent-hub/context/budgets.ts +204 -0
  235. package/.versions/2.0.13/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  236. package/.versions/2.0.13/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  237. package/.versions/2.0.13/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  238. package/.versions/2.0.13/.pi/harnesses/agent-hub/context-window.js +108 -0
  239. package/.versions/2.0.13/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  240. package/.versions/2.0.13/.pi/harnesses/agent-hub/delegate.ts +467 -0
  241. package/.versions/2.0.13/.pi/harnesses/agent-hub/deterministic-fs.ts +127 -0
  242. package/.versions/2.0.13/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  243. package/.versions/2.0.13/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  244. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
  245. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  246. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-complete.ts +169 -0
  247. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +248 -0
  248. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +231 -0
  249. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native-types.ts +257 -0
  250. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-native.ts +226 -0
  251. package/.versions/2.0.13/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  252. package/.versions/2.0.13/.pi/harnesses/agent-hub/docs-lane.js +122 -0
  253. package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  254. package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  255. package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  256. package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  257. package/.versions/2.0.13/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
  258. package/.versions/2.0.13/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  259. package/.versions/2.0.13/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
  260. package/.versions/2.0.13/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  261. package/.versions/2.0.13/.pi/harnesses/agent-hub/filesystem-tool.ts +73 -0
  262. package/.versions/2.0.13/.pi/harnesses/agent-hub/fixtures/registration-surface.json +61 -0
  263. package/.versions/2.0.13/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  264. package/.versions/2.0.13/.pi/harnesses/agent-hub/footer.ts +30 -0
  265. package/.versions/2.0.13/.pi/harnesses/agent-hub/helpers.ts +270 -0
  266. package/.versions/2.0.13/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
  267. package/.versions/2.0.13/.pi/harnesses/agent-hub/index.ts +2336 -0
  268. package/.versions/2.0.13/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  269. package/.versions/2.0.13/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
  270. package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +125 -0
  271. package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  272. package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +143 -0
  273. package/.versions/2.0.13/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
  274. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  275. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  276. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  277. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  278. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  279. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  280. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  281. package/.versions/2.0.13/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  282. package/.versions/2.0.13/.pi/harnesses/agent-hub/no-progress.ts +359 -0
  283. package/.versions/2.0.13/.pi/harnesses/agent-hub/package.json +7 -0
  284. package/.versions/2.0.13/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  285. package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  286. package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  287. package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  288. package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
  289. package/.versions/2.0.13/.pi/harnesses/agent-hub/policy/work-mode.ts +126 -0
  290. package/.versions/2.0.13/.pi/harnesses/agent-hub/poll-command.ts +176 -0
  291. package/.versions/2.0.13/.pi/harnesses/agent-hub/presentation.ts +48 -0
  292. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-config.ts +40 -0
  293. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  294. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  295. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  296. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-local.ts +88 -0
  297. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-observer.ts +105 -0
  298. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-rules.ts +143 -0
  299. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-runtime.ts +316 -0
  300. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  301. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  302. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-snapshot.ts +243 -0
  303. package/.versions/2.0.13/.pi/harnesses/agent-hub/proactive-types.ts +63 -0
  304. package/.versions/2.0.13/.pi/harnesses/agent-hub/process-obligations.ts +57 -0
  305. package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/context.ts +53 -0
  306. package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/fragments.ts +118 -0
  307. package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
  308. package/.versions/2.0.13/.pi/harnesses/agent-hub/prompts/system-prompt.ts +115 -0
  309. package/.versions/2.0.13/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  310. package/.versions/2.0.13/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  311. package/.versions/2.0.13/.pi/harnesses/agent-hub/recover-policy.ts +27 -0
  312. package/.versions/2.0.13/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  313. package/.versions/2.0.13/.pi/harnesses/agent-hub/recovery-contract.ts +80 -0
  314. package/.versions/2.0.13/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  315. package/.versions/2.0.13/.pi/harnesses/agent-hub/research/runtime.ts +195 -0
  316. package/.versions/2.0.13/.pi/harnesses/agent-hub/research/spawn-run.ts +174 -0
  317. package/.versions/2.0.13/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  318. package/.versions/2.0.13/.pi/harnesses/agent-hub/return-contract.js +327 -0
  319. package/.versions/2.0.13/.pi/harnesses/agent-hub/return-extract.js +77 -0
  320. package/.versions/2.0.13/.pi/harnesses/agent-hub/review-findings.js +104 -0
  321. package/.versions/2.0.13/.pi/harnesses/agent-hub/run-budget.js +542 -0
  322. package/.versions/2.0.13/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  323. package/.versions/2.0.13/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
  324. package/.versions/2.0.13/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  325. package/.versions/2.0.13/.pi/harnesses/agent-hub/scope-gate.js +123 -0
  326. package/.versions/2.0.13/.pi/harnesses/agent-hub/session-audit.ts +227 -0
  327. package/.versions/2.0.13/.pi/harnesses/agent-hub/session-health.js +110 -0
  328. package/.versions/2.0.13/.pi/harnesses/agent-hub/session-start.ts +42 -0
  329. package/.versions/2.0.13/.pi/harnesses/agent-hub/spawn.ts +526 -0
  330. package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-activity.ts +510 -0
  331. package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-report.ts +225 -0
  332. package/.versions/2.0.13/.pi/harnesses/agent-hub/system1-runtime.ts +276 -0
  333. package/.versions/2.0.13/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
  334. package/.versions/2.0.13/.pi/harnesses/agent-hub/timeline.ts +72 -0
  335. package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
  336. package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
  337. package/.versions/2.0.13/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  338. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/action-executors.ts +185 -0
  339. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  340. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/context.ts +142 -0
  341. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +82 -0
  342. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +498 -0
  343. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  344. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
  345. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/herdr-executors.ts +86 -0
  346. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
  347. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  348. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/spawn-research.ts +65 -0
  349. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  350. package/.versions/2.0.13/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
  351. package/.versions/2.0.13/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  352. package/.versions/2.0.13/.pi/harnesses/agent-hub/types.ts +66 -0
  353. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  354. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
  355. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  356. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  357. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +124 -0
  358. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  359. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/fleet-source.ts +175 -0
  360. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  361. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  362. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  363. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  364. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  365. package/.versions/2.0.13/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  366. package/.versions/2.0.13/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  367. package/.versions/2.0.13/.pi/harnesses/agent-hub/version.ts +42 -0
  368. package/.versions/2.0.13/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  369. package/.versions/2.0.13/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
  370. package/.versions/2.0.13/.pi/harnesses/agent-hub/work-mode.ts +173 -0
  371. package/.versions/2.0.13/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
  372. package/.versions/2.0.13/.pi/harnesses/ask-user-remote/README.md +59 -0
  373. package/.versions/2.0.13/.pi/harnesses/ask-user-remote/index.ts +558 -0
  374. package/.versions/2.0.13/.pi/harnesses/ask-user-remote/questions.ts +161 -0
  375. package/.versions/2.0.13/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  376. package/.versions/2.0.13/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
  377. package/.versions/2.0.13/.pi/harnesses/coms/README.md +100 -0
  378. package/.versions/2.0.13/.pi/harnesses/coms/index.ts +282 -0
  379. package/.versions/2.0.13/.pi/harnesses/coms/package.json +7 -0
  380. package/.versions/2.0.13/.pi/harnesses/coms/version.ts +42 -0
  381. package/.versions/2.0.13/.pi/harnesses/damage-control-continue/README.md +135 -0
  382. package/.versions/2.0.13/.pi/harnesses/damage-control-continue/index.ts +550 -0
  383. package/.versions/2.0.13/.pi/harnesses/damage-control-continue/package.json +7 -0
  384. package/.versions/2.0.13/.pi/harnesses/damage-control-continue/version.ts +42 -0
  385. package/.versions/2.0.13/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  386. package/.versions/2.0.13/.pi/harnesses/lib/coms-core-io.ts +385 -0
  387. package/.versions/2.0.13/.pi/harnesses/lib/coms-core.ts +577 -0
  388. package/.versions/2.0.13/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  389. package/.versions/2.0.13/.pi/harnesses/lib/context-budget-child-prompt.ts +219 -0
  390. package/.versions/2.0.13/.pi/harnesses/lib/context-budget-hub-prompt.ts +116 -0
  391. package/.versions/2.0.13/.pi/harnesses/lib/context-budget-view.ts +107 -0
  392. package/.versions/2.0.13/.pi/harnesses/lib/context-budget.ts +114 -0
  393. package/.versions/2.0.13/.pi/harnesses/lib/damage-control-shared.ts +197 -0
  394. package/.versions/2.0.13/.pi/harnesses/lib/deterministic-handle-path.ts +23 -0
  395. package/.versions/2.0.13/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  396. package/.versions/2.0.13/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  397. package/.versions/2.0.13/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  398. package/.versions/2.0.13/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  399. package/.versions/2.0.13/.pi/harnesses/lib/fleet-dashboard-view.ts +147 -0
  400. package/.versions/2.0.13/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  401. package/.versions/2.0.13/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  402. package/.versions/2.0.13/.pi/harnesses/lib/fleet-panel.ts +34 -0
  403. package/.versions/2.0.13/.pi/harnesses/lib/fleet-read-model.ts +536 -0
  404. package/.versions/2.0.13/.pi/harnesses/lib/fleet-selection.ts +24 -0
  405. package/.versions/2.0.13/.pi/harnesses/lib/fleet-strip-controller.ts +74 -0
  406. package/.versions/2.0.13/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  407. package/.versions/2.0.13/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  408. package/.versions/2.0.13/.pi/harnesses/lib/herdr-client.ts +472 -0
  409. package/.versions/2.0.13/.pi/harnesses/lib/herdr-presence.ts +399 -0
  410. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  411. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  412. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  413. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  414. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  415. package/.versions/2.0.13/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  416. package/.versions/2.0.13/.pi/harnesses/lib/spawned-peers.js +191 -0
  417. package/.versions/2.0.13/.pi/harnesses/lib/system1/config.js +61 -0
  418. package/.versions/2.0.13/.pi/harnesses/lib/system1/contracts.ts +152 -0
  419. package/.versions/2.0.13/.pi/harnesses/lib/system1/demo.ts +106 -0
  420. package/.versions/2.0.13/.pi/harnesses/lib/system1/jev.ts +503 -0
  421. package/.versions/2.0.13/.pi/harnesses/lib/system1/service.ts +245 -0
  422. package/.versions/2.0.13/.pi/harnesses/lib/update-check.ts +222 -0
  423. package/.versions/2.0.13/.pi/harnesses/package-lock.json +2039 -0
  424. package/.versions/2.0.13/.pi/harnesses/package.json +10 -0
  425. package/.versions/2.0.13/.pi/prompts/af-build.md +24 -0
  426. package/.versions/2.0.13/.pi/prompts/af-code-simplify.md +22 -0
  427. package/.versions/2.0.13/.pi/prompts/af-constraints.md +31 -0
  428. package/.versions/2.0.13/.pi/prompts/af-plan.md +17 -0
  429. package/.versions/2.0.13/.pi/prompts/af-review.md +16 -0
  430. package/.versions/2.0.13/.pi/prompts/af-set-hermes-telegram.md +15 -0
  431. package/.versions/2.0.13/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  432. package/.versions/2.0.13/.pi/prompts/af-setup-rules.md +20 -0
  433. package/.versions/2.0.13/.pi/prompts/af-ship.md +17 -0
  434. package/.versions/2.0.13/.pi/prompts/af-spec.md +15 -0
  435. package/.versions/2.0.13/.pi/prompts/af-test.md +19 -0
  436. package/.versions/2.0.13/.pi/skills/bowser/SKILL.md +145 -0
  437. package/.versions/2.0.13/.version +1 -0
  438. package/.versions/2.0.13/agents/architect.md +24 -0
  439. package/.versions/2.0.13/agents/bowser.md +28 -0
  440. package/.versions/2.0.13/agents/builder.md +55 -0
  441. package/.versions/2.0.13/agents/code-reviewer.md +209 -0
  442. package/.versions/2.0.13/agents/deep-researcher.md +32 -0
  443. package/.versions/2.0.13/agents/documenter.md +22 -0
  444. package/.versions/2.0.13/agents/orchestrator.md +22 -0
  445. package/.versions/2.0.13/agents/plan-reviewer.md +83 -0
  446. package/.versions/2.0.13/agents/planner.md +105 -0
  447. package/.versions/2.0.13/agents/releaser.md +24 -0
  448. package/.versions/2.0.13/agents/researcher.md +30 -0
  449. package/.versions/2.0.13/agents/security-auditor.md +167 -0
  450. package/.versions/2.0.13/agents/test-engineer.md +153 -0
  451. package/.versions/2.0.13/agents/web-debugger.md +44 -0
  452. package/.versions/2.0.13/agents/web-performance-auditor.md +194 -0
  453. package/.versions/2.0.13/bin/catalog/harness-runtime-closure.json +73 -0
  454. package/.versions/2.0.13/codex/fleet-session-client/SKILL.md +34 -0
  455. package/.versions/2.0.13/codex/fleet-session-client.zip +0 -0
  456. package/.versions/2.0.13/docs/ARCHITECTURE.md +753 -0
  457. package/.versions/2.0.13/docs/agent-fleet-setup.md +900 -0
  458. package/.versions/2.0.13/docs/claude-code-coms-bridge.md +134 -0
  459. package/.versions/2.0.13/docs/codex-session-bridge.md +219 -0
  460. package/.versions/2.0.13/docs/coms-hermes-bridge.md +188 -0
  461. package/.versions/2.0.13/docs/getting-started.md +126 -0
  462. package/.versions/2.0.13/docs/npm-install.md +468 -0
  463. package/.versions/2.0.13/docs/pi-extensions.md +454 -0
  464. package/.versions/2.0.13/docs/pi-setup.md +92 -0
  465. package/.versions/2.0.13/docs/skill-anatomy.md +150 -0
  466. package/.versions/2.0.13/install-manifest.json +3175 -0
  467. package/.versions/2.0.13/justfile +247 -0
  468. package/.versions/2.0.13/manifest-meta.json +1057 -0
  469. package/.versions/2.0.13/references/accessibility-checklist.md +160 -0
  470. package/.versions/2.0.13/references/communication-contract.md +26 -0
  471. package/.versions/2.0.13/references/definition-of-done.md +67 -0
  472. package/.versions/2.0.13/references/fleet-coordination-patterns.md +171 -0
  473. package/.versions/2.0.13/references/observability-checklist.md +92 -0
  474. package/.versions/2.0.13/references/orchestration-patterns.md +370 -0
  475. package/.versions/2.0.13/references/performance-checklist.md +236 -0
  476. package/.versions/2.0.13/references/prompting-patterns.md +380 -0
  477. package/.versions/2.0.13/references/security-checklist.md +245 -0
  478. package/.versions/2.0.13/references/testing-patterns.md +235 -0
  479. package/.versions/2.0.13/references/workflow-authoring.md +304 -0
  480. package/.versions/2.0.13/skills/_internal/grilling.md +59 -0
  481. package/.versions/2.0.13/skills/browser-testing-with-devtools/SKILL.md +351 -0
  482. package/.versions/2.0.13/skills/code-review-and-quality/SKILL.md +396 -0
  483. package/.versions/2.0.13/skills/compound-learning/SKILL.md +137 -0
  484. package/.versions/2.0.13/skills/constraint-driven-development/SKILL.md +338 -0
  485. package/.versions/2.0.13/skills/constraint-driven-development/references/floor-guard.md +99 -0
  486. package/.versions/2.0.13/skills/context-engineering/SKILL.md +341 -0
  487. package/.versions/2.0.13/skills/deprecation-and-migration/SKILL.md +247 -0
  488. package/.versions/2.0.13/skills/designing-agents/SKILL.md +394 -0
  489. package/.versions/2.0.13/skills/designing-agents/pi-harness-authoring.md +222 -0
  490. package/.versions/2.0.13/skills/drafting-workflows/SKILL.md +143 -0
  491. package/.versions/2.0.13/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  492. package/.versions/2.0.13/skills/frontend-ui-engineering/SKILL.md +328 -0
  493. package/.versions/2.0.13/skills/git-workflow-and-versioning/SKILL.md +316 -0
  494. package/.versions/2.0.13/skills/idea-refine/SKILL.md +182 -0
  495. package/.versions/2.0.13/skills/idea-refine/examples.md +238 -0
  496. package/.versions/2.0.13/skills/idea-refine/frameworks.md +99 -0
  497. package/.versions/2.0.13/skills/idea-refine/refinement-criteria.md +113 -0
  498. package/.versions/2.0.13/skills/idea-refine/scripts/idea-refine.sh +15 -0
  499. package/.versions/2.0.13/skills/incremental-implementation/SKILL.md +302 -0
  500. package/.versions/2.0.13/skills/interview-me/SKILL.md +226 -0
  501. package/.versions/2.0.13/skills/orchestration-verification/SKILL.md +182 -0
  502. package/.versions/2.0.13/skills/peer-coms/SKILL.md +90 -0
  503. package/.versions/2.0.13/skills/performance-optimization/SKILL.md +496 -0
  504. package/.versions/2.0.13/skills/planning-and-task-breakdown/SKILL.md +289 -0
  505. package/.versions/2.0.13/skills/repository-ai-setup/SKILL.md +117 -0
  506. package/.versions/2.0.13/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  507. package/.versions/2.0.13/skills/repository-ai-setup/references/apply-contract.md +74 -0
  508. package/.versions/2.0.13/skills/repository-ai-setup/references/provenance-template.md +16 -0
  509. package/.versions/2.0.13/skills/repository-ai-setup/references/setup-flow.md +108 -0
  510. package/.versions/2.0.13/skills/repository-ai-setup/references/verify-setup.md +20 -0
  511. package/.versions/2.0.13/skills/security-and-hardening/SKILL.md +524 -0
  512. package/.versions/2.0.13/skills/spec-driven-development/SKILL.md +295 -0
  513. package/.versions/2.0.13/skills/using-agent-skills/SKILL.md +198 -0
  514. package/.versions/2.0.13/vendor/agent-skills-upstream/LICENSE +21 -0
  515. package/.versions/2.0.13/vendor/agent-skills-upstream/README.md +430 -0
  516. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  517. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  518. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  519. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  520. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  521. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  522. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  523. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  524. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  525. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  526. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  527. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  528. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  529. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  530. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  531. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  532. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  533. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  534. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  535. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  536. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  537. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  538. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  539. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  540. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  541. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  542. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  543. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  544. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  545. package/.versions/2.0.13/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  546. package/CHANGELOG.md +10 -0
  547. package/README.md +3 -3
  548. package/agents/architect.md +2 -3
  549. package/agents/bowser.md +2 -2
  550. package/agents/builder.md +2 -3
  551. package/agents/code-reviewer.md +7 -8
  552. package/agents/deep-researcher.md +3 -4
  553. package/agents/documenter.md +2 -3
  554. package/agents/orchestrator.md +2 -3
  555. package/agents/plan-reviewer.md +5 -6
  556. package/agents/planner.md +5 -6
  557. package/agents/releaser.md +2 -3
  558. package/agents/researcher.md +4 -5
  559. package/agents/security-auditor.md +6 -7
  560. package/agents/test-engineer.md +3 -4
  561. package/agents/web-debugger.md +3 -3
  562. package/agents/web-performance-auditor.md +3 -3
  563. package/bin/catalog/harness-runtime-closure.json +30 -18
  564. package/bin/cli.js +47 -1
  565. package/bin/lib/apply.js +16 -0
  566. package/bin/lib/overrides.js +37 -1
  567. package/bin/lib/project-provenance.js +119 -0
  568. package/bin/lib/scan.js +1 -1
  569. package/bin/lib/transaction.js +1 -1
  570. package/bin/lib/validate-overrides.js +37 -3
  571. package/catalog/agent-prompts/README.md +12 -0
  572. package/catalog/agent-prompts/architecture-decision-author.md +24 -0
  573. package/catalog/agent-prompts/requirements-author.md +21 -0
  574. package/catalog/commands/README.md +13 -0
  575. package/catalog/commands/assess-change-impact.md +19 -0
  576. package/catalog/commands/audit-documentation.md +19 -0
  577. package/catalog/rules/README.md +33 -0
  578. package/catalog/rules/ai/policy-authoring.md +22 -0
  579. package/catalog/rules/architecture/behavior-preserving-refactoring.md +25 -0
  580. package/catalog/rules/architecture/public-contracts.md +22 -0
  581. package/catalog/rules/architecture/repository-boundaries.md +21 -0
  582. package/catalog/rules/architecture/structural-change-registration.md +25 -0
  583. package/catalog/rules/backend/notification-date-time.md +25 -0
  584. package/catalog/rules/bundles/README.md +16 -0
  585. package/catalog/rules/data/enum-semantics.md +25 -0
  586. package/catalog/rules/data/mixed-ownership-data.md +22 -0
  587. package/catalog/rules/data/reporting-queries.md +34 -0
  588. package/catalog/rules/docs/docs-maintenance.md +25 -0
  589. package/catalog/rules/frameworks/vue.md +25 -0
  590. package/catalog/rules/frontend/async-ui-states.md +26 -0
  591. package/catalog/rules/frontend/established-ui-primitives.md +25 -0
  592. package/catalog/rules/frontend/form-validation.md +26 -0
  593. package/catalog/rules/frontend/navigation-contracts.md +25 -0
  594. package/catalog/rules/languages/csharp.md +25 -0
  595. package/catalog/rules/languages/javascript.md +25 -0
  596. package/catalog/rules/languages/sql.md +24 -0
  597. package/catalog/rules/security/authorization-before-effects.md +26 -0
  598. package/catalog/rules/security/diagnostic-data-safety.md +22 -0
  599. package/catalog/rules/security/response-data-minimization.md +25 -0
  600. package/catalog/rules/security/trusted-tenant-scope.md +26 -0
  601. package/catalog/rules/testing/shared-package-consumers.md +25 -0
  602. package/catalog/rules/testing/verification-conventions.md +24 -0
  603. package/docs/ARCHITECTURE.md +50 -2
  604. package/docs/agent-fleet-setup.md +246 -28
  605. package/docs/codex-session-bridge.md +1 -1
  606. package/docs/pi-extensions.md +10 -5
  607. package/docs/workflows.md +4 -3
  608. package/install-manifest.json +125 -3
  609. package/manifest-meta.json +77 -15
  610. package/package.json +5 -3
  611. package/skills/repository-ai-setup/SKILL.md +117 -0
  612. package/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  613. package/skills/repository-ai-setup/references/apply-contract.md +74 -0
  614. package/skills/repository-ai-setup/references/provenance-template.md +16 -0
  615. package/skills/repository-ai-setup/references/setup-flow.md +108 -0
  616. package/skills/repository-ai-setup/references/verify-setup.md +20 -0
@@ -1,4 +1,11 @@
1
- import { join } from "node:path";
1
+ import { isAbsolute, join, resolve, sep } from "node:path";
2
+ import { createHash } from "node:crypto";
3
+ import { lstatSync, readFileSync, realpathSync } from "node:fs";
4
+ import { PROACTIVE_LIMITS } from "./proactive-config.ts";
5
+ import { validProactiveLabelKey } from "../lib/fleet-read-model.ts";
6
+ import type { ReviewRecord } from "./proactive-runtime.ts";
7
+ import type { FindingEntry, FindingReview } from "./proactive-findings.ts";
8
+ import { readProactiveTrace, type ProactiveTraceRecord } from "./system1-activity.ts";
2
9
  import { projectWatchdogReadback, readWatchdogTrace, type WatchdogActivity, type WatchdogTraceRecord } from "./system1-activity.ts";
3
10
  import type { WatchdogSystem1Session } from "./system1-runtime.ts";
4
11
 
@@ -82,3 +89,137 @@ export function formatWatchdogStatus(session: WatchdogSystem1Session | null, act
82
89
  `Last: ${latest ? `${latest.checkId} · ${latest.status} · ${latest.reason} · LLM ${latest.llm} · ${latest.outcome}` : "unknown"}`,
83
90
  ].join("\n");
84
91
  }
92
+
93
+ /** Explicit human labels for a reviewed, revision-bound candidate set. No label is inferred. */
94
+ export interface ProactiveHumanLabel {
95
+ snapshotId: string; ruleId: string; ruleHash: string; subject: string;
96
+ expected: "violation" | "clean" | "unknown";
97
+ }
98
+ /** Explicit local JSON file only. Caller supplies a path inside a session artifact directory.
99
+ * Invalid files fail closed; no auto-discovery and no file contents in errors/reports. */
100
+ export function loadProactiveLabels(sessionDir: string, file: string): readonly ProactiveHumanLabel[] {
101
+ if (!isAbsolute(file)) throw new Error("Unavailable labels file");
102
+ const root = resolve(sessionDir, "artifacts"), target = resolve(file);
103
+ try {
104
+ if (!target.startsWith(root + sep) || !target.endsWith(".json") || target.slice(root.length+1).split(sep).some(s => /^(?:\.|\.env|credentials?|secrets?|private)/i.test(s))) throw new Error();
105
+ const rootInfo = lstatSync(root), targetRelative = target.slice(root.length + 1).split(sep);
106
+ if (!rootInfo.isDirectory() || rootInfo.isSymbolicLink()) throw new Error();
107
+ let cursor = root;
108
+ for (const part of targetRelative) {
109
+ cursor = join(cursor, part);
110
+ if (lstatSync(cursor).isSymbolicLink()) throw new Error();
111
+ }
112
+ const canonicalRoot = realpathSync(root), canonicalTarget = realpathSync(target);
113
+ if (!canonicalTarget.startsWith(canonicalRoot + sep) || !lstatSync(target).isFile() || lstatSync(target).size > PROACTIVE_LIMITS.maxFileBytes) throw new Error();
114
+ } catch { throw new Error("Unavailable labels file"); }
115
+ let parsed: unknown;
116
+ try { parsed = JSON.parse(readFileSync(target, "utf8")); } catch { throw new Error("Invalid labels file"); }
117
+ if (!Array.isArray(parsed) || parsed.length > PROACTIVE_LIMITS.maxQuestions * PROACTIVE_LIMITS.maxUnits || parsed.some(label => !validLabel(label))) throw new Error("Invalid labels file");
118
+ return parsed;
119
+ }
120
+ const hashId = (v: unknown) => typeof v === "string" && /^[a-f0-9]{64}$/.test(v);
121
+ const validLabel = (v: unknown): v is ProactiveHumanLabel => !!v && typeof v === "object" && !Array.isArray(v) &&
122
+ Object.keys(v).sort().join(",") === "expected,ruleHash,ruleId,snapshotId,subject" &&
123
+ validProactiveLabelKey(v) &&
124
+ ["violation","clean","unknown"].includes((v as ProactiveHumanLabel).expected);
125
+ /** Command-only opt-in: bad syntax or unreadable/unmatched files never become measured zeroes. */
126
+ export function commandProactiveLabels(sessionDir: string, args: string): readonly ProactiveHumanLabel[] | undefined {
127
+ const value = /^--labels[ \t]+(.+)$/.exec(args.trim())?.[1];
128
+ if (!value || !isAbsolute(value)) return undefined;
129
+ try { return loadProactiveLabels(sessionDir, value); } catch { return undefined; }
130
+ }
131
+ export interface ProactiveReportInput {
132
+ records: readonly ReviewRecord[];
133
+ history: readonly FindingReview[];
134
+ current: readonly FindingEntry[];
135
+ activity: readonly ProactiveTraceRecord[];
136
+ labels?: readonly ProactiveHumanLabel[];
137
+ /** Only parent-observed deliveries; child inbox publication is not a delivery receipt. */
138
+ feedback?: { hubDelivered: number; nativeDelivered: number | null };
139
+ }
140
+ export function compareProactiveLabels(labels?: readonly ProactiveHumanLabel[], records: readonly ReviewRecord[] = [], history: readonly FindingReview[] = []) {
141
+ if (!labels) return { availability:"unavailable" as const, labelled:null, truePositives:null, falseAlarms:null, misses:null, trueNegatives:null, unchecked:null, unknown:null, invalid:null, conflicts:null, precision:null, recall:null };
142
+ const seen = new Map<string,ProactiveHumanLabel>(); const rejected = new Set<string>(); let truePositives = 0, falseAlarms = 0, misses = 0, trueNegatives = 0, unchecked = 0, unknown = 0, invalid = 0, conflicts = 0;
143
+ const reviews = new Map(history.map(h => [h.turnId,h]));
144
+ for (const label of labels) {
145
+ if (!validLabel(label)) { invalid++; continue; }
146
+ const key = JSON.stringify([label.snapshotId,label.ruleId,label.ruleHash,label.subject]);
147
+ const prior=seen.get(key);
148
+ if (prior) { if (prior.expected !== label.expected) { conflicts++; rejected.add(key); } else invalid++; continue; } seen.set(key,label);
149
+ }
150
+ for (const [key,label] of seen) {
151
+ if (rejected.has(key)) continue;
152
+ if (label.expected === "unknown") { unknown++; continue; }
153
+ const matching = records.filter(r => r.snapshotId === label.snapshotId);
154
+ const observed = matching.some(r => reviews.get(r.turnId)?.findings.some(f => f.state === "current" && f.snapshotId === label.snapshotId && f.ruleId === label.ruleId && f.ruleHash === label.ruleHash && f.subject === label.subject)) ? "finding" :
155
+ matching.some(r => r.status === "reviewed" && r.assessment?.status === "reviewed" && !r.assessment.gaps.length && r.assessment.checkedUnits?.some(u => u.ruleId === label.ruleId && u.ruleHash === label.ruleHash && u.subject === label.subject && (u.verdict === "no_observed_violation" || u.verdict === "not_applicable"))) ? "clear" : "unchecked";
156
+ if (observed === "unchecked") { unchecked++; continue; }
157
+ if (label.expected === "violation") { if (observed === "finding") truePositives++; else misses++; }
158
+ else if (observed === "finding") falseAlarms++; else trueNegatives++;
159
+ }
160
+ return { availability:"available" as const, source:"explicit-human-labels" as const, labelled:seen.size-rejected.size, truePositives,falseAlarms,misses,trueNegatives,unchecked,unknown,invalid,conflicts,
161
+ precision:truePositives+falseAlarms ? truePositives/(truePositives+falseAlarms) : null,
162
+ recall:truePositives+misses ? truePositives/(truePositives+misses) : null };
163
+ }
164
+ /** Metadata-only projection: never returns supplied task/rule/source/provider text. */
165
+ export function buildProactiveReport(input?: ProactiveReportInput) {
166
+ const records = new Map<string, ReviewRecord>(); let duplicates = 0;
167
+ for (const row of input?.records ?? []) { if (records.has(row.turnId)) { duplicates++; continue; } records.set(row.turnId, row); }
168
+ const history = new Map((input?.history ?? []).map(row => [row.turnId, row]));
169
+ const starts = new Map<string, number>(), ends = new Map<string, number>(), evalStarts = new Set<string>(), evalEnds = new Set<string>(), events = new Set<string>();
170
+ for (const e of input?.activity ?? []) {
171
+ if (e.schema !== "proactive-review-trace/v1" || e.consumer !== "proactive-review" || !/^[a-f0-9]{64}$/.test(e.jobId) || !finite(e.at)) continue;
172
+ const key = JSON.stringify([e.sessionId,e.jobId,e.type,e.evaluationId]);
173
+ if (events.has(key)) { duplicates++; continue; } events.add(key);
174
+ const job = `${e.sessionId}:${e.jobId}`;
175
+ if (e.type === "job_started") starts.set(job,e.at);
176
+ if (e.type === "job_finished") ends.set(job,e.at);
177
+ if (e.evaluationId && e.type === "evaluation_started") evalStarts.add(`${job}:${e.evaluationId}`);
178
+ if (e.evaluationId && e.type === "evaluation_finished") evalEnds.add(`${job}:${e.evaluationId}`);
179
+ }
180
+ const rows = [...records.values()];
181
+ const statuses = new Set(["reviewed","not_checked","superseded","queue_timeout","backlog_full","session_budget","cancelled","unavailable","no_new_evidence","not_instrumented"]);
182
+ const turns = rows.filter(r => r.status !== "not_instrumented");
183
+ const attempts = rows.filter(r => r.status === "not_instrumented").length;
184
+ const reviewed = turns.filter(r => r.status === "reviewed" && r.assessment?.status === "reviewed" && !r.assessment.gaps.length && history.get(r.turnId)?.coverage.status !== "partial").length;
185
+ const partial = turns.filter(r => r.status === "not_checked" || (r.status === "reviewed" && history.get(r.turnId)?.coverage.status === "partial")).length;
186
+ const coverageUnknown = turns.filter(r => r.status === "reviewed" && !((r.assessment?.status === "reviewed" && !r.assessment.gaps.length && history.get(r.turnId)?.coverage.status !== "partial") || history.get(r.turnId)?.coverage.status === "partial")).length;
187
+ const inventoryEligible = turns.filter(r => r.status !== "no_new_evidence");
188
+ const turnsWithoutRuleInventory = inventoryEligible.filter(r => !Array.isArray(r.assessment?.ruleCoverage)).length;
189
+ const active = [...starts.keys()].filter(k => !ends.has(k)).length;
190
+ const latencies = [...ends].flatMap(([id,end]) => { const start=starts.get(id); return start !== undefined && end >= start ? [end-start] : []; }).sort((a,b)=>a-b);
191
+ const percentile=(p:number)=>latencies.length ? latencies[Math.ceil(latencies.length*p)-1] : null;
192
+ const evaluations = rows.flatMap(r => r.assessment?.evaluations ?? []);
193
+ const usage = evaluations.flatMap(e => e.status === "ok" && e.metadata?.usage && finite(e.metadata.usage.inputTokens) && finite(e.metadata.usage.outputTokens) ? [e.metadata.usage] : []);
194
+ const modelLatencies = evaluations.flatMap(e => e.status === "ok" && finite(e.metadata?.latencyMs) ? [e.metadata!.latencyMs] : []).sort((a,b)=>a-b);
195
+ const findings = new Map((input?.current ?? []).map(f => [f.id,f]));
196
+ const gapCount = rows.reduce((n,r)=>n+Math.max(r.assessment?.gaps.length ?? 0, history.get(r.turnId)?.coverage.gaps.length ?? 0),0);
197
+ const uncovered = new Map<string,{ruleId:string;ruleHash:string;status:"not_selected"|"uncertain"|"insufficient";reason:string;count:number}>();
198
+ for (const row of rows) for (const item of row.assessment?.ruleCoverage ?? []) {
199
+ if (!hashId(item.ruleHash) || typeof item.ruleId !== "string" || !["not_selected","uncertain","insufficient"].includes(item.status) || !["budget","provisional_not_applicable","selection","assessment_incomplete","insufficient_evidence","rule_conflict"].includes(item.reason)) continue;
200
+ const key=JSON.stringify([item.ruleId,item.ruleHash,item.status,item.reason]);const prior=uncovered.get(key);
201
+ uncovered.set(key,{ruleId:createHash("sha256").update(item.ruleId).digest("hex"),ruleHash:item.ruleHash,status:item.status,reason:item.reason,count:(prior?.count??0)+1});
202
+ }
203
+ return { schema:"proactive-review-report/v1" as const, consumer:"proactive-review" as const, readOnly:true as const,
204
+ availability: input ? "session-memory" : "unavailable", scope:"retained-session-evidence", completeness:"bounded-history; missing data is not checked",
205
+ turns:{observed:turns.length+active,eligible:turns.filter(r=>r.status!=="no_new_evidence").length+active,reviewed,partial,coverageUnknown:coverageUnknown+active,skipped:turns.filter(r=>r.status!=="reviewed"&&r.status!=="not_checked").length,active,byStatus:countBy(turns.map(r=>statuses.has(r.status)?r.status:"unavailable"))},
206
+ attempts:{notInstrumented:attempts},
207
+ coverage:{gapCount,uncoveredRulesKnown:inventoryEligible.length>0 && turnsWithoutRuleInventory===0 && active===0,turnsWithoutRuleInventory:turnsWithoutRuleInventory+active,unboundInventory:rows.reduce((n,r)=>n+(r.assessment?.gaps.filter(g=>g==="unbound_rule_inventory"||g==="unbound_rules").length??0),0),uncoveredRules:[...uncovered.values()]},
208
+ evaluations:{started:evalStarts.size,finished:evalEnds.size,metadataKnown:evaluations.filter(e=>e.status==="ok"&&e.metadata).length},
209
+ findings:{deterministic:[...findings.values()].filter(f=>f.source==="deterministic").length,system1Suspicions:[...findings.values()].filter(f=>f.source==="system1").length,stale:[...findings.values()].filter(f=>f.state==="stale").length,resolved:[...findings.values()].filter(f=>f.state==="resolved").length,notValidatedBugs:true},
210
+ feedback:{hubDelivered:input?.feedback&&finite(input.feedback.hubDelivered)?input.feedback.hubDelivered:null,nativeDelivered:input?.feedback&&finite(input.feedback.nativeDelivered)?input.feedback.nativeDelivered:null},
211
+ latencyMs:{p50:percentile(.5),p95:percentile(.95),known:latencies.length,modelP50:modelLatencies.length?modelLatencies[Math.ceil(modelLatencies.length*.5)-1]:null,modelP95:modelLatencies.length?modelLatencies[Math.ceil(modelLatencies.length*.95)-1]:null},
212
+ usage:{known:usage.length,unknown:Math.max(evalStarts.size,evaluations.length)-usage.length,inputTokens:usage.reduce((n,u)=>n+u.inputTokens,0),outputTokens:usage.reduce((n,u)=>n+u.outputTokens,0)},
213
+ labels:compareProactiveLabels(input?.labels,rows,input?.history),observability:{duplicateEvents:duplicates,incompleteJobs:active} };
214
+ }
215
+ /** Disk fallback exposes only trace metrics: missing retained review data stays unavailable. */
216
+ export function readProactiveReport(sessionDir:string) {
217
+ const events:ProactiveTraceRecord[]=[]; let offset=0,invalidRecords=0,partialTail=false,readError=false;
218
+ for(let pageCount=0;pageCount<1000;pageCount++) {
219
+ const page=readProactiveTrace(join(sessionDir,"artifacts","proactive-activity","proactive-events.jsonl"),{after:offset,limit:100});
220
+ events.push(...page.events); invalidRecords+=page.invalidRecords;partialTail ||=page.partialTail;readError ||=page.readError;
221
+ if(page.nextOffset===offset)break;offset=page.nextOffset;
222
+ }
223
+ const report=buildProactiveReport({records:[],history:[],current:[],activity:events});
224
+ return {...report,availability:readError?"unavailable":"trace-only",turns:{...report.turns,observed:null,eligible:null,reviewed:null,partial:null,coverageUnknown:null,skipped:null},observability:{...report.observability,invalidRecords,partialTail,readError}};
225
+ }
@@ -54,6 +54,8 @@ export interface WatchdogSystem1Session {
54
54
  readonly requestedModel: string;
55
55
  readonly blockLabel: string | null;
56
56
  readonly readiness: System1Availability;
57
+ /** Shared session service; no second provider or consumer policy. Undefined when unavailable/disposed. */
58
+ readonly sharedService: System1Service | undefined;
57
59
  readonly approvedProfiles: readonly AcceptedWatchdogProfile[];
58
60
  readonly hubArmed: boolean;
59
61
  readonly warnings: readonly string[];
@@ -172,6 +174,7 @@ export function createWatchdogSystem1Session(options: CreateWatchdogSystem1Sessi
172
174
  ? profiles.length === 0 ? ACTIVE_BLOCKED_LABEL : options.approvedProfilesForTest === undefined ? "experimental: scope only; G2 not validated" : null
173
175
  : null,
174
176
  readiness: runtime.readiness,
177
+ get sharedService() { return !disposed && options.selected && runtime.readiness.status === "ready" ? runtime.service : undefined; },
175
178
  approvedProfiles: profiles,
176
179
  hubArmed: options.watchdogArmed,
177
180
  warnings: Object.freeze([...(options.warnings ?? [])]),
@@ -20,6 +20,7 @@ export interface RunFlowDeps {
20
20
  effectiveScoutConfig(cwd: string): { model: string; profile: string | null; tools: string[]; fallback: string | null; allowlisted: boolean };
21
21
  execute?: typeof executeFlow;
22
22
  createSnapshot?: typeof createIsolatedWorkingTreeSnapshot;
23
+ removeSnapshot?: (root: string) => void;
23
24
  scoutAgent?: ScoutWorkflowDeps["agent"];
24
25
  worktreeRevision?: typeof worktreeRevision;
25
26
  buildRuntimeResult?: typeof buildRuntimeResult;
@@ -58,6 +59,7 @@ export function registerRunFlow(pi: ExtensionAPI, deps: RunFlowDeps): void {
58
59
  const forwardAbort = () => controller.abort(signal?.reason ?? "caller cancelled");
59
60
  if (signal?.aborted) forwardAbort(); else signal?.addEventListener("abort", forwardAbort, { once: true });
60
61
  activeId = params.invocation_id;
62
+ const snapshotCleanup: { status: "not-created" | "removed" | "failed"; path?: string; error?: string } = { status: "not-created" };
61
63
  const promise = (async () => {
62
64
  let snapshotRoot: string | null = null;
63
65
  let budgetCharged = false;
@@ -110,9 +112,21 @@ export function registerRunFlow(pi: ExtensionAPI, deps: RunFlowDeps): void {
110
112
  } catch (error) {
111
113
  return failure(executionStarted ? "result-failed" : "setup-failed", error, budgetCharged, executionStarted, runId ? { runId } : {});
112
114
  } finally {
113
- if (snapshotRoot) { try { rmSync(snapshotRoot, { recursive: true, force: true }); } catch {} }
115
+ if (snapshotRoot) {
116
+ try {
117
+ if (deps.removeSnapshot) deps.removeSnapshot(snapshotRoot);
118
+ else rmSync(snapshotRoot, { recursive: true, force: true });
119
+ snapshotCleanup.status = "removed";
120
+ } catch (error) {
121
+ snapshotCleanup.status = "failed"; snapshotCleanup.path = snapshotRoot; snapshotCleanup.error = message(error);
122
+ }
123
+ }
114
124
  }
115
- })();
125
+ })().then(result => ({
126
+ ...result,
127
+ content: snapshotCleanup.status === "failed" ? [...result.content, { type: "text", text: `Temporary scout snapshot cleanup failed; retained at ${snapshotCleanup.path}: ${snapshotCleanup.error}` }] : result.content,
128
+ details: { ...result.details, snapshotCleanup },
129
+ }));
116
130
  runs.set(params.invocation_id, { promise, controller, request: params.request });
117
131
  const cleanup = () => { if (activeId === params.invocation_id) activeId = null; signal?.removeEventListener("abort", forwardAbort); };
118
132
  void promise.then(cleanup, cleanup);
@@ -6,14 +6,15 @@ import type { ResearchState } from "../research/runtime.ts";
6
6
  import type { DelegationChild } from "../dispatch-core.ts";
7
7
  import type { SpecialistContextManifest } from "../../lib/context-budget-child-prompt.ts";
8
8
  import type { TimelineEntry, Zoomable } from "./zoom.ts";
9
- import type { FleetRow } from "../../lib/fleet-read-model.ts";
9
+ import type { FleetRow, ProactiveFindingView, ProactiveSessionView } from "../../lib/fleet-read-model.ts";
10
+ import { safeTerminalText } from "../../lib/fleet-strip-view.ts";
10
11
  import {
11
12
  applyLiveFleetDetailRow, detailBodyLines, detailBodyOffsets, detailTransition, fleetModelChoices, modelPickerTransition,
12
- normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, DETAIL_CHROME_ROWS,
13
+ normalizeFleetDetailInput, renderFleetDetail, renderFleetModelPicker, openProactiveEvidence, proactiveEvidenceContent, evidenceScroll, DETAIL_CHROME_ROWS,
13
14
  type FleetDetailKey, type FleetModelChoice, type PiModelSummary,
14
15
  } from "../../lib/fleet-detail-view.ts";
15
16
  import { liveTimeline, snapshotFleetDetailRow } from "../../lib/fleet-dashboard-ops.ts";
16
- import { FULLSCREEN_OVERLAY, bodyRows } from "../../lib/fleet-overlay.ts";
17
+ import { FULLSCREEN_OVERLAY, bodyRows, fitToHeight } from "../../lib/fleet-overlay.ts";
17
18
  import { createPanelResources } from "../../lib/fleet-panel.ts";
18
19
  import {
19
20
  readFleetTranscript, readFleetTranscriptBefore, readFleetTranscriptTail,
@@ -62,6 +63,14 @@ export interface DetailPanelDeps<TDef extends DetailAgentDef, TAgent extends Det
62
63
  maxLiveEntryChars: number;
63
64
  /** Current fleet row for this key. Required so an open detail panel tracks System 1. */
64
65
  currentFleetRow?(key: string): FleetRow | undefined;
66
+ getProactive?(): ProactiveSessionView | undefined;
67
+ readProactiveEvidence?(finding: ProactiveFindingView): string | null;
68
+ }
69
+
70
+ /** Render captured bytes only after an explicit action; never interpret terminal controls or print unbounded payload. */
71
+ export function evidenceLines(value: string | null, width: number, height: number, offset = 0, finding?: ProactiveFindingView): string[] {
72
+ const lines = proactiveEvidenceContent(value, finding, width);
73
+ return lines.slice(Math.max(0, Math.min(offset, Math.max(0, lines.length - height))), Math.max(0, Math.min(offset, Math.max(0, lines.length - height))) + height);
65
74
  }
66
75
 
67
76
  type ModelTarget<TAgent, TResearch> =
@@ -137,6 +146,7 @@ export function createDetailPanel<TDef extends DetailAgentDef, TAgent extends De
137
146
  const resources = createPanelResources();
138
147
  let detailRow = row, modelPicker: { choices: FleetModelChoice[]; index: number; scrollOffset: number } | null = null;
139
148
  let scrollOffset = 0, selectedIndex = 0, expandedIndex: number | null = null, followTail = true, verbose = initialVerbose, lastRender = 0;
149
+ let findingIndex = 0, evidence: string | null | undefined, evidenceFinding: ProactiveFindingView | undefined, evidenceOffset = 0;
140
150
  const transcriptPath = target?.transcriptStore?.path;
141
151
  let transcriptRecords: FleetTranscriptRecord[] | null = transcriptPath ? readFleetTranscriptTail(transcriptPath, { limit: 2000 }).records : null;
142
152
  const compactRecords = (records: readonly FleetTranscriptRecord[]): TimelineEntry[] => {
@@ -158,8 +168,19 @@ export function createDetailPanel<TDef extends DetailAgentDef, TAgent extends De
158
168
  if (target) target.zoomRender = (force?: boolean) => { const now = Date.now(); if (force || now - lastRender > 80) { lastRender = now; tui.requestRender(); } };
159
169
  resources.every(2000, () => tui.requestRender());
160
170
  const paintedRow = () => snapshotFleetDetailRow(applyLiveFleetDetailRow(detailRow, deps.currentFleetRow?.(detailRow.key), !!deps.currentFleetRow), target);
161
- return { render: (w: number) => { const body = bodyRows(tui.terminal?.rows, DETAIL_CHROME_ROWS); if (modelPicker) return renderFleetModelPicker(detailRow.name, modelPicker.choices, modelPicker, w, body, theme); syncTail(); const entries = timeline(); const liveRow = paintedRow(); if (followTail) { selectedIndex = Math.max(0, entries.length - 1); scrollOffset = Math.max(0, detailBodyLines(liveRow, entries, w, expandedIndex, verbose, selectedIndex).length - body); } return renderFleetDetail(liveRow, entries, scrollOffset, w, body, theme, expandedIndex, verbose, selectedIndex); },
162
- handleInput: async (data: string) => { const input = matchedInput(data), body = bodyRows(tui.terminal?.rows, DETAIL_CHROME_ROWS); if (modelPicker) { const action = modelPickerTransition(input, modelPicker, modelPicker.choices.length, body); if (action === "cancel") modelPicker = null; else if (action === "select") { const picked = modelPicker.choices[modelPicker.index]?.spec; modelPicker = null; if (picked && applyModel(detailRow, picked, ctx)) { const effective = deps.modelPolicy.substitutedModel(picked) ?? picked; detailRow = { ...detailRow, model: detailRow.status === "running" ? `${detailRow.model} → ${deps.shortModel(effective)} next` : `${deps.shortModel(effective)} (next)` }; } } tui.requestRender(); return; }
171
+ return { render: (w: number) => { const body = bodyRows(tui.terminal?.rows, DETAIL_CHROME_ROWS); if (modelPicker) return renderFleetModelPicker(detailRow.name, modelPicker.choices, modelPicker, w, body, theme); if (evidence !== undefined) return fitToHeight(evidenceLines(evidence, w, body, evidenceOffset, evidenceFinding), body + DETAIL_CHROME_ROWS); syncTail(); const entries = timeline(); const liveRow = paintedRow(); if (followTail) { selectedIndex = Math.max(0, entries.length - 1); scrollOffset = Math.max(0, detailBodyLines(liveRow, entries, w, expandedIndex, verbose, selectedIndex).length - body); } const lines = renderFleetDetail(liveRow, entries, scrollOffset, w, body, theme, expandedIndex, verbose, selectedIndex); const findings = deps.getProactive?.()?.owners.find(owner => owner.runToken === detailRow.runToken)?.findings ?? []; if (findings.length) lines[lines.length - 1] = ` Review finding ${Math.min(findingIndex, findings.length - 1) + 1}/${findings.length} · ${safeTerminalText(findings[findingIndex]?.ruleId)} · n next · e evidence · Esc close`.slice(0, w); return lines; },
172
+ handleInput: async (data: string) => { const input = matchedInput(data), body = bodyRows(tui.terminal?.rows, DETAIL_CHROME_ROWS); if (evidence !== undefined) { if (input === "\u001b" || input === "q") { evidence = undefined; evidenceFinding = undefined; } else evidenceOffset = evidenceScroll(input, evidenceOffset, proactiveEvidenceContent(evidence, evidenceFinding, tui.terminal?.columns ?? 80).length, body); tui.requestRender(); return; }
173
+ if (input === "n" || input === "e") {
174
+ const owner = deps.getProactive?.()?.owners.find(view => view.runToken === detailRow.runToken && view.owner === detailRow.key);
175
+ const findings = owner?.findings ?? [];
176
+ if (input === "n") findingIndex = findings.length ? (findingIndex + 1) % findings.length : 0;
177
+ else { const finding = findings[findingIndex]; evidenceOffset = 0; evidence = finding && deps.readProactiveEvidence ? openProactiveEvidence(finding, (handle, digest, snapshot, unit, excerpt) => {
178
+ if (deps.getProactive?.()?.owners.find(view => view.runToken === finding.runToken)?.findings.some(item => item.id === finding.id && item.snapshotHandle === handle && item.snapshotHash === digest && item.snapshotId === snapshot && item.unitId === unit && item.excerptHash === excerpt)) return deps.readProactiveEvidence!(finding);
179
+ return null;
180
+ }) : null; evidenceFinding = evidence !== null ? finding : undefined; }
181
+ tui.requestRender(); return;
182
+ }
183
+ if (modelPicker) { const action = modelPickerTransition(input, modelPicker, modelPicker.choices.length, body); if (action === "cancel") modelPicker = null; else if (action === "select") { const picked = modelPicker.choices[modelPicker.index]?.spec; modelPicker = null; if (picked && applyModel(detailRow, picked, ctx)) { const effective = deps.modelPolicy.substitutedModel(picked) ?? picked; detailRow = { ...detailRow, model: detailRow.status === "running" ? `${detailRow.model} → ${deps.shortModel(effective)} next` : `${deps.shortModel(effective)} (next)` }; } } tui.requestRender(); return; }
163
184
  if ((input === "\u001b[A" || input === "k" || input === "\u001b[5~" || input === "\u001b[H") && scrollOffset === 0) selectedIndex += loadOlder(); if (input === "\u001b[F") reloadTail(); let entries = timeline(); if (!followTail && (input === "\u001b[B" || input === "j" || input === "\u001b[6~") && selectedIndex >= entries.length - 1) { selectedIndex = Math.max(0, selectedIndex - loadNewer()); entries = timeline(); }
164
185
  const width = tui.terminal?.columns ?? 80, liveRow = paintedRow(), state = { scrollOffset, selectedIndex, expandedIndex, followTail, verbose }, content = detailBodyLines(liveRow, entries, width, expandedIndex, verbose, selectedIndex), offsets = detailBodyOffsets(liveRow, entries, width, expandedIndex, verbose); const action = detailTransition(input, state, entries, body, content.length, offsets); ({ scrollOffset, selectedIndex, expandedIndex, followTail, verbose } = state); if (action === "close") done(); else if (action === "copy") { const item = entries[selectedIndex]; if (item) { try { await copyToClipboard(item.content); ctx.ui.notify("Copied selected zoom row", "info"); } catch { ctx.ui.notify("Failed to copy selected zoom row", "error"); } } } else if (action === "model") { const target = resolveModelTarget(detailRow, ctx); if (target) { const choices = await loadAvailableModelChoices(ctx, target.current); if (choices) { const index = choices.findIndex(choice => choice.spec === target.current); modelPicker = { choices, index: Math.max(0, index), scrollOffset: Math.max(0, index) }; } } } tui.requestRender(); },
165
186
  invalidate() {}, dispose: () => resources.dispose() };
@@ -4,12 +4,15 @@ import type { ModelPolicy } from "../policy/models.ts";
4
4
  import type { ResearchState } from "../research/runtime.ts";
5
5
  import type { DetailAgentDef, DetailAgentState, DetailUiContext } from "./detail-panel.ts";
6
6
  import type { DelegationChild } from "../dispatch-core.ts";
7
- import type { FleetRow } from "../../lib/fleet-read-model.ts";
7
+ import type { FleetRow, ProactiveFindingView, ProactiveSessionView } from "../../lib/fleet-read-model.ts";
8
+ import { safeTerminalText } from "../../lib/fleet-strip-view.ts";
9
+ import { proactiveReviewLines, openProactiveEvidence, proactiveEvidenceContent, evidenceScroll, normalizeFleetDetailInput, type FleetDetailKey } from "../../lib/fleet-detail-view.ts";
10
+ import { evidenceLines } from "./detail-panel.ts";
8
11
  import { summarise, unionMs } from "../../lib/fleet-read-model.ts";
9
12
  import { attachFleetDashboardTicker } from "../../lib/fleet-dashboard-ops.ts";
10
13
  import { dashboardTransition, renderFleetDashboard, FLEET_CHROME_ROWS, type DashboardConfirm } from "../../lib/fleet-dashboard-view.ts";
11
14
  import { modelPickerTransition, renderFleetSubstitutionPicker, type FleetModelChoice } from "../../lib/fleet-detail-view.ts";
12
- import { FULLSCREEN_OVERLAY, bodyRows, clampScroll } from "../../lib/fleet-overlay.ts";
15
+ import { FULLSCREEN_OVERLAY, bodyRows, clampScroll, fitToHeight } from "../../lib/fleet-overlay.ts";
13
16
  import { createPanelResources } from "../../lib/fleet-panel.ts";
14
17
  import { reconcileSelection, type Selection } from "../../lib/fleet-selection.ts";
15
18
  import type { HistoryEntry } from "./history-store.ts";
@@ -40,6 +43,8 @@ export interface FleetDashboardDeps<TDef extends DetailAgentDef, TAgent extends
40
43
  getFilter(): string;
41
44
  setFilter(value: string): void;
42
45
  getFleetRows(now: number, unfiltered: boolean): FleetRow[];
46
+ getProactive?(): ProactiveSessionView | undefined;
47
+ readProactiveEvidence?(finding: ProactiveFindingView): string | null;
43
48
  actions: {
44
49
  open(key: string, runToken: string | undefined, ctx: DetailUiContext, verbose?: boolean): Promise<boolean>;
45
50
  execute(action: "kill" | "restart", key: string, runToken: string | undefined, ctx: DetailUiContext): Promise<void>;
@@ -82,12 +87,32 @@ export function createFleetDashboard<TDef extends DetailAgentDef, TAgent extends
82
87
  async function openFleetDashboard(ctx: DetailUiContext, startSubstitution = false): Promise<void> {
83
88
  const resources = createPanelResources(), selection: Selection = { index: 0 };
84
89
  let scrollOffset = 0, filtering = false, detailVerbose = false, confirm: DashboardConfirm = null;
90
+ let reviewHistory = false, historyIndex = 0, findingIndex = 0, historyOffset = 0, evidence: string | null | undefined, evidenceFinding: ProactiveFindingView | undefined, evidenceOffset = 0;
91
+ const history = () => deps.getProactive?.()?.owners.flatMap(owner => owner.history.map(review => ({ owner, review }))) ?? [];
85
92
  let picker: SubstitutionPicker | null = startSubstitution ? { stage: "source", choices: substitutionSourceChoices(), index: 0, scrollOffset: 0 } : null;
86
- const toInput = (data: string) => matchesKey(data, Key.up) ? "\u001b[A" : matchesKey(data, Key.down) ? "\u001b[B" : matchesKey(data, Key.pageUp) ? "\u001b[5~" : matchesKey(data, Key.pageDown) ? "\u001b[6~" : matchesKey(data, Key.enter) ? "\r" : matchesKey(data, Key.escape) ? "\u001b" : data;
93
+ const toInput = (data: string) => { const key: FleetDetailKey | undefined = matchesKey(data, Key.up) ? "up" : matchesKey(data, Key.down) ? "down" : matchesKey(data, Key.pageUp) ? "pageUp" : matchesKey(data, Key.pageDown) ? "pageDown" : matchesKey(data, Key.home) ? "home" : matchesKey(data, Key.end) ? "end" : matchesKey(data, Key.enter) ? "enter" : matchesKey(data, Key.escape) ? "escape" : undefined; return normalizeFleetDetailInput(data, key); };
87
94
  try { await ctx.ui.custom((tui: any, theme: any, _kb: any, done: (result?: unknown) => void) => {
88
95
  attachFleetDashboardTicker(resources, () => tui.requestRender());
89
- return { render: (w: number) => { const now = Date.now(), rows = fleetRows(false, now); reconcileSelection(selection, rows); const comsLines = deps.getComsLines(w, theme); const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS + comsLines.length); if (picker) return renderFleetSubstitutionPicker(picker.stage, picker.source, picker.choices, picker, w, body, theme); scrollOffset = clampScroll(scrollOffset, rows.length, body); const summary = summarise(rows); return renderFleetDashboard({ rows, selection, scrollOffset, filterQuery: deps.getFilter(), showFinished: deps.getShowFinished(), confirmation: confirm && confirm.until > now ? `press ${confirm.action === "kill" ? "x" : "r"} again to ${confirm.action} ${rows.find(row => row.key === confirm!.key && row.runToken === confirm!.runToken)?.name ?? "agent"}` : undefined, summary: { ...summary, wallMs: unionMs(summary.intervals) }, comsLines }, w, body, theme, { visibleWidth, truncateToWidth }); },
90
- handleInput: async (data: string) => { const now = Date.now(), rows = fleetRows(false, now); reconcileSelection(selection, rows); const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS), input = toInput(data);
96
+ return { render: (w: number) => { const now = Date.now(), rows = fleetRows(false, now); reconcileSelection(selection, rows); const comsLines = deps.getComsLines(w, theme); const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS + comsLines.length); if (evidence !== undefined) return fitToHeight(evidenceLines(evidence, w, body, evidenceOffset, evidenceFinding), body + FLEET_CHROME_ROWS + comsLines.length);
97
+ if (picker) return renderFleetSubstitutionPicker(picker.stage, picker.source, picker.choices, picker, w, body, theme);
98
+ if (reviewHistory) { const entries = history(), selected = entries[Math.min(historyIndex, entries.length - 1)]; const heading = selected ? `${safeTerminalText(selected.owner.owner)} · ${safeTerminalText(selected.owner.attempt)} · review ${historyIndex + 1}/${entries.length}` : "Review history unavailable"; const chosen = selected?.review.findings[findingIndex]; const lines = selected ? proactiveReviewLines({ ...selected.review, findings: chosen ? [chosen] : [] }, w) : []; const visible = [heading, ...lines.slice(historyOffset, historyOffset + Math.max(0, body - 2)), `↑↓ review · PgUp/PgDn/Home/End scroll · n finding ${chosen ? findingIndex + 1 : 0}/${selected?.review.findings.length ?? 0} · e evidence · Esc back`]; return fitToHeight(visible.map(line => truncateToWidth(line, w)), body + FLEET_CHROME_ROWS + comsLines.length); }
99
+ scrollOffset = clampScroll(scrollOffset, rows.length, body); const summary = summarise(rows); const lines = renderFleetDashboard({ rows, selection, scrollOffset, filterQuery: deps.getFilter(), showFinished: deps.getShowFinished(), confirmation: confirm && confirm.until > now ? `press ${confirm.action === "kill" ? "x" : "r"} again to ${confirm.action} ${rows.find(row => row.key === confirm!.key && row.runToken === confirm!.runToken)?.name ?? "agent"}` : undefined, summary: { ...summary, wallMs: unionMs(summary.intervals) }, proactive: deps.getProactive?.(), comsLines }, w, body, theme, { visibleWidth, truncateToWidth }); if (deps.getProactive?.()?.owners.some(owner => owner.history.length)) lines[body + 3] = truncateToWidth(" p review history · h execution history · Enter detail · Esc close", w); return lines; },
100
+ handleInput: async (data: string) => { const now = Date.now(), rows = fleetRows(false, now); reconcileSelection(selection, rows); const body = bodyRows(tui.terminal?.rows, FLEET_CHROME_ROWS + deps.getComsLines(tui.terminal?.columns ?? 80, theme).length), input = toInput(data);
101
+ if (evidence !== undefined) { if (input === "\u001b" || input === "q") { evidence = undefined; evidenceFinding = undefined; } else evidenceOffset = evidenceScroll(input, evidenceOffset, proactiveEvidenceContent(evidence, evidenceFinding, tui.terminal?.columns ?? 80).length, body); tui.requestRender(); return; }
102
+ if (reviewHistory) {
103
+ const entries = history();
104
+ if (input === "\u001b" || input === "q") reviewHistory = false;
105
+ else if (input === "\u001b[A" || input === "k") { historyIndex = Math.max(0, historyIndex - 1); findingIndex = 0; historyOffset = 0; }
106
+ else if (input === "\u001b[B" || input === "j") { historyIndex = Math.min(Math.max(0, entries.length - 1), historyIndex + 1); findingIndex = 0; historyOffset = 0; }
107
+ else if (["\u001b[5~", "\u001b[6~", "\u001b[H", "\u001b[F"].includes(input)) { const selected = entries[historyIndex]?.review; const chosen = selected?.findings[findingIndex]; const lines = selected ? proactiveReviewLines({ ...selected, findings: chosen ? [chosen] : [] }, tui.terminal?.columns ?? 80) : []; historyOffset = evidenceScroll(input, historyOffset, lines.length, Math.max(1, body - 2)); }
108
+ else if (input === "n") { const count = entries[historyIndex]?.review.findings.length ?? 0; findingIndex = count ? (findingIndex + 1) % count : 0; historyOffset = 0; }
109
+ else if (input === "e") { const item = entries[historyIndex], finding = item?.review.findings[findingIndex]; evidenceOffset = 0; evidence = finding && deps.readProactiveEvidence ? openProactiveEvidence(finding, (handle, digest, snapshot, unit, excerpt) => {
110
+ const current = history().find(({ owner, review }) => owner.runToken === finding.runToken && review.turnId === item.review.turnId);
111
+ return current?.review.findings.some(ref => ref.id === finding.id && ref.snapshotHandle === handle && ref.snapshotHash === digest && ref.snapshotId === snapshot && ref.unitId === unit && ref.excerptHash === excerpt) ? deps.readProactiveEvidence!(finding) : null;
112
+ }) : null; evidenceFinding = evidence !== null ? finding : undefined; }
113
+ tui.requestRender(); return;
114
+ }
115
+ if (input === "p" && !filtering && !picker) { reviewHistory = true; historyIndex = Math.max(0, history().length - 1); findingIndex = 0; tui.requestRender(); return; }
91
116
  if (picker) { const action = modelPickerTransition(input, picker, picker.choices.length, body); if (action === "cancel") { if (picker.stage === "target") { const source = picker.source, choices = substitutionSourceChoices(), index = Math.max(0, choices.findIndex(choice => choice.spec === source)); picker = { stage: "source", choices, index, scrollOffset: index }; } else picker = null; } else if (action === "select") { const picked = picker.choices[picker.index]?.spec; if (picked && picker.stage === "source") { const targets = await deps.loadAvailableModels(ctx, deps.modelPolicy.getSubstitution(picked)); if (targets) { const current = deps.modelPolicy.getSubstitution(picked), index = Math.max(0, targets.findIndex(choice => choice.spec === current)); picker = { stage: "target", source: picked, choices: targets, index, scrollOffset: index }; } } else if (picked && picker.source) { await deps.modelPolicy.applySessionSubstitution(picker.source, picked, { loadAvailable: current => deps.loadAvailableModels(ctx, current), notify: (message, level) => ctx.ui.notify(message, level === "success" ? "info" : level) }); picker = null; } } tui.requestRender(); return; }
92
117
  const state = { selection, scrollOffset, filtering, filterQuery: deps.getFilter(), showFinished: deps.getShowFinished(), confirm }, intent = dashboardTransition(input, state, rows, body, now); ({ scrollOffset, filtering, confirm } = state); deps.setFilter(state.filterQuery); deps.setShowFinished(state.showFinished);
93
118
  if (intent === "close") done(); else if (intent === "history") { confirm = null; await deps.openHistory(ctx); } else if (intent === "substitute") { confirm = null; const choices = substitutionSourceChoices(); if (!choices.length) ctx.ui.notify("No configured persona or sub-role models are available as substitution sources.", "warning"); else picker = { stage: "source", choices, index: 0, scrollOffset: 0 }; } else if (intent && typeof intent === "object" && "open" in intent) { const selected = rows.find(row => row.key === intent.open); confirm = null; if (selected) detailVerbose = await deps.actions.open(selected.key, selected.runToken, ctx, detailVerbose); } else if (intent && typeof intent === "object" && "kill" in intent) { const selected = rows.find(row => row.key === intent.kill); if (selected) await deps.actions.execute("kill", selected.key, selected.runToken, ctx); else ctx.ui.notify("Selected fleet row no longer exists.", "warning"); } else if (intent && typeof intent === "object" && "restart" in intent) { const selected = rows.find(row => row.key === intent.restart); if (selected) await restartRow(selected, ctx); } tui.requestRender(); },
@@ -1,4 +1,4 @@
1
- import { buildFleetRows, fleetTiming, projectSystem1Owner, type DelegateInput, type FleetFilter, type FleetRow, type FleetSource, type PeerInput, type ResearchInput, type SpecialistInput, type System1CheckInput, type System1OwnerView } from "../../lib/fleet-read-model.ts";
1
+ import { buildFleetRows, fleetTiming, projectProactive, projectSystem1Owner, type DelegateInput, type FleetFilter, type FleetRow, type FleetSource, type PeerInput, type ProactiveLedgerInput, type ResearchInput, type SpecialistInput, type System1CheckInput, type System1OwnerView } from "../../lib/fleet-read-model.ts";
2
2
 
3
3
  export interface FleetSourceAgent {
4
4
  def: { name: string; description?: string };
@@ -56,6 +56,8 @@ export interface FleetSourceDeps<TAgent extends FleetSourceAgent = FleetSourceAg
56
56
  modelForPeer(model: string): string;
57
57
  /** In-memory projection only. Render must not call the provider or read JSONL. */
58
58
  getSystem1?(): { active: readonly System1CheckInput[]; completed: readonly System1CheckInput[]; degraded?: boolean } | null | undefined;
59
+ /** Session-owned in-memory ledger; never read private evidence or trace files here. */
60
+ getProactive?(): ProactiveLedgerInput | null | undefined;
59
61
  }
60
62
 
61
63
  function delegateForest(children: readonly FleetSourceDelegate[], now: number, model: (value: string) => string): DelegateInput[] {
@@ -104,6 +106,8 @@ export function createFleetSource<TAgent extends FleetSourceAgent, TResearch ext
104
106
  return chosen && chosen.view.runToken === runToken ? chosen.view : undefined;
105
107
  }
106
108
  function snapshot(now: number): FleetSource {
109
+ const ledger = deps.getProactive?.();
110
+ const proactive = ledger ? projectProactive(ledger) : undefined;
107
111
  const specialists: SpecialistInput[] = Array.from(deps.getAgents().entries()).map(([key, state]) => ({
108
112
  key,
109
113
  name: deps.displayName(state.def.name),
@@ -118,6 +122,7 @@ export function createFleetSource<TAgent extends FleetSourceAgent, TResearch ext
118
122
  lastWork: state.lastWork || state.task || state.def.description || "",
119
123
  hasTimeline: true,
120
124
  system1: ownerSystem1(key, state, now),
125
+ proactive: state.dispatchId && state.lastBackend !== "coms" ? proactive?.owners.find(view => view.owner === key && view.attempt === state.dispatchId && view.runToken === `${key}:${state.dispatchId}`) : undefined,
121
126
  delegates: delegateForest(Array.from(state.delegations?.values() ?? []), now, deps.modelForPeer),
122
127
  }));
123
128
  const research: ResearchInput[] = Array.from(deps.getResearch().values()).map(state => ({
@@ -161,7 +166,7 @@ export function createFleetSource<TAgent extends FleetSourceAgent, TResearch ext
161
166
  peers.push({ key: `peer-pending:${encodeURIComponent(name)}`, name, model: "", lastWork: `${pending.count} pending ${pending.count === 1 ? "reply" : "replies"}`, status: "running", timingKind: pending.oldest == null ? "unknown" : "wait", startedAt: pending.oldest, elapsed: pending.oldest == null ? 0 : Math.max(0, now - pending.oldest) });
162
167
  }
163
168
  }
164
- return { specialists, research, peers };
169
+ return { specialists, research, peers, ...(proactive ? { proactive } : {}) };
165
170
  }
166
171
  return {
167
172
  snapshot,
@@ -1,7 +1,7 @@
1
1
  import { CustomEditor } from "@mariozechner/pi-coding-agent";
2
2
  import { isKeyRelease, Key, matchesKey, truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
3
3
  import { fleetStripTransition, initialFleetStripState, reconcileStripState, type FleetStripIntent, type FleetStripState } from "../../lib/fleet-strip-controller.ts";
4
- import { selectWidgetRows, summariseWidget, system1Visible, type FleetRow } from "../../lib/fleet-read-model.ts";
4
+ import { selectWidgetRows, summariseWidget, system1Visible, type FleetRow, type ProactiveSessionView } from "../../lib/fleet-read-model.ts";
5
5
  import { renderFleetStrip, visibleWindow } from "../../lib/fleet-strip-view.ts";
6
6
  import { installFleetEditor, type FleetEditorFactory, type FleetEditorWrapper } from "./fleet-editor.ts";
7
7
  export interface GridWidgetContext {
@@ -16,6 +16,8 @@ export interface GridWidgetContext {
16
16
  export interface GridUIContext {
17
17
  getWidgetContext(): GridWidgetContext | null | undefined;
18
18
  getRows(now: number): FleetRow[];
19
+ /** Optional atomic common projection; existing getRows-only consumers remain supported. */
20
+ getSnapshot?(now: number): { rows: FleetRow[]; proactive?: ProactiveSessionView };
19
21
  handleIntent?(intent: FleetStripIntent): void | Promise<void>;
20
22
  now?(): number;
21
23
  setTimeout?(callback: () => void, ms: number): ReturnType<typeof setTimeout>;
@@ -27,7 +29,7 @@ export function createGridUI(deps: GridUIContext) {
27
29
  const schedule = deps.setTimeout ?? setTimeout;
28
30
  const cancel = deps.clearTimeout ?? clearTimeout;
29
31
  let owner: GridWidgetContext | null = null, widgetInstalled = false, editorInstallation: ReturnType<typeof installFleetEditor> | undefined;
30
- let tui: any, state: FleetStripState = initialFleetStripState(), suspended = 0, timer: ReturnType<typeof setTimeout> | undefined, disposed = false, lastDisplayKey = "", lastRows: FleetRow[] = [], snapshotNow = 0, epoch = 0;
32
+ let tui: any, state: FleetStripState = initialFleetStripState(), suspended = 0, timer: ReturnType<typeof setTimeout> | undefined, disposed = false, lastDisplayKey = "", lastRows: FleetRow[] = [], lastProactive: ProactiveSessionView | undefined, snapshotNow = 0, epoch = 0;
31
33
 
32
34
  const maxRows = () => Number.isFinite(tui?.terminal?.rows) ? Math.max(0, Math.floor(tui.terminal.rows / 3)) : 0;
33
35
  const bodyRows = () => Math.max(0, maxRows() - 3);
@@ -41,7 +43,10 @@ export function createGridUI(deps: GridUIContext) {
41
43
  if (state.confirmation && state.confirmation.until <= now) state = { ...state, confirmation: null };
42
44
  const gate = editorGate();
43
45
  if (!gate.open && (state.active || state.confirmation)) state = { ...state, active: false, confirmation: null };
44
- const all = deps.getRows(now);
46
+ const source = deps.getSnapshot ? deps.getSnapshot(now) : { rows: deps.getRows(now), proactive: undefined };
47
+ const all = source.rows;
48
+ const review = source.proactive;
49
+ lastProactive = review && (review.evaluating > 0 || now < review.retainUntil) ? review : undefined;
45
50
  const selected = all.find(row => row.key === state.selectedKey);
46
51
  const pin = state.active && selected ? { key: selected.key, runToken: selected.runToken } : undefined;
47
52
  lastRows = selectWidgetRows(all, now, pin);
@@ -49,7 +54,7 @@ export function createGridUI(deps: GridUIContext) {
49
54
  return lastRows;
50
55
  }
51
56
  function needsTimer(rows: readonly FleetRow[], now: number): boolean {
52
- return state.active || !!state.confirmation || rows.some(row => row.status === "running" || ((row.status === "done" || row.status === "error") && row.endedAt != null && now < row.endedAt + 10_000) || system1Visible(row, now));
57
+ return state.active || !!state.confirmation || !!lastProactive || rows.some(row => row.status === "running" || ((row.status === "done" || row.status === "error") && row.endedAt != null && now < row.endedAt + 10_000) || system1Visible(row, now));
53
58
  }
54
59
  function arm() {
55
60
  if (timer || disposed) return;
@@ -58,7 +63,7 @@ export function createGridUI(deps: GridUIContext) {
58
63
  timer = schedule(() => { timer = undefined; const before = lastDisplayKey; refresh(false); if (before !== lastDisplayKey) tui?.requestRender?.(); arm(); }, 500);
59
64
  }
60
65
  function displayKey(rows: readonly FleetRow[], now: number): string {
61
- return JSON.stringify([Math.floor(now / 1000), rows.map(row => [row.key, row.runToken, row.status, Math.floor(row.elapsed / 1000), row.lastWork, row.system1 && row.system1.runToken === row.runToken ? [row.system1.checkId, row.system1.phase, row.system1.label, row.system1.elapsedMs, row.system1.retainUntil, row.system1.llmRelation] : null]), state, maxRows(), tui?.terminal?.columns ?? null, suspended, editorGate().open]);
66
+ return JSON.stringify([Math.floor(now / 1000), rows.map(row => [row.key, row.runToken, row.status, Math.floor(row.elapsed / 1000), row.lastWork, row.system1 && row.system1.runToken === row.runToken ? [row.system1.checkId, row.system1.phase, row.system1.label, row.system1.elapsedMs, row.system1.retainUntil, row.system1.llmRelation] : null, lastProactive && row.proactive && row.proactive.runToken === row.runToken ? [row.proactive.turns, row.proactive.reviewed, row.proactive.partial, row.proactive.currentViolations, row.proactive.currentSuspicions, row.proactive.stale, row.proactive.resolved] : null]), lastProactive && [lastProactive.turns, lastProactive.reviewed, lastProactive.partial, lastProactive.evaluating, lastProactive.currentViolations, lastProactive.currentSuspicions, lastProactive.stale, lastProactive.resolved, lastProactive.retainUntil], state, maxRows(), tui?.terminal?.columns ?? null, suspended, editorGate().open]);
62
67
  }
63
68
  function refresh(request = true) {
64
69
  if (disposed) return;
@@ -117,7 +122,7 @@ export function createGridUI(deps: GridUIContext) {
117
122
  const confirmation = state.confirmation && state.confirmation.until > snapshotNow
118
123
  ? selected?.backend === "coms" && action === "kill" ? "press x again to abort request (peer pane keeps running)" : `press ${action === "kill" ? "x" : "r"} again to ${action}`
119
124
  : undefined;
120
- return renderFleetStrip({ active: state.active && gate.open, interactiveAvailable: gate.compatible && suspended === 0, selectedKey: state.selectedKey, summary: summariseWidget(lastRows), window, maxRows: maxRows(), confirmation: gate.open ? confirmation : undefined }, width, theme, { visibleWidth, truncateToWidth });
125
+ return renderFleetStrip({ active: state.active && gate.open, interactiveAvailable: gate.compatible && suspended === 0, selectedKey: state.selectedKey, summary: summariseWidget(lastRows), proactive: lastProactive, window, maxRows: maxRows(), confirmation: gate.open ? confirmation : undefined }, width, theme, { visibleWidth, truncateToWidth });
121
126
  } };
122
127
  }, { placement: "belowEditor" });
123
128
  }
@@ -142,7 +147,7 @@ export function createGridUI(deps: GridUIContext) {
142
147
  if (timer) { cancel(timer); timer = undefined; }
143
148
  try { owner.ui.setWidget("agent-running", undefined); } catch {}
144
149
  editorInstallation?.dispose(); editorInstallation = undefined; widgetInstalled = false; tui = undefined;
145
- state = initialFleetStripState(); lastRows = []; lastDisplayKey = "";
150
+ state = initialFleetStripState(); lastRows = []; lastProactive = undefined; lastDisplayKey = "";
146
151
  }
147
152
  function reset() { disposeOwned(); owner = null; disposed = false; install(); }
148
153
  function dispose() { disposed = true; disposeOwned(); owner = null; }
@@ -3,5 +3,5 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
- "version": "2.0.12"
6
+ "version": "2.0.13"
7
7
  }
@@ -3,5 +3,5 @@
3
3
  "private": true,
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
- "version": "2.0.12"
6
+ "version": "2.0.13"
7
7
  }
@@ -78,6 +78,42 @@ export interface SpecialistContextManifest {
78
78
  protocolIds: string[];
79
79
  }
80
80
 
81
+ export function buildProjectRulesProtocol(paths: readonly string[]): string {
82
+ if (paths.length === 0) return "";
83
+ return `
84
+
85
+ ## Project rules
86
+ This project keeps its own rules in: ${paths.join(", ")} (repo-relative).
87
+ Rules are HOW constraints — read the ones relevant to your task and comply with them.
88
+ Read a listed file directly. Resolve them index-first when they are folders: if one has a
89
+ top-level README.md or index.md, read that first and follow its loading manifest
90
+ (session bundles, "load X when Y" lists) to select only the rule files that apply;
91
+ do not bulk-read the tree. Only when a folder has no such index, discover rule files
92
+ recursively (\`find <dir> -type f\`) and read the relevant ones. If you plan or review
93
+ work, validate your subject against the rules; when delegating, pass the relevant
94
+ rule file paths and specific points to check to the child.`;
95
+ }
96
+
97
+ export function buildProjectDocsProtocol(paths: readonly string[]): string {
98
+ if (paths.length === 0) return "";
99
+ return `
100
+
101
+ ## Project docs
102
+ This project's canonical documentation entry points are: ${paths.join(", ")}
103
+ (repo-relative). Docs carry WHAT/WHY context — architecture, standards, decisions.
104
+ They orient you; they are not compliance rules. Read a listed file directly. For a
105
+ listed folder, start from its README.md or index.md and follow only links relevant
106
+ to the task rather than bulk-reading doc trees. If your work changes something the
107
+ docs describe (architecture, public APIs, commands, structure), say so in your final
108
+ response so the docs can be updated.`;
109
+ }
110
+
111
+ export function buildSelectedProjectPolicyProtocol(manifest: SpecialistContextManifest): string {
112
+ const selected = new Set(manifest.protocolIds);
113
+ return (selected.has("rules") ? buildProjectRulesProtocol(manifest.projectPolicy.rulesPaths) : "") +
114
+ (selected.has("docs") ? buildProjectDocsProtocol(manifest.projectPolicy.docsPaths) : "");
115
+ }
116
+
81
117
  const skillPaths = (text: string) => [...new Set(text.match(/(?:^|[\s`(])((?:\.?\/?skills\/)[\w./-]+\/SKILL\.md)/g) ?? [])]
82
118
  .map(match => match.match(/((?:\.?\/?skills\/)[\w./-]+\/SKILL\.md)/)?.[1] ?? "")
83
119
  .filter(Boolean);
@@ -118,7 +154,7 @@ export function nativeSpecialistSystemPrompt(input: { manifest: SpecialistContex
118
154
  ...(manifest.flags.artifacts ? ["Artifact paths are supplied via stdin."] : []),
119
155
  ];
120
156
  const references = `# Managed Specialist\nPersona: ${manifest.persona.name}; source: ${manifest.persona.sourcePath}.${paths("Primary skills", manifest.persona.primarySkillPaths)}${paths("Task-selected skills", manifest.taskSkillPaths)}${paths("Applicable project rules", manifest.projectPolicy.rulesPaths)}${paths("Applicable project docs", manifest.projectPolicy.docsPaths)}\n${framing.join(" ")} Read the persona source before work and applicable project rules before edits or commands. Read only the named skill and documentation paths when relevant; do not discover global skills or context files.`;
121
- let prompt = references + buildClarificationProtocol(input.userLanguage);
157
+ let prompt = references + buildSelectedProjectPolicyProtocol(manifest) + buildClarificationProtocol(input.userLanguage);
122
158
  if (manifest.flags.assertions) prompt += "\n\n## Verification\nRead skills/orchestration-verification/SKILL.md for the structured return contract; apply the assertions supplied in the task.";
123
159
  if (manifest.delegateRoles.length) prompt += buildDelegationProtocol(manifest.delegateRoles);
124
160
  prompt += buildDeliverableProtocol(input.agentKey, input.runNumber, input.artifactRoot, input.dispatchId);
@@ -169,12 +205,15 @@ export function nativeResearchSystemPrompt(input: {
169
205
  personaName?: string;
170
206
  personaPath?: string;
171
207
  cwd: string;
208
+ rulesPaths?: readonly string[];
209
+ docsPaths?: readonly string[];
172
210
  }): string {
173
211
  const persona = input.personaName && input.personaPath
174
212
  ? `\nSelected persona: ${input.personaName}. Its source is ${input.personaPath}; read that one file only when its role guidance is needed.`
175
213
  : "\nNo persona is selected; act as a general research helper.";
214
+ const policy = buildProjectRulesProtocol(input.rulesPaths ?? []) + buildProjectDocsProtocol(input.docsPaths ?? []);
176
215
  return `# Read-only Research Helper
177
216
  You investigate the requested repository topic for a parent agent. Your only tools are read, grep, find, and ls. Do not edit, write, run bash, delegate, or claim those tools are available.${persona}
178
- Working directory: ${input.cwd}
217
+ Working directory: ${input.cwd}${policy}
179
218
  Task input may name artifact paths; inspect only paths relevant to that task. Report concise findings with concrete path:line citations. State uncertainty or missing evidence plainly. Return findings only; do not propose or attempt edits.`;
180
219
  }
@@ -15,6 +15,7 @@ export interface HubPromptParts {
15
15
  askUserBlock: string;
16
16
  modeSection: string;
17
17
  verificationSection: string;
18
+ projectPolicySection?: string;
18
19
  comsSection: string;
19
20
  herdrSection: string;
20
21
  compactionSection?: string;
@@ -70,7 +71,7 @@ ${parts.researchCatalog}
70
71
  ${parts.languageLines}${fleet}
71
72
  ${parts.askUserBlock}
72
73
 
73
- ${parts.modeSection}${state}${verification}
74
+ ${parts.modeSection}${state}${verification}${parts.projectPolicySection ?? ""}
74
75
  ${parts.comsSection}${parts.herdrSection}${parts.compactionSection ?? ""}
75
76
  ## Hard Rules
76
77
  ${parts.hardRules}
@@ -83,7 +84,7 @@ export interface NamedHubPart { id: string; text: string; category: ContextCateg
83
84
 
84
85
  export function namedHubLedgerParts(input: {
85
86
  intro: string; languageLines: string; teamMembers: string; agentCards: readonly { id: string; text: string }[];
86
- dispatchSection: string; modeSection: string; verificationSection: string; researchCards: readonly { id: string; text: string }[];
87
+ dispatchSection: string; modeSection: string; verificationSection: string; projectPolicySection?: string; researchCards: readonly { id: string; text: string }[];
87
88
  researchCatalog: string; comsSection: string; herdrSection: string; compactionSection?: string; stateCapsule?: string;
88
89
  }): NamedHubPart[] {
89
90
  return [
@@ -94,6 +95,7 @@ export function namedHubLedgerParts(input: {
94
95
  { id: "hub/policy/dispatch", text: input.dispatchSection, category: "protocol", persistence: "fixed", source: "hub-policy" },
95
96
  { id: "hub/policy/triage", text: input.modeSection, category: "protocol", persistence: "fixed", source: "run-budget" },
96
97
  { id: "hub/policy/verification", text: input.verificationSection, category: "protocol", persistence: "fixed", source: "orchestration-verification" },
98
+ { id: "hub/policy/project", text: input.projectPolicySection ?? "", category: "protocol", persistence: "session", source: "project-overrides" },
97
99
  { id: "hub/state", text: input.stateCapsule ?? "", category: "system", persistence: "turn", source: "hub-state" },
98
100
  ...(input.researchCards.length ? input.researchCards.map(card => ({ id: `hub/research/${card.id}`, text: card.text, category: "persona" as const, persistence: "session" as const, source: "research-persona" })) : [{ id: "hub/research-empty", text: input.researchCatalog, category: "persona" as const, persistence: "session" as const, source: "research-persona" }]),
99
101
  { id: "hub/policy/coms", text: input.comsSection, category: "protocol", persistence: "fixed", source: "coms" },