@interf/compiler 0.13.0 → 0.18.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 (320) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +50 -7
  3. package/TRADEMARKS.md +4 -4
  4. package/agent-skills/interf-actions/SKILL.md +51 -5
  5. package/agent-skills/interf-actions/references/cli.md +82 -82
  6. package/builtin-methods/interf-default/README.md +6 -7
  7. package/builtin-methods/interf-default/method.json +7 -68
  8. package/builtin-methods/interf-default/method.schema.json +52 -50
  9. package/dist/cli/commands/agents.d.ts +2 -0
  10. package/dist/cli/commands/agents.js +213 -0
  11. package/dist/cli/commands/compile.js +10 -1
  12. package/dist/cli/commands/doctor.js +1 -1
  13. package/dist/cli/commands/login.js +1 -1
  14. package/dist/cli/commands/logout.js +1 -1
  15. package/dist/cli/commands/mcp.d.ts +42 -0
  16. package/dist/cli/commands/mcp.js +239 -0
  17. package/dist/cli/commands/method.js +1 -1
  18. package/dist/cli/commands/prep.js +81 -7
  19. package/dist/cli/commands/reset.js +1 -1
  20. package/dist/cli/commands/runs.js +1 -1
  21. package/dist/cli/commands/status.js +1 -1
  22. package/dist/cli/commands/verify.d.ts +10 -0
  23. package/dist/cli/commands/{test.js → verify.js} +30 -15
  24. package/dist/cli/commands/web.js +71 -18
  25. package/dist/cli/commands/wizard.js +462 -107
  26. package/dist/cli/index.d.ts +4 -2
  27. package/dist/cli/index.js +7 -3
  28. package/dist/compiler-ui/404.html +1 -1
  29. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  30. package/dist/compiler-ui/__next._full.txt +3 -3
  31. package/dist/compiler-ui/__next._head.txt +1 -1
  32. package/dist/compiler-ui/__next._index.txt +2 -2
  33. package/dist/compiler-ui/__next._tree.txt +2 -2
  34. package/dist/compiler-ui/_next/static/chunks/{045gole2ojo3g.css → 0_c_tvh-cukjz.css} +1 -1
  35. package/dist/compiler-ui/_next/static/chunks/0f_geuwdesg_c.js +114 -0
  36. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  37. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  38. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  39. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  40. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  41. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  42. package/dist/compiler-ui/_not-found.html +1 -1
  43. package/dist/compiler-ui/_not-found.txt +2 -2
  44. package/dist/compiler-ui/index.html +1 -1
  45. package/dist/compiler-ui/index.txt +3 -3
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +2 -2
  48. package/dist/packages/contracts/index.d.ts +2 -1
  49. package/dist/packages/contracts/index.js +1 -0
  50. package/dist/packages/contracts/lib/schema.d.ts +324 -31
  51. package/dist/packages/contracts/lib/schema.js +281 -21
  52. package/dist/packages/{local-service → engine}/action-definitions.js +9 -2
  53. package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
  54. package/dist/packages/{local-service → engine}/action-planner.js +1 -1
  55. package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
  56. package/dist/packages/{agents → engine/agents}/index.js +3 -0
  57. package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
  58. package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
  59. package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
  60. package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
  61. package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +14 -6
  62. package/dist/packages/{agents → engine/agents}/lib/shells.js +133 -126
  63. package/dist/packages/{agents → engine/agents}/lib/user-config.js +2 -2
  64. package/dist/packages/engine/agents/registry.d.ts +91 -0
  65. package/dist/packages/engine/agents/registry.js +321 -0
  66. package/dist/packages/engine/agents/role-executors.d.ts +35 -0
  67. package/dist/packages/engine/agents/role-executors.js +88 -0
  68. package/dist/packages/engine/agents/role-router.d.ts +66 -0
  69. package/dist/packages/engine/agents/role-router.js +73 -0
  70. package/dist/packages/{local-service → engine}/client.d.ts +9 -9
  71. package/dist/packages/{local-service → engine}/client.js +11 -11
  72. package/dist/packages/engine/cloud-seams.d.ts +115 -0
  73. package/dist/packages/engine/cloud-seams.js +84 -0
  74. package/dist/packages/engine/compile/artifact-counts.d.ts +1 -0
  75. package/dist/packages/{compiler → engine/compile}/artifact-counts.js +4 -4
  76. package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
  77. package/dist/packages/engine/compile/artifact-status.js +166 -0
  78. package/dist/packages/engine/compile/billing-events.d.ts +89 -0
  79. package/dist/packages/engine/compile/billing-events.js +74 -0
  80. package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
  81. package/dist/packages/engine/compile/check-evaluator.js +298 -0
  82. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
  83. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +16 -6
  84. package/dist/packages/engine/compile/compiled-schema.d.ts +21 -0
  85. package/dist/packages/engine/compile/compiled-schema.js +126 -0
  86. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +2 -1
  87. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +35 -18
  88. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
  89. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +4 -4
  90. package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +2 -2
  91. package/dist/packages/{compiler → engine/compile}/compiled-target.js +2 -2
  92. package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
  93. package/dist/packages/{compiler → engine/compile}/index.d.ts +0 -1
  94. package/dist/packages/{compiler → engine/compile}/index.js +0 -1
  95. package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +113 -94
  96. package/dist/packages/{compiler → engine/compile}/lib/schema.js +35 -39
  97. package/dist/packages/engine/compile/method-primitives.d.ts +2 -0
  98. package/dist/packages/{compiler → engine/compile}/method-primitives.js +1 -1
  99. package/dist/packages/{compiler → engine/compile}/method-runs.d.ts +3 -3
  100. package/dist/packages/{compiler → engine/compile}/method-runs.js +3 -3
  101. package/dist/packages/{compiler → engine/compile}/reset.js +4 -4
  102. package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +2 -1
  103. package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +3 -2
  104. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
  105. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +47 -45
  106. package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
  107. package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -44
  108. package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +7 -12
  109. package/dist/packages/engine/compile/runtime.d.ts +5 -0
  110. package/dist/packages/{compiler → engine/compile}/runtime.js +1 -2
  111. package/dist/packages/{compiler → engine/compile}/source-files.d.ts +1 -1
  112. package/dist/packages/{compiler → engine/compile}/source-files.js +3 -3
  113. package/dist/packages/{compiler → engine/compile}/state-health.js +8 -8
  114. package/dist/packages/{compiler → engine/compile}/state-io.js +2 -2
  115. package/dist/packages/{compiler → engine/compile}/state-view.js +9 -8
  116. package/dist/packages/{compiler → engine/compile}/validate-compiled.js +63 -32
  117. package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
  118. package/dist/packages/{compiler → engine/compile}/validate.js +29 -27
  119. package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +81 -55
  120. package/dist/packages/{execution → engine/execution}/lib/schema.js +14 -6
  121. package/dist/packages/engine/index.d.ts +22 -0
  122. package/dist/packages/engine/index.js +15 -0
  123. package/dist/packages/{local-service → engine}/lib/schema.d.ts +620 -435
  124. package/dist/packages/{local-service → engine}/lib/schema.js +103 -63
  125. package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
  126. package/dist/packages/{local-service → engine}/native-run-handlers.js +81 -29
  127. package/dist/packages/{local-service → engine}/preparation-store.d.ts +22 -4
  128. package/dist/packages/{local-service → engine}/preparation-store.js +56 -25
  129. package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
  130. package/dist/packages/{local-service → engine}/routes.d.ts +36 -1
  131. package/dist/packages/{local-service → engine}/routes.js +38 -1
  132. package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
  133. package/dist/packages/{local-service → engine}/run-observability.js +15 -15
  134. package/dist/packages/{local-service → engine}/runtime-event-applier.d.ts +1 -1
  135. package/dist/packages/{local-service → engine}/runtime-event-applier.js +7 -0
  136. package/dist/packages/{local-service → engine}/runtime-persistence.d.ts +6 -6
  137. package/dist/packages/{local-service → engine}/runtime-persistence.js +9 -9
  138. package/dist/packages/{local-service → engine}/runtime-proposal-helpers.d.ts +1 -1
  139. package/dist/packages/{local-service → engine}/runtime-proposal-helpers.js +5 -5
  140. package/dist/packages/{local-service → engine}/runtime-resource-builders.d.ts +12 -12
  141. package/dist/packages/{local-service → engine}/runtime-resource-builders.js +6 -5
  142. package/dist/packages/{local-service → engine}/runtime.d.ts +147 -56
  143. package/dist/packages/{local-service → engine}/runtime.js +333 -205
  144. package/dist/packages/{local-service → engine}/server.d.ts +25 -0
  145. package/dist/packages/{local-service → engine}/server.js +338 -17
  146. package/dist/packages/engine/verify/index.d.ts +13 -0
  147. package/dist/packages/engine/verify/index.js +10 -0
  148. package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +1 -1
  149. package/dist/packages/{testing → engine/verify}/lib/schema.js +1 -1
  150. package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +27 -11
  151. package/dist/packages/{testing → engine/verify}/readiness-check-run.js +72 -60
  152. package/dist/packages/{testing/test-execution.d.ts → engine/verify/verify-execution.d.ts} +2 -2
  153. package/dist/packages/{testing/test-execution.js → engine/verify/verify-execution.js} +2 -2
  154. package/dist/packages/{testing/test-paths.d.ts → engine/verify/verify-paths.d.ts} +1 -1
  155. package/dist/packages/{testing/test-paths.js → engine/verify/verify-paths.js} +2 -2
  156. package/dist/packages/{testing/test-sandbox.d.ts → engine/verify/verify-sandbox.d.ts} +1 -1
  157. package/dist/packages/{testing/test-sandbox.js → engine/verify/verify-sandbox.js} +6 -6
  158. package/dist/packages/{testing/test-specs.d.ts → engine/verify/verify-specs.d.ts} +1 -1
  159. package/dist/packages/{testing/test-specs.js → engine/verify/verify-specs.js} +2 -2
  160. package/dist/packages/{testing/test-targets.d.ts → engine/verify/verify-targets.d.ts} +1 -1
  161. package/dist/packages/{testing/test-targets.js → engine/verify/verify-targets.js} +3 -3
  162. package/dist/packages/{testing/test.d.ts → engine/verify/verify.d.ts} +4 -4
  163. package/dist/packages/{testing/test.js → engine/verify/verify.js} +3 -3
  164. package/dist/packages/engine/wire-schemas.d.ts +545 -0
  165. package/dist/packages/engine/wire-schemas.js +59 -0
  166. package/dist/packages/methods/authoring/method-authoring.d.ts +34 -0
  167. package/dist/packages/methods/authoring/method-authoring.js +260 -0
  168. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
  169. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +5 -5
  170. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
  171. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +16 -10
  172. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +12 -12
  173. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +27 -24
  174. package/dist/packages/methods/package/context-interface.d.ts +73 -0
  175. package/dist/packages/{method-package → methods/package}/context-interface.js +50 -41
  176. package/dist/packages/{method-package → methods/package}/interf-method-package.js +31 -49
  177. package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
  178. package/dist/packages/{method-package → methods/package}/local-methods.d.ts +10 -5
  179. package/dist/packages/{method-package → methods/package}/local-methods.js +41 -68
  180. package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +11 -7
  181. package/dist/packages/{method-package → methods/package}/method-definitions.js +5 -8
  182. package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +1 -3
  183. package/dist/packages/{method-package → methods/package}/method-helpers.js +4 -8
  184. package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
  185. package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
  186. package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
  187. package/dist/packages/{method-package → methods/package}/method-stage-runner.js +1 -29
  188. package/dist/packages/{method-package → methods/package}/user-methods.js +2 -2
  189. package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
  190. package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
  191. package/dist/packages/{project-model → project}/interf-detect.js +4 -4
  192. package/dist/packages/{project-model → project}/interf-scaffold.js +18 -18
  193. package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
  194. package/dist/packages/{project-model → project}/lib/schema.js +1 -1
  195. package/dist/packages/{project-model → project}/source-config.d.ts +1 -1
  196. package/dist/packages/{project-model → project}/source-config.js +9 -8
  197. package/dist/packages/{project-model → project}/source-folders.js +2 -2
  198. package/package.json +7 -16
  199. package/dist/cli/commands/test.d.ts +0 -9
  200. package/dist/compiler-ui/_next/static/chunks/17t-lulmyawg5.js +0 -89
  201. package/dist/packages/agents/lib/detection.d.ts +0 -7
  202. package/dist/packages/compiler/artifact-counts.d.ts +0 -1
  203. package/dist/packages/compiler/compiled-schema.d.ts +0 -31
  204. package/dist/packages/compiler/compiled-schema.js +0 -141
  205. package/dist/packages/compiler/method-primitives.d.ts +0 -2
  206. package/dist/packages/compiler/runtime-acceptance.d.ts +0 -9
  207. package/dist/packages/compiler/runtime-acceptance.js +0 -262
  208. package/dist/packages/compiler/runtime.d.ts +0 -6
  209. package/dist/packages/local-service/index.d.ts +0 -22
  210. package/dist/packages/local-service/index.js +0 -15
  211. package/dist/packages/method-authoring/method-authoring.d.ts +0 -24
  212. package/dist/packages/method-authoring/method-authoring.js +0 -116
  213. package/dist/packages/method-package/context-interface.d.ts +0 -60
  214. package/dist/packages/testing/index.d.ts +0 -13
  215. package/dist/packages/testing/index.js +0 -10
  216. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_buildManifest.js +0 -0
  217. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_clientMiddlewareManifest.js +0 -0
  218. /package/dist/compiler-ui/_next/static/{C6vVfy3aeYuIO3d2AoNvC → 6qyE1u9m_oBUkvAhhoCmO}/_ssgManifest.js +0 -0
  219. /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
  220. /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
  221. /package/dist/packages/{shared → contracts/utils}/filesystem.d.ts +0 -0
  222. /package/dist/packages/{shared → contracts/utils}/filesystem.js +0 -0
  223. /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
  224. /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
  225. /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
  226. /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
  227. /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
  228. /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
  229. /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
  230. /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
  231. /package/dist/packages/{local-service → engine}/action-definitions.d.ts +0 -0
  232. /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
  233. /package/dist/packages/{local-service → engine}/action-values.js +0 -0
  234. /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
  235. /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
  236. /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
  237. /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
  238. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
  239. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
  240. /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
  241. /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
  242. /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
  243. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
  244. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
  245. /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
  246. /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
  247. /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
  248. /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
  249. /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
  250. /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
  251. /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
  252. /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
  253. /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
  254. /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
  255. /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
  256. /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
  257. /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
  258. /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
  259. /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
  260. /package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +0 -0
  261. /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
  262. /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
  263. /package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +0 -0
  264. /package/dist/packages/{compiler → engine/compile}/compiled-paths.js +0 -0
  265. /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
  266. /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
  267. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
  268. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
  269. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
  270. /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
  271. /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
  272. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
  273. /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
  274. /package/dist/packages/{compiler → engine/compile}/state-artifacts.d.ts +0 -0
  275. /package/dist/packages/{compiler → engine/compile}/state-artifacts.js +0 -0
  276. /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
  277. /package/dist/packages/{compiler → engine/compile}/state-io.d.ts +0 -0
  278. /package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +0 -0
  279. /package/dist/packages/{compiler → engine/compile}/state-paths.js +0 -0
  280. /package/dist/packages/{compiler → engine/compile}/state-view.d.ts +0 -0
  281. /package/dist/packages/{compiler → engine/compile}/state.d.ts +0 -0
  282. /package/dist/packages/{compiler → engine/compile}/state.js +0 -0
  283. /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
  284. /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
  285. /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
  286. /package/dist/packages/{local-service → engine}/connection-config.d.ts +0 -0
  287. /package/dist/packages/{local-service → engine}/connection-config.js +0 -0
  288. /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
  289. /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
  290. /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
  291. /package/dist/packages/{execution → engine/execution}/events.js +0 -0
  292. /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
  293. /package/dist/packages/{execution → engine/execution}/index.js +0 -0
  294. /package/dist/packages/{local-service → engine}/instance-paths.d.ts +0 -0
  295. /package/dist/packages/{local-service → engine}/instance-paths.js +0 -0
  296. /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
  297. /package/dist/packages/{local-service → engine}/runtime-caches.d.ts +0 -0
  298. /package/dist/packages/{local-service → engine}/runtime-caches.js +0 -0
  299. /package/dist/packages/{local-service → engine}/service-registry.d.ts +0 -0
  300. /package/dist/packages/{local-service → engine}/service-registry.js +0 -0
  301. /package/dist/packages/{testing/test-profile-presets.d.ts → engine/verify/verify-profile-presets.d.ts} +0 -0
  302. /package/dist/packages/{testing/test-profile-presets.js → engine/verify/verify-profile-presets.js} +0 -0
  303. /package/dist/packages/{testing/test-types.d.ts → engine/verify/verify-types.d.ts} +0 -0
  304. /package/dist/packages/{testing/test-types.js → engine/verify/verify-types.js} +0 -0
  305. /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
  306. /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
  307. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
  308. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
  309. /package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +0 -0
  310. /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
  311. /package/dist/packages/{method-package → methods/package}/user-methods.d.ts +0 -0
  312. /package/dist/packages/{project-model → project}/index.d.ts +0 -0
  313. /package/dist/packages/{project-model → project}/index.js +0 -0
  314. /package/dist/packages/{project-model → project}/interf-detect.d.ts +0 -0
  315. /package/dist/packages/{project-model → project}/interf-scaffold.d.ts +0 -0
  316. /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
  317. /package/dist/packages/{project-model → project}/interf.js +0 -0
  318. /package/dist/packages/{project-model → project}/preparation-entries.d.ts +0 -0
  319. /package/dist/packages/{project-model → project}/preparation-entries.js +0 -0
  320. /package/dist/packages/{project-model → project}/source-folders.d.ts +0 -0
@@ -0,0 +1,321 @@
1
+ /**
2
+ * Agents registry — `~/.interf/agents.json`.
3
+ *
4
+ * Reads / writes the persisted user-registered agents and the role-map.
5
+ * Built-in agents (Claude Code, Codex, Cursor) are NOT persisted; they
6
+ * are detected dynamically at read time and merged with the persisted
7
+ * custom agents. The role-map IS persisted.
8
+ *
9
+ * 0.15 contract:
10
+ * {
11
+ * "agents": [
12
+ * { "name": "opencode", "display_name": "OpenCode", "command": "opencode --prompt", "source": "user" }
13
+ * ],
14
+ * "role_map": {
15
+ * "extractor": "claude-code",
16
+ * "summarizer": "claude-code",
17
+ * "structurer": "claude-code",
18
+ * "verifier": "claude-code",
19
+ * "general": "claude-code"
20
+ * }
21
+ * }
22
+ */
23
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
24
+ import { join } from "node:path";
25
+ import { AgentRecordSchema, AgentsRegistrySchema, CANONICAL_ROLES, } from "../../contracts/lib/schema.js";
26
+ import { readJsonFileWithSchema } from "../../contracts/utils/parse.js";
27
+ import { interfHomeRoot } from "../instance-paths.js";
28
+ import { agentCommandAvailable, detectAgents, supportsAutomatedRuns } from "./lib/detection.js";
29
+ import { AGENTS } from "./lib/constants.js";
30
+ export const AGENTS_REGISTRY_FILENAME = "agents.json";
31
+ /** `~/.interf/agents.json` — persisted custom agents + role-map. */
32
+ export function agentsRegistryPath() {
33
+ return join(interfHomeRoot(), AGENTS_REGISTRY_FILENAME);
34
+ }
35
+ /**
36
+ * Load just the persisted on-disk part of the registry. Built-in agents
37
+ * are NOT included — call `loadAgentsRegistry()` for the merged view.
38
+ *
39
+ * Returns `{ agents: [], role_map: {} }` when the file is missing or
40
+ * unreadable; persisted custom agents always have `source: "user"`.
41
+ */
42
+ export function loadPersistedRegistry() {
43
+ const path = agentsRegistryPath();
44
+ if (!existsSync(path)) {
45
+ return AgentsRegistrySchema.parse({});
46
+ }
47
+ const value = readJsonFileWithSchema(path, "agents registry", AgentsRegistrySchema);
48
+ return value ?? AgentsRegistrySchema.parse({});
49
+ }
50
+ /** Persist the on-disk part of the registry (custom agents + role-map). */
51
+ export function savePersistedRegistry(registry) {
52
+ const home = interfHomeRoot();
53
+ mkdirSync(home, { recursive: true });
54
+ const sanitized = {
55
+ agents: registry.agents.map(({ available: _available, ...agent }) => AgentRecordSchema.parse({ ...agent, source: "user" })),
56
+ role_map: { ...registry.role_map },
57
+ };
58
+ writeFileSync(agentsRegistryPath(), `${JSON.stringify(sanitized, null, 2)}\n`);
59
+ }
60
+ /**
61
+ * Detect built-in agents present on this machine. Filtered to agents
62
+ * whose marker home directory exists; we do NOT require the command
63
+ * to be on PATH at registry read time — that's a runtime concern.
64
+ */
65
+ export function detectBuiltinAgentRecords() {
66
+ return detectAgents().map((agent) => AgentRecordSchema.parse({
67
+ name: agent.name,
68
+ display_name: agent.displayName,
69
+ command: agent.command,
70
+ source: "builtin",
71
+ }));
72
+ }
73
+ /**
74
+ * Same as `detectBuiltinAgentRecords()` but only includes agents the
75
+ * current Interf build can fully drive (Claude Code, Codex). Used by
76
+ * the role-router and the CLI / UI listing as the "available agents"
77
+ * set.
78
+ */
79
+ export function detectAutomatableBuiltinAgentRecords() {
80
+ return detectAgents()
81
+ .filter(supportsAutomatedRuns)
82
+ .map((agent) => AgentRecordSchema.parse({
83
+ name: agent.name,
84
+ display_name: agent.displayName,
85
+ command: agent.command,
86
+ source: "builtin",
87
+ }));
88
+ }
89
+ /**
90
+ * Full advertisement set — all built-in agents Interf knows about,
91
+ * regardless of whether they are installed locally. Used by the
92
+ * "install cards" zero-state surface so the UI / wizard can offer
93
+ * the user choices to install.
94
+ */
95
+ export function listKnownBuiltinAgents() {
96
+ return AGENTS.map((agent) => AgentRecordSchema.parse({
97
+ name: agent.name,
98
+ display_name: agent.displayName,
99
+ command: agent.command,
100
+ source: "builtin",
101
+ }));
102
+ }
103
+ /**
104
+ * Merge persisted custom agents with the built-in agents currently
105
+ * detected on this machine. Detected built-ins are listed first; any
106
+ * persisted custom entry whose name collides with a built-in is
107
+ * dropped (built-ins are immutable / cannot be overridden).
108
+ *
109
+ * Each merged record carries an `available` flag — true when the
110
+ * agent's command resolves on PATH. Built-ins are detected by their
111
+ * marker directory and assumed available; custom agents are checked
112
+ * against `which` so a stale `~/.interf/agents.json` entry does not
113
+ * appear as a usable choice.
114
+ */
115
+ function mergeAgents(builtin, persisted) {
116
+ const seen = new Set(builtin.map((agent) => agent.name));
117
+ const merged = builtin.map((agent) => ({ ...agent, available: true }));
118
+ for (const agent of persisted) {
119
+ if (seen.has(agent.name))
120
+ continue;
121
+ seen.add(agent.name);
122
+ merged.push({
123
+ ...agent,
124
+ source: "user",
125
+ available: agentCommandAvailable(agent.command),
126
+ });
127
+ }
128
+ return merged;
129
+ }
130
+ function pickActiveAgent(agents, roleMap) {
131
+ const generalName = roleMap["general"];
132
+ const generalAgent = generalName
133
+ ? agents.find((agent) => agent.name === generalName)
134
+ : null;
135
+ if (generalAgent && generalAgent.available !== false)
136
+ return generalAgent;
137
+ return agents.find((agent) => agent.available !== false) ?? null;
138
+ }
139
+ /**
140
+ * Default role-map for a fresh install: every canonical role maps to
141
+ * the first available agent. If nothing is detected, returns an empty
142
+ * object (callers must handle "no agents available" upstream).
143
+ */
144
+ function buildDefaultRoleMap(agents) {
145
+ const first = agents.find((agent) => agent.available !== false) ?? agents[0];
146
+ if (!first)
147
+ return {};
148
+ const map = {};
149
+ for (const role of CANONICAL_ROLES) {
150
+ map[role] = first.name;
151
+ }
152
+ return map;
153
+ }
154
+ /**
155
+ * Public entry point — read the persisted registry, merge with detected
156
+ * built-ins, and seed the default role-map on first read if needed.
157
+ *
158
+ * Does NOT write back to disk. Callers that mutate the registry should
159
+ * call `savePersistedRegistry()` explicitly with the persisted slice.
160
+ */
161
+ export function loadAgentsRegistry() {
162
+ const persisted = loadPersistedRegistry();
163
+ const builtinDetected = detectAutomatableBuiltinAgentRecords();
164
+ const agents = mergeAgents(builtinDetected, persisted.agents);
165
+ // Seed the default role-map on first read when the persisted file
166
+ // has no role-map entries AND we have at least one detectable agent.
167
+ // (We do not write to disk yet; the seeded map is computed on the
168
+ // fly for each reader so a fresh install behaves identically before
169
+ // and after the first user edit.)
170
+ const persistedRoleMap = persisted.role_map;
171
+ const hasPersistedEntries = Object.keys(persistedRoleMap).length > 0;
172
+ const roleMap = hasPersistedEntries
173
+ ? { ...persistedRoleMap }
174
+ : buildDefaultRoleMap(agents);
175
+ // Derive the "active" agent: role-map's `general` entry, falling
176
+ // back to the first available agent. Skips the general entry if it
177
+ // points at an agent whose command is no longer on PATH.
178
+ const activeAgent = pickActiveAgent(agents, roleMap);
179
+ return { agents, roleMap, activeAgent };
180
+ }
181
+ /** Pure helper — like `loadAgentsRegistry()` but works off in-memory data. */
182
+ export function resolveRegistry(persisted, builtinDetected) {
183
+ const agents = mergeAgents(builtinDetected, persisted.agents);
184
+ const hasPersistedEntries = Object.keys(persisted.role_map).length > 0;
185
+ const roleMap = hasPersistedEntries
186
+ ? { ...persisted.role_map }
187
+ : buildDefaultRoleMap(agents);
188
+ const activeAgent = pickActiveAgent(agents, roleMap);
189
+ return { agents, roleMap, activeAgent };
190
+ }
191
+ /**
192
+ * Update the role-map (full replace). Returns the persisted slice that
193
+ * was written.
194
+ */
195
+ export function updateRoleMap(nextRoleMap) {
196
+ const current = loadPersistedRegistry();
197
+ const next = {
198
+ agents: current.agents,
199
+ role_map: { ...nextRoleMap },
200
+ };
201
+ savePersistedRegistry(next);
202
+ return next;
203
+ }
204
+ /**
205
+ * Patch the role-map with a partial update. Empty-string values clear
206
+ * the role (it falls back to `general` / active agent at run time).
207
+ */
208
+ export function patchRoleMap(patch) {
209
+ const current = loadPersistedRegistry();
210
+ const next = { ...current.role_map };
211
+ for (const [role, agentName] of Object.entries(patch)) {
212
+ if (typeof agentName !== "string" || agentName.trim().length === 0) {
213
+ delete next[role];
214
+ continue;
215
+ }
216
+ next[role] = agentName.trim();
217
+ }
218
+ const updated = {
219
+ agents: current.agents,
220
+ role_map: next,
221
+ };
222
+ savePersistedRegistry(updated);
223
+ return updated;
224
+ }
225
+ /**
226
+ * Register a new custom agent. Throws if `name` collides with a known
227
+ * built-in or with an already-persisted custom agent.
228
+ */
229
+ export function registerCustomAgent(input) {
230
+ const trimmedName = input.name.trim();
231
+ const trimmedDisplayName = input.display_name.trim();
232
+ const trimmedCommand = input.command.trim();
233
+ if (!trimmedName)
234
+ throw new Error("Agent name is required.");
235
+ if (!trimmedDisplayName)
236
+ throw new Error("Agent display name is required.");
237
+ if (!trimmedCommand)
238
+ throw new Error("Agent command is required.");
239
+ if (AGENTS.some((agent) => agent.name === trimmedName)) {
240
+ throw new Error(`Cannot register custom agent "${trimmedName}": that name is reserved for a built-in agent.`);
241
+ }
242
+ const current = loadPersistedRegistry();
243
+ if (current.agents.some((agent) => agent.name === trimmedName)) {
244
+ throw new Error(`Custom agent "${trimmedName}" is already registered.`);
245
+ }
246
+ const record = AgentRecordSchema.parse({
247
+ name: trimmedName,
248
+ display_name: trimmedDisplayName,
249
+ command: trimmedCommand,
250
+ source: "user",
251
+ });
252
+ const next = {
253
+ agents: [...current.agents, record],
254
+ role_map: { ...current.role_map },
255
+ };
256
+ savePersistedRegistry(next);
257
+ return next;
258
+ }
259
+ /**
260
+ * Unregister a custom agent. Throws if `name` matches a built-in or no
261
+ * custom record exists. Removes any role-map entry pointing at the
262
+ * removed agent.
263
+ */
264
+ export function unregisterCustomAgent(name) {
265
+ const trimmedName = name.trim();
266
+ if (AGENTS.some((agent) => agent.name === trimmedName)) {
267
+ throw new Error(`Cannot unregister built-in agent "${trimmedName}". Built-in agents are detected dynamically.`);
268
+ }
269
+ const current = loadPersistedRegistry();
270
+ const remaining = current.agents.filter((agent) => agent.name !== trimmedName);
271
+ if (remaining.length === current.agents.length) {
272
+ throw new Error(`Custom agent "${trimmedName}" is not registered.`);
273
+ }
274
+ const trimmedRoleMap = {};
275
+ for (const [role, agentName] of Object.entries(current.role_map)) {
276
+ if (agentName === trimmedName)
277
+ continue;
278
+ trimmedRoleMap[role] = agentName;
279
+ }
280
+ const next = {
281
+ agents: remaining,
282
+ role_map: trimmedRoleMap,
283
+ };
284
+ savePersistedRegistry(next);
285
+ return next;
286
+ }
287
+ /**
288
+ * Set the "active" agent — i.e. the agent the role-map's `general` row
289
+ * points at. Also updates any role still pointing at the previous
290
+ * active agent so existing single-active-agent setups don't need
291
+ * per-role edits when switching agents.
292
+ *
293
+ * Throws if `name` is not in the merged agents list.
294
+ */
295
+ export function setActiveAgent(name) {
296
+ const trimmedName = name.trim();
297
+ if (!trimmedName)
298
+ throw new Error("Agent name is required.");
299
+ const persisted = loadPersistedRegistry();
300
+ const builtinDetected = detectAutomatableBuiltinAgentRecords();
301
+ const agents = mergeAgents(builtinDetected, persisted.agents);
302
+ if (!agents.some((agent) => agent.name === trimmedName)) {
303
+ throw new Error(`Agent "${trimmedName}" is not detected or registered. Install or register it before making it active.`);
304
+ }
305
+ // The previous active is whatever `general` currently maps to (or the
306
+ // first agent in the merged list when `general` is unset).
307
+ const previousActive = persisted.role_map["general"] ?? agents[0]?.name ?? null;
308
+ const nextRoleMap = { ...persisted.role_map };
309
+ for (const [role, currentName] of Object.entries(nextRoleMap)) {
310
+ if (currentName === previousActive) {
311
+ nextRoleMap[role] = trimmedName;
312
+ }
313
+ }
314
+ nextRoleMap["general"] = trimmedName;
315
+ const next = {
316
+ agents: persisted.agents,
317
+ role_map: nextRoleMap,
318
+ };
319
+ savePersistedRegistry(next);
320
+ return next;
321
+ }
@@ -0,0 +1,35 @@
1
+ import type { AgentRecord, RoleMap } from "../../contracts/lib/schema.js";
2
+ import type { MethodExecutionProfile, MethodExecutor } from "./lib/executors.js";
3
+ import { type ResolvedAgent, type RoleResolutionContext } from "./role-router.js";
4
+ export interface RoleExecutorBundle {
5
+ /** Map agent name → method executor. */
6
+ executors: Map<string, MethodExecutor>;
7
+ /** Default fallback executor — usually the active agent. */
8
+ defaultExecutor: MethodExecutor;
9
+ /** The registry context we built this bundle from. */
10
+ context: RoleResolutionContext;
11
+ /**
12
+ * Resolve a stage's role to an executor + provenance. Falls back
13
+ * through `general` and the default executor before raising.
14
+ */
15
+ resolveExecutorForRole(role: string): {
16
+ executor: MethodExecutor;
17
+ resolved: ResolvedAgent;
18
+ };
19
+ }
20
+ export interface BuildRoleExecutorBundleInput {
21
+ agents: AgentRecord[];
22
+ roleMap: RoleMap;
23
+ /** The agent the role-map's `general` row points at, or fallback. */
24
+ activeAgent: AgentRecord | null;
25
+ /** The fallback executor — used when role resolution yields the active. */
26
+ defaultExecutor: MethodExecutor;
27
+ executionProfile?: MethodExecutionProfile;
28
+ }
29
+ /**
30
+ * Build a per-role executor bundle from a registry snapshot. The
31
+ * `defaultExecutor` is what the pipeline already passes for the
32
+ * single-active-agent case (so role lookups that fall through to
33
+ * `fallback-active` resolve to the same executor).
34
+ */
35
+ export declare function buildRoleExecutorBundle(input: BuildRoleExecutorBundleInput): RoleExecutorBundle;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Role-aware executor factory.
3
+ *
4
+ * Bridges the registry layer (`AgentRecord` / `RoleMap`) to the runtime
5
+ * layer (`MethodExecutor`). Builds a per-agent-name `MethodExecutor`
6
+ * map up front and exposes a `resolveExecutorForRole(role)` helper that
7
+ * the compile / verify pipelines can call per-stage.
8
+ *
9
+ * Falls back gracefully: when a role isn't mapped, or the mapped agent
10
+ * is missing, we fall through to `general` and ultimately to the
11
+ * default executor (the active agent at job start).
12
+ */
13
+ import { join } from "node:path";
14
+ import { homedir } from "node:os";
15
+ import { createLocalAgentExecutor } from "./lib/executors.js";
16
+ import { AGENTS } from "./lib/constants.js";
17
+ import { resolveAgentForRole, } from "./role-router.js";
18
+ /**
19
+ * Hydrate an `AgentRecord` (registry shape) into an `Agent` (runtime
20
+ * shape with `skillsDir`). For built-in agents we copy the canonical
21
+ * `skillsDir`; for custom user agents we synthesize a path under
22
+ * `~/.<name>` so any future skill loader has somewhere to look.
23
+ */
24
+ function agentRecordToAgent(record) {
25
+ const builtin = AGENTS.find((agent) => agent.name === record.name);
26
+ if (builtin)
27
+ return { ...builtin };
28
+ return {
29
+ name: record.name,
30
+ displayName: record.display_name,
31
+ skillsDir: join(homedir(), `.${record.name}`),
32
+ command: record.command,
33
+ };
34
+ }
35
+ /**
36
+ * Build a per-role executor bundle from a registry snapshot. The
37
+ * `defaultExecutor` is what the pipeline already passes for the
38
+ * single-active-agent case (so role lookups that fall through to
39
+ * `fallback-active` resolve to the same executor).
40
+ */
41
+ export function buildRoleExecutorBundle(input) {
42
+ const executors = new Map();
43
+ for (const record of input.agents) {
44
+ const agent = agentRecordToAgent(record);
45
+ executors.set(record.name, createLocalAgentExecutor(agent, input.executionProfile));
46
+ }
47
+ // Make sure the active / default executor is reachable by name
48
+ // even when the active agent isn't formally in the registry yet
49
+ // (e.g. legacy single-active setups during the 0.14 → 0.15 transition).
50
+ if (input.activeAgent && !executors.has(input.activeAgent.name)) {
51
+ executors.set(input.activeAgent.name, input.defaultExecutor);
52
+ }
53
+ const context = {
54
+ roleMap: input.roleMap,
55
+ agents: input.agents,
56
+ activeAgent: input.activeAgent,
57
+ };
58
+ return {
59
+ executors,
60
+ defaultExecutor: input.defaultExecutor,
61
+ context,
62
+ resolveExecutorForRole(role) {
63
+ const result = resolveAgentForRole(role, context);
64
+ if ("error" in result) {
65
+ // Role-router refused — fall back to the default executor and
66
+ // synthesize a `fallback-active` resolution. This keeps prepare
67
+ // runs alive when the registry is empty / mid-edit.
68
+ const synthetic = {
69
+ agent: input.activeAgent
70
+ ?? {
71
+ name: input.defaultExecutor.name,
72
+ display_name: input.defaultExecutor.displayName,
73
+ command: input.defaultExecutor.command ?? input.defaultExecutor.name,
74
+ source: "user",
75
+ },
76
+ role,
77
+ source: "fallback-active",
78
+ };
79
+ return {
80
+ executor: input.defaultExecutor,
81
+ resolved: synthetic,
82
+ };
83
+ }
84
+ const executor = executors.get(result.agent.name) ?? input.defaultExecutor;
85
+ return { executor, resolved: result };
86
+ },
87
+ };
88
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Role router — picks which connected agent runs a given stage role.
3
+ *
4
+ * The compile pipeline calls `resolveAgentForRole` for each agent-typed
5
+ * stage, passing the stage's declared role and the current registry +
6
+ * active agent. The verify pipeline always passes role `"verifier"`.
7
+ *
8
+ * Resolution priority (lean / explicit):
9
+ * 1. Explicit role-map entry for the requested role.
10
+ * 2. Role-map's `general` row (when the requested role isn't mapped).
11
+ * 3. The active agent (when `general` isn't mapped either).
12
+ *
13
+ * If the role-map points at an agent name that no longer exists in the
14
+ * merged agents list (e.g. user uninstalled it), we fall through to
15
+ * `general` then `activeAgent`. Only when ALL three are missing does the
16
+ * router return an error.
17
+ */
18
+ import type { AgentRecord, RoleMap } from "../../contracts/lib/schema.js";
19
+ export type RoleResolutionSource = "explicit" | "fallback-general" | "fallback-active";
20
+ export interface ResolvedAgent {
21
+ agent: AgentRecord;
22
+ /** The role the caller asked for (kept for audit / logging). */
23
+ role: string;
24
+ /** Which fallback rung the agent came from. */
25
+ source: RoleResolutionSource;
26
+ }
27
+ export interface RoleResolutionContext {
28
+ roleMap: RoleMap;
29
+ agents: AgentRecord[];
30
+ /**
31
+ * The agent the role-map's `general` row points at — or, when no
32
+ * role-map exists yet, the first detected agent. Pass `null` when
33
+ * there is no agent available; the router then returns an error.
34
+ */
35
+ activeAgent: AgentRecord | null;
36
+ }
37
+ export type RoleResolutionError = {
38
+ error: "no-agents";
39
+ detail: string;
40
+ } | {
41
+ error: "mapped-agent-missing";
42
+ detail: string;
43
+ };
44
+ /**
45
+ * Resolve a stage role to an agent + provenance trail. Returns
46
+ * `{ agent, role, source }` on success or `{ error, detail }` on
47
+ * failure.
48
+ */
49
+ export declare function resolveAgentForRole(role: string, context: RoleResolutionContext): ResolvedAgent | RoleResolutionError;
50
+ /**
51
+ * Resolve every role declared by a Method's stages. Useful for
52
+ * pre-flight: returns either `{ resolutions }` (one entry per stage)
53
+ * or `{ error, role }` if any stage cannot resolve.
54
+ */
55
+ export declare function resolveAgentsForStages(stages: ReadonlyArray<{
56
+ id: string;
57
+ role: string;
58
+ }>, context: RoleResolutionContext): {
59
+ resolutions: Array<{
60
+ stageId: string;
61
+ resolved: ResolvedAgent;
62
+ }>;
63
+ } | (RoleResolutionError & {
64
+ stageId: string;
65
+ role: string;
66
+ });
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Resolve a stage role to an agent + provenance trail. Returns
3
+ * `{ agent, role, source }` on success or `{ error, detail }` on
4
+ * failure.
5
+ */
6
+ export function resolveAgentForRole(role, context) {
7
+ if (context.agents.length === 0) {
8
+ return {
9
+ error: "no-agents",
10
+ detail: "No agents are available. Install Claude Code, Codex, or another agent CLI, " +
11
+ "or register a custom CLI with `interf agents register`.",
12
+ };
13
+ }
14
+ const trimmedRole = role && role.trim().length > 0 ? role.trim() : "general";
15
+ // 1. Explicit role-map entry for the requested role.
16
+ const explicitName = context.roleMap[trimmedRole];
17
+ if (explicitName) {
18
+ const found = context.agents.find((agent) => agent.name === explicitName);
19
+ if (found) {
20
+ return { agent: found, role: trimmedRole, source: "explicit" };
21
+ }
22
+ // Map exists but points at a missing agent. Fall through to
23
+ // `general` and ultimately `activeAgent`. We do NOT return
24
+ // `mapped-agent-missing` here because the resolution priority
25
+ // explicitly allows fallback through `general` and active —
26
+ // returning an error would block a usable agent.
27
+ }
28
+ // 2. Role-map's `general` row, if the requested role isn't `general`.
29
+ if (trimmedRole !== "general") {
30
+ const generalName = context.roleMap["general"];
31
+ if (generalName) {
32
+ const found = context.agents.find((agent) => agent.name === generalName);
33
+ if (found) {
34
+ return { agent: found, role: trimmedRole, source: "fallback-general" };
35
+ }
36
+ }
37
+ }
38
+ // 3. Active agent.
39
+ if (context.activeAgent) {
40
+ return {
41
+ agent: context.activeAgent,
42
+ role: trimmedRole,
43
+ source: "fallback-active",
44
+ };
45
+ }
46
+ // Map points at an agent we cannot find AND there is no active fallback.
47
+ if (explicitName) {
48
+ return {
49
+ error: "mapped-agent-missing",
50
+ detail: `Role "${trimmedRole}" maps to agent "${explicitName}", which is not detected or registered.`,
51
+ };
52
+ }
53
+ return {
54
+ error: "no-agents",
55
+ detail: `No agent is mapped to role "${trimmedRole}" and no active agent fallback is available.`,
56
+ };
57
+ }
58
+ /**
59
+ * Resolve every role declared by a Method's stages. Useful for
60
+ * pre-flight: returns either `{ resolutions }` (one entry per stage)
61
+ * or `{ error, role }` if any stage cannot resolve.
62
+ */
63
+ export function resolveAgentsForStages(stages, context) {
64
+ const resolutions = [];
65
+ for (const stage of stages) {
66
+ const result = resolveAgentForRole(stage.role, context);
67
+ if ("error" in result) {
68
+ return { ...result, stageId: stage.id, role: stage.role };
69
+ }
70
+ resolutions.push({ stageId: stage.id, resolved: result });
71
+ }
72
+ return { resolutions };
73
+ }
@@ -1,4 +1,4 @@
1
- import { type ActionProposalApprovalRequest, type ActionProposalCreateRequest, type ActionProposalResource, type CompileRunCreateRequest, type CompileRunResource, type LocalJobRunResource, type LocalServiceHealth, type ReadinessCheckDraftCreateRequest, type ReadinessCheckDraftResult, type ResetRequest, type ResetResult, type TestRunCreateRequest, type TestRunResource, type MethodAuthoringCreateRequest, type MethodAuthoringResult } from "./lib/schema.js";
1
+ import { type ActionProposalApprovalRequest, type ActionProposalCreateRequest, type ActionProposalResource, type CompileRunCreateRequest, type CompileRunResource, type LocalJobRunResource, type LocalServiceHealth, type ReadinessCheckDraftCreateRequest, type ReadinessCheckDraftResult, type ResetRequest, type ResetResult, type VerifyRunCreateRequest, type VerifyRunResource, type MethodAuthoringCreateRequest, type MethodAuthoringResult } from "./lib/schema.js";
2
2
  export interface FindOrStartLocalServiceOptions {
3
3
  url?: string;
4
4
  authToken?: string;
@@ -41,12 +41,12 @@ export declare function submitCompileRunToLocalService(options: {
41
41
  serviceUrl: string;
42
42
  resource: CompileRunResource;
43
43
  } | null>;
44
- export declare function submitTestRunToLocalService(options: {
44
+ export declare function submitVerifyRunToLocalService(options: {
45
45
  preparationId: string;
46
- request: TestRunCreateRequest;
46
+ request: VerifyRunCreateRequest;
47
47
  }): Promise<{
48
48
  serviceUrl: string;
49
- resource: TestRunResource;
49
+ resource: VerifyRunResource;
50
50
  } | null>;
51
51
  export declare function submitResetToLocalService(options: {
52
52
  preparationId: string;
@@ -103,18 +103,18 @@ export declare function waitForLocalCompileRun(options: {
103
103
  authToken?: string | null;
104
104
  onUpdate?: (resource: CompileRunResource) => void;
105
105
  }): Promise<CompileRunResource>;
106
- export declare function getLocalTestRun(options: {
106
+ export declare function getLocalVerifyRun(options: {
107
107
  serviceUrl: string;
108
108
  runId: string;
109
109
  authToken?: string | null;
110
- }): Promise<TestRunResource>;
111
- export declare function waitForLocalTestRun(options: {
110
+ }): Promise<VerifyRunResource>;
111
+ export declare function waitForLocalVerifyRun(options: {
112
112
  serviceUrl: string;
113
113
  runId: string;
114
114
  pollMs?: number;
115
115
  authToken?: string | null;
116
- onUpdate?: (resource: TestRunResource) => void;
117
- }): Promise<TestRunResource>;
116
+ onUpdate?: (resource: VerifyRunResource) => void;
117
+ }): Promise<VerifyRunResource>;
118
118
  export declare function getLocalJobRun(options: {
119
119
  serviceUrl: string;
120
120
  runId: string;