@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
@@ -7,12 +7,12 @@ import { formatWorkflowExecutionProfile } from "../../packages/agents/lib/execut
7
7
  function formatSavedDatasetHint(entry) {
8
8
  const config = entry.config;
9
9
  const checkCount = config.checks.length;
10
- const workflowHint = `workflow ${config.workflow ?? "interf"}${entry.localDraft ? " (local draft)" : ""}`;
10
+ const workflowHint = `Method ${config.method ?? config.workflow ?? "interf-default"}${entry.localDraft ? " (local draft)" : ""}`;
11
11
  if (config.about)
12
12
  return `${config.path} · ${config.about} · ${workflowHint}`;
13
13
  if (checkCount === 0)
14
- return `${config.path} · No questions yet · ${workflowHint}`;
15
- return `${config.path} · ${checkCount} question${checkCount === 1 ? "" : "s"} · ${workflowHint}`;
14
+ return `${config.path} · No readiness checks yet · ${workflowHint}`;
15
+ return `${config.path} · ${checkCount} readiness check${checkCount === 1 ? "" : "s"} · ${workflowHint}`;
16
16
  }
17
17
  export function listSavedCompiledEntries(sourcePath) {
18
18
  const builtEntries = new Map();
@@ -57,7 +57,7 @@ export async function chooseCompiledConfigToBuild(options) {
57
57
  label: entry.config.name,
58
58
  hint: [
59
59
  formatSavedDatasetHint(entry),
60
- entry.path ? "built" : "not built yet",
60
+ entry.path ? "Portable Context available" : "Portable Context not built yet",
61
61
  ].join(" · "),
62
62
  })),
63
63
  });
@@ -66,7 +66,7 @@ export async function chooseCompiledConfigToBuild(options) {
66
66
  return savedEntries.find((entry) => entry.config.name === selected)?.config ?? null;
67
67
  }
68
68
  export function createCompiledFromConfig(sourcePath, datasetConfig) {
69
- const workflowId = datasetConfig.workflow ?? "interf";
69
+ const workflowId = datasetConfig.method ?? datasetConfig.workflow ?? "interf-default";
70
70
  const datasetSourcePath = resolveSourceDatasetPath(sourcePath, datasetConfig);
71
71
  const compiledPath = createCompiled(datasetConfig.name, sourcePath, workflowId, datasetConfig.about, datasetSourcePath);
72
72
  syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath, datasetConfig);
@@ -82,7 +82,7 @@ export function ensureCompiledFromConfig(sourcePath, datasetConfig) {
82
82
  }
83
83
  export async function compileCompiledWithReporter(executor, compiledPath, options = {}) {
84
84
  console.log();
85
- console.log(chalk.bold(` ${options.heading ?? "Building portable context..."}`));
85
+ console.log(chalk.bold(` ${options.heading ?? "Building Portable Context..."}`));
86
86
  const profileLabel = formatWorkflowExecutionProfile(executor.executionProfile);
87
87
  if (profileLabel) {
88
88
  console.log(chalk.dim(` Execution profile: ${profileLabel}`));
@@ -97,11 +97,13 @@ export async function compileCompiledWithReporter(executor, compiledPath, option
97
97
  compiledPath,
98
98
  reporter,
99
99
  preserveStageShells: options.preserveStageShells,
100
+ runId: options.runId,
101
+ events: options.events,
100
102
  });
101
103
  if (!result.ok) {
102
104
  return result;
103
105
  }
104
106
  console.log();
105
- console.log(chalk.green(` ✓ ${options.successMessage ?? "Portable context ready."}`));
107
+ console.log(chalk.green(` ✓ ${options.successMessage ?? "Portable Context ready."}`));
106
108
  return result;
107
109
  }
@@ -0,0 +1,11 @@
1
+ export declare function hasInterfInstanceConfig(controlPath: string): boolean;
2
+ export declare function findNearestInterfInstanceConfig(cwd?: string): string | null;
3
+ export declare function defaultInterfInstanceRoot(sourceFolderPath: string): string;
4
+ export declare function resolveCommandControlPath(cwd?: string): string;
5
+ export interface InterfInstanceContext {
6
+ controlPath: string;
7
+ defaultSourceFolderPath: string | null;
8
+ defaultPreparationPath: string | null;
9
+ }
10
+ export declare function relativeSourceFolderPath(controlPath: string, sourceFolderPath: string): string;
11
+ export declare function resolveInterfInstanceContext(cwd?: string): InterfInstanceContext;
@@ -0,0 +1,72 @@
1
+ import { existsSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
4
+ import { assertCompiledContainer } from "../../packages/project-model/interf.js";
5
+ import { sourceFolderConfigPath } from "../../packages/project-model/source-config.js";
6
+ function canUseInterfInstanceRoot(controlPath) {
7
+ try {
8
+ assertCompiledContainer(controlPath);
9
+ return true;
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ export function hasInterfInstanceConfig(controlPath) {
16
+ return existsSync(sourceFolderConfigPath(controlPath)) && canUseInterfInstanceRoot(controlPath);
17
+ }
18
+ export function findNearestInterfInstanceConfig(cwd = process.cwd()) {
19
+ let cursor = resolve(cwd);
20
+ while (true) {
21
+ if (hasInterfInstanceConfig(cursor))
22
+ return cursor;
23
+ const parentPath = dirname(cursor);
24
+ if (parentPath === cursor)
25
+ return null;
26
+ cursor = parentPath;
27
+ }
28
+ }
29
+ function fallbackInterfInstanceRoot(sourceFolderPath) {
30
+ return join(homedir(), ".interf", basename(sourceFolderPath) || "source-folder");
31
+ }
32
+ export function defaultInterfInstanceRoot(sourceFolderPath) {
33
+ const parentPath = dirname(sourceFolderPath);
34
+ if (parentPath !== sourceFolderPath && canUseInterfInstanceRoot(parentPath)) {
35
+ return parentPath;
36
+ }
37
+ return fallbackInterfInstanceRoot(sourceFolderPath);
38
+ }
39
+ export function resolveCommandControlPath(cwd = process.cwd()) {
40
+ const currentPath = resolve(cwd);
41
+ return findNearestInterfInstanceConfig(currentPath) ?? currentPath;
42
+ }
43
+ export function relativeSourceFolderPath(controlPath, sourceFolderPath) {
44
+ const relativePath = relative(controlPath, sourceFolderPath).split(sep).join("/") || ".";
45
+ if (relativePath.startsWith(".."))
46
+ return sourceFolderPath;
47
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
48
+ }
49
+ export function resolveInterfInstanceContext(cwd = process.cwd()) {
50
+ const currentPath = resolve(cwd);
51
+ const existingControlPath = findNearestInterfInstanceConfig(currentPath);
52
+ if (existingControlPath) {
53
+ if (existingControlPath !== currentPath) {
54
+ return {
55
+ controlPath: existingControlPath,
56
+ defaultSourceFolderPath: currentPath,
57
+ defaultPreparationPath: relativeSourceFolderPath(existingControlPath, currentPath),
58
+ };
59
+ }
60
+ return {
61
+ controlPath: currentPath,
62
+ defaultSourceFolderPath: null,
63
+ defaultPreparationPath: null,
64
+ };
65
+ }
66
+ const controlPath = defaultInterfInstanceRoot(currentPath);
67
+ return {
68
+ controlPath,
69
+ defaultSourceFolderPath: currentPath,
70
+ defaultPreparationPath: relativeSourceFolderPath(controlPath, currentPath),
71
+ };
72
+ }
@@ -29,6 +29,7 @@ export interface WorkflowWizardDatasetContext {
29
29
  datasetPath: string;
30
30
  }
31
31
  export declare const clackWorkflowPrompts: WorkflowWizardPrompts;
32
+ type WorkflowCreationMode = "draft-from-scratch" | "fork-existing" | "draft" | "manual";
32
33
  export declare function formatWorkflowLabel(workflow: {
33
34
  id: string;
34
35
  label: string;
@@ -48,17 +49,28 @@ export declare function chooseCompiledWorkflow(sourcePath: string, options?: {
48
49
  currentWorkflowId?: string;
49
50
  message?: string;
50
51
  }): Promise<string | symbol>;
52
+ export declare function chooseOrCreateCompiledWorkflowForDataset(sourcePath: string, datasetConfig: SourceDatasetConfig, options?: {
53
+ currentWorkflowId?: string;
54
+ executionProfile?: WorkflowExecutionProfile;
55
+ resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
56
+ runDraft?: typeof runWorkflowAuthoringDraft;
57
+ }, prompts?: WorkflowWizardPrompts): Promise<string | symbol | null>;
51
58
  export declare function createWorkflowWizard(options?: {
52
59
  intro?: boolean;
53
60
  sourcePath?: string;
54
61
  executionProfile?: WorkflowExecutionProfile;
62
+ baseWorkflowId?: string;
63
+ creationMode?: WorkflowCreationMode;
55
64
  datasetContext?: WorkflowWizardDatasetContext;
56
65
  resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
57
66
  runDraft?: typeof runWorkflowAuthoringDraft;
58
67
  }, prompts?: WorkflowWizardPrompts): Promise<string | symbol | null>;
59
68
  export declare function createCompiledWorkflowWizard(sourcePath: string, prompts?: WorkflowWizardPrompts, options?: {
60
69
  executionProfile?: WorkflowExecutionProfile;
70
+ baseWorkflowId?: string;
71
+ creationMode?: WorkflowCreationMode;
61
72
  datasetContext?: WorkflowWizardDatasetContext;
62
73
  resolveExecutor?: typeof resolveOrConfigureLocalExecutor;
63
74
  runDraft?: typeof runWorkflowAuthoringDraft;
64
75
  }): Promise<string | symbol | null>;
76
+ export {};
@@ -4,11 +4,12 @@ import { resolve } from "node:path";
4
4
  import { listCompiledWorkflowChoices, getCompiledWorkflow, } from "../../packages/workflow-package/workflow-definitions.js";
5
5
  import { createLocalWorkflowPackageFromTemplate } from "../../packages/workflow-package/interf-workflow-package.js";
6
6
  import { rmSync } from "node:fs";
7
- import { isWorkflowId, loadWorkflowDefinitionFromDir, } from "../../packages/workflow-package/local-workflows.js";
7
+ import { isWorkflowId, loadWorkflowDefinitionFromDir, seedLocalDefaultWorkflow, } from "../../packages/workflow-package/local-workflows.js";
8
8
  import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
9
9
  import { runWorkflowAuthoringDraft } from "../../packages/workflow-authoring/workflow-authoring.js";
10
10
  import { listSourceDatasetConfigs, loadSourceFolderConfig, resolveSourceDatasetPath, } from "../../packages/project-model/source-config.js";
11
11
  import { slugify } from "../../packages/shared/naming.js";
12
+ import { submitWorkflowAuthoringRunToLocalService } from "../../packages/local-service/index.js";
12
13
  import { DEFAULT_DATASET_PATH_PLACEHOLDER, listDatasetFolderChoices, normalizeDatasetPathForConfig, } from "./source-config-wizard.js";
13
14
  export const clackWorkflowPrompts = {
14
15
  intro: p.intro,
@@ -20,6 +21,13 @@ export const clackWorkflowPrompts = {
20
21
  error: p.log.error,
21
22
  },
22
23
  };
24
+ function normalizeWorkflowCreationMode(mode) {
25
+ if (mode === "draft")
26
+ return "draft-from-scratch";
27
+ if (mode === "manual")
28
+ return "fork-existing";
29
+ return mode;
30
+ }
23
31
  function findMatchingDatasetConfig(sourcePath, datasetPath) {
24
32
  const config = loadSourceFolderConfig(sourcePath);
25
33
  for (const dataset of listSourceDatasetConfigs(config)) {
@@ -32,36 +40,46 @@ function findMatchingDatasetConfig(sourcePath, datasetPath) {
32
40
  function describeSavedDataset(dataset) {
33
41
  return dataset.about
34
42
  ? `${dataset.path} · ${dataset.about}`
35
- : `${dataset.path} · ${dataset.checks.length} test${dataset.checks.length === 1 ? "" : "s"}`;
43
+ : `${dataset.path} · ${dataset.checks.length} readiness check${dataset.checks.length === 1 ? "" : "s"}`;
36
44
  }
37
45
  async function promptWorkflowDatasetFolder(sourcePath, prompts) {
46
+ const savedDatasets = listSourceDatasetConfigs(loadSourceFolderConfig(sourcePath));
38
47
  const folderChoices = listDatasetFolderChoices(sourcePath);
39
48
  if (folderChoices.length > 0) {
40
49
  const selected = await prompts.select({
41
- message: "Which source folder should shape this workflow?",
50
+ message: "Which Source Folder should shape this Method?",
42
51
  options: [
52
+ ...savedDatasets.map((dataset) => ({
53
+ value: dataset.name,
54
+ label: dataset.name,
55
+ hint: describeSavedDataset(dataset),
56
+ })),
43
57
  ...folderChoices,
44
58
  {
45
59
  value: "__manual__",
46
60
  label: "Enter a different path",
47
- hint: "Use a relative path if the source folder is not listed here",
61
+ hint: "Use a relative path if the Source Folder is not listed here",
48
62
  },
49
63
  ],
50
64
  });
51
65
  if (prompts.isCancel(selected))
52
66
  return selected;
53
67
  if (selected !== "__manual__") {
68
+ const savedDataset = savedDatasets.find((dataset) => dataset.name === selected);
69
+ if (savedDataset) {
70
+ return resolveSourceDatasetPath(sourcePath, savedDataset);
71
+ }
54
72
  return resolve(sourcePath, normalizeDatasetPathForConfig(sourcePath, String(selected)));
55
73
  }
56
74
  }
57
75
  const datasetFolder = await prompts.text({
58
- message: "Which source folder should shape this workflow?",
76
+ message: "Which Source Folder should shape this Method?",
59
77
  placeholder: DEFAULT_DATASET_PATH_PLACEHOLDER,
60
78
  initialValue: folderChoices.length === 1 ? folderChoices[0]?.value : undefined,
61
79
  validate: (value) => {
62
80
  const trimmed = value.trim();
63
81
  if (trimmed.length === 0)
64
- return "Source folder is required";
82
+ return "Source Folder is required";
65
83
  try {
66
84
  normalizeDatasetPathForConfig(sourcePath, trimmed);
67
85
  return undefined;
@@ -85,6 +103,15 @@ export function formatWorkflowLabel(workflow) {
85
103
  export function buildCompiledWorkflowOptions(sourcePath) {
86
104
  return listCompiledWorkflowChoices(sourcePath).map(formatWorkflowLabel);
87
105
  }
106
+ function workflowUseLabel(workflow) {
107
+ if (workflow.value === "interf-default" || workflow.value === "interf") {
108
+ return "built-in Method";
109
+ }
110
+ return workflow.label.replace(/ \(Local\)$/, "");
111
+ }
112
+ function workflowForkLabel(workflow) {
113
+ return `Fork ${workflowUseLabel(workflow)}`;
114
+ }
88
115
  export async function chooseCompiledWorkflow(sourcePath, options = {}) {
89
116
  const currentWorkflowId = options.currentWorkflowId;
90
117
  const workflowOptions = buildCompiledWorkflowOptions(sourcePath);
@@ -107,50 +134,137 @@ export async function chooseCompiledWorkflow(sourcePath, options = {}) {
107
134
  return orderedOptions[0]?.value ?? "interf";
108
135
  }
109
136
  return p.select({
110
- message: options.message ?? "Dataset workflow?",
137
+ message: options.message ?? "Preparation Method?",
111
138
  options: orderedOptions,
112
139
  });
113
140
  }
141
+ export async function chooseOrCreateCompiledWorkflowForDataset(sourcePath, datasetConfig, options = {}, prompts = clackWorkflowPrompts) {
142
+ const currentWorkflowId = options.currentWorkflowId ?? datasetConfig.workflow ?? "interf-default";
143
+ const allWorkflowOptions = buildCompiledWorkflowOptions(sourcePath);
144
+ const workflowOptions = allWorkflowOptions.filter((workflow) => workflow.value !== "interf");
145
+ const builtinDefault = allWorkflowOptions.find((workflow) => workflow.value === "interf");
146
+ const virtualDefaultWorkflow = builtinDefault
147
+ ? {
148
+ value: "interf-default",
149
+ label: "built-in Method",
150
+ hint: "Use the built-in Method without drafting a custom package",
151
+ }
152
+ : undefined;
153
+ const currentWorkflow = workflowOptions.find((workflow) => workflow.value === currentWorkflowId) ??
154
+ workflowOptions.find((workflow) => workflow.value === "interf-default") ??
155
+ (currentWorkflowId === "interf-default" ? virtualDefaultWorkflow : undefined) ??
156
+ workflowOptions[0];
157
+ const selected = await prompts.select({
158
+ message: "Which Method should Interf use for this Preparation?",
159
+ options: [
160
+ {
161
+ value: "__draft_from_scratch__",
162
+ label: "Draft a new Method from scratch (Recommended)",
163
+ hint: "Start from a neutral scaffold; an agent designs stages, outputs, and proof for this Preparation",
164
+ },
165
+ ...(currentWorkflow
166
+ ? [{
167
+ value: "__current__",
168
+ label: `Use ${workflowUseLabel(currentWorkflow)}`,
169
+ hint: currentWorkflow.value === "interf-default"
170
+ ? "Use the built-in Method without drafting a custom package"
171
+ : currentWorkflow.hint,
172
+ }]
173
+ : []),
174
+ ...(currentWorkflow
175
+ ? [{
176
+ value: "__fork_existing__",
177
+ label: workflowForkLabel(currentWorkflow),
178
+ hint: "Copy its existing stage topology, then write the per-stage guidance yourself",
179
+ }]
180
+ : []),
181
+ ...workflowOptions
182
+ .filter((workflow) => workflow.value !== currentWorkflow?.value)
183
+ .map((workflow) => ({
184
+ ...workflow,
185
+ label: `Use ${workflowUseLabel(workflow)}`,
186
+ })),
187
+ ],
188
+ });
189
+ if (prompts.isCancel(selected))
190
+ return selected;
191
+ if (selected === "__current__") {
192
+ if (currentWorkflow?.value === "interf-default") {
193
+ seedLocalDefaultWorkflow({ sourcePath });
194
+ }
195
+ return currentWorkflow?.value ?? currentWorkflowId;
196
+ }
197
+ if (selected === "__draft_from_scratch__" || selected === "__fork_existing__") {
198
+ if (selected === "__fork_existing__" && currentWorkflow?.value === "interf-default") {
199
+ seedLocalDefaultWorkflow({ sourcePath });
200
+ }
201
+ const workflowId = await createWorkflowWizard({
202
+ intro: false,
203
+ sourcePath,
204
+ baseWorkflowId: selected === "__fork_existing__"
205
+ ? currentWorkflow?.value ?? currentWorkflowId
206
+ : undefined,
207
+ creationMode: selected === "__draft_from_scratch__" ? "draft-from-scratch" : "fork-existing",
208
+ executionProfile: options.executionProfile,
209
+ resolveExecutor: options.resolveExecutor,
210
+ runDraft: options.runDraft,
211
+ datasetContext: {
212
+ config: datasetConfig,
213
+ datasetPath: resolveSourceDatasetPath(sourcePath, datasetConfig),
214
+ },
215
+ }, prompts);
216
+ return workflowId;
217
+ }
218
+ return String(selected);
219
+ }
114
220
  export async function createWorkflowWizard(options = {}, prompts = clackWorkflowPrompts) {
115
221
  if (options.intro !== false) {
116
- prompts.intro(chalk.bold("Create a workflow"));
222
+ prompts.intro(chalk.bold("Create a Method"));
117
223
  }
118
224
  const sourcePath = options.sourcePath ?? process.cwd();
119
225
  return createCompiledWorkflowWizard(sourcePath, prompts, {
120
226
  executionProfile: options.executionProfile,
227
+ baseWorkflowId: options.baseWorkflowId,
228
+ creationMode: options.creationMode,
121
229
  datasetContext: options.datasetContext,
122
230
  resolveExecutor: options.resolveExecutor,
123
231
  runDraft: options.runDraft,
124
232
  });
125
233
  }
126
234
  export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWorkflowPrompts, options = {}) {
127
- const baseWorkflow = await prompts.select({
128
- message: "Start from which existing workflow?",
129
- options: listCompiledWorkflowChoices(sourcePath).map(formatWorkflowLabel),
130
- });
131
- if (prompts.isCancel(baseWorkflow))
132
- return baseWorkflow;
133
- const resolvedBaseWorkflow = getCompiledWorkflow(String(baseWorkflow), { sourcePath });
134
- const creationMode = await prompts.select({
235
+ const creationMode = options.creationMode ?? await prompts.select({
135
236
  message: "How do you want to create it?",
136
237
  options: [
137
238
  {
138
- value: "draft",
139
- label: "Draft a workflow from this source folder (Recommended)",
140
- hint: "Seed a workflow, build a preview, then let a local agent draft a reusable method for this kind of work",
239
+ value: "draft-from-scratch",
240
+ label: "Draft a new Method from scratch (Recommended)",
241
+ hint: "Start from a neutral scaffold and let a local agent design a reusable Method for this kind of agent work",
141
242
  },
142
243
  {
143
- value: "manual",
144
- label: "Copy an existing workflow",
145
- hint: "Start from an existing workflow and edit stage guidance directly",
244
+ value: "fork-existing",
245
+ label: "Fork an existing Method and edit stage guidance",
246
+ hint: "Copy an existing topology; choose this when the stages are right but their emphasis should change",
146
247
  },
147
248
  ],
148
249
  });
149
250
  if (prompts.isCancel(creationMode))
150
251
  return creationMode;
252
+ const creationModeValue = normalizeWorkflowCreationMode(creationMode);
253
+ const baseWorkflow = creationModeValue === "fork-existing"
254
+ ? options.baseWorkflowId ?? await prompts.select({
255
+ message: "Which existing Method should Interf fork?",
256
+ options: listCompiledWorkflowChoices(sourcePath).map(formatWorkflowLabel),
257
+ })
258
+ : null;
259
+ if (prompts.isCancel(baseWorkflow))
260
+ return baseWorkflow;
261
+ const baseWorkflowId = typeof baseWorkflow === "string" ? baseWorkflow : null;
262
+ const resolvedBaseWorkflow = baseWorkflowId
263
+ ? getCompiledWorkflow(baseWorkflowId, { sourcePath })
264
+ : null;
151
265
  const rawName = await prompts.text({
152
- message: "New workflow name?",
153
- placeholder: "founder-research",
266
+ message: "New Method name?",
267
+ placeholder: "customer-research",
154
268
  validate: (value) => {
155
269
  if (value.trim().length === 0)
156
270
  return "Name is required";
@@ -158,7 +272,7 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
158
272
  if (!isWorkflowId(workflowId))
159
273
  return "Use letters, numbers, and dashes only";
160
274
  if (listCompiledWorkflowChoices(sourcePath).some((workflow) => workflow.id === workflowId)) {
161
- return "That workflow name already exists";
275
+ return "That Method name already exists";
162
276
  }
163
277
  return undefined;
164
278
  },
@@ -168,20 +282,20 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
168
282
  const workflowId = slugify(rawName);
169
283
  const label = rawName.trim();
170
284
  const hint = await prompts.text({
171
- message: "One-line workflow description?",
285
+ message: "One-line Method description?",
172
286
  placeholder: "Bias toward evidence-backed summaries and strong retrieval structure",
173
287
  validate: (value) => (value.trim().length === 0 ? "Description is required" : undefined),
174
288
  });
175
289
  if (prompts.isCancel(hint))
176
290
  return hint;
177
- if (creationMode === "draft") {
291
+ if (creationModeValue === "draft-from-scratch") {
178
292
  let datasetPath = options.datasetContext?.datasetPath ?? null;
179
293
  let matchedDataset = options.datasetContext?.config ?? null;
180
294
  if (!datasetPath) {
181
295
  const savedDatasets = listSourceDatasetConfigs(loadSourceFolderConfig(sourcePath));
182
296
  if (savedDatasets.length > 0) {
183
297
  const datasetChoice = await prompts.select({
184
- message: "Which source folder setup should shape this workflow?",
298
+ message: "Which saved Preparation should shape this Method?",
185
299
  options: [
186
300
  ...savedDatasets.map((dataset) => ({
187
301
  value: dataset.name,
@@ -191,7 +305,7 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
191
305
  {
192
306
  value: "__manual__",
193
307
  label: "Enter folder path manually",
194
- hint: "Use a folder that is not saved as a dataset yet",
308
+ hint: "Use a folder that is not saved as a Preparation yet",
195
309
  },
196
310
  ],
197
311
  });
@@ -215,48 +329,97 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
215
329
  matchedDataset = matchedDataset ?? findMatchingDatasetConfig(sourcePath, datasetPath);
216
330
  }
217
331
  const taskPrompt = await prompts.text({
218
- message: "How do you want to organize your files?",
219
- placeholder: "Research interview transcripts. Agent produces per-interview summaries and a themes list with supporting quotes. Flow: summarize each, group by theme, collect evidence across interviews.",
332
+ message: "What should this Method prepare for agents, and what evidence should show the data is ready?",
333
+ placeholder: "Data: research interviews. Output: per-file summaries, themes, entities, claims, and source links. Evidence: every file processed, evidence linked to sources, required outputs created.",
220
334
  validate: (value) => (value.trim().length === 0 ? "A description is required" : undefined),
221
335
  });
222
336
  if (prompts.isCancel(taskPrompt))
223
337
  return taskPrompt;
224
338
  if (matchedDataset) {
225
- prompts.log.info(`Shaping this workflow from setup "${matchedDataset.name}".`);
339
+ prompts.log.info(`Shaping this Method from Preparation "${matchedDataset.name}".`);
226
340
  }
227
341
  if (matchedDataset?.checks.length) {
228
- prompts.log.info(`Using ${matchedDataset.checks.length} saved question${matchedDataset.checks.length === 1 ? "" : "s"} from setup "${matchedDataset.name}" as authoring context.`);
342
+ prompts.log.info(`Using ${matchedDataset.checks.length} saved readiness check${matchedDataset.checks.length === 1 ? "" : "s"} from Preparation "${matchedDataset.name}" as authoring context.`);
229
343
  }
230
- const resolveExecutor = options.resolveExecutor ?? resolveOrConfigureLocalExecutor;
231
- const runDraft = options.runDraft ?? runWorkflowAuthoringDraft;
232
- const { executor, error } = await resolveExecutor({
233
- executionProfile: options.executionProfile,
234
- purpose: "workflow",
344
+ prompts.log.info("Preparing a Method-authoring shell from the Source Folder, then drafting the package.");
345
+ let lastServiceStatus = "";
346
+ const serviceRun = await submitWorkflowAuthoringRunToLocalService({
347
+ projectPath: sourcePath,
348
+ request: {
349
+ preparation: matchedDataset?.name ?? null,
350
+ source_folder_path: datasetPath,
351
+ method_id: workflowId,
352
+ label,
353
+ hint: hint.trim(),
354
+ task_prompt: taskPrompt.trim(),
355
+ checks: matchedDataset?.checks ?? [],
356
+ },
357
+ onSubmitted: (submission) => {
358
+ prompts.log.info(`Visible in Interf: ${submission.serviceUrl}/`);
359
+ },
360
+ onUpdate: (job) => {
361
+ const activeStep = job.steps.find((step) => step.status === "running")
362
+ ?? [...job.steps].reverse().find((step) => step.status === "succeeded" || step.status === "failed")
363
+ ?? null;
364
+ const statusKey = `${job.status}:${activeStep?.id ?? ""}:${activeStep?.status ?? ""}`;
365
+ if (statusKey === lastServiceStatus)
366
+ return;
367
+ lastServiceStatus = statusKey;
368
+ prompts.log.info(activeStep
369
+ ? `${activeStep.label}: ${activeStep.status}`
370
+ : `Method draft run: ${job.status}`);
371
+ },
235
372
  });
236
- if (!executor && !error) {
237
- return null;
238
- }
239
- if (!executor) {
240
- process.exitCode = 1;
241
- (prompts.log.error ?? prompts.log.info)(error ?? "No coding agent detected.");
373
+ const result = serviceRun
374
+ ? serviceRun.result
375
+ ? {
376
+ status: serviceRun.result.status,
377
+ changed: serviceRun.result.changed,
378
+ summary: serviceRun.result.summary,
379
+ validation: serviceRun.result.validation ?? null,
380
+ workflowPath: serviceRun.result.method_path,
381
+ shellPath: serviceRun.result.shell_path,
382
+ }
383
+ : {
384
+ status: "executor-failed",
385
+ changed: false,
386
+ summary: serviceRun.error ?? "Method authoring failed in the local Interf service.",
387
+ validation: null,
388
+ workflowPath: resolve(sourcePath, "interf", "methods", workflowId),
389
+ shellPath: resolve(sourcePath, "interf", "methods", workflowId),
390
+ }
391
+ : await (async () => {
392
+ const resolveExecutor = options.resolveExecutor ?? resolveOrConfigureLocalExecutor;
393
+ const runDraft = options.runDraft ?? runWorkflowAuthoringDraft;
394
+ const { executor, error } = await resolveExecutor({
395
+ executionProfile: options.executionProfile,
396
+ purpose: "workflow",
397
+ });
398
+ if (!executor && !error) {
399
+ return null;
400
+ }
401
+ if (!executor) {
402
+ process.exitCode = 1;
403
+ (prompts.log.error ?? prompts.log.info)(error ?? "No coding agent detected.");
404
+ return null;
405
+ }
406
+ return runDraft({
407
+ sourcePath,
408
+ datasetPath,
409
+ workflowId,
410
+ label,
411
+ hint: hint.trim(),
412
+ taskPrompt: taskPrompt.trim(),
413
+ checks: matchedDataset?.checks ?? [],
414
+ executor,
415
+ onStatus: (line) => prompts.log.info(line),
416
+ });
417
+ })();
418
+ if (!result)
242
419
  return null;
243
- }
244
- prompts.log.info("Preparing a workflow-authoring preview from the source folder, then drafting the package.");
245
- const result = await runDraft({
246
- sourcePath,
247
- datasetPath,
248
- baseWorkflowId: baseWorkflow,
249
- workflowId,
250
- label,
251
- hint: hint.trim(),
252
- taskPrompt: taskPrompt.trim(),
253
- checks: matchedDataset?.checks ?? [],
254
- executor,
255
- preparePreview: true,
256
- });
257
420
  if (result.status === "updated") {
258
421
  const draft = loadWorkflowDefinitionFromDir(result.workflowPath);
259
- const stageList = draft?.stages?.map((stage) => stage.id).join(" ") ?? "";
422
+ const stageList = draft?.stages?.map((stage) => stage.id).join(" -> ") ?? "-";
260
423
  prompts.log.info(`Draft ready at ${result.workflowPath}`);
261
424
  prompts.log.info(` Name: ${draft?.label ?? label}`);
262
425
  prompts.log.info(` Description: ${draft?.hint ?? hint.trim()}`);
@@ -264,9 +427,9 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
264
427
  prompts.log.info(` Purpose: ${draft.purpose}`);
265
428
  prompts.log.info(` Stages: ${stageList}`);
266
429
  const confirmChoice = await prompts.select({
267
- message: "Save this workflow?",
430
+ message: "Save this Method?",
268
431
  options: [
269
- { value: "save", label: "Save", hint: "Keep the draft as your new compilation workflow" },
432
+ { value: "save", label: "Save", hint: "Keep the draft as your new Method package" },
270
433
  { value: "cancel", label: "Discard", hint: "Remove the draft folder and exit without saving" },
271
434
  ],
272
435
  });
@@ -275,17 +438,20 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
275
438
  prompts.log.info(`Discarded draft at ${result.workflowPath}`);
276
439
  return null;
277
440
  }
278
- prompts.log.info(`Saved local workflow: ${result.workflowPath}`);
441
+ prompts.log.info(`Saved local Method: ${result.workflowPath}`);
279
442
  return workflowId;
280
443
  }
281
444
  process.exitCode = 1;
282
445
  (prompts.log.error ?? prompts.log.info)(result.status === "no-change"
283
- ? `${result.summary} Draft mode only succeeds when it produces a work-specific package change.`
446
+ ? `${result.summary} Draft mode only succeeds when it produces an agent-work-specific package change.`
284
447
  : result.summary);
285
- prompts.log.info(`Workflow shell kept at: ${result.shellPath}`);
448
+ prompts.log.info(`Method shell kept at: ${result.shellPath}`);
286
449
  return null;
287
450
  }
288
451
  const stagePolicyNotes = {};
452
+ if (!baseWorkflowId || !resolvedBaseWorkflow) {
453
+ throw new Error("Fork-existing Method creation needs a base Method.");
454
+ }
289
455
  for (const stage of resolvedBaseWorkflow.stages) {
290
456
  const stagePrompt = await prompts.text({
291
457
  message: `What should ${stage.id} (${stage.label}) emphasize?`,
@@ -298,12 +464,12 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
298
464
  }
299
465
  const workflowPath = createLocalWorkflowPackageFromTemplate({
300
466
  sourcePath,
301
- baseWorkflowId: baseWorkflow,
467
+ baseWorkflowId,
302
468
  workflowId,
303
469
  label,
304
470
  hint: hint.trim(),
305
471
  stagePolicyNotes,
306
472
  });
307
- prompts.log.info(`Saved local workflow: ${workflowPath}`);
473
+ prompts.log.info(`Saved local Method: ${workflowPath}`);
308
474
  return workflowId;
309
475
  }