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,612 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RUN_TOKEN_KEYS = exports.RUN_RECORD_KEYS = exports.ADHOC_PHASE = exports.NO_WORKFLOW = exports.NOT_REPORTED = void 0;
4
+ exports.isRunId = isRunId;
5
+ exports.runIdElementId = runIdElementId;
6
+ exports.formatRunId = formatRunId;
7
+ exports.serializeRunRecord = serializeRunRecord;
8
+ exports.parseRunLog = parseRunLog;
9
+ exports.readRunLogAt = readRunLogAt;
10
+ exports.runLogDirPrefix = runLogDirPrefix;
11
+ exports.isRunLogPath = isRunLogPath;
12
+ exports.readRunLogsAt = readRunLogsAt;
13
+ exports.resolveRunLogPath = resolveRunLogPath;
14
+ exports.requireWritableRunLog = requireWritableRunLog;
15
+ exports.runLogPreflight = runLogPreflight;
16
+ exports.nextRunId = nextRunId;
17
+ exports.executionNotesSection = executionNotesSection;
18
+ exports.notesField = notesField;
19
+ exports.deriveNotesField = deriveNotesField;
20
+ exports.recordSubject = recordSubject;
21
+ exports.recordRun = recordRun;
22
+ /**
23
+ * The run log (task-206, `spec-016` §4): one JSON Lines record per agent run, in one file per element
24
+ * under `dna.yaml` `paths.runs`, committed on its own as `agent: record <run-id>`.
25
+ *
26
+ * This is the library `agent execute` (task-228), `agent list` (task-240) and `agent show` (task-220)
27
+ * build on. It owns:
28
+ * - the 18-key record of §4.2, written in a fixed key order with no insignificant whitespace, where an
29
+ * unreported value is the literal {@link NOT_REPORTED}, never `0` or `null` (`dl-114` Q2 (b), Q3 (i));
30
+ * - the run id `<element-id>/<phase>/<n>` of §4.3, `n` counted at `state_ref` (`dl-135` Q3 (a)), so
31
+ * every clone derives the same id from the same history (`REQ-SYS-07`);
32
+ * - the strict reader of §4.5, which every reader goes through;
33
+ * - the §4.4 commit, which contains only the element's run-log file (`commitPaths --only`), and the
34
+ * §4.3 collision rule, checked against the then-current `HEAD`;
35
+ * - the `notes` field (`dl-135` Q2 (c)).
36
+ *
37
+ * **Baseline.** The id is counted at `state_ref`, the collision is checked at `HEAD`, and `notes`
38
+ * compares the element at `state_ref` with the element at `HEAD`: all committed states, never the
39
+ * working tree, so notes an agent wrote but did not commit yield `none` (§4.2 key 18).
40
+ */
41
+ const node_fs_1 = require("node:fs");
42
+ const node_path_1 = require("node:path");
43
+ const storage_1 = require("../storage");
44
+ const id_1 = require("../validation/id");
45
+ const confinement_1 = require("../core/confinement");
46
+ const revision_1 = require("../core/revision");
47
+ const types_1 = require("../core/types");
48
+ const write_guard_1 = require("../core/write-guard");
49
+ /** The literal of a value the agent did not report (§2.6): never `0`, `null` or an absent key. */
50
+ exports.NOT_REPORTED = 'not-reported';
51
+ /** `workflow` of a run with no step (§4.2 key 3). */
52
+ exports.NO_WORKFLOW = 'n/a';
53
+ /** `phase`, and the id's phase segment, of a run with no step (§4.3; reserved by `spec-003`). */
54
+ exports.ADHOC_PHASE = 'adhoc';
55
+ /** The record's keys, in the order §4.2 fixes and every line carries. */
56
+ exports.RUN_RECORD_KEYS = [
57
+ 'id',
58
+ 'element',
59
+ 'workflow',
60
+ 'phase',
61
+ 'role',
62
+ 'mode',
63
+ 'agent',
64
+ 'adapter',
65
+ 'agent_version',
66
+ 'model',
67
+ 'session',
68
+ 'tokens',
69
+ 'wingfoil',
70
+ 'state_ref',
71
+ 'duration_ms',
72
+ 'exit_status',
73
+ 'result',
74
+ 'notes',
75
+ ];
76
+ /** The keys of the record's `tokens` object, in order (§4.2 key 12). */
77
+ exports.RUN_TOKEN_KEYS = ['input', 'output', 'cache_read', 'cache_write'];
78
+ /** A phase segment: `spec-003`'s phase-name class. */
79
+ const PHASE_SOURCE = '[a-z][a-z0-9-]*';
80
+ /** `n`: decimal, no padding, from 1. */
81
+ const COUNT_SOURCE = '[1-9][0-9]*';
82
+ const SIGNAL_RE = /^signal:[A-Z][A-Z0-9]*$/;
83
+ /** The largest process exit code (§4.2 key 16, bug-288). */
84
+ const MAX_EXIT_CODE = 255;
85
+ /** `element`'s `<type>:<id>` shape (`spec-008` §7): two non-empty parts. */
86
+ const ELEMENT_REF_RE = /^[^:\s]+:[^:\s]+$/;
87
+ /** The element id `<type>:<id>`'s id: everything after the first `:`. */
88
+ const elementIdOf = (element) => element.slice(element.indexOf(':') + 1);
89
+ const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
90
+ /**
91
+ * Whether `id` is a run id of the element `elementId` (§4.3): the element id, a `/`, a phase segment
92
+ * in `spec-003`'s phase-name class (a lowercase letter, then lowercase letters, digits and `-`), a
93
+ * `/`, and a decimal count from 1 with no padding; `elementId` itself in `spec-009`'s ID class.
94
+ */
95
+ function isRunId(id, elementId) {
96
+ if (!(0, id_1.isIdPiece)(elementId))
97
+ return false;
98
+ return new RegExp(`^${escapeRegExp(elementId)}/${PHASE_SOURCE}/${COUNT_SOURCE}$`).test(id);
99
+ }
100
+ /**
101
+ * The element id of the run id `value` (§4.3), or `null` when `value` is not a run id of any element
102
+ * — the parse a caller that only has the id needs (`agent show <run-id>`, task-220). An element id is
103
+ * in `spec-009`'s ID class, which holds no `/`, so a run id has exactly three `/`-separated segments
104
+ * and the first one is the element's.
105
+ */
106
+ function runIdElementId(value) {
107
+ const segments = value.split('/');
108
+ if (segments.length !== 3)
109
+ return null;
110
+ const elementId = segments[0];
111
+ return isRunId(value, elementId) ? elementId : null;
112
+ }
113
+ /**
114
+ * The run id `<element-id>/<phase>/<n>` (§4.3).
115
+ *
116
+ * @throws Error when the result would not be a run id ({@link isRunId}): a caller passing a malformed
117
+ * element id, phase or count has a defect, not a refusal to report.
118
+ */
119
+ function formatRunId(elementId, phase, n) {
120
+ const id = `${elementId}/${phase}/${n}`;
121
+ if (!Number.isSafeInteger(n) || !isRunId(id, elementId))
122
+ throw new Error(`not a run id: '${id}'`);
123
+ return id;
124
+ }
125
+ const isNonNegativeInteger = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
126
+ /** Plain object, not an array and not `null`. */
127
+ const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
128
+ /**
129
+ * The first difference between the keys `actual` has, in order, and `expected`: a missing, an
130
+ * unexpected or an out-of-order key, named with `prefix` (`tokens.` inside the token object).
131
+ */
132
+ function keyOrderDefect(actual, expected, prefix = '') {
133
+ for (let i = 0; i < Math.max(actual.length, expected.length); i += 1) {
134
+ const [have, want] = [actual[i], expected[i]];
135
+ if (have === want)
136
+ continue;
137
+ if (have === undefined || (want !== undefined && !actual.includes(want)))
138
+ return `missing key '${prefix}${want}'`;
139
+ if (want === undefined || !expected.includes(have))
140
+ return `unexpected key '${prefix}${have}'`;
141
+ return `key '${prefix}${have}' out of order: expected '${prefix}${want}' at position ${i + 1}`;
142
+ }
143
+ return null;
144
+ }
145
+ /** The defect of one field's value, or `null` (§4.2 types). The token object's key order is checked here too. */
146
+ function fieldDefect(key, value, ordered) {
147
+ switch (key) {
148
+ case 'tokens': {
149
+ if (!isPlainObject(value))
150
+ return "'tokens' must be an object";
151
+ const keys = Object.keys(value);
152
+ const order = ordered
153
+ ? keyOrderDefect(keys, exports.RUN_TOKEN_KEYS, 'tokens.')
154
+ : keyOrderDefect([...keys].sort(), [...exports.RUN_TOKEN_KEYS].sort(), 'tokens.');
155
+ if (order !== null)
156
+ return order;
157
+ for (const token of exports.RUN_TOKEN_KEYS) {
158
+ const count = value[token];
159
+ if (count !== exports.NOT_REPORTED && !isNonNegativeInteger(count)) {
160
+ return `'tokens.${token}' must be a non-negative integer or "${exports.NOT_REPORTED}"`;
161
+ }
162
+ }
163
+ return null;
164
+ }
165
+ case 'duration_ms':
166
+ return isNonNegativeInteger(value) ? null : "'duration_ms' must be a non-negative integer";
167
+ case 'exit_status':
168
+ // A process exit code is 0–255 (bug-288): a negative or larger integer is no exit code a spawn yields.
169
+ return (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && value <= MAX_EXIT_CODE) ||
170
+ (typeof value === 'string' && SIGNAL_RE.test(value))
171
+ ? null
172
+ : `'exit_status' must be an integer from 0 to ${MAX_EXIT_CODE} or "signal:<NAME>"`;
173
+ default:
174
+ return typeof value === 'string' ? null : `'${key}' must be a string`;
175
+ }
176
+ }
177
+ /**
178
+ * The first defect of `value` as a run record, or `null`. Its id must be the one its own `element` and
179
+ * `phase` produce.
180
+ *
181
+ * @param fileElementId - The log file's basename, which the id's element segment must equal (§4.5);
182
+ * `null` for a record not read from a file.
183
+ * @param ordered - `true` for a line read back (§4.5: keys in the declared order); `false` for an
184
+ * object a caller built, whose key order the writer fixes itself.
185
+ */
186
+ function recordDefect(value, fileElementId, ordered) {
187
+ if (!isPlainObject(value))
188
+ return 'not a JSON object';
189
+ const keys = Object.keys(value);
190
+ const order = ordered
191
+ ? keyOrderDefect(keys, exports.RUN_RECORD_KEYS)
192
+ : keyOrderDefect([...keys].sort(), [...exports.RUN_RECORD_KEYS].sort());
193
+ if (order !== null)
194
+ return order;
195
+ for (const key of exports.RUN_RECORD_KEYS) {
196
+ const defect = fieldDefect(key, value[key], ordered);
197
+ if (defect !== null)
198
+ return defect;
199
+ }
200
+ const [id, element, phase] = [value.id, value.element, value.phase];
201
+ if (!ELEMENT_REF_RE.test(element))
202
+ return "'element' must be <type>:<id>";
203
+ if (fileElementId !== null && !isRunId(id, fileElementId)) {
204
+ return `'id' '${id}' is not a run id of element '${fileElementId}' (the file's basename)`;
205
+ }
206
+ // The id must be the one this record's own element and phase produce (task-206 review F6): an id
207
+ // that disagrees is counted under another (element, phase) and wedges every later run of its own.
208
+ if (!isRunId(id, elementIdOf(element)) || !id.startsWith(`${elementIdOf(element)}/${phase}/`)) {
209
+ return `'id' '${id}' does not match element '${element}' and phase '${phase}'`;
210
+ }
211
+ return null;
212
+ }
213
+ /** `record` as an object whose keys, and whose token keys, are in §4.2 order. */
214
+ function ordered(record) {
215
+ const out = {};
216
+ for (const key of exports.RUN_RECORD_KEYS) {
217
+ out[key] = key === 'tokens' ? Object.fromEntries(exports.RUN_TOKEN_KEYS.map((token) => [token, record.tokens[token]])) : record[key];
218
+ }
219
+ return out;
220
+ }
221
+ /**
222
+ * The record as its log line (§4.2): one JSON object, keys in {@link RUN_RECORD_KEYS} order whatever
223
+ * order `record` was built in, no insignificant whitespace, `\n`-terminated.
224
+ *
225
+ * The record is validated first, with the reader's rules except key order, so the writer can never
226
+ * produce a line the reader refuses: an absent key, a `null`, a fractional count is refused rather than
227
+ * written.
228
+ *
229
+ * @throws Error `run record is not valid: <detail>` — a caller defect.
230
+ */
231
+ function serializeRunRecord(record) {
232
+ const defect = recordDefect(record, null, false);
233
+ if (defect !== null)
234
+ throw new Error(`run record is not valid: ${defect}`);
235
+ return `${JSON.stringify(ordered(record))}\n`;
236
+ }
237
+ /** `run log <path>: line <k> is not a valid run record: <detail>` (§4.5). */
238
+ const invalidLine = (path, k, detail) => (0, types_1.coreErr)({ code: 'VALIDATION', message: `run log ${path}: line ${k} is not a valid run record: ${detail}` });
239
+ /**
240
+ * Read a run log strictly (§4.5): every line JSON, exactly the §4.2 keys in order with valid types, an
241
+ * `id` whose element segment is the file's basename (`<runs>/<element-id>.jsonl`), no id twice, and each
242
+ * line byte for byte the writer's serialization of its record — no CR, no whitespace outside a string
243
+ * (bug-288).
244
+ * The last line must be `\n`-terminated, since an append to an unterminated line would corrupt both.
245
+ *
246
+ * @param text - The file's content.
247
+ * @param path - Root-relative path of the file; its basename without `.jsonl` is the element id, and it
248
+ * is named in every refusal.
249
+ * @returns The records in line order, or `VALIDATION` with the §4.5 message for the first violation.
250
+ */
251
+ function parseRunLog(text, path) {
252
+ const elementId = (0, node_path_1.basename)(path, '.jsonl');
253
+ const lines = text.split('\n');
254
+ const terminated = lines[lines.length - 1] === '';
255
+ if (terminated)
256
+ lines.pop();
257
+ const records = [];
258
+ const seen = new Set();
259
+ for (let i = 0; i < lines.length; i += 1) {
260
+ if (i === lines.length - 1 && !terminated)
261
+ return invalidLine(path, i + 1, 'not terminated by a newline');
262
+ let value;
263
+ try {
264
+ value = JSON.parse(lines[i]);
265
+ }
266
+ catch {
267
+ return invalidLine(path, i + 1, 'not JSON');
268
+ }
269
+ const defect = recordDefect(value, elementId, true);
270
+ if (defect !== null)
271
+ return invalidLine(path, i + 1, defect);
272
+ const record = value;
273
+ // The line must be exactly what the writer produces for the record it parses to (§4.2, bug-288):
274
+ // no CR before the newline, no whitespace outside a string. Key order is checked above, with its own
275
+ // message, so the comparison can only fail on those.
276
+ if (`${lines[i]}\n` !== serializeRunRecord(record)) {
277
+ return invalidLine(path, i + 1, 'not in the serialized form of spec-016 §4.2 (a CR, whitespace outside a string, or another spelling of a value)');
278
+ }
279
+ if (seen.has(record.id))
280
+ return (0, types_1.coreErr)({ code: 'VALIDATION', message: `run log ${path}: run id ${record.id} recorded twice` });
281
+ seen.add(record.id);
282
+ records.push(record);
283
+ }
284
+ return (0, types_1.coreOk)(records);
285
+ }
286
+ /**
287
+ * The run log `path` as commit `rev` holds it, read strictly ({@link parseRunLog}); a log the commit
288
+ * does not hold is no records.
289
+ *
290
+ * @returns `VALIDATION`/`NOT_FOUND` from a `rev` that is malformed or names no commit.
291
+ */
292
+ function readRunLogAt(root, rev, path) {
293
+ let sha;
294
+ try {
295
+ sha = (0, revision_1.resolveRevision)(root, rev);
296
+ }
297
+ catch (error) {
298
+ if (error instanceof revision_1.RevisionError)
299
+ return (0, types_1.coreErr)(error.toCoreError());
300
+ throw error;
301
+ }
302
+ const text = (0, storage_1.readPathAtRev)(root, sha, path);
303
+ return text === null ? (0, types_1.coreOk)([]) : parseRunLog(text, path);
304
+ }
305
+ /**
306
+ * The run-log directory `dir` (`dna.yaml` `paths.runs`' one entry) as a root-relative POSIX path, joined
307
+ * as {@link resolveRunLogPath} joins it (a trailing slash, `./` or a doubled `/` changes nothing): `''` for
308
+ * the root itself.
309
+ */
310
+ function runLogDirPrefix(root, dir) {
311
+ return (0, node_path_1.relative)((0, node_path_1.resolve)(root), (0, node_path_1.resolve)(root, dir.split(node_path_1.sep).join('/'))).split(node_path_1.sep).join('/');
312
+ }
313
+ /**
314
+ * Whether the root-relative `path` is a run log of the directory `prefix` ({@link runLogDirPrefix}): a
315
+ * `.jsonl` file directly inside it (§4.1, `<runs>/<element-id>.jsonl`). Anything else there — a README, a
316
+ * file in a subdirectory — is not a run log: no reader reads it, and nothing reports it (task-240 review F5).
317
+ */
318
+ function isRunLogPath(prefix, path) {
319
+ return path.endsWith('.jsonl') && node_path_1.posix.dirname(path) === (prefix === '' ? '.' : prefix);
320
+ }
321
+ /**
322
+ * Every run log commit `sha` holds in the run-log directory `dir` (§4.1, §4.5): each `<element-id>.jsonl`
323
+ * directly inside it ({@link isRunLogPath}), ordered by element id in byte order — the basename without
324
+ * `.jsonl`, never the whole path, under which `minor-v0.3.1.jsonl` would sort before `minor-v0.3.jsonl`
325
+ * (task-240 review F1) — each read strictly ({@link parseRunLog}), its records in line order. The reader
326
+ * `agent list` lists past runs from (task-240, `spec-016` §5).
327
+ *
328
+ * `dir` is confined to the project root first (`REQ-SEC-06`), unless it is the root itself, the boundary.
329
+ *
330
+ * @param dir - `dna.yaml` `paths.runs`' one directory, non-blank.
331
+ * @returns The records, or the first §4.5 violation (`VALIDATION`), or a confinement refusal.
332
+ * @throws `StorageError` when git cannot list the commit.
333
+ */
334
+ function readRunLogsAt(root, sha, dir) {
335
+ const prefix = runLogDirPrefix(root, dir);
336
+ // The root itself (`./`) is the one directory the confinement check names as outside: it is the boundary.
337
+ if (prefix !== '') {
338
+ const confined = (0, confinement_1.requireConfinedTarget)(root, dir, 'read');
339
+ if (!confined.ok)
340
+ return confined;
341
+ }
342
+ const elementOf = (path) => (0, node_path_1.basename)(path, '.jsonl');
343
+ const paths = (0, revision_1.listPathsAtCommit)(root, sha, prefix)
344
+ .filter((path) => isRunLogPath(prefix, path))
345
+ .sort((a, b) => Number(elementOf(a) > elementOf(b)) - Number(elementOf(a) < elementOf(b)));
346
+ const records = [];
347
+ for (const path of paths) {
348
+ const parsed = parseRunLog((0, storage_1.readPathAtRev)(root, sha, path) ?? '', path);
349
+ if (!parsed.ok)
350
+ return parsed;
351
+ records.push(...parsed.value);
352
+ }
353
+ return (0, types_1.coreOk)(records);
354
+ }
355
+ /**
356
+ * The run-log file of `elementId` (§4.1): `<runs>/<element-id>.jsonl`, joined as a path (a trailing
357
+ * slash, `./` or a doubled `/` in `paths.runs` changes nothing) and confined to the project root
358
+ * (`REQ-SEC-06`): `paths.runs` accepts an absolute or a `../` value, so the file it names is checked
359
+ * where it is resolved.
360
+ *
361
+ * @param runs - `dna.yaml` `paths.runs` (one directory; absent when undeclared).
362
+ * @param action - The verb of the confinement refusal (`cannot <action> '<path>'`): `write` for the
363
+ * recorder, `read` for a reader that opens the working tree's file (`agent show`'s hint, task-220).
364
+ * @returns The root-relative POSIX path, or `VALIDATION`: `dna.yaml declares no run log (paths.runs)`
365
+ * (`NO_RUN_LOG`, §3.7) for an absent or blank value; a confinement refusal; an element id outside
366
+ * `spec-009`'s ID class.
367
+ */
368
+ function resolveRunLogPath(root, runs, elementId, action = 'write') {
369
+ const dir = runs?.[0];
370
+ if (dir === undefined || dir.trim() === '') {
371
+ return (0, types_1.coreErr)({ code: 'VALIDATION', message: 'dna.yaml declares no run log (paths.runs)' });
372
+ }
373
+ if (!(0, id_1.isIdPiece)(elementId)) {
374
+ return (0, types_1.coreErr)({ code: 'VALIDATION', message: `not an element id: '${elementId}'` });
375
+ }
376
+ const joined = node_path_1.posix.join(dir.split(node_path_1.sep).join('/'), `${elementId}.jsonl`);
377
+ const relativePath = (0, node_path_1.relative)((0, node_path_1.resolve)(root), (0, node_path_1.resolve)(root, joined)).split(node_path_1.sep).join('/');
378
+ // The run log is not Memory: the neutral confinement refusal, not REQ-SEC-06's Memory-entry text
379
+ // (task-206 review, decision 6). A textual escape and a symlinked ancestor leaving the root both fail.
380
+ // Confinement is checked on the configured spelling (`/etc/<id>.jsonl`), so a refusal names the
381
+ // target `paths.runs` gives rather than its `../` climb from the root (bug-288).
382
+ const confined = (0, confinement_1.requireConfinedTarget)(root, joined, action);
383
+ if (!confined.ok)
384
+ return confined;
385
+ return (0, types_1.coreOk)(relativePath);
386
+ }
387
+ /** How the write guards name the run log and its commit (`requireInspectableTarget`). */
388
+ const RUN_LOG_CONTRACT = {
389
+ noun: 'run log',
390
+ owner: 'run record',
391
+ records: 'An `agent: record` commit records one run and nothing else',
392
+ };
393
+ /**
394
+ * Whether the run log `logPath` may be appended to and committed now: confined to the project root
395
+ * with no symlinked leaf (`requireConfinedWriteTarget`), inspectable by git — no directory on the way
396
+ * to it is a symbolic link, which would make an empty `git status` mean nothing
397
+ * (`requireInspectableTarget`, task-131) — and unmodified against `HEAD` in the index and the working
398
+ * tree, an untracked file included (`CONFLICT` `run log <path> has uncommitted changes`, §3.7).
399
+ * {@link recordRun} asks it again at step 17.
400
+ */
401
+ function requireWritableRunLog(root, logPath) {
402
+ const confined = (0, confinement_1.requireConfinedWriteTarget)(root, logPath, 'write');
403
+ if (!confined.ok)
404
+ return confined;
405
+ const inspectable = (0, write_guard_1.requireInspectableTarget)(root, logPath, RUN_LOG_CONTRACT);
406
+ if (!inspectable.ok)
407
+ return inspectable;
408
+ if ((0, storage_1.pathPorcelainStatus)(root, logPath) !== '') {
409
+ return (0, types_1.coreErr)({ code: 'CONFLICT', message: `run log ${logPath} has uncommitted changes` });
410
+ }
411
+ return (0, types_1.coreOk)(undefined);
412
+ }
413
+ /**
414
+ * The run-log pre-flight of `agent execute`'s pipeline step 6 (`spec-016` §3.3), for a caller to run
415
+ * **before the spawn**, so a run whose record could not be committed is refused before it starts:
416
+ * the log is declared (`NO_RUN_LOG`), confined, inspectable and unmodified ({@link resolveRunLogPath},
417
+ * then {@link requireWritableRunLog}).
418
+ *
419
+ * @param runs - `dna.yaml` `paths.runs`, read at `HEAD`.
420
+ * @returns The root-relative run-log path the record will be committed to.
421
+ */
422
+ function runLogPreflight(root, runs, elementId) {
423
+ const path = resolveRunLogPath(root, runs, elementId);
424
+ if (!path.ok)
425
+ return path;
426
+ const writable = requireWritableRunLog(root, path.value);
427
+ return writable.ok ? path : writable;
428
+ }
429
+ /**
430
+ * The next run id (§4.3): `<element-id>/<phase>/<n>`, `n` = 1 + the records in the log **at
431
+ * `state_ref`** whose `element` and `phase` match, whatever their workflow. Later commits and the
432
+ * working tree do not count, so two clones of the same history derive the same id.
433
+ *
434
+ * @returns The id, or the strict reader's `VALIDATION` for a log at `state_ref` it refuses.
435
+ */
436
+ function nextRunId(root, input) {
437
+ const records = readRunLogAt(root, input.stateRef, input.logPath);
438
+ if (!records.ok)
439
+ return records;
440
+ const n = 1 + records.value.filter((record) => record.element === input.element && record.phase === input.phase).length;
441
+ return (0, types_1.coreOk)(formatRunId(elementIdOf(input.element), input.phase, n));
442
+ }
443
+ /** The heading line that opens the section `notes` watches (§4.2 key 18, §2.4). */
444
+ const NOTES_HEADING = '## Execution Notes';
445
+ const FENCE_RE = /^ {0,3}(```|~~~)/;
446
+ const SECTION_END_RE = /^#{1,2}(?:\s|$)/;
447
+ /**
448
+ * The body of the `## Execution Notes` section of a Markdown document, or `null` when it has none.
449
+ *
450
+ * The section is found by its **heading line** — a line that is exactly `## Execution Notes` — never
451
+ * by substring, so an inline `` `## Execution Notes` `` in prose, a YAML frontmatter value or
452
+ * `## Triage & Execution Notes` is not it. It runs to the next level-1 or level-2 heading, or the end;
453
+ * lines inside a fenced code block are not headings. CRLF reads as LF.
454
+ */
455
+ function executionNotesSection(markdown) {
456
+ const lines = markdown.replace(/\r\n/g, '\n').split('\n');
457
+ if (lines[lines.length - 1] === '')
458
+ lines.pop();
459
+ let i = 0;
460
+ if (lines[0] === '---') {
461
+ const close = lines.indexOf('---', 1);
462
+ i = close === -1 ? lines.length : close + 1;
463
+ }
464
+ let fenced = false;
465
+ let start = -1;
466
+ for (; i < lines.length; i += 1) {
467
+ const line = lines[i];
468
+ if (FENCE_RE.test(line)) {
469
+ fenced = !fenced;
470
+ continue;
471
+ }
472
+ if (fenced)
473
+ continue;
474
+ if (start === -1) {
475
+ if (line === NOTES_HEADING)
476
+ start = i + 1;
477
+ }
478
+ else if (SECTION_END_RE.test(line)) {
479
+ break;
480
+ }
481
+ }
482
+ if (start === -1)
483
+ return null;
484
+ return lines.slice(start, i).map((line) => `${line}\n`).join('');
485
+ }
486
+ /**
487
+ * The record's `notes` (§4.2 key 18, `dl-135` Q2 (c)): `<element-id>#execution-notes` when the
488
+ * element's `## Execution Notes` section differs between `state_ref` and `HEAD`, else `none`. Always
489
+ * `none` for a type whose template has no such section.
490
+ */
491
+ function notesField(elementId, input) {
492
+ if (input.template === null || executionNotesSection(input.template) === null)
493
+ return 'none';
494
+ const before = input.atStateRef === null ? null : executionNotesSection(input.atStateRef);
495
+ const after = input.atHead === null ? null : executionNotesSection(input.atHead);
496
+ return before === after ? 'none' : `${elementId}#execution-notes`;
497
+ }
498
+ /**
499
+ * {@link notesField} over git: the template and the element at `HEAD`, the element at `state_ref`.
500
+ * Committed states only, so notes left uncommitted yield `none`.
501
+ */
502
+ function deriveNotesField(root, input) {
503
+ return notesField(input.elementId, {
504
+ template: (0, storage_1.readPathAtRev)(root, 'HEAD', input.templatePath),
505
+ atStateRef: (0, storage_1.readPathAtRev)(root, input.stateRef, input.elementPath),
506
+ atHead: (0, storage_1.readPathAtRev)(root, 'HEAD', input.elementPath),
507
+ });
508
+ }
509
+ /** The subject of the commit that records the run `runId` (§4.4): `agent: record <run-id>`, outside `wf()`. */
510
+ function recordSubject(runId) {
511
+ return `agent: record ${runId}`;
512
+ }
513
+ /** The record as the `details` of a refusal that loses it: one `dl-055` detail line, the JSON line. */
514
+ const recordDetails = (record, line) => ({
515
+ run_id: record.id,
516
+ record,
517
+ issues: [{ detail: line.replace(/\n$/, '') }],
518
+ });
519
+ /**
520
+ * `text` on one line with both spellings of the project root removed (`<root>/x` → `x`, a bare root →
521
+ * `.`), so a filesystem error's absolute path does not reach the operator.
522
+ */
523
+ function withoutRoot(root, text) {
524
+ let detail = text;
525
+ const spellings = [(0, node_path_1.resolve)(root), (0, node_fs_1.realpathSync)(root)].sort((a, b) => b.length - a.length);
526
+ for (const spelling of spellings)
527
+ detail = detail.split(`${spelling}${node_path_1.sep}`).join('').split(spelling).join('.');
528
+ return detail
529
+ .split('\n')
530
+ .map((part) => part.trim())
531
+ .filter((part) => part !== '')
532
+ .join('; ');
533
+ }
534
+ /**
535
+ * The cause a failed record commit names: git's (or a hook's) explanation on one line with the project
536
+ * root removed (`CommitFailure.gitDetail`, task-210), plus the index problem when the index entry could
537
+ * not be put back.
538
+ */
539
+ function commitCause(failure) {
540
+ return failure.indexProblem === undefined
541
+ ? failure.gitDetail
542
+ : `${failure.gitDetail} (the index entry could not be put back: ${failure.indexProblem}; check it with git status)`;
543
+ }
544
+ /**
545
+ * Append `record` to its run log and commit it (§4.4, §4.3 collision, §3.7).
546
+ *
547
+ * The commit contains only `logPath` (`commitPaths`, `--only`): the agent's uncommitted and staged
548
+ * edits elsewhere stay as they are. Its subject is `agent: record <run-id>`, outside the `wf()`
549
+ * grammar because the run log is not Memory, and `commitPaths` adds `dl-111`'s `WingFoil-Version:`
550
+ * trailer; there is no other body.
551
+ *
552
+ * Refusals, in order, none of which writes anything:
553
+ * - `VALIDATION` — `record` is not a valid record, including an id that is not the one its own
554
+ * `element` and `phase` produce (no `details`: there is no line to give back);
555
+ * - every later refusal carries the record as a `details` line, so the run is not lost (§3.7, §4.3):
556
+ * `VALIDATION` for a record not of this log's element (its id's element segment is not the file's
557
+ * basename), a log path that leaves the project root, is a symlink, or lies beyond a symlinked
558
+ * directory; `CONFLICT` `run log <path> has uncommitted changes` ({@link requireWritableRunLog});
559
+ * the strict reader's `VALIDATION` for the log at `HEAD`; `CONFLICT` `run id <run-id> already
560
+ * recorded at HEAD`.
561
+ *
562
+ * The append and the commit go through `writeAndCommit` (task-210): under a dry run the commit is
563
+ * planned and nothing is written. A commit git refuses (a hook, a held `index.lock`, …) is `IO` `run
564
+ * <run-id> not recorded: <cause>` with the record as a `details` line, the cause naming no absolute
565
+ * path; the file, any directory the append created, and the index entry are put back as they were. A
566
+ * write the filesystem refuses (`EACCES`, `ENOSPC`) is the same `IO` refusal, the record kept.
567
+ */
568
+ function recordRun(root, logPath, record) {
569
+ let line;
570
+ try {
571
+ line = serializeRunRecord(record);
572
+ }
573
+ catch (error) {
574
+ return (0, types_1.coreErr)({ code: 'VALIDATION', message: error.message });
575
+ }
576
+ // From here on every refusal carries the record, so the run is never lost (§3.7, §4.3; review F3).
577
+ const keep = (error) => (0, types_1.coreErr)({ ...error, details: recordDetails(record, line) });
578
+ const elementId = (0, node_path_1.basename)(logPath, '.jsonl');
579
+ if (!isRunId(record.id, elementId)) {
580
+ return keep({
581
+ code: 'VALIDATION',
582
+ message: `run log ${logPath}: run id ${record.id} is not a run id of element '${elementId}' (the file's basename)`,
583
+ });
584
+ }
585
+ const writable = requireWritableRunLog(root, logPath);
586
+ if (!writable.ok)
587
+ return keep(writable.error);
588
+ const atHead = (0, storage_1.readPathAtRev)(root, 'HEAD', logPath);
589
+ const existing = atHead === null ? (0, types_1.coreOk)([]) : parseRunLog(atHead, logPath);
590
+ if (!existing.ok)
591
+ return keep(existing.error);
592
+ if (existing.value.some((recorded) => recorded.id === record.id)) {
593
+ return keep({ code: 'CONFLICT', message: `run id ${record.id} already recorded at HEAD` });
594
+ }
595
+ const message = recordSubject(record.id);
596
+ try {
597
+ // task-210's primitive: plans instead of writing under a dry run, and on a refused commit puts the
598
+ // file, any directory it created and the index entry back before throwing a CommitFailure.
599
+ const sha = (0, storage_1.writeAndCommit)(root, [{ path: logPath, content: `${atHead ?? ''}${line}` }], message);
600
+ return (0, types_1.coreOk)({ record, sha }, { sha, message });
601
+ }
602
+ catch (error) {
603
+ // The dry-run stop ends the operation with its plan; it is not a failure to report.
604
+ if ((0, storage_1.isDryRunActive)())
605
+ throw error;
606
+ // Anything else — git refusing the commit, or the filesystem refusing the write (EACCES, ENOSPC),
607
+ // which writeAndCommit rethrows as raised — loses no run: the record goes back in details (§3.7).
608
+ const cause = error instanceof storage_1.CommitFailure ? commitCause(error) : withoutRoot(root, error instanceof Error ? error.message : String(error));
609
+ return keep({ code: 'IO', message: `run ${record.id} not recorded: ${cause}` });
610
+ }
611
+ }
612
+ //# sourceMappingURL=run-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-log.js","sourceRoot":"","sources":["../../src/agent/run-log.ts"],"names":[],"mappings":";;;AAkIA,0BAGC;AAQD,wCAKC;AAQD,kCAIC;AA4GD,gDAIC;AAkBD,kCA6BC;AAQD,oCAUC;AAOD,0CAEC;AAOD,oCAEC;AAeD,sCAkBC;AAeD,8CAsBC;AAiBD,sDASC;AAWD,0CAKC;AAqBD,8BAKC;AAeD,sDAyBC;AAiBD,gCAKC;AAgBD,4CAMC;AAGD,sCAEC;AAiED,8BAwCC;AA7qBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qCAAuC;AACvC,yCAAoE;AAEpE,wCAA+G;AAC/G,yCAA6C;AAC7C,qDAAwF;AACxF,+CAAqF;AACrF,yCAAiF;AACjF,qDAAyF;AAEzF,kGAAkG;AACrF,QAAA,YAAY,GAAG,cAAuB,CAAC;AAEpD,qDAAqD;AACxC,QAAA,WAAW,GAAG,KAAc,CAAC;AAE1C,iGAAiG;AACpF,QAAA,WAAW,GAAG,OAAgB,CAAC;AAE5C,yEAAyE;AAC5D,QAAA,eAAe,GAAG;IAC7B,IAAI;IACJ,SAAS;IACT,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,eAAe;IACf,OAAO;IACP,SAAS;IACT,QAAQ;IACR,UAAU;IACV,WAAW;IACX,aAAa;IACb,aAAa;IACb,QAAQ;IACR,OAAO;CACC,CAAC;AAEX,wEAAwE;AAC3D,QAAA,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAU,CAAC;AAgDxF,sDAAsD;AACtD,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,wCAAwC;AACxC,MAAM,YAAY,GAAG,aAAa,CAAC;AACnC,MAAM,SAAS,GAAG,yBAAyB,CAAC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