wingfoil 0.2.2 → 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 (454) hide show
  1. package/README.md +83 -43
  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 +1 -1
  48. package/dist/cli/index.d.ts.map +1 -1
  49. package/dist/cli/index.js +2 -1
  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 +4 -2
  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 +162 -40
  65. package/dist/cli/program.js.map +1 -1
  66. package/dist/cli/registrar.d.ts +1 -1
  67. package/dist/cli/registrar.d.ts.map +1 -1
  68. package/dist/cli/registrar.js +67 -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.d.ts.map +1 -1
  137. package/dist/core/exit-code.js +6 -7
  138. package/dist/core/exit-code.js.map +1 -1
  139. package/dist/core/git-identity.d.ts +46 -11
  140. package/dist/core/git-identity.d.ts.map +1 -1
  141. package/dist/core/git-identity.js +140 -27
  142. package/dist/core/git-identity.js.map +1 -1
  143. package/dist/core/index.d.ts +184 -10
  144. package/dist/core/index.d.ts.map +1 -1
  145. package/dist/core/index.js +1045 -185
  146. package/dist/core/index.js.map +1 -1
  147. package/dist/core/init.d.ts +45 -5
  148. package/dist/core/init.d.ts.map +1 -1
  149. package/dist/core/init.js +134 -24
  150. package/dist/core/init.js.map +1 -1
  151. package/dist/core/loaders.d.ts +170 -14
  152. package/dist/core/loaders.d.ts.map +1 -1
  153. package/dist/core/loaders.js +570 -89
  154. package/dist/core/loaders.js.map +1 -1
  155. package/dist/core/memory-add-link.d.ts +28 -0
  156. package/dist/core/memory-add-link.d.ts.map +1 -0
  157. package/dist/core/memory-add-link.js +67 -0
  158. package/dist/core/memory-add-link.js.map +1 -0
  159. package/dist/core/memory-add-type.d.ts +25 -1
  160. package/dist/core/memory-add-type.d.ts.map +1 -1
  161. package/dist/core/memory-add-type.js +59 -1
  162. package/dist/core/memory-add-type.js.map +1 -1
  163. package/dist/core/memory-amend.d.ts +80 -0
  164. package/dist/core/memory-amend.d.ts.map +1 -0
  165. package/dist/core/memory-amend.js +160 -0
  166. package/dist/core/memory-amend.js.map +1 -0
  167. package/dist/core/memory-supersede.d.ts +28 -0
  168. package/dist/core/memory-supersede.d.ts.map +1 -0
  169. package/dist/core/memory-supersede.js +79 -0
  170. package/dist/core/memory-supersede.js.map +1 -0
  171. package/dist/core/memory-transition.d.ts +190 -30
  172. package/dist/core/memory-transition.d.ts.map +1 -1
  173. package/dist/core/memory-transition.js +480 -59
  174. package/dist/core/memory-transition.js.map +1 -1
  175. package/dist/core/registry.d.ts +82 -10
  176. package/dist/core/registry.d.ts.map +1 -1
  177. package/dist/core/registry.js +50 -0
  178. package/dist/core/registry.js.map +1 -1
  179. package/dist/core/relevance.d.ts +74 -12
  180. package/dist/core/relevance.d.ts.map +1 -1
  181. package/dist/core/relevance.js +45 -27
  182. package/dist/core/relevance.js.map +1 -1
  183. package/dist/core/require-reason.d.ts.map +1 -1
  184. package/dist/core/require-reason.js +6 -5
  185. package/dist/core/require-reason.js.map +1 -1
  186. package/dist/core/required-fields.d.ts +28 -0
  187. package/dist/core/required-fields.d.ts.map +1 -0
  188. package/dist/core/required-fields.js +60 -0
  189. package/dist/core/required-fields.js.map +1 -0
  190. package/dist/core/revision.d.ts +82 -0
  191. package/dist/core/revision.d.ts.map +1 -0
  192. package/dist/core/revision.js +144 -0
  193. package/dist/core/revision.js.map +1 -0
  194. package/dist/core/types.d.ts +28 -2
  195. package/dist/core/types.d.ts.map +1 -1
  196. package/dist/core/types.js +12 -3
  197. package/dist/core/types.js.map +1 -1
  198. package/dist/core/workflow-core-checks.d.ts +34 -0
  199. package/dist/core/workflow-core-checks.d.ts.map +1 -0
  200. package/dist/core/workflow-core-checks.js +403 -0
  201. package/dist/core/workflow-core-checks.js.map +1 -0
  202. package/dist/core/workflow-create-remove.d.ts +65 -0
  203. package/dist/core/workflow-create-remove.d.ts.map +1 -0
  204. package/dist/core/workflow-create-remove.js +277 -0
  205. package/dist/core/workflow-create-remove.js.map +1 -0
  206. package/dist/core/workflow-deduction.d.ts +48 -0
  207. package/dist/core/workflow-deduction.d.ts.map +1 -0
  208. package/dist/core/workflow-deduction.js +523 -0
  209. package/dist/core/workflow-deduction.js.map +1 -0
  210. package/dist/core/workflow-diagnostics.d.ts +83 -0
  211. package/dist/core/workflow-diagnostics.d.ts.map +1 -0
  212. package/dist/core/workflow-diagnostics.js +375 -0
  213. package/dist/core/workflow-diagnostics.js.map +1 -0
  214. package/dist/core/workflow-exit-state.d.ts +125 -0
  215. package/dist/core/workflow-exit-state.d.ts.map +1 -0
  216. package/dist/core/workflow-exit-state.js +243 -0
  217. package/dist/core/workflow-exit-state.js.map +1 -0
  218. package/dist/core/workflow-finalize.d.ts +37 -0
  219. package/dist/core/workflow-finalize.d.ts.map +1 -0
  220. package/dist/core/workflow-finalize.js +153 -0
  221. package/dist/core/workflow-finalize.js.map +1 -0
  222. package/dist/core/workflow-list-show.d.ts +176 -0
  223. package/dist/core/workflow-list-show.d.ts.map +1 -0
  224. package/dist/core/workflow-list-show.js +268 -0
  225. package/dist/core/workflow-list-show.js.map +1 -0
  226. package/dist/core/workflow-next.d.ts +268 -0
  227. package/dist/core/workflow-next.d.ts.map +1 -0
  228. package/dist/core/workflow-next.js +503 -0
  229. package/dist/core/workflow-next.js.map +1 -0
  230. package/dist/core/workflow-registry.d.ts +52 -0
  231. package/dist/core/workflow-registry.d.ts.map +1 -0
  232. package/dist/core/workflow-registry.js +158 -0
  233. package/dist/core/workflow-registry.js.map +1 -0
  234. package/dist/core/workflow-start-end.d.ts +71 -0
  235. package/dist/core/workflow-start-end.d.ts.map +1 -0
  236. package/dist/core/workflow-start-end.js +298 -0
  237. package/dist/core/workflow-start-end.js.map +1 -0
  238. package/dist/core/workflow-status.d.ts +83 -0
  239. package/dist/core/workflow-status.d.ts.map +1 -0
  240. package/dist/core/workflow-status.js +125 -0
  241. package/dist/core/workflow-status.js.map +1 -0
  242. package/dist/core/write-guard.d.ts +51 -8
  243. package/dist/core/write-guard.d.ts.map +1 -1
  244. package/dist/core/write-guard.js +139 -9
  245. package/dist/core/write-guard.js.map +1 -1
  246. package/dist/directives/index.d.ts +3 -2
  247. package/dist/directives/index.d.ts.map +1 -1
  248. package/dist/directives/index.js +5 -3
  249. package/dist/directives/index.js.map +1 -1
  250. package/dist/directives/schema.d.ts +34 -29
  251. package/dist/directives/schema.d.ts.map +1 -1
  252. package/dist/directives/schema.js +35 -29
  253. package/dist/directives/schema.js.map +1 -1
  254. package/dist/directives/version.d.ts +28 -0
  255. package/dist/directives/version.d.ts.map +1 -0
  256. package/dist/directives/version.js +51 -0
  257. package/dist/directives/version.js.map +1 -0
  258. package/dist/dna/edit.d.ts +7 -6
  259. package/dist/dna/edit.d.ts.map +1 -1
  260. package/dist/dna/edit.js +96 -41
  261. package/dist/dna/edit.js.map +1 -1
  262. package/dist/dna/mutate.js +18 -3
  263. package/dist/dna/mutate.js.map +1 -1
  264. package/dist/dna/path.d.ts +2 -2
  265. package/dist/dna/roles.d.ts +1 -1
  266. package/dist/dna/schema.d.ts +61 -3
  267. package/dist/dna/schema.d.ts.map +1 -1
  268. package/dist/dna/schema.js +121 -6
  269. package/dist/dna/schema.js.map +1 -1
  270. package/dist/mcp/dna-resource.d.ts.map +1 -1
  271. package/dist/mcp/dna-resource.js +4 -4
  272. package/dist/mcp/dna-resource.js.map +1 -1
  273. package/dist/mcp/index.d.ts +8 -4
  274. package/dist/mcp/index.d.ts.map +1 -1
  275. package/dist/mcp/index.js +13 -2
  276. package/dist/mcp/index.js.map +1 -1
  277. package/dist/mcp/memory-resource.d.ts.map +1 -1
  278. package/dist/mcp/memory-resource.js +30 -19
  279. package/dist/mcp/memory-resource.js.map +1 -1
  280. package/dist/mcp/prompt.d.ts +61 -24
  281. package/dist/mcp/prompt.d.ts.map +1 -1
  282. package/dist/mcp/prompt.js +176 -47
  283. package/dist/mcp/prompt.js.map +1 -1
  284. package/dist/mcp/read-only.d.ts +39 -0
  285. package/dist/mcp/read-only.d.ts.map +1 -1
  286. package/dist/mcp/read-only.js +61 -0
  287. package/dist/mcp/read-only.js.map +1 -1
  288. package/dist/mcp/registrar.d.ts +10 -0
  289. package/dist/mcp/registrar.d.ts.map +1 -1
  290. package/dist/mcp/registrar.js +48 -12
  291. package/dist/mcp/registrar.js.map +1 -1
  292. package/dist/mcp/server.d.ts +21 -14
  293. package/dist/mcp/server.d.ts.map +1 -1
  294. package/dist/mcp/server.js +41 -15
  295. package/dist/mcp/server.js.map +1 -1
  296. package/dist/mcp/session-resource.d.ts +13 -0
  297. package/dist/mcp/session-resource.d.ts.map +1 -0
  298. package/dist/mcp/session-resource.js +65 -0
  299. package/dist/mcp/session-resource.js.map +1 -0
  300. package/dist/mcp/workflow-resource.d.ts +18 -0
  301. package/dist/mcp/workflow-resource.d.ts.map +1 -1
  302. package/dist/mcp/workflow-resource.js +37 -8
  303. package/dist/mcp/workflow-resource.js.map +1 -1
  304. package/dist/memory/add.d.ts +110 -24
  305. package/dist/memory/add.d.ts.map +1 -1
  306. package/dist/memory/add.js +251 -64
  307. package/dist/memory/add.js.map +1 -1
  308. package/dist/memory/audit.d.ts +152 -39
  309. package/dist/memory/audit.d.ts.map +1 -1
  310. package/dist/memory/audit.js +257 -103
  311. package/dist/memory/audit.js.map +1 -1
  312. package/dist/memory/commit-message.d.ts +60 -38
  313. package/dist/memory/commit-message.d.ts.map +1 -1
  314. package/dist/memory/commit-message.js +167 -21
  315. package/dist/memory/commit-message.js.map +1 -1
  316. package/dist/memory/entry.d.ts.map +1 -1
  317. package/dist/memory/entry.js +1 -2
  318. package/dist/memory/entry.js.map +1 -1
  319. package/dist/memory/frontmatter-edit.d.ts +16 -4
  320. package/dist/memory/frontmatter-edit.d.ts.map +1 -1
  321. package/dist/memory/frontmatter-edit.js +13 -1
  322. package/dist/memory/frontmatter-edit.js.map +1 -1
  323. package/dist/memory/git-log.d.ts +18 -6
  324. package/dist/memory/git-log.d.ts.map +1 -1
  325. package/dist/memory/git-log.js +40 -13
  326. package/dist/memory/git-log.js.map +1 -1
  327. package/dist/memory/history.d.ts +73 -12
  328. package/dist/memory/history.d.ts.map +1 -1
  329. package/dist/memory/history.js +128 -44
  330. package/dist/memory/history.js.map +1 -1
  331. package/dist/memory/index.d.ts +13 -11
  332. package/dist/memory/index.d.ts.map +1 -1
  333. package/dist/memory/index.js +34 -3
  334. package/dist/memory/index.js.map +1 -1
  335. package/dist/memory/query.d.ts +161 -19
  336. package/dist/memory/query.d.ts.map +1 -1
  337. package/dist/memory/query.js +435 -55
  338. package/dist/memory/query.js.map +1 -1
  339. package/dist/memory/schema.d.ts +52 -3
  340. package/dist/memory/schema.d.ts.map +1 -1
  341. package/dist/memory/schema.js +132 -8
  342. package/dist/memory/schema.js.map +1 -1
  343. package/dist/memory/state-machine.d.ts +65 -10
  344. package/dist/memory/state-machine.d.ts.map +1 -1
  345. package/dist/memory/state-machine.js +134 -46
  346. package/dist/memory/state-machine.js.map +1 -1
  347. package/dist/memory/submit.d.ts +52 -3
  348. package/dist/memory/submit.d.ts.map +1 -1
  349. package/dist/memory/submit.js +118 -11
  350. package/dist/memory/submit.js.map +1 -1
  351. package/dist/storage/build-stamp.d.ts +18 -0
  352. package/dist/storage/build-stamp.d.ts.map +1 -0
  353. package/dist/storage/build-stamp.js +68 -0
  354. package/dist/storage/build-stamp.js.map +1 -0
  355. package/dist/storage/builtin-adapters.d.ts +32 -0
  356. package/dist/storage/builtin-adapters.d.ts.map +1 -0
  357. package/dist/storage/builtin-adapters.js +100 -0
  358. package/dist/storage/builtin-adapters.js.map +1 -0
  359. package/dist/storage/builtin-directives.d.ts +0 -29
  360. package/dist/storage/builtin-directives.d.ts.map +1 -1
  361. package/dist/storage/builtin-directives.js +9 -4
  362. package/dist/storage/builtin-directives.js.map +1 -1
  363. package/dist/storage/commit.d.ts +310 -3
  364. package/dist/storage/commit.d.ts.map +1 -1
  365. package/dist/storage/commit.js +807 -33
  366. package/dist/storage/commit.js.map +1 -1
  367. package/dist/storage/document.d.ts +6 -0
  368. package/dist/storage/document.d.ts.map +1 -1
  369. package/dist/storage/document.js +10 -1
  370. package/dist/storage/document.js.map +1 -1
  371. package/dist/storage/dry-run.d.ts +65 -0
  372. package/dist/storage/dry-run.d.ts.map +1 -0
  373. package/dist/storage/dry-run.js +150 -0
  374. package/dist/storage/dry-run.js.map +1 -0
  375. package/dist/storage/errors.d.ts +26 -0
  376. package/dist/storage/errors.d.ts.map +1 -1
  377. package/dist/storage/errors.js +27 -1
  378. package/dist/storage/errors.js.map +1 -1
  379. package/dist/storage/frontmatter.d.ts +1 -1
  380. package/dist/storage/frontmatter.js +1 -1
  381. package/dist/storage/git-read.d.ts +64 -0
  382. package/dist/storage/git-read.d.ts.map +1 -0
  383. package/dist/storage/git-read.js +107 -0
  384. package/dist/storage/git-read.js.map +1 -0
  385. package/dist/storage/index.d.ts +13 -5
  386. package/dist/storage/index.d.ts.map +1 -1
  387. package/dist/storage/index.js +39 -2
  388. package/dist/storage/index.js.map +1 -1
  389. package/dist/storage/layout.d.ts +2 -2
  390. package/dist/storage/layout.d.ts.map +1 -1
  391. package/dist/storage/layout.js +2 -7
  392. package/dist/storage/layout.js.map +1 -1
  393. package/dist/storage/memory-path.d.ts +18 -5
  394. package/dist/storage/memory-path.d.ts.map +1 -1
  395. package/dist/storage/memory-path.js +41 -5
  396. package/dist/storage/memory-path.js.map +1 -1
  397. package/dist/storage/snapshot.js +1 -1
  398. package/dist/storage/templates.d.ts +33 -6
  399. package/dist/storage/templates.d.ts.map +1 -1
  400. package/dist/storage/templates.js +170 -16
  401. package/dist/storage/templates.js.map +1 -1
  402. package/dist/validation/config-version.d.ts +19 -0
  403. package/dist/validation/config-version.d.ts.map +1 -0
  404. package/dist/validation/config-version.js +53 -0
  405. package/dist/validation/config-version.js.map +1 -0
  406. package/dist/validation/diagnostic.d.ts +40 -0
  407. package/dist/validation/diagnostic.d.ts.map +1 -0
  408. package/dist/validation/diagnostic.js +41 -0
  409. package/dist/validation/diagnostic.js.map +1 -0
  410. package/dist/validation/format.d.ts +74 -0
  411. package/dist/validation/format.d.ts.map +1 -0
  412. package/dist/validation/format.js +104 -0
  413. package/dist/validation/format.js.map +1 -0
  414. package/dist/validation/id.d.ts +14 -0
  415. package/dist/validation/id.d.ts.map +1 -1
  416. package/dist/validation/id.js +35 -11
  417. package/dist/validation/id.js.map +1 -1
  418. package/dist/validation/identity.d.ts +40 -0
  419. package/dist/validation/identity.d.ts.map +1 -0
  420. package/dist/validation/identity.js +78 -0
  421. package/dist/validation/identity.js.map +1 -0
  422. package/dist/validation/index.d.ts +9 -3
  423. package/dist/validation/index.d.ts.map +1 -1
  424. package/dist/validation/index.js +30 -1
  425. package/dist/validation/index.js.map +1 -1
  426. package/dist/validation/secret-scan.d.ts +3 -2
  427. package/dist/validation/secret-scan.d.ts.map +1 -1
  428. package/dist/validation/secret-scan.js +32 -11
  429. package/dist/validation/secret-scan.js.map +1 -1
  430. package/dist/validation/warning.d.ts +30 -16
  431. package/dist/validation/warning.d.ts.map +1 -1
  432. package/dist/validation/warning.js +74 -7
  433. package/dist/validation/warning.js.map +1 -1
  434. package/dist/workflow/bindings.d.ts +152 -0
  435. package/dist/workflow/bindings.d.ts.map +1 -0
  436. package/dist/workflow/bindings.js +249 -0
  437. package/dist/workflow/bindings.js.map +1 -0
  438. package/dist/workflow/create.d.ts +13 -0
  439. package/dist/workflow/create.d.ts.map +1 -0
  440. package/dist/workflow/create.js +41 -0
  441. package/dist/workflow/create.js.map +1 -0
  442. package/dist/workflow/deduce.d.ts +400 -0
  443. package/dist/workflow/deduce.d.ts.map +1 -0
  444. package/dist/workflow/deduce.js +1109 -0
  445. package/dist/workflow/deduce.js.map +1 -0
  446. package/dist/workflow/manifest-edit.d.ts +19 -0
  447. package/dist/workflow/manifest-edit.d.ts.map +1 -0
  448. package/dist/workflow/manifest-edit.js +124 -0
  449. package/dist/workflow/manifest-edit.js.map +1 -0
  450. package/dist/workflow/schema.d.ts +158 -19
  451. package/dist/workflow/schema.d.ts.map +1 -1
  452. package/dist/workflow/schema.js +163 -15
  453. package/dist/workflow/schema.js.map +1 -1
  454. package/package.json +18 -8
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUPERSEDES_FIELD = void 0;
4
+ exports.prepareSupersede = prepareSupersede;
5
+ exports.supersedeReason = supersedeReason;
6
+ /**
7
+ * The `supersedes:` engine trigger (task-162; `dl-065` Q1.1; `spec-001` § `StateMachine`, `spec-010`
8
+ * § Field-write ownership, `spec-008` §2's `finalize` row).
9
+ *
10
+ * `superseded` is the last state of the `adr` and `tech-spec` machines, behind a `waiting` state, so
11
+ * no verb drives the edge into it. It fires when an element whose `supersedes:` names another element
12
+ * of its type is **approved into** that `waiting` state: `memory approve adr-B` (`pending → accepted`)
13
+ * moves the `adr-A` that `adr-B`'s `supersedes:` names `accepted → superseded`.
14
+ *
15
+ * The move is its own commit, because `memory history` reads a document's record by its path: one
16
+ * commit moving both documents under the `approve` subject would put an approval, with the approver's
17
+ * identity and the wrong bracket, into `adr-A`'s history. The engine-driven `set_state` into the last
18
+ * state of a `sequence` emits `finalize` (`spec-008` §2), so the commit is
19
+ * `wf({type}): finalize {A} [{state} → superseded]`, with no `Approver:` line (the decision is the
20
+ * approve's) and a `Reason:` that names the superseding element and cites the approve commit.
21
+ *
22
+ * The decision is taken at `HEAD`, at the same sha the approve was decided at: the `supersedes:` value
23
+ * as that commit records it, the named element's type and `status` as that commit records them
24
+ * (task-247, `command-baseline` 1.4). Every refusal is returned before either commit is written.
25
+ */
26
+ const memory_1 = require("../memory");
27
+ const memory_transition_1 = require("./memory-transition");
28
+ const types_1 = require("./types");
29
+ /** The frontmatter field that names the element an approval supersedes (`spec-010`). */
30
+ exports.SUPERSEDES_FIELD = 'supersedes';
31
+ /**
32
+ * Resolve the `supersedes:` trigger for an approval already prepared and authorized: `null` when it
33
+ * does not fire, the superseded element's prepared transition when it does, or a refusal.
34
+ *
35
+ * It fires only when the approve's target is a `waiting` state whose forward edge leads to
36
+ * `superseded` ({@link supersedesEdgeFrom}) and the approved element's committed `supersedes:` is a
37
+ * non-empty string. On any other approval the field is not read: a type without that edge has nothing
38
+ * for it to trigger. Refusals (exit `1`), each worded `cannot approve <B>: its supersedes: field names
39
+ * …`:
40
+ *
41
+ * - a value that is not a string → `VALIDATION`;
42
+ * - no element at `HEAD` carries that id → `NOT_FOUND`;
43
+ * - an element of another type → `VALIDATION`;
44
+ * - an element not in the approve's target state, the approved element itself included (it is in its
45
+ * gate state at `HEAD`) → `INVALID_TRANSITION`, `illegal transition <s> -> superseded for type '<t>'`;
46
+ * - every working-tree refusal a transition target meets (`prepareMemoryTransitionAtRev`).
47
+ *
48
+ * The caller still runs `checkMemoryTransition` on the result before writing anything, which adds the
49
+ * unmodified-document and confinement guards.
50
+ */
51
+ function prepareSupersede(root, approved) {
52
+ const machine = (0, memory_1.resolveStateMachine)(approved.memoryYaml, approved.type);
53
+ if (!(0, memory_1.supersedesEdgeFrom)(machine, approved.to))
54
+ return (0, types_1.coreOk)(null);
55
+ const value = approved.committedFrontmatter[exports.SUPERSEDES_FIELD];
56
+ if (value === undefined || value === null || (typeof value === 'string' && value.trim() === ''))
57
+ return (0, types_1.coreOk)(null);
58
+ const prefix = `cannot approve ${approved.id}: its ${exports.SUPERSEDES_FIELD}: field names `;
59
+ if (typeof value !== 'string') {
60
+ return (0, types_1.coreErr)({
61
+ code: 'VALIDATION',
62
+ message: `${prefix}${JSON.stringify(value)}, but it must be a single element id (a string)`,
63
+ });
64
+ }
65
+ const target = value.trim();
66
+ const prepared = (0, memory_transition_1.prepareMemoryTransitionAtRev)(root, approved.sha, approved.memoryYaml, target, 'supersede', approved.type);
67
+ if (!prepared.ok) {
68
+ const message = prepared.error.message.startsWith(`${target},`)
69
+ ? `${prefix}${prepared.error.message}`
70
+ : `${prefix}${target}, which cannot be superseded: ${prepared.error.message}`;
71
+ return (0, types_1.coreErr)({ ...prepared.error, message });
72
+ }
73
+ return (0, types_1.coreOk)({ ...prepared.value, identity: approved.identity });
74
+ }
75
+ /** The `Reason:` of the trigger's `finalize` commit: what superseded the element, and where it was approved. */
76
+ function supersedeReason(approvedId, approveSha) {
77
+ return `superseded by ${approvedId} (its ${exports.SUPERSEDES_FIELD}: field), approved in ${approveSha}.`;
78
+ }
79
+ //# sourceMappingURL=memory-supersede.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-supersede.js","sourceRoot":"","sources":["../../src/core/memory-supersede.ts"],"names":[],"mappings":";;;AAgDA,4CA0BC;AAGD,0CAEC;AA/ED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sCAAoE;AAEpE,2DAA+F;AAC/F,mCAA2D;AAE3D,wFAAwF;AAC3E,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,gBAAgB,CAC9B,IAAY,EACZ,QAA+B;IAE/B,MAAM,OAAO,GAAG,IAAA,4BAAmB,EAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxE,IAAI,CAAC,IAAA,2BAAkB,EAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAEnE,MAAM,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,wBAAgB,CAAC,CAAC;IAC9D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAAE,OAAO,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAErH,MAAM,MAAM,GAAG,kBAAkB,QAAQ,CAAC,EAAE,SAAS,wBAAgB,gBAAgB,CAAC;IACtF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAA,eAAO,EAAC;YACb,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iDAAiD;SAC5F,CAAC,CAAC;IACL,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,IAAA,gDAA4B,EAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3H,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC;YAC7D,CAAC,CAAC,GAAG,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE;YACtC,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,iCAAiC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAChF,OAAO,IAAA,eAAO,EAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,IAAA,cAAM,EAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,gHAAgH;AAChH,SAAgB,eAAe,CAAC,UAAkB,EAAE,UAAkB;IACpE,OAAO,iBAAiB,UAAU,SAAS,wBAAgB,yBAAyB,UAAU,GAAG,CAAC;AACpG,CAAC"}
@@ -1,4 +1,6 @@
1
- import type { DocumentScope, MemoryYaml, TransitionOp } from '../memory';
1
+ import type { DocumentScope, MemoryYaml, StateMachine, TransitionOp } from '../memory';
2
+ import { type Diagnostic } from '../validation';
3
+ import { type GitIdentity } from './git-identity';
2
4
  import { type CoreResult } from './types';
3
5
  /** A document located and cleared for one transition — everything the verb needs to finish it. */
4
6
  export interface PreparedMemoryTransition {
@@ -14,41 +16,182 @@ export interface PreparedMemoryTransition {
14
16
  readonly type: string;
15
17
  /** Root-relative POSIX path of the document. */
16
18
  readonly path: string;
17
- /** The document's parsed frontmatter as read (not schema-validated). */
19
+ /**
20
+ * The document's parsed frontmatter **in the working tree** (not schema-validated) — the content a
21
+ * verb checks and commits. Its `id` and `type` equal `HEAD`'s; its `status` may not, and never
22
+ * decides anything: `from` is the committed one (task-247).
23
+ */
18
24
  readonly frontmatter: Readonly<Record<string, unknown>>;
19
- /** The full current file content, the base for the verb's edit. */
25
+ /** The full working-tree file content, the base for the verb's edit. */
20
26
  readonly content: string;
21
27
  readonly from: string;
22
28
  readonly to: string;
29
+ /**
30
+ * The commit `HEAD` resolved to when this transition was decided — the one sha the machine, the
31
+ * document and `from` were read at. A follow-up decision in the same command (the `supersedes:`
32
+ * trigger, task-162) reads at this sha too, so the two cannot come from two commits.
33
+ */
34
+ readonly sha: string;
35
+ /**
36
+ * The document's frontmatter **as `HEAD` records it** — the copy a decision reads (task-247,
37
+ * `command-baseline` 1.4), where {@link frontmatter} is the working tree's content to commit.
38
+ */
39
+ readonly committedFrontmatter: Readonly<Record<string, unknown>>;
40
+ /**
41
+ * The committed documents the lookup could not read on its way to this one (task-171, `bug-031`), as
42
+ * `W_MEMORY_UNREADABLE` warning lines (`formatDiagnostic`). A verb's success carries them.
43
+ */
44
+ readonly warnings: readonly string[];
23
45
  }
24
46
  /**
25
- * Locate document `id` and resolve verb `op` on it, **against the `memory.yaml` committed at
26
- * `HEAD`** (`loadMemoryYamlAtHead`).
47
+ * What a transition is resolved for: a verb, `amend` (the self-loop of the current state, task-127),
48
+ * or `supersede` — the `supersedes:` engine trigger, which is not a verb and whose only target is
49
+ * `superseded` (`resolveSupersedeTarget`, task-162).; or `finalize` — the forward `waiting` edge no verb drives,
50
+ * which `workflow end` takes to close a plan, `active → done` (`resolveWaitingTarget`, task-217).
51
+ */
52
+ export type TransitionResolution = TransitionOp | 'amend' | 'supersede' | 'finalize';
53
+ /**
54
+ * Locate document `id` and resolve verb `op` on it, **at `HEAD`**: the `memory.yaml`, the document
55
+ * the id names and its current `status` are all read from the one commit `HEAD` resolves to, once
56
+ * (`resolveRevision`, then `loadMemoryYamlAtRev` and `findMemoryDocumentByIdAtRev` at that sha).
57
+ *
58
+ * The baseline is the point (`spec-006-core-domain-api` §6 item 1, `dl-080` option (B)). This
59
+ * function takes no `MemoryYaml` and no document: a caller cannot hand it a working-tree machine or a
60
+ * working-tree `status` even by accident. Two defects motivated it. An uncommitted edit to a type's
61
+ * `sequence` used to decide the transition a verb performed (task-091, `bug-081`); and until task-247
62
+ * (`bug-187`) the id was looked up by scanning the working tree and `from` was the working-tree
63
+ * frontmatter's `status`, so an element already past `draft` at `HEAD` but edited back to `draft` on
64
+ * disk was submitted again, and a hand-made document no commit holds was transitioned as if `memory
65
+ * add` had registered it.
27
66
  *
28
- * The baseline is the point (task-091, `bug-081`, `dl-080` option (B)). This function takes no
29
- * `MemoryYaml`: a caller cannot hand it a working-tree machine even by accident, which is what makes
30
- * the committed baseline a property of the read itself rather than of a precondition someone must
31
- * remember to run. An uncommitted edit to a type's `sequence` used to decide both the transition a
32
- * verb performed and the `status` it committed — through `memory submit`, which requires no
33
- * authority — and stranded the element in a state the committed machine rejects.
67
+ * **Content from the working tree, state from `HEAD`.** The `content` and `frontmatter` this returns
68
+ * are the working tree's, because that is what `memory submit` and `memory amend` commit; `from`, the
69
+ * `type` and the target are `HEAD`'s. The working tree must still carry the same `id` and `type` the
70
+ * commit records — a verb decides on one element and writes that element.
34
71
  *
35
72
  * Refusals, all returned (never thrown) and all exit `1`:
36
73
  *
37
- * - `HEAD` holds no `memory.yaml` → `VALIDATION`, fail-closed: with no committed machine there is no
38
- * `from → to` to record, and the only fail-open available is the working tree, which is the defect.
39
- * `wingfoil init` commits the scaffold, so no legitimate flow reaches this;
74
+ * - `HEAD` holds no `memory.yaml` (or there is no commit) → `VALIDATION`, fail-closed: with no
75
+ * committed machine there is no `from → to` to record, and the only fail-open available is the
76
+ * working tree, which is the defect. `wingfoil init` commits the scaffold, so no legitimate flow
77
+ * reaches this;
40
78
  * - the committed `memory.yaml` does not parse or validate → `VALIDATION`, same reasoning;
41
- * - no document carries that frontmatter `id` → `NOT_FOUND` `document not found: <id>` (P1.6 sc.3);
79
+ * - no document at `HEAD` carries that frontmatter `id` → `NOT_FOUND` `document not found: <id>`
80
+ * (P1.6 sc.3); when a working-tree document carries it, the message says so and names `memory add`
81
+ * (task-247), since a transition acts only on an element a commit records — or, when `HEAD` holds
82
+ * that path under another id, `VALIDATION` naming the renamed `id` field;
83
+ * - `HEAD` holds the document but the working tree deleted it → `VALIDATION`, naming the path;
84
+ * - the working tree changes the document's `id` or `type` → `VALIDATION`;
42
85
  * - its `type` is not registered → `NOT_FOUND` with `memory add`'s unknown-type message;
43
- * - its `status` is not a state of the type → `VALIDATION` `invalid state '<s>' for type '<t>'`
44
- * (task-036's `validateFrontmatterState`);
86
+ * - its committed `status` is not a state of the type → `VALIDATION` `invalid state '<s>' for type
87
+ * '<t>'` (task-036's `validateFrontmatterState`);
45
88
  * - the verb is illegal from that state → `INVALID_TRANSITION` with the `dl-032` contract message
46
- * (`resolveTypeTransition`), the engine's explanation in `details.issues[0].detail`.
89
+ * (`resolveTypeTransition`), the engine's explanation in `details.issues[0].detail`. `amend`
90
+ * (task-127) never takes this branch: its target is the current state.
91
+ * - the document, as `HEAD` records it or as the working tree would have it committed, declares a
92
+ * `format` newer than this build reads → `VALIDATION` with the `dl-149` `E_INVALID_FORMAT` text, the
93
+ * file named (task-257, `bug-241`);
94
+ * - the target state declares a WIP limit its holders have reached → `CONFLICT`
95
+ * ({@link requireWipSlot}, task-180), the holders counted across every ref (task-274). Every
96
+ * transition into a state goes through here, so the limit holds whichever verb or engine action
97
+ * moves the element — except `reject` and `park`, which send it back along a reject or `returns`
98
+ * edge and are exempt (`dl-156` Q2 (i)).
99
+ *
100
+ * The unknown-type, invalid-state and illegal-transition refusals keep their pinned messages
101
+ * verbatim as the first sentence; {@link uncommittedMachineNote} may append a second one.
102
+ */
103
+ export declare function prepareMemoryTransition(root: string, id: string, op: TransitionOp | 'amend' | 'finalize'): CoreResult<PreparedMemoryTransition>;
104
+ /**
105
+ * The body of {@link prepareMemoryTransition}, at a sha and a committed `memory.yaml` the caller has
106
+ * already resolved: locate document `id` at `sha`, check the working tree carries the same element,
107
+ * and resolve `op` on its committed `status`. Every refusal {@link prepareMemoryTransition} documents
108
+ * past the `memory.yaml` read comes from here, unchanged.
47
109
  *
48
- * The last four keep their pinned messages verbatim as the first sentence;
49
- * {@link uncommittedMachineNote} may append a second one.
110
+ * It exists so that a second decision in one command reads the same commit as the first: the
111
+ * `supersedes:` trigger (task-162) prepares the superseded element at the sha its superseding
112
+ * element's approve was decided at, with `op` `supersede`. With `expectedType`, a document of another
113
+ * type is refused (`VALIDATION`) before its own machine is consulted, since the caller's rule is about
114
+ * the type, not about that machine's states.
50
115
  */
51
- export declare function prepareMemoryTransition(root: string, id: string, op: TransitionOp): CoreResult<PreparedMemoryTransition>;
116
+ export declare function prepareMemoryTransitionAtRev(root: string, sha: string, memoryYaml: MemoryYaml, id: string, op: TransitionResolution, expectedType?: string): CoreResult<PreparedMemoryTransition>;
117
+ /**
118
+ * The sentence every WIP refusal ends with (`dl-156` Q1 (a), task-274): where the holders were counted,
119
+ * that a clone sees only the refs it has fetched, and where a holder recorded elsewhere is moved out.
120
+ */
121
+ export declare const WIP_REFS_SENTENCE: string;
122
+ /**
123
+ * Refuse to move an element into `state` when the type's machine declares a WIP limit there
124
+ * (`limits: { <state>: N }`, `spec-001`, `dl-110` P3 (a), task-180) and N elements of the type already
125
+ * hold it — `CONFLICT`, exit `1`, naming every holder in path order, before anything is written.
126
+ *
127
+ * The one shared check: {@link prepareMemoryTransitionAtRev} calls it for every transition into a new
128
+ * state except along a reject or `returns` edge (`submit`, `approve`, the `supersedes:` trigger, and
129
+ * any workflow emitter that prepares its transition there — not `reject` nor `park`, `dl-156` Q2 (i)),
130
+ * and `memory add` calls it for the initial state, since `add` is the verb that enters that state.
131
+ *
132
+ * **Where the holders are counted** (`dl-156` Q1 (a), task-274, as the approver ruled on 2026-10-11 at
133
+ * its review, option (a)): each element of the type counts in one state —
134
+ *
135
+ * - the state a ref records, when that ref **changed** the element since its merge-base with commit
136
+ * `sha` (the one the transition is decided at, `dl-080`): its `status` differs from the merge-base
137
+ * copy's, or the merge-base has no copy (an element added on the ref; a ref sharing no history with
138
+ * `sha` counts every copy it holds). The refs are those {@link refBaselineCommits} lists for
139
+ * `memory add`'s id counter (`dl-101` §2 (a)); a ref that is an ancestor of `sha` changed nothing.
140
+ * When several refs changed it, the most advanced of their copies wins
141
+ * ({@link isMoreAdvancedState}), the decided commit's copy not competing;
142
+ * - otherwise the state commit `sha` records.
143
+ *
144
+ * So a stale branch does not keep a parked holder counted, and an older copy elsewhere does not hide an
145
+ * element a reject moved back into the state. "Changed" compares `status`, not bytes: an edit that
146
+ * leaves the status alone (Execution Notes, an amend) is not a move. `exceptId`, the element being
147
+ * moved, is never its own holder. The refusal ends with {@link WIP_REFS_SENTENCE}. This read is wider
148
+ * than `HEAD`, which the `command-baseline` directive declares by name.
149
+ *
150
+ * Only the type's directory is read, every commit's listing and every distinct blob in one batch each,
151
+ * each blob parsed once (`loadTypeDocumentCopiesAtRevs`; task-274 review F2, the `bug-178` class);
152
+ * one `git merge-base` per ref. A document none of those reads can parse is not counted (task-171's
153
+ * tolerant scan) and is returned as a `W_MEMORY_UNREADABLE` diagnostic, once per file, which the
154
+ * caller's success carries as a warning and a refusal carries in `details.issues`, so a limit that may
155
+ * be undercounted says so. Without a declared limit nothing is read and nothing is returned.
156
+ */
157
+ export declare function requireWipSlot(root: string, sha: string, memoryYaml: MemoryYaml, type: string, state: string, exceptId?: string): CoreResult<readonly Diagnostic[]>;
158
+ /**
159
+ * Whether state `a` is further along `machine` than state `b` — the rule that picks the one state an
160
+ * element counts in when the refs disagree (`dl-156` Q1 (a): "the most advanced state wins"). A
161
+ * `sequence` state ranks by its position; a state outside `sequence` (an off-chain `gates` reject
162
+ * target, `deprecated`, or a value the machine does not declare) ranks after every `sequence` state,
163
+ * since the element has left the chain, and `deprecated` ranks last of all. Equal ranks are ordered by
164
+ * name, so the answer never depends on the order the commits were read in (REQ-SYS-07). Pure.
165
+ */
166
+ export declare function isMoreAdvancedState(machine: StateMachine, a: string, b: string): boolean;
167
+ /**
168
+ * A {@link PreparedMemoryTransition} together with the git identity that will carry it out — the
169
+ * result of {@link beginMemoryTransition}, and the only thing {@link commitMemoryTransition} accepts,
170
+ * so a transition cannot be committed under an identity other than the one its pre-flight checked.
171
+ */
172
+ export interface BegunMemoryTransition extends PreparedMemoryTransition {
173
+ /**
174
+ * The identity `requireGitIdentity` resolved and validated (REQ-SEC-01). The one "who" of the whole
175
+ * operation: the authority check takes it (REQ-SEC-03), the `Approver:` line is built from it, and
176
+ * {@link commitMemoryTransition} pins it as the commit's `--author` (`dl-064` B.1, task-132,
177
+ * `bug-149`).
178
+ */
179
+ readonly identity: GitIdentity;
180
+ }
181
+ /**
182
+ * The shared preamble of every state-moving `memory` verb — `submit`, `approve`, `reject`,
183
+ * `deprecate`, `amend` — written once (task-132, `bug-142`): resolve the git identity
184
+ * (`requireGitIdentity`, REQ-SEC-01, exit `1`), then locate the document and resolve verb `op` on it
185
+ * ({@link prepareMemoryTransition}, exit `1`). The first refusal is returned unchanged; nothing is
186
+ * written either way.
187
+ *
188
+ * The identity is read here ONCE and rides the result, so no verb reads it again (the structural test
189
+ * `test/core/memory-transition-preamble.test.ts` holds every registered transition verb to that).
190
+ * The order matches `spec-006` §7: a verb's usage checks run before it calls this (task-125,
191
+ * `bug-172`), and an approver-gated verb's authority check runs after it, because that check's
192
+ * message names the document's type, which only this step knows.
193
+ */
194
+ export declare function beginMemoryTransition(root: string, id: string, op: TransitionOp | 'amend' | 'finalize'): CoreResult<BegunMemoryTransition>;
52
195
  /**
53
196
  * Verify what the new commit **contains**, by diffing it against its own parent (task-088, AC3).
54
197
  *
@@ -62,11 +205,23 @@ export declare function prepareMemoryTransition(root: string, id: string, op: Tr
62
205
  * {@link requireUnmodifiedDocument} in place it should be unreachable, which is the point.
63
206
  */
64
207
  export declare function verifyCommittedScope(root: string, sha: string, path: string, expected: Readonly<Record<string, string | undefined>>, scope: DocumentScope): string[];
208
+ /**
209
+ * The pre-write half of {@link commitMemoryTransition} — its checks 1 to 3 (confinement, an
210
+ * unmodified working tree under `declared-fields-only` or no divergent stage under
211
+ * `carries-content`, and the rendering's post-condition), with nothing written. A command that makes
212
+ * more than one commit runs it on every document first, so a refusal of any of them leaves the
213
+ * repository as it was (the `supersedes:` trigger, task-162). {@link commitMemoryTransition} runs it
214
+ * again before its own write, so calling it first is never required for safety.
215
+ */
216
+ export declare function checkMemoryTransition(root: string, prepared: PreparedMemoryTransition, content: string, expected?: Readonly<Record<string, string | undefined>>, scope?: DocumentScope): CoreResult<undefined>;
65
217
  /**
66
218
  * Write `content` over the prepared document and commit exactly that one path with `message`,
67
219
  * returning the new commit's sha (`commitPaths`, task-018; scoped to that path even when other changes
68
- * are staged, bug-027). Callers must have run the git-identity pre-flight (REQ-SEC-01) and every refusal
69
- * check first; this step is the only write.
220
+ * are staged, bug-027). The commit's author is pinned to `prepared.identity` — the identity the
221
+ * pre-flight checked, and the one any `Approver:` line names — so git's own author resolution cannot
222
+ * substitute another (task-132, `bug-149`). `prepared` comes from {@link beginMemoryTransition}, which
223
+ * is how the git-identity pre-flight (REQ-SEC-01) is guaranteed to have run; callers run every other
224
+ * refusal check first, and this step is the only write.
70
225
  *
71
226
  * Four checks bound what reaches the repository, in this order — they are not redundant, they catch
72
227
  * different defects:
@@ -85,7 +240,10 @@ export declare function verifyCommittedScope(root: string, sha: string, path: st
85
240
  * --porcelain` reports a path beyond a symbolic link as clean, which is `bug-118`).
86
241
  * 2. **The working tree is unmodified** ({@link requireUnmodifiedDocument}, `declared-fields-only`
87
242
  * only) — catches a wrong *baseline*: content that was already on disk before the verb ran
88
- * (`bug-076`).
243
+ * (`bug-076`). Under `carries-content` the working tree IS the content, so the check narrows to
244
+ * `requireNoDivergentStage`: a staged version differing from both `HEAD` and the working tree,
245
+ * which `git add` would silently discard, is refused (task-131, `bug-182`). Both shapes first
246
+ * refuse a document behind a symlinked directory, which git cannot report on (`bug-118`).
89
247
  * 3. **The rendering is in scope** ({@link verifyDocumentEdit} against the prepared document) —
90
248
  * catches a defect in the *editor*: `status` must be the prepared target, every field in `expected`
91
249
  * must have its value (`undefined` = absent), and no other field and no byte of the body may have
@@ -98,14 +256,16 @@ export declare function verifyCommittedScope(root: string, sha: string, path: st
98
256
  * Checks 1–3 report a `VALIDATION` error (exit 1) with nothing written or committed. Check 4 can
99
257
  * only report; see {@link verifyCommittedScope}.
100
258
  *
101
- * Check 1 resolves on the **working tree**, not at `HEAD`, which departs from `command-baseline`'s
102
- * rule for a gating read. The argument is `task-102`'s, recorded in
103
- * `dl-086-a-guard-over-a-filesystem-effect-resolves-on-the-filesystem` (`in-discussion`) and cited
104
- * rather than re-made: it predicts where `writeDocument` will land, and that follows the symlinks on
105
- * disk rather than the ones a commit records.
259
+ * Check 1 resolves on the **working tree**, not at `HEAD`: it is the filesystem-effect read
260
+ * `command-baseline` and `spec-006-core-domain-api` §6 declare, ratified in
261
+ * `dl-086-a-guard-over-a-filesystem-effect-resolves-on-the-filesystem` from `task-102`'s argument,
262
+ * which is cited rather than re-made: it predicts where `writeDocument` will land, and that follows
263
+ * the symlinks on disk rather than the ones a commit records.
106
264
  *
107
265
  * @param scope - How much of the document this operation owns; defaults to the strict
108
266
  * `declared-fields-only`, so a new verb is guarded unless it opts out deliberately.
267
+ * @param warnings - The success warnings the verb will report, handed to the commit primitive so a dry
268
+ * run carries them (task-210 review, F4); defaults to the lookup's own, `prepared.warnings`.
109
269
  */
110
- export declare function commitMemoryTransition(root: string, prepared: PreparedMemoryTransition, content: string, message: string, expected?: Readonly<Record<string, string | undefined>>, scope?: DocumentScope): CoreResult<string>;
270
+ export declare function commitMemoryTransition(root: string, prepared: BegunMemoryTransition, content: string, message: string, expected?: Readonly<Record<string, string | undefined>>, scope?: DocumentScope, warnings?: readonly string[]): CoreResult<string>;
111
271
  //# sourceMappingURL=memory-transition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-transition.d.ts","sourceRoot":"","sources":["../../src/core/memory-transition.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAgB,YAAY,EAAE,MAAM,WAAW,CAAC;AAMvF,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG3D,kGAAkG;AAClG,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,GAAG,UAAU,CAAC,wBAAwB,CAAC,CA2DxH;AAyCD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,E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