wingfoil 0.2.1 → 0.3.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 (452) hide show
  1. package/README.md +88 -42
  2. package/dist/agent/discovery.d.ts +72 -0
  3. package/dist/agent/discovery.d.ts.map +1 -0
  4. package/dist/agent/discovery.js +210 -0
  5. package/dist/agent/discovery.js.map +1 -0
  6. package/dist/agent/execute.d.ts +206 -0
  7. package/dist/agent/execute.d.ts.map +1 -0
  8. package/dist/agent/execute.js +581 -0
  9. package/dist/agent/execute.js.map +1 -0
  10. package/dist/agent/index.d.ts +23 -0
  11. package/dist/agent/index.d.ts.map +1 -0
  12. package/dist/agent/index.js +85 -0
  13. package/dist/agent/index.js.map +1 -0
  14. package/dist/agent/launch.d.ts +133 -0
  15. package/dist/agent/launch.d.ts.map +1 -0
  16. package/dist/agent/launch.js +380 -0
  17. package/dist/agent/launch.js.map +1 -0
  18. package/dist/agent/manifest.d.ts +30 -0
  19. package/dist/agent/manifest.d.ts.map +1 -0
  20. package/dist/agent/manifest.js +93 -0
  21. package/dist/agent/manifest.js.map +1 -0
  22. package/dist/agent/placeholders.d.ts +49 -0
  23. package/dist/agent/placeholders.d.ts.map +1 -0
  24. package/dist/agent/placeholders.js +177 -0
  25. package/dist/agent/placeholders.js.map +1 -0
  26. package/dist/agent/run-log.d.ts +254 -0
  27. package/dist/agent/run-log.d.ts.map +1 -0
  28. package/dist/agent/run-log.js +612 -0
  29. package/dist/agent/run-log.js.map +1 -0
  30. package/dist/agent/schema.d.ts +100 -0
  31. package/dist/agent/schema.d.ts.map +1 -0
  32. package/dist/agent/schema.js +89 -0
  33. package/dist/agent/schema.js.map +1 -0
  34. package/dist/agent/step.d.ts +41 -0
  35. package/dist/agent/step.d.ts.map +1 -0
  36. package/dist/agent/step.js +95 -0
  37. package/dist/agent/step.js.map +1 -0
  38. package/dist/build-info.json +4 -0
  39. package/dist/cli/error.d.ts +11 -2
  40. package/dist/cli/error.d.ts.map +1 -1
  41. package/dist/cli/error.js +27 -6
  42. package/dist/cli/error.js.map +1 -1
  43. package/dist/cli/exit.d.ts +33 -3
  44. package/dist/cli/exit.d.ts.map +1 -1
  45. package/dist/cli/exit.js +54 -3
  46. package/dist/cli/exit.js.map +1 -1
  47. package/dist/cli/index.d.ts +2 -2
  48. package/dist/cli/index.d.ts.map +1 -1
  49. package/dist/cli/index.js +3 -2
  50. package/dist/cli/index.js.map +1 -1
  51. package/dist/cli/init-command.d.ts.map +1 -1
  52. package/dist/cli/init-command.js +6 -3
  53. package/dist/cli/init-command.js.map +1 -1
  54. package/dist/cli/mcp-command.d.ts +13 -4
  55. package/dist/cli/mcp-command.d.ts.map +1 -1
  56. package/dist/cli/mcp-command.js +25 -8
  57. package/dist/cli/mcp-command.js.map +1 -1
  58. package/dist/cli/output.d.ts +12 -4
  59. package/dist/cli/output.d.ts.map +1 -1
  60. package/dist/cli/output.js +15 -4
  61. package/dist/cli/output.js.map +1 -1
  62. package/dist/cli/program.d.ts +1 -1
  63. package/dist/cli/program.d.ts.map +1 -1
  64. package/dist/cli/program.js +270 -60
  65. package/dist/cli/program.js.map +1 -1
  66. package/dist/cli/registrar.d.ts +16 -7
  67. package/dist/cli/registrar.d.ts.map +1 -1
  68. package/dist/cli/registrar.js +71 -6
  69. package/dist/cli/registrar.js.map +1 -1
  70. package/dist/cli/suggest.d.ts +20 -0
  71. package/dist/cli/suggest.d.ts.map +1 -0
  72. package/dist/cli/suggest.js +49 -0
  73. package/dist/cli/suggest.js.map +1 -0
  74. package/dist/cli/warning.d.ts +26 -0
  75. package/dist/cli/warning.d.ts.map +1 -0
  76. package/dist/cli/warning.js +66 -0
  77. package/dist/cli/warning.js.map +1 -0
  78. package/dist/cli.js +11 -2
  79. package/dist/cli.js.map +1 -1
  80. package/dist/core/agent-execute.d.ts +44 -0
  81. package/dist/core/agent-execute.d.ts.map +1 -0
  82. package/dist/core/agent-execute.js +71 -0
  83. package/dist/core/agent-execute.js.map +1 -0
  84. package/dist/core/agent-list.d.ts +95 -0
  85. package/dist/core/agent-list.d.ts.map +1 -0
  86. package/dist/core/agent-list.js +207 -0
  87. package/dist/core/agent-list.js.map +1 -0
  88. package/dist/core/agent-show.d.ts +44 -0
  89. package/dist/core/agent-show.d.ts.map +1 -0
  90. package/dist/core/agent-show.js +188 -0
  91. package/dist/core/agent-show.js.map +1 -0
  92. package/dist/core/approval-authority.d.ts +17 -14
  93. package/dist/core/approval-authority.d.ts.map +1 -1
  94. package/dist/core/approval-authority.js +9 -9
  95. package/dist/core/approval-authority.js.map +1 -1
  96. package/dist/core/builtin-asset.d.ts +18 -15
  97. package/dist/core/builtin-asset.d.ts.map +1 -1
  98. package/dist/core/builtin-asset.js +17 -14
  99. package/dist/core/builtin-asset.js.map +1 -1
  100. package/dist/core/builtin-integrity.d.ts +12 -2
  101. package/dist/core/builtin-integrity.d.ts.map +1 -1
  102. package/dist/core/builtin-integrity.js +85 -9
  103. package/dist/core/builtin-integrity.js.map +1 -1
  104. package/dist/core/confinement.d.ts +3 -1
  105. package/dist/core/confinement.d.ts.map +1 -1
  106. package/dist/core/confinement.js +7 -4
  107. package/dist/core/confinement.js.map +1 -1
  108. package/dist/core/context.d.ts +150 -98
  109. package/dist/core/context.d.ts.map +1 -1
  110. package/dist/core/context.js +602 -66
  111. package/dist/core/context.js.map +1 -1
  112. package/dist/core/directive-assign.d.ts +33 -7
  113. package/dist/core/directive-assign.d.ts.map +1 -1
  114. package/dist/core/directive-assign.js +67 -27
  115. package/dist/core/directive-assign.js.map +1 -1
  116. package/dist/core/directive-scope.d.ts +36 -0
  117. package/dist/core/directive-scope.d.ts.map +1 -0
  118. package/dist/core/directive-scope.js +34 -0
  119. package/dist/core/directive-scope.js.map +1 -0
  120. package/dist/core/directives-list.d.ts +13 -3
  121. package/dist/core/directives-list.d.ts.map +1 -1
  122. package/dist/core/directives-list.js +18 -6
  123. package/dist/core/directives-list.js.map +1 -1
  124. package/dist/core/dry-run.d.ts +33 -0
  125. package/dist/core/dry-run.d.ts.map +1 -0
  126. package/dist/core/dry-run.js +45 -0
  127. package/dist/core/dry-run.js.map +1 -0
  128. package/dist/core/element-ref.d.ts +23 -0
  129. package/dist/core/element-ref.d.ts.map +1 -0
  130. package/dist/core/element-ref.js +24 -0
  131. package/dist/core/element-ref.js.map +1 -0
  132. package/dist/core/error-details.d.ts +20 -0
  133. package/dist/core/error-details.d.ts.map +1 -0
  134. package/dist/core/error-details.js +65 -0
  135. package/dist/core/error-details.js.map +1 -0
  136. package/dist/core/exit-code.js +6 -6
  137. package/dist/core/git-identity.d.ts +46 -11
  138. package/dist/core/git-identity.d.ts.map +1 -1
  139. package/dist/core/git-identity.js +140 -27
  140. package/dist/core/git-identity.js.map +1 -1
  141. package/dist/core/index.d.ts +189 -14
  142. package/dist/core/index.d.ts.map +1 -1
  143. package/dist/core/index.js +1241 -238
  144. package/dist/core/index.js.map +1 -1
  145. package/dist/core/init.d.ts +50 -8
  146. package/dist/core/init.d.ts.map +1 -1
  147. package/dist/core/init.js +139 -27
  148. package/dist/core/init.js.map +1 -1
  149. package/dist/core/loaders.d.ts +170 -14
  150. package/dist/core/loaders.d.ts.map +1 -1
  151. package/dist/core/loaders.js +570 -89
  152. package/dist/core/loaders.js.map +1 -1
  153. package/dist/core/memory-add-link.d.ts +28 -0
  154. package/dist/core/memory-add-link.d.ts.map +1 -0
  155. package/dist/core/memory-add-link.js +67 -0
  156. package/dist/core/memory-add-link.js.map +1 -0
  157. package/dist/core/memory-add-type.d.ts +25 -1
  158. package/dist/core/memory-add-type.d.ts.map +1 -1
  159. package/dist/core/memory-add-type.js +59 -1
  160. package/dist/core/memory-add-type.js.map +1 -1
  161. package/dist/core/memory-amend.d.ts +80 -0
  162. package/dist/core/memory-amend.d.ts.map +1 -0
  163. package/dist/core/memory-amend.js +160 -0
  164. package/dist/core/memory-amend.js.map +1 -0
  165. package/dist/core/memory-supersede.d.ts +28 -0
  166. package/dist/core/memory-supersede.d.ts.map +1 -0
  167. package/dist/core/memory-supersede.js +79 -0
  168. package/dist/core/memory-supersede.js.map +1 -0
  169. package/dist/core/memory-transition.d.ts +190 -30
  170. package/dist/core/memory-transition.d.ts.map +1 -1
  171. package/dist/core/memory-transition.js +480 -59
  172. package/dist/core/memory-transition.js.map +1 -1
  173. package/dist/core/registry.d.ts +147 -23
  174. package/dist/core/registry.d.ts.map +1 -1
  175. package/dist/core/registry.js +50 -0
  176. package/dist/core/registry.js.map +1 -1
  177. package/dist/core/relevance.d.ts +74 -12
  178. package/dist/core/relevance.d.ts.map +1 -1
  179. package/dist/core/relevance.js +45 -27
  180. package/dist/core/relevance.js.map +1 -1
  181. package/dist/core/require-reason.d.ts.map +1 -1
  182. package/dist/core/require-reason.js +6 -5
  183. package/dist/core/require-reason.js.map +1 -1
  184. package/dist/core/required-fields.d.ts +28 -0
  185. package/dist/core/required-fields.d.ts.map +1 -0
  186. package/dist/core/required-fields.js +60 -0
  187. package/dist/core/required-fields.js.map +1 -0
  188. package/dist/core/revision.d.ts +82 -0
  189. package/dist/core/revision.d.ts.map +1 -0
  190. package/dist/core/revision.js +144 -0
  191. package/dist/core/revision.js.map +1 -0
  192. package/dist/core/types.d.ts +28 -2
  193. package/dist/core/types.d.ts.map +1 -1
  194. package/dist/core/types.js +12 -3
  195. package/dist/core/types.js.map +1 -1
  196. package/dist/core/workflow-core-checks.d.ts +34 -0
  197. package/dist/core/workflow-core-checks.d.ts.map +1 -0
  198. package/dist/core/workflow-core-checks.js +403 -0
  199. package/dist/core/workflow-core-checks.js.map +1 -0
  200. package/dist/core/workflow-create-remove.d.ts +65 -0
  201. package/dist/core/workflow-create-remove.d.ts.map +1 -0
  202. package/dist/core/workflow-create-remove.js +277 -0
  203. package/dist/core/workflow-create-remove.js.map +1 -0
  204. package/dist/core/workflow-deduction.d.ts +48 -0
  205. package/dist/core/workflow-deduction.d.ts.map +1 -0
  206. package/dist/core/workflow-deduction.js +523 -0
  207. package/dist/core/workflow-deduction.js.map +1 -0
  208. package/dist/core/workflow-diagnostics.d.ts +83 -0
  209. package/dist/core/workflow-diagnostics.d.ts.map +1 -0
  210. package/dist/core/workflow-diagnostics.js +375 -0
  211. package/dist/core/workflow-diagnostics.js.map +1 -0
  212. package/dist/core/workflow-exit-state.d.ts +125 -0
  213. package/dist/core/workflow-exit-state.d.ts.map +1 -0
  214. package/dist/core/workflow-exit-state.js +243 -0
  215. package/dist/core/workflow-exit-state.js.map +1 -0
  216. package/dist/core/workflow-finalize.d.ts +37 -0
  217. package/dist/core/workflow-finalize.d.ts.map +1 -0
  218. package/dist/core/workflow-finalize.js +153 -0
  219. package/dist/core/workflow-finalize.js.map +1 -0
  220. package/dist/core/workflow-list-show.d.ts +176 -0
  221. package/dist/core/workflow-list-show.d.ts.map +1 -0
  222. package/dist/core/workflow-list-show.js +268 -0
  223. package/dist/core/workflow-list-show.js.map +1 -0
  224. package/dist/core/workflow-next.d.ts +268 -0
  225. package/dist/core/workflow-next.d.ts.map +1 -0
  226. package/dist/core/workflow-next.js +503 -0
  227. package/dist/core/workflow-next.js.map +1 -0
  228. package/dist/core/workflow-registry.d.ts +52 -0
  229. package/dist/core/workflow-registry.d.ts.map +1 -0
  230. package/dist/core/workflow-registry.js +158 -0
  231. package/dist/core/workflow-registry.js.map +1 -0
  232. package/dist/core/workflow-start-end.d.ts +71 -0
  233. package/dist/core/workflow-start-end.d.ts.map +1 -0
  234. package/dist/core/workflow-start-end.js +298 -0
  235. package/dist/core/workflow-start-end.js.map +1 -0
  236. package/dist/core/workflow-status.d.ts +83 -0
  237. package/dist/core/workflow-status.d.ts.map +1 -0
  238. package/dist/core/workflow-status.js +125 -0
  239. package/dist/core/workflow-status.js.map +1 -0
  240. package/dist/core/write-guard.d.ts +51 -8
  241. package/dist/core/write-guard.d.ts.map +1 -1
  242. package/dist/core/write-guard.js +139 -9
  243. package/dist/core/write-guard.js.map +1 -1
  244. package/dist/directives/index.d.ts +3 -2
  245. package/dist/directives/index.d.ts.map +1 -1
  246. package/dist/directives/index.js +5 -3
  247. package/dist/directives/index.js.map +1 -1
  248. package/dist/directives/schema.d.ts +35 -30
  249. package/dist/directives/schema.d.ts.map +1 -1
  250. package/dist/directives/schema.js +36 -30
  251. package/dist/directives/schema.js.map +1 -1
  252. package/dist/directives/version.d.ts +28 -0
  253. package/dist/directives/version.d.ts.map +1 -0
  254. package/dist/directives/version.js +51 -0
  255. package/dist/directives/version.js.map +1 -0
  256. package/dist/dna/edit.d.ts +7 -6
  257. package/dist/dna/edit.d.ts.map +1 -1
  258. package/dist/dna/edit.js +96 -41
  259. package/dist/dna/edit.js.map +1 -1
  260. package/dist/dna/mutate.js +18 -3
  261. package/dist/dna/mutate.js.map +1 -1
  262. package/dist/dna/path.d.ts +2 -2
  263. package/dist/dna/roles.d.ts +1 -1
  264. package/dist/dna/schema.d.ts +61 -3
  265. package/dist/dna/schema.d.ts.map +1 -1
  266. package/dist/dna/schema.js +121 -6
  267. package/dist/dna/schema.js.map +1 -1
  268. package/dist/mcp/dna-resource.d.ts.map +1 -1
  269. package/dist/mcp/dna-resource.js +4 -4
  270. package/dist/mcp/dna-resource.js.map +1 -1
  271. package/dist/mcp/index.d.ts +9 -5
  272. package/dist/mcp/index.d.ts.map +1 -1
  273. package/dist/mcp/index.js +13 -2
  274. package/dist/mcp/index.js.map +1 -1
  275. package/dist/mcp/memory-resource.d.ts.map +1 -1
  276. package/dist/mcp/memory-resource.js +30 -19
  277. package/dist/mcp/memory-resource.js.map +1 -1
  278. package/dist/mcp/prompt.d.ts +61 -24
  279. package/dist/mcp/prompt.d.ts.map +1 -1
  280. package/dist/mcp/prompt.js +176 -47
  281. package/dist/mcp/prompt.js.map +1 -1
  282. package/dist/mcp/read-only.d.ts +39 -0
  283. package/dist/mcp/read-only.d.ts.map +1 -1
  284. package/dist/mcp/read-only.js +61 -0
  285. package/dist/mcp/read-only.js.map +1 -1
  286. package/dist/mcp/registrar.d.ts +10 -0
  287. package/dist/mcp/registrar.d.ts.map +1 -1
  288. package/dist/mcp/registrar.js +48 -12
  289. package/dist/mcp/registrar.js.map +1 -1
  290. package/dist/mcp/server.d.ts +21 -14
  291. package/dist/mcp/server.d.ts.map +1 -1
  292. package/dist/mcp/server.js +41 -15
  293. package/dist/mcp/server.js.map +1 -1
  294. package/dist/mcp/session-resource.d.ts +13 -0
  295. package/dist/mcp/session-resource.d.ts.map +1 -0
  296. package/dist/mcp/session-resource.js +65 -0
  297. package/dist/mcp/session-resource.js.map +1 -0
  298. package/dist/mcp/workflow-resource.d.ts +18 -0
  299. package/dist/mcp/workflow-resource.d.ts.map +1 -1
  300. package/dist/mcp/workflow-resource.js +37 -8
  301. package/dist/mcp/workflow-resource.js.map +1 -1
  302. package/dist/memory/add.d.ts +160 -17
  303. package/dist/memory/add.d.ts.map +1 -1
  304. package/dist/memory/add.js +361 -51
  305. package/dist/memory/add.js.map +1 -1
  306. package/dist/memory/audit.d.ts +165 -32
  307. package/dist/memory/audit.d.ts.map +1 -1
  308. package/dist/memory/audit.js +267 -97
  309. package/dist/memory/audit.js.map +1 -1
  310. package/dist/memory/commit-message.d.ts +60 -38
  311. package/dist/memory/commit-message.d.ts.map +1 -1
  312. package/dist/memory/commit-message.js +167 -21
  313. package/dist/memory/commit-message.js.map +1 -1
  314. package/dist/memory/entry.d.ts.map +1 -1
  315. package/dist/memory/entry.js +1 -2
  316. package/dist/memory/entry.js.map +1 -1
  317. package/dist/memory/frontmatter-edit.d.ts +16 -4
  318. package/dist/memory/frontmatter-edit.d.ts.map +1 -1
  319. package/dist/memory/frontmatter-edit.js +13 -1
  320. package/dist/memory/frontmatter-edit.js.map +1 -1
  321. package/dist/memory/git-log.d.ts +18 -6
  322. package/dist/memory/git-log.d.ts.map +1 -1
  323. package/dist/memory/git-log.js +40 -13
  324. package/dist/memory/git-log.js.map +1 -1
  325. package/dist/memory/history.d.ts +74 -13
  326. package/dist/memory/history.d.ts.map +1 -1
  327. package/dist/memory/history.js +129 -45
  328. package/dist/memory/history.js.map +1 -1
  329. package/dist/memory/index.d.ts +13 -11
  330. package/dist/memory/index.d.ts.map +1 -1
  331. package/dist/memory/index.js +38 -3
  332. package/dist/memory/index.js.map +1 -1
  333. package/dist/memory/query.d.ts +161 -19
  334. package/dist/memory/query.d.ts.map +1 -1
  335. package/dist/memory/query.js +435 -55
  336. package/dist/memory/query.js.map +1 -1
  337. package/dist/memory/schema.d.ts +52 -3
  338. package/dist/memory/schema.d.ts.map +1 -1
  339. package/dist/memory/schema.js +132 -8
  340. package/dist/memory/schema.js.map +1 -1
  341. package/dist/memory/state-machine.d.ts +65 -10
  342. package/dist/memory/state-machine.d.ts.map +1 -1
  343. package/dist/memory/state-machine.js +136 -48
  344. package/dist/memory/state-machine.js.map +1 -1
  345. package/dist/memory/submit.d.ts +52 -3
  346. package/dist/memory/submit.d.ts.map +1 -1
  347. package/dist/memory/submit.js +118 -11
  348. package/dist/memory/submit.js.map +1 -1
  349. package/dist/storage/build-stamp.d.ts +18 -0
  350. package/dist/storage/build-stamp.d.ts.map +1 -0
  351. package/dist/storage/build-stamp.js +68 -0
  352. package/dist/storage/build-stamp.js.map +1 -0
  353. package/dist/storage/builtin-adapters.d.ts +32 -0
  354. package/dist/storage/builtin-adapters.d.ts.map +1 -0
  355. package/dist/storage/builtin-adapters.js +100 -0
  356. package/dist/storage/builtin-adapters.js.map +1 -0
  357. package/dist/storage/builtin-directives.d.ts +0 -29
  358. package/dist/storage/builtin-directives.d.ts.map +1 -1
  359. package/dist/storage/builtin-directives.js +9 -4
  360. package/dist/storage/builtin-directives.js.map +1 -1
  361. package/dist/storage/commit.d.ts +310 -3
  362. package/dist/storage/commit.d.ts.map +1 -1
  363. package/dist/storage/commit.js +807 -33
  364. package/dist/storage/commit.js.map +1 -1
  365. package/dist/storage/document.d.ts +6 -0
  366. package/dist/storage/document.d.ts.map +1 -1
  367. package/dist/storage/document.js +10 -1
  368. package/dist/storage/document.js.map +1 -1
  369. package/dist/storage/dry-run.d.ts +65 -0
  370. package/dist/storage/dry-run.d.ts.map +1 -0
  371. package/dist/storage/dry-run.js +150 -0
  372. package/dist/storage/dry-run.js.map +1 -0
  373. package/dist/storage/errors.d.ts +26 -0
  374. package/dist/storage/errors.d.ts.map +1 -1
  375. package/dist/storage/errors.js +27 -1
  376. package/dist/storage/errors.js.map +1 -1
  377. package/dist/storage/frontmatter.d.ts +1 -1
  378. package/dist/storage/frontmatter.js +1 -1
  379. package/dist/storage/git-read.d.ts +64 -0
  380. package/dist/storage/git-read.d.ts.map +1 -0
  381. package/dist/storage/git-read.js +107 -0
  382. package/dist/storage/git-read.js.map +1 -0
  383. package/dist/storage/index.d.ts +13 -5
  384. package/dist/storage/index.d.ts.map +1 -1
  385. package/dist/storage/index.js +39 -2
  386. package/dist/storage/index.js.map +1 -1
  387. package/dist/storage/layout.d.ts +2 -2
  388. package/dist/storage/layout.d.ts.map +1 -1
  389. package/dist/storage/layout.js +2 -7
  390. package/dist/storage/layout.js.map +1 -1
  391. package/dist/storage/memory-path.d.ts +18 -5
  392. package/dist/storage/memory-path.d.ts.map +1 -1
  393. package/dist/storage/memory-path.js +41 -5
  394. package/dist/storage/memory-path.js.map +1 -1
  395. package/dist/storage/snapshot.js +1 -1
  396. package/dist/storage/templates.d.ts +33 -6
  397. package/dist/storage/templates.d.ts.map +1 -1
  398. package/dist/storage/templates.js +182 -17
  399. package/dist/storage/templates.js.map +1 -1
  400. package/dist/validation/config-version.d.ts +19 -0
  401. package/dist/validation/config-version.d.ts.map +1 -0
  402. package/dist/validation/config-version.js +53 -0
  403. package/dist/validation/config-version.js.map +1 -0
  404. package/dist/validation/diagnostic.d.ts +40 -0
  405. package/dist/validation/diagnostic.d.ts.map +1 -0
  406. package/dist/validation/diagnostic.js +41 -0
  407. package/dist/validation/diagnostic.js.map +1 -0
  408. package/dist/validation/format.d.ts +74 -0
  409. package/dist/validation/format.d.ts.map +1 -0
  410. package/dist/validation/format.js +104 -0
  411. package/dist/validation/format.js.map +1 -0
  412. package/dist/validation/id.d.ts +40 -0
  413. package/dist/validation/id.d.ts.map +1 -1
  414. package/dist/validation/id.js +99 -12
  415. package/dist/validation/id.js.map +1 -1
  416. package/dist/validation/identity.d.ts +40 -0
  417. package/dist/validation/identity.d.ts.map +1 -0
  418. package/dist/validation/identity.js +78 -0
  419. package/dist/validation/identity.js.map +1 -0
  420. package/dist/validation/index.d.ts +9 -3
  421. package/dist/validation/index.d.ts.map +1 -1
  422. package/dist/validation/index.js +33 -1
  423. package/dist/validation/index.js.map +1 -1
  424. package/dist/validation/secret-scan.d.ts +10 -7
  425. package/dist/validation/secret-scan.d.ts.map +1 -1
  426. package/dist/validation/secret-scan.js +39 -16
  427. package/dist/validation/secret-scan.js.map +1 -1
  428. package/dist/validation/warning.d.ts +30 -16
  429. package/dist/validation/warning.d.ts.map +1 -1
  430. package/dist/validation/warning.js +74 -7
  431. package/dist/validation/warning.js.map +1 -1
  432. package/dist/workflow/bindings.d.ts +152 -0
  433. package/dist/workflow/bindings.d.ts.map +1 -0
  434. package/dist/workflow/bindings.js +249 -0
  435. package/dist/workflow/bindings.js.map +1 -0
  436. package/dist/workflow/create.d.ts +13 -0
  437. package/dist/workflow/create.d.ts.map +1 -0
  438. package/dist/workflow/create.js +41 -0
  439. package/dist/workflow/create.js.map +1 -0
  440. package/dist/workflow/deduce.d.ts +400 -0
  441. package/dist/workflow/deduce.d.ts.map +1 -0
  442. package/dist/workflow/deduce.js +1109 -0
  443. package/dist/workflow/deduce.js.map +1 -0
  444. package/dist/workflow/manifest-edit.d.ts +19 -0
  445. package/dist/workflow/manifest-edit.d.ts.map +1 -0
  446. package/dist/workflow/manifest-edit.js +124 -0
  447. package/dist/workflow/manifest-edit.js.map +1 -0
  448. package/dist/workflow/schema.d.ts +158 -19
  449. package/dist/workflow/schema.d.ts.map +1 -1
  450. package/dist/workflow/schema.js +190 -16
  451. package/dist/workflow/schema.js.map +1 -1
  452. package/package.json +37 -13
@@ -0,0 +1,523 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readDirtyRunLogs = readDirtyRunLogs;
4
+ exports.readDirtyPaths = readDirtyPaths;
5
+ exports.instancePlanIds = instancePlanIds;
6
+ exports.readDeductionSnapshotAtHead = readDeductionSnapshotAtHead;
7
+ exports.deduceWorkflowStateAtHead = deduceWorkflowStateAtHead;
8
+ exports.selectWorkflowInstance = selectWorkflowInstance;
9
+ /**
10
+ * The `HEAD` snapshot workflow state deduction reads (task-198, task-203; `spec-017` §1.1–§1.3, §3.3,
11
+ * §4.8), and the deduction at `HEAD` every workflow consumer calls.
12
+ *
13
+ * {@link readDeductionSnapshotAtHead} is the one impure step: it resolves `HEAD` once and reads every
14
+ * input at that sha — the workflow registry with its core checks (`loadWorkflowRegistryAtCommit`),
15
+ * `memory.yaml`, `dna.yaml`, every Memory document in sorted path order (tolerant, task-171), the file
16
+ * list, each open plan's start commit and what each instance's walk holds (phase records, step linkages,
17
+ * re-entries) — plus, to **explain** and never to decide, the working-tree paths among the inputs that
18
+ * differ from `HEAD` (`W_UNCOMMITTED_INPUTS`, §1.2; the `command-baseline` directive). The deduction
19
+ * itself is the pure `deduceWorkflowState` (`src/workflow/deduce.ts`).
20
+ *
21
+ * History is read at the cost §4.8 states (REQ-PERF-03): **one** `git log` over the union of the open
22
+ * instances' walks, bounded by the parents of the starts' octopus merge base (one `git merge-base
23
+ * --octopus`), from which each instance's own walk is cut in memory through the parent links; plus one
24
+ * lookup per element a re-entry in the walk names, and one batched read (`git cat-file --batch`) of those
25
+ * elements' files at the bracketless `add` / `submit` commits that name them (task-281, `bug-300`).
26
+ *
27
+ * git is read with `runGitRead` (stderr captured, `bug-093`) and the `git log` walk with
28
+ * `walkGitLogFields` (NUL-framed, `bug-050`); every `git log` passes `--no-show-signature` and checks the
29
+ * commit names it parses (`task-268`, `bug-291`), so a `log.showSignature` setting cannot put signature
30
+ * text among the parsed lines; the `git merge-base` that bounds the walk takes no such flag, and its
31
+ * output is checked the same way. No clock, no randomness, nothing cached between calls.
32
+ */
33
+ const path_1 = require("path");
34
+ const run_log_1 = require("../agent/run-log");
35
+ const path_2 = require("../dna/path");
36
+ const audit_1 = require("../memory/audit");
37
+ const git_log_1 = require("../memory/git-log");
38
+ const query_1 = require("../memory/query");
39
+ const state_machine_1 = require("../memory/state-machine");
40
+ const storage_1 = require("../storage");
41
+ const validation_1 = require("../validation");
42
+ const deduce_1 = require("../workflow/deduce");
43
+ const schema_1 = require("../workflow/schema");
44
+ const loaders_1 = require("./loaders");
45
+ const revision_1 = require("./revision");
46
+ const types_1 = require("./types");
47
+ const workflow_registry_1 = require("./workflow-registry");
48
+ /** The trailer that marks a phase record (`spec-003` § "Evidence"). */
49
+ const PHASE_TRAILER = 'WingFoil-Phase';
50
+ const RECORD_SUFFIX = ' completed';
51
+ /** A non-blank string frontmatter value, or `null`. */
52
+ function text(value) {
53
+ return typeof value === 'string' && value.trim() !== '' ? value : null;
54
+ }
55
+ /** The marker that opens one commit of {@link readStarts}'s `git log` (a byte no path or sha holds). */
56
+ const COMMIT_MARK = String.fromCharCode(1);
57
+ /**
58
+ * The start commit of each plan at `paths` (§3.3): the latest commit reachable from `sha` that **added**
59
+ * the file at its current path (`--no-renames`, so a moved plan starts where it arrived). One
60
+ * `git log --topo-order` over all of them: the commits come out in `git rev-list --topo-order` order,
61
+ * so a start's position is the index of its commit among them (`0` the most recent).
62
+ */
63
+ function readStarts(root, sha, paths) {
64
+ const starts = new Map();
65
+ if (paths.length === 0)
66
+ return starts;
67
+ const args = ['-c', 'core.quotePath=false', 'log', '--no-show-signature', '--topo-order', '--no-renames', '--diff-filter=A', '--name-only', '--format=%x01%H', sha, '--'];
68
+ const wanted = new Set(paths);
69
+ let commit = '';
70
+ let position = -1;
71
+ for (const line of (0, storage_1.runGitRead)(root, [...args, ...paths.map((path) => `:(literal)${path}`)]).stdout.split('\n')) {
72
+ if (line.startsWith(COMMIT_MARK)) {
73
+ commit = (0, storage_1.requireCommitName)(line.slice(1), 'git log --diff-filter=A');
74
+ position += 1;
75
+ }
76
+ else if (wanted.has(line) && !starts.has(line)) {
77
+ starts.set(line, { commit, position });
78
+ }
79
+ }
80
+ return starts;
81
+ }
82
+ /** The value of each `key: value` line of a trailer block, by key (the last one wins), or `null`. */
83
+ function trailerValue(block, key) {
84
+ let found = null;
85
+ for (const line of block.split('\n')) {
86
+ const colon = line.indexOf(':');
87
+ if (colon !== -1 && line.slice(0, colon).trim() === key)
88
+ found = line.slice(colon + 1).trim();
89
+ }
90
+ return found;
91
+ }
92
+ /**
93
+ * The walk's lower bound (§4.8, review F3 ruling (a)): `^@` of the octopus merge base of every start
94
+ * commit, or none when the starts share no ancestor (unrelated histories; `git merge-base` exits 1). The
95
+ * base is an ancestor of (or equal to) each start, so whatever its parents reach is reachable from every
96
+ * start's parents: outside every instance's walk. A commit some instance's walk holds is therefore never
97
+ * cut off, as it could be by the oldest start alone in a branching history. `merge-base` prints a commit
98
+ * name and takes no `--no-show-signature` (git refuses the option; `log.showSignature` does not apply to
99
+ * it); its output is refused unless it is a commit name (`requireCommitName`, task-268).
100
+ */
101
+ function readWalkBound(root, starts) {
102
+ const commits = [...new Set(starts.map((entry) => entry.commit))].sort();
103
+ const run = (0, storage_1.runGitRead)(root, ['merge-base', '--octopus', ...commits], { accepted: [0, 1] });
104
+ if (run.status === 1)
105
+ return [];
106
+ const base = (0, storage_1.requireCommitName)(run.stdout.trim(), 'git merge-base --octopus');
107
+ return ['--not', `${base}^@`];
108
+ }
109
+ /**
110
+ * The union of the open instances' walks (§4.8): one `git log --topo-order` of the commits reachable
111
+ * from `sha` and not from `bound` (`readWalkBound`), newest first, with each commit's parents, subject
112
+ * and trailers. Every instance's walk lies inside this one.
113
+ */
114
+ function readWalk(root, sha, bound) {
115
+ const rows = (0, git_log_1.walkGitLogFields)(root, ['%H', '%P', '%s', '%(trailers:only,unfold)'], [], ['--topo-order', sha, ...bound]);
116
+ // `walkGitLogFields` returns oldest first; the walk position counts from `HEAD`.
117
+ return rows.reverse().map(([commit, parents, subject, trailers], position) => ({
118
+ commit: commit,
119
+ position,
120
+ parents: parents.split(' ').filter((parent) => parent !== ''),
121
+ subject: subject,
122
+ trailers: trailers,
123
+ }));
124
+ }
125
+ /**
126
+ * The commits of one instance's walk (§4.8): those of the union walk not reachable from `start`'s
127
+ * parents. Reachability is followed through the walk's own parent links: a commit on a path from a
128
+ * parent of `start` down to a commit of the union walk is itself in the union walk, so nothing outside
129
+ * it is needed.
130
+ */
131
+ function instanceWalk(walk, byCommit, start) {
132
+ const excluded = new Set();
133
+ // Every start lies in the union walk: it descends from (or is) the merge base, so it is not reachable
134
+ // from the base's parents.
135
+ const pending = [...byCommit.get(start).parents];
136
+ while (pending.length > 0) {
137
+ const commit = pending.pop();
138
+ const entry = byCommit.get(commit);
139
+ if (entry === undefined || excluded.has(commit))
140
+ continue;
141
+ excluded.add(commit);
142
+ pending.push(...entry.parents);
143
+ }
144
+ return new Set(walk.filter((entry) => !excluded.has(entry.commit)).map((entry) => entry.commit));
145
+ }
146
+ /** The ids a `wf(<type>): <verb> <ids> [<bracket>]` subject names, in order. */
147
+ function subjectIds(subject) {
148
+ const rest = subject.replace(/^wf\([^)]*\):\s*\S+\s*/, '').replace(/\[[^[\]]*\]\s*$/, '');
149
+ return rest
150
+ .split(',')
151
+ .map((id) => id.trim())
152
+ .filter((id) => id !== '');
153
+ }
154
+ /** The scope of a `wf(<scope>): …` subject — the Memory type of a Memory operation. */
155
+ function subjectType(subject) {
156
+ return /^wf\(([^)]*)\)/.exec(subject)[1];
157
+ }
158
+ /** The verbs whose subject carries no bracket (`spec-008` §2): `add` and `submit`. */
159
+ const BRACKETLESS_VERBS = ['add', 'submit'];
160
+ /**
161
+ * Read one walk commit. A re-entry is a `reject` or `park` whose bracket ends at an earlier position of
162
+ * the type's `sequence` than it starts from: a `bug` rejected `open → closed` moves forward, which
163
+ * decides the phase rather than re-entering it (§5.2).
164
+ */
165
+ function readFacts(entry, memoryYaml) {
166
+ const { commit, position, subject, trailers } = entry;
167
+ const phase = trailerValue(trailers, PHASE_TRAILER);
168
+ const instance = trailerValue(trailers, 'WingFoil-Instance');
169
+ const record = phase !== null && phase.endsWith(RECORD_SUFFIX) && instance !== null
170
+ ? {
171
+ commit,
172
+ position,
173
+ phase: phase.slice(0, -RECORD_SUFFIX.length).trim(),
174
+ instance,
175
+ element: trailerValue(trailers, 'WingFoil-Element'),
176
+ item: trailerValue(trailers, 'WingFoil-Item'),
177
+ }
178
+ : null;
179
+ const facts = { record, links: [], reentries: [], transitions: [], bracketless: [] };
180
+ const operation = (0, audit_1.parseMemoryOperation)(subject);
181
+ if (operation === null)
182
+ return facts;
183
+ const type = subjectType(subject);
184
+ const ids = subjectIds(subject);
185
+ const step = trailerValue(trailers, 'WingFoil-Step');
186
+ if (operation === 'add' && instance !== null && step !== null) {
187
+ for (const id of ids)
188
+ facts.links.push({ commit, position, instance, step, type, id });
189
+ }
190
+ const hops = (0, audit_1.parseBracketHops)(subject);
191
+ if (hops === null) {
192
+ if (BRACKETLESS_VERBS.includes(operation))
193
+ for (const id of ids)
194
+ facts.bracketless.push({ commit, position, type, id });
195
+ return facts;
196
+ }
197
+ const from = hops[0].from;
198
+ const to = hops[hops.length - 1].to;
199
+ for (const id of ids)
200
+ facts.transitions.push({ commit, position, type, id, to });
201
+ if ((operation === 'reject' || operation === 'park') && memoryYaml !== null && Object.prototype.hasOwnProperty.call(memoryYaml.types, type)) {
202
+ const sequence = (0, state_machine_1.resolveStateMachine)(memoryYaml, type).sequence;
203
+ const target = sequence.indexOf(to);
204
+ if (target !== -1 && target < sequence.indexOf(from)) {
205
+ for (const id of ids)
206
+ facts.reentries.push({ commit, position, verb: operation, type, id, from, to });
207
+ }
208
+ }
209
+ return facts;
210
+ }
211
+ /**
212
+ * The latest commit of the walk that changed the file at `path` — one `git log -1` bounded like the
213
+ * walk — or `null` when no commit of the walk did.
214
+ */
215
+ function readLastChange(root, sha, bound, path, byCommit) {
216
+ const out = (0, storage_1.runGitRead)(root, ['log', '--no-show-signature', '--topo-order', '-1', '--format=%H', sha, ...bound, '--', `:(literal)${path}`]).stdout.trim();
217
+ if (out === '')
218
+ return null;
219
+ const entry = byCommit.get((0, storage_1.requireCommitName)(out, 'git log -1'));
220
+ return entry === undefined ? null : { commit: entry.commit, position: entry.position };
221
+ }
222
+ /**
223
+ * Read the history every open instance's deduction needs (§4.8): one walk for the union of the instances'
224
+ * walks, each instance's records, linkages and re-entries cut from it, the transition commits naming a
225
+ * re-entered element (a bracketless `add` / `submit` through the status its file holds there, one batched
226
+ * read), the walk's parent links, and one lookup per re-entered element (its file's latest change in the
227
+ * walk). With no start, nothing is read.
228
+ */
229
+ function readHistory(root, sha, starts, memoryYaml, documents) {
230
+ const read = { history: new Map(), transitions: [], lastChanges: new Map(), parents: new Map() };
231
+ if (starts.length === 0)
232
+ return read;
233
+ const bound = readWalkBound(root, starts);
234
+ const walk = readWalk(root, sha, bound);
235
+ const byCommit = new Map(walk.map((entry) => [entry.commit, entry]));
236
+ for (const entry of walk)
237
+ read.parents.set(entry.commit, entry.parents);
238
+ const facts = walk.map((entry) => readFacts(entry, memoryYaml));
239
+ const reentered = new Set();
240
+ for (const start of [...new Set(starts.map((entry) => entry.commit))].sort()) {
241
+ const members = instanceWalk(walk, byCommit, start);
242
+ const inWalk = facts.filter((_, index) => members.has(walk[index].commit));
243
+ const history = {
244
+ records: inWalk.flatMap((fact) => (fact.record === null ? [] : [fact.record])),
245
+ links: inWalk.flatMap((fact) => fact.links),
246
+ reentries: inWalk.flatMap((fact) => fact.reentries),
247
+ };
248
+ for (const reentry of history.reentries)
249
+ reentered.add(`${reentry.type}:${reentry.id}`);
250
+ read.history.set(start, history);
251
+ }
252
+ if (reentered.size === 0)
253
+ return read;
254
+ const pathOf = new Map();
255
+ for (const key of [...reentered].sort()) {
256
+ const document = documents.find(({ frontmatter }) => `${text(frontmatter['type'])}:${text(frontmatter['id'])}` === key);
257
+ if (document !== undefined)
258
+ pathOf.set(key, document.path);
259
+ }
260
+ const statuses = readBracketlessStatuses(root, facts.flatMap((fact) => fact.bracketless), pathOf);
261
+ // In walk order (newest first): a bracketed transition as its bracket says, a bracketless `add` / `submit`
262
+ // as the file it names holds at that commit (task-281, `bug-300`).
263
+ for (const fact of facts) {
264
+ read.transitions.push(...fact.transitions.filter((entry) => reentered.has(`${entry.type}:${entry.id}`)));
265
+ for (const entry of fact.bracketless) {
266
+ const to = statuses.get(`${entry.commit} ${entry.type}:${entry.id}`);
267
+ if (to !== undefined)
268
+ read.transitions.push({ commit: entry.commit, position: entry.position, type: entry.type, id: entry.id, to });
269
+ }
270
+ }
271
+ for (const key of [...reentered].sort()) {
272
+ const document = documents.find(({ frontmatter }) => `${text(frontmatter['type'])}:${text(frontmatter['id'])}` === key);
273
+ if (document === undefined)
274
+ continue;
275
+ const last = readLastChange(root, sha, bound, document.path, byCommit);
276
+ if (last !== null)
277
+ read.lastChanges.set(key, last);
278
+ }
279
+ return read;
280
+ }
281
+ /**
282
+ * The `status` each bracketless `add` / `submit` of a re-entered element left in that element's file
283
+ * (§4.8, task-281, `bug-300`), by `<commit> <type>:<id>`: one `git cat-file --batch` for all of them, the
284
+ * file read at its path at `HEAD` (`pathOf`). A commit whose tree does not hold that path, or whose
285
+ * frontmatter does not parse or has no `status`, gives no entry — the subject is then not counted.
286
+ */
287
+ function readBracketlessStatuses(root, entries, pathOf) {
288
+ const requests = entries.flatMap((entry) => {
289
+ const path = pathOf.get(`${entry.type}:${entry.id}`);
290
+ return path === undefined ? [] : [{ key: `${entry.commit} ${entry.type}:${entry.id}`, rev: entry.commit, path }];
291
+ });
292
+ const statuses = new Map();
293
+ if (requests.length === 0)
294
+ return statuses;
295
+ const contents = (0, storage_1.readRevisionPaths)(root, requests);
296
+ requests.forEach((request, index) => {
297
+ const status = frontmatterStatus(contents[index], `${request.rev}:${request.path}`);
298
+ if (status !== null)
299
+ statuses.set(request.key, status);
300
+ });
301
+ return statuses;
302
+ }
303
+ /** The frontmatter `status` of a document's bytes, or `null` (absent, no frontmatter, unparsable, no string status). */
304
+ function frontmatterStatus(raw, label) {
305
+ if (raw === null)
306
+ return null;
307
+ const { frontmatter } = (0, storage_1.splitFrontmatter)(raw);
308
+ if (frontmatter === null)
309
+ return null;
310
+ try {
311
+ const data = (0, validation_1.parseYaml)(frontmatter, label);
312
+ return text(data?.['status']);
313
+ }
314
+ catch {
315
+ return null;
316
+ }
317
+ }
318
+ /** The static directory (or file) a `produces` pattern names before its first token, or `null` for the whole tree. */
319
+ function staticPrefix(pattern) {
320
+ const brace = pattern.indexOf('{');
321
+ if (brace === -1)
322
+ return pattern;
323
+ const slash = pattern.lastIndexOf('/', brace);
324
+ return slash <= 0 ? null : pattern.slice(0, slash + 1);
325
+ }
326
+ /**
327
+ * The working-tree paths among the deduction's inputs that differ from `HEAD` (§1.2): the Memory scan
328
+ * roots, the configuration files §1.1 reads at `HEAD` — `.wingfoil/workflows.yaml` and
329
+ * `.wingfoil/workflows/`, `memory.yaml`, `dna.yaml`, `roles.yaml` and `.wingfoil/directives/` (task-281,
330
+ * `bug-301`, approver ruling D2) — every `produces` pattern's static part and `paths.runs`; modified,
331
+ * staged, deleted or untracked, sorted.
332
+ */
333
+ function readDirty(root, memoryYaml, dnaYaml, workflows) {
334
+ const specs = new Set(['.wingfoil/workflows.yaml', '.wingfoil/workflows/', loaders_1.MEMORY_YAML_PATH, loaders_1.DNA_YAML_PATH, loaders_1.ROLES_YAML_PATH, `${loaders_1.DIRECTIVES_DIR_PATH}/`]);
335
+ for (const dir of memoryYaml === null ? [] : (0, query_1.computeMemoryContentRoots)(memoryYaml))
336
+ specs.add(`${dir}/`);
337
+ for (const workflow of workflows) {
338
+ for (const phase of workflow.phases) {
339
+ for (const entry of phase.produces ?? []) {
340
+ const prefix = staticPrefix((0, schema_1.producesPath)(entry));
341
+ if (prefix !== null)
342
+ specs.add(prefix);
343
+ }
344
+ }
345
+ }
346
+ const runLogs = (dnaYaml?.paths?.runs ?? []).flatMap((dir) => readDirtyRunLogs(root, dir));
347
+ return [...new Set([...readDirtyPaths(root, [...specs]), ...runLogs])].sort();
348
+ }
349
+ /**
350
+ * The run logs of the directory `dir` (`paths.runs`) that differ from `HEAD`: only the `.jsonl` files
351
+ * directly inside it, the files a run-log reader reads (`isRunLogPath`, `spec-016` §4.1). A dirty README
352
+ * there, or a nested file, is no deduction input and no `agent list` input, so it is not reported
353
+ * (task-240 review F5). Sorted.
354
+ *
355
+ * @throws `StorageError` when git cannot answer.
356
+ */
357
+ function readDirtyRunLogs(root, dir) {
358
+ const prefix = (0, run_log_1.runLogDirPrefix)(root, dir);
359
+ return readDirtyPaths(root, [dir]).filter((path) => (0, run_log_1.isRunLogPath)(prefix, path));
360
+ }
361
+ /**
362
+ * The working-tree paths under `specs` (literal pathspecs: files or directories ending in `/`) that differ
363
+ * from `HEAD` — modified, staged, deleted or untracked — sorted, each once (`spec-017` §1.2). The deduction's
364
+ * input check, and `agent list --past`'s for the run log when no deduction runs (`spec-016` §5, task-240).
365
+ *
366
+ * @throws `StorageError` when git cannot answer.
367
+ */
368
+ function readDirtyPaths(root, specs) {
369
+ const pathspecs = [...new Set(specs)].sort().map((spec) => `:(literal)${spec}`);
370
+ const status = (0, storage_1.runGitRead)(root, ['status', '--porcelain=v1', '-z', '--no-renames', '--untracked-files=all', '--', ...pathspecs]).stdout;
371
+ const dirty = status
372
+ .split('\0')
373
+ .filter((entry) => entry.length > 3)
374
+ .map((entry) => entry.slice(3));
375
+ return [...new Set(dirty)].sort();
376
+ }
377
+ /**
378
+ * The entries of every collection a loaded workflow iterates over (`spec-003` § "Collections", `dl-104`
379
+ * D2 (b)), by reference in byte order: `dna:<path>` from `dna.yaml` (the `spec-008` §9 path syntax),
380
+ * `bindings:<name>` from `workflows/bindings.yaml`'s `collections`, both at the snapshot's commit. A
381
+ * `dna:` reference with no `dna.yaml` is left out: it has no candidates.
382
+ */
383
+ function readCollections(workflows, dnaYaml, bindings) {
384
+ const references = new Set();
385
+ for (const workflow of workflows) {
386
+ for (const phase of workflow.phases) {
387
+ if (phase.iterate_over !== undefined && /^(dna|bindings):/.test(phase.iterate_over))
388
+ references.add(phase.iterate_over);
389
+ }
390
+ }
391
+ const collections = new Map();
392
+ for (const reference of [...references].sort()) {
393
+ // Every reference resolves to a list here: the registry refuses one that does not
394
+ // (`E_WORKFLOW_COLLECTION_UNRESOLVED`), except a `dna:` reference without `dna.yaml`, which is undecided
395
+ // there and has no candidates here.
396
+ if (reference.startsWith('bindings:')) {
397
+ collections.set(reference, bindings.collections[reference.slice('bindings:'.length)]);
398
+ }
399
+ else if (dnaYaml !== null) {
400
+ collections.set(reference, (0, path_2.resolveDnaPath)(dnaYaml, reference.slice('dna:'.length)).target.value);
401
+ }
402
+ }
403
+ return collections;
404
+ }
405
+ /** `read`, called at most once: later calls answer the first call's value. */
406
+ function once(read) {
407
+ let done = false;
408
+ let value;
409
+ return () => {
410
+ if (!done) {
411
+ value = read();
412
+ done = true;
413
+ }
414
+ return value;
415
+ };
416
+ }
417
+ /** The snapshot of a repository with nothing committed: no instance can be open. */
418
+ function emptySnapshot() {
419
+ return {
420
+ commit: '',
421
+ workflows: [],
422
+ workflowFiles: [],
423
+ registryDiagnostics: [],
424
+ memoryYaml: null,
425
+ documents: [],
426
+ scanDiagnostics: [],
427
+ tree: [],
428
+ starts: new Map(),
429
+ history: new Map(),
430
+ transitions: [],
431
+ lastChanges: new Map(),
432
+ parents: new Map(),
433
+ dirty: [],
434
+ collections: new Map(),
435
+ bindings: null,
436
+ dnaYaml: null,
437
+ };
438
+ }
439
+ /** Whether a document's frontmatter is a plan of the instance kind (§3.1): type `plan`, `parent` empty. */
440
+ function isInstancePlan(frontmatter) {
441
+ return text(frontmatter['type']) === deduce_1.PLAN_TYPE && text(frontmatter['parent']) === null;
442
+ }
443
+ /**
444
+ * The ids of the instance plans among `documents` (§3.1: type `plan`, `parent` empty), in any status, in
445
+ * document order — what a `<ref>` may name besides a loaded workflow (§10, task-281, `bug-326`).
446
+ */
447
+ function instancePlanIds(documents) {
448
+ return documents.flatMap(({ frontmatter }) => {
449
+ const id = text(frontmatter['id']);
450
+ return isInstancePlan(frontmatter) && id !== null ? [id] : [];
451
+ });
452
+ }
453
+ /**
454
+ * Read everything workflow state deduction needs, as `HEAD` holds it (`spec-017` §1.1), plus the
455
+ * dirty input paths (§1.2). A repository with no commit gives an empty snapshot.
456
+ *
457
+ * @throws `DiagnosticsError` (`VALIDATION`, exit `1`) when the workflow registry has an error
458
+ * (`spec-017` §2); `StorageError` `E_GIT_READ_FAILED` when git cannot answer.
459
+ */
460
+ function readDeductionSnapshotAtHead(root) {
461
+ const sha = (0, revision_1.atHeadOr)(root, () => (0, revision_1.resolveRevision)(root, 'HEAD'), null);
462
+ if (sha === null)
463
+ return emptySnapshot();
464
+ // `HEAD` is resolved once, above, and every pillar is read at that sha (task-283, `bug-309`): no loader
465
+ // resolves it again, and `memory.yaml` / `dna.yaml` are read and parsed once, for the registry's core
466
+ // checks and for the snapshot alike, in the order the registry reads them.
467
+ const memoryYamlOnce = once(() => (0, loaders_1.loadMemoryYamlAtCommit)(root, sha));
468
+ const dnaYamlOnce = once(() => (0, loaders_1.loadDnaYamlAtCommit)(root, sha));
469
+ const registry = (0, workflow_registry_1.loadWorkflowRegistryAtCommit)(root, sha, undefined, { memoryYaml: memoryYamlOnce, dnaYaml: dnaYamlOnce });
470
+ const memoryYaml = memoryYamlOnce();
471
+ const dnaYaml = dnaYamlOnce();
472
+ const scanDiagnostics = [];
473
+ // The whole scan keeps archived documents: an archived bound element abandons its instance (§4.11), and
474
+ // the deduction keeps them out of every selection and iteration itself.
475
+ const documents = memoryYaml === null ? [] : (0, query_1.loadMemoryDocumentsAtCommit)(root, sha, memoryYaml, { onDiagnostic: (diagnostic) => scanDiagnostics.push(diagnostic) });
476
+ // The plans that may be open instances (§3.2's status and `parent` rules; the workflow rule is the deduction's).
477
+ const candidates = documents
478
+ .filter(({ frontmatter }) => isInstancePlan(frontmatter) && deduce_1.OPEN_PLAN_STATUSES.includes(text(frontmatter['status']) ?? ''))
479
+ .map((document) => document.path);
480
+ const starts = readStarts(root, sha, candidates);
481
+ const { history, transitions, lastChanges, parents } = readHistory(root, sha, [...starts.values()], memoryYaml, documents);
482
+ return {
483
+ commit: sha,
484
+ workflows: registry.workflows,
485
+ workflowFiles: (registry.manifest?.include ?? []).map((file) => path_1.posix.normalize(`.wingfoil/${file}`)),
486
+ registryDiagnostics: registry.diagnostics,
487
+ memoryYaml,
488
+ documents,
489
+ scanDiagnostics,
490
+ tree: (0, revision_1.listPathsAtCommit)(root, sha, '').sort(),
491
+ starts,
492
+ history,
493
+ transitions,
494
+ lastChanges,
495
+ parents,
496
+ dirty: readDirty(root, memoryYaml, dnaYaml, registry.workflows),
497
+ collections: readCollections(registry.workflows, dnaYaml, registry.bindings),
498
+ bindings: registry.bindings,
499
+ dnaYaml,
500
+ };
501
+ }
502
+ /**
503
+ * Workflow state deduced at `HEAD` (`spec-017` §1–§4): {@link readDeductionSnapshotAtHead}, then the
504
+ * pure `deduceWorkflowState`. The one function `workflow next|status|list`, the MCP Resources and
505
+ * `agent execute --next` answer from.
506
+ *
507
+ * @throws as {@link readDeductionSnapshotAtHead}.
508
+ */
509
+ function deduceWorkflowStateAtHead(root) {
510
+ return (0, deduce_1.deduceWorkflowState)(readDeductionSnapshotAtHead(root));
511
+ }
512
+ /**
513
+ * The instance `ref` selects (`spec-017` §3.3): a workflow name — its most recently started open
514
+ * instance — or an open instance id; without `ref`, the active instance (`null` when none is open).
515
+ * A `ref` that names no open instance is `NOT_FOUND` `workflow is not open: <ref>` (§10).
516
+ */
517
+ function selectWorkflowInstance(deduction, ref) {
518
+ const found = (0, deduce_1.resolveInstanceRef)(deduction, ref);
519
+ if (ref !== undefined && found === null)
520
+ return (0, types_1.coreErr)({ code: 'NOT_FOUND', message: `workflow is not open: ${ref}`, details: { ref } });
521
+ return (0, types_1.coreOk)(found);
522
+ }
523
+ //# sourceMappingURL=workflow-deduction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-deduction.js","sourceRoot":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yB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1I,OAAO,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The Workflow pillar's **loader** checks (spec-003-workflows-yaml-schema § "Diagnostics", rows whose
3
+ * "Runs in" is `loader`; task-136): the checks that need the loaded workflow files and nothing from
4
+ * another pillar, run by `loadWorkflowsYaml` (`./loaders.ts`) as caller-supplied semantic checks
5
+ * (spec-009-validation-strategy §1). Every check here reads only the files `workflows.yaml` lists, so
6
+ * the loader keeps its pillar isolation (REQ-SYS-02).
7
+ *
8
+ * The output is one ordered array (REQ-SYS-07): within a file, workflow-level before phase-level,
9
+ * phases in declared order, and per phase the table's rows in table order. The manifest's own
10
+ * diagnostics and the order of files are the loader's ({@link workflowFileDiagnostics} is called once
11
+ * per file, in `include` order).
12
+ */
13
+ import type { Diagnostic } from '../validation';
14
+ import { BindingsYaml } from '../workflow/bindings';
15
+ import { Workflow } from '../workflow/schema';
16
+ /** One included file as the loader saw it, in manifest `include` order. */
17
+ export interface LoadedWorkflowFile {
18
+ /** The manifest `include` entry, relative to `.wingfoil/` — the diagnostics' `file`. */
19
+ readonly file: string;
20
+ /** The validated workflow, or `null` when the file failed its structural pass. */
21
+ readonly workflow: Workflow | null;
22
+ /** The raw `name`, when it is a string — kept for a structurally invalid file too. */
23
+ readonly rawName: string | null;
24
+ }
25
+ /** The registry the cross-file checks resolve names against, built once from every loaded file. */
26
+ export interface WorkflowRegistryIndex {
27
+ /** Name → index (into the loaded files) of the **first** file declaring it. */
28
+ readonly byName: ReadonlyMap<string, number>;
29
+ /**
30
+ * `false` when some included file is missing or carries no readable `name`: a phase `include` may
31
+ * then name a workflow the loader could not see, so neither `E_WORKFLOW_INCLUDE_UNRESOLVED` nor
32
+ * `E_NO_MAIN_WORKFLOW` is decidable and neither is reported (the root error is).
33
+ */
34
+ readonly namesComplete: boolean;
35
+ }
36
+ /** Index the loaded files by name; `missing` counts manifest entries whose file does not exist. */
37
+ export declare function indexWorkflowFiles(files: readonly LoadedWorkflowFile[], missing: number): WorkflowRegistryIndex;
38
+ /**
39
+ * Every loader diagnostic of file `i` (spec-003 § "Diagnostics"), in spec-003's order. A file that
40
+ * failed its structural pass contributes nothing here — its structural diagnostics are the loader's.
41
+ */
42
+ export declare function workflowFileDiagnostics(files: readonly LoadedWorkflowFile[], index: WorkflowRegistryIndex, i: number, bindings?: BindingsContext): Diagnostic[];
43
+ /**
44
+ * `E_NO_MAIN_WORKFLOW` (spec-003 Layer 1; `dl-109` Action 1): a present manifest whose loaded files
45
+ * hold no startable workflow. Not decided while some file is missing or unreadable (see
46
+ * {@link WorkflowRegistryIndex.namesComplete}) or failed its structural pass.
47
+ */
48
+ export declare function noStartableDiagnostic(files: readonly LoadedWorkflowFile[], index: WorkflowRegistryIndex): Diagnostic | null;
49
+ /** What the loader knows about `workflows/bindings.yaml` when it checks the workflow files' tokens. */
50
+ export interface BindingsContext {
51
+ /** The validated file, or `null` when there is none (or it failed its own checks). */
52
+ readonly bindings: BindingsYaml | null;
53
+ /**
54
+ * `false` when the file exists but failed its YAML or structural pass: a token may be bound by the
55
+ * part the loader could not read, so `W_WORKFLOW_UNBOUND_TOKEN` is not decided (spec-003: a loader
56
+ * diagnostic is not decided when its inputs are missing).
57
+ */
58
+ readonly decided: boolean;
59
+ }
60
+ /** An absent `bindings.yaml`: no bindings, and that is known (spec-003 Layer 3: "Optional"). */
61
+ export declare const NO_BINDINGS_FILE: BindingsContext;
62
+ /**
63
+ * The index of a **self-creating** workflow's creating phase (spec-003 Layer 2 `element`): a
64
+ * startable workflow with no `element` whose phases `memory.add` — the phase holding the first such
65
+ * action. `-1` for every other workflow.
66
+ */
67
+ export declare function creatingPhaseIndex(workflow: Workflow): number;
68
+ /**
69
+ * Whether the string `produces` entry `entry` of phase `p` has an **implicit owner** (`dl-104` D3,
70
+ * `W_PHASE_PRODUCES_OWNER_IMPLICIT`): a bare `{<field>}` token in a phase that also `memory.add`s,
71
+ * other than a self-creating workflow's creating phase. The loader warns on it; state deduction
72
+ * (task-198, `spec-017` §4.3) shows it and does not count it as evidence — one rule for both.
73
+ */
74
+ export declare function isImplicitOwnerProduces(workflow: Workflow, p: number, entry: string): boolean;
75
+ /**
76
+ * The loader rows of `workflows/bindings.yaml` (spec-003 Layer 3), on a structurally valid file:
77
+ * sections in a fixed order (`checks`, then `actions`, then `collections`), entries in declared order,
78
+ * and per entry the table's rows in table order — `E_BINDING_PARTIAL_INTERPOLATION` (per `run`
79
+ * element), `E_BINDING_BUILTIN_TOKEN`, `E_BINDING_AGENT_CHECK`; then `E_BINDING_COLLECTION_KEY` per
80
+ * collection entry (approver ruling D1 (a)).
81
+ */
82
+ export declare function bindingsFileDiagnostics(bindings: BindingsYaml): Diagnostic[];
83
+ //# sourceMappingURL=workflow-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-diagnostics.d.ts","sourceRoot":"","sources":["../../src/core/workflow-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAEL,YAAY,EAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKL,QAAQ,EAGT,MAAM,oBAAoB,CAAC;AAE5B,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACnC,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,mGAAmG;AACnG,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,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