@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
@@ -1,627 +0,0 @@
1
- import { createServer } from "node:http";
2
- import { spawn } from "node:child_process";
3
- import { existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
- import { dirname, extname, join, normalize, resolve, sep } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { LocalServiceConfigSchema, LocalServiceDiscoverySchema, LocalServiceErrorSchema, LocalServicePointerSchema, OpenPathRequestSchema, PreparationSetupCreateRequestSchema, } from "./lib/schema.js";
7
- import { assertPathWithinRoot, } from "../shared/path-guards.js";
8
- import { createLocalServiceRuntime, } from "./runtime.js";
9
- import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_POINTER_PATH, LOCAL_SERVICE_ROUTES, } from "./routes.js";
10
- function packageRoot() {
11
- return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
12
- }
13
- export function resolveCompilerUiStaticRoot(rootPath = packageRoot()) {
14
- const distRoot = join(rootPath, "dist", "compiler-ui");
15
- const sourceExportRoot = join(rootPath, "apps", "compiler-ui", "out");
16
- if (existsSync(join(distRoot, "index.html")))
17
- return distRoot;
18
- if (existsSync(join(sourceExportRoot, "index.html")))
19
- return sourceExportRoot;
20
- return distRoot;
21
- }
22
- function compilerUiStaticRoot() {
23
- const explicit = process.env.INTERF_COMPILER_UI_STATIC_ROOT?.trim();
24
- if (explicit)
25
- return resolve(explicit);
26
- return resolveCompilerUiStaticRoot();
27
- }
28
- function localServicePointerPath(rootPath) {
29
- return join(rootPath, ...LOCAL_SERVICE_POINTER_PATH);
30
- }
31
- function writeLocalServicePointer(rootPath, pointer) {
32
- const pointerPath = localServicePointerPath(rootPath);
33
- mkdirSync(dirname(pointerPath), { recursive: true });
34
- const parsed = LocalServicePointerSchema.parse(pointer);
35
- writeFileSync(pointerPath, `${JSON.stringify(parsed, null, 2)}\n`);
36
- }
37
- function removeLocalServicePointer(rootPath, serviceUrl) {
38
- const pointerPath = localServicePointerPath(rootPath);
39
- if (!existsSync(pointerPath))
40
- return;
41
- try {
42
- const pointer = LocalServicePointerSchema.parse(JSON.parse(readFileSync(pointerPath, "utf8")));
43
- if (pointer.service_url !== serviceUrl || pointer.pid !== process.pid)
44
- return;
45
- rmSync(pointerPath, { force: true });
46
- }
47
- catch {
48
- return;
49
- }
50
- }
51
- function contentType(filePath) {
52
- switch (extname(filePath)) {
53
- case ".html":
54
- return "text/html; charset=utf-8";
55
- case ".js":
56
- return "text/javascript; charset=utf-8";
57
- case ".css":
58
- return "text/css; charset=utf-8";
59
- case ".json":
60
- return "application/json; charset=utf-8";
61
- case ".svg":
62
- return "image/svg+xml";
63
- case ".png":
64
- return "image/png";
65
- case ".ico":
66
- return "image/x-icon";
67
- case ".txt":
68
- return "text/plain; charset=utf-8";
69
- case ".map":
70
- return "application/json; charset=utf-8";
71
- case ".webmanifest":
72
- return "application/manifest+json; charset=utf-8";
73
- case ".woff2":
74
- return "font/woff2";
75
- default:
76
- return "application/octet-stream";
77
- }
78
- }
79
- function writeHeaders(res, statusCode, headers = {}) {
80
- res.writeHead(statusCode, {
81
- "access-control-allow-origin": "*",
82
- "access-control-allow-methods": "GET,POST,PATCH,OPTIONS",
83
- "access-control-allow-headers": "content-type",
84
- ...headers,
85
- });
86
- }
87
- function sendJson(res, statusCode, value) {
88
- writeHeaders(res, statusCode, {
89
- "content-type": "application/json; charset=utf-8",
90
- });
91
- res.end(`${JSON.stringify(value, null, 2)}\n`);
92
- }
93
- function sendText(res, statusCode, value) {
94
- writeHeaders(res, statusCode, {
95
- "content-type": "text/plain; charset=utf-8",
96
- });
97
- res.end(value);
98
- }
99
- function sendError(res, statusCode, message) {
100
- sendJson(res, statusCode, LocalServiceErrorSchema.parse({
101
- error: {
102
- message,
103
- },
104
- }));
105
- }
106
- function resolveOpenPath(allowedRoots, pathValue) {
107
- const roots = allowedRoots.map((root) => resolve(root));
108
- const targetPath = resolve(pathValue);
109
- for (const root of roots) {
110
- try {
111
- return assertPathWithinRoot(root, targetPath, "Open path");
112
- }
113
- catch {
114
- continue;
115
- }
116
- }
117
- throw new Error(`Open path must stay inside ${roots.join(" or ")}: ${targetPath}`);
118
- }
119
- async function openLocalPath(allowedRoots, pathValue) {
120
- const targetPath = resolveOpenPath(allowedRoots, pathValue);
121
- if (!existsSync(targetPath)) {
122
- throw new Error(`Path does not exist: ${targetPath}`);
123
- }
124
- if (process.env.INTERF_OPEN_PATH_DRY_RUN === "1") {
125
- return targetPath;
126
- }
127
- const isDirectory = statSync(targetPath).isDirectory();
128
- const command = process.platform === "darwin"
129
- ? "open"
130
- : process.platform === "win32"
131
- ? "explorer.exe"
132
- : "xdg-open";
133
- const args = process.platform === "darwin"
134
- ? (isDirectory ? [targetPath] : ["-R", targetPath])
135
- : process.platform === "win32"
136
- ? (isDirectory ? [targetPath] : ["/select,", targetPath])
137
- : [isDirectory ? targetPath : dirname(targetPath)];
138
- await new Promise((resolveOpen, rejectOpen) => {
139
- const child = spawn(command, args, {
140
- detached: true,
141
- stdio: "ignore",
142
- });
143
- child.once("error", rejectOpen);
144
- child.once("spawn", () => {
145
- child.unref();
146
- resolveOpen();
147
- });
148
- });
149
- return targetPath;
150
- }
151
- function parseRequestUrl(req) {
152
- return new URL(req.url ?? "/", "http://127.0.0.1");
153
- }
154
- function safeStaticPath(root, relativePath) {
155
- const normalized = normalize(relativePath).replace(/^(\.\.(?:\/|\\|$))+/, "");
156
- const absolute = resolve(root, normalized);
157
- const resolvedRoot = resolve(root);
158
- if (absolute !== resolvedRoot && !absolute.startsWith(`${resolvedRoot}${sep}`)) {
159
- return null;
160
- }
161
- return absolute;
162
- }
163
- function sendFile(res, filePath) {
164
- if (!existsSync(filePath))
165
- return false;
166
- try {
167
- if (!statSync(filePath).isFile())
168
- return false;
169
- writeHeaders(res, 200, {
170
- "content-type": contentType(filePath),
171
- });
172
- res.end(readFileSync(filePath));
173
- return true;
174
- }
175
- catch {
176
- return false;
177
- }
178
- }
179
- function sendCompilerUiAsset(req, res, _runtime) {
180
- const staticRoot = compilerUiStaticRoot();
181
- const url = parseRequestUrl(req);
182
- if (url.pathname === "/") {
183
- const indexPath = join(staticRoot, "index.html");
184
- if (sendFile(res, indexPath))
185
- return true;
186
- sendText(res, 503, "Interf UI assets are missing. Run `npm run web:build`, then restart `interf web`.\n");
187
- return true;
188
- }
189
- if (url.pathname.startsWith("/_next/static/")) {
190
- const relativePath = url.pathname.slice("/_next/static/".length);
191
- const assetPath = safeStaticPath(join(staticRoot, "_next", "static"), relativePath);
192
- if (assetPath && sendFile(res, assetPath))
193
- return true;
194
- }
195
- const assetPath = safeStaticPath(staticRoot, url.pathname.slice(1));
196
- if (assetPath && sendFile(res, assetPath))
197
- return true;
198
- return false;
199
- }
200
- async function readJsonBody(req) {
201
- const chunks = [];
202
- for await (const chunk of req) {
203
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
204
- }
205
- const raw = Buffer.concat(chunks).toString("utf8").trim();
206
- if (!raw)
207
- return {};
208
- return JSON.parse(raw);
209
- }
210
- async function routeApi(req, res, runtime) {
211
- const url = parseRequestUrl(req);
212
- const path = url.pathname;
213
- const method = req.method ?? "GET";
214
- if (method === "OPTIONS") {
215
- writeHeaders(res, 204);
216
- res.end();
217
- return true;
218
- }
219
- if (method === "GET" && path === "/health") {
220
- sendJson(res, 200, runtime.health());
221
- return true;
222
- }
223
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.api) {
224
- sendJson(res, 200, LocalServiceDiscoverySchema.parse({
225
- kind: "interf-local-service-discovery",
226
- version: 1,
227
- resources: {
228
- preparations: LOCAL_SERVICE_ROUTES.preparations,
229
- methods: LOCAL_SERVICE_ROUTES.methods,
230
- runs: LOCAL_SERVICE_ROUTES.runs,
231
- readiness: LOCAL_SERVICE_ROUTES.readiness,
232
- portable_contexts: LOCAL_SERVICE_ROUTES.portableContexts,
233
- source_files: LOCAL_SERVICE_ROUTES.sourceFiles,
234
- workspace_files: LOCAL_SERVICE_ROUTES.workspaceFiles,
235
- action_proposals: LOCAL_SERVICE_ROUTES.actionProposals,
236
- preparation_setups: LOCAL_SERVICE_ROUTES.preparationSetups,
237
- preparation_changes: LOCAL_SERVICE_ROUTES.preparationChanges,
238
- method_changes: LOCAL_SERVICE_ROUTES.methodChanges,
239
- readiness_check_drafts: LOCAL_SERVICE_ROUTES.readinessCheckDrafts,
240
- method_authoring_runs: LOCAL_SERVICE_ROUTES.methodAuthoringRuns,
241
- method_improvement_runs: LOCAL_SERVICE_ROUTES.methodImprovementRuns,
242
- compile_runs: LOCAL_SERVICE_ROUTES.compileRuns,
243
- test_runs: LOCAL_SERVICE_ROUTES.testRuns,
244
- reset: LOCAL_SERVICE_ROUTES.reset,
245
- executor: LOCAL_SERVICE_ROUTES.executor,
246
- },
247
- }));
248
- return true;
249
- }
250
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.preparations) {
251
- sendJson(res, 200, { preparations: runtime.listPreparations() });
252
- return true;
253
- }
254
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.preparationSetups) {
255
- try {
256
- const body = await readJsonBody(req);
257
- const request = PreparationSetupCreateRequestSchema.parse(body);
258
- const result = runtime.applyPreparationSetup(request);
259
- if (request.prepare_after_setup) {
260
- const resource = await runtime.createCompileRun({
261
- preparation: result.preparation,
262
- method: result.method,
263
- });
264
- sendJson(res, 202, {
265
- ...result,
266
- submitted_run_id: resource.run.run_id,
267
- submitted_run_type: "compile-run",
268
- message: `${result.message} Prepare run started.`,
269
- });
270
- }
271
- else {
272
- sendJson(res, 202, result);
273
- }
274
- }
275
- catch (error) {
276
- sendError(res, 409, error instanceof Error ? error.message : String(error));
277
- }
278
- return true;
279
- }
280
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.reset) {
281
- try {
282
- const body = await readJsonBody(req);
283
- sendJson(res, 202, runtime.applyReset(body));
284
- }
285
- catch (error) {
286
- sendError(res, 409, error instanceof Error ? error.message : String(error));
287
- }
288
- return true;
289
- }
290
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.preparationChanges) {
291
- try {
292
- const body = await readJsonBody(req);
293
- sendJson(res, 202, runtime.applyPreparationChange(body));
294
- }
295
- catch (error) {
296
- sendError(res, 409, error instanceof Error ? error.message : String(error));
297
- }
298
- return true;
299
- }
300
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.workspaceFiles) {
301
- sendJson(res, 200, { workspace_files: runtime.listWorkspaceFiles() });
302
- return true;
303
- }
304
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.readiness) {
305
- sendJson(res, 200, { readiness: runtime.listPreparationReadiness() });
306
- return true;
307
- }
308
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.sourceFiles) {
309
- const preparation = url.searchParams.get("preparation");
310
- sendJson(res, 200, { source_files: runtime.listSourceFiles(preparation) });
311
- return true;
312
- }
313
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.openPath) {
314
- const body = OpenPathRequestSchema.parse(await readJsonBody(req));
315
- const health = runtime.health();
316
- const allowedRoots = [
317
- runtime.rootPath,
318
- ...(health.source_folder_path ? [health.source_folder_path] : []),
319
- ];
320
- const openedPath = await openLocalPath(allowedRoots, body.path);
321
- sendJson(res, 202, { opened: true, path: openedPath });
322
- return true;
323
- }
324
- const preparationMatch = path.match(/^\/v1\/preparations\/([^/]+)$/);
325
- if (method === "GET" && preparationMatch?.[1]) {
326
- const preparation = runtime.getPreparation(decodeURIComponent(preparationMatch[1]));
327
- if (!preparation)
328
- sendError(res, 404, "Preparation not found.");
329
- else
330
- sendJson(res, 200, preparation);
331
- return true;
332
- }
333
- const preparationReadinessMatch = path.match(/^\/v1\/preparations\/([^/]+)\/readiness$/);
334
- if (method === "GET" && preparationReadinessMatch?.[1]) {
335
- const readiness = runtime.getPreparationReadiness(decodeURIComponent(preparationReadinessMatch[1]));
336
- if (!readiness)
337
- sendError(res, 404, "Preparation not found.");
338
- else
339
- sendJson(res, 200, readiness);
340
- return true;
341
- }
342
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.methods) {
343
- sendJson(res, 200, { methods: runtime.listMethods() });
344
- return true;
345
- }
346
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.methodChanges) {
347
- try {
348
- const body = await readJsonBody(req);
349
- sendJson(res, 202, runtime.applyMethodChange(body));
350
- }
351
- catch (error) {
352
- sendError(res, 409, error instanceof Error ? error.message : String(error));
353
- }
354
- return true;
355
- }
356
- const methodMatch = path.match(/^\/v1\/methods\/([^/]+)$/);
357
- if (method === "GET" && methodMatch?.[1]) {
358
- const methodResource = runtime.getMethod(decodeURIComponent(methodMatch[1]));
359
- if (!methodResource)
360
- sendError(res, 404, "Method not found.");
361
- else
362
- sendJson(res, 200, methodResource);
363
- return true;
364
- }
365
- if (method === "GET" && path === "/v1/jobs") {
366
- sendJson(res, 200, { jobs: runtime.listJobs() });
367
- return true;
368
- }
369
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.executor) {
370
- sendJson(res, 200, runtime.getExecutorStatus());
371
- return true;
372
- }
373
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.executor) {
374
- const body = await readJsonBody(req);
375
- sendJson(res, 202, runtime.selectExecutor(body));
376
- return true;
377
- }
378
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.actionProposals) {
379
- sendJson(res, 200, { action_proposals: runtime.listActionProposals() });
380
- return true;
381
- }
382
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.actionProposals) {
383
- const body = await readJsonBody(req);
384
- sendJson(res, 202, await runtime.createActionProposal(body));
385
- return true;
386
- }
387
- const actionProposalMatch = path.match(/^\/v1\/action-proposals\/([^/]+)(?:\/([^/]+))?$/);
388
- if (actionProposalMatch?.[1]) {
389
- const proposalId = decodeURIComponent(actionProposalMatch[1]);
390
- const child = actionProposalMatch[2];
391
- if (method === "GET" && !child) {
392
- const proposal = runtime.getActionProposal(proposalId);
393
- if (!proposal)
394
- sendError(res, 404, "Action proposal not found.");
395
- else
396
- sendJson(res, 200, proposal);
397
- return true;
398
- }
399
- if (method === "POST" && child === "decision") {
400
- const body = await readJsonBody(req);
401
- const proposal = await runtime.decideActionProposal(proposalId, body);
402
- if (!proposal)
403
- sendError(res, 404, "Action proposal not found.");
404
- else
405
- sendJson(res, 202, proposal);
406
- return true;
407
- }
408
- }
409
- if (method === "GET" && path === LOCAL_SERVICE_ROUTES.runs) {
410
- sendJson(res, 200, { runs: runtime.listRunObservability() });
411
- return true;
412
- }
413
- const observableRunMatch = path.match(/^\/v1\/runs\/([^/]+)$/);
414
- if (method === "GET" && observableRunMatch?.[1]) {
415
- const run = runtime.getRunObservability(decodeURIComponent(observableRunMatch[1]));
416
- if (!run)
417
- sendError(res, 404, "Run not found.");
418
- else
419
- sendJson(res, 200, run);
420
- return true;
421
- }
422
- const jobMatch = path.match(/^\/v1\/jobs\/([^/]+)(?:\/([^/]+))?$/);
423
- if (jobMatch?.[1]) {
424
- const runId = decodeURIComponent(jobMatch[1]);
425
- const child = jobMatch[2];
426
- if (method === "GET" && !child) {
427
- const job = runtime.getJob(runId);
428
- if (!job)
429
- sendError(res, 404, "Job run not found.");
430
- else
431
- sendJson(res, 200, job);
432
- return true;
433
- }
434
- if (method === "GET" && child === "events") {
435
- const events = runtime.getJobEvents(runId);
436
- if (!events)
437
- sendError(res, 404, "Job run not found.");
438
- else
439
- sendJson(res, 200, { events });
440
- return true;
441
- }
442
- }
443
- if (method === "POST" && path === "/v1/readiness-check-drafts") {
444
- const body = await readJsonBody(req);
445
- const job = await runtime.createReadinessCheckDraftRun(body);
446
- sendJson(res, 202, job);
447
- return true;
448
- }
449
- if (method === "POST" &&
450
- path === LOCAL_SERVICE_ROUTES.methodAuthoringRuns) {
451
- const body = await readJsonBody(req);
452
- const job = await runtime.createMethodAuthoringRun(body);
453
- sendJson(res, 202, job);
454
- return true;
455
- }
456
- if (method === "POST" &&
457
- path === LOCAL_SERVICE_ROUTES.methodImprovementRuns) {
458
- const body = await readJsonBody(req);
459
- const job = await runtime.createMethodAuthoringRun(body, "method-improvement");
460
- sendJson(res, 202, job);
461
- return true;
462
- }
463
- if (method === "GET" && path === "/v1/compile-runs") {
464
- sendJson(res, 200, { compile_runs: runtime.listCompileRuns() });
465
- return true;
466
- }
467
- if (method === "POST" && path === "/v1/compile-runs") {
468
- try {
469
- const body = await readJsonBody(req);
470
- const resource = await runtime.createCompileRun(body);
471
- sendJson(res, 202, resource);
472
- }
473
- catch (error) {
474
- sendError(res, 409, error instanceof Error ? error.message : String(error));
475
- }
476
- return true;
477
- }
478
- const compileRunMatch = path.match(/^\/v1\/compile-runs\/([^/]+)(?:\/([^/]+))?$/);
479
- if (compileRunMatch?.[1]) {
480
- const runId = decodeURIComponent(compileRunMatch[1]);
481
- const child = compileRunMatch[2];
482
- if (method === "GET" && !child) {
483
- const run = runtime.getCompileRun(runId);
484
- if (!run)
485
- sendError(res, 404, "Compile run not found.");
486
- else
487
- sendJson(res, 200, run);
488
- return true;
489
- }
490
- if (method === "GET" && child === "events") {
491
- const events = runtime.getCompileRunEvents(runId);
492
- if (!events)
493
- sendError(res, 404, "Compile run not found.");
494
- else
495
- sendJson(res, 200, { events });
496
- return true;
497
- }
498
- if (method === "GET" && child === "proof") {
499
- const proof = runtime.getCompileRunProof(runId);
500
- if (!proof)
501
- sendError(res, 404, "Compile run not found.");
502
- else
503
- sendJson(res, 200, { proof });
504
- return true;
505
- }
506
- if (method === "GET" && child === "artifacts") {
507
- const artifacts = runtime.getCompileRunArtifacts(runId);
508
- if (!artifacts)
509
- sendError(res, 404, "Compile run not found.");
510
- else
511
- sendJson(res, 200, { artifacts });
512
- return true;
513
- }
514
- if (method === "POST" && child === "cancel") {
515
- sendError(res, 501, "Compile-run cancellation is not implemented yet.");
516
- return true;
517
- }
518
- }
519
- if (method === "GET" && path === "/v1/test-runs") {
520
- sendJson(res, 200, { test_runs: runtime.listTestRuns() });
521
- return true;
522
- }
523
- if (method === "POST" && path === "/v1/test-runs") {
524
- const body = await readJsonBody(req);
525
- const resource = await runtime.createTestRun(body);
526
- sendJson(res, 202, resource);
527
- return true;
528
- }
529
- const testRunMatch = path.match(/^\/v1\/test-runs\/([^/]+)$/);
530
- if (method === "GET" && testRunMatch?.[1]) {
531
- const run = runtime.getTestRun(decodeURIComponent(testRunMatch[1]));
532
- if (!run)
533
- sendError(res, 404, "Readiness check run not found.");
534
- else
535
- sendJson(res, 200, run);
536
- return true;
537
- }
538
- if (method === "GET" && path === "/v1/portable-contexts") {
539
- sendJson(res, 200, { portable_contexts: runtime.listPortableContexts() });
540
- return true;
541
- }
542
- const portableContextMatch = path.match(/^\/v1\/portable-contexts\/([^/]+)$/);
543
- if (method === "GET" && portableContextMatch?.[1]) {
544
- const context = runtime.getPortableContext(decodeURIComponent(portableContextMatch[1]));
545
- if (!context)
546
- sendError(res, 404, "Portable context not found.");
547
- else
548
- sendJson(res, 200, context);
549
- return true;
550
- }
551
- return false;
552
- }
553
- export function createLocalServiceServer(runtime) {
554
- return createServer((req, res) => {
555
- void (async () => {
556
- try {
557
- const routed = await routeApi(req, res, runtime);
558
- if (routed)
559
- return;
560
- if (sendCompilerUiAsset(req, res, runtime))
561
- return;
562
- sendText(res, 404, "Not found.\n");
563
- }
564
- catch (error) {
565
- sendError(res, 500, error instanceof Error ? error.message : String(error));
566
- }
567
- })();
568
- });
569
- }
570
- function resolvePort(optionPort) {
571
- if (typeof optionPort === "number")
572
- return optionPort;
573
- const envPort = Number.parseInt(process.env.INTERF_SERVICE_PORT ?? "", 10);
574
- return Number.isInteger(envPort) ? envPort : LOCAL_SERVICE_DEFAULT_PORT;
575
- }
576
- export async function startLocalService(options = {}) {
577
- const config = LocalServiceConfigSchema.parse({
578
- host: options.host ?? process.env.INTERF_SERVICE_HOST ?? LOCAL_SERVICE_DEFAULT_HOST,
579
- port: resolvePort(options.port),
580
- });
581
- const rootPath = options.rootPath ?? process.cwd();
582
- const runtime = createLocalServiceRuntime({
583
- rootPath,
584
- host: config.host,
585
- port: config.port,
586
- packageVersion: options.packageVersion,
587
- handlers: options.handlers,
588
- });
589
- const server = createLocalServiceServer(runtime);
590
- await new Promise((resolveListen, rejectListen) => {
591
- const onError = (error) => {
592
- server.off("listening", onListening);
593
- rejectListen(error);
594
- };
595
- const onListening = () => {
596
- server.off("error", onError);
597
- resolveListen();
598
- };
599
- server.once("error", onError);
600
- server.once("listening", onListening);
601
- server.listen(config.port, config.host);
602
- });
603
- const url = runtime.health().service_url;
604
- writeLocalServicePointer(rootPath, {
605
- service_url: url,
606
- host: config.host,
607
- port: config.port,
608
- pid: process.pid,
609
- control_path: resolve(rootPath),
610
- started_at: new Date().toISOString(),
611
- });
612
- return {
613
- runtime,
614
- server,
615
- url,
616
- close: () => new Promise((resolveClose, rejectClose) => {
617
- server.close((error) => {
618
- if (error) {
619
- rejectClose(error);
620
- return;
621
- }
622
- removeLocalServicePointer(rootPath, url);
623
- resolveClose();
624
- });
625
- }),
626
- };
627
- }
@@ -1,11 +0,0 @@
1
- export * as builtinMethod from "./builtin-compiled-method.js";
2
- export * as contextInterface from "./context-interface.js";
3
- export * as localMethods from "./local-methods.js";
4
- export * as packageWriters from "./interf-method-package.js";
5
- export * as methodDefinitions from "./method-definitions.js";
6
- export * as methodHelpers from "./method-helpers.js";
7
- export * as methodStagePolicy from "./method-stage-policy.js";
8
- export * as methodStageRunner from "./method-stage-runner.js";
9
- export * as methodReviewPaths from "./method-review-paths.js";
10
- export * as packageRoot from "./lib/package-root.js";
11
- export { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, ContextInterfaceZoneSchema, ContextInterfaceZoneIdSchema, ContextInterfaceZoneRoleSchema, MethodInputSpecSchema, MethodInputContractSchema, contextInterfaceFilePath, resolveContextInterfacePath, contextInterfaceExists, contextInterfaceRelativePath, listContextInterfaceZones, findContextInterfaceZone, contextInterfaceZoneAbsolutePath, contextInterfaceArtifactPath, contextInterfaceArtifactPathsForZoneIds, buildContextInterface, writeContextInterfaceFile, writeContextInterface, readContextInterface, type ContextInterface, type ContextInterfaceZone, type ContextInterfaceZoneId, type ContextInterfaceZoneRole, type ContextInterfaceStageLike, type MethodInputSpec, type ContextInterfaceSummary, summarizeContextInterface, deriveMethodInputsFromContextInterface, } from "./context-interface.js";
@@ -1,11 +0,0 @@
1
- export * as builtinMethod from "./builtin-compiled-method.js";
2
- export * as contextInterface from "./context-interface.js";
3
- export * as localMethods from "./local-methods.js";
4
- export * as packageWriters from "./interf-method-package.js";
5
- export * as methodDefinitions from "./method-definitions.js";
6
- export * as methodHelpers from "./method-helpers.js";
7
- export * as methodStagePolicy from "./method-stage-policy.js";
8
- export * as methodStageRunner from "./method-stage-runner.js";
9
- export * as methodReviewPaths from "./method-review-paths.js";
10
- export * as packageRoot from "./lib/package-root.js";
11
- export { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, ContextInterfaceZoneSchema, ContextInterfaceZoneIdSchema, ContextInterfaceZoneRoleSchema, MethodInputSpecSchema, MethodInputContractSchema, contextInterfaceFilePath, resolveContextInterfacePath, contextInterfaceExists, contextInterfaceRelativePath, listContextInterfaceZones, findContextInterfaceZone, contextInterfaceZoneAbsolutePath, contextInterfaceArtifactPath, contextInterfaceArtifactPathsForZoneIds, buildContextInterface, writeContextInterfaceFile, writeContextInterface, readContextInterface, summarizeContextInterface, deriveMethodInputsFromContextInterface, } from "./context-interface.js";
@@ -1,5 +0,0 @@
1
- export interface StagePolicyStageLike {
2
- id: string;
3
- }
4
- export declare function normalizeStagePolicyNotes(value: unknown): Record<string, string[]> | undefined;
5
- export declare function mergeStagePolicyNotesForStages(stages: readonly StagePolicyStageLike[], baseNotes: unknown, overrideNotes: Record<string, string[]> | undefined): Record<string, string[]> | undefined;
@@ -1,31 +0,0 @@
1
- export function normalizeStagePolicyNotes(value) {
2
- if (!value || typeof value !== "object" || Array.isArray(value))
3
- return undefined;
4
- const normalized = {};
5
- for (const [stageId, notes] of Object.entries(value)) {
6
- if (!Array.isArray(notes))
7
- continue;
8
- const cleaned = Array.from(new Set(notes
9
- .filter((note) => typeof note === "string")
10
- .map((note) => note.trim())
11
- .filter((note) => note.length > 0)));
12
- if (cleaned.length > 0) {
13
- normalized[stageId] = cleaned;
14
- }
15
- }
16
- return Object.keys(normalized).length > 0 ? normalized : undefined;
17
- }
18
- export function mergeStagePolicyNotesForStages(stages, baseNotes, overrideNotes) {
19
- const normalizedBase = normalizeStagePolicyNotes(baseNotes);
20
- const merged = {};
21
- for (const stage of stages) {
22
- const combined = Array.from(new Set([
23
- ...(normalizedBase?.[stage.id] ?? []),
24
- ...((overrideNotes?.[stage.id] ?? []).map((note) => note.trim()).filter((note) => note.length > 0)),
25
- ]));
26
- if (combined.length > 0) {
27
- merged[stage.id] = combined;
28
- }
29
- }
30
- return Object.keys(merged).length > 0 ? merged : undefined;
31
- }