@interf/compiler 0.21.0 → 0.22.2

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 (367) hide show
  1. package/README.md +65 -63
  2. package/dist/cli/commands/build-plan.d.ts +2 -0
  3. package/dist/cli/commands/{method.js → build-plan.js} +89 -72
  4. package/dist/cli/commands/{compile.d.ts → build.d.ts} +2 -2
  5. package/dist/cli/commands/{compile.js → build.js} +18 -18
  6. package/dist/cli/commands/doctor.js +2 -2
  7. package/dist/cli/commands/mcp.js +48 -48
  8. package/dist/cli/commands/prep.js +16 -29
  9. package/dist/cli/commands/reset.d.ts +1 -1
  10. package/dist/cli/commands/reset.js +6 -6
  11. package/dist/cli/commands/runs.js +6 -28
  12. package/dist/cli/commands/status.js +1 -1
  13. package/dist/cli/commands/test.d.ts +1 -1
  14. package/dist/cli/commands/test.js +8 -8
  15. package/dist/cli/commands/web.js +3 -3
  16. package/dist/cli/commands/wizard.js +38 -38
  17. package/dist/cli/index.d.ts +3 -3
  18. package/dist/cli/index.js +5 -5
  19. package/dist/interf-ui/404.html +1 -0
  20. package/dist/interf-ui/__next.__PAGE__.txt +10 -0
  21. package/dist/interf-ui/__next._full.txt +20 -0
  22. package/dist/interf-ui/__next._head.txt +5 -0
  23. package/dist/interf-ui/__next._index.txt +5 -0
  24. package/dist/{compiler-ui → interf-ui}/__next._tree.txt +3 -4
  25. package/dist/interf-ui/_next/static/chunks/0.tjb6f4golw..css +3 -0
  26. package/dist/interf-ui/_next/static/chunks/085-n_jv2ng_q.css +1 -0
  27. package/dist/interf-ui/_next/static/chunks/0dn41fa_zvgsl.js +1 -0
  28. package/dist/interf-ui/_next/static/chunks/0g-ea0zj5d-0k.js +1 -0
  29. package/dist/interf-ui/_next/static/chunks/0gwqglc4iz583.js +1 -0
  30. package/dist/interf-ui/_next/static/chunks/0haldgm65ve6l.js +1 -0
  31. package/dist/interf-ui/_next/static/chunks/0nv3am99vjzn4.js +1 -0
  32. package/dist/{compiler-ui/_next/static/chunks/02f_.8.ebn556.js → interf-ui/_next/static/chunks/0s77gt_o4jwtx.js} +1 -1
  33. package/dist/interf-ui/_next/static/chunks/0~a36ujuzpaz..js +116 -0
  34. package/dist/interf-ui/_next/static/chunks/10jeodxe4nkgj.js +31 -0
  35. package/dist/interf-ui/_next/static/chunks/119h2rouych2t.js +1 -0
  36. package/dist/interf-ui/_next/static/chunks/13c8b~m8knjsf.js +1 -0
  37. package/dist/interf-ui/_next/static/chunks/14dznb2qpt-ho.js +91 -0
  38. package/dist/interf-ui/_next/static/chunks/15z_en80lrq-3.js +5 -0
  39. package/dist/{compiler-ui/_next/static/chunks/turbopack-0apv8vb-nczuy.js → interf-ui/_next/static/chunks/turbopack-0p.pvcjrtq-jh.js} +1 -1
  40. package/dist/interf-ui/_next/static/chunks/turbopack-0usj_75.8frlw.js +1 -0
  41. package/dist/interf-ui/_not-found/__next._full.txt +15 -0
  42. package/dist/interf-ui/_not-found/__next._head.txt +5 -0
  43. package/dist/interf-ui/_not-found/__next._index.txt +5 -0
  44. package/dist/{compiler-ui → interf-ui}/_not-found/__next._not-found.__PAGE__.txt +2 -2
  45. package/dist/interf-ui/_not-found/__next._not-found.txt +5 -0
  46. package/dist/{compiler-ui → interf-ui}/_not-found/__next._tree.txt +2 -3
  47. package/dist/interf-ui/_not-found.html +1 -0
  48. package/dist/interf-ui/_not-found.txt +15 -0
  49. package/dist/interf-ui/index.html +1 -0
  50. package/dist/interf-ui/index.txt +20 -0
  51. package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +36 -0
  52. package/dist/packages/{methods/authoring/method-authoring.js → build-plans/authoring/build-plan-authoring.js} +52 -52
  53. package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +18 -0
  54. package/dist/packages/{methods/authoring/method-edit-session.js → build-plans/authoring/build-plan-edit-session.js} +34 -34
  55. package/dist/packages/build-plans/authoring/build-plan-improvement.d.ts +23 -0
  56. package/dist/packages/build-plans/authoring/build-plan-improvement.js +216 -0
  57. package/dist/packages/build-plans/authoring/index.d.ts +4 -0
  58. package/dist/packages/build-plans/authoring/index.js +4 -0
  59. package/dist/packages/{methods/authoring/lib/method-edit-utils.d.ts → build-plans/authoring/lib/build-plan-edit-utils.d.ts} +3 -3
  60. package/dist/packages/build-plans/build-plan-resolution.d.ts +6 -0
  61. package/dist/packages/build-plans/build-plan-resolution.js +7 -0
  62. package/dist/packages/build-plans/index.d.ts +2 -0
  63. package/dist/packages/build-plans/index.js +2 -0
  64. package/dist/packages/build-plans/package/build-plan-definitions.d.ts +61 -0
  65. package/dist/packages/build-plans/package/build-plan-definitions.js +214 -0
  66. package/dist/packages/{methods/package/method-helpers.d.ts → build-plans/package/build-plan-helpers.d.ts} +7 -7
  67. package/dist/packages/{methods/package/method-helpers.js → build-plans/package/build-plan-helpers.js} +20 -20
  68. package/dist/packages/build-plans/package/build-plan-review-paths.d.ts +10 -0
  69. package/dist/packages/build-plans/package/build-plan-review-paths.js +31 -0
  70. package/dist/packages/{methods/package/method-stage-runner.d.ts → build-plans/package/build-plan-stage-runner.d.ts} +12 -12
  71. package/dist/packages/{methods/package/method-stage-runner.js → build-plans/package/build-plan-stage-runner.js} +10 -10
  72. package/dist/packages/build-plans/package/builtin-build-plan.d.ts +37 -0
  73. package/dist/packages/build-plans/package/builtin-build-plan.js +91 -0
  74. package/dist/packages/{methods → build-plans}/package/context-interface.d.ts +11 -11
  75. package/dist/packages/{methods → build-plans}/package/context-interface.js +23 -23
  76. package/dist/packages/build-plans/package/interf-build-plan-package.d.ts +31 -0
  77. package/dist/packages/build-plans/package/interf-build-plan-package.js +466 -0
  78. package/dist/packages/{methods → build-plans}/package/lib/package-root.js +1 -1
  79. package/dist/packages/build-plans/package/local-build-plans.d.ts +74 -0
  80. package/dist/packages/{methods/package/local-methods.js → build-plans/package/local-build-plans.js} +152 -152
  81. package/dist/packages/build-plans/package/user-build-plans.d.ts +17 -0
  82. package/dist/packages/build-plans/package/user-build-plans.js +77 -0
  83. package/dist/packages/contracts/index.d.ts +1 -1
  84. package/dist/packages/contracts/lib/preparation-paths.d.ts +37 -37
  85. package/dist/packages/contracts/lib/preparation-paths.js +43 -43
  86. package/dist/packages/contracts/lib/schema.d.ts +34 -41
  87. package/dist/packages/contracts/lib/schema.js +42 -34
  88. package/dist/packages/engine/action-definitions.d.ts +60 -60
  89. package/dist/packages/engine/action-definitions.js +198 -197
  90. package/dist/packages/engine/action-planner.d.ts +2 -2
  91. package/dist/packages/engine/action-planner.js +5 -5
  92. package/dist/packages/engine/action-values.d.ts +1 -1
  93. package/dist/packages/engine/action-values.js +1 -1
  94. package/dist/packages/engine/agents/index.d.ts +2 -2
  95. package/dist/packages/engine/agents/index.js +1 -1
  96. package/dist/packages/engine/agents/lib/args.d.ts +2 -2
  97. package/dist/packages/engine/agents/lib/args.js +1 -1
  98. package/dist/packages/engine/agents/lib/constants.js +1 -1
  99. package/dist/packages/engine/agents/lib/execution-profile.d.ts +5 -5
  100. package/dist/packages/engine/agents/lib/execution-profile.js +3 -3
  101. package/dist/packages/engine/agents/lib/executors.d.ts +11 -11
  102. package/dist/packages/engine/agents/lib/render.js +4 -4
  103. package/dist/packages/engine/agents/lib/shells.d.ts +30 -30
  104. package/dist/packages/engine/agents/lib/shells.js +248 -248
  105. package/dist/packages/engine/agents/lib/types.d.ts +2 -2
  106. package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.d.ts +3 -0
  107. package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.js +19 -0
  108. package/dist/packages/engine/agents/role-executors.d.ts +7 -7
  109. package/dist/packages/engine/agents/role-executors.js +2 -2
  110. package/dist/packages/engine/agents/role-router.d.ts +2 -2
  111. package/dist/packages/engine/agents/role-router.js +1 -1
  112. package/dist/packages/engine/build/artifact-counts.d.ts +1 -0
  113. package/dist/packages/engine/{compile → build}/artifact-counts.js +7 -7
  114. package/dist/packages/engine/{compile → build}/artifact-status.d.ts +8 -8
  115. package/dist/packages/engine/{compile → build}/artifact-status.js +19 -19
  116. package/dist/packages/engine/{compile → build}/billing-events.d.ts +4 -4
  117. package/dist/packages/engine/{compile → build}/billing-events.js +4 -4
  118. package/dist/packages/engine/build/build-execution.d.ts +4 -0
  119. package/dist/packages/engine/build/build-execution.js +4 -0
  120. package/dist/packages/engine/build/build-pipeline.d.ts +56 -0
  121. package/dist/packages/engine/{compile/compiled-pipeline.js → build/build-pipeline.js} +55 -55
  122. package/dist/packages/engine/build/build-plan-primitives.d.ts +2 -0
  123. package/dist/packages/engine/{compile/method-primitives.js → build/build-plan-primitives.js} +1 -1
  124. package/dist/packages/engine/build/build-plan-runs.d.ts +14 -0
  125. package/dist/packages/engine/build/build-plan-runs.js +31 -0
  126. package/dist/packages/engine/build/build-stage-plan.d.ts +16 -0
  127. package/dist/packages/engine/build/build-stage-plan.js +100 -0
  128. package/dist/packages/engine/build/build-stage-runner.d.ts +15 -0
  129. package/dist/packages/engine/{compile/compiled-stage-runner.js → build/build-stage-runner.js} +21 -21
  130. package/dist/packages/engine/build/build-target.d.ts +11 -0
  131. package/dist/packages/engine/build/build-target.js +16 -0
  132. package/dist/packages/engine/{compile → build}/check-evaluator.d.ts +4 -4
  133. package/dist/packages/engine/{compile → build}/check-evaluator.js +1 -1
  134. package/dist/packages/engine/{compile → build}/discovery.d.ts +2 -2
  135. package/dist/packages/engine/{compile → build}/discovery.js +4 -4
  136. package/dist/packages/engine/{compile → build}/index.d.ts +6 -6
  137. package/dist/packages/engine/{compile → build}/index.js +5 -5
  138. package/dist/packages/engine/{compile → build}/lib/schema.d.ts +79 -79
  139. package/dist/packages/engine/{compile → build}/lib/schema.js +71 -71
  140. package/dist/packages/engine/build/reset.d.ts +2 -0
  141. package/dist/packages/engine/build/reset.js +74 -0
  142. package/dist/packages/engine/{compile → build}/runtime-contracts.js +8 -8
  143. package/dist/packages/engine/build/runtime-inventory.d.ts +7 -0
  144. package/dist/packages/engine/{compile → build}/runtime-inventory.js +8 -8
  145. package/dist/packages/engine/{compile → build}/runtime-paths.js +6 -6
  146. package/dist/packages/engine/{compile → build}/runtime-prompt.js +11 -11
  147. package/dist/packages/engine/build/runtime-reconcile.d.ts +2 -0
  148. package/dist/packages/engine/{compile → build}/runtime-reconcile.js +18 -18
  149. package/dist/packages/engine/{compile → build}/runtime-runs.js +27 -27
  150. package/dist/packages/engine/{compile → build}/runtime-types.d.ts +10 -10
  151. package/dist/packages/engine/build/source-files.d.ts +46 -0
  152. package/dist/packages/engine/{compile → build}/source-files.js +32 -32
  153. package/dist/packages/engine/build/state-artifacts.d.ts +9 -0
  154. package/dist/packages/engine/build/state-artifacts.js +14 -0
  155. package/dist/packages/engine/build/state-health.d.ts +4 -0
  156. package/dist/packages/engine/{compile → build}/state-health.js +40 -40
  157. package/dist/packages/engine/build/state-io.d.ts +11 -0
  158. package/dist/packages/engine/{compile → build}/state-io.js +22 -22
  159. package/dist/packages/engine/build/state-paths.js +16 -0
  160. package/dist/packages/engine/build/state-view.d.ts +5 -0
  161. package/dist/packages/engine/{compile → build}/state-view.js +29 -29
  162. package/dist/packages/engine/build/state.d.ts +7 -0
  163. package/dist/packages/engine/build/state.js +12 -0
  164. package/dist/packages/engine/build/validate-verifiable-context.d.ts +27 -0
  165. package/dist/packages/engine/{compile/validate-compiled.js → build/validate-verifiable-context.js} +73 -73
  166. package/dist/packages/engine/{compile → build}/validate.d.ts +4 -4
  167. package/dist/packages/engine/{compile → build}/validate.js +27 -27
  168. package/dist/packages/engine/build/verifiable-context-paths.d.ts +47 -0
  169. package/dist/packages/engine/build/verifiable-context-paths.js +121 -0
  170. package/dist/packages/engine/build/verifiable-context-schema.d.ts +21 -0
  171. package/dist/packages/engine/build/verifiable-context-schema.js +126 -0
  172. package/dist/packages/engine/client.d.ts +16 -16
  173. package/dist/packages/engine/client.js +21 -21
  174. package/dist/packages/engine/cloud-seams.d.ts +3 -3
  175. package/dist/packages/engine/execution/index.d.ts +2 -2
  176. package/dist/packages/engine/execution/index.js +1 -1
  177. package/dist/packages/engine/execution/lib/schema.d.ts +90 -95
  178. package/dist/packages/engine/execution/lib/schema.js +31 -31
  179. package/dist/packages/engine/index.d.ts +7 -7
  180. package/dist/packages/engine/index.js +3 -3
  181. package/dist/packages/engine/instance-paths.d.ts +39 -39
  182. package/dist/packages/engine/instance-paths.js +48 -48
  183. package/dist/packages/engine/lib/schema.d.ts +900 -472
  184. package/dist/packages/engine/lib/schema.js +137 -153
  185. package/dist/packages/engine/native-run-handlers.d.ts +12 -12
  186. package/dist/packages/engine/native-run-handlers.js +135 -135
  187. package/dist/packages/engine/preparation-store.d.ts +22 -23
  188. package/dist/packages/engine/preparation-store.js +30 -31
  189. package/dist/packages/engine/readiness-check-draft.d.ts +2 -2
  190. package/dist/packages/engine/readiness-check-draft.js +1 -1
  191. package/dist/packages/engine/requested-artifacts.d.ts +2 -2
  192. package/dist/packages/engine/routes.d.ts +18 -17
  193. package/dist/packages/engine/routes.js +20 -19
  194. package/dist/packages/engine/run-observability.d.ts +5 -3
  195. package/dist/packages/engine/run-observability.js +101 -89
  196. package/dist/packages/engine/runtime-caches.d.ts +16 -16
  197. package/dist/packages/engine/runtime-caches.js +26 -26
  198. package/dist/packages/engine/runtime-event-applier.d.ts +2 -2
  199. package/dist/packages/engine/runtime-event-applier.js +1 -1
  200. package/dist/packages/engine/runtime-persistence.d.ts +9 -9
  201. package/dist/packages/engine/runtime-persistence.js +16 -16
  202. package/dist/packages/engine/runtime-proposal-helpers.d.ts +14 -14
  203. package/dist/packages/engine/runtime-proposal-helpers.js +78 -80
  204. package/dist/packages/engine/runtime-resource-builders.d.ts +12 -12
  205. package/dist/packages/engine/runtime-resource-builders.js +19 -19
  206. package/dist/packages/engine/runtime.d.ts +52 -61
  207. package/dist/packages/engine/runtime.js +440 -463
  208. package/dist/packages/engine/server.d.ts +2 -2
  209. package/dist/packages/engine/server.js +147 -116
  210. package/dist/packages/engine/service-registry.d.ts +5 -17
  211. package/dist/packages/engine/service-registry.js +5 -20
  212. package/dist/packages/engine/verify/lib/schema.d.ts +19 -19
  213. package/dist/packages/engine/verify/lib/schema.js +36 -8
  214. package/dist/packages/engine/verify/readiness-check-run.d.ts +15 -16
  215. package/dist/packages/engine/verify/readiness-check-run.js +46 -46
  216. package/dist/packages/engine/verify/verify-execution.d.ts +3 -3
  217. package/dist/packages/engine/verify/verify-execution.js +10 -10
  218. package/dist/packages/engine/verify/verify-paths.d.ts +4 -4
  219. package/dist/packages/engine/verify/verify-paths.js +17 -17
  220. package/dist/packages/engine/verify/verify-sandbox.d.ts +1 -1
  221. package/dist/packages/engine/verify/verify-sandbox.js +26 -26
  222. package/dist/packages/engine/verify/verify-targets.d.ts +2 -2
  223. package/dist/packages/engine/verify/verify-targets.js +17 -17
  224. package/dist/packages/engine/verify/verify-types.d.ts +2 -2
  225. package/dist/packages/engine/verify/verify.d.ts +1 -1
  226. package/dist/packages/engine/verify/verify.js +1 -1
  227. package/dist/packages/engine/wire-schemas.d.ts +38 -40
  228. package/dist/packages/engine/wire-schemas.js +13 -13
  229. package/dist/packages/project/index.d.ts +1 -1
  230. package/dist/packages/project/interf-bootstrap.d.ts +1 -1
  231. package/dist/packages/project/interf-bootstrap.js +1 -1
  232. package/dist/packages/project/interf-detect.d.ts +11 -11
  233. package/dist/packages/project/interf-detect.js +30 -30
  234. package/dist/packages/project/interf-scaffold.d.ts +3 -3
  235. package/dist/packages/project/interf-scaffold.js +72 -72
  236. package/dist/packages/project/interf.d.ts +4 -4
  237. package/dist/packages/project/interf.js +3 -3
  238. package/dist/packages/project/lib/schema.d.ts +12 -12
  239. package/dist/packages/project/lib/schema.js +14 -14
  240. package/dist/packages/project/preparation-entries.d.ts +3 -3
  241. package/dist/packages/project/preparation-entries.js +19 -19
  242. package/dist/packages/project/source-config.d.ts +10 -10
  243. package/dist/packages/project/source-config.js +58 -58
  244. package/package.json +15 -15
  245. package/public-repo/CONTRIBUTING.md +12 -12
  246. package/public-repo/README.md +65 -63
  247. package/public-repo/SECURITY.md +3 -3
  248. package/public-repo/build-plans/interf-default/README.md +33 -0
  249. package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/shape/SKILL.md +10 -10
  250. package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/structure/SKILL.md +2 -2
  251. package/public-repo/{methods/interf-default/compile → build-plans/interf-default/build}/stages/summarize/SKILL.md +1 -1
  252. package/public-repo/{methods/interf-default/method.json → build-plans/interf-default/build-plan.json} +15 -15
  253. package/public-repo/{methods/interf-default/method.schema.json → build-plans/interf-default/build-plan.schema.json} +4 -4
  254. package/public-repo/build-plans/interf-default/improve/SKILL.md +18 -0
  255. package/public-repo/{methods → build-plans}/interf-default/use/query/SKILL.md +6 -6
  256. package/public-repo/plugins/README.md +1 -1
  257. package/public-repo/plugins/interf/.claude-plugin/plugin.json +3 -3
  258. package/public-repo/plugins/interf/README.md +4 -1
  259. package/public-repo/plugins/interf/skills/interf/SKILL.md +189 -290
  260. package/public-repo/skills/interf/SKILL.md +189 -290
  261. package/LICENSE.md +0 -1
  262. package/TRADEMARKS.md +0 -8
  263. package/dist/cli/commands/method.d.ts +0 -2
  264. package/dist/compiler-ui/404.html +0 -1
  265. package/dist/compiler-ui/__next.__PAGE__.txt +0 -10
  266. package/dist/compiler-ui/__next._full.txt +0 -21
  267. package/dist/compiler-ui/__next._head.txt +0 -5
  268. package/dist/compiler-ui/__next._index.txt +0 -6
  269. package/dist/compiler-ui/_next/static/chunks/01646j7yi.w5a.css +0 -1
  270. package/dist/compiler-ui/_next/static/chunks/02r7siaw-_p5w.js +0 -1
  271. package/dist/compiler-ui/_next/static/chunks/04d0ly-7xb~-j.js +0 -91
  272. package/dist/compiler-ui/_next/static/chunks/0fhs9psnxqd8s.js +0 -1
  273. package/dist/compiler-ui/_next/static/chunks/0mssmhpbifj15.css +0 -2
  274. package/dist/compiler-ui/_next/static/chunks/0nypu~ddwxari.js +0 -116
  275. package/dist/compiler-ui/_next/static/chunks/0p3s8iyhgcww2.js +0 -31
  276. package/dist/compiler-ui/_next/static/chunks/0tjf-vu_rz8s0.css +0 -1
  277. package/dist/compiler-ui/_next/static/chunks/0u6p3fpbbfgtl.js +0 -1
  278. package/dist/compiler-ui/_next/static/chunks/0wpx5..8dnh0w.js +0 -1
  279. package/dist/compiler-ui/_next/static/chunks/0y0uj160p0ts~.js +0 -1
  280. package/dist/compiler-ui/_next/static/chunks/10t8l~_oenf.c.js +0 -1
  281. package/dist/compiler-ui/_next/static/chunks/13gz9e7z~imx1.js +0 -5
  282. package/dist/compiler-ui/_next/static/chunks/156xed-b6czaw.js +0 -1
  283. package/dist/compiler-ui/_next/static/chunks/turbopack-02-3e_c-yz~5g.js +0 -1
  284. package/dist/compiler-ui/_not-found/__next._full.txt +0 -16
  285. package/dist/compiler-ui/_not-found/__next._head.txt +0 -5
  286. package/dist/compiler-ui/_not-found/__next._index.txt +0 -6
  287. package/dist/compiler-ui/_not-found/__next._not-found.txt +0 -5
  288. package/dist/compiler-ui/_not-found.html +0 -1
  289. package/dist/compiler-ui/_not-found.txt +0 -16
  290. package/dist/compiler-ui/index.html +0 -1
  291. package/dist/compiler-ui/index.txt +0 -21
  292. package/dist/packages/engine/agents/lib/compiled-bootstrap.d.ts +0 -3
  293. package/dist/packages/engine/agents/lib/compiled-bootstrap.js +0 -19
  294. package/dist/packages/engine/compile/artifact-counts.d.ts +0 -1
  295. package/dist/packages/engine/compile/compiled-compile.d.ts +0 -4
  296. package/dist/packages/engine/compile/compiled-compile.js +0 -4
  297. package/dist/packages/engine/compile/compiled-paths.d.ts +0 -47
  298. package/dist/packages/engine/compile/compiled-paths.js +0 -121
  299. package/dist/packages/engine/compile/compiled-pipeline.d.ts +0 -56
  300. package/dist/packages/engine/compile/compiled-schema.d.ts +0 -21
  301. package/dist/packages/engine/compile/compiled-schema.js +0 -126
  302. package/dist/packages/engine/compile/compiled-stage-plan.d.ts +0 -16
  303. package/dist/packages/engine/compile/compiled-stage-plan.js +0 -100
  304. package/dist/packages/engine/compile/compiled-stage-runner.d.ts +0 -15
  305. package/dist/packages/engine/compile/compiled-target.d.ts +0 -11
  306. package/dist/packages/engine/compile/compiled-target.js +0 -16
  307. package/dist/packages/engine/compile/method-primitives.d.ts +0 -2
  308. package/dist/packages/engine/compile/method-runs.d.ts +0 -14
  309. package/dist/packages/engine/compile/method-runs.js +0 -31
  310. package/dist/packages/engine/compile/reset.d.ts +0 -2
  311. package/dist/packages/engine/compile/reset.js +0 -74
  312. package/dist/packages/engine/compile/runtime-inventory.d.ts +0 -7
  313. package/dist/packages/engine/compile/runtime-reconcile.d.ts +0 -2
  314. package/dist/packages/engine/compile/source-files.d.ts +0 -46
  315. package/dist/packages/engine/compile/state-artifacts.d.ts +0 -9
  316. package/dist/packages/engine/compile/state-artifacts.js +0 -14
  317. package/dist/packages/engine/compile/state-health.d.ts +0 -4
  318. package/dist/packages/engine/compile/state-io.d.ts +0 -11
  319. package/dist/packages/engine/compile/state-paths.js +0 -16
  320. package/dist/packages/engine/compile/state-view.d.ts +0 -5
  321. package/dist/packages/engine/compile/state.d.ts +0 -7
  322. package/dist/packages/engine/compile/state.js +0 -12
  323. package/dist/packages/engine/compile/validate-compiled.d.ts +0 -27
  324. package/dist/packages/methods/authoring/index.d.ts +0 -4
  325. package/dist/packages/methods/authoring/index.js +0 -4
  326. package/dist/packages/methods/authoring/method-authoring.d.ts +0 -36
  327. package/dist/packages/methods/authoring/method-edit-session.d.ts +0 -18
  328. package/dist/packages/methods/authoring/method-improvement.d.ts +0 -23
  329. package/dist/packages/methods/authoring/method-improvement.js +0 -217
  330. package/dist/packages/methods/index.d.ts +0 -2
  331. package/dist/packages/methods/index.js +0 -2
  332. package/dist/packages/methods/method-resolution.d.ts +0 -6
  333. package/dist/packages/methods/method-resolution.js +0 -7
  334. package/dist/packages/methods/package/builtin-compiled-method.d.ts +0 -37
  335. package/dist/packages/methods/package/builtin-compiled-method.js +0 -91
  336. package/dist/packages/methods/package/interf-method-package.d.ts +0 -31
  337. package/dist/packages/methods/package/interf-method-package.js +0 -466
  338. package/dist/packages/methods/package/local-methods.d.ts +0 -74
  339. package/dist/packages/methods/package/method-definitions.d.ts +0 -61
  340. package/dist/packages/methods/package/method-definitions.js +0 -214
  341. package/dist/packages/methods/package/method-review-paths.d.ts +0 -10
  342. package/dist/packages/methods/package/method-review-paths.js +0 -31
  343. package/dist/packages/methods/package/user-methods.d.ts +0 -17
  344. package/dist/packages/methods/package/user-methods.js +0 -77
  345. package/public-repo/methods/interf-default/README.md +0 -33
  346. package/public-repo/methods/interf-default/improve/SKILL.md +0 -18
  347. /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_buildManifest.js +0 -0
  348. /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_clientMiddlewareManifest.js +0 -0
  349. /package/dist/{compiler-ui/_next/static/tYHMLL9oKds1yDoNYgkPV → interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6}/_ssgManifest.js +0 -0
  350. /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/03~yq9q893hmn.js +0 -0
  351. /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/0y5z3t-z1c8ks.js.map +0 -0
  352. /package/dist/{compiler-ui → interf-ui}/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -0
  353. /package/dist/{compiler-ui → interf-ui}/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
  354. /package/dist/{compiler-ui → interf-ui}/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
  355. /package/dist/{compiler-ui → interf-ui}/_next/static/media/worker.102zas1s52_pf.js +0 -0
  356. /package/dist/packages/{methods/authoring/lib/method-edit-utils.js → build-plans/authoring/lib/build-plan-edit-utils.js} +0 -0
  357. /package/dist/packages/{methods → build-plans}/package/lib/package-root.d.ts +0 -0
  358. /package/dist/packages/engine/{compile → build}/runtime-contracts.d.ts +0 -0
  359. /package/dist/packages/engine/{compile → build}/runtime-paths.d.ts +0 -0
  360. /package/dist/packages/engine/{compile → build}/runtime-prompt.d.ts +0 -0
  361. /package/dist/packages/engine/{compile → build}/runtime-runs.d.ts +0 -0
  362. /package/dist/packages/engine/{compile → build}/runtime-types.js +0 -0
  363. /package/dist/packages/engine/{compile → build}/runtime.d.ts +0 -0
  364. /package/dist/packages/engine/{compile → build}/runtime.js +0 -0
  365. /package/dist/packages/engine/{compile → build}/state-paths.d.ts +0 -0
  366. /package/dist/packages/engine/{compile → build}/validate-helpers.d.ts +0 -0
  367. /package/dist/packages/engine/{compile → build}/validate-helpers.js +0 -0
@@ -3,19 +3,19 @@ import { join } from "node:path";
3
3
  import { z } from "zod";
4
4
  import { warnInterf } from "../../contracts/utils/logger.js";
5
5
  import { readJsonFileUnchecked } from "../../contracts/utils/parse.js";
6
- import { MethodCompiledSchemaSchema, MethodArtifactIdSchema, } from "../../engine/compile/lib/schema.js";
7
- import { listBuiltinCompiledArtifactSpecs, requiredCompiledArtifactOwners, } from "./builtin-compiled-method.js";
8
- // Method packages define the context interface. The compiler persists the
6
+ import { BuildPlanContextSchemaSchema, BuildPlanArtifactIdSchema, } from "../../engine/build/lib/schema.js";
7
+ import { listBuiltinBuildPlanArtifactSpecs, requiredBuildPlanArtifactOwners, } from "./builtin-build-plan.js";
8
+ // Build Plan packages define the context interface. The local engine persists the
9
9
  // same schema on disk, but higher layers should prefer this boundary when they
10
- // mean "the Method-declared shape a portable context must implement."
11
- export const CONTEXT_INTERFACE_FILE = "method.schema.json";
12
- export const ContextInterfaceSchema = MethodCompiledSchemaSchema;
10
+ // mean "the Build Plan-declared shape verifiable context must implement."
11
+ export const CONTEXT_INTERFACE_FILE = "build-plan.schema.json";
12
+ export const ContextInterfaceSchema = BuildPlanContextSchemaSchema;
13
13
  // Package-owned input contract for authoring, review, and future authoring flows.
14
- // This does not change compiler execution semantics; it describes what data a
15
- // Method expects to organize before the compiler materializes the context
14
+ // This does not change build execution semantics; it describes what data a
15
+ // Build Plan expects to organize before the local engine materializes the context
16
16
  // interface on disk.
17
- export const MethodInputSpecSchema = z.object({
18
- id: MethodArtifactIdSchema,
17
+ export const BuildPlanInputSpecSchema = z.object({
18
+ id: BuildPlanArtifactIdSchema,
19
19
  label: z.string().min(1),
20
20
  description: z.string().min(1),
21
21
  required: z.boolean().default(false),
@@ -24,10 +24,10 @@ export const MethodInputSpecSchema = z.object({
24
24
  function normalizeContextInterface(contextInterface) {
25
25
  return {
26
26
  ...contextInterface,
27
- kind: "method-schema",
27
+ kind: "build-plan-schema",
28
28
  };
29
29
  }
30
- function artifactToMethodArtifact(artifact) {
30
+ function artifactToBuildPlanArtifact(artifact) {
31
31
  const path = artifact.shape.kind === "path" ? artifact.shape.path : artifact.id;
32
32
  return {
33
33
  id: artifact.id,
@@ -40,7 +40,7 @@ function artifactToMethodArtifact(artifact) {
40
40
  };
41
41
  }
42
42
  export function listContextInterfaceArtifacts(contextInterface) {
43
- return contextInterface.artifacts.map(artifactToMethodArtifact);
43
+ return contextInterface.artifacts.map(artifactToBuildPlanArtifact);
44
44
  }
45
45
  function titleCaseArtifactId(artifactId) {
46
46
  return artifactId
@@ -59,8 +59,8 @@ export function resolveContextInterfacePath(rootPath) {
59
59
  export function contextInterfaceExists(rootPath) {
60
60
  return existsSync(contextInterfaceFilePath(rootPath));
61
61
  }
62
- export function contextInterfaceArtifactAbsolutePath(compiledPath, artifact) {
63
- return join(compiledPath, artifact.path);
62
+ export function contextInterfaceArtifactAbsolutePath(verifiableContextPath, artifact) {
63
+ return join(verifiableContextPath, artifact.path);
64
64
  }
65
65
  export function contextInterfaceArtifactPath(artifact) {
66
66
  if (artifact.kind === "file")
@@ -76,7 +76,7 @@ export function summarizeContextInterface(contextInterface) {
76
76
  runtimeArtifacts: artifacts.filter((artifact) => artifact.role === "runtime"),
77
77
  };
78
78
  }
79
- export function deriveMethodInputsFromContextInterface(contextInterface) {
79
+ export function deriveBuildPlanInputsFromContextInterface(contextInterface) {
80
80
  if (!contextInterface)
81
81
  return [];
82
82
  return listContextInterfaceArtifacts(contextInterface)
@@ -88,13 +88,13 @@ export function deriveMethodInputsFromContextInterface(contextInterface) {
88
88
  required: artifact.required,
89
89
  }));
90
90
  }
91
- export function buildContextInterface(stages, label = "Method context interface") {
91
+ export function buildContextInterface(stages, label = "Build Plan context interface") {
92
92
  return {
93
- kind: "method-schema",
93
+ kind: "build-plan-schema",
94
94
  version: 1,
95
- target_type: "compiled",
95
+ target_type: "verifiable-context",
96
96
  label,
97
- artifacts: listBuiltinCompiledArtifactSpecs().map((artifact) => ({
97
+ artifacts: listBuiltinBuildPlanArtifactSpecs().map((artifact) => ({
98
98
  id: artifact.id,
99
99
  description: artifact.description,
100
100
  shape: {
@@ -103,7 +103,7 @@ export function buildContextInterface(stages, label = "Method context interface"
103
103
  artifact_kind: artifact.kind === "file" ? "file" : "directory",
104
104
  },
105
105
  checks: [],
106
- built_by_stages: requiredCompiledArtifactOwners(stages, artifact.id),
106
+ built_by_stages: requiredBuildPlanArtifactOwners(stages, artifact.id),
107
107
  })),
108
108
  };
109
109
  }
@@ -121,12 +121,12 @@ export function readContextInterface(rootPath) {
121
121
  const path = contextInterfaceFilePath(rootPath);
122
122
  if (!existsSync(path))
123
123
  return null;
124
- const raw = readJsonFileUnchecked(path, "Method context interface");
124
+ const raw = readJsonFileUnchecked(path, "Build Plan context interface");
125
125
  if (raw === null)
126
126
  return null;
127
127
  const parsed = ContextInterfaceSchema.safeParse(raw);
128
128
  if (!parsed.success) {
129
- warnInterf(`Warning: failed to validate Method context interface at ${path}: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
129
+ warnInterf(`Warning: failed to validate Build Plan context interface at ${path}: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
130
130
  return null;
131
131
  }
132
132
  return normalizeContextInterface(parsed.data);
@@ -0,0 +1,31 @@
1
+ import { type BuildPlanDefinition } from "./build-plan-definitions.js";
2
+ export declare function writeBuildPlanPackageForVerifiableContext(verifiableContextPath: string, buildPlan: BuildPlanDefinition<string>): void;
3
+ export declare function writeBuildPlanPackageToDir(buildPlanDir: string, buildPlan: BuildPlanDefinition<string>, options?: {
4
+ overwrite?: boolean;
5
+ }): void;
6
+ export declare function seedVerifiableContextBuildPlanPackage(options: {
7
+ verifiableContextPath: string;
8
+ prepDataDir: string;
9
+ buildPlanId: string;
10
+ }): void;
11
+ export declare function createLocalBuildPlanPackageFromTemplate(options: {
12
+ prepDataDir: string;
13
+ baseBuildPlanId: string;
14
+ buildPlanId: string;
15
+ label: string;
16
+ hint: string;
17
+ stagePolicyNotes: Record<string, string[]>;
18
+ }): string;
19
+ export declare function seedLocalBuildPlanPackageFromBase(options: {
20
+ prepDataDir: string;
21
+ baseBuildPlanId: string;
22
+ buildPlanId: string;
23
+ label: string;
24
+ hint: string;
25
+ }): string;
26
+ export declare function createScratchLocalBuildPlanPackage(options: {
27
+ prepDataDir: string;
28
+ buildPlanId: string;
29
+ label: string;
30
+ hint: string;
31
+ }): string;
@@ -0,0 +1,466 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { renderVerifiableContextQuerySkill } from "../../engine/agents/lib/shells.js";
4
+ import { copyBuildPlanPackageDirectory, isPortableBuildPlanPackage, patchBuildPlanPackageMetadata, resolveBuildPlanPackageSourcePath, buildPlanDefinitionPath, mergeStagePolicyNotesForStages, } from "./local-build-plans.js";
5
+ import { getBuildPlan, } from "./build-plan-definitions.js";
6
+ import { CONTEXT_INTERFACE_FILE, deriveBuildPlanInputsFromContextInterface, listContextInterfaceArtifacts, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
7
+ import { buildPlanPackagePathForVerifiableContext } from "../../engine/build/verifiable-context-paths.js";
8
+ function writeBuildPlanStarterDocs(dirPath, docs, options) {
9
+ for (const doc of docs ?? []) {
10
+ const targetPath = join(dirPath, doc.relativePath);
11
+ if (!options.overwrite && existsSync(targetPath))
12
+ continue;
13
+ mkdirSync(dirname(targetPath), { recursive: true });
14
+ writeFileSync(targetPath, doc.content);
15
+ }
16
+ }
17
+ function writeBuildPlanPackageJson(rootPath, buildPlan, options) {
18
+ const targetPath = join(rootPath, "build-plan.json");
19
+ if (!options.overwrite && existsSync(targetPath))
20
+ return;
21
+ const inputs = buildPlan.inputs?.length
22
+ ? buildPlan.inputs
23
+ : deriveBuildPlanInputsFromContextInterface(buildPlan.contextInterface ?? buildPlan.schema);
24
+ writeFileSync(targetPath, `${JSON.stringify({
25
+ id: buildPlan.id,
26
+ type: "build-plan",
27
+ engine_api: buildPlan.engineApi ?? {
28
+ kind: "build",
29
+ version: 1,
30
+ },
31
+ ...(buildPlan.purpose
32
+ ? {
33
+ purpose: {
34
+ label: buildPlan.purpose.label,
35
+ task_hint: buildPlan.purpose.taskHint,
36
+ },
37
+ }
38
+ : {}),
39
+ ...(inputs.length > 0 ? { inputs } : {}),
40
+ label: buildPlan.label,
41
+ hint: buildPlan.hint,
42
+ stages: buildPlan.stages.map((stage) => ({
43
+ id: stage.id,
44
+ label: stage.label,
45
+ description: stage.description,
46
+ contract_type: stage.contractType,
47
+ skill_dir: stage.skillDir,
48
+ reads: stage.reads,
49
+ writes: stage.writes,
50
+ })),
51
+ ...(buildPlan.stagePolicyNotes ? { stage_policy_notes: buildPlan.stagePolicyNotes } : {}),
52
+ }, null, 2)}\n`);
53
+ }
54
+ function renderBuildPlanReadme(buildPlan) {
55
+ const contextInterface = buildPlan.contextInterface ?? buildPlan.schema ?? null;
56
+ const stageLines = buildPlan.stages
57
+ .map((stage) => `- \`${stage.id}\` — ${stage.description} (${stage.contractType}; reads: ${stage.reads.join(", ")}; writes: ${stage.writes.join(", ")})`)
58
+ .join("\n");
59
+ const interfaceSummary = contextInterface
60
+ ? summarizeContextInterface(contextInterface)
61
+ : null;
62
+ const contextInterfaceArtifacts = contextInterface
63
+ ? listContextInterfaceArtifacts(contextInterface)
64
+ : [];
65
+ const contextInterfaceLines = contextInterfaceArtifacts.length > 0
66
+ ? contextInterfaceArtifacts
67
+ .map((artifact) => `- \`${artifact.id}\` — ${artifact.role} ${artifact.kind} Artifact at \`${artifact.path}\`: ${artifact.description}`)
68
+ .join("\n")
69
+ : null;
70
+ const inputs = buildPlan.inputs?.length
71
+ ? buildPlan.inputs
72
+ : deriveBuildPlanInputsFromContextInterface(contextInterface);
73
+ const inputLines = inputs.length > 0
74
+ ? inputs
75
+ .map((input) => `- \`${input.id}\` — ${input.label}: ${input.description}${input.required ? " (required)" : ""}${input.examples?.length ? ` Example inputs: ${input.examples.join("; ")}` : ""}`)
76
+ .join("\n")
77
+ : null;
78
+ const contextInterfaceSummaryLines = interfaceSummary
79
+ ? [
80
+ `- Input Artifacts: ${interfaceSummary.inputArtifacts.length > 0 ? interfaceSummary.inputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
81
+ `- Working Artifacts: ${interfaceSummary.workingArtifacts.length > 0 ? interfaceSummary.workingArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
82
+ `- Output Artifacts: ${interfaceSummary.outputArtifacts.length > 0 ? interfaceSummary.outputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
83
+ `- Runtime Artifacts: ${interfaceSummary.runtimeArtifacts.length > 0 ? interfaceSummary.runtimeArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
84
+ ].join("\n")
85
+ : null;
86
+ return [
87
+ `# ${buildPlan.label}`,
88
+ "",
89
+ buildPlan.hint,
90
+ ...(buildPlan.purpose
91
+ ? [
92
+ "",
93
+ "## Purpose",
94
+ "",
95
+ `- ${buildPlan.purpose.label}`,
96
+ `- ${buildPlan.purpose.taskHint}`,
97
+ ]
98
+ : []),
99
+ ...(inputLines
100
+ ? [
101
+ "",
102
+ "## Inputs",
103
+ "",
104
+ inputLines,
105
+ ]
106
+ : []),
107
+ ...(contextInterfaceLines
108
+ ? [
109
+ "",
110
+ "## Context Interface",
111
+ "",
112
+ ...(contextInterfaceSummaryLines
113
+ ? [
114
+ contextInterfaceSummaryLines,
115
+ "",
116
+ ]
117
+ : []),
118
+ "Artifact map:",
119
+ "",
120
+ contextInterfaceLines,
121
+ ]
122
+ : []),
123
+ "",
124
+ "## Package",
125
+ "",
126
+ "- `build-plan.json` = Build Plan stage graph, local-engine API target, and build contract mapping",
127
+ "- `build-plan.schema.json` = deterministic context interface for the Build Plan",
128
+ "- `improve/`, `build/stages/`, and `use/query/` = human-readable authoring docs",
129
+ "- Build Plans are standalone: explicit stages, schema, and docs live together in this folder",
130
+ "- Interf projects native agent shells from these docs for query use, stage execution, and Build Plan improvement loops",
131
+ "",
132
+ "## Stages",
133
+ "",
134
+ stageLines,
135
+ "",
136
+ "Interf runs the local copy of this Build Plan directly from `.interf/build-plan/` inside each verifiable-context output.",
137
+ "",
138
+ ].join("\n");
139
+ }
140
+ function renderDerivedBuildPlanReadme(options) {
141
+ return [
142
+ `# ${options.label}`,
143
+ "",
144
+ options.hint,
145
+ "",
146
+ `This Build Plan package was forked from \`${options.baseBuildPlanId}\` and materialized as a standalone package for this kind of agent work.`,
147
+ "It starts with that Build Plan topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
148
+ "",
149
+ "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.",
150
+ "",
151
+ "## Emphasis",
152
+ "",
153
+ ...(options.emphasis.length > 0
154
+ ? options.emphasis.map((entry) => `- ${entry.stageId} (${entry.label}): ${entry.notes.join("; ")}`)
155
+ : ["- No stage-specific emphasis was added yet."]),
156
+ "",
157
+ ].join("\n");
158
+ }
159
+ function renderSeedBuildPlanReadme(options) {
160
+ return [
161
+ `# ${options.label}`,
162
+ "",
163
+ options.hint,
164
+ "",
165
+ `This Build Plan package was forked from \`${options.baseBuildPlanId}\` as a standalone local package.`,
166
+ "It starts with that Build Plan topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
167
+ "",
168
+ "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.",
169
+ "",
170
+ ].join("\n");
171
+ }
172
+ function renderScratchBuildPlanReadme(options) {
173
+ return [
174
+ `# ${options.label}`,
175
+ "",
176
+ options.hint,
177
+ "",
178
+ "This Build Plan package is a neutral from-scratch authoring scaffold.",
179
+ "",
180
+ "It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
181
+ "Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Build Plan this source data and task actually need.",
182
+ "",
183
+ ].join("\n");
184
+ }
185
+ function renderImproveSkill(buildPlan) {
186
+ return [
187
+ "# Build Plan Improvement",
188
+ "",
189
+ `Build Plan package: ${buildPlan.id}`,
190
+ "",
191
+ "This file is the editable authoring source for Interf's generated native Build Plan improver shell.",
192
+ "The improver edits this local package directly.",
193
+ "",
194
+ "Default loop:",
195
+ "1. Read the loop context first.",
196
+ "2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
197
+ "3. Edit only the local Build Plan package for this verifiable context to create a better Build Plan implementation for this kind of agent work.",
198
+ `4. Keep purpose, inputs, \`build-plan.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
199
+ "",
200
+ "Guardrails:",
201
+ "- do not edit checks, test specs, or source artifacts",
202
+ "- do not hardcode expected answers into Build Plan docs",
203
+ "- keep this package standalone; do not rely on runtime inheritance",
204
+ "- keep the Build Plan stack coherent: purpose, inputs, context interface, and stages should describe the same job",
205
+ "- prefer small, defensible Build Plan changes over random churn",
206
+ "",
207
+ ].join("\n");
208
+ }
209
+ function renderStageSkill(buildPlan, stage) {
210
+ const notes = buildPlan.stagePolicyNotes?.[stage.id] ?? [];
211
+ const abstractRules = stage.contractType === "build-file-evidence"
212
+ ? [
213
+ "- Valid abstract forms for deterministic validation are:",
214
+ ' - frontmatter key `"abstract"` with a real sentence, or',
215
+ " - a markdown heading `## Abstract` followed by at least one sentence",
216
+ "- A bare `Abstract` label without markdown heading syntax does not count.",
217
+ ]
218
+ : [];
219
+ return [
220
+ `# ${stage.label}`,
221
+ "",
222
+ stage.description,
223
+ "",
224
+ "## Stage Contract",
225
+ "",
226
+ `- Contract type: \`${stage.contractType}\``,
227
+ `- Reads Artifacts: ${stage.reads.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
228
+ `- Writes Artifacts: ${stage.writes.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
229
+ "",
230
+ "## Requirements",
231
+ "",
232
+ "- Treat `build-plan.json` and `build-plan.schema.json` as the authoritative package contract for this stage.",
233
+ "- Read only from the declared input Artifacts unless this package explicitly documents broader Build Plan behavior.",
234
+ "- Write only inside the declared output Artifacts for this stage. Do not invent undeclared Artifacts or implicit outputs.",
235
+ "- Keep stage instructions, artifact ownership, and Build Plan checks aligned when you change this stage.",
236
+ "- Treat runtime files as proof and execution state, not as the source of truth for Build Plan behavior.",
237
+ "- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
238
+ ...abstractRules,
239
+ "",
240
+ ...(notes.length > 0
241
+ ? [
242
+ "## Notes",
243
+ "",
244
+ ...notes.map((note) => `- ${note}`),
245
+ "",
246
+ ]
247
+ : []),
248
+ ].join("\n");
249
+ }
250
+ export function writeBuildPlanPackageForVerifiableContext(verifiableContextPath, buildPlan) {
251
+ writeBuildPlanPackageToDir(buildPlanPackagePathForVerifiableContext(verifiableContextPath), buildPlan);
252
+ }
253
+ export function writeBuildPlanPackageToDir(buildPlanDir, buildPlan, options = {}) {
254
+ const overwrite = options.overwrite ?? true;
255
+ mkdirSync(join(buildPlanDir, "improve"), { recursive: true });
256
+ mkdirSync(join(buildPlanDir, "use", "query"), { recursive: true });
257
+ mkdirSync(join(buildPlanDir, "build", "stages"), { recursive: true });
258
+ for (const stage of buildPlan.stages) {
259
+ mkdirSync(join(buildPlanDir, "build", "stages", stage.skillDir), { recursive: true });
260
+ }
261
+ writeBuildPlanPackageJson(buildPlanDir, buildPlan, { overwrite });
262
+ if (overwrite || !existsSync(join(buildPlanDir, CONTEXT_INTERFACE_FILE))) {
263
+ const contextInterface = buildPlan.contextInterface ?? buildPlan.schema;
264
+ if (contextInterface) {
265
+ writeContextInterface(buildPlanDir, {
266
+ ...contextInterface,
267
+ label: contextInterface.label || `${buildPlan.label} Build Plan schema`,
268
+ });
269
+ }
270
+ else {
271
+ writeContextInterfaceFile(buildPlanDir, buildPlan.stages, `${buildPlan.label} Build Plan schema`);
272
+ }
273
+ }
274
+ if (overwrite || !existsSync(join(buildPlanDir, "README.md"))) {
275
+ writeFileSync(join(buildPlanDir, "README.md"), renderBuildPlanReadme(buildPlan));
276
+ }
277
+ if (overwrite || !existsSync(join(buildPlanDir, "improve", "SKILL.md"))) {
278
+ writeFileSync(join(buildPlanDir, "improve", "SKILL.md"), renderImproveSkill(buildPlan));
279
+ }
280
+ if (overwrite || !existsSync(join(buildPlanDir, "use", "query", "SKILL.md"))) {
281
+ writeFileSync(join(buildPlanDir, "use", "query", "SKILL.md"), renderVerifiableContextQuerySkill());
282
+ }
283
+ for (const stage of buildPlan.stages) {
284
+ const targetPath = join(buildPlanDir, "build", "stages", stage.skillDir, "SKILL.md");
285
+ if (overwrite || !existsSync(targetPath)) {
286
+ writeFileSync(targetPath, renderStageSkill(buildPlan, stage));
287
+ }
288
+ }
289
+ writeBuildPlanStarterDocs(buildPlanDir, buildPlan.starterDocs, { overwrite });
290
+ }
291
+ export function seedVerifiableContextBuildPlanPackage(options) {
292
+ const resolvedBuildPlan = getBuildPlan(options.buildPlanId, {
293
+ prepDataDir: options.prepDataDir,
294
+ });
295
+ const sourceBuildPlanPath = resolveBuildPlanPackageSourcePath(options.prepDataDir, resolvedBuildPlan.id);
296
+ if (sourceBuildPlanPath && isPortableBuildPlanPackage(sourceBuildPlanPath)) {
297
+ // Portable seed packages can be copied directly because Build runs the
298
+ // local package folder without reading source-root Build Plan packages.
299
+ copyBuildPlanPackageDirectory(sourceBuildPlanPath, buildPlanPackagePathForVerifiableContext(options.verifiableContextPath));
300
+ patchBuildPlanPackageMetadata(buildPlanPackagePathForVerifiableContext(options.verifiableContextPath), {
301
+ id: resolvedBuildPlan.id,
302
+ inputs: resolvedBuildPlan.inputs,
303
+ label: resolvedBuildPlan.label,
304
+ hint: resolvedBuildPlan.hint,
305
+ stagePolicyNotes: resolvedBuildPlan.stagePolicyNotes,
306
+ });
307
+ // The verifiable-context README is always derived from the resolved Build Plan;
308
+ // any hand-authored README belongs in the Preparation-local draft at
309
+ // <prep-data>/build-plans/<id>/, not in the built copy.
310
+ writeFileSync(join(buildPlanPackagePathForVerifiableContext(options.verifiableContextPath), "README.md"), renderBuildPlanReadme(resolvedBuildPlan));
311
+ return;
312
+ }
313
+ // Legacy or partially-defined seed packages are resolved once and
314
+ // materialized into a standalone local package.
315
+ writeBuildPlanPackageForVerifiableContext(options.verifiableContextPath, resolvedBuildPlan);
316
+ }
317
+ export function createLocalBuildPlanPackageFromTemplate(options) {
318
+ const targetPath = seedLocalBuildPlanPackageFromBase({
319
+ prepDataDir: options.prepDataDir,
320
+ baseBuildPlanId: options.baseBuildPlanId,
321
+ buildPlanId: options.buildPlanId,
322
+ label: options.label,
323
+ hint: options.hint,
324
+ });
325
+ const baseBuildPlan = getBuildPlan(options.baseBuildPlanId, {
326
+ prepDataDir: options.prepDataDir,
327
+ });
328
+ const stagePolicyNotes = mergeStagePolicyNotesForStages(baseBuildPlan.stages, baseBuildPlan.stagePolicyNotes, options.stagePolicyNotes);
329
+ patchBuildPlanPackageMetadata(targetPath, {
330
+ id: options.buildPlanId,
331
+ label: options.label,
332
+ hint: options.hint,
333
+ stagePolicyNotes,
334
+ });
335
+ writeFileSync(join(targetPath, "README.md"), renderDerivedBuildPlanReadme({
336
+ label: options.label,
337
+ hint: options.hint,
338
+ baseBuildPlanId: options.baseBuildPlanId,
339
+ emphasis: baseBuildPlan.stages
340
+ .map((stage) => ({
341
+ stageId: stage.id,
342
+ label: stage.label,
343
+ notes: stagePolicyNotes?.[stage.id] ?? [],
344
+ }))
345
+ .filter((entry) => entry.notes.length > 0),
346
+ }));
347
+ return targetPath;
348
+ }
349
+ export function seedLocalBuildPlanPackageFromBase(options) {
350
+ const baseBuildPlan = getBuildPlan(options.baseBuildPlanId, {
351
+ prepDataDir: options.prepDataDir,
352
+ });
353
+ const sourceBuildPlanPath = resolveBuildPlanPackageSourcePath(options.prepDataDir, options.baseBuildPlanId);
354
+ const targetPath = buildPlanDefinitionPath(options.prepDataDir, options.buildPlanId);
355
+ if (sourceBuildPlanPath && isPortableBuildPlanPackage(sourceBuildPlanPath)) {
356
+ // Copy directly when the base package is already portable and standalone.
357
+ copyBuildPlanPackageDirectory(sourceBuildPlanPath, targetPath);
358
+ patchBuildPlanPackageMetadata(targetPath, {
359
+ id: options.buildPlanId,
360
+ inputs: baseBuildPlan.inputs,
361
+ label: options.label,
362
+ hint: options.hint,
363
+ });
364
+ writeFileSync(join(targetPath, "README.md"), renderSeedBuildPlanReadme({
365
+ label: options.label,
366
+ hint: options.hint,
367
+ baseBuildPlanId: options.baseBuildPlanId,
368
+ }));
369
+ return targetPath;
370
+ }
371
+ // Base packages are materialized immediately so the new local Build Plan package
372
+ // is standalone from its first write.
373
+ const localBuildPlan = {
374
+ ...baseBuildPlan,
375
+ id: options.buildPlanId,
376
+ label: options.label,
377
+ hint: options.hint,
378
+ recommended: false,
379
+ scope: "local",
380
+ starterDocs: [
381
+ {
382
+ relativePath: "README.md",
383
+ content: renderSeedBuildPlanReadme({
384
+ label: options.label,
385
+ hint: options.hint,
386
+ baseBuildPlanId: options.baseBuildPlanId,
387
+ }),
388
+ },
389
+ ...(baseBuildPlan.starterDocs ?? []).filter((doc) => doc.relativePath !== "README.md"),
390
+ ],
391
+ };
392
+ writeBuildPlanPackageToDir(targetPath, localBuildPlan);
393
+ return targetPath;
394
+ }
395
+ export function createScratchLocalBuildPlanPackage(options) {
396
+ const targetPath = buildPlanDefinitionPath(options.prepDataDir, options.buildPlanId);
397
+ const buildPlan = {
398
+ id: options.buildPlanId,
399
+ engineApi: {
400
+ kind: "build",
401
+ version: 1,
402
+ },
403
+ purpose: {
404
+ label: "From-scratch Build Plan draft",
405
+ taskHint: "Replace this neutral scaffold with the Build Plan stages, outputs, and proof rules this agent work requires.",
406
+ },
407
+ inputs: [
408
+ {
409
+ id: "source",
410
+ label: "Source",
411
+ description: "Source references assigned to each stage by Interf runtime.",
412
+ required: true,
413
+ },
414
+ ],
415
+ label: options.label,
416
+ hint: options.hint,
417
+ recommended: false,
418
+ scope: "local",
419
+ contextInterface: {
420
+ kind: "build-plan-schema",
421
+ version: 1,
422
+ target_type: "verifiable-context",
423
+ label: `${options.label} Build Plan schema`,
424
+ artifacts: [
425
+ {
426
+ id: "draft-context",
427
+ description: "Temporary placeholder Artifact for the neutral authoring scaffold. Replace it with task-specific Artifacts.",
428
+ shape: { kind: "path", path: "draft", artifact_kind: "directory" },
429
+ checks: [
430
+ { id: "exists", kind: "min_file_count", required: true, params: { min: 1 } },
431
+ ],
432
+ built_by_stages: ["prepare"],
433
+ },
434
+ ],
435
+ },
436
+ stages: [
437
+ {
438
+ id: "prepare",
439
+ label: "Prepare",
440
+ description: "Neutral placeholder stage for Build Plan authoring. Replace this stage with the topology this agent work needs.",
441
+ contractType: "build-plan-draft-stage",
442
+ skillDir: "prepare",
443
+ role: "general",
444
+ reads: [],
445
+ writes: ["draft-context"],
446
+ },
447
+ ],
448
+ stagePolicyNotes: {
449
+ prepare: [
450
+ "This is a neutral authoring scaffold, not a recommended Build Plan topology.",
451
+ "Replace this stage, Artifact, and check when drafting the final Build Plan.",
452
+ ],
453
+ },
454
+ starterDocs: [
455
+ {
456
+ relativePath: "README.md",
457
+ content: renderScratchBuildPlanReadme({
458
+ label: options.label,
459
+ hint: options.hint,
460
+ }),
461
+ },
462
+ ],
463
+ };
464
+ writeBuildPlanPackageToDir(targetPath, buildPlan);
465
+ return targetPath;
466
+ }
@@ -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/methods/package/lib/ -> package root)
5
+ // Package root (dist/packages/build-plans/package/lib/ -> package root)
6
6
  export const PACKAGE_ROOT = join(__dirname, "..", "..", "..", "..", "..");