@chankov/agent-fleet 2.0.18 → 2.0.19

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 (583) hide show
  1. package/.pi/harnesses/agent-hub/package.json +1 -1
  2. package/.pi/harnesses/agent-hub/proactive-external-git.ts +28 -5
  3. package/.pi/harnesses/agent-hub/proactive-external.ts +83 -18
  4. package/.pi/harnesses/agent-hub/proactive-rules.ts +3 -3
  5. package/.pi/harnesses/agent-hub/proactive-snapshot.ts +23 -10
  6. package/.pi/harnesses/agent-hub/prompts/fragments.ts +6 -6
  7. package/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +1 -1
  8. package/.pi/harnesses/coms/package.json +1 -1
  9. package/.pi/harnesses/damage-control-continue/package.json +1 -1
  10. package/.pi/harnesses/lib/policy-roots.js +106 -0
  11. package/.pi/harnesses/lib/policy-roots.ts +7 -118
  12. package/.versions/2.0.19/.pi/agent-fleet/hermes/README.md +347 -0
  13. package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/plugin.js +1291 -0
  14. package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-herdr/presentation.js +672 -0
  15. package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/plugin.js +19 -0
  16. package/.versions/2.0.19/.pi/agent-fleet/hermes/desktop-plugins/agent-fleet-monitor/state.js +10 -0
  17. package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-capability.md +8 -0
  18. package/.versions/2.0.19/.pi/agent-fleet/hermes/gates/gate-o-validator-fixtures.json +1 -0
  19. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/activity.py +773 -0
  20. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_registry.py +134 -0
  21. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/coms_send.py +350 -0
  22. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/herdr_source.py +193 -0
  23. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/manifest.json +4 -0
  24. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/plugin_api.py +444 -0
  25. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/sessions.py +205 -0
  26. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/tasks.py +300 -0
  27. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/dashboard/watch.py +819 -0
  28. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-herdr/plugin.yaml +8 -0
  29. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/adapter.py +139 -0
  30. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/manifest.json +11 -0
  31. package/.versions/2.0.19/.pi/agent-fleet/hermes/plugins/agent-fleet-monitor/dashboard/plugin_api.py +50 -0
  32. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-conductor/SKILL.md +84 -0
  33. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-liaison/SKILL.md +84 -0
  34. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/SKILL.md +76 -0
  35. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/manifest.json +1 -0
  36. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog.py +249 -0
  37. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_actions.py +124 -0
  38. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_contract.py +76 -0
  39. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_delivery.py +10 -0
  40. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_engine.py +128 -0
  41. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_judgment.py +41 -0
  42. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_recovery.py +103 -0
  43. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_state.py +163 -0
  44. package/.versions/2.0.19/.pi/agent-fleet/hermes/skills/hub-watchdog/scripts/watchdog_transport.py +138 -0
  45. package/.versions/2.0.19/.pi/agent-fleet/hermes/watchdog-tests/__init__.py +0 -0
  46. package/.versions/2.0.19/.pi/agent-fleet/hooks/coms-stop-hook.mjs +84 -0
  47. package/.versions/2.0.19/.pi/agent-fleet/scripts/claude-code-preflight.ts +70 -0
  48. package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-claude-bridge.ts +437 -0
  49. package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-cli.ts +425 -0
  50. package/.versions/2.0.19/.pi/agent-fleet/scripts/coms-hermes-bridge.ts +413 -0
  51. package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-client.ts +69 -0
  52. package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet-codex-read.py +148 -0
  53. package/.versions/2.0.19/.pi/agent-fleet/scripts/fleet.ts +217 -0
  54. package/.versions/2.0.19/.pi/agent-fleet/scripts/flow.ts +157 -0
  55. package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-capability-runner.ts +25 -0
  56. package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-monitor-scenario.ts +474 -0
  57. package/.versions/2.0.19/.pi/agent-fleet/scripts/hermes-watchdog-capability-probe.ts +45 -0
  58. package/.versions/2.0.19/.pi/agent-fleet/scripts/install-hermes-plugin.sh +180 -0
  59. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/claude-bridge-core.ts +208 -0
  60. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/coms-envelope.ts +582 -0
  61. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fake-herdr-server.ts +88 -0
  62. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-catalog.ts +63 -0
  63. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-operations.ts +190 -0
  64. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-session.ts +166 -0
  65. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-codex-transport.ts +124 -0
  66. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/fleet-command.ts +252 -0
  67. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-command.ts +98 -0
  68. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/flow-maintenance.ts +230 -0
  69. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/herdr-layout.ts +281 -0
  70. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-bridge-core.ts +241 -0
  71. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-events.ts +1 -0
  72. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-herdr.ts +2 -0
  73. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-model.ts +3 -0
  74. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-registry.ts +2 -0
  75. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-socket.ts +2 -0
  76. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/hermes-monitor-store.ts +2 -0
  77. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/monitor-env.ts +146 -0
  78. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/peer-launch.ts +318 -0
  79. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-banner.ts +62 -0
  80. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/persona-dirs.ts +25 -0
  81. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/runtime-dependencies.js +124 -0
  82. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/spawn-stagger.ts +101 -0
  83. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-project.ts +178 -0
  84. package/.versions/2.0.19/.pi/agent-fleet/scripts/lib/team-snapshot.ts +147 -0
  85. package/.versions/2.0.19/.pi/agent-fleet/scripts/package-lock.json +35 -0
  86. package/.versions/2.0.19/.pi/agent-fleet/scripts/package.json +9 -0
  87. package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-banner.ts +41 -0
  88. package/.versions/2.0.19/.pi/agent-fleet/scripts/peer-launch.ts +283 -0
  89. package/.versions/2.0.19/.pi/agent-fleet/scripts/team-snapshot.ts +237 -0
  90. package/.versions/2.0.19/.pi/agent-fleet/scripts/team-up.ts +378 -0
  91. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/agent-phase.ts +179 -0
  92. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/changes.ts +61 -0
  93. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/debate.ts +149 -0
  94. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/env.ts +34 -0
  95. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/envelopes.ts +169 -0
  96. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/gates.ts +81 -0
  97. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/git.ts +96 -0
  98. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/isolated-snapshot.ts +125 -0
  99. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/merge.ts +95 -0
  100. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-profile.ts +22 -0
  101. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/model-visibility.ts +92 -0
  102. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/permissions.ts +130 -0
  103. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/personas.ts +57 -0
  104. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/poll.ts +86 -0
  105. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/project-policy.ts +36 -0
  106. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/quality.ts +64 -0
  107. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/run.ts +108 -0
  108. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/scout-data-boundary.ts +55 -0
  109. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/trace.ts +34 -0
  110. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/voices.ts +128 -0
  111. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/lib/writer-lease.ts +112 -0
  112. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/tsconfig.json +22 -0
  113. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-build-test.ts +61 -0
  114. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-debate.ts +87 -0
  115. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-document.ts +50 -0
  116. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-poll.ts +95 -0
  117. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-quality.ts +20 -0
  118. package/.versions/2.0.19/.pi/agent-fleet/scripts/workflows/wf-scout.ts +40 -0
  119. package/.versions/2.0.19/.pi/agents/dispatch-policy.yaml +32 -0
  120. package/.versions/2.0.19/.pi/agents/model-profiles.yaml +134 -0
  121. package/.versions/2.0.19/.pi/agents/peers.yaml +147 -0
  122. package/.versions/2.0.19/.pi/agents/teams.yaml +41 -0
  123. package/.versions/2.0.19/.pi/agents/voices.yaml +13 -0
  124. package/.versions/2.0.19/.pi/damage-control-rules.yaml +297 -0
  125. package/.versions/2.0.19/.pi/extensions/btw/README.md +120 -0
  126. package/.versions/2.0.19/.pi/extensions/btw/index.ts +914 -0
  127. package/.versions/2.0.19/.pi/extensions/btw/package.json +6 -0
  128. package/.versions/2.0.19/.pi/extensions/btw/state.js +179 -0
  129. package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/README.md +55 -0
  130. package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/index.ts +93 -0
  131. package/.versions/2.0.19/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  132. package/.versions/2.0.19/.pi/extensions/compact-and-continue/README.md +42 -0
  133. package/.versions/2.0.19/.pi/extensions/compact-and-continue/index.ts +120 -0
  134. package/.versions/2.0.19/.pi/extensions/compact-and-continue/package.json +6 -0
  135. package/.versions/2.0.19/.pi/extensions/mcp-bridge/README.md +46 -0
  136. package/.versions/2.0.19/.pi/extensions/mcp-bridge/index.ts +206 -0
  137. package/.versions/2.0.19/.pi/extensions/mcp-bridge/package.json +6 -0
  138. package/.versions/2.0.19/.pi/extensions/package-lock.json +1175 -0
  139. package/.versions/2.0.19/.pi/extensions/package.json +9 -0
  140. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/README.md +224 -0
  141. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/config.ts +198 -0
  142. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/examples/stt.json +35 -0
  143. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/index.ts +248 -0
  144. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/package.json +6 -0
  145. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/providers.ts +214 -0
  146. package/.versions/2.0.19/.pi/extensions/pi-voice-stt/recorder.ts +158 -0
  147. package/.versions/2.0.19/.pi/harnesses/agent-hub/README.md +1483 -0
  148. package/.versions/2.0.19/.pi/harnesses/agent-hub/acceptance.ts +199 -0
  149. package/.versions/2.0.19/.pi/harnesses/agent-hub/access-approval.ts +135 -0
  150. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-contract.ts +43 -0
  151. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-evidence.ts +64 -0
  152. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-hub.ts +54 -0
  153. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-runtime.ts +56 -0
  154. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources-worker.mjs +4 -0
  155. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-sources.ts +74 -0
  156. package/.versions/2.0.19/.pi/harnesses/agent-hub/agentic-state.ts +23 -0
  157. package/.versions/2.0.19/.pi/harnesses/agent-hub/artifacts.js +146 -0
  158. package/.versions/2.0.19/.pi/harnesses/agent-hub/assertion-ledger.js +67 -0
  159. package/.versions/2.0.19/.pi/harnesses/agent-hub/assist-profile.ts +16 -0
  160. package/.versions/2.0.19/.pi/harnesses/agent-hub/backend-policy.js +174 -0
  161. package/.versions/2.0.19/.pi/harnesses/agent-hub/bounded-output.ts +26 -0
  162. package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-continuation.ts +13 -0
  163. package/.versions/2.0.19/.pi/harnesses/agent-hub/budget-recovery.ts +214 -0
  164. package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-confirmation.ts +47 -0
  165. package/.versions/2.0.19/.pi/harnesses/agent-hub/capability-packs.ts +184 -0
  166. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model-thinking.ts +10 -0
  167. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-model.ts +10 -0
  168. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agent-models-substitute.ts +10 -0
  169. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-add.ts +9 -0
  170. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-drop.ts +9 -0
  171. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-history.ts +9 -0
  172. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-kill.ts +10 -0
  173. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-list.ts +9 -0
  174. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-restart.ts +10 -0
  175. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-save.ts +9 -0
  176. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/agents-team.ts +9 -0
  177. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/audit.ts +9 -0
  178. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/budget-continue.ts +10 -0
  179. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/compound.ts +9 -0
  180. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/coms.ts +9 -0
  181. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context-command.ts +9 -0
  182. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/context.ts +47 -0
  183. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/debate.ts +9 -0
  184. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/dispatch-policy.ts +9 -0
  185. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/handoff.ts +10 -0
  186. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/hub-report.ts +9 -0
  187. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/models.ts +10 -0
  188. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/poll.ts +9 -0
  189. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/recover.ts +61 -0
  190. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/retry.ts +10 -0
  191. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-recover.ts +12 -0
  192. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/task-triage-waive.ts +12 -0
  193. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/watchdog.ts +9 -0
  194. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/work-mode.ts +29 -0
  195. package/.versions/2.0.19/.pi/harnesses/agent-hub/commands/zoom.ts +10 -0
  196. package/.versions/2.0.19/.pi/harnesses/agent-hub/config/agents.ts +178 -0
  197. package/.versions/2.0.19/.pi/harnesses/agent-hub/config/model-profiles.ts +236 -0
  198. package/.versions/2.0.19/.pi/harnesses/agent-hub/config/overrides.ts +165 -0
  199. package/.versions/2.0.19/.pi/harnesses/agent-hub/context/agent-state.ts +30 -0
  200. package/.versions/2.0.19/.pi/harnesses/agent-hub/context/assertions-artifacts.ts +221 -0
  201. package/.versions/2.0.19/.pi/harnesses/agent-hub/context/budgets.ts +206 -0
  202. package/.versions/2.0.19/.pi/harnesses/agent-hub/context/hub-state.ts +40 -0
  203. package/.versions/2.0.19/.pi/harnesses/agent-hub/context-budget-snapshot.ts +105 -0
  204. package/.versions/2.0.19/.pi/harnesses/agent-hub/context-pressure.ts +191 -0
  205. package/.versions/2.0.19/.pi/harnesses/agent-hub/context-window.js +108 -0
  206. package/.versions/2.0.19/.pi/harnesses/agent-hub/debate-command.ts +176 -0
  207. package/.versions/2.0.19/.pi/harnesses/agent-hub/delegate.ts +478 -0
  208. package/.versions/2.0.19/.pi/harnesses/agent-hub/deterministic-fs.ts +169 -0
  209. package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-probe-extension.ts +26 -0
  210. package/.versions/2.0.19/.pi/harnesses/agent-hub/diagnostic-series-budget.ts +178 -0
  211. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-coms.ts +252 -0
  212. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-core.ts +27 -0
  213. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-complete.ts +173 -0
  214. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-prepare.ts +270 -0
  215. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-spawn.ts +233 -0
  216. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native-types.ts +267 -0
  217. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-native.ts +234 -0
  218. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-observability.ts +225 -0
  219. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-contract.ts +27 -0
  220. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-eval.ts +77 -0
  221. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-policy.ts +29 -0
  222. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-runtime.ts +55 -0
  223. package/.versions/2.0.19/.pi/harnesses/agent-hub/dispatch-triage-state.ts +33 -0
  224. package/.versions/2.0.19/.pi/harnesses/agent-hub/docs-lane.js +123 -0
  225. package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-judge.ts +352 -0
  226. package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-runtime.ts +480 -0
  227. package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1-policy.ts +39 -0
  228. package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-system1.ts +469 -0
  229. package/.versions/2.0.19/.pi/harnesses/agent-hub/drift-watchdog.js +349 -0
  230. package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-manifest.ts +51 -0
  231. package/.versions/2.0.19/.pi/harnesses/agent-hub/evidence-rules.js +96 -0
  232. package/.versions/2.0.19/.pi/harnesses/agent-hub/execution-evidence.ts +80 -0
  233. package/.versions/2.0.19/.pi/harnesses/agent-hub/external-blocker.js +85 -0
  234. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/adapters.ts +82 -0
  235. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker-client.ts +56 -0
  236. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/broker.ts +125 -0
  237. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/child-extension.ts +33 -0
  238. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/descendant.ts +63 -0
  239. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery-worker.mjs +15 -0
  240. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/discovery.ts +126 -0
  241. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/evaluate.ts +48 -0
  242. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/hub.ts +152 -0
  243. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-context.ts +8 -0
  244. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/native-fixture.test-support.ts +99 -0
  245. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/owners.ts +96 -0
  246. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/results.ts +54 -0
  247. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/runtime.ts +120 -0
  248. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/sources.ts +69 -0
  249. package/.versions/2.0.19/.pi/harnesses/agent-hub/file-discovery/state.ts +22 -0
  250. package/.versions/2.0.19/.pi/harnesses/agent-hub/filesystem-tool.ts +185 -0
  251. package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/registration-surface.json +66 -0
  252. package/.versions/2.0.19/.pi/harnesses/agent-hub/fixtures/t0a-synthetic/catalog.ts +189 -0
  253. package/.versions/2.0.19/.pi/harnesses/agent-hub/footer.ts +30 -0
  254. package/.versions/2.0.19/.pi/harnesses/agent-hub/helpers.ts +270 -0
  255. package/.versions/2.0.19/.pi/harnesses/agent-hub/hub-state-audit.js +65 -0
  256. package/.versions/2.0.19/.pi/harnesses/agent-hub/index.ts +2625 -0
  257. package/.versions/2.0.19/.pi/harnesses/agent-hub/input/completions.ts +82 -0
  258. package/.versions/2.0.19/.pi/harnesses/agent-hub/input/shortcuts.ts +20 -0
  259. package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/context-pressure.ts +133 -0
  260. package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/monitor-session.ts +104 -0
  261. package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/session-orchestration.ts +144 -0
  262. package/.versions/2.0.19/.pi/harnesses/agent-hub/lifecycle/turn-handlers.ts +74 -0
  263. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-control.ts +9 -0
  264. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke-journal.ts +131 -0
  265. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-invoke.ts +92 -0
  266. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-lifecycle.ts +13 -0
  267. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-publisher.ts +59 -0
  268. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-recovery.ts +3 -0
  269. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-runtime.ts +3 -0
  270. package/.versions/2.0.19/.pi/harnesses/agent-hub/monitor-session-bridge.ts +266 -0
  271. package/.versions/2.0.19/.pi/harnesses/agent-hub/no-progress.ts +593 -0
  272. package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-activation.ts +112 -0
  273. package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-metrics.ts +78 -0
  274. package/.versions/2.0.19/.pi/harnesses/agent-hub/orchestration-route.ts +76 -0
  275. package/.versions/2.0.19/.pi/harnesses/agent-hub/package.json +7 -0
  276. package/.versions/2.0.19/.pi/harnesses/agent-hub/peer-spawn-plan.ts +116 -0
  277. package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/models.ts +153 -0
  278. package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-activation.ts +62 -0
  279. package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/profile-runtime.ts +120 -0
  280. package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/roster.ts +94 -0
  281. package/.versions/2.0.19/.pi/harnesses/agent-hub/policy/work-mode.ts +137 -0
  282. package/.versions/2.0.19/.pi/harnesses/agent-hub/poll-command.ts +176 -0
  283. package/.versions/2.0.19/.pi/harnesses/agent-hub/presentation.ts +48 -0
  284. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-config.ts +21 -0
  285. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-evaluate.ts +138 -0
  286. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external-git.ts +82 -0
  287. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-external.ts +142 -0
  288. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-feedback.ts +104 -0
  289. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-findings.ts +115 -0
  290. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-local.ts +89 -0
  291. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-observer.ts +106 -0
  292. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-rules.ts +171 -0
  293. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-runtime.ts +318 -0
  294. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-selection.ts +68 -0
  295. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot-worker.mjs +12 -0
  296. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-snapshot.ts +271 -0
  297. package/.versions/2.0.19/.pi/harnesses/agent-hub/proactive-types.ts +67 -0
  298. package/.versions/2.0.19/.pi/harnesses/agent-hub/process-obligations.ts +158 -0
  299. package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/context.ts +56 -0
  300. package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/fragments.ts +95 -0
  301. package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/session-start.ts +90 -0
  302. package/.versions/2.0.19/.pi/harnesses/agent-hub/prompts/system-prompt.ts +125 -0
  303. package/.versions/2.0.19/.pi/harnesses/agent-hub/provider-semaphore.js +138 -0
  304. package/.versions/2.0.19/.pi/harnesses/agent-hub/reconcile.ts +26 -0
  305. package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-policy.ts +44 -0
  306. package/.versions/2.0.19/.pi/harnesses/agent-hub/recover-state.ts +104 -0
  307. package/.versions/2.0.19/.pi/harnesses/agent-hub/recovery-contract.ts +150 -0
  308. package/.versions/2.0.19/.pi/harnesses/agent-hub/rerun-policy.ts +40 -0
  309. package/.versions/2.0.19/.pi/harnesses/agent-hub/research/controls.ts +74 -0
  310. package/.versions/2.0.19/.pi/harnesses/agent-hub/research/runtime.ts +201 -0
  311. package/.versions/2.0.19/.pi/harnesses/agent-hub/research/spawn-run.ts +194 -0
  312. package/.versions/2.0.19/.pi/harnesses/agent-hub/research-watchdog.ts +40 -0
  313. package/.versions/2.0.19/.pi/harnesses/agent-hub/return-contract.js +349 -0
  314. package/.versions/2.0.19/.pi/harnesses/agent-hub/return-extract.js +77 -0
  315. package/.versions/2.0.19/.pi/harnesses/agent-hub/review-closure.ts +43 -0
  316. package/.versions/2.0.19/.pi/harnesses/agent-hub/review-findings.js +104 -0
  317. package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-observation.ts +41 -0
  318. package/.versions/2.0.19/.pi/harnesses/agent-hub/routing-proposal.ts +46 -0
  319. package/.versions/2.0.19/.pi/harnesses/agent-hub/run-budget.js +554 -0
  320. package/.versions/2.0.19/.pi/harnesses/agent-hub/run-namespace.js +93 -0
  321. package/.versions/2.0.19/.pi/harnesses/agent-hub/runtime-test-check.ts +54 -0
  322. package/.versions/2.0.19/.pi/harnesses/agent-hub/safety-routing.ts +22 -0
  323. package/.versions/2.0.19/.pi/harnesses/agent-hub/scope-gate.js +144 -0
  324. package/.versions/2.0.19/.pi/harnesses/agent-hub/session-audit.ts +313 -0
  325. package/.versions/2.0.19/.pi/harnesses/agent-hub/session-health.js +110 -0
  326. package/.versions/2.0.19/.pi/harnesses/agent-hub/session-start.ts +42 -0
  327. package/.versions/2.0.19/.pi/harnesses/agent-hub/spawn.ts +563 -0
  328. package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-activity.ts +625 -0
  329. package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-communication-store.ts +190 -0
  330. package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-report.ts +275 -0
  331. package/.versions/2.0.19/.pi/harnesses/agent-hub/system1-runtime.ts +258 -0
  332. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-resume-contract.ts +70 -0
  333. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-authorization.ts +122 -0
  334. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-config.ts +29 -0
  335. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-contract.ts +14 -0
  336. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-live-stage-boundary.mjs +49 -0
  337. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-obligations.ts +104 -0
  338. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-policy.ts +16 -0
  339. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-review-contract.mjs +43 -0
  340. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-contract.mjs +156 -0
  341. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-reviewer-only-diagnostics.mjs +112 -0
  342. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-runtime.ts +125 -0
  343. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-stage-guard.ts +21 -0
  344. package/.versions/2.0.19/.pi/harnesses/agent-hub/task-triage-state.ts +46 -0
  345. package/.versions/2.0.19/.pi/harnesses/agent-hub/timeline.ts +72 -0
  346. package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-runtime.ts +68 -0
  347. package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-catalog-state.ts +123 -0
  348. package/.versions/2.0.19/.pi/harnesses/agent-hub/tool-protocol.ts +134 -0
  349. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/action-executors.ts +213 -0
  350. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1-files.ts +15 -0
  351. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/ask-system1.ts +25 -0
  352. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/coms-tools.ts +139 -0
  353. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/context.ts +144 -0
  354. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-agent.ts +88 -0
  355. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-execution.ts +560 -0
  356. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/dispatch-triage.ts +16 -0
  357. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/execution-orchestration.ts +22 -0
  358. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/fleet-tools.ts +200 -0
  359. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/herdr-executors.ts +95 -0
  360. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/run-flow.ts +136 -0
  361. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/set-task-tier.ts +31 -0
  362. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/spawn-research.ts +67 -0
  363. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/team-adjust.ts +29 -0
  364. package/.versions/2.0.19/.pi/harnesses/agent-hub/tools/verification-contract.ts +80 -0
  365. package/.versions/2.0.19/.pi/harnesses/agent-hub/tsconfig.json +22 -0
  366. package/.versions/2.0.19/.pi/harnesses/agent-hub/types.ts +66 -0
  367. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/activity-dots.ts +25 -0
  368. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/context-budget.ts +87 -0
  369. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/detail-panel.ts +192 -0
  370. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-actions.ts +78 -0
  371. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-dashboard.ts +155 -0
  372. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-editor.ts +44 -0
  373. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/fleet-source.ts +179 -0
  374. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/grid.ts +159 -0
  375. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history-store.ts +137 -0
  376. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/history.ts +234 -0
  377. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/pool.ts +103 -0
  378. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/running-strip.ts +2 -0
  379. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/system1-communication.ts +59 -0
  380. package/.versions/2.0.19/.pi/harnesses/agent-hub/ui/zoom.ts +206 -0
  381. package/.versions/2.0.19/.pi/harnesses/agent-hub/unknown-tool-counter.ts +116 -0
  382. package/.versions/2.0.19/.pi/harnesses/agent-hub/version.ts +42 -0
  383. package/.versions/2.0.19/.pi/harnesses/agent-hub/watchdog-evaluation.ts +110 -0
  384. package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode-controls.ts +56 -0
  385. package/.versions/2.0.19/.pi/harnesses/agent-hub/work-mode.ts +187 -0
  386. package/.versions/2.0.19/.pi/harnesses/agent-hub/write-isolation.ts +187 -0
  387. package/.versions/2.0.19/.pi/harnesses/ask-user-remote/README.md +59 -0
  388. package/.versions/2.0.19/.pi/harnesses/ask-user-remote/index.ts +558 -0
  389. package/.versions/2.0.19/.pi/harnesses/ask-user-remote/questions.ts +161 -0
  390. package/.versions/2.0.19/.pi/harnesses/ask-user-remote/race-core.js +124 -0
  391. package/.versions/2.0.19/.pi/harnesses/ask-user-remote/runtime-ask.ts +68 -0
  392. package/.versions/2.0.19/.pi/harnesses/coms/README.md +100 -0
  393. package/.versions/2.0.19/.pi/harnesses/coms/index.ts +282 -0
  394. package/.versions/2.0.19/.pi/harnesses/coms/package.json +7 -0
  395. package/.versions/2.0.19/.pi/harnesses/coms/version.ts +42 -0
  396. package/.versions/2.0.19/.pi/harnesses/damage-control-continue/README.md +135 -0
  397. package/.versions/2.0.19/.pi/harnesses/damage-control-continue/index.ts +533 -0
  398. package/.versions/2.0.19/.pi/harnesses/damage-control-continue/package.json +7 -0
  399. package/.versions/2.0.19/.pi/harnesses/damage-control-continue/version.ts +42 -0
  400. package/.versions/2.0.19/.pi/harnesses/lib/changed-file-diagnostics.ts +642 -0
  401. package/.versions/2.0.19/.pi/harnesses/lib/coms-core-io.ts +385 -0
  402. package/.versions/2.0.19/.pi/harnesses/lib/coms-core.ts +577 -0
  403. package/.versions/2.0.19/.pi/harnesses/lib/coms-registry-entry.ts +94 -0
  404. package/.versions/2.0.19/.pi/harnesses/lib/context-budget-child-prompt.ts +220 -0
  405. package/.versions/2.0.19/.pi/harnesses/lib/context-budget-hub-prompt.ts +121 -0
  406. package/.versions/2.0.19/.pi/harnesses/lib/context-budget-view.ts +107 -0
  407. package/.versions/2.0.19/.pi/harnesses/lib/context-budget.ts +114 -0
  408. package/.versions/2.0.19/.pi/harnesses/lib/damage-control-shared.ts +226 -0
  409. package/.versions/2.0.19/.pi/harnesses/lib/deterministic-handle-path.ts +25 -0
  410. package/.versions/2.0.19/.pi/harnesses/lib/fixtures/context-budget-profiles.json +11 -0
  411. package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-operator.legacy.txt +73 -0
  412. package/.versions/2.0.19/.pi/harnesses/lib/fixtures/hub-prompt-orchestrator.legacy.txt +73 -0
  413. package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-ops.ts +178 -0
  414. package/.versions/2.0.19/.pi/harnesses/lib/fleet-dashboard-view.ts +172 -0
  415. package/.versions/2.0.19/.pi/harnesses/lib/fleet-detail-view.ts +339 -0
  416. package/.versions/2.0.19/.pi/harnesses/lib/fleet-overlay.ts +26 -0
  417. package/.versions/2.0.19/.pi/harnesses/lib/fleet-panel.ts +34 -0
  418. package/.versions/2.0.19/.pi/harnesses/lib/fleet-read-model.ts +609 -0
  419. package/.versions/2.0.19/.pi/harnesses/lib/fleet-selection.ts +24 -0
  420. package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-controller.ts +75 -0
  421. package/.versions/2.0.19/.pi/harnesses/lib/fleet-strip-view.ts +179 -0
  422. package/.versions/2.0.19/.pi/harnesses/lib/fleet-transcript-store.ts +244 -0
  423. package/.versions/2.0.19/.pi/harnesses/lib/herdr-client.ts +472 -0
  424. package/.versions/2.0.19/.pi/harnesses/lib/herdr-presence.ts +399 -0
  425. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-events.ts +136 -0
  426. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-herdr.ts +28 -0
  427. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-model.ts +18 -0
  428. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-registry.ts +6 -0
  429. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-socket.ts +163 -0
  430. package/.versions/2.0.19/.pi/harnesses/lib/hermes-monitor-store.ts +31 -0
  431. package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.js +106 -0
  432. package/.versions/2.0.19/.pi/harnesses/lib/policy-roots.ts +31 -0
  433. package/.versions/2.0.19/.pi/harnesses/lib/safe-source-read.js +29 -0
  434. package/.versions/2.0.19/.pi/harnesses/lib/spawned-peers.js +191 -0
  435. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-agentic.js +15 -0
  436. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-file-discovery.js +21 -0
  437. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-json.js +37 -0
  438. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-loader.js +44 -0
  439. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-proactive.js +68 -0
  440. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-triage.js +42 -0
  441. package/.versions/2.0.19/.pi/harnesses/lib/system1/config-v2.js +106 -0
  442. package/.versions/2.0.19/.pi/harnesses/lib/system1/config.js +50 -0
  443. package/.versions/2.0.19/.pi/harnesses/lib/system1/contracts.ts +154 -0
  444. package/.versions/2.0.19/.pi/harnesses/lib/system1/demo.ts +95 -0
  445. package/.versions/2.0.19/.pi/harnesses/lib/system1/jev.ts +503 -0
  446. package/.versions/2.0.19/.pi/harnesses/lib/system1/selection.js +11 -0
  447. package/.versions/2.0.19/.pi/harnesses/lib/system1/service.ts +245 -0
  448. package/.versions/2.0.19/.pi/harnesses/lib/update-check.ts +222 -0
  449. package/.versions/2.0.19/.pi/harnesses/package-lock.json +2039 -0
  450. package/.versions/2.0.19/.pi/harnesses/package.json +10 -0
  451. package/.versions/2.0.19/.pi/prompts/af-build.md +27 -0
  452. package/.versions/2.0.19/.pi/prompts/af-code-simplify.md +22 -0
  453. package/.versions/2.0.19/.pi/prompts/af-constraints.md +31 -0
  454. package/.versions/2.0.19/.pi/prompts/af-plan.md +17 -0
  455. package/.versions/2.0.19/.pi/prompts/af-review.md +16 -0
  456. package/.versions/2.0.19/.pi/prompts/af-set-hermes-telegram.md +15 -0
  457. package/.versions/2.0.19/.pi/prompts/af-set-hermes-watchdog.md +6 -0
  458. package/.versions/2.0.19/.pi/prompts/af-setup-rules.md +20 -0
  459. package/.versions/2.0.19/.pi/prompts/af-ship.md +17 -0
  460. package/.versions/2.0.19/.pi/prompts/af-spec.md +15 -0
  461. package/.versions/2.0.19/.pi/prompts/af-test.md +19 -0
  462. package/.versions/2.0.19/.pi/skills/bowser/SKILL.md +145 -0
  463. package/.versions/2.0.19/.version +1 -0
  464. package/.versions/2.0.19/agents/architect.md +24 -0
  465. package/.versions/2.0.19/agents/bowser.md +28 -0
  466. package/.versions/2.0.19/agents/builder.md +55 -0
  467. package/.versions/2.0.19/agents/code-reviewer.md +209 -0
  468. package/.versions/2.0.19/agents/deep-researcher.md +32 -0
  469. package/.versions/2.0.19/agents/documenter.md +22 -0
  470. package/.versions/2.0.19/agents/orchestrator.md +22 -0
  471. package/.versions/2.0.19/agents/plan-reviewer.md +83 -0
  472. package/.versions/2.0.19/agents/planner.md +105 -0
  473. package/.versions/2.0.19/agents/releaser.md +24 -0
  474. package/.versions/2.0.19/agents/researcher.md +30 -0
  475. package/.versions/2.0.19/agents/security-auditor.md +167 -0
  476. package/.versions/2.0.19/agents/test-engineer.md +153 -0
  477. package/.versions/2.0.19/agents/web-debugger.md +44 -0
  478. package/.versions/2.0.19/agents/web-performance-auditor.md +194 -0
  479. package/.versions/2.0.19/bin/catalog/harness-runtime-closure.json +73 -0
  480. package/.versions/2.0.19/codex/fleet-session-client/SKILL.md +34 -0
  481. package/.versions/2.0.19/codex/fleet-session-client.zip +0 -0
  482. package/.versions/2.0.19/docs/ARCHITECTURE.md +874 -0
  483. package/.versions/2.0.19/docs/agent-fleet-setup.md +1101 -0
  484. package/.versions/2.0.19/docs/claude-code-coms-bridge.md +147 -0
  485. package/.versions/2.0.19/docs/codex-session-bridge.md +219 -0
  486. package/.versions/2.0.19/docs/coms-hermes-bridge.md +188 -0
  487. package/.versions/2.0.19/docs/getting-started.md +126 -0
  488. package/.versions/2.0.19/docs/npm-install.md +535 -0
  489. package/.versions/2.0.19/docs/pi-extensions.md +454 -0
  490. package/.versions/2.0.19/docs/pi-setup.md +92 -0
  491. package/.versions/2.0.19/docs/skill-anatomy.md +150 -0
  492. package/.versions/2.0.19/install-manifest.json +3197 -0
  493. package/.versions/2.0.19/justfile +247 -0
  494. package/.versions/2.0.19/manifest-meta.json +1075 -0
  495. package/.versions/2.0.19/references/accessibility-checklist.md +160 -0
  496. package/.versions/2.0.19/references/communication-contract.md +26 -0
  497. package/.versions/2.0.19/references/definition-of-done.md +67 -0
  498. package/.versions/2.0.19/references/fleet-coordination-patterns.md +171 -0
  499. package/.versions/2.0.19/references/observability-checklist.md +92 -0
  500. package/.versions/2.0.19/references/orchestration-patterns.md +370 -0
  501. package/.versions/2.0.19/references/performance-checklist.md +236 -0
  502. package/.versions/2.0.19/references/prompting-patterns.md +380 -0
  503. package/.versions/2.0.19/references/security-checklist.md +245 -0
  504. package/.versions/2.0.19/references/testing-patterns.md +235 -0
  505. package/.versions/2.0.19/references/workflow-authoring.md +304 -0
  506. package/.versions/2.0.19/skills/_internal/grilling.md +59 -0
  507. package/.versions/2.0.19/skills/browser-testing-with-devtools/SKILL.md +351 -0
  508. package/.versions/2.0.19/skills/code-review-and-quality/SKILL.md +396 -0
  509. package/.versions/2.0.19/skills/compound-learning/SKILL.md +137 -0
  510. package/.versions/2.0.19/skills/constraint-driven-development/SKILL.md +338 -0
  511. package/.versions/2.0.19/skills/constraint-driven-development/references/floor-guard.md +99 -0
  512. package/.versions/2.0.19/skills/context-engineering/SKILL.md +341 -0
  513. package/.versions/2.0.19/skills/deprecation-and-migration/SKILL.md +247 -0
  514. package/.versions/2.0.19/skills/designing-agents/SKILL.md +394 -0
  515. package/.versions/2.0.19/skills/designing-agents/pi-harness-authoring.md +222 -0
  516. package/.versions/2.0.19/skills/drafting-workflows/SKILL.md +143 -0
  517. package/.versions/2.0.19/skills/drafting-workflows/scripts/make-workflow.ts +177 -0
  518. package/.versions/2.0.19/skills/frontend-ui-engineering/SKILL.md +328 -0
  519. package/.versions/2.0.19/skills/git-workflow-and-versioning/SKILL.md +316 -0
  520. package/.versions/2.0.19/skills/idea-refine/SKILL.md +182 -0
  521. package/.versions/2.0.19/skills/idea-refine/examples.md +238 -0
  522. package/.versions/2.0.19/skills/idea-refine/frameworks.md +99 -0
  523. package/.versions/2.0.19/skills/idea-refine/refinement-criteria.md +113 -0
  524. package/.versions/2.0.19/skills/idea-refine/scripts/idea-refine.sh +15 -0
  525. package/.versions/2.0.19/skills/incremental-implementation/SKILL.md +353 -0
  526. package/.versions/2.0.19/skills/interview-me/SKILL.md +226 -0
  527. package/.versions/2.0.19/skills/orchestration-verification/SKILL.md +182 -0
  528. package/.versions/2.0.19/skills/peer-coms/SKILL.md +90 -0
  529. package/.versions/2.0.19/skills/performance-optimization/SKILL.md +496 -0
  530. package/.versions/2.0.19/skills/planning-and-task-breakdown/SKILL.md +318 -0
  531. package/.versions/2.0.19/skills/repository-ai-setup/SKILL.md +135 -0
  532. package/.versions/2.0.19/skills/repository-ai-setup/references/agent-fleet-ai-state.template.json +4 -0
  533. package/.versions/2.0.19/skills/repository-ai-setup/references/apply-contract.md +74 -0
  534. package/.versions/2.0.19/skills/repository-ai-setup/references/provenance-template.md +16 -0
  535. package/.versions/2.0.19/skills/repository-ai-setup/references/setup-flow.md +108 -0
  536. package/.versions/2.0.19/skills/repository-ai-setup/references/verify-setup.md +20 -0
  537. package/.versions/2.0.19/skills/repository-ai-setup.zip +0 -0
  538. package/.versions/2.0.19/skills/security-and-hardening/SKILL.md +524 -0
  539. package/.versions/2.0.19/skills/spec-driven-development/SKILL.md +295 -0
  540. package/.versions/2.0.19/skills/using-agent-skills/SKILL.md +198 -0
  541. package/.versions/2.0.19/vendor/agent-skills-upstream/LICENSE +21 -0
  542. package/.versions/2.0.19/vendor/agent-skills-upstream/README.md +430 -0
  543. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/api-and-interface-design/SKILL.md +367 -0
  544. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/browser-testing-with-devtools/SKILL.md +317 -0
  545. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/ci-cd-and-automation/SKILL.md +390 -0
  546. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-review-and-quality/SKILL.md +396 -0
  547. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/code-simplification/SKILL.md +331 -0
  548. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/SKILL.md +311 -0
  549. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/constraint-driven-development/references/floor-guard.md +99 -0
  550. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/context-engineering/SKILL.md +337 -0
  551. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/debugging-and-error-recovery/SKILL.md +300 -0
  552. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/deprecation-and-migration/SKILL.md +247 -0
  553. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/documentation-and-adrs/SKILL.md +288 -0
  554. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/doubt-driven-development/SKILL.md +243 -0
  555. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/frontend-ui-engineering/SKILL.md +328 -0
  556. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/git-workflow-and-versioning/SKILL.md +355 -0
  557. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/SKILL.md +178 -0
  558. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/examples.md +238 -0
  559. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/frameworks.md +99 -0
  560. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/refinement-criteria.md +113 -0
  561. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/idea-refine/scripts/idea-refine.sh +15 -0
  562. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/incremental-implementation/SKILL.md +249 -0
  563. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/interview-me/SKILL.md +225 -0
  564. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/observability-and-instrumentation/SKILL.md +238 -0
  565. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/performance-optimization/SKILL.md +496 -0
  566. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/planning-and-task-breakdown/SKILL.md +257 -0
  567. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/security-and-hardening/SKILL.md +524 -0
  568. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/shipping-and-launch/SKILL.md +330 -0
  569. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/source-driven-development/SKILL.md +216 -0
  570. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/spec-driven-development/SKILL.md +245 -0
  571. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/test-driven-development/SKILL.md +398 -0
  572. package/.versions/2.0.19/vendor/agent-skills-upstream/skills/using-agent-skills/SKILL.md +192 -0
  573. package/CHANGELOG.md +6 -0
  574. package/bin/cli.js +1 -1
  575. package/bin/lib/doctor.js +8 -2
  576. package/bin/lib/system1-migration.js +17 -8
  577. package/bin/lib/system1-policy-context.js +57 -0
  578. package/bin/lib/transaction.js +1 -1
  579. package/docs/agent-fleet-setup.md +1 -1
  580. package/docs/external-project-ai-content.md +17 -1
  581. package/install-manifest.json +5 -1
  582. package/manifest-meta.json +4 -0
  583. package/package.json +1 -1
@@ -0,0 +1,318 @@
1
+ import { createHash } from "node:crypto";
2
+ import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync } from "node:fs";
3
+ import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
4
+ import type { System1Service } from "../lib/system1/contracts.ts";
5
+ import { createProactiveEvaluator } from "./proactive-evaluate.ts";
6
+ import { discoverRules } from "./proactive-rules.ts";
7
+ import type { PolicyRootTable } from "../lib/policy-roots.ts";
8
+ import { selectRules } from "./proactive-selection.ts";
9
+ import type { BoundReference } from "./proactive-types.ts";
10
+ import { PROACTIVE_LIMITS } from "./proactive-config.ts";
11
+ import type { ObserverAssignment, ObserverManifest } from "./proactive-observer.ts";
12
+ import type { ProactiveConfig, TaskContext, TurnSnapshot } from "./proactive-types.ts";
13
+ import { isCaptureEnabled, type LocalProactiveConfig } from "./proactive-config.ts";
14
+ import { assessLocal } from "./proactive-local.ts";
15
+ import type { CatalogSection } from "./proactive-rules.ts";
16
+ import type { ProactiveAssessment } from "./proactive-evaluate.ts";
17
+ import { beginTurn, finishTurn, type TurnBaseline } from "./proactive-snapshot.ts";
18
+ import { createProactiveFindings } from "./proactive-findings.ts";
19
+ import { createProactiveFeedback } from "./proactive-feedback.ts";
20
+ import { createProactiveActivity } from "./system1-activity.ts";
21
+
22
+ export type ReviewClosure = "reviewed" | "not_checked" | "superseded" | "queue_timeout" | "backlog_full" | "session_budget" | "cancelled" | "unavailable" | "no_new_evidence" | "not_instrumented";
23
+ export interface ReviewRecord { readonly owner: string; readonly attempt: string; readonly turnId: string; readonly snapshotId?: string; readonly status: ReviewClosure; readonly paths: readonly string[]; readonly uncheckedPaths: readonly string[]; readonly assessment?: import("./proactive-evaluate.ts").ProactiveAssessment }
24
+ export interface ReviewJob { readonly owner: string; readonly attempt: string; readonly snapshot: TurnSnapshot; readonly uncheckedPaths: readonly string[]; readonly signal: AbortSignal; readonly claimEvaluation?: () => boolean }
25
+ export interface ReviewRuntimeOptions {
26
+ config: LocalProactiveConfig;
27
+ localSections?: readonly CatalogSection[];
28
+ policyRoots?: PolicyRootTable;
29
+ evaluate?: ((job: ReviewJob) => Promise<void | import("./proactive-evaluate.ts").ProactiveAssessment>) & { readonly budgeted?: true }; // P6 accounts actual calls; legacy callbacks count one job.
30
+ onRecord?: (record: ReviewRecord) => void;
31
+ onChange?: () => void;
32
+ findingsDirectory?: string; // parent-owned private session directory, never child supplied
33
+ activityDirectory?: string;
34
+ feedback?: ReturnType<typeof createProactiveFeedback>;
35
+ now?: () => number;
36
+ setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
37
+ clearTimer?: (timer: ReturnType<typeof setTimeout>) => void;
38
+ }
39
+ const MAX_PENDING = 8, MAX_WAIT_MS = 5000, MAX_CARRY = 20;
40
+ const sha = (value: Buffer) => createHash("sha256").update(value).digest("hex");
41
+ const hex = (value: unknown): value is string => typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
42
+ function paths(snapshot: TurnSnapshot): string[] { return [...new Set(snapshot.units.filter(u => u.kind !== "text").map(u => u.path))].slice(0, MAX_CARRY); }
43
+ interface Entry { owner: string; attempt: string; snapshot: TurnSnapshot; queued: number; controller: AbortController; carry: string[]; jobId: string; evaluationIds: string[]; closed: boolean }
44
+ export function createProactiveRuntime(options: ReviewRuntimeOptions) {
45
+ const now = options.now ?? Date.now;
46
+ const setTimer = options.setTimer ?? setTimeout;
47
+ const clearTimer = options.clearTimer ?? clearTimeout;
48
+ const enabled = options.config.mode !== "off";
49
+ const pending: Entry[] = [];
50
+ const lastIndex = new Map<string, number>();
51
+ const carry = new Map<string, string[]>();
52
+ const records: ReviewRecord[] = [];
53
+ const findings = createProactiveFindings({ directory: options.findingsDirectory });
54
+ const activity = createProactiveActivity({ directory: options.activityDirectory, now });
55
+ let active: Entry | undefined;
56
+ let timer: ReturnType<typeof setTimeout> | undefined;
57
+ let used = 0, stopped = false;
58
+ const ownerKey = (owner: string, attempt: string) => `${owner}\0${attempt}`;
59
+ const remember = (entry: Entry, extra: string[]) => {
60
+ const key = ownerKey(entry.owner, entry.attempt);
61
+ carry.set(key, [...new Set([...(carry.get(key) ?? []), ...extra])].slice(0, MAX_CARRY));
62
+ };
63
+ const close = (entry: Entry, status: ReviewClosure, assessment?: import("./proactive-evaluate.ts").ProactiveAssessment) => {
64
+ if (entry.closed) return;
65
+ entry.closed = true;
66
+ entry.evaluationIds.forEach(id => activity.evaluationFinished(entry.jobId, id, status === "reviewed" ? "ok" : status));
67
+ activity.jobFinished(entry.jobId, status);
68
+ if (assessment) {
69
+ const checkedLocal = status === "reviewed" && entry.snapshot.status === "complete" && !assessment.gaps.length
70
+ ? findings.current.filter(f => f.source === "deterministic" && f.owner === entry.owner && f.attempt === entry.attempt).flatMap(f => {
71
+ const binding = options.config.localBindings?.find(b => b.rule.hash === f.ruleHash && options.localSections?.some(s => s.id === f.ruleId && s.source.hash === b.rule.hash && s.source.path === b.rule.path));
72
+ const unit = entry.snapshot.units.find(u => u.path === f.subject && u.after && !u.after.truncated && sha(Buffer.from(u.after.text)) === u.after.hash);
73
+ const matches = (patterns: readonly string[]) => patterns.some(p => p === f.subject || (p.endsWith("/**") && f.subject.startsWith(p.slice(0, -2))));
74
+ return binding && unit && binding.applicability.kinds.includes(unit.kind as "added" | "modified") && (matches(binding.applicability.paths) || (binding.applicability.basename && f.subject.split("/").at(-1) === binding.applicability.basename && binding.applicability.paths.includes(binding.applicability.basename))) && !matches(binding.exceptions.paths) && (!binding.exceptions.legacy || unit.kind === "added") && entry.snapshot.context.rules.some(r => r.path === binding.rule.path && r.hash === binding.rule.hash) ? [{ ruleId: f.ruleId, subject: f.subject }] : [];
75
+ }) : [];
76
+ const review = findings.observe(entry.owner, entry.attempt, entry.snapshot, status, assessment, checkedLocal);
77
+ options.feedback?.publish(review, entry.snapshot);
78
+ }
79
+ if (status !== "reviewed" && status !== "no_new_evidence") remember(entry, [...paths(entry.snapshot), ...entry.carry]);
80
+ const record: ReviewRecord = { owner: entry.owner, attempt: entry.attempt, turnId: entry.snapshot.turnId, snapshotId: entry.snapshot.snapshotId, status, paths: paths(entry.snapshot), uncheckedPaths: [...(carry.get(ownerKey(entry.owner, entry.attempt)) ?? [])], ...(assessment ? { assessment } : {}) };
81
+ records.push(record); options.onRecord?.(record); options.onChange?.();
82
+ };
83
+ const arm = () => {
84
+ if (timer) { clearTimer(timer); timer = undefined; }
85
+ if (!pending.length || stopped) return;
86
+ timer = setTimer(() => { timer = undefined; drain(); }, Math.max(0, pending[0].queued + MAX_WAIT_MS - now()));
87
+ };
88
+ const drain = () => {
89
+ if (stopped) return;
90
+ while (pending.length && now() - pending[0].queued >= MAX_WAIT_MS) close(pending.shift()!, "queue_timeout");
91
+ if (!active && pending.length) {
92
+ const entry = pending.shift()!;
93
+ active = entry;
94
+ const local = options.config.localBindings?.length ? assessLocal(entry.snapshot, options.localSections ?? [], options.config.localBindings, options.config.include, options.policyRoots) : undefined;
95
+ const localAssessment = (): ProactiveAssessment | undefined => local ? { status: "not_checked", drift: { task: "not_checked", plan: "not_checked" }, rules: [], findings: local.findings, gaps: local.gaps, evaluations: [] } : undefined;
96
+ if (used >= options.config.maxEvaluationsPerSession && !local) { close(entry, "session_budget"); active = undefined; drain(); return; }
97
+ const key = ownerKey(entry.owner, entry.attempt);
98
+ const uncheckedPaths = [...new Set([...(carry.get(key) ?? []), ...entry.carry])].slice(0, MAX_CARRY);
99
+ // No evaluator is installed before P6. Do not spend budget or fabricate semantic coverage.
100
+ if (!options.evaluate || used >= options.config.maxEvaluationsPerSession) { close(entry, "not_checked", localAssessment()); active = undefined; drain(); return; }
101
+ if (!options.evaluate.budgeted) {
102
+ used++; // Existing P5 callbacks represent a single evaluation.
103
+ const id = sha(Buffer.from(`${entry.jobId}:evaluation:1`));
104
+ entry.evaluationIds.push(id); activity.evaluationStarted(entry.jobId, id);
105
+ }
106
+ let calls = 0;
107
+ const claimEvaluation = () => {
108
+ if (entry.controller.signal.aborted || calls >= PROACTIVE_LIMITS.maxCallsPerTurn || used >= options.config.maxEvaluationsPerSession) return false;
109
+ calls++; used++;
110
+ const id = sha(Buffer.from(`${entry.jobId}:evaluation:${calls}`));
111
+ entry.evaluationIds.push(id); activity.evaluationStarted(entry.jobId, id);
112
+ return true;
113
+ };
114
+ const deadline = setTimer(() => { if (active === entry) { active = undefined; entry.controller.abort(); close(entry, "unavailable", localAssessment()); drain(); } }, 2000);
115
+ void Promise.resolve().then(() => options.evaluate!({ owner: entry.owner, attempt: entry.attempt, snapshot: entry.snapshot, uncheckedPaths, signal: entry.controller.signal, claimEvaluation }))
116
+ .then(assessment => { if (active === entry && !entry.controller.signal.aborted) { const result = assessment && local ? { ...assessment, findings: [...local.findings, ...assessment.findings], gaps: [...local.gaps, ...assessment.gaps], status: local.gaps.length || assessment.gaps.length ? "not_checked" as const : assessment.status } : assessment ?? localAssessment(); if (result && (result.status !== "reviewed" || result.gaps.length || entry.snapshot.status !== "complete" || local?.gaps.length)) close(entry, "not_checked", result); else { carry.delete(key); close(entry, "reviewed", result); } } }, () => { if (active === entry && !entry.controller.signal.aborted) close(entry, "unavailable", localAssessment()); })
117
+ .finally(() => { clearTimer(deadline); if (active === entry) { active = undefined; drain(); } });
118
+ }
119
+ arm();
120
+ };
121
+ const submit = (owner: string, attempt: string, snapshot: TurnSnapshot, turnIndex: number) => {
122
+ if (!enabled || stopped) return false;
123
+ if (!owner || !attempt || !Number.isSafeInteger(turnIndex) || turnIndex < 0 || !snapshot.turnId.endsWith(`:${owner}:${attempt}:${turnIndex}`)) return false;
124
+ const key = ownerKey(owner, attempt);
125
+ const prior = lastIndex.get(key);
126
+ if (prior !== undefined && turnIndex <= prior) return false;
127
+ lastIndex.set(key, turnIndex);
128
+ const entry: Entry = { owner, attempt, snapshot, queued: now(), controller: new AbortController(), carry: [], jobId: sha(Buffer.from(JSON.stringify([owner, attempt, snapshot.turnId, snapshot.snapshotId]))), evaluationIds: [], closed: false };
129
+ activity.jobStarted(entry.jobId); options.onChange?.();
130
+ if (snapshot.units.length === 0) { close(entry, "no_new_evidence"); return true; }
131
+ if (used >= options.config.maxEvaluationsPerSession && options.evaluate?.budgeted !== true && !options.config.localBindings?.length) { close(entry, "session_budget"); return true; }
132
+ const existing = pending.findIndex(p => p.owner === owner);
133
+ if (existing >= 0) { const replaced = pending.splice(existing, 1)[0]; close(replaced, "superseded"); }
134
+ if (pending.length >= MAX_PENDING) { close(entry, "backlog_full"); return true; }
135
+ pending.push(entry);
136
+ drain();
137
+ return true;
138
+ };
139
+ const recordGap = (owner: string, attempt: string, turnId: string, status: "not_checked" | "not_instrumented") => {
140
+ if (!enabled || stopped || !owner || !attempt || !turnId) return false;
141
+ const record: ReviewRecord = { owner, attempt, turnId, status, paths: [], uncheckedPaths: [...(carry.get(ownerKey(owner, attempt)) ?? [])] };
142
+ records.push(record); options.onRecord?.(record); options.onChange?.();
143
+ return true;
144
+ };
145
+ const abort = (owner?: string, attempt?: string) => {
146
+ for (let i = pending.length - 1; i >= 0; i--) if ((!owner || pending[i].owner === owner) && (!attempt || pending[i].attempt === attempt)) close(pending.splice(i, 1)[0], "cancelled");
147
+ if (active && (!owner || active.owner === owner) && (!attempt || active.attempt === attempt)) { const entry = active; active = undefined; entry.controller.abort(); close(entry, "cancelled"); }
148
+ if (!owner) { stopped = true; options.feedback?.clear(); }
149
+ drain();
150
+ };
151
+ return { submit, abort, recordGap, records, findings, activity, feedback: options.feedback, get pendingCount() { return pending.length; }, get activeCount() { return active ? 1 : 0; }, get used() { return used; } };
152
+ }
153
+ /** Hub hook ports share the same generation fence as session reset and evidence-dir binding. */
154
+ export function createHubCapture(options: {
155
+ root: () => string; task: () => string | undefined; plan?: () => string | undefined; policyRoots?: () => PolicyRootTable | undefined;
156
+ begin?: typeof beginTurn; finish?: typeof finishTurn;
157
+ }) {
158
+ let generation = 0, session = "", config: ProactiveConfig | null = null;
159
+ let runtime: ReturnType<typeof createProactiveRuntime> | null = null;
160
+ let baseline: { index: number; value: TurnBaseline | null } | undefined;
161
+ let capture: Promise<void> = Promise.resolve();
162
+ let rules: readonly BoundReference[] = [];
163
+ const bound = new Map<string, { task: string; plan?: string }>();
164
+ const native = new Map<string, { owner: string; task: string; context: TaskContext }>();
165
+ const seen = new Set<number>();
166
+ const start = (index: number) => {
167
+ if (!runtime || !config || !session || !isCaptureEnabled(config) || seen.has(index)) return;
168
+ const current = generation, identity = session, settings = config;
169
+ capture = capture.then(async () => {
170
+ if (current !== generation || identity !== session || !runtime) return;
171
+ const task = options.task(), plan = options.plan?.();
172
+ if (!task?.trim()) { baseline = { index, value: null }; return; }
173
+ const digest = (text: string) => createHash("sha256").update(text).digest("hex");
174
+ const turnId = `${identity}:hub:direct:${index}`;
175
+ bound.set(turnId, { task, ...(plan ? { plan } : {}) });
176
+ if (bound.size > 32) bound.delete(bound.keys().next().value!);
177
+ let value: TurnBaseline | null = null;
178
+ try { value = await (options.begin ?? beginTurn)({ root: options.root(), config: settings, turnId, policyRoots:options.policyRoots?.(), context: { task: { path: "hub-task", revision: digest(task), hash: digest(task) }, ...(plan ? { plan: { path: "hub-plan", revision: digest(plan), hash: digest(plan) } } : {}), rules, exceptions: [] } }); }
179
+ catch { /* recorded by end */ }
180
+ if (current === generation && identity === session) baseline = { index, value };
181
+ }).catch(() => { if (current === generation && identity === session && runtime) {
182
+ baseline = { index, value: null }; const turnId = `${identity}:hub:direct:${index}`; bound.delete(turnId);
183
+ if (!runtime.records.some(r => r.turnId === turnId)) try { runtime.recordGap("hub", "direct", turnId, "not_checked"); } catch { /* callback failure must not poison capture */ }
184
+ } });
185
+ // Pi awaits turn_start handlers: tools must not race the bounded baseline capture.
186
+ return capture;
187
+ };
188
+ const end = (index: number, text: string) => {
189
+ if (!runtime || !config || !session || !isCaptureEnabled(config) || seen.has(index)) return;
190
+ seen.add(index);
191
+ const current = generation, identity = session;
192
+ capture = capture.then(async () => {
193
+ if (current !== generation || identity !== session || !runtime) return;
194
+ const value = baseline?.index === index ? baseline.value : null;
195
+ baseline = undefined;
196
+ const turnId = `${identity}:hub:direct:${index}`;
197
+ if (!value) { bound.delete(turnId); if (!runtime.records.some(r => r.turnId === turnId)) runtime.recordGap("hub", "direct", turnId, "not_checked"); return; }
198
+ let snapshot: TurnSnapshot | null = null;
199
+ try { snapshot = await (options.finish ?? finishTurn)(value, { assistantText: text }); }
200
+ catch { /* unavailable capture */ }
201
+ if (current !== generation || identity !== session || !runtime) return;
202
+ if (snapshot) runtime.submit("hub", "direct", snapshot, index);
203
+ else { bound.delete(turnId); runtime.recordGap("hub", "direct", turnId, "not_checked"); }
204
+ }).catch(() => {
205
+ if (current !== generation || identity !== session || !runtime) return;
206
+ const turnId = `${identity}:hub:direct:${index}`;
207
+ bound.delete(turnId);
208
+ if (!runtime.records.some(r => r.turnId === turnId)) {
209
+ try { runtime.recordGap("hub", "direct", turnId, "not_checked"); } catch { /* callback failed; the chain must remain usable */ }
210
+ }
211
+ });
212
+ };
213
+ return {
214
+ start, end,
215
+ reset() { generation++; runtime?.abort(); runtime = null; config = null; session = ""; baseline = undefined; rules = []; bound.clear(); native.clear(); seen.clear(); },
216
+ initialize(next: ProactiveConfig, nextRuntime: ReturnType<typeof createProactiveRuntime>, refs: readonly BoundReference[] = []) { config = next; runtime = nextRuntime; rules = [...refs]; },
217
+ /** Parent dispatch bytes only; the child receives hashes/refs, never these bytes. */
218
+ nativeContext(identity: string, owner: string, attempt: string, task: string): TaskContext | undefined {
219
+ if (!runtime || !config || !isCaptureEnabled(config) || identity !== session || !owner || !attempt || !task.trim()) return undefined;
220
+ const prefix = `${identity}:${owner}:${attempt}:`;
221
+ const hash = createHash("sha256").update(task).digest("hex");
222
+ const context: TaskContext = { task: { path: "dispatch", revision: hash, hash }, rules: rules.map(ref => ({ ...ref })), exceptions: [] };
223
+ for (const [key, value] of native) if (value.owner === owner) native.delete(key); // replacement attempt fence
224
+ native.set(prefix, { owner, task, context });
225
+ if (native.size > 32) native.delete(native.keys().next().value!);
226
+ return context;
227
+ },
228
+ contentFor(turnId: string) {
229
+ const hub = bound.get(turnId);
230
+ if (hub) return hub;
231
+ const separator = turnId.lastIndexOf(":");
232
+ const index = turnId.slice(separator + 1);
233
+ if (!/^(0|[1-9]\d*)$/.test(index) || !Number.isSafeInteger(Number(index))) return undefined;
234
+ const entry = native.get(turnId.slice(0, separator + 1));
235
+ return entry ? { task: entry.task } : undefined;
236
+ },
237
+ bindSession(next: string) { session = next; },
238
+ hubContext(): TaskContext | undefined {
239
+ const task = options.task(), plan = options.plan?.();
240
+ if (!task?.trim()) return undefined;
241
+ const digest = (text: string) => createHash("sha256").update(text).digest("hex");
242
+ return { task: { path: "hub-task", revision: digest(task), hash: digest(task) }, ...(plan ? { plan: { path: "hub-plan", revision: digest(plan), hash: digest(plan) } } : {}), rules, exceptions: [] };
243
+ },
244
+ get capture() { return capture; },
245
+ };
246
+ }
247
+ /** Compose from the already-selected session service and approved roots; no config or provider activation. */
248
+ export function composeHubProactive(input: {
249
+ config: LocalProactiveConfig; root: string; sessionDir: string; rulesRoots: readonly string[]; policyRoots?: PolicyRootTable;
250
+ service?: System1Service; capture: ReturnType<typeof createHubCapture>; onChange?: () => void;
251
+ }) {
252
+ const catalog = input.rulesRoots.length ? discoverRules(input.root, input.rulesRoots, input.policyRoots) : null;
253
+ const sections = catalog?.sections ?? [];
254
+ const refs = catalog?.files ?? [];
255
+ // Selection stays local and is keyed to the captured task revision and authored paths.
256
+ const selectionFor = (job: ReviewJob) => catalog ? selectRules({ catalog, config: input.config,
257
+ taskRevision: job.snapshot.context.task.revision, changedPaths: job.snapshot.units.map(u => u.path), contentHints: [] }) : null;
258
+ const directory = join(input.sessionDir, "artifacts");
259
+ // Directory belongs to the parent session; findings/activity use restrictive files underneath.
260
+ mkdirSync(directory, { recursive: true, mode: 0o700 });
261
+ const evaluate = input.config.remoteContext === "selected-excerpts" && input.service ? Object.assign(async (job: ReviewJob) => {
262
+ const content = input.capture.contentFor(job.snapshot.turnId);
263
+ const selection = selectionFor(job);
264
+ const selected = selection ? await selection : { selected: [], coverage: [], gaps: ["unconfigured_rules"], status: "partial" as const, cacheKey: "" };
265
+ return createProactiveEvaluator({ config: input.config, service: input.service!, selection: selected,
266
+ taskText: content?.task, planText: content?.plan, catalogSections: sections })(job);
267
+ }, { budgeted: true as const }) : undefined;
268
+ const feedback = createProactiveFeedback(input.root, join(directory, "proactive-inbox"), input.config.mode);
269
+ const runtime = createProactiveRuntime({ config: input.config, localSections: sections, policyRoots:input.policyRoots, evaluate, feedback,
270
+ findingsDirectory: join(directory, "proactive-findings"), activityDirectory: join(directory, "proactive-activity"), onChange: input.onChange });
271
+ input.capture.initialize(input.config, runtime, refs);
272
+ input.capture.bindSession(input.sessionDir);
273
+ return runtime;
274
+ }
275
+ /** Parent-owned directory only. This validates correlation and bytes, not hostile-child attestation. */
276
+ export function ingestObserverManifests(assignment: ObserverAssignment, submit: (owner: string, attempt: string, snapshot: TurnSnapshot, index: number) => boolean): number {
277
+ if (assignment.config.mode === "off") return 0;
278
+ const root = resolve(assignment.root), dir = resolve(assignment.directory);
279
+ // Compare paths within one namespace. macOS /var is an alias for /private/var;
280
+ // realpath(dir) !== dir does not mean the attempt itself is a symlink.
281
+ try {
282
+ const below = relative(root, dir);
283
+ if (!below || below === ".." || below.startsWith(`..${sep}`) || isAbsolute(below)) return 0;
284
+ let cursor = root;
285
+ for (const part of below.split(sep)) {
286
+ cursor = join(cursor, part);
287
+ if (!lstatSync(cursor).isDirectory()) return 0;
288
+ }
289
+ if (!realpathSync(dir).startsWith(realpathSync(root) + sep)) return 0;
290
+ } catch { return 0; }
291
+ let accepted = 0;
292
+ let names: string[];
293
+ try { names = readdirSync(dir).filter(name => /^turn-(0|[1-9]\d*)\.json$/.test(name)).slice(0, 256); } catch { return 0; }
294
+ for (const name of names) {
295
+ try {
296
+ const index = Number(name.slice(5, -5));
297
+ if (!Number.isSafeInteger(index)) continue;
298
+ const file = join(dir, name);
299
+ const manifestInfo = lstatSync(file);
300
+ if (!manifestInfo.isFile() || manifestInfo.size > 2048) continue;
301
+ const manifest = JSON.parse(readFileSync(file, "utf8")) as ObserverManifest;
302
+ if (manifest.producer !== "agent-fleet.proactive-observer/v1" || manifest.session !== assignment.session || manifest.owner !== assignment.owner || manifest.attempt !== assignment.attempt || manifest.turnIndex !== index || manifest.turnId !== `${assignment.session}:${assignment.owner}:${assignment.attempt}:${index}` || !["captured", "incomplete", "not_checked"].includes(manifest.status)) continue;
303
+ const ref = manifest.snapshot;
304
+ if (!ref || ref.path !== `snapshot-${index}.json` || basename(ref.path) !== ref.path || !hex(ref.hash) || !hex(ref.snapshotId) || !Number.isSafeInteger(ref.bytes) || ref.bytes < 1 || ref.bytes > PROACTIVE_LIMITS.maxRetainedBytes + 65536) continue;
305
+ const source = join(dir, ref.path);
306
+ const sourceInfo = lstatSync(source);
307
+ if (!sourceInfo.isFile() || sourceInfo.size !== ref.bytes) continue;
308
+ const data = readFileSync(source);
309
+ if (sha(data) !== ref.hash) continue;
310
+ const snapshot = JSON.parse(data.toString("utf8")) as TurnSnapshot;
311
+ if (snapshot.turnId !== manifest.turnId || snapshot.snapshotId !== ref.snapshotId || !hex(snapshot.snapshotId) || !Array.isArray(snapshot.units) || snapshot.units.length > PROACTIVE_LIMITS.maxUnits || !snapshot.coverage || snapshot.coverage.retainedBytes > PROACTIVE_LIMITS.maxRetainedBytes) continue;
312
+ // Child-owned snapshot cannot revise parent task, plan, or the catalog snapshot.
313
+ if (JSON.stringify(snapshot.context) !== JSON.stringify(assignment.context) || snapshot.planStatus !== (assignment.context.plan ? "bound" : "task_only")) continue;
314
+ if (submit(assignment.owner, assignment.attempt, snapshot, index)) accepted++;
315
+ } catch { /* malformed or changing child data is unavailable, not evidence */ }
316
+ }
317
+ return accepted;
318
+ }
@@ -0,0 +1,68 @@
1
+ import { createHash } from "node:crypto";
2
+ import type { ProactiveConfig } from "./proactive-types.ts";
3
+ import type { CatalogSection, RuleCatalog } from "./proactive-rules.ts";
4
+
5
+ export const SELECTION_VERSION = "p3-selection-v1";
6
+ export type SelectionDecision = "applicable" | "not_applicable" | "uncertain";
7
+ export interface SelectionInput {
8
+ readonly catalog: RuleCatalog;
9
+ readonly config: ProactiveConfig;
10
+ readonly taskRevision: string;
11
+ readonly changedPaths: readonly string[];
12
+ readonly contentHints: readonly string[];
13
+ readonly maxSections?: number;
14
+ readonly maxBytes?: number;
15
+ readonly classify?: (candidates: readonly { id: string; heading: string; kind: CatalogSection["kind"] }[]) => Promise<Readonly<Record<string, SelectionDecision>>>;
16
+ readonly cache?: Map<string, SelectionResult>;
17
+ }
18
+ export interface SelectionResult {
19
+ readonly selected: readonly CatalogSection[];
20
+ readonly coverage: readonly { id: string; status: "selected" | "not_selected"; reason: "applicable" | "uncertain" | "default" | "budget" | "provisional_not_applicable" }[];
21
+ readonly gaps: readonly string[];
22
+ readonly status: "complete" | "partial";
23
+ readonly cacheKey: string;
24
+ }
25
+ const sha = (v: unknown) => createHash("sha256").update(JSON.stringify(v)).digest("hex");
26
+ /** Model output is only a provisional classification of the already discovered IDs. */
27
+ export async function selectRules(input: SelectionInput): Promise<SelectionResult> {
28
+ const { catalog, config } = input;
29
+ const cacheKey = sha([SELECTION_VERSION, input.taskRevision, input.changedPaths, input.contentHints, catalog.version,
30
+ catalog.files.map(f => [f.path, f.hash]), catalog.sections.map(s => [s.id, s.source.hash, sha([s.text, s.context])]),
31
+ config.mode, config.remoteContext, input.maxSections, input.maxBytes]);
32
+ const cached = input.cache?.get(cacheKey);
33
+ if (cached) return cached;
34
+ const gaps = [...catalog.gaps];
35
+ const candidates = catalog.sections;
36
+ let decisions: Readonly<Record<string, SelectionDecision>> = {};
37
+ if (config.mode !== "off" && config.remoteContext === "selected-excerpts" && input.classify && candidates.length) {
38
+ const manifest = candidates.map(s => ({ id: s.id, heading: s.heading, kind: s.kind }));
39
+ if (Buffer.byteLength(JSON.stringify(manifest)) > 32 * 1024) gaps.push("selection_state_budget");
40
+ else try {
41
+ const response = await input.classify(manifest);
42
+ if (!response || Object.keys(response).some(id => !candidates.some(s => s.id === id) || !["applicable", "not_applicable", "uncertain"].includes(response[id]!))) gaps.push("invalid_selection_response");
43
+ else decisions = response;
44
+ } catch { gaps.push("selection_unavailable"); }
45
+ }
46
+ const priority = { default: 0, shared: 1, conditional: 2, reference: 3 };
47
+ const sorted = [...candidates].sort((a, b) => priority[a.kind] - priority[b.kind] || a.source.path.localeCompare(b.source.path) || a.id.localeCompare(b.id));
48
+ const selected: CatalogSection[] = [], coverage: SelectionResult["coverage"][number][] = [];
49
+ let bytes = 0;
50
+ const limit = Math.max(0, Math.min(20, input.maxSections ?? 20));
51
+ const byteLimit = Math.max(0, Math.min(32 * 1024, input.maxBytes ?? 32 * 1024));
52
+ for (const section of sorted) {
53
+ const decision = decisions[section.id];
54
+ if (decision === "not_applicable" && section.kind !== "default" && section.kind !== "shared") {
55
+ coverage.push({ id: section.id, status: "not_selected", reason: "provisional_not_applicable" }); continue;
56
+ }
57
+ // Include full subtree and ancestors or not at all. Never truncate an exception.
58
+ const size = Buffer.byteLength(section.text + section.context);
59
+ if (selected.length >= limit || bytes + size > byteLimit) {
60
+ coverage.push({ id: section.id, status: "not_selected", reason: "budget" }); gaps.push(`selection_budget:${section.id}`); continue;
61
+ }
62
+ selected.push(section); bytes += size;
63
+ coverage.push({ id: section.id, status: "selected", reason: section.kind === "default" || section.kind === "shared" ? "default" : decision === "applicable" ? "applicable" : "uncertain" });
64
+ }
65
+ const result: SelectionResult = { selected, coverage, gaps, status: gaps.length || coverage.some(c => c.status !== "selected") ? "partial" : "complete", cacheKey };
66
+ input.cache?.set(cacheKey, result);
67
+ return result;
68
+ }
@@ -0,0 +1,12 @@
1
+ // Disposable local capture process; it never receives a model credential or transport.
2
+ import { beginTurnCore, finishTurnCore } from "./proactive-snapshot.ts";
3
+ process.once("message", message => {
4
+ try {
5
+ const result = message?.phase === "begin" ? beginTurnCore(message.payload)
6
+ : message?.phase === "finish" ? finishTurnCore(message.payload.baseline, message.payload.input)
7
+ : null;
8
+ process.send?.({ ok: true, result });
9
+ } catch (error) {
10
+ process.send?.({ ok: false, code: error?.message === "capture_timeout" ? "capture_timeout" : "capture_unavailable" });
11
+ }
12
+ });