@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
@@ -2,37 +2,37 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no
2
2
  import { tmpdir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { z } from "zod";
5
- const DraftTruthCheckSchema = z.object({
5
+ const DraftReadinessCheckSchema = z.object({
6
6
  question: z.string().min(1),
7
7
  answer: z.string().min(1),
8
8
  }).strict();
9
- const DraftTruthChecksSchema = z.array(DraftTruthCheckSchema).min(1).max(8);
10
- export function buildTruthCheckDraftPrompt(options) {
9
+ const DraftReadinessChecksSchema = z.array(DraftReadinessCheckSchema).min(1).max(8);
10
+ export function buildReadinessCheckDraftPrompt(options) {
11
11
  const normalizedAbout = options.about?.trim();
12
12
  const taskLines = normalizedAbout
13
13
  ? [
14
- `Primary work: ${normalizedAbout}`,
15
- "Draft checks that directly measure whether a local agent can answer the key questions from the data behind that work.",
16
- "Prefer checks that would make a human confident the dataset is useful for that exact job.",
14
+ `Primary agent work: ${normalizedAbout}`,
15
+ "Draft readiness checks that directly measure whether a local agent can recover the agent-work-critical facts from the source files.",
16
+ "Prefer checks that would make a human confident the Preparation is useful for that exact job.",
17
17
  ]
18
18
  : [
19
- "No primary work was provided.",
20
- "Prefer broad, representative checks that reflect the most useful questions a human would verify from this source folder.",
19
+ "No primary agent work was provided.",
20
+ "Prefer broad, representative readiness checks that reflect the facts a human would verify from this Source Folder.",
21
21
  ];
22
22
  return [
23
- "You are drafting Interf checks for a local source folder.",
23
+ "You are drafting Interf readiness checks for a local Source Folder.",
24
24
  "Read the files in this folder and draft a small set of checks that a human can verify from the source material.",
25
25
  "Do not ask follow-up questions.",
26
- "Keep the checks concrete, explicit, and useful for measuring whether an agent can reason correctly over the files in this source folder.",
26
+ "Keep the checks concrete, explicit, and useful for measuring whether an agent can reason correctly over the files in this Source Folder.",
27
27
  "",
28
- `Setup id: ${options.datasetName}`,
29
- `Source folder: ${options.datasetPath}`,
28
+ `Preparation id: ${options.datasetName}`,
29
+ `Source Folder: ${options.datasetPath}`,
30
30
  ...taskLines,
31
31
  "",
32
32
  `Write exactly one JSON array to ${JSON.stringify(options.outputPath)}.`,
33
- `Draft ${options.targetCount} checks unless the source folder is too small; in that case write fewer.`,
33
+ `Draft ${options.targetCount} checks unless the Source Folder is too small; in that case write fewer.`,
34
34
  "Each array item must be an object with exactly these keys:",
35
- '- "question": a plain-English question answerable from this source folder',
35
+ '- "question": a plain-English question answerable from this Source Folder',
36
36
  '- "answer": the expected correct answer in plain English',
37
37
  "",
38
38
  "Quality bar:",
@@ -52,11 +52,11 @@ export function buildTruthCheckDraftPrompt(options) {
52
52
  "- Stop after writing the file.",
53
53
  ].join("\n");
54
54
  }
55
- export async function draftTruthChecks(options) {
55
+ export async function draftReadinessChecks(options) {
56
56
  const tempDir = mkdtempSync(join(tmpdir(), "interf-draft-checks-"));
57
57
  const outputPath = join(tempDir, "checks.json");
58
58
  const promptPath = join(tempDir, "prompt.txt");
59
- const prompt = buildTruthCheckDraftPrompt({
59
+ const prompt = buildReadinessCheckDraftPrompt({
60
60
  datasetName: options.datasetName,
61
61
  datasetPath: options.datasetPath,
62
62
  about: options.about,
@@ -67,6 +67,7 @@ export async function draftTruthChecks(options) {
67
67
  try {
68
68
  const code = await options.executor.execute(options.datasetPath, prompt, {
69
69
  completionCheck: () => existsSync(outputPath),
70
+ onStatus: options.onStatus,
70
71
  });
71
72
  if (!existsSync(outputPath)) {
72
73
  return {
@@ -86,7 +87,7 @@ export async function draftTruthChecks(options) {
86
87
  error: `Draft checks were not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
87
88
  };
88
89
  }
89
- const validated = DraftTruthChecksSchema.safeParse(parsed);
90
+ const validated = DraftReadinessChecksSchema.safeParse(parsed);
90
91
  if (!validated.success) {
91
92
  const detail = validated.error.issues[0]?.message ?? "invalid draft checks";
92
93
  return {
@@ -1,6 +1,7 @@
1
1
  import type { WorkflowExecutionProfile, WorkflowExecutor } from "../../packages/agents/lib/executors.js";
2
2
  import type { SourceDatasetConfig } from "../../packages/project-model/lib/schema.js";
3
3
  import type { StageShellRetentionMode } from "../../packages/compiler/workflows.js";
4
+ import type { RunEventSink } from "../../packages/execution/events.js";
4
5
  export declare function runConfiguredCompiledCompile(options: {
5
6
  executor: WorkflowExecutor;
6
7
  testExecutor?: WorkflowExecutor | null;
@@ -11,4 +12,6 @@ export declare function runConfiguredCompiledCompile(options: {
11
12
  maxAttemptsOverride: number | null;
12
13
  maxLoopsOverride: number | null;
13
14
  preserveStageShells?: StageShellRetentionMode;
15
+ runId?: string;
16
+ events?: RunEventSink;
14
17
  }): Promise<boolean>;
@@ -11,10 +11,10 @@ import { stageExecutionShellsRoot, workflowPackagePathForCompiled, } from "../..
11
11
  import { readCompiledSchemaFile } from "../../packages/compiler/compiled-schema.js";
12
12
  import { initializeCompiledRuntimeState } from "../../packages/compiler/state.js";
13
13
  import { compileCompiledWithReporter } from "./compiled-flow.js";
14
- import { printSavedTestOutcome, questionPassRate, runSavedCompiledTest, } from "./test-flow.js";
14
+ import { printSavedTestOutcome, readinessPassRate, runSavedCompiledTest, } from "./test-flow.js";
15
15
  function printCompileFailure(compiledPath, failedStage) {
16
- const workflowId = resolveRequiredCompiledWorkflowFromConfig(readInterfConfig(compiledPath), `.interf/interf.json for ${compiledPath}`);
17
- const failedStageLabel = formatActiveCompiledWorkflowStageStep(compiledPath, workflowId, failedStage ?? "compile");
16
+ resolveRequiredCompiledWorkflowFromConfig(readInterfConfig(compiledPath), `.interf/interf.json for ${compiledPath}`);
17
+ const failedStageLabel = formatActiveCompiledWorkflowStageStep(compiledPath, failedStage ?? "compile");
18
18
  console.log(chalk.red(` ${failedStageLabel} failed.`));
19
19
  }
20
20
  function testScore(outcome) {
@@ -33,7 +33,7 @@ function bestVariationRestorePaths(compiledPath) {
33
33
  ".agents",
34
34
  ".cursor",
35
35
  ".interf/interf.json",
36
- ".interf/workflow",
36
+ ".interf/method",
37
37
  ...zonePaths,
38
38
  ];
39
39
  }
@@ -78,17 +78,19 @@ async function runWorkflowVariation(options) {
78
78
  const resetTarget = attempt > 1
79
79
  ? `attempt ${attempt}/${options.maxAttempts}`
80
80
  : options.variationLabel;
81
- console.log(chalk.dim(` Resetting generated portable-context state before ${resetTarget}...`));
81
+ console.log(chalk.dim(` Resetting generated Portable Context state before ${resetTarget}...`));
82
82
  resetCompiledGeneratedState(options.compiledPath, "compile");
83
83
  }
84
84
  const result = await compileCompiledWithReporter(options.executor, options.compiledPath, {
85
85
  heading: options.maxAttempts > 1
86
- ? `Building portable context (${options.variationLabel}, attempt ${attempt}/${options.maxAttempts})...`
87
- : `Building portable context (${options.variationLabel})...`,
86
+ ? `Building Portable Context (${options.variationLabel}, attempt ${attempt}/${options.maxAttempts})...`
87
+ : `Building Portable Context (${options.variationLabel})...`,
88
88
  successMessage: options.maxAttempts > 1
89
- ? `Portable context ready for ${options.variationLabel}, attempt ${attempt}.`
90
- : `Portable context ready for ${options.variationLabel}.`,
89
+ ? `Portable Context ready for ${options.variationLabel}, attempt ${attempt}.`
90
+ : `Portable Context ready for ${options.variationLabel}.`,
91
91
  preserveStageShells: options.preserveStageShells,
92
+ runId: options.runId,
93
+ events: options.events,
92
94
  });
93
95
  if (!result.ok) {
94
96
  printCompileFailure(options.compiledPath, result.failedStage);
@@ -123,7 +125,7 @@ async function runWorkflowVariation(options) {
123
125
  bestOutcome,
124
126
  bestSnapshotPath,
125
127
  bestAttempt,
126
- fatalError: "Could not run the saved portable-context comparison after compile.",
128
+ fatalError: "Could not run the saved Portable Context comparison after compile.",
127
129
  };
128
130
  }
129
131
  console.log();
@@ -138,7 +140,7 @@ async function runWorkflowVariation(options) {
138
140
  }
139
141
  if (outcome.result.ok) {
140
142
  console.log();
141
- console.log(chalk.green(` Compiled context passed on ${options.variationLabel}, attempt ${attempt}/${options.maxAttempts}.`));
143
+ console.log(chalk.green(` Portable Context passed on ${options.variationLabel}, attempt ${attempt}/${options.maxAttempts}.`));
142
144
  printStageShellReviewHint(options.compiledPath, options.preserveStageShells, "success");
143
145
  return {
144
146
  passed: true,
@@ -152,7 +154,7 @@ async function runWorkflowVariation(options) {
152
154
  }
153
155
  if (attempt < options.maxAttempts) {
154
156
  console.log();
155
- console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} did not pass. Retrying with the same workflow.`));
157
+ console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} did not pass. Retrying with the same Method.`));
156
158
  }
157
159
  }
158
160
  return {
@@ -178,22 +180,22 @@ async function runWorkflowVariation(options) {
178
180
  }
179
181
  }
180
182
  function summarizeWorkflowVariation(options) {
181
- const passedQuestions = options.result.bestOutcome?.result.passedCases ?? 0;
182
- const totalQuestions = options.result.bestOutcome?.result.totalCases ?? options.defaultTotalQuestions;
183
+ const passedChecks = options.result.bestOutcome?.result.passedCases ?? 0;
184
+ const totalChecks = options.result.bestOutcome?.result.totalCases ?? options.defaultTotalChecks;
183
185
  const summary = options.result.passed
184
- ? `Passed ${passedQuestions}/${totalQuestions} questions.`
186
+ ? `Passed ${passedChecks}/${totalChecks} readiness checks.`
185
187
  : options.result.bestOutcome
186
- ? `Best result: ${passedQuestions}/${totalQuestions} questions passed.`
188
+ ? `Best result: ${passedChecks}/${totalChecks} readiness checks passed.`
187
189
  : options.result.failedStage
188
190
  ? `Compile failed at stage ${options.result.failedStage} before any saved comparison result.`
189
- : "Workflow variation did not produce a passing result.";
191
+ : "Method variation did not produce a passing result.";
190
192
  return {
191
193
  variation: options.variation,
192
194
  kind: options.kind,
193
195
  attempts_run: Math.max(1, options.result.attemptsRun),
194
196
  passed: options.result.passed,
195
- passed_questions: passedQuestions,
196
- total_questions: totalQuestions,
197
+ passed_questions: passedChecks,
198
+ total_questions: totalChecks,
197
199
  ...(options.result.failedStage ? { failed_stage: options.result.failedStage } : {}),
198
200
  ...(options.result.bestOutcome ? { test_run_path: options.result.bestOutcome.runPath } : {}),
199
201
  ...(options.result.bestOutcome?.result.sandbox_path
@@ -213,39 +215,39 @@ function printStageShellReviewHint(compiledPath, preserveStageShells, result) {
213
215
  }
214
216
  }
215
217
  function printPostCompileNextStep(options) {
216
- console.log(chalk.dim(` Portable context: ${options.compiledPath}`));
218
+ console.log(chalk.dim(` Portable Context: ${options.compiledPath}`));
217
219
  if (options.checks === 0) {
218
- console.log(chalk.dim(" Next: run `interf` to add questions, then `interf test`."));
220
+ console.log(chalk.dim(" Next: run `interf` to add readiness checks, then `interf test`."));
219
221
  return;
220
222
  }
221
223
  if (options.testedDuringCompile) {
222
- console.log(chalk.dim(" Next: inspect the portable context agents will use, or run `interf test` if you also want a source-files-versus-portable-context comparison."));
224
+ console.log(chalk.dim(" Next: inspect the Portable Context agents will use, or run `interf test` if you also want a source files versus Portable Context comparison."));
223
225
  return;
224
226
  }
225
- console.log(chalk.dim(" Next: run `interf test` to compare source files and portable context."));
227
+ console.log(chalk.dim(" Next: run `interf test` to compare source files and Portable Context."));
226
228
  }
227
- function formatVariationQuestionSummary(summary) {
229
+ function formatVariationReadinessSummary(summary) {
228
230
  return `${summary.passed_questions}/${summary.total_questions}`;
229
231
  }
230
232
  function printWorkflowVariationSummary(summaries) {
231
233
  if (summaries.length === 0)
232
234
  return;
233
235
  console.log();
234
- console.log(chalk.bold(" Workflow variation summary"));
236
+ console.log(chalk.bold(" Method variation summary"));
235
237
  console.log();
236
- console.log(" | Variation | Kind | Questions | Result |");
238
+ console.log(" | Variation | Kind | Readiness checks | Result |");
237
239
  console.log(" | --- | --- | --- | --- |");
238
240
  for (const summary of summaries) {
239
- console.log(` | ${summary.variation} | ${summary.kind} | \`${formatVariationQuestionSummary(summary)}\` | ${summary.passed ? "pass" : "fail"} |`);
241
+ console.log(` | ${summary.variation} | ${summary.kind} | \`${formatVariationReadinessSummary(summary)}\` | ${summary.passed ? "pass" : "fail"} |`);
240
242
  }
241
243
  }
242
244
  function printCompiledLocalWorkflowOwnership(compiledPath, bestVariation) {
243
245
  if (bestVariation <= 1)
244
246
  return;
245
247
  console.log();
246
- console.log(chalk.dim(` Best workflow variation now lives in: ${workflowPackagePathForCompiled(compiledPath)}`));
247
- console.log(chalk.dim(" The project-level workflow selection was not changed automatically."));
248
- console.log(chalk.dim(" Recompiling this existing portable context reuses that local workflow draft."));
248
+ console.log(chalk.dim(` Best Method variation now lives in: ${workflowPackagePathForCompiled(compiledPath)}`));
249
+ console.log(chalk.dim(" The project-level Method selection was not changed automatically."));
250
+ console.log(chalk.dim(" Recompiling this existing Portable Context reuses that local Method draft."));
249
251
  }
250
252
  export async function runConfiguredCompiledCompile(options) {
251
253
  const preserveStageShells = options.preserveStageShells ?? "on-failure";
@@ -255,24 +257,26 @@ export async function runConfiguredCompiledCompile(options) {
255
257
  const loopEnabled = maxAttempts != null;
256
258
  const checks = options.compiledConfig?.checks ?? [];
257
259
  if (loopEnabled && checks.length === 0) {
258
- console.log(chalk.yellow(" Retry and self-improving modes need saved questions. Building once without those loops."));
260
+ console.log(chalk.yellow(" Retry and self-improving modes need saved readiness checks. Building once without those loops."));
259
261
  }
260
262
  else if (loopEnabled) {
261
263
  if (maxAttempts > 1) {
262
264
  console.log(chalk.dim(` Retry mode: up to ${maxAttempts} compile attempts.`));
263
- console.log(chalk.dim(" Interf will rerun the same workflow variation, check the portable context agents can use, and stop early if it passes."));
265
+ console.log(chalk.dim(" Interf will rerun the same Method variation, check the Portable Context agents can use, and stop early if it passes."));
264
266
  }
265
267
  else {
266
- console.log(chalk.dim(" Compile mode: 1 attempt per workflow variation."));
268
+ console.log(chalk.dim(" Compilation mode: 1 attempt per Method variation."));
267
269
  }
268
270
  if (maxLoops != null) {
269
- console.log(chalk.dim(` Self-improving loops: up to ${maxLoops} workflow edits after retries fail.`));
270
- console.log(chalk.dim(" Interf will review failed runs, edit the workflow, and test new workflow variations."));
271
+ console.log(chalk.dim(` Self-improving loops: up to ${maxLoops} Method edits after retries fail.`));
272
+ console.log(chalk.dim(" Interf will review failed runs, edit the Method, and test new Method variations."));
271
273
  }
272
274
  }
273
275
  if (!loopEnabled || checks.length === 0) {
274
276
  const result = await compileCompiledWithReporter(options.executor, options.compiledPath, {
275
277
  preserveStageShells,
278
+ runId: options.runId,
279
+ events: options.events,
276
280
  });
277
281
  if (!result.ok) {
278
282
  process.exitCode = 1;
@@ -327,7 +331,9 @@ export async function runConfiguredCompiledCompile(options) {
327
331
  executionProfile: options.executionProfile,
328
332
  preserveStageShells,
329
333
  maxAttempts,
330
- variationLabel: "baseline workflow",
334
+ variationLabel: "baseline Method",
335
+ runId: options.runId,
336
+ events: options.events,
331
337
  });
332
338
  if (baseline.fatalError) {
333
339
  process.exitCode = 1;
@@ -339,7 +345,7 @@ export async function runConfiguredCompiledCompile(options) {
339
345
  variation: 1,
340
346
  kind: "baseline",
341
347
  result: baseline,
342
- defaultTotalQuestions: checks.length,
348
+ defaultTotalChecks: checks.length,
343
349
  }));
344
350
  if (baseline.passed) {
345
351
  printWorkflowVariationSummary(previousVariations);
@@ -353,7 +359,7 @@ export async function runConfiguredCompiledCompile(options) {
353
359
  if (maxLoops != null) {
354
360
  for (let loopIndex = 1; loopIndex <= maxLoops; loopIndex += 1) {
355
361
  console.log();
356
- console.log(chalk.dim(` Self-improving loop ${loopIndex}/${maxLoops}: reviewing failed runs and editing the workflow.`));
362
+ console.log(chalk.dim(` Self-improving loop ${loopIndex}/${maxLoops}: reviewing failed runs and editing the Method.`));
357
363
  const improvement = await runWorkflowImprovementLoop({
358
364
  executor: options.executor,
359
365
  compiledPath: options.compiledPath,
@@ -365,7 +371,7 @@ export async function runConfiguredCompiledCompile(options) {
365
371
  maxAttempts,
366
372
  previousVariations,
367
373
  });
368
- console.log(chalk.dim(` Workflow improvement shell: ${improvement.shellPath}`));
374
+ console.log(chalk.dim(` Method improvement shell: ${improvement.shellPath}`));
369
375
  if (improvement.status === "executor-failed") {
370
376
  process.exitCode = 1;
371
377
  console.log(chalk.red(` ${improvement.summary}`));
@@ -384,8 +390,10 @@ export async function runConfiguredCompiledCompile(options) {
384
390
  executionProfile: options.executionProfile,
385
391
  preserveStageShells,
386
392
  maxAttempts,
387
- variationLabel: `workflow variation ${loopIndex + 1}`,
393
+ variationLabel: `Method variation ${loopIndex + 1}`,
388
394
  resetBeforeFirstAttempt: true,
395
+ runId: options.runId,
396
+ events: options.events,
389
397
  });
390
398
  if (variation.fatalError) {
391
399
  process.exitCode = 1;
@@ -397,7 +405,7 @@ export async function runConfiguredCompiledCompile(options) {
397
405
  variation: loopIndex + 1,
398
406
  kind: "edited",
399
407
  result: variation,
400
- defaultTotalQuestions: checks.length,
408
+ defaultTotalChecks: checks.length,
401
409
  }));
402
410
  if (variation.passed) {
403
411
  printWorkflowVariationSummary(previousVariations);
@@ -414,20 +422,20 @@ export async function runConfiguredCompiledCompile(options) {
414
422
  if (bestSnapshotPath && bestVariation > 0) {
415
423
  restoreCompiledBestState(bestSnapshotPath, options.compiledPath);
416
424
  console.log();
417
- console.log(chalk.dim(` Restored the best-performing portable context from variation ${bestVariation}, attempt ${bestAttempt}.`));
425
+ console.log(chalk.dim(` Restored the best-performing Portable Context from variation ${bestVariation}, attempt ${bestAttempt}.`));
418
426
  }
419
427
  process.exitCode = 1;
420
428
  console.log();
421
429
  printWorkflowVariationSummary(previousVariations);
422
430
  printCompiledLocalWorkflowOwnership(options.compiledPath, bestVariation);
423
431
  if (maxLoops != null) {
424
- console.log(chalk.red(` Portable context did not pass after ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"} per variation and ${maxLoops} workflow-improvement loop${maxLoops === 1 ? "" : "s"}.`));
432
+ console.log(chalk.red(` Portable Context did not pass after ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"} per variation and ${maxLoops} Method-improvement loop${maxLoops === 1 ? "" : "s"}.`));
425
433
  }
426
434
  else {
427
- console.log(chalk.red(` Portable context did not pass within ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}.`));
435
+ console.log(chalk.red(` Portable Context did not pass within ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}.`));
428
436
  }
429
437
  if (bestOutcome) {
430
- console.log(chalk.dim(` Best attempt test pass rate: ${questionPassRate(bestOutcome)}%.`));
438
+ console.log(chalk.dim(` Best attempt readiness-check pass rate: ${readinessPassRate(bestOutcome)}%.`));
431
439
  }
432
440
  printStageShellReviewHint(options.compiledPath, preserveStageShells, "failure");
433
441
  return false;
@@ -4,20 +4,25 @@ import { detectInterf, readInterfConfig, resolveSourceControlPath, } from "../..
4
4
  import { loadCompiledDatasetConfig, sourceDatasetConfigFromInterfConfig, resolveDatasetCompileMaxAttempts, resolveDatasetCompileMaxLoops, } from "../../packages/project-model/source-config.js";
5
5
  import { addExecutionProfileOptions, executionProfileFromArgv, } from "../../packages/agents/lib/execution-profile.js";
6
6
  import { chooseCompiledConfigToBuild, ensureCompiledFromConfig, } from "./compiled-flow.js";
7
- import { resolveConfiguredDatasetSelection } from "./dataset-selection.js";
7
+ import { resolveConfiguredPreparationSelection } from "./preparation-selection.js";
8
8
  import { promptCompileLoopSelection, } from "./source-config-wizard.js";
9
9
  import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
10
10
  import { runConfiguredCompiledCompile } from "./compile-controller.js";
11
+ import { submitCompileRunToLocalService, waitForLocalCompileRun, } from "../../packages/local-service/index.js";
12
+ import { resolveCommandControlPath } from "./control-path.js";
11
13
  export { runConfiguredCompiledCompile } from "./compile-controller.js";
12
14
  export const compileCommand = {
13
15
  command: "compile",
14
- describe: "Build portable context agents can use and optionally run retry or self-improving compile loops",
15
- builder: (yargs) => addExecutionProfileOptions(yargs).option("max-attempts", {
16
+ describe: "Prepare files and write Portable Context agents can use",
17
+ builder: (yargs) => addExecutionProfileOptions(yargs).option("preparation", {
18
+ type: "string",
19
+ describe: "Preparation id to compile when this Source Folder has more than one Preparation",
20
+ }).option("max-attempts", {
16
21
  type: "number",
17
- describe: "Retry compile and test the same workflow until the dataset passes or reaches this total attempt limit",
22
+ describe: "Retry the prepare run and run saved readiness checks with the same Method until the Preparation is ready or reaches this total attempt limit",
18
23
  }).option("max-loops", {
19
24
  type: "number",
20
- describe: "After retries fail, let Interf edit the workflow and test new workflow variations for this dataset up to this loop limit",
25
+ describe: "After retries fail, let Interf edit the Method and run saved readiness checks on new Method variations for this Preparation up to this loop limit",
21
26
  }).option("keep-stage-shells", {
22
27
  type: "boolean",
23
28
  default: false,
@@ -42,8 +47,9 @@ function readHintedSourcePath(argv) {
42
47
  : null;
43
48
  }
44
49
  function readRequestedDatasetName(argv) {
45
- return typeof argv.dataset === "string" && argv.dataset.trim().length > 0
46
- ? argv.dataset.trim()
50
+ const raw = argv.preparation;
51
+ return typeof raw === "string" && raw.trim().length > 0
52
+ ? raw.trim()
47
53
  : null;
48
54
  }
49
55
  function shouldSkipCompileConfirm(argv) {
@@ -69,7 +75,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
69
75
  let compiledPath = null;
70
76
  const hintedSourcePath = readHintedSourcePath(argv);
71
77
  const detected = hintedSourcePath ? null : helpers.detectInterf(process.cwd());
72
- let sourcePath = hintedSourcePath ?? process.cwd();
78
+ let sourcePath = hintedSourcePath ?? resolveCommandControlPath();
73
79
  let compiledConfig = null;
74
80
  const requestedDatasetName = readRequestedDatasetName(argv);
75
81
  const hintedDatasetConfig = (argv.datasetConfig ?? null);
@@ -82,7 +88,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
82
88
  ?? sourceDatasetConfigFromInterfConfig(detected.config);
83
89
  if (!skipConfirm && process.stdin.isTTY && process.stdout.isTTY) {
84
90
  const confirmed = await helpers.confirm({
85
- message: `Compile dataset "${detected.config.name}" now?`,
91
+ message: `Prepare files for Preparation "${detected.config.name}" now?`,
86
92
  initialValue: true,
87
93
  });
88
94
  if (p.isCancel(confirmed) || !confirmed)
@@ -91,32 +97,32 @@ export async function runCompileCommand(argv = {}, deps = {}) {
91
97
  }
92
98
  else {
93
99
  const selectedCompiled = requestedDatasetName || hintedDatasetConfig
94
- ? resolveConfiguredDatasetSelection({
100
+ ? resolveConfiguredPreparationSelection({
95
101
  sourcePath,
96
- requestedDatasetName,
97
- hintedDatasetConfig,
102
+ requestedPreparationName: requestedDatasetName,
103
+ hintedPreparationConfig: hintedDatasetConfig,
98
104
  })
99
105
  : await helpers.chooseCompiledConfigToBuild({
100
106
  sourcePath,
101
- selectMessage: "Which source folder setup do you want to compile?",
107
+ selectMessage: "Which saved Preparation do you want to compile?",
102
108
  });
103
109
  if (selectedCompiled === undefined)
104
110
  return null;
105
111
  if (!selectedCompiled) {
106
112
  process.exitCode = 1;
107
113
  if (requestedDatasetName) {
108
- console.log(chalk.red(` Setup "${requestedDatasetName}" is not set up in this project.`));
109
- console.log(chalk.dim(" Run `interf list` to see the saved setups."));
114
+ console.log(chalk.red(` Preparation "${requestedDatasetName}" is not saved in this Source Folder.`));
115
+ console.log(chalk.dim(" Run `interf list` to see the saved Preparations."));
110
116
  }
111
117
  else {
112
- console.log(chalk.red(" No saved setups are configured for this folder yet."));
118
+ console.log(chalk.red(" No saved Preparations are configured for this Source Folder yet."));
113
119
  console.log(chalk.dim(" Start with `interf` or `interf init` to set up this folder."));
114
120
  }
115
121
  return null;
116
122
  }
117
123
  if (!skipConfirm && process.stdin.isTTY && process.stdout.isTTY) {
118
124
  const confirmed = await helpers.confirm({
119
- message: `Compile dataset "${selectedCompiled.name}" now?`,
125
+ message: `Prepare files for Preparation "${selectedCompiled.name}" now?`,
120
126
  initialValue: true,
121
127
  });
122
128
  if (p.isCancel(confirmed) || !confirmed)
@@ -125,7 +131,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
125
131
  compiledConfig = selectedCompiled;
126
132
  compiledPath = helpers.ensureCompiledFromConfig(sourcePath, selectedCompiled);
127
133
  if (!skipDatasetBanner) {
128
- console.log(chalk.dim(` Dataset: ${selectedCompiled.name}`));
134
+ console.log(chalk.dim(` Preparation: ${selectedCompiled.name}`));
129
135
  }
130
136
  }
131
137
  let maxAttemptsOverride = null;
@@ -155,6 +161,56 @@ export async function runCompileCommand(argv = {}, deps = {}) {
155
161
  maxAttemptsOverride,
156
162
  maxLoopsOverride,
157
163
  });
164
+ if (argv.skipService !== true && compiledConfig) {
165
+ const submitted = await submitCompileRunToLocalService({
166
+ projectPath: sourcePath,
167
+ request: {
168
+ preparation: compiledConfig.name,
169
+ ...(compiledConfig.method ? { method: compiledConfig.method } : {}),
170
+ ...(maxAttemptsOverride != null ? { max_attempts: maxAttemptsOverride } : {}),
171
+ ...(maxLoopsOverride != null ? { max_loops: maxLoopsOverride } : {}),
172
+ preserve_stage_shells: readStageShellRetentionMode(argv),
173
+ },
174
+ });
175
+ if (submitted) {
176
+ console.log(chalk.dim(` Visible in Interf: ${submitted.serviceUrl}/`));
177
+ let lastStatus = "";
178
+ let lastStage = "";
179
+ const completed = await waitForLocalCompileRun({
180
+ serviceUrl: submitted.serviceUrl,
181
+ runId: submitted.resource.run.run_id,
182
+ onUpdate(resource) {
183
+ const activeStage = resource.run.stages.find((stage) => stage.status === "running")
184
+ ?? [...resource.run.stages].reverse().find((stage) => stage.status === "succeeded" || stage.status === "failed")
185
+ ?? null;
186
+ const statusKey = `${resource.run.status}:${activeStage?.stage_id ?? ""}:${activeStage?.status ?? ""}`;
187
+ if (statusKey === `${lastStatus}:${lastStage}`)
188
+ return;
189
+ lastStatus = resource.run.status;
190
+ lastStage = `${activeStage?.stage_id ?? ""}:${activeStage?.status ?? ""}`;
191
+ if (activeStage) {
192
+ console.log(chalk.dim(` ${activeStage.stage_label ?? activeStage.stage_id}: ${activeStage.status}`));
193
+ }
194
+ else {
195
+ console.log(chalk.dim(` Prepare run: ${resource.run.status}`));
196
+ }
197
+ },
198
+ });
199
+ if (completed.run.status !== "succeeded") {
200
+ process.exitCode = 1;
201
+ const failure = completed.run.stages.find((stage) => stage.status === "failed");
202
+ console.log(chalk.red(` Prepare run ${completed.run.status}.`));
203
+ if (failure?.failure)
204
+ console.log(chalk.red(` ${failure.failure}`));
205
+ return null;
206
+ }
207
+ console.log(chalk.green(" Portable Context ready."));
208
+ return {
209
+ compiledPath: completed.run.portable_context_path,
210
+ testedDuringCompile,
211
+ };
212
+ }
213
+ }
158
214
  const executionProfile = executionProfileFromArgv(argv);
159
215
  const { executor, error } = await helpers.resolveOrConfigureLocalExecutor({
160
216
  executionProfile,
@@ -231,10 +287,10 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
231
287
  initialMaxAttempts: savedCompiledConfig.max_attempts,
232
288
  initialMaxLoops: savedCompiledConfig.max_loops,
233
289
  intro: [
234
- `Workflow: ${savedCompiledConfig.workflow ?? currentConfig?.workflow ?? "interf"}`,
235
- "This selection applies to this compile run only. It does not change the saved dataset setup.",
290
+ `Method: ${savedCompiledConfig.method ?? savedCompiledConfig.workflow ?? currentConfig?.method ?? currentConfig?.workflow ?? "interf-default"}`,
291
+ "This selection applies to this prepare run only. It does not change the saved Preparation.",
236
292
  ],
237
- message: "How should this compile run?",
293
+ message: "How should this prepare run work?",
238
294
  });
239
295
  if (overrideSelection === null)
240
296
  return null;
@@ -249,17 +305,17 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
249
305
  };
250
306
  }
251
307
  const savedMode = await p.select({
252
- message: "Which compile mode should this run use?",
308
+ message: "Which prepare mode should this run use?",
253
309
  options: [
254
310
  {
255
311
  value: "saved",
256
- label: "Use saved compile mode (Recommended)",
312
+ label: "Use saved prepare mode (Recommended)",
257
313
  hint: `${savedCompiledConfig.max_loops ? "Self-improving" : savedCompiledConfig.max_attempts && savedCompiledConfig.max_attempts > 1 ? "Retry" : "Single attempt"} · ${formatCompileModeHint(savedCompiledConfig)}`,
258
314
  },
259
315
  {
260
316
  value: "override",
261
317
  label: "Change it for this run only",
262
- hint: "Keep the saved dataset setup unchanged",
318
+ hint: "Keep the saved Preparation unchanged",
263
319
  },
264
320
  ],
265
321
  });
@@ -277,10 +333,10 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
277
333
  initialMaxAttempts: savedCompiledConfig.max_attempts,
278
334
  initialMaxLoops: savedCompiledConfig.max_loops,
279
335
  intro: [
280
- `Workflow: ${savedCompiledConfig.workflow ?? currentConfig?.workflow ?? "interf"}`,
281
- "This applies to this compile run only. It does not change the saved dataset setup.",
336
+ `Method: ${savedCompiledConfig.method ?? savedCompiledConfig.workflow ?? currentConfig?.method ?? currentConfig?.workflow ?? "interf-default"}`,
337
+ "This applies to this prepare run only. It does not change the saved Preparation.",
282
338
  ],
283
- message: "Override the compile mode for this run",
339
+ message: "Override the prepare mode for this run",
284
340
  });
285
341
  if (selection === null)
286
342
  return null;
@@ -1,6 +1,7 @@
1
1
  import type { SourceDatasetConfig } from "../../packages/project-model/lib/schema.js";
2
2
  import { type StageShellRetentionMode, type CompiledCompileResult } from "../../packages/compiler/workflows.js";
3
3
  import type { WorkflowExecutor } from "../../packages/agents/lib/executors.js";
4
+ import type { RunEventSink } from "../../packages/execution/events.js";
4
5
  export interface SavedDatasetEntry {
5
6
  config: SourceDatasetConfig;
6
7
  path: string | null;
@@ -19,4 +20,6 @@ export declare function compileCompiledWithReporter(executor: WorkflowExecutor,
19
20
  heading?: string;
20
21
  successMessage?: string;
21
22
  preserveStageShells?: StageShellRetentionMode;
23
+ runId?: string;
24
+ events?: RunEventSink;
22
25
  }): Promise<CompiledCompileResult>;