@interf/compiler 0.13.0 → 0.16.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 (292) hide show
  1. package/README.md +40 -0
  2. package/agent-skills/interf-actions/SKILL.md +51 -5
  3. package/agent-skills/interf-actions/references/cli.md +82 -82
  4. package/dist/cli/commands/agents.d.ts +2 -0
  5. package/dist/cli/commands/agents.js +213 -0
  6. package/dist/cli/commands/compile.js +10 -1
  7. package/dist/cli/commands/doctor.js +1 -1
  8. package/dist/cli/commands/login.js +1 -1
  9. package/dist/cli/commands/logout.js +1 -1
  10. package/dist/cli/commands/mcp.d.ts +42 -0
  11. package/dist/cli/commands/mcp.js +239 -0
  12. package/dist/cli/commands/method.js +1 -1
  13. package/dist/cli/commands/prep.js +23 -5
  14. package/dist/cli/commands/reset.js +1 -1
  15. package/dist/cli/commands/runs.js +1 -1
  16. package/dist/cli/commands/status.js +1 -1
  17. package/dist/cli/commands/verify.d.ts +8 -0
  18. package/dist/cli/commands/{test.js → verify.js} +24 -18
  19. package/dist/cli/commands/web.js +71 -18
  20. package/dist/cli/commands/wizard.js +373 -126
  21. package/dist/cli/index.d.ts +4 -2
  22. package/dist/cli/index.js +7 -3
  23. package/dist/compiler-ui/404.html +1 -1
  24. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  25. package/dist/compiler-ui/__next._full.txt +3 -3
  26. package/dist/compiler-ui/__next._head.txt +1 -1
  27. package/dist/compiler-ui/__next._index.txt +2 -2
  28. package/dist/compiler-ui/__next._tree.txt +2 -2
  29. package/dist/compiler-ui/_next/static/chunks/{17t-lulmyawg5.js → 0jipmpez3_ehh.js} +16 -16
  30. package/dist/compiler-ui/_next/static/chunks/{045gole2ojo3g.css → 13awzu4tooflw.css} +1 -1
  31. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  32. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  33. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  34. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  35. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  36. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  37. package/dist/compiler-ui/_not-found.html +1 -1
  38. package/dist/compiler-ui/_not-found.txt +2 -2
  39. package/dist/compiler-ui/index.html +1 -1
  40. package/dist/compiler-ui/index.txt +3 -3
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +2 -2
  43. package/dist/packages/contracts/index.d.ts +2 -1
  44. package/dist/packages/contracts/index.js +1 -0
  45. package/dist/packages/contracts/lib/schema.d.ts +102 -8
  46. package/dist/packages/contracts/lib/schema.js +102 -2
  47. package/dist/packages/{local-service → engine}/action-definitions.js +8 -1
  48. package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
  49. package/dist/packages/{local-service → engine}/action-planner.js +1 -1
  50. package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
  51. package/dist/packages/{agents → engine/agents}/index.js +3 -0
  52. package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
  53. package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
  54. package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
  55. package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
  56. package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +4 -4
  57. package/dist/packages/{agents → engine/agents}/lib/shells.js +8 -8
  58. package/dist/packages/{agents → engine/agents}/lib/user-config.js +2 -2
  59. package/dist/packages/engine/agents/registry.d.ts +91 -0
  60. package/dist/packages/engine/agents/registry.js +321 -0
  61. package/dist/packages/engine/agents/role-executors.d.ts +35 -0
  62. package/dist/packages/engine/agents/role-executors.js +88 -0
  63. package/dist/packages/engine/agents/role-router.d.ts +66 -0
  64. package/dist/packages/engine/agents/role-router.js +73 -0
  65. package/dist/packages/{local-service → engine}/client.d.ts +9 -9
  66. package/dist/packages/{local-service → engine}/client.js +11 -11
  67. package/dist/packages/{compiler → engine/compile}/artifact-counts.js +1 -1
  68. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
  69. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +16 -6
  70. package/dist/packages/{compiler → engine/compile}/compiled-schema.d.ts +2 -2
  71. package/dist/packages/{compiler → engine/compile}/compiled-schema.js +4 -4
  72. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +1 -1
  73. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +4 -4
  74. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
  75. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +3 -3
  76. package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +2 -2
  77. package/dist/packages/{compiler → engine/compile}/compiled-target.js +2 -2
  78. package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
  79. package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +4 -4
  80. package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -2
  81. package/dist/packages/{compiler → engine/compile}/method-runs.d.ts +3 -3
  82. package/dist/packages/{compiler → engine/compile}/method-runs.js +3 -3
  83. package/dist/packages/{compiler → engine/compile}/runtime-acceptance.js +17 -14
  84. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
  85. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +12 -10
  86. package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
  87. package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -43
  88. package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +1 -5
  89. package/dist/packages/{compiler → engine/compile}/runtime.d.ts +2 -2
  90. package/dist/packages/{compiler → engine/compile}/runtime.js +1 -1
  91. package/dist/packages/{compiler → engine/compile}/source-files.d.ts +1 -1
  92. package/dist/packages/{compiler → engine/compile}/source-files.js +3 -3
  93. package/dist/packages/{compiler → engine/compile}/state-health.js +2 -2
  94. package/dist/packages/{compiler → engine/compile}/state-io.js +2 -2
  95. package/dist/packages/{compiler → engine/compile}/state-view.js +2 -2
  96. package/dist/packages/{compiler → engine/compile}/validate-compiled.js +2 -2
  97. package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
  98. package/dist/packages/{compiler → engine/compile}/validate.js +3 -3
  99. package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +2 -22
  100. package/dist/packages/{execution → engine/execution}/lib/schema.js +2 -2
  101. package/dist/packages/{local-service → engine}/index.d.ts +4 -4
  102. package/dist/packages/{local-service → engine}/index.js +2 -2
  103. package/dist/packages/{local-service → engine}/lib/schema.d.ts +85 -209
  104. package/dist/packages/{local-service → engine}/lib/schema.js +58 -54
  105. package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
  106. package/dist/packages/{local-service → engine}/native-run-handlers.js +69 -25
  107. package/dist/packages/{local-service → engine}/preparation-store.d.ts +16 -4
  108. package/dist/packages/{local-service → engine}/preparation-store.js +48 -25
  109. package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
  110. package/dist/packages/{local-service → engine}/routes.d.ts +30 -1
  111. package/dist/packages/{local-service → engine}/routes.js +32 -1
  112. package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
  113. package/dist/packages/{local-service → engine}/run-observability.js +14 -13
  114. package/dist/packages/{local-service → engine}/runtime-event-applier.d.ts +1 -1
  115. package/dist/packages/{local-service → engine}/runtime-persistence.d.ts +6 -6
  116. package/dist/packages/{local-service → engine}/runtime-persistence.js +9 -9
  117. package/dist/packages/{local-service → engine}/runtime-proposal-helpers.d.ts +1 -1
  118. package/dist/packages/{local-service → engine}/runtime-proposal-helpers.js +5 -5
  119. package/dist/packages/{local-service → engine}/runtime-resource-builders.d.ts +6 -6
  120. package/dist/packages/{local-service → engine}/runtime-resource-builders.js +1 -1
  121. package/dist/packages/{local-service → engine}/runtime.d.ts +80 -49
  122. package/dist/packages/{local-service → engine}/runtime.js +177 -179
  123. package/dist/packages/{local-service → engine}/server.js +276 -14
  124. package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +1 -1
  125. package/dist/packages/{testing → engine/verify}/lib/schema.js +1 -1
  126. package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +6 -13
  127. package/dist/packages/{testing → engine/verify}/readiness-check-run.js +25 -81
  128. package/dist/packages/{testing → engine/verify}/test-paths.js +2 -2
  129. package/dist/packages/{testing → engine/verify}/test-sandbox.js +6 -6
  130. package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
  131. package/dist/packages/{testing → engine/verify}/test-targets.js +3 -3
  132. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +11 -3
  133. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +68 -5
  134. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
  135. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
  136. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +15 -9
  137. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +1 -1
  138. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +2 -2
  139. package/dist/packages/{method-package → methods/package}/context-interface.d.ts +1 -1
  140. package/dist/packages/{method-package → methods/package}/context-interface.js +3 -3
  141. package/dist/packages/{method-package → methods/package}/interf-method-package.js +3 -2
  142. package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
  143. package/dist/packages/{method-package → methods/package}/local-methods.d.ts +8 -2
  144. package/dist/packages/{method-package → methods/package}/local-methods.js +8 -7
  145. package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +8 -2
  146. package/dist/packages/{method-package → methods/package}/method-definitions.js +5 -4
  147. package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +1 -1
  148. package/dist/packages/{method-package → methods/package}/method-helpers.js +4 -4
  149. package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
  150. package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
  151. package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
  152. package/dist/packages/{method-package → methods/package}/method-stage-runner.js +1 -29
  153. package/dist/packages/{method-package → methods/package}/user-methods.js +2 -2
  154. package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
  155. package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
  156. package/dist/packages/{project-model → project}/interf-detect.js +4 -4
  157. package/dist/packages/{project-model → project}/interf-scaffold.js +7 -7
  158. package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
  159. package/dist/packages/{project-model → project}/lib/schema.js +1 -1
  160. package/dist/packages/{project-model → project}/source-config.d.ts +1 -1
  161. package/dist/packages/{project-model → project}/source-config.js +7 -7
  162. package/dist/packages/{project-model → project}/source-folders.js +2 -2
  163. package/package.json +6 -5
  164. package/dist/cli/commands/test.d.ts +0 -9
  165. package/dist/packages/agents/lib/detection.d.ts +0 -7
  166. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
  167. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
  168. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → a3UiUF0DiMEbfWy_0gihg}/_ssgManifest.js +0 -0
  169. /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
  170. /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
  171. /package/dist/packages/{shared → contracts/utils}/filesystem.d.ts +0 -0
  172. /package/dist/packages/{shared → contracts/utils}/filesystem.js +0 -0
  173. /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
  174. /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
  175. /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
  176. /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
  177. /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
  178. /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
  179. /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
  180. /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
  181. /package/dist/packages/{local-service → engine}/action-definitions.d.ts +0 -0
  182. /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
  183. /package/dist/packages/{local-service → engine}/action-values.js +0 -0
  184. /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
  185. /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
  186. /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
  187. /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
  188. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
  189. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
  190. /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
  191. /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
  192. /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
  193. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
  194. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
  195. /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
  196. /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
  197. /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
  198. /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
  199. /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
  200. /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
  201. /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
  202. /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
  203. /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
  204. /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
  205. /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
  206. /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
  207. /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
  208. /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
  209. /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
  210. /package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +0 -0
  211. /package/dist/packages/{compiler → engine/compile}/artifact-counts.d.ts +0 -0
  212. /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
  213. /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
  214. /package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +0 -0
  215. /package/dist/packages/{compiler → engine/compile}/compiled-paths.js +0 -0
  216. /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
  217. /package/dist/packages/{compiler → engine/compile}/index.d.ts +0 -0
  218. /package/dist/packages/{compiler → engine/compile}/index.js +0 -0
  219. /package/dist/packages/{compiler → engine/compile}/method-primitives.d.ts +0 -0
  220. /package/dist/packages/{compiler → engine/compile}/method-primitives.js +0 -0
  221. /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
  222. /package/dist/packages/{compiler → engine/compile}/reset.js +0 -0
  223. /package/dist/packages/{compiler → engine/compile}/runtime-acceptance.d.ts +0 -0
  224. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
  225. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +0 -0
  226. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
  227. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
  228. /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
  229. /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
  230. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
  231. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +0 -0
  232. /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
  233. /package/dist/packages/{compiler → engine/compile}/state-artifacts.d.ts +0 -0
  234. /package/dist/packages/{compiler → engine/compile}/state-artifacts.js +0 -0
  235. /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
  236. /package/dist/packages/{compiler → engine/compile}/state-io.d.ts +0 -0
  237. /package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +0 -0
  238. /package/dist/packages/{compiler → engine/compile}/state-paths.js +0 -0
  239. /package/dist/packages/{compiler → engine/compile}/state-view.d.ts +0 -0
  240. /package/dist/packages/{compiler → engine/compile}/state.d.ts +0 -0
  241. /package/dist/packages/{compiler → engine/compile}/state.js +0 -0
  242. /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
  243. /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
  244. /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
  245. /package/dist/packages/{local-service → engine}/connection-config.d.ts +0 -0
  246. /package/dist/packages/{local-service → engine}/connection-config.js +0 -0
  247. /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
  248. /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
  249. /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
  250. /package/dist/packages/{execution → engine/execution}/events.js +0 -0
  251. /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
  252. /package/dist/packages/{execution → engine/execution}/index.js +0 -0
  253. /package/dist/packages/{local-service → engine}/instance-paths.d.ts +0 -0
  254. /package/dist/packages/{local-service → engine}/instance-paths.js +0 -0
  255. /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
  256. /package/dist/packages/{local-service → engine}/runtime-caches.d.ts +0 -0
  257. /package/dist/packages/{local-service → engine}/runtime-caches.js +0 -0
  258. /package/dist/packages/{local-service → engine}/runtime-event-applier.js +0 -0
  259. /package/dist/packages/{local-service → engine}/server.d.ts +0 -0
  260. /package/dist/packages/{local-service → engine}/service-registry.d.ts +0 -0
  261. /package/dist/packages/{local-service → engine}/service-registry.js +0 -0
  262. /package/dist/packages/{testing → engine/verify}/index.d.ts +0 -0
  263. /package/dist/packages/{testing → engine/verify}/index.js +0 -0
  264. /package/dist/packages/{testing → engine/verify}/test-execution.d.ts +0 -0
  265. /package/dist/packages/{testing → engine/verify}/test-execution.js +0 -0
  266. /package/dist/packages/{testing → engine/verify}/test-paths.d.ts +0 -0
  267. /package/dist/packages/{testing → engine/verify}/test-profile-presets.d.ts +0 -0
  268. /package/dist/packages/{testing → engine/verify}/test-profile-presets.js +0 -0
  269. /package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -0
  270. /package/dist/packages/{testing → engine/verify}/test-specs.d.ts +0 -0
  271. /package/dist/packages/{testing → engine/verify}/test-targets.d.ts +0 -0
  272. /package/dist/packages/{testing → engine/verify}/test-types.d.ts +0 -0
  273. /package/dist/packages/{testing → engine/verify}/test-types.js +0 -0
  274. /package/dist/packages/{testing → engine/verify}/test.d.ts +0 -0
  275. /package/dist/packages/{testing → engine/verify}/test.js +0 -0
  276. /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
  277. /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
  278. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
  279. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
  280. /package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +0 -0
  281. /package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +0 -0
  282. /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
  283. /package/dist/packages/{method-package → methods/package}/user-methods.d.ts +0 -0
  284. /package/dist/packages/{project-model → project}/index.d.ts +0 -0
  285. /package/dist/packages/{project-model → project}/index.js +0 -0
  286. /package/dist/packages/{project-model → project}/interf-detect.d.ts +0 -0
  287. /package/dist/packages/{project-model → project}/interf-scaffold.d.ts +0 -0
  288. /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
  289. /package/dist/packages/{project-model → project}/interf.js +0 -0
  290. /package/dist/packages/{project-model → project}/preparation-entries.d.ts +0 -0
  291. /package/dist/packages/{project-model → project}/preparation-entries.js +0 -0
  292. /package/dist/packages/{project-model → project}/source-folders.d.ts +0 -0
package/README.md CHANGED
@@ -152,6 +152,43 @@ When the first compile run still misses readiness checks, Interf edits the Metho
152
152
 
153
153
  Interf saves every readiness-check run inside the preparation's portable context under `.interf/tests/`. You can inspect what changed and why a later compile run did better.
154
154
 
155
+ ## How Interf Compiles
156
+
157
+ You don't need to think about roles. By default Interf uses your active agent for every stage of every compile run, the same way 0.14 did. Roles are available for advanced users who want different agents per stage; defaults are good and stable.
158
+
159
+ Interf treats connected agents as a first-class primitive and uses a small role taxonomy internally to route stages between them. The default behavior is single-active-agent — one installed agent runs everything — but you can opt into per-role specialization without changing any Method.
160
+
161
+ ```text
162
+ Connected agents Role map (per-instance)
163
+ claude-code (active) extractor → claude-code
164
+ codex summarizer → claude-code
165
+ pdf-extract (custom) structurer → claude-code
166
+ verifier → claude-code
167
+ general → claude-code
168
+
169
+ A Method compile run
170
+ for each stage in the Method
171
+ look up the stage's role in the role map
172
+ invoke the mapped agent on the prepared shell
173
+ record which agent ran which stage
174
+ ```
175
+
176
+ Methods declare an optional `role` per stage — one of `extractor`, `summarizer`, `structurer`, `verifier`, or `general`. Custom role names are allowed; unknown roles fall through to `general`.
177
+
178
+ The role map lives in `~/.interf/agents.json`. On a fresh install with one agent installed, every role maps to that agent and you get the same single-active-agent behavior 0.14 had. To change which agent runs which role:
179
+
180
+ ```bash
181
+ interf agents ls
182
+ interf agents register opencode --command "opencode --prompt"
183
+ interf agents map structurer codex
184
+ interf agents use claude-code # set the active agent
185
+ interf agents unmap structurer # fall back to active
186
+ ```
187
+
188
+ Or use the **Agents** tab in Interf Compiler UI. Either surface mutates the same `~/.interf/agents.json` through the local service.
189
+
190
+ Verify runs always resolve to the `verifier` role. Method-authoring runs ask the authoring agent to propose a `role` per stage based on the prompt content; missing roles default to `general`.
191
+
155
192
  ## How the Pieces Fit
156
193
 
157
194
  The instance owns preparation state. A preparation declares a source binding (`{ kind: "local-folder", locator: <path> }`) and a method id; the instance stores its config at `~/.interf/preparations/<prep-id>/config.json` and writes portable context to `~/.interf/preparations/<prep-id>/portable-context/`. A compile run processes the selected source files and produces the artifact locator the API returns. `interf test` checks Source Folder files and portable context against the same readiness checks.
@@ -160,6 +197,8 @@ Readiness is one `ready` / `not ready` status, not a separate score. Interf buil
160
197
 
161
198
  `interf web` runs the local Interf instance and serves Interf Compiler UI. The UI reads local-service resources: Source Files, Methods, runs, stages, proof, artifacts, readiness checks, and whether portable context is `ready` or `not ready`. It renders local instance state; it does not own compiler, Method, or readiness semantics.
162
199
 
200
+ Everywhere Interf shows a resource — Source Folder, portable context, Method files, run artifacts — the API returns a single locator shape: `{ kind, value }`. `local-path` means the engine has filesystem access to the same host as the user; `remote-url` is a signed URL the UI opens in a browser tab; `api-served` is a relative API route the UI fetches and renders inline. Local engines today return `local-path`; the same shape carries forward unchanged when a remote instance fronts the API.
201
+
163
202
  ## CLI Connection
164
203
 
165
204
  The CLI is a thin authorized client of one connected instance. It carries one piece of state — `~/.interf/connection.json`:
@@ -247,6 +286,7 @@ A maintained public test example uses this preparation:
247
286
  - `interf compile <prep-id>` — build portable context, returns the artifact locator
248
287
  - `interf test <prep-id>` — run readiness checks against source files and/or portable context
249
288
  - `interf method ls / install / draft / improve` — manage Method packages
289
+ - `interf agents ls / use / register / unregister / map / unmap` — manage connected agents and the role map
250
290
  - `interf runs ls / status / watch / cancel / fetch` — inspect runs
251
291
  - `interf login / logout` — manage `~/.interf/connection.json` (remote backend ships in a future release)
252
292
  - `interf status` — show the active connection and a preparation summary
@@ -61,6 +61,21 @@ interf login --url <…> # remote: writes connection.json
61
61
  interf method improve <prep-id>
62
62
  ```
63
63
 
64
+ ## Connected agents and the role map
65
+
66
+ Interf treats the agents it can shell out to (Claude Code, Codex, custom CLIs) as a first-class primitive. `GET /v1/instance` reports `agent_count` and `default_agent`; if `agent_count` is `0`, **`interf compile` and `interf verify` will hard-error** — install one or register a custom CLI before retrying.
67
+
68
+ ```sh
69
+ interf agents ls # list registered + detected agents
70
+ interf agents use <name> # set the active agent (sweeps role map)
71
+ interf agents register <name> --command "<cmd>" # register a custom CLI
72
+ interf agents unregister <name> # remove a custom CLI
73
+ interf agents map <role> <agent> # pin a role to an agent
74
+ interf agents unmap <role> # fall back to the active agent
75
+ ```
76
+
77
+ Roles are: `extractor`, `summarizer`, `structurer`, `verifier`, `general` (Methods may declare custom names; the engine treats unknown roles as `general`). Default behavior is single-active-agent — every role maps to the same agent — so existing agent flows do not change unless the user opts into per-role specialization.
78
+
64
79
  ## Agent contract — flags every CLI run uses
65
80
 
66
81
  | Flag | What it controls | When the agent passes it |
@@ -82,6 +97,41 @@ interf login --url <…> # remote: writes connection.json
82
97
  - Propose the command first and wait for approval before running commands that write files, start runs, create Method packages, build portable context, or run readiness checks.
83
98
  - If the request is ambiguous, ask one concise clarification instead of guessing.
84
99
 
100
+ ## Show your work — always print the run URL
101
+
102
+ Interf Compiler UI is the user's verification surface. The agent does
103
+ the work; the user clicks a URL to see live trace, events, readiness,
104
+ and proof. **Whenever you kick off a run, print a deep-link to the run
105
+ page in the same message as the run id.** The user should never have
106
+ to navigate the UI manually to find what you just started.
107
+
108
+ The base URL is whatever `interf status` reports as the connected
109
+ instance (e.g. `http://127.0.0.1:4873` for a local engine,
110
+ `https://api.interf.cloud/...` for cloud). Append query params:
111
+
112
+ | Param | Value |
113
+ |---|---|
114
+ | `preparation` | the preparation id |
115
+ | `run` | the run id returned by the CLI |
116
+ | `runTab` | optional: `trace` (default), `events`, or `readiness` |
117
+
118
+ **Example output after `interf compile serge`:**
119
+
120
+ ```text
121
+ Started compile run compile_8x2abc...
122
+ Watch live: http://127.0.0.1:4873/?preparation=serge&run=compile_8x2abc...
123
+
124
+ I'll check status in a moment with `interf runs status compile_8x2abc...`.
125
+ ```
126
+
127
+ The same pattern applies to verify, method-improvement, and method-authoring
128
+ runs. When a run finishes, print the same URL with `runTab=readiness` so the
129
+ user can click through to the readiness summary.
130
+
131
+ The agent stays the executor; the URL is the user's "I can see what's
132
+ happening" handle. It also makes failures self-explanatory — when a run
133
+ errors, the user clicks through to the same trace the agent is reading.
134
+
85
135
  ## Reading the artifact locator
86
136
 
87
137
  `interf compile <prep-id>` prints a short multi-line block by default. The portable-context locator looks like one of:
@@ -111,11 +161,7 @@ Use these action types:
111
161
 
112
162
  Use `compile` when the user asks to prepare, build, or refresh portable context. Set `method` to the Method id and, if the request named one, `preparation` to the preparation id. CLI equivalent: `interf compile --method`.
113
163
 
114
- For a readiness-check proposal, set `values.mode` to:
115
-
116
- - `source-files` for source files only
117
- - `compiled` for portable context only
118
- - `both` for source files and portable context
164
+ Readiness-check proposals always run against the compiled portable context in 0.15+. The legacy `values.mode` field is gone — omit it from `test` proposals.
119
165
 
120
166
  Return this shape:
121
167
 
@@ -9,19 +9,21 @@ This snapshot is bundled with the `interf-actions` skill. The installed `interf`
9
9
  ```text
10
10
  interf
11
11
 
12
+ Open the interactive wizard (default when no subcommand is given)
13
+
12
14
  Commands:
13
- interf init Set up Interf or open the Preparation wizard
14
- interf compile Prepare files and write Portable Context agents can use
15
- interf test Run readiness checks against source files and Portable Context
16
- interf create [type] Create a Preparation or reusable Method
15
+ interf Open the interactive wizard (default when no subcommand is given) [default]
16
+ interf init Open the interactive wizard
17
+ interf compile <prep-id> Start a compile run for a preparation
18
+ interf verify <prep-id> Verify a preparation's claim-checks against its portable context
19
+ interf agents <subcommand> Manage connected agents and role mapping
17
20
  interf doctor Check local executor configuration before a real local run
18
- interf list List saved Preparations in this Source Folder
19
- interf list-methods List Methods available in this Source Folder (built-in + local drafts)
20
- interf method <subcommand> Manage Methods in your user library (install, publish, remove, list)
21
- interf runs <subcommand> Inspect, fetch, or cancel compile runs (status, watch, list, fetch, cancel)
22
- interf status Show deterministic health for the Portable Context agents use
23
- interf web [subcommand] Open Interf Compiler UI; manage the engine instance for this Workspace
24
- interf reset <scope> Reset generated Portable Context state while keeping source files and the local Method package
21
+ interf method <subcommand> Manage methods on the connected instance
22
+ interf mcp Run the Interf Model Context Protocol server (stdio by default).
23
+ interf runs <subcommand> Inspect runs on the connected instance
24
+ interf status Show connection + preparation summary
25
+ interf web [subcommand] Start / stop / inspect the Interf engine
26
+ interf reset <prep-id> Reset a preparation's compile output
25
27
  interf prep <subcommand> Manage preparations on the connected instance
26
28
  interf login Set the active Interf instance connection (URL + optional bearer token)
27
29
  interf logout Clear the active Interf instance connection
@@ -29,6 +31,8 @@ Commands:
29
31
  Options:
30
32
  --help Show help [boolean]
31
33
  --version Show version number [boolean]
34
+ --url Override the active connection URL [string]
35
+ --token Override the active bearer token [string]
32
36
  ```
33
37
 
34
38
  ## interf web
@@ -36,23 +40,18 @@ Options:
36
40
  ```text
37
41
  interf web [subcommand]
38
42
 
39
- Open Interf Compiler UI; manage the engine instance for this Workspace
43
+ Start / stop / inspect the Interf engine
40
44
 
41
45
  Commands:
42
- interf web stop Deregister this workspace from the engine instance (and shut it down if last)
43
- interf web status Show engine-instance status: registered workspaces, active runs, idle time
44
- interf web Start (or attach to) the engine instance for this Workspace and open Interf Compiler UI. Other CLI commands auto-start this in the backgrou
45
- nd — running it explicitly is only needed for the UI. [default]
46
+ interf web stop Stop the connected engine
47
+ interf web status Show engine status via the connected URL
48
+ interf web Start the engine in the foreground (default) [default]
46
49
 
47
50
  Options:
48
- --help Show help [boolean]
49
- --version Show version number [boolean]
50
- --host Host for the local Interf service (only when starting a fresh instance) [string]
51
- --port Port for the local Interf service (only when starting a fresh instance) [number]
52
- --control-path Folder where Interf stores local config, Methods, runs, and portable context [string]
53
- --source-folder Source Folder to prepare when initializing a new Interf Workspace [string]
54
- --background Run as the detached background instance the auto-bootstrap path uses; suppresses interactive hints. Set INTERF_WEB_NO_AUTOSTART=1 to disable
55
- auto-start. [boolean] [default: false]
51
+ --help Show help [boolean]
52
+ --version Show version number [boolean]
53
+ --host Host to bind [string] [default: "127.0.0.1"]
54
+ --port Port to bind [number] [default: 4873]
56
55
  ```
57
56
 
58
57
  ## interf prep
@@ -63,10 +62,11 @@ interf prep <subcommand>
63
62
  Manage preparations on the connected instance
64
63
 
65
64
  Commands:
66
- interf prep ls List preparations
67
- interf prep create <prep-id> Create a preparation
68
- interf prep show <prep-id> Show a preparation's full record
69
- interf prep rm <prep-id> Delete a preparation
65
+ interf prep ls List preparations
66
+ interf prep create <prep-id> Create a preparation (method binding optional — set later if you don't have one yet)
67
+ interf prep set-method <prep-id> <method-id> Bind a method to a preparation (or change which method it uses)
68
+ interf prep show <prep-id> Show a preparation's full record
69
+ interf prep rm <prep-id> Delete a preparation
70
70
 
71
71
  Options:
72
72
  --help Show help [boolean]
@@ -78,45 +78,38 @@ Options:
78
78
  ## interf compile
79
79
 
80
80
  ```text
81
- interf compile
81
+ interf compile <prep-id>
82
+
83
+ Start a compile run for a preparation
82
84
 
83
- Prepare files and write Portable Context agents can use
85
+ Positionals:
86
+ prep-id Preparation id [string] [required]
84
87
 
85
88
  Options:
86
- --help Show help [boolean]
87
- --version Show version number [boolean]
88
- --method Method id to compile against this Source Folder. Resolves to the saved Preparation that uses this Method, or asks if more than one bindin
89
- g exists. [string]
90
- --preparation Saved Preparation id to compile (advanced; use --method for the Method-first form). [string]
91
- --max-attempts Retry the compile run and run saved readiness checks with the same Method until the Preparation is ready or reaches this total attempt li
92
- mit [number]
93
- --max-loops After retries fail, let Interf edit the Method and run saved readiness checks on new Method variations for this Preparation up to this lo
94
- op limit [number]
95
- --keep-stage-shells Keep every executed stage shell under .interf/runtime/execution-shells for review instead of pruning successful shells
96
- [boolean] [default: false]
97
- --auto-create When --method has no matching saved Preparation: --auto-create creates one without prompting; --no-auto-create refuses to create. Default
98
- : prompt on TTY, auto-create otherwise. [boolean]
99
- --source Source Folder path the auto-created Preparation should bind to. Relative paths resolve against --workspace. Default: '.'. [string]
100
- --as Name to use when auto-creating a Preparation. The portable context lands at <workspace>/<as>/. Default: derived from --method id.[string]
101
- --watch Block until the compile run finishes; tail stage status. Default is async return-with-id (use `interf runs status <id>` to check later).
102
- [boolean] [default: false]
103
- --idempotency-key Opaque key sent as X-Interf-Idempotency-Key. The local service caches the key for an hour and returns the original run id on retries inst
104
- ead of starting a fresh run. [string]
89
+ --help Show help [boolean]
90
+ --version Show version number [boolean]
91
+ --watch Stream run events [boolean] [default: false]
92
+ --quiet Print only the portable-context locator on success [boolean] [default: false]
93
+ --idempotency-key Client-supplied dedupe key [string]
94
+ --url Override the active connection URL [string]
95
+ --token Override the active bearer token [string]
105
96
  ```
106
97
 
107
- ## interf test
98
+ ## interf verify
108
99
 
109
100
  ```text
110
- interf test
101
+ interf verify <prep-id>
111
102
 
112
- Run readiness checks against source files and Portable Context
103
+ Verify a preparation's claim-checks against its portable context
104
+
105
+ Positionals:
106
+ prep-id Preparation id [string] [required]
113
107
 
114
108
  Options:
115
- --help Show help [boolean]
116
- --version Show version number [boolean]
117
- --preparation Preparation id to check when this Source Folder has more than one Preparation [string]
118
- --target Check source files, Portable Context, or both. Default: both when Portable Context exists, otherwise source files.
119
- [choices: "both", "source-files", "portable-context"]
109
+ --help Show help [boolean]
110
+ --version Show version number [boolean]
111
+ --url Override the active connection URL [string]
112
+ --token Override the active bearer token [string]
120
113
  ```
121
114
 
122
115
  ## interf method
@@ -124,17 +117,19 @@ Options:
124
117
  ```text
125
118
  interf method <subcommand>
126
119
 
127
- Manage Methods in your user library (install, publish, remove, list)
120
+ Manage methods on the connected instance
128
121
 
129
122
  Commands:
130
- interf method install <path> Copy a Method package from a path into your user library at ~/.interf/methods/<id>/
131
- interf method publish <id> Promote a workspace draft Method to your user library at ~/.interf/methods/<id>/
132
- interf method remove <id> Remove a Method from your user library at ~/.interf/methods/<id>/
133
- interf method list List Methods installed in your user library at ~/.interf/methods/
123
+ interf method ls List methods on the instance
124
+ interf method install <path> Install a method package from a local folder
125
+ interf method draft <prep-id> Start a method-authoring run for a preparation
126
+ interf method improve <prep-id> Start a method-improvement run for a preparation
134
127
 
135
128
  Options:
136
129
  --help Show help [boolean]
137
130
  --version Show version number [boolean]
131
+ --url Override the active connection URL [string]
132
+ --token Override the active bearer token [string]
138
133
  ```
139
134
 
140
135
  ## interf runs
@@ -142,18 +137,19 @@ Options:
142
137
  ```text
143
138
  interf runs <subcommand>
144
139
 
145
- Inspect, fetch, or cancel compile runs (status, watch, list, fetch, cancel)
140
+ Inspect runs on the connected instance
146
141
 
147
142
  Commands:
148
- interf runs status <run-id> Show the current state of a compile run by id
149
- interf runs watch <run-id> Block until the named compile run finishes; tail stage status
150
- interf runs list List recent compile runs in this Workspace
151
- interf runs fetch <run-id> Copy the portable context produced by a compile run to <abs-path>
152
- interf runs cancel <run-id> Cancel an in-flight compile run
143
+ interf runs ls List runs (optionally filtered by preparation)
144
+ interf runs status <run-id> Show full record for a run
145
+ interf runs cancel <run-id> Cancel a running run
146
+ interf runs fetch <run-id> Download a run's portable context
153
147
 
154
148
  Options:
155
149
  --help Show help [boolean]
156
150
  --version Show version number [boolean]
151
+ --url Override the active connection URL [string]
152
+ --token Override the active bearer token [string]
157
153
  ```
158
154
 
159
155
  ## interf runs fetch
@@ -161,16 +157,17 @@ Options:
161
157
  ```text
162
158
  interf runs fetch <run-id>
163
159
 
164
- Copy the portable context produced by a compile run to <abs-path>
160
+ Download a run's portable context
165
161
 
166
162
  Positionals:
167
- run-id Compile run id to fetch [string] [required]
163
+ run-id Run id [string] [required]
168
164
 
169
165
  Options:
170
- --help Show help [boolean]
171
- --version Show version number [boolean]
172
- --to Absolute destination path. Must be empty or non-existent unless --overwrite is set. [string] [required]
173
- --overwrite Allow copying into a destination that already has files. [boolean] [default: false]
166
+ --help Show help [boolean]
167
+ --version Show version number [boolean]
168
+ --url Override the active connection URL [string]
169
+ --token Override the active bearer token [string]
170
+ --to Target path [string] [required]
174
171
  ```
175
172
 
176
173
  ## interf status
@@ -178,13 +175,13 @@ Options:
178
175
  ```text
179
176
  interf status
180
177
 
181
- Show deterministic health for the Portable Context agents use
178
+ Show connection + preparation summary
182
179
 
183
180
  Options:
184
- --help Show help [boolean]
185
- --version Show version number [boolean]
186
- --watch Poll the local Interf service for live run status [boolean] [default: false]
187
- --instance Show only engine-instance status (workspaces, runs, idle); skip workspace details [boolean] [default: false]
181
+ --help Show help [boolean]
182
+ --version Show version number [boolean]
183
+ --url Override the active connection URL [string]
184
+ --token Override the active bearer token [string]
188
185
  ```
189
186
 
190
187
  ## interf login
@@ -216,16 +213,19 @@ Options:
216
213
  ## interf reset
217
214
 
218
215
  ```text
219
- interf reset <scope>
216
+ interf reset <prep-id>
220
217
 
221
- Reset generated Portable Context state while keeping source files and the local Method package
218
+ Reset a preparation's compile output
222
219
 
223
220
  Positionals:
224
- scope [string] [required] [choices: "compile", "all"]
221
+ prep-id Preparation id [string] [required]
225
222
 
226
223
  Options:
227
224
  --help Show help [boolean]
228
225
  --version Show version number [boolean]
226
+ --mode Scope of the reset [string] [choices: "compile", "all"] [default: "compile"]
227
+ --url Override the active connection URL [string]
228
+ --token Override the active bearer token [string]
229
229
  ```
230
230
 
231
231
  ## interf doctor
@@ -0,0 +1,2 @@
1
+ import type { CommandModule } from "yargs";
2
+ export declare const agentsCommand: CommandModule;
@@ -0,0 +1,213 @@
1
+ /**
2
+ * `interf agents` — manage connected agents + role mapping.
3
+ *
4
+ * interf agents ls # list registered + detected
5
+ * interf agents use <name> # set active agent
6
+ * interf agents register <name> --command <cmd> [--display-name <s>]
7
+ * interf agents unregister <name> # custom CLIs only
8
+ * interf agents map <role> <agent> # pin a role to an agent
9
+ * interf agents unmap <role> # clear a role
10
+ *
11
+ * All subcommands hit the connected local service. They never touch
12
+ * `~/.interf/agents.json` directly — the service is the source of truth.
13
+ */
14
+ import chalk from "chalk";
15
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/engine/connection-config.js";
16
+ function resolveConnection(args) {
17
+ const conn = readActiveConnection({
18
+ urlOverride: args.url,
19
+ authTokenOverride: args.token,
20
+ });
21
+ if (!conn) {
22
+ console.error(CONNECT_OR_ERROR_HINT);
23
+ process.exit(1);
24
+ }
25
+ return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
26
+ }
27
+ async function callJson(url, token, init = {}) {
28
+ const headers = new Headers(init.headers ?? {});
29
+ if (token)
30
+ headers.set("authorization", `Bearer ${token}`);
31
+ if (init.body && !headers.has("content-type")) {
32
+ headers.set("content-type", "application/json");
33
+ }
34
+ const response = await fetch(url, { ...init, headers });
35
+ const raw = await response.text();
36
+ let body = null;
37
+ if (raw.length > 0) {
38
+ try {
39
+ body = JSON.parse(raw);
40
+ }
41
+ catch {
42
+ body = null;
43
+ }
44
+ }
45
+ return { status: response.status, body, raw };
46
+ }
47
+ function formatAgentLine(agent, registry) {
48
+ const isActive = agent.name === registry.active_agent?.name;
49
+ const sourceLabel = agent.source === "builtin" ? "builtin" : "user";
50
+ const activeMarker = isActive ? chalk.green(" (active)") : "";
51
+ const availabilityMarker = agent.available === false ? chalk.yellow(" (not installed)") : "";
52
+ return ` ${chalk.bold(agent.name)} ${chalk.dim(`[${sourceLabel}]`)} ${chalk.dim(agent.display_name)} — ${chalk.dim(agent.command)}${activeMarker}${availabilityMarker}`;
53
+ }
54
+ function printRegistry(registry) {
55
+ if (registry.agents.length === 0) {
56
+ console.log();
57
+ console.log(chalk.yellow(" No agents available."));
58
+ console.log();
59
+ console.log(" Install Claude Code, Codex, Gemini, or another agent CLI,");
60
+ console.log(" or register a custom CLI: `interf agents register <name> --command <cmd>`.");
61
+ console.log();
62
+ return;
63
+ }
64
+ console.log();
65
+ console.log(chalk.bold(" Connected agents"));
66
+ for (const agent of registry.agents) {
67
+ console.log(formatAgentLine(agent, registry));
68
+ }
69
+ if (Object.keys(registry.role_map).length > 0) {
70
+ console.log();
71
+ console.log(chalk.bold(" Role mapping"));
72
+ for (const [role, agentName] of Object.entries(registry.role_map)) {
73
+ console.log(` ${chalk.bold(role.padEnd(11))} → ${agentName}`);
74
+ }
75
+ }
76
+ console.log();
77
+ }
78
+ export const agentsCommand = {
79
+ command: "agents <subcommand>",
80
+ describe: "Manage connected agents and role mapping",
81
+ builder: (yargs) => yargs
82
+ .option("url", { type: "string", describe: "Override the active connection URL" })
83
+ .option("token", { type: "string", describe: "Override the active bearer token" })
84
+ .command("ls", "List registered + detected agents", (y) => y, async (args) => {
85
+ const { url, token } = resolveConnection(args);
86
+ const { status, body, raw } = await callJson(`${url}/v1/agents`, token);
87
+ if (status !== 200 || !body) {
88
+ console.error(chalk.red(`Failed to list agents (HTTP ${status}).`));
89
+ if (raw)
90
+ console.error(raw);
91
+ process.exit(1);
92
+ }
93
+ printRegistry(body);
94
+ })
95
+ .command("use <name>", "Set the active agent (mirrors to role_map.general + sweeps roles still on the prior active)", (y) => y.positional("name", {
96
+ type: "string",
97
+ demandOption: true,
98
+ describe: "Agent name (e.g. claude-code, codex, opencode)",
99
+ }), async (args) => {
100
+ const { url, token } = resolveConnection(args);
101
+ const { status, body, raw } = await callJson(`${url}/v1/executor`, token, {
102
+ method: "POST",
103
+ body: JSON.stringify({ agent: args.name }),
104
+ });
105
+ if (status !== 200 && status !== 202) {
106
+ console.error(chalk.red(`Failed to set active agent (HTTP ${status}).`));
107
+ if (raw)
108
+ console.error(raw);
109
+ process.exit(1);
110
+ }
111
+ const display = body?.executor?.display_name ?? args.name;
112
+ console.log(chalk.green(` Active agent: ${chalk.bold(display)}.`));
113
+ })
114
+ .command("register <name>", "Register a custom agent CLI", (y) => y
115
+ .positional("name", {
116
+ type: "string",
117
+ demandOption: true,
118
+ describe: "Agent name (lowercase identifier, e.g. opencode)",
119
+ })
120
+ .option("command", {
121
+ type: "string",
122
+ demandOption: true,
123
+ describe: "Command to invoke (e.g. \"opencode --prompt\")",
124
+ })
125
+ .option("display-name", {
126
+ type: "string",
127
+ describe: "Human-readable name (defaults to the agent name)",
128
+ }), async (args) => {
129
+ const { url, token } = resolveConnection(args);
130
+ const displayName = args.displayName ?? args.name;
131
+ const { status, body, raw } = await callJson(`${url}/v1/agents`, token, {
132
+ method: "POST",
133
+ body: JSON.stringify({
134
+ name: args.name,
135
+ display_name: displayName,
136
+ command: args.command,
137
+ }),
138
+ });
139
+ if (status !== 201 || !body) {
140
+ console.error(chalk.red(`Failed to register agent (HTTP ${status}).`));
141
+ if (raw)
142
+ console.error(raw);
143
+ process.exit(1);
144
+ }
145
+ console.log(chalk.green(` Registered ${chalk.bold(args.name)} → ${args.command}.`));
146
+ printRegistry(body);
147
+ })
148
+ .command("unregister <name>", "Unregister a custom agent (built-ins cannot be unregistered)", (y) => y.positional("name", {
149
+ type: "string",
150
+ demandOption: true,
151
+ describe: "Agent name to remove",
152
+ }), async (args) => {
153
+ const { url, token } = resolveConnection(args);
154
+ const { status, body, raw } = await callJson(`${url}/v1/agents/${encodeURIComponent(args.name)}`, token, { method: "DELETE" });
155
+ if (status !== 200 || !body) {
156
+ console.error(chalk.red(`Failed to unregister agent (HTTP ${status}).`));
157
+ if (raw)
158
+ console.error(raw);
159
+ process.exit(1);
160
+ }
161
+ console.log(chalk.green(` Unregistered ${chalk.bold(args.name)}.`));
162
+ printRegistry(body);
163
+ })
164
+ .command("map <role> <agent>", "Map a role to an agent", (y) => y
165
+ .positional("role", {
166
+ type: "string",
167
+ demandOption: true,
168
+ describe: "Role name (e.g. extractor, summarizer, verifier, general)",
169
+ })
170
+ .positional("agent", {
171
+ type: "string",
172
+ demandOption: true,
173
+ describe: "Agent name to bind to the role",
174
+ }), async (args) => {
175
+ const { url, token } = resolveConnection(args);
176
+ const patch = { [args.role]: args.agent };
177
+ const { status, body, raw } = await callJson(`${url}/v1/agents/role-map`, token, {
178
+ method: "PATCH",
179
+ body: JSON.stringify(patch),
180
+ });
181
+ if (status !== 200 || !body) {
182
+ console.error(chalk.red(`Failed to update role map (HTTP ${status}).`));
183
+ if (raw)
184
+ console.error(raw);
185
+ process.exit(1);
186
+ }
187
+ console.log(chalk.green(` Mapped ${chalk.bold(args.role)} → ${args.agent}.`));
188
+ })
189
+ .command("unmap <role>", "Clear a role mapping (falls back to active agent)", (y) => y.positional("role", {
190
+ type: "string",
191
+ demandOption: true,
192
+ describe: "Role name to clear",
193
+ }), async (args) => {
194
+ const { url, token } = resolveConnection(args);
195
+ const patch = { [args.role]: "" };
196
+ const { status, raw } = await callJson(`${url}/v1/agents/role-map`, token, {
197
+ method: "PATCH",
198
+ body: JSON.stringify(patch),
199
+ });
200
+ if (status !== 200) {
201
+ console.error(chalk.red(`Failed to clear role mapping (HTTP ${status}).`));
202
+ if (raw)
203
+ console.error(raw);
204
+ process.exit(1);
205
+ }
206
+ console.log(chalk.green(` Cleared role ${chalk.bold(args.role)}.`));
207
+ })
208
+ .demandCommand(1)
209
+ .strict(),
210
+ handler: () => {
211
+ /* yargs subcommand handlers do the work */
212
+ },
213
+ };