@interf/compiler 0.7.2 → 0.9.1

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 (306) hide show
  1. package/README.md +141 -99
  2. package/TRADEMARKS.md +1 -1
  3. package/agent-skills/interf-actions/SKILL.md +71 -0
  4. package/agent-skills/interf-actions/references/cli.md +190 -0
  5. package/apps/compiler-ui/.next/server/app/index.html +1 -0
  6. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_buildManifest.js +11 -0
  7. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_clientMiddlewareManifest.js +1 -0
  8. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_ssgManifest.js +1 -0
  9. package/apps/compiler-ui/.next/static/chunks/03~yq9q893hmn.js +1 -0
  10. package/apps/compiler-ui/.next/static/chunks/06z~l3kwb891e.js +1 -0
  11. package/apps/compiler-ui/.next/static/chunks/08g7lvje.te.u.js +1 -0
  12. package/apps/compiler-ui/.next/static/chunks/08m7vf5asqlsm.js +91 -0
  13. package/apps/compiler-ui/.next/static/chunks/0_i-3_5l9t2qe.js +1 -0
  14. package/apps/compiler-ui/.next/static/chunks/0b-ywny_j0g~0.js +1 -0
  15. package/apps/compiler-ui/.next/static/chunks/0b52v41o1gixx.js +1 -0
  16. package/apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js +124 -0
  17. package/apps/compiler-ui/.next/static/chunks/0gpzgsv0w.q~m.js +31 -0
  18. package/apps/compiler-ui/.next/static/chunks/0ilwfezfvu6~-.js +1 -0
  19. package/apps/compiler-ui/.next/static/chunks/0n51hrfoufc7g.js +1 -0
  20. package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +5 -0
  21. package/apps/compiler-ui/.next/static/chunks/0xxmf45eskdt~.css +1 -0
  22. package/apps/compiler-ui/.next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
  23. package/apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css +3 -0
  24. package/apps/compiler-ui/.next/static/chunks/14wtz~vq25~qq.js +1 -0
  25. package/apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js +1 -0
  26. package/apps/compiler-ui/.next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
  27. package/apps/compiler-ui/.next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
  28. package/apps/compiler-ui/.next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
  29. package/apps/compiler-ui/.next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
  30. package/apps/compiler-ui/.next/static/media/worker.102zas1s52_pf.js +109 -0
  31. package/builtin-workflows/interf/README.md +8 -8
  32. package/builtin-workflows/interf/compile/stages/shape/SKILL.md +6 -6
  33. package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
  34. package/builtin-workflows/interf/improve/SKILL.md +2 -2
  35. package/builtin-workflows/interf/use/query/SKILL.md +2 -2
  36. package/builtin-workflows/interf/workflow.json +9 -9
  37. package/builtin-workflows/interf/workflow.schema.json +2 -2
  38. package/dist/cli/commands/check-draft.d.ts +5 -4
  39. package/dist/cli/commands/check-draft.js +18 -17
  40. package/dist/cli/commands/compile-controller.d.ts +3 -0
  41. package/dist/cli/commands/compile-controller.js +53 -45
  42. package/dist/cli/commands/compile.js +83 -27
  43. package/dist/cli/commands/compiled-flow.d.ts +3 -0
  44. package/dist/cli/commands/compiled-flow.js +9 -7
  45. package/dist/cli/commands/control-path.d.ts +11 -0
  46. package/dist/cli/commands/control-path.js +72 -0
  47. package/dist/cli/commands/create-workflow-wizard.d.ts +12 -0
  48. package/dist/cli/commands/create-workflow-wizard.js +232 -66
  49. package/dist/cli/commands/create.js +70 -46
  50. package/dist/cli/commands/default.js +5 -3
  51. package/dist/cli/commands/doctor.js +5 -5
  52. package/dist/cli/commands/executor-flow.js +1 -1
  53. package/dist/cli/commands/init.js +362 -101
  54. package/dist/cli/commands/list.js +8 -7
  55. package/dist/cli/commands/preparation-selection.d.ts +6 -0
  56. package/dist/cli/commands/preparation-selection.js +11 -0
  57. package/dist/cli/commands/reset.js +3 -3
  58. package/dist/cli/commands/source-config-wizard.d.ts +4 -4
  59. package/dist/cli/commands/source-config-wizard.js +175 -200
  60. package/dist/cli/commands/status.js +116 -8
  61. package/dist/cli/commands/test-flow.d.ts +1 -1
  62. package/dist/cli/commands/test-flow.js +35 -33
  63. package/dist/cli/commands/test.d.ts +4 -0
  64. package/dist/cli/commands/test.js +95 -58
  65. package/dist/cli/commands/verify.js +7 -7
  66. package/dist/cli/commands/web.d.ts +11 -0
  67. package/dist/cli/commands/web.js +373 -0
  68. package/dist/cli/index.d.ts +2 -1
  69. package/dist/cli/index.js +3 -1
  70. package/dist/index.d.ts +4 -2
  71. package/dist/index.js +3 -1
  72. package/dist/packages/agents/lib/execution.js +4 -2
  73. package/dist/packages/agents/lib/executors.d.ts +1 -0
  74. package/dist/packages/agents/lib/executors.js +1 -0
  75. package/dist/packages/agents/lib/render.d.ts +2 -2
  76. package/dist/packages/agents/lib/render.js +10 -9
  77. package/dist/packages/agents/lib/shells.d.ts +3 -11
  78. package/dist/packages/agents/lib/shells.js +58 -106
  79. package/dist/packages/agents/lib/types.d.ts +1 -0
  80. package/dist/packages/compiler/compiled-paths.d.ts +4 -1
  81. package/dist/packages/compiler/compiled-paths.js +8 -2
  82. package/dist/packages/compiler/compiled-pipeline.d.ts +7 -0
  83. package/dist/packages/compiler/compiled-pipeline.js +15 -4
  84. package/dist/packages/compiler/compiled-schema.js +1 -1
  85. package/dist/packages/compiler/compiled-stage-plan.d.ts +2 -2
  86. package/dist/packages/compiler/compiled-stage-plan.js +4 -4
  87. package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -0
  88. package/dist/packages/compiler/compiled-stage-runner.js +50 -2
  89. package/dist/packages/compiler/compiled-target.d.ts +1 -1
  90. package/dist/packages/compiler/compiled-target.js +2 -2
  91. package/dist/packages/compiler/lib/schema.d.ts +161 -1
  92. package/dist/packages/compiler/lib/schema.js +87 -1
  93. package/dist/packages/compiler/raw-snapshot.d.ts +9 -2
  94. package/dist/packages/compiler/runtime-acceptance.js +1 -1
  95. package/dist/packages/compiler/runtime-contracts.js +2 -2
  96. package/dist/packages/compiler/runtime-prompt.js +7 -7
  97. package/dist/packages/compiler/runtime-reconcile.js +3 -3
  98. package/dist/packages/compiler/runtime-runs.js +3 -0
  99. package/dist/packages/compiler/runtime-types.d.ts +1 -0
  100. package/dist/packages/compiler/state-health.js +1 -1
  101. package/dist/packages/compiler/state-view.js +2 -2
  102. package/dist/packages/compiler/validate-compiled.js +11 -9
  103. package/dist/packages/execution/adapters.d.ts +15 -0
  104. package/dist/packages/execution/adapters.js +1 -0
  105. package/dist/packages/execution/events.d.ts +8 -0
  106. package/dist/packages/execution/events.js +16 -0
  107. package/dist/packages/execution/index.d.ts +9 -0
  108. package/dist/packages/execution/index.js +6 -0
  109. package/dist/packages/execution/lib/schema.d.ts +1554 -0
  110. package/dist/packages/execution/lib/schema.js +319 -0
  111. package/dist/packages/local-service/action-values.d.ts +23 -0
  112. package/dist/packages/local-service/action-values.js +31 -0
  113. package/dist/packages/local-service/client.d.ts +119 -0
  114. package/dist/packages/local-service/client.js +356 -0
  115. package/dist/packages/local-service/index.d.ts +15 -0
  116. package/dist/packages/local-service/index.js +11 -0
  117. package/dist/packages/local-service/lib/schema.d.ts +7355 -0
  118. package/dist/packages/local-service/lib/schema.js +636 -0
  119. package/dist/packages/local-service/routes.d.ts +27 -0
  120. package/dist/packages/local-service/routes.js +32 -0
  121. package/dist/packages/local-service/runtime.d.ts +134 -0
  122. package/dist/packages/local-service/runtime.js +2841 -0
  123. package/dist/packages/local-service/server.d.ts +17 -0
  124. package/dist/packages/local-service/server.js +572 -0
  125. package/dist/packages/project-model/index.d.ts +2 -1
  126. package/dist/packages/project-model/index.js +1 -0
  127. package/dist/packages/project-model/interf-detect.d.ts +6 -2
  128. package/dist/packages/project-model/interf-detect.js +48 -19
  129. package/dist/packages/project-model/interf-scaffold.d.ts +1 -0
  130. package/dist/packages/project-model/interf-scaffold.js +39 -17
  131. package/dist/packages/project-model/interf.d.ts +2 -2
  132. package/dist/packages/project-model/interf.js +2 -2
  133. package/dist/packages/project-model/lib/schema.d.ts +80 -6
  134. package/dist/packages/project-model/lib/schema.js +29 -19
  135. package/dist/packages/project-model/project-paths.d.ts +3 -1
  136. package/dist/packages/project-model/project-paths.js +6 -2
  137. package/dist/packages/project-model/source-config.d.ts +25 -11
  138. package/dist/packages/project-model/source-config.js +152 -82
  139. package/dist/packages/project-model/source-folders.d.ts +11 -0
  140. package/dist/packages/project-model/source-folders.js +110 -0
  141. package/dist/packages/testing/test-execution.js +5 -5
  142. package/dist/packages/testing/test-paths.js +4 -3
  143. package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
  144. package/dist/packages/workflow-authoring/workflow-authoring.js +46 -85
  145. package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
  146. package/dist/packages/workflow-authoring/workflow-edit-session.js +83 -49
  147. package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
  148. package/dist/packages/workflow-package/context-interface.js +2 -2
  149. package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
  150. package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
  151. package/dist/packages/workflow-package/local-workflows.js +33 -17
  152. package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
  153. package/dist/packages/workflow-package/workflow-definitions.js +23 -22
  154. package/dist/packages/workflow-package/workflow-helpers.js +10 -6
  155. package/dist/packages/workflow-package/workflow-review-paths.js +5 -1
  156. package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
  157. package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
  158. package/package.json +18 -4
  159. package/dist/cli/commands/dataset-selection.d.ts +0 -6
  160. package/dist/cli/commands/dataset-selection.js +0 -11
  161. package/dist/lib/agent-args.d.ts +0 -1
  162. package/dist/lib/agent-args.js +0 -1
  163. package/dist/lib/agent-constants.d.ts +0 -1
  164. package/dist/lib/agent-constants.js +0 -1
  165. package/dist/lib/agent-detection.d.ts +0 -1
  166. package/dist/lib/agent-detection.js +0 -1
  167. package/dist/lib/agent-execution.d.ts +0 -1
  168. package/dist/lib/agent-execution.js +0 -1
  169. package/dist/lib/agent-logs.d.ts +0 -1
  170. package/dist/lib/agent-logs.js +0 -1
  171. package/dist/lib/agent-preflight.d.ts +0 -1
  172. package/dist/lib/agent-preflight.js +0 -1
  173. package/dist/lib/agent-render.d.ts +0 -1
  174. package/dist/lib/agent-render.js +0 -1
  175. package/dist/lib/agent-shells.d.ts +0 -1
  176. package/dist/lib/agent-shells.js +0 -1
  177. package/dist/lib/agent-status.d.ts +0 -1
  178. package/dist/lib/agent-status.js +0 -1
  179. package/dist/lib/agent-types.d.ts +0 -1
  180. package/dist/lib/agent-types.js +0 -1
  181. package/dist/lib/agents.d.ts +0 -1
  182. package/dist/lib/agents.js +0 -1
  183. package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
  184. package/dist/lib/builtin-compiled-workflow.js +0 -1
  185. package/dist/lib/chart-guidance.d.ts +0 -1
  186. package/dist/lib/chart-guidance.js +0 -1
  187. package/dist/lib/compiled-compile.d.ts +0 -1
  188. package/dist/lib/compiled-compile.js +0 -1
  189. package/dist/lib/compiled-paths.d.ts +0 -1
  190. package/dist/lib/compiled-paths.js +0 -3
  191. package/dist/lib/compiled-raw.d.ts +0 -1
  192. package/dist/lib/compiled-raw.js +0 -3
  193. package/dist/lib/compiled-reset.d.ts +0 -1
  194. package/dist/lib/compiled-reset.js +0 -3
  195. package/dist/lib/compiled-schema.d.ts +0 -1
  196. package/dist/lib/compiled-schema.js +0 -1
  197. package/dist/lib/discovery.d.ts +0 -1
  198. package/dist/lib/discovery.js +0 -1
  199. package/dist/lib/execution-profile.d.ts +0 -1
  200. package/dist/lib/execution-profile.js +0 -1
  201. package/dist/lib/executors.d.ts +0 -1
  202. package/dist/lib/executors.js +0 -1
  203. package/dist/lib/filesystem.d.ts +0 -1
  204. package/dist/lib/filesystem.js +0 -1
  205. package/dist/lib/interf-bootstrap.d.ts +0 -1
  206. package/dist/lib/interf-bootstrap.js +0 -3
  207. package/dist/lib/interf-detect.d.ts +0 -1
  208. package/dist/lib/interf-detect.js +0 -3
  209. package/dist/lib/interf-scaffold.d.ts +0 -1
  210. package/dist/lib/interf-scaffold.js +0 -3
  211. package/dist/lib/interf-workflow-package.d.ts +0 -1
  212. package/dist/lib/interf-workflow-package.js +0 -1
  213. package/dist/lib/interf.d.ts +0 -1
  214. package/dist/lib/interf.js +0 -3
  215. package/dist/lib/local-workflows.d.ts +0 -1
  216. package/dist/lib/local-workflows.js +0 -1
  217. package/dist/lib/logger.d.ts +0 -1
  218. package/dist/lib/logger.js +0 -1
  219. package/dist/lib/package-root.d.ts +0 -1
  220. package/dist/lib/package-root.js +0 -1
  221. package/dist/lib/parse.d.ts +0 -1
  222. package/dist/lib/parse.js +0 -1
  223. package/dist/lib/project-paths.d.ts +0 -1
  224. package/dist/lib/project-paths.js +0 -3
  225. package/dist/lib/runtime-acceptance.d.ts +0 -1
  226. package/dist/lib/runtime-acceptance.js +0 -1
  227. package/dist/lib/runtime-contracts.d.ts +0 -1
  228. package/dist/lib/runtime-contracts.js +0 -1
  229. package/dist/lib/runtime-inventory.d.ts +0 -1
  230. package/dist/lib/runtime-inventory.js +0 -1
  231. package/dist/lib/runtime-paths.d.ts +0 -1
  232. package/dist/lib/runtime-paths.js +0 -1
  233. package/dist/lib/runtime-prompt.d.ts +0 -1
  234. package/dist/lib/runtime-prompt.js +0 -1
  235. package/dist/lib/runtime-reconcile.d.ts +0 -1
  236. package/dist/lib/runtime-reconcile.js +0 -1
  237. package/dist/lib/runtime-runs.d.ts +0 -1
  238. package/dist/lib/runtime-runs.js +0 -1
  239. package/dist/lib/runtime-types.d.ts +0 -1
  240. package/dist/lib/runtime-types.js +0 -1
  241. package/dist/lib/runtime.d.ts +0 -1
  242. package/dist/lib/runtime.js +0 -1
  243. package/dist/lib/schema.d.ts +0 -4
  244. package/dist/lib/schema.js +0 -6
  245. package/dist/lib/source-config.d.ts +0 -1
  246. package/dist/lib/source-config.js +0 -3
  247. package/dist/lib/state-artifacts.d.ts +0 -1
  248. package/dist/lib/state-artifacts.js +0 -1
  249. package/dist/lib/state-health.d.ts +0 -1
  250. package/dist/lib/state-health.js +0 -1
  251. package/dist/lib/state-io.d.ts +0 -1
  252. package/dist/lib/state-io.js +0 -1
  253. package/dist/lib/state-paths.d.ts +0 -1
  254. package/dist/lib/state-paths.js +0 -1
  255. package/dist/lib/state-view.d.ts +0 -1
  256. package/dist/lib/state-view.js +0 -1
  257. package/dist/lib/state.d.ts +0 -1
  258. package/dist/lib/state.js +0 -1
  259. package/dist/lib/test-execution.d.ts +0 -1
  260. package/dist/lib/test-execution.js +0 -3
  261. package/dist/lib/test-matrices.d.ts +0 -1
  262. package/dist/lib/test-matrices.js +0 -3
  263. package/dist/lib/test-paths.d.ts +0 -1
  264. package/dist/lib/test-paths.js +0 -3
  265. package/dist/lib/test-profile-presets.d.ts +0 -1
  266. package/dist/lib/test-profile-presets.js +0 -3
  267. package/dist/lib/test-sandbox.d.ts +0 -1
  268. package/dist/lib/test-sandbox.js +0 -3
  269. package/dist/lib/test-specs.d.ts +0 -1
  270. package/dist/lib/test-specs.js +0 -3
  271. package/dist/lib/test-targets.d.ts +0 -1
  272. package/dist/lib/test-targets.js +0 -3
  273. package/dist/lib/test-types.d.ts +0 -1
  274. package/dist/lib/test-types.js +0 -3
  275. package/dist/lib/test.d.ts +0 -1
  276. package/dist/lib/test.js +0 -3
  277. package/dist/lib/util.d.ts +0 -1
  278. package/dist/lib/util.js +0 -1
  279. package/dist/lib/validate-compiled.d.ts +0 -1
  280. package/dist/lib/validate-compiled.js +0 -1
  281. package/dist/lib/validate-helpers.d.ts +0 -1
  282. package/dist/lib/validate-helpers.js +0 -1
  283. package/dist/lib/validate.d.ts +0 -1
  284. package/dist/lib/validate.js +0 -1
  285. package/dist/lib/workflow-authoring.d.ts +0 -1
  286. package/dist/lib/workflow-authoring.js +0 -1
  287. package/dist/lib/workflow-definitions.d.ts +0 -1
  288. package/dist/lib/workflow-definitions.js +0 -1
  289. package/dist/lib/workflow-edit-session.d.ts +0 -1
  290. package/dist/lib/workflow-edit-session.js +0 -1
  291. package/dist/lib/workflow-edit-utils.d.ts +0 -1
  292. package/dist/lib/workflow-edit-utils.js +0 -1
  293. package/dist/lib/workflow-helpers.d.ts +0 -1
  294. package/dist/lib/workflow-helpers.js +0 -1
  295. package/dist/lib/workflow-improvement.d.ts +0 -1
  296. package/dist/lib/workflow-improvement.js +0 -1
  297. package/dist/lib/workflow-primitives.d.ts +0 -1
  298. package/dist/lib/workflow-primitives.js +0 -1
  299. package/dist/lib/workflow-review-paths.d.ts +0 -1
  300. package/dist/lib/workflow-review-paths.js +0 -1
  301. package/dist/lib/workflow-stage-policy.d.ts +0 -1
  302. package/dist/lib/workflow-stage-policy.js +0 -1
  303. package/dist/lib/workflow-stage-runner.d.ts +0 -1
  304. package/dist/lib/workflow-stage-runner.js +0 -1
  305. package/dist/lib/workflows.d.ts +0 -1
  306. package/dist/lib/workflows.js +0 -1
@@ -1,28 +1,35 @@
1
- import { mkdtempSync, rmSync, } from "node:fs";
2
- import { tmpdir } from "node:os";
3
- import { join } from "node:path";
1
+ import { rmSync } from "node:fs";
4
2
  import { createWorkflowAuthoringShell } from "../agents/lib/shells.js";
5
- import { seedLocalWorkflowPackageFromBase } from "../workflow-package/interf-workflow-package.js";
3
+ import { createScratchLocalWorkflowPackage } from "../workflow-package/interf-workflow-package.js";
6
4
  import { CONTEXT_INTERFACE_FILE } from "../workflow-package/context-interface.js";
7
5
  import { validateWorkflowPackage, workflowDefinitionPath } from "../workflow-package/local-workflows.js";
8
- import { createCompiled, compileCompiled } from "../compiler/workflows.js";
9
- import { projectRawSnapshot } from "../compiler/raw-snapshot.js";
10
6
  import { runWorkflowEditSession } from "./workflow-edit-session.js";
11
- import { copyDirectory } from "./lib/workflow-edit-utils.js";
12
7
  function buildWorkflowAuthoringPrompt() {
13
8
  return [
14
9
  "This is an automated Interf workflow-authoring run, not an open-ended chat session.",
15
10
  "Execute it now.",
16
- "Create one standalone workflow for the files and checks in this source folder.",
11
+ "Create one standalone workflow for the source data, desired portable-context outputs, and proof requirements in this source folder.",
17
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.",
18
14
  `Then read \`workflow/README.md\`, \`workflow/workflow.json\`, and \`workflow/${CONTEXT_INTERFACE_FILE}\`.`,
19
- "Review `artifacts/source-dataset/raw/` and any `artifacts/preview-compiled/` notes before editing the package.",
15
+ "The workflow directory starts as a neutral scaffold, not as a suggested workflow.",
16
+ "Replace the scaffold purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the method this work actually needs.",
17
+ "Review `artifacts/source-dataset/raw/` before editing the package.",
20
18
  "Prefer direct file-reading and search tools over shell commands for routine file inspection.",
21
19
  "Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
22
20
  "Edit only files under `workflow/`.",
23
21
  "Keep the workflow valid for the current compiler API and workflow schema.",
24
- "Make the package materially more specific to this dataset task than the seeded base workflow. A no-op copy is not acceptable.",
22
+ "Choose stage ids, stage order, reads, writes, acceptance criteria, and stage docs from the source data and preparation-and-evidence brief.",
23
+ "Do not preserve the placeholder `prepare` stage unless the final workflow genuinely needs a stage with that exact role.",
24
+ "When editing acceptance criteria: `zone_counts_at_least` maps declared zone ids to fixed numeric minimums.",
25
+ "`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.",
26
+ "Before stopping, verify every acceptance zone key is declared in `workflow.schema.json`.",
27
+ "For every stage in `workflow.json`, create `workflow/compile/stages/<skill_dir>/SKILL.md` and make the folder name exactly match that stage's `skill_dir`.",
28
+ "Every zone path in `workflow.schema.json` must be unique and non-overlapping. Do not declare both `knowledge/indexes` and `knowledge/indexes/some-file.md` as separate zones.",
29
+ "Make the package materially specific to this dataset task, output shape, and proof requirement. A no-op scaffold is not acceptable.",
25
30
  "Treat the workflow package as four aligned layers: purpose, inputs, context interface, and stages.",
31
+ "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.",
32
+ "Do not move the main entrypoint to `knowledge/home.md` or any other nested path.",
26
33
  "Prefer explicit stage-doc, stage-policy, purpose, input-contract, and context-interface edits over vague rewrites.",
27
34
  "Do not introduce wikilinks unless the workflow also creates the target note by exact basename or explicit relative path.",
28
35
  "Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
@@ -33,88 +40,42 @@ function buildWorkflowAuthoringPrompt() {
33
40
  "As soon as the workflow edits are complete, stop.",
34
41
  ].join("\n");
35
42
  }
36
- async function prepareWorkflowAuthoringPreview(options) {
37
- const tempRoot = mkdtempSync(join(tmpdir(), "interf-workflow-preview-"));
38
- projectRawSnapshot({
39
- sourcePath: options.datasetPath,
40
- destinationPath: tempRoot,
41
- compiledPath: tempRoot,
42
- mode: "copy",
43
- prune: true,
44
- preserveTimestamps: true,
45
- });
46
- copyDirectory(options.workflowPath, workflowDefinitionPath(tempRoot, options.workflowId));
47
- const compiledPath = createCompiled("preview", tempRoot, options.workflowId, options.about, tempRoot);
48
- const result = await compileCompiled({
49
- executor: options.executor,
50
- compiledPath,
51
- ...(options.reporter ? { reporter: options.reporter } : {}),
52
- preserveStageShells: "on-failure",
53
- });
54
- return {
55
- tempRoot,
56
- compiledPath,
57
- compileResult: {
58
- ok: result.ok,
59
- failedStage: result.failedStage,
60
- },
61
- };
62
- }
63
43
  export async function runWorkflowAuthoringDraft(options) {
64
- const workflowPath = seedLocalWorkflowPackageFromBase({
44
+ const workflowPath = createScratchLocalWorkflowPackage({
65
45
  sourcePath: options.sourcePath,
66
- baseWorkflowId: options.baseWorkflowId,
67
46
  workflowId: options.workflowId,
68
47
  label: options.label,
69
48
  hint: options.hint,
70
49
  });
71
- let preview = null;
72
- try {
73
- if (options.preparePreview !== false) {
74
- preview = await prepareWorkflowAuthoringPreview({
75
- datasetPath: options.datasetPath,
76
- about: options.taskPrompt,
77
- workflowId: options.workflowId,
78
- workflowPath,
79
- executor: options.executor,
80
- reporter: options.previewReporter ?? null,
81
- });
82
- }
83
- const shell = createWorkflowAuthoringShell({
84
- workflowPath,
85
- workflowId: options.workflowId,
86
- label: options.label,
87
- baseWorkflowId: options.baseWorkflowId,
88
- datasetPath: options.datasetPath,
89
- taskPrompt: options.taskPrompt,
90
- checks: options.checks ?? [],
91
- preview,
92
- });
93
- if (preview) {
94
- rmSync(preview.tempRoot, { recursive: true, force: true });
95
- preview = null;
96
- }
97
- const session = await runWorkflowEditSession({
98
- executor: options.executor,
99
- workflowPath,
100
- shell,
101
- prompt: buildWorkflowAuthoringPrompt(),
102
- validate: validateWorkflowPackage,
103
- });
104
- return {
105
- status: session.status,
106
- changed: session.changed,
107
- summary: session.summary,
108
- validation: session.validation,
109
- workflowPath,
110
- shellPath: shell.rootPath,
111
- };
112
- }
113
- finally {
114
- if (preview) {
115
- rmSync(preview.tempRoot, { recursive: true, force: true });
116
- }
50
+ const shell = createWorkflowAuthoringShell({
51
+ workflowPath,
52
+ workflowId: options.workflowId,
53
+ label: options.label,
54
+ referenceWorkflowId: options.baseWorkflowId ?? null,
55
+ datasetPath: options.datasetPath,
56
+ taskPrompt: options.taskPrompt,
57
+ checks: options.checks ?? [],
58
+ });
59
+ const session = await runWorkflowEditSession({
60
+ executor: options.executor,
61
+ workflowPath,
62
+ shell,
63
+ prompt: buildWorkflowAuthoringPrompt(),
64
+ validate: validateWorkflowPackage,
65
+ maxValidationRepairAttempts: 1,
66
+ onStatus: options.onStatus,
67
+ });
68
+ if (session.status !== "updated") {
69
+ rmSync(workflowPath, { recursive: true, force: true });
117
70
  }
71
+ return {
72
+ status: session.status,
73
+ changed: session.changed,
74
+ summary: session.summary,
75
+ validation: session.validation,
76
+ workflowPath,
77
+ shellPath: shell.rootPath,
78
+ };
118
79
  }
119
80
  export function resolveWorkflowDraftPath(sourcePath, workflowId) {
120
81
  return workflowDefinitionPath(sourcePath, workflowId);
@@ -13,4 +13,6 @@ export declare function runWorkflowEditSession(options: {
13
13
  shell: WorkflowEditShellArtifacts;
14
14
  prompt: string;
15
15
  validate: (workflowPath: string) => WorkflowValidationResult;
16
+ maxValidationRepairAttempts?: number;
17
+ onStatus?: (line: string) => void;
16
18
  }): Promise<WorkflowEditSessionResult>;
@@ -1,57 +1,91 @@
1
- import { writeFileSync } from "node:fs";
1
+ import { appendFileSync, writeFileSync } from "node:fs";
2
2
  import { copyDirectory, directoriesMatch, } from "./lib/workflow-edit-utils.js";
3
3
  export async function runWorkflowEditSession(options) {
4
4
  copyDirectory(options.workflowPath, options.shell.workflowBeforePath);
5
5
  writeFileSync(options.shell.promptLogPath, `${options.prompt}\n`);
6
- let code = 1;
7
- let executeError = null;
8
- try {
9
- code = await options.executor.execute(options.shell.rootPath, options.prompt, {
10
- eventLogPath: options.shell.eventLogPath,
11
- statusLogPath: options.shell.statusLogPath,
12
- });
13
- }
14
- catch (error) {
15
- executeError = error instanceof Error ? error.message : String(error);
16
- }
17
- copyDirectory(options.workflowPath, options.shell.workflowAfterPath);
18
- const changed = !directoriesMatch(options.shell.workflowBeforePath, options.shell.workflowAfterPath);
19
- if (executeError) {
20
- copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
21
- return {
22
- status: "executor-failed",
23
- changed,
24
- validation: null,
25
- summary: `Workflow editor failed before completing: ${executeError}`,
26
- };
27
- }
28
- if (code !== 0) {
29
- copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
30
- return {
31
- status: "executor-failed",
32
- changed,
33
- validation: null,
34
- summary: `Workflow editor exited with code ${code}.`,
35
- };
36
- }
37
- const validation = options.validate(options.workflowPath);
38
- if (!validation.ok) {
39
- copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
40
- return {
41
- status: "invalid",
42
- changed,
43
- validation,
44
- summary: changed
45
- ? `Workflow package failed validation: ${validation.summary}`
46
- : `Workflow package is invalid without any workflow edits: ${validation.summary}`,
47
- };
6
+ const maxValidationRepairAttempts = options.maxValidationRepairAttempts ?? 0;
7
+ let prompt = options.prompt;
8
+ for (let attempt = 0; attempt <= maxValidationRepairAttempts; attempt += 1) {
9
+ let code = 1;
10
+ let executeError = null;
11
+ try {
12
+ code = await options.executor.execute(options.shell.rootPath, prompt, {
13
+ eventLogPath: options.shell.eventLogPath,
14
+ statusLogPath: options.shell.statusLogPath,
15
+ onStatus: options.onStatus,
16
+ });
17
+ }
18
+ catch (error) {
19
+ executeError = error instanceof Error ? error.message : String(error);
20
+ }
21
+ copyDirectory(options.workflowPath, options.shell.workflowAfterPath);
22
+ const changed = !directoriesMatch(options.shell.workflowBeforePath, options.shell.workflowAfterPath);
23
+ if (executeError) {
24
+ copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
25
+ return {
26
+ status: "executor-failed",
27
+ changed,
28
+ validation: null,
29
+ summary: `Workflow editor failed before completing: ${executeError}`,
30
+ };
31
+ }
32
+ if (code !== 0) {
33
+ copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
34
+ return {
35
+ status: "executor-failed",
36
+ changed,
37
+ validation: null,
38
+ summary: `Workflow editor exited with code ${code}.`,
39
+ };
40
+ }
41
+ const validation = options.validate(options.workflowPath);
42
+ if (validation.ok) {
43
+ return {
44
+ status: changed ? "updated" : "no-change",
45
+ changed,
46
+ validation,
47
+ summary: changed
48
+ ? "Workflow package updated and validated."
49
+ : "Workflow package is valid without additional edits.",
50
+ };
51
+ }
52
+ const details = validation.errors.length > 0
53
+ ? `: ${validation.errors.slice(0, 6).join("; ")}`
54
+ : "";
55
+ if (!changed || attempt >= maxValidationRepairAttempts) {
56
+ copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
57
+ return {
58
+ status: "invalid",
59
+ changed,
60
+ validation,
61
+ summary: changed
62
+ ? `Workflow package failed validation: ${validation.summary}${details}`
63
+ : `Workflow package is invalid without any workflow edits: ${validation.summary}${details}`,
64
+ };
65
+ }
66
+ prompt = [
67
+ "This is an automated Interf Method validation-repair pass.",
68
+ "The previous edit did not pass package validation.",
69
+ "Fix only the validation errors below. Do not redesign the Method.",
70
+ "",
71
+ "Validation errors:",
72
+ ...validation.errors.slice(0, 12).map((error) => `- ${error}`),
73
+ "",
74
+ "Rules:",
75
+ "- Edit only files under `workflow/`.",
76
+ "- Keep every stage `skill_dir` matched by `workflow/compile/stages/<skill_dir>/SKILL.md`.",
77
+ "- Keep `workflow.schema.json` zone paths unique and non-overlapping.",
78
+ "- Keep acceptance zone keys declared in `workflow.schema.json`.",
79
+ "- Preserve root `home.md` as the main portable-context entrypoint when the Method writes an entrypoint.",
80
+ "- Stop as soon as the package should validate.",
81
+ ].join("\n");
82
+ appendFileSync(options.shell.promptLogPath, `\n\n---\n\n${prompt}\n`);
48
83
  }
84
+ copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
49
85
  return {
50
- status: changed ? "updated" : "no-change",
51
- changed,
52
- validation,
53
- summary: changed
54
- ? "Workflow package updated and validated."
55
- : "Workflow package is valid without additional edits.",
86
+ status: "invalid",
87
+ changed: true,
88
+ validation: null,
89
+ summary: "Workflow package failed validation.",
56
90
  };
57
91
  }
@@ -42,7 +42,7 @@ function buildLoopContext(options) {
42
42
  max_loops: options.maxLoops,
43
43
  max_attempts: options.maxAttempts,
44
44
  review_paths: resolveWorkflowImprovementReviewPaths(options.compiledPath),
45
- truth_checks: {
45
+ readiness_checks: {
46
46
  count: options.compiledConfig.checks.length,
47
47
  questions: options.compiledConfig.checks.map((check, index) => ({
48
48
  id: check.id ?? `check-${index + 1}`,
@@ -167,6 +167,7 @@ export async function runWorkflowImprovementLoop(options) {
167
167
  shell,
168
168
  prompt: buildWorkflowImprovementPrompt(),
169
169
  validate: validateWorkflowPackage,
170
+ maxValidationRepairAttempts: 1,
170
171
  });
171
172
  const preservedShellManifestPath = freezeWorkflowImprovementShell(shell.rootPath);
172
173
  writeWorkflowImprovementRunLedger(options.compiledPath, options.runId, buildWorkflowImprovementLoopRecord({
@@ -13,7 +13,7 @@ export const ContextInterfaceSchema = WorkflowCompiledSchemaSchema;
13
13
  export const ContextInterfaceZoneSchema = WorkflowCompiledZoneSchema;
14
14
  export const ContextInterfaceZoneIdSchema = WorkflowZoneIdSchema;
15
15
  export const ContextInterfaceZoneRoleSchema = WorkflowZoneRoleSchema;
16
- // Package-owned input contract for authoring, review, and future Studio flows.
16
+ // Package-owned input contract for authoring, review, and future authoring flows.
17
17
  // This does not change compiler execution semantics; it describes what data a
18
18
  // workflow expects to organize before the compiler materializes the context
19
19
  // interface on disk.
@@ -54,7 +54,7 @@ export function contextInterfaceExists(rootPath) {
54
54
  return existsSync(contextInterfaceFilePath(rootPath));
55
55
  }
56
56
  export function contextInterfaceRelativePath() {
57
- return `workflow/${CONTEXT_INTERFACE_FILE}`;
57
+ return `method/${CONTEXT_INTERFACE_FILE}`;
58
58
  }
59
59
  export function listContextInterfaceZones(contextInterface) {
60
60
  return [...contextInterface.zones];
@@ -23,3 +23,9 @@ export declare function seedLocalWorkflowPackageFromBase(options: {
23
23
  label: string;
24
24
  hint: string;
25
25
  }): string;
26
+ export declare function createScratchLocalWorkflowPackage(options: {
27
+ sourcePath: string;
28
+ workflowId: string;
29
+ label: string;
30
+ hint: string;
31
+ }): string;
@@ -135,7 +135,7 @@ function renderWorkflowReadme(workflow) {
135
135
  "",
136
136
  stageLines,
137
137
  "",
138
- "Interf runs the local copy of this package directly from `.interf/workflow/` inside each compiled context.",
138
+ "Interf runs the local copy of this package directly from `.interf/method/` inside each portable context.",
139
139
  "",
140
140
  ].join("\n");
141
141
  }
@@ -145,9 +145,10 @@ function renderDerivedWorkflowReadme(options) {
145
145
  "",
146
146
  options.hint,
147
147
  "",
148
- `This workflow package was copied from \`${options.baseWorkflowId}\` and materialized as a standalone package for this kind of work.`,
148
+ `This workflow package was forked from \`${options.baseWorkflowId}\` and materialized as a standalone package for this kind of work.`,
149
+ "It starts with that workflow's topology; edit the package when the work needs different stages, zones, or proof.",
149
150
  "",
150
- "Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance or fallback.",
151
+ "Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
151
152
  "",
152
153
  "## Emphasis",
153
154
  "",
@@ -163,9 +164,23 @@ function renderSeedWorkflowReadme(options) {
163
164
  "",
164
165
  options.hint,
165
166
  "",
166
- `This workflow package was seeded from \`${options.baseWorkflowId}\` as a standalone local draft.`,
167
+ `This workflow package was forked from \`${options.baseWorkflowId}\` as a standalone local package.`,
168
+ "It starts with that workflow's topology; edit the package when the work needs different stages, zones, or proof.",
167
169
  "",
168
- "Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance or runtime fallback.",
170
+ "Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance.",
171
+ "",
172
+ ].join("\n");
173
+ }
174
+ function renderScratchWorkflowReadme(options) {
175
+ return [
176
+ `# ${options.label}`,
177
+ "",
178
+ options.hint,
179
+ "",
180
+ "This workflow package is a neutral from-scratch authoring scaffold.",
181
+ "",
182
+ "It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
183
+ "Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the workflow this source data and task actually need.",
169
184
  "",
170
185
  ].join("\n");
171
186
  }
@@ -181,13 +196,13 @@ function renderImproveSkill(workflow) {
181
196
  "Default loop:",
182
197
  "1. Read the loop context first.",
183
198
  "2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
184
- "3. Edit only the local workflow package for this compiled context to create a better workflow variation for this kind of work.",
199
+ "3. Edit only the local Method package for this portable context to create a better Method variation for this kind of work.",
185
200
  `4. Keep purpose, inputs, \`workflow.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
186
201
  "",
187
202
  "Guardrails:",
188
203
  "- do not edit checks, test specs, or raw files",
189
204
  "- do not hardcode expected answers into workflow docs",
190
- "- keep this package standalone; do not add or rely on runtime `extends` or fallback behavior",
205
+ "- keep this package standalone; do not add or rely on runtime `extends`",
191
206
  "- keep the workflow stack coherent: purpose, inputs, context interface, and stages should describe the same job",
192
207
  "- prefer small, defensible workflow changes over random churn",
193
208
  "",
@@ -291,7 +306,7 @@ export function seedCompiledWorkflowPackage(options) {
291
306
  const sourceWorkflowPath = resolveWorkflowPackageSourcePath(options.sourcePath, resolvedWorkflow.id);
292
307
  if (sourceWorkflowPath && isPortableWorkflowPackage(sourceWorkflowPath)) {
293
308
  // Portable seed packages can be copied directly because compile runs the
294
- // local package folder without any source-root fallback.
309
+ // local package folder without reading source-root workflow packages.
295
310
  copyWorkflowPackageDirectory(sourceWorkflowPath, workflowPackagePath(options.compiledPath));
296
311
  patchWorkflowPackageMetadata(workflowPackagePath(options.compiledPath), {
297
312
  id: resolvedWorkflow.id,
@@ -387,3 +402,95 @@ export function seedLocalWorkflowPackageFromBase(options) {
387
402
  writeWorkflowPackageToDir(targetPath, localWorkflow);
388
403
  return targetPath;
389
404
  }
405
+ export function createScratchLocalWorkflowPackage(options) {
406
+ const targetPath = workflowDefinitionPath(options.sourcePath, options.workflowId);
407
+ const workflow = {
408
+ id: options.workflowId,
409
+ compilerApi: {
410
+ kind: "compiled",
411
+ version: 1,
412
+ },
413
+ purpose: {
414
+ label: "From-scratch workflow draft",
415
+ taskHint: "Replace this neutral scaffold with the workflow stages, outputs, and proof rules this work requires.",
416
+ },
417
+ inputs: [
418
+ {
419
+ id: "raw",
420
+ label: "Raw",
421
+ description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
422
+ required: true,
423
+ },
424
+ ],
425
+ label: options.label,
426
+ hint: options.hint,
427
+ recommended: false,
428
+ scope: "local",
429
+ contextInterface: {
430
+ kind: "workflow-schema",
431
+ version: 1,
432
+ target_type: "compiled",
433
+ label: `${options.label} workflow schema`,
434
+ zones: [
435
+ {
436
+ id: "raw",
437
+ role: "input",
438
+ path: "raw",
439
+ kind: "directory",
440
+ required: true,
441
+ owned_by: [],
442
+ description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
443
+ },
444
+ {
445
+ id: "draft-context",
446
+ role: "output",
447
+ path: "draft",
448
+ kind: "directory",
449
+ required: true,
450
+ owned_by: ["prepare"],
451
+ description: "Temporary placeholder output zone for the neutral authoring scaffold. Replace it with task-specific output zones.",
452
+ },
453
+ {
454
+ id: "runtime",
455
+ role: "runtime",
456
+ path: ".interf/runtime",
457
+ kind: "runtime",
458
+ required: true,
459
+ owned_by: [],
460
+ description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
461
+ },
462
+ ],
463
+ },
464
+ stages: [
465
+ {
466
+ id: "prepare",
467
+ label: "Prepare",
468
+ description: "Neutral placeholder stage for workflow authoring. Replace this stage with the topology this work needs.",
469
+ contractType: "workflow-draft-stage",
470
+ skillDir: "prepare",
471
+ reads: ["raw", "runtime"],
472
+ writes: ["draft-context"],
473
+ acceptance: {
474
+ stage_truthy: ["finished_at"],
475
+ },
476
+ },
477
+ ],
478
+ stagePolicyNotes: {
479
+ prepare: [
480
+ "This is a neutral authoring scaffold, not a recommended workflow topology.",
481
+ "Replace this stage, output zone, and proof rule when drafting the final workflow.",
482
+ ],
483
+ },
484
+ starterDocs: [
485
+ {
486
+ relativePath: "README.md",
487
+ content: renderScratchWorkflowReadme({
488
+ label: options.label,
489
+ hint: options.hint,
490
+ }),
491
+ },
492
+ ],
493
+ };
494
+ writeWorkflowPackageToDir(targetPath, workflow);
495
+ return targetPath;
496
+ }
@@ -33,6 +33,9 @@ const LocalWorkflowDefinitionSchema = z.object({
33
33
  stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
34
34
  });
35
35
  function workflowRootPath(sourcePath) {
36
+ return join(sourcePath, "interf", "methods");
37
+ }
38
+ function legacyWorkflowRootPath(sourcePath) {
36
39
  return join(sourcePath, "interf", "workflows");
37
40
  }
38
41
  function builtinWorkflowRootPath(workflowId) {
@@ -41,6 +44,9 @@ function builtinWorkflowRootPath(workflowId) {
41
44
  export function workflowDefinitionPath(sourcePath, id) {
42
45
  return join(workflowRootPath(sourcePath), id);
43
46
  }
47
+ function legacyWorkflowDefinitionPath(sourcePath, id) {
48
+ return join(legacyWorkflowRootPath(sourcePath), id);
49
+ }
44
50
  function isSupportedWorkflowStarterDocPath(relativePath) {
45
51
  if (relativePath === "README.md")
46
52
  return true;
@@ -110,30 +116,36 @@ export function loadWorkflowDefinitionFromDir(dirPath) {
110
116
  };
111
117
  }
112
118
  export function listLocalWorkflowDefinitions(sourcePath) {
113
- const root = workflowRootPath(sourcePath);
114
- if (!existsSync(root))
115
- return [];
116
- return readdirSync(root)
117
- .map((entry) => join(root, entry))
118
- .filter((entryPath) => {
119
- try {
120
- return statSync(entryPath).isDirectory();
121
- }
122
- catch {
123
- return false;
119
+ const definitions = new Map();
120
+ for (const root of [legacyWorkflowRootPath(sourcePath), workflowRootPath(sourcePath)]) {
121
+ if (!existsSync(root))
122
+ continue;
123
+ for (const entryPath of readdirSync(root).map((entry) => join(root, entry))) {
124
+ try {
125
+ if (!statSync(entryPath).isDirectory())
126
+ continue;
127
+ }
128
+ catch {
129
+ continue;
130
+ }
131
+ const definition = loadWorkflowDefinitionFromDir(entryPath);
132
+ if (definition)
133
+ definitions.set(definition.id, definition);
124
134
  }
125
- })
126
- .map((entryPath) => loadWorkflowDefinitionFromDir(entryPath))
127
- .filter((definition) => definition !== null)
128
- .sort((a, b) => a.label.localeCompare(b.label));
135
+ }
136
+ return [...definitions.values()].sort((a, b) => a.label.localeCompare(b.label));
129
137
  }
130
138
  export function loadLocalWorkflowDefinition(sourcePath, id) {
131
- return loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id));
139
+ return (loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id)) ??
140
+ loadWorkflowDefinitionFromDir(legacyWorkflowDefinitionPath(sourcePath, id)));
132
141
  }
133
142
  export function resolveWorkflowPackageSourcePath(sourcePath, workflowId) {
134
143
  const localPath = workflowDefinitionPath(sourcePath, workflowId);
135
144
  if (existsSync(join(localPath, "workflow.json")))
136
145
  return localPath;
146
+ const legacyLocalPath = legacyWorkflowDefinitionPath(sourcePath, workflowId);
147
+ if (existsSync(join(legacyLocalPath, "workflow.json")))
148
+ return legacyLocalPath;
137
149
  const builtinPath = builtinWorkflowRootPath(workflowId);
138
150
  if (existsSync(join(builtinPath, "workflow.json")))
139
151
  return builtinPath;
@@ -155,7 +167,11 @@ export function seedLocalDefaultWorkflow(options) {
155
167
  throw new Error(`Built-in "interf" workflow not found at ${builtinInterfPath}.`);
156
168
  }
157
169
  copyWorkflowPackageDirectory(builtinInterfPath, targetPath);
158
- patchWorkflowPackageMetadata(targetPath, { id: workflowId });
170
+ patchWorkflowPackageMetadata(targetPath, {
171
+ id: workflowId,
172
+ label: "Built-in Interf Workflow",
173
+ hint: "Built-in file-processing workflow: summarize source-grounded evidence, structure cross-file connections, and shape portable context around the saved readiness checks.",
174
+ });
159
175
  return { workflowId, targetPath, alreadyExisted: false };
160
176
  }
161
177
  export function isWorkflowId(value) {
@@ -61,7 +61,7 @@ export declare function listCompiledWorkflowChoices(sourcePath?: string): Workfl
61
61
  export declare function getCompiledWorkflow(workflowId: CompiledWorkflowId, options?: {
62
62
  sourcePath?: string;
63
63
  }): WorkflowDefinition<string>;
64
- export declare function getActiveCompiledWorkflow(compiledPath: string, fallbackWorkflowId: CompiledWorkflowId): WorkflowDefinition<string>;
64
+ export declare function getActiveCompiledWorkflow(compiledPath: string): WorkflowDefinition<string>;
65
65
  export declare function resolveCompiledWorkflowId(value: unknown): CompiledWorkflowId | null;
66
66
  export declare function resolveCompiledWorkflowFromConfig(config: unknown): CompiledWorkflowId | null;
67
67
  export declare function resolveRequiredCompiledWorkflowFromConfig(config: unknown, label?: string): CompiledWorkflowId;
@@ -75,8 +75,8 @@ export declare function getWorkflowStagePosition(workflowId: WorkflowId, stage:
75
75
  stages: string[];
76
76
  } | null;
77
77
  export declare function getWorkflowStages(workflowId: WorkflowId, sourcePath?: string): string[];
78
- export declare function getActiveCompiledStages(compiledPath: string, fallbackWorkflowId: WorkflowId): string[];
78
+ export declare function getActiveCompiledStages(compiledPath: string): string[];
79
79
  export declare function getWorkflowStagePolicyNotes(workflowId: WorkflowId, stage: string, sourcePath?: string): string[];
80
- export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, fallbackWorkflowId: WorkflowId, stage: string): string[];
81
- export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, fallbackWorkflowId: WorkflowId, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
82
- export declare function formatActiveCompiledWorkflowStageStep(compiledPath: string, fallbackWorkflowId: CompiledWorkflowId, stage: string): string;
80
+ export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, stage: string): string[];
81
+ export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
82
+ export declare function formatActiveCompiledWorkflowStageStep(compiledPath: string, stage: string): string;