@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,10 +7,14 @@ import { resolveSourceControlPathForCompiled, compiledInterfConfigPath, } from "
7
7
  import { InterfConfigSchema, } from "./lib/schema.js";
8
8
  import { assertPathWithinRoot } from "../shared/path-guards.js";
9
9
  export const INTERF_CONTAINER_NAME = "interf";
10
- export const WORKFLOW_CONTAINER_NAME = "workflows";
10
+ export const METHOD_CONTAINER_NAME = "methods";
11
+ export const WORKFLOW_CONTAINER_NAME = METHOD_CONTAINER_NAME;
12
+ export const LEGACY_WORKFLOW_CONTAINER_NAME = "workflows";
11
13
  export const TEST_CONTAINER_NAME = "tests";
12
14
  export const INTERF_CONFIG_FILE = "interf.json";
13
- export const WORKFLOW_PACKAGE_DIR = "workflow";
15
+ export const METHOD_PACKAGE_DIR = "method";
16
+ export const WORKFLOW_PACKAGE_DIR = METHOD_PACKAGE_DIR;
17
+ export const LEGACY_WORKFLOW_PACKAGE_DIR = "workflow";
14
18
  export function readInterfConfig(dirPath) {
15
19
  const configPath = compiledInterfConfigPath(dirPath);
16
20
  if (!existsSync(configPath))
@@ -61,11 +65,17 @@ export function resolveSourceControlPath(compiledPath) {
61
65
  }
62
66
  export function resolveSourceInputPath(compiledPath) {
63
67
  const config = readInterfConfig(compiledPath);
64
- if (typeof config?.source?.dataset_path === "string" && config.source.dataset_path.length > 0) {
65
- const projectPath = resolveSourceControlPathForCompiled(compiledPath);
66
- return assertPathWithinRoot(projectPath, resolve(compiledPath, config.source.dataset_path), "Dataset source path");
68
+ const sourceBinding = typeof config?.source?.preparation_path === "string" && config.source.preparation_path.length > 0
69
+ ? config.source.preparation_path
70
+ : typeof config?.source?.source_folder_path === "string" && config.source.source_folder_path.length > 0
71
+ ? config.source.source_folder_path
72
+ : typeof config?.source?.dataset_path === "string" && config.source.dataset_path.length > 0
73
+ ? config.source.dataset_path
74
+ : null;
75
+ if (sourceBinding) {
76
+ return resolve(compiledPath, sourceBinding);
67
77
  }
68
- throw new Error(`Context folder is missing source.dataset_path in ${compiledInterfConfigPath(compiledPath)}.`);
78
+ throw new Error(`Portable context is missing source.preparation_path in ${compiledInterfConfigPath(compiledPath)}.`);
69
79
  }
70
80
  export function listCompiledDatasetsForSourceFolder(sourcePath) {
71
81
  const interfRoot = projectInterfRoot(sourcePath);
@@ -82,7 +92,9 @@ export function listCompiledDatasetsForSourceFolder(sourcePath) {
82
92
  return readdirSync(interfRoot)
83
93
  .filter((entry) => !entry.startsWith(".") &&
84
94
  entry !== WORKFLOW_CONTAINER_NAME &&
85
- entry !== TEST_CONTAINER_NAME)
95
+ entry !== LEGACY_WORKFLOW_CONTAINER_NAME &&
96
+ entry !== TEST_CONTAINER_NAME &&
97
+ entry !== INTERF_CONFIG_FILE)
86
98
  .map((entry) => compiledCompiledPathForDataset(sourcePath, entry))
87
99
  .filter((compiledPath) => existsSync(compiledPath))
88
100
  .map((compiledPath) => {
@@ -102,24 +114,33 @@ export function assertCompiledContainer(sourcePath) {
102
114
  if (entry.startsWith("."))
103
115
  return false;
104
116
  const entryPath = join(interfRoot, entry);
105
- if (entry === WORKFLOW_CONTAINER_NAME || entry === TEST_CONTAINER_NAME) {
117
+ if (entry === INTERF_CONFIG_FILE) {
118
+ try {
119
+ return !statSync(entryPath).isFile();
120
+ }
121
+ catch (error) {
122
+ warnInterf(`Warning: failed to inspect Interf config path at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
123
+ return true;
124
+ }
125
+ }
126
+ if (entry === WORKFLOW_CONTAINER_NAME ||
127
+ entry === LEGACY_WORKFLOW_CONTAINER_NAME ||
128
+ entry === TEST_CONTAINER_NAME) {
106
129
  try {
107
130
  return !statSync(entryPath).isDirectory();
108
131
  }
109
132
  catch (error) {
110
- warnInterf(`Warning: failed to inspect Interf control-plane path at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
133
+ warnInterf(`Warning: failed to inspect Interf Workspace path at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
111
134
  return true;
112
135
  }
113
136
  }
114
137
  try {
115
- if (!statSync(entryPath).isDirectory())
116
- return true;
138
+ return !statSync(entryPath).isDirectory();
117
139
  }
118
140
  catch (error) {
119
141
  warnInterf(`Warning: failed to inspect Interf entry at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
120
142
  return true;
121
143
  }
122
- return false;
123
144
  });
124
145
  if (unexpectedRootEntries.length > 0) {
125
146
  throw new Error(`Interf container contains unexpected entries: ${interfRoot}`);
@@ -136,7 +157,19 @@ export function assertCompiledContainer(sourcePath) {
136
157
  const unexpectedEntries = readdirSync(containerPath).filter((entry) => {
137
158
  if (entry.startsWith("."))
138
159
  return false;
139
- if (entry === WORKFLOW_CONTAINER_NAME || entry === TEST_CONTAINER_NAME)
160
+ if (entry === INTERF_CONFIG_FILE) {
161
+ const entryPath = join(containerPath, entry);
162
+ try {
163
+ return !statSync(entryPath).isFile();
164
+ }
165
+ catch (error) {
166
+ warnInterf(`Warning: failed to inspect Interf config path at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
167
+ return true;
168
+ }
169
+ }
170
+ if (entry === WORKFLOW_CONTAINER_NAME ||
171
+ entry === LEGACY_WORKFLOW_CONTAINER_NAME ||
172
+ entry === TEST_CONTAINER_NAME)
140
173
  return false;
141
174
  const entryPath = join(containerPath, entry);
142
175
  try {
@@ -147,14 +180,10 @@ export function assertCompiledContainer(sourcePath) {
147
180
  warnInterf(`Warning: failed to inspect Interf entry at ${entryPath}: ${error instanceof Error ? error.message : String(error)}`);
148
181
  return true;
149
182
  }
150
- const compiledPath = compiledCompiledPathForDataset(sourcePath, entry);
151
- if (!existsSync(compiledPath)) {
152
- return false;
153
- }
154
- return !readInterfConfig(compiledPath);
183
+ return false;
155
184
  });
156
185
  if (unexpectedEntries.length > 0) {
157
- throw new Error(`Interf container contains invalid dataset entries: ${containerPath}`);
186
+ throw new Error(`Interf container contains invalid Preparation entries: ${containerPath}`);
158
187
  }
159
188
  return containerPath;
160
189
  }
@@ -1,2 +1,3 @@
1
+ export declare function ensurePortableContextScaffold(sourcePath: string, datasetName: string, workflowId?: string): string;
1
2
  export declare function createCompiled(name: string, sourcePath: string, workflowId?: string, about?: string, datasetPath?: string): string;
2
3
  export declare function defaultCompiledNameForSource(sourcePath: string): string;
@@ -1,15 +1,16 @@
1
1
  import { mkdirSync, existsSync, writeFileSync, } from "node:fs";
2
2
  import { basename, join, relative, sep } from "node:path";
3
3
  import { getCompiledWorkflow } from "../workflow-package/workflow-definitions.js";
4
+ import { loadWorkflowDefinitionFromDir, seedLocalDefaultWorkflow } from "../workflow-package/local-workflows.js";
4
5
  import { initializeCompiledRuntimeState, } from "../compiler/state.js";
5
6
  import { refreshCompiledBootstrapGuidance } from "../agents/lib/compiled-bootstrap.js";
6
7
  import { syncCompiledRawSnapshot } from "../compiler/raw-snapshot.js";
7
- import { assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
8
+ import { assertCompiledContainer, assertCompiledName, } from "./interf-detect.js";
8
9
  import { seedCompiledWorkflowPackage } from "../workflow-package/interf-workflow-package.js";
9
10
  import { compiledCompiledPathForDataset } from "./project-paths.js";
10
11
  import { ensureCompiledZoneTargets, readCompiledSchemaFile } from "../compiler/compiled-schema.js";
11
- import { findSourceDatasetConfig, listSourceDatasetConfigs, loadSourceFolderConfig, resolveSourceDatasetPath, saveCompiledInterfConfig, } from "./source-config.js";
12
- import { defaultControlPathForCompiled, workflowPackagePathForCompiled } from "../compiler/compiled-paths.js";
12
+ import { findSourceDatasetConfig, listSourceDatasetConfigs, loadSourceFolderConfig, methodIdForSourcePreparationConfig, resolveSourceDatasetPath, saveCompiledInterfConfig, } from "./source-config.js";
13
+ import { defaultControlPathForCompiled, testRootForCompiled, workflowPackagePathForCompiled } from "../compiler/compiled-paths.js";
13
14
  const DEFAULT_INTERFIGNORE = [
14
15
  ".claude/",
15
16
  ".codex/",
@@ -61,14 +62,40 @@ function scaffoldCompiledOutputs(compiledPath, compiledName, about) {
61
62
  writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName, zone.path, about));
62
63
  }
63
64
  }
64
- export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath) {
65
- assertCompiledName(name, "Portable context");
65
+ function localWorkflowMatches(compiledPath, workflowId) {
66
+ const localWorkflow = loadWorkflowDefinitionFromDir(workflowPackagePathForCompiled(compiledPath));
67
+ return localWorkflow?.id === workflowId;
68
+ }
69
+ export function ensurePortableContextScaffold(sourcePath, datasetName, workflowId = "interf") {
70
+ assertCompiledName(datasetName, "Portable context");
66
71
  assertCompiledContainer(sourcePath);
67
- const compiledPath = compiledCompiledPathForDataset(sourcePath, name);
68
- assertWritableTargetDir(compiledPath, "Portable context");
72
+ const compiledPath = compiledCompiledPathForDataset(sourcePath, datasetName);
69
73
  mkdirSync(compiledPath, { recursive: true });
70
- const savedCompiled = findSourceDatasetConfig(loadSourceFolderConfig(sourcePath), name);
74
+ mkdirSync(testRootForCompiled(compiledPath), { recursive: true });
75
+ if (workflowId === "interf-default") {
76
+ seedLocalDefaultWorkflow({ sourcePath });
77
+ }
71
78
  const selectedWorkflow = getCompiledWorkflow(workflowId, { sourcePath });
79
+ if (!localWorkflowMatches(compiledPath, selectedWorkflow.id)) {
80
+ seedCompiledWorkflowPackage({
81
+ compiledPath,
82
+ sourcePath,
83
+ workflowId: selectedWorkflow.id,
84
+ });
85
+ }
86
+ if (!existsSync(join(compiledPath, ".gitignore"))) {
87
+ writeFileSync(join(compiledPath, ".gitignore"), [...compiledGitignoreEntries(compiledPath), ""].join("\n"));
88
+ }
89
+ return compiledPath;
90
+ }
91
+ export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath) {
92
+ assertCompiledName(name, "Portable context");
93
+ const savedCompiled = findSourceDatasetConfig(loadSourceFolderConfig(sourcePath), name);
94
+ const effectiveWorkflowId = workflowId === "interf"
95
+ ? methodIdForSourcePreparationConfig(savedCompiled) ?? workflowId
96
+ : workflowId;
97
+ const selectedWorkflow = getCompiledWorkflow(effectiveWorkflowId, { sourcePath });
98
+ const compiledPath = ensurePortableContextScaffold(sourcePath, name, selectedWorkflow.id);
72
99
  const resolvedAbout = about ?? savedCompiled?.about;
73
100
  const resolvedDatasetPath = (() => {
74
101
  if (savedCompiled) {
@@ -81,13 +108,13 @@ export function createCompiled(name, sourcePath, workflowId = "interf", about, d
81
108
  if (configuredDatasets.length === 1) {
82
109
  return resolveSourceDatasetPath(sourcePath, configuredDatasets[0]);
83
110
  }
84
- throw new Error("Cannot infer the source folder for this portable context. Select a source folder first or pass an explicit dataset path.");
111
+ throw new Error("Cannot infer the source folder for this portable context. Select a source folder first or pass an explicit source folder path.");
85
112
  })();
86
113
  saveCompiledInterfConfig(compiledPath, {
87
114
  type: "compiled",
88
115
  name,
89
116
  ...(resolvedAbout ? { about: resolvedAbout } : {}),
90
- workflow: selectedWorkflow.id,
117
+ method: selectedWorkflow.id,
91
118
  ...(typeof savedCompiled?.max_attempts === "number"
92
119
  ? { max_attempts: savedCompiled.max_attempts }
93
120
  : {}),
@@ -95,24 +122,19 @@ export function createCompiled(name, sourcePath, workflowId = "interf", about, d
95
122
  ? { max_loops: savedCompiled.max_loops }
96
123
  : {}),
97
124
  checks: savedCompiled?.checks ?? [],
98
- workflow_origin: {
125
+ method_origin: {
99
126
  selected: selectedWorkflow.id,
100
127
  local_draft: false,
101
128
  },
102
129
  source: {
103
130
  path: "./raw",
104
131
  control_path: defaultControlPathForCompiled(compiledPath),
105
- dataset_path: relative(compiledPath, resolvedDatasetPath).split(sep).join("/") || ".",
132
+ preparation_path: relative(compiledPath, resolvedDatasetPath).split(sep).join("/") || ".",
106
133
  },
107
134
  });
108
135
  mkdirSync(join(compiledPath, "raw"), { recursive: true });
109
136
  syncCompiledRawSnapshot(compiledPath, resolvedDatasetPath);
110
137
  writeFileSync(join(compiledPath, ".interfignore"), DEFAULT_INTERFIGNORE);
111
- seedCompiledWorkflowPackage({
112
- compiledPath,
113
- sourcePath,
114
- workflowId: selectedWorkflow.id,
115
- });
116
138
  scaffoldCompiledOutputs(compiledPath, name, about);
117
139
  refreshCompiledBootstrapGuidance(compiledPath);
118
140
  writeFileSync(join(compiledPath, ".gitignore"), [...compiledGitignoreEntries(compiledPath), ""].join("\n"));
@@ -1,5 +1,5 @@
1
- export { INTERF_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, WORKFLOW_PACKAGE_DIR, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
1
+ export { INTERF_CONTAINER_NAME, METHOD_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, LEGACY_WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, METHOD_PACKAGE_DIR, WORKFLOW_PACKAGE_DIR, LEGACY_WORKFLOW_PACKAGE_DIR, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
2
2
  export type { InterfConfig, ResolvedCompiled } from "./interf-detect.js";
3
3
  export { ensureCompiledRawBinding, resolveCompiledRawPath, syncCompiledRawSnapshot, } from "./compiled-raw.js";
4
4
  export { refreshCompiledBootstrapGuidance, renderClaudeBootstrap, } from "./interf-bootstrap.js";
5
- export { createCompiled, defaultCompiledNameForSource, } from "./interf-scaffold.js";
5
+ export { createCompiled, defaultCompiledNameForSource, ensurePortableContextScaffold, } from "./interf-scaffold.js";
@@ -1,4 +1,4 @@
1
- export { INTERF_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, WORKFLOW_PACKAGE_DIR, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
1
+ export { INTERF_CONTAINER_NAME, METHOD_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, LEGACY_WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, METHOD_PACKAGE_DIR, WORKFLOW_PACKAGE_DIR, LEGACY_WORKFLOW_PACKAGE_DIR, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
2
2
  export { ensureCompiledRawBinding, resolveCompiledRawPath, syncCompiledRawSnapshot, } from "./compiled-raw.js";
3
3
  export { refreshCompiledBootstrapGuidance, renderClaudeBootstrap, } from "./interf-bootstrap.js";
4
- export { createCompiled, defaultCompiledNameForSource, } from "./interf-scaffold.js";
4
+ export { createCompiled, defaultCompiledNameForSource, ensurePortableContextScaffold, } from "./interf-scaffold.js";
@@ -1,6 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const DatasetNameSchema: z.ZodString;
3
- export declare const SourceTruthCheckSchema: z.ZodObject<{
3
+ export declare const PreparationNameSchema: z.ZodString;
4
+ export declare const MethodIdSchema: z.ZodString;
5
+ export declare const SourceReadinessCheckSchema: z.ZodObject<{
4
6
  id: z.ZodOptional<z.ZodString>;
5
7
  question: z.ZodString;
6
8
  answer: z.ZodOptional<z.ZodString>;
@@ -13,11 +15,35 @@ export declare const SourceTruthCheckSchema: z.ZodObject<{
13
15
  }, z.core.$strip>>;
14
16
  strictness: z.ZodOptional<z.ZodString>;
15
17
  }, z.core.$strict>;
18
+ export declare const SourcePreparationConfigSchema: z.ZodObject<{
19
+ id: z.ZodOptional<z.ZodString>;
20
+ name: z.ZodString;
21
+ path: z.ZodString;
22
+ about: z.ZodOptional<z.ZodString>;
23
+ method: z.ZodOptional<z.ZodString>;
24
+ workflow: z.ZodOptional<z.ZodString>;
25
+ max_attempts: z.ZodOptional<z.ZodNumber>;
26
+ max_loops: z.ZodOptional<z.ZodNumber>;
27
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
28
+ id: z.ZodOptional<z.ZodString>;
29
+ question: z.ZodString;
30
+ answer: z.ZodOptional<z.ZodString>;
31
+ expect: z.ZodOptional<z.ZodObject<{
32
+ must_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ must_include_one_of: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
34
+ must_not_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ min_words: z.ZodOptional<z.ZodNumber>;
36
+ max_words: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strip>>;
38
+ strictness: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strict>>>;
40
+ }, z.core.$strict>;
16
41
  export declare const SourceDatasetConfigSchema: z.ZodObject<{
17
42
  id: z.ZodOptional<z.ZodString>;
18
43
  name: z.ZodString;
19
44
  path: z.ZodString;
20
45
  about: z.ZodOptional<z.ZodString>;
46
+ method: z.ZodOptional<z.ZodString>;
21
47
  workflow: z.ZodOptional<z.ZodString>;
22
48
  max_attempts: z.ZodOptional<z.ZodNumber>;
23
49
  max_loops: z.ZodOptional<z.ZodNumber>;
@@ -35,11 +61,15 @@ export declare const SourceDatasetConfigSchema: z.ZodObject<{
35
61
  strictness: z.ZodOptional<z.ZodString>;
36
62
  }, z.core.$strict>>>;
37
63
  }, z.core.$strict>;
64
+ export declare const SourceFolderBindingSchema: z.ZodObject<{
65
+ path: z.ZodString;
66
+ }, z.core.$strict>;
38
67
  export declare const CompiledInterfConfigSchema: z.ZodObject<{
39
68
  type: z.ZodLiteral<"compiled">;
40
69
  name: z.ZodString;
41
70
  about: z.ZodOptional<z.ZodString>;
42
- workflow: z.ZodString;
71
+ method: z.ZodString;
72
+ workflow: z.ZodOptional<z.ZodString>;
43
73
  max_attempts: z.ZodOptional<z.ZodNumber>;
44
74
  max_loops: z.ZodOptional<z.ZodNumber>;
45
75
  checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -55,6 +85,10 @@ export declare const CompiledInterfConfigSchema: z.ZodObject<{
55
85
  }, z.core.$strip>>;
56
86
  strictness: z.ZodOptional<z.ZodString>;
57
87
  }, z.core.$strict>>>;
88
+ method_origin: z.ZodOptional<z.ZodObject<{
89
+ selected: z.ZodString;
90
+ local_draft: z.ZodOptional<z.ZodBoolean>;
91
+ }, z.core.$strip>>;
58
92
  workflow_origin: z.ZodOptional<z.ZodObject<{
59
93
  selected: z.ZodString;
60
94
  local_draft: z.ZodOptional<z.ZodBoolean>;
@@ -62,14 +96,17 @@ export declare const CompiledInterfConfigSchema: z.ZodObject<{
62
96
  source: z.ZodObject<{
63
97
  path: z.ZodString;
64
98
  control_path: z.ZodOptional<z.ZodString>;
65
- dataset_path: z.ZodString;
99
+ preparation_path: z.ZodOptional<z.ZodString>;
100
+ source_folder_path: z.ZodOptional<z.ZodString>;
101
+ dataset_path: z.ZodOptional<z.ZodString>;
66
102
  }, z.core.$strip>;
67
103
  }, z.core.$loose>;
68
104
  export declare const InterfConfigSchema: z.ZodObject<{
69
105
  type: z.ZodLiteral<"compiled">;
70
106
  name: z.ZodString;
71
107
  about: z.ZodOptional<z.ZodString>;
72
- workflow: z.ZodString;
108
+ method: z.ZodString;
109
+ workflow: z.ZodOptional<z.ZodString>;
73
110
  max_attempts: z.ZodOptional<z.ZodNumber>;
74
111
  max_loops: z.ZodOptional<z.ZodNumber>;
75
112
  checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -85,6 +122,10 @@ export declare const InterfConfigSchema: z.ZodObject<{
85
122
  }, z.core.$strip>>;
86
123
  strictness: z.ZodOptional<z.ZodString>;
87
124
  }, z.core.$strict>>>;
125
+ method_origin: z.ZodOptional<z.ZodObject<{
126
+ selected: z.ZodString;
127
+ local_draft: z.ZodOptional<z.ZodBoolean>;
128
+ }, z.core.$strip>>;
88
129
  workflow_origin: z.ZodOptional<z.ZodObject<{
89
130
  selected: z.ZodString;
90
131
  local_draft: z.ZodOptional<z.ZodBoolean>;
@@ -92,15 +133,44 @@ export declare const InterfConfigSchema: z.ZodObject<{
92
133
  source: z.ZodObject<{
93
134
  path: z.ZodString;
94
135
  control_path: z.ZodOptional<z.ZodString>;
95
- dataset_path: z.ZodString;
136
+ preparation_path: z.ZodOptional<z.ZodString>;
137
+ source_folder_path: z.ZodOptional<z.ZodString>;
138
+ dataset_path: z.ZodOptional<z.ZodString>;
96
139
  }, z.core.$strip>;
97
140
  }, z.core.$loose>;
98
141
  export declare const SourceFolderConfigSchema: z.ZodObject<{
142
+ source_folder: z.ZodOptional<z.ZodObject<{
143
+ path: z.ZodString;
144
+ }, z.core.$strict>>;
145
+ preparations: z.ZodDefault<z.ZodArray<z.ZodObject<{
146
+ id: z.ZodOptional<z.ZodString>;
147
+ name: z.ZodString;
148
+ path: z.ZodString;
149
+ about: z.ZodOptional<z.ZodString>;
150
+ method: z.ZodOptional<z.ZodString>;
151
+ workflow: z.ZodOptional<z.ZodString>;
152
+ max_attempts: z.ZodOptional<z.ZodNumber>;
153
+ max_loops: z.ZodOptional<z.ZodNumber>;
154
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
155
+ id: z.ZodOptional<z.ZodString>;
156
+ question: z.ZodString;
157
+ answer: z.ZodOptional<z.ZodString>;
158
+ expect: z.ZodOptional<z.ZodObject<{
159
+ must_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ must_include_one_of: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
161
+ must_not_include: z.ZodOptional<z.ZodArray<z.ZodString>>;
162
+ min_words: z.ZodOptional<z.ZodNumber>;
163
+ max_words: z.ZodOptional<z.ZodNumber>;
164
+ }, z.core.$strip>>;
165
+ strictness: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$strict>>>;
167
+ }, z.core.$strict>>>;
99
168
  datasets: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
169
  id: z.ZodOptional<z.ZodString>;
101
170
  name: z.ZodString;
102
171
  path: z.ZodString;
103
172
  about: z.ZodOptional<z.ZodString>;
173
+ method: z.ZodOptional<z.ZodString>;
104
174
  workflow: z.ZodOptional<z.ZodString>;
105
175
  max_attempts: z.ZodOptional<z.ZodNumber>;
106
176
  max_loops: z.ZodOptional<z.ZodNumber>;
@@ -119,7 +189,11 @@ export declare const SourceFolderConfigSchema: z.ZodObject<{
119
189
  }, z.core.$strict>>>;
120
190
  }, z.core.$strict>>>;
121
191
  }, z.core.$strict>;
122
- export type SourceTruthCheck = z.infer<typeof SourceTruthCheckSchema>;
192
+ export type SourceFolderBinding = z.infer<typeof SourceFolderBindingSchema>;
193
+ export type SourceReadinessCheck = z.infer<typeof SourceReadinessCheckSchema>;
123
194
  export type SourceDatasetConfig = z.infer<typeof SourceDatasetConfigSchema>;
195
+ export type PreparationName = z.infer<typeof PreparationNameSchema>;
196
+ export type MethodId = z.infer<typeof MethodIdSchema>;
197
+ export type SourcePreparationConfig = z.infer<typeof SourcePreparationConfigSchema>;
124
198
  export type InterfConfig = z.infer<typeof InterfConfigSchema>;
125
199
  export type SourceFolderConfig = z.infer<typeof SourceFolderConfigSchema>;
@@ -1,12 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { SourceCompiledMaxAttemptsSchema, SourceCompiledMaxLoopsSchema, TestCaseExpectSchema, WorkflowIdPattern, WorkflowIdSchema, } from "../../compiler/lib/schema.js";
3
3
  const DatasetNamePattern = /^[a-z0-9][a-z0-9-]*$/;
4
- const RESERVED_DATASET_NAMES = new Set(["tests", "workflows"]);
4
+ const RESERVED_DATASET_NAMES = new Set(["tests", "methods", "workflows"]);
5
5
  export const DatasetNameSchema = z
6
6
  .string()
7
- .regex(DatasetNamePattern, "Dataset names must use lowercase letters, numbers, and dashes only.")
8
- .refine((value) => !RESERVED_DATASET_NAMES.has(value), "Dataset name is reserved.");
9
- export const SourceTruthCheckSchema = z.object({
7
+ .regex(DatasetNamePattern, "Preparation names must use lowercase letters, numbers, and dashes only.")
8
+ .refine((value) => !RESERVED_DATASET_NAMES.has(value), "Preparation name is reserved.");
9
+ export const PreparationNameSchema = DatasetNameSchema;
10
+ export const MethodIdSchema = WorkflowIdSchema;
11
+ export const SourceReadinessCheckSchema = z.object({
10
12
  id: z.string().regex(WorkflowIdPattern).optional(),
11
13
  question: z.string().min(1),
12
14
  answer: z.string().min(1).optional(),
@@ -17,28 +19,38 @@ export const SourceTruthCheckSchema = z.object({
17
19
  ctx.addIssue({
18
20
  code: z.ZodIssueCode.custom,
19
21
  path: ["answer"],
20
- message: "Truth checks need `answer` or `expect`.",
22
+ message: "Readiness checks need `answer` or `expect`.",
21
23
  });
22
24
  }
23
25
  });
24
- export const SourceDatasetConfigSchema = z.object({
26
+ export const SourcePreparationConfigSchema = z.object({
25
27
  id: z.string().regex(WorkflowIdPattern).optional(),
26
- name: DatasetNameSchema,
28
+ name: PreparationNameSchema,
27
29
  path: z.string().min(1),
28
30
  about: z.string().min(1).optional(),
31
+ method: MethodIdSchema.optional(),
29
32
  workflow: WorkflowIdSchema.optional(),
30
33
  max_attempts: SourceCompiledMaxAttemptsSchema.optional(),
31
34
  max_loops: SourceCompiledMaxLoopsSchema.optional(),
32
- checks: z.array(SourceTruthCheckSchema).default([]),
35
+ checks: z.array(SourceReadinessCheckSchema).default([]),
36
+ }).strict();
37
+ export const SourceDatasetConfigSchema = SourcePreparationConfigSchema;
38
+ export const SourceFolderBindingSchema = z.object({
39
+ path: z.string().min(1),
33
40
  }).strict();
34
41
  export const CompiledInterfConfigSchema = z.object({
35
42
  type: z.literal("compiled"),
36
43
  name: DatasetNameSchema,
37
44
  about: z.string().optional(),
38
- workflow: WorkflowIdSchema,
45
+ method: MethodIdSchema,
46
+ workflow: WorkflowIdSchema.optional(),
39
47
  max_attempts: SourceCompiledMaxAttemptsSchema.optional(),
40
48
  max_loops: SourceCompiledMaxLoopsSchema.optional(),
41
- checks: z.array(SourceTruthCheckSchema).default([]),
49
+ checks: z.array(SourceReadinessCheckSchema).default([]),
50
+ method_origin: z.object({
51
+ selected: MethodIdSchema,
52
+ local_draft: z.boolean().optional(),
53
+ }).optional(),
42
54
  workflow_origin: z.object({
43
55
  selected: WorkflowIdSchema,
44
56
  local_draft: z.boolean().optional(),
@@ -46,17 +58,15 @@ export const CompiledInterfConfigSchema = z.object({
46
58
  source: z.object({
47
59
  path: z.string(),
48
60
  control_path: z.string().optional(),
49
- dataset_path: z.string(),
61
+ preparation_path: z.string().optional(),
62
+ source_folder_path: z.string().optional(),
63
+ dataset_path: z.string().optional(),
50
64
  }),
51
65
  }).passthrough();
52
66
  export const InterfConfigSchema = CompiledInterfConfigSchema;
53
67
  export const SourceFolderConfigSchema = z.object({
68
+ source_folder: SourceFolderBindingSchema.optional(),
69
+ preparations: z.array(SourcePreparationConfigSchema).default([]),
70
+ // Legacy config array. Read for compatibility; new writes use `preparations`.
54
71
  datasets: z.array(SourceDatasetConfigSchema).optional(),
55
- }).strict().superRefine((value, ctx) => {
56
- if ((value.datasets?.length ?? 0) === 0) {
57
- ctx.addIssue({
58
- code: z.ZodIssueCode.custom,
59
- message: "Interf project config needs at least one dataset.",
60
- });
61
- }
62
- });
72
+ }).strict();
@@ -1,7 +1,9 @@
1
1
  export declare const PROJECT_INTERF_DIR = "interf";
2
- export declare const PROJECT_TESTS_DIR = "tests";
2
+ export declare const DATASET_INTERF_DIR = ".interf";
3
+ export declare const PORTABLE_CONTEXT_TESTS_DIR = "tests";
3
4
  export declare function projectInterfRoot(projectPath: string): string;
4
5
  export declare function compiledCompiledPathForDataset(projectPath: string, datasetName: string): string;
6
+ export declare function portableContextPath(projectPath: string, datasetName: string): string;
5
7
  export declare function datasetTestsRoot(projectPath: string, datasetName: string): string;
6
8
  export type DatasetTestTargetLabel = "file-as-is" | "compiled";
7
9
  export declare function datasetTestRunsRoot(projectPath: string, datasetName: string, target: DatasetTestTargetLabel): string;
@@ -1,14 +1,18 @@
1
1
  import { join } from "node:path";
2
2
  export const PROJECT_INTERF_DIR = "interf";
3
- export const PROJECT_TESTS_DIR = "tests";
3
+ export const DATASET_INTERF_DIR = ".interf";
4
+ export const PORTABLE_CONTEXT_TESTS_DIR = "tests";
4
5
  export function projectInterfRoot(projectPath) {
5
6
  return join(projectPath, PROJECT_INTERF_DIR);
6
7
  }
7
8
  export function compiledCompiledPathForDataset(projectPath, datasetName) {
8
9
  return join(projectInterfRoot(projectPath), datasetName);
9
10
  }
11
+ export function portableContextPath(projectPath, datasetName) {
12
+ return compiledCompiledPathForDataset(projectPath, datasetName);
13
+ }
10
14
  export function datasetTestsRoot(projectPath, datasetName) {
11
- return join(projectInterfRoot(projectPath), PROJECT_TESTS_DIR, datasetName);
15
+ return join(portableContextPath(projectPath, datasetName), DATASET_INTERF_DIR, PORTABLE_CONTEXT_TESTS_DIR);
12
16
  }
13
17
  export function datasetTestRunsRoot(projectPath, datasetName, target) {
14
18
  return join(datasetTestsRoot(projectPath, datasetName), target, "runs");
@@ -1,31 +1,44 @@
1
- import { type InterfConfig, type SourceTruthCheck, type SourceDatasetConfig, type SourceFolderConfig } from "./lib/schema.js";
1
+ import { type InterfConfig, type SourceFolderBinding, type SourceReadinessCheck, type SourceDatasetConfig, type SourcePreparationConfig, type SourceFolderConfig } from "./lib/schema.js";
2
2
  import type { TestSpec, TestTargetType } from "../testing/lib/schema.js";
3
3
  export declare const SOURCE_FOLDER_CONFIG_FILE = "interf.json";
4
+ export declare const SOURCE_FOLDER_CONFIG_PATH = "interf/interf.json";
4
5
  export interface LoadedSourceTestSpec extends TestSpec {
5
6
  id: string;
6
7
  filePath: string;
7
8
  }
8
- export declare function fingerprintTruthChecks(checks: SourceTruthCheck[]): string;
9
+ export declare function sourceFolderConfigPath(sourcePath: string): string;
10
+ export declare function resolveSourceFolderConfigPath(sourcePath: string): string;
11
+ export declare function fingerprintReadinessChecks(checks: SourceReadinessCheck[]): string;
9
12
  export declare function loadSourceFolderConfig(sourcePath: string): SourceFolderConfig | null;
10
13
  export interface WritableSourceProjectConfig {
14
+ source_folder?: SourceFolderBinding;
15
+ preparations?: SourcePreparationConfig[];
11
16
  datasets?: SourceDatasetConfig[];
12
17
  }
13
- export declare function listSourceDatasetConfigs(config: SourceFolderConfig | null): SourceDatasetConfig[];
18
+ export declare function methodIdForSourcePreparationConfig(preparationConfig: Pick<SourcePreparationConfig, "method" | "workflow"> | null | undefined): string | null;
19
+ export declare function listSourcePreparationConfigs(config: SourceFolderConfig | null): SourcePreparationConfig[];
20
+ export declare const listSourceDatasetConfigs: typeof listSourcePreparationConfigs;
14
21
  export declare function resolveDatasetCompileMaxAttempts(datasetConfig: Pick<SourceDatasetConfig, "max_attempts">, override?: number | null): number | null;
15
22
  export declare function resolveDatasetCompileMaxLoops(datasetConfig: Pick<SourceDatasetConfig, "max_loops">, override?: number | null): number | null;
16
- export declare function getDefaultSourceDatasetConfig(config: SourceFolderConfig | null): SourceDatasetConfig | null;
17
- export declare function findSourceDatasetConfig(config: SourceFolderConfig | null, datasetName: string): SourceDatasetConfig | null;
23
+ export declare function getDefaultSourcePreparationConfig(config: SourceFolderConfig | null): SourcePreparationConfig | null;
24
+ export declare const getDefaultSourceDatasetConfig: typeof getDefaultSourcePreparationConfig;
25
+ export declare function findSourcePreparationConfig(config: SourceFolderConfig | null, preparationName: string): SourcePreparationConfig | null;
26
+ export declare const findSourceDatasetConfig: typeof findSourcePreparationConfig;
27
+ export declare function configuredSourceFolderPath(config: SourceFolderConfig | WritableSourceProjectConfig | null | undefined): string | null;
28
+ export declare function resolveConfiguredSourceFolderPath(sourcePath: string, config?: SourceFolderConfig | WritableSourceProjectConfig | null | undefined): string | null;
18
29
  export declare function saveSourceFolderConfig(sourcePath: string, config: WritableSourceProjectConfig): void;
19
- export declare function appendSourceDatasetChecks(sourcePath: string, datasetName: string, checks: SourceTruthCheck[]): void;
20
- export declare function upsertSourceDatasetConfig(sourcePath: string, datasetConfig: SourceDatasetConfig, options?: {
30
+ export declare function appendSourceDatasetChecks(sourcePath: string, preparationName: string, checks: SourceReadinessCheck[]): void;
31
+ export declare const appendSourcePreparationChecks: typeof appendSourceDatasetChecks;
32
+ export declare function upsertSourceDatasetConfig(sourcePath: string, preparationConfig: SourcePreparationConfig, options?: {
21
33
  matchName?: string;
22
34
  }): void;
35
+ export declare const upsertSourcePreparationConfig: typeof upsertSourceDatasetConfig;
23
36
  export declare function compiledMaxAttempts(maxAttempts: number | null | undefined): number | undefined;
24
37
  export declare function compiledMaxLoops(maxLoops: number | null | undefined): number | undefined;
25
- export declare function sourceDatasetConfigFromInterfConfig(config: InterfConfig, datasetPath?: string): SourceDatasetConfig;
26
- export declare function loadCompiledDatasetConfig(compiledPath: string): SourceDatasetConfig | null;
38
+ export declare function sourceDatasetConfigFromInterfConfig(config: InterfConfig, preparationPath?: string): SourcePreparationConfig;
39
+ export declare function loadCompiledDatasetConfig(compiledPath: string): SourcePreparationConfig | null;
27
40
  export declare function saveCompiledInterfConfig(compiledPath: string, config: InterfConfig): InterfConfig;
28
- export declare function syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath: string, datasetConfig: SourceDatasetConfig): InterfConfig;
41
+ export declare function syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath: string, datasetConfig: SourcePreparationConfig): InterfConfig;
29
42
  export declare function buildTestSpecFromSourceFolderConfig(options: {
30
43
  sourcePath: string;
31
44
  targetName?: string | null;
@@ -35,4 +48,5 @@ export declare function buildTestSpecFromCompiledDatasetConfig(options: {
35
48
  compiledPath: string;
36
49
  targetType?: TestTargetType;
37
50
  }): LoadedSourceTestSpec | null;
38
- export declare function resolveSourceDatasetPath(projectPath: string, datasetConfig: Pick<SourceDatasetConfig, "path">): string;
51
+ export declare function resolveSourceDatasetPath(projectPath: string, datasetConfig: Pick<SourcePreparationConfig, "path">): string;
52
+ export declare const resolveSourcePreparationPath: typeof resolveSourceDatasetPath;