@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,239 @@
1
+ import { z } from "zod";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/engine/connection-config.js";
5
+ import { LOCAL_SERVICE_ROUTES, preparationResourcePath, preparationSubresourcePath, runResourcePath, runSubresourcePath, } from "../../packages/engine/routes.js";
6
+ function trimTrailingSlash(value) {
7
+ return value.replace(/\/+$/, "");
8
+ }
9
+ function resolveConnection(args) {
10
+ const conn = readActiveConnection({
11
+ urlOverride: args.url ?? null,
12
+ authTokenOverride: args.token ?? null,
13
+ });
14
+ if (!conn) {
15
+ process.stderr.write(`${CONNECT_OR_ERROR_HINT}\n`);
16
+ process.exit(1);
17
+ }
18
+ return {
19
+ url: trimTrailingSlash(conn.url),
20
+ token: conn.auth_token ?? null,
21
+ };
22
+ }
23
+ async function callApi(conn, path, init = {}) {
24
+ const headers = new Headers(init.headers ?? {});
25
+ if (conn.token)
26
+ headers.set("authorization", `Bearer ${conn.token}`);
27
+ if (init.body && !headers.has("content-type")) {
28
+ headers.set("content-type", "application/json");
29
+ }
30
+ const response = await fetch(`${conn.url}${path}`, { ...init, headers });
31
+ const raw = await response.text();
32
+ let body = null;
33
+ if (raw.length > 0) {
34
+ try {
35
+ body = JSON.parse(raw);
36
+ }
37
+ catch {
38
+ body = raw;
39
+ }
40
+ }
41
+ return { status: response.status, body, raw };
42
+ }
43
+ function toolResultJson(payload) {
44
+ const text = typeof payload === "string"
45
+ ? payload
46
+ : JSON.stringify(payload, null, 2);
47
+ return {
48
+ content: [{ type: "text", text }],
49
+ };
50
+ }
51
+ function toolErrorJson(message, payload) {
52
+ const text = payload !== undefined
53
+ ? `${message}\n${typeof payload === "string" ? payload : JSON.stringify(payload, null, 2)}`
54
+ : message;
55
+ return {
56
+ content: [{ type: "text", text }],
57
+ isError: true,
58
+ };
59
+ }
60
+ async function callAndReturn(conn, path, init = {}) {
61
+ const response = await callApi(conn, path, init);
62
+ if (response.status >= 200 && response.status < 300) {
63
+ return toolResultJson(response.body ?? response.raw);
64
+ }
65
+ return toolErrorJson(`Local service responded with HTTP ${response.status}.`, response.body ?? response.raw);
66
+ }
67
+ function registerTools(server, conn) {
68
+ // ── Preparations ────────────────────────────────────────────────────────
69
+ server.registerTool("prep_list", {
70
+ title: "List preparations",
71
+ description: "List every Preparation registered on the connected Interf instance, "
72
+ + "with source binding, Method id, and current readiness.",
73
+ inputSchema: {},
74
+ }, async () => callAndReturn(conn, LOCAL_SERVICE_ROUTES.preparations));
75
+ server.registerTool("prep_create", {
76
+ title: "Create a preparation",
77
+ description: "Create a new Preparation. The Preparation binds a Source Folder "
78
+ + "to an optional Method and is the saved unit of work for compile runs.",
79
+ inputSchema: {
80
+ id: z.string().min(1).describe("Preparation id (kebab-case)."),
81
+ source_path: z.string().min(1).describe("Absolute or workspace-relative Source Folder path."),
82
+ method_id: z.string().min(1).optional().describe("Optional Method id to bind. Bind later with prep_set_method if omitted."),
83
+ about: z.string().min(1).optional().describe("Optional human-readable description."),
84
+ },
85
+ }, async (args) => callAndReturn(conn, LOCAL_SERVICE_ROUTES.preparations, {
86
+ method: "POST",
87
+ body: JSON.stringify({
88
+ id: args.id,
89
+ source: { kind: "local-folder", locator: args.source_path },
90
+ ...(args.method_id ? { method_id: args.method_id } : {}),
91
+ ...(args.about ? { about: args.about } : {}),
92
+ }),
93
+ }));
94
+ server.registerTool("prep_show", {
95
+ title: "Show one preparation",
96
+ description: "Return the full resource for one Preparation by id.",
97
+ inputSchema: {
98
+ id: z.string().min(1).describe("Preparation id."),
99
+ },
100
+ }, async (args) => callAndReturn(conn, preparationResourcePath(args.id)));
101
+ server.registerTool("prep_set_method", {
102
+ title: "Bind a Method to a preparation",
103
+ description: "Update the Method binding on a Preparation. Use this to swap "
104
+ + "Methods between compile runs without rebuilding the Preparation.",
105
+ inputSchema: {
106
+ id: z.string().min(1).describe("Preparation id."),
107
+ method_id: z.string().min(1).describe("Method id to bind."),
108
+ },
109
+ }, async (args) => callAndReturn(conn, preparationResourcePath(args.id), {
110
+ method: "PATCH",
111
+ body: JSON.stringify({ method_id: args.method_id }),
112
+ }));
113
+ server.registerTool("prep_remove", {
114
+ title: "Remove a preparation",
115
+ description: "Delete a Preparation. Portable context is removed too.",
116
+ inputSchema: {
117
+ id: z.string().min(1).describe("Preparation id."),
118
+ },
119
+ }, async (args) => callAndReturn(conn, preparationResourcePath(args.id), {
120
+ method: "DELETE",
121
+ }));
122
+ // ── Compile + verify runs ──────────────────────────────────────────────
123
+ server.registerTool("prep_compile", {
124
+ title: "Start a compile run",
125
+ description: "Kick off a compile run for a Preparation. Returns the new run "
126
+ + "resource immediately; use runs_status to poll progress and "
127
+ + "runs_fetch when the run finishes.",
128
+ inputSchema: {
129
+ id: z.string().min(1).describe("Preparation id."),
130
+ },
131
+ }, async (args) => callAndReturn(conn, preparationSubresourcePath(args.id, "compileRuns"), { method: "POST", body: "{}" }));
132
+ server.registerTool("prep_verify", {
133
+ title: "Run readiness checks",
134
+ description: "Run the Preparation's readiness checks against the latest portable "
135
+ + "context. Verify runs always judge against the compiled output in 0.15+.",
136
+ inputSchema: {
137
+ id: z.string().min(1).describe("Preparation id."),
138
+ },
139
+ }, async (args) => callAndReturn(conn, preparationSubresourcePath(args.id, "verifyRuns"), {
140
+ method: "POST",
141
+ body: JSON.stringify({}),
142
+ }));
143
+ // ── Methods ─────────────────────────────────────────────────────────────
144
+ server.registerTool("method_list", {
145
+ title: "List Methods",
146
+ description: "List every Method visible to the connected instance: workspace "
147
+ + "drafts, the user library at ~/.interf/methods/, and bundled Methods.",
148
+ inputSchema: {},
149
+ }, async () => callAndReturn(conn, LOCAL_SERVICE_ROUTES.methods));
150
+ server.registerTool("method_draft", {
151
+ title: "Author a new Method draft",
152
+ description: "Run the Method-authoring agent for a Preparation. Produces a new "
153
+ + "Method package draft under <workspace>/methods/<id>/.",
154
+ inputSchema: {
155
+ prep_id: z.string().min(1).describe("Preparation id."),
156
+ },
157
+ }, async (args) => callAndReturn(conn, preparationSubresourcePath(args.prep_id, "methodAuthoringRuns"), { method: "POST", body: "{}" }));
158
+ server.registerTool("method_improve", {
159
+ title: "Run Method improvement",
160
+ description: "Run the Method-improvement agent for a Preparation. Iterates on "
161
+ + "the bound Method based on the latest readiness-check results.",
162
+ inputSchema: {
163
+ prep_id: z.string().min(1).describe("Preparation id."),
164
+ },
165
+ }, async (args) => callAndReturn(conn, preparationSubresourcePath(args.prep_id, "methodImprovementRuns"), { method: "POST", body: "{}" }));
166
+ // ── Runs ────────────────────────────────────────────────────────────────
167
+ server.registerTool("runs_status", {
168
+ title: "Get run status",
169
+ description: "Return the run record for one observable run.",
170
+ inputSchema: {
171
+ run_id: z.string().min(1).describe("Run id."),
172
+ },
173
+ }, async (args) => callAndReturn(conn, runResourcePath(args.run_id)));
174
+ server.registerTool("runs_watch", {
175
+ title: "Read run events",
176
+ description: "Read the events log for one run as a snapshot. Returns the same "
177
+ + "stream the UI consumes via SSE; agents that need live progress "
178
+ + "should poll runs_status until the run reaches a terminal state.",
179
+ inputSchema: {
180
+ run_id: z.string().min(1).describe("Run id."),
181
+ },
182
+ }, async (args) => callAndReturn(conn, runSubresourcePath(args.run_id, "events")));
183
+ server.registerTool("runs_cancel", {
184
+ title: "Cancel a run",
185
+ description: "Request cancellation of an in-flight run.",
186
+ inputSchema: {
187
+ run_id: z.string().min(1).describe("Run id."),
188
+ },
189
+ }, async (args) => callAndReturn(conn, runSubresourcePath(args.run_id, "cancel"), { method: "POST", body: "{}" }));
190
+ server.registerTool("runs_fetch", {
191
+ title: "Fetch run artifacts",
192
+ description: "Return the artifact manifest for a finished run (portable context, "
193
+ + "proof records, logs, run-scoped audit trail).",
194
+ inputSchema: {
195
+ run_id: z.string().min(1).describe("Run id."),
196
+ },
197
+ }, async (args) => callAndReturn(conn, runSubresourcePath(args.run_id, "artifacts")));
198
+ // ── Instance ────────────────────────────────────────────────────────────
199
+ server.registerTool("instance_status", {
200
+ title: "Show instance status",
201
+ description: "Return the engine's instance resource: started_at, package "
202
+ + "version, registered preparations, active runs, idle seconds.",
203
+ inputSchema: {},
204
+ }, async () => callAndReturn(conn, LOCAL_SERVICE_ROUTES.instance));
205
+ }
206
+ async function startStdioServer(args) {
207
+ const conn = resolveConnection(args);
208
+ const server = new McpServer({ name: "interf", version: "0.14.0" }, { capabilities: { tools: {} } });
209
+ registerTools(server, conn);
210
+ const transport = new StdioServerTransport();
211
+ await server.connect(transport);
212
+ }
213
+ export const mcpCommand = {
214
+ command: "mcp",
215
+ describe: "Run the Interf Model Context Protocol server (stdio by default).",
216
+ builder: (yargs) => yargs
217
+ .option("transport", {
218
+ type: "string",
219
+ choices: ["stdio", "http"],
220
+ default: "stdio",
221
+ describe: "Transport for the MCP server.",
222
+ })
223
+ .option("url", {
224
+ type: "string",
225
+ describe: "Override the active connection URL.",
226
+ })
227
+ .option("token", {
228
+ type: "string",
229
+ describe: "Override the active bearer token.",
230
+ }),
231
+ handler: async (args) => {
232
+ if (args.transport && args.transport !== "stdio") {
233
+ process.stderr.write("interf mcp: only the stdio transport is implemented today. "
234
+ + "Open an issue if you need --transport=http.\n");
235
+ process.exit(2);
236
+ }
237
+ await startStdioServer(args);
238
+ },
239
+ };
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import chalk from "chalk";
10
10
  import { resolve } from "node:path";
11
- import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
11
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
12
12
  function resolveConnection(args) {
13
13
  const conn = readActiveConnection({
14
14
  urlOverride: args.url,
@@ -12,8 +12,8 @@
12
12
  */
13
13
  import { resolve } from "node:path";
14
14
  import chalk from "chalk";
15
- import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/local-service/connection-config.js";
16
- import { preparationResourcePath } from "../../packages/local-service/routes.js";
15
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/engine/connection-config.js";
16
+ import { preparationResourcePath } from "../../packages/engine/routes.js";
17
17
  function requireConnection(args) {
18
18
  const conn = readActiveConnection({
19
19
  urlOverride: args.url,
@@ -45,6 +45,52 @@ async function callJson(url, token, init = {}) {
45
45
  }
46
46
  return { status: response.status, body, raw };
47
47
  }
48
+ function statusColor(status) {
49
+ if (status === "ready")
50
+ return chalk.green;
51
+ if (status === "failed")
52
+ return chalk.red;
53
+ if (status === "skipped")
54
+ return chalk.dim;
55
+ return chalk.yellow;
56
+ }
57
+ function renderPreparationSummary(prep) {
58
+ console.log();
59
+ console.log(` ${chalk.bold(prep.name)}`);
60
+ if (prep.method_id)
61
+ console.log(chalk.dim(` method: ${prep.method_id}`));
62
+ if (prep.source_path)
63
+ console.log(chalk.dim(` source: ${prep.source_path}`));
64
+ if (prep.portable_context_path) {
65
+ console.log(chalk.dim(` output: ${prep.portable_context_path}`));
66
+ }
67
+ if (prep.readiness?.status) {
68
+ const aggColor = prep.readiness.ready ? chalk.green : chalk.yellow;
69
+ console.log(` readiness: ${aggColor(prep.readiness.status)}${prep.readiness.summary ? chalk.dim(` (${prep.readiness.summary})`) : ""}`);
70
+ }
71
+ if (prep.artifacts && prep.artifacts.length > 0) {
72
+ console.log();
73
+ console.log(chalk.bold(" Artifacts"));
74
+ const idWidth = Math.max(...prep.artifacts.map((entry) => entry.artifact_id.length), 8);
75
+ for (const artifact of prep.artifacts) {
76
+ const colored = statusColor(artifact.status)(artifact.status);
77
+ const stages = artifact.built_by_stages && artifact.built_by_stages.length > 0
78
+ ? chalk.dim(` ← ${artifact.built_by_stages.join(", ")}`)
79
+ : "";
80
+ console.log(` ${artifact.artifact_id.padEnd(idWidth)} ${colored}${stages}`);
81
+ }
82
+ }
83
+ if (prep.latest_compile_run_id) {
84
+ console.log();
85
+ console.log(chalk.dim(` latest compile run: ${prep.latest_compile_run_id}`));
86
+ }
87
+ if (prep.latest_test_run_id) {
88
+ console.log(chalk.dim(` latest verify run: ${prep.latest_test_run_id}`));
89
+ }
90
+ console.log();
91
+ console.log(chalk.dim(` Run with --json for the raw resource record.`));
92
+ console.log();
93
+ }
48
94
  export const prepCommand = {
49
95
  command: "prep <subcommand>",
50
96
  describe: "Manage preparations on the connected instance",
@@ -78,17 +124,17 @@ export const prepCommand = {
78
124
  console.log(chalk.dim(` readiness: ${readiness}`));
79
125
  }
80
126
  })
81
- .command("create <prep-id>", "Create a preparation", (y) => y
127
+ .command("create <prep-id>", "Create a preparation (method binding optional — set later if you don't have one yet)", (y) => y
82
128
  .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id (lowercase, dash-separated)" })
83
129
  .option("source", { type: "string", demandOption: true, describe: "Path to the Source Folder" })
84
- .option("method", { type: "string", demandOption: true, describe: "Method id (e.g. interf-default)" })
130
+ .option("method", { type: "string", describe: "Method id (e.g. interf-default). Optional — bind later via `interf prep set-method`." })
85
131
  .option("about", { type: "string", describe: "One-line description of the agent work" }), async (args) => {
86
132
  const { url, token } = requireConnection(args);
87
133
  const sourceAbs = resolve(process.cwd(), args.source);
88
134
  const requestBody = {
89
135
  id: args.prepId,
90
136
  source: { kind: "local-folder", locator: sourceAbs },
91
- method_id: args.method,
137
+ ...(args.method ? { method_id: args.method } : {}),
92
138
  about: args.about,
93
139
  checks: [],
94
140
  };
@@ -100,11 +146,35 @@ export const prepCommand = {
100
146
  process.exit(1);
101
147
  }
102
148
  console.log(chalk.green(`Created preparation ${chalk.bold(args.prepId)}.`));
149
+ if (!args.method) {
150
+ console.log(chalk.dim(` no method bound yet — pick or draft one before compiling:`));
151
+ console.log(chalk.dim(` interf prep set-method ${args.prepId} <method-id>`));
152
+ console.log(chalk.dim(` interf method draft ${args.prepId}`));
153
+ }
103
154
  if (body?.portable_context?.value) {
104
155
  console.log(chalk.dim(` portable context (locator): ${body.portable_context.value}`));
105
156
  }
106
157
  })
107
- .command("show <prep-id>", "Show a preparation's full record", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
158
+ .command("set-method <prep-id> <method-id>", "Bind a method to a preparation (or change which method it uses)", (y) => y
159
+ .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
160
+ .positional("method-id", { type: "string", demandOption: true, describe: "Method id to bind" }), async (args) => {
161
+ const { url, token } = requireConnection(args);
162
+ const { status, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token, { method: "PATCH", body: JSON.stringify({ method_id: args.methodId }) });
163
+ if (status !== 200) {
164
+ console.error(chalk.red(`Failed to set method (HTTP ${status}).`));
165
+ if (raw)
166
+ console.error(raw);
167
+ process.exit(1);
168
+ }
169
+ console.log(chalk.green(`Bound ${chalk.bold(args.methodId)} to ${chalk.bold(args.prepId)}.`));
170
+ })
171
+ .command("show <prep-id>", "Show a preparation's full record", (y) => y
172
+ .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
173
+ .option("json", {
174
+ type: "boolean",
175
+ default: false,
176
+ describe: "Print the raw JSON record instead of the formatted summary",
177
+ }), async (args) => {
108
178
  const { url, token } = requireConnection(args);
109
179
  const { status, body, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token);
110
180
  if (status !== 200) {
@@ -113,7 +183,11 @@ export const prepCommand = {
113
183
  console.error(raw);
114
184
  process.exit(1);
115
185
  }
116
- console.log(JSON.stringify(body, null, 2));
186
+ if (args.json || !body) {
187
+ console.log(JSON.stringify(body, null, 2));
188
+ return;
189
+ }
190
+ renderPreparationSummary(body);
117
191
  })
118
192
  .command("rm <prep-id>", "Delete a preparation", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
119
193
  const { url, token } = requireConnection(args);
@@ -5,7 +5,7 @@
5
5
  * interf reset bristol --mode all # also clear method draft / runs
6
6
  */
7
7
  import chalk from "chalk";
8
- import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
8
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
9
9
  function resolveConnection(args) {
10
10
  const conn = readActiveConnection({
11
11
  urlOverride: args.url,
@@ -9,7 +9,7 @@
9
9
  import chalk from "chalk";
10
10
  import { mkdirSync, writeFileSync } from "node:fs";
11
11
  import { dirname, isAbsolute, resolve } from "node:path";
12
- import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
12
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
13
13
  function resolveConnection(args) {
14
14
  const conn = readActiveConnection({
15
15
  urlOverride: args.url,
@@ -2,7 +2,7 @@
2
2
  * `interf status` — print connection state + preparation summary.
3
3
  */
4
4
  import chalk from "chalk";
5
- import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
5
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
6
6
  async function callJson(url, token) {
7
7
  const headers = new Headers();
8
8
  if (token)
@@ -0,0 +1,10 @@
1
+ import type { CommandModule } from "yargs";
2
+ type VerifyTarget = "compiled" | "source-files";
3
+ interface VerifyArgs {
4
+ prepId: string;
5
+ target?: VerifyTarget;
6
+ url?: string;
7
+ token?: string;
8
+ }
9
+ export declare const verifyCommand: CommandModule<unknown, VerifyArgs>;
10
+ export {};
@@ -1,13 +1,17 @@
1
1
  /**
2
- * `interf test <prep-id>` — start a readiness-check (test) run for a preparation.
2
+ * `interf verify <prep-id>` — verify a preparation's claim-checks via a
3
+ * judge against the latest compiled portable context (default) or
4
+ * against the source folder baseline (`--target source-files`). The
5
+ * source-files target reveals how much value the Method actually adds.
6
+ * Together with the method's structural checks (auto-run on every
7
+ * `interf compile`), this feeds the preparation's overall readiness
8
+ * state.
3
9
  *
4
- * interf test bristol
5
- * interf test bristol --target source-files
6
- * interf test bristol --target portable-context
7
- * interf test bristol --target both
10
+ * interf verify bristol
11
+ * interf verify bristol --target source-files
8
12
  */
9
13
  import chalk from "chalk";
10
- import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/local-service/connection-config.js";
14
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
11
15
  function resolveConnection(args) {
12
16
  const conn = readActiveConnection({
13
17
  urlOverride: args.url,
@@ -38,31 +42,42 @@ async function callJson(url, token, init = {}) {
38
42
  }
39
43
  return { status: response.status, body, raw };
40
44
  }
41
- export const testCommand = {
42
- command: "test <prep-id>",
43
- describe: "Run readiness checks for a preparation",
45
+ export const verifyCommand = {
46
+ command: "verify <prep-id>",
47
+ describe: "Verify a preparation's claim-checks against its portable context (or source-files baseline)",
44
48
  builder: (yargs) => yargs
45
49
  .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
46
50
  .option("target", {
47
51
  type: "string",
48
- choices: ["source-files", "portable-context", "both"],
49
- default: "both",
50
- describe: "Which surface to test against",
52
+ choices: ["compiled", "source-files"],
53
+ default: "compiled",
54
+ describe: "Judge target: 'compiled' (default) checks the portable context, 'source-files' checks the raw source folder baseline",
51
55
  })
52
56
  .option("url", { type: "string", describe: "Override the active connection URL" })
53
57
  .option("token", { type: "string", describe: "Override the active bearer token" }),
54
58
  handler: async (args) => {
55
59
  const { url, token } = resolveConnection(args);
56
- const mode = args.target === "portable-context" ? "compiled" : args.target === "source-files" ? "source-files" : "both";
57
- const { status, body, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/test-runs`, token, { method: "POST", body: JSON.stringify({ mode }) });
60
+ // 0.15 hard-error: refuse to start a verify run if the engine has
61
+ // zero connected agents verifier-role stages can't run without
62
+ // one.
63
+ const instance = await callJson(`${url}/v1/instance`, token);
64
+ if (instance.body && instance.body.agent_count === 0) {
65
+ console.error(chalk.red(" Cannot verify — no agents available."));
66
+ console.error(" Install Claude Code, Codex, Gemini, or another agent CLI, or");
67
+ console.error(" register a custom CLI: `interf agents register <name> --command <cmd>`.");
68
+ process.exit(1);
69
+ }
70
+ const target = args.target ?? "compiled";
71
+ const { status, body, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/verify-runs`, token, { method: "POST", body: JSON.stringify({ target }) });
58
72
  if (status !== 201 && status !== 200) {
59
- console.error(chalk.red(`Failed to start test run for ${args.prepId} (HTTP ${status}).`));
73
+ console.error(chalk.red(`Failed to start verify run for ${args.prepId} (HTTP ${status}).`));
60
74
  if (raw)
61
75
  console.error(raw);
62
76
  process.exit(1);
63
77
  }
64
78
  console.log();
65
79
  console.log(` Run ${chalk.bold(body?.run_id ?? "(?)")} ${chalk.dim(`(${body?.status ?? "started"})`)}`);
80
+ console.log(` Target: ${target}`);
66
81
  if (body?.readiness?.status)
67
82
  console.log(` Readiness: ${body.readiness.status}`);
68
83
  if (body?.error)
@@ -11,11 +11,11 @@
11
11
  */
12
12
  import chalk from "chalk";
13
13
  import { readFileSync } from "node:fs";
14
- import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, buildLocalServiceUrl, } from "../../packages/local-service/routes.js";
15
- import { startLocalService } from "../../packages/local-service/server.js";
16
- import { createNativeLocalServiceRunHandlers } from "../../packages/local-service/native-run-handlers.js";
17
- import { CONNECT_OR_ERROR_HINT, clearConnection, readActiveConnection, } from "../../packages/local-service/connection-config.js";
18
- import { serviceRegistryPath } from "../../packages/local-service/instance-paths.js";
14
+ import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, buildLocalServiceUrl, } from "../../packages/engine/routes.js";
15
+ import { startLocalService } from "../../packages/engine/server.js";
16
+ import { createNativeLocalServiceRunHandlers } from "../../packages/engine/native-run-handlers.js";
17
+ import { CONNECT_OR_ERROR_HINT, clearConnection, readActiveConnection, } from "../../packages/engine/connection-config.js";
18
+ import { serviceRegistryPath } from "../../packages/engine/instance-paths.js";
19
19
  function packageVersionFromManifest() {
20
20
  try {
21
21
  const url = new URL("../../../package.json", import.meta.url);
@@ -85,28 +85,81 @@ function findEnginePidByUrl(url) {
85
85
  return null;
86
86
  }
87
87
  }
88
+ function isPidAlive(pid) {
89
+ try {
90
+ // Signal 0 is a no-op probe — succeeds if the PID exists and we can
91
+ // signal it; throws ESRCH otherwise.
92
+ process.kill(pid, 0);
93
+ return true;
94
+ }
95
+ catch {
96
+ return false;
97
+ }
98
+ }
99
+ /**
100
+ * Scan ~/.interf/services.json for engines whose PID is still alive.
101
+ * Used by `interf web stop` when ~/.interf/connection.json is missing
102
+ * — the registry tells us which engine processes are actually running
103
+ * regardless of which one the wizard last connected to.
104
+ */
105
+ function listLiveEnginesFromRegistry() {
106
+ try {
107
+ const raw = readFileSync(serviceRegistryPath(), "utf8");
108
+ const parsed = JSON.parse(raw);
109
+ return (parsed.services ?? []).filter((entry) => typeof entry.pid === "number" && isPidAlive(entry.pid));
110
+ }
111
+ catch {
112
+ return [];
113
+ }
114
+ }
88
115
  async function runWebStop(args) {
116
+ // Resolution order: explicit --url override → active connection.json
117
+ // → fall back to scanning services.json for any live engine. The
118
+ // last fallback recovers from the case where connection.json was
119
+ // cleared while an engine was still running (e.g. another `interf
120
+ // web` attempt failed mid-startup, or `interf logout` was run while
121
+ // the engine kept going).
89
122
  const conn = readActiveConnection({
90
123
  urlOverride: args.url,
91
124
  authTokenOverride: args.token,
92
125
  });
93
- if (!conn) {
94
- console.error("No active Interf connection to stop.");
95
- process.exit(1);
96
- }
97
- const url = conn.url.replace(/\/+$/, "");
98
- const pid = findEnginePidByUrl(url);
99
- if (!pid) {
100
- console.error(`Could not locate engine PID for ${url}.`);
101
- process.exit(1);
126
+ let urlToStop = conn ? conn.url.replace(/\/+$/, "") : null;
127
+ let pidToStop = urlToStop ? findEnginePidByUrl(urlToStop) : null;
128
+ if (!pidToStop) {
129
+ const liveEngines = listLiveEnginesFromRegistry();
130
+ if (liveEngines.length === 0) {
131
+ console.error("No live Interf engine to stop.");
132
+ console.error("Checked ~/.interf/connection.json and ~/.interf/services.json — neither pointed at a running process.");
133
+ process.exit(1);
134
+ }
135
+ if (liveEngines.length > 1 && !urlToStop) {
136
+ console.error(`Multiple live Interf engines registered. Pick one with --url:`);
137
+ for (const entry of liveEngines) {
138
+ console.error(` ${entry.url} (pid ${entry.pid})`);
139
+ }
140
+ process.exit(1);
141
+ }
142
+ const target = urlToStop
143
+ ? liveEngines.find((entry) => entry.url === urlToStop)
144
+ : liveEngines[0];
145
+ if (!target) {
146
+ console.error(`No live engine matches ${urlToStop ?? "the active connection"} in services.json.`);
147
+ process.exit(1);
148
+ }
149
+ urlToStop = target.url;
150
+ pidToStop = target.pid;
151
+ if (!conn) {
152
+ console.log(chalk.dim(` No active connection.json — recovering engine pid ${pidToStop} from services.json.`));
153
+ }
102
154
  }
103
155
  try {
104
- process.kill(pid, "SIGTERM");
105
- console.log(chalk.green(`Sent SIGTERM to engine pid ${pid} (${url}).`));
106
- clearConnection();
156
+ process.kill(pidToStop, "SIGTERM");
157
+ console.log(chalk.green(`Sent SIGTERM to engine pid ${pidToStop} (${urlToStop}).`));
158
+ if (conn)
159
+ clearConnection();
107
160
  }
108
161
  catch (error) {
109
- console.error(`Failed to stop engine pid ${pid}: ${error instanceof Error ? error.message : String(error)}`);
162
+ console.error(`Failed to stop engine pid ${pidToStop}: ${error instanceof Error ? error.message : String(error)}`);
110
163
  process.exit(1);
111
164
  }
112
165
  }