@oscharko-dev/keiko 1.0.5 → 1.1.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 (930) hide show
  1. package/README.md +11 -1
  2. package/dist/ui/csp-hashes.json +6 -6
  3. package/dist/ui/static/404.html +1 -1
  4. package/dist/ui/static/__next.__PAGE__.txt +16 -14
  5. package/dist/ui/static/__next._full.txt +21 -20
  6. package/dist/ui/static/__next._tree.txt +2 -2
  7. package/dist/ui/static/_next/static/chunks/000t9p2ysi3dv.css +1 -0
  8. package/dist/ui/static/_next/static/chunks/01_gc9m97_vw5.js +1 -0
  9. package/dist/ui/static/_next/static/chunks/02p2_qr2a9511.js +1 -0
  10. package/dist/ui/static/_next/static/chunks/02ug3u_si269z.js +1 -0
  11. package/dist/ui/static/_next/static/chunks/03deeo56ud39g.js +1 -0
  12. package/dist/ui/static/_next/static/chunks/0_8kv51rrhcg-.js +1 -0
  13. package/dist/ui/static/_next/static/chunks/0ahpt93l7-z9f.js +1 -0
  14. package/dist/ui/static/_next/static/chunks/0bbv42deftomm.js +1 -0
  15. package/dist/ui/static/_next/static/chunks/0c3w2ubla6ek6.js +1 -0
  16. package/dist/ui/static/_next/static/chunks/0e6em7dg4gr6q.js +1 -0
  17. package/dist/ui/static/_next/static/chunks/0gnizm29lk3ll.js +1 -0
  18. package/dist/ui/static/_next/static/chunks/0m0w3hleoejwg.js +1 -0
  19. package/dist/ui/static/_next/static/chunks/{2nubqp1hwandv.js → 0ojvvjnsf38bk.js} +1 -1
  20. package/dist/ui/static/_next/static/chunks/0we68cbpsgepq.css +1 -0
  21. package/dist/ui/static/_next/static/chunks/0xqxs7rppw_o5.css +5 -0
  22. package/dist/ui/static/_next/static/chunks/0z5be09yla9lp.js +1 -0
  23. package/dist/ui/static/_next/static/chunks/14aztwc0_78th.js +1 -0
  24. package/dist/ui/static/_next/static/chunks/18-rkk8vbltb8.js +1 -0
  25. package/dist/ui/static/_next/static/chunks/187yy--dlljjz.js +1 -0
  26. package/dist/ui/static/_next/static/chunks/1ep9f2fjv7oh7.js +1 -0
  27. package/dist/ui/static/_next/static/chunks/1hk335vrug1rc.js +1 -0
  28. package/dist/ui/static/_next/static/chunks/1kacubgk0y2ki.js +1 -0
  29. package/dist/ui/static/_next/static/chunks/1kxhf3ld28pzk.js +1 -0
  30. package/dist/ui/static/_next/static/chunks/1lb8ju8qa0d9m.js +1 -0
  31. package/dist/ui/static/_next/static/chunks/1lrj3d157kay1.js +5 -0
  32. package/dist/ui/static/_next/static/chunks/1mcajwmbse068.js +7 -0
  33. package/dist/ui/static/_next/static/chunks/{2l9r80s3qje3v.js → 1piodmepoegnw.js} +1 -1
  34. package/dist/ui/static/_next/static/chunks/1qsl7dx87n-af.js +1 -0
  35. package/dist/ui/static/_next/static/chunks/{0vywz1p6au4ri.js → 1uetvnnpa5z22.js} +1 -1
  36. package/dist/ui/static/_next/static/chunks/1uulmf99vtuyt.js +1 -0
  37. package/dist/ui/static/_next/static/chunks/202kx3p8axlmr.js +1 -0
  38. package/dist/ui/static/_next/static/chunks/{0hn7lj400e79p.js → 2179tism08tgt.js} +1 -1
  39. package/dist/ui/static/_next/static/chunks/21t1klb1thn76.js +1 -0
  40. package/dist/ui/static/_next/static/chunks/29nzymeooaepv.js +1 -0
  41. package/dist/ui/static/_next/static/chunks/2_o61-akoq549.js +1 -0
  42. package/dist/ui/static/_next/static/chunks/{064diuwddstj6.js → 2cn33khz2ae-h.js} +1 -1
  43. package/dist/ui/static/_next/static/chunks/{0b3klia_y6i3z.js → 2dbr8ufwv1hwn.js} +1 -1
  44. package/dist/ui/static/_next/static/chunks/2dpxapmdvqlh1.js +1 -0
  45. package/dist/ui/static/_next/static/chunks/2e4prtd3wmn0a.js +1 -0
  46. package/dist/ui/static/_next/static/chunks/2h_zvmb272ozs.js +1 -0
  47. package/dist/ui/static/_next/static/chunks/{3qtph5seqciux.css → 2l0gyhe4jpu23.css} +5 -5
  48. package/dist/ui/static/_next/static/chunks/2l9ens2l3tayx.js +1 -0
  49. package/dist/ui/static/_next/static/chunks/2oxvgl3qb19wf.js +1 -0
  50. package/dist/ui/static/_next/static/chunks/2s9-91g2jic6u.js +1 -0
  51. package/dist/ui/static/_next/static/chunks/2uoxlx30y60nf.js +1 -0
  52. package/dist/ui/static/_next/static/chunks/2vhgpp_064_st.js +1 -0
  53. package/dist/ui/static/_next/static/chunks/2xpud5k1hwfvf.js +1 -0
  54. package/dist/ui/static/_next/static/chunks/2ywqac8g8us1n.css +1 -0
  55. package/dist/ui/static/_next/static/chunks/3-htoy7v6gx51.js +1 -0
  56. package/dist/ui/static/_next/static/chunks/3-l-8qt163_y6.js +1 -0
  57. package/dist/ui/static/_next/static/chunks/3_rof9w-g14_v.js +3 -0
  58. package/dist/ui/static/_next/static/chunks/3aqtjd-a1ygis.js +1 -0
  59. package/dist/ui/static/_next/static/chunks/3d-10944zk2o9.js +1 -0
  60. package/dist/ui/static/_next/static/chunks/3f6svr_pokw6j.js +1 -0
  61. package/dist/ui/static/_next/static/chunks/3ibevys2o09xx.js +1 -0
  62. package/dist/ui/static/_next/static/chunks/3iv5llh4xg-7v.js +1 -0
  63. package/dist/ui/static/_next/static/chunks/3ly6-f_52vfie.js +1 -0
  64. package/dist/ui/static/_next/static/chunks/3pm8eiwwesd47.js +1 -0
  65. package/dist/ui/static/_next/static/chunks/3tr04kks52pjw.js +1 -0
  66. package/dist/ui/static/_next/static/chunks/3wwyidrm300kk.js +1 -0
  67. package/dist/ui/static/_next/static/chunks/3xw9gh9d5ngza.js +1 -0
  68. package/dist/ui/static/_next/static/chunks/3zbk4r-6rxn7j.css +2 -0
  69. package/dist/ui/static/_next/static/chunks/42y02tbxkub8f.js +1 -0
  70. package/dist/ui/static/_not-found/__next._full.txt +20 -18
  71. package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +13 -11
  72. package/dist/ui/static/_not-found/__next._tree.txt +1 -1
  73. package/dist/ui/static/_not-found.html +1 -1
  74. package/dist/ui/static/_not-found.txt +20 -18
  75. package/dist/ui/static/atlassian-connectors/__next._full.txt +22 -20
  76. package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
  77. package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +15 -13
  78. package/dist/ui/static/atlassian-connectors.html +1 -1
  79. package/dist/ui/static/atlassian-connectors.txt +22 -20
  80. package/dist/ui/static/index.html +1 -1
  81. package/dist/ui/static/index.txt +21 -20
  82. package/dist/ui/static/launch/__next._full.txt +25 -23
  83. package/dist/ui/static/launch/__next._tree.txt +2 -2
  84. package/dist/ui/static/launch/__next.launch.__PAGE__.txt +16 -14
  85. package/dist/ui/static/launch.html +1 -1
  86. package/dist/ui/static/launch.txt +25 -23
  87. package/dist/ui/static/local-knowledge/__next._full.txt +25 -23
  88. package/dist/ui/static/local-knowledge/__next._tree.txt +2 -2
  89. package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +16 -14
  90. package/dist/ui/static/local-knowledge/capsule/__next._full.txt +23 -21
  91. package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
  92. package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +15 -13
  93. package/dist/ui/static/local-knowledge/capsule.html +1 -1
  94. package/dist/ui/static/local-knowledge/capsule.txt +23 -21
  95. package/dist/ui/static/local-knowledge.html +1 -1
  96. package/dist/ui/static/local-knowledge.txt +25 -23
  97. package/node_modules/@oscharko-dev/keiko-cli/dist/activity-log-line-reader.d.ts +30 -0
  98. package/node_modules/@oscharko-dev/keiko-cli/dist/activity-log-line-reader.d.ts.map +1 -0
  99. package/node_modules/@oscharko-dev/keiko-cli/dist/activity-log-line-reader.js +114 -0
  100. package/node_modules/@oscharko-dev/keiko-cli/dist/audit.d.ts.map +1 -1
  101. package/node_modules/@oscharko-dev/keiko-cli/dist/audit.js +108 -39
  102. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-activity-log.d.ts +3 -0
  103. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-activity-log.d.ts.map +1 -0
  104. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-activity-log.js +14 -0
  105. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.d.ts +1 -1
  106. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.d.ts.map +1 -1
  107. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.js +7 -4
  108. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-model-resolution.d.ts.map +1 -1
  109. package/node_modules/@oscharko-dev/keiko-cli/dist/cli-model-resolution.js +3 -1
  110. package/node_modules/@oscharko-dev/keiko-cli/dist/evaluate.d.ts.map +1 -1
  111. package/node_modules/@oscharko-dev/keiko-cli/dist/evaluate.js +4 -2
  112. package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.d.ts +60 -7
  113. package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.d.ts.map +1 -1
  114. package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.js +32 -10
  115. package/node_modules/@oscharko-dev/keiko-cli/dist/launcher-state.js +1 -1
  116. package/node_modules/@oscharko-dev/keiko-cli/dist/lifecycle.d.ts.map +1 -1
  117. package/node_modules/@oscharko-dev/keiko-cli/dist/lifecycle.js +82 -103
  118. package/node_modules/@oscharko-dev/keiko-cli/dist/memory.d.ts.map +1 -1
  119. package/node_modules/@oscharko-dev/keiko-cli/dist/memory.js +14 -7
  120. package/node_modules/@oscharko-dev/keiko-cli/dist/portable-launch-notifier.d.ts.map +1 -1
  121. package/node_modules/@oscharko-dev/keiko-cli/dist/portable-launch-notifier.js +30 -7
  122. package/node_modules/@oscharko-dev/keiko-cli/dist/process-activity-log.d.ts +197 -0
  123. package/node_modules/@oscharko-dev/keiko-cli/dist/process-activity-log.d.ts.map +1 -0
  124. package/node_modules/@oscharko-dev/keiko-cli/dist/process-activity-log.js +147 -0
  125. package/node_modules/@oscharko-dev/keiko-cli/dist/process-guards.d.ts +3 -2
  126. package/node_modules/@oscharko-dev/keiko-cli/dist/process-guards.d.ts.map +1 -1
  127. package/node_modules/@oscharko-dev/keiko-cli/dist/process-guards.js +49 -36
  128. package/node_modules/@oscharko-dev/keiko-cli/dist/prompt-enhancer.d.ts.map +1 -1
  129. package/node_modules/@oscharko-dev/keiko-cli/dist/prompt-enhancer.js +9 -7
  130. package/node_modules/@oscharko-dev/keiko-cli/dist/repair.d.ts.map +1 -1
  131. package/node_modules/@oscharko-dev/keiko-cli/dist/repair.js +8 -3
  132. package/node_modules/@oscharko-dev/keiko-cli/dist/run.d.ts.map +1 -1
  133. package/node_modules/@oscharko-dev/keiko-cli/dist/run.js +3 -1
  134. package/node_modules/@oscharko-dev/keiko-cli/dist/runner.d.ts.map +1 -1
  135. package/node_modules/@oscharko-dev/keiko-cli/dist/runner.js +58 -18
  136. package/node_modules/@oscharko-dev/keiko-cli/dist/security-log.d.ts.map +1 -1
  137. package/node_modules/@oscharko-dev/keiko-cli/dist/security-log.js +126 -57
  138. package/node_modules/@oscharko-dev/keiko-cli/dist/state-paths.d.ts +1 -1
  139. package/node_modules/@oscharko-dev/keiko-cli/dist/state-paths.d.ts.map +1 -1
  140. package/node_modules/@oscharko-dev/keiko-cli/dist/state-paths.js +29 -6
  141. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze-sufficiency.d.ts +52 -0
  142. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze-sufficiency.d.ts.map +1 -0
  143. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze-sufficiency.js +249 -0
  144. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.d.ts +85 -0
  145. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.d.ts.map +1 -1
  146. package/node_modules/@oscharko-dev/keiko-cli/dist/support-analyze.js +498 -56
  147. package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.d.ts +12 -8
  148. package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.d.ts.map +1 -1
  149. package/node_modules/@oscharko-dev/keiko-cli/dist/support-export.js +147 -99
  150. package/node_modules/@oscharko-dev/keiko-cli/dist/support-incident.d.ts +50 -0
  151. package/node_modules/@oscharko-dev/keiko-cli/dist/support-incident.d.ts.map +1 -0
  152. package/node_modules/@oscharko-dev/keiko-cli/dist/support-incident.js +317 -0
  153. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-cli.d.ts +80 -0
  154. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-cli.d.ts.map +1 -0
  155. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-cli.js +462 -0
  156. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-evidence.d.ts +480 -0
  157. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-evidence.d.ts.map +1 -0
  158. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query-evidence.js +191 -0
  159. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query.d.ts +169 -0
  160. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query.d.ts.map +1 -0
  161. package/node_modules/@oscharko-dev/keiko-cli/dist/support-query.js +709 -0
  162. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest-names.d.ts +6 -0
  163. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest-names.d.ts.map +1 -0
  164. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest-names.js +27 -0
  165. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest.d.ts +164 -0
  166. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest.d.ts.map +1 -0
  167. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-manifest.js +688 -0
  168. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-scan.d.ts +78 -0
  169. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-scan.d.ts.map +1 -0
  170. package/node_modules/@oscharko-dev/keiko-cli/dist/support-segment-scan.js +252 -0
  171. package/node_modules/@oscharko-dev/keiko-cli/dist/support-selective-export.d.ts +43 -0
  172. package/node_modules/@oscharko-dev/keiko-cli/dist/support-selective-export.d.ts.map +1 -0
  173. package/node_modules/@oscharko-dev/keiko-cli/dist/support-selective-export.js +115 -0
  174. package/node_modules/@oscharko-dev/keiko-cli/dist/support-tool-catalog.d.ts.map +1 -1
  175. package/node_modules/@oscharko-dev/keiko-cli/dist/support-tool-catalog.js +118 -4
  176. package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts +21 -2
  177. package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts.map +1 -1
  178. package/node_modules/@oscharko-dev/keiko-cli/dist/support.js +885 -177
  179. package/node_modules/@oscharko-dev/keiko-cli/dist/ui-process-stop.d.ts.map +1 -1
  180. package/node_modules/@oscharko-dev/keiko-cli/dist/ui-process-stop.js +95 -24
  181. package/node_modules/@oscharko-dev/keiko-cli/dist/ui.d.ts +13 -4
  182. package/node_modules/@oscharko-dev/keiko-cli/dist/ui.d.ts.map +1 -1
  183. package/node_modules/@oscharko-dev/keiko-cli/dist/ui.js +364 -109
  184. package/node_modules/@oscharko-dev/keiko-cli/dist/uninstall.d.ts.map +1 -1
  185. package/node_modules/@oscharko-dev/keiko-cli/dist/uninstall.js +123 -51
  186. package/node_modules/@oscharko-dev/keiko-cli/package.json +14 -14
  187. package/node_modules/@oscharko-dev/keiko-connectors/dist/version.d.ts +1 -1
  188. package/node_modules/@oscharko-dev/keiko-connectors/dist/version.js +1 -1
  189. package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
  190. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts +6322 -0
  191. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.d.ts.map +1 -0
  192. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-failure-class-contracts.js +8278 -0
  193. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-files.d.ts +54 -0
  194. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-files.d.ts.map +1 -0
  195. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-files.js +215 -0
  196. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-loss.d.ts +16 -0
  197. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-loss.d.ts.map +1 -0
  198. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-loss.js +82 -0
  199. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts +50926 -0
  200. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.d.ts.map +1 -0
  201. package/node_modules/@oscharko-dev/keiko-contracts/dist/activity-log-registry.generated.js +60264 -0
  202. package/node_modules/@oscharko-dev/keiko-contracts/dist/bff-wire.d.ts +19 -0
  203. package/node_modules/@oscharko-dev/keiko-contracts/dist/bff-wire.d.ts.map +1 -1
  204. package/node_modules/@oscharko-dev/keiko-contracts/dist/code-task-acceptance.d.ts +2 -2
  205. package/node_modules/@oscharko-dev/keiko-contracts/dist/code-task-acceptance.d.ts.map +1 -1
  206. package/node_modules/@oscharko-dev/keiko-contracts/dist/code-task-acceptance.js +1 -2
  207. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-api.d.ts +5 -0
  208. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-api.d.ts.map +1 -1
  209. package/node_modules/@oscharko-dev/keiko-contracts/dist/coding-workbench-runtime-api.js +15 -0
  210. package/node_modules/@oscharko-dev/keiko-contracts/dist/diagnostics.d.ts +145 -1
  211. package/node_modules/@oscharko-dev/keiko-contracts/dist/diagnostics.d.ts.map +1 -1
  212. package/node_modules/@oscharko-dev/keiko-contracts/dist/diagnostics.js +532 -6
  213. package/node_modules/@oscharko-dev/keiko-contracts/dist/gateway.d.ts +1 -1
  214. package/node_modules/@oscharko-dev/keiko-contracts/dist/gateway.d.ts.map +1 -1
  215. package/node_modules/@oscharko-dev/keiko-contracts/dist/gateway.js +1 -0
  216. package/node_modules/@oscharko-dev/keiko-contracts/dist/governed-tool-catalog.d.ts +1 -1
  217. package/node_modules/@oscharko-dev/keiko-contracts/dist/governed-tool-catalog.d.ts.map +1 -1
  218. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.d.ts +1 -1
  219. package/node_modules/@oscharko-dev/keiko-contracts/dist/index.d.ts.map +1 -1
  220. package/node_modules/@oscharko-dev/keiko-contracts/dist/observability.d.ts +235 -0
  221. package/node_modules/@oscharko-dev/keiko-contracts/dist/observability.d.ts.map +1 -1
  222. package/node_modules/@oscharko-dev/keiko-contracts/dist/observability.js +743 -0
  223. package/node_modules/@oscharko-dev/keiko-contracts/dist/support-incident.d.ts +216 -0
  224. package/node_modules/@oscharko-dev/keiko-contracts/dist/support-incident.d.ts.map +1 -0
  225. package/node_modules/@oscharko-dev/keiko-contracts/dist/support-incident.js +403 -0
  226. package/node_modules/@oscharko-dev/keiko-contracts/dist/verification.d.ts +3 -0
  227. package/node_modules/@oscharko-dev/keiko-contracts/dist/verification.d.ts.map +1 -1
  228. package/node_modules/@oscharko-dev/keiko-contracts/dist/verification.js +18 -1
  229. package/node_modules/@oscharko-dev/keiko-contracts/dist/version.d.ts +2 -2
  230. package/node_modules/@oscharko-dev/keiko-contracts/dist/version.js +2 -2
  231. package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
  232. package/node_modules/@oscharko-dev/keiko-evaluations/dist/model-provider.d.ts +2 -1
  233. package/node_modules/@oscharko-dev/keiko-evaluations/dist/model-provider.d.ts.map +1 -1
  234. package/node_modules/@oscharko-dev/keiko-evaluations/dist/model-provider.js +1 -1
  235. package/node_modules/@oscharko-dev/keiko-evaluations/dist/runner.d.ts +2 -1
  236. package/node_modules/@oscharko-dev/keiko-evaluations/dist/runner.d.ts.map +1 -1
  237. package/node_modules/@oscharko-dev/keiko-evaluations/dist/runner.js +2 -1
  238. package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
  239. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
  240. package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
  241. package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
  242. package/node_modules/@oscharko-dev/keiko-git/dist/types.d.ts +20 -0
  243. package/node_modules/@oscharko-dev/keiko-git/dist/types.d.ts.map +1 -1
  244. package/node_modules/@oscharko-dev/keiko-git/dist/version.d.ts +1 -1
  245. package/node_modules/@oscharko-dev/keiko-git/dist/version.js +1 -1
  246. package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
  247. package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
  248. package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
  249. package/node_modules/@oscharko-dev/keiko-harness/package.json +7 -7
  250. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-activity-log.d.ts +68 -0
  251. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-activity-log.d.ts.map +1 -0
  252. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-activity-log.js +532 -0
  253. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-batcher.d.ts.map +1 -1
  254. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/embedding-batcher.js +93 -76
  255. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator-activity-log.d.ts +120 -0
  256. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator-activity-log.d.ts.map +1 -0
  257. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator-activity-log.js +686 -0
  258. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator.d.ts.map +1 -1
  259. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/orchestrator.js +150 -207
  260. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/preflight-activity-log.d.ts +36 -0
  261. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/preflight-activity-log.d.ts.map +1 -0
  262. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/preflight-activity-log.js +264 -0
  263. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/indexing/types.d.ts.map +1 -1
  264. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.d.ts +1 -0
  265. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.d.ts.map +1 -1
  266. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/knowledge-log.js +44 -12
  267. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/repository-pod.d.ts.map +1 -1
  268. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/repository-pod.js +30 -13
  269. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/retrieval/local-vector-index-port.d.ts.map +1 -1
  270. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/retrieval/local-vector-index-port.js +25 -6
  271. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/retrieval/usearch-ann-index.d.ts.map +1 -1
  272. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/retrieval/usearch-ann-index.js +46 -10
  273. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store-content-encryption.d.ts.map +1 -1
  274. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store-content-encryption.js +71 -20
  275. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store.d.ts.map +1 -1
  276. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/store.js +54 -17
  277. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
  278. package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
  279. package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +5 -5
  280. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
  281. package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
  282. package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
  283. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/consolidate.d.ts.map +1 -1
  284. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/consolidate.js +24 -5
  285. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/log-port.d.ts.map +1 -1
  286. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/log-port.js +35 -12
  287. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
  288. package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
  289. package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
  290. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
  291. package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
  292. package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
  293. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
  294. package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
  295. package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
  296. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/db.d.ts.map +1 -1
  297. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/db.js +25 -7
  298. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/migrate-encrypt.d.ts +4 -2
  299. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/migrate-encrypt.d.ts.map +1 -1
  300. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/migrate-encrypt.js +37 -12
  301. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/schema.d.ts.map +1 -1
  302. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/schema.js +34 -10
  303. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/vault-log.d.ts +3 -2
  304. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/vault-log.d.ts.map +1 -1
  305. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/vault-log.js +35 -12
  306. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/vault.d.ts.map +1 -1
  307. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/vault.js +24 -6
  308. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
  309. package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
  310. package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
  311. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.d.ts.map +1 -1
  312. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/gateway.js +408 -40
  313. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/http.d.ts.map +1 -1
  314. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/http.js +237 -61
  315. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts +5 -0
  316. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.d.ts.map +1 -1
  317. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/observability.js +72 -12
  318. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.d.ts.map +1 -1
  319. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-adapter.js +75 -17
  320. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.d.ts.map +1 -1
  321. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/openai-embedding-adapter.js +404 -116
  322. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prDescription/generate.d.ts.map +1 -1
  323. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/prDescription/generate.js +313 -92
  324. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts +2 -3
  325. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.d.ts.map +1 -1
  326. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/resilience.js +260 -54
  327. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/speech-to-text-adapter.d.ts.map +1 -1
  328. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/speech-to-text-adapter.js +31 -11
  329. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/text-to-speech-adapter.d.ts.map +1 -1
  330. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/text-to-speech-adapter.js +147 -21
  331. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/toolCatalogBridge.d.ts.map +1 -1
  332. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/toolCatalogBridge.js +190 -44
  333. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
  334. package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
  335. package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +4 -4
  336. package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
  337. package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
  338. package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
  339. package/node_modules/@oscharko-dev/keiko-security/dist/fs-atomic-rename.d.ts.map +1 -1
  340. package/node_modules/@oscharko-dev/keiko-security/dist/fs-atomic-rename.js +39 -14
  341. package/node_modules/@oscharko-dev/keiko-security/dist/fs-hardening.d.ts +107 -0
  342. package/node_modules/@oscharko-dev/keiko-security/dist/fs-hardening.d.ts.map +1 -1
  343. package/node_modules/@oscharko-dev/keiko-security/dist/fs-hardening.js +1998 -1
  344. package/node_modules/@oscharko-dev/keiko-security/dist/index.d.ts +2 -1
  345. package/node_modules/@oscharko-dev/keiko-security/dist/index.d.ts.map +1 -1
  346. package/node_modules/@oscharko-dev/keiko-security/dist/index.js +1 -3
  347. package/node_modules/@oscharko-dev/keiko-security/dist/log-port.d.ts.map +1 -1
  348. package/node_modules/@oscharko-dev/keiko-security/dist/log-port.js +36 -13
  349. package/node_modules/@oscharko-dev/keiko-security/dist/macos-keychain.d.ts.map +1 -1
  350. package/node_modules/@oscharko-dev/keiko-security/dist/macos-keychain.js +31 -15
  351. package/node_modules/@oscharko-dev/keiko-security/dist/portable-tree-attestation.d.ts +2 -1
  352. package/node_modules/@oscharko-dev/keiko-security/dist/portable-tree-attestation.d.ts.map +1 -1
  353. package/node_modules/@oscharko-dev/keiko-security/dist/portable-tree-attestation.js +46 -15
  354. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-protocol.d.ts +23 -0
  355. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-protocol.d.ts.map +1 -0
  356. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-protocol.js +11 -0
  357. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-runtime.d.ts +9 -0
  358. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-runtime.d.ts.map +1 -0
  359. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation-runtime.js +115 -0
  360. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation.d.ts +2 -0
  361. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation.d.ts.map +1 -0
  362. package/node_modules/@oscharko-dev/keiko-security/dist/safe-artifact-directory-mutation.js +50 -0
  363. package/node_modules/@oscharko-dev/keiko-security/dist/secret-vault.d.ts.map +1 -1
  364. package/node_modules/@oscharko-dev/keiko-security/dist/secret-vault.js +260 -50
  365. package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
  366. package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
  367. package/node_modules/@oscharko-dev/keiko-security/dist/windows-local-volume.d.ts.map +1 -1
  368. package/node_modules/@oscharko-dev/keiko-security/dist/windows-local-volume.js +32 -7
  369. package/node_modules/@oscharko-dev/keiko-security/dist/windows-shortcuts.d.ts.map +1 -1
  370. package/node_modules/@oscharko-dev/keiko-security/dist/windows-shortcuts.js +38 -14
  371. package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
  372. package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/credentialRoutes.d.ts.map +1 -1
  373. package/node_modules/@oscharko-dev/keiko-server/dist/atlassian/credentialRoutes.js +47 -5
  374. package/node_modules/@oscharko-dev/keiko-server/dist/bounded-request-body.d.ts.map +1 -1
  375. package/node_modules/@oscharko-dev/keiko-server/dist/bounded-request-body.js +160 -37
  376. package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.d.ts +48 -0
  377. package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.d.ts.map +1 -0
  378. package/node_modules/@oscharko-dev/keiko-server/dist/chat-activity.js +336 -0
  379. package/node_modules/@oscharko-dev/keiko-server/dist/chat-compaction-model-summary.d.ts.map +1 -1
  380. package/node_modules/@oscharko-dev/keiko-server/dist/chat-compaction-model-summary.js +28 -10
  381. package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.d.ts +5 -5
  382. package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.d.ts.map +1 -1
  383. package/node_modules/@oscharko-dev/keiko-server/dist/chat-handlers.js +49 -66
  384. package/node_modules/@oscharko-dev/keiko-server/dist/chat-stream-handlers.d.ts.map +1 -1
  385. package/node_modules/@oscharko-dev/keiko-server/dist/chat-stream-handlers.js +5 -1
  386. package/node_modules/@oscharko-dev/keiko-server/dist/client-diagnostics-routes.d.ts +9 -1
  387. package/node_modules/@oscharko-dev/keiko-server/dist/client-diagnostics-routes.d.ts.map +1 -1
  388. package/node_modules/@oscharko-dev/keiko-server/dist/client-diagnostics-routes.js +1202 -50
  389. package/node_modules/@oscharko-dev/keiko-server/dist/coding-app-session/codingAppSessionRoutes.d.ts.map +1 -1
  390. package/node_modules/@oscharko-dev/keiko-server/dist/coding-app-session/codingAppSessionRoutes.js +98 -35
  391. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/activity-log.d.ts +22 -0
  392. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/activity-log.d.ts.map +1 -0
  393. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/activity-log.js +83 -0
  394. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/codeContextConnector.d.ts.map +1 -1
  395. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/codeContextConnector.js +10 -15
  396. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/codingRuntimeIssueIntake.d.ts.map +1 -1
  397. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/codingRuntimeIssueIntake.js +45 -23
  398. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubAuthorizationRoutes.d.ts.map +1 -1
  399. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubAuthorizationRoutes.js +21 -6
  400. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubCodeContextPort.d.ts.map +1 -1
  401. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubCodeContextPort.js +90 -12
  402. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubIssueReaderAuthorization.d.ts.map +1 -1
  403. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubIssueReaderAuthorization.js +85 -27
  404. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubIssueResolution.d.ts +2 -0
  405. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubIssueResolution.d.ts.map +1 -1
  406. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/githubIssueResolution.js +118 -14
  407. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/issuePreviewRoutes.d.ts.map +1 -1
  408. package/node_modules/@oscharko-dev/keiko-server/dist/coding-context/issuePreviewRoutes.js +53 -9
  409. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingHistoryRoutes.d.ts +7 -0
  410. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingHistoryRoutes.d.ts.map +1 -0
  411. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingHistoryRoutes.js +78 -0
  412. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRepositorySearchHandler.d.ts.map +1 -1
  413. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRepositorySearchHandler.js +126 -27
  414. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeActivityOperations.d.ts +857 -0
  415. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeActivityOperations.d.ts.map +1 -0
  416. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeActivityOperations.js +411 -0
  417. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairBudgetStore.d.ts.map +1 -1
  418. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairBudgetStore.js +49 -44
  419. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairBudgetTypes.d.ts +2 -0
  420. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairBudgetTypes.d.ts.map +1 -1
  421. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairBudgetTypes.js +17 -0
  422. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairController.d.ts +9 -1
  423. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairController.d.ts.map +1 -1
  424. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeCiRepairController.js +38 -20
  425. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeControlPlane.d.ts +2 -0
  426. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeControlPlane.d.ts.map +1 -1
  427. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeControlPlane.js +4 -0
  428. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeHistory.d.ts +40 -0
  429. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeHistory.d.ts.map +1 -0
  430. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeHistory.js +372 -0
  431. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeIssueIntake.d.ts +2 -0
  432. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeIssueIntake.d.ts.map +1 -1
  433. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeIssueIntake.js +104 -20
  434. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeManager.d.ts.map +1 -1
  435. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeManager.js +0 -1
  436. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOperationCoordinator.d.ts.map +1 -1
  437. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOperationCoordinator.js +183 -27
  438. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOrchestrator.d.ts +12 -3
  439. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOrchestrator.d.ts.map +1 -1
  440. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOrchestrator.js +963 -223
  441. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOrchestratorTypes.d.ts +3 -0
  442. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeOrchestratorTypes.d.ts.map +1 -1
  443. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeRoutes.d.ts.map +1 -1
  444. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeRoutes.js +123 -14
  445. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeSnapshotStore.d.ts +2 -0
  446. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeSnapshotStore.d.ts.map +1 -1
  447. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeSnapshotStore.js +33 -16
  448. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeVerifiedCommitAuthorityStore.d.ts.map +1 -1
  449. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingRuntimeVerifiedCommitAuthorityStore.js +23 -9
  450. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingSafeActivityProjection.d.ts +1 -1
  451. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingSafeActivityProjection.d.ts.map +1 -1
  452. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingSafeActivityProjection.js +66 -19
  453. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolAuthorityPort.d.ts.map +1 -1
  454. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolAuthorityPort.js +46 -5
  455. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolFacade.d.ts.map +1 -1
  456. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolFacade.js +13 -1
  457. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolGovernedDelegate.d.ts.map +1 -1
  458. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolGovernedDelegate.js +6 -5
  459. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolIpc.d.ts +8 -2
  460. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolIpc.d.ts.map +1 -1
  461. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolReadEditPorts.d.ts.map +1 -1
  462. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/codingToolReadEditPorts.js +130 -31
  463. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/devLanePortableCodingRuntime.js +3 -3
  464. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/devLaneRuntimeProcessBackend.d.ts +1 -1
  465. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/devLaneRuntimeProcessBackend.d.ts.map +1 -1
  466. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/devLaneRuntimeProcessBackend.js +54 -47
  467. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/nativeRuntimeProcessBackend.d.ts +1 -1
  468. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/nativeRuntimeProcessBackend.d.ts.map +1 -1
  469. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/nativeRuntimeProcessBackend.js +13 -16
  470. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeLaunchProfile.d.ts +5 -2
  471. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeLaunchProfile.d.ts.map +1 -1
  472. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeLaunchProfile.js +56 -4
  473. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeProtocolSurface.d.ts +4 -1
  474. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeProtocolSurface.d.ts.map +1 -1
  475. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeProtocolSurface.js +24 -4
  476. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeAdapter.d.ts +10 -1
  477. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeAdapter.d.ts.map +1 -1
  478. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeAdapter.js +244 -61
  479. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeComposition.d.ts +2 -1
  480. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeComposition.d.ts.map +1 -1
  481. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeComposition.js +268 -368
  482. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeToolSchemas.d.ts +5 -13
  483. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeToolSchemas.d.ts.map +1 -1
  484. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeToolSchemas.js +15 -44
  485. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2ApprovalRequests.d.ts +16 -0
  486. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2ApprovalRequests.d.ts.map +1 -0
  487. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2ApprovalRequests.js +86 -0
  488. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2History.d.ts +22 -0
  489. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2History.d.ts.map +1 -0
  490. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2History.js +438 -0
  491. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2HttpClient.d.ts +30 -0
  492. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2HttpClient.d.ts.map +1 -0
  493. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2HttpClient.js +251 -0
  494. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2Questions.d.ts +7 -0
  495. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2Questions.d.ts.map +1 -0
  496. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeV2Questions.js +125 -0
  497. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionAuxiliaryPorts.d.ts.map +1 -1
  498. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionAuxiliaryPorts.js +42 -14
  499. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCiRepairRuntime.d.ts.map +1 -1
  500. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCiRepairRuntime.js +65 -36
  501. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimePorts.d.ts.map +1 -1
  502. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimePorts.js +109 -21
  503. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimeQuestionPort.d.ts.map +1 -1
  504. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimeQuestionPort.js +3 -6
  505. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimeResolver.d.ts +1 -1
  506. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimeResolver.d.ts.map +1 -1
  507. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionCodingRuntimeResolver.js +18 -8
  508. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionDraftDeliveryDependencies.d.ts.map +1 -1
  509. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionDraftDeliveryDependencies.js +160 -46
  510. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionManagedWorktreeTools.d.ts.map +1 -1
  511. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionManagedWorktreeTools.js +423 -106
  512. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeActivation.d.ts +2 -0
  513. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeActivation.d.ts.map +1 -1
  514. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeActivation.js +100 -18
  515. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeBackend.d.ts +6 -1
  516. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeBackend.d.ts.map +1 -1
  517. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeBackend.js +43 -16
  518. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionRuntimeGitPreparation.d.ts.map +1 -1
  519. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionRuntimeGitPreparation.js +51 -7
  520. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionVerifiedCommitDependencies.d.ts.map +1 -1
  521. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionVerifiedCommitDependencies.js +32 -9
  522. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/readOnlyChildOrchestrator.d.ts +1 -1
  523. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/readOnlyChildOrchestrator.d.ts.map +1 -1
  524. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/readOnlyChildOrchestrator.js +155 -22
  525. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/runtimeAuthorityService.d.ts +1 -1
  526. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/runtimeAuthorityService.d.ts.map +1 -1
  527. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/runtimeAuthorityService.js +300 -61
  528. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/windowsPortableAuthenticode.d.ts.map +1 -1
  529. package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/windowsPortableAuthenticode.js +30 -11
  530. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-gateway.d.ts.map +1 -1
  531. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-gateway.js +240 -61
  532. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-tool-facade.d.ts.map +1 -1
  533. package/node_modules/@oscharko-dev/keiko-server/dist/coding-sidecar-tool-facade.js +45 -8
  534. package/node_modules/@oscharko-dev/keiko-server/dist/deps-activity.d.ts +40 -0
  535. package/node_modules/@oscharko-dev/keiko-server/dist/deps-activity.d.ts.map +1 -0
  536. package/node_modules/@oscharko-dev/keiko-server/dist/deps-activity.js +207 -0
  537. package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts +7 -1
  538. package/node_modules/@oscharko-dev/keiko-server/dist/deps.d.ts.map +1 -1
  539. package/node_modules/@oscharko-dev/keiko-server/dist/deps.js +69 -58
  540. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts +1 -1
  541. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.d.ts.map +1 -1
  542. package/node_modules/@oscharko-dev/keiko-server/dist/diagnostics-log.js +194 -26
  543. package/node_modules/@oscharko-dev/keiko-server/dist/editor/agentProducerRoute.d.ts.map +1 -1
  544. package/node_modules/@oscharko-dev/keiko-server/dist/editor/agentProducerRoute.js +113 -17
  545. package/node_modules/@oscharko-dev/keiko-server/dist/editor/agentRoutes.d.ts.map +1 -1
  546. package/node_modules/@oscharko-dev/keiko-server/dist/editor/agentRoutes.js +7 -1
  547. package/node_modules/@oscharko-dev/keiko-server/dist/editor/dap/debugLaunchPlan.d.ts.map +1 -1
  548. package/node_modules/@oscharko-dev/keiko-server/dist/editor/dap/debugLaunchPlan.js +35 -11
  549. package/node_modules/@oscharko-dev/keiko-server/dist/editor/localHistory/localHistoryCapture.d.ts +1 -1
  550. package/node_modules/@oscharko-dev/keiko-server/dist/editor/localHistory/localHistoryCapture.d.ts.map +1 -1
  551. package/node_modules/@oscharko-dev/keiko-server/dist/editor/localHistory/localHistoryCapture.js +56 -15
  552. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/lspNodeAdapter.d.ts.map +1 -1
  553. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/lspNodeAdapter.js +201 -37
  554. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/lspProcessManager.d.ts.map +1 -1
  555. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/lspProcessManager.js +51 -11
  556. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/providers/javaProvider.d.ts.map +1 -1
  557. package/node_modules/@oscharko-dev/keiko-server/dist/editor/lsp/providers/javaProvider.js +78 -11
  558. package/node_modules/@oscharko-dev/keiko-server/dist/editor/verificationExecution.d.ts +4 -1
  559. package/node_modules/@oscharko-dev/keiko-server/dist/editor/verificationExecution.d.ts.map +1 -1
  560. package/node_modules/@oscharko-dev/keiko-server/dist/editor/verificationExecution.js +55 -0
  561. package/node_modules/@oscharko-dev/keiko-server/dist/editor/verificationRunner.d.ts.map +1 -1
  562. package/node_modules/@oscharko-dev/keiko-server/dist/editor/verificationRunner.js +211 -65
  563. package/node_modules/@oscharko-dev/keiko-server/dist/editor/watch/workspaceWatchRoutes.d.ts.map +1 -1
  564. package/node_modules/@oscharko-dev/keiko-server/dist/editor/watch/workspaceWatchRoutes.js +33 -6
  565. package/node_modules/@oscharko-dev/keiko-server/dist/evidence-retention-log.d.ts.map +1 -1
  566. package/node_modules/@oscharko-dev/keiko-server/dist/evidence-retention-log.js +36 -6
  567. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-instance-cache.d.ts.map +1 -1
  568. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-instance-cache.js +97 -22
  569. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.d.ts +5 -3
  570. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.d.ts.map +1 -1
  571. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-readiness.js +220 -39
  572. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.d.ts.map +1 -1
  573. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-setup.js +283 -68
  574. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-spend-budget.d.ts.map +1 -1
  575. package/node_modules/@oscharko-dev/keiko-server/dist/gateway-spend-budget.js +138 -45
  576. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeChatContext.d.ts.map +1 -1
  577. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeChatContext.js +97 -13
  578. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeRoutes.d.ts +5 -0
  579. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeRoutes.d.ts.map +1 -1
  580. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeRoutes.js +146 -30
  581. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotReader.d.ts.map +1 -1
  582. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotReader.js +13 -1
  583. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotRegistry.d.ts.map +1 -1
  584. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotRegistry.js +122 -32
  585. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotService.d.ts.map +1 -1
  586. package/node_modules/@oscharko-dev/keiko-server/dist/gitChangeSnapshotService.js +140 -24
  587. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/approvalEvents.d.ts +6 -2
  588. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/approvalEvents.d.ts.map +1 -1
  589. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/approvalEvents.js +192 -8
  590. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/ciObservationService.d.ts.map +1 -1
  591. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/ciObservationService.js +154 -26
  592. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.d.ts +2 -2
  593. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.d.ts.map +1 -1
  594. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/commitRoutes.js +100 -46
  595. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryChecks.d.ts +21 -0
  596. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryChecks.d.ts.map +1 -1
  597. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryChecks.js +108 -13
  598. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryChecksRefresh.d.ts.map +1 -1
  599. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryChecksRefresh.js +23 -20
  600. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryFacts.d.ts.map +1 -1
  601. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryFacts.js +93 -18
  602. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryLedger.d.ts +28 -0
  603. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryLedger.d.ts.map +1 -1
  604. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryLedger.js +123 -33
  605. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryService.d.ts.map +1 -1
  606. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryService.js +33 -33
  607. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryTemplate.d.ts.map +1 -1
  608. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftDeliveryTemplate.js +97 -24
  609. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftRelatedIssuesActivity.d.ts +150 -0
  610. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftRelatedIssuesActivity.d.ts.map +1 -0
  611. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/draftRelatedIssuesActivity.js +64 -0
  612. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/execution.d.ts +226 -1
  613. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/execution.d.ts.map +1 -1
  614. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/execution.js +344 -70
  615. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/journeyObservationService.d.ts +25 -0
  616. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/journeyObservationService.d.ts.map +1 -1
  617. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/journeyObservationService.js +159 -26
  618. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/journeyRoutes.d.ts.map +1 -1
  619. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/journeyRoutes.js +238 -59
  620. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/localMutationRoutes.d.ts.map +1 -1
  621. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/localMutationRoutes.js +2 -9
  622. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/mergeExecution.d.ts.map +1 -1
  623. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/mergeExecution.js +79 -13
  624. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionPreparation.d.ts.map +1 -1
  625. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionPreparation.js +6 -2
  626. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionProjection.d.ts.map +1 -1
  627. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionProjection.js +133 -16
  628. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionReceiptStore.d.ts.map +1 -1
  629. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionReceiptStore.js +73 -19
  630. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionRoutes.d.ts.map +1 -1
  631. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionRoutes.js +147 -50
  632. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionService.d.ts.map +1 -1
  633. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionService.js +4 -3
  634. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionTypes.d.ts +12 -4
  635. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prDescriptionTypes.d.ts.map +1 -1
  636. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prMarkReadyExecution.d.ts +1 -1
  637. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prMarkReadyExecution.d.ts.map +1 -1
  638. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/prMarkReadyExecution.js +138 -42
  639. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/repositoryInitializationRoutes.d.ts.map +1 -1
  640. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/repositoryInitializationRoutes.js +51 -7
  641. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/requestPreparation.d.ts +4 -0
  642. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/requestPreparation.d.ts.map +1 -1
  643. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/requestPreparation.js +145 -26
  644. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/runtimeGitRead.d.ts.map +1 -1
  645. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/runtimeGitRead.js +43 -13
  646. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/runtimeGitService.d.ts.map +1 -1
  647. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/runtimeGitService.js +122 -11
  648. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/syncRoutes.d.ts.map +1 -1
  649. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/syncRoutes.js +4 -15
  650. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/verifiedCommitService.d.ts.map +1 -1
  651. package/node_modules/@oscharko-dev/keiko-server/dist/gitDelivery/verifiedCommitService.js +194 -11
  652. package/node_modules/@oscharko-dev/keiko-server/dist/gitProcessActivity.d.ts +5 -2
  653. package/node_modules/@oscharko-dev/keiko-server/dist/gitProcessActivity.d.ts.map +1 -1
  654. package/node_modules/@oscharko-dev/keiko-server/dist/gitProcessActivity.js +157 -31
  655. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-orchestrator.d.ts.map +1 -1
  656. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-orchestrator.js +514 -74
  657. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-qa.d.ts.map +1 -1
  658. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-qa.js +7 -2
  659. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-rerank-facade.d.ts.map +1 -1
  660. package/node_modules/@oscharko-dev/keiko-server/dist/grounded-rerank-facade.js +84 -20
  661. package/node_modules/@oscharko-dev/keiko-server/dist/harness-context-compactor.d.ts.map +1 -1
  662. package/node_modules/@oscharko-dev/keiko-server/dist/harness-context-compactor.js +30 -9
  663. package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts +7 -0
  664. package/node_modules/@oscharko-dev/keiko-server/dist/index.d.ts.map +1 -1
  665. package/node_modules/@oscharko-dev/keiko-server/dist/index.js +20 -0
  666. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-handlers.d.ts.map +1 -1
  667. package/node_modules/@oscharko-dev/keiko-server/dist/local-knowledge-handlers.js +287 -68
  668. package/node_modules/@oscharko-dev/keiko-server/dist/memory-embedding.d.ts.map +1 -1
  669. package/node_modules/@oscharko-dev/keiko-server/dist/memory-embedding.js +219 -65
  670. package/node_modules/@oscharko-dev/keiko-server/dist/native-file-dialog/route.d.ts.map +1 -1
  671. package/node_modules/@oscharko-dev/keiko-server/dist/native-file-dialog/route.js +30 -10
  672. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-loss-summary.d.ts +233 -0
  673. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-loss-summary.d.ts.map +1 -0
  674. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-loss-summary.js +124 -0
  675. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-persistence.d.ts +8 -0
  676. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-persistence.d.ts.map +1 -0
  677. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-persistence.js +25 -0
  678. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-readiness.d.ts +34 -0
  679. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-readiness.d.ts.map +1 -0
  680. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-readiness.js +301 -0
  681. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-store.d.ts +215 -0
  682. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-store.d.ts.map +1 -0
  683. package/node_modules/@oscharko-dev/keiko-server/dist/observability/activity-log-store.js +755 -0
  684. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.d.ts +4 -0
  685. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.d.ts.map +1 -1
  686. package/node_modules/@oscharko-dev/keiko-server/dist/observability/index.js +6 -2
  687. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-redaction.d.ts.map +1 -1
  688. package/node_modules/@oscharko-dev/keiko-server/dist/observability/log-redaction.js +25 -14
  689. package/node_modules/@oscharko-dev/keiko-server/dist/observability/model-id-evidence.d.ts +17 -0
  690. package/node_modules/@oscharko-dev/keiko-server/dist/observability/model-id-evidence.d.ts.map +1 -0
  691. package/node_modules/@oscharko-dev/keiko-server/dist/observability/model-id-evidence.js +35 -0
  692. package/node_modules/@oscharko-dev/keiko-server/dist/observability/runtime-state-dir.d.ts +6 -0
  693. package/node_modules/@oscharko-dev/keiko-server/dist/observability/runtime-state-dir.d.ts.map +1 -0
  694. package/node_modules/@oscharko-dev/keiko-server/dist/observability/runtime-state-dir.js +23 -0
  695. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts +106 -6
  696. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.d.ts.map +1 -1
  697. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-log.js +2504 -481
  698. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.d.ts +38 -2
  699. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.d.ts.map +1 -1
  700. package/node_modules/@oscharko-dev/keiko-server/dist/observability/server-logger.js +187 -39
  701. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident-store.d.ts +44 -0
  702. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident-store.d.ts.map +1 -0
  703. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident-store.js +255 -0
  704. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident.d.ts +107 -0
  705. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident.d.ts.map +1 -0
  706. package/node_modules/@oscharko-dev/keiko-server/dist/observability/support-incident.js +1052 -0
  707. package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.d.ts.map +1 -1
  708. package/node_modules/@oscharko-dev/keiko-server/dist/process-log-sink.js +66 -17
  709. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/capsuleAdapter.d.ts +3 -2
  710. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/capsuleAdapter.d.ts.map +1 -1
  711. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/capsuleAdapter.js +35 -5
  712. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/figmaSnapshotRoutes.d.ts.map +1 -1
  713. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/figmaSnapshotRoutes.js +3 -1
  714. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/handoffRoutes.d.ts.map +1 -1
  715. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/handoffRoutes.js +7 -6
  716. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/reCheckRoutes.d.ts.map +1 -1
  717. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/reCheckRoutes.js +7 -2
  718. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/runRoutes.d.ts.map +1 -1
  719. package/node_modules/@oscharko-dev/keiko-server/dist/qualityIntelligence/runRoutes.js +7 -2
  720. package/node_modules/@oscharko-dev/keiko-server/dist/reference-id.d.ts +16 -0
  721. package/node_modules/@oscharko-dev/keiko-server/dist/reference-id.d.ts.map +1 -0
  722. package/node_modules/@oscharko-dev/keiko-server/dist/reference-id.js +90 -0
  723. package/node_modules/@oscharko-dev/keiko-server/dist/routes.d.ts.map +1 -1
  724. package/node_modules/@oscharko-dev/keiko-server/dist/routes.js +12 -7
  725. package/node_modules/@oscharko-dev/keiko-server/dist/run-engine.d.ts.map +1 -1
  726. package/node_modules/@oscharko-dev/keiko-server/dist/run-engine.js +3 -3
  727. package/node_modules/@oscharko-dev/keiko-server/dist/run-handlers.d.ts.map +1 -1
  728. package/node_modules/@oscharko-dev/keiko-server/dist/run-handlers.js +33 -9
  729. package/node_modules/@oscharko-dev/keiko-server/dist/server.d.ts.map +1 -1
  730. package/node_modules/@oscharko-dev/keiko-server/dist/server.js +50 -10
  731. package/node_modules/@oscharko-dev/keiko-server/dist/sse-write.d.ts.map +1 -1
  732. package/node_modules/@oscharko-dev/keiko-server/dist/sse-write.js +37 -9
  733. package/node_modules/@oscharko-dev/keiko-server/dist/store/chats.d.ts.map +1 -1
  734. package/node_modules/@oscharko-dev/keiko-server/dist/store/chats.js +3 -2
  735. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistory.d.ts +36 -0
  736. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistory.d.ts.map +1 -0
  737. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistory.js +191 -0
  738. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistoryIsolation.d.ts +5 -0
  739. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistoryIsolation.d.ts.map +1 -0
  740. package/node_modules/@oscharko-dev/keiko-server/dist/store/codingHistoryIsolation.js +44 -0
  741. package/node_modules/@oscharko-dev/keiko-server/dist/store/db.d.ts +1 -1
  742. package/node_modules/@oscharko-dev/keiko-server/dist/store/db.d.ts.map +1 -1
  743. package/node_modules/@oscharko-dev/keiko-server/dist/store/db.js +61 -37
  744. package/node_modules/@oscharko-dev/keiko-server/dist/store/journeyOutcomeMigration.d.ts.map +1 -1
  745. package/node_modules/@oscharko-dev/keiko-server/dist/store/journeyOutcomeMigration.js +26 -5
  746. package/node_modules/@oscharko-dev/keiko-server/dist/store/legacySchemaTestFixture.d.ts.map +1 -1
  747. package/node_modules/@oscharko-dev/keiko-server/dist/store/legacySchemaTestFixture.js +9 -1
  748. package/node_modules/@oscharko-dev/keiko-server/dist/store/schema.d.ts +1 -1
  749. package/node_modules/@oscharko-dev/keiko-server/dist/store/schema.d.ts.map +1 -1
  750. package/node_modules/@oscharko-dev/keiko-server/dist/store/schema.js +31 -1
  751. package/node_modules/@oscharko-dev/keiko-server/dist/store/transaction.d.ts +4 -0
  752. package/node_modules/@oscharko-dev/keiko-server/dist/store/transaction.d.ts.map +1 -0
  753. package/node_modules/@oscharko-dev/keiko-server/dist/store/transaction.js +19 -0
  754. package/node_modules/@oscharko-dev/keiko-server/dist/store/types.d.ts +6 -1
  755. package/node_modules/@oscharko-dev/keiko-server/dist/store/types.d.ts.map +1 -1
  756. package/node_modules/@oscharko-dev/keiko-server/dist/store-handlers.d.ts.map +1 -1
  757. package/node_modules/@oscharko-dev/keiko-server/dist/store-handlers.js +34 -8
  758. package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/activity-log.d.ts.map +1 -1
  759. package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/activity-log.js +212 -13
  760. package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/workspace-root-access.d.ts.map +1 -1
  761. package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/workspace-root-access.js +31 -28
  762. package/node_modules/@oscharko-dev/keiko-server/dist/terminal-routes.d.ts.map +1 -1
  763. package/node_modules/@oscharko-dev/keiko-server/dist/terminal-routes.js +6 -10
  764. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolBinder.d.ts.map +1 -1
  765. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolBinder.js +18 -9
  766. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolFacadeBridge.d.ts.map +1 -1
  767. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolFacadeBridge.js +41 -5
  768. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolLifecycle.d.ts.map +1 -1
  769. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolLifecycle.js +401 -17
  770. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolSettlement.d.ts.map +1 -1
  771. package/node_modules/@oscharko-dev/keiko-server/dist/tool-catalog/catalogToolSettlement.js +1 -2
  772. package/node_modules/@oscharko-dev/keiko-server/dist/update-candidate-authority.d.ts +1 -1
  773. package/node_modules/@oscharko-dev/keiko-server/dist/update-candidate-authority.d.ts.map +1 -1
  774. package/node_modules/@oscharko-dev/keiko-server/dist/update-candidate-authority.js +170 -39
  775. package/node_modules/@oscharko-dev/keiko-server/dist/update-legacy-audit-import.d.ts.map +1 -1
  776. package/node_modules/@oscharko-dev/keiko-server/dist/update-legacy-audit-import.js +94 -66
  777. package/node_modules/@oscharko-dev/keiko-server/dist/update-local-state.d.ts +1 -1
  778. package/node_modules/@oscharko-dev/keiko-server/dist/update-local-state.d.ts.map +1 -1
  779. package/node_modules/@oscharko-dev/keiko-server/dist/update-local-state.js +70 -20
  780. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-normal-startup.d.ts.map +1 -1
  781. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-normal-startup.js +87 -13
  782. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-sidecar-verification.d.ts +2 -2
  783. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-sidecar-verification.d.ts.map +1 -1
  784. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-sidecar-verification.js +7 -7
  785. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-staging.d.ts.map +1 -1
  786. package/node_modules/@oscharko-dev/keiko-server/dist/update-portable-staging.js +4 -4
  787. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-activity.d.ts +16 -0
  788. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-activity.d.ts.map +1 -0
  789. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-activity.js +182 -0
  790. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-assets.d.ts +1 -1
  791. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-assets.d.ts.map +1 -1
  792. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-assets.js +5 -15
  793. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-evidence.d.ts +1 -1
  794. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-evidence.d.ts.map +1 -1
  795. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-portable-evidence.js +21 -47
  796. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-routes.d.ts +5 -5
  797. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-routes.d.ts.map +1 -1
  798. package/node_modules/@oscharko-dev/keiko-server/dist/update-preflight-routes.js +21 -15
  799. package/node_modules/@oscharko-dev/keiko-server/dist/update-runtime-activity.d.ts +39 -0
  800. package/node_modules/@oscharko-dev/keiko-server/dist/update-runtime-activity.d.ts.map +1 -0
  801. package/node_modules/@oscharko-dev/keiko-server/dist/update-runtime-activity.js +266 -0
  802. package/node_modules/@oscharko-dev/keiko-server/dist/update-session.d.ts.map +1 -1
  803. package/node_modules/@oscharko-dev/keiko-server/dist/update-session.js +138 -20
  804. package/node_modules/@oscharko-dev/keiko-server/dist/voice-handlers.d.ts.map +1 -1
  805. package/node_modules/@oscharko-dev/keiko-server/dist/voice-handlers.js +5 -0
  806. package/node_modules/@oscharko-dev/keiko-server/dist/voice-live-dictation.d.ts.map +1 -1
  807. package/node_modules/@oscharko-dev/keiko-server/dist/voice-live-dictation.js +41 -11
  808. package/node_modules/@oscharko-dev/keiko-server/dist/voice-realtime.d.ts.map +1 -1
  809. package/node_modules/@oscharko-dev/keiko-server/dist/voice-realtime.js +70 -17
  810. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-root-denial-log.d.ts +11 -1
  811. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-root-denial-log.d.ts.map +1 -1
  812. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-root-denial-log.js +81 -26
  813. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-script-trust.d.ts +2 -2
  814. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-script-trust.d.ts.map +1 -1
  815. package/node_modules/@oscharko-dev/keiko-server/dist/workspace-script-trust.js +135 -37
  816. package/node_modules/@oscharko-dev/keiko-server/package.json +22 -22
  817. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/dialect.d.ts.map +1 -1
  818. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/dialect.js +4 -6
  819. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/opencode.d.ts +2 -2
  820. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/opencode.d.ts.map +1 -1
  821. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/opencode.js +30 -70
  822. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/profile.d.ts.map +1 -1
  823. package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/profile.js +1 -1
  824. package/node_modules/@oscharko-dev/keiko-tool-catalog/package.json +3 -3
  825. package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
  826. package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
  827. package/node_modules/@oscharko-dev/keiko-tools/package.json +7 -7
  828. package/node_modules/@oscharko-dev/keiko-verification/dist/dependencies.d.ts +7 -3
  829. package/node_modules/@oscharko-dev/keiko-verification/dist/dependencies.d.ts.map +1 -1
  830. package/node_modules/@oscharko-dev/keiko-verification/dist/dependencies.js +192 -14
  831. package/node_modules/@oscharko-dev/keiko-verification/dist/orchestrator.d.ts +2 -0
  832. package/node_modules/@oscharko-dev/keiko-verification/dist/orchestrator.d.ts.map +1 -1
  833. package/node_modules/@oscharko-dev/keiko-verification/dist/orchestrator.js +6 -2
  834. package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
  835. package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
  836. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
  837. package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
  838. package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
  839. package/package.json +29 -26
  840. package/release-impact.catalog.json +74 -0
  841. package/scripts/lib/local-state-audit.mjs +94 -0
  842. package/vendor/oscharko-dev-keiko-cli-1.1.0.tgz +0 -0
  843. package/vendor/{oscharko-dev-keiko-connectors-1.0.5.tgz → oscharko-dev-keiko-connectors-1.1.0.tgz} +0 -0
  844. package/vendor/oscharko-dev-keiko-contracts-1.1.0.tgz +0 -0
  845. package/vendor/oscharko-dev-keiko-evaluations-1.1.0.tgz +0 -0
  846. package/vendor/{oscharko-dev-keiko-evidence-1.0.5.tgz → oscharko-dev-keiko-evidence-1.1.0.tgz} +0 -0
  847. package/vendor/oscharko-dev-keiko-git-1.1.0.tgz +0 -0
  848. package/vendor/{oscharko-dev-keiko-harness-1.0.5.tgz → oscharko-dev-keiko-harness-1.1.0.tgz} +0 -0
  849. package/vendor/oscharko-dev-keiko-local-knowledge-1.1.0.tgz +0 -0
  850. package/vendor/{oscharko-dev-keiko-memory-capture-1.0.5.tgz → oscharko-dev-keiko-memory-capture-1.1.0.tgz} +0 -0
  851. package/vendor/oscharko-dev-keiko-memory-consolidation-1.1.0.tgz +0 -0
  852. package/vendor/{oscharko-dev-keiko-memory-governance-1.0.5.tgz → oscharko-dev-keiko-memory-governance-1.1.0.tgz} +0 -0
  853. package/vendor/{oscharko-dev-keiko-memory-retrieval-1.0.5.tgz → oscharko-dev-keiko-memory-retrieval-1.1.0.tgz} +0 -0
  854. package/vendor/oscharko-dev-keiko-memory-vault-1.1.0.tgz +0 -0
  855. package/vendor/oscharko-dev-keiko-model-gateway-1.1.0.tgz +0 -0
  856. package/vendor/{oscharko-dev-keiko-quality-intelligence-1.0.5.tgz → oscharko-dev-keiko-quality-intelligence-1.1.0.tgz} +0 -0
  857. package/vendor/oscharko-dev-keiko-sandbox-1.1.0.tgz +0 -0
  858. package/vendor/oscharko-dev-keiko-sdk-1.1.0.tgz +0 -0
  859. package/vendor/oscharko-dev-keiko-security-1.1.0.tgz +0 -0
  860. package/vendor/oscharko-dev-keiko-server-1.1.0.tgz +0 -0
  861. package/vendor/oscharko-dev-keiko-tool-catalog-1.1.0.tgz +0 -0
  862. package/vendor/{oscharko-dev-keiko-tools-1.0.5.tgz → oscharko-dev-keiko-tools-1.1.0.tgz} +0 -0
  863. package/vendor/oscharko-dev-keiko-verification-1.1.0.tgz +0 -0
  864. package/vendor/{oscharko-dev-keiko-workflows-1.0.5.tgz → oscharko-dev-keiko-workflows-1.1.0.tgz} +0 -0
  865. package/vendor/{oscharko-dev-keiko-workspace-1.0.5.tgz → oscharko-dev-keiko-workspace-1.1.0.tgz} +0 -0
  866. package/dist/ui/static/_next/static/chunks/0-tss9mlvjuz4.js +0 -1
  867. package/dist/ui/static/_next/static/chunks/04lb-38e89aw8.js +0 -1
  868. package/dist/ui/static/_next/static/chunks/04t-d0js_hvfr.js +0 -1
  869. package/dist/ui/static/_next/static/chunks/086jxcgou7s_5.js +0 -1
  870. package/dist/ui/static/_next/static/chunks/08pxrik1lm06d.js +0 -5
  871. package/dist/ui/static/_next/static/chunks/093r62_9c_psx.js +0 -1
  872. package/dist/ui/static/_next/static/chunks/0_u5vd-_66bpj.js +0 -1
  873. package/dist/ui/static/_next/static/chunks/0gsb-naamu9g1.js +0 -1
  874. package/dist/ui/static/_next/static/chunks/0ix9hk8cnb0as.js +0 -1
  875. package/dist/ui/static/_next/static/chunks/0n9uef9g17pxd.js +0 -1
  876. package/dist/ui/static/_next/static/chunks/0o131urxtkbxj.js +0 -1
  877. package/dist/ui/static/_next/static/chunks/0pac-465ukeam.js +0 -1
  878. package/dist/ui/static/_next/static/chunks/0qzzopo8q0m1e.js +0 -1
  879. package/dist/ui/static/_next/static/chunks/0vvfq-eocx502.js +0 -1
  880. package/dist/ui/static/_next/static/chunks/15wh9-75zvro2.js +0 -1
  881. package/dist/ui/static/_next/static/chunks/160x2go4zkjhx.js +0 -1
  882. package/dist/ui/static/_next/static/chunks/17yrtbw7mk5py.css +0 -2
  883. package/dist/ui/static/_next/static/chunks/1kgbe4la7mty5.js +0 -1
  884. package/dist/ui/static/_next/static/chunks/1peg9ve597086.js +0 -1
  885. package/dist/ui/static/_next/static/chunks/1q6j3gd8d86-v.css +0 -2
  886. package/dist/ui/static/_next/static/chunks/1t_6hc_5pxuqd.js +0 -1
  887. package/dist/ui/static/_next/static/chunks/1v4mpk8t6w8_7.js +0 -1
  888. package/dist/ui/static/_next/static/chunks/1yj6x688jjk-a.js +0 -1
  889. package/dist/ui/static/_next/static/chunks/21djhsnzx069x.js +0 -1
  890. package/dist/ui/static/_next/static/chunks/23e-psiwdsaxk.js +0 -1
  891. package/dist/ui/static/_next/static/chunks/289h3-vke8o67.js +0 -1
  892. package/dist/ui/static/_next/static/chunks/2dxo0g3208ag1.js +0 -1
  893. package/dist/ui/static/_next/static/chunks/2jadbwshuwe_n.js +0 -1
  894. package/dist/ui/static/_next/static/chunks/2u9u5i8o6vd-w.js +0 -1
  895. package/dist/ui/static/_next/static/chunks/2vj6gqk9lh7yv.js +0 -1
  896. package/dist/ui/static/_next/static/chunks/3-k1y9vbxcms8.js +0 -3
  897. package/dist/ui/static/_next/static/chunks/3137i2nt475lq.js +0 -1
  898. package/dist/ui/static/_next/static/chunks/3_jzs5uvplshk.js +0 -1
  899. package/dist/ui/static/_next/static/chunks/3d-jscai6hb55.js +0 -1
  900. package/dist/ui/static/_next/static/chunks/3dkw81rui6ry8.js +0 -1
  901. package/dist/ui/static/_next/static/chunks/3f3ici8rsavir.js +0 -1
  902. package/dist/ui/static/_next/static/chunks/3f_-h2lm9ml4b.js +0 -1
  903. package/dist/ui/static/_next/static/chunks/3frfm_q9cqdtg.js +0 -1
  904. package/dist/ui/static/_next/static/chunks/3irz7sn3e2ix3.js +0 -1
  905. package/dist/ui/static/_next/static/chunks/3j1p83q4cv4cv.js +0 -1
  906. package/dist/ui/static/_next/static/chunks/3kgmrssgqwg_h.js +0 -1
  907. package/dist/ui/static/_next/static/chunks/3lc67g1jowxt_.js +0 -1
  908. package/dist/ui/static/_next/static/chunks/3pgmij812w0aa.css +0 -1
  909. package/dist/ui/static/_next/static/chunks/3q3ds5x5j4w7j.js +0 -1
  910. package/dist/ui/static/_next/static/chunks/3r2v5s5l7jkoj.js +0 -1
  911. package/dist/ui/static/_next/static/chunks/3w9c58yrtr4oj.js +0 -1
  912. package/dist/ui/static/_next/static/chunks/3wxm1wke5887n.js +0 -7
  913. package/dist/ui/static/_next/static/chunks/3ymz8bp4uzhhh.js +0 -1
  914. package/vendor/oscharko-dev-keiko-cli-1.0.5.tgz +0 -0
  915. package/vendor/oscharko-dev-keiko-contracts-1.0.5.tgz +0 -0
  916. package/vendor/oscharko-dev-keiko-evaluations-1.0.5.tgz +0 -0
  917. package/vendor/oscharko-dev-keiko-git-1.0.5.tgz +0 -0
  918. package/vendor/oscharko-dev-keiko-local-knowledge-1.0.5.tgz +0 -0
  919. package/vendor/oscharko-dev-keiko-memory-consolidation-1.0.5.tgz +0 -0
  920. package/vendor/oscharko-dev-keiko-memory-vault-1.0.5.tgz +0 -0
  921. package/vendor/oscharko-dev-keiko-model-gateway-1.0.5.tgz +0 -0
  922. package/vendor/oscharko-dev-keiko-sandbox-1.0.5.tgz +0 -0
  923. package/vendor/oscharko-dev-keiko-sdk-1.0.5.tgz +0 -0
  924. package/vendor/oscharko-dev-keiko-security-1.0.5.tgz +0 -0
  925. package/vendor/oscharko-dev-keiko-server-1.0.5.tgz +0 -0
  926. package/vendor/oscharko-dev-keiko-tool-catalog-1.0.5.tgz +0 -0
  927. package/vendor/oscharko-dev-keiko-verification-1.0.5.tgz +0 -0
  928. /package/dist/ui/static/_next/static/{IaAMlj5CIiO4E3RPp1TWn → pnaCuBv6v6k-xKyv71Bct}/_buildManifest.js +0 -0
  929. /package/dist/ui/static/_next/static/{IaAMlj5CIiO4E3RPp1TWn → pnaCuBv6v6k-xKyv71Bct}/_clientMiddlewareManifest.js +0 -0
  930. /package/dist/ui/static/_next/static/{IaAMlj5CIiO4E3RPp1TWn → pnaCuBv6v6k-xKyv71Bct}/_ssgManifest.js +0 -0
@@ -6,7 +6,12 @@
6
6
  //
7
7
  // keiko-security depends only on keiko-contracts and is depended upon by the store/vault packages, so
8
8
  // hoisting this module here introduces no dependency cycle.
9
- import { chmodSync, existsSync, mkdirSync } from "node:fs";
9
+ import { createHash, randomBytes } from "node:crypto";
10
+ import { spawnSync } from "node:child_process";
11
+ import { chmodSync, closeSync, constants, existsSync, fchmodSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readSync, realpathSync, writeSync, } from "node:fs";
12
+ import { fileURLToPath } from "node:url";
13
+ import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
14
+ import { SAFE_ARTIFACT_DIRECTORY_MUTATION_EXIT, } from "./safe-artifact-directory-mutation-protocol.js";
10
15
  // Owner-only directory: rwx for the owner, nothing for group/other.
11
16
  export const DIR_MODE = 0o700;
12
17
  // Owner-only file: rw for the owner, nothing for group/other.
@@ -41,3 +46,1995 @@ export function chmodIfPresent(path, mode) {
41
46
  // The sidecar (-wal/-shm) may not exist yet; best-effort.
42
47
  }
43
48
  }
49
+ export const SAFE_ARTIFACT_CLASSES = [
50
+ "activity-log",
51
+ "support-report",
52
+ "replay-fixture",
53
+ "manifest",
54
+ "integrity-artifact",
55
+ ];
56
+ export const SAFE_ARTIFACT_FILE_FAILURE_KINDS = [
57
+ "invalid-publication",
58
+ "close-failed",
59
+ "durability-failed",
60
+ "open-failed",
61
+ "permission-failed",
62
+ "permission-unsafe",
63
+ "publish-failed",
64
+ "publish-unsupported",
65
+ "read-failed",
66
+ "recovery-conflict",
67
+ "replace-failed",
68
+ "target-exists",
69
+ "target-mutated",
70
+ "unsafe-ancestor",
71
+ "unsafe-target",
72
+ "write-failed",
73
+ ];
74
+ const SAFE_ARTIFACT_CLASS_SET = new Set(SAFE_ARTIFACT_CLASSES);
75
+ const SAFE_ARTIFACT_FAILURE_SET = new Set(SAFE_ARTIFACT_FILE_FAILURE_KINDS);
76
+ export function isSafeArtifactClass(value) {
77
+ return typeof value === "string" && SAFE_ARTIFACT_CLASS_SET.has(value);
78
+ }
79
+ export function isSafeArtifactFailureKind(value) {
80
+ return typeof value === "string" && SAFE_ARTIFACT_FAILURE_SET.has(value);
81
+ }
82
+ /** A closed, body-free filesystem failure safe to project into diagnostics. */
83
+ export class SafeArtifactFileError extends Error {
84
+ name = "SafeArtifactFileError";
85
+ artifactClass;
86
+ kind;
87
+ constructor(artifactClass, kind) {
88
+ const closedClass = isSafeArtifactClass(artifactClass) ? artifactClass : "manifest";
89
+ const closedKind = isSafeArtifactFailureKind(kind) ? kind : "open-failed";
90
+ super(`safe artifact ${closedClass} failed: ${closedKind}`);
91
+ this.artifactClass = closedClass;
92
+ this.kind = closedKind;
93
+ }
94
+ }
95
+ /** Windows inherits privacy from the operator-selected root ACL; Node cannot attest that DACL. */
96
+ export function safeArtifactPermissionAssurance() {
97
+ return process.platform === "win32" ? "platform-inherited" : "verified-private";
98
+ }
99
+ /** Node has no portable descriptor-relative create; containment inherits the guarded root. */
100
+ export function safeArtifactContainmentAssurance() {
101
+ return process.platform === "win32" ? "platform-inherited" : "private-root-guarded";
102
+ }
103
+ function safeFileError(artifactClass, kind) {
104
+ return new SafeArtifactFileError(artifactClass, kind);
105
+ }
106
+ function closeArtifactDescriptor(descriptor, artifactClass) {
107
+ try {
108
+ closeSync(descriptor);
109
+ }
110
+ catch {
111
+ throw safeFileError(artifactClass, "close-failed");
112
+ }
113
+ }
114
+ function errorCode(error) {
115
+ if (typeof error !== "object" || error === null || !("code" in error))
116
+ return undefined;
117
+ return typeof error.code === "string" ? error.code : undefined;
118
+ }
119
+ function pathExists(path, artifactClass) {
120
+ try {
121
+ lstatSync(path);
122
+ return true;
123
+ }
124
+ catch (error) {
125
+ if (errorCode(error) === "ENOENT")
126
+ return false;
127
+ throw safeFileError(artifactClass, "open-failed");
128
+ }
129
+ }
130
+ const DIRECTORY_MUTATION_TIMEOUT_MS = 5_000;
131
+ function directoryMutationHelperPath() {
132
+ const modulePath = fileURLToPath(import.meta.url);
133
+ const moduleDirectory = dirname(modulePath);
134
+ return modulePath.endsWith(".ts")
135
+ ? resolve(moduleDirectory, "../dist/safe-artifact-directory-mutation.js")
136
+ : join(moduleDirectory, "safe-artifact-directory-mutation.js");
137
+ }
138
+ function guardedParent(guards, parent, artifactClass) {
139
+ const parentKey = filesystemComparisonPath(parent);
140
+ const guard = guards.find((candidate) => filesystemComparisonPath(candidate.path) === parentKey);
141
+ if (guard === undefined || !guards.every(directoryGuardStillMatches)) {
142
+ throw safeFileError(artifactClass, "target-mutated");
143
+ }
144
+ return guard;
145
+ }
146
+ function mutationExitResult(status) {
147
+ if (status === SAFE_ARTIFACT_DIRECTORY_MUTATION_EXIT.success)
148
+ return "success";
149
+ if (status === SAFE_ARTIFACT_DIRECTORY_MUTATION_EXIT.targetExists)
150
+ return "target-exists";
151
+ if (status === SAFE_ARTIFACT_DIRECTORY_MUTATION_EXIT.unsupported)
152
+ return "unsupported";
153
+ if (status === SAFE_ARTIFACT_DIRECTORY_MUTATION_EXIT.entryMismatch)
154
+ return "entry-mismatch";
155
+ return "failed";
156
+ }
157
+ function mutationFailureKind(result) {
158
+ if (result === "entry-mismatch")
159
+ return "target-mutated";
160
+ return result === "unsupported" ? "publish-unsupported" : "publish-failed";
161
+ }
162
+ function directoryMutationRequest(operation, guard, path, targetPath, entry) {
163
+ const common = {
164
+ operation,
165
+ expectedDev: guard.dev.toString(),
166
+ expectedIno: guard.ino.toString(),
167
+ source: basename(path),
168
+ expectedEntryDev: entry.dev.toString(),
169
+ expectedEntryIno: entry.ino.toString(),
170
+ };
171
+ return targetPath === undefined ? common : { ...common, target: basename(targetPath) };
172
+ }
173
+ // Mutates the name at `path` only while it still names the inode behind `held`. Between the
174
+ // caller's check and the helper's syscall, a concurrent process may have replaced the name: an
175
+ // unlink would then delete the new file, and a link or rename would publish it. The caller keeps
176
+ // `held` open until this returns, so the inode stays allocated and its number cannot be recycled
177
+ // for the replacement; Linux file systems reuse a freed inode number at once.
178
+ function runGuardedDirectoryMutation(operation, path, held, trustedRoot, artifactClass, targetPath, authority = "standard") {
179
+ const parent = dirname(resolve(path));
180
+ if (targetPath !== undefined && dirname(resolve(targetPath)) !== parent) {
181
+ throw safeFileError(artifactClass, "invalid-publication");
182
+ }
183
+ const guards = captureDirectoryGuards(trustedRoot, path, artifactClass, authority);
184
+ try {
185
+ const guard = guardedParent(guards, parent, artifactClass);
186
+ if (!directoryGuardsStillAuthorized(guards, trustedRoot, path, authority)) {
187
+ throw safeFileError(artifactClass, "target-mutated");
188
+ }
189
+ const source = fstatSync(held, { bigint: true });
190
+ const request = directoryMutationRequest(operation, guard, path, targetPath, source);
191
+ // The child validates the OS-established cwd identity, then mutates only relative basenames.
192
+ // Keep those names off argv and suppress child output so no path value reaches diagnostics.
193
+ const child = spawnSync(process.execPath, [directoryMutationHelperPath()], {
194
+ cwd: parent,
195
+ input: JSON.stringify(request),
196
+ stdio: ["pipe", "ignore", "ignore"],
197
+ timeout: DIRECTORY_MUTATION_TIMEOUT_MS,
198
+ windowsHide: true,
199
+ });
200
+ if (!directoryGuardsStillAuthorized(guards, trustedRoot, path, authority)) {
201
+ throw safeFileError(artifactClass, "target-mutated");
202
+ }
203
+ if (child.error !== undefined || child.signal !== null)
204
+ return "failed";
205
+ return mutationExitResult(child.status);
206
+ }
207
+ finally {
208
+ closeDirectoryGuards(guards, artifactClass);
209
+ }
210
+ }
211
+ // A concurrent Keiko process may have recreated a shared name such as server.log; the guarded
212
+ // unlink then refuses instead of deleting the new file and the lines in it.
213
+ function unlinkGuardedPath(path, held, trustedRoot, artifactClass, authority = "standard") {
214
+ const result = runGuardedDirectoryMutation("unlink", path, held, trustedRoot, artifactClass, undefined, authority);
215
+ if (result !== "success")
216
+ throw safeFileError(artifactClass, mutationFailureKind(result));
217
+ }
218
+ function archiveDescriptor(path, target, options) {
219
+ const guards = captureDirectoryGuards(options.trustedRoot, path, options.artifactClass, "owner-only-mutation");
220
+ let descriptor;
221
+ try {
222
+ const noFollow = noFollowFlag();
223
+ if (noFollow === 0)
224
+ refuseSymlinkFallback(path, options.artifactClass);
225
+ descriptor = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK | noFollow);
226
+ const opened = fstatSync(descriptor, { bigint: true });
227
+ const pathname = lstatSync(path, { bigint: true });
228
+ if (!archiveSourceIsSafe(descriptor, path, target, opened, pathname) ||
229
+ !directoryGuardsStillAuthorized(guards, options.trustedRoot, path, "owner-only-mutation")) {
230
+ throw safeFileError(options.artifactClass, "unsafe-target");
231
+ }
232
+ closeDirectoryGuards(guards, options.artifactClass);
233
+ return descriptor;
234
+ }
235
+ catch (error) {
236
+ closeDirectoryGuardsIgnoringErrors(guards);
237
+ if (descriptor !== undefined)
238
+ closeDescriptorIgnoringErrors(descriptor);
239
+ if (errorCode(error) === "ENOENT")
240
+ return undefined;
241
+ if (error instanceof SafeArtifactFileError)
242
+ throw error;
243
+ throw safeFileError(options.artifactClass, "unsafe-target");
244
+ }
245
+ }
246
+ function archiveSourceIsSafe(descriptor, path, target, opened, pathname) {
247
+ const checks = [
248
+ opened.isFile(),
249
+ descriptorOwnerIsTrusted(opened),
250
+ permissionIsPrivate(opened.mode),
251
+ new Set([1n, 2n]).has(opened.nlink),
252
+ opened.dev === pathname.dev,
253
+ opened.ino === pathname.ino,
254
+ ];
255
+ if (!checks.every(Boolean))
256
+ return false;
257
+ if (opened.nlink === 1n)
258
+ return true;
259
+ return linkedArchiveMatches(descriptor, path, target);
260
+ }
261
+ function linkedArchiveMatches(descriptor, source, target) {
262
+ try {
263
+ const opened = fstatSync(descriptor, { bigint: true });
264
+ const sourceStat = lstatSync(source, { bigint: true });
265
+ const targetStat = lstatSync(target, { bigint: true });
266
+ return (opened.isFile() &&
267
+ descriptorOwnerIsTrusted(opened) &&
268
+ permissionIsPrivate(opened.mode) &&
269
+ opened.nlink === 2n &&
270
+ sourceStat.dev === opened.dev &&
271
+ sourceStat.ino === opened.ino &&
272
+ targetStat.dev === opened.dev &&
273
+ targetStat.ino === opened.ino);
274
+ }
275
+ catch {
276
+ return false;
277
+ }
278
+ }
279
+ function movedArchiveMatches(descriptor, target) {
280
+ try {
281
+ const opened = fstatSync(descriptor, { bigint: true });
282
+ const targetStat = lstatSync(target, { bigint: true });
283
+ return (descriptorIsSafeArtifact(opened) &&
284
+ permissionIsPrivate(opened.mode) &&
285
+ targetStat.dev === opened.dev &&
286
+ targetStat.ino === opened.ino &&
287
+ targetStat.nlink === 1n);
288
+ }
289
+ catch {
290
+ return false;
291
+ }
292
+ }
293
+ function finalizeLinkedArchive(descriptor, source, target, options) {
294
+ if (!linkedArchiveMatches(descriptor, source, target)) {
295
+ throw safeFileError(options.artifactClass, "target-mutated");
296
+ }
297
+ try {
298
+ unlinkGuardedPath(source, descriptor, options.trustedRoot, options.artifactClass, "owner-only-mutation");
299
+ }
300
+ catch (error) {
301
+ // A concurrent rotation already removed the archived name (and a writer may have recreated
302
+ // it). The identity check refused to delete that newer file; the archive is still final when
303
+ // it alone holds the archived inode.
304
+ if (!isTargetMutated(error) || !movedArchiveMatches(descriptor, target))
305
+ throw error;
306
+ return;
307
+ }
308
+ if (!movedArchiveMatches(descriptor, target)) {
309
+ throw safeFileError(options.artifactClass, "target-mutated");
310
+ }
311
+ }
312
+ function isTargetMutated(error) {
313
+ return error instanceof SafeArtifactFileError && error.kind === "target-mutated";
314
+ }
315
+ /** Archives one private regular file without replacing an existing destination. */
316
+ export function archiveSafeArtifactFile(source, target, options) {
317
+ const descriptor = archiveDescriptor(source, target, options);
318
+ if (descriptor === undefined)
319
+ return "source-missing";
320
+ try {
321
+ const linked = runGuardedDirectoryMutation("link", source, descriptor, options.trustedRoot, options.artifactClass, target, "owner-only-mutation");
322
+ if (linked === "success") {
323
+ finalizeLinkedArchive(descriptor, source, target, options);
324
+ return "hard-link-winner";
325
+ }
326
+ if (linked === "target-exists") {
327
+ if (linkedArchiveMatches(descriptor, source, target)) {
328
+ finalizeLinkedArchive(descriptor, source, target, options);
329
+ }
330
+ return "archive-exists";
331
+ }
332
+ if (linked !== "unsupported") {
333
+ throw safeFileError(options.artifactClass, mutationFailureKind(linked));
334
+ }
335
+ return renameIntoClaimedArchive(descriptor, source, target, options);
336
+ }
337
+ finally {
338
+ closeArtifactDescriptor(descriptor, options.artifactClass);
339
+ }
340
+ }
341
+ // rename(2) replaces an existing destination and Node has no RENAME_NOREPLACE, so a concurrent
342
+ // rotation could destroy the winner's archive. The name is claimed exclusively first; only the
343
+ // claim winner renames, and the only file it can replace is its own empty claim.
344
+ function renameIntoClaimedArchive(descriptor, source, target, options) {
345
+ const claim = claimArchiveName(target, options);
346
+ if (claim === undefined)
347
+ return "archive-exists";
348
+ const renamed = runGuardedDirectoryMutation("rename", source, descriptor, options.trustedRoot, options.artifactClass, target, "owner-only-mutation");
349
+ if (renamed !== "success") {
350
+ releaseArchiveClaim(target, claim, options);
351
+ throw safeFileError(options.artifactClass, mutationFailureKind(renamed));
352
+ }
353
+ if (!movedArchiveMatches(descriptor, target)) {
354
+ throw safeFileError(options.artifactClass, "publish-failed");
355
+ }
356
+ return "rename-fallback";
357
+ }
358
+ // The claim is not held open across the rename, because Windows cannot replace a name that is
359
+ // still open on file systems without POSIX delete semantics. It is re-opened here and held, so its
360
+ // inode number cannot be recycled for a replacement before the guarded unlink checks it.
361
+ function releaseArchiveClaim(target, claim, options) {
362
+ if (!pathHasIdentity(target, claim))
363
+ return;
364
+ const held = openSafeArtifactFile(target, { ...options, mode: "read" });
365
+ try {
366
+ const opened = fstatSync(held, { bigint: true });
367
+ if (opened.dev === claim.dev && opened.ino === claim.ino) {
368
+ unlinkGuardedPath(target, held, options.trustedRoot, options.artifactClass, "owner-only-mutation");
369
+ }
370
+ }
371
+ finally {
372
+ closeDescriptorIgnoringErrors(held);
373
+ }
374
+ }
375
+ function claimArchiveName(target, options) {
376
+ let claim;
377
+ try {
378
+ claim = openSafeArtifactFile(target, {
379
+ artifactClass: options.artifactClass,
380
+ mode: "exclusive-create",
381
+ trustedRoot: options.trustedRoot,
382
+ });
383
+ }
384
+ catch (error) {
385
+ if (error instanceof SafeArtifactFileError && error.kind === "target-exists")
386
+ return undefined;
387
+ throw error;
388
+ }
389
+ try {
390
+ return fstatSync(claim, { bigint: true });
391
+ }
392
+ finally {
393
+ closeArtifactDescriptor(claim, options.artifactClass);
394
+ }
395
+ }
396
+ function pathHasIdentity(path, identity) {
397
+ try {
398
+ const current = lstatSync(path, { bigint: true });
399
+ return current.dev === identity.dev && current.ino === identity.ino;
400
+ }
401
+ catch {
402
+ return false;
403
+ }
404
+ }
405
+ /** Removes only an opened, owner-private, single-link regular file in an attested directory. */
406
+ export function removeSafeArtifactFile(path, options) {
407
+ const descriptor = openSafeArtifactFile(path, {
408
+ ...options,
409
+ mode: "read",
410
+ });
411
+ try {
412
+ verifySafeArtifactFileDescriptor(descriptor, path, options);
413
+ unlinkGuardedPath(path, descriptor, options.trustedRoot, options.artifactClass, "owner-only-mutation");
414
+ }
415
+ catch (error) {
416
+ closeDescriptorIgnoringErrors(descriptor);
417
+ throw error;
418
+ }
419
+ closeArtifactDescriptor(descriptor, options.artifactClass);
420
+ }
421
+ function lstatDirectory(path, artifactClass) {
422
+ try {
423
+ const stat = lstatSync(path, { bigint: true });
424
+ if (!stat.isDirectory() || stat.isSymbolicLink() || !directoryAuthorityIsSafe(stat)) {
425
+ throw safeFileError(artifactClass, "unsafe-ancestor");
426
+ }
427
+ return stat;
428
+ }
429
+ catch (error) {
430
+ if (error instanceof SafeArtifactFileError)
431
+ throw error;
432
+ throw safeFileError(artifactClass, "unsafe-ancestor");
433
+ }
434
+ }
435
+ function directoryAuthorityIsSafe(stat) {
436
+ if (process.platform === "win32")
437
+ return true;
438
+ const effectiveUser = process.geteuid?.();
439
+ if (effectiveUser === undefined)
440
+ return false;
441
+ const ownerIsTrusted = stat.uid === 0n || stat.uid === BigInt(effectiveUser);
442
+ const writableByOthers = (stat.mode & 18n) !== 0n;
443
+ const rootStickyDirectory = stat.uid === 0n && (stat.mode & 512n) !== 0n;
444
+ return ownerIsTrusted && (!writableByOthers || rootStickyDirectory);
445
+ }
446
+ function directoryAuthorityIsOwnerOnly(stat) {
447
+ if (process.platform === "win32")
448
+ return true;
449
+ const effectiveUser = process.geteuid?.();
450
+ return (effectiveUser !== undefined &&
451
+ stat.uid === BigInt(effectiveUser) &&
452
+ (stat.mode & 511n) === BigInt(DIR_MODE));
453
+ }
454
+ function isOwnerOnlyMutationDirectory(path, trustedRoot, targetPath) {
455
+ const key = filesystemComparisonPath(path);
456
+ return (key === filesystemComparisonPath(trustedRoot) ||
457
+ key === filesystemComparisonPath(dirname(resolve(targetPath))));
458
+ }
459
+ function directoryChain(path) {
460
+ const absolute = resolve(path);
461
+ const filesystemRoot = parse(absolute).root;
462
+ const fromRoot = relative(filesystemRoot, absolute);
463
+ const directories = [filesystemRoot];
464
+ let current = filesystemRoot;
465
+ for (const component of fromRoot === "" ? [] : fromRoot.split(sep)) {
466
+ current = join(current, component);
467
+ directories.push(current);
468
+ }
469
+ return directories;
470
+ }
471
+ function resolvedRealPath(path, artifactClass) {
472
+ try {
473
+ return realpathSync(path);
474
+ }
475
+ catch {
476
+ throw safeFileError(artifactClass, "unsafe-ancestor");
477
+ }
478
+ }
479
+ function sameFilesystemPath(left, right) {
480
+ return filesystemComparisonPath(left) === filesystemComparisonPath(right);
481
+ }
482
+ function compareResolvedPaths(left, right) {
483
+ const resolvedLeft = resolve(left);
484
+ const resolvedRight = resolve(right);
485
+ if (resolvedLeft < resolvedRight)
486
+ return -1;
487
+ if (resolvedLeft > resolvedRight)
488
+ return 1;
489
+ return 0;
490
+ }
491
+ function containedDirectories(trustedRoot, targetPath, artifactClass) {
492
+ const root = resolve(trustedRoot);
493
+ const parent = dirname(resolve(targetPath));
494
+ const fromRoot = relative(root, parent);
495
+ if (fromRoot === ".." || fromRoot.startsWith(`..${sep}`) || isAbsolute(fromRoot)) {
496
+ throw safeFileError(artifactClass, "unsafe-ancestor");
497
+ }
498
+ const canonicalRoot = resolvedRealPath(root, artifactClass);
499
+ if (process.platform === "win32" && !sameFilesystemPath(root, canonicalRoot)) {
500
+ throw safeFileError(artifactClass, "unsafe-ancestor");
501
+ }
502
+ const canonicalParent = resolve(canonicalRoot, fromRoot);
503
+ if (!sameFilesystemPath(resolvedRealPath(parent, artifactClass), canonicalParent)) {
504
+ throw safeFileError(artifactClass, "unsafe-ancestor");
505
+ }
506
+ const directories = [...directoryChain(canonicalParent), root];
507
+ let current = root;
508
+ for (const component of fromRoot === "" ? [] : fromRoot.split(sep)) {
509
+ current = join(current, component);
510
+ directories.push(current);
511
+ }
512
+ const unique = new Map(directories.map((path) => [filesystemComparisonPath(path), path]));
513
+ return [...unique.values()];
514
+ }
515
+ function openDirectoryGuard(path, artifactClass) {
516
+ const before = lstatDirectory(path, artifactClass);
517
+ if (process.platform === "win32") {
518
+ const after = lstatDirectory(path, artifactClass);
519
+ if (after.dev !== before.dev || after.ino !== before.ino) {
520
+ throw safeFileError(artifactClass, "target-mutated");
521
+ }
522
+ return { path, dev: after.dev, ino: after.ino, descriptor: undefined };
523
+ }
524
+ const noFollow = typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
525
+ const directory = typeof constants.O_DIRECTORY === "number" ? constants.O_DIRECTORY : 0;
526
+ let descriptor;
527
+ try {
528
+ descriptor = openSync(path, constants.O_RDONLY | noFollow | directory);
529
+ return validateDirectoryGuard(path, before.dev, before.ino, descriptor, artifactClass);
530
+ }
531
+ catch (error) {
532
+ if (descriptor !== undefined)
533
+ closeDescriptorIgnoringErrors(descriptor);
534
+ if (error instanceof SafeArtifactFileError)
535
+ throw error;
536
+ throw safeFileError(artifactClass, "unsafe-ancestor");
537
+ }
538
+ }
539
+ function validateDirectoryGuard(path, dev, ino, descriptor, artifactClass) {
540
+ let opened;
541
+ try {
542
+ opened = fstatSync(descriptor, { bigint: true });
543
+ }
544
+ catch {
545
+ throw safeFileError(artifactClass, "unsafe-ancestor");
546
+ }
547
+ const pathname = lstatDirectory(path, artifactClass);
548
+ if (!opened.isDirectory() ||
549
+ opened.dev !== dev ||
550
+ opened.ino !== ino ||
551
+ pathname.dev !== dev ||
552
+ pathname.ino !== ino) {
553
+ throw safeFileError(artifactClass, "target-mutated");
554
+ }
555
+ return { path, dev, ino, descriptor };
556
+ }
557
+ function closeDescriptorIgnoringErrors(descriptor) {
558
+ try {
559
+ closeSync(descriptor);
560
+ }
561
+ catch {
562
+ // Preserve the already-closed primary failure.
563
+ }
564
+ }
565
+ function captureDirectoryGuards(trustedRoot, targetPath, artifactClass, authority = "standard") {
566
+ const guards = [];
567
+ try {
568
+ for (const path of containedDirectories(trustedRoot, targetPath, artifactClass)) {
569
+ if (authority === "owner-only-mutation" &&
570
+ isOwnerOnlyMutationDirectory(path, trustedRoot, targetPath) &&
571
+ !directoryAuthorityIsOwnerOnly(lstatDirectory(path, artifactClass))) {
572
+ throw safeFileError(artifactClass, "unsafe-ancestor");
573
+ }
574
+ guards.push(openDirectoryGuard(path, artifactClass));
575
+ }
576
+ return guards;
577
+ }
578
+ catch (error) {
579
+ closeDirectoryGuardsIgnoringErrors(guards);
580
+ throw error;
581
+ }
582
+ }
583
+ function directoryGuardStillOwnerOnly(guard) {
584
+ try {
585
+ const stat = lstatSync(guard.path, { bigint: true });
586
+ return stat.isDirectory() && !stat.isSymbolicLink() && directoryAuthorityIsOwnerOnly(stat);
587
+ }
588
+ catch {
589
+ return false;
590
+ }
591
+ }
592
+ function directoryGuardsStillAuthorized(guards, trustedRoot, targetPath, authority) {
593
+ if (!guards.every(directoryGuardStillMatches))
594
+ return false;
595
+ if (authority === "standard")
596
+ return true;
597
+ return guards
598
+ .filter((guard) => isOwnerOnlyMutationDirectory(guard.path, trustedRoot, targetPath))
599
+ .every(directoryGuardStillOwnerOnly);
600
+ }
601
+ function directoryGuardStillMatches(guard) {
602
+ try {
603
+ const pathname = lstatSync(guard.path, { bigint: true });
604
+ if (!pathname.isDirectory() || pathname.isSymbolicLink())
605
+ return false;
606
+ if (pathname.dev !== guard.dev || pathname.ino !== guard.ino)
607
+ return false;
608
+ if (guard.descriptor === undefined)
609
+ return process.platform === "win32";
610
+ const opened = fstatSync(guard.descriptor, { bigint: true });
611
+ return opened.isDirectory() && opened.dev === guard.dev && opened.ino === guard.ino;
612
+ }
613
+ catch {
614
+ return false;
615
+ }
616
+ }
617
+ function closeDirectoryGuardsIgnoringErrors(guards) {
618
+ for (const guard of guards) {
619
+ if (guard.descriptor === undefined)
620
+ continue;
621
+ closeDescriptorIgnoringErrors(guard.descriptor);
622
+ }
623
+ }
624
+ function closeDirectoryGuards(guards, artifactClass) {
625
+ let failed = false;
626
+ for (const guard of guards) {
627
+ if (guard.descriptor === undefined)
628
+ continue;
629
+ try {
630
+ closeSync(guard.descriptor);
631
+ }
632
+ catch {
633
+ failed = true;
634
+ }
635
+ }
636
+ if (failed)
637
+ throw safeFileError(artifactClass, "close-failed");
638
+ }
639
+ function refuseSymlinkFallback(path, artifactClass) {
640
+ try {
641
+ if (lstatSync(path).isSymbolicLink()) {
642
+ throw safeFileError(artifactClass, "unsafe-target");
643
+ }
644
+ }
645
+ catch (error) {
646
+ if (errorCode(error) === "ENOENT")
647
+ return;
648
+ if (error instanceof SafeArtifactFileError)
649
+ throw error;
650
+ throw safeFileError(artifactClass, "open-failed");
651
+ }
652
+ }
653
+ function openFlags(mode) {
654
+ if (mode === "read")
655
+ return constants.O_RDONLY;
656
+ if (mode === "read-write-existing")
657
+ return constants.O_RDWR;
658
+ const create = constants.O_WRONLY | constants.O_CREAT;
659
+ return mode === "exclusive-create" ? create | constants.O_EXCL : create | constants.O_APPEND;
660
+ }
661
+ function permissionIsPrivate(mode) {
662
+ if (process.platform === "win32")
663
+ return true;
664
+ return typeof mode === "bigint" ? (mode & 63n) === 0n : (mode & 0o077) === 0;
665
+ }
666
+ function descriptorOwnerIsTrusted(stat) {
667
+ if (process.platform === "win32")
668
+ return true;
669
+ const effectiveUser = process.geteuid?.();
670
+ return effectiveUser !== undefined && stat.uid === BigInt(effectiveUser);
671
+ }
672
+ function descriptorIsSafeArtifact(stat) {
673
+ return stat.isFile() && stat.nlink === 1n && descriptorOwnerIsTrusted(stat);
674
+ }
675
+ function descriptorSafetyFailureKind(stat) {
676
+ return stat.isFile() && stat.nlink === 1n ? "permission-unsafe" : "unsafe-target";
677
+ }
678
+ function verifyDescriptorIdentity(descriptor, path, artifactClass) {
679
+ let opened;
680
+ try {
681
+ opened = fstatSync(descriptor, { bigint: true });
682
+ }
683
+ catch {
684
+ throw safeFileError(artifactClass, "open-failed");
685
+ }
686
+ if (!descriptorIsSafeArtifact(opened)) {
687
+ throw safeFileError(artifactClass, descriptorSafetyFailureKind(opened));
688
+ }
689
+ let pathname;
690
+ try {
691
+ pathname = lstatSync(path, { bigint: true });
692
+ }
693
+ catch {
694
+ throw safeFileError(artifactClass, "target-mutated");
695
+ }
696
+ if (pathname.isSymbolicLink() ||
697
+ !pathname.isFile() ||
698
+ pathname.nlink !== 1n ||
699
+ pathname.dev !== opened.dev ||
700
+ pathname.ino !== opened.ino) {
701
+ throw safeFileError(artifactClass, "target-mutated");
702
+ }
703
+ return opened;
704
+ }
705
+ /** Verifies the opened descriptor and final pathname still name one private regular inode. */
706
+ export function verifySafeArtifactFileDescriptor(descriptor, path, options) {
707
+ const guards = captureDirectoryGuards(options.trustedRoot, path, options.artifactClass);
708
+ try {
709
+ const opened = verifyDescriptorIdentity(descriptor, path, options.artifactClass);
710
+ if (!permissionIsPrivate(opened.mode)) {
711
+ throw safeFileError(options.artifactClass, "permission-unsafe");
712
+ }
713
+ if (!guards.every(directoryGuardStillMatches)) {
714
+ throw safeFileError(options.artifactClass, "target-mutated");
715
+ }
716
+ }
717
+ catch (error) {
718
+ closeDirectoryGuardsIgnoringErrors(guards);
719
+ if (error instanceof SafeArtifactFileError)
720
+ throw error;
721
+ throw safeFileError(options.artifactClass, "open-failed");
722
+ }
723
+ closeDirectoryGuards(guards, options.artifactClass);
724
+ }
725
+ function tightenDescriptor(descriptor, artifactClass) {
726
+ if (process.platform === "win32")
727
+ return;
728
+ try {
729
+ fchmodSync(descriptor, FILE_MODE);
730
+ }
731
+ catch {
732
+ throw safeFileError(artifactClass, "permission-failed");
733
+ }
734
+ }
735
+ function mapOpenError(error) {
736
+ const code = errorCode(error);
737
+ if (code === "EEXIST")
738
+ return "target-exists";
739
+ if (code === "ELOOP" || code === "EISDIR" || code === "ENXIO")
740
+ return "unsafe-target";
741
+ return "open-failed";
742
+ }
743
+ function noFollowFlag() {
744
+ if (process.platform === "win32")
745
+ return 0;
746
+ return typeof constants.O_NOFOLLOW === "number" ? constants.O_NOFOLLOW : 0;
747
+ }
748
+ function openArtifactDescriptor(path, options) {
749
+ const noFollow = noFollowFlag();
750
+ const nonBlocking = typeof constants.O_NONBLOCK === "number" ? constants.O_NONBLOCK : 0;
751
+ if (noFollow === 0)
752
+ refuseSymlinkFallback(path, options.artifactClass);
753
+ try {
754
+ return openSync(path, openFlags(options.mode) | noFollow | nonBlocking, FILE_MODE);
755
+ }
756
+ catch (error) {
757
+ if (error instanceof SafeArtifactFileError)
758
+ throw error;
759
+ throw safeFileError(options.artifactClass, mapOpenError(error));
760
+ }
761
+ }
762
+ function validateOpenedArtifact(descriptor, path, options, guards) {
763
+ verifyDescriptorIdentity(descriptor, path, options.artifactClass);
764
+ if (!guards.every(directoryGuardStillMatches)) {
765
+ throw safeFileError(options.artifactClass, "target-mutated");
766
+ }
767
+ if (options.mode !== "read")
768
+ tightenDescriptor(descriptor, options.artifactClass);
769
+ const opened = verifyDescriptorIdentity(descriptor, path, options.artifactClass);
770
+ if (!permissionIsPrivate(opened.mode)) {
771
+ throw safeFileError(options.artifactClass, "permission-unsafe");
772
+ }
773
+ if (!guards.every(directoryGuardStillMatches)) {
774
+ throw safeFileError(options.artifactClass, "target-mutated");
775
+ }
776
+ }
777
+ /**
778
+ * Opens without following the final symlink and verifies the descriptor before any caller write.
779
+ * POSIX containment relies on the verified owner-private ancestor chain because Node has no
780
+ * descriptor-relative open API. A same-UID ancestor mutation can create an empty file before the
781
+ * post-open guard rejects it, so the closed assurance is `private-root-guarded`, not absolute
782
+ * containment; no descriptor is returned and no content or chmod reaches the redirected file.
783
+ * Windows also lacks stable no-follow directory descriptors and Node cannot inspect NTFS DACLs.
784
+ * Its permission assurance is therefore `platform-inherited`, never `verified-private`.
785
+ */
786
+ export function openSafeArtifactFile(path, options) {
787
+ const guards = captureDirectoryGuards(options.trustedRoot, path, options.artifactClass);
788
+ let descriptor;
789
+ try {
790
+ descriptor = openArtifactDescriptor(path, options);
791
+ validateOpenedArtifact(descriptor, path, options, guards);
792
+ closeDirectoryGuards(guards, options.artifactClass);
793
+ return descriptor;
794
+ }
795
+ catch (error) {
796
+ closeDirectoryGuardsIgnoringErrors(guards);
797
+ if (descriptor !== undefined)
798
+ closeArtifactDescriptor(descriptor, options.artifactClass);
799
+ if (error instanceof SafeArtifactFileError)
800
+ throw error;
801
+ throw safeFileError(options.artifactClass, "open-failed");
802
+ }
803
+ }
804
+ const PUBLICATION_SLOT_PATTERN = /^[0-9a-f]{24}$/u;
805
+ const PUBLICATION_DIGEST_PATTERN = /^[0-9a-f]{64}$/u;
806
+ const PUBLICATION_OWNER_TOKEN_PATTERN = /^[0-9a-f]{24}$/u;
807
+ // The owner file and in-process token identify one synchronous publish call, not a process. A peer
808
+ // fails closed while that call is live. Once a still-live foreign PID outlives this bounded lease,
809
+ // recovery becomes explicitly unsupported rather than risking takeover of an active operation.
810
+ const PUBLICATION_OWNER_LEASE_MS = 10 * 60 * 1000;
811
+ const activePublicationOwnerTokens = new Set();
812
+ const MAX_PUBLICATION_ENTRIES = 16;
813
+ export const MAX_SAFE_ARTIFACT_RECOVERY_ENTRY_BYTES = 256 * 1024 * 1024;
814
+ export const MAX_SAFE_ARTIFACT_RECOVERY_PUBLICATION_BYTES = 512 * 1024 * 1024;
815
+ const MAX_PUBLICATION_INTENT_BYTES = 64 * 1024;
816
+ function validatePublicationSlot(slot, artifactClass) {
817
+ if (!PUBLICATION_SLOT_PATTERN.test(slot)) {
818
+ throw safeFileError(artifactClass, "invalid-publication");
819
+ }
820
+ }
821
+ function intentPath(trustedRoot, slot, state) {
822
+ return join(resolve(trustedRoot), `.keiko-publish-${slot}.${state}`);
823
+ }
824
+ function ownerPath(trustedRoot, slot) {
825
+ return join(resolve(trustedRoot), `.keiko-publish-${slot}.owner`);
826
+ }
827
+ function publicationId(entries, commitPath) {
828
+ const hash = createHash("sha256");
829
+ const ordered = [...entries].sort((left, right) => compareResolvedPaths(left.path, right.path));
830
+ for (const entry of ordered) {
831
+ const bytes = typeof entry.contents === "string"
832
+ ? Buffer.from(entry.contents, "utf8")
833
+ : Buffer.from(entry.contents);
834
+ hash
835
+ .update(entry.artifactClass)
836
+ .update("\0")
837
+ .update(resolve(entry.path))
838
+ .update("\0")
839
+ .update(String(bytes.length))
840
+ .update("\0")
841
+ .update(bytes)
842
+ .update("\0");
843
+ }
844
+ hash.update(resolve(commitPath)).update("\0");
845
+ return hash.digest("hex").slice(0, 24);
846
+ }
847
+ /** Returns a body-free stable slot identifier for one publication namespace and destination. */
848
+ export function safeArtifactPublicationSlot(namespace, destinationKey) {
849
+ return createHash("sha256")
850
+ .update(namespace)
851
+ .update("\0")
852
+ .update(resolve(destinationKey))
853
+ .digest("hex")
854
+ .slice(0, 24);
855
+ }
856
+ function preparePublicationEntries(entries, commitPath, trustedRoot, fixedSlot) {
857
+ const parent = dirname(resolve(commitPath));
858
+ const id = fixedSlot ?? publicationId(entries, commitPath);
859
+ const ordered = [...entries].sort((left, right) => compareResolvedPaths(left.path, right.path));
860
+ return ordered.map((entry, index) => ({
861
+ path: resolve(entry.path),
862
+ stagePath: join(parent, `.keiko-publish-${id}-${String(index)}.stage`),
863
+ bytes: typeof entry.contents === "string"
864
+ ? Buffer.from(entry.contents, "utf8")
865
+ : Buffer.from(entry.contents),
866
+ artifactClass: entry.artifactClass,
867
+ trustedRoot: resolve(trustedRoot),
868
+ }));
869
+ }
870
+ function publicationDigest(bytes) {
871
+ return createHash("sha256").update(bytes).digest("hex");
872
+ }
873
+ function publicationIntent(entries, commitPath) {
874
+ const resolvedCommit = resolve(commitPath);
875
+ const commitIndex = entries.findIndex((entry) => entry.path === resolvedCommit);
876
+ return {
877
+ schemaVersion: 1,
878
+ ownerPid: process.pid,
879
+ ownerToken: randomBytes(12).toString("hex"),
880
+ ownerExpiresAt: Date.now() + PUBLICATION_OWNER_LEASE_MS,
881
+ commitIndex,
882
+ entries: entries.map((entry) => ({
883
+ name: basename(entry.path),
884
+ artifactClass: entry.artifactClass,
885
+ byteCount: entry.bytes.length,
886
+ sha256: publicationDigest(entry.bytes),
887
+ })),
888
+ };
889
+ }
890
+ function intentBytes(intent) {
891
+ return Buffer.from(`${JSON.stringify(intent)}\n`, "utf8");
892
+ }
893
+ function isRecord(value) {
894
+ return typeof value === "object" && value !== null && !Array.isArray(value);
895
+ }
896
+ function publicationNameComparison(value) {
897
+ return process.platform === "darwin" || process.platform === "win32"
898
+ ? value.normalize("NFC").toLocaleLowerCase("en-US")
899
+ : value;
900
+ }
901
+ function isIntentName(value) {
902
+ return (typeof value === "string" &&
903
+ value !== "." &&
904
+ value !== ".." &&
905
+ basename(value) === value &&
906
+ !publicationNameComparison(value).startsWith(".keiko-publish-"));
907
+ }
908
+ function isIntentByteCount(value) {
909
+ return (typeof value === "number" &&
910
+ Number.isSafeInteger(value) &&
911
+ value >= 0 &&
912
+ value <= MAX_SAFE_ARTIFACT_RECOVERY_ENTRY_BYTES);
913
+ }
914
+ function publicationContentsByteCount(contents) {
915
+ if (typeof contents === "string")
916
+ return Buffer.byteLength(contents);
917
+ return contents instanceof Uint8Array ? contents.byteLength : undefined;
918
+ }
919
+ function validateIntentPublicationEntries(entries, artifactClass) {
920
+ let totalBytes = 0;
921
+ for (const entry of entries) {
922
+ const byteCount = publicationContentsByteCount(entry.contents);
923
+ if (!isIntentName(basename(resolve(entry.path))) || !isIntentByteCount(byteCount)) {
924
+ throw safeFileError(artifactClass, "invalid-publication");
925
+ }
926
+ totalBytes += byteCount;
927
+ }
928
+ if (totalBytes > MAX_SAFE_ARTIFACT_RECOVERY_PUBLICATION_BYTES) {
929
+ throw safeFileError(artifactClass, "invalid-publication");
930
+ }
931
+ }
932
+ function isIntentEntry(value) {
933
+ if (!isRecord(value))
934
+ return false;
935
+ return (isIntentName(value.name) &&
936
+ isSafeArtifactClass(value.artifactClass) &&
937
+ isIntentByteCount(value.byteCount) &&
938
+ typeof value.sha256 === "string" &&
939
+ PUBLICATION_DIGEST_PATTERN.test(value.sha256));
940
+ }
941
+ function isCommitIndex(value, entryCount) {
942
+ return (typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value < entryCount);
943
+ }
944
+ function hasValidIntentOwner(value) {
945
+ return (typeof value.ownerPid === "number" &&
946
+ Number.isSafeInteger(value.ownerPid) &&
947
+ value.ownerPid > 0 &&
948
+ typeof value.ownerToken === "string" &&
949
+ PUBLICATION_OWNER_TOKEN_PATTERN.test(value.ownerToken) &&
950
+ typeof value.ownerExpiresAt === "number" &&
951
+ Number.isSafeInteger(value.ownerExpiresAt) &&
952
+ value.ownerExpiresAt > 0);
953
+ }
954
+ function parsedIntentEntries(value) {
955
+ if (!Array.isArray(value) || value.length === 0 || value.length > MAX_PUBLICATION_ENTRIES) {
956
+ return undefined;
957
+ }
958
+ if (!value.every(isIntentEntry))
959
+ return undefined;
960
+ const comparisonNames = value.map((entry) => filesystemComparisonPath(join("/", entry.name)));
961
+ const totalBytes = value.reduce((total, entry) => total + entry.byteCount, 0);
962
+ if (new Set(comparisonNames).size !== comparisonNames.length ||
963
+ totalBytes > MAX_SAFE_ARTIFACT_RECOVERY_PUBLICATION_BYTES) {
964
+ return undefined;
965
+ }
966
+ return value;
967
+ }
968
+ function parsedPublicationIntent(value) {
969
+ if (!isRecord(value) || value.schemaVersion !== 1)
970
+ return undefined;
971
+ const entries = parsedIntentEntries(value.entries);
972
+ if (entries === undefined || !isCommitIndex(value.commitIndex, entries.length))
973
+ return undefined;
974
+ if (!hasValidIntentOwner(value))
975
+ return undefined;
976
+ return {
977
+ schemaVersion: 1,
978
+ ownerPid: value.ownerPid,
979
+ ownerToken: value.ownerToken,
980
+ ownerExpiresAt: value.ownerExpiresAt,
981
+ commitIndex: value.commitIndex,
982
+ entries,
983
+ };
984
+ }
985
+ function filesystemComparisonPath(path) {
986
+ const resolved = resolve(path);
987
+ return process.platform === "darwin" || process.platform === "win32"
988
+ ? resolved.normalize("NFC").toLocaleLowerCase("en-US")
989
+ : resolved;
990
+ }
991
+ function validatePublication(entries, options) {
992
+ const fallbackClass = entries[0]?.artifactClass ?? "manifest";
993
+ const resolvedCommit = resolve(options.commitPath);
994
+ const paths = entries.map((entry) => resolve(entry.path));
995
+ const comparisonPaths = paths.map(filesystemComparisonPath);
996
+ const parents = new Set(paths.map(dirname));
997
+ if (entries.length === 0 ||
998
+ !paths.includes(resolvedCommit) ||
999
+ new Set(comparisonPaths).size !== paths.length ||
1000
+ parents.size !== 1) {
1001
+ throw safeFileError(fallbackClass, "invalid-publication");
1002
+ }
1003
+ if (entries.length > MAX_PUBLICATION_ENTRIES) {
1004
+ throw safeFileError(fallbackClass, "invalid-publication");
1005
+ }
1006
+ validatePublicationSlotOption(entries, options, resolvedCommit, fallbackClass);
1007
+ for (const path of paths)
1008
+ containedDirectories(options.trustedRoot, path, fallbackClass);
1009
+ }
1010
+ function validatePublicationSlotOption(entries, options, resolvedCommit, artifactClass) {
1011
+ if (options.publicationSlot === undefined)
1012
+ return;
1013
+ validatePublicationSlot(options.publicationSlot, artifactClass);
1014
+ validateIntentPublicationEntries(entries, artifactClass);
1015
+ if (!sameFilesystemPath(dirname(resolvedCommit), resolve(options.trustedRoot))) {
1016
+ throw safeFileError(artifactClass, "invalid-publication");
1017
+ }
1018
+ }
1019
+ function writeAll(descriptor, bytes, artifactClass) {
1020
+ let offset = 0;
1021
+ try {
1022
+ while (offset < bytes.length) {
1023
+ const written = writeSync(descriptor, bytes, offset, bytes.length - offset);
1024
+ if (written <= 0)
1025
+ throw safeFileError(artifactClass, "write-failed");
1026
+ offset += written;
1027
+ }
1028
+ }
1029
+ catch (error) {
1030
+ if (error instanceof SafeArtifactFileError)
1031
+ throw error;
1032
+ throw safeFileError(artifactClass, "write-failed");
1033
+ }
1034
+ }
1035
+ function syncArtifactDescriptor(descriptor, artifactClass) {
1036
+ try {
1037
+ fsyncSync(descriptor);
1038
+ }
1039
+ catch {
1040
+ throw safeFileError(artifactClass, "durability-failed");
1041
+ }
1042
+ }
1043
+ function createStage(entry) {
1044
+ const descriptor = openSafeArtifactFile(entry.stagePath, {
1045
+ artifactClass: entry.artifactClass,
1046
+ mode: "exclusive-create",
1047
+ trustedRoot: entry.trustedRoot,
1048
+ });
1049
+ try {
1050
+ writeAll(descriptor, entry.bytes, entry.artifactClass);
1051
+ syncArtifactDescriptor(descriptor, entry.artifactClass);
1052
+ }
1053
+ catch (error) {
1054
+ closeDescriptorIgnoringErrors(descriptor);
1055
+ throw error;
1056
+ }
1057
+ closeArtifactDescriptor(descriptor, entry.artifactClass);
1058
+ }
1059
+ function syncDirectory(path, trustedRoot, artifactClass) {
1060
+ const guards = captureDirectoryGuards(trustedRoot, join(path, ".keiko-directory-sync"), artifactClass);
1061
+ try {
1062
+ const parent = guards.at(-1);
1063
+ if (parent === undefined || !guards.every(directoryGuardStillMatches)) {
1064
+ throw safeFileError(artifactClass, "target-mutated");
1065
+ }
1066
+ if (parent.descriptor !== undefined)
1067
+ fsyncSync(parent.descriptor);
1068
+ if (!guards.every(directoryGuardStillMatches)) {
1069
+ throw safeFileError(artifactClass, "target-mutated");
1070
+ }
1071
+ }
1072
+ catch (error) {
1073
+ closeDirectoryGuardsIgnoringErrors(guards);
1074
+ if (error instanceof SafeArtifactFileError)
1075
+ throw error;
1076
+ throw safeFileError(artifactClass, "durability-failed");
1077
+ }
1078
+ const assurance = guards.at(-1)?.descriptor === undefined ? "directory-sync-unavailable" : "verified";
1079
+ closeDirectoryGuards(guards, artifactClass);
1080
+ return assurance;
1081
+ }
1082
+ function createPublicationIntent(path, bytes, artifactClass, trustedRoot) {
1083
+ const descriptor = openSafeArtifactFile(path, {
1084
+ artifactClass,
1085
+ mode: "exclusive-create",
1086
+ trustedRoot,
1087
+ });
1088
+ try {
1089
+ writeAll(descriptor, bytes, artifactClass);
1090
+ syncArtifactDescriptor(descriptor, artifactClass);
1091
+ }
1092
+ catch (error) {
1093
+ closeDescriptorIgnoringErrors(descriptor);
1094
+ throw error;
1095
+ }
1096
+ closeArtifactDescriptor(descriptor, artifactClass);
1097
+ return syncDirectory(dirname(path), trustedRoot, artifactClass);
1098
+ }
1099
+ function parsePublicationIntentBytes(buffer, count) {
1100
+ let parsed;
1101
+ try {
1102
+ parsed = JSON.parse(buffer.subarray(0, count).toString("utf8"));
1103
+ }
1104
+ catch {
1105
+ throw safeFileError("manifest", "recovery-conflict");
1106
+ }
1107
+ const intent = parsedPublicationIntent(parsed);
1108
+ if (intent === undefined)
1109
+ throw safeFileError("manifest", "recovery-conflict");
1110
+ return intent;
1111
+ }
1112
+ function readPublicationIntent(path, trustedRoot) {
1113
+ const artifactClass = "manifest";
1114
+ const descriptor = openSafeArtifactFile(path, {
1115
+ artifactClass,
1116
+ mode: "read",
1117
+ trustedRoot,
1118
+ });
1119
+ try {
1120
+ const stat = fstatSync(descriptor, { bigint: true });
1121
+ if (stat.size <= 0n || stat.size > BigInt(MAX_PUBLICATION_INTENT_BYTES)) {
1122
+ throw safeFileError(artifactClass, "recovery-conflict");
1123
+ }
1124
+ const buffer = Buffer.alloc(Number(stat.size) + 1);
1125
+ const count = readIntoBuffer(descriptor, buffer, artifactClass);
1126
+ verifySafeArtifactFileDescriptor(descriptor, path, { artifactClass, trustedRoot });
1127
+ if (count !== Number(stat.size))
1128
+ throw safeFileError(artifactClass, "recovery-conflict");
1129
+ return parsePublicationIntentBytes(buffer, count);
1130
+ }
1131
+ finally {
1132
+ closeArtifactDescriptor(descriptor, artifactClass);
1133
+ }
1134
+ }
1135
+ function removePublicationIntent(path, trustedRoot, artifactClass, restoreBytes) {
1136
+ const descriptor = openSafeArtifactFile(path, {
1137
+ artifactClass,
1138
+ mode: "read",
1139
+ trustedRoot,
1140
+ });
1141
+ try {
1142
+ verifySafeArtifactFileDescriptor(descriptor, path, { artifactClass, trustedRoot });
1143
+ unlinkGuardedPath(path, descriptor, trustedRoot, artifactClass);
1144
+ }
1145
+ catch (error) {
1146
+ closeDescriptorIgnoringErrors(descriptor);
1147
+ if (error instanceof SafeArtifactFileError)
1148
+ throw error;
1149
+ throw safeFileError(artifactClass, "publish-failed");
1150
+ }
1151
+ closeArtifactDescriptor(descriptor, artifactClass);
1152
+ try {
1153
+ return syncDirectory(dirname(path), trustedRoot, artifactClass);
1154
+ }
1155
+ catch (error) {
1156
+ if (restoreBytes !== undefined && !pathExists(path, artifactClass)) {
1157
+ createPublicationIntent(path, restoreBytes, artifactClass, trustedRoot);
1158
+ }
1159
+ throw error;
1160
+ }
1161
+ }
1162
+ function readExactPrivateFile(path, expected, artifactClass, trustedRoot) {
1163
+ const descriptor = openSafeArtifactFile(path, {
1164
+ artifactClass,
1165
+ mode: "read",
1166
+ trustedRoot,
1167
+ });
1168
+ try {
1169
+ const buffer = Buffer.alloc(expected.length + 1);
1170
+ const read = readIntoBuffer(descriptor, buffer, artifactClass);
1171
+ verifySafeArtifactFileDescriptor(descriptor, path, { artifactClass, trustedRoot });
1172
+ return read === expected.length && buffer.subarray(0, read).equals(expected);
1173
+ }
1174
+ catch (error) {
1175
+ if (error instanceof SafeArtifactFileError)
1176
+ throw error;
1177
+ throw safeFileError(artifactClass, "read-failed");
1178
+ }
1179
+ finally {
1180
+ closeArtifactDescriptor(descriptor, artifactClass);
1181
+ }
1182
+ }
1183
+ function readIntoBuffer(descriptor, buffer, artifactClass) {
1184
+ let offset = 0;
1185
+ try {
1186
+ while (offset < buffer.length) {
1187
+ const read = readSync(descriptor, buffer, offset, buffer.length - offset, offset);
1188
+ if (read === 0)
1189
+ break;
1190
+ offset += read;
1191
+ }
1192
+ return offset;
1193
+ }
1194
+ catch {
1195
+ throw safeFileError(artifactClass, "read-failed");
1196
+ }
1197
+ }
1198
+ function recoveryStatIsSafe(stat) {
1199
+ return (stat.isFile() &&
1200
+ !stat.isSymbolicLink() &&
1201
+ (stat.nlink === 1n || stat.nlink === 2n) &&
1202
+ permissionIsPrivate(stat.mode));
1203
+ }
1204
+ function recoveryPathStat(path, artifactClass) {
1205
+ try {
1206
+ const stat = lstatSync(path, { bigint: true });
1207
+ if (!recoveryStatIsSafe(stat))
1208
+ throw safeFileError(artifactClass, "recovery-conflict");
1209
+ return stat;
1210
+ }
1211
+ catch (error) {
1212
+ if (error instanceof SafeArtifactFileError)
1213
+ throw error;
1214
+ throw safeFileError(artifactClass, "recovery-conflict");
1215
+ }
1216
+ }
1217
+ function openRecoveryDescriptor(path, artifactClass) {
1218
+ const noFollow = noFollowFlag();
1219
+ const nonBlocking = typeof constants.O_NONBLOCK === "number" ? constants.O_NONBLOCK : 0;
1220
+ if (noFollow === 0)
1221
+ refuseSymlinkFallback(path, artifactClass);
1222
+ try {
1223
+ return openSync(path, constants.O_RDWR | noFollow | nonBlocking);
1224
+ }
1225
+ catch (error) {
1226
+ if (error instanceof SafeArtifactFileError)
1227
+ throw error;
1228
+ throw safeFileError(artifactClass, "read-failed");
1229
+ }
1230
+ }
1231
+ function sameRecoveryIdentity(left, right) {
1232
+ return left.dev === right.dev && left.ino === right.ino && left.nlink === right.nlink;
1233
+ }
1234
+ function recoveryReadMatches(bytes, count, expected, before, after, guards) {
1235
+ return (count === expected.byteCount &&
1236
+ publicationDigest(bytes.subarray(0, count)) === expected.sha256 &&
1237
+ sameRecoveryIdentity(before, after) &&
1238
+ guards.every(directoryGuardStillMatches));
1239
+ }
1240
+ function readRecoveryBytes(path, expected, trustedRoot) {
1241
+ const guards = captureDirectoryGuards(trustedRoot, path, expected.artifactClass);
1242
+ const before = recoveryPathStat(path, expected.artifactClass);
1243
+ let descriptor;
1244
+ try {
1245
+ descriptor = openRecoveryDescriptor(path, expected.artifactClass);
1246
+ const opened = fstatSync(descriptor, { bigint: true });
1247
+ if (!recoveryStatIsSafe(opened) || !sameRecoveryIdentity(before, opened)) {
1248
+ throw safeFileError(expected.artifactClass, "recovery-conflict");
1249
+ }
1250
+ const bytes = Buffer.alloc(expected.byteCount + 1);
1251
+ const count = readIntoBuffer(descriptor, bytes, expected.artifactClass);
1252
+ const after = recoveryPathStat(path, expected.artifactClass);
1253
+ const finalOpened = fstatSync(descriptor, { bigint: true });
1254
+ if (!recoveryReadMatches(bytes, count, expected, opened, finalOpened, guards) ||
1255
+ !sameRecoveryIdentity(finalOpened, after)) {
1256
+ throw safeFileError(expected.artifactClass, "recovery-conflict");
1257
+ }
1258
+ closeArtifactDescriptor(descriptor, expected.artifactClass);
1259
+ descriptor = undefined;
1260
+ closeDirectoryGuards(guards, expected.artifactClass);
1261
+ return bytes.subarray(0, count);
1262
+ }
1263
+ catch (error) {
1264
+ if (descriptor !== undefined)
1265
+ closeDescriptorIgnoringErrors(descriptor);
1266
+ closeDirectoryGuardsIgnoringErrors(guards);
1267
+ if (error instanceof SafeArtifactFileError)
1268
+ throw error;
1269
+ throw safeFileError(expected.artifactClass, "read-failed");
1270
+ }
1271
+ }
1272
+ function linkedRecoveryStats(entry) {
1273
+ try {
1274
+ const stage = lstatSync(entry.stagePath, { bigint: true });
1275
+ const target = lstatSync(entry.path, { bigint: true });
1276
+ if (!linkedStatsAreSafe(stage, target)) {
1277
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1278
+ }
1279
+ return { stage, target };
1280
+ }
1281
+ catch (error) {
1282
+ if (error instanceof SafeArtifactFileError)
1283
+ throw error;
1284
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1285
+ }
1286
+ }
1287
+ function linkedStatsAreSafe(stage, target) {
1288
+ const checks = [
1289
+ stage.isFile(),
1290
+ target.isFile(),
1291
+ !stage.isSymbolicLink(),
1292
+ !target.isSymbolicLink(),
1293
+ stage.nlink === 2n,
1294
+ target.nlink === 2n,
1295
+ stage.dev === target.dev,
1296
+ stage.ino === target.ino,
1297
+ permissionIsPrivate(stage.mode),
1298
+ permissionIsPrivate(target.mode),
1299
+ ];
1300
+ return checks.every(Boolean);
1301
+ }
1302
+ function openLinkedStage(entry) {
1303
+ const noFollow = noFollowFlag();
1304
+ const nonBlocking = typeof constants.O_NONBLOCK === "number" ? constants.O_NONBLOCK : 0;
1305
+ if (noFollow === 0)
1306
+ refuseSymlinkFallback(entry.stagePath, entry.artifactClass);
1307
+ try {
1308
+ return openSync(entry.stagePath, constants.O_RDWR | noFollow | nonBlocking);
1309
+ }
1310
+ catch (error) {
1311
+ if (error instanceof SafeArtifactFileError)
1312
+ throw error;
1313
+ throw safeFileError(entry.artifactClass, "read-failed");
1314
+ }
1315
+ }
1316
+ function linkedDescriptorMatches(descriptor, expected) {
1317
+ const opened = fstatSync(descriptor, { bigint: true });
1318
+ return [
1319
+ opened.isFile(),
1320
+ opened.dev === expected.dev,
1321
+ opened.ino === expected.ino,
1322
+ opened.nlink === 2n,
1323
+ ].every(Boolean);
1324
+ }
1325
+ function readMatchesPublication(descriptor, entry) {
1326
+ const buffer = Buffer.alloc(entry.bytes.length + 1);
1327
+ const read = readIntoBuffer(descriptor, buffer, entry.artifactClass);
1328
+ return read === entry.bytes.length && buffer.subarray(0, read).equals(entry.bytes);
1329
+ }
1330
+ function linkedRecoveryContentsMatch(entry) {
1331
+ const expected = linkedRecoveryStats(entry).stage;
1332
+ const guards = captureDirectoryGuards(entry.trustedRoot, entry.stagePath, entry.artifactClass);
1333
+ let descriptor;
1334
+ try {
1335
+ descriptor = openLinkedStage(entry);
1336
+ if (!linkedDescriptorMatches(descriptor, expected) ||
1337
+ !guards.every(directoryGuardStillMatches)) {
1338
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1339
+ }
1340
+ const matches = readMatchesPublication(descriptor, entry);
1341
+ syncArtifactDescriptor(descriptor, entry.artifactClass);
1342
+ closeArtifactDescriptor(descriptor, entry.artifactClass);
1343
+ closeDirectoryGuards(guards, entry.artifactClass);
1344
+ return matches;
1345
+ }
1346
+ catch (error) {
1347
+ if (descriptor !== undefined)
1348
+ closeDescriptorIgnoringErrors(descriptor);
1349
+ closeDirectoryGuardsIgnoringErrors(guards);
1350
+ if (error instanceof SafeArtifactFileError)
1351
+ throw error;
1352
+ throw safeFileError(entry.artifactClass, "read-failed");
1353
+ }
1354
+ }
1355
+ function samePathNode(left, right) {
1356
+ try {
1357
+ const leftStat = lstatSync(left, { bigint: true });
1358
+ const rightStat = lstatSync(right, { bigint: true });
1359
+ return leftStat.dev === rightStat.dev && leftStat.ino === rightStat.ino;
1360
+ }
1361
+ catch {
1362
+ return false;
1363
+ }
1364
+ }
1365
+ function recoverLinkedStage(entry) {
1366
+ if (!pathExists(entry.stagePath, entry.artifactClass) ||
1367
+ !pathExists(entry.path, entry.artifactClass)) {
1368
+ return false;
1369
+ }
1370
+ if (!samePathNode(entry.stagePath, entry.path) || !linkedRecoveryContentsMatch(entry)) {
1371
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1372
+ }
1373
+ return true;
1374
+ }
1375
+ function syncRecoveredStage(entry) {
1376
+ const descriptor = openSafeArtifactFile(entry.stagePath, {
1377
+ artifactClass: entry.artifactClass,
1378
+ mode: "read-write-existing",
1379
+ trustedRoot: entry.trustedRoot,
1380
+ });
1381
+ try {
1382
+ syncArtifactDescriptor(descriptor, entry.artifactClass);
1383
+ }
1384
+ catch (error) {
1385
+ closeDescriptorIgnoringErrors(descriptor);
1386
+ throw error;
1387
+ }
1388
+ closeArtifactDescriptor(descriptor, entry.artifactClass);
1389
+ }
1390
+ function removeVerifiedStage(entry) {
1391
+ const descriptor = openSafeArtifactFile(entry.stagePath, {
1392
+ artifactClass: entry.artifactClass,
1393
+ mode: "read",
1394
+ trustedRoot: entry.trustedRoot,
1395
+ });
1396
+ try {
1397
+ verifySafeArtifactFileDescriptor(descriptor, entry.stagePath, {
1398
+ artifactClass: entry.artifactClass,
1399
+ trustedRoot: entry.trustedRoot,
1400
+ });
1401
+ unlinkGuardedPath(entry.stagePath, descriptor, entry.trustedRoot, entry.artifactClass);
1402
+ syncDirectory(dirname(entry.stagePath), entry.trustedRoot, entry.artifactClass);
1403
+ }
1404
+ catch (error) {
1405
+ closeDescriptorIgnoringErrors(descriptor);
1406
+ if (error instanceof SafeArtifactFileError)
1407
+ throw error;
1408
+ throw safeFileError(entry.artifactClass, "publish-failed");
1409
+ }
1410
+ closeArtifactDescriptor(descriptor, entry.artifactClass);
1411
+ }
1412
+ function ensurePreparedStage(entry, recovering) {
1413
+ if (recoverLinkedStage(entry))
1414
+ return;
1415
+ const stageExists = pathExists(entry.stagePath, entry.artifactClass);
1416
+ const targetExists = pathExists(entry.path, entry.artifactClass);
1417
+ if (targetExists) {
1418
+ if (!recovering ||
1419
+ !readExactPrivateFile(entry.path, entry.bytes, entry.artifactClass, entry.trustedRoot)) {
1420
+ throw safeFileError(entry.artifactClass, recovering ? "recovery-conflict" : "target-exists");
1421
+ }
1422
+ return;
1423
+ }
1424
+ if (!stageExists) {
1425
+ createStage(entry);
1426
+ return;
1427
+ }
1428
+ if (!readExactPrivateFile(entry.stagePath, entry.bytes, entry.artifactClass, entry.trustedRoot)) {
1429
+ if (!recovering)
1430
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1431
+ removeVerifiedStage(entry);
1432
+ createStage(entry);
1433
+ return;
1434
+ }
1435
+ syncRecoveredStage(entry);
1436
+ }
1437
+ function orderedForCommit(entries, commitPath) {
1438
+ const resolvedCommit = resolve(commitPath);
1439
+ const commit = entries.find((entry) => entry.path === resolvedCommit);
1440
+ if (commit === undefined)
1441
+ return entries;
1442
+ return [...entries.filter((entry) => entry !== commit), commit];
1443
+ }
1444
+ function acceptRecoveredTarget(entry, recovering) {
1445
+ if (!recovering)
1446
+ throw safeFileError(entry.artifactClass, "target-exists");
1447
+ if (pathExists(entry.stagePath, entry.artifactClass) &&
1448
+ samePathNode(entry.stagePath, entry.path) &&
1449
+ linkedRecoveryContentsMatch(entry)) {
1450
+ return;
1451
+ }
1452
+ if (!readExactPrivateFile(entry.path, entry.bytes, entry.artifactClass, entry.trustedRoot)) {
1453
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1454
+ }
1455
+ }
1456
+ // Links `source` to `target` while holding `source` open, so the helper publishes only that inode.
1457
+ function linkHeldEntry(source, target, entry) {
1458
+ const held = openSafeArtifactFile(source, {
1459
+ artifactClass: entry.artifactClass,
1460
+ mode: "read",
1461
+ trustedRoot: entry.trustedRoot,
1462
+ });
1463
+ try {
1464
+ return runGuardedDirectoryMutation("link", source, held, entry.trustedRoot, entry.artifactClass, target);
1465
+ }
1466
+ finally {
1467
+ closeDescriptorIgnoringErrors(held);
1468
+ }
1469
+ }
1470
+ function linkPreparedEntry(entry, recovering) {
1471
+ const result = linkHeldEntry(entry.stagePath, entry.path, entry);
1472
+ if (result === "success")
1473
+ return true;
1474
+ if (result === "target-exists") {
1475
+ acceptRecoveredTarget(entry, recovering);
1476
+ return false;
1477
+ }
1478
+ throw safeFileError(entry.artifactClass, mutationFailureKind(result));
1479
+ }
1480
+ function publishPreparedEntry(entry, recovering) {
1481
+ if (recovering && pathExists(entry.path, entry.artifactClass)) {
1482
+ acceptRecoveredTarget(entry, true);
1483
+ return;
1484
+ }
1485
+ if (!linkPreparedEntry(entry, recovering))
1486
+ return;
1487
+ try {
1488
+ if (!samePathNode(entry.stagePath, entry.path) || !linkedRecoveryContentsMatch(entry)) {
1489
+ throw safeFileError(entry.artifactClass, "target-mutated");
1490
+ }
1491
+ }
1492
+ catch (error) {
1493
+ if (error instanceof SafeArtifactFileError)
1494
+ throw error;
1495
+ throw safeFileError(entry.artifactClass, "publish-failed");
1496
+ }
1497
+ }
1498
+ function unlinkLinkedStage(entry) {
1499
+ const held = openLinkedStage(entry);
1500
+ try {
1501
+ unlinkGuardedPath(entry.stagePath, held, entry.trustedRoot, entry.artifactClass);
1502
+ }
1503
+ finally {
1504
+ closeDescriptorIgnoringErrors(held);
1505
+ }
1506
+ }
1507
+ function cleanupPublishedStage(entry) {
1508
+ if (!pathExists(entry.stagePath, entry.artifactClass)) {
1509
+ if (readExactPrivateFile(entry.path, entry.bytes, entry.artifactClass, entry.trustedRoot))
1510
+ return;
1511
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1512
+ }
1513
+ if (!samePathNode(entry.stagePath, entry.path) || !linkedRecoveryContentsMatch(entry)) {
1514
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1515
+ }
1516
+ try {
1517
+ unlinkLinkedStage(entry);
1518
+ }
1519
+ catch {
1520
+ restoreRecoveryMarker(entry, dirname(entry.stagePath));
1521
+ throw safeFileError(entry.artifactClass, "publish-failed");
1522
+ }
1523
+ try {
1524
+ if (!readExactPrivateFile(entry.path, entry.bytes, entry.artifactClass, entry.trustedRoot)) {
1525
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1526
+ }
1527
+ }
1528
+ catch (error) {
1529
+ restoreRecoveryMarker(entry, dirname(entry.stagePath));
1530
+ throw error;
1531
+ }
1532
+ }
1533
+ function restoreRecoveryMarker(entry, parent) {
1534
+ if (pathExists(entry.stagePath, entry.artifactClass))
1535
+ return;
1536
+ const result = linkHeldEntry(entry.path, entry.stagePath, entry);
1537
+ if (result !== "success" && result !== "target-exists") {
1538
+ throw safeFileError(entry.artifactClass, "durability-failed");
1539
+ }
1540
+ syncDirectory(parent, entry.trustedRoot, entry.artifactClass);
1541
+ }
1542
+ function combineDurabilityAssurance(...assurances) {
1543
+ return assurances.includes("directory-sync-unavailable")
1544
+ ? "directory-sync-unavailable"
1545
+ : "verified";
1546
+ }
1547
+ function publicationLocatorEntry(intent, trustedRoot, slot, from, to) {
1548
+ return {
1549
+ path: intentPath(trustedRoot, slot, to),
1550
+ stagePath: intentPath(trustedRoot, slot, from),
1551
+ bytes: intentBytes(intent),
1552
+ artifactClass: "manifest",
1553
+ trustedRoot,
1554
+ };
1555
+ }
1556
+ function readLinkedPublicationIntent(fromPath, toPath, trustedRoot) {
1557
+ const entry = {
1558
+ path: toPath,
1559
+ stagePath: fromPath,
1560
+ bytes: Buffer.alloc(0),
1561
+ artifactClass: "manifest",
1562
+ trustedRoot,
1563
+ };
1564
+ const guards = [
1565
+ ...captureDirectoryGuards(trustedRoot, fromPath, "manifest"),
1566
+ ...captureDirectoryGuards(trustedRoot, toPath, "manifest"),
1567
+ ];
1568
+ let descriptor;
1569
+ try {
1570
+ const before = linkedRecoveryStats(entry).stage;
1571
+ if (before.size <= 0n || before.size > BigInt(MAX_PUBLICATION_INTENT_BYTES)) {
1572
+ throw safeFileError("manifest", "recovery-conflict");
1573
+ }
1574
+ descriptor = openLinkedStage(entry);
1575
+ if (!linkedDescriptorMatches(descriptor, before)) {
1576
+ throw safeFileError("manifest", "recovery-conflict");
1577
+ }
1578
+ const buffer = Buffer.alloc(Number(before.size) + 1);
1579
+ const count = readIntoBuffer(descriptor, buffer, "manifest");
1580
+ const after = linkedRecoveryStats(entry).stage;
1581
+ if (count !== Number(before.size) || !sameRecoveryIdentity(before, after)) {
1582
+ throw safeFileError("manifest", "recovery-conflict");
1583
+ }
1584
+ if (!linkedDescriptorMatches(descriptor, after) || !guards.every(directoryGuardStillMatches)) {
1585
+ throw safeFileError("manifest", "recovery-conflict");
1586
+ }
1587
+ return parsePublicationIntentBytes(buffer, count);
1588
+ }
1589
+ finally {
1590
+ if (descriptor !== undefined)
1591
+ closeArtifactDescriptor(descriptor, "manifest");
1592
+ closeDirectoryGuards(guards, "manifest");
1593
+ }
1594
+ }
1595
+ function transitionPublicationReceipt(intent, trustedRoot, slot, from, to) {
1596
+ const entry = publicationLocatorEntry(intent, trustedRoot, slot, from, to);
1597
+ publishPreparedEntry(entry, true);
1598
+ const linked = syncDirectory(dirname(entry.path), trustedRoot, "manifest");
1599
+ cleanupPublishedStage(entry);
1600
+ const cleaned = syncDirectory(dirname(entry.path), trustedRoot, "manifest");
1601
+ return combineDurabilityAssurance(linked, cleaned);
1602
+ }
1603
+ function cleanupPublishedStages(entries, parent) {
1604
+ const commit = entries.at(-1);
1605
+ if (commit === undefined)
1606
+ return "verified";
1607
+ for (const entry of entries.slice(0, -1))
1608
+ cleanupPublishedStage(entry);
1609
+ const beforeCommitCleanup = syncDirectory(parent, commit.trustedRoot, commit.artifactClass);
1610
+ cleanupPublishedStage(commit);
1611
+ try {
1612
+ const afterCommitCleanup = syncDirectory(parent, commit.trustedRoot, commit.artifactClass);
1613
+ return combineDurabilityAssurance(beforeCommitCleanup, afterCommitCleanup);
1614
+ }
1615
+ catch (error) {
1616
+ restoreRecoveryMarker(commit, parent);
1617
+ throw error;
1618
+ }
1619
+ }
1620
+ function publicationHasPath(entries, field) {
1621
+ return entries.some((entry) => pathExists(entry[field], entry.artifactClass));
1622
+ }
1623
+ function publicationArtifactClass(entries) {
1624
+ return entries[0]?.artifactClass ?? "manifest";
1625
+ }
1626
+ function completePreparedPublication(prepared, options, recovering) {
1627
+ for (const entry of prepared)
1628
+ ensurePreparedStage(entry, recovering);
1629
+ const parent = dirname(resolve(options.commitPath));
1630
+ const preparedAssurance = syncDirectory(parent, options.trustedRoot, publicationArtifactClass(prepared));
1631
+ const ordered = orderedForCommit(prepared, options.commitPath);
1632
+ for (const entry of ordered)
1633
+ publishPreparedEntry(entry, recovering);
1634
+ const publishedAssurance = syncDirectory(parent, options.trustedRoot, publicationArtifactClass(prepared));
1635
+ const cleanupAssurance = cleanupPublishedStages(ordered, parent);
1636
+ return {
1637
+ status: recovering ? "recovered" : "published",
1638
+ permissionAssurance: safeArtifactPermissionAssurance(),
1639
+ durabilityAssurance: combineDurabilityAssurance(preparedAssurance, publishedAssurance, cleanupAssurance),
1640
+ };
1641
+ }
1642
+ function removeIntentPublicationStages(prepared) {
1643
+ const assurances = [];
1644
+ for (const entry of prepared) {
1645
+ if (!pathExists(entry.stagePath, entry.artifactClass))
1646
+ continue;
1647
+ if (!readExactPrivateFile(entry.stagePath, entry.bytes, entry.artifactClass, entry.trustedRoot)) {
1648
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1649
+ }
1650
+ removeVerifiedStage(entry);
1651
+ assurances.push("verified");
1652
+ }
1653
+ return combineDurabilityAssurance(...assurances);
1654
+ }
1655
+ function rollbackIntentPublication(prepared, intent, options) {
1656
+ if (publicationHasPath(prepared, "path")) {
1657
+ throw safeFileError(publicationArtifactClass(prepared), "recovery-conflict");
1658
+ }
1659
+ const stages = removeIntentPublicationStages(prepared);
1660
+ const marker = transitionPublicationReceipt(intent, options.trustedRoot, options.publicationSlot, "active", "consumed");
1661
+ return combineDurabilityAssurance(stages, marker);
1662
+ }
1663
+ function releasePublicationOwner(intent, options) {
1664
+ activePublicationOwnerTokens.delete(intent.ownerToken);
1665
+ const path = ownerPath(options.trustedRoot, options.publicationSlot);
1666
+ if (!pathExists(path, "manifest"))
1667
+ return "verified";
1668
+ if (!readExactPrivateFile(path, intentBytes(intent), "manifest", options.trustedRoot)) {
1669
+ throw safeFileError("manifest", "recovery-conflict");
1670
+ }
1671
+ return removePublicationIntent(path, options.trustedRoot, "manifest");
1672
+ }
1673
+ function releasePublicationOwnerAfterFailure(intent, options, ownerCreated) {
1674
+ activePublicationOwnerTokens.delete(intent.ownerToken);
1675
+ if (!ownerCreated)
1676
+ return;
1677
+ try {
1678
+ releasePublicationOwner(intent, options);
1679
+ }
1680
+ catch {
1681
+ // Preserve the primary failure. The durable owner marker remains available for recovery.
1682
+ }
1683
+ }
1684
+ function createOwnedActiveReceipt(intent, activePath, consumedPath, hasConsumed, artifactClass, options) {
1685
+ const publicationOwnerPath = ownerPath(options.trustedRoot, options.publicationSlot);
1686
+ if (pathExists(publicationOwnerPath, "manifest")) {
1687
+ throw safeFileError("manifest", "recovery-conflict");
1688
+ }
1689
+ let ownerCreated = false;
1690
+ activePublicationOwnerTokens.add(intent.ownerToken);
1691
+ try {
1692
+ ownerCreated = true;
1693
+ const ownerAssurance = createPublicationIntent(publicationOwnerPath, intentBytes(intent), "manifest", options.trustedRoot);
1694
+ const activeAssurance = createPublicationIntent(activePath, intentBytes(intent), artifactClass, options.trustedRoot);
1695
+ const priorAssurance = hasConsumed
1696
+ ? removePublicationIntent(consumedPath, options.trustedRoot, "manifest")
1697
+ : "verified";
1698
+ return combineDurabilityAssurance(ownerAssurance, activeAssurance, priorAssurance);
1699
+ }
1700
+ catch (error) {
1701
+ releasePublicationOwnerAfterFailure(intent, options, ownerCreated);
1702
+ throw error;
1703
+ }
1704
+ }
1705
+ function beginIntentPublication(entries, options) {
1706
+ const prepared = preparePublicationEntries(entries, options.commitPath, options.trustedRoot, options.publicationSlot);
1707
+ const activePath = intentPath(options.trustedRoot, options.publicationSlot, "active");
1708
+ const completePath = intentPath(options.trustedRoot, options.publicationSlot, "complete");
1709
+ const consumedPath = intentPath(options.trustedRoot, options.publicationSlot, "consumed");
1710
+ if (pathExists(activePath, publicationArtifactClass(prepared)) ||
1711
+ pathExists(completePath, publicationArtifactClass(prepared)) ||
1712
+ publicationHasPath(prepared, "stagePath")) {
1713
+ throw safeFileError(publicationArtifactClass(prepared), "recovery-conflict");
1714
+ }
1715
+ if (publicationHasPath(prepared, "path")) {
1716
+ throw safeFileError(publicationArtifactClass(prepared), "target-exists");
1717
+ }
1718
+ const hasConsumed = pathExists(consumedPath, "manifest");
1719
+ if (hasConsumed)
1720
+ readPublicationIntent(consumedPath, options.trustedRoot);
1721
+ const intent = publicationIntent(prepared, options.commitPath);
1722
+ const initialAssurance = createOwnedActiveReceipt(intent, activePath, consumedPath, hasConsumed, publicationArtifactClass(prepared), options);
1723
+ return { prepared, intent, initialAssurance };
1724
+ }
1725
+ function publishIntentFileSet(entries, options) {
1726
+ const begun = beginIntentPublication(entries, options);
1727
+ try {
1728
+ let result;
1729
+ try {
1730
+ result = completePreparedPublication(begun.prepared, options, false);
1731
+ }
1732
+ catch (error) {
1733
+ if (error instanceof SafeArtifactFileError && error.kind === "publish-unsupported") {
1734
+ rollbackIntentPublication(begun.prepared, begun.intent, options);
1735
+ }
1736
+ throw error;
1737
+ }
1738
+ const receiptAssurance = transitionPublicationReceipt(begun.intent, options.trustedRoot, options.publicationSlot, "active", "complete");
1739
+ const publication = {
1740
+ ...result,
1741
+ durabilityAssurance: combineDurabilityAssurance(begun.initialAssurance, result.durabilityAssurance, receiptAssurance),
1742
+ };
1743
+ releasePublicationOwner(begun.intent, options);
1744
+ return publication;
1745
+ }
1746
+ catch (error) {
1747
+ releasePublicationOwnerAfterFailure(begun.intent, options, true);
1748
+ throw error;
1749
+ }
1750
+ }
1751
+ function preparedRecoveryEntries(intent, trustedRoot, slot) {
1752
+ const root = resolve(trustedRoot);
1753
+ const targetPresence = intent.entries.map((entry) => pathExists(join(root, entry.name), entry.artifactClass));
1754
+ const stagePresence = intent.entries.map((entry, index) => pathExists(join(root, `.keiko-publish-${slot}-${String(index)}.stage`), entry.artifactClass));
1755
+ const allTargetsPresent = targetPresence.every(Boolean);
1756
+ if (targetPresence.some(Boolean) && !allTargetsPresent) {
1757
+ for (let index = 0; index < intent.entries.length; index += 1) {
1758
+ if (!targetPresence[index] && !stagePresence[index]) {
1759
+ throw safeFileError(intent.entries[index]?.artifactClass ?? "manifest", "recovery-conflict");
1760
+ }
1761
+ }
1762
+ }
1763
+ return intent.entries.map((entry, index) => {
1764
+ const path = join(root, entry.name);
1765
+ const stagePath = join(root, `.keiko-publish-${slot}-${String(index)}.stage`);
1766
+ const hasTarget = targetPresence[index] === true;
1767
+ const hasStage = stagePresence[index] === true;
1768
+ if (!hasTarget && !hasStage)
1769
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1770
+ if (hasTarget && hasStage && !samePathNode(path, stagePath)) {
1771
+ throw safeFileError(entry.artifactClass, "recovery-conflict");
1772
+ }
1773
+ const bytes = readRecoveryBytes(hasStage ? stagePath : path, entry, root);
1774
+ if (hasTarget && hasStage)
1775
+ readRecoveryBytes(path, entry, root);
1776
+ return { path, stagePath, bytes, artifactClass: entry.artifactClass, trustedRoot: root };
1777
+ });
1778
+ }
1779
+ function rollbackIncompleteIntent(intent, trustedRoot, slot) {
1780
+ const root = resolve(trustedRoot);
1781
+ const assurances = [];
1782
+ for (let index = 0; index < intent.entries.length; index += 1) {
1783
+ const entry = intent.entries[index];
1784
+ if (entry === undefined)
1785
+ continue;
1786
+ const stagePath = join(root, `.keiko-publish-${slot}-${String(index)}.stage`);
1787
+ if (!pathExists(stagePath, entry.artifactClass))
1788
+ continue;
1789
+ removeVerifiedStage({
1790
+ path: join(root, entry.name),
1791
+ stagePath,
1792
+ bytes: Buffer.alloc(0),
1793
+ artifactClass: entry.artifactClass,
1794
+ trustedRoot: root,
1795
+ });
1796
+ assurances.push("verified");
1797
+ }
1798
+ const marker = transitionPublicationReceipt(intent, root, slot, "active", "consumed");
1799
+ return combineDurabilityAssurance(...assurances, marker);
1800
+ }
1801
+ function countIntentPaths(intent, root, slot, kind) {
1802
+ return intent.entries.filter((entry, index) => {
1803
+ const path = kind === "target"
1804
+ ? join(root, entry.name)
1805
+ : join(root, `.keiko-publish-${slot}-${String(index)}.stage`);
1806
+ return pathExists(path, entry.artifactClass);
1807
+ }).length;
1808
+ }
1809
+ function processIsAlive(pid) {
1810
+ try {
1811
+ process.kill(pid, 0);
1812
+ return true;
1813
+ }
1814
+ catch (error) {
1815
+ return errorCode(error) !== "ESRCH";
1816
+ }
1817
+ }
1818
+ function publicationOwnerFailureKind(intent) {
1819
+ if (intent.ownerPid === process.pid) {
1820
+ return activePublicationOwnerTokens.has(intent.ownerToken) ? "recovery-conflict" : undefined;
1821
+ }
1822
+ if (!processIsAlive(intent.ownerPid))
1823
+ return undefined;
1824
+ return intent.ownerExpiresAt > Date.now() ? "recovery-conflict" : "publish-unsupported";
1825
+ }
1826
+ function recoverPublicationOwner(root, slot, receiptIntent) {
1827
+ const path = ownerPath(root, slot);
1828
+ if (!pathExists(path, "manifest"))
1829
+ return "verified";
1830
+ const intent = readPublicationIntent(path, root);
1831
+ if (receiptIntent !== undefined && !intentBytes(intent).equals(intentBytes(receiptIntent))) {
1832
+ throw safeFileError("manifest", "recovery-conflict");
1833
+ }
1834
+ const failureKind = publicationOwnerFailureKind(intent);
1835
+ if (failureKind !== undefined)
1836
+ throw safeFileError("manifest", failureKind);
1837
+ return releasePublicationOwner(intent, { publicationSlot: slot, trustedRoot: root });
1838
+ }
1839
+ function finishLinkedPublicationReceipt(root, slot, from, to) {
1840
+ const fromPath = intentPath(root, slot, from);
1841
+ const toPath = intentPath(root, slot, to);
1842
+ if (!samePathNode(fromPath, toPath))
1843
+ throw safeFileError("manifest", "recovery-conflict");
1844
+ const intent = readLinkedPublicationIntent(fromPath, toPath, root);
1845
+ const assurance = transitionPublicationReceipt(intent, root, slot, from, to);
1846
+ return { intent, assurance };
1847
+ }
1848
+ function retireConsumedReceipt(root, slot) {
1849
+ const consumedPath = intentPath(root, slot, "consumed");
1850
+ readPublicationIntent(consumedPath, root);
1851
+ return removePublicationIntent(consumedPath, root, "manifest");
1852
+ }
1853
+ function completeIntentRecovery(intent, options, root, state, priorAssurance = "verified") {
1854
+ const prepared = preparedRecoveryEntries(intent, root, options.publicationSlot);
1855
+ const commit = prepared[intent.commitIndex];
1856
+ if (commit === undefined)
1857
+ throw safeFileError("manifest", "recovery-conflict");
1858
+ const result = completePreparedPublication(prepared, {
1859
+ commitPath: commit.path,
1860
+ publicationSlot: options.publicationSlot,
1861
+ trustedRoot: root,
1862
+ }, true);
1863
+ const receiptAssurance = state === "active"
1864
+ ? transitionPublicationReceipt(intent, root, options.publicationSlot, "active", "complete")
1865
+ : "verified";
1866
+ return {
1867
+ status: "recovered",
1868
+ commitPath: commit.path,
1869
+ artifactCount: prepared.length,
1870
+ commitByteCount: intent.entries[intent.commitIndex]?.byteCount ?? 0,
1871
+ commitSha256: intent.entries[intent.commitIndex]?.sha256 ?? publicationDigest(commit.bytes),
1872
+ permissionAssurance: result.permissionAssurance,
1873
+ durabilityAssurance: combineDurabilityAssurance(priorAssurance, result.durabilityAssurance, receiptAssurance),
1874
+ };
1875
+ }
1876
+ function transitionalReceiptState(root, slot, active, complete, consumed) {
1877
+ if (Number(active) + Number(complete) + Number(consumed) === 3) {
1878
+ throw safeFileError("manifest", "recovery-conflict");
1879
+ }
1880
+ if (complete && consumed) {
1881
+ finishLinkedPublicationReceipt(root, slot, "complete", "consumed");
1882
+ return { status: "none" };
1883
+ }
1884
+ if (active && complete) {
1885
+ const finished = finishLinkedPublicationReceipt(root, slot, "active", "complete");
1886
+ return { status: "complete", priorAssurance: finished.assurance };
1887
+ }
1888
+ if (active &&
1889
+ consumed &&
1890
+ samePathNode(intentPath(root, slot, "active"), intentPath(root, slot, "consumed"))) {
1891
+ finishLinkedPublicationReceipt(root, slot, "active", "consumed");
1892
+ return { status: "rolled-back" };
1893
+ }
1894
+ return undefined;
1895
+ }
1896
+ function recoveredReceiptState(root, slot) {
1897
+ const active = pathExists(intentPath(root, slot, "active"), "manifest");
1898
+ const complete = pathExists(intentPath(root, slot, "complete"), "manifest");
1899
+ const consumed = pathExists(intentPath(root, slot, "consumed"), "manifest");
1900
+ const transitional = transitionalReceiptState(root, slot, active, complete, consumed);
1901
+ if (transitional !== undefined)
1902
+ return transitional;
1903
+ if (active)
1904
+ return { status: "active", priorAssurance: "verified" };
1905
+ if (complete)
1906
+ return { status: "complete", priorAssurance: "verified" };
1907
+ if (consumed)
1908
+ readPublicationIntent(intentPath(root, slot, "consumed"), root);
1909
+ return { status: "none" };
1910
+ }
1911
+ function validateLinkedReceiptPair(root, slot, from, to) {
1912
+ const fromPath = intentPath(root, slot, from);
1913
+ const toPath = intentPath(root, slot, to);
1914
+ if (!samePathNode(fromPath, toPath))
1915
+ throw safeFileError("manifest", "recovery-conflict");
1916
+ return readLinkedPublicationIntent(fromPath, toPath, root);
1917
+ }
1918
+ function validateActiveConsumedPair(root, slot) {
1919
+ const activePath = intentPath(root, slot, "active");
1920
+ const consumedPath = intentPath(root, slot, "consumed");
1921
+ if (samePathNode(activePath, consumedPath)) {
1922
+ return readLinkedPublicationIntent(activePath, consumedPath, root);
1923
+ }
1924
+ const intent = readPublicationIntent(activePath, root);
1925
+ readPublicationIntent(consumedPath, root);
1926
+ return intent;
1927
+ }
1928
+ function validateStableReceiptStates(root, slot, active, complete, consumed) {
1929
+ if (active)
1930
+ return readPublicationIntent(intentPath(root, slot, "active"), root);
1931
+ if (complete)
1932
+ return readPublicationIntent(intentPath(root, slot, "complete"), root);
1933
+ if (consumed)
1934
+ readPublicationIntent(intentPath(root, slot, "consumed"), root);
1935
+ return undefined;
1936
+ }
1937
+ function validateReceiptTopology(root, slot) {
1938
+ const active = pathExists(intentPath(root, slot, "active"), "manifest");
1939
+ const complete = pathExists(intentPath(root, slot, "complete"), "manifest");
1940
+ const consumed = pathExists(intentPath(root, slot, "consumed"), "manifest");
1941
+ if (Number(active) + Number(complete) + Number(consumed) === 3) {
1942
+ throw safeFileError("manifest", "recovery-conflict");
1943
+ }
1944
+ if (active && complete) {
1945
+ return validateLinkedReceiptPair(root, slot, "active", "complete");
1946
+ }
1947
+ if (complete && consumed) {
1948
+ return validateLinkedReceiptPair(root, slot, "complete", "consumed");
1949
+ }
1950
+ if (active && consumed) {
1951
+ return validateActiveConsumedPair(root, slot);
1952
+ }
1953
+ return validateStableReceiptStates(root, slot, active, complete, consumed);
1954
+ }
1955
+ /** Recovers or safely rolls back the bounded transaction named by a durable publication slot. */
1956
+ export function recoverSafeArtifactFileSet(options) {
1957
+ validatePublicationSlot(options.publicationSlot, "manifest");
1958
+ const root = resolve(options.trustedRoot);
1959
+ const receiptIntent = validateReceiptTopology(root, options.publicationSlot);
1960
+ const ownerAssurance = recoverPublicationOwner(root, options.publicationSlot, receiptIntent);
1961
+ const state = recoveredReceiptState(root, options.publicationSlot);
1962
+ if (state.status === "none")
1963
+ return { status: "none" };
1964
+ if (state.status === "rolled-back") {
1965
+ return {
1966
+ status: "rolled-back",
1967
+ permissionAssurance: safeArtifactPermissionAssurance(),
1968
+ durabilityAssurance: ownerAssurance,
1969
+ };
1970
+ }
1971
+ const markerPath = intentPath(root, options.publicationSlot, state.status);
1972
+ const intent = readPublicationIntent(markerPath, root);
1973
+ if (state.status === "complete") {
1974
+ return completeIntentRecovery(intent, options, root, "complete", combineDurabilityAssurance(ownerAssurance, state.priorAssurance));
1975
+ }
1976
+ const consumedAssurance = pathExists(intentPath(root, options.publicationSlot, "consumed"), "manifest")
1977
+ ? retireConsumedReceipt(root, options.publicationSlot)
1978
+ : state.priorAssurance;
1979
+ const priorAssurance = combineDurabilityAssurance(ownerAssurance, consumedAssurance);
1980
+ const targetCount = countIntentPaths(intent, root, options.publicationSlot, "target");
1981
+ if (targetCount === 0) {
1982
+ const durabilityAssurance = combineDurabilityAssurance(priorAssurance, rollbackIncompleteIntent(intent, root, options.publicationSlot));
1983
+ return {
1984
+ status: "rolled-back",
1985
+ permissionAssurance: safeArtifactPermissionAssurance(),
1986
+ durabilityAssurance,
1987
+ };
1988
+ }
1989
+ return completeIntentRecovery(intent, options, root, "active", priorAssurance);
1990
+ }
1991
+ /** Marks a completed fixed-slot publication as observed without removing its durable locator. */
1992
+ export function acknowledgeSafeArtifactFileSet(options) {
1993
+ validatePublicationSlot(options.publicationSlot, "manifest");
1994
+ const root = resolve(options.trustedRoot);
1995
+ const activePath = intentPath(root, options.publicationSlot, "active");
1996
+ const completePath = intentPath(root, options.publicationSlot, "complete");
1997
+ const consumedPath = intentPath(root, options.publicationSlot, "consumed");
1998
+ if (pathExists(activePath, "manifest"))
1999
+ throw safeFileError("manifest", "recovery-conflict");
2000
+ if (pathExists(consumedPath, "manifest")) {
2001
+ if (pathExists(completePath, "manifest")) {
2002
+ return finishLinkedPublicationReceipt(root, options.publicationSlot, "complete", "consumed")
2003
+ .assurance;
2004
+ }
2005
+ readPublicationIntent(consumedPath, root);
2006
+ return "verified";
2007
+ }
2008
+ const intent = readPublicationIntent(completePath, root);
2009
+ preparedRecoveryEntries(intent, root, options.publicationSlot);
2010
+ return transitionPublicationReceipt(intent, root, options.publicationSlot, "complete", "consumed");
2011
+ }
2012
+ /**
2013
+ * Publishes related files without replacement; the designated commit artifact appears last.
2014
+ * Filesystems without same-directory hard links fail closed as `publish-unsupported`.
2015
+ * Fixed-slot publication retains a bounded active/complete/consumed receipt: complete receipts
2016
+ * authorize exact recovery until the consumer acknowledges them, and a consumed receipt is
2017
+ * retired only after its next active successor is durable. Targets alone never authorize replay.
2018
+ */
2019
+ export function publishSafeArtifactFileSet(entries, options) {
2020
+ validatePublication(entries, options);
2021
+ if (options.publicationSlot !== undefined) {
2022
+ return publishIntentFileSet(entries, {
2023
+ ...options,
2024
+ publicationSlot: options.publicationSlot,
2025
+ });
2026
+ }
2027
+ const prepared = preparePublicationEntries(entries, options.commitPath, options.trustedRoot);
2028
+ const recovering = publicationHasPath(prepared, "stagePath");
2029
+ if (!recovering && publicationHasPath(prepared, "path")) {
2030
+ throw safeFileError(publicationArtifactClass(prepared), "target-exists");
2031
+ }
2032
+ return completePreparedPublication(prepared, options, recovering);
2033
+ }
2034
+ /**
2035
+ * Fails closed until Node exposes a portable descriptor-relative atomic replacement primitive.
2036
+ * Absolute-path rename cannot exclude a final ancestor substitution, even with verified guards.
2037
+ */
2038
+ export function replaceSafeArtifactFile(_path, _contents, options) {
2039
+ throw safeFileError(options.artifactClass, "publish-unsupported");
2040
+ }