@interf/compiler 0.7.3 → 0.9.3

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 (418) hide show
  1. package/README.md +124 -90
  2. package/TRADEMARKS.md +1 -1
  3. package/agent-skills/interf-actions/SKILL.md +74 -0
  4. package/agent-skills/interf-actions/references/cli.md +190 -0
  5. package/{builtin-workflows/interf → builtin-methods/interf-default}/README.md +9 -9
  6. package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/shape/SKILL.md +4 -4
  7. package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/structure/SKILL.md +1 -1
  8. package/builtin-methods/interf-default/improve/SKILL.md +18 -0
  9. package/{builtin-workflows/interf/workflow.json → builtin-methods/interf-default/method.json} +9 -9
  10. package/{builtin-workflows/interf/workflow.schema.json → builtin-methods/interf-default/method.schema.json} +3 -3
  11. package/{builtin-workflows/interf → builtin-methods/interf-default}/use/query/SKILL.md +1 -1
  12. package/dist/cli/commands/check-draft.d.ts +11 -10
  13. package/dist/cli/commands/check-draft.js +21 -20
  14. package/dist/cli/commands/compile-controller.d.ts +10 -7
  15. package/dist/cli/commands/compile-controller.js +84 -79
  16. package/dist/cli/commands/compile.d.ts +3 -3
  17. package/dist/cli/commands/compile.js +101 -43
  18. package/dist/cli/commands/compiled-flow.d.ts +14 -11
  19. package/dist/cli/commands/compiled-flow.js +38 -33
  20. package/dist/cli/commands/control-path.d.ts +11 -0
  21. package/dist/cli/commands/control-path.js +72 -0
  22. package/dist/cli/commands/create-method-wizard.d.ts +76 -0
  23. package/dist/cli/commands/create-method-wizard.js +465 -0
  24. package/dist/cli/commands/create.d.ts +3 -3
  25. package/dist/cli/commands/create.js +81 -68
  26. package/dist/cli/commands/default.js +4 -3
  27. package/dist/cli/commands/doctor.js +5 -5
  28. package/dist/cli/commands/executor-flow.d.ts +6 -6
  29. package/dist/cli/commands/executor-flow.js +2 -2
  30. package/dist/cli/commands/init.d.ts +2 -2
  31. package/dist/cli/commands/init.js +415 -144
  32. package/dist/cli/commands/list.js +16 -14
  33. package/dist/cli/commands/preparation-selection.d.ts +6 -0
  34. package/dist/cli/commands/preparation-selection.js +11 -0
  35. package/dist/cli/commands/reset.js +3 -3
  36. package/dist/cli/commands/source-config-wizard.d.ts +12 -11
  37. package/dist/cli/commands/source-config-wizard.js +206 -228
  38. package/dist/cli/commands/status.js +152 -17
  39. package/dist/cli/commands/test-flow.d.ts +16 -16
  40. package/dist/cli/commands/test-flow.js +53 -243
  41. package/dist/cli/commands/test.d.ts +6 -2
  42. package/dist/cli/commands/test.js +136 -100
  43. package/dist/cli/commands/verify.js +13 -13
  44. package/dist/cli/commands/web.d.ts +11 -0
  45. package/dist/cli/commands/web.js +386 -0
  46. package/dist/cli/index.d.ts +2 -1
  47. package/dist/cli/index.js +3 -1
  48. package/dist/compiler-ui/404.html +1 -0
  49. package/dist/compiler-ui/__next.__PAGE__.txt +10 -0
  50. package/dist/compiler-ui/__next._full.txt +20 -0
  51. package/dist/compiler-ui/__next._head.txt +5 -0
  52. package/dist/compiler-ui/__next._index.txt +5 -0
  53. package/dist/compiler-ui/__next._tree.txt +5 -0
  54. package/dist/compiler-ui/_next/static/chunks/03~yq9q893hmn.js +1 -0
  55. package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +5 -0
  56. package/dist/compiler-ui/_next/static/chunks/06z~l3kwb891e.js +1 -0
  57. package/dist/compiler-ui/_next/static/chunks/08g7lvje.te.u.js +1 -0
  58. package/dist/compiler-ui/_next/static/chunks/08m7vf5asqlsm.js +91 -0
  59. package/dist/compiler-ui/_next/static/chunks/0_i-3_5l9t2qe.js +1 -0
  60. package/dist/compiler-ui/_next/static/chunks/0b-ywny_j0g~0.js +1 -0
  61. package/dist/compiler-ui/_next/static/chunks/0b52v41o1gixx.js +1 -0
  62. package/dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css +3 -0
  63. package/dist/compiler-ui/_next/static/chunks/0gpzgsv0w.q~m.js +31 -0
  64. package/dist/compiler-ui/_next/static/chunks/0ilwfezfvu6~-.js +1 -0
  65. package/dist/compiler-ui/_next/static/chunks/0n51hrfoufc7g.js +1 -0
  66. package/dist/compiler-ui/_next/static/chunks/0xxmf45eskdt~.css +1 -0
  67. package/dist/compiler-ui/_next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
  68. package/dist/compiler-ui/_next/static/chunks/14wtz~vq25~qq.js +1 -0
  69. package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +118 -0
  70. package/dist/compiler-ui/_next/static/chunks/turbopack-0.uq1k8c0j4s..js +1 -0
  71. package/dist/compiler-ui/_next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
  72. package/dist/compiler-ui/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
  73. package/dist/compiler-ui/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
  74. package/dist/compiler-ui/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
  75. package/dist/compiler-ui/_next/static/media/worker.102zas1s52_pf.js +109 -0
  76. package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_buildManifest.js +11 -0
  77. package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_clientMiddlewareManifest.js +1 -0
  78. package/dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK/_ssgManifest.js +1 -0
  79. package/dist/compiler-ui/_not-found/__next._full.txt +15 -0
  80. package/dist/compiler-ui/_not-found/__next._head.txt +5 -0
  81. package/dist/compiler-ui/_not-found/__next._index.txt +5 -0
  82. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +5 -0
  83. package/dist/compiler-ui/_not-found/__next._not-found.txt +5 -0
  84. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -0
  85. package/dist/compiler-ui/_not-found.html +1 -0
  86. package/dist/compiler-ui/_not-found.txt +15 -0
  87. package/dist/compiler-ui/index.html +1 -0
  88. package/dist/compiler-ui/index.txt +20 -0
  89. package/dist/index.d.ts +11 -7
  90. package/dist/index.js +8 -4
  91. package/dist/packages/agents/index.d.ts +1 -1
  92. package/dist/packages/agents/lib/args.d.ts +2 -2
  93. package/dist/packages/agents/lib/compiled-bootstrap.js +7 -6
  94. package/dist/packages/agents/lib/execution-profile.d.ts +5 -5
  95. package/dist/packages/agents/lib/execution-profile.js +7 -6
  96. package/dist/packages/agents/lib/execution.js +4 -2
  97. package/dist/packages/agents/lib/executors.d.ts +14 -13
  98. package/dist/packages/agents/lib/executors.js +1 -0
  99. package/dist/packages/agents/lib/preflight.d.ts +1 -0
  100. package/dist/packages/agents/lib/preflight.js +32 -9
  101. package/dist/packages/agents/lib/render.d.ts +2 -2
  102. package/dist/packages/agents/lib/render.js +10 -9
  103. package/dist/packages/agents/lib/shells.d.ts +27 -34
  104. package/dist/packages/agents/lib/shells.js +191 -235
  105. package/dist/packages/agents/lib/types.d.ts +3 -2
  106. package/dist/packages/compiler/artifact-counts.d.ts +1 -0
  107. package/dist/packages/compiler/artifact-counts.js +30 -0
  108. package/dist/packages/compiler/compiled-paths.d.ts +5 -5
  109. package/dist/packages/compiler/compiled-paths.js +10 -10
  110. package/dist/packages/compiler/compiled-pipeline.d.ts +18 -12
  111. package/dist/packages/compiler/compiled-pipeline.js +34 -23
  112. package/dist/packages/compiler/compiled-schema.d.ts +20 -20
  113. package/dist/packages/compiler/compiled-schema.js +29 -29
  114. package/dist/packages/compiler/compiled-stage-plan.d.ts +4 -4
  115. package/dist/packages/compiler/compiled-stage-plan.js +11 -11
  116. package/dist/packages/compiler/compiled-stage-runner.d.ts +10 -5
  117. package/dist/packages/compiler/compiled-stage-runner.js +56 -8
  118. package/dist/packages/compiler/compiled-target.d.ts +5 -5
  119. package/dist/packages/compiler/compiled-target.js +5 -5
  120. package/dist/packages/compiler/index.d.ts +3 -3
  121. package/dist/packages/compiler/index.js +2 -2
  122. package/dist/packages/compiler/lib/schema.d.ts +68 -93
  123. package/dist/packages/compiler/lib/schema.js +57 -89
  124. package/dist/packages/compiler/{workflows.d.ts → method-runs.d.ts} +4 -4
  125. package/dist/packages/compiler/{workflows.js → method-runs.js} +4 -3
  126. package/dist/packages/compiler/raw-snapshot.d.ts +3 -3
  127. package/dist/packages/compiler/raw-snapshot.js +0 -1
  128. package/dist/packages/compiler/reset.js +3 -3
  129. package/dist/packages/compiler/runtime-acceptance.js +9 -16
  130. package/dist/packages/compiler/runtime-contracts.js +9 -9
  131. package/dist/packages/compiler/runtime-prompt.js +9 -9
  132. package/dist/packages/compiler/runtime-reconcile.d.ts +2 -2
  133. package/dist/packages/compiler/runtime-reconcile.js +3 -3
  134. package/dist/packages/compiler/runtime-runs.js +12 -9
  135. package/dist/packages/compiler/runtime-types.d.ts +9 -7
  136. package/dist/packages/compiler/state-health.js +26 -35
  137. package/dist/packages/compiler/state-view.js +6 -6
  138. package/dist/packages/compiler/validate-compiled.d.ts +5 -5
  139. package/dist/packages/compiler/validate-compiled.js +56 -62
  140. package/dist/packages/compiler/validate.d.ts +2 -2
  141. package/dist/packages/compiler/validate.js +22 -14
  142. package/dist/packages/contracts/index.d.ts +2 -0
  143. package/dist/packages/contracts/index.js +1 -0
  144. package/dist/packages/contracts/lib/schema.d.ts +205 -0
  145. package/dist/packages/contracts/lib/schema.js +101 -0
  146. package/dist/packages/execution/adapters.d.ts +15 -0
  147. package/dist/packages/execution/adapters.js +1 -0
  148. package/dist/packages/execution/events.d.ts +8 -0
  149. package/dist/packages/execution/events.js +16 -0
  150. package/dist/packages/execution/index.d.ts +9 -0
  151. package/dist/packages/execution/index.js +6 -0
  152. package/dist/packages/execution/lib/schema.d.ts +1551 -0
  153. package/dist/packages/execution/lib/schema.js +296 -0
  154. package/dist/packages/local-service/action-values.d.ts +22 -0
  155. package/dist/packages/local-service/action-values.js +30 -0
  156. package/dist/packages/local-service/client.d.ts +119 -0
  157. package/dist/packages/local-service/client.js +356 -0
  158. package/dist/packages/local-service/index.d.ts +15 -0
  159. package/dist/packages/local-service/index.js +11 -0
  160. package/dist/packages/local-service/lib/schema.d.ts +6917 -0
  161. package/dist/packages/local-service/lib/schema.js +519 -0
  162. package/dist/packages/local-service/routes.d.ts +27 -0
  163. package/dist/packages/local-service/routes.js +32 -0
  164. package/dist/packages/local-service/run-observability.d.ts +6 -0
  165. package/dist/packages/local-service/run-observability.js +592 -0
  166. package/dist/packages/local-service/runtime.d.ts +130 -0
  167. package/dist/packages/local-service/runtime.js +2263 -0
  168. package/dist/packages/local-service/server.d.ts +18 -0
  169. package/dist/packages/local-service/server.js +577 -0
  170. package/dist/packages/method-authoring/index.d.ts +4 -0
  171. package/dist/packages/method-authoring/index.js +4 -0
  172. package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.d.ts → method-authoring/lib/method-edit-utils.d.ts} +3 -3
  173. package/dist/packages/method-authoring/method-authoring.d.ts +24 -0
  174. package/dist/packages/method-authoring/method-authoring.js +116 -0
  175. package/dist/packages/method-authoring/method-edit-session.d.ts +18 -0
  176. package/dist/packages/method-authoring/method-edit-session.js +125 -0
  177. package/dist/packages/method-authoring/method-improvement.d.ts +23 -0
  178. package/dist/packages/{workflow-authoring/workflow-improvement.js → method-authoring/method-improvement.js} +65 -64
  179. package/dist/packages/{workflow-package/builtin-compiled-workflow.d.ts → method-package/builtin-compiled-method.d.ts} +1 -1
  180. package/dist/packages/{workflow-package/builtin-compiled-workflow.js → method-package/builtin-compiled-method.js} +17 -17
  181. package/dist/packages/{workflow-package → method-package}/context-interface.d.ts +12 -12
  182. package/dist/packages/{workflow-package → method-package}/context-interface.js +20 -20
  183. package/dist/packages/method-package/index.d.ts +11 -0
  184. package/dist/packages/method-package/index.js +11 -0
  185. package/dist/packages/method-package/interf-method-package.d.ts +31 -0
  186. package/dist/packages/method-package/interf-method-package.js +496 -0
  187. package/dist/packages/{workflow-package → method-package}/lib/package-root.js +1 -1
  188. package/dist/packages/method-package/local-methods.d.ts +64 -0
  189. package/dist/packages/method-package/local-methods.js +466 -0
  190. package/dist/packages/method-package/method-definitions.d.ts +83 -0
  191. package/dist/packages/method-package/method-definitions.js +205 -0
  192. package/dist/packages/{workflow-package/workflow-helpers.d.ts → method-package/method-helpers.d.ts} +10 -10
  193. package/dist/packages/{workflow-package/workflow-helpers.js → method-package/method-helpers.js} +27 -27
  194. package/dist/packages/method-package/method-review-paths.d.ts +10 -0
  195. package/dist/packages/{workflow-package/workflow-review-paths.js → method-package/method-review-paths.js} +4 -4
  196. package/dist/packages/{workflow-package/workflow-stage-runner.d.ts → method-package/method-stage-runner.d.ts} +13 -11
  197. package/dist/packages/{workflow-package/workflow-stage-runner.js → method-package/method-stage-runner.js} +8 -6
  198. package/dist/packages/methods/index.d.ts +2 -0
  199. package/dist/packages/methods/index.js +2 -0
  200. package/dist/packages/methods/method-resolution.d.ts +6 -0
  201. package/dist/packages/methods/method-resolution.js +7 -0
  202. package/dist/packages/project-model/index.d.ts +2 -4
  203. package/dist/packages/project-model/index.js +1 -3
  204. package/dist/packages/project-model/interf-detect.d.ts +3 -3
  205. package/dist/packages/project-model/interf-detect.js +18 -14
  206. package/dist/packages/project-model/interf-scaffold.d.ts +2 -2
  207. package/dist/packages/project-model/interf-scaffold.js +40 -38
  208. package/dist/packages/project-model/interf.d.ts +1 -2
  209. package/dist/packages/project-model/interf.js +1 -2
  210. package/dist/packages/project-model/lib/schema.d.ts +24 -14
  211. package/dist/packages/project-model/lib/schema.js +22 -30
  212. package/dist/packages/project-model/project-paths.d.ts +9 -10
  213. package/dist/packages/project-model/project-paths.js +14 -17
  214. package/dist/packages/project-model/source-config.d.ts +19 -17
  215. package/dist/packages/project-model/source-config.js +144 -145
  216. package/dist/packages/project-model/source-folders.d.ts +11 -0
  217. package/dist/packages/project-model/source-folders.js +110 -0
  218. package/dist/packages/testing/index.d.ts +2 -2
  219. package/dist/packages/testing/index.js +1 -1
  220. package/dist/packages/testing/lib/schema.d.ts +11 -11
  221. package/dist/packages/testing/lib/schema.js +8 -9
  222. package/dist/packages/testing/readiness-check-run.d.ts +67 -0
  223. package/dist/packages/testing/readiness-check-run.js +258 -0
  224. package/dist/packages/testing/test-execution.d.ts +3 -3
  225. package/dist/packages/testing/test-execution.js +8 -8
  226. package/dist/packages/testing/test-paths.js +7 -9
  227. package/dist/packages/testing/test-profile-presets.js +2 -2
  228. package/dist/packages/testing/test-sandbox.js +10 -11
  229. package/dist/packages/testing/test-targets.d.ts +1 -1
  230. package/dist/packages/testing/test-targets.js +8 -7
  231. package/dist/packages/testing/test-types.d.ts +1 -1
  232. package/package.json +29 -30
  233. package/builtin-workflows/interf/improve/SKILL.md +0 -18
  234. package/dist/cli/commands/create-workflow-wizard.d.ts +0 -70
  235. package/dist/cli/commands/create-workflow-wizard.js +0 -361
  236. package/dist/cli/commands/dataset-selection.d.ts +0 -6
  237. package/dist/cli/commands/dataset-selection.js +0 -11
  238. package/dist/lib/agent-args.d.ts +0 -1
  239. package/dist/lib/agent-args.js +0 -1
  240. package/dist/lib/agent-constants.d.ts +0 -1
  241. package/dist/lib/agent-constants.js +0 -1
  242. package/dist/lib/agent-detection.d.ts +0 -1
  243. package/dist/lib/agent-detection.js +0 -1
  244. package/dist/lib/agent-execution.d.ts +0 -1
  245. package/dist/lib/agent-execution.js +0 -1
  246. package/dist/lib/agent-logs.d.ts +0 -1
  247. package/dist/lib/agent-logs.js +0 -1
  248. package/dist/lib/agent-preflight.d.ts +0 -1
  249. package/dist/lib/agent-preflight.js +0 -1
  250. package/dist/lib/agent-render.d.ts +0 -1
  251. package/dist/lib/agent-render.js +0 -1
  252. package/dist/lib/agent-shells.d.ts +0 -1
  253. package/dist/lib/agent-shells.js +0 -1
  254. package/dist/lib/agent-status.d.ts +0 -1
  255. package/dist/lib/agent-status.js +0 -1
  256. package/dist/lib/agent-types.d.ts +0 -1
  257. package/dist/lib/agent-types.js +0 -1
  258. package/dist/lib/agents.d.ts +0 -1
  259. package/dist/lib/agents.js +0 -1
  260. package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
  261. package/dist/lib/builtin-compiled-workflow.js +0 -1
  262. package/dist/lib/chart-guidance.d.ts +0 -1
  263. package/dist/lib/chart-guidance.js +0 -1
  264. package/dist/lib/compiled-compile.d.ts +0 -1
  265. package/dist/lib/compiled-compile.js +0 -1
  266. package/dist/lib/compiled-paths.d.ts +0 -1
  267. package/dist/lib/compiled-paths.js +0 -3
  268. package/dist/lib/compiled-raw.d.ts +0 -1
  269. package/dist/lib/compiled-raw.js +0 -3
  270. package/dist/lib/compiled-reset.d.ts +0 -1
  271. package/dist/lib/compiled-reset.js +0 -3
  272. package/dist/lib/compiled-schema.d.ts +0 -1
  273. package/dist/lib/compiled-schema.js +0 -1
  274. package/dist/lib/discovery.d.ts +0 -1
  275. package/dist/lib/discovery.js +0 -1
  276. package/dist/lib/execution-profile.d.ts +0 -1
  277. package/dist/lib/execution-profile.js +0 -1
  278. package/dist/lib/executors.d.ts +0 -1
  279. package/dist/lib/executors.js +0 -1
  280. package/dist/lib/filesystem.d.ts +0 -1
  281. package/dist/lib/filesystem.js +0 -1
  282. package/dist/lib/interf-bootstrap.d.ts +0 -1
  283. package/dist/lib/interf-bootstrap.js +0 -3
  284. package/dist/lib/interf-detect.d.ts +0 -1
  285. package/dist/lib/interf-detect.js +0 -3
  286. package/dist/lib/interf-scaffold.d.ts +0 -1
  287. package/dist/lib/interf-scaffold.js +0 -3
  288. package/dist/lib/interf-workflow-package.d.ts +0 -1
  289. package/dist/lib/interf-workflow-package.js +0 -1
  290. package/dist/lib/interf.d.ts +0 -1
  291. package/dist/lib/interf.js +0 -3
  292. package/dist/lib/local-workflows.d.ts +0 -1
  293. package/dist/lib/local-workflows.js +0 -1
  294. package/dist/lib/logger.d.ts +0 -1
  295. package/dist/lib/logger.js +0 -1
  296. package/dist/lib/package-root.d.ts +0 -1
  297. package/dist/lib/package-root.js +0 -1
  298. package/dist/lib/parse.d.ts +0 -1
  299. package/dist/lib/parse.js +0 -1
  300. package/dist/lib/project-paths.d.ts +0 -1
  301. package/dist/lib/project-paths.js +0 -3
  302. package/dist/lib/runtime-acceptance.d.ts +0 -1
  303. package/dist/lib/runtime-acceptance.js +0 -1
  304. package/dist/lib/runtime-contracts.d.ts +0 -1
  305. package/dist/lib/runtime-contracts.js +0 -1
  306. package/dist/lib/runtime-inventory.d.ts +0 -1
  307. package/dist/lib/runtime-inventory.js +0 -1
  308. package/dist/lib/runtime-paths.d.ts +0 -1
  309. package/dist/lib/runtime-paths.js +0 -1
  310. package/dist/lib/runtime-prompt.d.ts +0 -1
  311. package/dist/lib/runtime-prompt.js +0 -1
  312. package/dist/lib/runtime-reconcile.d.ts +0 -1
  313. package/dist/lib/runtime-reconcile.js +0 -1
  314. package/dist/lib/runtime-runs.d.ts +0 -1
  315. package/dist/lib/runtime-runs.js +0 -1
  316. package/dist/lib/runtime-types.d.ts +0 -1
  317. package/dist/lib/runtime-types.js +0 -1
  318. package/dist/lib/runtime.d.ts +0 -1
  319. package/dist/lib/runtime.js +0 -1
  320. package/dist/lib/schema.d.ts +0 -4
  321. package/dist/lib/schema.js +0 -6
  322. package/dist/lib/source-config.d.ts +0 -1
  323. package/dist/lib/source-config.js +0 -3
  324. package/dist/lib/state-artifacts.d.ts +0 -1
  325. package/dist/lib/state-artifacts.js +0 -1
  326. package/dist/lib/state-health.d.ts +0 -1
  327. package/dist/lib/state-health.js +0 -1
  328. package/dist/lib/state-io.d.ts +0 -1
  329. package/dist/lib/state-io.js +0 -1
  330. package/dist/lib/state-paths.d.ts +0 -1
  331. package/dist/lib/state-paths.js +0 -1
  332. package/dist/lib/state-view.d.ts +0 -1
  333. package/dist/lib/state-view.js +0 -1
  334. package/dist/lib/state.d.ts +0 -1
  335. package/dist/lib/state.js +0 -1
  336. package/dist/lib/test-execution.d.ts +0 -1
  337. package/dist/lib/test-execution.js +0 -3
  338. package/dist/lib/test-matrices.d.ts +0 -1
  339. package/dist/lib/test-matrices.js +0 -3
  340. package/dist/lib/test-paths.d.ts +0 -1
  341. package/dist/lib/test-paths.js +0 -3
  342. package/dist/lib/test-profile-presets.d.ts +0 -1
  343. package/dist/lib/test-profile-presets.js +0 -3
  344. package/dist/lib/test-sandbox.d.ts +0 -1
  345. package/dist/lib/test-sandbox.js +0 -3
  346. package/dist/lib/test-specs.d.ts +0 -1
  347. package/dist/lib/test-specs.js +0 -3
  348. package/dist/lib/test-targets.d.ts +0 -1
  349. package/dist/lib/test-targets.js +0 -3
  350. package/dist/lib/test-types.d.ts +0 -1
  351. package/dist/lib/test-types.js +0 -3
  352. package/dist/lib/test.d.ts +0 -1
  353. package/dist/lib/test.js +0 -3
  354. package/dist/lib/util.d.ts +0 -1
  355. package/dist/lib/util.js +0 -1
  356. package/dist/lib/validate-compiled.d.ts +0 -1
  357. package/dist/lib/validate-compiled.js +0 -1
  358. package/dist/lib/validate-helpers.d.ts +0 -1
  359. package/dist/lib/validate-helpers.js +0 -1
  360. package/dist/lib/validate.d.ts +0 -1
  361. package/dist/lib/validate.js +0 -1
  362. package/dist/lib/workflow-authoring.d.ts +0 -1
  363. package/dist/lib/workflow-authoring.js +0 -1
  364. package/dist/lib/workflow-definitions.d.ts +0 -1
  365. package/dist/lib/workflow-definitions.js +0 -1
  366. package/dist/lib/workflow-edit-session.d.ts +0 -1
  367. package/dist/lib/workflow-edit-session.js +0 -1
  368. package/dist/lib/workflow-edit-utils.d.ts +0 -1
  369. package/dist/lib/workflow-edit-utils.js +0 -1
  370. package/dist/lib/workflow-helpers.d.ts +0 -1
  371. package/dist/lib/workflow-helpers.js +0 -1
  372. package/dist/lib/workflow-improvement.d.ts +0 -1
  373. package/dist/lib/workflow-improvement.js +0 -1
  374. package/dist/lib/workflow-primitives.d.ts +0 -1
  375. package/dist/lib/workflow-primitives.js +0 -1
  376. package/dist/lib/workflow-review-paths.d.ts +0 -1
  377. package/dist/lib/workflow-review-paths.js +0 -1
  378. package/dist/lib/workflow-stage-policy.d.ts +0 -1
  379. package/dist/lib/workflow-stage-policy.js +0 -1
  380. package/dist/lib/workflow-stage-runner.d.ts +0 -1
  381. package/dist/lib/workflow-stage-runner.js +0 -1
  382. package/dist/lib/workflows.d.ts +0 -1
  383. package/dist/lib/workflows.js +0 -1
  384. package/dist/packages/project-model/compiled-paths.d.ts +0 -1
  385. package/dist/packages/project-model/compiled-paths.js +0 -1
  386. package/dist/packages/project-model/compiled-raw.d.ts +0 -1
  387. package/dist/packages/project-model/compiled-raw.js +0 -1
  388. package/dist/packages/project-model/compiled-reset.d.ts +0 -1
  389. package/dist/packages/project-model/compiled-reset.js +0 -1
  390. package/dist/packages/shared/index.d.ts +0 -7
  391. package/dist/packages/shared/index.js +0 -7
  392. package/dist/packages/shared/util.d.ts +0 -3
  393. package/dist/packages/shared/util.js +0 -3
  394. package/dist/packages/testing/test-matrices.d.ts +0 -90
  395. package/dist/packages/testing/test-matrices.js +0 -96
  396. package/dist/packages/workflow-authoring/index.d.ts +0 -4
  397. package/dist/packages/workflow-authoring/index.js +0 -4
  398. package/dist/packages/workflow-authoring/workflow-authoring.d.ts +0 -26
  399. package/dist/packages/workflow-authoring/workflow-authoring.js +0 -123
  400. package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +0 -16
  401. package/dist/packages/workflow-authoring/workflow-edit-session.js +0 -60
  402. package/dist/packages/workflow-authoring/workflow-improvement.d.ts +0 -23
  403. package/dist/packages/workflow-package/index.d.ts +0 -11
  404. package/dist/packages/workflow-package/index.js +0 -11
  405. package/dist/packages/workflow-package/interf-workflow-package.d.ts +0 -25
  406. package/dist/packages/workflow-package/interf-workflow-package.js +0 -389
  407. package/dist/packages/workflow-package/local-workflows.d.ts +0 -64
  408. package/dist/packages/workflow-package/local-workflows.js +0 -441
  409. package/dist/packages/workflow-package/workflow-definitions.d.ts +0 -82
  410. package/dist/packages/workflow-package/workflow-definitions.js +0 -210
  411. package/dist/packages/workflow-package/workflow-review-paths.d.ts +0 -10
  412. /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/summarize/SKILL.md +0 -0
  413. /package/dist/packages/compiler/{workflow-primitives.d.ts → method-primitives.d.ts} +0 -0
  414. /package/dist/packages/compiler/{workflow-primitives.js → method-primitives.js} +0 -0
  415. /package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.js → method-authoring/lib/method-edit-utils.js} +0 -0
  416. /package/dist/packages/{workflow-package → method-package}/lib/package-root.d.ts +0 -0
  417. /package/dist/packages/{workflow-package/workflow-stage-policy.d.ts → method-package/method-stage-policy.d.ts} +0 -0
  418. /package/dist/packages/{workflow-package/workflow-stage-policy.js → method-package/method-stage-policy.js} +0 -0
@@ -0,0 +1,496 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { renderCompiledQuerySkill } from "../agents/lib/shells.js";
4
+ import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, } from "./local-methods.js";
5
+ import { getCompiledMethod, } from "./method-definitions.js";
6
+ import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
7
+ import { methodPackagePathForCompiled } from "../compiler/compiled-paths.js";
8
+ import { mergeStagePolicyNotesForStages } from "./method-stage-policy.js";
9
+ function methodPackagePath(dirPath) {
10
+ return methodPackagePathForCompiled(dirPath);
11
+ }
12
+ function writeMethodStarterDocs(dirPath, docs, options) {
13
+ for (const doc of docs ?? []) {
14
+ const targetPath = join(dirPath, doc.relativePath);
15
+ if (!options.overwrite && existsSync(targetPath))
16
+ continue;
17
+ mkdirSync(dirname(targetPath), { recursive: true });
18
+ writeFileSync(targetPath, doc.content);
19
+ }
20
+ }
21
+ function writeMethodPackageJson(rootPath, method, options) {
22
+ const targetPath = join(rootPath, "method.json");
23
+ if (!options.overwrite && existsSync(targetPath))
24
+ return;
25
+ const inputs = method.inputs?.length
26
+ ? method.inputs
27
+ : deriveMethodInputsFromContextInterface(method.contextInterface ?? method.schema);
28
+ writeFileSync(targetPath, `${JSON.stringify({
29
+ id: method.id,
30
+ type: "compiled",
31
+ compiler_api: method.compilerApi ?? {
32
+ kind: "compiled",
33
+ version: 1,
34
+ },
35
+ ...(method.purpose
36
+ ? {
37
+ purpose: {
38
+ label: method.purpose.label,
39
+ task_hint: method.purpose.taskHint,
40
+ },
41
+ }
42
+ : {}),
43
+ ...(inputs.length > 0 ? { inputs } : {}),
44
+ label: method.label,
45
+ hint: method.hint,
46
+ stages: method.stages.map((stage) => ({
47
+ id: stage.id,
48
+ label: stage.label,
49
+ description: stage.description,
50
+ contract_type: stage.contractType,
51
+ skill_dir: stage.skillDir,
52
+ reads: stage.reads,
53
+ writes: stage.writes,
54
+ ...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
55
+ })),
56
+ ...(method.stagePolicyNotes ? { stage_policy_notes: method.stagePolicyNotes } : {}),
57
+ }, null, 2)}\n`);
58
+ }
59
+ function renderMethodReadme(method) {
60
+ const contextInterface = method.contextInterface ?? method.schema ?? null;
61
+ const stageLines = method.stages
62
+ .map((stage) => `- \`${stage.id}\` — ${stage.description} (${stage.contractType}; reads: ${stage.reads.join(", ")}; writes: ${stage.writes.join(", ")})`)
63
+ .join("\n");
64
+ const interfaceSummary = contextInterface
65
+ ? summarizeContextInterface(contextInterface)
66
+ : null;
67
+ const contextInterfaceLines = contextInterface?.zones
68
+ ? contextInterface.zones
69
+ .map((zone) => `- \`${zone.id}\` — ${zone.role} ${zone.kind} at \`${zone.path}\`: ${zone.description}`)
70
+ .join("\n")
71
+ : null;
72
+ const inputs = method.inputs?.length
73
+ ? method.inputs
74
+ : deriveMethodInputsFromContextInterface(contextInterface);
75
+ const inputLines = inputs.length > 0
76
+ ? inputs
77
+ .map((input) => `- \`${input.id}\` — ${input.label}: ${input.description}${input.required ? " (required)" : ""}${input.examples?.length ? ` Example inputs: ${input.examples.join("; ")}` : ""}`)
78
+ .join("\n")
79
+ : null;
80
+ const contextInterfaceSummaryLines = interfaceSummary
81
+ ? [
82
+ `- Input zones: ${interfaceSummary.inputZones.length > 0 ? interfaceSummary.inputZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
83
+ `- Working zones: ${interfaceSummary.workingZones.length > 0 ? interfaceSummary.workingZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
84
+ `- Output zones: ${interfaceSummary.outputZones.length > 0 ? interfaceSummary.outputZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
85
+ `- Runtime zones: ${interfaceSummary.runtimeZones.length > 0 ? interfaceSummary.runtimeZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
86
+ ].join("\n")
87
+ : null;
88
+ return [
89
+ `# ${method.label}`,
90
+ "",
91
+ method.hint,
92
+ ...(method.purpose
93
+ ? [
94
+ "",
95
+ "## Purpose",
96
+ "",
97
+ `- ${method.purpose.label}`,
98
+ `- ${method.purpose.taskHint}`,
99
+ ]
100
+ : []),
101
+ ...(inputLines
102
+ ? [
103
+ "",
104
+ "## Inputs",
105
+ "",
106
+ inputLines,
107
+ ]
108
+ : []),
109
+ ...(contextInterfaceLines
110
+ ? [
111
+ "",
112
+ "## Context Interface",
113
+ "",
114
+ ...(contextInterfaceSummaryLines
115
+ ? [
116
+ contextInterfaceSummaryLines,
117
+ "",
118
+ ]
119
+ : []),
120
+ "Zone map:",
121
+ "",
122
+ contextInterfaceLines,
123
+ ]
124
+ : []),
125
+ "",
126
+ "## Package",
127
+ "",
128
+ "- `method.json` = stage graph, compiler API target, and compile contract mapping",
129
+ "- `method.schema.json` = deterministic context interface for the Method package",
130
+ "- `improve/`, `compile/stages/`, and `use/query/` = human-readable authoring docs",
131
+ "- Portable Method packages are standalone: explicit stages, schema, and docs live together in this folder",
132
+ "- Interf projects native agent shells from these docs for query use, stage execution, and Method-improvement loops",
133
+ "",
134
+ "## Stages",
135
+ "",
136
+ stageLines,
137
+ "",
138
+ "Interf runs the local copy of this package directly from `.interf/method/` inside each portable context.",
139
+ "",
140
+ ].join("\n");
141
+ }
142
+ function renderDerivedMethodReadme(options) {
143
+ return [
144
+ `# ${options.label}`,
145
+ "",
146
+ options.hint,
147
+ "",
148
+ `This Method package was forked from \`${options.baseMethodId}\` and materialized as a standalone package for this kind of agent work.`,
149
+ "It starts with that Method's topology; edit the package when the agent work needs different stages, zones, or proof.",
150
+ "",
151
+ "Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
152
+ "",
153
+ "## Emphasis",
154
+ "",
155
+ ...(options.emphasis.length > 0
156
+ ? options.emphasis.map((entry) => `- ${entry.stageId} (${entry.label}): ${entry.notes.join("; ")}`)
157
+ : ["- No stage-specific emphasis was added yet."]),
158
+ "",
159
+ ].join("\n");
160
+ }
161
+ function renderSeedMethodReadme(options) {
162
+ return [
163
+ `# ${options.label}`,
164
+ "",
165
+ options.hint,
166
+ "",
167
+ `This Method package was forked from \`${options.baseMethodId}\` as a standalone local package.`,
168
+ "It starts with that Method's topology; edit the package when the agent work needs different stages, zones, or proof.",
169
+ "",
170
+ "Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance.",
171
+ "",
172
+ ].join("\n");
173
+ }
174
+ function renderScratchMethodReadme(options) {
175
+ return [
176
+ `# ${options.label}`,
177
+ "",
178
+ options.hint,
179
+ "",
180
+ "This Method package is a neutral from-scratch authoring scaffold.",
181
+ "",
182
+ "It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
183
+ "Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Method this source data and task actually need.",
184
+ "",
185
+ ].join("\n");
186
+ }
187
+ function renderImproveSkill(method) {
188
+ return [
189
+ "# Method Improvement",
190
+ "",
191
+ `Method: ${method.id}`,
192
+ "",
193
+ "This file is the editable authoring source for Interf's generated native Method-improver shell.",
194
+ "The improver edits this local package directly.",
195
+ "",
196
+ "Default loop:",
197
+ "1. Read the loop context first.",
198
+ "2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
199
+ "3. Edit only the local Method package for this portable context to create a better Method variation for this kind of agent work.",
200
+ `4. Keep purpose, inputs, \`method.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
201
+ "",
202
+ "Guardrails:",
203
+ "- do not edit checks, test specs, or raw files",
204
+ "- do not hardcode expected answers into Method docs",
205
+ "- keep this package standalone; do not rely on runtime inheritance",
206
+ "- keep the Method stack coherent: purpose, inputs, context interface, and stages should describe the same job",
207
+ "- prefer small, defensible Method changes over random churn",
208
+ "",
209
+ ].join("\n");
210
+ }
211
+ function renderStageSkill(method, stage) {
212
+ const notes = method.stagePolicyNotes?.[stage.id] ?? [];
213
+ const acceptanceKeys = stage.acceptance ? Object.keys(stage.acceptance) : [];
214
+ const abstractRules = stage.contractType === "compiled-file-evidence"
215
+ ? [
216
+ "- Valid abstract forms for deterministic validation are:",
217
+ ' - frontmatter key `"abstract"` with a real sentence, or',
218
+ " - a markdown heading `## Abstract` followed by at least one sentence",
219
+ "- A bare `Abstract` label without markdown heading syntax does not count.",
220
+ ]
221
+ : [];
222
+ return [
223
+ `# ${stage.label}`,
224
+ "",
225
+ stage.description,
226
+ "",
227
+ "## Stage Contract",
228
+ "",
229
+ `- Contract type: \`${stage.contractType}\``,
230
+ `- Reads zones: ${stage.reads.map((zoneId) => `\`${zoneId}\``).join(", ")}`,
231
+ `- Writes zones: ${stage.writes.map((zoneId) => `\`${zoneId}\``).join(", ")}`,
232
+ "",
233
+ "## Requirements",
234
+ "",
235
+ "- Treat `method.json` and `method.schema.json` as the authoritative package contract for this stage.",
236
+ "- Read only from the declared input zones unless this package explicitly documents a broader method.",
237
+ "- Write only inside the declared output zones for this stage. Do not invent undeclared zones or implicit outputs.",
238
+ "- Keep stage instructions, zone ownership, and Method-level acceptance aligned when you change this stage.",
239
+ "- Treat runtime files as proof and execution state, not as the source of truth for Method behavior.",
240
+ "- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
241
+ ...abstractRules,
242
+ "",
243
+ ...(acceptanceKeys.length > 0
244
+ ? [
245
+ "## Declarative Acceptance",
246
+ "",
247
+ ...acceptanceKeys.map((key) => `- \`${key}\``),
248
+ "",
249
+ ]
250
+ : []),
251
+ ...(notes.length > 0
252
+ ? [
253
+ "## Notes",
254
+ "",
255
+ ...notes.map((note) => `- ${note}`),
256
+ "",
257
+ ]
258
+ : []),
259
+ ].join("\n");
260
+ }
261
+ export function writeCompiledMethodPackage(compiledPath, method) {
262
+ writeMethodPackageToDir(methodPackagePath(compiledPath), method);
263
+ }
264
+ export function writeMethodPackageToDir(methodDir, method, options = {}) {
265
+ const overwrite = options.overwrite ?? true;
266
+ mkdirSync(join(methodDir, "improve"), { recursive: true });
267
+ mkdirSync(join(methodDir, "use", "query"), { recursive: true });
268
+ mkdirSync(join(methodDir, "compile", "stages"), { recursive: true });
269
+ for (const stage of method.stages) {
270
+ mkdirSync(join(methodDir, "compile", "stages", stage.skillDir), { recursive: true });
271
+ }
272
+ writeMethodPackageJson(methodDir, method, { overwrite });
273
+ if (overwrite || !existsSync(join(methodDir, CONTEXT_INTERFACE_FILE))) {
274
+ const contextInterface = method.contextInterface ?? method.schema;
275
+ if (contextInterface) {
276
+ writeContextInterface(methodDir, {
277
+ ...contextInterface,
278
+ label: contextInterface.label || `${method.label} Method schema`,
279
+ });
280
+ }
281
+ else {
282
+ writeContextInterfaceFile(methodDir, method.stages, `${method.label} Method schema`);
283
+ }
284
+ }
285
+ if (overwrite || !existsSync(join(methodDir, "README.md"))) {
286
+ writeFileSync(join(methodDir, "README.md"), renderMethodReadme(method));
287
+ }
288
+ if (overwrite || !existsSync(join(methodDir, "improve", "SKILL.md"))) {
289
+ writeFileSync(join(methodDir, "improve", "SKILL.md"), renderImproveSkill(method));
290
+ }
291
+ if (overwrite || !existsSync(join(methodDir, "use", "query", "SKILL.md"))) {
292
+ writeFileSync(join(methodDir, "use", "query", "SKILL.md"), renderCompiledQuerySkill());
293
+ }
294
+ for (const stage of method.stages) {
295
+ const targetPath = join(methodDir, "compile", "stages", stage.skillDir, "SKILL.md");
296
+ if (overwrite || !existsSync(targetPath)) {
297
+ writeFileSync(targetPath, renderStageSkill(method, stage));
298
+ }
299
+ }
300
+ writeMethodStarterDocs(methodDir, method.starterDocs, { overwrite });
301
+ }
302
+ export function seedCompiledMethodPackage(options) {
303
+ const resolvedMethod = getCompiledMethod(options.methodId, {
304
+ sourcePath: options.sourcePath,
305
+ });
306
+ const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, resolvedMethod.id);
307
+ if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
308
+ // Portable seed packages can be copied directly because compile runs the
309
+ // local package folder without reading source-root Method packages.
310
+ copyMethodPackageDirectory(sourceMethodPath, methodPackagePath(options.compiledPath));
311
+ patchMethodPackageMetadata(methodPackagePath(options.compiledPath), {
312
+ id: resolvedMethod.id,
313
+ inputs: resolvedMethod.inputs,
314
+ label: resolvedMethod.label,
315
+ hint: resolvedMethod.hint,
316
+ stagePolicyNotes: resolvedMethod.stagePolicyNotes,
317
+ });
318
+ if (resolvedMethod.scope === "builtin") {
319
+ writeFileSync(join(methodPackagePath(options.compiledPath), "README.md"), renderMethodReadme(resolvedMethod));
320
+ }
321
+ return;
322
+ }
323
+ // Legacy or partially-defined seed packages are resolved once and
324
+ // materialized into a standalone local package.
325
+ writeCompiledMethodPackage(options.compiledPath, resolvedMethod);
326
+ }
327
+ export function createLocalMethodPackageFromTemplate(options) {
328
+ const targetPath = seedLocalMethodPackageFromBase({
329
+ sourcePath: options.sourcePath,
330
+ baseMethodId: options.baseMethodId,
331
+ methodId: options.methodId,
332
+ label: options.label,
333
+ hint: options.hint,
334
+ });
335
+ const baseMethod = getCompiledMethod(options.baseMethodId, {
336
+ sourcePath: options.sourcePath,
337
+ });
338
+ const stagePolicyNotes = mergeStagePolicyNotesForStages(baseMethod.stages, baseMethod.stagePolicyNotes, options.stagePolicyNotes);
339
+ patchMethodPackageMetadata(targetPath, {
340
+ id: options.methodId,
341
+ label: options.label,
342
+ hint: options.hint,
343
+ stagePolicyNotes,
344
+ });
345
+ writeFileSync(join(targetPath, "README.md"), renderDerivedMethodReadme({
346
+ label: options.label,
347
+ hint: options.hint,
348
+ baseMethodId: options.baseMethodId,
349
+ emphasis: baseMethod.stages
350
+ .map((stage) => ({
351
+ stageId: stage.id,
352
+ label: stage.label,
353
+ notes: stagePolicyNotes?.[stage.id] ?? [],
354
+ }))
355
+ .filter((entry) => entry.notes.length > 0),
356
+ }));
357
+ return targetPath;
358
+ }
359
+ export function seedLocalMethodPackageFromBase(options) {
360
+ const baseMethod = getCompiledMethod(options.baseMethodId, {
361
+ sourcePath: options.sourcePath,
362
+ });
363
+ const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, options.baseMethodId);
364
+ const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
365
+ if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
366
+ // Copy directly when the base package is already portable and standalone.
367
+ copyMethodPackageDirectory(sourceMethodPath, targetPath);
368
+ patchMethodPackageMetadata(targetPath, {
369
+ id: options.methodId,
370
+ inputs: baseMethod.inputs,
371
+ label: options.label,
372
+ hint: options.hint,
373
+ });
374
+ writeFileSync(join(targetPath, "README.md"), renderSeedMethodReadme({
375
+ label: options.label,
376
+ hint: options.hint,
377
+ baseMethodId: options.baseMethodId,
378
+ }));
379
+ return targetPath;
380
+ }
381
+ // Base packages are materialized immediately so the new local Method package
382
+ // is standalone from its first write.
383
+ const localMethod = {
384
+ ...baseMethod,
385
+ id: options.methodId,
386
+ label: options.label,
387
+ hint: options.hint,
388
+ recommended: false,
389
+ scope: "local",
390
+ starterDocs: [
391
+ {
392
+ relativePath: "README.md",
393
+ content: renderSeedMethodReadme({
394
+ label: options.label,
395
+ hint: options.hint,
396
+ baseMethodId: options.baseMethodId,
397
+ }),
398
+ },
399
+ ...(baseMethod.starterDocs ?? []).filter((doc) => doc.relativePath !== "README.md"),
400
+ ],
401
+ };
402
+ writeMethodPackageToDir(targetPath, localMethod);
403
+ return targetPath;
404
+ }
405
+ export function createScratchLocalMethodPackage(options) {
406
+ const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
407
+ const method = {
408
+ id: options.methodId,
409
+ compilerApi: {
410
+ kind: "compiled",
411
+ version: 1,
412
+ },
413
+ purpose: {
414
+ label: "From-scratch Method draft",
415
+ taskHint: "Replace this neutral scaffold with the Method stages, outputs, and proof rules this agent work requires.",
416
+ },
417
+ inputs: [
418
+ {
419
+ id: "raw",
420
+ label: "Raw",
421
+ description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
422
+ required: true,
423
+ },
424
+ ],
425
+ label: options.label,
426
+ hint: options.hint,
427
+ recommended: false,
428
+ scope: "local",
429
+ contextInterface: {
430
+ kind: "method-schema",
431
+ version: 1,
432
+ target_type: "compiled",
433
+ label: `${options.label} Method schema`,
434
+ zones: [
435
+ {
436
+ id: "raw",
437
+ role: "input",
438
+ path: "raw",
439
+ kind: "directory",
440
+ required: true,
441
+ owned_by: [],
442
+ description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
443
+ },
444
+ {
445
+ id: "draft-context",
446
+ role: "output",
447
+ path: "draft",
448
+ kind: "directory",
449
+ required: true,
450
+ owned_by: ["prepare"],
451
+ description: "Temporary placeholder output zone for the neutral authoring scaffold. Replace it with task-specific output zones.",
452
+ },
453
+ {
454
+ id: "runtime",
455
+ role: "runtime",
456
+ path: ".interf/runtime",
457
+ kind: "runtime",
458
+ required: true,
459
+ owned_by: [],
460
+ description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
461
+ },
462
+ ],
463
+ },
464
+ stages: [
465
+ {
466
+ id: "prepare",
467
+ label: "Prepare",
468
+ description: "Neutral placeholder stage for Method authoring. Replace this stage with the topology this agent work needs.",
469
+ contractType: "method-draft-stage",
470
+ skillDir: "prepare",
471
+ reads: ["raw", "runtime"],
472
+ writes: ["draft-context"],
473
+ acceptance: {
474
+ stage_truthy: ["finished_at"],
475
+ },
476
+ },
477
+ ],
478
+ stagePolicyNotes: {
479
+ prepare: [
480
+ "This is a neutral authoring scaffold, not a recommended method topology.",
481
+ "Replace this stage, output zone, and proof rule when drafting the final method.",
482
+ ],
483
+ },
484
+ starterDocs: [
485
+ {
486
+ relativePath: "README.md",
487
+ content: renderScratchMethodReadme({
488
+ label: options.label,
489
+ hint: options.hint,
490
+ }),
491
+ },
492
+ ],
493
+ };
494
+ writeMethodPackageToDir(targetPath, method);
495
+ return targetPath;
496
+ }
@@ -2,5 +2,5 @@ import { dirname, join } from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
  const __filename = fileURLToPath(import.meta.url);
4
4
  const __dirname = dirname(__filename);
5
- // Package root (dist/packages/workflow-package/lib/ -> package root)
5
+ // Package root (dist/packages/method-package/lib/ -> package root)
6
6
  export const PACKAGE_ROOT = join(__dirname, "..", "..", "..", "..");
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema } from "../compiler/lib/schema.js";
3
+ import { RuntimeContractTypeSchema } from "../contracts/lib/schema.js";
4
+ import { MethodInputSpecSchema, type ContextInterface, type MethodInputSpec } from "./context-interface.js";
5
+ export interface LocalMethodStarterDoc {
6
+ relativePath: string;
7
+ content: string;
8
+ }
9
+ export interface LocalMethodStageDefinition {
10
+ id: string;
11
+ label: string;
12
+ contract_type: z.infer<typeof RuntimeContractTypeSchema>;
13
+ skill_dir?: string;
14
+ description?: string;
15
+ reads: z.infer<typeof MethodStageZoneAccessSchema>;
16
+ writes: z.infer<typeof MethodStageZoneAccessSchema>;
17
+ acceptance?: z.infer<typeof RuntimeStageAcceptanceSchema>;
18
+ }
19
+ export interface LocalMethodDefinition {
20
+ id: string;
21
+ type: "compiled";
22
+ compiler_api?: z.infer<typeof MethodCompilerApiSchema>;
23
+ purpose?: z.infer<typeof MethodPurposeSchema>;
24
+ inputs?: Array<z.infer<typeof MethodInputSpecSchema>>;
25
+ label: string;
26
+ hint: string;
27
+ stages?: LocalMethodStageDefinition[];
28
+ stage_policy_notes?: Record<string, string[]>;
29
+ method_schema: ContextInterface;
30
+ starter_docs: LocalMethodStarterDoc[];
31
+ directoryPath: string;
32
+ methodPath: string;
33
+ methodSchemaPath: string;
34
+ }
35
+ export declare function methodDefinitionPath(sourcePath: string, id: string): string;
36
+ export declare function loadMethodDefinitionFromDir(dirPath: string): LocalMethodDefinition | null;
37
+ export declare function listLocalMethodDefinitions(sourcePath: string): LocalMethodDefinition[];
38
+ export declare function loadLocalMethodDefinition(sourcePath: string, id: string): LocalMethodDefinition | null;
39
+ export declare function resolveMethodPackageSourcePath(sourcePath: string, methodId: string): string | null;
40
+ export declare function seedLocalDefaultMethod(options: {
41
+ sourcePath: string;
42
+ }): {
43
+ methodId: string;
44
+ targetPath: string;
45
+ alreadyExisted: boolean;
46
+ };
47
+ export declare function isMethodId(value: string): boolean;
48
+ export declare function patchMethodPackageMetadata(dirPath: string, options?: {
49
+ id?: string;
50
+ inputs?: MethodInputSpec[];
51
+ label?: string;
52
+ hint?: string;
53
+ stagePolicyNotes?: Record<string, string[]>;
54
+ }): void;
55
+ export declare function describeMethodPackagePortability(dirPath: string): string[];
56
+ export declare function isPortableMethodPackage(dirPath: string): boolean;
57
+ export declare function copyMethodPackageDirectory(sourceMethodPath: string, targetMethodPath: string): void;
58
+ export interface MethodValidationResult {
59
+ ok: boolean;
60
+ summary: string;
61
+ errors: string[];
62
+ counts: Record<string, number>;
63
+ }
64
+ export declare function validateMethodPackage(dirPath: string): MethodValidationResult;