harnery 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/README.md +4 -4
  2. package/dist/commander.d.ts +8 -0
  3. package/dist/commander.d.ts.map +1 -1
  4. package/dist/commander.js +14 -13
  5. package/dist/commands/adapter.d.ts +12 -0
  6. package/dist/commands/adapter.d.ts.map +1 -0
  7. package/dist/commands/{harness.js → adapter.js} +35 -35
  8. package/dist/commands/agents.d.ts +3 -2
  9. package/dist/commands/agents.d.ts.map +1 -1
  10. package/dist/commands/agents.js +61 -60
  11. package/dist/commands/artifacts.d.ts +4 -0
  12. package/dist/commands/artifacts.d.ts.map +1 -0
  13. package/dist/commands/artifacts.js +143 -0
  14. package/dist/commands/backup.d.ts +1 -1
  15. package/dist/commands/backup.d.ts.map +1 -1
  16. package/dist/commands/backup.js +5 -2
  17. package/dist/commands/browse.d.ts.map +1 -1
  18. package/dist/commands/browse.js +310 -7
  19. package/dist/commands/checkpoint.d.ts +12 -0
  20. package/dist/commands/checkpoint.d.ts.map +1 -0
  21. package/dist/commands/checkpoint.js +162 -0
  22. package/dist/commands/context.d.ts +2 -2
  23. package/dist/commands/context.d.ts.map +1 -1
  24. package/dist/commands/context.js +3 -151
  25. package/dist/commands/decision.d.ts.map +1 -1
  26. package/dist/commands/decision.js +31 -7
  27. package/dist/commands/deinit.d.ts +2 -2
  28. package/dist/commands/deinit.js +15 -15
  29. package/dist/commands/doctor.js +23 -23
  30. package/dist/commands/governor.d.ts +4 -0
  31. package/dist/commands/governor.d.ts.map +1 -0
  32. package/dist/commands/{supervisor.js → governor.js} +133 -108
  33. package/dist/commands/init.d.ts +12 -12
  34. package/dist/commands/init.d.ts.map +1 -1
  35. package/dist/commands/init.js +44 -30
  36. package/dist/commands/{session.d.ts → journal.d.ts} +2 -2
  37. package/dist/commands/journal.d.ts.map +1 -0
  38. package/dist/commands/{scratch.js → journal.js} +47 -47
  39. package/dist/commands/policy.js +1 -1
  40. package/dist/commands/presence.js +2 -2
  41. package/dist/commands/sync.d.ts +1 -1
  42. package/dist/commands/sync.js +3 -3
  43. package/dist/commands/tunnel.d.ts +16 -0
  44. package/dist/commands/tunnel.d.ts.map +1 -1
  45. package/dist/commands/tunnel.js +193 -23
  46. package/dist/commands/web-fetch.js +1 -1
  47. package/dist/commands/web.d.ts +19 -0
  48. package/dist/commands/web.d.ts.map +1 -1
  49. package/dist/commands/web.js +51 -0
  50. package/dist/commands/work.d.ts.map +1 -1
  51. package/dist/commands/work.js +38 -22
  52. package/dist/commands/workflow.d.ts.map +1 -1
  53. package/dist/commands/workflow.js +35 -28
  54. package/dist/core/{harnesses → adapters}/attest-projection.d.ts +2 -2
  55. package/dist/core/adapters/attest-projection.d.ts.map +1 -0
  56. package/dist/core/{harnesses → adapters}/attest.d.ts +16 -16
  57. package/dist/core/adapters/attest.d.ts.map +1 -0
  58. package/dist/core/{harnesses → adapters}/attest.js +9 -9
  59. package/dist/core/{harnesses → adapters}/attestation.d.ts +16 -16
  60. package/dist/core/adapters/attestation.d.ts.map +1 -0
  61. package/dist/core/{harnesses → adapters}/attestation.js +20 -20
  62. package/dist/core/{harnesses → adapters}/bench.d.ts +12 -12
  63. package/dist/core/adapters/bench.d.ts.map +1 -0
  64. package/dist/core/{harnesses → adapters}/bench.js +12 -12
  65. package/dist/core/adapters/index.d.ts +13 -0
  66. package/dist/core/adapters/index.d.ts.map +1 -0
  67. package/dist/core/adapters/index.js +6 -0
  68. package/dist/core/{harnesses → adapters}/profiles.d.ts +11 -11
  69. package/dist/core/adapters/profiles.d.ts.map +1 -0
  70. package/dist/core/{harnesses → adapters}/profiles.js +11 -11
  71. package/dist/core/adapters/registry.d.ts +15 -0
  72. package/dist/core/adapters/registry.d.ts.map +1 -0
  73. package/dist/core/{harnesses → adapters}/registry.js +11 -11
  74. package/dist/core/{harnesses → adapters}/types.d.ts +23 -23
  75. package/dist/core/adapters/types.d.ts.map +1 -0
  76. package/dist/core/{harnesses → adapters}/types.js +1 -1
  77. package/dist/core/agents/canonical-emit.d.ts +4 -4
  78. package/dist/core/agents/canonical-emit.js +5 -5
  79. package/dist/core/agents/cli-emit.js +1 -1
  80. package/dist/core/agents/cli.js +30 -26
  81. package/dist/core/agents/codex-replay.d.ts +1 -1
  82. package/dist/core/agents/codex-replay.js +6 -6
  83. package/dist/core/agents/coord-client.d.ts +21 -2
  84. package/dist/core/agents/coord-client.d.ts.map +1 -1
  85. package/dist/core/agents/coord-client.js +122 -27
  86. package/dist/core/agents/events/consume.d.ts +1 -1
  87. package/dist/core/agents/events/emit.d.ts +5 -6
  88. package/dist/core/agents/events/emit.d.ts.map +1 -1
  89. package/dist/core/agents/events/emit.js +2 -2
  90. package/dist/core/agents/render/prompt-context.d.ts +21 -9
  91. package/dist/core/agents/render/prompt-context.d.ts.map +1 -1
  92. package/dist/core/agents/render/prompt-context.js +82 -30
  93. package/dist/core/agents/render/session-context.d.ts +1 -1
  94. package/dist/core/agents/render/session-context.js +5 -5
  95. package/dist/core/agents/rules/claim-conflict.d.ts +2 -6
  96. package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -1
  97. package/dist/core/agents/rules/claim-conflict.js +1 -1
  98. package/dist/core/agents/rules/commit-conflict.js +98 -22
  99. package/dist/core/agents/rules/stop-hook.d.ts +9 -9
  100. package/dist/core/agents/rules/stop-hook.d.ts.map +1 -1
  101. package/dist/core/agents/rules/stop-hook.js +23 -5
  102. package/dist/core/agents/rules/verdict.d.ts +14 -0
  103. package/dist/core/agents/rules/verdict.d.ts.map +1 -0
  104. package/dist/core/agents/rules/verdict.js +1 -0
  105. package/dist/core/agents/session-events.js +3 -3
  106. package/dist/core/agents/state/council.d.ts +1 -1
  107. package/dist/core/agents/state/council.js +1 -1
  108. package/dist/core/agents/state/heartbeat-projector.d.ts +3 -2
  109. package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -1
  110. package/dist/core/agents/state/heartbeat-projector.js +14 -10
  111. package/dist/core/agents/state/heartbeat-writer.d.ts +1 -1
  112. package/dist/core/agents/state/heartbeat-writer.js +12 -12
  113. package/dist/core/agents/state/{scratch.d.ts → journal.d.ts} +7 -7
  114. package/dist/core/agents/state/{scratch.d.ts.map → journal.d.ts.map} +1 -1
  115. package/dist/core/agents/state/{scratch.js → journal.js} +12 -12
  116. package/dist/core/agents/state/pidmap.d.ts +28 -4
  117. package/dist/core/agents/state/pidmap.d.ts.map +1 -1
  118. package/dist/core/agents/state/pidmap.js +130 -15
  119. package/dist/core/agents/state/proc-start.d.ts +95 -0
  120. package/dist/core/agents/state/proc-start.d.ts.map +1 -0
  121. package/dist/core/agents/state/proc-start.js +199 -0
  122. package/dist/core/agents/state/shell-mutation.d.ts +1 -1
  123. package/dist/core/agents/state/shell-mutation.js +1 -1
  124. package/dist/core/agents/state/stale-sweep.js +7 -7
  125. package/dist/core/artifacts/index.d.ts +86 -0
  126. package/dist/core/artifacts/index.d.ts.map +1 -0
  127. package/dist/core/artifacts/index.js +421 -0
  128. package/dist/core/config.d.ts +9 -2
  129. package/dist/core/config.d.ts.map +1 -1
  130. package/dist/core/config.js +26 -2
  131. package/dist/core/context/index.d.ts +12 -12
  132. package/dist/core/context/index.js +10 -10
  133. package/dist/core/governor/adapter-spread.d.ts +52 -0
  134. package/dist/core/governor/adapter-spread.d.ts.map +1 -0
  135. package/dist/core/governor/adapter-spread.js +52 -0
  136. package/dist/core/governor/index.d.ts +7 -0
  137. package/dist/core/governor/index.d.ts.map +1 -0
  138. package/dist/core/governor/index.js +6 -0
  139. package/dist/core/governor/plan-api.d.ts +38 -0
  140. package/dist/core/governor/plan-api.d.ts.map +1 -0
  141. package/dist/core/governor/plan-api.js +83 -0
  142. package/dist/core/governor/plan-read.d.ts +5 -0
  143. package/dist/core/governor/plan-read.d.ts.map +1 -0
  144. package/dist/core/{supervisor → governor}/plan-read.js +66 -52
  145. package/dist/core/{supervisor → governor}/plan-types.d.ts +57 -56
  146. package/dist/core/governor/plan-types.d.ts.map +1 -0
  147. package/dist/core/{supervisor → governor}/plan-types.js +4 -4
  148. package/dist/core/governor/planning.d.ts +48 -0
  149. package/dist/core/governor/planning.d.ts.map +1 -0
  150. package/dist/core/{supervisor → governor}/planning.js +125 -94
  151. package/dist/core/governor/read.d.ts +6 -0
  152. package/dist/core/governor/read.d.ts.map +1 -0
  153. package/dist/core/governor/read.js +4 -0
  154. package/dist/core/governor/runner.d.ts +37 -0
  155. package/dist/core/governor/runner.d.ts.map +1 -0
  156. package/dist/core/{supervisor → governor}/runner.js +15 -15
  157. package/dist/core/governor/service-read.d.ts +6 -0
  158. package/dist/core/governor/service-read.d.ts.map +1 -0
  159. package/dist/core/{supervisor → governor}/service-read.js +12 -12
  160. package/dist/core/governor/service.d.ts +114 -0
  161. package/dist/core/governor/service.d.ts.map +1 -0
  162. package/dist/core/{supervisor → governor}/service.js +57 -57
  163. package/dist/core/governor/state.d.ts +116 -0
  164. package/dist/core/governor/state.d.ts.map +1 -0
  165. package/dist/core/{supervisor → governor}/state.js +228 -108
  166. package/dist/core/hooks/adapter/detect.d.ts +9 -0
  167. package/dist/core/hooks/{harness → adapter}/detect.d.ts.map +1 -1
  168. package/dist/core/hooks/{harness → adapter}/detect.js +8 -8
  169. package/dist/core/hooks/{harness → adapter}/events.d.ts +15 -14
  170. package/dist/core/hooks/adapter/events.d.ts.map +1 -0
  171. package/dist/core/hooks/{harness → adapter}/events.js +5 -5
  172. package/dist/core/hooks/{harness → adapter}/output.d.ts +20 -14
  173. package/dist/core/hooks/adapter/output.d.ts.map +1 -0
  174. package/dist/core/hooks/{harness → adapter}/output.js +30 -22
  175. package/dist/core/hooks/{harness → adapter}/parse.d.ts +5 -5
  176. package/dist/core/hooks/{harness → adapter}/parse.d.ts.map +1 -1
  177. package/dist/core/hooks/{harness → adapter}/parse.js +4 -4
  178. package/dist/core/hooks/{harness → adapter}/wiring.d.ts +15 -15
  179. package/dist/core/hooks/{harness → adapter}/wiring.d.ts.map +1 -1
  180. package/dist/core/hooks/{harness → adapter}/wiring.js +13 -13
  181. package/dist/core/hooks/cli.d.ts +3 -3
  182. package/dist/core/hooks/cli.js +175 -151
  183. package/dist/core/hooks/effects/image-capture.d.ts +5 -5
  184. package/dist/core/hooks/effects/image-capture.d.ts.map +1 -1
  185. package/dist/core/hooks/effects/image-capture.js +3 -3
  186. package/dist/core/hooks/effects/index.d.ts +12 -12
  187. package/dist/core/hooks/effects/index.d.ts.map +1 -1
  188. package/dist/core/hooks/effects/index.js +17 -17
  189. package/dist/core/hooks/events/emit.d.ts +2 -2
  190. package/dist/core/hooks/events/emit.d.ts.map +1 -1
  191. package/dist/core/hooks/events/emit.js +1 -1
  192. package/dist/core/hooks/events/rotate.js +1 -1
  193. package/dist/core/hooks/events/schema.d.ts +13 -5
  194. package/dist/core/hooks/events/schema.d.ts.map +1 -1
  195. package/dist/core/hooks/guard-path.d.ts +2 -2
  196. package/dist/core/hooks/guard-path.js +2 -2
  197. package/dist/core/hooks/index.d.ts +1 -1
  198. package/dist/core/hooks/index.d.ts.map +1 -1
  199. package/dist/core/hooks/resolve/anchor.d.ts +14 -5
  200. package/dist/core/hooks/resolve/anchor.d.ts.map +1 -1
  201. package/dist/core/hooks/resolve/anchor.js +64 -7
  202. package/dist/core/hooks/resolve/coord-root.d.ts +3 -3
  203. package/dist/core/hooks/resolve/coord-root.js +4 -4
  204. package/dist/core/hooks/resolve/intent.js +1 -1
  205. package/dist/core/hooks/resolve/owner.d.ts +1 -1
  206. package/dist/core/hooks/resolve/owner.d.ts.map +1 -1
  207. package/dist/core/hooks/resolve/owner.js +11 -5
  208. package/dist/core/{scratch → journal}/index.d.ts +25 -25
  209. package/dist/core/{scratch → journal}/index.d.ts.map +1 -1
  210. package/dist/core/{scratch → journal}/index.js +38 -38
  211. package/dist/core/policy/evaluate.d.ts +1 -1
  212. package/dist/core/policy/evaluate.d.ts.map +1 -1
  213. package/dist/core/policy/evaluate.js +7 -7
  214. package/dist/core/policy/types.d.ts +3 -3
  215. package/dist/core/policy/types.d.ts.map +1 -1
  216. package/dist/core/work/state.d.ts +12 -4
  217. package/dist/core/work/state.d.ts.map +1 -1
  218. package/dist/core/work/state.js +50 -17
  219. package/dist/core/workflow/adapters.d.ts +17 -0
  220. package/dist/core/workflow/adapters.d.ts.map +1 -0
  221. package/dist/core/workflow/adapters.js +21 -0
  222. package/dist/core/workflow/approvals.js +6 -6
  223. package/dist/core/workflow/billing.d.ts +9 -9
  224. package/dist/core/workflow/billing.js +9 -9
  225. package/dist/core/workflow/child-env.d.ts +10 -2
  226. package/dist/core/workflow/child-env.d.ts.map +1 -1
  227. package/dist/core/workflow/child-env.js +12 -4
  228. package/dist/core/workflow/engine.d.ts +15 -5
  229. package/dist/core/workflow/engine.d.ts.map +1 -1
  230. package/dist/core/workflow/engine.js +138 -83
  231. package/dist/core/workflow/evidence-preflight.d.ts +24 -0
  232. package/dist/core/workflow/evidence-preflight.d.ts.map +1 -0
  233. package/dist/core/workflow/evidence-preflight.js +134 -0
  234. package/dist/core/workflow/index.d.ts +1 -1
  235. package/dist/core/workflow/index.d.ts.map +1 -1
  236. package/dist/core/workflow/proof.d.ts +11 -5
  237. package/dist/core/workflow/proof.d.ts.map +1 -1
  238. package/dist/core/workflow/proof.js +45 -36
  239. package/dist/core/workflow/run-state.d.ts +1 -1
  240. package/dist/core/workflow/run-state.js +7 -7
  241. package/dist/core/workflow/sandbox-projection.d.ts +6 -6
  242. package/dist/core/workflow/sandbox-projection.d.ts.map +1 -1
  243. package/dist/core/workflow/sandbox-projection.js +11 -11
  244. package/dist/core/workflow/spawn-claude.d.ts +3 -3
  245. package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
  246. package/dist/core/workflow/spawn-claude.js +9 -6
  247. package/dist/core/workflow/spawn-codex.d.ts +4 -4
  248. package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
  249. package/dist/core/workflow/spawn-codex.js +9 -6
  250. package/dist/core/workflow/spawn-cursor.d.ts +4 -4
  251. package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
  252. package/dist/core/workflow/spawn-cursor.js +9 -6
  253. package/dist/core/workflow/spawn-failure.d.ts +1 -1
  254. package/dist/core/workflow/spawn-failure.js +1 -1
  255. package/dist/core/workflow/specialists.js +2 -2
  256. package/dist/core/workflow/{journal.d.ts → transcript.d.ts} +8 -8
  257. package/dist/core/workflow/transcript.d.ts.map +1 -0
  258. package/dist/core/workflow/{journal.js → transcript.js} +14 -14
  259. package/dist/core/workflow/types.d.ts +98 -51
  260. package/dist/core/workflow/types.d.ts.map +1 -1
  261. package/dist/core/workflow/types.js +11 -1
  262. package/dist/core/workflow/validate.d.ts +1 -1
  263. package/dist/core/workflow/validate.js +1 -1
  264. package/dist/core/workflow/workspaces/cancellation.js +2 -2
  265. package/dist/core/workflow/workspaces/cleanup.js +2 -2
  266. package/dist/core/workflow/workspaces/execution.js +6 -6
  267. package/dist/core/workflow/workspaces/inspect.js +9 -9
  268. package/dist/core/workflow/workspaces/integration.js +14 -14
  269. package/dist/core/workflow/workspaces/lifecycle.d.ts +1 -1
  270. package/dist/core/workflow/workspaces/lifecycle.d.ts.map +1 -1
  271. package/dist/core/workflow/workspaces/lifecycle.js +9 -9
  272. package/dist/core/workflow/workspaces/local-git.d.ts.map +1 -1
  273. package/dist/core/workflow/workspaces/local-git.js +39 -5
  274. package/dist/core/workflow/workspaces/recovery.js +3 -3
  275. package/dist/core/workflow/workspaces/state.d.ts +1 -1
  276. package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
  277. package/dist/core/workflow/workspaces/state.js +3 -3
  278. package/dist/core/workflow/workspaces/types.d.ts +1 -1
  279. package/dist/core/workflow/workspaces/types.d.ts.map +1 -1
  280. package/dist/lib/browser/asserts.d.ts +28 -0
  281. package/dist/lib/browser/asserts.d.ts.map +1 -0
  282. package/dist/lib/browser/asserts.js +152 -0
  283. package/dist/lib/browser/client.d.ts +49 -0
  284. package/dist/lib/browser/client.d.ts.map +1 -1
  285. package/dist/lib/browser/client.js +155 -14
  286. package/dist/lib/browser/content-checks.d.ts +108 -0
  287. package/dist/lib/browser/content-checks.d.ts.map +1 -0
  288. package/dist/lib/browser/content-checks.js +474 -0
  289. package/dist/lib/browser/critique.d.ts +91 -0
  290. package/dist/lib/browser/critique.d.ts.map +1 -0
  291. package/dist/lib/browser/critique.js +167 -0
  292. package/dist/lib/browser/geometry.d.ts +32 -0
  293. package/dist/lib/browser/geometry.d.ts.map +1 -1
  294. package/dist/lib/browser/geometry.js +244 -1
  295. package/dist/lib/browser/index.d.ts +4 -1
  296. package/dist/lib/browser/index.d.ts.map +1 -1
  297. package/dist/lib/browser/index.js +2 -0
  298. package/dist/lib/claude-desktop.d.ts.map +1 -1
  299. package/dist/lib/claude-desktop.js +4 -1
  300. package/dist/lib/council/index.d.ts +6 -6
  301. package/dist/lib/council/index.d.ts.map +1 -1
  302. package/dist/lib/council/index.js +8 -8
  303. package/dist/lib/identities/assume.d.ts +2 -2
  304. package/dist/lib/identities/assume.js +7 -7
  305. package/dist/lib/instructions/apply.d.ts +3 -3
  306. package/dist/lib/instructions/apply.d.ts.map +1 -1
  307. package/dist/lib/instructions/apply.js +75 -27
  308. package/dist/lib/instructions/host-addendum.d.ts +54 -0
  309. package/dist/lib/instructions/host-addendum.d.ts.map +1 -0
  310. package/dist/lib/instructions/host-addendum.js +107 -0
  311. package/dist/lib/instructions/templates.d.ts +10 -3
  312. package/dist/lib/instructions/templates.d.ts.map +1 -1
  313. package/dist/lib/instructions/templates.js +41 -12
  314. package/dist/lib/machine.d.ts +2 -2
  315. package/dist/lib/machine.js +2 -2
  316. package/package.json +26 -21
  317. package/schemas/config.schema.json +26 -1
  318. package/src/commander.ts +22 -13
  319. package/src/commands/{harness.ts → adapter.ts} +46 -46
  320. package/src/commands/agents.ts +71 -64
  321. package/src/commands/artifacts.ts +168 -0
  322. package/src/commands/backup.ts +47 -33
  323. package/src/commands/browse.ts +438 -2
  324. package/src/commands/checkpoint.ts +196 -0
  325. package/src/commands/context.ts +3 -176
  326. package/src/commands/decision.ts +41 -7
  327. package/src/commands/deinit.ts +16 -16
  328. package/src/commands/doctor.ts +28 -28
  329. package/src/commands/{supervisor.ts → governor.ts} +184 -154
  330. package/src/commands/init.ts +50 -34
  331. package/src/commands/{scratch.ts → journal.ts} +60 -60
  332. package/src/commands/policy.ts +1 -1
  333. package/src/commands/presence.ts +2 -2
  334. package/src/commands/sync.ts +3 -3
  335. package/src/commands/tunnel.ts +237 -34
  336. package/src/commands/web-fetch.ts +1 -1
  337. package/src/commands/web.ts +56 -1
  338. package/src/commands/work.ts +50 -35
  339. package/src/commands/workflow.ts +43 -34
  340. package/src/core/{harnesses → adapters}/attest-projection.ts +2 -2
  341. package/src/core/{harnesses → adapters}/attest.ts +27 -27
  342. package/src/core/{harnesses → adapters}/attestation.ts +41 -41
  343. package/src/core/{harnesses → adapters}/bench.ts +34 -43
  344. package/src/core/adapters/index.ts +56 -0
  345. package/src/core/{harnesses → adapters}/profiles.ts +16 -16
  346. package/src/core/{harnesses → adapters}/registry.ts +23 -23
  347. package/src/core/{harnesses → adapters}/types.ts +23 -23
  348. package/src/core/agents/canonical-emit.ts +6 -6
  349. package/src/core/agents/cli-emit.ts +1 -1
  350. package/src/core/agents/cli.ts +30 -28
  351. package/src/core/agents/codex-replay.ts +6 -6
  352. package/src/core/agents/coord-client.ts +119 -28
  353. package/src/core/agents/events/consume.ts +1 -1
  354. package/src/core/agents/events/emit.ts +7 -6
  355. package/src/core/agents/render/prompt-context.ts +107 -31
  356. package/src/core/agents/render/session-context.ts +6 -6
  357. package/src/core/agents/rules/claim-conflict.ts +4 -7
  358. package/src/core/agents/rules/commit-conflict.ts +103 -22
  359. package/src/core/agents/rules/stop-hook.ts +33 -17
  360. package/src/core/agents/rules/verdict.ts +13 -0
  361. package/src/core/agents/session-events.ts +4 -4
  362. package/src/core/agents/state/council.ts +1 -1
  363. package/src/core/agents/state/heartbeat-projector.ts +16 -12
  364. package/src/core/agents/state/heartbeat-writer.ts +12 -12
  365. package/src/core/agents/state/{scratch.ts → journal.ts} +12 -12
  366. package/src/core/agents/state/pidmap.ts +130 -15
  367. package/src/core/agents/state/proc-start.ts +208 -0
  368. package/src/core/agents/state/shell-mutation.ts +1 -1
  369. package/src/core/agents/state/stale-sweep.ts +7 -7
  370. package/src/core/artifacts/index.ts +557 -0
  371. package/src/core/config.ts +30 -2
  372. package/src/core/context/index.ts +15 -15
  373. package/src/core/governor/adapter-spread.ts +82 -0
  374. package/src/core/governor/index.ts +91 -0
  375. package/src/core/governor/plan-api.ts +115 -0
  376. package/src/core/{supervisor → governor}/plan-read.ts +112 -97
  377. package/src/core/{supervisor → governor}/plan-types.ts +59 -56
  378. package/src/core/{supervisor → governor}/planning.ts +223 -192
  379. package/src/core/governor/read.ts +59 -0
  380. package/src/core/{supervisor → governor}/runner.ts +39 -39
  381. package/src/core/{supervisor → governor}/service-read.ts +22 -22
  382. package/src/core/{supervisor → governor}/service.ts +117 -119
  383. package/src/core/{supervisor → governor}/state.ts +325 -167
  384. package/src/core/hooks/adapter/detect.ts +30 -0
  385. package/src/core/hooks/{harness → adapter}/events.ts +16 -14
  386. package/src/core/hooks/{harness → adapter}/output.ts +31 -23
  387. package/src/core/hooks/{harness → adapter}/parse.ts +5 -5
  388. package/src/core/hooks/{harness → adapter}/wiring.ts +21 -21
  389. package/src/core/hooks/cli.ts +185 -162
  390. package/src/core/hooks/effects/image-capture.ts +6 -6
  391. package/src/core/hooks/effects/index.ts +17 -17
  392. package/src/core/hooks/events/emit.ts +3 -3
  393. package/src/core/hooks/events/rotate.ts +1 -1
  394. package/src/core/hooks/events/schema.ts +15 -7
  395. package/src/core/hooks/guard-path.ts +2 -2
  396. package/src/core/hooks/index.ts +1 -1
  397. package/src/core/hooks/resolve/anchor.ts +63 -8
  398. package/src/core/hooks/resolve/coord-root.ts +4 -4
  399. package/src/core/hooks/resolve/intent.ts +1 -1
  400. package/src/core/hooks/resolve/owner.ts +11 -5
  401. package/src/core/{scratch → journal}/index.ts +53 -53
  402. package/src/core/policy/evaluate.ts +8 -8
  403. package/src/core/policy/types.ts +3 -3
  404. package/src/core/work/state.ts +65 -23
  405. package/src/core/workflow/adapters.ts +33 -0
  406. package/src/core/workflow/approvals.ts +7 -7
  407. package/src/core/workflow/billing.ts +12 -12
  408. package/src/core/workflow/child-env.ts +13 -4
  409. package/src/core/workflow/engine.ts +155 -90
  410. package/src/core/workflow/evidence-preflight.ts +165 -0
  411. package/src/core/workflow/index.ts +3 -3
  412. package/src/core/workflow/proof.ts +60 -50
  413. package/src/core/workflow/run-state.ts +7 -7
  414. package/src/core/workflow/sandbox-projection.ts +16 -16
  415. package/src/core/workflow/spawn-claude.ts +13 -10
  416. package/src/core/workflow/spawn-codex.ts +13 -10
  417. package/src/core/workflow/spawn-cursor.ts +13 -10
  418. package/src/core/workflow/spawn-failure.ts +1 -1
  419. package/src/core/workflow/specialists.ts +2 -2
  420. package/src/core/workflow/{journal.ts → transcript.ts} +16 -16
  421. package/src/core/workflow/types.ts +108 -51
  422. package/src/core/workflow/validate.ts +1 -1
  423. package/src/core/workflow/workspaces/cancellation.ts +2 -2
  424. package/src/core/workflow/workspaces/cleanup.ts +2 -2
  425. package/src/core/workflow/workspaces/execution.ts +6 -6
  426. package/src/core/workflow/workspaces/inspect.ts +14 -11
  427. package/src/core/workflow/workspaces/integration.ts +18 -14
  428. package/src/core/workflow/workspaces/lifecycle.ts +10 -10
  429. package/src/core/workflow/workspaces/local-git.ts +47 -5
  430. package/src/core/workflow/workspaces/recovery.ts +3 -3
  431. package/src/core/workflow/workspaces/state.ts +4 -3
  432. package/src/core/workflow/workspaces/types.ts +1 -1
  433. package/src/lib/browser/asserts.ts +177 -0
  434. package/src/lib/browser/client.ts +189 -14
  435. package/src/lib/browser/content-checks.ts +571 -0
  436. package/src/lib/browser/critique.ts +231 -0
  437. package/src/lib/browser/geometry.ts +297 -1
  438. package/src/lib/browser/index.ts +34 -0
  439. package/src/lib/claude-desktop.ts +4 -1
  440. package/src/lib/council/index.ts +9 -9
  441. package/src/lib/identities/assume.ts +7 -7
  442. package/src/lib/instructions/apply.ts +87 -25
  443. package/src/lib/instructions/host-addendum.ts +126 -0
  444. package/src/lib/instructions/templates.ts +44 -15
  445. package/src/lib/machine.ts +2 -2
  446. package/dist/commands/harness.d.ts +0 -12
  447. package/dist/commands/harness.d.ts.map +0 -1
  448. package/dist/commands/scratch.d.ts +0 -4
  449. package/dist/commands/scratch.d.ts.map +0 -1
  450. package/dist/commands/session.d.ts.map +0 -1
  451. package/dist/commands/session.js +0 -162
  452. package/dist/commands/supervisor.d.ts +0 -4
  453. package/dist/commands/supervisor.d.ts.map +0 -1
  454. package/dist/core/harnesses/attest-projection.d.ts.map +0 -1
  455. package/dist/core/harnesses/attest.d.ts.map +0 -1
  456. package/dist/core/harnesses/attestation.d.ts.map +0 -1
  457. package/dist/core/harnesses/bench.d.ts.map +0 -1
  458. package/dist/core/harnesses/index.d.ts +0 -13
  459. package/dist/core/harnesses/index.d.ts.map +0 -1
  460. package/dist/core/harnesses/index.js +0 -6
  461. package/dist/core/harnesses/profiles.d.ts.map +0 -1
  462. package/dist/core/harnesses/registry.d.ts +0 -15
  463. package/dist/core/harnesses/registry.d.ts.map +0 -1
  464. package/dist/core/harnesses/types.d.ts.map +0 -1
  465. package/dist/core/hooks/harness/detect.d.ts +0 -9
  466. package/dist/core/hooks/harness/events.d.ts.map +0 -1
  467. package/dist/core/hooks/harness/output.d.ts.map +0 -1
  468. package/dist/core/supervisor/index.d.ts +0 -7
  469. package/dist/core/supervisor/index.d.ts.map +0 -1
  470. package/dist/core/supervisor/index.js +0 -6
  471. package/dist/core/supervisor/plan-api.d.ts +0 -23
  472. package/dist/core/supervisor/plan-api.d.ts.map +0 -1
  473. package/dist/core/supervisor/plan-api.js +0 -50
  474. package/dist/core/supervisor/plan-read.d.ts +0 -5
  475. package/dist/core/supervisor/plan-read.d.ts.map +0 -1
  476. package/dist/core/supervisor/plan-types.d.ts.map +0 -1
  477. package/dist/core/supervisor/planning.d.ts +0 -33
  478. package/dist/core/supervisor/planning.d.ts.map +0 -1
  479. package/dist/core/supervisor/read.d.ts +0 -6
  480. package/dist/core/supervisor/read.d.ts.map +0 -1
  481. package/dist/core/supervisor/read.js +0 -4
  482. package/dist/core/supervisor/runner.d.ts +0 -37
  483. package/dist/core/supervisor/runner.d.ts.map +0 -1
  484. package/dist/core/supervisor/service-read.d.ts +0 -6
  485. package/dist/core/supervisor/service-read.d.ts.map +0 -1
  486. package/dist/core/supervisor/service.d.ts +0 -114
  487. package/dist/core/supervisor/service.d.ts.map +0 -1
  488. package/dist/core/supervisor/state.d.ts +0 -95
  489. package/dist/core/supervisor/state.d.ts.map +0 -1
  490. package/dist/core/workflow/harnesses.d.ts +0 -17
  491. package/dist/core/workflow/harnesses.d.ts.map +0 -1
  492. package/dist/core/workflow/harnesses.js +0 -21
  493. package/dist/core/workflow/journal.d.ts.map +0 -1
  494. package/src/commands/session.ts +0 -187
  495. package/src/core/harnesses/index.ts +0 -56
  496. package/src/core/hooks/harness/detect.ts +0 -30
  497. package/src/core/supervisor/index.ts +0 -89
  498. package/src/core/supervisor/plan-api.ts +0 -73
  499. package/src/core/supervisor/read.ts +0 -59
  500. package/src/core/workflow/harnesses.ts +0 -33
  501. /package/dist/core/{harnesses → adapters}/attest-projection.js +0 -0
@@ -2,43 +2,46 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { dirname, isAbsolute, resolve } from "node:path";
3
3
  import type { Command } from "commander";
4
4
  import type { EmitContext } from "../commander.ts";
5
- import { workflowSubscriptionOnly } from "../core/config.ts";
6
5
  import {
7
- createBuiltinHarnessRegistry,
8
- harnessProofInputs,
6
+ adapterProofInputs,
7
+ createBuiltinAdapterRegistry,
9
8
  probeBinaryVersion,
10
- } from "../core/harnesses/index.ts";
9
+ readAttestation,
10
+ } from "../core/adapters/index.ts";
11
+ import { workflowSubscriptionOnly } from "../core/config.ts";
12
+ import { inspectAdapterSpread } from "../core/governor/adapter-spread.ts";
13
+ import {
14
+ approveGovernorPlan,
15
+ type CreateGovernorMissionInput,
16
+ type CreateGovernorReplanningInput,
17
+ configureGovernorService,
18
+ createGovernor,
19
+ type GovernorPlanOutcome,
20
+ type GovernorPlanRecord,
21
+ type GovernorRecord,
22
+ type GovernorRunReport,
23
+ type GovernorServiceConfig,
24
+ type GovernorServiceStatus,
25
+ governorServiceLogPath,
26
+ listGovernors,
27
+ readGovernor,
28
+ readGovernorPlan,
29
+ readGovernorServiceConfig,
30
+ readGovernorServiceStatus,
31
+ rejectGovernorPlan,
32
+ requestGovernorServiceStop,
33
+ retryGovernorPlan,
34
+ runGovernor,
35
+ runGovernorServiceDaemon,
36
+ spawnGovernorService,
37
+ } from "../core/governor/index.ts";
11
38
  import { findCoordRoot } from "../core/hooks/resolve/coord-root.ts";
12
39
  import type { PolicyIsolation } from "../core/policy/index.ts";
13
40
  import { loadPolicyFile } from "../core/policy/index.ts";
14
- import {
15
- approveSupervisorPlan,
16
- type CreateSupervisorMissionInput,
17
- type CreateSupervisorReplanningInput,
18
- configureSupervisorService,
19
- createSupervisor,
20
- listSupervisors,
21
- readSupervisor,
22
- readSupervisorPlan,
23
- readSupervisorServiceConfig,
24
- readSupervisorServiceStatus,
25
- rejectSupervisorPlan,
26
- requestSupervisorServiceStop,
27
- retrySupervisorPlan,
28
- runSupervisor,
29
- runSupervisorServiceDaemon,
30
- type SupervisorPlanOutcome,
31
- type SupervisorPlanRecord,
32
- type SupervisorRecord,
33
- type SupervisorRunReport,
34
- type SupervisorServiceConfig,
35
- type SupervisorServiceStatus,
36
- spawnSupervisorService,
37
- supervisorServiceLogPath,
38
- } from "../core/supervisor/index.ts";
39
41
  import type { WorkflowSpecialistProfile } from "../core/workflow/index.ts";
40
42
 
41
43
  interface CreateOpts {
44
+ allowSingleAdapter?: boolean;
42
45
  team: string;
43
46
  id?: string;
44
47
  title?: string;
@@ -57,7 +60,7 @@ interface CreateOpts {
57
60
  }
58
61
 
59
62
  interface RunOpts {
60
- harness?: string;
63
+ adapter?: string;
61
64
  cwd?: string;
62
65
  subscriptionOnly?: boolean;
63
66
  allowApiBilling?: boolean;
@@ -75,13 +78,13 @@ interface ServiceOpts extends RunOpts {
75
78
  errorBackoffMaxMs?: string;
76
79
  }
77
80
 
78
- export function registerSupervisorCommand(program: Command, emit: EmitContext): void {
79
- const registry = createBuiltinHarnessRegistry();
80
- const supervisor = program
81
- .command("supervisor")
81
+ export function registerGovernorCommand(program: Command, emit: EmitContext): void {
82
+ const registry = createBuiltinAdapterRegistry();
83
+ const governor = program
84
+ .command("governor")
82
85
  .description("Run a bounded specialist team over a durable-work dependency graph.");
83
86
 
84
- supervisor
87
+ governor
85
88
  .command("create [root-work-id]")
86
89
  .description("Freeze an existing-root goal or an objective-first bounded mission.")
87
90
  .requiredOption("--team <file>", "JSON object mapping specialist ids to profiles")
@@ -93,24 +96,43 @@ export function registerSupervisorCommand(program: Command, emit: EmitContext):
93
96
  .option("--max-total-attempts <n>", "Graph-wide attempt ceiling (default 100)")
94
97
  .option("--max-agents-per-work <n>", "Child-agent ceiling per work item (default 20)")
95
98
  .option("--agent-concurrency <n>", "Child concurrency per work item (default 4)")
96
- .option("--accept-passing-proof", "Allow the supervisor to explicitly accept passing proof")
99
+ .option("--accept-passing-proof", "Allow the governor to explicitly accept passing proof")
97
100
  .option("--no-resume-approved", "Stop after an approval instead of resuming its parked run")
98
101
  .option("--retry-blocked", "Allow bounded retry of blocked work")
102
+ .option(
103
+ "--allow-single-adapter",
104
+ "Freeze a team even though every specialist lands on one adapter under subscription auth",
105
+ )
99
106
  .option("--replanning <file>", "Frozen planner policy and allowed workflow-template catalog")
100
107
  .option("--mission <file>", "Frozen objective, acceptance criteria, and milestone bound")
101
- .option("--json", "Emit the complete supervisor record as JSON")
108
+ .option("--json", "Emit the complete governor record as JSON")
102
109
  .action((rootWorkId: string | undefined, opts: CreateOpts) => {
103
- withSupervisorRoot(emit, (coordRoot) => {
110
+ withGovernorRoot(emit, (coordRoot) => {
104
111
  const specialists = readTeamFile(opts.team);
105
112
  for (const [id, profile] of Object.entries(specialists)) {
106
- if (profile.harness && !registry.get(profile.harness)) {
113
+ if (profile.adapter && !registry.get(profile.adapter)) {
107
114
  throw new Error(
108
- `specialist ${id} names unknown harness ${JSON.stringify(profile.harness)}`,
115
+ `specialist ${id} names unknown adapter ${JSON.stringify(profile.adapter)}`,
109
116
  );
110
117
  }
111
118
  }
112
- emitSupervisor(
113
- createSupervisor({
119
+ if (!opts.allowSingleAdapter) {
120
+ // Refuse a team that would put every child on one subscription seat
121
+ // while other adapters sit attested and idle. Checked here rather than
122
+ // at run time because the intent freezes on create with no amend path:
123
+ // catching it later means recreating the goal.
124
+ const spread = inspectAdapterSpread({
125
+ specialists,
126
+ defaultAdapter: "claude-code",
127
+ reachable: registry.ids().filter((id) => readAttestation(id) !== null),
128
+ subscriptionOnly: workflowSubscriptionOnly(coordRoot),
129
+ });
130
+ if (spread.concentrated) {
131
+ throw new Error(`refusing to freeze a single-adapter team: ${spread.reason}`);
132
+ }
133
+ }
134
+ emitGovernor(
135
+ createGovernor({
114
136
  coordRoot,
115
137
  rootWorkId,
116
138
  specialists,
@@ -139,42 +161,42 @@ export function registerSupervisorCommand(program: Command, emit: EmitContext):
139
161
  });
140
162
  });
141
163
 
142
- supervisor
164
+ governor
143
165
  .command("list")
144
166
  .description("List durable goals and their derived next action.")
145
- .option("--json", "Emit complete supervisor records as JSON")
167
+ .option("--json", "Emit complete governor records as JSON")
146
168
  .action((opts: { json?: boolean }) => {
147
- withSupervisorRoot(emit, (coordRoot) => {
148
- const records = listSupervisors(coordRoot);
169
+ withGovernorRoot(emit, (coordRoot) => {
170
+ const records = listGovernors(coordRoot);
149
171
  if (opts.json) {
150
172
  emit.config({ format: "json" });
151
173
  emit.data(records);
152
174
  } else if (records.length === 0) {
153
- emit.text("no durable supervisors\n");
175
+ emit.text("no durable governors\n");
154
176
  } else {
155
- emit.text(`${records.map(renderSupervisorRow).join("\n")}\n`);
177
+ emit.text(`${records.map(renderGovernorRow).join("\n")}\n`);
156
178
  }
157
179
  });
158
180
  });
159
181
 
160
- supervisor
182
+ governor
161
183
  .command("show <goal-id>")
162
184
  .description("Show one goal, frozen team, bounds, graph state, and next action.")
163
- .option("--json", "Emit the complete supervisor record as JSON")
185
+ .option("--json", "Emit the complete governor record as JSON")
164
186
  .action((goalId: string, opts: { json?: boolean }) => {
165
- withSupervisorRoot(emit, (coordRoot) => {
166
- emitSupervisor(readSupervisor(coordRoot, goalId), opts.json, emit, true);
187
+ withGovernorRoot(emit, (coordRoot) => {
188
+ emitGovernor(readGovernor(coordRoot, goalId), opts.json, emit, true);
167
189
  });
168
190
  });
169
191
 
170
- registerPlanCommand(supervisor, emit);
171
- registerServiceCommand(supervisor, registry, emit);
172
- registerRunCommand(supervisor, "tick", registry, emit);
173
- registerRunCommand(supervisor, "run", registry, emit);
192
+ registerPlanCommand(governor, emit);
193
+ registerServiceCommand(governor, registry, emit);
194
+ registerRunCommand(governor, "tick", registry, emit);
195
+ registerRunCommand(governor, "run", registry, emit);
174
196
  }
175
197
 
176
- function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
177
- const plan = supervisor
198
+ function registerPlanCommand(governor: Command, emit: EmitContext): void {
199
+ const plan = governor
178
200
  .command("plan")
179
201
  .description("Inspect and resolve bounded planner proposals for a durable goal.");
180
202
 
@@ -183,13 +205,13 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
183
205
  .description("List append-only replanning attempts for one goal.")
184
206
  .option("--json", "Emit complete plan records as JSON")
185
207
  .action((goalId: string, opts: { json?: boolean }) => {
186
- withSupervisorRoot(emit, (coordRoot) => {
187
- const plans = readSupervisor(coordRoot, goalId).plans;
208
+ withGovernorRoot(emit, (coordRoot) => {
209
+ const plans = readGovernor(coordRoot, goalId).plans;
188
210
  if (opts.json) {
189
211
  emit.config({ format: "json" });
190
212
  emit.data(plans);
191
213
  } else if (plans.length === 0) {
192
- emit.text(`supervisor ${goalId} has no replanning attempts\n`);
214
+ emit.text(`governor ${goalId} has no replanning attempts\n`);
193
215
  } else {
194
216
  emit.text(`${plans.map(renderPlanRow).join("\n")}\n`);
195
217
  }
@@ -201,8 +223,8 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
201
223
  .description("Show one planner request, schema-gated proposal, and audit events.")
202
224
  .option("--json", "Emit the complete plan record as JSON")
203
225
  .action((goalId: string, planId: string, opts: { json?: boolean }) => {
204
- withSupervisorRoot(emit, (coordRoot) => {
205
- emitPlan(readSupervisorPlan(coordRoot, goalId, planId), opts.json, emit);
226
+ withGovernorRoot(emit, (coordRoot) => {
227
+ emitPlan(readGovernorPlan(coordRoot, goalId, planId), opts.json, emit);
206
228
  });
207
229
  });
208
230
 
@@ -218,9 +240,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
218
240
  planId: string,
219
241
  opts: { actor?: string; reason?: string; json?: boolean },
220
242
  ) => {
221
- withSupervisorRoot(emit, (coordRoot) => {
243
+ withGovernorRoot(emit, (coordRoot) => {
222
244
  emitPlanOutcome(
223
- approveSupervisorPlan({
245
+ approveGovernorPlan({
224
246
  coordRoot,
225
247
  goalId,
226
248
  planId,
@@ -246,9 +268,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
246
268
  planId: string,
247
269
  opts: { actor?: string; reason: string; json?: boolean },
248
270
  ) => {
249
- withSupervisorRoot(emit, (coordRoot) => {
271
+ withGovernorRoot(emit, (coordRoot) => {
250
272
  emitPlanOutcome(
251
- rejectSupervisorPlan({
273
+ rejectGovernorPlan({
252
274
  coordRoot,
253
275
  goalId,
254
276
  planId,
@@ -274,9 +296,9 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
274
296
  planId: string,
275
297
  opts: { actor?: string; reason: string; json?: boolean },
276
298
  ) => {
277
- withSupervisorRoot(emit, (coordRoot) => {
299
+ withGovernorRoot(emit, (coordRoot) => {
278
300
  emitPlanOutcome(
279
- retrySupervisorPlan({
301
+ retryGovernorPlan({
280
302
  coordRoot,
281
303
  goalId,
282
304
  planId,
@@ -292,24 +314,24 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
292
314
  }
293
315
 
294
316
  function registerServiceCommand(
295
- supervisor: Command,
296
- registry: ReturnType<typeof createBuiltinHarnessRegistry>,
317
+ governor: Command,
318
+ registry: ReturnType<typeof createBuiltinAdapterRegistry>,
297
319
  emit: EmitContext,
298
320
  ): void {
299
- const service = supervisor
321
+ const service = governor
300
322
  .command("service")
301
323
  .description("Run explicitly enrolled durable goals in a restartable background service.");
302
324
 
303
325
  addServiceOptions(
304
326
  service
305
327
  .command("start [goal-ids...]")
306
- .description("Configure and start the detached per-repository supervisor service."),
328
+ .description("Configure and start the detached per-repository governor service."),
307
329
  )
308
330
  .option("--json", "Emit complete service status as JSON")
309
331
  .action(async (goalIds: string[], opts: ServiceOpts) => {
310
- await withSupervisorRootAsync(emit, async (coordRoot) => {
332
+ await withGovernorRootAsync(emit, async (coordRoot) => {
311
333
  prepareServiceConfig(coordRoot, goalIds, opts, registry);
312
- const status = await spawnSupervisorService(coordRoot);
334
+ const status = await spawnGovernorService(coordRoot);
313
335
  emitServiceStatus(status, opts.json, emit);
314
336
  });
315
337
  });
@@ -321,9 +343,9 @@ function registerServiceCommand(
321
343
  )
322
344
  .option("--json", "Emit terminal service status as JSON")
323
345
  .action(async (goalIds: string[], opts: ServiceOpts) => {
324
- await withSupervisorRootAsync(emit, async (coordRoot) => {
346
+ await withGovernorRootAsync(emit, async (coordRoot) => {
325
347
  const config = prepareServiceConfig(coordRoot, goalIds, opts, registry);
326
- const status = await runSupervisorServiceDaemon({
348
+ const status = await runGovernorServiceDaemon({
327
349
  coordRoot,
328
350
  engine: serviceEngine(config, registry),
329
351
  onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
@@ -340,8 +362,8 @@ function registerServiceCommand(
340
362
  .description("Show service liveness, heartbeat, enrolled goals, and durable wake state.")
341
363
  .option("--json", "Emit complete service status as JSON")
342
364
  .action((opts: { json?: boolean }) => {
343
- withSupervisorRoot(emit, (coordRoot) => {
344
- emitServiceStatus(readSupervisorServiceStatus(coordRoot), opts.json, emit);
365
+ withGovernorRoot(emit, (coordRoot) => {
366
+ emitServiceStatus(readGovernorServiceStatus(coordRoot), opts.json, emit);
345
367
  });
346
368
  });
347
369
 
@@ -350,12 +372,12 @@ function registerServiceCommand(
350
372
  .description("Request a graceful stop; an active goal tick is allowed to finish safely.")
351
373
  .option("--json", "Emit complete service status as JSON")
352
374
  .action(async (opts: { json?: boolean }) => {
353
- await withSupervisorRootAsync(emit, async (coordRoot) => {
354
- let status = requestSupervisorServiceStop(coordRoot);
375
+ await withGovernorRootAsync(emit, async (coordRoot) => {
376
+ let status = requestGovernorServiceStop(coordRoot);
355
377
  const deadline = Date.now() + 5_000;
356
378
  while (status.running && Date.now() < deadline) {
357
379
  await delay(50);
358
- status = readSupervisorServiceStatus(coordRoot);
380
+ status = readGovernorServiceStatus(coordRoot);
359
381
  }
360
382
  emitServiceStatus(status, opts.json, emit);
361
383
  });
@@ -366,12 +388,12 @@ function registerServiceCommand(
366
388
  .description("Show the tail of the private background-service log.")
367
389
  .option("--lines <n>", "Number of lines to show (default 50)", "50")
368
390
  .action((opts: { lines: string }) => {
369
- withSupervisorRoot(emit, (coordRoot) => {
391
+ withGovernorRoot(emit, (coordRoot) => {
370
392
  const lines = integer(opts.lines) ?? 50;
371
393
  if (lines > 10_000) throw new Error("service log lines must not exceed 10000");
372
- const path = supervisorServiceLogPath(coordRoot);
394
+ const path = governorServiceLogPath(coordRoot);
373
395
  if (!existsSync(path)) {
374
- emit.text("no supervisor service log\n");
396
+ emit.text("no governor service log\n");
375
397
  return;
376
398
  }
377
399
  const selected = readFileSync(path, "utf8")
@@ -386,9 +408,9 @@ function registerServiceCommand(
386
408
  .command("daemon", { hidden: true })
387
409
  .description("Internal detached service entrypoint.")
388
410
  .action(async () => {
389
- await withSupervisorRootAsync(emit, async (coordRoot) => {
390
- const config = readSupervisorServiceConfig(coordRoot);
391
- await runSupervisorServiceDaemon({
411
+ await withGovernorRootAsync(emit, async (coordRoot) => {
412
+ const config = readGovernorServiceConfig(coordRoot);
413
+ await runGovernorServiceDaemon({
392
414
  coordRoot,
393
415
  engine: serviceEngine(config, registry),
394
416
  onLog: (line) => emit.text(`${line}\n`),
@@ -403,9 +425,9 @@ function addServiceOptions(command: Command): Command {
403
425
  .option("--heartbeat-interval-ms <n>", "Heartbeat interval (default 2000)")
404
426
  .option("--error-backoff-base-ms <n>", "Initial service-error backoff (default 2000)")
405
427
  .option("--error-backoff-max-ms <n>", "Maximum service-error backoff (default 300000)")
406
- .option("--harness <name>", "Fallback harness for agent calls without a specialist")
428
+ .option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
407
429
  .option("--cwd <dir>", "Working directory for child agents")
408
- .option("--subscription-only", "Require stored harness-login billing")
430
+ .option("--subscription-only", "Require stored adapter-login billing")
409
431
  .option("--allow-api-billing", "Permit API-key override billing")
410
432
  .option("--policy <file>", "Host policy JSON/JSONC")
411
433
  .option("--isolation <mode>", "shared | worktree | sandbox | remote")
@@ -416,19 +438,19 @@ function prepareServiceConfig(
416
438
  coordRoot: string,
417
439
  goalIds: string[],
418
440
  opts: ServiceOpts,
419
- registry: ReturnType<typeof createBuiltinHarnessRegistry>,
420
- ): SupervisorServiceConfig {
441
+ registry: ReturnType<typeof createBuiltinAdapterRegistry>,
442
+ ): GovernorServiceConfig {
421
443
  if (goalIds.length === 0) {
422
444
  if (hasServiceConfigOverrides(opts)) {
423
- throw new Error("goal ids are required when changing supervisor service options");
445
+ throw new Error("goal ids are required when changing governor service options");
424
446
  }
425
- return readSupervisorServiceConfig(coordRoot);
447
+ return readGovernorServiceConfig(coordRoot);
426
448
  }
427
- if (opts.harness && !registry.get(opts.harness)) {
428
- throw new Error(`unknown harness ${JSON.stringify(opts.harness)}`);
449
+ if (opts.adapter && !registry.get(opts.adapter)) {
450
+ throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
429
451
  }
430
452
  const policy = opts.policy ? loadPolicyFile(opts.policy) : undefined;
431
- return configureSupervisorService({
453
+ return configureGovernorService({
432
454
  coordRoot,
433
455
  goalIds,
434
456
  wakeIntervalMs: integer(opts.wakeIntervalMs),
@@ -436,7 +458,7 @@ function prepareServiceConfig(
436
458
  errorBackoffBaseMs: integer(opts.errorBackoffBaseMs),
437
459
  errorBackoffMaxMs: integer(opts.errorBackoffMaxMs),
438
460
  engine: {
439
- default_harness: opts.harness,
461
+ default_adapter: opts.adapter,
440
462
  cwd: opts.cwd,
441
463
  subscription_only:
442
464
  opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
@@ -454,7 +476,7 @@ function hasServiceConfigOverrides(opts: ServiceOpts): boolean {
454
476
  opts.heartbeatIntervalMs ||
455
477
  opts.errorBackoffBaseMs ||
456
478
  opts.errorBackoffMaxMs ||
457
- opts.harness ||
479
+ opts.adapter ||
458
480
  opts.cwd ||
459
481
  opts.subscriptionOnly ||
460
482
  opts.allowApiBilling ||
@@ -465,16 +487,16 @@ function hasServiceConfigOverrides(opts: ServiceOpts): boolean {
465
487
  }
466
488
 
467
489
  function serviceEngine(
468
- config: SupervisorServiceConfig,
469
- registry: ReturnType<typeof createBuiltinHarnessRegistry>,
490
+ config: GovernorServiceConfig,
491
+ registry: ReturnType<typeof createBuiltinAdapterRegistry>,
470
492
  ) {
471
493
  return {
472
494
  spawners: registry.spawners(),
473
- defaultHarness: config.engine.default_harness,
495
+ defaultAdapter: config.engine.default_adapter,
474
496
  cwd: config.engine.cwd,
475
497
  subscriptionOnly: config.engine.subscription_only,
476
498
  allowApiBilling: config.engine.allow_api_billing,
477
- ...harnessProofInputs(
499
+ ...adapterProofInputs(
478
500
  registry.list().map((adapter) => adapter.profile),
479
501
  { versionProbe: probeBinaryVersion },
480
502
  ),
@@ -487,7 +509,7 @@ function serviceEngine(
487
509
  }
488
510
 
489
511
  function emitServiceStatus(
490
- status: SupervisorServiceStatus,
512
+ status: GovernorServiceStatus,
491
513
  json: boolean | undefined,
492
514
  emit: EmitContext,
493
515
  ): void {
@@ -497,7 +519,7 @@ function emitServiceStatus(
497
519
  return;
498
520
  }
499
521
  if (!status.config && !status.record) {
500
- emit.text("supervisor service: unconfigured\n");
522
+ emit.text("governor service: unconfigured\n");
501
523
  return;
502
524
  }
503
525
  const state = status.running
@@ -506,7 +528,7 @@ function emitServiceStatus(
506
528
  ? "stale"
507
529
  : "stopped";
508
530
  const lines = [
509
- `supervisor service: ${state}`,
531
+ `governor service: ${state}`,
510
532
  `goals: ${status.config?.goal_ids.join(", ") || "none"}`,
511
533
  ];
512
534
  if (status.record) {
@@ -527,33 +549,33 @@ function emitServiceStatus(
527
549
  }
528
550
 
529
551
  function registerRunCommand(
530
- supervisor: Command,
552
+ governor: Command,
531
553
  mode: "tick" | "run",
532
- registry: ReturnType<typeof createBuiltinHarnessRegistry>,
554
+ registry: ReturnType<typeof createBuiltinAdapterRegistry>,
533
555
  emit: EmitContext,
534
556
  ): void {
535
- supervisor
557
+ governor
536
558
  .command(`${mode} <goal-id>`)
537
559
  .description(
538
560
  mode === "tick"
539
561
  ? "Perform at most one bounded scheduling cycle."
540
562
  : "Run bounded cycles until success, attention, no progress, or budget exhaustion.",
541
563
  )
542
- .option("--harness <name>", "Fallback harness for agent calls without a specialist")
564
+ .option("--adapter <name>", "Fallback adapter for agent calls without a specialist")
543
565
  .option("--cwd <dir>", "Working directory for child agents")
544
- .option("--subscription-only", "Require stored harness-login billing")
566
+ .option("--subscription-only", "Require stored adapter-login billing")
545
567
  .option("--allow-api-billing", "Permit API-key override billing")
546
568
  .option("--policy <file>", "Host policy JSON/JSONC")
547
569
  .option("--isolation <mode>", "shared | worktree | sandbox | remote")
548
570
  .option("--approval-to <address>", "Address durable ASK requests")
549
- .option("--actor <name>", "Actor recorded on supervisor work decisions")
571
+ .option("--actor <name>", "Actor recorded on governor work decisions")
550
572
  .option("--json", "Emit the complete run report as JSON")
551
573
  .action(async (goalId: string, opts: RunOpts) => {
552
- await withSupervisorRootAsync(emit, async (coordRoot) => {
553
- if (opts.harness && !registry.get(opts.harness)) {
554
- throw new Error(`unknown harness ${JSON.stringify(opts.harness)}`);
574
+ await withGovernorRootAsync(emit, async (coordRoot) => {
575
+ if (opts.adapter && !registry.get(opts.adapter)) {
576
+ throw new Error(`unknown adapter ${JSON.stringify(opts.adapter)}`);
555
577
  }
556
- const report = await runSupervisor({
578
+ const report = await runGovernor({
557
579
  coordRoot,
558
580
  goalId,
559
581
  mode,
@@ -561,12 +583,12 @@ function registerRunCommand(
561
583
  onLog: opts.json ? undefined : (line) => emit.text(`${line}\n`),
562
584
  engine: {
563
585
  spawners: registry.spawners(),
564
- defaultHarness: opts.harness,
586
+ defaultAdapter: opts.adapter,
565
587
  cwd: opts.cwd,
566
588
  subscriptionOnly:
567
589
  opts.subscriptionOnly === true ? true : workflowSubscriptionOnly(coordRoot),
568
590
  allowApiBilling: opts.allowApiBilling,
569
- ...harnessProofInputs(
591
+ ...adapterProofInputs(
570
592
  registry.list().map((adapter) => adapter.profile),
571
593
  { versionProbe: probeBinaryVersion },
572
594
  ),
@@ -577,7 +599,7 @@ function registerRunCommand(
577
599
  networkAccess: "enabled",
578
600
  },
579
601
  });
580
- emitSupervisorReport(report, opts.json, emit);
602
+ emitGovernorReport(report, opts.json, emit);
581
603
  });
582
604
  });
583
605
  }
@@ -588,47 +610,47 @@ function readTeamFile(path: string): Record<string, WorkflowSpecialistProfile> {
588
610
  try {
589
611
  value = JSON.parse(readFileSync(absolute, "utf8"));
590
612
  } catch (error) {
591
- throw new Error(`cannot read supervisor team at ${absolute}: ${(error as Error).message}`);
613
+ throw new Error(`cannot read governor team at ${absolute}: ${(error as Error).message}`);
592
614
  }
593
615
  if (!value || typeof value !== "object" || Array.isArray(value)) {
594
- throw new Error("supervisor team must be a JSON object keyed by specialist id");
616
+ throw new Error("governor team must be a JSON object keyed by specialist id");
595
617
  }
596
618
  return value as Record<string, WorkflowSpecialistProfile>;
597
619
  }
598
620
 
599
- function readReplanningFile(path: string): CreateSupervisorReplanningInput {
621
+ function readReplanningFile(path: string): CreateGovernorReplanningInput {
600
622
  const absolute = resolve(path);
601
623
  let value: unknown;
602
624
  try {
603
625
  value = JSON.parse(readFileSync(absolute, "utf8"));
604
626
  } catch (error) {
605
627
  throw new Error(
606
- `cannot read supervisor replanning policy at ${absolute}: ${(error as Error).message}`,
628
+ `cannot read governor replanning policy at ${absolute}: ${(error as Error).message}`,
607
629
  );
608
630
  }
609
631
  if (!value || typeof value !== "object" || Array.isArray(value)) {
610
- throw new Error("supervisor replanning policy must be a JSON object");
632
+ throw new Error("governor replanning policy must be a JSON object");
611
633
  }
612
634
  const config = value as Record<string, unknown>;
613
635
  if (typeof config.planner_specialist !== "string") {
614
- throw new Error("supervisor replanning planner_specialist must be a string");
636
+ throw new Error("governor replanning planner_specialist must be a string");
615
637
  }
616
638
  if (
617
639
  !config.templates ||
618
640
  typeof config.templates !== "object" ||
619
641
  Array.isArray(config.templates)
620
642
  ) {
621
- throw new Error("supervisor replanning templates must be an object");
643
+ throw new Error("governor replanning templates must be an object");
622
644
  }
623
645
  const base = dirname(absolute);
624
646
  const templates = Object.fromEntries(
625
647
  Object.entries(config.templates as Record<string, unknown>).map(([id, raw]) => {
626
648
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
627
- throw new Error(`supervisor replanning template ${id} must be an object`);
649
+ throw new Error(`governor replanning template ${id} must be an object`);
628
650
  }
629
651
  const template = raw as Record<string, unknown>;
630
652
  if (typeof template.workflow !== "string") {
631
- throw new Error(`supervisor replanning template ${id} workflow must be a string`);
653
+ throw new Error(`governor replanning template ${id} workflow must be a string`);
632
654
  }
633
655
  return [
634
656
  id,
@@ -657,19 +679,17 @@ function readReplanningFile(path: string): CreateSupervisorReplanningInput {
657
679
  };
658
680
  }
659
681
 
660
- function readReplanningReview(raw: unknown): CreateSupervisorReplanningInput["review"] | undefined {
682
+ function readReplanningReview(raw: unknown): CreateGovernorReplanningInput["review"] | undefined {
661
683
  if (raw === undefined) return undefined;
662
684
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
663
- throw new Error("supervisor replanning review must be a JSON object");
685
+ throw new Error("governor replanning review must be a JSON object");
664
686
  }
665
687
  const review = raw as Record<string, unknown>;
666
688
  if (
667
689
  !Array.isArray(review.reviewer_specialists) ||
668
690
  review.reviewer_specialists.some((item) => typeof item !== "string")
669
691
  ) {
670
- throw new Error(
671
- "supervisor replanning review reviewer_specialists must be an array of strings",
672
- );
692
+ throw new Error("governor replanning review reviewer_specialists must be an array of strings");
673
693
  }
674
694
  return {
675
695
  reviewerSpecialists: review.reviewer_specialists as string[],
@@ -679,26 +699,26 @@ function readReplanningReview(raw: unknown): CreateSupervisorReplanningInput["re
679
699
  };
680
700
  }
681
701
 
682
- function readMissionFile(path: string): CreateSupervisorMissionInput {
702
+ function readMissionFile(path: string): CreateGovernorMissionInput {
683
703
  const absolute = resolve(path);
684
704
  let value: unknown;
685
705
  try {
686
706
  value = JSON.parse(readFileSync(absolute, "utf8"));
687
707
  } catch (error) {
688
- throw new Error(`cannot read supervisor mission at ${absolute}: ${(error as Error).message}`);
708
+ throw new Error(`cannot read governor mission at ${absolute}: ${(error as Error).message}`);
689
709
  }
690
710
  if (!value || typeof value !== "object" || Array.isArray(value)) {
691
- throw new Error("supervisor mission must be a JSON object");
711
+ throw new Error("governor mission must be a JSON object");
692
712
  }
693
713
  const config = value as Record<string, unknown>;
694
714
  if (typeof config.objective !== "string") {
695
- throw new Error("supervisor mission objective must be a string");
715
+ throw new Error("governor mission objective must be a string");
696
716
  }
697
717
  if (
698
718
  !Array.isArray(config.acceptance) ||
699
719
  config.acceptance.some((item) => typeof item !== "string")
700
720
  ) {
701
- throw new Error("supervisor mission acceptance must be an array of strings");
721
+ throw new Error("governor mission acceptance must be an array of strings");
702
722
  }
703
723
  return {
704
724
  objective: config.objective,
@@ -707,8 +727,8 @@ function readMissionFile(path: string): CreateSupervisorMissionInput {
707
727
  };
708
728
  }
709
729
 
710
- function emitSupervisor(
711
- record: SupervisorRecord,
730
+ function emitGovernor(
731
+ record: GovernorRecord,
712
732
  json: boolean | undefined,
713
733
  emit: EmitContext,
714
734
  detail = false,
@@ -719,7 +739,7 @@ function emitSupervisor(
719
739
  return;
720
740
  }
721
741
  if (!detail) {
722
- emit.text(`${renderSupervisorRow(record)}\n`);
742
+ emit.text(`${renderGovernorRow(record)}\n`);
723
743
  return;
724
744
  }
725
745
  const projection = record.projection;
@@ -751,6 +771,11 @@ function emitSupervisor(
751
771
  if (projection.attention_plan_id) {
752
772
  lines.push(`attention plan: ${projection.attention_plan_id}`);
753
773
  }
774
+ if (projection.replan_consumption && projection.replan_consumption.planner_no_proposal > 0) {
775
+ lines.push(
776
+ `replan consumption: planner no-proposal=${projection.replan_consumption.planner_no_proposal}, reviewer rejection=${projection.replan_consumption.reviewer_rejection}`,
777
+ );
778
+ }
754
779
  }
755
780
  if (record.intent.mission) {
756
781
  lines.push(`mission: ${record.intent.mission.objective}`);
@@ -765,8 +790,8 @@ function emitSupervisor(
765
790
  emit.text(`${lines.join("\n")}\n`);
766
791
  }
767
792
 
768
- function emitSupervisorReport(
769
- report: SupervisorRunReport,
793
+ function emitGovernorReport(
794
+ report: GovernorRunReport,
770
795
  json: boolean | undefined,
771
796
  emit: EmitContext,
772
797
  ): void {
@@ -776,7 +801,7 @@ function emitSupervisorReport(
776
801
  return;
777
802
  }
778
803
  emit.text(
779
- `supervisor ${report.goal_id}: ${report.stop_reason}\n` +
804
+ `governor ${report.goal_id}: ${report.stop_reason}\n` +
780
805
  `reason: ${report.reason}\n` +
781
806
  `cycles: ${report.cycles}; dispatches: ${report.dispatches}; acceptances: ${report.acceptances}\n` +
782
807
  `replans: ${report.replans}\n` +
@@ -784,9 +809,14 @@ function emitSupervisorReport(
784
809
  );
785
810
  }
786
811
 
787
- function renderSupervisorRow(record: SupervisorRecord): string {
812
+ function renderGovernorRow(record: GovernorRecord): string {
788
813
  const projection = record.projection;
789
- return `${record.intent.id} ${projection.state.padEnd(20)} ${projection.attempts_used}/${record.intent.limits.max_total_attempts} ${projection.next_action.padEnd(18)} ${record.intent.title}`;
814
+ const row = `${record.intent.id} ${projection.state.padEnd(20)} ${projection.attempts_used}/${record.intent.limits.max_total_attempts} ${projection.next_action.padEnd(18)} ${record.intent.title}`;
815
+ const consumption = projection.replan_consumption;
816
+ if (consumption && consumption.planner_no_proposal > 0) {
817
+ return `${row} [planner no-proposal x${consumption.planner_no_proposal}]`;
818
+ }
819
+ return row;
790
820
  }
791
821
 
792
822
  function integer(value: string | undefined): number | undefined {
@@ -818,7 +848,7 @@ function jsonBoolean(value: unknown, field: string): boolean | undefined {
818
848
  return value;
819
849
  }
820
850
 
821
- function emitPlan(plan: SupervisorPlanRecord, json: boolean | undefined, emit: EmitContext): void {
851
+ function emitPlan(plan: GovernorPlanRecord, json: boolean | undefined, emit: EmitContext): void {
822
852
  if (json) {
823
853
  emit.config({ format: "json" });
824
854
  emit.data(plan);
@@ -852,7 +882,7 @@ function emitPlan(plan: SupervisorPlanRecord, json: boolean | undefined, emit: E
852
882
  }
853
883
 
854
884
  function emitPlanOutcome(
855
- outcome: SupervisorPlanOutcome,
885
+ outcome: GovernorPlanOutcome,
856
886
  json: boolean | undefined,
857
887
  emit: EmitContext,
858
888
  ): void {
@@ -862,13 +892,13 @@ function emitPlanOutcome(
862
892
  return;
863
893
  }
864
894
  emit.text(
865
- `supervisor plan ${outcome.plan_id}: ${outcome.status}\n` +
895
+ `governor plan ${outcome.plan_id}: ${outcome.status}\n` +
866
896
  `${outcome.reason ? `reason: ${outcome.reason}\n` : ""}` +
867
897
  `${outcome.root_work_id ? `root: ${outcome.root_work_id}\n` : ""}`,
868
898
  );
869
899
  }
870
900
 
871
- function renderPlanRow(plan: SupervisorPlanRecord): string {
901
+ function renderPlanRow(plan: GovernorPlanRecord): string {
872
902
  const review = plan.review ? ` review:${plan.review.status}` : "";
873
903
  return `${plan.request.id} ${plan.status.padEnd(18)} ${plan.request.prior_root_work_id}${review}`;
874
904
  }
@@ -877,7 +907,7 @@ function delay(ms: number): Promise<void> {
877
907
  return new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
878
908
  }
879
909
 
880
- function withSupervisorRoot(emit: EmitContext, fn: (coordRoot: string) => void): void {
910
+ function withGovernorRoot(emit: EmitContext, fn: (coordRoot: string) => void): void {
881
911
  const coordRoot = findCoordRoot();
882
912
  if (!coordRoot) {
883
913
  emit.error({
@@ -890,12 +920,12 @@ function withSupervisorRoot(emit: EmitContext, fn: (coordRoot: string) => void):
890
920
  try {
891
921
  fn(coordRoot);
892
922
  } catch (error) {
893
- emit.error({ code: "supervisor_failed", message: (error as Error).message });
923
+ emit.error({ code: "governor_failed", message: (error as Error).message });
894
924
  emit.setExitCode(1);
895
925
  }
896
926
  }
897
927
 
898
- async function withSupervisorRootAsync(
928
+ async function withGovernorRootAsync(
899
929
  emit: EmitContext,
900
930
  fn: (coordRoot: string) => Promise<void>,
901
931
  ): Promise<void> {
@@ -911,7 +941,7 @@ async function withSupervisorRootAsync(
911
941
  try {
912
942
  await fn(coordRoot);
913
943
  } catch (error) {
914
- emit.error({ code: "supervisor_failed", message: (error as Error).message });
944
+ emit.error({ code: "governor_failed", message: (error as Error).message });
915
945
  emit.setExitCode(1);
916
946
  }
917
947
  }