@interf/compiler 0.3.4 → 0.4.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 (385) hide show
  1. package/README.md +128 -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
@@ -4,9 +4,11 @@ import { countFilesRecursive, listFilesRecursive } from "./filesystem.js";
4
4
  import { discoverSourceFiles } from "./discovery.js";
5
5
  import { resolveSourceFolderPath } from "./interf.js";
6
6
  import { readJsonFileUnchecked } from "./parse.js";
7
+ import { workspaceHomeIsShaped } from "./workspace-home.js";
7
8
  import { WorkspaceInventorySchema, WorkspaceStateSchema, } from "./schema.js";
8
9
  import { readWorkspaceConfig, validateSynthFiles, countBrokenWikilinks, asNumber, isOutputMarkdownFile, } from "./validate.js";
9
10
  import { readInventoryFiles, readInventoryTotal, } from "./validate-helpers.js";
11
+ import { workspaceInterfConfigPath, workspaceRuntimeRoot, } from "./workspace-paths.js";
10
12
  export function validateWorkspace(dirPath) {
11
13
  const config = readWorkspaceConfig(dirPath);
12
14
  const summaryFiles = listFilesRecursive(join(dirPath, "summaries"), isOutputMarkdownFile);
@@ -32,8 +34,9 @@ export function validateWorkspaceSummarize(dirPath) {
32
34
  const summaryFiles = listFilesRecursive(join(dirPath, "summaries"), isOutputMarkdownFile);
33
35
  const summaryValidation = validateSynthFiles(summaryFiles);
34
36
  const summarized = summaryFiles.length;
35
- const statePath = join(dirPath, ".interf", "state.json");
36
- const inventoryPath = join(dirPath, ".interf", "inventory.json");
37
+ const runtimeRoot = workspaceRuntimeRoot(dirPath);
38
+ const statePath = join(runtimeRoot, "state.json");
39
+ const inventoryPath = join(runtimeRoot, "inventory.json");
37
40
  const statePresent = existsSync(statePath);
38
41
  const inventoryPresent = existsSync(inventoryPath);
39
42
  const state = statePresent
@@ -69,21 +72,21 @@ export function validateWorkspaceSummarize(dirPath) {
69
72
  };
70
73
  const errors = [];
71
74
  if (!checks.config_present)
72
- errors.push("Missing interf.json.");
75
+ errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
73
76
  else if (!checks.config_valid)
74
- errors.push("Could not parse interf.json.");
77
+ errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
75
78
  else if (!checks.config_type_match)
76
79
  errors.push("Config is not a workspace.");
77
80
  if (required && !checks.summaries_present)
78
81
  errors.push("Missing summaries/ directory.");
79
82
  if (required && !checks.state_present)
80
- errors.push("Missing .interf/state.json.");
83
+ errors.push("Missing .interf/runtime/state.json.");
81
84
  else if (required && !checks.state_valid)
82
- errors.push("Could not parse .interf/state.json.");
85
+ errors.push("Could not parse .interf/runtime/state.json.");
83
86
  if (required && !checks.inventory_present)
84
- errors.push("Missing .interf/inventory.json.");
87
+ errors.push("Missing .interf/runtime/inventory.json.");
85
88
  else if (required && !checks.inventory_valid)
86
- errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
89
+ errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
87
90
  if (required && checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
88
91
  errors.push("state.json does not mark inventory_complete.");
89
92
  }
@@ -126,8 +129,9 @@ export function validateWorkspaceCompile(dirPath) {
126
129
  const summarizeValidation = validateWorkspaceSummarize(dirPath);
127
130
  const structureValidation = validateWorkspaceStructure(dirPath);
128
131
  const config = readWorkspaceConfig(dirPath);
129
- const statePath = join(dirPath, ".interf", "state.json");
130
- const inventoryPath = join(dirPath, ".interf", "inventory.json");
132
+ const runtimeRoot = workspaceRuntimeRoot(dirPath);
133
+ const statePath = join(runtimeRoot, "state.json");
134
+ const inventoryPath = join(runtimeRoot, "inventory.json");
131
135
  const statePresent = existsSync(statePath);
132
136
  const inventoryPresent = existsSync(inventoryPath);
133
137
  const state = statePresent
@@ -169,6 +173,7 @@ export function validateWorkspaceCompile(dirPath) {
169
173
  const indexFiles = countFilesRecursive(join(dirPath, "knowledge", "indexes"));
170
174
  const outputs = entityFiles + claimFiles + indexFiles;
171
175
  const homePresent = existsSync(join(dirPath, "home.md"));
176
+ const homeShaped = workspaceHomeIsShaped(dirPath);
172
177
  const brokenLinks = countBrokenWikilinks(dirPath, [join(dirPath, "summaries"), join(dirPath, "knowledge"), join(dirPath, "home.md")], [join(dirPath, "summaries"), join(dirPath, "knowledge"), join(dirPath, "home.md")]);
173
178
  const required = structureValidation.required || homePresent || shaped > 0 || compiled > 0 || inventoryPresent;
174
179
  const checks = {
@@ -195,13 +200,14 @@ export function validateWorkspaceCompile(dirPath) {
195
200
  state.last_compile.length > 0,
196
201
  outputs_present: outputs > 0,
197
202
  home_present: homePresent,
203
+ home_shaped: homeShaped,
198
204
  links_valid: brokenLinks === 0,
199
205
  };
200
206
  const errors = [];
201
207
  if (!checks.config_present)
202
- errors.push("Missing interf.json.");
208
+ errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
203
209
  else if (!checks.config_valid)
204
- errors.push("Could not parse interf.json.");
210
+ errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
205
211
  else if (!checks.config_type_match)
206
212
  errors.push("Config is not a workspace.");
207
213
  if (!checks.summarize_complete)
@@ -209,13 +215,13 @@ export function validateWorkspaceCompile(dirPath) {
209
215
  if (!checks.structure_complete)
210
216
  errors.push("Workspace structure is incomplete or invalid.");
211
217
  if (!checks.state_present)
212
- errors.push("Missing .interf/state.json.");
218
+ errors.push("Missing .interf/runtime/state.json.");
213
219
  else if (!checks.state_valid)
214
- errors.push("Could not parse .interf/state.json.");
220
+ errors.push("Could not parse .interf/runtime/state.json.");
215
221
  if (!checks.inventory_present)
216
- errors.push("Missing .interf/inventory.json.");
222
+ errors.push("Missing .interf/runtime/inventory.json.");
217
223
  else if (!checks.inventory_valid)
218
- errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
224
+ errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
219
225
  if (checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
220
226
  errors.push("state.json does not mark inventory_complete.");
221
227
  }
@@ -238,6 +244,9 @@ export function validateWorkspaceCompile(dirPath) {
238
244
  errors.push("Workspace compile outputs are missing or empty.");
239
245
  if (!checks.home_present)
240
246
  errors.push("Workspace home.md is missing.");
247
+ if (checks.home_present && !checks.home_shaped) {
248
+ errors.push("Workspace home.md still contains the uncompiled scaffold placeholder.");
249
+ }
241
250
  if (!checks.links_valid)
242
251
  errors.push("Some knowledge notes contain broken wikilinks.");
243
252
  const ok = required ? errors.length === 0 : true;
@@ -272,8 +281,9 @@ export function validateWorkspaceCompile(dirPath) {
272
281
  export function validateWorkspaceStructure(dirPath) {
273
282
  const summarizeValidation = validateWorkspaceSummarize(dirPath);
274
283
  const config = readWorkspaceConfig(dirPath);
275
- const statePath = join(dirPath, ".interf", "state.json");
276
- const inventoryPath = join(dirPath, ".interf", "inventory.json");
284
+ const runtimeRoot = workspaceRuntimeRoot(dirPath);
285
+ const statePath = join(runtimeRoot, "state.json");
286
+ const inventoryPath = join(runtimeRoot, "inventory.json");
277
287
  const statePresent = existsSync(statePath);
278
288
  const inventoryPresent = existsSync(inventoryPath);
279
289
  const state = statePresent
@@ -335,21 +345,21 @@ export function validateWorkspaceStructure(dirPath) {
335
345
  };
336
346
  const errors = [];
337
347
  if (!checks.config_present)
338
- errors.push("Missing interf.json.");
348
+ errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
339
349
  else if (!checks.config_valid)
340
- errors.push("Could not parse interf.json.");
350
+ errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
341
351
  else if (!checks.config_type_match)
342
352
  errors.push("Config is not a workspace.");
343
353
  if (!checks.summarize_complete)
344
354
  errors.push("Workspace summarize is incomplete or invalid.");
345
355
  if (!checks.state_present)
346
- errors.push("Missing .interf/state.json.");
356
+ errors.push("Missing .interf/runtime/state.json.");
347
357
  else if (!checks.state_valid)
348
- errors.push("Could not parse .interf/state.json.");
358
+ errors.push("Could not parse .interf/runtime/state.json.");
349
359
  if (!checks.inventory_present)
350
- errors.push("Missing .interf/inventory.json.");
360
+ errors.push("Missing .interf/runtime/inventory.json.");
351
361
  else if (!checks.inventory_valid)
352
- errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
362
+ errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
353
363
  if (checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
354
364
  errors.push("state.json does not mark inventory_complete.");
355
365
  }
@@ -395,4 +405,3 @@ export function validateWorkspaceStructure(dirPath) {
395
405
  errors,
396
406
  };
397
407
  }
398
- //# sourceMappingURL=validate-workspace.js.map
@@ -15,4 +15,3 @@ export declare function isOutputMarkdownFile(filePath: string): boolean;
15
15
  export declare function safeReadText(filePath: string): string | null;
16
16
  export { validateWorkspace, validateWorkspaceSummarize, validateWorkspaceStructure, validateWorkspaceCompile, } from "./validate-workspace.js";
17
17
  export type { WorkspaceValidationSummary, WorkspaceSummarizeValidation, WorkspaceStructureValidation, WorkspaceCompileValidation, } from "./validate-workspace.js";
18
- //# sourceMappingURL=validate.d.ts.map
@@ -3,6 +3,7 @@ import { basename, extname, join } from "node:path";
3
3
  import { listFilesRecursive } from "./filesystem.js";
4
4
  import { readInterfConfig } from "./interf.js";
5
5
  import { parseJsonFrontmatter } from "./parse.js";
6
+ import { workspaceInterfConfigPath } from "./workspace-paths.js";
6
7
  const REQUIRED_DIGEST_FIELDS = [
7
8
  "source_kind",
8
9
  "evidence_tier",
@@ -11,8 +12,10 @@ const REQUIRED_DIGEST_FIELDS = [
11
12
  ];
12
13
  const MIN_ABSTRACT_WORDS = 5;
13
14
  const WIKILINK_PATTERN = /!?\[\[([^[\]]+)\]\]/g;
15
+ const KNOWLEDGE_RELATIVE_PREFIXES = new Set(["entities", "claims", "indexes"]);
14
16
  export function readWorkspaceConfig(dirPath) {
15
- const configPath = join(dirPath, "interf.json");
17
+ const configPath = workspaceInterfConfigPath(dirPath);
18
+ const value = readInterfConfig(dirPath);
16
19
  const present = existsSync(configPath);
17
20
  if (!present) {
18
21
  return {
@@ -22,7 +25,6 @@ export function readWorkspaceConfig(dirPath) {
22
25
  typeMatch: () => false,
23
26
  };
24
27
  }
25
- const value = readInterfConfig(dirPath);
26
28
  return {
27
29
  present: true,
28
30
  valid: value !== null,
@@ -57,7 +59,9 @@ export function validateSynthFiles(files) {
57
59
  export function countBrokenWikilinks(workspaceRoot, noteIndexRoots, linkScanRoots) {
58
60
  const noteIndex = new Set();
59
61
  for (const filePath of dedupeFiles(noteIndexRoots)) {
60
- noteIndex.add(noteName(filePath).toLowerCase());
62
+ for (const target of collectWikilinkTargets(filePath)) {
63
+ noteIndex.add(target.toLowerCase());
64
+ }
61
65
  }
62
66
  let brokenLinks = 0;
63
67
  for (const filePath of dedupeFiles(linkScanRoots)) {
@@ -73,11 +77,7 @@ export function countBrokenWikilinks(workspaceRoot, noteIndexRoots, linkScanRoot
73
77
  if (!target)
74
78
  continue;
75
79
  if (target.includes("/")) {
76
- const directPath = join(workspaceRoot, target);
77
- const markdownPath = directPath.endsWith(".md")
78
- ? directPath
79
- : `${directPath}.md`;
80
- if (!existsSync(directPath) && !existsSync(markdownPath)) {
80
+ if (!wikilinkPathExists(workspaceRoot, target)) {
81
81
  brokenLinks += 1;
82
82
  }
83
83
  continue;
@@ -157,5 +157,51 @@ function countWords(text) {
157
157
  function noteName(filePath) {
158
158
  return basename(filePath, extname(filePath));
159
159
  }
160
+ function wikilinkPathExists(workspaceRoot, target) {
161
+ return linkPathCandidates(workspaceRoot, target).some((candidate) => existsSync(candidate));
162
+ }
163
+ function linkPathCandidates(workspaceRoot, target) {
164
+ const candidates = new Set();
165
+ addPathCandidate(candidates, join(workspaceRoot, target));
166
+ const [firstSegment] = target.split("/");
167
+ if (firstSegment && KNOWLEDGE_RELATIVE_PREFIXES.has(firstSegment)) {
168
+ addPathCandidate(candidates, join(workspaceRoot, "knowledge", target));
169
+ }
170
+ return Array.from(candidates);
171
+ }
172
+ function addPathCandidate(candidates, absolutePath) {
173
+ candidates.add(absolutePath);
174
+ if (!absolutePath.endsWith(".md")) {
175
+ candidates.add(`${absolutePath}.md`);
176
+ }
177
+ }
178
+ function collectWikilinkTargets(filePath) {
179
+ const targets = new Set();
180
+ targets.add(noteName(filePath));
181
+ const content = safeReadText(filePath);
182
+ if (content === null)
183
+ return Array.from(targets);
184
+ const parsed = parseJsonFrontmatter(content);
185
+ const frontmatter = parsed?.frontmatter;
186
+ if (!frontmatter)
187
+ return Array.from(targets);
188
+ addFrontmatterLinkTarget(targets, frontmatter.label);
189
+ addFrontmatterLinkTarget(targets, frontmatter.title);
190
+ addFrontmatterLinkTarget(targets, frontmatter.alias);
191
+ addFrontmatterLinkTarget(targets, frontmatter.aliases);
192
+ return Array.from(targets);
193
+ }
194
+ function addFrontmatterLinkTarget(targets, value) {
195
+ if (typeof value === "string") {
196
+ const trimmed = value.trim();
197
+ if (trimmed.length > 0)
198
+ targets.add(trimmed);
199
+ return;
200
+ }
201
+ if (Array.isArray(value)) {
202
+ for (const entry of value) {
203
+ addFrontmatterLinkTarget(targets, entry);
204
+ }
205
+ }
206
+ }
160
207
  export { validateWorkspace, validateWorkspaceSummarize, validateWorkspaceStructure, validateWorkspaceCompile, } from "./validate-workspace.js";
161
- //# sourceMappingURL=validate.js.map
@@ -0,0 +1,138 @@
1
+ export declare const WORKSPACE_CONTRACT_TYPES: readonly ["workspace-file-evidence", "workspace-knowledge-structure", "workspace-query-shape"];
2
+ export type WorkspaceContractType = typeof WORKSPACE_CONTRACT_TYPES[number];
3
+ export declare const WORKSPACE_ZONE_KINDS: readonly ["directory", "file", "runtime"];
4
+ export type WorkspaceZoneKind = typeof WORKSPACE_ZONE_KINDS[number];
5
+ export declare const WORKSPACE_CONTRACT_FAMILY_METADATA: {
6
+ readonly "workspace-file-evidence": {
7
+ readonly order: 0;
8
+ readonly bundledSkill: "compile/stages/summarize";
9
+ };
10
+ readonly "workspace-knowledge-structure": {
11
+ readonly order: 1;
12
+ readonly bundledSkill: "compile/stages/structure";
13
+ };
14
+ readonly "workspace-query-shape": {
15
+ readonly order: 2;
16
+ readonly bundledSkill: "compile/stages/shape";
17
+ };
18
+ };
19
+ export declare const BUILTIN_WORKSPACE_STAGE_IDS: {
20
+ readonly SUMMARIZE: "summarize";
21
+ readonly STRUCTURE: "structure";
22
+ readonly SHAPE: "shape";
23
+ };
24
+ export type BuiltinWorkspaceStageId = typeof BUILTIN_WORKSPACE_STAGE_IDS[keyof typeof BUILTIN_WORKSPACE_STAGE_IDS];
25
+ export declare const BUILTIN_WORKSPACE_ZONE_IDS: {
26
+ readonly RAW: "raw";
27
+ readonly SUMMARIES: "summaries";
28
+ readonly KNOWLEDGE_ENTITIES: "knowledge-entities";
29
+ readonly KNOWLEDGE_CLAIMS: "knowledge-claims";
30
+ readonly KNOWLEDGE_INDEXES: "knowledge-indexes";
31
+ readonly HOME: "home";
32
+ readonly RUNTIME: "runtime";
33
+ };
34
+ export type BuiltinWorkspaceZoneId = typeof BUILTIN_WORKSPACE_ZONE_IDS[keyof typeof BUILTIN_WORKSPACE_ZONE_IDS];
35
+ export interface BuiltinWorkspaceZoneSpec {
36
+ id: BuiltinWorkspaceZoneId;
37
+ path: string;
38
+ kind: WorkspaceZoneKind;
39
+ required: true;
40
+ description: string;
41
+ }
42
+ export declare const BUILTIN_WORKSPACE_ZONE_SPECS: readonly [{
43
+ readonly id: "raw";
44
+ readonly path: "raw";
45
+ readonly kind: "directory";
46
+ readonly required: true;
47
+ readonly description: "Workspace-local raw snapshot copied from the dataset for direct evidence and verification.";
48
+ }, {
49
+ readonly id: "summaries";
50
+ readonly path: "summaries";
51
+ readonly kind: "directory";
52
+ readonly required: true;
53
+ readonly description: "Per-file evidence notes produced by file-evidence stages.";
54
+ }, {
55
+ readonly id: "knowledge-entities";
56
+ readonly path: "knowledge/entities";
57
+ readonly kind: "directory";
58
+ readonly required: true;
59
+ readonly description: "Canonical entity notes produced by knowledge-structure stages.";
60
+ }, {
61
+ readonly id: "knowledge-claims";
62
+ readonly path: "knowledge/claims";
63
+ readonly kind: "directory";
64
+ readonly required: true;
65
+ readonly description: "Claim notes produced by knowledge-structure stages.";
66
+ }, {
67
+ readonly id: "knowledge-indexes";
68
+ readonly path: "knowledge/indexes";
69
+ readonly kind: "directory";
70
+ readonly required: true;
71
+ readonly description: "Retrieval indexes and navigation notes produced by structure and shape stages.";
72
+ }, {
73
+ readonly id: "home";
74
+ readonly path: "home.md";
75
+ readonly kind: "file";
76
+ readonly required: true;
77
+ readonly description: "Primary entrypoint note for agents using the compiled workspace.";
78
+ }, {
79
+ readonly id: "runtime";
80
+ readonly path: ".interf/runtime";
81
+ readonly kind: "runtime";
82
+ readonly required: true;
83
+ readonly description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.";
84
+ }];
85
+ export interface BuiltinWorkspaceStageAccessPattern {
86
+ id: BuiltinWorkspaceStageId;
87
+ label: string;
88
+ description: string;
89
+ contractType: WorkspaceContractType;
90
+ skillDir: string;
91
+ reads: readonly BuiltinWorkspaceZoneId[];
92
+ writes: readonly BuiltinWorkspaceZoneId[];
93
+ }
94
+ export declare const BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS: readonly [{
95
+ readonly id: "summarize";
96
+ readonly label: "Summarize";
97
+ readonly description: "Turn source files into per-file summaries.";
98
+ readonly contractType: "workspace-file-evidence";
99
+ readonly skillDir: "summarize";
100
+ readonly reads: readonly ["raw", "runtime"];
101
+ readonly writes: readonly ["summaries"];
102
+ }, {
103
+ readonly id: "structure";
104
+ readonly label: "Structure";
105
+ readonly description: "Build the cross-file knowledge structure from the summaries.";
106
+ readonly contractType: "workspace-knowledge-structure";
107
+ readonly skillDir: "structure";
108
+ readonly reads: readonly ["summaries", "runtime"];
109
+ readonly writes: readonly ["knowledge-entities", "knowledge-claims", "knowledge-indexes"];
110
+ }, {
111
+ readonly id: "shape";
112
+ readonly label: "Shape";
113
+ readonly description: "Shape the final workspace around the saved focus and truth checks.";
114
+ readonly contractType: "workspace-query-shape";
115
+ readonly skillDir: "shape";
116
+ readonly reads: readonly ["raw", "summaries", "knowledge-entities", "knowledge-claims", "knowledge-indexes", "runtime"];
117
+ readonly writes: readonly ["knowledge-indexes", "home"];
118
+ }];
119
+ export declare function workspaceContractOrder(contractType: WorkspaceContractType): number;
120
+ export declare function workspaceBundledSkillForContractType(contractType: WorkspaceContractType): string;
121
+ export declare function hasValidWorkspaceContractSequence(contractTypes: readonly WorkspaceContractType[]): boolean;
122
+ export declare function listMissingWorkspaceContractTypes(contractTypes: readonly string[]): WorkspaceContractType[];
123
+ export declare function validateWorkspaceContractSequence(contractTypes: readonly WorkspaceContractType[]): {
124
+ ok: boolean;
125
+ orderValid: boolean;
126
+ missing: WorkspaceContractType[];
127
+ };
128
+ export declare function listBuiltinWorkspaceZoneSpecs(): BuiltinWorkspaceZoneSpec[];
129
+ export declare function listBuiltinWorkspaceFallbackStages(): Array<{
130
+ id: BuiltinWorkspaceStageId;
131
+ contract_type: WorkspaceContractType;
132
+ reads: BuiltinWorkspaceZoneId[];
133
+ writes: BuiltinWorkspaceZoneId[];
134
+ }>;
135
+ export declare function requiredWorkspaceZoneOwners<TStage extends {
136
+ id: string;
137
+ contractType: WorkspaceContractType;
138
+ }>(stages: readonly TStage[], zoneId: BuiltinWorkspaceZoneId): string[];
@@ -0,0 +1,181 @@
1
+ export const WORKSPACE_CONTRACT_TYPES = [
2
+ "workspace-file-evidence",
3
+ "workspace-knowledge-structure",
4
+ "workspace-query-shape",
5
+ ];
6
+ export const WORKSPACE_ZONE_KINDS = [
7
+ "directory",
8
+ "file",
9
+ "runtime",
10
+ ];
11
+ export const WORKSPACE_CONTRACT_FAMILY_METADATA = {
12
+ "workspace-file-evidence": {
13
+ order: 0,
14
+ bundledSkill: "compile/stages/summarize",
15
+ },
16
+ "workspace-knowledge-structure": {
17
+ order: 1,
18
+ bundledSkill: "compile/stages/structure",
19
+ },
20
+ "workspace-query-shape": {
21
+ order: 2,
22
+ bundledSkill: "compile/stages/shape",
23
+ },
24
+ };
25
+ export const BUILTIN_WORKSPACE_STAGE_IDS = {
26
+ SUMMARIZE: "summarize",
27
+ STRUCTURE: "structure",
28
+ SHAPE: "shape",
29
+ };
30
+ export const BUILTIN_WORKSPACE_ZONE_IDS = {
31
+ RAW: "raw",
32
+ SUMMARIES: "summaries",
33
+ KNOWLEDGE_ENTITIES: "knowledge-entities",
34
+ KNOWLEDGE_CLAIMS: "knowledge-claims",
35
+ KNOWLEDGE_INDEXES: "knowledge-indexes",
36
+ HOME: "home",
37
+ RUNTIME: "runtime",
38
+ };
39
+ export const BUILTIN_WORKSPACE_ZONE_SPECS = [
40
+ {
41
+ id: BUILTIN_WORKSPACE_ZONE_IDS.RAW,
42
+ path: "raw",
43
+ kind: "directory",
44
+ required: true,
45
+ description: "Workspace-local raw snapshot copied from the dataset for direct evidence and verification.",
46
+ },
47
+ {
48
+ id: BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
49
+ path: "summaries",
50
+ kind: "directory",
51
+ required: true,
52
+ description: "Per-file evidence notes produced by file-evidence stages.",
53
+ },
54
+ {
55
+ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
56
+ path: "knowledge/entities",
57
+ kind: "directory",
58
+ required: true,
59
+ description: "Canonical entity notes produced by knowledge-structure stages.",
60
+ },
61
+ {
62
+ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
63
+ path: "knowledge/claims",
64
+ kind: "directory",
65
+ required: true,
66
+ description: "Claim notes produced by knowledge-structure stages.",
67
+ },
68
+ {
69
+ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
70
+ path: "knowledge/indexes",
71
+ kind: "directory",
72
+ required: true,
73
+ description: "Retrieval indexes and navigation notes produced by structure and shape stages.",
74
+ },
75
+ {
76
+ id: BUILTIN_WORKSPACE_ZONE_IDS.HOME,
77
+ path: "home.md",
78
+ kind: "file",
79
+ required: true,
80
+ description: "Primary entrypoint note for agents using the compiled workspace.",
81
+ },
82
+ {
83
+ id: BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
84
+ path: ".interf/runtime",
85
+ kind: "runtime",
86
+ required: true,
87
+ description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
88
+ },
89
+ ];
90
+ export const BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS = [
91
+ {
92
+ id: BUILTIN_WORKSPACE_STAGE_IDS.SUMMARIZE,
93
+ label: "Summarize",
94
+ description: "Turn source files into per-file summaries.",
95
+ contractType: "workspace-file-evidence",
96
+ skillDir: "summarize",
97
+ reads: [
98
+ BUILTIN_WORKSPACE_ZONE_IDS.RAW,
99
+ BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
100
+ ],
101
+ writes: [
102
+ BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
103
+ ],
104
+ },
105
+ {
106
+ id: BUILTIN_WORKSPACE_STAGE_IDS.STRUCTURE,
107
+ label: "Structure",
108
+ description: "Build the cross-file knowledge structure from the summaries.",
109
+ contractType: "workspace-knowledge-structure",
110
+ skillDir: "structure",
111
+ reads: [
112
+ BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
113
+ BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
114
+ ],
115
+ writes: [
116
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
117
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
118
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
119
+ ],
120
+ },
121
+ {
122
+ id: BUILTIN_WORKSPACE_STAGE_IDS.SHAPE,
123
+ label: "Shape",
124
+ description: "Shape the final workspace around the saved focus and truth checks.",
125
+ contractType: "workspace-query-shape",
126
+ skillDir: "shape",
127
+ reads: [
128
+ BUILTIN_WORKSPACE_ZONE_IDS.RAW,
129
+ BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
130
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
131
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
132
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
133
+ BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
134
+ ],
135
+ writes: [
136
+ BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
137
+ BUILTIN_WORKSPACE_ZONE_IDS.HOME,
138
+ ],
139
+ },
140
+ ];
141
+ export function workspaceContractOrder(contractType) {
142
+ return WORKSPACE_CONTRACT_FAMILY_METADATA[contractType].order;
143
+ }
144
+ export function workspaceBundledSkillForContractType(contractType) {
145
+ return WORKSPACE_CONTRACT_FAMILY_METADATA[contractType].bundledSkill;
146
+ }
147
+ export function hasValidWorkspaceContractSequence(contractTypes) {
148
+ return contractTypes.every((contractType, index) => index === 0 ||
149
+ workspaceContractOrder(contractType) >= workspaceContractOrder(contractTypes[index - 1]));
150
+ }
151
+ export function listMissingWorkspaceContractTypes(contractTypes) {
152
+ return WORKSPACE_CONTRACT_TYPES.filter((contractType) => !contractTypes.includes(contractType));
153
+ }
154
+ export function validateWorkspaceContractSequence(contractTypes) {
155
+ const missing = listMissingWorkspaceContractTypes(contractTypes);
156
+ const orderValid = hasValidWorkspaceContractSequence(contractTypes);
157
+ return {
158
+ ok: missing.length === 0 && orderValid,
159
+ orderValid,
160
+ missing,
161
+ };
162
+ }
163
+ export function listBuiltinWorkspaceZoneSpecs() {
164
+ return BUILTIN_WORKSPACE_ZONE_SPECS.map((zone) => ({ ...zone }));
165
+ }
166
+ export function listBuiltinWorkspaceFallbackStages() {
167
+ return BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS.map((stage) => ({
168
+ id: stage.id,
169
+ contract_type: stage.contractType,
170
+ reads: [...stage.reads],
171
+ writes: [...stage.writes],
172
+ }));
173
+ }
174
+ export function requiredWorkspaceZoneOwners(stages, zoneId) {
175
+ const writerContractTypes = new Set(BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS
176
+ .filter((stage) => stage.writes.includes(zoneId))
177
+ .map((stage) => stage.contractType));
178
+ return Array.from(new Set(stages
179
+ .filter((stage) => writerContractTypes.has(stage.contractType))
180
+ .map((stage) => stage.id)));
181
+ }
@@ -1,6 +1,7 @@
1
1
  import type { RuntimeContractType, RuntimeStageAcceptance, WorkflowCompilerApi, WorkflowId, WorkflowZoneId } from "./schema.js";
2
- import { type StarterDoc } from "./workflow-starter-docs.js";
3
- export interface WorkflowStarterDoc extends StarterDoc {
2
+ export interface WorkflowStarterDoc {
3
+ relativePath: string;
4
+ content: string;
4
5
  }
5
6
  export interface WorkflowStageDefinition {
6
7
  id: string;
@@ -24,12 +25,29 @@ export interface WorkflowDefinition<TId extends string> {
24
25
  scope?: "builtin" | "local";
25
26
  }
26
27
  export type WorkspaceWorkflowId = string;
27
- export declare const WORKSPACE_WORKFLOWS: WorkflowDefinition<"interf">[];
28
+ export declare function standaloneWorkflowDefinitionFromLocalPackage(local: {
29
+ id: string;
30
+ compiler_api?: WorkflowCompilerApi;
31
+ label: string;
32
+ hint: string;
33
+ stages?: Array<{
34
+ id: string;
35
+ label: string;
36
+ description?: string;
37
+ contract_type: RuntimeContractType;
38
+ skill_dir?: string;
39
+ reads: WorkflowZoneId[];
40
+ writes: WorkflowZoneId[];
41
+ acceptance?: RuntimeStageAcceptance;
42
+ }>;
43
+ stage_policy_notes?: Record<string, string[]>;
44
+ starter_docs: WorkflowStarterDoc[];
45
+ }): WorkflowDefinition<string>;
28
46
  export declare function listWorkspaceWorkflowChoices(sourcePath?: string): WorkflowDefinition<string>[];
29
47
  export declare function getWorkspaceWorkflow(workflowId: WorkspaceWorkflowId, options?: {
30
48
  sourcePath?: string;
31
- visited?: Set<string>;
32
49
  }): WorkflowDefinition<string>;
50
+ export declare function getActiveWorkspaceWorkflow(workspacePath: string, fallbackWorkflowId: WorkspaceWorkflowId): WorkflowDefinition<string>;
33
51
  export declare function resolveWorkspaceWorkflowId(value: unknown): WorkspaceWorkflowId;
34
52
  export declare function resolveWorkspaceWorkflowFromConfig(config: unknown): WorkspaceWorkflowId;
35
53
  export declare function formatWorkspaceWorkflowStageStep(workflowId: WorkspaceWorkflowId, stage: string, options?: {
@@ -42,5 +60,8 @@ export declare function getWorkflowStagePosition(workflowId: WorkflowId, stage:
42
60
  stages: string[];
43
61
  } | null;
44
62
  export declare function getWorkflowStages(workflowId: WorkflowId, sourcePath?: string): string[];
63
+ export declare function getActiveWorkspaceStages(workspacePath: string, fallbackWorkflowId: WorkflowId): string[];
45
64
  export declare function getWorkflowStagePolicyNotes(workflowId: WorkflowId, stage: string, sourcePath?: string): string[];
46
- //# sourceMappingURL=workflow-definitions.d.ts.map
65
+ export declare function getActiveWorkspaceStagePolicyNotes(workspacePath: string, fallbackWorkflowId: WorkflowId, stage: string): string[];
66
+ export declare function resolveActiveWorkspaceStageAcceptance(workspacePath: string, fallbackWorkflowId: WorkflowId, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
67
+ export declare function formatActiveWorkspaceWorkflowStageStep(workspacePath: string, fallbackWorkflowId: WorkspaceWorkflowId, stage: string): string;