@makaio/framework 1.0.0-dev-1789000242829 → 1.0.0-dev-1789056039016

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 (288) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapters/claude/index.d.mts +60 -60
  3. package/dist/adapters/config/index.d.mts +1 -1
  4. package/dist/adapters/index.d.mts +2 -2
  5. package/dist/adapters/node.d.mts +1 -1
  6. package/dist/artifact--nbPrvm5.mjs +1 -0
  7. package/dist/attempt-control-evidence-BKw1U3wL.mjs +1 -0
  8. package/dist/bootstrap-start-client-D7t7d9ty.mjs +1 -0
  9. package/dist/bus/index.mjs +1 -1
  10. package/dist/clients/index.d.mts +1 -1
  11. package/dist/clients/managed-install.d.mts +1 -1
  12. package/dist/code-execution/worker-entry.d.mts +1 -1
  13. package/dist/contracts/adapter/index.d.mts +2 -2
  14. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  15. package/dist/contracts/artifact/index.d.mts +3 -3
  16. package/dist/contracts/artifact/index.mjs +1 -1
  17. package/dist/contracts/auth/index.d.mts +2 -2
  18. package/dist/contracts/automation-trigger/index.d.mts +3 -3
  19. package/dist/contracts/canonical-model/index.d.mts +1 -1
  20. package/dist/contracts/capabilities/index.d.mts +1 -1
  21. package/dist/contracts/client/index.d.mts +2 -2
  22. package/dist/contracts/code-execution/index.d.mts +1 -1
  23. package/dist/contracts/common/index.d.mts +1 -1
  24. package/dist/contracts/config/index.d.mts +1 -1
  25. package/dist/contracts/extension/index.d.mts +5 -5
  26. package/dist/contracts/facet/index.d.mts +1 -1
  27. package/dist/contracts/harness/index.d.mts +1 -1
  28. package/dist/contracts/host/index.d.mts +1 -1
  29. package/dist/contracts/index.d.mts +287 -61
  30. package/dist/contracts/index.mjs +1 -1
  31. package/dist/contracts/materialization/index.d.mts +2 -2
  32. package/dist/contracts/model-registry/index.d.mts +1 -1
  33. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  34. package/dist/contracts/platform/index.d.mts +1 -1
  35. package/dist/contracts/provider/index.d.mts +2 -2
  36. package/dist/contracts/reaction/index.d.mts +1 -1
  37. package/dist/contracts/session/index.d.mts +2 -2
  38. package/dist/contracts/shared/index.d.mts +2 -2
  39. package/dist/contracts/skill/index.d.mts +1 -1
  40. package/dist/contracts/telemetry/index.d.mts +1 -1
  41. package/dist/contracts/timeout/index.d.mts +1 -1
  42. package/dist/contracts/variant/index.d.mts +1 -1
  43. package/dist/contracts/worker/index.d.mts +3 -3
  44. package/dist/contracts/worker/index.mjs +1 -1
  45. package/dist/contracts/workflow/index.d.mts +2 -2
  46. package/dist/contracts/workflow/index.mjs +1 -1
  47. package/dist/{contribution-BfEEQ8YZ.d.mts → contribution-BWanQHUz.d.mts} +2 -2
  48. package/dist/{definition-6d5JBi55.d.mts → definition-DSOXLpQj.d.mts} +1 -1
  49. package/dist/{detached-extension-handle-BJnk3WEh.mjs → detached-extension-handle-BNvRSUVO.mjs} +1 -1
  50. package/dist/{execution-attempt-repository-DSpz2kyW.d.mts → execution-attempt-repository-BoNwNybg.d.mts} +85 -3
  51. package/dist/{hook-responses-CpEfxEmG.d.mts → hook-responses-DVjMuGh9.d.mts} +1 -1
  52. package/dist/{index-CCNCo440.d.mts → index-B4KCyY6J.d.mts} +16 -16
  53. package/dist/{index-Bj2JCo9V.d.mts → index-BXair-QK.d.mts} +1 -1
  54. package/dist/{index-BfzuauBt2.d.mts → index-BgKU1PuR2.d.mts} +1 -1
  55. package/dist/{index-DvoitgXV.d.mts → index-C0jn5nKJ.d.mts} +11 -11
  56. package/dist/{index-CRM23ToM2.d.mts → index-CAURP-Tl2.d.mts} +3 -3
  57. package/dist/{index-BTluq4-E.d.mts → index-CKvliyuY.d.mts} +4847 -1730
  58. package/dist/{index-BlHq_Ksb.d.mts → index-CLmjrH8K.d.mts} +2 -2
  59. package/dist/{index-GTCM4lXx.d.mts → index-CO6ADD43.d.mts} +25 -25
  60. package/dist/{index-BM-FPWjs2.d.mts → index-CTNGL-cq2.d.mts} +1 -1
  61. package/dist/{index-CDhbUjUH.d.mts → index-CU9xmTkP.d.mts} +1 -1
  62. package/dist/{index-hm8NV4CJ2.d.mts → index-CVP9K9-a2.d.mts} +8 -8
  63. package/dist/{index-BfwHYuRf.d.mts → index-Caai1zAG.d.mts} +1 -1
  64. package/dist/{index-D7IZQNhD.d.mts → index-CgYGg-Ne2.d.mts} +2 -2
  65. package/dist/{index-Bn6sN1op.d.mts → index-DUH2eTyC.d.mts} +1 -1
  66. package/dist/{index-C742b1FV.d.mts → index-DUdGqxHD.d.mts} +1 -1
  67. package/dist/{index-Dzozmb5u.d.mts → index-Ddk-kjif.d.mts} +3 -3
  68. package/dist/{index-DY_0TRvM.d.mts → index-DhW9WHFS.d.mts} +2 -2
  69. package/dist/{index-6kg8YFYt.d.mts → index-DnZksNTM.d.mts} +1 -1
  70. package/dist/{index-B3G-Hzwn.d.mts → index-Dp3UZQv_.d.mts} +1 -1
  71. package/dist/{index-BxJRljy-.d.mts → index-Dtc5UYJG.d.mts} +237 -102
  72. package/dist/{index-DR308wUB2.d.mts → index-H2NL2OwF2.d.mts} +119 -7
  73. package/dist/{index-CjMMvZch.d.mts → index-LRAmVQLj.d.mts} +278 -44
  74. package/dist/kernel/cli/index.d.mts +2 -2
  75. package/dist/kernel/cli/register.d.mts +1 -1
  76. package/dist/kernel/extension/index.d.mts +1 -1
  77. package/dist/kernel/index.d.mts +5 -5
  78. package/dist/kernel/namespace/index.d.mts +1 -1
  79. package/dist/kernel/observability/index.d.mts +1 -1
  80. package/dist/kernel/providers/index.d.mts +1 -1
  81. package/dist/kernel/window/index.d.mts +1 -1
  82. package/dist/{lib-BmXBuE-w.mjs → lib-B1Mvm4hQ.mjs} +1 -1
  83. package/dist/{lib-R-c_q77C.mjs → lib-D1-cvcTz.mjs} +1 -1
  84. package/dist/{load-extensions-Bu10B5B1.d.mts → load-extensions-D6SVKBPw.d.mts} +1 -1
  85. package/dist/{load-extensions-s4YmICgn.mjs → load-extensions-bwisKaW0.mjs} +1 -1
  86. package/dist/{namespace-btfJrUf6.d.mts → namespace-CYYFqmtJ.d.mts} +6 -6
  87. package/dist/{namespace-CfA0C0JR.d.mts → namespace-CfNNUjVv.d.mts} +2 -2
  88. package/dist/{namespace-BHb_9sh4.d.mts → namespace-DyWNxLt1.d.mts} +6 -6
  89. package/dist/{namespace-Dmbm2JzV.d.mts → namespace-l1Rcc4mp.d.mts} +2 -2
  90. package/dist/node/bus-server/index.d.mts +1 -1
  91. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  92. package/dist/{package-BaTrCWZl.d.mts → package-CnR_tOsW.d.mts} +21 -3
  93. package/dist/package-tvzH3A0x.mjs +7 -0
  94. package/dist/package.json +1 -1
  95. package/dist/rules/index.d.mts +1 -1
  96. package/dist/rules/schemas.d.mts +1 -1
  97. package/dist/runtime-bun/index.mjs +1 -1
  98. package/dist/runtime-node/code-execution/index.d.mts +2 -2
  99. package/dist/runtime-node/extension-discovery.d.mts +1 -1
  100. package/dist/runtime-node/extension-validation.d.mts +1 -1
  101. package/dist/runtime-node/extension-validation.mjs +1 -1
  102. package/dist/runtime-node/index.d.mts +6 -6
  103. package/dist/runtime-node/index.mjs +21 -21
  104. package/dist/runtime-node/makaio-config.d.mts +1 -1
  105. package/dist/runtime-node/workflow-execution-bus-access.mjs +1 -1
  106. package/dist/runtime-node/workflow-worker/index.d.mts +2 -2
  107. package/dist/runtime-node/workflow-worker/index.mjs +1 -1
  108. package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
  109. package/dist/{schemas-DYIVJDlx.d.mts → schemas-BGcAiQE0.d.mts} +4 -4
  110. package/dist/{schemas-CQe4xCRn.d.mts → schemas-D6JvwH-h.d.mts} +2 -2
  111. package/dist/{schemas-Cz7H2f7S.d.mts → schemas-DChhgfU0.d.mts} +7 -7
  112. package/dist/{schemas-yXs929kr.d.mts → schemas-Dt1YwXLN.d.mts} +7 -7
  113. package/dist/{schemas-BkCqhK3X.d.mts → schemas-FkLOBJgq.d.mts} +4 -4
  114. package/dist/{schemas-GyKYcV-Z2.d.mts → schemas-Fn-eeay32.d.mts} +7 -7
  115. package/dist/{schemas-bcDK-fK3.d.mts → schemas-_NrySTmN.d.mts} +7 -7
  116. package/dist/services/adapter-runtime/index.d.mts +3 -3
  117. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  118. package/dist/services/adapter-runtime/schemas.d.mts +1 -1
  119. package/dist/services/adapter-subsystem/index.d.mts +3 -3
  120. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  121. package/dist/services/agent-runtime/index.d.mts +2 -2
  122. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  123. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  124. package/dist/services/capability/index.d.mts +2 -2
  125. package/dist/services/code-execution/index.d.mts +1 -1
  126. package/dist/services/codebase/index.d.mts +2 -2
  127. package/dist/services/codebase/namespace.d.mts +1 -1
  128. package/dist/services/codebase/schemas.d.mts +1 -1
  129. package/dist/services/compression/index.d.mts +2 -2
  130. package/dist/services/compression/namespace.d.mts +1 -1
  131. package/dist/services/compression/schemas.d.mts +1 -1
  132. package/dist/services/context-rules/index.d.mts +1 -1
  133. package/dist/services/execution-target/index.d.mts +3 -3
  134. package/dist/services/execution-target/namespace.d.mts +1 -1
  135. package/dist/services/execution-target/schemas.d.mts +1 -1
  136. package/dist/services/filesystem/index.d.mts +1 -1
  137. package/dist/services/filesystem/namespace.d.mts +6 -6
  138. package/dist/services/filesystem/schemas.d.mts +3 -3
  139. package/dist/services/git/namespace.d.mts +2 -2
  140. package/dist/services/git/schemas.d.mts +1 -1
  141. package/dist/services/index.d.mts +57 -57
  142. package/dist/services/log-import/browser.d.mts +2 -2
  143. package/dist/services/log-import/index.d.mts +2 -2
  144. package/dist/services/log-import/log-import.d.mts +1 -1
  145. package/dist/services/materialization/index.d.mts +1 -1
  146. package/dist/services/model-registry/index.d.mts +1 -1
  147. package/dist/services/preferences/index.d.mts +2 -2
  148. package/dist/services/preferences/schemas.d.mts +1 -1
  149. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  150. package/dist/services/provider-context/index.d.mts +1 -1
  151. package/dist/services/session/handlers/index.d.mts +1 -1
  152. package/dist/services/session/index.d.mts +9 -9
  153. package/dist/services/session/messages/namespace.d.mts +1 -1
  154. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  155. package/dist/services/session/session-events/namespace.d.mts +1 -1
  156. package/dist/services/session/storage/namespace.d.mts +1 -1
  157. package/dist/services/session/storage/schema.d.mts +1 -1
  158. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  159. package/dist/services/session/turns/namespace.d.mts +1 -1
  160. package/dist/services/session-editor/index.d.mts +1 -1
  161. package/dist/services/settings/index.d.mts +3 -3
  162. package/dist/services/settings/namespace.d.mts +4 -4
  163. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  164. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  165. package/dist/services/settings/storage/index.d.mts +3 -3
  166. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  167. package/dist/services/subagent/index.d.mts +1 -1
  168. package/dist/services/subagent-template/index.d.mts +2 -2
  169. package/dist/services/subagent-template/namespace.d.mts +1 -1
  170. package/dist/services/subagent-template/schemas.d.mts +1 -1
  171. package/dist/services/tool-approval/index.d.mts +1 -1
  172. package/dist/services/tools/index.d.mts +1 -1
  173. package/dist/services/tray-menu/index.d.mts +3 -3
  174. package/dist/services/tray-menu/namespace.d.mts +1 -1
  175. package/dist/services/tray-menu/schemas.d.mts +1 -1
  176. package/dist/services/turn/index.d.mts +1 -1
  177. package/dist/services/turn/namespace.d.mts +1 -1
  178. package/dist/services/workflow-transitions/index.d.mts +1 -1
  179. package/dist/{src-CmLn6zYj.mjs → src-BZdlyUxT.mjs} +1 -1
  180. package/dist/storage/drizzle/client.d.mts +1 -1
  181. package/dist/storage/drizzle/index.d.mts +1 -1
  182. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  183. package/dist/storage/handlers/index.d.mts +1 -1
  184. package/dist/{storage-namespace-zRXWqAfO.d.mts → storage-namespace-BUSNKZLw.d.mts} +10 -10
  185. package/dist/{transition-bYkXnLY2.d.mts → transition-D2VKNtv6.d.mts} +2 -2
  186. package/dist/{types-Bnc-pdB12.d.mts → types-DafDuOcH2.d.mts} +1 -1
  187. package/dist/{types-BNKqcHfP.d.mts → types-DyXXIK4c.d.mts} +3 -3
  188. package/dist/ui-kernel/index.d.mts +4 -4
  189. package/dist/ui-kernel/pages/namespace.d.mts +4 -4
  190. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  191. package/dist/{view-builder-CA5qUx85.d.mts → view-builder-BFEvUe6n.d.mts} +1 -1
  192. package/dist/worker-L8vWpbYa.mjs +1 -0
  193. package/dist/{workflow-5yHn_Knq.mjs → workflow-DNks09Ip.mjs} +1 -1
  194. package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
  195. package/dist/workflow-engine/index.d.mts +98 -60
  196. package/dist/workflow-engine/index.mjs +1 -1
  197. package/dist/workflow-engine/package.d.mts +1 -1
  198. package/dist/workflow-engine/package.mjs +1 -1
  199. package/dist/workflow-engine/provider-operation.d.mts +1 -1
  200. package/dist/workflow-engine/testing/conformance.d.mts +1 -1
  201. package/dist/workflow-engine/testing/conformance.mjs +2 -2
  202. package/dist/workflow-engine/testing/index.d.mts +3 -1
  203. package/dist/workflow-engine/testing/index.mjs +1 -1
  204. package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
  205. package/dist/workflow-engine/testing/sqlite.mjs +50 -33
  206. package/dist/workflow-worker-BDA-E_pm.mjs +2 -0
  207. package/package.json +1 -1
  208. package/dist/artifact-Cxm5ZX7L.mjs +0 -1
  209. package/dist/bootstrap-start-client-rW55mDI-.mjs +0 -1
  210. package/dist/package-BT94BLu4.mjs +0 -7
  211. package/dist/worker-Cx1JDOB9.mjs +0 -1
  212. package/dist/workflow-worker-BAO7pQpx.mjs +0 -2
  213. /package/dist/{adapter-binding-DhANVB-O.d.mts → adapter-binding-CTssGlH_.d.mts} +0 -0
  214. /package/dist/{attempt-fixtures-CMx-2OlG.mjs → attempt-fixtures-B8FSy_vs.mjs} +0 -0
  215. /package/dist/{attempt-record-codec-D2Gb_epJ.mjs → attempt-record-codec-BrungudT.mjs} +0 -0
  216. /package/dist/{base-orchestrator-tAgnJAKu.d.mts → base-orchestrator-C5Z9Aowq.d.mts} +0 -0
  217. /package/dist/{capability-service-Cpkonrc0.d.mts → capability-service-DX3wLjdt.d.mts} +0 -0
  218. /package/dist/{client-At2zn3yg.d.mts → client-BsXMxeCN.d.mts} +0 -0
  219. /package/dist/{client-binary-version-verifier-EOj8xXqm.d.mts → client-binary-version-verifier-uMFQoKZj.d.mts} +0 -0
  220. /package/dist/{clients-namespace-CVRwXq8f.d.mts → clients-namespace-1hXA6qNd.d.mts} +0 -0
  221. /package/dist/{config-namespace-D7GbrasR.d.mts → config-namespace-Bpq9WOY4.d.mts} +0 -0
  222. /package/dist/{create-static-mount-BIH26VH8.mjs → create-static-mount-Cr24q94C.mjs} +0 -0
  223. /package/dist/{definition-VK1rERAp.d.mts → definition-Ckt_WmJw.d.mts} +0 -0
  224. /package/dist/{extension-context-Cpf_n5FH.d.mts → extension-context-BGNUn34r.d.mts} +0 -0
  225. /package/dist/{extension-discovery-B0ZL076T.d.mts → extension-discovery-Dx118u_N.d.mts} +0 -0
  226. /package/dist/{filesystem-service-BWoNtujU.d.mts → filesystem-service-DtApanQk.d.mts} +0 -0
  227. /package/dist/{index-Bk0Xjk-B.d.mts → index-1AKlC3kZ.d.mts} +0 -0
  228. /package/dist/{index-CDA33y5A.d.mts → index-5KVPGsig.d.mts} +0 -0
  229. /package/dist/{index-8a41yDOl.d.mts → index-B4lidHiL.d.mts} +0 -0
  230. /package/dist/{index-Bzxs2nVR.d.mts → index-BLhNHkiK.d.mts} +0 -0
  231. /package/dist/{index-DzHc6hsJ.d.mts → index-Bw7benCh.d.mts} +0 -0
  232. /package/dist/{index-DXSVC0bM.d.mts → index-C0zo4Id_.d.mts} +0 -0
  233. /package/dist/{index-BL1F1xYB.d.mts → index-C3n8beRR.d.mts} +0 -0
  234. /package/dist/{index-C8oBOTl_.d.mts → index-C86rKLPD.d.mts} +0 -0
  235. /package/dist/{index-BIlFSGnW.d.mts → index-CIl66QhT.d.mts} +0 -0
  236. /package/dist/{index-Dckvm0Ml2.d.mts → index-CK5GEXLB2.d.mts} +0 -0
  237. /package/dist/{index-D4XNkbM4.d.mts → index-CUcEfh31.d.mts} +0 -0
  238. /package/dist/{index-DwY1Mt9a.d.mts → index-CrDp6vHG.d.mts} +0 -0
  239. /package/dist/{index-CilWtThn.d.mts → index-CrvTRZqh.d.mts} +0 -0
  240. /package/dist/{index-DCfYa3cF.d.mts → index-CzKJC3Bt.d.mts} +0 -0
  241. /package/dist/{index-BBkJsViX2.d.mts → index-D4FE3jHM2.d.mts} +0 -0
  242. /package/dist/{index-Ccaqmi0J.d.mts → index-DK8lSIvY.d.mts} +0 -0
  243. /package/dist/{index-Du-eXjEN.d.mts → index-DLsopffG.d.mts} +0 -0
  244. /package/dist/{index-BcPO9w0j.d.mts → index-DNN9jOVO.d.mts} +0 -0
  245. /package/dist/{index-C75h1xHF2.d.mts → index-DO0QO0ux2.d.mts} +0 -0
  246. /package/dist/{index-krTCFThl2.d.mts → index-DSRxn5Zr2.d.mts} +0 -0
  247. /package/dist/{index-CSJOBx3H.d.mts → index-Dfv9hyZE.d.mts} +0 -0
  248. /package/dist/{index-BpsurXEW.d.mts → index-DqS8eCAT.d.mts} +0 -0
  249. /package/dist/{index-CjazerMN.d.mts → index-Dv5aNxoa.d.mts} +0 -0
  250. /package/dist/{index-CWeWBh-_.d.mts → index-DxxORQny.d.mts} +0 -0
  251. /package/dist/{index-BTHdi23O.d.mts → index-DyBuGOvY.d.mts} +0 -0
  252. /package/dist/{index-CVh7ZP2I.d.mts → index-fpGFhEmI.d.mts} +0 -0
  253. /package/dist/{index-DwKPj8jD.d.mts → index-lLuIAmRB.d.mts} +0 -0
  254. /package/dist/{index-Bn1JTbn_2.d.mts → index-qLkIGcgv2.d.mts} +0 -0
  255. /package/dist/{index-DCHdW5g-.d.mts → index-tCFckLG6.d.mts} +0 -0
  256. /package/dist/{json-value-BKUDMT7k.d.mts → json-value-Bjl8jzom.d.mts} +0 -0
  257. /package/dist/{jsonl-transport-3yp3clGp.mjs → jsonl-transport-D4ch0vsf.mjs} +0 -0
  258. /package/dist/{lib-DF6sgNx_.mjs → lib-BLdnqIFF.mjs} +0 -0
  259. /package/dist/{namespace-fEBskugJ.d.mts → namespace--mFdPlbu.d.mts} +0 -0
  260. /package/dist/{namespace-KTRWfIPy.d.mts → namespace-Bivbsfms.d.mts} +0 -0
  261. /package/dist/{namespace-BiEV44Mk.d.mts → namespace-C-4xI2rm.d.mts} +0 -0
  262. /package/dist/{namespace-B0_Sg-1m.d.mts → namespace-CQPcYS-Q.d.mts} +0 -0
  263. /package/dist/{namespace-BNNFD-ul.d.mts → namespace-CvCk6Y9i.d.mts} +0 -0
  264. /package/dist/{namespace-BgaVgd00.d.mts → namespace-DXrdGpbs.d.mts} +0 -0
  265. /package/dist/{namespace-B3MnuAqp.d.mts → namespace-Dwf7aOLt.d.mts} +0 -0
  266. /package/dist/{namespace-Czr38fiF.d.mts → namespace-E4ajXk0W.d.mts} +0 -0
  267. /package/dist/{namespace-CY-9Evdf.d.mts → namespace-TX9DlWiQ.d.mts} +0 -0
  268. /package/dist/{namespace-CjmNxtr1.d.mts → namespace-XUB3XnBK.d.mts} +0 -0
  269. /package/dist/{orchestrator-shared-Cwc6JKkV.d.mts → orchestrator-shared-D2I9gyOl.d.mts} +0 -0
  270. /package/dist/{packages-DTz_1dCa.d.mts → packages-Dj9Nul23.d.mts} +0 -0
  271. /package/dist/{providers-namespace-Bming6U8.d.mts → providers-namespace-BA0JT--_.d.mts} +0 -0
  272. /package/dist/{runtime-inputs-DeOea-ab.d.mts → runtime-inputs-CIYLDuBM.d.mts} +0 -0
  273. /package/dist/{schema-DFCBjTB7.d.mts → schema-B098Jz9p.d.mts} +0 -0
  274. /package/dist/{schemas-DqWwz4eR.d.mts → schemas-ADuQFkhH.d.mts} +0 -0
  275. /package/dist/{schemas-BLy33xay.d.mts → schemas-BZyi7v9g.d.mts} +0 -0
  276. /package/dist/{schemas-CSeLgroC.d.mts → schemas-D9WJH6We.d.mts} +0 -0
  277. /package/dist/{schemas-DwqibWUL.d.mts → schemas-DKy_XYjq.d.mts} +0 -0
  278. /package/dist/{schemas-DTBWnWjN.d.mts → schemas-DMxM4U1A.d.mts} +0 -0
  279. /package/dist/{server-lifecycle-_m_x1_TC.d.mts → server-lifecycle-B8UabaW3.d.mts} +0 -0
  280. /package/dist/{session-lineage-CEyJWg_J.d.mts → session-lineage-CoNs4WZy.d.mts} +0 -0
  281. /package/dist/{src-DdaPoQOD.mjs → src-D9PYcdDS.mjs} +0 -0
  282. /package/dist/{storage-namespace-definition-CsaZPU3n.d.mts → storage-namespace-definition-1uCuoHvM.d.mts} +0 -0
  283. /package/dist/{types-CccTiXH2.d.mts → types-BlaguWul.d.mts} +0 -0
  284. /package/dist/{types-nor1SQLZ.d.mts → types-CbXf822E.d.mts} +0 -0
  285. /package/dist/{types-DjxvRcX6.d.mts → types-KF8zuMhi.d.mts} +0 -0
  286. /package/dist/{types-Dswhi1L9.d.mts → types-RWRXplnM.d.mts} +0 -0
  287. /package/dist/{types-DXGVwrQn.d.mts → types-nY8yr3th.d.mts} +0 -0
  288. /package/dist/{window-registry-DQ7udUzI.d.mts → window-registry-Dq5uOWpH.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{C as t,S as n,a as r,b as i,c as a,d as o,i as s,l as c,n as l,r as ee,t as u,y as d}from"./schemas-NKlV5jqJ.mjs";import{a as f,f as te,l as ne,m as re,s as p,t as m}from"./kind-registration-BanX_UAF.mjs";import{t as ie}from"./zod-json-schema-DGWHUOK0.mjs";import{t as ae}from"./ajv-Dz-0DD7m.mjs";import{t as oe}from"./2020-DvDj4r_K.mjs";import{t as se}from"./dist-DMIaE8sg.mjs";import{z as h}from"zod";import{createBusNamespace as ce}from"@makaio/framework/core";const g=h.strictObject({evidence:n}),_=h.strictObject({kind:h.literal(`text`),text:h.string()}),[le,ue,de]=n.options,v=h.union([le.pick({source:!0,location:!0}).extend({content:_}),ue.pick({source:!0,location:!0}).extend({content:_}),de.pick({source:!0,location:!0}).extend({content:_})]);function y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function b(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function x(e,t){if(t===`#`)return{node:e,pointer:``};if(!t.startsWith(`#/`))return;let n;try{n=decodeURIComponent(t.slice(1))}catch{return}let r=e;for(let e of n.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r)){if(!/^(0|[1-9]\d*)$/.test(t)||Number(t)>=r.length)return;r=r[Number(t)]}else{let e=y(r);if(!e||!Object.hasOwn(e,t))return;r=e[t]}}let i=typeof r==`boolean`?r:y(r);return i===void 0?void 0:{node:i,pointer:n}}function S(e,t){if(t===``)return!1;let n=e;for(let e of t.slice(1).split(`/`)){let t=e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(n=Array.isArray(n)?n[Number(t)]:y(n)?.[t],typeof y(n)?.$id==`string`)return!0}return!1}function fe(e,t,r){if(e[`x-makaio-value-type`]!==`evidence/v1`)return;let i=n.safeParse(t);if(!i.success)throw Error(`Invalid schema-declared evidence at ${r}`);return{evidence:i.data,dataPath:r}}function pe(e,t,n,r){if(typeof t.$ref!=`string`)return!1;if(r)return!0;let i=x(e,t.$ref);return i===void 0?!0:typeof i.node!=`boolean`&&C(e,i.node,n,S(e,i.pointer))}function C(e,t,n=new WeakSet,r=!1){let i=y(t);if(!i||n.has(i))return!1;n.add(i);let a=r||i!==e&&typeof i.$id==`string`;if(i[`x-makaio-value-type`]===`evidence/v1`||typeof i.$dynamicRef==`string`||pe(e,i,n,a)||[`additionalItems`,`additionalProperties`,`contains`,`else`,`if`,`items`,`then`,`unevaluatedItems`,`unevaluatedProperties`].some(t=>C(e,i[t],n,a))||[`allOf`,`anyOf`,`oneOf`,`prefixItems`].some(t=>Array.isArray(i[t])&&i[t].some(t=>C(e,t,n,a)))||Array.isArray(i.items)&&i.items.some(t=>C(e,t,n,a)))return!0;for(let t of[`dependentSchemas`,`dependencies`,`patternProperties`,`properties`]){let r=y(i[t]);if(r&&Object.values(r).some(t=>C(e,t,n,a)))return!0}return!1}var me=class{dataSchema;matchesSchema;occurrences=new Map;visited=new WeakMap;constructor(e,t){this.dataSchema=e,this.matchesSchema=t}extract(e){return this.visit(this.dataSchema,e,`/data`),[...this.occurrences.values()]}visit(e,t,n,r=``){let i=this.visited.get(e)??new Set;if(i.has(n))return;if(i.add(n),this.visited.set(e,i),typeof e.$dynamicRef==`string`)throw Error(`Evidence discovery does not support active $dynamicRef at ${n}`);if(typeof e.$ref==`string`){if(S(this.dataSchema,r))throw Error(`Evidence discovery does not support local $ref inside nested $id resource at ${n}`);let i=x(this.dataSchema,e.$ref);if(i===void 0)throw Error(`Cannot resolve local schema reference ${e.$ref} at ${n}`);if(typeof i.node!=`boolean`&&this.visit(i.node,t,n,i.pointer),this.dataSchema.$schema!==`https://json-schema.org/draft/2020-12/schema`)return}let a=fe(e,t,n);if(a){this.occurrences.set(n,a);return}this.visitCombiners(e,t,n,r),this.visitConditional(e,t,n,r),this.visitDependencies(e,t,n,r),this.assertSupportedApplicators(e,n,r),Array.isArray(t)?this.visitArray(e,t,n,r):typeof t==`object`&&t&&this.visitObject(e,t,n,r)}visitCombiners(e,t,n,r){for(let i of[`allOf`,`anyOf`,`oneOf`]){let a=e[i];if(Array.isArray(a))for(let[e,o]of a.entries()){let a=y(o),s=`${r}/${i}/${e}`;a&&(i===`allOf`||this.matchesSchema(this.dataSchema,s,t))&&this.visit(a,t,n,s)}}}visitConditional(e,t,n,r){let i=typeof e.if==`boolean`?e.if:y(e.if);if(i===void 0)return;let a=`${r}/if`,o=this.matchesSchema(this.dataSchema,a,t);o&&typeof i!=`boolean`&&this.visit(i,t,n,a);let s=o?`then`:`else`,c=y(e[s]);c&&this.visit(c,t,n,`${r}/${s}`)}visitDependencies(e,t,n,r){if(!(typeof t!=`object`||!t||Array.isArray(t)))for(let i of[`dependentSchemas`,`dependencies`]){let a=y(e[i]);if(a)for(let[e,o]of Object.entries(a)){let a=y(o);Object.hasOwn(t,e)&&a&&this.visit(a,t,n,`${r}/${i}/${b(e)}`)}}}assertSupportedApplicators(e,t,n){for(let r of[`unevaluatedProperties`,`unevaluatedItems`])if(C(this.dataSchema,e[r],void 0,S(this.dataSchema,n)))throw Error(`Evidence under unsupported ${r} applicator at ${t}`)}visitArray(e,t,n,r){let i=Array.isArray(e.prefixItems),a=i?e.prefixItems:Array.isArray(e.items)?e.items:[];a.forEach((e,a)=>{let o=y(e),s=i?`prefixItems`:`items`;o&&a<t.length&&this.visit(o,t[a],`${n}/${a}`,`${r}/${s}/${a}`)});let o=Array.isArray(e.items)?y(e.additionalItems):y(e.items);if(o){let i=Array.isArray(e.items)?`additionalItems`:`items`;t.slice(a.length).forEach((e,t)=>this.visit(o,e,`${n}/${a.length+t}`,`${r}/${i}`))}this.visitContains(e,t,n,r)}visitContains(e,t,n,r){let i=y(e.contains);if(!i)return;let a=`${r}/contains`;t.forEach((e,t)=>{this.matchesSchema(this.dataSchema,a,e)&&this.visit(i,e,`${n}/${t}`,a)})}visitObject(e,t,n,r){let i=y(e.properties),a=y(e.patternProperties);for(let[o,s]of Object.entries(t)){let t=b(o),c=i!==void 0&&Object.hasOwn(i,o),l=y(i?.[o]);l&&this.visit(l,s,`${n}/${t}`,`${r}/properties/${t}`);let ee=this.visitPatterns(a,o,s,`${n}/${t}`,r),u=y(e.additionalProperties);!c&&!ee&&u&&this.visit(u,s,`${n}/${t}`,`${r}/additionalProperties`)}}visitPatterns(e,t,n,r,i){let a=!1;for(let[o,s]of Object.entries(e??{})){if(!new RegExp(o,`u`).test(t))continue;a=!0;let e=y(s);e&&this.visit(e,n,r,`${i}/patternProperties/${b(o)}`)}return a}};function he(e,t,n){return new me(e,n.matchesSchema).extract(t)}function ge(e){let{dataSchema:t,hooks:n,...r}=e,i={$schema:`https://json-schema.org/draft/2020-12/schema`,...ie(t)};te(i);let a=f.parse({...r,dataSchema:i});if(a.kind!==e.kind)throw Error(`Artifact kind identifiers must not contain surrounding whitespace`);let o=h.fromJSONSchema(a.dataSchema),s=h.unknown().superRefine((e,t)=>{let n=o.safeParse(e);if(!n.success)for(let e of n.error.issues)t.addIssue({code:`custom`,path:e.path,message:e.message})}).pipe(t).superRefine((e,t)=>{try{re(e,a.titlePath)}catch(e){t.addIssue({code:`custom`,path:a.titlePath.split(`.`),message:e instanceof Error?e.message:`Artifact title must be a nonblank string`})}});return{...structuredClone(a),kind:e.kind,schemaVersion:e.schemaVersion,dataSchema:s,...n?{hooks:n}:{},toRegistration:()=>structuredClone(a)}}var _e=e(ae(),1),ve=e(oe(),1),ye=e(se(),1);function be(e){let t={allErrors:!0,strict:!1,strictSchema:!0},n=e.dataSchema.$schema===`https://json-schema.org/draft/2020-12/schema`?new ve.default(t):new _e.default(t);return(0,ye.default)(n),n.addKeyword({keyword:i,schemaType:`string`,valid:!0}),n.compile(e.dataSchema)}function xe(e){return{hooks:[...e.hooks]}}const Se=[`inline`,`summary`,`link`,`omit`],w=h.string().min(1),T=h.object({kinds:h.array(h.string().min(1)).optional(),hint:w.optional(),depth:h.number().int().min(1).max(20).optional(),nested:h.lazy(()=>E).optional()}),E=h.record(h.string().min(1),T);function D(e){return JSON.stringify([e.kind,e.id,e.revision])}const O=h.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),k=h.object({target:c,sourceRef:t,relationType:h.string().min(1),hint:w,status:h.enum([`resolved`,`unresolved`]),reason:O.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:h.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:h.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:h.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),A=h.object({rootRef:t,refs:h.array(k),resolved:h.array(o)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(D));n.has(D(e.rootRef))||t.addIssue({code:h.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(D(e.sourceRef))||t.addIssue({code:h.ZodIssueCode.custom,path:[`refs`,r,`sourceRef`],message:`artifact context ref sources must have a matching revision in resolved`}),!(e.status!==`resolved`||e.target.refClass!==`artifact`)&&(n.has(D(e.target))||t.addIssue({code:h.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function Ce(e){let t=A.parse(e),n=new Map(t.resolved.map(e=>[N(e),e])),r=new Map;for(let e of t.refs){let t=N(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(N(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${N(t.rootRef)}'`);let a=we(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return M(a,e),e}}}function we(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:j(e,r,i,new Set([N(e)]))}}function Te(e,t,n,r,i,a,o){let s=N(e),c=new Set(o);return c.add(s),{status:`resolved`,ref:e,artifact:t,relation:n,hint:r,children:j(e,i,a,c)}}function j(e,t,n,r){return(t.get(N(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=N(e.target),a=n.get(i);if(!a)throw Error(`Resolved artifact context is missing target artifact '${i}'`);return r.has(i)?{status:`unresolved`,target:e.target,relation:e.relationType,hint:e.hint,reason:`cycle-detected`}:Te(e.target,a,e.relationType,e.hint,t,n,r)})}function M(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)M(n,t)}}function N(e){return JSON.stringify([e.kind,e.id,e.revision])}const P=t.pick({kind:!0,id:!0}),F=h.number().int().positive(),I=F,L={knowledge:`valid`,commitment:`proposed`,interaction:`open`},R=h.discriminatedUnion(`category`,[h.strictObject({category:h.literal(`knowledge`),state:h.enum(m.knowledge),version:I}),h.strictObject({category:h.literal(`commitment`),state:h.enum(m.commitment),version:I}),h.strictObject({category:h.literal(`interaction`),state:h.enum(m.interaction),version:I})]).superRefine((e,t)=>{e.version===1&&e.state!==L[e.category]&&t.addIssue({code:`custom`,path:[`state`],message:`Lifecycle version 1 is reserved for the category initial state`})}),z=h.union([R,h.strictObject({category:h.literal(`record`)})]),B=h.string().trim().min(1),V=h.strictObject({kind:B,ref:B}),H=h.discriminatedUnion(`kind`,[h.strictObject({kind:h.literal(`revision-assessment`),assessedRevision:t.shape.revision,source:V.optional()}),h.strictObject({kind:h.literal(`handover`),source:V})]),U={artifact:P,expectedVersion:I,state:p,situation:H,reason:B.optional()},W=h.strictObject(U),G=h.strictObject({...U,actor:u}),Ee={valid:[`retired`],retired:[],proposed:[`decided`],decided:[`fulfilled`,`revoked`],fulfilled:[],revoked:[],open:[`resolved`,`closed-without-resolution`],resolved:[],"closed-without-resolution":[]};function K(e,t){return Ee[e].includes(t)}const De={artifact:P,lifecycle:R,actor:u,timestamp:h.number().int().nonnegative(),observedRevision:t.shape.revision},Oe=h.strictObject({...De,operation:h.literal(`initialized`)}).superRefine((e,t)=>{(e.lifecycle.version!==1||e.lifecycle.state!==L[e.lifecycle.category])&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`Initialization requires the category initial state and version 1`})}),q=h.strictObject({...De,operation:h.literal(`transitioned`),previousState:p,situation:H,reason:W.shape.reason}).superRefine((e,t)=>{(!K(e.previousState,e.lifecycle.state)||e.lifecycle.version<=1)&&t.addIssue({code:`custom`,path:[`lifecycle`],message:`History requires a category-compatible transition after initialization`}),e.lifecycle.state===`retired`&&!e.reason&&t.addIssue({code:`custom`,path:[`reason`],message:`Retiring knowledge requires a reason`}),e.situation.kind===`revision-assessment`&&e.situation.assessedRevision!==e.observedRevision&&t.addIssue({code:`custom`,path:[`situation`],message:`An assessment cannot authorize a different observed content revision`})}),ke=h.discriminatedUnion(`operation`,[Oe,q]),J=h.discriminatedUnion(`reason`,[h.strictObject({reason:h.literal(`lifecycle-version-conflict`),expectedVersion:I,current:R,requestedState:p}),h.strictObject({reason:h.literal(`content-basis-conflict`),assessedRevision:t.shape.revision,currentRevision:t.shape.revision}),h.strictObject({reason:h.literal(`invalid-transition`),current:z,requestedState:p}),h.strictObject({reason:h.literal(`precondition-failed`),current:R,requestedState:p})]),Y=`artifact-lifecycle-rejected`;var X=class extends Error{code=Y;data;constructor(e,t){super(e),this.name=`ArtifactLifecycleError`,this.data=J.parse(t)}};function Ae(e){return e===`record`?{category:`record`}:R.parse({category:e,state:L[e],version:1})}function je(e){let n=z.parse(e.current),r=t.shape.revision.parse(e.currentRevision),i=G.parse(e.command);if(n.category===`record`)throw new X(`Record artifacts do not have a lifecycle`,{reason:`invalid-transition`,current:n,requestedState:i.state});if(i.expectedVersion!==n.version)throw new X(`Artifact lifecycle changed since the supplied baseline`,{reason:`lifecycle-version-conflict`,expectedVersion:i.expectedVersion,current:n,requestedState:i.state});if(i.situation.kind===`revision-assessment`&&i.situation.assessedRevision!==r)throw new X(`Assessed content revision is no longer current`,{reason:`content-basis-conflict`,assessedRevision:i.situation.assessedRevision,currentRevision:r});if(!K(n.state,i.state))throw new X(`Artifact lifecycle transition is not allowed`,{reason:`invalid-transition`,current:n,requestedState:i.state});if(i.state===`retired`&&!i.reason)throw new X(`Retiring knowledge requires a reason`,{reason:`precondition-failed`,current:n,requestedState:i.state});return R.parse({...n,state:i.state,version:n.version+1})}const Me=h.strictObject({artifact:P}),Z=h.strictObject({lifecycle:z}),Ne=h.strictObject({artifact:P,afterVersion:F.optional(),limit:h.number().int().min(1).max(100).default(50)}),Pe=h.strictObject({entries:h.array(ke).max(100),nextCursor:F.optional()}).superRefine(({entries:e,nextCursor:t},n)=>{let r=e[0],i;for(let[t,a]of e.entries()){let e=a.artifact.kind===r?.artifact.kind&&a.artifact.id===r?.artifact.id,o=i===void 0||a.lifecycle.version===i.lifecycle.version+1,s=i===void 0||a.operation===`transitioned`&&a.lifecycle.category===i.lifecycle.category&&a.previousState===i.lifecycle.state;if(!e||!o||!s){n.addIssue({code:`custom`,path:[`entries`,t],message:`History pages contain one artifact in contiguous ascending, state-linked order`});break}i=a}t!==void 0&&t!==i?.lifecycle.version&&n.addIssue({code:`custom`,path:[`nextCursor`],message:`nextCursor must equal the last returned lifecycle version`})}),Q=h.strictObject({entry:q}),Fe=Q,Ie=h.strictObject({code:h.literal(Y),message:h.string().min(1),data:J});function Le(e){return{code:e.code,message:e.message,data:e.data}}function Re(e,t){switch(t.reason){case`content-basis-conflict`:return Ve(e,t);case`lifecycle-version-conflict`:return[...ze(e,t),...Be(e,t)];case`invalid-transition`:case`precondition-failed`:return[...ze(e,t),...He(e,t)]}}function ze(e,t){return t.requestedState===e.state?[]:[{path:[`requestedState`],message:`Rejection requestedState must match the rejected transition`}]}function Be(e,t){let n=[];return t.expectedVersion!==e.expectedVersion&&n.push({path:[`expectedVersion`],message:`Version conflict baseline must match the rejected transition`}),t.current.version===e.expectedVersion&&n.push({path:[`current`,`version`],message:`Version conflict requires a current version different from the supplied baseline`}),n}function Ve(e,t){let n=[];return(e.situation.kind!==`revision-assessment`||t.assessedRevision!==e.situation.assessedRevision)&&n.push({path:[`assessedRevision`],message:`Content conflict must identify the rejected revision assessment`}),t.currentRevision===t.assessedRevision&&n.push({path:[`currentRevision`],message:`Content conflict requires a current revision different from the assessed revision`}),n}function He(e,t){if(t.current.category===`record`)return[];let n=[];t.current.version!==e.expectedVersion&&n.push({path:[`current`,`version`],message:`A rejection after the version check must report the supplied baseline version`});let r=K(t.current.state,t.requestedState);return t.reason===`invalid-transition`&&r&&n.push({path:[`reason`],message:`invalid-transition requires a transition the lifecycle matrix disallows`}),t.reason===`precondition-failed`&&!r&&n.push({path:[`reason`],message:`precondition-failed requires a transition the lifecycle matrix allows`}),n}const Ue=h.strictObject({transition:W,error:Ie}).superRefine(({transition:e,error:t},n)=>{for(let r of Re(e,t.data))n.addIssue({code:`custom`,path:[`error`,`data`,...r.path],message:r.message})}),We={"lifecycle.get":{request:Me,response:Z},"lifecycle.history":{request:Ne,response:Pe},"lifecycle.transition":{request:W,response:Q},"lifecycle.committed":Fe,"lifecycle.rejected":Ue},Ge={...We,"kind.register":{request:f,response:h.object({registered:h.boolean()})},"kind.list":{request:h.object({kind:h.string().min(1).optional()}),response:h.object({kinds:h.array(f)})},"relation-type.register":{request:d,response:h.object({registered:h.boolean()})},"relation-type.list":{request:h.object({type:h.string().min(1).optional()}),response:h.object({relationTypes:h.array(d)})},create:{request:o.omit({id:!0,revision:!0,timestamp:!0}).extend({id:t.shape.id.optional()}),response:h.object({artifact:o})},revise:{request:h.object({previous:t,statusPath:h.string().regex(/^(?:\/(?:[^~/]|~[01])*)+$/,`Expected a data-relative JSON Pointer`).optional(),revision:o.omit({id:!0,revision:!0,timestamp:!0})}),response:h.object({artifact:o})},resolve:{request:h.object({ref:t}),response:h.object({artifact:o.nullable()})},query:{request:r,response:h.object({artifacts:h.array(o)})},compare:{request:l,response:ee},"evidence.resolve":{request:g,response:v},resolveContext:{request:h.object({ref:t,selectors:E.optional(),maxDepth:h.number().int().min(1).max(20).default(5)}),response:h.object({context:A})},created:h.object({artifact:o}),revised:h.object({previous:t,artifact:o}),"relation.added":h.object({artifact:t,relation:a}),"observation.added":h.object({artifact:t,observation:s}),"status.changed":h.object({artifact:t,path:h.string().min(1),previous:h.unknown().optional(),current:h.unknown().optional()}),"kind.changed":h.object({kind:h.string().min(1),schemaVersion:ne})},$=ce(`artifact`,Ge),Ke=$.subjects;export{Ce as A,ge as B,G as C,je as D,F as E,T as F,g as H,w as I,E as L,O as M,A as N,Ae as O,Se as P,xe as R,R as S,q as T,v as U,he as V,ke as _,Ie as a,J as b,Ne as c,We as d,Q as f,X as g,z as h,Fe as i,k as j,K as k,Pe as l,Y as m,Ge as n,Me as o,Le as p,Ke as r,Z as s,$ as t,Ue as u,P as v,W as w,H as x,Oe as y,be as z};
@@ -0,0 +1 @@
1
+ import{canonicalStringify as e}from"@makaio/framework/utils";import{ExecutionAttemptControlReceiptSchema as t,ExecutionAttemptControlReportSchema as n}from"@makaio/framework/contracts";function r(e){if(typeof e!=`string`||e.length===0)throw TypeError(`executionId must be a non-empty string`);return e}function i(e){let{executionId:n,...i}=e;return{executionId:r(n),...t.parse(i)}}function a(e){let{executionId:t,...i}=e;return{executionId:r(t),...n.parse(i)}}function o(e,t,n){return e===null||e.executionId!==n.executionId?{kind:`not-found`}:t?.controlRevision!==n.controlRevision||t.requestKey!==n.requestKey?{kind:`cancel-mismatch`}:e.runtimeGeneration!==n.runtimeGeneration||e.runtimeIncarnationId!==n.runtimeIncarnationId?{kind:`stale-generation`}:null}function s(t,n){let{executionId:r,...i}=n;return{kind:e(t)===e(i)?`duplicate`:`conflict`}}function c(e,t,n,r){return e===null||e.executionId!==r.executionId?{kind:`not-found`}:n===null?o(e,t,r)??{kind:`accepted`}:s(n,r)}function l(e,t){if(t.conclusion.boundary===`admission-closed`)return t.operationId===void 0&&e.operationStartGate===`closed`&&(e.activeOperationId===null||e.activeOperationKind===`runtime-probe`);if(t.operationId===void 0)return!1;let n=e.activeOperationId===t.operationId&&e.activeOperationGeneration===t.runtimeGeneration;return t.conclusion.boundary===`setup-process-group`?n&&e.activeOperationKind===`workspace-preparation`||e.preparationReceipts.some(e=>e.operationId===t.operationId&&e.runtimeGeneration===t.runtimeGeneration):n&&(e.activeOperationKind===`workload-invocation`||e.activeOperationKind===`workflow-run`)}function u(e,t,n,r){if(e===null||e.executionId!==r.executionId)return{kind:`not-found`};if(n!==null)return s(n,r);let i=o(e,t,r);return i===null?l(e,r)?{kind:`accepted`}:{kind:`operation-mismatch`}:i}export{a as i,u as n,i as r,c as t};
@@ -0,0 +1 @@
1
+ import{pathToFileURL as e}from"node:url";import{mkdir as t,rm as n,writeFile as r}from"node:fs/promises";import{basename as i,join as a}from"node:path";import{randomBytes as o}from"node:crypto";import{ExecutionAttemptBootstrapAwaitStartResponseSchema as s,ExecutionAttemptSchemas as c,ExecutionAttemptSubjects as l,WorkflowDefinitionSchema as u,WorkflowError as d,WorkflowErrorCode as f}from"@makaio/framework/contracts";import{ConnectionLostError as ee,TimeoutError as p,waitForSubscriptionPropagation as te}from"@makaio/framework/bus";import{HmacAuth as ne,WebSocketConnectionError as m}from"@makaio/framework/node/transports";import{tmpdir as re}from"node:os";import{AUTOMATION_TRIGGER_BUILTINS_OWNER as ie,AutomationTriggerBindingRuntime as ae,busBackedAutomationTriggers as h}from"@makaio/framework/services/automation-trigger";import{MessageChannel as g}from"node:worker_threads";import{WorkerBootstrapDeadlineAtSchema as _}from"@makaio/framework/contracts/worker";import{assertWorkflowTriggerPayload as v,compileWorkflowTriggerBindingFilter as y}from"@makaio/framework/workflow-engine/workflow-trigger-binding-consumer";function b(e,t,n){return{type:`makaio.workflow-worker.ready`,executionId:e,cancelSubject:t,executionAttemptId:n}}function x(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`makaio.workflow-worker.ready`&&typeof t.executionId==`string`&&typeof t.cancelSubject==`string`&&typeof t.executionAttemptId==`string`}var S=class extends Error{code=`WORKER_BOOTSTRAP_DEADLINE_EXCEEDED`;constructor(){super(`Worker bootstrap deadline exceeded`),this.name=`BootstrapDeadlineExceededError`}};function C(e,t){if(!_.safeParse(e).success)throw TypeError(`bootstrapDeadlineAt must be a valid absolute ISO timestamp`);let n={deadline:Date.parse(e),signal:t};return T(n),n}function w(e,t,n){let r=C(e,t);return E(r,r.deadline-Date.now(),n)}function T(e){if(e.signal.throwIfAborted(),Date.now()>=e.deadline)throw new S}async function E(e,t,n){T(e);let r=Math.min(t,e.deadline-Date.now()),i=Date.now()+r,a=new AbortController,o,s=()=>{},c=new Promise((t,n)=>{s=()=>{a.abort(e.signal.reason),n(e.signal.reason)},e.signal.addEventListener(`abort`,s,{once:!0});let c=()=>{let t=i-Date.now();if(t>0){o=setTimeout(c,Math.min(t,2147483647));return}let s=Date.now()>=e.deadline?new S:new p(`worker bootstrap`,r);a.abort(s),n(s)};o=setTimeout(c,Math.min(r,2147483647))});try{let t=Promise.resolve().then(()=>(T(e),n(a.signal,r))),o=await Promise.race([c,t]);if(T(e),Date.now()>=i)throw new p(`worker bootstrap`,r);return o}catch(t){throw a.abort(t),T(e),t}finally{clearTimeout(o),e.signal.removeEventListener(`abort`,s)}}async function oe(e,t,n){let r=new g,i=new AbortController,a=()=>i.abort(t.reason);t.addEventListener(`abort`,a,{once:!0});try{let a=await w(e,t,async e=>{let t=D(r.port1,`takeover`,e),a=Promise.resolve().then(()=>n(r.port2,i.signal));return await Promise.race([t,a.then(()=>{throw Error(`Piscina task completed before bootstrap handoff`)})]),{result:a}});return C(e,t),r.port1.postMessage(`acknowledged`),r.port1.close(),await a.result}catch(e){throw i.abort(e),e}finally{t.removeEventListener(`abort`,a),r.port1.close(),r.port2.close()}}async function se(e,t=new AbortController().signal){try{await w(e.bootstrapDeadlineAt,t,t=>D(e.bootstrapPort,`acknowledged`,t,`takeover`))}finally{e.bootstrapPort.close()}}async function D(e,t,n,r){n.throwIfAborted();let i=Promise.withResolvers(),a=e=>{e===t?i.resolve():i.reject(Error(`Invalid Piscina bootstrap handoff message`))},o=()=>i.reject(Error(`Piscina bootstrap handoff port closed`)),s=e=>i.reject(e),c=()=>i.reject(n.reason);e.on(`message`,a),e.on(`messageerror`,s),e.on(`close`,o),n.addEventListener(`abort`,c,{once:!0});try{r!==void 0&&e.postMessage(r),await i.promise}finally{e.off(`message`,a),e.off(`messageerror`,s),e.off(`close`,o),n.removeEventListener(`abort`,c)}}function ce(e,t){return e===void 0?void 0:new ne({secret:e,...t!==void 0&&{identityId:t}})}async function O(e){let t=C(e.bootstrapDeadlineAt,e.signal),n=1e3;for(;;){T(t);let r=e.createSession();try{await E(t,1e4,t=>e.connect(r,t));let i=await k(e,r,t,()=>{n=1e3});return T(t),{session:r,value:i}}catch(i){try{await A(e,r,t)}finally{T(t)}if(!j(i))throw i;await E(t,t.deadline-Date.now(),e=>M(Math.min(n,t.deadline-Date.now()),e)),n=Math.min(n*2,1e4)}}}async function k(e,t,n,r){for(;;){let i=await E(n,35e3,(n,r)=>e.exchange(t,{signal:n,timeoutMs:r}));if(r(),i.status===`complete`)return i.value;await E(n,35e3,e=>M(0,e))}}async function A(e,t,n){let r=Promise.resolve(e.dispose(t));r.catch(()=>{}),await E(n,n.deadline-Date.now(),()=>r)}function j(e){if(e instanceof ee||e instanceof p)return!0;let t=e instanceof Error&&e.cause instanceof m&&`code`in e&&e.code===e.cause.code?e.cause:e;return t instanceof m&&(t.code===`WS_CONNECTION_UNAVAILABLE`||t.code===`WS_HANDSHAKE_TIMEOUT`||t.code===`WS_CONNECTION_TIMEOUT`)}function M(e,t){return t.throwIfAborted(),new Promise((n,r)=>{let i=()=>{clearTimeout(a),r(t.reason)},a=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);t.addEventListener(`abort`,i,{once:!0})})}function N(e){if(typeof e!=`object`||!e)throw new d(f.NOT_EXECUTABLE,`Invalid workflow module default export: expected an object with 'definition' and 'runtimeHandlers', got ${typeof e}.`);let t=e;if(!(t.runtimeHandlers instanceof Map))throw new d(f.NOT_EXECUTABLE,`Invalid workflow module default export: 'runtimeHandlers' must be a Map instance.`);let n=u.safeParse(t.definition);if(!n.success)throw new d(f.NOT_EXECUTABLE,`Invalid workflow module default export: 'definition' must satisfy WorkflowDefinitionSchema. `+n.error.message);let r=P(t.zodSchemas)?t.zodSchemas:void 0,i=t.runtimeLoopGates;if(i!==void 0&&!(i instanceof Map))throw new d(f.NOT_EXECUTABLE,`Invalid workflow module default export: 'runtimeLoopGates' must be a Map instance when provided.`);return{definition:n.data,runtimeHandlers:t.runtimeHandlers,...r===void 0?{}:{zodSchemas:r},...i===void 0?{}:{runtimeLoopGates:i}}}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`gates`in e}async function F(e,s){let c=i(e);if(!c||c===`.`||c===`..`)throw Error(`Invalid workflow source filename: ${e}`);let l=a(re(),`makaio-wf-${o(6).toString(`hex`)}`);await t(l,{recursive:!0});let u=a(l,c.endsWith(`.mjs`)?c:`${c}.mjs`);try{await r(u,s,`utf8`)}catch(e){throw await n(l,{recursive:!0,force:!0}).catch(()=>{}),e}return{tempDir:l,tempPath:u}}function I(e){return typeof e==`object`&&e&&Array.isArray(e.workflows)?e.workflows.map(N):[N(e)]}async function L(t){if(t.kind===`path`)return I((await import(e(t.path).href)).default);let{tempDir:r,tempPath:i}=await F(t.filename,t.source);try{return I((await import(e(i).href)).default)}finally{await n(r,{recursive:!0,force:!0})}}async function R(e){if(e.kind===`definition`)throw new d(f.NOT_EXECUTABLE,`Definition-sourced workers are handled by the workflow executor, not the file loader. Received source: ${JSON.stringify(e)}`);let t=await L(e);if(t.length!==1)throw new d(f.NOT_EXECUTABLE,`loadWorkflowModule expects a single workflow export, but the module exported ${String(t.length)} workflows. Use loadWorkflowModules for bundle exports.`);return t[0]}async function z(e){if(e.source.kind===`definition`){if(e.definition===void 0)throw Error(`Definition-sourced worker config for workflowId "${e.source.workflowId}" is missing the required 'definition' field. Ensure the executor populates WorkflowWorkerConfig.definition before dispatching.`);return{definition:e.definition,runtimeHandlers:new Map}}let t=await R(e.source);return B(e,t),e.definition===void 0?t:{...t,definition:e.definition}}function B(e,t){if(e.workflowId!==e.executionId&&t.definition.id!==e.workflowId)throw new d(f.SOURCE_MISMATCH,`Source-backed workflow for logical workflow '${e.workflowId}' loaded definition '${t.definition.id}'.`)}const V=`[WorkflowWorkerAwaitTrigger]`;function H(e){let t=h(e);return{resolveRegistration:e=>{let n=t.find(t=>t.kind===e);return n===void 0?void 0:{owner:ie,type:n}}}}async function U(e,t,n){let r=new ae(H(e)),i=t.flatMap(e=>{let t=r.prepareBinding(e);return t===void 0?(console.warn(`${V} skipping binding '${e.kind}': awaiting it inside a worker is unsupported. A worker carries only bus-backed trigger types; schedules and extension-contributed sources are activated by the host that owns their placement.`),[]):t.workflowCompatible?[{binding:e,prepared:t}]:(console.warn(`${V} skipping binding '${e.kind}': its event payload does not have an object root.`),[])});if(i.length===0){await r.close();return}try{if(n.aborted)throw n.reason??Error(`Await-trigger aborted`);let e=Promise.withResolvers();e.promise.catch(()=>void 0);let t=()=>{e.reject(n.reason??Error(`Await-trigger aborted`))};n.addEventListener(`abort`,t,{once:!0});try{return await Promise.all(i.map(async({binding:t,prepared:n})=>{let r=y(t);await n.subscribe(t=>{r(t.payload)&&e.resolve(v(t.payload))})})),await e.promise}finally{n.removeEventListener(`abort`,t)}}finally{await r.close()}}async function W(e,t,n,r){let i=t.definition.triggers??[];if(e.triggerMode!==`await-trigger`||i.length===0)return e;let a=await U(n,i,r);return a===void 0?e:{...e,triggerPayload:a}}function le(e){let t=e,n=!1,r=new Set,i=()=>{let e=[...r];r.clear();for(let n of e)n(t)};return{accepted:()=>t,isStale:e=>t===void 0||e!==t,wait:async()=>t!==void 0||n?t:await new Promise(e=>r.add(e)),bind:e=>{t=e,i()},release:()=>{n=!0,i()}}}async function G(e,t,n,r){r?.throwIfAborted();let{executionAttemptId:i,runtimeIncarnationId:a}=t,o=le(t.runtimeGeneration),s=n({bus:e.withFilter({executionAttemptId:i,runtimeIncarnationId:a}),get acceptedGeneration(){return o.accepted()},isStaleGeneration:o.isStale,awaitGeneration:o.wait}),c={bindGeneration(e){o.bind(e)},cleanup(){let e=s;s=void 0,e?.(),o.release()}},l=()=>c.cleanup();r?.addEventListener(`abort`,l,{once:!0});try{return await te(s),r?.throwIfAborted(),c}catch(e){throw c.cleanup(),e}finally{r?.removeEventListener(`abort`,l)}}async function ue(e,t,n){if(e.operationKind===`runtime-probe`)return{receipt:`completed`};if(n(e.runtimeGeneration))return{receipt:`refused`,refusalReason:`stale-generation`};let r=t[e.operationKind];return r===void 0?{receipt:`refused`,refusalReason:`unknown-kind`}:await r(e)}async function K(e,t,n,r){return await G(e,t,e=>e.bus.on(l.operation.deliver,async t=>{t.setResult(await ue(t.payload,n,e.isStaleGeneration))}),r)}var q=class extends Error{executionAttemptId;refusalReason;constructor(e,t){super(`Runtime registration refused by the Authority (executionAttemptId=${e}, refusalReason=${t??`unreported`})`),this.executionAttemptId=e,this.refusalReason=t,this.name=`RuntimeRegistrationRefusedError`}},J=class extends Error{executionAttemptId;admissionKey;refusalReason;constructor(e,t,n){super(`Operation admission refused by the Authority (executionAttemptId=${e}, admissionKey=${t}, refusalReason=${n??`unreported`})`),this.executionAttemptId=e,this.admissionKey=t,this.refusalReason=n,this.name=`OperationAdmissionRefusedError`}};function Y(e,t,n,r){let i=t.safeParse(n);if(i.success)return i.data;let a=i.error.issues.map(e=>`${e.path.join(`.`)||`<root>`}: ${e.message}`);throw Error(`Malformed '${e.$meta.namespace}.${e.subject}' response from the Authority (executionAttemptId=${r}): ${a.join(`; `)}`)}async function X(e,t){let{executionAttemptId:n,runtimeIncarnationId:r,signal:i}=t;i?.throwIfAborted();let a=Y(l.runtime.register,c[`runtime.register`].response,await e.request(l.runtime.register,{executionAttemptId:n,runtimeIncarnationId:r},{signal:i}),n);if(a.decision===`refused`)throw new q(n,a.refusalReason);return a.runtimeGeneration}async function Z(e,t){let{executionAttemptId:n,runtimeGeneration:r,admissionKey:i,signal:a}=t,o=Y(l.operation.admit,c[`operation.admit`].response,await e.request(l.operation.admit,{executionAttemptId:n,operationKind:`workflow-run`,admissionKey:i,runtimeGeneration:r},{signal:a}),n);if(o.decision===`refused`)throw new J(n,i,o.refusalReason);if(o.operationId===void 0)throw Error(`Operation admission decision '${o.decision}' named no operation (executionAttemptId=${n}, admissionKey=${i})`);return o.operationId}async function Q(e,t){let{executionAttemptId:n,runtimeIncarnationId:r,endpoint:i,signal:a}=t,o=await X(e,{executionAttemptId:n,runtimeIncarnationId:r,signal:a});return i.bindGeneration(o),{runtimeGeneration:o,operationId:await Z(e,{executionAttemptId:n,runtimeGeneration:o,admissionKey:`workflow-run:${r}`,signal:a})}}var $=class extends Error{refusalReason;constructor(e){super(`Worker bootstrap start refused: ${e}`),this.refusalReason=e,this.name=`BootstrapStartRefusedError`}};async function de(e){let{session:t}=await O({bootstrapDeadlineAt:e.bootstrapDeadlineAt,signal:e.signal,createSession:()=>({connection:e.createConnection()}),connect:async(t,n)=>{await t.connection.connect(n),n.throwIfAborted(),t.endpoint=await K(t.connection.bus,e,{},n)},exchange:async(t,{signal:n,timeoutMs:r})=>{let i=s.parse(await t.connection.bus.request(l.bootstrap.awaitStart,{executionAttemptId:e.executionAttemptId},{signal:n,timeout:r}));if(i.status===`refused`)throw new $(i.reason);return i.status===`pending`?{status:`pending`}:{status:`complete`,value:void 0}},dispose:async e=>{e.endpoint?.cleanup(),await e.connection.close()}});if(t.endpoint===void 0)throw Error(`Bootstrap completed without an operation endpoint`);return{connection:t.connection,endpoint:t.endpoint}}export{oe as _,Z as a,b,Q as c,z as d,R as f,se as g,ce as h,q as i,X as l,O as m,de as n,G as o,L as p,J as r,K as s,$ as t,W as u,S as v,x,w as y};