@interf/compiler 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +9 -9
  2. package/agent-skills/interf-actions/SKILL.md +3 -0
  3. package/agent-skills/interf-actions/references/cli.md +13 -13
  4. package/{builtin-workflows/interf → builtin-methods/interf-default}/README.md +2 -2
  5. package/builtin-methods/interf-default/improve/SKILL.md +18 -0
  6. package/{builtin-workflows/interf/workflow.json → builtin-methods/interf-default/method.json} +4 -4
  7. package/{builtin-workflows/interf/workflow.schema.json → builtin-methods/interf-default/method.schema.json} +2 -2
  8. package/dist/cli/commands/check-draft.d.ts +6 -6
  9. package/dist/cli/commands/check-draft.js +5 -5
  10. package/dist/cli/commands/compile-controller.d.ts +7 -7
  11. package/dist/cli/commands/compile-controller.js +35 -38
  12. package/dist/cli/commands/compile.d.ts +3 -3
  13. package/dist/cli/commands/compile.js +23 -21
  14. package/dist/cli/commands/compiled-flow.d.ts +11 -11
  15. package/dist/cli/commands/compiled-flow.js +33 -30
  16. package/dist/cli/commands/create-method-wizard.d.ts +76 -0
  17. package/dist/cli/commands/{create-workflow-wizard.js → create-method-wizard.js} +153 -163
  18. package/dist/cli/commands/create.d.ts +3 -3
  19. package/dist/cli/commands/create.js +44 -45
  20. package/dist/cli/commands/default.js +1 -1
  21. package/dist/cli/commands/executor-flow.d.ts +6 -6
  22. package/dist/cli/commands/executor-flow.js +1 -1
  23. package/dist/cli/commands/init.d.ts +2 -2
  24. package/dist/cli/commands/init.js +139 -118
  25. package/dist/cli/commands/list.js +11 -10
  26. package/dist/cli/commands/preparation-selection.d.ts +3 -3
  27. package/dist/cli/commands/source-config-wizard.d.ts +9 -9
  28. package/dist/cli/commands/source-config-wizard.js +43 -43
  29. package/dist/cli/commands/status.js +36 -9
  30. package/dist/cli/commands/test-flow.d.ts +15 -15
  31. package/dist/cli/commands/test-flow.js +29 -219
  32. package/dist/cli/commands/test.d.ts +2 -2
  33. package/dist/cli/commands/test.js +50 -51
  34. package/dist/cli/commands/verify.js +7 -7
  35. package/dist/cli/commands/web.js +41 -28
  36. package/dist/compiler-ui/404.html +1 -0
  37. package/dist/compiler-ui/__next.__PAGE__.txt +10 -0
  38. package/dist/compiler-ui/__next._full.txt +20 -0
  39. package/dist/compiler-ui/__next._head.txt +5 -0
  40. package/dist/compiler-ui/__next._index.txt +5 -0
  41. package/dist/compiler-ui/__next._tree.txt +5 -0
  42. package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +5 -0
  43. package/{apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css → dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css} +1 -1
  44. package/{apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js → dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js} +15 -21
  45. package/{apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js → dist/compiler-ui/_next/static/chunks/turbopack-0.uq1k8c0j4s..js} +1 -1
  46. package/dist/compiler-ui/_not-found/__next._full.txt +15 -0
  47. package/dist/compiler-ui/_not-found/__next._head.txt +5 -0
  48. package/dist/compiler-ui/_not-found/__next._index.txt +5 -0
  49. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +5 -0
  50. package/dist/compiler-ui/_not-found/__next._not-found.txt +5 -0
  51. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -0
  52. package/dist/compiler-ui/_not-found.html +1 -0
  53. package/dist/compiler-ui/_not-found.txt +15 -0
  54. package/{apps/compiler-ui/.next/server/app → dist/compiler-ui}/index.html +1 -1
  55. package/dist/compiler-ui/index.txt +20 -0
  56. package/dist/index.d.ts +8 -6
  57. package/dist/index.js +5 -3
  58. package/dist/packages/agents/index.d.ts +1 -1
  59. package/dist/packages/agents/lib/args.d.ts +2 -2
  60. package/dist/packages/agents/lib/compiled-bootstrap.js +7 -6
  61. package/dist/packages/agents/lib/execution-profile.d.ts +5 -5
  62. package/dist/packages/agents/lib/execution-profile.js +7 -6
  63. package/dist/packages/agents/lib/executors.d.ts +13 -13
  64. package/dist/packages/agents/lib/preflight.d.ts +1 -0
  65. package/dist/packages/agents/lib/preflight.js +32 -9
  66. package/dist/packages/agents/lib/shells.d.ts +25 -24
  67. package/dist/packages/agents/lib/shells.js +161 -154
  68. package/dist/packages/agents/lib/types.d.ts +2 -2
  69. package/dist/packages/compiler/artifact-counts.d.ts +1 -0
  70. package/dist/packages/compiler/artifact-counts.js +30 -0
  71. package/dist/packages/compiler/compiled-paths.d.ts +4 -7
  72. package/dist/packages/compiler/compiled-paths.js +9 -15
  73. package/dist/packages/compiler/compiled-pipeline.d.ts +11 -12
  74. package/dist/packages/compiler/compiled-pipeline.js +22 -22
  75. package/dist/packages/compiler/compiled-schema.d.ts +20 -20
  76. package/dist/packages/compiler/compiled-schema.js +29 -29
  77. package/dist/packages/compiler/compiled-stage-plan.d.ts +4 -4
  78. package/dist/packages/compiler/compiled-stage-plan.js +8 -8
  79. package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -5
  80. package/dist/packages/compiler/compiled-stage-runner.js +7 -7
  81. package/dist/packages/compiler/compiled-target.d.ts +5 -5
  82. package/dist/packages/compiler/compiled-target.js +5 -5
  83. package/dist/packages/compiler/index.d.ts +3 -3
  84. package/dist/packages/compiler/index.js +2 -2
  85. package/dist/packages/compiler/lib/schema.d.ts +62 -247
  86. package/dist/packages/compiler/lib/schema.js +56 -174
  87. package/dist/packages/compiler/{workflows.d.ts → method-runs.d.ts} +4 -4
  88. package/dist/packages/compiler/{workflows.js → method-runs.js} +4 -3
  89. package/dist/packages/compiler/raw-snapshot.d.ts +0 -7
  90. package/dist/packages/compiler/raw-snapshot.js +0 -1
  91. package/dist/packages/compiler/reset.js +3 -3
  92. package/dist/packages/compiler/runtime-acceptance.js +9 -16
  93. package/dist/packages/compiler/runtime-contracts.js +9 -9
  94. package/dist/packages/compiler/runtime-prompt.js +4 -4
  95. package/dist/packages/compiler/runtime-reconcile.d.ts +2 -2
  96. package/dist/packages/compiler/runtime-reconcile.js +3 -3
  97. package/dist/packages/compiler/runtime-runs.js +9 -9
  98. package/dist/packages/compiler/runtime-types.d.ts +8 -7
  99. package/dist/packages/compiler/state-health.js +26 -35
  100. package/dist/packages/compiler/state-view.js +6 -6
  101. package/dist/packages/compiler/validate-compiled.d.ts +5 -5
  102. package/dist/packages/compiler/validate-compiled.js +56 -64
  103. package/dist/packages/compiler/validate.d.ts +2 -2
  104. package/dist/packages/compiler/validate.js +22 -14
  105. package/dist/packages/contracts/index.d.ts +2 -0
  106. package/dist/packages/contracts/index.js +1 -0
  107. package/dist/packages/contracts/lib/schema.d.ts +205 -0
  108. package/dist/packages/contracts/lib/schema.js +101 -0
  109. package/dist/packages/execution/index.d.ts +2 -2
  110. package/dist/packages/execution/index.js +1 -1
  111. package/dist/packages/execution/lib/schema.d.ts +80 -83
  112. package/dist/packages/execution/lib/schema.js +25 -48
  113. package/dist/packages/local-service/action-values.d.ts +0 -1
  114. package/dist/packages/local-service/action-values.js +0 -1
  115. package/dist/packages/local-service/client.d.ts +4 -4
  116. package/dist/packages/local-service/client.js +4 -4
  117. package/dist/packages/local-service/index.d.ts +3 -3
  118. package/dist/packages/local-service/index.js +2 -2
  119. package/dist/packages/local-service/lib/schema.d.ts +536 -974
  120. package/dist/packages/local-service/lib/schema.js +43 -160
  121. package/dist/packages/local-service/run-observability.d.ts +6 -0
  122. package/dist/packages/local-service/run-observability.js +592 -0
  123. package/dist/packages/local-service/runtime.d.ts +19 -23
  124. package/dist/packages/local-service/runtime.js +302 -880
  125. package/dist/packages/local-service/server.d.ts +1 -0
  126. package/dist/packages/local-service/server.js +25 -20
  127. package/dist/packages/method-authoring/index.d.ts +4 -0
  128. package/dist/packages/method-authoring/index.js +4 -0
  129. package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.d.ts → method-authoring/lib/method-edit-utils.d.ts} +3 -3
  130. package/dist/packages/method-authoring/method-authoring.d.ts +24 -0
  131. package/dist/packages/method-authoring/method-authoring.js +116 -0
  132. package/dist/packages/method-authoring/method-edit-session.d.ts +18 -0
  133. package/dist/packages/method-authoring/method-edit-session.js +125 -0
  134. package/dist/packages/method-authoring/method-improvement.d.ts +23 -0
  135. package/dist/packages/{workflow-authoring/workflow-improvement.js → method-authoring/method-improvement.js} +63 -63
  136. package/dist/packages/{workflow-package/builtin-compiled-workflow.d.ts → method-package/builtin-compiled-method.d.ts} +1 -1
  137. package/dist/packages/{workflow-package/builtin-compiled-workflow.js → method-package/builtin-compiled-method.js} +17 -17
  138. package/dist/packages/{workflow-package → method-package}/context-interface.d.ts +12 -12
  139. package/dist/packages/{workflow-package → method-package}/context-interface.js +19 -19
  140. package/dist/packages/method-package/index.d.ts +11 -0
  141. package/dist/packages/method-package/index.js +11 -0
  142. package/dist/packages/method-package/interf-method-package.d.ts +31 -0
  143. package/dist/packages/{workflow-package/interf-workflow-package.js → method-package/interf-method-package.js} +145 -145
  144. package/dist/packages/{workflow-package → method-package}/lib/package-root.js +1 -1
  145. package/dist/packages/method-package/local-methods.d.ts +64 -0
  146. package/dist/packages/method-package/local-methods.js +466 -0
  147. package/dist/packages/method-package/method-definitions.d.ts +83 -0
  148. package/dist/packages/method-package/method-definitions.js +205 -0
  149. package/dist/packages/{workflow-package/workflow-helpers.d.ts → method-package/method-helpers.d.ts} +10 -10
  150. package/dist/packages/{workflow-package/workflow-helpers.js → method-package/method-helpers.js} +22 -26
  151. package/dist/packages/method-package/method-review-paths.d.ts +10 -0
  152. package/dist/packages/{workflow-package/workflow-review-paths.js → method-package/method-review-paths.js} +4 -4
  153. package/dist/packages/{workflow-package/workflow-stage-runner.d.ts → method-package/method-stage-runner.d.ts} +12 -11
  154. package/dist/packages/{workflow-package/workflow-stage-runner.js → method-package/method-stage-runner.js} +6 -6
  155. package/dist/packages/methods/index.d.ts +2 -0
  156. package/dist/packages/methods/index.js +2 -0
  157. package/dist/packages/methods/method-resolution.d.ts +6 -0
  158. package/dist/packages/methods/method-resolution.js +7 -0
  159. package/dist/packages/project-model/index.d.ts +1 -4
  160. package/dist/packages/project-model/index.js +0 -3
  161. package/dist/packages/project-model/interf-detect.d.ts +1 -5
  162. package/dist/packages/project-model/interf-detect.js +7 -18
  163. package/dist/packages/project-model/interf-scaffold.d.ts +2 -2
  164. package/dist/packages/project-model/interf-scaffold.js +38 -39
  165. package/dist/packages/project-model/interf.d.ts +1 -2
  166. package/dist/packages/project-model/interf.js +1 -2
  167. package/dist/packages/project-model/lib/schema.d.ts +2 -66
  168. package/dist/packages/project-model/lib/schema.js +5 -23
  169. package/dist/packages/project-model/project-paths.d.ts +9 -10
  170. package/dist/packages/project-model/project-paths.js +14 -17
  171. package/dist/packages/project-model/source-config.d.ts +11 -18
  172. package/dist/packages/project-model/source-config.js +42 -60
  173. package/dist/packages/project-model/source-folders.d.ts +4 -4
  174. package/dist/packages/project-model/source-folders.js +10 -10
  175. package/dist/packages/testing/index.d.ts +2 -2
  176. package/dist/packages/testing/index.js +1 -1
  177. package/dist/packages/testing/lib/schema.d.ts +11 -11
  178. package/dist/packages/testing/lib/schema.js +8 -9
  179. package/dist/packages/testing/readiness-check-run.d.ts +67 -0
  180. package/dist/packages/testing/readiness-check-run.js +258 -0
  181. package/dist/packages/testing/test-execution.d.ts +3 -3
  182. package/dist/packages/testing/test-execution.js +5 -5
  183. package/dist/packages/testing/test-paths.js +6 -6
  184. package/dist/packages/testing/test-profile-presets.js +2 -2
  185. package/dist/packages/testing/test-sandbox.js +10 -11
  186. package/dist/packages/testing/test-targets.d.ts +1 -1
  187. package/dist/packages/testing/test-targets.js +8 -7
  188. package/dist/packages/testing/test-types.d.ts +1 -1
  189. package/package.json +16 -33
  190. package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +0 -5
  191. package/builtin-workflows/interf/improve/SKILL.md +0 -18
  192. package/dist/cli/commands/create-workflow-wizard.d.ts +0 -76
  193. package/dist/packages/project-model/compiled-paths.d.ts +0 -1
  194. package/dist/packages/project-model/compiled-paths.js +0 -1
  195. package/dist/packages/project-model/compiled-raw.d.ts +0 -1
  196. package/dist/packages/project-model/compiled-raw.js +0 -1
  197. package/dist/packages/project-model/compiled-reset.d.ts +0 -1
  198. package/dist/packages/project-model/compiled-reset.js +0 -1
  199. package/dist/packages/shared/index.d.ts +0 -7
  200. package/dist/packages/shared/index.js +0 -7
  201. package/dist/packages/shared/util.d.ts +0 -3
  202. package/dist/packages/shared/util.js +0 -3
  203. package/dist/packages/testing/test-matrices.d.ts +0 -90
  204. package/dist/packages/testing/test-matrices.js +0 -96
  205. package/dist/packages/workflow-authoring/index.d.ts +0 -4
  206. package/dist/packages/workflow-authoring/index.js +0 -4
  207. package/dist/packages/workflow-authoring/workflow-authoring.d.ts +0 -24
  208. package/dist/packages/workflow-authoring/workflow-authoring.js +0 -82
  209. package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +0 -18
  210. package/dist/packages/workflow-authoring/workflow-edit-session.js +0 -91
  211. package/dist/packages/workflow-authoring/workflow-improvement.d.ts +0 -23
  212. package/dist/packages/workflow-package/index.d.ts +0 -11
  213. package/dist/packages/workflow-package/index.js +0 -11
  214. package/dist/packages/workflow-package/interf-workflow-package.d.ts +0 -31
  215. package/dist/packages/workflow-package/local-workflows.d.ts +0 -64
  216. package/dist/packages/workflow-package/local-workflows.js +0 -457
  217. package/dist/packages/workflow-package/workflow-definitions.d.ts +0 -82
  218. package/dist/packages/workflow-package/workflow-definitions.js +0 -211
  219. package/dist/packages/workflow-package/workflow-review-paths.d.ts +0 -10
  220. /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/shape/SKILL.md +0 -0
  221. /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/structure/SKILL.md +0 -0
  222. /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/summarize/SKILL.md +0 -0
  223. /package/{builtin-workflows/interf → builtin-methods/interf-default}/use/query/SKILL.md +0 -0
  224. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/03~yq9q893hmn.js +0 -0
  225. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/06z~l3kwb891e.js +0 -0
  226. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08g7lvje.te.u.js +0 -0
  227. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08m7vf5asqlsm.js +0 -0
  228. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0_i-3_5l9t2qe.js +0 -0
  229. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b-ywny_j0g~0.js +0 -0
  230. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b52v41o1gixx.js +0 -0
  231. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0gpzgsv0w.q~m.js +0 -0
  232. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0ilwfezfvu6~-.js +0 -0
  233. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0n51hrfoufc7g.js +0 -0
  234. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0xxmf45eskdt~.css +0 -0
  235. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0y5z3t-z1c8ks.js.map +0 -0
  236. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/14wtz~vq25~qq.js +0 -0
  237. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-10e~t1yzi4svj.js +0 -0
  238. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -0
  239. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
  240. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
  241. /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/worker.102zas1s52_pf.js +0 -0
  242. /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_buildManifest.js +0 -0
  243. /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_clientMiddlewareManifest.js +0 -0
  244. /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_ssgManifest.js +0 -0
  245. /package/dist/packages/compiler/{workflow-primitives.d.ts → method-primitives.d.ts} +0 -0
  246. /package/dist/packages/compiler/{workflow-primitives.js → method-primitives.js} +0 -0
  247. /package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.js → method-authoring/lib/method-edit-utils.js} +0 -0
  248. /package/dist/packages/{workflow-package → method-package}/lib/package-root.d.ts +0 -0
  249. /package/dist/packages/{workflow-package/workflow-stage-policy.d.ts → method-package/method-stage-policy.d.ts} +0 -0
  250. /package/dist/packages/{workflow-package/workflow-stage-policy.js → method-package/method-stage-policy.js} +0 -0
@@ -13,5 +13,6 @@ export interface StartedLocalService {
13
13
  url: string;
14
14
  close(): Promise<void>;
15
15
  }
16
+ export declare function resolveCompilerUiStaticRoot(rootPath?: string): string;
16
17
  export declare function createLocalServiceServer(runtime: LocalServiceRuntime): Server;
17
18
  export declare function startLocalService(options?: StartLocalServiceOptions): Promise<StartedLocalService>;
@@ -10,19 +10,20 @@ import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_I
10
10
  function packageRoot() {
11
11
  return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
12
12
  }
13
- function compilerUiAssetBuildRoot() {
14
- const explicit = process.env.INTERF_COMPILER_UI_ASSETS?.trim();
13
+ export function resolveCompilerUiStaticRoot(rootPath = packageRoot()) {
14
+ const distRoot = join(rootPath, "dist", "compiler-ui");
15
+ const sourceExportRoot = join(rootPath, "apps", "compiler-ui", "out");
16
+ if (existsSync(join(distRoot, "index.html")))
17
+ return distRoot;
18
+ if (existsSync(join(sourceExportRoot, "index.html")))
19
+ return sourceExportRoot;
20
+ return distRoot;
21
+ }
22
+ function compilerUiStaticRoot() {
23
+ const explicit = process.env.INTERF_COMPILER_UI_STATIC_ROOT?.trim();
15
24
  if (explicit)
16
25
  return resolve(explicit);
17
- return join(packageRoot(), "apps", "compiler-ui", ".next");
18
- }
19
- function compilerUiPublicRoots() {
20
- const explicit = process.env.INTERF_COMPILER_UI_ASSETS?.trim();
21
- if (explicit) {
22
- const assetRoot = resolve(explicit);
23
- return [join(assetRoot, "public"), join(dirname(assetRoot), "public")];
24
- }
25
- return [join(packageRoot(), "apps", "compiler-ui", "public")];
26
+ return resolveCompilerUiStaticRoot();
26
27
  }
27
28
  function localInstancePointerPath(rootPath) {
28
29
  return join(rootPath, ...LOCAL_SERVICE_INSTANCE_POINTER_PATH);
@@ -65,6 +66,12 @@ function contentType(filePath) {
65
66
  return "image/x-icon";
66
67
  case ".txt":
67
68
  return "text/plain; charset=utf-8";
69
+ case ".map":
70
+ return "application/json; charset=utf-8";
71
+ case ".webmanifest":
72
+ return "application/manifest+json; charset=utf-8";
73
+ case ".woff2":
74
+ return "font/woff2";
68
75
  default:
69
76
  return "application/octet-stream";
70
77
  }
@@ -170,10 +177,10 @@ function sendFile(res, filePath) {
170
177
  }
171
178
  }
172
179
  function sendCompilerUiAsset(req, res, _runtime) {
173
- const buildRoot = compilerUiAssetBuildRoot();
180
+ const staticRoot = compilerUiStaticRoot();
174
181
  const url = parseRequestUrl(req);
175
182
  if (url.pathname === "/") {
176
- const indexPath = join(buildRoot, "server", "app", "index.html");
183
+ const indexPath = join(staticRoot, "index.html");
177
184
  if (sendFile(res, indexPath))
178
185
  return true;
179
186
  sendText(res, 503, "Interf UI assets are missing. Run `npm run web:build`, then restart `interf web`.\n");
@@ -181,15 +188,13 @@ function sendCompilerUiAsset(req, res, _runtime) {
181
188
  }
182
189
  if (url.pathname.startsWith("/_next/static/")) {
183
190
  const relativePath = url.pathname.slice("/_next/static/".length);
184
- const assetPath = safeStaticPath(join(buildRoot, "static"), relativePath);
185
- if (assetPath && sendFile(res, assetPath))
186
- return true;
187
- }
188
- for (const publicRoot of compilerUiPublicRoots()) {
189
- const assetPath = safeStaticPath(publicRoot, url.pathname.slice(1));
191
+ const assetPath = safeStaticPath(join(staticRoot, "_next", "static"), relativePath);
190
192
  if (assetPath && sendFile(res, assetPath))
191
193
  return true;
192
194
  }
195
+ const assetPath = safeStaticPath(staticRoot, url.pathname.slice(1));
196
+ if (assetPath && sendFile(res, assetPath))
197
+ return true;
193
198
  return false;
194
199
  }
195
200
  async function readJsonBody(req) {
@@ -406,7 +411,7 @@ async function routeApi(req, res, runtime) {
406
411
  if (method === "POST" &&
407
412
  path === LOCAL_SERVICE_ROUTES.methodAuthoringRuns) {
408
413
  const body = await readJsonBody(req);
409
- const job = await runtime.createWorkflowAuthoringRun(body);
414
+ const job = await runtime.createMethodAuthoringRun(body);
410
415
  sendJson(res, 202, job);
411
416
  return true;
412
417
  }
@@ -0,0 +1,4 @@
1
+ export * as authoring from "./method-authoring.js";
2
+ export * as editSession from "./method-edit-session.js";
3
+ export * as editUtils from "./lib/method-edit-utils.js";
4
+ export * as improvement from "./method-improvement.js";
@@ -0,0 +1,4 @@
1
+ export * as authoring from "./method-authoring.js";
2
+ export * as editSession from "./method-edit-session.js";
3
+ export * as editUtils from "./lib/method-edit-utils.js";
4
+ export * as improvement from "./method-improvement.js";
@@ -1,9 +1,9 @@
1
1
  export declare function copyDirectory(sourcePath: string, targetPath: string): void;
2
2
  export declare function directoriesMatch(leftPath: string, rightPath: string): boolean;
3
- export interface WorkflowEditShellArtifacts {
3
+ export interface MethodEditShellArtifacts {
4
4
  rootPath: string;
5
- workflowBeforePath: string;
6
- workflowAfterPath: string;
5
+ methodBeforePath: string;
6
+ methodAfterPath: string;
7
7
  promptLogPath: string;
8
8
  eventLogPath: string;
9
9
  statusLogPath: string;
@@ -0,0 +1,24 @@
1
+ import type { MethodExecutor } from "../agents/lib/executors.js";
2
+ import { validateMethodPackage } from "../method-package/local-methods.js";
3
+ import type { SourceReadinessCheck } from "../project-model/lib/schema.js";
4
+ export interface MethodAuthoringRunResult {
5
+ status: "updated" | "no-change" | "invalid" | "executor-failed";
6
+ changed: boolean;
7
+ summary: string;
8
+ validation: ReturnType<typeof validateMethodPackage> | null;
9
+ methodPath: string;
10
+ shellPath: string;
11
+ }
12
+ export declare function runMethodAuthoringDraft(options: {
13
+ sourcePath: string;
14
+ sourceFolderPath: string;
15
+ baseMethodId?: string;
16
+ methodId: string;
17
+ label: string;
18
+ hint: string;
19
+ taskPrompt: string;
20
+ checks?: SourceReadinessCheck[];
21
+ executor: MethodExecutor;
22
+ onStatus?: (line: string) => void;
23
+ }): Promise<MethodAuthoringRunResult>;
24
+ export declare function resolveMethodDraftPath(sourcePath: string, methodId: string): string;
@@ -0,0 +1,116 @@
1
+ import { rmSync } from "node:fs";
2
+ import { createMethodAuthoringShell } from "../agents/lib/shells.js";
3
+ import { createScratchLocalMethodPackage } from "../method-package/interf-method-package.js";
4
+ import { CONTEXT_INTERFACE_FILE } from "../method-package/context-interface.js";
5
+ import { loadMethodDefinitionFromDir, validateMethodPackage, methodDefinitionPath, } from "../method-package/local-methods.js";
6
+ import { runMethodEditSession } from "./method-edit-session.js";
7
+ function buildMethodAuthoringPrompt() {
8
+ return [
9
+ "This is an automated Interf Method-authoring run, not an open-ended chat session.",
10
+ "Execute it now.",
11
+ "Create one standalone Method package for the source data, desired portable-context outputs, and proof requirements in this source folder.",
12
+ "Read `runtime/authoring-context.json` first.",
13
+ "Treat `task_prompt` as the user's preparation-and-evidence brief: source data, output shape, and evidence that should show the data is ready.",
14
+ `Then read \`method/README.md\`, \`method/method.json\`, and \`method/${CONTEXT_INTERFACE_FILE}\`.`,
15
+ "The `method/` directory starts as a neutral Method package scaffold, not as a suggested Method.",
16
+ "Replace the scaffold purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Method this agent work actually needs.",
17
+ "Review `artifacts/source-folder/raw/` before editing the package.",
18
+ "Prefer direct file-reading and search tools over shell commands for routine file inspection.",
19
+ "Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
20
+ "Edit only files under `method/`.",
21
+ "Keep the Method package valid for the current compiler API and `method.schema.json`.",
22
+ "Choose stage ids, stage order, reads, writes, acceptance criteria, and stage docs from the source data and preparation-and-evidence brief.",
23
+ "Use kebab-case ids everywhere: stage ids, skill_dir values, zone ids, reads/writes values, and package ids. Never use underscores.",
24
+ "Do not preserve the placeholder `prepare` stage unless the final Method genuinely needs a stage with that exact role.",
25
+ "When editing acceptance criteria: `zone_counts_at_least` maps declared zone ids to fixed numeric minimums.",
26
+ "`zone_counts_at_least_counts` also maps declared zone ids to runtime count-key strings such as `source_total`; `source_total` is a value, never a zone key.",
27
+ "For file output zones that replace scaffold files, add `artifacts_must_not_contain` entries that reject `Not yet compiled.` placeholder text; its keys must be artifact paths like `home.md`, not zone ids like `home`.",
28
+ "Before stopping, verify every zone-count acceptance key is declared in `method.schema.json`.",
29
+ "For every stage in `method.json`, create `method/compile/stages/<skill_dir>/SKILL.md` and make the folder name exactly match that stage's kebab-case `skill_dir`.",
30
+ "Every zone path in `method.schema.json` must be unique and non-overlapping. Do not declare both `knowledge/indexes` and `knowledge/indexes/some-file.md` as separate zones.",
31
+ "Make the package materially specific to this Preparation task, output shape, and proof requirement. A no-op scaffold is not acceptable.",
32
+ "Treat the Method package as four aligned layers: purpose, inputs, context interface, and stages.",
33
+ "Keep the portable-context entrypoint canonical: if the Method writes an agent entrypoint, declare zone id `home` with path `home.md` and make the final shaping stage own it.",
34
+ "Do not move the main entrypoint to `knowledge/home.md` or any other nested path.",
35
+ "Prefer explicit stage-doc, stage-policy, purpose, input-contract, and context-interface edits over vague rewrites.",
36
+ "Do not introduce wikilinks unless the Method also creates the target note by exact basename or explicit relative path.",
37
+ "Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
38
+ "Do not make one stage point at files or notes that are only created later by another stage.",
39
+ "Prefer conservative retrieval routing over speculative note sprawl.",
40
+ "Do not narrate plans or ask follow-up questions.",
41
+ "Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
42
+ "As soon as the Method edits are complete, stop.",
43
+ ].join("\n");
44
+ }
45
+ function validateAuthoredMethodPackage(methodPath) {
46
+ const validation = validateMethodPackage(methodPath);
47
+ if (!validation.ok)
48
+ return validation;
49
+ const definition = loadMethodDefinitionFromDir(methodPath);
50
+ if (!definition)
51
+ return validation;
52
+ const errors = [...validation.errors];
53
+ const placeholderStage = definition.stages?.find((stage) => stage.id === "prepare" &&
54
+ stage.contract_type === "method-draft-stage" &&
55
+ stage.writes.includes("draft-context"));
56
+ const placeholderZone = definition.method_schema.zones.find((zone) => zone.id === "draft-context");
57
+ const placeholderPurpose = definition.purpose?.label === "From-scratch Method draft" ||
58
+ definition.purpose?.task_hint?.includes("Replace this neutral scaffold");
59
+ if (placeholderStage) {
60
+ errors.push("Authored Method still contains the neutral scaffold stage `prepare`.");
61
+ }
62
+ if (placeholderZone) {
63
+ errors.push("Authored Method still contains the neutral scaffold zone `draft-context`.");
64
+ }
65
+ if (placeholderPurpose) {
66
+ errors.push("Authored Method still contains the neutral scaffold purpose.");
67
+ }
68
+ return {
69
+ ok: validation.ok && errors.length === 0,
70
+ summary: errors.length === 0
71
+ ? validation.summary
72
+ : `Method package has ${errors.length} issue(s).`,
73
+ errors,
74
+ counts: validation.counts,
75
+ };
76
+ }
77
+ export async function runMethodAuthoringDraft(options) {
78
+ const methodPath = createScratchLocalMethodPackage({
79
+ sourcePath: options.sourcePath,
80
+ methodId: options.methodId,
81
+ label: options.label,
82
+ hint: options.hint,
83
+ });
84
+ const shell = createMethodAuthoringShell({
85
+ methodPath,
86
+ methodId: options.methodId,
87
+ label: options.label,
88
+ referenceMethodId: options.baseMethodId ?? null,
89
+ sourceFolderPath: options.sourceFolderPath,
90
+ taskPrompt: options.taskPrompt,
91
+ checks: options.checks ?? [],
92
+ });
93
+ const session = await runMethodEditSession({
94
+ executor: options.executor,
95
+ methodPath,
96
+ shell,
97
+ prompt: buildMethodAuthoringPrompt(),
98
+ validate: validateAuthoredMethodPackage,
99
+ maxValidationRepairAttempts: 1,
100
+ onStatus: options.onStatus,
101
+ });
102
+ if (session.status !== "updated") {
103
+ rmSync(methodPath, { recursive: true, force: true });
104
+ }
105
+ return {
106
+ status: session.status,
107
+ changed: session.changed,
108
+ summary: session.summary,
109
+ validation: session.validation,
110
+ methodPath,
111
+ shellPath: shell.rootPath,
112
+ };
113
+ }
114
+ export function resolveMethodDraftPath(sourcePath, methodId) {
115
+ return methodDefinitionPath(sourcePath, methodId);
116
+ }
@@ -0,0 +1,18 @@
1
+ import type { MethodExecutor } from "../agents/lib/executors.js";
2
+ import type { MethodValidationResult } from "../method-package/local-methods.js";
3
+ import { type MethodEditShellArtifacts } from "./lib/method-edit-utils.js";
4
+ export interface MethodEditSessionResult {
5
+ status: "updated" | "no-change" | "invalid" | "executor-failed";
6
+ changed: boolean;
7
+ validation: MethodValidationResult | null;
8
+ summary: string;
9
+ }
10
+ export declare function runMethodEditSession(options: {
11
+ executor: MethodExecutor;
12
+ methodPath: string;
13
+ shell: MethodEditShellArtifacts;
14
+ prompt: string;
15
+ validate: (methodPath: string) => MethodValidationResult;
16
+ maxValidationRepairAttempts?: number;
17
+ onStatus?: (line: string) => void;
18
+ }): Promise<MethodEditSessionResult>;
@@ -0,0 +1,125 @@
1
+ import { appendFileSync, existsSync, realpathSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { copyDirectory, directoriesMatch, } from "./lib/method-edit-utils.js";
4
+ export async function runMethodEditSession(options) {
5
+ const editableMethodPath = join(options.shell.rootPath, "method");
6
+ copyDirectory(options.methodPath, options.shell.methodBeforePath);
7
+ if (!existsSync(editableMethodPath)) {
8
+ copyDirectory(options.methodPath, editableMethodPath);
9
+ }
10
+ writeFileSync(options.shell.promptLogPath, `${options.prompt}\n`);
11
+ const maxValidationRepairAttempts = options.maxValidationRepairAttempts ?? 0;
12
+ let prompt = options.prompt;
13
+ for (let attempt = 0; attempt <= maxValidationRepairAttempts; attempt += 1) {
14
+ let code = 1;
15
+ let executeError = null;
16
+ try {
17
+ code = await options.executor.execute(options.shell.rootPath, prompt, {
18
+ eventLogPath: options.shell.eventLogPath,
19
+ statusLogPath: options.shell.statusLogPath,
20
+ completionCheck: () => {
21
+ try {
22
+ if (directoriesMatch(options.shell.methodBeforePath, editableMethodPath))
23
+ return false;
24
+ return options.validate(editableMethodPath).ok;
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ },
30
+ onStatus: options.onStatus,
31
+ });
32
+ }
33
+ catch (error) {
34
+ executeError = error instanceof Error ? error.message : String(error);
35
+ }
36
+ copyDirectory(editableMethodPath, options.shell.methodAfterPath);
37
+ const changed = !directoriesMatch(options.shell.methodBeforePath, options.shell.methodAfterPath);
38
+ if (executeError) {
39
+ copyDirectory(options.shell.methodBeforePath, options.methodPath);
40
+ copyDirectory(options.shell.methodBeforePath, editableMethodPath);
41
+ return {
42
+ status: "executor-failed",
43
+ changed,
44
+ validation: null,
45
+ summary: `Method editor failed before completing: ${executeError}`,
46
+ };
47
+ }
48
+ if (code !== 0) {
49
+ copyDirectory(options.shell.methodBeforePath, options.methodPath);
50
+ copyDirectory(options.shell.methodBeforePath, editableMethodPath);
51
+ return {
52
+ status: "executor-failed",
53
+ changed,
54
+ validation: null,
55
+ summary: `Method editor exited with code ${code}.`,
56
+ };
57
+ }
58
+ const validation = options.validate(editableMethodPath);
59
+ if (validation.ok) {
60
+ if (!sameRealPath(editableMethodPath, options.methodPath)) {
61
+ copyDirectory(editableMethodPath, options.methodPath);
62
+ }
63
+ return {
64
+ status: changed ? "updated" : "no-change",
65
+ changed,
66
+ validation,
67
+ summary: changed
68
+ ? "Method package updated and validated."
69
+ : "Method package is valid without additional edits.",
70
+ };
71
+ }
72
+ const details = validation.errors.length > 0
73
+ ? `: ${validation.errors.slice(0, 6).join("; ")}`
74
+ : "";
75
+ if (!changed || attempt >= maxValidationRepairAttempts) {
76
+ copyDirectory(options.shell.methodBeforePath, options.methodPath);
77
+ copyDirectory(options.shell.methodBeforePath, editableMethodPath);
78
+ return {
79
+ status: "invalid",
80
+ changed,
81
+ validation,
82
+ summary: changed
83
+ ? `Method package failed validation: ${validation.summary}${details}`
84
+ : `Method package is invalid without any Method edits: ${validation.summary}${details}`,
85
+ };
86
+ }
87
+ prompt = [
88
+ "This is an automated Interf Method validation-repair pass.",
89
+ "The previous edit did not pass package validation.",
90
+ "Fix only the validation errors below. Do not redesign the Method.",
91
+ "",
92
+ "Validation errors:",
93
+ ...validation.errors.slice(0, 12).map((error) => `- ${error}`),
94
+ "",
95
+ "Rules:",
96
+ "- Edit only files under `method/`.",
97
+ "- Use kebab-case ids everywhere: stage ids, skill_dir values, zone ids, reads/writes values, and package ids. Never use underscores.",
98
+ "- Keep every stage `skill_dir` matched by `method/compile/stages/<skill_dir>/SKILL.md`.",
99
+ "- Keep `method.schema.json` zone paths unique and non-overlapping.",
100
+ "- Keep zone-count acceptance keys declared in `method.schema.json`.",
101
+ "- Keep `artifacts_must_not_contain` keys as portable-context relative artifact paths such as `home.md`, not zone ids.",
102
+ "- Preserve root `home.md` as the main portable-context entrypoint when the Method writes an entrypoint.",
103
+ "- Stop as soon as the package should validate.",
104
+ ].join("\n");
105
+ appendFileSync(options.shell.promptLogPath, `\n\n---\n\n${prompt}\n`);
106
+ }
107
+ copyDirectory(options.shell.methodBeforePath, options.methodPath);
108
+ copyDirectory(options.shell.methodBeforePath, editableMethodPath);
109
+ return {
110
+ status: "invalid",
111
+ changed: true,
112
+ validation: null,
113
+ summary: "Method package failed validation.",
114
+ };
115
+ }
116
+ function sameRealPath(leftPath, rightPath) {
117
+ try {
118
+ return existsSync(leftPath) &&
119
+ existsSync(rightPath) &&
120
+ realpathSync(leftPath) === realpathSync(rightPath);
121
+ }
122
+ catch {
123
+ return false;
124
+ }
125
+ }
@@ -0,0 +1,23 @@
1
+ import type { MethodExecutor } from "../agents/lib/executors.js";
2
+ import { type MethodValidationResult } from "../method-package/local-methods.js";
3
+ import type { SourcePreparationConfig } from "../project-model/lib/schema.js";
4
+ import type { MethodImprovementLoopSummary } from "../compiler/lib/schema.js";
5
+ export interface MethodImprovementRunResult {
6
+ status: "updated" | "no-change" | "invalid" | "executor-failed";
7
+ changed: boolean;
8
+ validation: MethodValidationResult | null;
9
+ summary: string;
10
+ shellPath: string;
11
+ loopRootPath: string;
12
+ }
13
+ export declare function runMethodImprovementLoop(options: {
14
+ executor: MethodExecutor;
15
+ compiledPath: string;
16
+ methodId: string;
17
+ compiledConfig: Pick<SourcePreparationConfig, "checks">;
18
+ runId: string;
19
+ loopIndex: number;
20
+ maxLoops: number;
21
+ maxAttempts: number;
22
+ previousVariations: MethodImprovementLoopSummary[];
23
+ }): Promise<MethodImprovementRunResult>;