@interf/compiler 0.3.3 → 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 +137 -243
  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 +16 -12
  20. package/dist/commands/default.d.ts +0 -1
  21. package/dist/commands/default.js +1 -2
  22. package/dist/commands/doctor.d.ts +0 -1
  23. package/dist/commands/doctor.js +7 -22
  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 +72 -15
  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 +527 -63
  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 +17 -16
  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,12 +1,14 @@
1
- import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, } from "node:fs";
1
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync, } from "node:fs";
2
2
  import { dirname, join, relative } from "node:path";
3
3
  import { z } from "zod";
4
+ import { PACKAGE_ROOT } from "./config.js";
4
5
  import { isMarkdownFile } from "./util.js";
5
6
  import { listFilesRecursive } from "./filesystem.js";
6
7
  import { warnInterf } from "./logger.js";
7
8
  import { readJsonFileUnchecked, readJsonFileWithSchema } from "./parse.js";
9
+ import { listBuiltinWorkspaceZoneSpecs, validateWorkspaceContractSequence, } from "./workflow-abi.js";
8
10
  import { WorkflowCompilerApiSchema, RuntimeContractTypeSchema, RuntimeStageAcceptanceSchema, WorkflowStageZoneAccessSchema, WorkflowWorkspaceSchemaSchema, WorkflowIdPattern, } from "./schema.js";
9
- import { BUILTIN_WORKSPACE_ZONE_IDS, writeWorkspaceSchemaFile, workspaceSchemaFilePath, } from "./workspace-schema.js";
11
+ import { writeWorkspaceSchemaFile, workspaceSchemaFilePath } from "./workspace-schema.js";
10
12
  const LocalWorkflowStageDefinitionSchema = z.object({
11
13
  id: z.string().regex(WorkflowIdPattern),
12
14
  label: z.string().min(1),
@@ -27,24 +29,31 @@ const LocalWorkflowDefinitionSchema = z.object({
27
29
  stages: z.array(LocalWorkflowStageDefinitionSchema).min(1).optional(),
28
30
  stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
29
31
  }).superRefine((value, ctx) => {
30
- const allowed = new Set([
31
- "workspace-file-evidence",
32
- "workspace-knowledge-structure",
33
- "workspace-query-shape",
34
- ]);
35
- for (const [index, stage] of (value.stages ?? []).entries()) {
36
- if (!allowed.has(stage.contract_type)) {
37
- ctx.addIssue({
38
- code: z.ZodIssueCode.custom,
39
- path: ["stages", index, "contract_type"],
40
- message: `contract_type "${stage.contract_type}" is not valid for workspace workflows`,
41
- });
42
- }
32
+ const stages = value.stages ?? [];
33
+ if (stages.length === 0)
34
+ return;
35
+ const sequence = validateWorkspaceContractSequence(stages.map((stage) => stage.contract_type));
36
+ if (!sequence.orderValid) {
37
+ ctx.addIssue({
38
+ code: z.ZodIssueCode.custom,
39
+ path: ["stages"],
40
+ message: "Workspace workflow stages must keep non-decreasing order: file-evidence -> knowledge-structure -> query-shape.",
41
+ });
42
+ }
43
+ for (const missing of sequence.missing) {
44
+ ctx.addIssue({
45
+ code: z.ZodIssueCode.custom,
46
+ path: ["stages"],
47
+ message: `Workspace workflows must include at least one ${missing} stage.`,
48
+ });
43
49
  }
44
50
  });
45
51
  function workflowRootPath(sourcePath) {
46
52
  return join(sourcePath, "interf", "workflows");
47
53
  }
54
+ function builtinWorkflowRootPath(workflowId) {
55
+ return join(PACKAGE_ROOT, "builtin-workflows", workflowId);
56
+ }
48
57
  export function workflowDefinitionPath(sourcePath, id) {
49
58
  return join(workflowRootPath(sourcePath), id);
50
59
  }
@@ -104,9 +113,162 @@ export function listLocalWorkflowDefinitions(sourcePath) {
104
113
  export function loadLocalWorkflowDefinition(sourcePath, id) {
105
114
  return loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id));
106
115
  }
116
+ export function resolveWorkflowPackageSourcePath(sourcePath, workflowId) {
117
+ const builtinPath = builtinWorkflowRootPath(workflowId);
118
+ if (workflowId === "interf" && existsSync(join(builtinPath, "workflow.json")))
119
+ return builtinPath;
120
+ const localPath = workflowDefinitionPath(sourcePath, workflowId);
121
+ if (existsSync(join(localPath, "workflow.json")))
122
+ return localPath;
123
+ if (existsSync(join(builtinPath, "workflow.json")))
124
+ return builtinPath;
125
+ return null;
126
+ }
107
127
  export function isWorkflowId(value) {
108
128
  return WorkflowIdPattern.test(value);
109
129
  }
130
+ function normalizeStagePolicyNotes(value) {
131
+ if (!value || typeof value !== "object" || Array.isArray(value))
132
+ return undefined;
133
+ const normalized = {};
134
+ for (const [stageId, notes] of Object.entries(value)) {
135
+ if (!Array.isArray(notes))
136
+ continue;
137
+ const cleaned = Array.from(new Set(notes
138
+ .filter((note) => typeof note === "string")
139
+ .map((note) => note.trim())
140
+ .filter((note) => note.length > 0)));
141
+ if (cleaned.length > 0) {
142
+ normalized[stageId] = cleaned;
143
+ }
144
+ }
145
+ return Object.keys(normalized).length > 0 ? normalized : undefined;
146
+ }
147
+ function mergeStagePolicyNotes(currentValue, nextValue) {
148
+ const current = normalizeStagePolicyNotes(currentValue);
149
+ if (!nextValue || Object.keys(nextValue).length === 0)
150
+ return current;
151
+ const merged = { ...(current ?? {}) };
152
+ for (const [stageId, notes] of Object.entries(nextValue)) {
153
+ merged[stageId] = Array.from(new Set([
154
+ ...(merged[stageId] ?? []),
155
+ ...notes.map((note) => note.trim()).filter((note) => note.length > 0),
156
+ ]));
157
+ }
158
+ return Object.keys(merged).length > 0 ? merged : undefined;
159
+ }
160
+ function readWorkflowJsonObject(dirPath) {
161
+ const workflowPath = join(dirPath, "workflow.json");
162
+ const raw = readJsonFileUnchecked(workflowPath, "workflow package");
163
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
164
+ throw new Error(`Workflow package at ${dirPath} is missing a valid workflow.json.`);
165
+ }
166
+ return { ...raw };
167
+ }
168
+ export function patchWorkflowPackageMetadata(dirPath, options = {}) {
169
+ const workflowPath = join(dirPath, "workflow.json");
170
+ const schemaPath = workspaceSchemaFilePath(dirPath);
171
+ const workflowJson = readWorkflowJsonObject(dirPath);
172
+ const normalizedStages = Array.isArray(workflowJson.stages) && workflowJson.stages.length > 0
173
+ ? workflowJson.stages
174
+ : null;
175
+ if (!normalizedStages) {
176
+ throw new Error(`Cannot patch workflow package at ${dirPath}: workflow.json must declare explicit stages before it can be copied or rewritten.`);
177
+ }
178
+ const nextWorkflowJson = {
179
+ ...workflowJson,
180
+ type: "workspace",
181
+ compiler_api: workflowJson.compiler_api ?? {
182
+ kind: "workspace",
183
+ version: 1,
184
+ },
185
+ stages: normalizedStages,
186
+ ...(options.id ? { id: options.id } : {}),
187
+ ...(options.label ? { label: options.label } : {}),
188
+ ...(options.hint ? { hint: options.hint } : {}),
189
+ };
190
+ delete nextWorkflowJson.extends;
191
+ const mergedStagePolicyNotes = mergeStagePolicyNotes(workflowJson.stage_policy_notes, options.stagePolicyNotes);
192
+ if (mergedStagePolicyNotes) {
193
+ nextWorkflowJson.stage_policy_notes = mergedStagePolicyNotes;
194
+ }
195
+ else {
196
+ delete nextWorkflowJson.stage_policy_notes;
197
+ }
198
+ writeFileSync(workflowPath, JSON.stringify(nextWorkflowJson, null, 2) + "\n");
199
+ const schemaLabel = `${String(nextWorkflowJson.label ?? workflowJson.label ?? options.id ?? "Workflow")} workspace schema`;
200
+ if (!existsSync(schemaPath)) {
201
+ writeWorkspaceSchemaFile(dirPath, normalizedStages, schemaLabel);
202
+ return;
203
+ }
204
+ const rawSchema = readJsonFileUnchecked(schemaPath, "workspace schema");
205
+ if (!rawSchema || typeof rawSchema !== "object" || Array.isArray(rawSchema))
206
+ return;
207
+ writeFileSync(schemaPath, JSON.stringify({
208
+ ...rawSchema,
209
+ label: schemaLabel,
210
+ }, null, 2) + "\n");
211
+ }
212
+ export function describeWorkflowPackagePortability(dirPath) {
213
+ const issues = [];
214
+ const workflowPath = join(dirPath, "workflow.json");
215
+ const schemaPath = workspaceSchemaFilePath(dirPath);
216
+ if (!existsSync(workflowPath))
217
+ issues.push("missing workflow.json");
218
+ if (!existsSync(schemaPath))
219
+ issues.push("missing workspace.schema.json");
220
+ if (!existsSync(join(dirPath, "README.md")))
221
+ issues.push("missing README.md");
222
+ if (!existsSync(join(dirPath, "improve", "SKILL.md")))
223
+ issues.push("missing improve/SKILL.md");
224
+ if (!existsSync(join(dirPath, "use", "query", "SKILL.md")))
225
+ issues.push("missing use/query/SKILL.md");
226
+ if (issues.length > 0)
227
+ return issues;
228
+ let workflowJson;
229
+ try {
230
+ workflowJson = readWorkflowJsonObject(dirPath);
231
+ }
232
+ catch (error) {
233
+ issues.push(error instanceof Error ? error.message : String(error));
234
+ return issues;
235
+ }
236
+ const parsed = LocalWorkflowDefinitionSchema.safeParse(workflowJson);
237
+ if (!parsed.success) {
238
+ issues.push(...parsed.error.issues.map((issue) => issue.path.length > 0
239
+ ? `workflow.json ${issue.path.join(".")}: ${issue.message}`
240
+ : `workflow.json: ${issue.message}`));
241
+ return issues;
242
+ }
243
+ if (typeof parsed.data.extends === "string" && parsed.data.extends.trim().length > 0) {
244
+ issues.push("workflow.json uses legacy extends; portable workflow packages must be materialized standalone");
245
+ }
246
+ if (!parsed.data.stages || parsed.data.stages.length === 0) {
247
+ issues.push("workflow.json must declare explicit stages for a portable workflow package");
248
+ return issues;
249
+ }
250
+ for (const stage of parsed.data.stages) {
251
+ const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
252
+ ? stage.skill_dir
253
+ : stage.id;
254
+ if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
255
+ issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
256
+ }
257
+ }
258
+ return issues;
259
+ }
260
+ export function isPortableWorkflowPackage(dirPath) {
261
+ return describeWorkflowPackagePortability(dirPath).length === 0;
262
+ }
263
+ export function copyWorkflowPackageDirectory(sourceWorkflowPath, targetWorkflowPath) {
264
+ const portabilityIssues = describeWorkflowPackagePortability(sourceWorkflowPath);
265
+ if (portabilityIssues.length > 0) {
266
+ throw new Error(`Workflow package at ${sourceWorkflowPath} is not directly copyable: ${portabilityIssues.join("; ")}.`);
267
+ }
268
+ rmSync(targetWorkflowPath, { recursive: true, force: true });
269
+ mkdirSync(dirname(targetWorkflowPath), { recursive: true });
270
+ cpSync(sourceWorkflowPath, targetWorkflowPath, { recursive: true });
271
+ }
110
272
  export function validateWorkflowPackage(dirPath) {
111
273
  const workflowPath = join(dirPath, "workflow.json");
112
274
  const schemaPath = workspaceSchemaFilePath(dirPath);
@@ -139,70 +301,53 @@ export function validateWorkflowPackage(dirPath) {
139
301
  }
140
302
  const def = parsed.data;
141
303
  const errors = [];
304
+ if (typeof def.extends === "string" && def.extends.trim().length > 0) {
305
+ errors.push("workflow.json uses legacy extends. Portable workflow packages must be materialized as standalone packages.");
306
+ }
307
+ if (!def.stages || def.stages.length === 0) {
308
+ errors.push("workflow.json must declare explicit stages. Legacy inherited packages are not portable.");
309
+ }
142
310
  if (!existsSync(schemaPath)) {
143
311
  errors.push("Missing workspace.schema.json.");
144
312
  }
313
+ if (!existsSync(join(dirPath, "README.md"))) {
314
+ errors.push("Missing README.md.");
315
+ }
316
+ if (!existsSync(join(dirPath, "improve", "SKILL.md"))) {
317
+ errors.push("Missing improve/SKILL.md.");
318
+ }
319
+ if (!existsSync(join(dirPath, "use", "query", "SKILL.md"))) {
320
+ errors.push("Missing use/query/SKILL.md.");
321
+ }
145
322
  const workspaceSchema = readJsonFileWithSchema(schemaPath, "workspace schema", WorkflowWorkspaceSchemaSchema);
146
323
  if (!workspaceSchema) {
147
324
  errors.push("workspace.schema.json is missing or invalid.");
148
325
  }
149
326
  if (def.stages && def.stages.length > 0) {
150
- const order = new Map([
151
- ["workspace-file-evidence", 0],
152
- ["workspace-knowledge-structure", 1],
153
- ["workspace-query-shape", 2],
154
- ]);
155
327
  const contractTypes = def.stages.map((stage) => stage.contract_type);
328
+ const sequence = validateWorkspaceContractSequence(contractTypes);
156
329
  if (def.stages.length < 3) {
157
330
  errors.push("Workspace workflows must include summarize, structure, and shape stages in order.");
158
331
  }
159
- else if (!contractTypes.every((contractType, index) => index === 0 || (order.get(contractType) ?? -1) >= (order.get(contractTypes[index - 1]) ?? -1))) {
332
+ else if (!sequence.orderValid) {
160
333
  errors.push("Workspace workflow stages must keep non-decreasing order: file-evidence -> knowledge-structure -> query-shape.");
161
334
  }
162
335
  else {
163
- if (!contractTypes.includes("workspace-file-evidence")) {
164
- errors.push("Workspace workflows must include at least one workspace-file-evidence stage.");
336
+ for (const missing of sequence.missing) {
337
+ errors.push(`Workspace workflows must include at least one ${missing} stage.`);
165
338
  }
166
- if (!contractTypes.includes("workspace-knowledge-structure")) {
167
- errors.push("Workspace workflows must include at least one workspace-knowledge-structure stage.");
168
- }
169
- if (!contractTypes.includes("workspace-query-shape")) {
170
- errors.push("Workspace workflows must include at least one workspace-query-shape stage.");
339
+ }
340
+ for (const stage of def.stages) {
341
+ const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
342
+ ? stage.skill_dir
343
+ : stage.id;
344
+ if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
345
+ errors.push(`Missing compile/stages/${skillDir}/SKILL.md.`);
171
346
  }
172
347
  }
173
348
  }
174
349
  if (workspaceSchema) {
175
- const fallbackStages = [
176
- {
177
- id: "summarize",
178
- reads: [BUILTIN_WORKSPACE_ZONE_IDS.RAW, BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME],
179
- writes: [BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES],
180
- },
181
- {
182
- id: "structure",
183
- reads: [BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES, BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME],
184
- writes: [
185
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
186
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
187
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
188
- ],
189
- },
190
- {
191
- id: "shape",
192
- reads: [
193
- BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
194
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
195
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
196
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
197
- BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
198
- ],
199
- writes: [
200
- BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
201
- BUILTIN_WORKSPACE_ZONE_IDS.HOME,
202
- ],
203
- },
204
- ];
205
- const stages = def.stages ?? fallbackStages;
350
+ const stages = def.stages ?? [];
206
351
  const stageIds = new Set(stages.map((stage) => stage.id));
207
352
  const seenPaths = new Map();
208
353
  const seenZoneIds = new Set();
@@ -255,16 +400,7 @@ export function validateWorkflowPackage(dirPath) {
255
400
  }
256
401
  }
257
402
  }
258
- const requiredZones = [
259
- { id: BUILTIN_WORKSPACE_ZONE_IDS.RAW, path: "raw", kind: "directory" },
260
- { id: BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES, path: "summaries", kind: "directory" },
261
- { id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES, path: "knowledge/entities", kind: "directory" },
262
- { id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS, path: "knowledge/claims", kind: "directory" },
263
- { id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES, path: "knowledge/indexes", kind: "directory" },
264
- { id: BUILTIN_WORKSPACE_ZONE_IDS.HOME, path: "home.md", kind: "file" },
265
- { id: BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME, path: ".interf", kind: "runtime" },
266
- ];
267
- for (const requiredZone of requiredZones) {
403
+ for (const requiredZone of listBuiltinWorkspaceZoneSpecs()) {
268
404
  const match = zoneById.get(requiredZone.id);
269
405
  if (!match) {
270
406
  errors.push(`workspace.schema.json is missing required zone "${requiredZone.id}".`);
@@ -278,7 +414,9 @@ export function validateWorkflowPackage(dirPath) {
278
414
  }
279
415
  }
280
416
  }
281
- const stageDirs = listFilesRecursive(join(dirPath, "compile", "stages"), (filePath) => basename(filePath) === "SKILL.md");
417
+ const stageDirs = existsSync(join(dirPath, "compile", "stages"))
418
+ ? listFilesRecursive(join(dirPath, "compile", "stages"), (filePath) => basename(filePath) === "SKILL.md")
419
+ : [];
282
420
  const counts = {
283
421
  starter_docs: collectStarterDocs(dirPath).length,
284
422
  compile_stage_docs: stageDirs.length,
@@ -291,33 +429,6 @@ export function validateWorkflowPackage(dirPath) {
291
429
  counts,
292
430
  };
293
431
  }
294
- export function writeLocalWorkflowDefinition(sourcePath, id, workflowJson, docs) {
295
- const root = workflowDefinitionPath(sourcePath, id);
296
- mkdirSync(root, { recursive: true });
297
- const normalizedWorkflowJson = {
298
- compiler_api: {
299
- kind: "workspace",
300
- version: 1,
301
- },
302
- ...workflowJson,
303
- };
304
- writeFileSync(join(root, "workflow.json"), JSON.stringify(normalizedWorkflowJson, null, 2) + "\n");
305
- const stages = Array.isArray(normalizedWorkflowJson.stages)
306
- ? (normalizedWorkflowJson.stages)
307
- : [
308
- { id: "summarize", contract_type: "workspace-file-evidence" },
309
- { id: "structure", contract_type: "workspace-knowledge-structure" },
310
- { id: "shape", contract_type: "workspace-query-shape" },
311
- ];
312
- writeWorkspaceSchemaFile(root, stages, `${String(normalizedWorkflowJson.label ?? id)} workspace schema`);
313
- for (const doc of docs) {
314
- const targetPath = join(root, doc.relativePath);
315
- mkdirSync(dirname(targetPath), { recursive: true });
316
- writeFileSync(targetPath, doc.content);
317
- }
318
- return root;
319
- }
320
432
  function basename(filePath) {
321
433
  return filePath.split(/[\\/]/).pop() ?? filePath;
322
434
  }
323
- //# sourceMappingURL=local-workflows.js.map
@@ -1,4 +1,3 @@
1
1
  export type InterfWarningHandler = (message: string) => void;
2
2
  export declare function setInterfWarningHandler(handler?: InterfWarningHandler): void;
3
3
  export declare function warnInterf(message: string): void;
4
- //# sourceMappingURL=logger.d.ts.map
@@ -8,4 +8,3 @@ export function setInterfWarningHandler(handler) {
8
8
  export function warnInterf(message) {
9
9
  currentWarningHandler(message);
10
10
  }
11
- //# sourceMappingURL=logger.js.map
@@ -1,2 +1 @@
1
1
  export declare function writeObsidianDefaults(dirPath: string, type: "workspace"): void;
2
- //# sourceMappingURL=obsidian.d.ts.map
@@ -13,4 +13,3 @@ export function writeObsidianDefaults(dirPath, type) {
13
13
  };
14
14
  writeFileSync(join(obsidianDir, "graph.json"), JSON.stringify(graphSettings, null, 2) + "\n");
15
15
  }
16
- //# sourceMappingURL=obsidian.js.map
@@ -6,4 +6,3 @@ export declare function parseJsonFrontmatter(content: string): {
6
6
  frontmatter: Record<string, unknown>;
7
7
  body: string;
8
8
  } | null;
9
- //# sourceMappingURL=parse.d.ts.map
package/dist/lib/parse.js CHANGED
@@ -52,4 +52,3 @@ export function parseJsonFrontmatter(content) {
52
52
  return null;
53
53
  }
54
54
  }
55
- //# sourceMappingURL=parse.js.map
@@ -14,4 +14,3 @@ export declare function listWorkspaceEntries(registry?: Registry): WorkspaceEntr
14
14
  export declare function addWorkspace(name: string, path: string, workflow: string): void;
15
15
  export declare function findWorkspaceByName(name: string): WorkspaceEntry[];
16
16
  export declare function findInterf(name: string): WorkspaceEntry | undefined;
17
- //# sourceMappingURL=registry.d.ts.map
@@ -63,4 +63,3 @@ export function findInterf(name) {
63
63
  const matches = listWorkspaceEntries().filter((workspace) => workspace.name === name);
64
64
  return matches.length === 1 ? matches[0] : undefined;
65
65
  }
66
- //# sourceMappingURL=registry.js.map
@@ -1,4 +1,3 @@
1
1
  import { type RuntimeStageContract } from "./schema.js";
2
2
  import { type RuntimeStageAcceptanceValidation } from "./runtime-types.js";
3
3
  export declare function validateStageContractAcceptance(dirPath: string, contract?: RuntimeStageContract | null): RuntimeStageAcceptanceValidation;
4
- //# sourceMappingURL=runtime-acceptance.d.ts.map
@@ -68,7 +68,7 @@ export function validateStageContractAcceptance(dirPath, contract = null) {
68
68
  };
69
69
  }
70
70
  const failures = [];
71
- const state = readWorkspaceJsonFile(dirPath, ".interf/state.json");
71
+ const state = readWorkspaceJsonFile(dirPath, ".interf/runtime/state.json");
72
72
  for (const relativePath of acceptance?.artifacts_exist ?? []) {
73
73
  if (!existsSync(join(dirPath, relativePath))) {
74
74
  failures.push(`Missing required artifact: ${relativePath}.`);
@@ -120,4 +120,3 @@ export function validateStageContractAcceptance(dirPath, contract = null) {
120
120
  failures,
121
121
  };
122
122
  }
123
- //# sourceMappingURL=runtime-acceptance.js.map
@@ -2,4 +2,3 @@ import { type RuntimeStageContractDraft, type WorkspaceKnowledgeContractOptions,
2
2
  export declare function buildWorkspaceSummarizeContract(options: WorkspaceSummarizeContractOptions): RuntimeStageContractDraft;
3
3
  export declare function buildWorkspaceStructureContract(options: WorkspaceKnowledgeContractOptions): RuntimeStageContractDraft;
4
4
  export declare function buildWorkspaceShapeContract(options: WorkspaceShapeContractOptions): RuntimeStageContractDraft;
5
- //# sourceMappingURL=runtime-contracts.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { CHART_APPROXIMATION_NOTES } from "./chart-guidance.js";
1
2
  export function buildWorkspaceSummarizeContract(options) {
2
3
  const localSkillDocs = options.localSkillDocs ?? [];
3
4
  const workflowNotes = options.workflowNotes ?? [];
@@ -14,12 +15,12 @@ export function buildWorkspaceSummarizeContract(options) {
14
15
  "interf.json",
15
16
  options.planPath,
16
17
  "workflow/workspace.schema.json",
17
- ".interf/raw-snapshot.json",
18
+ ".interf/runtime/raw-snapshot.json",
18
19
  ...localSkillDocs,
19
20
  ],
20
21
  writes: [
21
22
  "summaries/",
22
- ".interf/inventory.json",
23
+ ".interf/runtime/inventory.json",
23
24
  ],
24
25
  verifies: [
25
26
  "interf verify summarize --json",
@@ -39,10 +40,10 @@ export function buildWorkspaceSummarizeContract(options) {
39
40
  "Also include a `## Abstract` section or another clearly labeled abstract block so humans can scan the summary quickly.",
40
41
  "Use cautious, source-grounded titles. Summary filenames should describe what the file is or records without overstating uncertain conclusions.",
41
42
  "If links are added, keep them minimal and source-grounded.",
42
- "Do not precreate `.interf/inventory.json` with placeholder writes. Write the final JSON document directly.",
43
- "When updating `.interf/inventory.json`, rewrite the full JSON document in one whole-file write instead of patching partial lines.",
44
- "The CLI reconciles `.interf/state.json` and refreshes `.interf/health.json` after stage validation. Do not treat those files as stage-owned write targets for this stage.",
45
- "Prefer the current inventory runtime shape: `.interf/inventory.json` should use `entries` plus `total`, with one object per source file containing at least `source`, `summary`, and a conservative status/state field.",
43
+ "Do not precreate `.interf/runtime/inventory.json` with placeholder writes. Write the final JSON document directly.",
44
+ "When updating `.interf/runtime/inventory.json`, rewrite the full JSON document in one whole-file write instead of patching partial lines.",
45
+ "The CLI reconciles `.interf/runtime/state.json` and refreshes `.interf/runtime/health.json` after stage validation. Do not treat those files as stage-owned write targets for this stage.",
46
+ "Prefer the current inventory runtime shape: `.interf/runtime/inventory.json` should use `entries` plus `total`, with one object per source file containing at least `source`, `summary`, and a conservative status/state field.",
46
47
  "Keep scratch extraction commands single-purpose and non-destructive. Do not use `rm`, wildcard cleanup, `;`, or `&&` chains during summarize.",
47
48
  "Use `workflow/workspace.schema.json` as the deterministic output-shape reference for this workspace.",
48
49
  "The workspace includes its own `raw/` snapshot. Read source files there when summary evidence depends on direct inspection.",
@@ -78,7 +79,7 @@ export function buildWorkspaceStructureContract(options) {
78
79
  "interf.json",
79
80
  "workflow/workspace.schema.json",
80
81
  "summaries/",
81
- ".interf/inventory.json",
82
+ ".interf/runtime/inventory.json",
82
83
  ...localSkillDocs,
83
84
  ],
84
85
  writes: [
@@ -137,6 +138,7 @@ export function buildWorkspaceShapeContract(options) {
137
138
  "interf.json",
138
139
  "workflow/workspace.schema.json",
139
140
  options.shapeInputPath,
141
+ "raw/",
140
142
  "knowledge/entities/",
141
143
  "knowledge/claims/",
142
144
  "knowledge/indexes/",
@@ -158,7 +160,12 @@ export function buildWorkspaceShapeContract(options) {
158
160
  `Use ${options.shapeInputPath} as the shaping input for this workspace.`,
159
161
  "The shaping input provides the workspace focus plus saved truth-check question text only. It does not provide expected answers.",
160
162
  "Use the focus and saved truth checks to bias routing, navigation, priority notes, and the final workspace home.",
163
+ "Replace any scaffold or placeholder content in `home.md`. The final home note must not keep the initial `Not yet compiled.` message.",
161
164
  "Do not copy expected answers into the workspace or treat the checks as license to hallucinate missing evidence.",
165
+ "When a focused question depends on chart-derived or table-derived evidence, prefer the saved summaries and structured notes if they already preserve the needed bounded reads plus provenance.",
166
+ "Use `raw/` during shaping only when the compiled layer is missing the needed value, the metric family is ambiguous, or the earlier bounded read is clearly inconsistent.",
167
+ "Carry the final bounded reads forward into focused indexes with clear provenance instead of repeatedly recomputing them from `raw/`.",
168
+ ...CHART_APPROXIMATION_NOTES,
162
169
  "Use `workflow/workspace.schema.json` as the deterministic output-shape reference for this workspace.",
163
170
  "Prefer better retrieval routes, tighter home.md guidance, and focused indexes over speculative synthesis.",
164
171
  ...workflowNotes,
@@ -182,4 +189,3 @@ export function buildWorkspaceShapeContract(options) {
182
189
  },
183
190
  };
184
191
  }
185
- //# sourceMappingURL=runtime-contracts.js.map
@@ -5,4 +5,3 @@ export declare function logsDirPath(dirPath: string): string;
5
5
  export declare function promptLogPath(dirPath: string, runId: string): string;
6
6
  export declare function eventLogPath(dirPath: string, runId: string): string;
7
7
  export declare function statusLogPath(dirPath: string, runId: string): string;
8
- //# sourceMappingURL=runtime-paths.d.ts.map
@@ -1,20 +1,16 @@
1
1
  import { join } from "node:path";
2
- import { STATE_DIR } from "./util.js";
3
- const RUN_FILE = "run.json";
4
- const RUN_HISTORY_FILE = "run-history.jsonl";
5
- const STAGE_CONTRACT_FILE = "stage-contract.json";
6
- const LOGS_DIR = "logs";
2
+ import { workspaceRuntimeLogsRoot, workspaceRuntimeRunHistoryPath, workspaceRuntimeRunPath, workspaceRuntimeStageContractPath, } from "./workspace-paths.js";
7
3
  export function runPath(dirPath) {
8
- return join(dirPath, STATE_DIR, RUN_FILE);
4
+ return workspaceRuntimeRunPath(dirPath);
9
5
  }
10
6
  export function runHistoryPath(dirPath) {
11
- return join(dirPath, STATE_DIR, RUN_HISTORY_FILE);
7
+ return workspaceRuntimeRunHistoryPath(dirPath);
12
8
  }
13
9
  export function stageContractPath(dirPath) {
14
- return join(dirPath, STATE_DIR, STAGE_CONTRACT_FILE);
10
+ return workspaceRuntimeStageContractPath(dirPath);
15
11
  }
16
12
  export function logsDirPath(dirPath) {
17
- return join(dirPath, STATE_DIR, LOGS_DIR);
13
+ return workspaceRuntimeLogsRoot(dirPath);
18
14
  }
19
15
  export function promptLogPath(dirPath, runId) {
20
16
  return join(logsDirPath(dirPath), `${runId}.prompt.txt`);
@@ -25,4 +21,3 @@ export function eventLogPath(dirPath, runId) {
25
21
  export function statusLogPath(dirPath, runId) {
26
22
  return join(logsDirPath(dirPath), `${runId}.status.log`);
27
23
  }
28
- //# sourceMappingURL=runtime-paths.js.map
@@ -1,3 +1,2 @@
1
1
  import { type RuntimeStageInstructions } from "./schema.js";
2
2
  export declare function buildStagePrompt(instructions: RuntimeStageInstructions, contractPath: string, statusLines: string[]): string;
3
- //# sourceMappingURL=runtime-prompt.d.ts.map
@@ -1,11 +1,4 @@
1
- import { existsSync, readFileSync, } from "node:fs";
2
- import { join } from "node:path";
3
- import { SKILLS_DIR } from "./config.js";
4
1
  export function buildStagePrompt(instructions, contractPath, statusLines) {
5
- const bundledSkillPath = join(SKILLS_DIR, ...instructions.bundled_skill.split("/"), "SKILL.md");
6
- const bundledSkillDoc = existsSync(bundledSkillPath)
7
- ? readFileSync(bundledSkillPath, "utf8").trim()
8
- : null;
9
2
  const modeNotes = instructions.effective_mode === "override"
10
3
  ? [
11
4
  "Local stage instruction docs are authoritative for this run.",
@@ -14,30 +7,31 @@ export function buildStagePrompt(instructions, contractPath, statusLines) {
14
7
  ]
15
8
  : instructions.effective_mode === "extend"
16
9
  ? [
17
- "Use the bundled stage instructions as the default workflow for this run.",
18
- "Then apply any local stage instruction docs referenced by the contract as stage-specific extensions.",
10
+ "Use the current workspace workflow docs as the default workflow for this run.",
11
+ "Then apply any additional local stage instruction docs referenced by the contract as stage-specific extensions.",
19
12
  ]
20
13
  : [
21
- "Use the bundled stage instructions as the default workflow for this run.",
14
+ "Use the current workspace workflow docs as the default workflow for this run.",
22
15
  ];
23
16
  return [
24
- `Interf built-in stage: ${instructions.bundled_skill}`,
17
+ `Interf built-in stage id: ${instructions.bundled_skill}`,
25
18
  "",
26
19
  "This is an automated Interf stage run, not an open-ended chat session.",
27
20
  "The user has already invoked this stage through the Interf CLI. Execute it now.",
28
21
  "Do not ask what the user wants, offer help, list tools, or wait for another instruction.",
29
22
  `Read \`${contractPath}\` first. It is the authoritative contract for this stage.`,
30
23
  "If `runtime/paths.json` exists in this shell, read it next. It maps workflow zone ids onto the shell-local `inputs/` and `outputs/` mounts for this stage.",
24
+ "For file-zone mounts, `runtime/paths.json` also gives the exact file path inside the `inputs/` or `outputs/` mount root.",
31
25
  "Honor the contract's counts, artifact paths, and policies instead of inventing another workflow.",
32
26
  "Read only the files named by the contract's `artifacts.reads` list plus any paths they explicitly direct you to open.",
33
27
  "If the contract lists `instructions.local_docs`, open every one of those files before you write artifacts or declare the stage complete.",
34
28
  "If `AGENTS.md` is listed in the contract, use it only for workspace routing that is directly relevant to this stage.",
35
- "`.interf/run.json`, `.interf/state.json`, `.interf/health.json`, and `.interf/view-spec.json` are CLI-owned runtime artifacts. You may read them, but do not create, edit, or replace them unless the contract explicitly marks a different proof artifact as stage-owned.",
29
+ "`.interf/runtime/run.json`, `.interf/runtime/state.json`, `.interf/runtime/health.json`, and `.interf/runtime/view-spec.json` are CLI-owned runtime artifacts. You may read them, but do not create, edit, or replace them unless the contract explicitly marks a different proof artifact as stage-owned.",
36
30
  "If a contract-listed output file does not exist yet, create it in one whole-file write. Do not attempt patch-style edits against a missing runtime path.",
37
31
  "Stay inside the current workspace. Do not try to open SDK repo docs, SDK source files, or other paths outside the workspace unless the stage contract explicitly requires them.",
38
32
  instructions.effective_mode === "override"
39
- ? "Do not depend on globally installed slash-command skills for this run. Local stage instruction docs are the primary workflow layer for this run."
40
- : "Do not depend on globally installed slash-command skills for this run. Use the bundled stage instructions below as the default behavior.",
33
+ ? "Do not depend on any repo-root or globally installed skill cache for this run. Local stage instruction docs are the primary workflow layer for this run."
34
+ : "Do not depend on any repo-root or globally installed skill cache for this run. Use the current workspace workflow docs and the contract as the default behavior.",
41
35
  ...modeNotes,
42
36
  "Do not narrate intentions, plans, or reasoning to the user.",
43
37
  "Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
@@ -47,14 +41,5 @@ export function buildStagePrompt(instructions, contractPath, statusLines) {
47
41
  "If you respond conversationally instead of executing the stage, the run will be treated as failed.",
48
42
  "As soon as the required proof artifacts are complete, stop. Do not keep browsing or auditing after the contract is satisfied.",
49
43
  ...statusLines,
50
- ...(bundledSkillDoc && instructions.effective_mode !== "override"
51
- ? [
52
- "",
53
- "Bundled Stage Instructions",
54
- "==========================",
55
- bundledSkillDoc,
56
- ]
57
- : []),
58
44
  ].join("\n");
59
45
  }
60
- //# sourceMappingURL=runtime-prompt.js.map
@@ -1,4 +1,3 @@
1
1
  export declare function reconcileWorkspaceSummarizeRun(dirPath: string, expectedSummaryTotal: number): boolean;
2
2
  export declare function reconcileWorkspaceStructureRun(dirPath: string): boolean;
3
3
  export declare function reconcileWorkspaceShapeRun(dirPath: string): boolean;
4
- //# sourceMappingURL=runtime-reconcile.d.ts.map