@makaio/framework 1.0.0-dev-1788832451167 → 1.0.0-dev-1788863979610

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 (267) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapters/config/index.d.mts +1 -1
  3. package/dist/adapters/index.d.mts +2 -2
  4. package/dist/adapters/node.d.mts +1 -1
  5. package/dist/attempt-record-codec-BcAPEIW3.mjs +1 -0
  6. package/dist/clients/index.d.mts +1 -1
  7. package/dist/clients/managed-install.d.mts +1 -1
  8. package/dist/code-execution/worker-entry.d.mts +1 -1
  9. package/dist/{context-resolution-BrtoXnez.d.mts → context-resolution-BZKEKzu4.d.mts} +1 -1
  10. package/dist/contracts/adapter/index.d.mts +2 -2
  11. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  12. package/dist/contracts/artifact/index.d.mts +2 -2
  13. package/dist/contracts/auth/index.d.mts +2 -2
  14. package/dist/contracts/automation-trigger/index.d.mts +3 -3
  15. package/dist/contracts/canonical-model/index.d.mts +1 -1
  16. package/dist/contracts/capabilities/index.d.mts +1 -1
  17. package/dist/contracts/client/index.d.mts +2 -2
  18. package/dist/contracts/code-execution/index.d.mts +1 -1
  19. package/dist/contracts/common/index.d.mts +1 -1
  20. package/dist/contracts/config/index.d.mts +1 -1
  21. package/dist/contracts/extension/index.d.mts +5 -5
  22. package/dist/contracts/facet/index.d.mts +1 -1
  23. package/dist/contracts/harness/index.d.mts +1 -1
  24. package/dist/contracts/host/index.d.mts +1 -1
  25. package/dist/contracts/index.d.mts +114 -114
  26. package/dist/contracts/materialization/index.d.mts +3 -3
  27. package/dist/contracts/model-registry/index.d.mts +1 -1
  28. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  29. package/dist/contracts/platform/index.d.mts +1 -1
  30. package/dist/contracts/provider/index.d.mts +2 -2
  31. package/dist/contracts/reaction/index.d.mts +1 -1
  32. package/dist/contracts/session/index.d.mts +2 -2
  33. package/dist/contracts/shared/index.d.mts +2 -2
  34. package/dist/contracts/skill/index.d.mts +1 -1
  35. package/dist/contracts/telemetry/index.d.mts +1 -1
  36. package/dist/contracts/timeout/index.d.mts +1 -1
  37. package/dist/contracts/variant/index.d.mts +1 -1
  38. package/dist/contracts/worker/index.d.mts +1 -1
  39. package/dist/contracts/workflow/index.d.mts +2 -2
  40. package/dist/{contribution-Crm-mctl.d.mts → contribution-CQIpPQLl.d.mts} +2 -2
  41. package/dist/{definition-u_5rYQtc.d.mts → definition-Cdpw5l9g.d.mts} +1 -1
  42. package/dist/{detached-extension-handle-DAXKQT9c.mjs → detached-extension-handle-2yUaviLu.mjs} +1 -1
  43. package/dist/execution-attempt-owner-recovery-BRjtmTGv.mjs +1 -0
  44. package/dist/{execution-attempt-repository-CgB7uiYD.d.mts → execution-attempt-repository-CPk3F98N.d.mts} +111 -3
  45. package/dist/{hook-responses-DcapjzLb.d.mts → hook-responses-DK6uu35J.d.mts} +1 -1
  46. package/dist/{index-BvgLFm-U.d.mts → index-1y-PUD3B.d.mts} +1 -1
  47. package/dist/{index-BxOFB25y.d.mts → index-B8Tc0urp.d.mts} +1 -1
  48. package/dist/{index-QJW9g1mG.d.mts → index-B9vEfalH.d.mts} +1 -1
  49. package/dist/{index-CGJgZGqN.d.mts → index-BDAPOKi3.d.mts} +8 -8
  50. package/dist/{index-LOh6AEqx.d.mts → index-BDs5tDcM.d.mts} +10 -10
  51. package/dist/{index-rygpcDBV.d.mts → index-BlJbchHp.d.mts} +1 -1
  52. package/dist/{index-LryUXslm.d.mts → index-C3uCMCHI.d.mts} +3 -3
  53. package/dist/{index-J-kv32zv.d.mts → index-COSxBdTp.d.mts} +2 -2
  54. package/dist/{index-DZnb56vt2.d.mts → index-CXZ8ODDT.d.mts} +1 -1
  55. package/dist/{index-Bsr4rZl0.d.mts → index-Cjy1_Hc2.d.mts} +13 -13
  56. package/dist/{index-DIhkK4Y0.d.mts → index-CsDj-DEW.d.mts} +1 -1
  57. package/dist/{index-BwccWakG.d.mts → index-CvWUgywU.d.mts} +1 -1
  58. package/dist/{index-BDzqNCXs.d.mts → index-D5UpsCNq.d.mts} +1 -1
  59. package/dist/{index-Cbv_3Xi12.d.mts → index-D9CdrFKz2.d.mts} +1 -1
  60. package/dist/{index-CfJKwWJa.d.mts → index-DQWEOn6i.d.mts} +1 -1
  61. package/dist/{index-BakMNLkB.d.mts → index-DXv51ZIb.d.mts} +38 -38
  62. package/dist/{index-DZXpKlyB.d.mts → index-DmTBlEzu.d.mts} +20 -20
  63. package/dist/{index-vXmPEZ5O.d.mts → index-Dne0xNUI.d.mts} +7 -7
  64. package/dist/{index-Bo3LRb2u.d.mts → index-DtHmaj-q.d.mts} +1 -1
  65. package/dist/{index-BADuMxcP.d.mts → index-DvV7vEKt.d.mts} +134 -134
  66. package/dist/{index-C1PfDEIV.d.mts → index-jZXIrHlY.d.mts} +54 -54
  67. package/dist/{index-BDAfOYSw2.d.mts → index-zCstNu9J2.d.mts} +12 -12
  68. package/dist/kernel/cli/index.d.mts +2 -2
  69. package/dist/kernel/cli/register.d.mts +1 -1
  70. package/dist/kernel/extension/index.d.mts +1 -1
  71. package/dist/kernel/index.d.mts +5 -5
  72. package/dist/kernel/namespace/index.d.mts +1 -1
  73. package/dist/kernel/observability/index.d.mts +1 -1
  74. package/dist/kernel/providers/index.d.mts +1 -1
  75. package/dist/kernel/window/index.d.mts +1 -1
  76. package/dist/{lib-271rPR7A.mjs → lib-BB0XjVs6.mjs} +1 -1
  77. package/dist/{lib-RFpLjUda.mjs → lib-DNGNIb-O.mjs} +1 -1
  78. package/dist/{load-extensions-CY8ELnCp.d.mts → load-extensions-C3Y3y9EW.d.mts} +1 -1
  79. package/dist/{load-extensions-D9inWcDy.mjs → load-extensions-CWlR-8BM.mjs} +1 -1
  80. package/dist/{namespace-BoyqQiW9.d.mts → namespace-B8i86gVL.d.mts} +2 -2
  81. package/dist/{namespace-BMG3RCdr.d.mts → namespace-Bz3qcZBD.d.mts} +6 -6
  82. package/dist/{namespace-BymM0nl_.d.mts → namespace-C3Ch35nb.d.mts} +27 -27
  83. package/dist/{namespace-DlrX8feY.d.mts → namespace-C9X7Qvn5.d.mts} +45 -45
  84. package/dist/{namespace-Dw5H_KCF.d.mts → namespace-agOiy4kr.d.mts} +1 -1
  85. package/dist/node/bus-server/index.d.mts +1 -1
  86. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  87. package/dist/{package-CzKoZ1k0.mjs → package-BdOoo7XE.mjs} +2 -2
  88. package/dist/{package-DkpF17X_.d.mts → package-w4WZqO7J.d.mts} +19 -5
  89. package/dist/package.json +1 -1
  90. package/dist/rules/index.d.mts +1 -1
  91. package/dist/rules/schemas.d.mts +1 -1
  92. package/dist/runtime-bun/index.mjs +1 -1
  93. package/dist/runtime-node/code-execution/index.d.mts +2 -2
  94. package/dist/runtime-node/extension-discovery.d.mts +1 -1
  95. package/dist/runtime-node/extension-validation.d.mts +1 -1
  96. package/dist/runtime-node/extension-validation.mjs +1 -1
  97. package/dist/runtime-node/index.d.mts +5 -5
  98. package/dist/runtime-node/index.mjs +2 -2
  99. package/dist/runtime-node/makaio-config.d.mts +1 -1
  100. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  101. package/dist/{schema-C9PauHXt.d.mts → schema-BwrsXKsP.d.mts} +2 -2
  102. package/dist/{schemas-B2UbGJpJ.d.mts → schemas-B4MSOlcv.d.mts} +10 -10
  103. package/dist/{schemas-CBpjAhut.d.mts → schemas-Bw2-j1lm.d.mts} +4 -4
  104. package/dist/{schemas-Wqo3_F6-.d.mts → schemas-Io717dOA.d.mts} +1 -1
  105. package/dist/services/adapter-runtime/index.d.mts +3 -3
  106. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  107. package/dist/services/adapter-runtime/schemas.d.mts +1 -1
  108. package/dist/services/adapter-subsystem/index.d.mts +3 -3
  109. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  110. package/dist/services/agent-runtime/index.d.mts +2 -2
  111. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  112. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  113. package/dist/services/capability/index.d.mts +2 -2
  114. package/dist/services/code-execution/index.d.mts +1 -1
  115. package/dist/services/codebase/index.d.mts +2 -2
  116. package/dist/services/codebase/namespace.d.mts +1 -1
  117. package/dist/services/codebase/schemas.d.mts +1 -1
  118. package/dist/services/compression/index.d.mts +2 -2
  119. package/dist/services/compression/namespace.d.mts +1 -1
  120. package/dist/services/compression/schemas.d.mts +1 -1
  121. package/dist/services/context-rules/index.d.mts +4 -4
  122. package/dist/services/execution-target/index.d.mts +3 -3
  123. package/dist/services/execution-target/namespace.d.mts +1 -1
  124. package/dist/services/execution-target/schemas.d.mts +1 -1
  125. package/dist/services/filesystem/index.d.mts +1 -1
  126. package/dist/services/filesystem/namespace.d.mts +6 -6
  127. package/dist/services/filesystem/schemas.d.mts +3 -3
  128. package/dist/services/index.d.mts +55 -55
  129. package/dist/services/log-import/browser.d.mts +2 -2
  130. package/dist/services/log-import/index.d.mts +2 -2
  131. package/dist/services/log-import/log-import.d.mts +1 -1
  132. package/dist/services/materialization/index.d.mts +1 -1
  133. package/dist/services/model-registry/index.d.mts +1 -1
  134. package/dist/services/preferences/index.d.mts +2 -2
  135. package/dist/services/preferences/schemas.d.mts +1 -1
  136. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  137. package/dist/services/provider-context/index.d.mts +1 -1
  138. package/dist/services/session/handlers/index.d.mts +1 -1
  139. package/dist/services/session/index.d.mts +9 -9
  140. package/dist/services/session/messages/namespace.d.mts +1 -1
  141. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  142. package/dist/services/session/session-events/namespace.d.mts +1 -1
  143. package/dist/services/session/storage/namespace.d.mts +1 -1
  144. package/dist/services/session/storage/schema.d.mts +1 -1
  145. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  146. package/dist/services/session/turns/namespace.d.mts +1 -1
  147. package/dist/services/session-editor/index.d.mts +1 -1
  148. package/dist/services/settings/index.d.mts +3 -3
  149. package/dist/services/settings/namespace.d.mts +10 -10
  150. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  151. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  152. package/dist/services/settings/storage/index.d.mts +3 -3
  153. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  154. package/dist/services/subagent/index.d.mts +1 -1
  155. package/dist/services/subagent-template/index.d.mts +2 -2
  156. package/dist/services/subagent-template/namespace.d.mts +1 -1
  157. package/dist/services/subagent-template/schemas.d.mts +1 -1
  158. package/dist/services/tool-approval/index.d.mts +1 -1
  159. package/dist/services/tools/index.d.mts +1 -1
  160. package/dist/services/tray-menu/index.d.mts +3 -3
  161. package/dist/services/tray-menu/namespace.d.mts +1 -1
  162. package/dist/services/tray-menu/schemas.d.mts +1 -1
  163. package/dist/services/turn/index.d.mts +1 -1
  164. package/dist/services/turn/namespace.d.mts +1 -1
  165. package/dist/services/workflow-transitions/index.d.mts +1 -1
  166. package/dist/{src-DEgV239R.mjs → src-BWEtqWTw.mjs} +1 -1
  167. package/dist/storage/drizzle/client.d.mts +1 -1
  168. package/dist/storage/drizzle/index.d.mts +1 -1
  169. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  170. package/dist/storage/handlers/index.d.mts +1 -1
  171. package/dist/{transition-DFA_ckdP.d.mts → transition-CGnHfVIv.d.mts} +2 -2
  172. package/dist/{types-p55qvq922.d.mts → types-B6V3HDRl2.d.mts} +1 -1
  173. package/dist/{types-DkfDRSTr.d.mts → types-FPmiU-3J.d.mts} +51 -51
  174. package/dist/ui-kernel/index.d.mts +1 -1
  175. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  176. package/dist/{view-builder-CYW_9n4A.d.mts → view-builder-CELaqM4Z.d.mts} +1 -1
  177. package/dist/workflow-engine/execution-attempt-repository.d.mts +2 -2
  178. package/dist/workflow-engine/index.d.mts +30 -30
  179. package/dist/workflow-engine/index.mjs +1 -1
  180. package/dist/workflow-engine/package.d.mts +1 -1
  181. package/dist/workflow-engine/package.mjs +1 -1
  182. package/dist/workflow-engine/provider-operation.d.mts +1 -1
  183. package/dist/workflow-engine/testing/conformance.d.mts +1 -1
  184. package/dist/workflow-engine/testing/conformance.mjs +3 -1
  185. package/dist/workflow-engine/testing/index.d.mts +9 -6
  186. package/dist/workflow-engine/testing/index.mjs +1 -1
  187. package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
  188. package/dist/workflow-engine/testing/sqlite.mjs +63 -55
  189. package/package.json +1 -1
  190. package/dist/attempt-record-codec-B32Whx75.mjs +0 -1
  191. package/dist/{adapter-binding-D68U_Hmh.d.mts → adapter-binding-C6jAAjGu.d.mts} +0 -0
  192. package/dist/{attempt-fixtures-CnrnF5_4.mjs → attempt-fixtures-gGhCA_WQ.mjs} +0 -0
  193. package/dist/{base-orchestrator-DA95InJU.d.mts → base-orchestrator-B9OUXDR-.d.mts} +0 -0
  194. package/dist/{capability-service-s4ZYSEWc.d.mts → capability-service-DA9xdAyh.d.mts} +0 -0
  195. package/dist/{client-f5A-6La5.d.mts → client-BhRxxVig.d.mts} +0 -0
  196. package/dist/{client-binary-version-verifier-kd9LP9AQ.d.mts → client-binary-version-verifier-DXu9mjRx.d.mts} +0 -0
  197. package/dist/{clients-namespace-q4PqU1cA.d.mts → clients-namespace-2TIeXofb.d.mts} +0 -0
  198. package/dist/{config-namespace-Cp71zTT0.d.mts → config-namespace-Burux0cR.d.mts} +0 -0
  199. package/dist/{create-static-mount-CmQgA0jq.mjs → create-static-mount-CuiFK6nC.mjs} +0 -0
  200. package/dist/{definition-BHSzhrUf.d.mts → definition-011l3aQ8.d.mts} +0 -0
  201. package/dist/{extension-context-BmU5XKjI.d.mts → extension-context-CogUIfZb.d.mts} +0 -0
  202. package/dist/{extension-discovery-DnO7bINK.d.mts → extension-discovery-CuC5Nd5d.d.mts} +0 -0
  203. package/dist/{filesystem-service-BBArEDPL.d.mts → filesystem-service-DYYL4fLd.d.mts} +0 -0
  204. package/dist/{index-CDLf3Fka2.d.mts → index-09JDqcgy2.d.mts} +0 -0
  205. package/dist/{index-xaBSwHxJ.d.mts → index-B4MG7PBn.d.mts} +0 -0
  206. package/dist/{index-mK-rgiit.d.mts → index-BD1_BSMP.d.mts} +0 -0
  207. package/dist/{index-DQD2-jcL.d.mts → index-BKco9D6a.d.mts} +0 -0
  208. package/dist/{index-DSLTgc7h2.d.mts → index-BNF8osK42.d.mts} +0 -0
  209. package/dist/{index-KAAnSRZt.d.mts → index-BPX7lMRX.d.mts} +0 -0
  210. package/dist/{index-B-zl-O-Y.d.mts → index-BRNRgfOm.d.mts} +0 -0
  211. package/dist/{index-CPWBGotQ.d.mts → index-BlkTzRHz.d.mts} +0 -0
  212. package/dist/{index-CcrXttC02.d.mts → index-C0uHQitR2.d.mts} +0 -0
  213. package/dist/{index-CrcfeFOo.d.mts → index-C7ZdyYMT.d.mts} +0 -0
  214. package/dist/{index-C9xVZ-gt.d.mts → index-CDJUiga3.d.mts} +0 -0
  215. package/dist/{index-D-JbTXIH.d.mts → index-CKeNzHte.d.mts} +0 -0
  216. package/dist/{index-COOM1j_L2.d.mts → index-CU90gGDk2.d.mts} +0 -0
  217. package/dist/{index-DYHxzwok2.d.mts → index-CUxMqAoE2.d.mts} +0 -0
  218. package/dist/{index-Df1c_2PF.d.mts → index-CbaOOgMX.d.mts} +0 -0
  219. package/dist/{index-DSN2t48K.d.mts → index-CrA9tCMf.d.mts} +0 -0
  220. package/dist/{index-CkpR5sIH.d.mts → index-CrUijdhZ.d.mts} +0 -0
  221. package/dist/{index-D_sMzTvv.d.mts → index-CweK7QAS.d.mts} +0 -0
  222. package/dist/{index-Dn_SGTgp.d.mts → index-DhCBbChV.d.mts} +0 -0
  223. package/dist/{index-Co1da7YK.d.mts → index-DiHGEgh-.d.mts} +0 -0
  224. package/dist/{index-DW4SE_sH.d.mts → index-DmjyHIEH.d.mts} +0 -0
  225. package/dist/{index-D94yE5Dr.d.mts → index-DsIrU-pP.d.mts} +0 -0
  226. package/dist/{index-BB0HypzC.d.mts → index-DuoOsxow.d.mts} +0 -0
  227. package/dist/{index-CiKzWCW02.d.mts → index-DwFnHNoq2.d.mts} +6 -6
  228. /package/dist/{index-NhW2h2wH2.d.mts → index-Oejq5WGD2.d.mts} +0 -0
  229. /package/dist/{index-CBixkF0n.d.mts → index-XNbcZBEZ.d.mts} +0 -0
  230. /package/dist/{index-D6RMsZko.d.mts → index-fQIrZBY0.d.mts} +0 -0
  231. /package/dist/{index-Bf2MgOni.d.mts → index-ikP83tJm.d.mts} +0 -0
  232. /package/dist/{index-CsFN2nv7.d.mts → index-luD7oSCA.d.mts} +0 -0
  233. /package/dist/{json-value-pX6xnLGw.d.mts → json-value-DbwI1AMR.d.mts} +0 -0
  234. /package/dist/{jsonl-transport-DQIlRX_y.mjs → jsonl-transport-W03tkPvB.mjs} +0 -0
  235. /package/dist/{lib-6eNAiNK7.mjs → lib-Wtk4Ef-T.mjs} +0 -0
  236. /package/dist/{namespace-CQEYu8az.d.mts → namespace-BGi71aDN.d.mts} +0 -0
  237. /package/dist/{namespace-Cs-cOyrn.d.mts → namespace-BW2rjW9-.d.mts} +0 -0
  238. /package/dist/{namespace-9ychTEk_.d.mts → namespace-Br7IQt88.d.mts} +0 -0
  239. /package/dist/{namespace-BGDq7HmW.d.mts → namespace-C3l4AsWS.d.mts} +0 -0
  240. /package/dist/{namespace-CVg_cpkh.d.mts → namespace-D4RJjLv8.d.mts} +0 -0
  241. /package/dist/{namespace-CPR2xem0.d.mts → namespace-D5nHBTPz.d.mts} +0 -0
  242. /package/dist/{namespace-DdqVQSyc.d.mts → namespace-DeezOMb9.d.mts} +0 -0
  243. /package/dist/{namespace-DykqxEyX.d.mts → namespace-Df8uPrMr.d.mts} +0 -0
  244. /package/dist/{namespace-DG0hjPcx.d.mts → namespace-aUe_P5qN.d.mts} +0 -0
  245. /package/dist/{orchestrator-shared-BzqqcY2z.d.mts → orchestrator-shared-B2Lb5Enk.d.mts} +0 -0
  246. /package/dist/{packages-Cx-BwSZr.d.mts → packages-uNYWGMH1.d.mts} +0 -0
  247. /package/dist/{provider-operation-B2wQST6N.d.mts → provider-operation-BwvTdAsv.d.mts} +0 -0
  248. /package/dist/{providers-namespace-DsKTnuO1.d.mts → providers-namespace-D-gdpu0p.d.mts} +0 -0
  249. /package/dist/{schemas-CHRuwe18.d.mts → schemas-BNf-WkKF.d.mts} +0 -0
  250. /package/dist/{schemas-ClGDFa44.d.mts → schemas-BaWB3EXP.d.mts} +0 -0
  251. /package/dist/{schemas-Dxvjq-Bi.d.mts → schemas-CMQ2PiO2.d.mts} +0 -0
  252. /package/dist/{schemas-DmULJ7Jk.d.mts → schemas-CsOAG1rB.d.mts} +0 -0
  253. /package/dist/{schemas-Bk50UoMA.d.mts → schemas-DKJyKDpe.d.mts} +0 -0
  254. /package/dist/{schemas-CzGN0eqW.d.mts → schemas-Ds_YMFjX.d.mts} +0 -0
  255. /package/dist/{schemas-BDZFd3Wb.d.mts → schemas-uaQuIxm4.d.mts} +0 -0
  256. /package/dist/{schemas--LAbwXvw.d.mts → schemas-v1W9Gj9m.d.mts} +0 -0
  257. /package/dist/{server-lifecycle-WFZcCMwF.d.mts → server-lifecycle-CmuBMs3O.d.mts} +0 -0
  258. /package/dist/{session-lineage-C9kppcCa.d.mts → session-lineage-BRhnTWqq.d.mts} +0 -0
  259. /package/dist/{src-DIyWekjW.mjs → src-BA_c2cXX.mjs} +0 -0
  260. /package/dist/{storage-namespace-BWU-8rvj.d.mts → storage-namespace-CTXxds3h.d.mts} +0 -0
  261. /package/dist/{storage-namespace-definition-B-8JKvzm.d.mts → storage-namespace-definition-Dkxl1FGw.d.mts} +0 -0
  262. /package/dist/{types-8rMNe3AS.d.mts → types--Sa8Ip8j.d.mts} +0 -0
  263. /package/dist/{types-DxHeL0pF.d.mts → types-BWfAz9Sh.d.mts} +0 -0
  264. /package/dist/{types-BnPJa-C_.d.mts → types-BklZfFWo.d.mts} +0 -0
  265. /package/dist/{types-DQTCNM2i.d.mts → types-C4ayzk8k.d.mts} +0 -0
  266. /package/dist/{types-BFeWU3WM.d.mts → types-DDfy8LgJ.d.mts} +0 -0
  267. /package/dist/{window-registry-DQP5P2_0.d.mts → window-registry-CIlKN806.d.mts} +0 -0
@@ -1 +1 @@
1
- import{_ as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f}from"../../execution-attempt-repository-D0cCU7dI.mjs";import{a as p,c as m,d as h,f as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"../../attempt-record-codec-B32Whx75.mjs";import{a as D,c as O,d as k,f as A,i as j,l as M,m as N,n as P,o as F,p as I,r as L,s as R,t as z,u as B}from"../../attempt-fixtures-CnrnF5_4.mjs";import{BoundedRecoveryEvidenceSchema as V}from"@makaio/framework/contracts";function H(e,t){return{...e,status:`settled`,settlementKind:t,claimable:!1,operationStartGate:`closed`}}function U(D,O={}){let k=O.attempts??new Map,A=O.operations??new Map,j=e=>A.get(e)?.obligation===`terminal-convergence`,M=O.committedOutcomes??new Map,N=O.activeAttempts??new Map,P=e=>{let t=e.settlementKind!=null,r=!t&&N.get(e.executionId)===e.executionAttemptId;return n({matchesExecution:!0,settled:t,active:r,allocated:r&&e.allocationRef!==null&&!j(e.executionAttemptId)})},F=e=>{let t=k.get(e.executionAttemptId),n=A.get(e.executionAttemptId);return!t||!n?{kind:`not-found`}:t.settlementKind==null?n.token===null||n.token!==e.token||n.generation!==e.generation||n.ownerId!==e.ownerId?{kind:`stale`,attempt:t}:{kind:`authorized`,attempt:t,operation:n}:{kind:`resolved`,attempt:t}},I=(e,t)=>{A.set(e.executionAttemptId,{...e,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t})},L=(e,t)=>{let n=w(e.allocationRef),r=F(e.claim);if(r.kind!==`not-found`&&g(r.attempt,n),r.kind===`resolved`)return{kind:`resolved`,allocationRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i,operation:a}=r;if(i.allocationRef!==null)return o(i.allocationRef,n)?{kind:`duplicate`,allocationRef:i.allocationRef}:{kind:`conflict`,allocationRef:i.allocationRef};let s=N.get(i.executionId)===i.executionAttemptId;return k.set(i.executionAttemptId,{...i,status:`allocated`,allocationRef:n,claimable:t&&s}),A.set(a.executionAttemptId,{...a,obligation:`allocation-control`}),{kind:`recorded`}};return{async createAttempt(e){let t=v(e.instruction),n=C(e.bootstrapTimeoutMs);if(k.has(e.executionAttemptId))throw new c(e.executionAttemptId);let r={executionAttemptId:e.executionAttemptId,executionId:e.executionId,instruction:t,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,...n,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null,...T},i=N.get(e.executionId),a=i===void 0?void 0:k.get(i);return a!==void 0&&k.set(a.executionAttemptId,{...a,claimable:a.status===`allocated`?!1:a.claimable,operationStartGate:`closed`}),k.set(e.executionAttemptId,r),N.set(e.executionId,e.executionAttemptId),r},async readBootstrapStartState(e){let t=k.get(e.executionAttemptId);return!t||t.executionId!==e.executionId?null:{settled:t.settlementKind!=null,active:N.get(e.executionId)===e.executionAttemptId,allocated:t.allocationRef!==null,allocationTerminated:j(e.executionAttemptId),operationStartGate:t.operationStartGate,bootstrapDeadlineAt:t.bootstrapDeadlineAt??null}},async beginProvisioning(e){let t=x(e.allocationLifetime),n=k.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(N.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};if(n.settlementKind!=null)return{kind:`resolved`,allocationRef:n.allocationRef};if(n.allocationRef!==null)return{kind:`allocated`,allocationRef:n.allocationRef};if(n.status!==`pending`)return{kind:`already-provisioning`};k.set(e.executionAttemptId,{...n,status:`provisioning`,providerId:e.providerId,allocationLifetime:t,provisionerIncarnationId:e.provisionerIncarnationId});let r={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:p(e.leaseExpiresAt)};return A.set(e.executionAttemptId,{executionAttemptId:e.executionAttemptId,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt,obligation:`provisioning-resolution`,failureCount:0,lastFailure:null}),{kind:`started`,claim:r}},async getProviderOperation(e){return A.get(e)??null},async renewProviderOperationClaim(e){let t=F(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=p(e.leaseExpiresAt);return A.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=k.get(e.executionAttemptId),n=A.get(e.executionAttemptId);if(!t||!n)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};if(n.ownerId!==null&&n.leaseExpiresAt!==null&&_(n.leaseExpiresAt)>_(e.observedAt))return{kind:`stale`};let r={executionAttemptId:e.executionAttemptId,generation:n.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:p(e.leaseExpiresAt)};return A.set(e.executionAttemptId,{...n,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt}),{kind:`claimed`,claim:r}},async handoffProviderOperation(e){let t=e.evidence===void 0?void 0:V.parse(e.evidence),n=F(e.claim);return n.kind===`authorized`?(A.set(e.claim.executionAttemptId,{...n.operation,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t??n.operation.lastFailure}),{kind:`recorded`}):{kind:n.kind}},async recordProviderOperationUncertainty(e){let t=V.parse(e.evidence),n=F(e.claim);return n.kind===`authorized`?(A.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async recordAllocation(e){return L(e,!0)},async recordProvisioningAbsent(e){let t=V.parse(e.evidence),n=F(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?(k.set(r.executionAttemptId,H(r,`abandoned`)),I(i,t),{kind:`recorded`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=V.parse(e.proof.evidence),n=F(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n,o=a(r,e);return o===null?(k.set(r.executionAttemptId,H(r,`abandoned`)),I(i,t),{kind:`recorded`}):o},async recordAllocationTerminated(e){let t=V.parse(e.evidence),n=F(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.allocationRef===null?{kind:`not-allocated`}:(A.set(i.executionAttemptId,{...i,obligation:`terminal-convergence`,lastFailure:t}),{kind:`recorded`})},async recordInfrastructureFailure(e){let t=F(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let{attempt:n,operation:r}=t;return n.executionId===e.executionId?n.allocationRef===null?{kind:`not-allocated`}:r.obligation===`terminal-convergence`?(k.set(n.executionAttemptId,H(n,`infrastructure-failure`)),I(r,r.lastFailure),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`not-found`}},async registerRuntime(t){let n=k.get(t.executionAttemptId);if(n===void 0||n.executionId!==t.executionId)return{kind:`not-found`};let r=P(n)??e(n,t);if(r!==null)return r;let i=n.runtimeGeneration+1;return k.set(n.executionAttemptId,{...n,runtimeGeneration:i,runtimeIncarnationId:t.runtimeIncarnationId,runtimeReadyAt:null,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null}),{kind:`registered`,runtimeGeneration:i}},async admitOperation(e){let t=k.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=P(t);if(n!==null)return n;let i=r(t,e,t.activeOperationId!==null&&t.activeOperationKey===e.admissionKey&&t.activeOperationAdmittedAt===null?p(new Date().toISOString()):``,t);if(i!==null)return i;let a=crypto.randomUUID(),o=p(new Date().toISOString());return k.set(t.executionAttemptId,{...t,activeOperationId:a,activeOperationKind:e.operationKind,activeOperationKey:e.admissionKey,activeOperationGeneration:t.runtimeGeneration,activeOperationAdmittedAt:o}),{kind:`admitted`,operationId:a,runtimeGeneration:t.runtimeGeneration,admittedAt:o}},async getInstruction(e){let t=k.get(e.executionAttemptId);return t?.executionId===e.executionId?t.instruction:null},async reportOperation(e){let t=h(e.result),n=k.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=s({matchesExecution:!0,settled:n.settlementKind!=null,active:N.get(e.executionId)===e.executionAttemptId,allocated:n.allocationRef!==null&&!j(e.executionAttemptId)},n,n,{...e,result:t});if(r!==null)return r;let i=E([...n.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return k.set(e.executionAttemptId,{...n,preparationReceipts:i,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`accepted`,binding:t.binding}},async completeOperation(e){let t=k.get(e.executionAttemptId);if(t===void 0)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};let n=u(t,e);return n===null?(k.set(t.executionAttemptId,{...t,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`completed`}):n},async markRuntimeReady(e){let t=p(e.readyAt),n=k.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=P(n)??i(n,e);return r===null?(k.set(n.executionAttemptId,{...n,runtimeReadyAt:t}),{kind:`ready`,acceptedAt:t}):r},async getAttemptControlState(e){let t=k.get(e);return t===void 0?null:S(t)},async getActiveAttempt(e,t){return N.get(e)===t?k.get(t)??null:null},canonicalizeOutcome(e){return t(D,e)},decodeOutcome(e){return d(D,e)},async commitOutcome(e){let t=e.result;if(N.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let n=k.get(e.executionAttemptId);if(n===void 0)return{kind:`fenced`};let r=M.get(e.executionAttemptId);if(r!==void 0){let e=d(D,r);return f(r,t.text)?{kind:`duplicate`,outcome:e,text:r}:{kind:`conflict`}}if(n.settlementKind!=null)return{kind:`conflict`};l(n,e.runtimeFence),M.set(e.executionAttemptId,t.text),k.set(e.executionAttemptId,H(n,`outcome`));let i=A.get(e.executionAttemptId);return i&&I(i,i.lastFailure),{kind:`accepted`,outcome:d(D,t.text),text:t.text}},async abandonPendingAttempt(e,t){if(N.get(t)!==e)return{kind:`fenced`};let n=k.get(e);return n?n.status===`allocated`?{kind:`allocated`}:n.status===`provisioning`?{kind:`provisioning`}:n.status===`settled`?{kind:n.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:(k.set(e,H(n,`abandoned`)),{kind:`abandoned`}):{kind:`fenced`}},recovery:{async getAttemptWithAllocation(e){return k.get(e)??null},async recordDiscoveredAllocation(e){return L(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=m(e),r=F(e.claim);if(r.kind===`stale`)return{kind:`stale`,storedRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?{kind:`not-allocated`}:o(i.allocationRef,t)?(k.set(i.executionAttemptId,{...i,allocationRef:n}),{kind:`evolved`}):{kind:`stale`,storedRef:i.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=_(new Date().toISOString()),n=[];for(let r of k.values())r.executionId===e&&r.status===`allocated`&&r.allocationRef!==null&&r.claimable===!0&&r.settlementKind==null&&(r.claimExpiresAt!=null&&_(r.claimExpiresAt)<t||n.push(y(r)));return n.sort(b)}},attempts:k,operations:A,committedOutcomes:M,activeAttempts:N}}export{T as INITIAL_ATTEMPT_CONTROL_STATE,z as TEST_OWNER_ID,P as TEST_PROVIDER_ID,L as TEST_PROVISIONER_INCARNATION_ID,j as allocateTestAttempt,D as beginTestProvisioning,U as createInMemoryAttemptRepository,F as driveTestAttemptToAllocated,R as leaseAt,O as makeBeginProvisioningInput,M as makeEvidence,B as makeProcessLossProof,k as makeTestAllocationRef,A as makeTestInstruction,I as makeTestWorkflowResult,N as workflowRunResultOutcomeCodec};
1
+ import{_ as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f}from"../../execution-attempt-repository-D0cCU7dI.mjs";import{a as p,i as m,n as h,o as g,t as _}from"../../execution-attempt-owner-recovery-BRjtmTGv.mjs";import{a as v,c as y,d as b,f as x,i as S,l as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A}from"../../attempt-record-codec-BcAPEIW3.mjs";import{a as j,c as M,d as N,f as P,i as F,l as I,m as L,n as R,o as z,p as B,r as V,s as H,t as U,u as W}from"../../attempt-fixtures-gGhCA_WQ.mjs";import{BoundedRecoveryEvidenceSchema as G}from"@makaio/framework/contracts";function K(e,t){return{...e,status:`settled`,settlementKind:t,claimable:!1,operationStartGate:`closed`}}function q(j,M={}){let N=M.attempts??new Map,P=M.operations??new Map,F=e=>P.get(e)?.obligation===`terminal-convergence`,I=M.committedOutcomes??new Map,L=M.activeAttempts??new Map,R=M.requestBindings??new Map,z=e=>{let t=e.settlementKind!=null,r=!t&&L.get(e.executionId)===e.executionAttemptId;return n({matchesExecution:!0,settled:t,active:r,allocated:r&&e.allocationRef!==null&&!F(e.executionAttemptId)})},B=e=>{let t=N.get(e.executionAttemptId),n=P.get(e.executionAttemptId);return!t||!n?{kind:`not-found`}:t.settlementKind==null?n.token===null||n.token!==e.token||n.generation!==e.generation||n.ownerId!==e.ownerId?{kind:`stale`,attempt:t}:{kind:`authorized`,attempt:t,operation:n}:{kind:`resolved`,attempt:t}},V=(e,t)=>{P.set(e.executionAttemptId,{...e,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t})},H=(e,t)=>{let n=O(e.allocationRef),r=B(e.claim);if(r.kind!==`not-found`&&b(r.attempt,n),r.kind===`resolved`)return{kind:`resolved`,allocationRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i,operation:a}=r;if(i.allocationRef!==null)return o(i.allocationRef,n)?{kind:`duplicate`,allocationRef:i.allocationRef}:{kind:`conflict`,allocationRef:i.allocationRef};let s=L.get(i.executionId)===i.executionAttemptId;return N.set(i.executionAttemptId,{...i,status:`allocated`,allocationRef:n,claimable:t&&s}),P.set(a.executionAttemptId,{...a,obligation:`allocation-control`}),{kind:`recorded`}},U={async getAttemptWithAllocation(e){return N.get(e)??null},async recordDiscoveredAllocation(e){return H(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=y(e),r=B(e.claim);if(r.kind===`stale`)return{kind:`stale`,storedRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?{kind:`not-allocated`}:o(i.allocationRef,t)?(N.set(i.executionAttemptId,{...i,allocationRef:n}),{kind:`evolved`}):{kind:`stale`,storedRef:i.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=S(new Date().toISOString()),n=[];for(let r of N.values())r.executionId===e&&r.status===`allocated`&&r.allocationRef!==null&&r.claimable===!0&&r.settlementKind==null&&(r.claimExpiresAt!=null&&S(r.claimExpiresAt)<t||n.push(E(r)));return n.sort(w)}},W=e=>{let t=D(e.bootstrapTimeoutMs);if(N.has(e.executionAttemptId))throw new c(e.executionAttemptId);let n={executionAttemptId:e.executionAttemptId,executionId:e.executionId,instruction:e.instruction,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,...t,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null,...k},r=L.get(e.executionId),i=r===void 0?void 0:N.get(r);return i!==void 0&&N.set(i.executionAttemptId,{...i,claimable:i.status===`allocated`?!1:i.claimable,operationStartGate:`closed`}),N.set(e.executionAttemptId,n),L.set(e.executionId,e.executionAttemptId),n};return{async createAttempt(e){return W({...e,instruction:g(e.instruction)})},async ensureAttempt(e){let t=m(e),n=R.get(t.executionId),r=n?.get(t.requestKey);if(r!==void 0)return h(t,N.get(r)??null);let i=W(t),a=n??new Map;return a.set(t.requestKey,i.executionAttemptId),R.set(t.executionId,a),{kind:`created`,attempt:structuredClone(i)}},async readAttemptSettlement(e){let t=p(e);return _(t,{attempt:N.get(t.executionAttemptId)??null,activeAttemptId:L.get(t.executionId)??null,outcomeText:I.get(t.executionAttemptId)??null},j)},async readBootstrapStartState(e){let t=N.get(e.executionAttemptId);return!t||t.executionId!==e.executionId?null:{settled:t.settlementKind!=null,active:L.get(e.executionId)===e.executionAttemptId,allocated:t.allocationRef!==null,allocationTerminated:F(e.executionAttemptId),operationStartGate:t.operationStartGate,bootstrapDeadlineAt:t.bootstrapDeadlineAt??null}},async beginProvisioning(e){let t=T(e.allocationLifetime),n=N.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(L.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};if(n.settlementKind!=null)return{kind:`resolved`,allocationRef:n.allocationRef};if(n.allocationRef!==null)return{kind:`allocated`,allocationRef:n.allocationRef};if(n.status!==`pending`)return{kind:`already-provisioning`};N.set(e.executionAttemptId,{...n,status:`provisioning`,providerId:e.providerId,allocationLifetime:t,provisionerIncarnationId:e.provisionerIncarnationId});let r={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:v(e.leaseExpiresAt)};return P.set(e.executionAttemptId,{executionAttemptId:e.executionAttemptId,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt,obligation:`provisioning-resolution`,failureCount:0,lastFailure:null}),{kind:`started`,claim:r}},async getProviderOperation(e){return P.get(e)??null},async renewProviderOperationClaim(e){let t=B(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=v(e.leaseExpiresAt);return P.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=N.get(e.executionAttemptId),n=P.get(e.executionAttemptId);if(!t||!n)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};if(n.ownerId!==null&&n.leaseExpiresAt!==null&&S(n.leaseExpiresAt)>S(e.observedAt))return{kind:`stale`};let r={executionAttemptId:e.executionAttemptId,generation:n.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:v(e.leaseExpiresAt)};return P.set(e.executionAttemptId,{...n,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt}),{kind:`claimed`,claim:r}},async handoffProviderOperation(e){let t=e.evidence===void 0?void 0:G.parse(e.evidence),n=B(e.claim);return n.kind===`authorized`?(P.set(e.claim.executionAttemptId,{...n.operation,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t??n.operation.lastFailure}),{kind:`recorded`}):{kind:n.kind}},async recordProviderOperationUncertainty(e){let t=G.parse(e.evidence),n=B(e.claim);return n.kind===`authorized`?(P.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async recordAllocation(e){return H(e,!0)},async recordProvisioningAbsent(e){let t=G.parse(e.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?(N.set(r.executionAttemptId,K(r,`abandoned`)),V(i,t),{kind:`recorded`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=G.parse(e.proof.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n,o=a(r,e);return o===null?(N.set(r.executionAttemptId,K(r,`abandoned`)),V(i,t),{kind:`recorded`}):o},async recordAllocationTerminated(e){let t=G.parse(e.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.allocationRef===null?{kind:`not-allocated`}:(P.set(i.executionAttemptId,{...i,obligation:`terminal-convergence`,lastFailure:t}),{kind:`recorded`})},async recordInfrastructureFailure(e){let t=B(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let{attempt:n,operation:r}=t;return n.executionId===e.executionId?n.allocationRef===null?{kind:`not-allocated`}:r.obligation===`terminal-convergence`?(N.set(n.executionAttemptId,K(n,`infrastructure-failure`)),V(r,r.lastFailure),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`not-found`}},async registerRuntime(t){let n=N.get(t.executionAttemptId);if(n===void 0||n.executionId!==t.executionId)return{kind:`not-found`};let r=z(n)??e(n,t);if(r!==null)return r;let i=n.runtimeGeneration+1;return N.set(n.executionAttemptId,{...n,runtimeGeneration:i,runtimeIncarnationId:t.runtimeIncarnationId,runtimeReadyAt:null,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null}),{kind:`registered`,runtimeGeneration:i}},async admitOperation(e){let t=N.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=z(t);if(n!==null)return n;let i=r(t,e,t.activeOperationId!==null&&t.activeOperationKey===e.admissionKey&&t.activeOperationAdmittedAt===null?v(new Date().toISOString()):``,t);if(i!==null)return i;let a=crypto.randomUUID(),o=v(new Date().toISOString());return N.set(t.executionAttemptId,{...t,activeOperationId:a,activeOperationKind:e.operationKind,activeOperationKey:e.admissionKey,activeOperationGeneration:t.runtimeGeneration,activeOperationAdmittedAt:o}),{kind:`admitted`,operationId:a,runtimeGeneration:t.runtimeGeneration,admittedAt:o}},async getInstruction(e){let t=N.get(e.executionAttemptId);return t?.executionId===e.executionId?t.instruction:null},async reportOperation(e){let t=A(e.result),n=N.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=s({matchesExecution:!0,settled:n.settlementKind!=null,active:L.get(e.executionId)===e.executionAttemptId,allocated:n.allocationRef!==null&&!F(e.executionAttemptId)},n,n,{...e,result:t});if(r!==null)return r;let i=C([...n.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return N.set(e.executionAttemptId,{...n,preparationReceipts:i,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`accepted`,binding:t.binding}},async completeOperation(e){let t=N.get(e.executionAttemptId);if(t===void 0)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};let n=u(t,e);return n===null?(N.set(t.executionAttemptId,{...t,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`completed`}):n},async markRuntimeReady(e){let t=v(e.readyAt),n=N.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=z(n)??i(n,e);return r===null?(N.set(n.executionAttemptId,{...n,runtimeReadyAt:t}),{kind:`ready`,acceptedAt:t}):r},async getAttemptControlState(e){let t=N.get(e);return t===void 0?null:x(t)},async getActiveAttempt(e,t){return L.get(e)===t?N.get(t)??null:null},canonicalizeOutcome(e){return t(j,e)},decodeOutcome(e){return d(j,e)},async commitOutcome(e){let t=e.result;if(L.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let n=N.get(e.executionAttemptId);if(n===void 0)return{kind:`fenced`};let r=I.get(e.executionAttemptId);if(r!==void 0){let e=d(j,r);return f(r,t.text)?{kind:`duplicate`,outcome:e,text:r}:{kind:`conflict`}}if(n.settlementKind!=null)return{kind:`conflict`};l(n,e.runtimeFence),I.set(e.executionAttemptId,t.text),N.set(e.executionAttemptId,K(n,`outcome`));let i=P.get(e.executionAttemptId);return i&&V(i,i.lastFailure),{kind:`accepted`,outcome:d(j,t.text),text:t.text}},async abandonPendingAttempt(e,t){if(L.get(t)!==e)return{kind:`fenced`};let n=N.get(e);return n?n.status===`allocated`?{kind:`allocated`}:n.status===`provisioning`?{kind:`provisioning`}:n.status===`settled`?{kind:n.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:(N.set(e,K(n,`abandoned`)),{kind:`abandoned`}):{kind:`fenced`}},recovery:U,attempts:N,operations:P,committedOutcomes:I,activeAttempts:L,requestBindings:R}}export{k as INITIAL_ATTEMPT_CONTROL_STATE,U as TEST_OWNER_ID,R as TEST_PROVIDER_ID,V as TEST_PROVISIONER_INCARNATION_ID,F as allocateTestAttempt,j as beginTestProvisioning,q as createInMemoryAttemptRepository,z as driveTestAttemptToAllocated,H as leaseAt,M as makeBeginProvisioningInput,I as makeEvidence,W as makeProcessLossProof,N as makeTestAllocationRef,P as makeTestInstruction,B as makeTestWorkflowResult,L as workflowRunResultOutcomeCodec};
@@ -1,4 +1,4 @@
1
- import { C as ExecutionAttemptRepository, P as OutcomeCodec } from "../../execution-attempt-repository-CgB7uiYD.mjs";
1
+ import { C as ExecutionAttemptRepository, P as OutcomeCodec } from "../../execution-attempt-repository-CPk3F98N.mjs";
2
2
  import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
3
3
 
4
4
  //#region subsystems/workflow-engine/src/testing/sqlite-attempt-repository.d.ts
@@ -1,4 +1,4 @@
1
- import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as ee,p as te,r as u,s as d,t as f,u as p}from"../../execution-attempt-repository-D0cCU7dI.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as m}from"../provider-operation.mjs";import{a as h,c as ne,d as re,f as ie,i as g,l as _,m as v,o as y,r as b,s as ae,t as x,u as S}from"../../attempt-record-codec-B32Whx75.mjs";import{BoundedRecoveryEvidenceSchema as C,ExecutionAttemptOperationKindSchema as w,ProviderAllocationRefSchema as T,WorkerAllocationLifetimeSchema as E}from"@makaio/framework/contracts";import{getRawSqlExecutor as oe,isSqliteUniqueViolationError as se,serializeByKey as D,serializeDatabaseOperation as ce}from"@makaio/framework/storage/drizzle";import{sql as O}from"drizzle-orm";const k=[`CREATE TABLE IF NOT EXISTS test_execution_attempt (
1
+ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o as te,p as ne,r as l,s as u,t as d,u as f}from"../../execution-attempt-repository-D0cCU7dI.mjs";import{a as re,i as ie,n as ae,o as p,t as oe}from"../../execution-attempt-owner-recovery-BRjtmTGv.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as m}from"../provider-operation.mjs";import{a as h,c as g,d as se,i as _,l as v,o as y,p as b,r as x,s as ce,t as le,u as ue}from"../../attempt-record-codec-BcAPEIW3.mjs";import{BoundedRecoveryEvidenceSchema as S,ExecutionAttemptOperationKindSchema as C,ProviderAllocationRefSchema as w,WorkerAllocationLifetimeSchema as T}from"@makaio/framework/contracts";import{getRawSqlExecutor as de,isSqliteUniqueViolationError as E,serializeByKey as D,serializeDatabaseOperation as O}from"@makaio/framework/storage/drizzle";import{sql as k}from"drizzle-orm";const A=[`CREATE TABLE IF NOT EXISTS test_execution_attempt (
2
2
  execution_attempt_id TEXT PRIMARY KEY,
3
3
  execution_id TEXT NOT NULL,
4
4
  instruction TEXT NOT NULL,
@@ -28,6 +28,12 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
28
28
  execution_id TEXT PRIMARY KEY,
29
29
  execution_attempt_id TEXT NOT NULL
30
30
  REFERENCES test_execution_attempt(execution_attempt_id)
31
+ )`,`CREATE TABLE IF NOT EXISTS test_execution_attempt_request (
32
+ execution_id TEXT NOT NULL,
33
+ request_key TEXT NOT NULL,
34
+ execution_attempt_id TEXT NOT NULL
35
+ REFERENCES test_execution_attempt(execution_attempt_id),
36
+ PRIMARY KEY (execution_id, request_key)
31
37
  )`,`CREATE TABLE IF NOT EXISTS test_provider_operation (
32
38
  execution_attempt_id TEXT PRIMARY KEY
33
39
  REFERENCES test_execution_attempt(execution_attempt_id),
@@ -38,50 +44,63 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
38
44
  obligation TEXT NOT NULL,
39
45
  failure_count INTEGER NOT NULL DEFAULT 0,
40
46
  last_failure TEXT
41
- )`];function A(e,t,n){let r=e.find(e=>e===t);if(r===void 0)throw Error(`Stored '${n}' value '${t}' is not part of the port's vocabulary`);return r}function j(e,t){return e===null?null:t(JSON.parse(e))}function M(e){return{runtimeGeneration:e.runtime_generation,runtimeIncarnationId:e.runtime_incarnation_id,runtimeReadyAt:e.runtime_ready_at,operationStartGate:A(f,e.operation_start_gate,`operation_start_gate`),activeOperationId:e.active_operation_id,activeOperationKind:e.active_operation_kind===null?null:w.parse(e.active_operation_kind),activeOperationKey:e.active_operation_key,activeOperationGeneration:e.active_operation_generation,activeOperationAdmittedAt:e.active_operation_admitted_at,lastCompletedOperationId:e.last_completed_operation_id}}function N(e){return{...M(e),executionAttemptId:e.execution_attempt_id,executionId:e.execution_id,instruction:_(JSON.parse(e.instruction)),preparationReceipts:S(JSON.parse(e.preparation_receipts)),status:A(o,e.status,`status`),allocationRef:j(e.allocation_ref,e=>T.parse(e)),createdAt:e.created_at,bootstrapDeadlineAt:e.bootstrap_deadline_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:E.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:A(u,e.settlement_kind,`settlement_kind`),claimable:e.claimable!==0,claimExpiresAt:e.claim_expires_at}}function P(e){return{executionAttemptId:e.execution_attempt_id,generation:e.generation,ownerId:e.owner_id,token:e.token,leaseExpiresAt:e.lease_expires_at,obligation:A(m,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:j(e.last_failure,e=>C.parse(e))}}const F=new Map,I=new Map;function L(e){if(typeof e!=`object`||!e)return!1;let t=e,n=typeof t.message==`string`?t.message:``;return n.includes(`SQLITE_BUSY`)||n.startsWith(`Failed query: BEGIN IMMEDIATE`)||n.startsWith(`Failed query: COMMIT`)||L(t.cause)}function R(e){if(typeof e!=`object`||!e)return!1;let t=e;return(typeof t.message==`string`?t.message:``).includes(`no transaction is active`)||R(t.cause)}async function z(){await new Promise(e=>setImmediate(e))}async function B(e){for(let t=0;;t+=1)try{await e.run(O.raw(`COMMIT`));return}catch(e){if(!L(e)||t===100)throw e;await z()}}async function V(e,t){return D(F,e,t)}async function le(e,t){return D(I,e,t)}const H=new WeakMap;async function ue(e,t){let n=(await t.all(O.raw(`PRAGMA database_list`))).find(e=>e.name===`main`)?.file??null;if(n!==null&&n!==``)return`file:${n}`;let r=H.get(e);if(r!==void 0)return r;let i=`connection:${crypto.randomUUID()}`;return H.set(e,i),i}async function U(e,t){let n=await e();if(typeof n!=`function`)return n;if((await n()).rowsAffected>0)return t;let r=await e();if(typeof r!=`function`)return r;throw Error(`A guarded transition affected no rows while durable state still permitted it`)}function W(e){return O`EXISTS (SELECT 1 FROM test_provider_operation
47
+ )`];function j(e,t,n){let r=e.find(e=>e===t);if(r===void 0)throw Error(`Stored '${n}' value '${t}' is not part of the port's vocabulary`);return r}function M(e,t){return e===null?null:t(JSON.parse(e))}function N(e){return{runtimeGeneration:e.runtime_generation,runtimeIncarnationId:e.runtime_incarnation_id,runtimeReadyAt:e.runtime_ready_at,operationStartGate:j(d,e.operation_start_gate,`operation_start_gate`),activeOperationId:e.active_operation_id,activeOperationKind:e.active_operation_kind===null?null:C.parse(e.active_operation_kind),activeOperationKey:e.active_operation_key,activeOperationGeneration:e.active_operation_generation,activeOperationAdmittedAt:e.active_operation_admitted_at,lastCompletedOperationId:e.last_completed_operation_id}}function P(e){return{...N(e),executionAttemptId:e.execution_attempt_id,executionId:e.execution_id,instruction:p(JSON.parse(e.instruction)),preparationReceipts:v(JSON.parse(e.preparation_receipts)),status:j(o,e.status,`status`),allocationRef:M(e.allocation_ref,e=>w.parse(e)),createdAt:e.created_at,bootstrapDeadlineAt:e.bootstrap_deadline_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:T.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:j(l,e.settlement_kind,`settlement_kind`),claimable:e.claimable!==0,claimExpiresAt:e.claim_expires_at}}function fe(e){return{executionAttemptId:e.execution_attempt_id,generation:e.generation,ownerId:e.owner_id,token:e.token,leaseExpiresAt:e.lease_expires_at,obligation:j(m,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:M(e.last_failure,e=>S.parse(e))}}const F=new Map,I=new Map;function L(e){if(typeof e!=`object`||!e)return!1;let t=e,n=typeof t.message==`string`?t.message:``;return n.includes(`SQLITE_BUSY`)||n.startsWith(`Failed query: BEGIN IMMEDIATE`)||n.startsWith(`Failed query: COMMIT`)||L(t.cause)}function R(e){if(typeof e!=`object`||!e)return!1;let t=e;return(typeof t.message==`string`?t.message:``).includes(`no transaction is active`)||R(t.cause)}async function z(){await new Promise(e=>setImmediate(e))}async function B(e){for(let t=0;;t+=1)try{await e.run(k.raw(`COMMIT`));return}catch(e){if(!L(e)||t===100)throw e;await z()}}async function pe(e,t){return D(F,e,t)}async function me(e,t){return D(I,e,t)}const V=new WeakMap;async function he(e,t){let n=(await t.all(k.raw(`PRAGMA database_list`))).find(e=>e.name===`main`)?.file??null;if(n!==null&&n!==``)return`file:${n}`;let r=V.get(e);if(r!==void 0)return r;let i=`connection:${crypto.randomUUID()}`;return V.set(e,i),i}async function H(e,t){let n=await e();if(typeof n!=`function`)return n;if((await n()).rowsAffected>0)return t;let r=await e();if(typeof r!=`function`)return r;throw Error(`A guarded transition affected no rows while durable state still permitted it`)}function U(e){return k`EXISTS (SELECT 1 FROM test_provider_operation
42
48
  WHERE execution_attempt_id = ${e.executionAttemptId}
43
49
  AND generation = ${e.generation}
44
50
  AND owner_id = ${e.ownerId}
45
- AND token = ${e.token})`}function G(e){return O`EXISTS (SELECT 1 FROM test_execution_attempt
46
- WHERE execution_attempt_id = ${e} AND settlement_kind IS NULL)`}function K(e){return O`${W(e)} AND ${G(e.executionAttemptId)}`}function q(e){return O`EXISTS (SELECT 1 FROM test_provider_operation
51
+ AND token = ${e.token})`}function W(e){return k`EXISTS (SELECT 1 FROM test_execution_attempt
52
+ WHERE execution_attempt_id = ${e} AND settlement_kind IS NULL)`}function G(e){return k`${U(e)} AND ${W(e.executionAttemptId)}`}function K(e){return k`EXISTS (SELECT 1 FROM test_provider_operation
47
53
  WHERE execution_attempt_id = ${e}
48
- AND obligation = ${`terminal-convergence`})`}function J(){return O`EXISTS (SELECT 1 FROM test_active_execution_attempt
54
+ AND obligation = ${`terminal-convergence`})`}function q(){return k`EXISTS (SELECT 1 FROM test_active_execution_attempt
49
55
  WHERE execution_id = test_execution_attempt.execution_id
50
- AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function Y(o,u){let w=oe(o);await w.run(O.raw(`PRAGMA busy_timeout = 0`));let T=await ue(o,w);await V(T,async()=>{for(let e of k)await w.run(O.raw(e));(await w.all(O.raw(`PRAGMA table_info(test_execution_attempt)`))).some(e=>e.name===`bootstrap_deadline_at`)||await w.run(O.raw(`ALTER TABLE test_execution_attempt ADD COLUMN bootstrap_deadline_at TEXT`))});let E,D=async e=>ce(o,()=>le(T,async()=>{if(E!==void 0)throw Error(`This repository was retired by a failed transaction rollback`,{cause:E});for(let t=0;;t+=1)try{return await w.withSession(async t=>{let n=!1;try{await t.run(O.raw(`BEGIN IMMEDIATE`)),n=!0;let r=await e(t);return await B(t),r}catch(e){try{await t.run(O.raw(`ROLLBACK`))}catch(t){throw!n&&R(t)?e:(E=AggregateError([e,t],`Transaction rollback failed`),E)}throw e}})}catch(e){if(!L(e)||t===100)throw e;await z()}})),j=async(e,t)=>(await e.all(O`SELECT * FROM test_execution_attempt WHERE execution_attempt_id = ${t}`))[0],F=async(e,t)=>(await e.all(O`SELECT * FROM test_provider_operation WHERE execution_attempt_id = ${t}`))[0],I=async(e,t)=>(await F(e,t))?.obligation===`terminal-convergence`,H=async(e,t)=>(await e.all(O`SELECT execution_attempt_id FROM test_active_execution_attempt WHERE execution_id = ${t}`))[0]?.execution_attempt_id??null,Y=async(e,t)=>{let r=t.settlement_kind!==null,i=!r&&await H(e,t.execution_id)===t.execution_attempt_id;return n({matchesExecution:!0,settled:r,active:i,allocated:i&&t.allocation_ref!==null&&!await I(e,t.execution_attempt_id)})},X=async(e,t)=>{let n=await j(e,t.executionAttemptId),r=await F(e,t.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};let i=N(n);return i.settlementKind==null?r.token===null||r.token!==t.token||r.generation!==t.generation||r.owner_id!==t.ownerId?{kind:`stale`,attempt:i}:{kind:`authorized`,attempt:i,attemptRow:n,operation:r}:{kind:`resolved`,attempt:i}},Z=async(e,t)=>{let n=await X(e,t);return n.kind===`authorized`?void 0:{kind:n.kind}},Q=async(e,t,n,r,i)=>{let a=await e.run(O`UPDATE test_execution_attempt
56
+ AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function J(o,l){let C=de(o);await C.run(k.raw(`PRAGMA busy_timeout = 0`));let w=await he(o,C);await pe(w,async()=>{for(let e of A)await C.run(k.raw(e));(await C.all(k.raw(`PRAGMA table_info(test_execution_attempt)`))).some(e=>e.name===`bootstrap_deadline_at`)||await C.run(k.raw(`ALTER TABLE test_execution_attempt ADD COLUMN bootstrap_deadline_at TEXT`))});let T,D=async e=>O(o,()=>me(w,async()=>{if(T!==void 0)throw Error(`This repository was retired by a failed transaction rollback`,{cause:T});for(let t=0;;t+=1)try{return await C.withSession(async t=>{let n=!1;try{await t.run(k.raw(`BEGIN IMMEDIATE`)),n=!0;let r=await e(t);return await B(t),r}catch(e){try{await t.run(k.raw(`ROLLBACK`))}catch(t){throw!n&&R(t)?e:(T=AggregateError([e,t],`Transaction rollback failed`),T)}throw e}})}catch(e){if(!L(e)||t===100)throw e;await z()}})),M=async(e,t)=>(await e.all(k`SELECT * FROM test_execution_attempt WHERE execution_attempt_id = ${t}`))[0],F=async(e,t)=>(await e.all(k`SELECT * FROM test_provider_operation WHERE execution_attempt_id = ${t}`))[0],I=async(e,t)=>(await F(e,t))?.obligation===`terminal-convergence`,V=async(e,t)=>(await e.all(k`SELECT execution_attempt_id FROM test_active_execution_attempt WHERE execution_id = ${t}`))[0]?.execution_attempt_id??null,J=async(e,t)=>{let r=t.settlement_kind!==null,i=!r&&await V(e,t.execution_id)===t.execution_attempt_id;return n({matchesExecution:!0,settled:r,active:i,allocated:i&&t.allocation_ref!==null&&!await I(e,t.execution_attempt_id)})},Y=async(e,t)=>{let n=await M(e,t.executionAttemptId),r=await F(e,t.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};let i=P(n);return i.settlementKind==null?r.token===null||r.token!==t.token||r.generation!==t.generation||r.owner_id!==t.ownerId?{kind:`stale`,attempt:i}:{kind:`authorized`,attempt:i,attemptRow:n,operation:r}:{kind:`resolved`,attempt:i}},X=async(e,t)=>{let n=await Y(e,t);return n.kind===`authorized`?void 0:{kind:n.kind}},Z=async(e,t,n,r,i)=>{let a=await e.run(k`UPDATE test_execution_attempt
51
57
  SET status = ${`settled`}, settlement_kind = ${n}, claimable = ${0},
52
58
  operation_start_gate = ${`closed`}
53
59
  WHERE execution_attempt_id = ${t}
54
60
  AND settlement_kind IS NULL
55
- AND ${r}`);return a.rowsAffected===0||await e.run(i===void 0?O`UPDATE test_provider_operation
61
+ AND ${r}`);return a.rowsAffected===0||await e.run(i===void 0?k`UPDATE test_provider_operation
56
62
  SET owner_id = NULL, token = NULL, lease_expires_at = NULL
57
- WHERE execution_attempt_id = ${t}`:O`UPDATE test_provider_operation
63
+ WHERE execution_attempt_id = ${t}`:k`UPDATE test_provider_operation
58
64
  SET owner_id = NULL, token = NULL, lease_expires_at = NULL, last_failure = ${JSON.stringify(i)}
59
- WHERE execution_attempt_id = ${t}`),a},$=(e,t)=>{let n=ae(e.allocationRef),r=t?O`CASE WHEN ${J()} THEN 1 ELSE 0 END`:O`${0}`;return D(t=>U(async()=>{let i=await X(t,e.claim);if(i.kind!==`not-found`&&ie(i.attempt,n),i.kind===`resolved`)return{kind:`resolved`,allocationRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i;return a.allocationRef===null?async()=>{let i=await t.run(O`UPDATE test_execution_attempt
65
+ WHERE execution_attempt_id = ${t}`),a},Q=(e,t)=>{let n=ce(e.allocationRef),r=t?k`CASE WHEN ${q()} THEN 1 ELSE 0 END`:k`${0}`;return D(t=>H(async()=>{let i=await Y(t,e.claim);if(i.kind!==`not-found`&&se(i.attempt,n),i.kind===`resolved`)return{kind:`resolved`,allocationRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i;return a.allocationRef===null?async()=>{let i=await t.run(k`UPDATE test_execution_attempt
60
66
  SET status = ${`allocated`},
61
67
  allocation_ref = ${JSON.stringify(n)},
62
68
  claimable = ${r}
63
69
  WHERE execution_attempt_id = ${a.executionAttemptId}
64
70
  AND allocation_ref IS NULL
65
- AND ${K(e.claim)}`);return i.rowsAffected===0||await t.run(O`UPDATE test_provider_operation SET obligation = ${`allocation-control`}
66
- WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:s(a.allocationRef,n)?{kind:`duplicate`,allocationRef:a.allocationRef}:{kind:`conflict`,allocationRef:a.allocationRef}},{kind:`recorded`}))};return{async createAttempt(e){let t=_(e.instruction),{createdAt:n,bootstrapDeadlineAt:r}=b(e.bootstrapTimeoutMs);return D(async i=>{try{await i.run(O`INSERT INTO test_execution_attempt
71
+ AND ${G(e.claim)}`);return i.rowsAffected===0||await t.run(k`UPDATE test_provider_operation SET obligation = ${`allocation-control`}
72
+ WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:s(a.allocationRef,n)?{kind:`duplicate`,allocationRef:a.allocationRef}:{kind:`conflict`,allocationRef:a.allocationRef}},{kind:`recorded`}))},ge={async getAttemptWithAllocation(e){return D(async t=>{let n=await M(t,e);return n===void 0?null:P(n)})},async recordDiscoveredAllocation(e){return Q(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=g(e);return D(r=>H(async()=>{let i=await Y(r,e.claim);if(i.kind===`stale`)return{kind:`stale`,storedRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a,attemptRow:o}=i;return a.executionId===e.executionId?a.allocationRef===null?{kind:`not-allocated`}:s(a.allocationRef,t)?()=>r.run(k`UPDATE test_execution_attempt SET allocation_ref = ${JSON.stringify(n)}
73
+ WHERE execution_attempt_id = ${a.executionAttemptId}
74
+ AND execution_id = ${e.executionId}
75
+ AND allocation_ref = ${o.allocation_ref}
76
+ AND ${G(e.claim)}`):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return D(async t=>{let n=new Date().toISOString();return(await t.all(k`SELECT * FROM test_execution_attempt
77
+ WHERE execution_id = ${e}
78
+ AND status = ${`allocated`}
79
+ AND settlement_kind IS NULL
80
+ AND allocation_ref IS NOT NULL
81
+ AND claimable = ${1}
82
+ AND (claim_expires_at IS NULL OR claim_expires_at >= ${n})
83
+ ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>b(P(e)))})}},$=async(e,t,n)=>{let{instruction:r}=t,{createdAt:i,bootstrapDeadlineAt:a}=n;try{await e.run(k`INSERT INTO test_execution_attempt
67
84
  (execution_attempt_id, execution_id, instruction, status, claimable, created_at, bootstrap_deadline_at)
68
- VALUES (${e.executionAttemptId}, ${e.executionId}, ${JSON.stringify(t)}, ${`pending`}, ${0}, ${n}, ${r})`)}catch(t){throw se(t)?new l(e.executionAttemptId,{cause:t}):t}return await i.run(O`UPDATE test_execution_attempt
85
+ VALUES (${t.executionAttemptId}, ${t.executionId}, ${JSON.stringify(r)}, ${`pending`}, ${0}, ${i}, ${a})`)}catch(e){throw E(e)?new ee(t.executionAttemptId,{cause:e}):e}return await e.run(k`UPDATE test_execution_attempt
69
86
  SET claimable = ${0}
70
87
  WHERE execution_attempt_id = (
71
88
  SELECT execution_attempt_id
72
89
  FROM test_active_execution_attempt
73
- WHERE execution_id = ${e.executionId}
90
+ WHERE execution_id = ${t.executionId}
74
91
  )
75
- AND status = ${`allocated`}`),await i.run(O`UPDATE test_execution_attempt
92
+ AND status = ${`allocated`}`),await e.run(k`UPDATE test_execution_attempt
76
93
  SET operation_start_gate = ${`closed`}
77
94
  WHERE execution_attempt_id = (
78
95
  SELECT execution_attempt_id
79
96
  FROM test_active_execution_attempt
80
- WHERE execution_id = ${e.executionId}
81
- )`),await i.run(O`INSERT INTO test_active_execution_attempt (execution_id, execution_attempt_id)
82
- VALUES (${e.executionId}, ${e.executionAttemptId})
97
+ WHERE execution_id = ${t.executionId}
98
+ )`),await e.run(k`INSERT INTO test_active_execution_attempt (execution_id, execution_attempt_id)
99
+ VALUES (${t.executionId}, ${t.executionAttemptId})
83
100
  ON CONFLICT(execution_id)
84
- DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...x,executionAttemptId:e.executionAttemptId,executionId:e.executionId,instruction:t,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,createdAt:n,bootstrapDeadlineAt:r,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null}})},async readBootstrapStartState(e){return D(async t=>{let n=await j(t,e.executionAttemptId);return n===void 0||n.execution_id!==e.executionId?null:{settled:n.settlement_kind!==null,active:await H(t,e.executionId)===e.executionAttemptId,allocated:n.allocation_ref!==null,allocationTerminated:await I(t,e.executionAttemptId),operationStartGate:A(f,n.operation_start_gate,`operation_start_gate`),bootstrapDeadlineAt:n.bootstrap_deadline_at}})},async beginProvisioning(e){let t=y(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:h(e.leaseExpiresAt)};return D(r=>U(async()=>{let i=await j(r,e.executionAttemptId);if(i===void 0||i.execution_id!==e.executionId)return{kind:`not-found`};let a=N(i);return await H(r,e.executionId)===e.executionAttemptId?a.settlementKind==null?a.allocationRef===null?a.status===`pending`?async()=>{let i=await r.run(O`UPDATE test_execution_attempt
101
+ DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...le,executionAttemptId:t.executionAttemptId,executionId:t.executionId,instruction:r,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,createdAt:i,bootstrapDeadlineAt:a,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null}};return{async createAttempt(e){let t={...e,instruction:p(e.instruction)},n=x(e.bootstrapTimeoutMs);return D(e=>$(e,t,n))},async ensureAttempt(e){let t=ie(e);return D(async e=>{let n=(await e.all(k`SELECT execution_attempt_id FROM test_execution_attempt_request
102
+ WHERE execution_id = ${t.executionId} AND request_key = ${t.requestKey}`))[0];if(n!==void 0){let r=await M(e,n.execution_attempt_id);return ae(t,r===void 0?null:P(r))}let r=await $(e,t,x(t.bootstrapTimeoutMs));return await e.run(k`INSERT INTO test_execution_attempt_request (execution_id, request_key, execution_attempt_id)
103
+ VALUES (${t.executionId}, ${t.requestKey}, ${r.executionAttemptId})`),{kind:`created`,attempt:structuredClone(r)}})},async readAttemptSettlement(e){let t=re(e);return D(async e=>{let n=await M(e,t.executionAttemptId);return n===void 0||n.execution_id!==t.executionId?{kind:`not-found`}:oe(t,{attempt:P(n),activeAttemptId:await V(e,t.executionId),outcomeText:n.workflow_result},l)})},async readBootstrapStartState(e){return D(async t=>{let n=await M(t,e.executionAttemptId);return n===void 0||n.execution_id!==e.executionId?null:{settled:n.settlement_kind!==null,active:await V(t,e.executionId)===e.executionAttemptId,allocated:n.allocation_ref!==null,allocationTerminated:await I(t,e.executionAttemptId),operationStartGate:j(d,n.operation_start_gate,`operation_start_gate`),bootstrapDeadlineAt:n.bootstrap_deadline_at}})},async beginProvisioning(e){let t=y(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:h(e.leaseExpiresAt)};return D(r=>H(async()=>{let i=await M(r,e.executionAttemptId);if(i===void 0||i.execution_id!==e.executionId)return{kind:`not-found`};let a=P(i);return await V(r,e.executionId)===e.executionAttemptId?a.settlementKind==null?a.allocationRef===null?a.status===`pending`?async()=>{let i=await r.run(k`UPDATE test_execution_attempt
85
104
  SET status = ${`provisioning`},
86
105
  provider_id = ${e.providerId},
87
106
  allocation_lifetime = ${t},
@@ -91,42 +110,42 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
91
110
  AND status = ${`pending`}
92
111
  AND allocation_ref IS NULL
93
112
  AND settlement_kind IS NULL
94
- AND ${J()}`);return i.rowsAffected===0||await r.run(O`INSERT INTO test_provider_operation
113
+ AND ${q()}`);return i.rowsAffected===0||await r.run(k`INSERT INTO test_provider_operation
95
114
  (execution_attempt_id, generation, owner_id, token, lease_expires_at, obligation, failure_count)
96
115
  VALUES (${e.executionAttemptId}, ${n.generation}, ${n.ownerId}, ${n.token},
97
- ${n.leaseExpiresAt}, ${`provisioning-resolution`}, ${0})`),i}:{kind:`already-provisioning`}:{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`resolved`,allocationRef:a.allocationRef}:{kind:`fenced`}},{kind:`started`,claim:n}))},async getProviderOperation(e){return D(async t=>{let n=await F(t,e);return n===void 0?null:P(n)})},async renewProviderOperationClaim(e){let t=h(e.leaseExpiresAt);return D(n=>U(async()=>await Z(n,e.claim)??(()=>n.run(O`UPDATE test_provider_operation SET lease_expires_at = ${t}
116
+ ${n.leaseExpiresAt}, ${`provisioning-resolution`}, ${0})`),i}:{kind:`already-provisioning`}:{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`resolved`,allocationRef:a.allocationRef}:{kind:`fenced`}},{kind:`started`,claim:n}))},async getProviderOperation(e){return D(async t=>{let n=await F(t,e);return n===void 0?null:fe(n)})},async renewProviderOperationClaim(e){let t=h(e.leaseExpiresAt);return D(n=>H(async()=>await X(n,e.claim)??(()=>n.run(k`UPDATE test_provider_operation SET lease_expires_at = ${t}
98
117
  WHERE execution_attempt_id = ${e.claim.executionAttemptId}
99
- AND ${K(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return D(async t=>{let n=await j(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};if(r.owner_id!==null&&r.lease_expires_at!==null&&g(r.lease_expires_at)>g(e.observedAt))return{kind:`stale`};let i={executionAttemptId:e.executionAttemptId,generation:r.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:h(e.leaseExpiresAt)},{rowsAffected:a}=await t.run(O`UPDATE test_provider_operation
118
+ AND ${G(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return D(async t=>{let n=await M(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};if(r.owner_id!==null&&r.lease_expires_at!==null&&_(r.lease_expires_at)>_(e.observedAt))return{kind:`stale`};let i={executionAttemptId:e.executionAttemptId,generation:r.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:h(e.leaseExpiresAt)},{rowsAffected:a}=await t.run(k`UPDATE test_provider_operation
100
119
  SET generation = ${i.generation}, owner_id = ${i.ownerId}, token = ${i.token},
101
120
  lease_expires_at = ${i.leaseExpiresAt}
102
121
  WHERE execution_attempt_id = ${e.executionAttemptId}
103
122
  AND generation = ${r.generation}
104
- AND ${G(e.executionAttemptId)}`);return a===0?{kind:`stale`}:{kind:`claimed`,claim:i}})},async handoffProviderOperation(e){let t=e.evidence===void 0?null:C.parse(e.evidence);return D(n=>U(async()=>await Z(n,e.claim)??(()=>n.run(t===null?O`UPDATE test_provider_operation
123
+ AND ${W(e.executionAttemptId)}`);return a===0?{kind:`stale`}:{kind:`claimed`,claim:i}})},async handoffProviderOperation(e){let t=e.evidence===void 0?null:S.parse(e.evidence);return D(n=>H(async()=>await X(n,e.claim)??(()=>n.run(t===null?k`UPDATE test_provider_operation
105
124
  SET owner_id = NULL, token = NULL, lease_expires_at = NULL
106
125
  WHERE execution_attempt_id = ${e.claim.executionAttemptId}
107
- AND ${K(e.claim)}`:O`UPDATE test_provider_operation
126
+ AND ${G(e.claim)}`:k`UPDATE test_provider_operation
108
127
  SET owner_id = NULL, token = NULL, lease_expires_at = NULL,
109
128
  last_failure = ${JSON.stringify(t)}
110
129
  WHERE execution_attempt_id = ${e.claim.executionAttemptId}
111
- AND ${K(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=C.parse(e.evidence);return D(n=>U(async()=>await Z(n,e.claim)??(()=>n.run(O`UPDATE test_provider_operation
130
+ AND ${G(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=S.parse(e.evidence);return D(n=>H(async()=>await X(n,e.claim)??(()=>n.run(k`UPDATE test_provider_operation
112
131
  SET failure_count = failure_count + 1, last_failure = ${JSON.stringify(t)}
113
132
  WHERE execution_attempt_id = ${e.claim.executionAttemptId}
114
- AND ${K(e.claim)}`)),{kind:`recorded`}))},async recordAllocation(e){return $(e,!0)},async recordProvisioningAbsent(e){let t=C.parse(e.evidence);return D(n=>U(async()=>{let r=await X(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?()=>Q(n,i.executionAttemptId,`abandoned`,O`execution_id = ${e.executionId}
133
+ AND ${G(e.claim)}`)),{kind:`recorded`}))},async recordAllocation(e){return Q(e,!0)},async recordProvisioningAbsent(e){let t=S.parse(e.evidence);return D(n=>H(async()=>{let r=await Y(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?()=>Z(n,i.executionAttemptId,`abandoned`,k`execution_id = ${e.executionId}
115
134
  AND allocation_ref IS NULL
116
- AND ${W(e.claim)}`,t):{kind:`allocated`,allocationRef:i.allocationRef}:{kind:`not-found`}},{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=C.parse(e.proof.evidence);return D(n=>U(async()=>{let r=await X(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r,o=a(i,e);return o===null?()=>Q(n,i.executionAttemptId,`abandoned`,O`execution_id = ${e.executionId}
135
+ AND ${U(e.claim)}`,t):{kind:`allocated`,allocationRef:i.allocationRef}:{kind:`not-found`}},{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=S.parse(e.proof.evidence);return D(n=>H(async()=>{let r=await Y(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r,o=a(i,e);return o===null?()=>Z(n,i.executionAttemptId,`abandoned`,k`execution_id = ${e.executionId}
117
136
  AND allocation_ref IS NULL
118
137
  AND allocation_lifetime = ${`provisioner-process-bound`}
119
138
  AND provisioner_incarnation_id = ${e.proof.provisionerIncarnationId}
120
- AND ${W(e.claim)}`,t):o},{kind:`recorded`}))},async recordAllocationTerminated(e){let t=C.parse(e.evidence);return D(n=>U(async()=>{let r=await X(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.allocationRef===null?{kind:`not-allocated`}:()=>n.run(O`UPDATE test_provider_operation
139
+ AND ${U(e.claim)}`,t):o},{kind:`recorded`}))},async recordAllocationTerminated(e){let t=S.parse(e.evidence);return D(n=>H(async()=>{let r=await Y(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.allocationRef===null?{kind:`not-allocated`}:()=>n.run(k`UPDATE test_provider_operation
121
140
  SET obligation = ${`terminal-convergence`}, last_failure = ${JSON.stringify(t)}
122
141
  WHERE execution_attempt_id = ${i.executionAttemptId}
123
- AND ${K(e.claim)}
142
+ AND ${G(e.claim)}
124
143
  AND EXISTS (SELECT 1 FROM test_execution_attempt
125
144
  WHERE execution_attempt_id = ${i.executionAttemptId}
126
- AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return D(t=>U(async()=>{let n=await X(t,e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?{kind:`not-allocated`}:A(m,i.obligation,`obligation`)===`terminal-convergence`?()=>Q(t,r.executionAttemptId,`infrastructure-failure`,O`execution_id = ${e.executionId}
145
+ AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return D(t=>H(async()=>{let n=await Y(t,e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?{kind:`not-allocated`}:j(m,i.obligation,`obligation`)===`terminal-convergence`?()=>Z(t,r.executionAttemptId,`infrastructure-failure`,k`execution_id = ${e.executionId}
127
146
  AND allocation_ref IS NOT NULL
128
- AND ${q(r.executionAttemptId)}
129
- AND ${W(e.claim)}`):{kind:`not-terminated`}:{kind:`not-found`}},{kind:`recorded`}))},async registerRuntime(t){return D(async n=>{let r=0,i=await U(async()=>{let i=await j(n,t.executionAttemptId);if(i===void 0||i.execution_id!==t.executionId)return{kind:`not-found`};let a=await Y(n,i);if(a!==null)return a;let o=M(i),s=e(o,t);return s===null?(r=o.runtimeGeneration+1,()=>n.run(O`UPDATE test_execution_attempt
147
+ AND ${K(r.executionAttemptId)}
148
+ AND ${U(e.claim)}`):{kind:`not-terminated`}:{kind:`not-found`}},{kind:`recorded`}))},async registerRuntime(t){return D(async n=>{let r=0,i=await H(async()=>{let i=await M(n,t.executionAttemptId);if(i===void 0||i.execution_id!==t.executionId)return{kind:`not-found`};let a=await J(n,i);if(a!==null)return a;let o=N(i),s=e(o,t);return s===null?(r=o.runtimeGeneration+1,()=>n.run(k`UPDATE test_execution_attempt
130
149
  SET runtime_generation = ${r},
131
150
  runtime_incarnation_id = ${t.runtimeIncarnationId},
132
151
  runtime_ready_at = NULL,
@@ -141,8 +160,8 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
141
160
  AND settlement_kind IS NULL
142
161
  AND (active_operation_id IS NULL OR active_operation_kind = ${`runtime-probe`})
143
162
  AND allocation_ref IS NOT NULL
144
- AND NOT ${q(t.executionAttemptId)}
145
- AND ${J()}`)):s},{kind:`applied`});return i.kind===`applied`?{kind:`registered`,runtimeGeneration:r}:i})},async admitOperation(e){let t=crypto.randomUUID(),n=h(new Date().toISOString()),i=e.operationKind===`runtime-probe`?O`1 = 1`:O`runtime_ready_at IS NOT NULL`;return D(a=>U(async()=>{let o=await j(a,e.executionAttemptId);if(o===void 0||o.execution_id!==e.executionId)return{kind:`not-found`};let s=await Y(a,o);if(s!==null)return s;let c=r(M(o),e,n,N(o));return c===null?()=>a.run(O`UPDATE test_execution_attempt
163
+ AND NOT ${K(t.executionAttemptId)}
164
+ AND ${q()}`)):s},{kind:`applied`});return i.kind===`applied`?{kind:`registered`,runtimeGeneration:r}:i})},async admitOperation(e){let t=crypto.randomUUID(),n=h(new Date().toISOString()),i=e.operationKind===`runtime-probe`?k`1 = 1`:k`runtime_ready_at IS NOT NULL`;return D(a=>H(async()=>{let o=await M(a,e.executionAttemptId);if(o===void 0||o.execution_id!==e.executionId)return{kind:`not-found`};let s=await J(a,o);if(s!==null)return s;let c=r(N(o),e,n,P(o));return c===null?()=>a.run(k`UPDATE test_execution_attempt
146
165
  SET active_operation_id = ${t},
147
166
  active_operation_kind = ${e.operationKind},
148
167
  active_operation_key = ${e.admissionKey},
@@ -157,9 +176,9 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
157
176
  AND preparation_receipts = ${o.preparation_receipts}
158
177
  AND settlement_kind IS NULL
159
178
  AND allocation_ref IS NOT NULL
160
- AND NOT ${q(e.executionAttemptId)}
179
+ AND NOT ${K(e.executionAttemptId)}
161
180
  AND ${i}
162
- AND ${J()}`):c},{kind:`admitted`,operationId:t,runtimeGeneration:e.runtimeGeneration,admittedAt:n}))},async getInstruction(e){return D(async t=>{let n=await j(t,e.executionAttemptId);return n?.execution_id===e.executionId?_(JSON.parse(n.instruction)):null})},async reportOperation(e){let t=re(e.result);return D(n=>U(async()=>{let r=await j(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let i=N(r),a=c({matchesExecution:!0,settled:r.settlement_kind!==null,active:await H(n,e.executionId)===e.executionAttemptId,allocated:r.allocation_ref!==null&&!await I(n,e.executionAttemptId)},i,i,{...e,result:t});if(a!==null)return a;let o=S([...i.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return()=>n.run(O`UPDATE test_execution_attempt
181
+ AND ${q()}`):c},{kind:`admitted`,operationId:t,runtimeGeneration:e.runtimeGeneration,admittedAt:n}))},async getInstruction(e){return D(async t=>{let n=await M(t,e.executionAttemptId);return n?.execution_id===e.executionId?p(JSON.parse(n.instruction)):null})},async reportOperation(e){let t=ue(e.result);return D(n=>H(async()=>{let r=await M(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let i=P(r),a=c({matchesExecution:!0,settled:r.settlement_kind!==null,active:await V(n,e.executionId)===e.executionAttemptId,allocated:r.allocation_ref!==null&&!await I(n,e.executionAttemptId)},i,i,{...e,result:t});if(a!==null)return a;let o=v([...i.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return()=>n.run(k`UPDATE test_execution_attempt
163
182
  SET preparation_receipts = ${JSON.stringify(o)},
164
183
  active_operation_id = NULL,
165
184
  active_operation_kind = NULL,
@@ -177,8 +196,8 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
177
196
  AND instruction = ${r.instruction}
178
197
  AND preparation_receipts = ${r.preparation_receipts}
179
198
  AND allocation_ref IS NOT NULL
180
- AND NOT ${q(e.executionAttemptId)}
181
- AND ${J()}`)},{kind:`accepted`,binding:t.binding}))},async completeOperation(e){return D(t=>U(async()=>{let n=await j(t,e.executionAttemptId);if(n===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};let r=te(M(n),e);return r===null?()=>t.run(O`UPDATE test_execution_attempt
199
+ AND NOT ${K(e.executionAttemptId)}
200
+ AND ${q()}`)},{kind:`accepted`,binding:t.binding}))},async completeOperation(e){return D(t=>H(async()=>{let n=await M(t,e.executionAttemptId);if(n===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};let r=ne(N(n),e);return r===null?()=>t.run(k`UPDATE test_execution_attempt
182
201
  SET active_operation_id = NULL,
183
202
  active_operation_kind = NULL,
184
203
  active_operation_key = NULL,
@@ -189,7 +208,7 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
189
208
  AND settlement_kind IS NULL
190
209
  AND active_operation_id = ${e.operationId}
191
210
  AND active_operation_kind IN (${`runtime-probe`}, ${`workflow-run`})
192
- AND active_operation_generation = ${e.runtimeGeneration}`):r},{kind:`completed`}))},async markRuntimeReady(e){let t=h(e.readyAt);return D(n=>U(async()=>{let r=await j(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let a=await Y(n,r);if(a!==null)return a;let o=i(M(r),e);return o===null?()=>n.run(O`UPDATE test_execution_attempt SET runtime_ready_at = ${t}
211
+ AND active_operation_generation = ${e.runtimeGeneration}`):r},{kind:`completed`}))},async markRuntimeReady(e){let t=h(e.readyAt);return D(n=>H(async()=>{let r=await M(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let a=await J(n,r);if(a!==null)return a;let o=i(N(r),e);return o===null?()=>n.run(k`UPDATE test_execution_attempt SET runtime_ready_at = ${t}
193
212
  WHERE execution_attempt_id = ${e.executionAttemptId}
194
213
  AND execution_id = ${e.executionId}
195
214
  AND settlement_kind IS NULL
@@ -197,31 +216,20 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o a
197
216
  AND runtime_ready_at IS NULL
198
217
  AND active_operation_id IS NULL
199
218
  AND allocation_ref IS NOT NULL
200
- AND NOT ${q(e.executionAttemptId)}
201
- AND ${J()}`):o},{kind:`ready`,acceptedAt:t}))},async getAttemptControlState(e){return D(async t=>{let n=await j(t,e);return n===void 0?null:M(n)})},async getActiveAttempt(e,t){return D(async n=>{if(await H(n,e)!==t)return null;let r=await j(n,t);return r===void 0?null:N(r)})},canonicalizeOutcome(e){return t(u,e)},decodeOutcome(e){return d(u,e)},async commitOutcome(e){let t=e.result,n=e.runtimeFence,r=n===void 0?O`1 = 1`:O`
219
+ AND NOT ${K(e.executionAttemptId)}
220
+ AND ${q()}`):o},{kind:`ready`,acceptedAt:t}))},async getAttemptControlState(e){return D(async t=>{let n=await M(t,e);return n===void 0?null:N(n)})},async getActiveAttempt(e,t){return D(async n=>{if(await V(n,e)!==t)return null;let r=await M(n,t);return r===void 0?null:P(r)})},canonicalizeOutcome(e){return t(l,e)},decodeOutcome(e){return u(l,e)},async commitOutcome(e){let t=e.result,n=e.runtimeFence,r=n===void 0?k`1 = 1`:k`
202
221
  runtime_generation = ${n.runtimeGeneration}
203
- AND ${n.operationId===null?O`active_operation_id IS NULL`:O`active_operation_id = ${n.operationId}
204
- AND active_operation_generation = ${n.runtimeGeneration}`}`;return D(i=>U(async()=>{if(await H(i,e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let a=await j(i,e.executionAttemptId);if(a===void 0)return{kind:`fenced`};let o=a.workflow_result;if(o!==null){let e=d(u,o);return p(o,t.text)?{kind:`duplicate`,outcome:e,text:o}:{kind:`conflict`}}return a.settlement_kind===null?(n!==void 0&&ee(M(a),n),async()=>{let n=await i.run(O`UPDATE test_execution_attempt SET workflow_result = ${t.text}
222
+ AND ${n.operationId===null?k`active_operation_id IS NULL`:k`active_operation_id = ${n.operationId}
223
+ AND active_operation_generation = ${n.runtimeGeneration}`}`;return D(i=>H(async()=>{if(await V(i,e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let a=await M(i,e.executionAttemptId);if(a===void 0)return{kind:`fenced`};let o=a.workflow_result;if(o!==null){let e=u(l,o);return f(o,t.text)?{kind:`duplicate`,outcome:e,text:o}:{kind:`conflict`}}return a.settlement_kind===null?(n!==void 0&&te(N(a),n),async()=>{let n=await i.run(k`UPDATE test_execution_attempt SET workflow_result = ${t.text}
205
224
  WHERE execution_attempt_id = ${e.executionAttemptId}
206
225
  AND workflow_result IS NULL
207
226
  AND settlement_kind IS NULL
208
227
  AND ${r}
209
- AND ${J()}`);return n.rowsAffected===0?n:Q(i,e.executionAttemptId,`outcome`,O`workflow_result IS NOT NULL`)}):{kind:`conflict`}},{kind:`accepted`,outcome:d(u,t.text),text:t.text}))},async abandonPendingAttempt(e,t){return D(n=>U(async()=>{if(await H(n,t)!==e)return{kind:`fenced`};let r=await j(n,e);if(r===void 0)return{kind:`fenced`};let i=N(r);return i.status===`allocated`?{kind:`allocated`}:i.status===`provisioning`?{kind:`provisioning`}:i.status===`settled`?{kind:i.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:()=>n.run(O`UPDATE test_execution_attempt
228
+ AND ${q()}`);return n.rowsAffected===0?n:Z(i,e.executionAttemptId,`outcome`,k`workflow_result IS NOT NULL`)}):{kind:`conflict`}},{kind:`accepted`,outcome:u(l,t.text),text:t.text}))},async abandonPendingAttempt(e,t){return D(n=>H(async()=>{if(await V(n,t)!==e)return{kind:`fenced`};let r=await M(n,e);if(r===void 0)return{kind:`fenced`};let i=P(r);return i.status===`allocated`?{kind:`allocated`}:i.status===`provisioning`?{kind:`provisioning`}:i.status===`settled`?{kind:i.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:()=>n.run(k`UPDATE test_execution_attempt
210
229
  SET status = ${`settled`}, settlement_kind = ${`abandoned`}, claimable = ${0},
211
230
  operation_start_gate = ${`closed`}
212
231
  WHERE execution_attempt_id = ${e}
213
232
  AND execution_id = ${t}
214
233
  AND status = ${`pending`}
215
234
  AND settlement_kind IS NULL
216
- AND ${J()}`)},{kind:`abandoned`}))},recovery:{async getAttemptWithAllocation(e){return D(async t=>{let n=await j(t,e);return n===void 0?null:N(n)})},async recordDiscoveredAllocation(e){return $(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=ne(e);return D(r=>U(async()=>{let i=await X(r,e.claim);if(i.kind===`stale`)return{kind:`stale`,storedRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a,attemptRow:o}=i;return a.executionId===e.executionId?a.allocationRef===null?{kind:`not-allocated`}:s(a.allocationRef,t)?()=>r.run(O`UPDATE test_execution_attempt SET allocation_ref = ${JSON.stringify(n)}
217
- WHERE execution_attempt_id = ${a.executionAttemptId}
218
- AND execution_id = ${e.executionId}
219
- AND allocation_ref = ${o.allocation_ref}
220
- AND ${K(e.claim)}`):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return D(async t=>{let n=new Date().toISOString();return(await t.all(O`SELECT * FROM test_execution_attempt
221
- WHERE execution_id = ${e}
222
- AND status = ${`allocated`}
223
- AND settlement_kind IS NULL
224
- AND allocation_ref IS NOT NULL
225
- AND claimable = ${1}
226
- AND (claim_expires_at IS NULL OR claim_expires_at >= ${n})
227
- ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>v(N(e)))})}}}}export{Y as createSqliteAttemptRepository};
235
+ AND ${q()}`)},{kind:`abandoned`}))},recovery:ge}}export{J as createSqliteAttemptRepository};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makaio/framework",
3
- "version": "1.0.0-dev-1788832451167",
3
+ "version": "1.0.0-dev-1788863979610",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/makaio-ai/makaio-framework.git",
@@ -1 +0,0 @@
1
- import{z as e}from"zod";import{ExecutionAttemptInstructionSchema as t,ExecutionAttemptPreparationResultSchema as n,ProviderAllocationRefSchema as r,WorkerAllocationLifetimeSchema as i}from"@makaio/framework/contracts";function a(e){let t=Date.parse(e);if(Number.isNaN(t))throw Error(`Expected an ISO-8601 timestamp, received '${e}'`);return t}function o(e){return new Date(a(e)).toISOString()}function s(e){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`bootstrapTimeoutMs must be a positive safe integer`);let t=Date.now(),n=t+e;if(!Number.isSafeInteger(n)||!Number.isFinite(new Date(n).getTime()))throw RangeError(`bootstrapTimeoutMs produces an unrepresentable bootstrap deadline`);return{createdAt:new Date(t).toISOString(),bootstrapDeadlineAt:new Date(n).toISOString()}}function c(e){return typeof e==`object`&&!!e}function l(e){if(!(!c(e)||Object.isFrozen(e))){Object.freeze(e);for(let t of Object.values(e))l(t)}}function u(e,t){let n=t(structuredClone(e));return l(n),n}function d(e){return u(e,e=>t.parse(e))}function f(e){return u(e,e=>n.parse(e))}const p=e.array(e.object({operationId:e.string().min(1),runtimeGeneration:e.number().int().positive(),result:n}).strict());function m(e){return u(e,e=>p.parse(e))}function h(e){return u(e,e=>r.parse(e))}function g(e){return i.parse(e)}function _(e){let t=r.parse(e.currentRef),n=h(e.nextRef);if(t.providerId!==n.providerId)throw Error(`Allocation reference evolution must keep one provider, received '${t.providerId}' and '${n.providerId}'`);return{currentRef:t,nextRef:n}}function v(e,t){if(e.providerId!==t.providerId)throw Error(`Allocation reference for attempt '${e.executionAttemptId}' names provider '${t.providerId}' but the attempt is bound to '${e.providerId??`no provider`}'`)}const y={runtimeGeneration:0,runtimeIncarnationId:null,runtimeReadyAt:null,operationStartGate:`open`,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:null};function b(e){return{runtimeGeneration:e.runtimeGeneration,runtimeIncarnationId:e.runtimeIncarnationId,runtimeReadyAt:e.runtimeReadyAt,operationStartGate:e.operationStartGate,activeOperationId:e.activeOperationId,activeOperationKind:e.activeOperationKind,activeOperationKey:e.activeOperationKey,activeOperationGeneration:e.activeOperationGeneration,activeOperationAdmittedAt:e.activeOperationAdmittedAt,lastCompletedOperationId:e.lastCompletedOperationId}}function x(e,t){let n=a(e.createdAt)-a(t.createdAt);return n===0?e.executionAttemptId<t.executionAttemptId?-1:+(e.executionAttemptId>t.executionAttemptId):n}function S(e){let{status:t,claimable:n,settlementKind:r,allocationRef:i,providerId:a}=e,{allocationLifetime:o,provisionerIncarnationId:s}=e;if(t!==`allocated`||n!==!0||r!=null||i===null||a===null||o===null||s===null)throw Error(`Attempt '${e.executionAttemptId}' was selected as recoverable but is not: status '${t}', claimable '${String(n)}', settlement '${String(r)}', allocation '${i===null?`none`:`present`}', provider '${String(a)}', lifetime '${String(o)}', provisioner '${String(s)}'`);return{...e,status:t,claimable:!0,settlementKind:null,allocationRef:i,providerId:a,allocationLifetime:o,provisionerIncarnationId:s}}export{o as a,_ as c,f as d,v as f,a as i,d as l,S as m,x as n,g as o,b as p,s as r,h as s,y as t,m as u};
@@ -676,9 +676,9 @@ declare const WorkerSchemas$1: {
676
676
  }, z.core.$strict>;
677
677
  response: z.ZodObject<{
678
678
  decision: z.ZodEnum<{
679
- accepted: "accepted";
680
- duplicate: "duplicate";
681
679
  fenced: "fenced";
680
+ duplicate: "duplicate";
681
+ accepted: "accepted";
682
682
  conflict: "conflict";
683
683
  }>;
684
684
  }, z.core.$strict>;
@@ -1201,9 +1201,9 @@ declare const WorkerNamespace: _$_makaio_core0.BusNamespaceDefinition<"worker",
1201
1201
  }, _$zod_v4_core0.$strict>;
1202
1202
  response: _$zod.ZodObject<{
1203
1203
  decision: _$zod.ZodEnum<{
1204
- accepted: "accepted";
1205
- duplicate: "duplicate";
1206
1204
  fenced: "fenced";
1205
+ duplicate: "duplicate";
1206
+ accepted: "accepted";
1207
1207
  conflict: "conflict";
1208
1208
  }>;
1209
1209
  }, _$zod_v4_core0.$strict>;
@@ -1649,9 +1649,9 @@ declare const WorkerSubjects$1: _$_makaio_core0.BusSubjects<_$_makaio_core0.Flat
1649
1649
  }, _$zod_v4_core0.$strict>;
1650
1650
  response: _$zod.ZodObject<{
1651
1651
  decision: _$zod.ZodEnum<{
1652
- accepted: "accepted";
1653
- duplicate: "duplicate";
1654
1652
  fenced: "fenced";
1653
+ duplicate: "duplicate";
1654
+ accepted: "accepted";
1655
1655
  conflict: "conflict";
1656
1656
  }>;
1657
1657
  }, _$zod_v4_core0.$strict>;
File without changes