@interf/compiler 0.9.5 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/README.md +135 -91
  2. package/TRADEMARKS.md +2 -13
  3. package/agent-skills/interf-actions/SKILL.md +143 -38
  4. package/agent-skills/interf-actions/references/cli.md +134 -67
  5. package/builtin-methods/interf-default/README.md +3 -4
  6. package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
  7. package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
  8. package/builtin-methods/interf-default/improve/SKILL.md +1 -1
  9. package/builtin-methods/interf-default/method.json +10 -4
  10. package/builtin-methods/interf-default/method.schema.json +0 -9
  11. package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
  12. package/dist/cli/commands/agents.d.ts +2 -0
  13. package/dist/cli/commands/agents.js +213 -0
  14. package/dist/cli/commands/compile.d.ts +8 -25
  15. package/dist/cli/commands/compile.js +83 -359
  16. package/dist/cli/commands/doctor.js +2 -2
  17. package/dist/cli/commands/login.d.ts +7 -0
  18. package/dist/cli/commands/login.js +39 -0
  19. package/dist/cli/commands/logout.d.ts +2 -0
  20. package/dist/cli/commands/logout.js +16 -0
  21. package/dist/cli/commands/mcp.d.ts +42 -0
  22. package/dist/cli/commands/mcp.js +239 -0
  23. package/dist/cli/commands/method.d.ts +2 -0
  24. package/dist/cli/commands/method.js +113 -0
  25. package/dist/cli/commands/prep.d.ts +2 -0
  26. package/dist/cli/commands/prep.js +152 -0
  27. package/dist/cli/commands/reset.d.ts +8 -1
  28. package/dist/cli/commands/reset.js +47 -26
  29. package/dist/cli/commands/runs.d.ts +2 -0
  30. package/dist/cli/commands/runs.js +120 -0
  31. package/dist/cli/commands/status.d.ts +6 -1
  32. package/dist/cli/commands/status.js +68 -111
  33. package/dist/cli/commands/verify.d.ts +7 -1
  34. package/dist/cli/commands/verify.js +69 -85
  35. package/dist/cli/commands/web.d.ts +0 -9
  36. package/dist/cli/commands/web.js +201 -121
  37. package/dist/cli/commands/wizard.d.ts +9 -0
  38. package/dist/cli/commands/wizard.js +689 -0
  39. package/dist/cli/index.d.ts +10 -7
  40. package/dist/cli/index.js +19 -12
  41. package/dist/compiler-ui/404.html +1 -1
  42. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  43. package/dist/compiler-ui/__next._full.txt +3 -3
  44. package/dist/compiler-ui/__next._head.txt +1 -1
  45. package/dist/compiler-ui/__next._index.txt +2 -2
  46. package/dist/compiler-ui/__next._tree.txt +2 -2
  47. package/dist/compiler-ui/_next/static/chunks/{177mvn4rse235.js → 0jipmpez3_ehh.js} +16 -16
  48. package/dist/compiler-ui/_next/static/chunks/{18a8f2jkv3z.c.css → 13awzu4tooflw.css} +1 -1
  49. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  50. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  51. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  52. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  53. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  54. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  55. package/dist/compiler-ui/_not-found.html +1 -1
  56. package/dist/compiler-ui/_not-found.txt +2 -2
  57. package/dist/compiler-ui/index.html +1 -1
  58. package/dist/compiler-ui/index.txt +3 -3
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +2 -2
  61. package/dist/packages/contracts/index.d.ts +2 -1
  62. package/dist/packages/contracts/index.js +1 -0
  63. package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
  64. package/dist/packages/contracts/lib/preparation-paths.js +177 -0
  65. package/dist/packages/contracts/lib/schema.d.ts +187 -13
  66. package/dist/packages/contracts/lib/schema.js +148 -3
  67. package/dist/packages/contracts/utils/filesystem.d.ts +9 -0
  68. package/dist/packages/contracts/utils/filesystem.js +142 -0
  69. package/dist/packages/{local-service → engine}/action-definitions.d.ts +14 -14
  70. package/dist/packages/{local-service → engine}/action-definitions.js +35 -29
  71. package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
  72. package/dist/packages/{local-service → engine}/action-planner.js +3 -2
  73. package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
  74. package/dist/packages/{agents → engine/agents}/index.js +3 -0
  75. package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
  76. package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
  77. package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
  78. package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
  79. package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +5 -5
  80. package/dist/packages/{agents → engine/agents}/lib/shells.js +117 -58
  81. package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +4 -2
  82. package/dist/packages/engine/agents/lib/user-config.js +24 -0
  83. package/dist/packages/engine/agents/registry.d.ts +91 -0
  84. package/dist/packages/engine/agents/registry.js +321 -0
  85. package/dist/packages/engine/agents/role-executors.d.ts +35 -0
  86. package/dist/packages/engine/agents/role-executors.js +88 -0
  87. package/dist/packages/engine/agents/role-router.d.ts +66 -0
  88. package/dist/packages/engine/agents/role-router.js +73 -0
  89. package/dist/packages/{local-service → engine}/client.d.ts +59 -60
  90. package/dist/packages/{local-service → engine}/client.js +137 -145
  91. package/dist/packages/{compiler → engine/compile}/artifact-counts.js +1 -1
  92. package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +9 -2
  93. package/dist/packages/{compiler → engine/compile}/compiled-paths.js +30 -15
  94. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
  95. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +39 -9
  96. package/dist/packages/{compiler → engine/compile}/compiled-schema.d.ts +2 -2
  97. package/dist/packages/{compiler → engine/compile}/compiled-schema.js +4 -4
  98. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +1 -1
  99. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +8 -4
  100. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
  101. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +3 -3
  102. package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +3 -3
  103. package/dist/packages/{compiler → engine/compile}/compiled-target.js +3 -3
  104. package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
  105. package/dist/packages/{compiler → engine/compile}/index.d.ts +1 -0
  106. package/dist/packages/{compiler → engine/compile}/index.js +1 -0
  107. package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +26 -31
  108. package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -13
  109. package/dist/packages/engine/compile/method-runs.d.ts +14 -0
  110. package/dist/packages/{compiler → engine/compile}/method-runs.js +5 -6
  111. package/dist/packages/{compiler → engine/compile}/reset.js +3 -1
  112. package/dist/packages/{compiler → engine/compile}/runtime-acceptance.js +17 -14
  113. package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +0 -3
  114. package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +1 -1
  115. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
  116. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +12 -10
  117. package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
  118. package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -43
  119. package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +1 -5
  120. package/dist/packages/{compiler → engine/compile}/runtime.d.ts +2 -2
  121. package/dist/packages/{compiler → engine/compile}/runtime.js +1 -1
  122. package/dist/packages/engine/compile/source-files.d.ts +46 -0
  123. package/dist/packages/engine/compile/source-files.js +149 -0
  124. package/dist/packages/engine/compile/state-artifacts.d.ts +9 -0
  125. package/dist/packages/{compiler → engine/compile}/state-artifacts.js +4 -3
  126. package/dist/packages/{compiler → engine/compile}/state-health.js +2 -2
  127. package/dist/packages/{compiler → engine/compile}/state-io.d.ts +3 -2
  128. package/dist/packages/{compiler → engine/compile}/state-io.js +13 -7
  129. package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +2 -1
  130. package/dist/packages/engine/compile/state-paths.js +16 -0
  131. package/dist/packages/engine/compile/state-view.d.ts +5 -0
  132. package/dist/packages/{compiler → engine/compile}/state-view.js +20 -30
  133. package/dist/packages/engine/compile/state.d.ts +7 -0
  134. package/dist/packages/{compiler → engine/compile}/state.js +3 -3
  135. package/dist/packages/{compiler → engine/compile}/validate-compiled.js +2 -2
  136. package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
  137. package/dist/packages/{compiler → engine/compile}/validate.js +3 -3
  138. package/dist/packages/engine/connection-config.d.ts +38 -0
  139. package/dist/packages/engine/connection-config.js +75 -0
  140. package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +52 -72
  141. package/dist/packages/{execution → engine/execution}/lib/schema.js +3 -3
  142. package/dist/packages/engine/index.d.ts +22 -0
  143. package/dist/packages/engine/index.js +15 -0
  144. package/dist/packages/engine/instance-paths.d.ts +100 -0
  145. package/dist/packages/engine/instance-paths.js +165 -0
  146. package/dist/packages/{local-service → engine}/lib/schema.d.ts +392 -2408
  147. package/dist/packages/{local-service → engine}/lib/schema.js +164 -76
  148. package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
  149. package/dist/packages/{local-service → engine}/native-run-handlers.js +71 -27
  150. package/dist/packages/engine/preparation-store.d.ts +104 -0
  151. package/dist/packages/engine/preparation-store.js +194 -0
  152. package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
  153. package/dist/packages/engine/routes.d.ts +78 -0
  154. package/dist/packages/engine/routes.js +92 -0
  155. package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
  156. package/dist/packages/{local-service → engine}/run-observability.js +25 -24
  157. package/dist/packages/engine/runtime-caches.d.ts +76 -0
  158. package/dist/packages/engine/runtime-caches.js +191 -0
  159. package/dist/packages/engine/runtime-event-applier.d.ts +12 -0
  160. package/dist/packages/engine/runtime-event-applier.js +177 -0
  161. package/dist/packages/engine/runtime-persistence.d.ts +47 -0
  162. package/dist/packages/engine/runtime-persistence.js +137 -0
  163. package/dist/packages/engine/runtime-proposal-helpers.d.ts +35 -0
  164. package/dist/packages/engine/runtime-proposal-helpers.js +251 -0
  165. package/dist/packages/engine/runtime-resource-builders.d.ts +52 -0
  166. package/dist/packages/engine/runtime-resource-builders.js +149 -0
  167. package/dist/packages/engine/runtime.d.ts +318 -0
  168. package/dist/packages/{local-service → engine}/runtime.js +835 -1011
  169. package/dist/packages/{local-service → engine}/server.d.ts +15 -0
  170. package/dist/packages/engine/server.js +1257 -0
  171. package/dist/packages/engine/service-registry.d.ts +47 -0
  172. package/dist/packages/engine/service-registry.js +137 -0
  173. package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +11 -11
  174. package/dist/packages/{testing → engine/verify}/lib/schema.js +3 -3
  175. package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +9 -16
  176. package/dist/packages/{testing → engine/verify}/readiness-check-run.js +38 -94
  177. package/dist/packages/{testing → engine/verify}/test-execution.js +6 -6
  178. package/dist/packages/{testing → engine/verify}/test-paths.js +5 -4
  179. package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -1
  180. package/dist/packages/{testing → engine/verify}/test-sandbox.js +17 -33
  181. package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
  182. package/dist/packages/{testing → engine/verify}/test-targets.d.ts +1 -1
  183. package/dist/packages/{testing → engine/verify}/test-targets.js +9 -9
  184. package/dist/packages/{testing → engine/verify}/test.d.ts +1 -1
  185. package/dist/packages/{testing → engine/verify}/test.js +1 -1
  186. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +12 -4
  187. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +70 -7
  188. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
  189. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
  190. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +16 -10
  191. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +4 -5
  192. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +10 -16
  193. package/dist/packages/{method-package → methods/package}/context-interface.d.ts +5 -41
  194. package/dist/packages/{method-package → methods/package}/context-interface.js +3 -25
  195. package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +4 -4
  196. package/dist/packages/{method-package → methods/package}/interf-method-package.js +24 -35
  197. package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
  198. package/dist/packages/{method-package → methods/package}/local-methods.d.ts +18 -8
  199. package/dist/packages/{method-package → methods/package}/local-methods.js +64 -45
  200. package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +16 -36
  201. package/dist/packages/{method-package → methods/package}/method-definitions.js +53 -40
  202. package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +2 -14
  203. package/dist/packages/{method-package → methods/package}/method-helpers.js +12 -46
  204. package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
  205. package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
  206. package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
  207. package/dist/packages/{method-package → methods/package}/method-stage-runner.js +3 -31
  208. package/dist/packages/methods/package/user-methods.d.ts +17 -0
  209. package/dist/packages/methods/package/user-methods.js +77 -0
  210. package/dist/packages/{project-model → project}/index.d.ts +0 -1
  211. package/dist/packages/{project-model → project}/index.js +0 -1
  212. package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
  213. package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
  214. package/dist/packages/{project-model → project}/interf-detect.d.ts +8 -3
  215. package/dist/packages/{project-model → project}/interf-detect.js +38 -38
  216. package/dist/packages/project/interf-scaffold.d.ts +3 -0
  217. package/dist/packages/{project-model → project}/interf-scaffold.js +30 -39
  218. package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
  219. package/dist/packages/{project-model → project}/lib/schema.js +39 -2
  220. package/dist/packages/project/preparation-entries.d.ts +11 -0
  221. package/dist/packages/{project-model → project}/preparation-entries.js +14 -14
  222. package/dist/packages/{project-model → project}/source-config.d.ts +12 -12
  223. package/dist/packages/{project-model → project}/source-config.js +81 -53
  224. package/dist/packages/{project-model → project}/source-folders.d.ts +5 -5
  225. package/dist/packages/{project-model → project}/source-folders.js +16 -16
  226. package/package.json +8 -8
  227. package/CHANGELOG.md +0 -93
  228. package/LICENSE +0 -183
  229. package/dist/cli/commands/action-input-cli.d.ts +0 -25
  230. package/dist/cli/commands/action-input-cli.js +0 -73
  231. package/dist/cli/commands/control-path.d.ts +0 -11
  232. package/dist/cli/commands/control-path.js +0 -72
  233. package/dist/cli/commands/create-method-wizard.d.ts +0 -64
  234. package/dist/cli/commands/create-method-wizard.js +0 -434
  235. package/dist/cli/commands/create.d.ts +0 -6
  236. package/dist/cli/commands/create.js +0 -183
  237. package/dist/cli/commands/default.d.ts +0 -2
  238. package/dist/cli/commands/default.js +0 -39
  239. package/dist/cli/commands/executor-flow.d.ts +0 -29
  240. package/dist/cli/commands/executor-flow.js +0 -163
  241. package/dist/cli/commands/init.d.ts +0 -26
  242. package/dist/cli/commands/init.js +0 -771
  243. package/dist/cli/commands/list.d.ts +0 -2
  244. package/dist/cli/commands/list.js +0 -30
  245. package/dist/cli/commands/preparation-action.d.ts +0 -8
  246. package/dist/cli/commands/preparation-action.js +0 -29
  247. package/dist/cli/commands/preparation-picker.d.ts +0 -5
  248. package/dist/cli/commands/preparation-picker.js +0 -36
  249. package/dist/cli/commands/preparation-selection.d.ts +0 -6
  250. package/dist/cli/commands/preparation-selection.js +0 -11
  251. package/dist/cli/commands/service-action-flow.d.ts +0 -9
  252. package/dist/cli/commands/service-action-flow.js +0 -19
  253. package/dist/cli/commands/source-config-wizard.d.ts +0 -51
  254. package/dist/cli/commands/source-config-wizard.js +0 -670
  255. package/dist/cli/commands/test.d.ts +0 -17
  256. package/dist/cli/commands/test.js +0 -188
  257. package/dist/packages/agents/lib/detection.d.ts +0 -7
  258. package/dist/packages/agents/lib/user-config.js +0 -16
  259. package/dist/packages/compiler/method-runs.d.ts +0 -15
  260. package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
  261. package/dist/packages/compiler/raw-snapshot.js +0 -101
  262. package/dist/packages/compiler/state-artifacts.d.ts +0 -8
  263. package/dist/packages/compiler/state-paths.js +0 -13
  264. package/dist/packages/compiler/state-view.d.ts +0 -4
  265. package/dist/packages/compiler/state.d.ts +0 -7
  266. package/dist/packages/local-service/index.d.ts +0 -18
  267. package/dist/packages/local-service/index.js +0 -13
  268. package/dist/packages/local-service/routes.d.ts +0 -32
  269. package/dist/packages/local-service/routes.js +0 -37
  270. package/dist/packages/local-service/runtime.d.ts +0 -133
  271. package/dist/packages/local-service/server.js +0 -627
  272. package/dist/packages/method-package/index.d.ts +0 -11
  273. package/dist/packages/method-package/index.js +0 -11
  274. package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
  275. package/dist/packages/method-package/method-stage-policy.js +0 -31
  276. package/dist/packages/project-model/interf-scaffold.d.ts +0 -3
  277. package/dist/packages/project-model/preparation-entries.d.ts +0 -11
  278. package/dist/packages/project-model/project-paths.d.ts +0 -12
  279. package/dist/packages/project-model/project-paths.js +0 -33
  280. package/dist/packages/shared/filesystem.d.ts +0 -2
  281. package/dist/packages/shared/filesystem.js +0 -55
  282. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
  283. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
  284. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_ssgManifest.js +0 -0
  285. /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
  286. /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
  287. /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
  288. /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
  289. /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
  290. /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
  291. /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
  292. /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
  293. /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
  294. /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
  295. /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
  296. /package/dist/packages/{local-service → engine}/action-values.js +0 -0
  297. /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
  298. /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
  299. /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
  300. /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
  301. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
  302. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
  303. /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
  304. /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
  305. /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
  306. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
  307. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
  308. /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
  309. /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
  310. /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
  311. /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
  312. /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
  313. /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
  314. /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
  315. /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
  316. /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
  317. /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
  318. /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
  319. /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
  320. /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
  321. /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
  322. /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
  323. /package/dist/packages/{compiler → engine/compile}/artifact-counts.d.ts +0 -0
  324. /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
  325. /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
  326. /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
  327. /package/dist/packages/{compiler → engine/compile}/method-primitives.d.ts +0 -0
  328. /package/dist/packages/{compiler → engine/compile}/method-primitives.js +0 -0
  329. /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
  330. /package/dist/packages/{compiler → engine/compile}/runtime-acceptance.d.ts +0 -0
  331. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
  332. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
  333. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
  334. /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
  335. /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
  336. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
  337. /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
  338. /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
  339. /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
  340. /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
  341. /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
  342. /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
  343. /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
  344. /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
  345. /package/dist/packages/{execution → engine/execution}/events.js +0 -0
  346. /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
  347. /package/dist/packages/{execution → engine/execution}/index.js +0 -0
  348. /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
  349. /package/dist/packages/{testing → engine/verify}/index.d.ts +0 -0
  350. /package/dist/packages/{testing → engine/verify}/index.js +0 -0
  351. /package/dist/packages/{testing → engine/verify}/test-execution.d.ts +0 -0
  352. /package/dist/packages/{testing → engine/verify}/test-paths.d.ts +0 -0
  353. /package/dist/packages/{testing → engine/verify}/test-profile-presets.d.ts +0 -0
  354. /package/dist/packages/{testing → engine/verify}/test-profile-presets.js +0 -0
  355. /package/dist/packages/{testing → engine/verify}/test-specs.d.ts +0 -0
  356. /package/dist/packages/{testing → engine/verify}/test-types.d.ts +0 -0
  357. /package/dist/packages/{testing → engine/verify}/test-types.js +0 -0
  358. /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
  359. /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
  360. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
  361. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
  362. /package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +0 -0
  363. /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
  364. /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
  365. /package/dist/packages/{project-model → project}/interf.js +0 -0
@@ -1,18 +1,15 @@
1
1
  import { existsSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { z } from "zod";
4
- import { warnInterf } from "../shared/logger.js";
5
- import { readJsonFileUnchecked } from "../shared/parse.js";
6
- import { MethodCompiledSchemaSchema, MethodCompiledZoneSchema, MethodZoneIdSchema, MethodZoneRoleSchema, } from "../compiler/lib/schema.js";
4
+ import { warnInterf } from "../../contracts/utils/logger.js";
5
+ import { readJsonFileUnchecked } from "../../contracts/utils/parse.js";
6
+ import { MethodCompiledSchemaSchema, MethodZoneIdSchema, } from "../../engine/compile/lib/schema.js";
7
7
  import { listBuiltinCompiledZoneSpecs, requiredCompiledZoneOwners, } from "./builtin-compiled-method.js";
8
8
  // Method packages define the context interface. The compiler persists the
9
9
  // same schema on disk, but higher layers should prefer this boundary when they
10
10
  // mean "the Method-declared shape a portable context must implement."
11
11
  export const CONTEXT_INTERFACE_FILE = "method.schema.json";
12
12
  export const ContextInterfaceSchema = MethodCompiledSchemaSchema;
13
- export const ContextInterfaceZoneSchema = MethodCompiledZoneSchema;
14
- export const ContextInterfaceZoneIdSchema = MethodZoneIdSchema;
15
- export const ContextInterfaceZoneRoleSchema = MethodZoneRoleSchema;
16
13
  // Package-owned input contract for authoring, review, and future authoring flows.
17
14
  // This does not change compiler execution semantics; it describes what data a
18
15
  // Method expects to organize before the compiler materializes the context
@@ -24,7 +21,6 @@ export const MethodInputSpecSchema = z.object({
24
21
  required: z.boolean().default(false),
25
22
  examples: z.array(z.string().min(1)).optional(),
26
23
  }).strict();
27
- export const MethodInputContractSchema = z.array(MethodInputSpecSchema);
28
24
  function normalizeContextInterface(contextInterface) {
29
25
  return {
30
26
  ...contextInterface,
@@ -53,15 +49,6 @@ export function resolveContextInterfacePath(rootPath) {
53
49
  export function contextInterfaceExists(rootPath) {
54
50
  return existsSync(contextInterfaceFilePath(rootPath));
55
51
  }
56
- export function contextInterfaceRelativePath() {
57
- return `method/${CONTEXT_INTERFACE_FILE}`;
58
- }
59
- export function listContextInterfaceZones(contextInterface) {
60
- return [...contextInterface.zones];
61
- }
62
- export function findContextInterfaceZone(contextInterface, zoneId) {
63
- return contextInterface.zones.find((zone) => zone.id === zoneId) ?? null;
64
- }
65
52
  export function contextInterfaceZoneAbsolutePath(compiledPath, zone) {
66
53
  return join(compiledPath, zone.path);
67
54
  }
@@ -70,15 +57,6 @@ export function contextInterfaceArtifactPath(zone) {
70
57
  return zone.path;
71
58
  return zone.path.endsWith("/") ? zone.path : `${zone.path}/`;
72
59
  }
73
- export function contextInterfaceArtifactPathsForZoneIds(contextInterface, zoneIds) {
74
- return zoneIds.map((zoneId) => {
75
- const zone = findContextInterfaceZone(contextInterface, zoneId);
76
- if (!zone) {
77
- throw new Error(`Context interface is missing declared zone "${zoneId}".`);
78
- }
79
- return contextInterfaceArtifactPath(zone);
80
- });
81
- }
82
60
  export function summarizeContextInterface(contextInterface) {
83
61
  return {
84
62
  inputZones: contextInterface.zones.filter((zone) => zone.role === "input"),
@@ -5,11 +5,11 @@ export declare function writeMethodPackageToDir(methodDir: string, method: Metho
5
5
  }): void;
6
6
  export declare function seedCompiledMethodPackage(options: {
7
7
  compiledPath: string;
8
- sourcePath: string;
8
+ prepDataDir: string;
9
9
  methodId: string;
10
10
  }): void;
11
11
  export declare function createLocalMethodPackageFromTemplate(options: {
12
- sourcePath: string;
12
+ prepDataDir: string;
13
13
  baseMethodId: string;
14
14
  methodId: string;
15
15
  label: string;
@@ -17,14 +17,14 @@ export declare function createLocalMethodPackageFromTemplate(options: {
17
17
  stagePolicyNotes: Record<string, string[]>;
18
18
  }): string;
19
19
  export declare function seedLocalMethodPackageFromBase(options: {
20
- sourcePath: string;
20
+ prepDataDir: string;
21
21
  baseMethodId: string;
22
22
  methodId: string;
23
23
  label: string;
24
24
  hint: string;
25
25
  }): string;
26
26
  export declare function createScratchLocalMethodPackage(options: {
27
- sourcePath: string;
27
+ prepDataDir: string;
28
28
  methodId: string;
29
29
  label: string;
30
30
  hint: string;
@@ -1,14 +1,10 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
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";
3
+ import { renderCompiledQuerySkill } from "../../engine/agents/lib/shells.js";
4
+ import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, mergeStagePolicyNotesForStages, } from "./local-methods.js";
5
5
  import { getCompiledMethod, } from "./method-definitions.js";
6
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
- }
7
+ import { methodPackagePathForCompiled } from "../../engine/compile/compiled-paths.js";
12
8
  function writeMethodStarterDocs(dirPath, docs, options) {
13
9
  for (const doc of docs ?? []) {
14
10
  const targetPath = join(dirPath, doc.relativePath);
@@ -200,7 +196,7 @@ function renderImproveSkill(method) {
200
196
  `4. Keep purpose, inputs, \`method.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
201
197
  "",
202
198
  "Guardrails:",
203
- "- do not edit checks, test specs, or raw files",
199
+ "- do not edit checks, test specs, or source artifacts",
204
200
  "- do not hardcode expected answers into Method docs",
205
201
  "- keep this package standalone; do not rely on runtime inheritance",
206
202
  "- keep the Method stack coherent: purpose, inputs, context interface, and stages should describe the same job",
@@ -259,7 +255,7 @@ function renderStageSkill(method, stage) {
259
255
  ].join("\n");
260
256
  }
261
257
  export function writeCompiledMethodPackage(compiledPath, method) {
262
- writeMethodPackageToDir(methodPackagePath(compiledPath), method);
258
+ writeMethodPackageToDir(methodPackagePathForCompiled(compiledPath), method);
263
259
  }
264
260
  export function writeMethodPackageToDir(methodDir, method, options = {}) {
265
261
  const overwrite = options.overwrite ?? true;
@@ -301,23 +297,24 @@ export function writeMethodPackageToDir(methodDir, method, options = {}) {
301
297
  }
302
298
  export function seedCompiledMethodPackage(options) {
303
299
  const resolvedMethod = getCompiledMethod(options.methodId, {
304
- sourcePath: options.sourcePath,
300
+ prepDataDir: options.prepDataDir,
305
301
  });
306
- const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, resolvedMethod.id);
302
+ const sourceMethodPath = resolveMethodPackageSourcePath(options.prepDataDir, resolvedMethod.id);
307
303
  if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
308
304
  // Portable seed packages can be copied directly because compile runs the
309
305
  // local package folder without reading source-root Method packages.
310
- copyMethodPackageDirectory(sourceMethodPath, methodPackagePath(options.compiledPath));
311
- patchMethodPackageMetadata(methodPackagePath(options.compiledPath), {
306
+ copyMethodPackageDirectory(sourceMethodPath, methodPackagePathForCompiled(options.compiledPath));
307
+ patchMethodPackageMetadata(methodPackagePathForCompiled(options.compiledPath), {
312
308
  id: resolvedMethod.id,
313
309
  inputs: resolvedMethod.inputs,
314
310
  label: resolvedMethod.label,
315
311
  hint: resolvedMethod.hint,
316
312
  stagePolicyNotes: resolvedMethod.stagePolicyNotes,
317
313
  });
318
- if (resolvedMethod.scope === "builtin") {
319
- writeFileSync(join(methodPackagePath(options.compiledPath), "README.md"), renderMethodReadme(resolvedMethod));
320
- }
314
+ // The portable-context README is always derived from the resolved Method;
315
+ // any hand-authored README belongs in the workspace draft at
316
+ // <workspace>/methods/<id>/, not in the compiled copy.
317
+ writeFileSync(join(methodPackagePathForCompiled(options.compiledPath), "README.md"), renderMethodReadme(resolvedMethod));
321
318
  return;
322
319
  }
323
320
  // Legacy or partially-defined seed packages are resolved once and
@@ -326,14 +323,14 @@ export function seedCompiledMethodPackage(options) {
326
323
  }
327
324
  export function createLocalMethodPackageFromTemplate(options) {
328
325
  const targetPath = seedLocalMethodPackageFromBase({
329
- sourcePath: options.sourcePath,
326
+ prepDataDir: options.prepDataDir,
330
327
  baseMethodId: options.baseMethodId,
331
328
  methodId: options.methodId,
332
329
  label: options.label,
333
330
  hint: options.hint,
334
331
  });
335
332
  const baseMethod = getCompiledMethod(options.baseMethodId, {
336
- sourcePath: options.sourcePath,
333
+ prepDataDir: options.prepDataDir,
337
334
  });
338
335
  const stagePolicyNotes = mergeStagePolicyNotesForStages(baseMethod.stages, baseMethod.stagePolicyNotes, options.stagePolicyNotes);
339
336
  patchMethodPackageMetadata(targetPath, {
@@ -358,10 +355,10 @@ export function createLocalMethodPackageFromTemplate(options) {
358
355
  }
359
356
  export function seedLocalMethodPackageFromBase(options) {
360
357
  const baseMethod = getCompiledMethod(options.baseMethodId, {
361
- sourcePath: options.sourcePath,
358
+ prepDataDir: options.prepDataDir,
362
359
  });
363
- const sourceMethodPath = resolveMethodPackageSourcePath(options.sourcePath, options.baseMethodId);
364
- const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
360
+ const sourceMethodPath = resolveMethodPackageSourcePath(options.prepDataDir, options.baseMethodId);
361
+ const targetPath = methodDefinitionPath(options.prepDataDir, options.methodId);
365
362
  if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
366
363
  // Copy directly when the base package is already portable and standalone.
367
364
  copyMethodPackageDirectory(sourceMethodPath, targetPath);
@@ -403,7 +400,7 @@ export function seedLocalMethodPackageFromBase(options) {
403
400
  return targetPath;
404
401
  }
405
402
  export function createScratchLocalMethodPackage(options) {
406
- const targetPath = methodDefinitionPath(options.sourcePath, options.methodId);
403
+ const targetPath = methodDefinitionPath(options.prepDataDir, options.methodId);
407
404
  const method = {
408
405
  id: options.methodId,
409
406
  compilerApi: {
@@ -416,9 +413,9 @@ export function createScratchLocalMethodPackage(options) {
416
413
  },
417
414
  inputs: [
418
415
  {
419
- id: "raw",
420
- label: "Raw",
421
- description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
416
+ id: "source",
417
+ label: "Source",
418
+ description: "Source references assigned to each stage by Interf runtime.",
422
419
  required: true,
423
420
  },
424
421
  ],
@@ -432,15 +429,6 @@ export function createScratchLocalMethodPackage(options) {
432
429
  target_type: "compiled",
433
430
  label: `${options.label} Method schema`,
434
431
  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
432
  {
445
433
  id: "draft-context",
446
434
  role: "output",
@@ -468,7 +456,8 @@ export function createScratchLocalMethodPackage(options) {
468
456
  description: "Neutral placeholder stage for Method authoring. Replace this stage with the topology this agent work needs.",
469
457
  contractType: "method-draft-stage",
470
458
  skillDir: "prepare",
471
- reads: ["raw", "runtime"],
459
+ role: "general",
460
+ reads: ["runtime"],
472
461
  writes: ["draft-context"],
473
462
  acceptance: {
474
463
  stage_truthy: ["finished_at"],
@@ -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/method-package/lib/ -> package root)
6
- export const PACKAGE_ROOT = join(__dirname, "..", "..", "..", "..");
5
+ // Package root (dist/packages/methods/package/lib/ -> package root)
6
+ export const PACKAGE_ROOT = join(__dirname, "..", "..", "..", "..", "..");
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
- import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema } from "../compiler/lib/schema.js";
3
- import { RuntimeContractTypeSchema } from "../contracts/lib/schema.js";
2
+ import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema } from "../../engine/compile/lib/schema.js";
3
+ import { RuntimeContractTypeSchema } from "../../contracts/lib/schema.js";
4
4
  import { MethodInputSpecSchema, type ContextInterface, type MethodInputSpec } from "./context-interface.js";
5
5
  export interface LocalMethodStarterDoc {
6
6
  relativePath: string;
@@ -12,6 +12,12 @@ export interface LocalMethodStageDefinition {
12
12
  contract_type: z.infer<typeof RuntimeContractTypeSchema>;
13
13
  skill_dir?: string;
14
14
  description?: string;
15
+ /**
16
+ * Optional role hint. Open-ended string; defaults to `general` at the
17
+ * runtime layer when missing. Maps to a connected agent via the user's
18
+ * role-map (`~/.interf/agents.json`).
19
+ */
20
+ role?: string;
15
21
  reads: z.infer<typeof MethodStageZoneAccessSchema>;
16
22
  writes: z.infer<typeof MethodStageZoneAccessSchema>;
17
23
  acceptance?: z.infer<typeof RuntimeStageAcceptanceSchema>;
@@ -32,20 +38,24 @@ export interface LocalMethodDefinition {
32
38
  methodPath: string;
33
39
  methodSchemaPath: string;
34
40
  }
35
- export declare function methodDefinitionPath(sourcePath: string, id: string): string;
41
+ export declare function mergeStagePolicyNotesForStages(stages: readonly {
42
+ id: string;
43
+ }[], baseNotes: unknown, overrideNotes: Record<string, string[]> | undefined): Record<string, string[]> | undefined;
44
+ export declare function builtinMethodPackagePath(methodId: string): string;
45
+ export declare function methodDefinitionPath(prepDataDir: string, id: string): string;
36
46
  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;
47
+ export declare function listLocalMethodDefinitions(prepDataDir: string): LocalMethodDefinition[];
48
+ export declare function loadLocalMethodDefinition(prepDataDir: string, id: string): LocalMethodDefinition | null;
49
+ export declare function resolveMethodPackageSourcePath(prepDataDir: string, methodId: string): string | null;
40
50
  export declare function seedLocalDefaultMethod(options: {
41
- sourcePath: string;
51
+ prepDataDir: string;
42
52
  }): {
43
53
  methodId: string;
44
54
  targetPath: string;
45
55
  alreadyExisted: boolean;
46
56
  };
47
57
  export declare function isMethodId(value: string): boolean;
48
- export declare function patchMethodPackageMetadata(dirPath: string, options?: {
58
+ export declare function patchMethodPackageMetadata(dirPath: string, options: {
49
59
  id?: string;
50
60
  inputs?: MethodInputSpec[];
51
61
  label?: string;
@@ -1,22 +1,23 @@
1
1
  import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync, } from "node:fs";
2
- import { dirname, join, relative } from "node:path";
2
+ import { basename, dirname, join, relative } from "node:path";
3
3
  import { z } from "zod";
4
- import { listFilesRecursive } from "../shared/filesystem.js";
5
- import { warnInterf } from "../shared/logger.js";
6
- import { readJsonFileUnchecked, readJsonFileWithSchema } from "../shared/parse.js";
7
- import { isMarkdownFile } from "../shared/file-types.js";
8
- import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema, } from "../compiler/lib/schema.js";
9
- import { RuntimeContractTypeSchema, InterfIdPattern, } from "../contracts/lib/schema.js";
4
+ import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
5
+ import { warnInterf } from "../../contracts/utils/logger.js";
6
+ import { readJsonFileUnchecked, readJsonFileWithSchema } from "../../contracts/utils/parse.js";
7
+ import { isMarkdownFile } from "../../contracts/utils/file-types.js";
8
+ import { MethodCompilerApiSchema, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema, } from "../../engine/compile/lib/schema.js";
9
+ import { RuntimeContractTypeSchema, InterfIdPattern, } from "../../contracts/lib/schema.js";
10
+ import { asPreparationDataDir, preparationMethodsRoot, } from "../../contracts/lib/preparation-paths.js";
10
11
  import { listBuiltinCompiledZoneSpecs, } from "./builtin-compiled-method.js";
11
12
  import { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, contextInterfaceExists, contextInterfaceFilePath, readContextInterface, MethodInputSpecSchema, writeContextInterface, } from "./context-interface.js";
12
13
  import { PACKAGE_ROOT } from "./lib/package-root.js";
13
- import { mergeStagePolicyNotesForStages } from "./method-stage-policy.js";
14
14
  const LocalMethodStageDefinitionSchema = z.object({
15
15
  id: z.string().regex(InterfIdPattern),
16
16
  label: z.string().min(1),
17
17
  contract_type: RuntimeContractTypeSchema,
18
18
  skill_dir: z.string().regex(InterfIdPattern).optional(),
19
19
  description: z.string().min(1).optional(),
20
+ role: z.string().min(1).optional(),
20
21
  reads: MethodStageZoneAccessSchema,
21
22
  writes: MethodStageZoneAccessSchema,
22
23
  acceptance: RuntimeStageAcceptanceSchema.optional(),
@@ -32,14 +33,45 @@ const LocalMethodDefinitionSchema = z.object({
32
33
  stages: z.array(LocalMethodStageDefinitionSchema).min(1).optional(),
33
34
  stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
34
35
  });
35
- function methodRootPath(sourcePath) {
36
- return join(sourcePath, "interf", "methods");
36
+ function normalizeStagePolicyNotes(value) {
37
+ if (!value || typeof value !== "object" || Array.isArray(value))
38
+ return undefined;
39
+ const normalized = {};
40
+ for (const [stageId, notes] of Object.entries(value)) {
41
+ if (!Array.isArray(notes))
42
+ continue;
43
+ const cleaned = Array.from(new Set(notes
44
+ .filter((note) => typeof note === "string")
45
+ .map((note) => note.trim())
46
+ .filter((note) => note.length > 0)));
47
+ if (cleaned.length > 0) {
48
+ normalized[stageId] = cleaned;
49
+ }
50
+ }
51
+ return Object.keys(normalized).length > 0 ? normalized : undefined;
37
52
  }
38
- function builtinMethodRootPath(methodId) {
53
+ export function mergeStagePolicyNotesForStages(stages, baseNotes, overrideNotes) {
54
+ const normalizedBase = normalizeStagePolicyNotes(baseNotes);
55
+ const merged = {};
56
+ for (const stage of stages) {
57
+ const combined = Array.from(new Set([
58
+ ...(normalizedBase?.[stage.id] ?? []),
59
+ ...((overrideNotes?.[stage.id] ?? []).map((note) => note.trim()).filter((note) => note.length > 0)),
60
+ ]));
61
+ if (combined.length > 0) {
62
+ merged[stage.id] = combined;
63
+ }
64
+ }
65
+ return Object.keys(merged).length > 0 ? merged : undefined;
66
+ }
67
+ function methodRootPath(prepDataDir) {
68
+ return preparationMethodsRoot(asPreparationDataDir(prepDataDir));
69
+ }
70
+ export function builtinMethodPackagePath(methodId) {
39
71
  return join(PACKAGE_ROOT, "builtin-methods", methodId);
40
72
  }
41
- export function methodDefinitionPath(sourcePath, id) {
42
- return join(methodRootPath(sourcePath), id);
73
+ export function methodDefinitionPath(prepDataDir, id) {
74
+ return join(methodRootPath(prepDataDir), id);
43
75
  }
44
76
  function isSupportedMethodStarterDocPath(relativePath) {
45
77
  if (relativePath === "README.md")
@@ -109,9 +141,9 @@ export function loadMethodDefinitionFromDir(dirPath) {
109
141
  methodSchemaPath: contextInterfaceFilePath(dirPath),
110
142
  };
111
143
  }
112
- export function listLocalMethodDefinitions(sourcePath) {
144
+ export function listLocalMethodDefinitions(prepDataDir) {
113
145
  const definitions = new Map();
114
- const root = methodRootPath(sourcePath);
146
+ const root = methodRootPath(prepDataDir);
115
147
  if (existsSync(root)) {
116
148
  for (const entryPath of readdirSync(root).map((entry) => join(root, entry))) {
117
149
  try {
@@ -128,25 +160,25 @@ export function listLocalMethodDefinitions(sourcePath) {
128
160
  }
129
161
  return [...definitions.values()].sort((a, b) => a.label.localeCompare(b.label));
130
162
  }
131
- export function loadLocalMethodDefinition(sourcePath, id) {
132
- return loadMethodDefinitionFromDir(methodDefinitionPath(sourcePath, id));
163
+ export function loadLocalMethodDefinition(prepDataDir, id) {
164
+ return loadMethodDefinitionFromDir(methodDefinitionPath(prepDataDir, id));
133
165
  }
134
- export function resolveMethodPackageSourcePath(sourcePath, methodId) {
135
- const localPath = methodDefinitionPath(sourcePath, methodId);
166
+ export function resolveMethodPackageSourcePath(prepDataDir, methodId) {
167
+ const localPath = methodDefinitionPath(prepDataDir, methodId);
136
168
  if (loadMethodDefinitionFromDir(localPath))
137
169
  return localPath;
138
- const builtinPath = builtinMethodRootPath(methodId);
170
+ const builtinPath = builtinMethodPackagePath(methodId);
139
171
  if (loadMethodDefinitionFromDir(builtinPath))
140
172
  return builtinPath;
141
173
  return null;
142
174
  }
143
175
  export function seedLocalDefaultMethod(options) {
144
176
  const methodId = "interf-default";
145
- const targetPath = methodDefinitionPath(options.sourcePath, methodId);
177
+ const targetPath = methodDefinitionPath(options.prepDataDir, methodId);
146
178
  if (existsSync(join(targetPath, "method.json"))) {
147
179
  return { methodId, targetPath, alreadyExisted: true };
148
180
  }
149
- const builtinInterfPath = builtinMethodRootPath(methodId);
181
+ const builtinInterfPath = builtinMethodPackagePath(methodId);
150
182
  if (!existsSync(join(builtinInterfPath, "method.json"))) {
151
183
  throw new Error(`Built-in "${methodId}" Method package not found at ${builtinInterfPath}.`);
152
184
  }
@@ -169,7 +201,7 @@ function readMethodJsonObject(dirPath) {
169
201
  }
170
202
  return { ...raw };
171
203
  }
172
- export function patchMethodPackageMetadata(dirPath, options = {}) {
204
+ export function patchMethodPackageMetadata(dirPath, options) {
173
205
  const methodPath = join(dirPath, "method.json");
174
206
  const methodJson = readMethodJsonObject(dirPath);
175
207
  const normalizedStages = Array.isArray(methodJson.stages) && methodJson.stages.length > 0
@@ -209,6 +241,11 @@ export function patchMethodPackageMetadata(dirPath, options = {}) {
209
241
  label: schemaLabel,
210
242
  });
211
243
  }
244
+ function resolveStageSkillDir(stage) {
245
+ return typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
246
+ ? stage.skill_dir
247
+ : stage.id;
248
+ }
212
249
  function collectMethodPackageStructureIssues(dirPath, stages) {
213
250
  const issues = [];
214
251
  const methodPath = join(dirPath, "method.json");
@@ -225,23 +262,7 @@ function collectMethodPackageStructureIssues(dirPath, stages) {
225
262
  if (!stages)
226
263
  return issues;
227
264
  for (const stage of stages) {
228
- const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
229
- ? stage.skill_dir
230
- : stage.id;
231
- if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
232
- issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
233
- }
234
- }
235
- return issues;
236
- }
237
- function collectMethodStageSkillIssues(dirPath, stages) {
238
- if (!stages)
239
- return [];
240
- const issues = [];
241
- for (const stage of stages) {
242
- const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
243
- ? stage.skill_dir
244
- : stage.id;
265
+ const skillDir = resolveStageSkillDir(stage);
245
266
  if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
246
267
  issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
247
268
  }
@@ -271,9 +292,10 @@ export function describeMethodPackagePortability(dirPath) {
271
292
  issues.push("method.json must declare explicit stages for a portable Method package");
272
293
  return issues;
273
294
  }
295
+ // Structural issues already returned earlier; only stage-skill files can be missing now.
274
296
  return [
275
297
  ...issues,
276
- ...collectMethodStageSkillIssues(dirPath, parsed.data.stages ?? null),
298
+ ...collectMethodPackageStructureIssues(dirPath, parsed.data.stages ?? null),
277
299
  ];
278
300
  }
279
301
  export function isPortableMethodPackage(dirPath) {
@@ -413,7 +435,7 @@ export function validateMethodPackage(dirPath) {
413
435
  }
414
436
  }
415
437
  }
416
- for (const requiredZone of listBuiltinCompiledZoneSpecs().filter((zone) => zone.id === "raw" || zone.id === "runtime")) {
438
+ for (const requiredZone of listBuiltinCompiledZoneSpecs().filter((zone) => zone.id === "runtime")) {
417
439
  const match = zoneById.get(requiredZone.id);
418
440
  if (!match) {
419
441
  errors.push(`method.schema.json is missing required zone "${requiredZone.id}".`);
@@ -461,6 +483,3 @@ function describeContextInterfaceValidationIssues(dirPath) {
461
483
  return `method.schema.json ${path}: ${issue.message}`;
462
484
  });
463
485
  }
464
- function basename(filePath) {
465
- return filePath.split(/[\\/]/).pop() ?? filePath;
466
- }
@@ -1,5 +1,6 @@
1
- import type { RuntimeStageAcceptance, MethodCompilerApi } from "../compiler/lib/schema.js";
2
- import type { MethodId, RuntimeContractType } from "../contracts/lib/schema.js";
1
+ import { type LocalMethodDefinition } from "./local-methods.js";
2
+ import type { RuntimeStageAcceptance, MethodCompilerApi } from "../../engine/compile/lib/schema.js";
3
+ import type { MethodId, RuntimeContractType } from "../../contracts/lib/schema.js";
3
4
  import { type ContextInterface, type ContextInterfaceZoneId, type MethodInputSpec } from "./context-interface.js";
4
5
  export interface MethodStarterDoc {
5
6
  relativePath: string;
@@ -11,6 +12,12 @@ export interface MethodStageDefinition {
11
12
  description: string;
12
13
  contractType: RuntimeContractType;
13
14
  skillDir: string;
15
+ /**
16
+ * Role hint declared by the Method package. Defaults to `general` when
17
+ * absent; mapped to a connected agent via the user's role-map at run
18
+ * time.
19
+ */
20
+ role: string;
14
21
  reads: ContextInterfaceZoneId[];
15
22
  writes: ContextInterfaceZoneId[];
16
23
  acceptance?: RuntimeStageAcceptance;
@@ -31,53 +38,26 @@ export interface MethodDefinition<TId extends string> {
31
38
  stages: MethodStageDefinition[];
32
39
  stagePolicyNotes?: Record<string, string[]>;
33
40
  starterDocs?: MethodStarterDoc[];
34
- scope?: "builtin" | "local";
41
+ scope?: "builtin" | "user" | "local";
35
42
  }
36
43
  export type CompiledMethodId = string;
37
- export declare function standaloneMethodDefinitionFromLocalPackage(local: {
38
- id: string;
39
- compiler_api?: MethodCompilerApi;
40
- purpose?: {
41
- label: string;
42
- task_hint: string;
43
- };
44
- inputs?: MethodInputSpec[];
45
- label: string;
46
- hint: string;
47
- stages?: Array<{
48
- id: string;
49
- label: string;
50
- description?: string;
51
- contract_type: RuntimeContractType;
52
- skill_dir?: string;
53
- reads: ContextInterfaceZoneId[];
54
- writes: ContextInterfaceZoneId[];
55
- acceptance?: RuntimeStageAcceptance;
56
- }>;
57
- stage_policy_notes?: Record<string, string[]>;
58
- method_schema?: ContextInterface;
59
- starter_docs: MethodStarterDoc[];
60
- }): MethodDefinition<string>;
61
- export declare function listCompiledMethodChoices(sourcePath?: string): MethodDefinition<string>[];
44
+ export declare function standaloneMethodDefinitionFromLocalPackage(local: LocalMethodDefinition): MethodDefinition<string>;
45
+ export declare function listCompiledMethodChoices(prepDataDir?: string): MethodDefinition<string>[];
62
46
  export declare function getCompiledMethod(methodId: CompiledMethodId, options?: {
63
- sourcePath?: string;
47
+ prepDataDir?: string;
64
48
  }): MethodDefinition<string>;
65
49
  export declare function getActiveCompiledMethod(compiledPath: string): MethodDefinition<string>;
66
50
  export declare function resolveCompiledMethodId(value: unknown): CompiledMethodId | null;
67
51
  export declare function resolveCompiledMethodFromConfig(config: unknown): CompiledMethodId | null;
68
52
  export declare function resolveRequiredCompiledMethodFromConfig(config: unknown, label?: string): CompiledMethodId;
69
- export declare function formatCompiledMethodStageStep(methodId: CompiledMethodId, stage: string, options?: {
70
- sourcePath?: string;
71
- }): string;
72
- export declare function getMethodStageDefinition(methodId: MethodId, stage: string, sourcePath?: string): MethodStageDefinition | null;
73
- export declare function getMethodStagePosition(methodId: MethodId, stage: string, sourcePath?: string): {
53
+ export declare function getMethodStageDefinition(methodId: MethodId, stage: string, prepDataDir?: string): MethodStageDefinition | null;
54
+ export declare function getMethodStagePosition(methodId: MethodId, stage: string, prepDataDir?: string): {
74
55
  stageIndex: number;
75
56
  stageTotal: number;
76
57
  stages: string[];
77
58
  } | null;
78
- export declare function getMethodStages(methodId: MethodId, sourcePath?: string): string[];
59
+ export declare function getMethodStages(methodId: MethodId, prepDataDir?: string): string[];
79
60
  export declare function getActiveCompiledStages(compiledPath: string): string[];
80
- export declare function getMethodStagePolicyNotes(methodId: MethodId, stage: string, sourcePath?: string): string[];
81
61
  export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, stage: string): string[];
82
62
  export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, stage: string): MethodStageDefinition["acceptance"] | undefined;
83
63
  export declare function formatActiveCompiledMethodStageStep(compiledPath: string, stage: string): string;