@interf/compiler 0.3.4 → 0.4.0

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 (385) hide show
  1. package/README.md +131 -149
  2. package/builtin-workflows/interf/README.md +19 -0
  3. package/builtin-workflows/interf/compile/stages/shape/SKILL.md +28 -0
  4. package/builtin-workflows/interf/compile/stages/structure/SKILL.md +18 -0
  5. package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +18 -0
  6. package/builtin-workflows/interf/improve/SKILL.md +18 -0
  7. package/builtin-workflows/interf/use/query/SKILL.md +28 -0
  8. package/builtin-workflows/interf/workflow.json +120 -0
  9. package/builtin-workflows/interf/workspace.schema.json +75 -0
  10. package/dist/bin.d.ts +0 -1
  11. package/dist/bin.js +0 -1
  12. package/dist/commands/compile-controller.d.ts +14 -0
  13. package/dist/commands/compile-controller.js +409 -0
  14. package/dist/commands/compile.d.ts +8 -9
  15. package/dist/commands/compile.js +151 -153
  16. package/dist/commands/create-workflow-wizard.d.ts +4 -2
  17. package/dist/commands/create-workflow-wizard.js +33 -31
  18. package/dist/commands/create.d.ts +0 -1
  19. package/dist/commands/create.js +15 -11
  20. package/dist/commands/default.d.ts +0 -1
  21. package/dist/commands/default.js +0 -1
  22. package/dist/commands/doctor.d.ts +0 -1
  23. package/dist/commands/doctor.js +1 -16
  24. package/dist/commands/executor-flow.d.ts +0 -1
  25. package/dist/commands/executor-flow.js +0 -1
  26. package/dist/commands/init.d.ts +0 -1
  27. package/dist/commands/init.js +71 -14
  28. package/dist/commands/list.d.ts +0 -1
  29. package/dist/commands/list.js +0 -1
  30. package/dist/commands/reset.d.ts +0 -1
  31. package/dist/commands/reset.js +0 -1
  32. package/dist/commands/source-config-wizard.d.ts +28 -7
  33. package/dist/commands/source-config-wizard.js +159 -63
  34. package/dist/commands/status.d.ts +0 -1
  35. package/dist/commands/status.js +0 -1
  36. package/dist/commands/test-flow.d.ts +20 -10
  37. package/dist/commands/test-flow.js +89 -23
  38. package/dist/commands/test.d.ts +0 -1
  39. package/dist/commands/test.js +36 -72
  40. package/dist/commands/verify.d.ts +0 -1
  41. package/dist/commands/verify.js +0 -1
  42. package/dist/commands/workspace-flow.d.ts +3 -3
  43. package/dist/commands/workspace-flow.js +30 -12
  44. package/dist/index.d.ts +5 -6
  45. package/dist/index.js +3 -4
  46. package/dist/lib/agent-args.d.ts +0 -1
  47. package/dist/lib/agent-args.js +0 -1
  48. package/dist/lib/agent-constants.d.ts +0 -1
  49. package/dist/lib/agent-constants.js +0 -1
  50. package/dist/lib/agent-detection.d.ts +0 -1
  51. package/dist/lib/agent-detection.js +0 -1
  52. package/dist/lib/agent-execution.d.ts +0 -1
  53. package/dist/lib/agent-execution.js +47 -12
  54. package/dist/lib/agent-logs.d.ts +0 -1
  55. package/dist/lib/agent-logs.js +0 -1
  56. package/dist/lib/agent-preflight.d.ts +0 -1
  57. package/dist/lib/agent-preflight.js +1 -2
  58. package/dist/lib/agent-render.d.ts +0 -1
  59. package/dist/lib/agent-render.js +0 -1
  60. package/dist/lib/agent-shells.d.ts +30 -3
  61. package/dist/lib/agent-shells.js +517 -54
  62. package/dist/lib/agent-status.d.ts +0 -1
  63. package/dist/lib/agent-status.js +0 -1
  64. package/dist/lib/agent-types.d.ts +0 -1
  65. package/dist/lib/agent-types.js +0 -1
  66. package/dist/lib/agents.d.ts +0 -9
  67. package/dist/lib/agents.js +0 -9
  68. package/dist/lib/chart-guidance.d.ts +1 -0
  69. package/dist/lib/chart-guidance.js +8 -0
  70. package/dist/lib/config.d.ts +0 -3
  71. package/dist/lib/config.js +0 -5
  72. package/dist/lib/discovery.d.ts +0 -1
  73. package/dist/lib/discovery.js +0 -1
  74. package/dist/lib/execution-profile.d.ts +0 -1
  75. package/dist/lib/execution-profile.js +0 -1
  76. package/dist/lib/executors.d.ts +0 -1
  77. package/dist/lib/executors.js +0 -1
  78. package/dist/lib/filesystem.d.ts +0 -1
  79. package/dist/lib/filesystem.js +0 -1
  80. package/dist/lib/interf-bootstrap.d.ts +0 -1
  81. package/dist/lib/interf-bootstrap.js +6 -2
  82. package/dist/lib/interf-detect.d.ts +2 -2
  83. package/dist/lib/interf-detect.js +25 -8
  84. package/dist/lib/interf-scaffold.d.ts +0 -1
  85. package/dist/lib/interf-scaffold.js +54 -21
  86. package/dist/lib/interf-workflow-package.d.ts +18 -1
  87. package/dist/lib/interf-workflow-package.js +164 -23
  88. package/dist/lib/interf.d.ts +1 -2
  89. package/dist/lib/interf.js +1 -2
  90. package/dist/lib/local-workflows.d.ts +10 -5
  91. package/dist/lib/local-workflows.js +208 -97
  92. package/dist/lib/logger.d.ts +0 -1
  93. package/dist/lib/logger.js +0 -1
  94. package/dist/lib/obsidian.d.ts +0 -1
  95. package/dist/lib/obsidian.js +0 -1
  96. package/dist/lib/parse.d.ts +0 -1
  97. package/dist/lib/parse.js +0 -1
  98. package/dist/lib/registry.d.ts +0 -1
  99. package/dist/lib/registry.js +0 -1
  100. package/dist/lib/runtime-acceptance.d.ts +0 -1
  101. package/dist/lib/runtime-acceptance.js +1 -2
  102. package/dist/lib/runtime-contracts.d.ts +0 -1
  103. package/dist/lib/runtime-contracts.js +14 -8
  104. package/dist/lib/runtime-paths.d.ts +0 -1
  105. package/dist/lib/runtime-paths.js +5 -10
  106. package/dist/lib/runtime-prompt.d.ts +0 -1
  107. package/dist/lib/runtime-prompt.js +8 -23
  108. package/dist/lib/runtime-reconcile.d.ts +0 -1
  109. package/dist/lib/runtime-reconcile.js +7 -3
  110. package/dist/lib/runtime-runs.d.ts +0 -1
  111. package/dist/lib/runtime-runs.js +4 -5
  112. package/dist/lib/runtime-types.d.ts +0 -1
  113. package/dist/lib/runtime-types.js +0 -1
  114. package/dist/lib/runtime.d.ts +0 -1
  115. package/dist/lib/runtime.js +0 -1
  116. package/dist/lib/schema.d.ts +356 -51
  117. package/dist/lib/schema.js +189 -54
  118. package/dist/lib/source-config.d.ts +17 -8
  119. package/dist/lib/source-config.js +125 -11
  120. package/dist/lib/state-artifacts.d.ts +0 -1
  121. package/dist/lib/state-artifacts.js +0 -1
  122. package/dist/lib/state-health.d.ts +0 -1
  123. package/dist/lib/state-health.js +2 -3
  124. package/dist/lib/state-io.d.ts +1 -1
  125. package/dist/lib/state-io.js +9 -10
  126. package/dist/lib/state-paths.d.ts +0 -1
  127. package/dist/lib/state-paths.js +5 -11
  128. package/dist/lib/state-view.d.ts +0 -1
  129. package/dist/lib/state-view.js +7 -8
  130. package/dist/lib/state.d.ts +0 -1
  131. package/dist/lib/state.js +0 -1
  132. package/dist/lib/summarize-plan.d.ts +0 -1
  133. package/dist/lib/summarize-plan.js +3 -3
  134. package/dist/lib/test-execution.d.ts +14 -0
  135. package/dist/lib/{benchmark-execution.js → test-execution.js} +122 -120
  136. package/dist/lib/test-matrices.d.ts +90 -0
  137. package/dist/lib/test-matrices.js +96 -0
  138. package/dist/lib/test-paths.d.ts +12 -0
  139. package/dist/lib/test-paths.js +44 -0
  140. package/dist/lib/test-profile-presets.d.ts +57 -0
  141. package/dist/lib/test-profile-presets.js +50 -0
  142. package/dist/lib/test-sandbox.d.ts +11 -0
  143. package/dist/lib/{benchmark-sandbox.js → test-sandbox.js} +18 -13
  144. package/dist/lib/test-specs.d.ts +7 -0
  145. package/dist/lib/test-specs.js +114 -0
  146. package/dist/lib/test-targets.d.ts +5 -0
  147. package/dist/lib/test-targets.js +38 -0
  148. package/dist/lib/test-types.d.ts +17 -0
  149. package/dist/lib/test-types.js +1 -0
  150. package/dist/lib/test.d.ts +4 -0
  151. package/dist/lib/test.js +3 -0
  152. package/dist/lib/user-config.d.ts +0 -1
  153. package/dist/lib/user-config.js +0 -1
  154. package/dist/lib/util.d.ts +0 -2
  155. package/dist/lib/util.js +0 -2
  156. package/dist/lib/validate-helpers.d.ts +0 -1
  157. package/dist/lib/validate-helpers.js +0 -1
  158. package/dist/lib/validate-workspace.d.ts +0 -1
  159. package/dist/lib/validate-workspace.js +34 -25
  160. package/dist/lib/validate.d.ts +0 -1
  161. package/dist/lib/validate.js +55 -9
  162. package/dist/lib/workflow-abi.d.ts +138 -0
  163. package/dist/lib/workflow-abi.js +181 -0
  164. package/dist/lib/workflow-definitions.d.ts +26 -5
  165. package/dist/lib/workflow-definitions.js +105 -168
  166. package/dist/lib/workflow-helpers.d.ts +1 -2
  167. package/dist/lib/workflow-helpers.js +32 -21
  168. package/dist/lib/workflow-improvement.d.ts +22 -0
  169. package/dist/lib/workflow-improvement.js +396 -0
  170. package/dist/lib/workflow-review-paths.d.ts +10 -0
  171. package/dist/lib/workflow-review-paths.js +27 -0
  172. package/dist/lib/workflow-stage-runner.d.ts +1 -1
  173. package/dist/lib/workflow-stage-runner.js +4 -1
  174. package/dist/lib/workflows.d.ts +1 -2
  175. package/dist/lib/workflows.js +1 -2
  176. package/dist/lib/workspace-compile.d.ts +0 -1
  177. package/dist/lib/workspace-compile.js +146 -109
  178. package/dist/lib/workspace-home.d.ts +5 -0
  179. package/dist/lib/workspace-home.js +32 -0
  180. package/dist/lib/workspace-layout.d.ts +2 -0
  181. package/dist/lib/workspace-layout.js +60 -0
  182. package/dist/lib/workspace-paths.d.ts +41 -0
  183. package/dist/lib/workspace-paths.js +107 -0
  184. package/dist/lib/workspace-raw.d.ts +20 -2
  185. package/dist/lib/workspace-raw.js +6 -8
  186. package/dist/lib/workspace-reset.d.ts +0 -1
  187. package/dist/lib/workspace-reset.js +27 -5
  188. package/dist/lib/workspace-schema.d.ts +1 -10
  189. package/dist/lib/workspace-schema.js +16 -74
  190. package/package.json +16 -15
  191. package/dist/bin.d.ts.map +0 -1
  192. package/dist/bin.js.map +0 -1
  193. package/dist/commands/compile.d.ts.map +0 -1
  194. package/dist/commands/compile.js.map +0 -1
  195. package/dist/commands/create-workflow-wizard.d.ts.map +0 -1
  196. package/dist/commands/create-workflow-wizard.js.map +0 -1
  197. package/dist/commands/create.d.ts.map +0 -1
  198. package/dist/commands/create.js.map +0 -1
  199. package/dist/commands/default.d.ts.map +0 -1
  200. package/dist/commands/default.js.map +0 -1
  201. package/dist/commands/doctor.d.ts.map +0 -1
  202. package/dist/commands/doctor.js.map +0 -1
  203. package/dist/commands/executor-flow.d.ts.map +0 -1
  204. package/dist/commands/executor-flow.js.map +0 -1
  205. package/dist/commands/init.d.ts.map +0 -1
  206. package/dist/commands/init.js.map +0 -1
  207. package/dist/commands/list.d.ts.map +0 -1
  208. package/dist/commands/list.js.map +0 -1
  209. package/dist/commands/reset.d.ts.map +0 -1
  210. package/dist/commands/reset.js.map +0 -1
  211. package/dist/commands/source-config-wizard.d.ts.map +0 -1
  212. package/dist/commands/source-config-wizard.js.map +0 -1
  213. package/dist/commands/status.d.ts.map +0 -1
  214. package/dist/commands/status.js.map +0 -1
  215. package/dist/commands/test-flow.d.ts.map +0 -1
  216. package/dist/commands/test-flow.js.map +0 -1
  217. package/dist/commands/test.d.ts.map +0 -1
  218. package/dist/commands/test.js.map +0 -1
  219. package/dist/commands/verify.d.ts.map +0 -1
  220. package/dist/commands/verify.js.map +0 -1
  221. package/dist/commands/workspace-flow.d.ts.map +0 -1
  222. package/dist/commands/workspace-flow.js.map +0 -1
  223. package/dist/index.d.ts.map +0 -1
  224. package/dist/index.js.map +0 -1
  225. package/dist/lib/agent-args.d.ts.map +0 -1
  226. package/dist/lib/agent-args.js.map +0 -1
  227. package/dist/lib/agent-constants.d.ts.map +0 -1
  228. package/dist/lib/agent-constants.js.map +0 -1
  229. package/dist/lib/agent-detection.d.ts.map +0 -1
  230. package/dist/lib/agent-detection.js.map +0 -1
  231. package/dist/lib/agent-execution.d.ts.map +0 -1
  232. package/dist/lib/agent-execution.js.map +0 -1
  233. package/dist/lib/agent-logs.d.ts.map +0 -1
  234. package/dist/lib/agent-logs.js.map +0 -1
  235. package/dist/lib/agent-preflight.d.ts.map +0 -1
  236. package/dist/lib/agent-preflight.js.map +0 -1
  237. package/dist/lib/agent-render.d.ts.map +0 -1
  238. package/dist/lib/agent-render.js.map +0 -1
  239. package/dist/lib/agent-shells.d.ts.map +0 -1
  240. package/dist/lib/agent-shells.js.map +0 -1
  241. package/dist/lib/agent-skills.d.ts +0 -21
  242. package/dist/lib/agent-skills.d.ts.map +0 -1
  243. package/dist/lib/agent-skills.js +0 -215
  244. package/dist/lib/agent-skills.js.map +0 -1
  245. package/dist/lib/agent-status.d.ts.map +0 -1
  246. package/dist/lib/agent-status.js.map +0 -1
  247. package/dist/lib/agent-types.d.ts.map +0 -1
  248. package/dist/lib/agent-types.js.map +0 -1
  249. package/dist/lib/agents.d.ts.map +0 -1
  250. package/dist/lib/agents.js.map +0 -1
  251. package/dist/lib/benchmark-execution.d.ts +0 -13
  252. package/dist/lib/benchmark-execution.d.ts.map +0 -1
  253. package/dist/lib/benchmark-execution.js.map +0 -1
  254. package/dist/lib/benchmark-paths.d.ts +0 -13
  255. package/dist/lib/benchmark-paths.d.ts.map +0 -1
  256. package/dist/lib/benchmark-paths.js +0 -44
  257. package/dist/lib/benchmark-paths.js.map +0 -1
  258. package/dist/lib/benchmark-sandbox.d.ts +0 -12
  259. package/dist/lib/benchmark-sandbox.d.ts.map +0 -1
  260. package/dist/lib/benchmark-sandbox.js.map +0 -1
  261. package/dist/lib/benchmark-specs.d.ts +0 -8
  262. package/dist/lib/benchmark-specs.d.ts.map +0 -1
  263. package/dist/lib/benchmark-specs.js +0 -115
  264. package/dist/lib/benchmark-specs.js.map +0 -1
  265. package/dist/lib/benchmark-targets.d.ts +0 -5
  266. package/dist/lib/benchmark-targets.d.ts.map +0 -1
  267. package/dist/lib/benchmark-targets.js +0 -38
  268. package/dist/lib/benchmark-targets.js.map +0 -1
  269. package/dist/lib/benchmark-types.d.ts +0 -18
  270. package/dist/lib/benchmark-types.d.ts.map +0 -1
  271. package/dist/lib/benchmark-types.js +0 -2
  272. package/dist/lib/benchmark-types.js.map +0 -1
  273. package/dist/lib/benchmark.d.ts +0 -5
  274. package/dist/lib/benchmark.d.ts.map +0 -1
  275. package/dist/lib/benchmark.js +0 -4
  276. package/dist/lib/benchmark.js.map +0 -1
  277. package/dist/lib/config.d.ts.map +0 -1
  278. package/dist/lib/config.js.map +0 -1
  279. package/dist/lib/discovery.d.ts.map +0 -1
  280. package/dist/lib/discovery.js.map +0 -1
  281. package/dist/lib/eval-packs.d.ts +0 -158
  282. package/dist/lib/eval-packs.d.ts.map +0 -1
  283. package/dist/lib/eval-packs.js +0 -149
  284. package/dist/lib/eval-packs.js.map +0 -1
  285. package/dist/lib/execution-profile.d.ts.map +0 -1
  286. package/dist/lib/execution-profile.js.map +0 -1
  287. package/dist/lib/executors.d.ts.map +0 -1
  288. package/dist/lib/executors.js.map +0 -1
  289. package/dist/lib/filesystem.d.ts.map +0 -1
  290. package/dist/lib/filesystem.js.map +0 -1
  291. package/dist/lib/interf-bootstrap.d.ts.map +0 -1
  292. package/dist/lib/interf-bootstrap.js.map +0 -1
  293. package/dist/lib/interf-detect.d.ts.map +0 -1
  294. package/dist/lib/interf-detect.js.map +0 -1
  295. package/dist/lib/interf-scaffold.d.ts.map +0 -1
  296. package/dist/lib/interf-scaffold.js.map +0 -1
  297. package/dist/lib/interf-workflow-package.d.ts.map +0 -1
  298. package/dist/lib/interf-workflow-package.js.map +0 -1
  299. package/dist/lib/interf.d.ts.map +0 -1
  300. package/dist/lib/interf.js.map +0 -1
  301. package/dist/lib/local-workflows.d.ts.map +0 -1
  302. package/dist/lib/local-workflows.js.map +0 -1
  303. package/dist/lib/logger.d.ts.map +0 -1
  304. package/dist/lib/logger.js.map +0 -1
  305. package/dist/lib/obsidian.d.ts.map +0 -1
  306. package/dist/lib/obsidian.js.map +0 -1
  307. package/dist/lib/parse.d.ts.map +0 -1
  308. package/dist/lib/parse.js.map +0 -1
  309. package/dist/lib/registry.d.ts.map +0 -1
  310. package/dist/lib/registry.js.map +0 -1
  311. package/dist/lib/runtime-acceptance.d.ts.map +0 -1
  312. package/dist/lib/runtime-acceptance.js.map +0 -1
  313. package/dist/lib/runtime-contracts.d.ts.map +0 -1
  314. package/dist/lib/runtime-contracts.js.map +0 -1
  315. package/dist/lib/runtime-paths.d.ts.map +0 -1
  316. package/dist/lib/runtime-paths.js.map +0 -1
  317. package/dist/lib/runtime-prompt.d.ts.map +0 -1
  318. package/dist/lib/runtime-prompt.js.map +0 -1
  319. package/dist/lib/runtime-reconcile.d.ts.map +0 -1
  320. package/dist/lib/runtime-reconcile.js.map +0 -1
  321. package/dist/lib/runtime-runs.d.ts.map +0 -1
  322. package/dist/lib/runtime-runs.js.map +0 -1
  323. package/dist/lib/runtime-types.d.ts.map +0 -1
  324. package/dist/lib/runtime-types.js.map +0 -1
  325. package/dist/lib/runtime.d.ts.map +0 -1
  326. package/dist/lib/runtime.js.map +0 -1
  327. package/dist/lib/schema.d.ts.map +0 -1
  328. package/dist/lib/schema.js.map +0 -1
  329. package/dist/lib/source-config.d.ts.map +0 -1
  330. package/dist/lib/source-config.js.map +0 -1
  331. package/dist/lib/state-artifacts.d.ts.map +0 -1
  332. package/dist/lib/state-artifacts.js.map +0 -1
  333. package/dist/lib/state-health.d.ts.map +0 -1
  334. package/dist/lib/state-health.js.map +0 -1
  335. package/dist/lib/state-io.d.ts.map +0 -1
  336. package/dist/lib/state-io.js.map +0 -1
  337. package/dist/lib/state-paths.d.ts.map +0 -1
  338. package/dist/lib/state-paths.js.map +0 -1
  339. package/dist/lib/state-view.d.ts.map +0 -1
  340. package/dist/lib/state-view.js.map +0 -1
  341. package/dist/lib/state.d.ts.map +0 -1
  342. package/dist/lib/state.js.map +0 -1
  343. package/dist/lib/summarize-plan.d.ts.map +0 -1
  344. package/dist/lib/summarize-plan.js.map +0 -1
  345. package/dist/lib/user-config.d.ts.map +0 -1
  346. package/dist/lib/user-config.js.map +0 -1
  347. package/dist/lib/util.d.ts.map +0 -1
  348. package/dist/lib/util.js.map +0 -1
  349. package/dist/lib/validate-helpers.d.ts.map +0 -1
  350. package/dist/lib/validate-helpers.js.map +0 -1
  351. package/dist/lib/validate-workspace.d.ts.map +0 -1
  352. package/dist/lib/validate-workspace.js.map +0 -1
  353. package/dist/lib/validate.d.ts.map +0 -1
  354. package/dist/lib/validate.js.map +0 -1
  355. package/dist/lib/workflow-definitions.d.ts.map +0 -1
  356. package/dist/lib/workflow-definitions.js.map +0 -1
  357. package/dist/lib/workflow-helpers.d.ts.map +0 -1
  358. package/dist/lib/workflow-helpers.js.map +0 -1
  359. package/dist/lib/workflow-stage-runner.d.ts.map +0 -1
  360. package/dist/lib/workflow-stage-runner.js.map +0 -1
  361. package/dist/lib/workflow-starter-docs.d.ts +0 -7
  362. package/dist/lib/workflow-starter-docs.d.ts.map +0 -1
  363. package/dist/lib/workflow-starter-docs.js +0 -3
  364. package/dist/lib/workflow-starter-docs.js.map +0 -1
  365. package/dist/lib/workflows.d.ts.map +0 -1
  366. package/dist/lib/workflows.js.map +0 -1
  367. package/dist/lib/workspace-compile.d.ts.map +0 -1
  368. package/dist/lib/workspace-compile.js.map +0 -1
  369. package/dist/lib/workspace-docs.d.ts +0 -3
  370. package/dist/lib/workspace-docs.d.ts.map +0 -1
  371. package/dist/lib/workspace-docs.js +0 -82
  372. package/dist/lib/workspace-docs.js.map +0 -1
  373. package/dist/lib/workspace-raw.d.ts.map +0 -1
  374. package/dist/lib/workspace-raw.js.map +0 -1
  375. package/dist/lib/workspace-reset.d.ts.map +0 -1
  376. package/dist/lib/workspace-reset.js.map +0 -1
  377. package/dist/lib/workspace-schema.d.ts.map +0 -1
  378. package/dist/lib/workspace-schema.js.map +0 -1
  379. package/skills/benchmark/SKILL.md +0 -122
  380. package/skills/workflow/create/SKILL.md +0 -141
  381. package/skills/workspace/shape/SKILL.md +0 -15
  382. package/skills/workspace/structure/SKILL.md +0 -15
  383. package/skills/workspace/summarize/SKILL.md +0 -15
  384. package/templates/workspace/README.md +0 -24
  385. package/templates/workspace/interfignore +0 -2
@@ -1,20 +1,21 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { countFilesRecursive } from "./filesystem.js";
4
- import { createStageExecutionShell, pruneStageExecutionShells } from "./agent-shells.js";
4
+ import { createStageExecutionShell, freezeStageExecutionShell, pruneStageExecutionShells, syncStageExecutionShellWrites, } from "./agent-shells.js";
5
5
  import { readInterfConfig, refreshWorkspaceBootstrapGuidance, resolveSourceFolderPath, resolveSourceControlPath, } from "./interf.js";
6
- import { findSourceWorkspaceConfig, loadSourceFolderConfig } from "./source-config.js";
7
6
  import { buildSummarizePlan, writeSummarizePlan } from "./summarize-plan.js";
8
7
  import { reconcileWorkspaceShapeRun, reconcileWorkspaceStructureRun, reconcileWorkspaceSummarizeRun, } from "./runtime-reconcile.js";
9
8
  import { loadState, refreshWorkspaceArtifacts, } from "./state.js";
10
9
  import { buildWorkspaceShapeContract, buildWorkspaceStructureContract, buildWorkspaceSummarizeContract, validateStageContractAcceptance, } from "./runtime.js";
11
10
  import { readJsonFileUnchecked } from "./parse.js";
12
- import { formatWorkspaceWorkflowStageStep, getWorkflowStagePolicyNotes, getWorkspaceWorkflow, resolveWorkspaceWorkflowFromConfig, } from "./workflow-definitions.js";
11
+ import { validateWorkflowPackage } from "./local-workflows.js";
12
+ import { formatActiveWorkspaceWorkflowStageStep, getActiveWorkspaceStagePolicyNotes, getActiveWorkspaceWorkflow, resolveWorkspaceWorkflowFromConfig, resolveActiveWorkspaceStageAcceptance, } from "./workflow-definitions.js";
13
13
  import { validateWorkspaceCompile, validateWorkspaceStructure, validateWorkspaceSummarize, } from "./validate.js";
14
- import { buildLocalSkillContractExtension, buildStageInstructions, bundledSkillForContractType, reportBlankLine, reportLine, reportValidationFailure, resolveStageAcceptance, workflowCompileStageDirectory, } from "./workflow-helpers.js";
14
+ import { buildLocalSkillContractExtension, buildStageInstructions, bundledSkillForContractType, reportBlankLine, reportLine, reportValidationFailure, workflowCompileStageDirectory, } from "./workflow-helpers.js";
15
15
  import { executeValidatedStage, executeValidatedSummarizeStage, findStageByContractType, } from "./workflow-stage-runner.js";
16
16
  import { syncWorkspaceRawSnapshot } from "./workspace-raw.js";
17
- const SHAPE_INPUT_RELATIVE_PATH = ".interf/shape-input.json";
17
+ import { workspaceRuntimeRoot } from "./workspace-paths.js";
18
+ const SHAPE_INPUT_RELATIVE_PATH = ".interf/runtime/shape-input.json";
18
19
  export function resolveWorkspaceContext(workspacePath) {
19
20
  const config = readInterfConfig(workspacePath);
20
21
  const workflowId = resolveWorkspaceWorkflowFromConfig(config);
@@ -26,11 +27,11 @@ export function resolveWorkspaceContext(workspacePath) {
26
27
  };
27
28
  }
28
29
  export function workspaceExecutionStages(workflowId, workspacePath) {
29
- return getWorkspaceWorkflow(workflowId, { sourcePath: resolveSourceControlPath(workspacePath) })
30
+ return getActiveWorkspaceWorkflow(workspacePath, workflowId)
30
31
  .stages;
31
32
  }
32
33
  function readWorkspaceInventoryTotal(workspacePath) {
33
- const inventory = readJsonFileUnchecked(join(workspacePath, ".interf", "inventory.json"), "workspace inventory");
34
+ const inventory = readJsonFileUnchecked(join(workspaceRuntimeRoot(workspacePath), "inventory.json"), "workspace inventory");
34
35
  if (!inventory)
35
36
  return 0;
36
37
  if (typeof inventory.total === "number")
@@ -83,21 +84,19 @@ function isWorkspaceShapeStageComplete(workspacePath, summaryCount) {
83
84
  (state.shaped ?? state.compiled ?? 0) >= summaryCount &&
84
85
  (state.compiled ?? 0) >= summaryCount);
85
86
  }
86
- function writeWorkspaceShapeInput(workspacePath, workspaceName, controlPath) {
87
+ function writeWorkspaceShapeInput(workspacePath, workspaceName) {
87
88
  const workspaceConfig = readInterfConfig(workspacePath);
88
- const sourceConfig = loadSourceFolderConfig(controlPath);
89
- const sourceWorkspace = findSourceWorkspaceConfig(sourceConfig, workspaceName);
90
- const questions = (sourceWorkspace?.checks ?? []).map((check, index) => ({
89
+ const questions = (workspaceConfig?.checks ?? []).map((check, index) => ({
91
90
  id: check.id ?? `check-${index + 1}`,
92
91
  question: check.question,
93
92
  }));
94
- mkdirSync(join(workspacePath, ".interf"), { recursive: true });
93
+ mkdirSync(workspaceRuntimeRoot(workspacePath), { recursive: true });
95
94
  writeFileSync(join(workspacePath, SHAPE_INPUT_RELATIVE_PATH), JSON.stringify({
96
95
  kind: "workspace-shape-input",
97
96
  version: 1,
98
97
  generated_at: new Date().toISOString(),
99
98
  target_name: workspaceName,
100
- about: sourceWorkspace?.about ?? workspaceConfig?.about ?? null,
99
+ about: workspaceConfig?.about ?? null,
101
100
  question_count: questions.length,
102
101
  questions,
103
102
  }, null, 2) + "\n");
@@ -105,14 +104,13 @@ function writeWorkspaceShapeInput(workspacePath, workspaceName, controlPath) {
105
104
  }
106
105
  export function buildWorkspaceCompileContract(workspacePath, workflowId, summaryCount, instructions, stageId = "shape", stageSkillDir = "shape", shapeInputPath = SHAPE_INPUT_RELATIVE_PATH) {
107
106
  const config = readInterfConfig(workspacePath);
108
- const controlPath = resolveSourceControlPath(workspacePath);
109
- const acceptance = resolveStageAcceptance(workflowId, stageId, controlPath);
107
+ const acceptance = resolveActiveWorkspaceStageAcceptance(workspacePath, workflowId, stageId);
110
108
  const localSkills = buildLocalSkillContractExtension(workspacePath, [workflowCompileStageDirectory(stageSkillDir)], "Use them to refine workspace shaping, navigation, and retrieval routes.");
111
109
  return buildWorkspaceShapeContract({
112
110
  workspaceName: config?.name ?? "workspace",
113
111
  summaryCount,
114
112
  shapeInputPath,
115
- workflowNotes: getWorkflowStagePolicyNotes(workflowId, stageId, controlPath),
113
+ workflowNotes: getActiveWorkspaceStagePolicyNotes(workspacePath, workflowId, stageId),
116
114
  localSkillDocs: localSkills.reads,
117
115
  instructions,
118
116
  acceptance,
@@ -120,13 +118,12 @@ export function buildWorkspaceCompileContract(workspacePath, workflowId, summary
120
118
  }
121
119
  function buildWorkspaceStructureStageContract(workspacePath, workflowId, summaryCount, instructions, stageId = "structure", stageSkillDir = "structure") {
122
120
  const config = readInterfConfig(workspacePath);
123
- const controlPath = resolveSourceControlPath(workspacePath);
124
- const acceptance = resolveStageAcceptance(workflowId, stageId, controlPath);
121
+ const acceptance = resolveActiveWorkspaceStageAcceptance(workspacePath, workflowId, stageId);
125
122
  const localSkills = buildLocalSkillContractExtension(workspacePath, [workflowCompileStageDirectory(stageSkillDir)], "Use them to refine workspace structure, taxonomy, ontology, entity extraction, and claim extraction.");
126
123
  return buildWorkspaceStructureContract({
127
124
  workspaceName: config?.name ?? "workspace",
128
125
  summaryCount,
129
- workflowNotes: getWorkflowStagePolicyNotes(workflowId, stageId, controlPath),
126
+ workflowNotes: getActiveWorkspaceStagePolicyNotes(workspacePath, workflowId, stageId),
130
127
  localSkillDocs: localSkills.reads,
131
128
  instructions,
132
129
  acceptance,
@@ -135,7 +132,6 @@ function buildWorkspaceStructureStageContract(workspacePath, workflowId, summary
135
132
  export async function runWorkspaceSummarize(options) {
136
133
  const context = resolveWorkspaceContext(options.workspacePath);
137
134
  const sourcePath = options.sourcePath ?? context.sourcePath;
138
- const controlPath = context.controlPath;
139
135
  const workflowId = context.workflowId;
140
136
  const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-file-evidence");
141
137
  const stageStatusLabel = stageDefinition.label.toLowerCase();
@@ -151,7 +147,7 @@ export async function runWorkspaceSummarize(options) {
151
147
  refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true });
152
148
  const validation = validateWorkspaceSummarize(options.workspacePath);
153
149
  if (options.reportStep !== false) {
154
- reportLine(options.reporter, `${formatWorkspaceWorkflowStageStep(workflowId, stageDefinition.id, { sourcePath: controlPath })} skipped (no work required)`);
150
+ reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} skipped (no work required)`);
155
151
  }
156
152
  if (!validation.ok) {
157
153
  reportValidationFailure(options.reporter, validation.summary);
@@ -164,45 +160,52 @@ export async function runWorkspaceSummarize(options) {
164
160
  };
165
161
  }
166
162
  if (options.reportStep !== false) {
167
- reportLine(options.reporter, `${formatWorkspaceWorkflowStageStep(workflowId, stageDefinition.id, { sourcePath: controlPath })} (${plan.targetCount} files)`);
163
+ reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (${plan.targetCount} files)`);
168
164
  }
169
165
  const shell = createStageExecutionShell(options.workspacePath, context.workspaceName, workflowId, stageDefinition);
170
- const stageResult = await executeValidatedSummarizeStage({
171
- executor: options.executor,
172
- workspacePath: options.workspacePath,
173
- executionPath: shell.rootPath,
174
- targetName: context.workspaceName,
175
- workflow: workflowId,
176
- workflowSourcePath: controlPath,
177
- stageDefinition,
178
- instructions,
179
- summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${plan.targetCount} source files.`,
180
- contract: buildWorkspaceSummarizeContract({
181
- workspaceName: context.workspaceName,
182
- targetCount: plan.targetCount,
183
- expectedSummaryTotal,
184
- sourcePath,
185
- planPath,
186
- workflowNotes: getWorkflowStagePolicyNotes(workflowId, stageDefinition.id, controlPath),
187
- localSkillDocs: localSkills.reads,
166
+ let stageResult;
167
+ try {
168
+ stageResult = await executeValidatedSummarizeStage({
169
+ executor: options.executor,
170
+ workspacePath: options.workspacePath,
171
+ executionPath: shell.rootPath,
172
+ targetName: context.workspaceName,
173
+ workflow: workflowId,
174
+ workflowSourcePath: options.workspacePath,
175
+ stageDefinition,
188
176
  instructions,
189
- acceptance: resolveStageAcceptance(workflowId, stageDefinition.id, controlPath),
190
- }),
191
- statusLines: [
192
- `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${plan.targetCount} files.`,
193
- "The CLI owns live file-count progress. Do not emit per-file progress.",
194
- "If `.interf/inventory.json` already exists, overwrite it completely instead of patching prior contents.",
195
- "Emit STATUS: batch committed after a completed batch has been merged into summaries/ and inventory.",
196
- `Emit DONE: ${stageStatusLabel} complete ${plan.targetCount}/${plan.targetCount} when finished.`,
197
- ],
198
- reporter: options.reporter,
199
- completionCheck: () => isWorkspaceSummarizeStageComplete(options.workspacePath, expectedSummaryTotal),
200
- reconcile: () => reconcileWorkspaceSummarizeRun(options.workspacePath, expectedSummaryTotal),
201
- refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
202
- validate: () => validateWorkspaceSummarize(options.workspacePath),
203
- startingSummaryCount: plan.summaryCount,
204
- targetCount: plan.targetCount,
205
- });
177
+ summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${plan.targetCount} source files.`,
178
+ contract: buildWorkspaceSummarizeContract({
179
+ workspaceName: context.workspaceName,
180
+ targetCount: plan.targetCount,
181
+ expectedSummaryTotal,
182
+ sourcePath,
183
+ planPath,
184
+ workflowNotes: getActiveWorkspaceStagePolicyNotes(options.workspacePath, workflowId, stageDefinition.id),
185
+ localSkillDocs: localSkills.reads,
186
+ instructions,
187
+ acceptance: resolveActiveWorkspaceStageAcceptance(options.workspacePath, workflowId, stageDefinition.id),
188
+ }),
189
+ statusLines: [
190
+ `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${plan.targetCount} files.`,
191
+ "The CLI owns live file-count progress. Do not emit per-file progress.",
192
+ "If `.interf/runtime/inventory.json` already exists, overwrite it completely instead of patching prior contents.",
193
+ "Emit STATUS: batch committed after a completed batch has been merged into summaries/ and inventory.",
194
+ `Emit DONE: ${stageStatusLabel} complete ${plan.targetCount}/${plan.targetCount} when finished.`,
195
+ ],
196
+ reporter: options.reporter,
197
+ completionCheck: () => isWorkspaceSummarizeStageComplete(options.workspacePath, expectedSummaryTotal),
198
+ syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
199
+ reconcile: () => reconcileWorkspaceSummarizeRun(options.workspacePath, expectedSummaryTotal),
200
+ refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
201
+ validate: () => validateWorkspaceSummarize(options.workspacePath),
202
+ startingSummaryCount: plan.summaryCount,
203
+ targetCount: plan.targetCount,
204
+ });
205
+ }
206
+ finally {
207
+ freezeStageExecutionShell(shell.rootPath);
208
+ }
206
209
  if (!stageResult.ok) {
207
210
  return {
208
211
  ok: false,
@@ -223,7 +226,6 @@ async function runWorkspaceStructure(options) {
223
226
  const workspaceName = workspaceConfig?.name ?? "workspace";
224
227
  const workflowId = resolveWorkspaceWorkflowFromConfig(workspaceConfig);
225
228
  const sourcePath = options.sourcePath ?? resolveSourceFolderPath(options.workspacePath, workspaceConfig);
226
- const controlPath = resolveSourceControlPath(options.workspacePath);
227
229
  const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-knowledge-structure");
228
230
  const stageStatusLabel = stageDefinition.label.toLowerCase();
229
231
  const summaryCount = countFilesRecursive(join(options.workspacePath, "summaries"));
@@ -231,73 +233,84 @@ async function runWorkspaceStructure(options) {
231
233
  const instructions = buildStageInstructions(bundledSkillForContractType(stageDefinition.contractType), localSkills);
232
234
  if (options.reportStep !== false) {
233
235
  reportBlankLine(options.reporter);
234
- reportLine(options.reporter, `${formatWorkspaceWorkflowStageStep(workflowId, stageDefinition.id, { sourcePath: controlPath })} (building knowledge structure)`);
236
+ reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (building knowledge structure)`);
235
237
  }
236
238
  const shell = createStageExecutionShell(options.workspacePath, workspaceName, workflowId, stageDefinition);
237
- return executeValidatedStage({
238
- executor: options.executor,
239
- workspacePath: options.workspacePath,
240
- executionPath: shell.rootPath,
241
- targetName: workspaceName,
242
- workflow: workflowId,
243
- workflowSourcePath: controlPath,
244
- stageDefinition,
245
- instructions,
246
- summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
247
- contract: buildWorkspaceStructureStageContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir),
248
- statusLines: [
249
- `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
250
- `Emit STATUS: inventoried summaries ${summaryCount}/${summaryCount} after the inventory pass completes.`,
251
- `Emit STATUS: structured knowledge layer after entities, claims, and indexes are updated.`,
252
- `Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
253
- ],
254
- reporter: options.reporter,
255
- completionCheck: () => isWorkspaceStructureStageComplete(options.workspacePath, summaryCount),
256
- reconcile: () => reconcileWorkspaceStructureRun(options.workspacePath),
257
- refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
258
- validate: () => validateWorkspaceStructure(options.workspacePath),
259
- });
239
+ try {
240
+ return await executeValidatedStage({
241
+ executor: options.executor,
242
+ workspacePath: options.workspacePath,
243
+ executionPath: shell.rootPath,
244
+ targetName: workspaceName,
245
+ workflow: workflowId,
246
+ workflowSourcePath: options.workspacePath,
247
+ stageDefinition,
248
+ instructions,
249
+ summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
250
+ contract: buildWorkspaceStructureStageContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir),
251
+ statusLines: [
252
+ `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
253
+ `Emit STATUS: inventoried summaries ${summaryCount}/${summaryCount} after the inventory pass completes.`,
254
+ `Emit STATUS: structured knowledge layer after entities, claims, and indexes are updated.`,
255
+ `Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
256
+ ],
257
+ reporter: options.reporter,
258
+ completionCheck: () => isWorkspaceStructureStageComplete(options.workspacePath, summaryCount),
259
+ syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
260
+ reconcile: () => reconcileWorkspaceStructureRun(options.workspacePath),
261
+ refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
262
+ validate: () => validateWorkspaceStructure(options.workspacePath),
263
+ });
264
+ }
265
+ finally {
266
+ freezeStageExecutionShell(shell.rootPath);
267
+ }
260
268
  }
261
269
  async function runWorkspaceShape(options) {
262
270
  const workspaceConfig = readInterfConfig(options.workspacePath);
263
271
  const workspaceName = workspaceConfig?.name ?? "workspace";
264
272
  const workflowId = resolveWorkspaceWorkflowFromConfig(workspaceConfig);
265
273
  const sourcePath = options.sourcePath ?? resolveSourceFolderPath(options.workspacePath, workspaceConfig);
266
- const controlPath = resolveSourceControlPath(options.workspacePath);
267
274
  const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-query-shape");
268
275
  const stageStatusLabel = stageDefinition.label.toLowerCase();
269
276
  const summaryCount = countFilesRecursive(join(options.workspacePath, "summaries"));
270
277
  const localSkills = buildLocalSkillContractExtension(options.workspacePath, [workflowCompileStageDirectory(stageDefinition.skillDir)], "Use them to refine final workspace shaping, navigation, and retrieval routes.");
271
278
  const instructions = buildStageInstructions(bundledSkillForContractType(stageDefinition.contractType), localSkills);
272
- const shapeInputPath = writeWorkspaceShapeInput(options.workspacePath, workspaceName, controlPath);
279
+ const shapeInputPath = writeWorkspaceShapeInput(options.workspacePath, workspaceName);
273
280
  if (options.reportStep !== false) {
274
281
  reportBlankLine(options.reporter);
275
- reportLine(options.reporter, `${formatWorkspaceWorkflowStageStep(workflowId, stageDefinition.id, { sourcePath: controlPath })} (shaping workspace surface)`);
282
+ reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (shaping workspace surface)`);
276
283
  }
277
284
  const shell = createStageExecutionShell(options.workspacePath, workspaceName, workflowId, stageDefinition);
278
- return executeValidatedStage({
279
- executor: options.executor,
280
- workspacePath: options.workspacePath,
281
- executionPath: shell.rootPath,
282
- targetName: workspaceName,
283
- workflow: workflowId,
284
- workflowSourcePath: controlPath,
285
- stageDefinition,
286
- instructions,
287
- summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
288
- contract: buildWorkspaceCompileContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir, shapeInputPath),
289
- statusLines: [
290
- `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
291
- `Emit STATUS: read shaping input after ${shapeInputPath} has been loaded.`,
292
- "Emit STATUS: shaped workspace surface after home.md and any focused indexes are updated.",
293
- `Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
294
- ],
295
- reporter: options.reporter,
296
- completionCheck: () => isWorkspaceShapeStageComplete(options.workspacePath, summaryCount),
297
- reconcile: () => reconcileWorkspaceShapeRun(options.workspacePath),
298
- refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
299
- validate: () => validateWorkspaceCompile(options.workspacePath),
300
- });
285
+ try {
286
+ return await executeValidatedStage({
287
+ executor: options.executor,
288
+ workspacePath: options.workspacePath,
289
+ executionPath: shell.rootPath,
290
+ targetName: workspaceName,
291
+ workflow: workflowId,
292
+ workflowSourcePath: options.workspacePath,
293
+ stageDefinition,
294
+ instructions,
295
+ summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
296
+ contract: buildWorkspaceCompileContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir, shapeInputPath),
297
+ statusLines: [
298
+ `Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
299
+ `Emit STATUS: read shaping input after ${shapeInputPath} has been loaded.`,
300
+ "Emit STATUS: shaped workspace surface after home.md and any focused indexes are updated.",
301
+ `Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
302
+ ],
303
+ reporter: options.reporter,
304
+ completionCheck: () => isWorkspaceShapeStageComplete(options.workspacePath, summaryCount),
305
+ syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
306
+ reconcile: () => reconcileWorkspaceShapeRun(options.workspacePath),
307
+ refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
308
+ validate: () => validateWorkspaceCompile(options.workspacePath),
309
+ });
310
+ }
311
+ finally {
312
+ freezeStageExecutionShell(shell.rootPath);
313
+ }
301
314
  }
302
315
  async function runWorkspaceCompileStages(options) {
303
316
  const workspaceConfig = readInterfConfig(options.workspacePath);
@@ -377,6 +390,31 @@ export async function compileWorkspace(options) {
377
390
  const controlPath = resolveSourceControlPath(options.workspacePath);
378
391
  syncWorkspaceRawSnapshot(options.workspacePath, controlPath);
379
392
  refreshWorkspaceBootstrapGuidance(options.workspacePath);
393
+ const workflowValidation = validateWorkflowPackage(join(options.workspacePath, ".interf", "workflow"));
394
+ if (!workflowValidation.ok) {
395
+ const summary = workflowValidation.summary;
396
+ reportValidationFailure(options.reporter, summary, workflowValidation.errors);
397
+ const failedResult = {
398
+ ok: false,
399
+ summarize: {
400
+ ok: false,
401
+ code: 1,
402
+ skipped: true,
403
+ plan: buildSummarizePlan(controlPath, options.workspacePath),
404
+ summary,
405
+ },
406
+ structure: null,
407
+ shape: null,
408
+ compile: {
409
+ ok: false,
410
+ code: 1,
411
+ summary,
412
+ },
413
+ failedStage: "workflow",
414
+ };
415
+ result = failedResult;
416
+ return failedResult;
417
+ }
380
418
  const { sourcePath, workflowId } = resolveWorkspaceContext(options.workspacePath);
381
419
  const stages = workspaceExecutionStages(workflowId, options.workspacePath);
382
420
  let summarize = {
@@ -436,4 +474,3 @@ export async function compileWorkspace(options) {
436
474
  }
437
475
  }
438
476
  }
439
- //# sourceMappingURL=workspace-compile.js.map
@@ -0,0 +1,5 @@
1
+ export declare const UNCOMPILED_WORKSPACE_HOME_NOTICE = "Not yet compiled. Run `interf compile` to build this compiled workspace.";
2
+ export declare function renderUncompiledWorkspaceHome(workspaceName: string, about?: string): string;
3
+ export declare function workspaceHomeHasCompilePlaceholder(content: string): boolean;
4
+ export declare function readWorkspaceHomeContent(dirPath: string): string | null;
5
+ export declare function workspaceHomeIsShaped(dirPath: string): boolean;
@@ -0,0 +1,32 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ export const UNCOMPILED_WORKSPACE_HOME_NOTICE = "Not yet compiled. Run `interf compile` to build this compiled workspace.";
4
+ export function renderUncompiledWorkspaceHome(workspaceName, about) {
5
+ return [
6
+ `# ${workspaceName} — Home`,
7
+ "",
8
+ UNCOMPILED_WORKSPACE_HOME_NOTICE,
9
+ ...(about ? ["", `About: ${about}`] : []),
10
+ "",
11
+ ].join("\n");
12
+ }
13
+ export function workspaceHomeHasCompilePlaceholder(content) {
14
+ return content.includes(UNCOMPILED_WORKSPACE_HOME_NOTICE);
15
+ }
16
+ export function readWorkspaceHomeContent(dirPath) {
17
+ const homePath = join(dirPath, "home.md");
18
+ if (!existsSync(homePath))
19
+ return null;
20
+ try {
21
+ return readFileSync(homePath, "utf8");
22
+ }
23
+ catch {
24
+ return null;
25
+ }
26
+ }
27
+ export function workspaceHomeIsShaped(dirPath) {
28
+ const content = readWorkspaceHomeContent(dirPath);
29
+ if (content === null)
30
+ return false;
31
+ return !workspaceHomeHasCompilePlaceholder(content);
32
+ }
@@ -0,0 +1,2 @@
1
+ export declare function normalizeLegacyWorkspaceLayout(workspacePath: string): boolean;
2
+ export declare function workspaceNeedsLegacyLayoutNormalization(workspacePath: string): boolean;
@@ -0,0 +1,60 @@
1
+ import { existsSync, mkdirSync, readdirSync, renameSync, } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { WORKSPACE_CONFIG_FILE, WORKSPACE_INTERF_DIR, WORKSPACE_RUNTIME_DIR, WORKSPACE_TEST_DIR, WORKSPACE_WORKFLOW_DIR, workflowPackagePathForWorkspace, workspaceInterfConfigPath, workspaceInterfRoot, workspaceRuntimeRoot, } from "./workspace-paths.js";
4
+ const LEGACY_WORKSPACE_CONFIG_FILE = "interf.json";
5
+ const LEGACY_WORKFLOW_DIR = "workflow";
6
+ function movePathIfMissing(sourcePath, targetPath) {
7
+ if (!existsSync(sourcePath)) {
8
+ return false;
9
+ }
10
+ if (existsSync(targetPath)) {
11
+ return false;
12
+ }
13
+ mkdirSync(dirname(targetPath), { recursive: true });
14
+ renameSync(sourcePath, targetPath);
15
+ return true;
16
+ }
17
+ export function normalizeLegacyWorkspaceLayout(workspacePath) {
18
+ const interfRoot = workspaceInterfRoot(workspacePath);
19
+ const runtimeRoot = workspaceRuntimeRoot(workspacePath);
20
+ let changed = false;
21
+ changed = movePathIfMissing(join(workspacePath, LEGACY_WORKSPACE_CONFIG_FILE), workspaceInterfConfigPath(workspacePath)) || changed;
22
+ changed = movePathIfMissing(join(workspacePath, LEGACY_WORKFLOW_DIR), workflowPackagePathForWorkspace(workspacePath)) || changed;
23
+ if (!existsSync(interfRoot)) {
24
+ return changed;
25
+ }
26
+ for (const entry of readdirSync(interfRoot)) {
27
+ if (entry === WORKSPACE_RUNTIME_DIR ||
28
+ entry === WORKSPACE_TEST_DIR ||
29
+ entry === WORKSPACE_WORKFLOW_DIR ||
30
+ entry === WORKSPACE_CONFIG_FILE) {
31
+ continue;
32
+ }
33
+ changed = movePathIfMissing(join(interfRoot, entry), join(runtimeRoot, entry)) || changed;
34
+ }
35
+ return changed;
36
+ }
37
+ export function workspaceNeedsLegacyLayoutNormalization(workspacePath) {
38
+ if (existsSync(join(workspacePath, LEGACY_WORKSPACE_CONFIG_FILE)) &&
39
+ !existsSync(workspaceInterfConfigPath(workspacePath))) {
40
+ return true;
41
+ }
42
+ if (!existsSync(join(workspacePath, WORKSPACE_INTERF_DIR)))
43
+ return false;
44
+ if (existsSync(join(workspacePath, LEGACY_WORKFLOW_DIR)) &&
45
+ !existsSync(workflowPackagePathForWorkspace(workspacePath))) {
46
+ return true;
47
+ }
48
+ for (const entry of readdirSync(join(workspacePath, WORKSPACE_INTERF_DIR))) {
49
+ if (entry === WORKSPACE_RUNTIME_DIR ||
50
+ entry === WORKSPACE_TEST_DIR ||
51
+ entry === WORKSPACE_WORKFLOW_DIR ||
52
+ entry === WORKSPACE_CONFIG_FILE) {
53
+ continue;
54
+ }
55
+ if (!existsSync(join(workspaceRuntimeRoot(workspacePath), entry))) {
56
+ return true;
57
+ }
58
+ }
59
+ return false;
60
+ }
@@ -0,0 +1,41 @@
1
+ export declare const WORKSPACE_INTERF_DIR = ".interf";
2
+ export declare const WORKSPACE_CONFIG_FILE = "interf.json";
3
+ export declare const WORKSPACE_WORKFLOW_DIR = "workflow";
4
+ export declare const WORKSPACE_TEST_DIR = "tests";
5
+ export declare const WORKSPACE_TEST_TARGETS_DIR = "targets";
6
+ export declare const WORKSPACE_RUNTIME_DIR = "runtime";
7
+ export declare const WORKSPACE_RUNTIME_STATE_FILE = "state.json";
8
+ export declare const WORKSPACE_RUNTIME_HEALTH_FILE = "health.json";
9
+ export declare const WORKSPACE_RUNTIME_VIEW_SPEC_FILE = "view-spec.json";
10
+ export declare const WORKSPACE_RUNTIME_RAW_SNAPSHOT_FILE = "raw-snapshot.json";
11
+ export declare const WORKSPACE_RUNTIME_INVENTORY_FILE = "inventory.json";
12
+ export declare const WORKSPACE_RUNTIME_RUN_FILE = "run.json";
13
+ export declare const WORKSPACE_RUNTIME_RUN_HISTORY_FILE = "run-history.jsonl";
14
+ export declare const WORKSPACE_RUNTIME_STAGE_CONTRACT_FILE = "stage-contract.json";
15
+ export declare function workspaceRuntimeRoot(workspacePath: string): string;
16
+ export declare function workspaceRuntimeFilePath(workspacePath: string, fileName: string): string;
17
+ export declare function workspaceInterfRoot(workspacePath: string): string;
18
+ export declare function workspaceInterfConfigPath(workspacePath: string): string;
19
+ export declare function workflowPackagePathForWorkspace(workspacePath: string): string;
20
+ export declare function testRootForWorkspace(workspacePath: string): string;
21
+ export declare function testRunsRootForWorkspace(workspacePath: string): string;
22
+ export declare function testTargetsRootForWorkspace(workspacePath: string): string;
23
+ export declare function latestTestComparisonPathForWorkspace(workspacePath: string): string;
24
+ export declare function stageExecutionShellsRoot(workspacePath: string): string;
25
+ export declare function workflowImprovementLoopsRoot(workspacePath: string): string;
26
+ export declare function workflowImprovementRunRoot(workspacePath: string, runId: string): string;
27
+ export declare function workflowImprovementLoopRoot(workspacePath: string, runId: string, loopIndex: number): string;
28
+ export declare function targetTestRunsRootForWorkspace(workspacePath: string): string;
29
+ export declare function targetTestSandboxesRootForWorkspace(workspacePath: string): string;
30
+ export declare function workspaceRuntimeLogsRoot(workspacePath: string): string;
31
+ export declare function workspaceQueryAcceptanceRoot(workspacePath: string): string;
32
+ export declare function workspaceRuntimeStatePath(workspacePath: string): string;
33
+ export declare function workspaceRuntimeHealthPath(workspacePath: string): string;
34
+ export declare function workspaceRuntimeViewSpecPath(workspacePath: string): string;
35
+ export declare function workspaceRawSnapshotMetadataPath(workspacePath: string): string;
36
+ export declare function workspaceRuntimeInventoryPath(workspacePath: string): string;
37
+ export declare function workspaceRuntimeRunPath(workspacePath: string): string;
38
+ export declare function workspaceRuntimeRunHistoryPath(workspacePath: string): string;
39
+ export declare function workspaceRuntimeStageContractPath(workspacePath: string): string;
40
+ export declare function resolveSourceControlPathForWorkspace(workspacePath: string): string;
41
+ export declare function defaultControlPathForWorkspace(workspacePath: string): string;