@interf/compiler 0.9.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/README.md +135 -91
  2. package/TRADEMARKS.md +2 -13
  3. package/agent-skills/interf-actions/SKILL.md +143 -38
  4. package/agent-skills/interf-actions/references/cli.md +134 -67
  5. package/builtin-methods/interf-default/README.md +3 -4
  6. package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
  7. package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
  8. package/builtin-methods/interf-default/improve/SKILL.md +1 -1
  9. package/builtin-methods/interf-default/method.json +10 -4
  10. package/builtin-methods/interf-default/method.schema.json +0 -9
  11. package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
  12. package/dist/cli/commands/agents.d.ts +2 -0
  13. package/dist/cli/commands/agents.js +213 -0
  14. package/dist/cli/commands/compile.d.ts +8 -25
  15. package/dist/cli/commands/compile.js +83 -359
  16. package/dist/cli/commands/doctor.js +2 -2
  17. package/dist/cli/commands/login.d.ts +7 -0
  18. package/dist/cli/commands/login.js +39 -0
  19. package/dist/cli/commands/logout.d.ts +2 -0
  20. package/dist/cli/commands/logout.js +16 -0
  21. package/dist/cli/commands/mcp.d.ts +42 -0
  22. package/dist/cli/commands/mcp.js +239 -0
  23. package/dist/cli/commands/method.d.ts +2 -0
  24. package/dist/cli/commands/method.js +113 -0
  25. package/dist/cli/commands/prep.d.ts +2 -0
  26. package/dist/cli/commands/prep.js +152 -0
  27. package/dist/cli/commands/reset.d.ts +8 -1
  28. package/dist/cli/commands/reset.js +47 -26
  29. package/dist/cli/commands/runs.d.ts +2 -0
  30. package/dist/cli/commands/runs.js +120 -0
  31. package/dist/cli/commands/status.d.ts +6 -1
  32. package/dist/cli/commands/status.js +68 -111
  33. package/dist/cli/commands/verify.d.ts +7 -1
  34. package/dist/cli/commands/verify.js +69 -85
  35. package/dist/cli/commands/web.d.ts +0 -9
  36. package/dist/cli/commands/web.js +201 -121
  37. package/dist/cli/commands/wizard.d.ts +9 -0
  38. package/dist/cli/commands/wizard.js +689 -0
  39. package/dist/cli/index.d.ts +10 -7
  40. package/dist/cli/index.js +19 -12
  41. package/dist/compiler-ui/404.html +1 -1
  42. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  43. package/dist/compiler-ui/__next._full.txt +3 -3
  44. package/dist/compiler-ui/__next._head.txt +1 -1
  45. package/dist/compiler-ui/__next._index.txt +2 -2
  46. package/dist/compiler-ui/__next._tree.txt +2 -2
  47. package/dist/compiler-ui/_next/static/chunks/{177mvn4rse235.js → 0jipmpez3_ehh.js} +16 -16
  48. package/dist/compiler-ui/_next/static/chunks/{18a8f2jkv3z.c.css → 13awzu4tooflw.css} +1 -1
  49. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  50. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  51. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  52. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  53. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  54. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  55. package/dist/compiler-ui/_not-found.html +1 -1
  56. package/dist/compiler-ui/_not-found.txt +2 -2
  57. package/dist/compiler-ui/index.html +1 -1
  58. package/dist/compiler-ui/index.txt +3 -3
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +2 -2
  61. package/dist/packages/contracts/index.d.ts +2 -1
  62. package/dist/packages/contracts/index.js +1 -0
  63. package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
  64. package/dist/packages/contracts/lib/preparation-paths.js +177 -0
  65. package/dist/packages/contracts/lib/schema.d.ts +187 -13
  66. package/dist/packages/contracts/lib/schema.js +148 -3
  67. package/dist/packages/contracts/utils/filesystem.d.ts +9 -0
  68. package/dist/packages/contracts/utils/filesystem.js +142 -0
  69. package/dist/packages/{local-service → engine}/action-definitions.d.ts +14 -14
  70. package/dist/packages/{local-service → engine}/action-definitions.js +35 -29
  71. package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
  72. package/dist/packages/{local-service → engine}/action-planner.js +3 -2
  73. package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
  74. package/dist/packages/{agents → engine/agents}/index.js +3 -0
  75. package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
  76. package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
  77. package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
  78. package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
  79. package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +5 -5
  80. package/dist/packages/{agents → engine/agents}/lib/shells.js +117 -58
  81. package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +4 -2
  82. package/dist/packages/engine/agents/lib/user-config.js +24 -0
  83. package/dist/packages/engine/agents/registry.d.ts +91 -0
  84. package/dist/packages/engine/agents/registry.js +321 -0
  85. package/dist/packages/engine/agents/role-executors.d.ts +35 -0
  86. package/dist/packages/engine/agents/role-executors.js +88 -0
  87. package/dist/packages/engine/agents/role-router.d.ts +66 -0
  88. package/dist/packages/engine/agents/role-router.js +73 -0
  89. package/dist/packages/{local-service → engine}/client.d.ts +59 -60
  90. package/dist/packages/{local-service → engine}/client.js +137 -145
  91. package/dist/packages/{compiler → engine/compile}/artifact-counts.js +1 -1
  92. package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +9 -2
  93. package/dist/packages/{compiler → engine/compile}/compiled-paths.js +30 -15
  94. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
  95. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +39 -9
  96. package/dist/packages/{compiler → engine/compile}/compiled-schema.d.ts +2 -2
  97. package/dist/packages/{compiler → engine/compile}/compiled-schema.js +4 -4
  98. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +1 -1
  99. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +8 -4
  100. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
  101. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +3 -3
  102. package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +3 -3
  103. package/dist/packages/{compiler → engine/compile}/compiled-target.js +3 -3
  104. package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
  105. package/dist/packages/{compiler → engine/compile}/index.d.ts +1 -0
  106. package/dist/packages/{compiler → engine/compile}/index.js +1 -0
  107. package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +26 -31
  108. package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -13
  109. package/dist/packages/engine/compile/method-runs.d.ts +14 -0
  110. package/dist/packages/{compiler → engine/compile}/method-runs.js +5 -6
  111. package/dist/packages/{compiler → engine/compile}/reset.js +3 -1
  112. package/dist/packages/{compiler → engine/compile}/runtime-acceptance.js +17 -14
  113. package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +0 -3
  114. package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +1 -1
  115. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
  116. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +12 -10
  117. package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
  118. package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -43
  119. package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +1 -5
  120. package/dist/packages/{compiler → engine/compile}/runtime.d.ts +2 -2
  121. package/dist/packages/{compiler → engine/compile}/runtime.js +1 -1
  122. package/dist/packages/engine/compile/source-files.d.ts +46 -0
  123. package/dist/packages/engine/compile/source-files.js +149 -0
  124. package/dist/packages/engine/compile/state-artifacts.d.ts +9 -0
  125. package/dist/packages/{compiler → engine/compile}/state-artifacts.js +4 -3
  126. package/dist/packages/{compiler → engine/compile}/state-health.js +2 -2
  127. package/dist/packages/{compiler → engine/compile}/state-io.d.ts +3 -2
  128. package/dist/packages/{compiler → engine/compile}/state-io.js +13 -7
  129. package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +2 -1
  130. package/dist/packages/engine/compile/state-paths.js +16 -0
  131. package/dist/packages/engine/compile/state-view.d.ts +5 -0
  132. package/dist/packages/{compiler → engine/compile}/state-view.js +20 -30
  133. package/dist/packages/engine/compile/state.d.ts +7 -0
  134. package/dist/packages/{compiler → engine/compile}/state.js +3 -3
  135. package/dist/packages/{compiler → engine/compile}/validate-compiled.js +2 -2
  136. package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
  137. package/dist/packages/{compiler → engine/compile}/validate.js +3 -3
  138. package/dist/packages/engine/connection-config.d.ts +38 -0
  139. package/dist/packages/engine/connection-config.js +75 -0
  140. package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +52 -72
  141. package/dist/packages/{execution → engine/execution}/lib/schema.js +3 -3
  142. package/dist/packages/engine/index.d.ts +22 -0
  143. package/dist/packages/engine/index.js +15 -0
  144. package/dist/packages/engine/instance-paths.d.ts +100 -0
  145. package/dist/packages/engine/instance-paths.js +165 -0
  146. package/dist/packages/{local-service → engine}/lib/schema.d.ts +392 -2408
  147. package/dist/packages/{local-service → engine}/lib/schema.js +164 -76
  148. package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
  149. package/dist/packages/{local-service → engine}/native-run-handlers.js +71 -27
  150. package/dist/packages/engine/preparation-store.d.ts +104 -0
  151. package/dist/packages/engine/preparation-store.js +194 -0
  152. package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
  153. package/dist/packages/engine/routes.d.ts +78 -0
  154. package/dist/packages/engine/routes.js +92 -0
  155. package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
  156. package/dist/packages/{local-service → engine}/run-observability.js +25 -24
  157. package/dist/packages/engine/runtime-caches.d.ts +76 -0
  158. package/dist/packages/engine/runtime-caches.js +191 -0
  159. package/dist/packages/engine/runtime-event-applier.d.ts +12 -0
  160. package/dist/packages/engine/runtime-event-applier.js +177 -0
  161. package/dist/packages/engine/runtime-persistence.d.ts +47 -0
  162. package/dist/packages/engine/runtime-persistence.js +137 -0
  163. package/dist/packages/engine/runtime-proposal-helpers.d.ts +35 -0
  164. package/dist/packages/engine/runtime-proposal-helpers.js +251 -0
  165. package/dist/packages/engine/runtime-resource-builders.d.ts +52 -0
  166. package/dist/packages/engine/runtime-resource-builders.js +149 -0
  167. package/dist/packages/engine/runtime.d.ts +318 -0
  168. package/dist/packages/{local-service → engine}/runtime.js +835 -1011
  169. package/dist/packages/{local-service → engine}/server.d.ts +15 -0
  170. package/dist/packages/engine/server.js +1257 -0
  171. package/dist/packages/engine/service-registry.d.ts +47 -0
  172. package/dist/packages/engine/service-registry.js +137 -0
  173. package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +11 -11
  174. package/dist/packages/{testing → engine/verify}/lib/schema.js +3 -3
  175. package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +9 -16
  176. package/dist/packages/{testing → engine/verify}/readiness-check-run.js +38 -94
  177. package/dist/packages/{testing → engine/verify}/test-execution.js +6 -6
  178. package/dist/packages/{testing → engine/verify}/test-paths.js +5 -4
  179. package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -1
  180. package/dist/packages/{testing → engine/verify}/test-sandbox.js +17 -33
  181. package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
  182. package/dist/packages/{testing → engine/verify}/test-targets.d.ts +1 -1
  183. package/dist/packages/{testing → engine/verify}/test-targets.js +9 -9
  184. package/dist/packages/{testing → engine/verify}/test.d.ts +1 -1
  185. package/dist/packages/{testing → engine/verify}/test.js +1 -1
  186. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +12 -4
  187. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +70 -7
  188. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
  189. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
  190. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +16 -10
  191. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +4 -5
  192. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +10 -16
  193. package/dist/packages/{method-package → methods/package}/context-interface.d.ts +5 -41
  194. package/dist/packages/{method-package → methods/package}/context-interface.js +3 -25
  195. package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +4 -4
  196. package/dist/packages/{method-package → methods/package}/interf-method-package.js +24 -35
  197. package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
  198. package/dist/packages/{method-package → methods/package}/local-methods.d.ts +18 -8
  199. package/dist/packages/{method-package → methods/package}/local-methods.js +64 -45
  200. package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +16 -36
  201. package/dist/packages/{method-package → methods/package}/method-definitions.js +53 -40
  202. package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +2 -14
  203. package/dist/packages/{method-package → methods/package}/method-helpers.js +12 -46
  204. package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
  205. package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
  206. package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
  207. package/dist/packages/{method-package → methods/package}/method-stage-runner.js +3 -31
  208. package/dist/packages/methods/package/user-methods.d.ts +17 -0
  209. package/dist/packages/methods/package/user-methods.js +77 -0
  210. package/dist/packages/{project-model → project}/index.d.ts +0 -1
  211. package/dist/packages/{project-model → project}/index.js +0 -1
  212. package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
  213. package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
  214. package/dist/packages/{project-model → project}/interf-detect.d.ts +8 -3
  215. package/dist/packages/{project-model → project}/interf-detect.js +38 -38
  216. package/dist/packages/project/interf-scaffold.d.ts +3 -0
  217. package/dist/packages/{project-model → project}/interf-scaffold.js +30 -39
  218. package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
  219. package/dist/packages/{project-model → project}/lib/schema.js +39 -2
  220. package/dist/packages/project/preparation-entries.d.ts +11 -0
  221. package/dist/packages/{project-model → project}/preparation-entries.js +14 -14
  222. package/dist/packages/{project-model → project}/source-config.d.ts +12 -12
  223. package/dist/packages/{project-model → project}/source-config.js +81 -53
  224. package/dist/packages/{project-model → project}/source-folders.d.ts +5 -5
  225. package/dist/packages/{project-model → project}/source-folders.js +16 -16
  226. package/package.json +8 -8
  227. package/CHANGELOG.md +0 -93
  228. package/LICENSE +0 -183
  229. package/dist/cli/commands/action-input-cli.d.ts +0 -25
  230. package/dist/cli/commands/action-input-cli.js +0 -73
  231. package/dist/cli/commands/control-path.d.ts +0 -11
  232. package/dist/cli/commands/control-path.js +0 -72
  233. package/dist/cli/commands/create-method-wizard.d.ts +0 -64
  234. package/dist/cli/commands/create-method-wizard.js +0 -434
  235. package/dist/cli/commands/create.d.ts +0 -6
  236. package/dist/cli/commands/create.js +0 -183
  237. package/dist/cli/commands/default.d.ts +0 -2
  238. package/dist/cli/commands/default.js +0 -39
  239. package/dist/cli/commands/executor-flow.d.ts +0 -29
  240. package/dist/cli/commands/executor-flow.js +0 -163
  241. package/dist/cli/commands/init.d.ts +0 -26
  242. package/dist/cli/commands/init.js +0 -771
  243. package/dist/cli/commands/list.d.ts +0 -2
  244. package/dist/cli/commands/list.js +0 -30
  245. package/dist/cli/commands/preparation-action.d.ts +0 -8
  246. package/dist/cli/commands/preparation-action.js +0 -29
  247. package/dist/cli/commands/preparation-picker.d.ts +0 -5
  248. package/dist/cli/commands/preparation-picker.js +0 -36
  249. package/dist/cli/commands/preparation-selection.d.ts +0 -6
  250. package/dist/cli/commands/preparation-selection.js +0 -11
  251. package/dist/cli/commands/service-action-flow.d.ts +0 -9
  252. package/dist/cli/commands/service-action-flow.js +0 -19
  253. package/dist/cli/commands/source-config-wizard.d.ts +0 -51
  254. package/dist/cli/commands/source-config-wizard.js +0 -670
  255. package/dist/cli/commands/test.d.ts +0 -17
  256. package/dist/cli/commands/test.js +0 -188
  257. package/dist/packages/agents/lib/detection.d.ts +0 -7
  258. package/dist/packages/agents/lib/user-config.js +0 -16
  259. package/dist/packages/compiler/method-runs.d.ts +0 -15
  260. package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
  261. package/dist/packages/compiler/raw-snapshot.js +0 -101
  262. package/dist/packages/compiler/state-artifacts.d.ts +0 -8
  263. package/dist/packages/compiler/state-paths.js +0 -13
  264. package/dist/packages/compiler/state-view.d.ts +0 -4
  265. package/dist/packages/compiler/state.d.ts +0 -7
  266. package/dist/packages/local-service/index.d.ts +0 -18
  267. package/dist/packages/local-service/index.js +0 -13
  268. package/dist/packages/local-service/routes.d.ts +0 -32
  269. package/dist/packages/local-service/routes.js +0 -37
  270. package/dist/packages/local-service/runtime.d.ts +0 -133
  271. package/dist/packages/local-service/server.js +0 -627
  272. package/dist/packages/method-package/index.d.ts +0 -11
  273. package/dist/packages/method-package/index.js +0 -11
  274. package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
  275. package/dist/packages/method-package/method-stage-policy.js +0 -31
  276. package/dist/packages/project-model/interf-scaffold.d.ts +0 -3
  277. package/dist/packages/project-model/preparation-entries.d.ts +0 -11
  278. package/dist/packages/project-model/project-paths.d.ts +0 -12
  279. package/dist/packages/project-model/project-paths.js +0 -33
  280. package/dist/packages/shared/filesystem.d.ts +0 -2
  281. package/dist/packages/shared/filesystem.js +0 -55
  282. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
  283. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
  284. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_ssgManifest.js +0 -0
  285. /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
  286. /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
  287. /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
  288. /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
  289. /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
  290. /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
  291. /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
  292. /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
  293. /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
  294. /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
  295. /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
  296. /package/dist/packages/{local-service → engine}/action-values.js +0 -0
  297. /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
  298. /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
  299. /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
  300. /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
  301. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
  302. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
  303. /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
  304. /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
  305. /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
  306. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
  307. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
  308. /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
  309. /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
  310. /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
  311. /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
  312. /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
  313. /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
  314. /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
  315. /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
  316. /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
  317. /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
  318. /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
  319. /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
  320. /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
  321. /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
  322. /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
  323. /package/dist/packages/{compiler → engine/compile}/artifact-counts.d.ts +0 -0
  324. /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
  325. /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
  326. /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
  327. /package/dist/packages/{compiler → engine/compile}/method-primitives.d.ts +0 -0
  328. /package/dist/packages/{compiler → engine/compile}/method-primitives.js +0 -0
  329. /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
  330. /package/dist/packages/{compiler → engine/compile}/runtime-acceptance.d.ts +0 -0
  331. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
  332. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
  333. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
  334. /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
  335. /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
  336. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
  337. /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
  338. /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
  339. /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
  340. /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
  341. /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
  342. /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
  343. /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
  344. /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
  345. /package/dist/packages/{execution → engine/execution}/events.js +0 -0
  346. /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
  347. /package/dist/packages/{execution → engine/execution}/index.js +0 -0
  348. /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
  349. /package/dist/packages/{testing → engine/verify}/index.d.ts +0 -0
  350. /package/dist/packages/{testing → engine/verify}/index.js +0 -0
  351. /package/dist/packages/{testing → engine/verify}/test-execution.d.ts +0 -0
  352. /package/dist/packages/{testing → engine/verify}/test-paths.d.ts +0 -0
  353. /package/dist/packages/{testing → engine/verify}/test-profile-presets.d.ts +0 -0
  354. /package/dist/packages/{testing → engine/verify}/test-profile-presets.js +0 -0
  355. /package/dist/packages/{testing → engine/verify}/test-specs.d.ts +0 -0
  356. /package/dist/packages/{testing → engine/verify}/test-types.d.ts +0 -0
  357. /package/dist/packages/{testing → engine/verify}/test-types.js +0 -0
  358. /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
  359. /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
  360. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
  361. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
  362. /package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +0 -0
  363. /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
  364. /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
  365. /package/dist/packages/{project-model → project}/interf.js +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
+ };
@@ -0,0 +1,2 @@
1
+ import type { CommandModule } from "yargs";
2
+ export declare const methodCommand: CommandModule;
@@ -0,0 +1,113 @@
1
+ /**
2
+ * `interf method` — manage methods on the connected instance.
3
+ *
4
+ * interf method ls # list methods (instance-wide)
5
+ * interf method install <path> # install a method package
6
+ * interf method draft <prep-id> # start a method-authoring run
7
+ * interf method improve <prep-id> # start a method-improvement run
8
+ */
9
+ import chalk from "chalk";
10
+ import { resolve } from "node:path";
11
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
12
+ function resolveConnection(args) {
13
+ const conn = readActiveConnection({
14
+ urlOverride: args.url,
15
+ authTokenOverride: args.token,
16
+ });
17
+ if (!conn) {
18
+ console.error(CONNECT_OR_ERROR_HINT);
19
+ process.exit(1);
20
+ }
21
+ return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
22
+ }
23
+ async function callJson(url, token, init = {}) {
24
+ const headers = new Headers(init.headers ?? {});
25
+ if (token)
26
+ headers.set("authorization", `Bearer ${token}`);
27
+ if (init.body && !headers.has("content-type"))
28
+ headers.set("content-type", "application/json");
29
+ const response = await fetch(url, { ...init, headers });
30
+ const raw = await response.text();
31
+ let body = null;
32
+ if (raw) {
33
+ try {
34
+ body = JSON.parse(raw);
35
+ }
36
+ catch {
37
+ body = null;
38
+ }
39
+ }
40
+ return { status: response.status, body, raw };
41
+ }
42
+ export const methodCommand = {
43
+ command: "method <subcommand>",
44
+ describe: "Manage methods on the connected instance",
45
+ builder: (yargs) => yargs
46
+ .option("url", { type: "string", describe: "Override the active connection URL" })
47
+ .option("token", { type: "string", describe: "Override the active bearer token" })
48
+ .command("ls", "List methods on the instance", (y) => y, async (args) => {
49
+ const { url, token } = resolveConnection(args);
50
+ const { status, body, raw } = await callJson(`${url}/v1/methods`, token);
51
+ if (status !== 200) {
52
+ console.error(chalk.red(`Failed to list methods (HTTP ${status}).`));
53
+ if (raw)
54
+ console.error(raw);
55
+ process.exit(1);
56
+ }
57
+ const methods = body?.methods ?? [];
58
+ if (methods.length === 0) {
59
+ console.log(chalk.dim(" No methods on this instance."));
60
+ return;
61
+ }
62
+ console.log();
63
+ for (const m of methods) {
64
+ const id = m.method_id ?? m.id ?? "(?)";
65
+ const label = m.label ? ` ${chalk.dim(m.label)}` : "";
66
+ const kind = m.source_kind ? chalk.dim(`[${m.source_kind}]`) : "";
67
+ console.log(` ${chalk.bold(id)} ${kind}${label}`);
68
+ if (m.active_for_preparations?.length) {
69
+ console.log(chalk.dim(` used by: ${m.active_for_preparations.join(", ")}`));
70
+ }
71
+ }
72
+ console.log();
73
+ })
74
+ .command("install <path>", "Install a method package from a local folder", (y) => y.positional("path", { type: "string", demandOption: true, describe: "Path to the method package" }), async (args) => {
75
+ const { url, token } = resolveConnection(args);
76
+ const absolute = resolve(process.cwd(), args.path);
77
+ const { status, raw } = await callJson(`${url}/v1/methods`, token, { method: "POST", body: JSON.stringify({ source_path: absolute }) });
78
+ if (status !== 201 && status !== 200) {
79
+ console.error(chalk.red(`Failed to install method (HTTP ${status}).`));
80
+ if (raw)
81
+ console.error(raw);
82
+ process.exit(1);
83
+ }
84
+ console.log(chalk.green(`Installed method from ${absolute}.`));
85
+ })
86
+ .command("draft <prep-id>", "Start a method-authoring run for a preparation", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
87
+ const { url, token } = resolveConnection(args);
88
+ const { status, body, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/method-authoring-runs`, token, { method: "POST", body: JSON.stringify({}) });
89
+ if (status !== 201 && status !== 200) {
90
+ console.error(chalk.red(`Failed to start method-authoring run (HTTP ${status}).`));
91
+ if (raw)
92
+ console.error(raw);
93
+ process.exit(1);
94
+ }
95
+ console.log(chalk.green(`Method-authoring run ${chalk.bold(body?.run_id ?? "(?)")} started.`));
96
+ })
97
+ .command("improve <prep-id>", "Start a method-improvement run for a preparation", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
98
+ const { url, token } = resolveConnection(args);
99
+ const { status, body, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/method-improvement-runs`, token, { method: "POST", body: JSON.stringify({}) });
100
+ if (status !== 201 && status !== 200) {
101
+ console.error(chalk.red(`Failed to start method-improvement run (HTTP ${status}).`));
102
+ if (raw)
103
+ console.error(raw);
104
+ process.exit(1);
105
+ }
106
+ console.log(chalk.green(`Method-improvement run ${chalk.bold(body?.run_id ?? "(?)")} started.`));
107
+ })
108
+ .demandCommand(1)
109
+ .strict(),
110
+ handler: () => {
111
+ /* yargs subcommand handlers do the work */
112
+ },
113
+ };
@@ -0,0 +1,2 @@
1
+ import type { CommandModule } from "yargs";
2
+ export declare const prepCommand: CommandModule;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * `interf prep` — preparation CRUD against a connected instance.
3
+ *
4
+ * interf prep ls
5
+ * interf prep create <id> --source <path> --method <id> [--about <text>]
6
+ * interf prep show <id>
7
+ * interf prep rm <id>
8
+ *
9
+ * Every subcommand requires an active connection. If `~/.interf/connection.json`
10
+ * is missing or unreachable, the command exits non-zero with the
11
+ * connect-or-error hint.
12
+ */
13
+ import { resolve } from "node:path";
14
+ import chalk from "chalk";
15
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection, } from "../../packages/engine/connection-config.js";
16
+ import { preparationResourcePath } from "../../packages/engine/routes.js";
17
+ function requireConnection(args) {
18
+ const conn = readActiveConnection({
19
+ urlOverride: args.url,
20
+ authTokenOverride: args.token,
21
+ });
22
+ if (!conn) {
23
+ console.error(CONNECT_OR_ERROR_HINT);
24
+ process.exit(1);
25
+ }
26
+ return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
27
+ }
28
+ async function callJson(url, token, init = {}) {
29
+ const headers = new Headers(init.headers ?? {});
30
+ if (token)
31
+ headers.set("authorization", `Bearer ${token}`);
32
+ if (init.body && !headers.has("content-type")) {
33
+ headers.set("content-type", "application/json");
34
+ }
35
+ const response = await fetch(url, { ...init, headers });
36
+ const raw = await response.text();
37
+ let body = null;
38
+ if (raw.length > 0) {
39
+ try {
40
+ body = JSON.parse(raw);
41
+ }
42
+ catch {
43
+ body = null;
44
+ }
45
+ }
46
+ return { status: response.status, body, raw };
47
+ }
48
+ export const prepCommand = {
49
+ command: "prep <subcommand>",
50
+ describe: "Manage preparations on the connected instance",
51
+ builder: (yargs) => yargs
52
+ .option("url", { type: "string", describe: "Override the active connection URL" })
53
+ .option("token", { type: "string", describe: "Override the active bearer token" })
54
+ .command("ls", "List preparations", (y) => y, async (args) => {
55
+ const { url, token } = requireConnection(args);
56
+ const { status, body, raw } = await callJson(`${url}/v1/preparations`, token);
57
+ if (status !== 200 || !body) {
58
+ console.error(chalk.red(`Failed to list preparations (HTTP ${status}).`));
59
+ if (raw)
60
+ console.error(raw);
61
+ process.exit(1);
62
+ }
63
+ const preparations = body.preparations ?? [];
64
+ if (preparations.length === 0) {
65
+ console.log(chalk.dim(" No preparations yet. Create one with `interf prep create <id> --source <path> --method <method-id>`."));
66
+ return;
67
+ }
68
+ console.log();
69
+ console.log(chalk.bold(" Preparations"));
70
+ console.log();
71
+ for (const prep of preparations) {
72
+ const sourceLabel = prep.source?.locator ?? prep.source_path ?? "(no source)";
73
+ const method = prep.method_id ?? "(no method)";
74
+ const readiness = prep.readiness?.status ?? "—";
75
+ console.log(` ${prep.id}`);
76
+ console.log(chalk.dim(` source: ${sourceLabel}`));
77
+ console.log(chalk.dim(` method: ${method}`));
78
+ console.log(chalk.dim(` readiness: ${readiness}`));
79
+ }
80
+ })
81
+ .command("create <prep-id>", "Create a preparation (method binding optional — set later if you don't have one yet)", (y) => y
82
+ .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id (lowercase, dash-separated)" })
83
+ .option("source", { type: "string", demandOption: true, describe: "Path to the Source Folder" })
84
+ .option("method", { type: "string", describe: "Method id (e.g. interf-default). Optional — bind later via `interf prep set-method`." })
85
+ .option("about", { type: "string", describe: "One-line description of the agent work" }), async (args) => {
86
+ const { url, token } = requireConnection(args);
87
+ const sourceAbs = resolve(process.cwd(), args.source);
88
+ const requestBody = {
89
+ id: args.prepId,
90
+ source: { kind: "local-folder", locator: sourceAbs },
91
+ ...(args.method ? { method_id: args.method } : {}),
92
+ about: args.about,
93
+ checks: [],
94
+ };
95
+ const { status, body, raw } = await callJson(`${url}/v1/preparations`, token, { method: "POST", body: JSON.stringify(requestBody) });
96
+ if (status !== 201 && status !== 200) {
97
+ console.error(chalk.red(`Failed to create preparation (HTTP ${status}).`));
98
+ if (raw)
99
+ console.error(raw);
100
+ process.exit(1);
101
+ }
102
+ console.log(chalk.green(`Created preparation ${chalk.bold(args.prepId)}.`));
103
+ if (!args.method) {
104
+ console.log(chalk.dim(` no method bound yet — pick or draft one before compiling:`));
105
+ console.log(chalk.dim(` interf prep set-method ${args.prepId} <method-id>`));
106
+ console.log(chalk.dim(` interf method draft ${args.prepId}`));
107
+ }
108
+ if (body?.portable_context?.value) {
109
+ console.log(chalk.dim(` portable context (locator): ${body.portable_context.value}`));
110
+ }
111
+ })
112
+ .command("set-method <prep-id> <method-id>", "Bind a method to a preparation (or change which method it uses)", (y) => y
113
+ .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
114
+ .positional("method-id", { type: "string", demandOption: true, describe: "Method id to bind" }), async (args) => {
115
+ const { url, token } = requireConnection(args);
116
+ const { status, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token, { method: "PATCH", body: JSON.stringify({ method_id: args.methodId }) });
117
+ if (status !== 200) {
118
+ console.error(chalk.red(`Failed to set method (HTTP ${status}).`));
119
+ if (raw)
120
+ console.error(raw);
121
+ process.exit(1);
122
+ }
123
+ console.log(chalk.green(`Bound ${chalk.bold(args.methodId)} to ${chalk.bold(args.prepId)}.`));
124
+ })
125
+ .command("show <prep-id>", "Show a preparation's full record", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
126
+ const { url, token } = requireConnection(args);
127
+ const { status, body, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token);
128
+ if (status !== 200) {
129
+ console.error(chalk.red(`Failed to read preparation ${args.prepId} (HTTP ${status}).`));
130
+ if (raw)
131
+ console.error(raw);
132
+ process.exit(1);
133
+ }
134
+ console.log(JSON.stringify(body, null, 2));
135
+ })
136
+ .command("rm <prep-id>", "Delete a preparation", (y) => y.positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" }), async (args) => {
137
+ const { url, token } = requireConnection(args);
138
+ const { status, raw } = await callJson(`${url}${preparationResourcePath(args.prepId)}`, token, { method: "DELETE" });
139
+ if (status !== 200 && status !== 204) {
140
+ console.error(chalk.red(`Failed to delete preparation ${args.prepId} (HTTP ${status}).`));
141
+ if (raw)
142
+ console.error(raw);
143
+ process.exit(1);
144
+ }
145
+ console.log(chalk.green(`Deleted preparation ${chalk.bold(args.prepId)}.`));
146
+ })
147
+ .demandCommand(1)
148
+ .strict(),
149
+ handler: () => {
150
+ /* yargs subcommand handlers do the work */
151
+ },
152
+ };
@@ -1,2 +1,9 @@
1
1
  import type { CommandModule } from "yargs";
2
- export declare const resetCommand: CommandModule;
2
+ interface ResetArgs {
3
+ prepId: string;
4
+ mode?: "compile" | "all";
5
+ url?: string;
6
+ token?: string;
7
+ }
8
+ export declare const resetCommand: CommandModule<unknown, ResetArgs>;
9
+ export {};
@@ -1,33 +1,54 @@
1
+ /**
2
+ * `interf reset <prep-id>` — reset a preparation's compile output (or all state).
3
+ *
4
+ * interf reset bristol # default mode = compile
5
+ * interf reset bristol --mode all # also clear method draft / runs
6
+ */
1
7
  import chalk from "chalk";
2
- import { detectInterf } from "../../packages/project-model/interf.js";
3
- import { submitResetToLocalService, } from "../../packages/local-service/index.js";
4
- import { resolveSourceControlPath, } from "../../packages/project-model/interf.js";
8
+ import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/engine/connection-config.js";
9
+ function resolveConnection(args) {
10
+ const conn = readActiveConnection({
11
+ urlOverride: args.url,
12
+ authTokenOverride: args.token,
13
+ });
14
+ if (!conn) {
15
+ console.error(CONNECT_OR_ERROR_HINT);
16
+ process.exit(1);
17
+ }
18
+ return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
19
+ }
20
+ async function callJson(url, token, init = {}) {
21
+ const headers = new Headers(init.headers ?? {});
22
+ if (token)
23
+ headers.set("authorization", `Bearer ${token}`);
24
+ if (init.body && !headers.has("content-type"))
25
+ headers.set("content-type", "application/json");
26
+ const response = await fetch(url, { ...init, headers });
27
+ const raw = await response.text();
28
+ return { status: response.status, raw };
29
+ }
5
30
  export const resetCommand = {
6
- command: "reset <scope>",
7
- describe: "Reset generated Portable Context state while keeping source files and the local Method package",
8
- builder: (yargs) => yargs.positional("scope", {
31
+ command: "reset <prep-id>",
32
+ describe: "Reset a preparation's compile output",
33
+ builder: (yargs) => yargs
34
+ .positional("prep-id", { type: "string", demandOption: true, describe: "Preparation id" })
35
+ .option("mode", {
9
36
  type: "string",
10
37
  choices: ["compile", "all"],
11
- }),
12
- handler: async (argv) => {
13
- const detected = detectInterf(process.cwd());
14
- if (!detected) {
15
- process.exitCode = 1;
16
- console.log(chalk.red("Run this from inside a Portable Context."));
17
- return;
38
+ default: "compile",
39
+ describe: "Scope of the reset",
40
+ })
41
+ .option("url", { type: "string", describe: "Override the active connection URL" })
42
+ .option("token", { type: "string", describe: "Override the active bearer token" }),
43
+ handler: async (args) => {
44
+ const { url, token } = resolveConnection(args);
45
+ const { status, raw } = await callJson(`${url}/v1/preparations/${encodeURIComponent(args.prepId)}/reset`, token, { method: "POST", body: JSON.stringify({ scope: args.mode }) });
46
+ if (status !== 200 && status !== 204) {
47
+ console.error(chalk.red(`Failed to reset ${args.prepId} (HTTP ${status}).`));
48
+ if (raw)
49
+ console.error(raw);
50
+ process.exit(1);
18
51
  }
19
- const submitted = await submitResetToLocalService({
20
- projectPath: resolveSourceControlPath(detected.path),
21
- request: {
22
- preparation: detected.config.name,
23
- scope: argv.scope,
24
- },
25
- });
26
- if (!submitted) {
27
- process.exitCode = 1;
28
- console.log(chalk.red("Interf local service is not running. Start `interf web`, then retry reset so the mutation is visible through the service API."));
29
- return;
30
- }
31
- console.log(chalk.green(` ${submitted.result.message}`));
52
+ console.log(chalk.green(`Reset ${chalk.bold(args.prepId)} (${args.mode}).`));
32
53
  },
33
54
  };
@@ -0,0 +1,2 @@
1
+ import type { CommandModule } from "yargs";
2
+ export declare const runsCommand: CommandModule;