@interf/compiler 0.7.3 → 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 (302) hide show
  1. package/README.md +123 -89
  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 +4 -4
  33. package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
  34. package/builtin-workflows/interf/improve/SKILL.md +1 -1
  35. package/builtin-workflows/interf/use/query/SKILL.md +1 -1
  36. package/builtin-workflows/interf/workflow.json +8 -8
  37. package/builtin-workflows/interf/workflow.schema.json +1 -1
  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 +6 -0
  48. package/dist/cli/commands/create-workflow-wizard.js +191 -77
  49. package/dist/cli/commands/create.js +54 -40
  50. package/dist/cli/commands/default.js +4 -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 +326 -76
  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 -3
  59. package/dist/cli/commands/source-config-wizard.js +175 -197
  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 +31 -31
  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 +45 -96
  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 +7 -1
  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 +6 -6
  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 +25 -10
  129. package/dist/packages/project-model/interf-scaffold.js +9 -6
  130. package/dist/packages/project-model/interf.d.ts +1 -1
  131. package/dist/packages/project-model/interf.js +1 -1
  132. package/dist/packages/project-model/lib/schema.d.ts +80 -6
  133. package/dist/packages/project-model/lib/schema.js +29 -19
  134. package/dist/packages/project-model/source-config.d.ts +22 -13
  135. package/dist/packages/project-model/source-config.js +140 -123
  136. package/dist/packages/project-model/source-folders.d.ts +11 -0
  137. package/dist/packages/project-model/source-folders.js +110 -0
  138. package/dist/packages/testing/test-execution.js +5 -5
  139. package/dist/packages/testing/test-paths.js +1 -3
  140. package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
  141. package/dist/packages/workflow-authoring/workflow-authoring.js +45 -86
  142. package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
  143. package/dist/packages/workflow-authoring/workflow-edit-session.js +80 -49
  144. package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
  145. package/dist/packages/workflow-package/context-interface.js +1 -1
  146. package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
  147. package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
  148. package/dist/packages/workflow-package/local-workflows.js +33 -17
  149. package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
  150. package/dist/packages/workflow-package/workflow-definitions.js +23 -22
  151. package/dist/packages/workflow-package/workflow-helpers.js +10 -6
  152. package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
  153. package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
  154. package/package.json +17 -1
  155. package/dist/cli/commands/dataset-selection.d.ts +0 -6
  156. package/dist/cli/commands/dataset-selection.js +0 -11
  157. package/dist/lib/agent-args.d.ts +0 -1
  158. package/dist/lib/agent-args.js +0 -1
  159. package/dist/lib/agent-constants.d.ts +0 -1
  160. package/dist/lib/agent-constants.js +0 -1
  161. package/dist/lib/agent-detection.d.ts +0 -1
  162. package/dist/lib/agent-detection.js +0 -1
  163. package/dist/lib/agent-execution.d.ts +0 -1
  164. package/dist/lib/agent-execution.js +0 -1
  165. package/dist/lib/agent-logs.d.ts +0 -1
  166. package/dist/lib/agent-logs.js +0 -1
  167. package/dist/lib/agent-preflight.d.ts +0 -1
  168. package/dist/lib/agent-preflight.js +0 -1
  169. package/dist/lib/agent-render.d.ts +0 -1
  170. package/dist/lib/agent-render.js +0 -1
  171. package/dist/lib/agent-shells.d.ts +0 -1
  172. package/dist/lib/agent-shells.js +0 -1
  173. package/dist/lib/agent-status.d.ts +0 -1
  174. package/dist/lib/agent-status.js +0 -1
  175. package/dist/lib/agent-types.d.ts +0 -1
  176. package/dist/lib/agent-types.js +0 -1
  177. package/dist/lib/agents.d.ts +0 -1
  178. package/dist/lib/agents.js +0 -1
  179. package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
  180. package/dist/lib/builtin-compiled-workflow.js +0 -1
  181. package/dist/lib/chart-guidance.d.ts +0 -1
  182. package/dist/lib/chart-guidance.js +0 -1
  183. package/dist/lib/compiled-compile.d.ts +0 -1
  184. package/dist/lib/compiled-compile.js +0 -1
  185. package/dist/lib/compiled-paths.d.ts +0 -1
  186. package/dist/lib/compiled-paths.js +0 -3
  187. package/dist/lib/compiled-raw.d.ts +0 -1
  188. package/dist/lib/compiled-raw.js +0 -3
  189. package/dist/lib/compiled-reset.d.ts +0 -1
  190. package/dist/lib/compiled-reset.js +0 -3
  191. package/dist/lib/compiled-schema.d.ts +0 -1
  192. package/dist/lib/compiled-schema.js +0 -1
  193. package/dist/lib/discovery.d.ts +0 -1
  194. package/dist/lib/discovery.js +0 -1
  195. package/dist/lib/execution-profile.d.ts +0 -1
  196. package/dist/lib/execution-profile.js +0 -1
  197. package/dist/lib/executors.d.ts +0 -1
  198. package/dist/lib/executors.js +0 -1
  199. package/dist/lib/filesystem.d.ts +0 -1
  200. package/dist/lib/filesystem.js +0 -1
  201. package/dist/lib/interf-bootstrap.d.ts +0 -1
  202. package/dist/lib/interf-bootstrap.js +0 -3
  203. package/dist/lib/interf-detect.d.ts +0 -1
  204. package/dist/lib/interf-detect.js +0 -3
  205. package/dist/lib/interf-scaffold.d.ts +0 -1
  206. package/dist/lib/interf-scaffold.js +0 -3
  207. package/dist/lib/interf-workflow-package.d.ts +0 -1
  208. package/dist/lib/interf-workflow-package.js +0 -1
  209. package/dist/lib/interf.d.ts +0 -1
  210. package/dist/lib/interf.js +0 -3
  211. package/dist/lib/local-workflows.d.ts +0 -1
  212. package/dist/lib/local-workflows.js +0 -1
  213. package/dist/lib/logger.d.ts +0 -1
  214. package/dist/lib/logger.js +0 -1
  215. package/dist/lib/package-root.d.ts +0 -1
  216. package/dist/lib/package-root.js +0 -1
  217. package/dist/lib/parse.d.ts +0 -1
  218. package/dist/lib/parse.js +0 -1
  219. package/dist/lib/project-paths.d.ts +0 -1
  220. package/dist/lib/project-paths.js +0 -3
  221. package/dist/lib/runtime-acceptance.d.ts +0 -1
  222. package/dist/lib/runtime-acceptance.js +0 -1
  223. package/dist/lib/runtime-contracts.d.ts +0 -1
  224. package/dist/lib/runtime-contracts.js +0 -1
  225. package/dist/lib/runtime-inventory.d.ts +0 -1
  226. package/dist/lib/runtime-inventory.js +0 -1
  227. package/dist/lib/runtime-paths.d.ts +0 -1
  228. package/dist/lib/runtime-paths.js +0 -1
  229. package/dist/lib/runtime-prompt.d.ts +0 -1
  230. package/dist/lib/runtime-prompt.js +0 -1
  231. package/dist/lib/runtime-reconcile.d.ts +0 -1
  232. package/dist/lib/runtime-reconcile.js +0 -1
  233. package/dist/lib/runtime-runs.d.ts +0 -1
  234. package/dist/lib/runtime-runs.js +0 -1
  235. package/dist/lib/runtime-types.d.ts +0 -1
  236. package/dist/lib/runtime-types.js +0 -1
  237. package/dist/lib/runtime.d.ts +0 -1
  238. package/dist/lib/runtime.js +0 -1
  239. package/dist/lib/schema.d.ts +0 -4
  240. package/dist/lib/schema.js +0 -6
  241. package/dist/lib/source-config.d.ts +0 -1
  242. package/dist/lib/source-config.js +0 -3
  243. package/dist/lib/state-artifacts.d.ts +0 -1
  244. package/dist/lib/state-artifacts.js +0 -1
  245. package/dist/lib/state-health.d.ts +0 -1
  246. package/dist/lib/state-health.js +0 -1
  247. package/dist/lib/state-io.d.ts +0 -1
  248. package/dist/lib/state-io.js +0 -1
  249. package/dist/lib/state-paths.d.ts +0 -1
  250. package/dist/lib/state-paths.js +0 -1
  251. package/dist/lib/state-view.d.ts +0 -1
  252. package/dist/lib/state-view.js +0 -1
  253. package/dist/lib/state.d.ts +0 -1
  254. package/dist/lib/state.js +0 -1
  255. package/dist/lib/test-execution.d.ts +0 -1
  256. package/dist/lib/test-execution.js +0 -3
  257. package/dist/lib/test-matrices.d.ts +0 -1
  258. package/dist/lib/test-matrices.js +0 -3
  259. package/dist/lib/test-paths.d.ts +0 -1
  260. package/dist/lib/test-paths.js +0 -3
  261. package/dist/lib/test-profile-presets.d.ts +0 -1
  262. package/dist/lib/test-profile-presets.js +0 -3
  263. package/dist/lib/test-sandbox.d.ts +0 -1
  264. package/dist/lib/test-sandbox.js +0 -3
  265. package/dist/lib/test-specs.d.ts +0 -1
  266. package/dist/lib/test-specs.js +0 -3
  267. package/dist/lib/test-targets.d.ts +0 -1
  268. package/dist/lib/test-targets.js +0 -3
  269. package/dist/lib/test-types.d.ts +0 -1
  270. package/dist/lib/test-types.js +0 -3
  271. package/dist/lib/test.d.ts +0 -1
  272. package/dist/lib/test.js +0 -3
  273. package/dist/lib/util.d.ts +0 -1
  274. package/dist/lib/util.js +0 -1
  275. package/dist/lib/validate-compiled.d.ts +0 -1
  276. package/dist/lib/validate-compiled.js +0 -1
  277. package/dist/lib/validate-helpers.d.ts +0 -1
  278. package/dist/lib/validate-helpers.js +0 -1
  279. package/dist/lib/validate.d.ts +0 -1
  280. package/dist/lib/validate.js +0 -1
  281. package/dist/lib/workflow-authoring.d.ts +0 -1
  282. package/dist/lib/workflow-authoring.js +0 -1
  283. package/dist/lib/workflow-definitions.d.ts +0 -1
  284. package/dist/lib/workflow-definitions.js +0 -1
  285. package/dist/lib/workflow-edit-session.d.ts +0 -1
  286. package/dist/lib/workflow-edit-session.js +0 -1
  287. package/dist/lib/workflow-edit-utils.d.ts +0 -1
  288. package/dist/lib/workflow-edit-utils.js +0 -1
  289. package/dist/lib/workflow-helpers.d.ts +0 -1
  290. package/dist/lib/workflow-helpers.js +0 -1
  291. package/dist/lib/workflow-improvement.d.ts +0 -1
  292. package/dist/lib/workflow-improvement.js +0 -1
  293. package/dist/lib/workflow-primitives.d.ts +0 -1
  294. package/dist/lib/workflow-primitives.js +0 -1
  295. package/dist/lib/workflow-review-paths.d.ts +0 -1
  296. package/dist/lib/workflow-review-paths.js +0 -1
  297. package/dist/lib/workflow-stage-policy.d.ts +0 -1
  298. package/dist/lib/workflow-stage-policy.js +0 -1
  299. package/dist/lib/workflow-stage-runner.d.ts +0 -1
  300. package/dist/lib/workflow-stage-runner.js +0 -1
  301. package/dist/lib/workflows.d.ts +0 -1
  302. package/dist/lib/workflows.js +0 -1
@@ -58,21 +58,21 @@ export function renderCompiledAgents(compiledPath, name, workflowId, about, opti
58
58
  "",
59
59
  "## How this portable context works",
60
60
  "",
61
- "- The workflow package defines the context interface this portable context implements on disk.",
62
- "- `.interf/interf.json` points to the local `raw/` snapshot via `source.path` and back to the project root via `source.control_path`.",
63
- `- Workflow seed: \`${workflowOriginSelected}\`.`,
61
+ "- The Method package defines the context interface this portable context implements on disk.",
62
+ "- `.interf/interf.json` points to the local `raw/` snapshot via `source.path` and back to the Interf Workspace via `source.control_path`.",
63
+ `- Method seed: \`${workflowOriginSelected}\`.`,
64
64
  ...(workflowLocalDraft
65
- ? ["- This portable context now carries a local workflow draft improved from that seed. Recompiling this portable context reuses the local `.interf/workflow/` package."]
65
+ ? ["- This portable context now carries a local Method draft improved from that seed. Recompiling this portable context reuses the local `.interf/method/` package."]
66
66
  : []),
67
- `- Active local workflow id: \`${workflowId}\`.`,
68
- "- `.interf/workflow/` is the local editable method package for this portable context.",
69
- `- \`.interf/workflow/${WORKFLOW_SCHEMA_FILE}\` is the deterministic context interface for this portable context.`,
70
- "- `.interf/workflow/improve/` is the editable source for workflow-improvement loops.",
71
- "- `.interf/workflow/use/query/` is the editable source for the generated native query shell.",
72
- "- `.interf/workflow/compile/stages/` defines stage-specific docs that Interf projects into native execution shells for automated runs.",
67
+ `- Active local Method id: \`${workflowId}\`.`,
68
+ "- `.interf/method/` is the local editable Method package for this portable context.",
69
+ `- \`.interf/method/${WORKFLOW_SCHEMA_FILE}\` is the deterministic context interface for this portable context.`,
70
+ "- `.interf/method/improve/` is the editable source for Method-improvement loops.",
71
+ "- `.interf/method/use/query/` is the editable source for the generated native query shell.",
72
+ "- `.interf/method/compile/stages/` defines stage-specific docs that Interf projects into native execution shells for automated runs.",
73
73
  "- Native local query skills are generated under local agent skill directories such as `.claude/skills/` and `.codex/skills/`.",
74
74
  "- `raw/` contains the local raw snapshot used for evidence and verification.",
75
- `- Workflow zones are declared in \`.interf/workflow/${WORKFLOW_SCHEMA_FILE}\`.`,
75
+ `- Method zones are declared in \`.interf/method/${WORKFLOW_SCHEMA_FILE}\`.`,
76
76
  ...zoneLines,
77
77
  "- `.interf/runtime/` holds runtime artifacts written by Interf.",
78
78
  "- `.interf/tests/` mirrors the latest saved comparison and keeps detailed target runs plus preserved sandboxes.",
@@ -80,9 +80,9 @@ export function renderCompiledAgents(compiledPath, name, workflowId, about, opti
80
80
  "",
81
81
  "## Manual query rules",
82
82
  "",
83
- "- Prefer the workflow-declared context outputs before `raw/`.",
84
- "- Use the generated native `interf-query` skill for manual querying. The editable source lives at `.interf/workflow/use/query/SKILL.md`.",
85
- "- Treat `.interf/` as method/runtime metadata, not answer evidence, unless explicitly asked to inspect workflow or test history.",
83
+ "- Prefer the Method-declared context outputs before `raw/`.",
84
+ "- Use the generated native `interf-query` skill for manual querying. The editable source lives at `.interf/method/use/query/SKILL.md`.",
85
+ "- Treat `.interf/` as method/runtime metadata, not answer evidence, unless explicitly asked to inspect Method or test history.",
86
86
  "- Use `raw/` for quotes, verification, ambiguity, or evidence the portable context does not expose well.",
87
87
  "- If exact chart, table, or image-derived evidence matters, inspect the raw source and say whether the answer was text-derived, table-derived, or chart-derived.",
88
88
  "",
@@ -111,16 +111,16 @@ export function renderCompiledQuerySkill() {
111
111
  "This file is the editable authoring source for the generated native local `interf-query` skill.",
112
112
  "",
113
113
  "Default loop:",
114
- "1. Read `workflow/README.md` and this file first.",
115
- `2. Use the workflow zones declared in \`workflow/${WORKFLOW_SCHEMA_FILE}\` before falling back to \`raw/\`.`,
114
+ "1. Read `.interf/method/README.md` and this file first.",
115
+ `2. Use the Method zones declared in \`.interf/method/${WORKFLOW_SCHEMA_FILE}\` before consulting \`raw/\`.`,
116
116
  "3. Use `raw/` for direct quotes, verification, exact lookups, and cases where the portable context is missing the needed evidence or is ambiguous.",
117
117
  "",
118
118
  "Answering rule:",
119
119
  "- do not modify files under `raw/`",
120
- "- treat the workflow as the method layer and the portable-context zones as the working retrieval surface",
120
+ "- treat the Method as the portable-context contract and use its zones as the working retrieval surface",
121
121
  "- say explicitly when an answer depends on approximation, bounded inference, or a raw-source re-check",
122
122
  "- use `raw/` to confirm source page, metric family, provenance, or exact wording when the portable context is missing the needed evidence or is ambiguous",
123
- "- do not invent navigation or note structure beyond what this workflow declares",
123
+ "- do not invent navigation or note structure beyond what this Method declares",
124
124
  "- when the portable context is insufficient, verify in `raw/` and then answer",
125
125
  "",
126
126
  "You can edit this file to bias manual question-answering behavior for this portable context.",
@@ -158,7 +158,7 @@ function renderRawTestQuerySkill() {
158
158
  "name: interf-query",
159
159
  "description: >",
160
160
  " Native local query skill for an Interf raw test shell. Use it only",
161
- " to answer baseline questions directly from `raw/`.",
161
+ " to answer source-files readiness checks directly from `raw/`.",
162
162
  "---",
163
163
  "",
164
164
  "# Interf Raw Test Query",
@@ -176,7 +176,7 @@ function renderRawTestQuerySkill() {
176
176
  function readCompiledQuerySkillSource(compiledPath) {
177
177
  const filePath = compiledQuerySkillSourcePath(compiledPath);
178
178
  if (!existsSync(filePath)) {
179
- throw new Error(`Missing compiled query skill source at ${filePath}. Interf compile runs the local workflow package directly, so reseed or repair this compiled context instead of auto-healing query docs.`);
179
+ throw new Error(`Missing compiled query skill source at ${filePath}. Interf compile runs the local Method package directly, so reseed or repair this portable context instead of auto-healing query docs.`);
180
180
  }
181
181
  return readFileSync(filePath, "utf8").trim();
182
182
  }
@@ -331,9 +331,9 @@ function renderStageExecutionAgents(compiledName, workflowId, stage) {
331
331
  "- `inputs/<zone-id>/` = read mounts for the current stage.",
332
332
  "- `outputs/<zone-id>/` = write mounts for the current stage.",
333
333
  "- For file zones, `runtime/paths.json` points to the exact file path inside those mount roots.",
334
- "- declared compiled zone paths are also projected at the shell root so workflow-relative contract paths stay valid.",
334
+ "- declared compiled zone paths are also projected at the shell root so Method-relative contract paths stay valid.",
335
335
  "- `runtime/` = stage contract and machine-readable path map for this shell.",
336
- "- `workflow/` = workflow metadata, workflow schema, and docs for the current stage only.",
336
+ "- `method/` = Method metadata, workflow schema, and docs for the current stage only.",
337
337
  "",
338
338
  "## Boundaries",
339
339
  "",
@@ -381,7 +381,7 @@ function renderStageExecutionSkill(stage, stageMethodDoc) {
381
381
  `- contract type: \`${stage.contractType}\``,
382
382
  `- reads: ${stage.reads.join(", ")}`,
383
383
  `- writes: ${stage.writes.join(", ")}`,
384
- `- editable source: \`workflow/compile/stages/${stage.skillDir}/SKILL.md\``,
384
+ `- editable source: \`method/compile/stages/${stage.skillDir}/SKILL.md\``,
385
385
  "",
386
386
  ...(stageMethodDoc
387
387
  ? [
@@ -399,14 +399,14 @@ function renderCompiledQueryNativeSkill(querySkillContent) {
399
399
  "name: interf-query",
400
400
  "description: >",
401
401
  " Native local query skill for this portable context built by Interf.",
402
- " Use it for manual questions against the portable context and raw fallback.",
402
+ " Use it for manual questions against the portable context and source files under raw/.",
403
403
  "---",
404
404
  "",
405
405
  "# Interf Query",
406
406
  "",
407
407
  "This is the native local query skill for portable context built by Interf.",
408
408
  "Use it when reading this portable context manually.",
409
- "Editable source: `.interf/workflow/use/query/SKILL.md`.",
409
+ "Editable source: `.interf/method/use/query/SKILL.md`.",
410
410
  "",
411
411
  querySkillContent.trim(),
412
412
  "",
@@ -655,7 +655,7 @@ function freezePreservedShell(rootPath, shellType) {
655
655
  }
656
656
  export function renderClaudeBootstrap(content) {
657
657
  return [
658
- "<!-- Generated compatibility mirror of AGENTS.md. Interf may rewrite this file. -->",
658
+ "<!-- Generated mirror of AGENTS.md. Interf may rewrite this file. -->",
659
659
  "",
660
660
  content.trimEnd(),
661
661
  "",
@@ -666,29 +666,33 @@ function renderWorkflowAuthoringAgents(options) {
666
666
  `# ${options.label} — Workflow Authoring Shell`,
667
667
  "",
668
668
  "This is an automated workflow-authoring shell generated by Interf.",
669
- "It exists to create or refine one standalone workflow from the source data, desired portable-context outputs, and proof requirements in this task.",
669
+ "It exists to create one standalone workflow from the source data, desired portable-context outputs, and proof requirements in this task.",
670
670
  "",
671
671
  "## Start Here",
672
672
  "",
673
673
  "1. Read `runtime/authoring-context.json` now.",
674
674
  `2. Read \`workflow/README.md\`, \`workflow/workflow.json\`, and \`workflow/${WORKFLOW_SCHEMA_FILE}\` now.`,
675
- "3. Review `artifacts/source-dataset/raw/` and `artifacts/preview-compiled/` if present.",
675
+ "3. Review `artifacts/source-dataset/raw/`.",
676
676
  "4. Use the local native `interf-workflow-author` skill now.",
677
677
  "",
678
678
  "## Boundaries",
679
679
  "",
680
680
  `- New workflow id: \`${options.workflowId}\`.`,
681
- `- Seed workflow: \`${options.baseWorkflowId}\`.`,
681
+ "- Authoring mode: from scratch.",
682
+ ...(options.referenceWorkflowId
683
+ ? [`- Reference workflow id: \`${options.referenceWorkflowId}\` (context only, not a seed).`]
684
+ : []),
682
685
  "- Edit only files under `workflow/`.",
683
- "- Do not edit raw files or preview artifacts.",
686
+ "- Do not edit source artifacts.",
684
687
  "- Keep the workflow valid for the current compiler API and workflow schema.",
685
- "- For acceptance rules, use `zone_counts_at_least` for numeric fixed minimums and `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`.",
688
+ "- For acceptance criteria, use `zone_counts_at_least` for numeric fixed minimums and `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`.",
686
689
  "- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
687
690
  "- Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
688
691
  "",
689
692
  "## Goal",
690
693
  "",
691
694
  "- produce one standalone workflow tuned to the source data, desired outputs, and checks in this task",
695
+ "- replace the neutral scaffold topology with the stage graph this work needs",
692
696
  "- define output zones and stage proof so Interf can show whether the data is ready",
693
697
  "- preserve deterministic stage and context-interface contracts",
694
698
  "- stop once the workflow edits are complete",
@@ -706,66 +710,25 @@ function renderWorkflowAuthoringSkill() {
706
710
  "# Interf Workflow Authoring",
707
711
  "",
708
712
  "Read `runtime/authoring-context.json` first.",
709
- "Then review the seeded package under `workflow/`, the raw snapshot under `artifacts/source-dataset/raw/`, and any preview context outputs under `artifacts/preview-compiled/`.",
713
+ "Then review the neutral workflow scaffold under `workflow/` and the raw snapshot under `artifacts/source-dataset/raw/`.",
710
714
  "",
711
715
  "Rules:",
712
716
  "- edit only `workflow/`",
713
717
  `- keep \`workflow.json\`, \`${WORKFLOW_SCHEMA_FILE}\`, and any changed stage docs aligned`,
714
718
  "- use `zone_counts_at_least` for numeric fixed minimums; use `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`",
715
- "- prefer small, defensible package edits over random churn",
716
- "- keep the package standalone; do not introduce runtime inheritance or fallback assumptions",
719
+ "- design the stage graph from the source data and preparation-and-evidence brief",
720
+ "- replace the placeholder `prepare` stage unless that exact stage is truly the final method",
721
+ "- keep the package standalone; do not introduce runtime inheritance or hidden source-package assumptions",
717
722
  "- do not introduce wikilinks unless the workflow also creates the target note by exact basename or explicit relative path",
718
723
  "- respect stage boundaries: do not make structure outputs link to notes or entrypoints first created by later stages",
719
724
  "- prefer conservative routing changes over speculative note sprawl",
720
725
  "- prefer direct file-reading and search tools over shell commands for routine file inspection",
721
726
  "- do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files",
722
- "- do not hardcode benchmark answers into workflow docs",
723
- "- do not edit raw files or preview artifacts",
727
+ "- do not hardcode readiness-check answers into workflow docs",
728
+ "- do not edit source artifacts",
724
729
  "",
725
730
  ].join("\n");
726
731
  }
727
- function authoringCopyIfExists(sourcePath, targetPath) {
728
- if (!existsSync(sourcePath))
729
- return;
730
- mkdirSync(dirname(targetPath), { recursive: true });
731
- cpSync(sourcePath, targetPath, {
732
- recursive: true,
733
- force: true,
734
- errorOnExist: false,
735
- preserveTimestamps: true,
736
- });
737
- }
738
- function projectCompiledPreviewSnapshot(previewCompiledPath, shellRoot) {
739
- const previewRoot = join(shellRoot, "artifacts", "preview-compiled");
740
- mkdirSync(previewRoot, { recursive: true });
741
- authoringCopyIfExists(join(previewCompiledPath, "AGENTS.md"), join(previewRoot, "AGENTS.md"));
742
- authoringCopyIfExists(join(previewCompiledPath, "CLAUDE.md"), join(previewRoot, "CLAUDE.md"));
743
- const schema = readCompiledSchemaFile(workflowPackagePathForCompiled(previewCompiledPath));
744
- for (const zone of schema?.zones ?? []) {
745
- if (zone.kind === "runtime" || zone.role === "input")
746
- continue;
747
- const absolutePath = compiledZoneAbsolutePath(previewCompiledPath, zone);
748
- if (!existsSync(absolutePath))
749
- continue;
750
- authoringCopyIfExists(absolutePath, join(previewRoot, zone.path));
751
- }
752
- }
753
- function projectCompiledPreviewRuntime(previewCompiledPath, shellRoot) {
754
- const targetRoot = join(shellRoot, "artifacts", "preview-runtime");
755
- mkdirSync(targetRoot, { recursive: true });
756
- const runtimeRoot = compiledRuntimeRoot(previewCompiledPath);
757
- for (const artifactName of [
758
- "run.json",
759
- "state.json",
760
- "health.json",
761
- "view-spec.json",
762
- "raw-snapshot.json",
763
- "execution-shells",
764
- "logs",
765
- ]) {
766
- authoringCopyIfExists(join(runtimeRoot, artifactName), join(targetRoot, artifactName));
767
- }
768
- }
769
732
  function improvementWorkflowDocsPath(compiledPath) {
770
733
  return join(workflowPackagePathForCompiled(compiledPath), "improve");
771
734
  }
@@ -778,9 +741,10 @@ export function createWorkflowAuthoringShell(options) {
778
741
  kind: "interf-workflow-authoring",
779
742
  version: 1,
780
743
  generated_at: new Date().toISOString(),
744
+ authoring_mode: "from-scratch",
781
745
  workflow_id: options.workflowId,
782
746
  workflow_label: options.label,
783
- seed_workflow_id: options.baseWorkflowId,
747
+ ...(options.referenceWorkflowId ? { reference_workflow_id: options.referenceWorkflowId } : {}),
784
748
  task_prompt: options.taskPrompt,
785
749
  dataset: {
786
750
  source_path: options.datasetPath,
@@ -792,17 +756,6 @@ export function createWorkflowAuthoringShell(options) {
792
756
  })),
793
757
  },
794
758
  },
795
- preview: options.preview
796
- ? {
797
- prepared: true,
798
- compile_ok: options.preview.compileResult.ok,
799
- failed_stage: options.preview.compileResult.failedStage,
800
- }
801
- : {
802
- prepared: false,
803
- compile_ok: null,
804
- failed_stage: null,
805
- },
806
759
  };
807
760
  writeFileSync(join(shellRoot, "runtime", "authoring-context.json"), `${JSON.stringify(context, null, 2)}\n`);
808
761
  projectRawSnapshot({
@@ -813,15 +766,11 @@ export function createWorkflowAuthoringShell(options) {
813
766
  prune: true,
814
767
  preserveTimestamps: true,
815
768
  });
816
- if (options.preview) {
817
- projectCompiledPreviewSnapshot(options.preview.compiledPath, shellRoot);
818
- projectCompiledPreviewRuntime(options.preview.compiledPath, shellRoot);
819
- }
820
769
  linkPath(options.workflowPath, join(shellRoot, "workflow"));
821
770
  writeNativeAgentSurface(shellRoot, renderWorkflowAuthoringAgents({
822
771
  workflowId: options.workflowId,
823
772
  label: options.label,
824
- baseWorkflowId: options.baseWorkflowId,
773
+ referenceWorkflowId: options.referenceWorkflowId ?? null,
825
774
  }), "interf-workflow-author", renderWorkflowAuthoringSkill());
826
775
  return {
827
776
  rootPath: shellRoot,
@@ -854,7 +803,7 @@ function renderWorkflowImprovementAgents(compiledName, workflowId, loopIndex) {
854
803
  "- Do not edit checks, test specs, raw files, or generated context outputs.",
855
804
  "- Review context outputs under `artifacts/compiled-view/` and test/runtime evidence under `artifacts/`.",
856
805
  "- Keep the workflow valid for the current compiler API and workflow schema.",
857
- "- For acceptance rules, use `zone_counts_at_least` for numeric fixed minimums and `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`.",
806
+ "- For acceptance criteria, use `zone_counts_at_least` for numeric fixed minimums and `zone_counts_at_least_counts` only for runtime count-key strings such as `source_total`.",
858
807
  "",
859
808
  "## Goal",
860
809
  "",
@@ -27,4 +27,5 @@ export interface SpawnAgentOptions {
27
27
  statusLogPath?: string | null;
28
28
  executionProfile?: WorkflowExecutionProfile;
29
29
  completionCheck?: (() => boolean) | null;
30
+ onStatus?: (line: string) => void;
30
31
  }
@@ -1,6 +1,8 @@
1
1
  export declare const COMPILED_INTERF_DIR = ".interf";
2
2
  export declare const COMPILED_CONFIG_FILE = "interf.json";
3
- export declare const COMPILED_WORKFLOW_DIR = "workflow";
3
+ export declare const COMPILED_METHOD_DIR = "method";
4
+ export declare const COMPILED_WORKFLOW_DIR = "method";
5
+ export declare const LEGACY_COMPILED_WORKFLOW_DIR = "workflow";
4
6
  export declare const COMPILED_TEST_DIR = "tests";
5
7
  export declare const COMPILED_TEST_TARGETS_DIR = "targets";
6
8
  export declare const COMPILED_RUNTIME_DIR = "runtime";
@@ -17,6 +19,7 @@ export declare function compiledRuntimeFilePath(compiledPath: string, fileName:
17
19
  export declare function compiledInterfRoot(compiledPath: string): string;
18
20
  export declare function compiledInterfConfigPath(compiledPath: string): string;
19
21
  export declare function workflowPackagePathForCompiled(compiledPath: string): string;
22
+ export declare function legacyWorkflowPackagePathForCompiled(compiledPath: string): string;
20
23
  export declare function testRootForCompiled(compiledPath: string): string;
21
24
  export declare function testTargetsRootForCompiled(compiledPath: string): string;
22
25
  export declare function stageExecutionShellsRoot(compiledPath: string): string;
@@ -1,7 +1,9 @@
1
1
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
2
2
  export const COMPILED_INTERF_DIR = ".interf";
3
3
  export const COMPILED_CONFIG_FILE = "interf.json";
4
- export const COMPILED_WORKFLOW_DIR = "workflow";
4
+ export const COMPILED_METHOD_DIR = "method";
5
+ export const COMPILED_WORKFLOW_DIR = COMPILED_METHOD_DIR;
6
+ export const LEGACY_COMPILED_WORKFLOW_DIR = "workflow";
5
7
  export const COMPILED_TEST_DIR = "tests";
6
8
  export const COMPILED_TEST_TARGETS_DIR = "targets";
7
9
  export const COMPILED_RUNTIME_DIR = "runtime";
@@ -28,6 +30,9 @@ export function compiledInterfConfigPath(compiledPath) {
28
30
  export function workflowPackagePathForCompiled(compiledPath) {
29
31
  return join(compiledInterfRoot(compiledPath), COMPILED_WORKFLOW_DIR);
30
32
  }
33
+ export function legacyWorkflowPackagePathForCompiled(compiledPath) {
34
+ return join(compiledInterfRoot(compiledPath), LEGACY_COMPILED_WORKFLOW_DIR);
35
+ }
31
36
  export function testRootForCompiled(compiledPath) {
32
37
  return join(compiledInterfRoot(compiledPath), COMPILED_TEST_DIR);
33
38
  }
@@ -91,6 +96,7 @@ export function resolveSourceControlPathForCompiled(compiledPath) {
91
96
  const parent = dirname(cursor);
92
97
  if (basename(parent) === "interf" &&
93
98
  basename(cursor) !== "tests" &&
99
+ basename(cursor) !== "methods" &&
94
100
  basename(cursor) !== "workflows") {
95
101
  return dirname(parent);
96
102
  }
@@ -1,6 +1,7 @@
1
1
  import { type WorkflowExecutor } from "../agents/lib/executors.js";
2
2
  import { type WorkflowReporter, type WorkflowStageResult } from "../workflow-package/workflow-helpers.js";
3
3
  import { type CompiledStageExecutionDefinition } from "./compiled-target.js";
4
+ import type { RunEventSink } from "../execution/events.js";
4
5
  export interface CompiledSummarizeResult extends WorkflowStageResult {
5
6
  skipped: boolean;
6
7
  plan: {
@@ -23,6 +24,8 @@ export declare function runCompiledSummarize(options: {
23
24
  reportStep?: boolean;
24
25
  stageDefinition?: CompiledStageExecutionDefinition;
25
26
  fullPass?: boolean;
27
+ runId?: string;
28
+ events?: RunEventSink;
26
29
  }): Promise<CompiledSummarizeResult>;
27
30
  export declare function runCompiledCompile(options: {
28
31
  executor: WorkflowExecutor;
@@ -30,10 +33,14 @@ export declare function runCompiledCompile(options: {
30
33
  reporter?: WorkflowReporter;
31
34
  reportStep?: boolean;
32
35
  preserveStageShells?: StageShellRetentionMode;
36
+ runId?: string;
37
+ events?: RunEventSink;
33
38
  }): Promise<WorkflowStageResult>;
34
39
  export declare function compileCompiled(options: {
35
40
  executor: WorkflowExecutor;
36
41
  compiledPath: string;
37
42
  reporter?: WorkflowReporter;
38
43
  preserveStageShells?: StageShellRetentionMode;
44
+ runId?: string;
45
+ events?: RunEventSink;
39
46
  }): Promise<CompiledCompileResult>;
@@ -1,4 +1,3 @@
1
- import { join } from "node:path";
2
1
  import { refreshCompiledBootstrapGuidance, } from "../agents/lib/compiled-bootstrap.js";
3
2
  import { validateWorkflowPackage } from "../workflow-package/local-workflows.js";
4
3
  import { reportValidationFailure, } from "../workflow-package/workflow-helpers.js";
@@ -9,6 +8,7 @@ import { compiledExecutionStages, resolveCompiledContext, } from "./compiled-tar
9
8
  import { discoverSourceFiles } from "./discovery.js";
10
9
  import { runCompiledStage } from "./compiled-stage-runner.js";
11
10
  import { resolveSourceInputPath } from "../project-model/interf-detect.js";
11
+ import { workflowPackagePathForCompiled } from "./compiled-paths.js";
12
12
  export async function runCompiledSummarize(options) {
13
13
  const context = resolveCompiledContext(options.compiledPath);
14
14
  const stageDefinition = options.stageDefinition
@@ -29,6 +29,8 @@ export async function runCompiledSummarize(options) {
29
29
  reporter: options.reporter,
30
30
  reportStep: options.reportStep,
31
31
  stageDefinition,
32
+ runId: options.runId,
33
+ events: options.events,
32
34
  });
33
35
  return {
34
36
  ...result,
@@ -48,13 +50,18 @@ export async function runCompiledCompile(options) {
48
50
  let lastResult = { ok: true, code: 0 };
49
51
  try {
50
52
  const context = resolveCompiledContext(options.compiledPath);
51
- for (const stageDefinition of compiledExecutionStages(context.workflowId, options.compiledPath)) {
53
+ const stages = compiledExecutionStages(context.workflowId, options.compiledPath);
54
+ for (const [index, stageDefinition] of stages.entries()) {
52
55
  const result = await runCompiledStage({
53
56
  executor: options.executor,
54
57
  compiledPath: options.compiledPath,
55
58
  reporter: options.reporter,
56
59
  reportStep: options.reportStep,
57
60
  stageDefinition,
61
+ runId: options.runId,
62
+ events: options.events,
63
+ stageIndex: index,
64
+ stageTotal: stages.length,
58
65
  });
59
66
  lastResult = result;
60
67
  if (!result.ok)
@@ -82,7 +89,7 @@ export async function compileCompiled(options) {
82
89
  const sourceInputPath = resolveSourceInputPath(options.compiledPath);
83
90
  syncCompiledRawSnapshot(options.compiledPath, sourceInputPath);
84
91
  refreshCompiledBootstrapGuidance(options.compiledPath);
85
- const workflowValidation = validateWorkflowPackage(join(options.compiledPath, ".interf", "workflow"));
92
+ const workflowValidation = validateWorkflowPackage(workflowPackagePathForCompiled(options.compiledPath));
86
93
  if (!workflowValidation.ok) {
87
94
  reportValidationFailure(options.reporter, workflowValidation.summary, workflowValidation.errors);
88
95
  return {
@@ -101,13 +108,17 @@ export async function compileCompiled(options) {
101
108
  }
102
109
  const context = resolveCompiledContext(options.compiledPath);
103
110
  const stages = compiledExecutionStages(context.workflowId, options.compiledPath);
104
- for (const stageDefinition of stages) {
111
+ for (const [index, stageDefinition] of stages.entries()) {
105
112
  const stageResult = await runCompiledStage({
106
113
  executor: options.executor,
107
114
  compiledPath: options.compiledPath,
108
115
  reporter: options.reporter,
109
116
  reportStep: true,
110
117
  stageDefinition,
118
+ runId: options.runId,
119
+ events: options.events,
120
+ stageIndex: index,
121
+ stageTotal: stages.length,
111
122
  });
112
123
  result.stageResults[stageDefinition.id] = stageResult;
113
124
  if (!stageResult.ok) {
@@ -18,7 +18,7 @@ export function workflowSchemaExists(rootPath) {
18
18
  return existsSync(workflowSchemaFilePath(rootPath));
19
19
  }
20
20
  export function workflowSchemaRelativePath() {
21
- return `workflow/${WORKFLOW_SCHEMA_FILE}`;
21
+ return `method/${WORKFLOW_SCHEMA_FILE}`;
22
22
  }
23
23
  export function listCompiledSchemaZones(schema) {
24
24
  return [...schema.zones];
@@ -1,5 +1,5 @@
1
1
  import { type RuntimeStageContractDraft } from "./runtime.js";
2
- import { type CompiledWorkflowId, type WorkflowStageDefinition } from "../workflow-package/workflow-definitions.js";
2
+ import { type WorkflowStageDefinition } from "../workflow-package/workflow-definitions.js";
3
3
  import { resolveCompiledContext, type CompiledStageExecutionDefinition } from "./compiled-target.js";
4
4
  import type { RuntimeStageInstructions } from "./lib/schema.js";
5
5
  export declare function resolveStageContractArtifacts(compiledPath: string, stageDefinition: Pick<WorkflowStageDefinition, "id" | "reads" | "writes">): {
@@ -7,7 +7,7 @@ export declare function resolveStageContractArtifacts(compiledPath: string, stag
7
7
  writes: string[];
8
8
  };
9
9
  export declare function buildStageCounts(compiledPath: string, stageDefinition: WorkflowStageDefinition): Record<string, number>;
10
- export declare function buildStageContract(compiledPath: string, workflowId: CompiledWorkflowId, stageDefinition: WorkflowStageDefinition, instructions: RuntimeStageInstructions): RuntimeStageContractDraft;
10
+ export declare function buildStageContract(compiledPath: string, stageDefinition: WorkflowStageDefinition, instructions: RuntimeStageInstructions): RuntimeStageContractDraft;
11
11
  export declare function buildCompiledStageExecutionPlan(compiledPath: string, stageDefinition: CompiledStageExecutionDefinition): {
12
12
  context: ReturnType<typeof resolveCompiledContext>;
13
13
  contract: RuntimeStageContractDraft;
@@ -51,7 +51,7 @@ export function buildStageCounts(compiledPath, stageDefinition) {
51
51
  ...zoneCounts,
52
52
  };
53
53
  }
54
- export function buildStageContract(compiledPath, workflowId, stageDefinition, instructions) {
54
+ export function buildStageContract(compiledPath, stageDefinition, instructions) {
55
55
  const config = readInterfConfig(compiledPath);
56
56
  const stageArtifacts = resolveStageContractArtifacts(compiledPath, stageDefinition);
57
57
  return buildRuntimeStageContract({
@@ -61,10 +61,10 @@ export function buildStageContract(compiledPath, workflowId, stageDefinition, in
61
61
  counts: buildStageCounts(compiledPath, stageDefinition),
62
62
  stageReadArtifacts: stageArtifacts.reads,
63
63
  stageWriteArtifacts: stageArtifacts.writes,
64
- workflowNotes: getActiveCompiledStagePolicyNotes(compiledPath, workflowId, stageDefinition.id),
64
+ workflowNotes: getActiveCompiledStagePolicyNotes(compiledPath, stageDefinition.id),
65
65
  localSkillDocs: instructions.local_docs,
66
66
  instructions,
67
- acceptance: resolveActiveCompiledStageAcceptance(compiledPath, workflowId, stageDefinition.id),
67
+ acceptance: resolveActiveCompiledStageAcceptance(compiledPath, stageDefinition.id),
68
68
  });
69
69
  }
70
70
  export function buildCompiledStageExecutionPlan(compiledPath, stageDefinition) {
@@ -74,6 +74,6 @@ export function buildCompiledStageExecutionPlan(compiledPath, stageDefinition) {
74
74
  return {
75
75
  context,
76
76
  instructions,
77
- contract: buildStageContract(compiledPath, context.workflowId, stageDefinition, instructions),
77
+ contract: buildStageContract(compiledPath, stageDefinition, instructions),
78
78
  };
79
79
  }
@@ -1,10 +1,15 @@
1
1
  import { type WorkflowExecutor } from "../agents/lib/executors.js";
2
2
  import { type WorkflowReporter, type WorkflowStageResult } from "../workflow-package/workflow-helpers.js";
3
3
  import { type CompiledStageExecutionDefinition } from "./compiled-target.js";
4
+ import { type RunEventSink } from "../execution/events.js";
4
5
  export declare function runCompiledStage(options: {
5
6
  executor: WorkflowExecutor;
6
7
  compiledPath: string;
7
8
  reporter?: WorkflowReporter;
8
9
  reportStep?: boolean;
9
10
  stageDefinition: CompiledStageExecutionDefinition;
11
+ runId?: string;
12
+ events?: RunEventSink;
13
+ stageIndex?: number;
14
+ stageTotal?: number;
10
15
  }): Promise<WorkflowStageResult>;
@@ -6,16 +6,31 @@ import { executeValidatedStage, } from "../workflow-package/workflow-stage-runne
6
6
  import { formatActiveCompiledWorkflowStageStep, } from "../workflow-package/workflow-definitions.js";
7
7
  import { reportBlankLine, reportLine, } from "../workflow-package/workflow-helpers.js";
8
8
  import { buildCompiledStageExecutionPlan, } from "./compiled-stage-plan.js";
9
+ import { createRunEventId, createRunEventTimestamp, } from "../execution/events.js";
10
+ async function emitRunEvent(sink, event) {
11
+ await sink?.emit(event);
12
+ }
9
13
  export async function runCompiledStage(options) {
10
14
  const stageDefinition = options.stageDefinition;
11
15
  const plan = buildCompiledStageExecutionPlan(options.compiledPath, stageDefinition);
12
16
  if (options.reportStep !== false) {
13
17
  reportBlankLine(options.reporter);
14
- reportLine(options.reporter, `${formatActiveCompiledWorkflowStageStep(options.compiledPath, plan.context.workflowId, stageDefinition.id)} (${stageDefinition.description.toLowerCase()})`);
18
+ reportLine(options.reporter, `${formatActiveCompiledWorkflowStageStep(options.compiledPath, stageDefinition.id)} (${stageDefinition.description.toLowerCase()})`);
15
19
  }
16
20
  const shell = createStageExecutionShell(options.compiledPath, plan.context.compiledName, plan.context.workflowId, stageDefinition, plan.contract.artifacts.writes);
17
21
  try {
18
- return await executeValidatedStage({
22
+ if (options.runId && options.events) {
23
+ await emitRunEvent(options.events, {
24
+ type: "stage.started",
25
+ event_id: createRunEventId("event"),
26
+ run_id: options.runId,
27
+ timestamp: createRunEventTimestamp(),
28
+ stage_id: stageDefinition.id,
29
+ ...(typeof options.stageIndex === "number" ? { stage_index: options.stageIndex } : {}),
30
+ ...(typeof options.stageTotal === "number" ? { stage_total: options.stageTotal } : {}),
31
+ });
32
+ }
33
+ const result = await executeValidatedStage({
19
34
  executor: options.executor,
20
35
  compiledPath: options.compiledPath,
21
36
  executionPath: shell.rootPath,
@@ -34,11 +49,44 @@ export async function runCompiledStage(options) {
34
49
  ],
35
50
  reporter: options.reporter,
36
51
  completionCheck: () => validateCompiledStage(options.compiledPath, stageDefinition.id).ok,
52
+ onStatus: options.runId && options.events
53
+ ? (line) => {
54
+ void options.events?.emit({
55
+ type: "log.appended",
56
+ event_id: createRunEventId("event"),
57
+ run_id: options.runId,
58
+ timestamp: createRunEventTimestamp(),
59
+ stage_id: stageDefinition.id,
60
+ stream: "status",
61
+ message: line,
62
+ });
63
+ }
64
+ : undefined,
37
65
  syncWrites: () => syncStageExecutionShellWrites(options.compiledPath, shell.rootPath, stageDefinition, plan.contract.artifacts.writes),
38
66
  reconcile: () => reconcileCompiledStageRun(options.compiledPath, stageDefinition),
39
67
  refreshArtifacts: () => refreshCompiledArtifacts(options.compiledPath, { ensureViewSpec: true }),
40
68
  validate: () => validateCompiledStage(options.compiledPath, stageDefinition.id),
41
69
  });
70
+ if (options.runId && options.events) {
71
+ await emitRunEvent(options.events, result.ok
72
+ ? {
73
+ type: "stage.passed",
74
+ event_id: createRunEventId("event"),
75
+ run_id: options.runId,
76
+ timestamp: createRunEventTimestamp(),
77
+ stage_id: stageDefinition.id,
78
+ summary: result.summary ?? `${stageDefinition.label} completed.`,
79
+ }
80
+ : {
81
+ type: "stage.failed",
82
+ event_id: createRunEventId("event"),
83
+ run_id: options.runId,
84
+ timestamp: createRunEventTimestamp(),
85
+ stage_id: stageDefinition.id,
86
+ error: result.summary ?? `${stageDefinition.label} failed.`,
87
+ });
88
+ }
89
+ return result;
42
90
  }
43
91
  finally {
44
92
  freezeStageExecutionShell(shell.rootPath);
@@ -8,4 +8,4 @@ export declare function resolveCompiledContext(compiledPath: string): {
8
8
  controlPath: string;
9
9
  workflowId: CompiledWorkflowId;
10
10
  };
11
- export declare function compiledExecutionStages(workflowId: CompiledWorkflowId, compiledPath: string): CompiledStageExecutionDefinition[];
11
+ export declare function compiledExecutionStages(_workflowId: CompiledWorkflowId, compiledPath: string): CompiledStageExecutionDefinition[];
@@ -10,7 +10,7 @@ export function resolveCompiledContext(compiledPath) {
10
10
  workflowId,
11
11
  };
12
12
  }
13
- export function compiledExecutionStages(workflowId, compiledPath) {
14
- return getActiveCompiledWorkflow(compiledPath, workflowId)
13
+ export function compiledExecutionStages(_workflowId, compiledPath) {
14
+ return getActiveCompiledWorkflow(compiledPath)
15
15
  .stages;
16
16
  }