@makaio/framework 1.0.0-dev-1787670071418 → 1.0.0-dev-1787670559522

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 (527) hide show
  1. package/README.md +0 -2
  2. package/dist/.makaio-build.json +2 -2
  3. package/dist/{account-identity-B3vLwm9O.mjs → account-identity-DGpXd8h_.mjs} +1 -1
  4. package/dist/adapter-BkdJaOOG.mjs +1 -0
  5. package/dist/adapter-subsystem/index.d.mts +76 -118
  6. package/dist/adapter-subsystem/index.mjs +1 -1
  7. package/dist/adapters/claude/index.d.mts +5 -5
  8. package/dist/adapters/config/index.d.mts +1 -1
  9. package/dist/adapters/config/index.mjs +1 -1
  10. package/dist/adapters/index.d.mts +53 -73
  11. package/dist/adapters/index.mjs +6 -6
  12. package/dist/adapters/node.d.mts +1 -1
  13. package/dist/adapters/node.mjs +1 -1
  14. package/dist/adapters/stream-session/index.mjs +1 -1
  15. package/dist/agent-namespace-D51PODFf.mjs +1 -0
  16. package/dist/{artifact-Btbuib48.mjs → artifact-k3veR4Yx.mjs} +1 -1
  17. package/dist/attach-error-BSlc7JfL.mjs +1 -0
  18. package/dist/{auth-C6tVtaOX.mjs → auth-A1K_7q-8.mjs} +1 -1
  19. package/dist/{authority-state-bootstrap-CLYus369.mjs → authority-state-bootstrap-YwtEImIB.mjs} +1 -1
  20. package/dist/{automation-trigger-ByjNlClm.mjs → automation-trigger-CuSdQwir.mjs} +1 -1
  21. package/dist/bus/index.d.mts +4 -22
  22. package/dist/bus/index.mjs +1 -1
  23. package/dist/bus-BIj0_aG6.mjs +1 -0
  24. package/dist/{bus-D6NoBhIV.mjs → bus-CqgrphNE.mjs} +1 -1
  25. package/dist/{canonical-model-DXOvCaVg.mjs → canonical-model-DJASlL4m.mjs} +1 -1
  26. package/dist/capabilities-Bqckjh7G.mjs +1 -0
  27. package/dist/capability-service-CJHNkjvm.mjs +1 -0
  28. package/dist/{client-BkznbdsO.mjs → client-BL5__WT0.mjs} +1 -1
  29. package/dist/clients/index.d.mts +1 -1
  30. package/dist/clients/index.mjs +1 -1
  31. package/dist/clients/managed-install.d.mts +1 -1
  32. package/dist/clients/managed-install.mjs +1 -1
  33. package/dist/{compression-CtgeVLpP.mjs → compression-BbttSqm8.mjs} +1 -1
  34. package/dist/{config-namespace-CjWvw8ij.mjs → config-namespace-CyzeLWSg.mjs} +1 -1
  35. package/dist/{context-resolution-841T7jBI.d.mts → context-resolution-ya9TXKg-.d.mts} +1 -1
  36. package/dist/contracts/adapter/index.d.mts +3 -3
  37. package/dist/contracts/adapter/index.mjs +1 -1
  38. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  39. package/dist/contracts/artifact/index.d.mts +2 -2
  40. package/dist/contracts/artifact/index.mjs +1 -1
  41. package/dist/contracts/auth/index.d.mts +2 -2
  42. package/dist/contracts/auth/index.mjs +1 -1
  43. package/dist/contracts/automation-trigger/index.d.mts +3 -3
  44. package/dist/contracts/automation-trigger/index.mjs +1 -1
  45. package/dist/contracts/canonical-model/index.d.mts +1 -1
  46. package/dist/contracts/canonical-model/index.mjs +1 -1
  47. package/dist/contracts/capabilities/index.d.mts +1 -1
  48. package/dist/contracts/capabilities/index.mjs +1 -1
  49. package/dist/contracts/client/index.d.mts +2 -2
  50. package/dist/contracts/client/index.mjs +1 -1
  51. package/dist/contracts/common/index.d.mts +1 -1
  52. package/dist/contracts/config/index.d.mts +1 -1
  53. package/dist/contracts/config/index.mjs +1 -1
  54. package/dist/contracts/extension/index.d.mts +5 -5
  55. package/dist/contracts/extension/index.mjs +1 -1
  56. package/dist/contracts/facet/index.d.mts +1 -1
  57. package/dist/contracts/facet/index.mjs +1 -1
  58. package/dist/contracts/harness/index.d.mts +1 -1
  59. package/dist/contracts/harness/index.mjs +1 -1
  60. package/dist/contracts/host/index.d.mts +1 -1
  61. package/dist/contracts/host/index.mjs +1 -1
  62. package/dist/contracts/index.d.mts +47 -57
  63. package/dist/contracts/index.mjs +1 -1
  64. package/dist/contracts/materialization/index.d.mts +3 -3
  65. package/dist/contracts/materialization/index.mjs +1 -1
  66. package/dist/contracts/model-registry/index.d.mts +1 -1
  67. package/dist/contracts/model-registry/index.mjs +1 -1
  68. package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
  69. package/dist/contracts/native-session-supervisor/index.mjs +1 -1
  70. package/dist/contracts/platform/index.d.mts +1 -1
  71. package/dist/contracts/platform/index.mjs +1 -1
  72. package/dist/contracts/provider/index.d.mts +2 -2
  73. package/dist/contracts/provider/index.mjs +1 -1
  74. package/dist/contracts/reaction/index.d.mts +1 -1
  75. package/dist/contracts/reaction/index.mjs +1 -1
  76. package/dist/contracts/session/index.d.mts +3 -3
  77. package/dist/contracts/session/index.mjs +1 -1
  78. package/dist/contracts/shared/index.d.mts +3 -3
  79. package/dist/contracts/shared/index.mjs +1 -1
  80. package/dist/contracts/skill/index.d.mts +1 -1
  81. package/dist/contracts/skill/index.mjs +1 -1
  82. package/dist/contracts/telemetry/index.d.mts +1 -1
  83. package/dist/contracts/telemetry/index.mjs +1 -1
  84. package/dist/contracts/timeout/index.d.mts +1 -1
  85. package/dist/contracts/timeout/index.mjs +1 -1
  86. package/dist/contracts/toast/index.mjs +1 -1
  87. package/dist/contracts/variant/index.d.mts +1 -1
  88. package/dist/contracts/variant/index.mjs +1 -1
  89. package/dist/contracts/worker-node/index.d.mts +1 -1
  90. package/dist/contracts/worker-node/index.mjs +1 -1
  91. package/dist/contracts/workflow/index.d.mts +2 -2
  92. package/dist/contracts/workflow/index.mjs +1 -1
  93. package/dist/{contribution-CUHLVLsT.d.mts → contribution-BB5bjx3f.d.mts} +2 -2
  94. package/dist/core/index.d.mts +2 -25
  95. package/dist/{definition-DyGImhyi.d.mts → definition-BYgHlmMw.d.mts} +1 -1
  96. package/dist/{definition-BH4QLGLI.mjs → definition-CDg-Jq1T.mjs} +1 -1
  97. package/dist/{detached-extension-handle-D0aI0pJA.mjs → detached-extension-handle-DKd17UB6.mjs} +1 -1
  98. package/dist/drizzle/meta/_journal.json +0 -28
  99. package/dist/event-DR8U9Efx.mjs +1 -0
  100. package/dist/{execution-attempt-repository-BJ2W6wwx.d.mts → execution-attempt-repository-DFyAnchJ.d.mts} +1 -1
  101. package/dist/{execution-target-H0RWV7Py.mjs → execution-target-ByNwZh5-.mjs} +1 -1
  102. package/dist/{extension-Cz39YNXy.mjs → extension-DMdmj9gi.mjs} +1 -1
  103. package/dist/{extension-Bfkr2DBs.mjs → extension-DUmibvMk.mjs} +1 -1
  104. package/dist/{extension-discovery-Dhu3WplO.d.mts → extension-discovery-Fhps4icD.d.mts} +1 -9
  105. package/dist/{filesystem-service-CiUw0YN5.mjs → filesystem-service-FAtd9gWH.mjs} +1 -1
  106. package/dist/framework-packages-D_2hBZ-p.mjs +1 -0
  107. package/dist/git/index.mjs +2 -2
  108. package/dist/{globby-QBDqstzq.mjs → globby-BBLuT_vy.mjs} +1 -1
  109. package/dist/handlers-2yd00VEq.mjs +57 -0
  110. package/dist/{harness-YQ2ewID9.mjs → harness-KxbWGL4I.mjs} +1 -1
  111. package/dist/{hook-responses-9Ywsqzzq.d.mts → hook-responses-uCXAICTU.d.mts} +1 -1
  112. package/dist/identity-DC3Pk0ps.mjs +1 -0
  113. package/dist/{index-D-4jv_66.d.mts → index-1UcQWrZy.d.mts} +149 -149
  114. package/dist/{index-D8D-yibS2.d.mts → index-B0xJgTi-.d.mts} +4 -4
  115. package/dist/{index-CYjgoYeX.d.mts → index-BMVZs6pm.d.mts} +3 -3
  116. package/dist/{index-CPi0UpRh.d.mts → index-BSQ30wYP.d.mts} +1 -1
  117. package/dist/{index-DXtQRehh.d.mts → index-Bl7KWFod.d.mts} +1 -1
  118. package/dist/{index-D_4K3Tf_.d.mts → index-BtdK8HeH.d.mts} +168 -43
  119. package/dist/{index-C146Eq_J.d.mts → index-C-JzEkqs.d.mts} +1802 -536
  120. package/dist/{index-DI2lS7VT.d.mts → index-CER64zYO.d.mts} +15 -15
  121. package/dist/{index-BkbnC65b.d.mts → index-CM75k-Ff.d.mts} +17 -189
  122. package/dist/{index-CmwAJ8-5.d.mts → index-CSN_0sCo.d.mts} +1 -1
  123. package/dist/{index-CIEycZrt.d.mts → index-C__EQfKa.d.mts} +1 -1
  124. package/dist/{index-B0VO0rAl.d.mts → index-CfiCJPP6.d.mts} +1 -1
  125. package/dist/{index-BNzUyVwV.d.mts → index-CqQYgsbB.d.mts} +170 -513
  126. package/dist/{index-B0yMCJW8.d.mts → index-DI7-tIL3.d.mts} +14 -39
  127. package/dist/{index-CMekqu_D.d.mts → index-DxYDRoDE2.d.mts} +8 -28
  128. package/dist/index-OsbtyMgx2.d.mts +98 -0
  129. package/dist/{index-DJ2KgJDJ2.d.mts → index-cPqSpWQC.d.mts} +12 -12
  130. package/dist/{index-DNI6UF9h.d.mts → index-e4Txan9i.d.mts} +4 -4
  131. package/dist/{index-CPRQ4dWX.d.mts → index-nydhGvXa.d.mts} +23 -0
  132. package/dist/json-value-C1RGgS0a.d.mts +72 -0
  133. package/dist/json-value-D57aJhVn.mjs +1 -0
  134. package/dist/kernel/cli/index.d.mts +2 -2
  135. package/dist/kernel/cli/index.mjs +1 -1
  136. package/dist/kernel/cli/register.d.mts +1 -1
  137. package/dist/kernel/cli/register.mjs +1 -1
  138. package/dist/kernel/cli/schemas.mjs +1 -1
  139. package/dist/kernel/extension/index.d.mts +1 -1
  140. package/dist/kernel/extension/index.mjs +1 -1
  141. package/dist/kernel/index.d.mts +5 -5
  142. package/dist/kernel/index.mjs +1 -1
  143. package/dist/kernel/namespace/index.d.mts +1 -1
  144. package/dist/kernel/namespace/index.mjs +1 -1
  145. package/dist/kernel/observability/index.d.mts +1 -1
  146. package/dist/kernel/observability/index.mjs +1 -1
  147. package/dist/kernel/providers/index.d.mts +1 -1
  148. package/dist/kernel/providers/index.mjs +1 -1
  149. package/dist/kernel/window/index.d.mts +1 -1
  150. package/dist/kernel/window/index.mjs +1 -1
  151. package/dist/{lib-Cm-uEoC1.mjs → lib-B_rJ6r0T.mjs} +1 -1
  152. package/dist/{lib-BpGvHZye.mjs → lib-CnOAtohU.mjs} +2 -2
  153. package/dist/{load-extensions-DG5LvPyM.mjs → load-extensions-CW9uzNR5.mjs} +1 -1
  154. package/dist/{load-extensions-BQoXaHhR.d.mts → load-extensions-DUpaMQ7G.d.mts} +1 -1
  155. package/dist/{materialization-lVd9_-jr.mjs → materialization-CcpCDhXh.mjs} +1 -1
  156. package/dist/mcp-http-server/index.mjs +1 -1
  157. package/dist/model-ZH3L1dPW.mjs +1 -0
  158. package/dist/{namespace-BL7lHlmg.mjs → namespace-B7bntOB8.mjs} +1 -1
  159. package/dist/{namespace-BNp7n_gu.d.mts → namespace-BgEiY7r1.d.mts} +3 -3
  160. package/dist/{namespace-DknCutQZ.d.mts → namespace-C6CVEGH8.d.mts} +0 -50
  161. package/dist/{namespace-C06lJSuj.d.mts → namespace-ChnRTUG4.d.mts} +6 -6
  162. package/dist/namespace-CxrOLeeP.mjs +1 -0
  163. package/dist/{namespace-BRuHzhPo.d.mts → namespace-DSlfFhB1.d.mts} +2 -154
  164. package/dist/{native-session-supervisor-LKio8XZn.mjs → native-session-supervisor-fZYPUk0-.mjs} +1 -1
  165. package/dist/node/bus-server/index.d.mts +1 -1
  166. package/dist/node/bus-server/index.mjs +1 -1
  167. package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
  168. package/dist/node/bus-server/server-lifecycle.mjs +1 -1
  169. package/dist/{orchestrator-shared-CNHSImNY.d.mts → orchestrator-shared-B-KRW1Z0.d.mts} +10 -9
  170. package/dist/orchestrator-shared-CTCZc6Vl.mjs +1 -0
  171. package/dist/ownership-memory-handler-Bblp93YC.mjs +1 -0
  172. package/dist/{package-BNFTUFLB.d.mts → package-Bf3hyuzs.d.mts} +2 -2
  173. package/dist/{package-JtjbO-Oi.mjs → package-CddkNbZI.mjs} +1 -1
  174. package/dist/{package-B01gmu75.mjs → package-ypz4rKvn.mjs} +1 -1
  175. package/dist/package.json +1 -1
  176. package/dist/{profile-N5qGUpF0.mjs → profile-BtznZlq3.mjs} +1 -1
  177. package/dist/{provider-context-zTDSH2x9.mjs → provider-context-BrLZYnDW.mjs} +1 -1
  178. package/dist/{provider-context-CG42JlP9.mjs → provider-context-Dh-VOOYF.mjs} +1 -1
  179. package/dist/{reaction-D3TNwPK8.mjs → reaction-BS0k4eNN.mjs} +1 -1
  180. package/dist/{registry-Dk12tAfv.mjs → registry-BO_bOoky.mjs} +1 -1
  181. package/dist/{resolved-sq8RXNDf.mjs → resolved-DMByz1_2.mjs} +1 -1
  182. package/dist/rules/index.d.mts +1 -1
  183. package/dist/rules/index.mjs +1 -1
  184. package/dist/rules/schemas.d.mts +1 -1
  185. package/dist/runtime-bun/index.mjs +1 -1
  186. package/dist/runtime-node/extension-discovery.d.mts +2 -2
  187. package/dist/runtime-node/extension-discovery.mjs +1 -1
  188. package/dist/runtime-node/extension-validation.d.mts +1 -1
  189. package/dist/runtime-node/extension-validation.mjs +1 -1
  190. package/dist/runtime-node/index.d.mts +4 -6
  191. package/dist/runtime-node/index.mjs +24 -24
  192. package/dist/runtime-node/makaio-config.d.mts +1 -1
  193. package/dist/runtime-node/makaio-config.mjs +1 -1
  194. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  195. package/dist/runtime-node/workflow-worker/index.mjs +1 -1
  196. package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
  197. package/dist/{schema-Dq-7si8u.mjs → schema-DBG7Jq5_.mjs} +1 -1
  198. package/dist/{schema-B3Pf7JP7.d.mts → schema-DKTzriEY.d.mts} +3 -250
  199. package/dist/{schemas-C1mxTfd7.d.mts → schemas-B7zo7Zcx.d.mts} +4 -60
  200. package/dist/schemas-BqD8LlQw.mjs +1 -0
  201. package/dist/{schemas-QWDnauKX.mjs → schemas-CsjN7cmM.mjs} +1 -1
  202. package/dist/schemas-CvHFbzdy.mjs +1 -0
  203. package/dist/{schemas-BfO5jkrL.mjs → schemas-DSkBOdx_.mjs} +1 -1
  204. package/dist/{schemas-OWvBn7AH.d.mts → schemas-DZH9lpxs.d.mts} +4 -4
  205. package/dist/schemas-DplrlAyR.mjs +1 -0
  206. package/dist/{schemas-Dd13TMgU.d.mts → schemas-DvMbcABQ.d.mts} +4 -4
  207. package/dist/scoped-bus-ClwTWqX8.mjs +1 -0
  208. package/dist/{selection-DL3ric7K.mjs → selection-7Ku8DBnh.mjs} +1 -1
  209. package/dist/services/adapter-runtime/index.d.mts +4 -4
  210. package/dist/services/adapter-runtime/index.mjs +1 -1
  211. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  212. package/dist/services/adapter-runtime/schemas.d.mts +2 -2
  213. package/dist/services/adapter-runtime/schemas.mjs +1 -1
  214. package/dist/services/adapter-subsystem/index.d.mts +3 -3
  215. package/dist/services/adapter-subsystem/index.mjs +1 -1
  216. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  217. package/dist/services/adapter-subsystem/namespace.mjs +1 -1
  218. package/dist/services/agent-runtime/index.d.mts +2 -2
  219. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  220. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  221. package/dist/services/automation-trigger/index.mjs +1 -1
  222. package/dist/services/capability/index.d.mts +2 -3
  223. package/dist/services/capability/index.mjs +1 -1
  224. package/dist/services/codebase/index.d.mts +2 -2
  225. package/dist/services/codebase/namespace.d.mts +1 -1
  226. package/dist/services/codebase/schemas.d.mts +1 -1
  227. package/dist/services/compression/index.d.mts +2 -2
  228. package/dist/services/compression/namespace.d.mts +1 -1
  229. package/dist/services/compression/schemas.d.mts +1 -1
  230. package/dist/services/context-rules/index.d.mts +1 -1
  231. package/dist/services/context-rules/index.mjs +1 -1
  232. package/dist/services/execution-target/index.d.mts +3 -3
  233. package/dist/services/execution-target/index.mjs +1 -1
  234. package/dist/services/execution-target/namespace.d.mts +1 -1
  235. package/dist/services/execution-target/namespace.mjs +1 -1
  236. package/dist/services/execution-target/schemas.d.mts +1 -1
  237. package/dist/services/execution-target/schemas.mjs +1 -1
  238. package/dist/services/filesystem/index.d.mts +1 -1
  239. package/dist/services/filesystem/index.mjs +1 -1
  240. package/dist/services/filesystem/namespace.d.mts +6 -6
  241. package/dist/services/filesystem/schemas.d.mts +3 -3
  242. package/dist/services/git/namespace.d.mts +0 -18
  243. package/dist/services/git/namespace.mjs +1 -1
  244. package/dist/services/git/schemas.d.mts +1 -10
  245. package/dist/services/git/schemas.mjs +1 -1
  246. package/dist/services/harness/index.mjs +1 -1
  247. package/dist/services/index.d.mts +61 -161
  248. package/dist/services/index.mjs +1 -1
  249. package/dist/services/log-import/browser.d.mts +2 -2
  250. package/dist/services/log-import/index.d.mts +2 -2
  251. package/dist/services/log-import/log-import.d.mts +1 -1
  252. package/dist/services/log-import/log-import.mjs +1 -1
  253. package/dist/services/log-import/namespace.mjs +1 -1
  254. package/dist/services/log-import/schemas.mjs +1 -1
  255. package/dist/services/materialization/index.d.mts +1 -1
  256. package/dist/services/materialization/index.mjs +1 -1
  257. package/dist/services/model-registry/index.d.mts +1 -1
  258. package/dist/services/model-registry/index.mjs +1 -1
  259. package/dist/services/preferences/index.d.mts +2 -2
  260. package/dist/services/preferences/schemas.d.mts +1 -1
  261. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  262. package/dist/services/provider-context/index.d.mts +1 -1
  263. package/dist/services/provider-context/index.mjs +1 -1
  264. package/dist/services/provider-runtime/index.mjs +1 -1
  265. package/dist/services/session/handlers/index.d.mts +1 -1
  266. package/dist/services/session/handlers/index.mjs +1 -1
  267. package/dist/services/session/index.d.mts +10 -10
  268. package/dist/services/session/index.mjs +1 -1
  269. package/dist/services/session/messages/namespace.d.mts +1 -1
  270. package/dist/services/session/messages/namespace.mjs +1 -1
  271. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  272. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  273. package/dist/services/session/session-events/namespace.d.mts +1 -1
  274. package/dist/services/session/session-events/namespace.mjs +1 -1
  275. package/dist/services/session/storage/namespace.d.mts +1 -1
  276. package/dist/services/session/storage/schema.d.mts +2 -2
  277. package/dist/services/session/storage/schema.mjs +1 -1
  278. package/dist/services/session/testing/index.d.mts +1 -22
  279. package/dist/services/session/testing/index.mjs +14 -38
  280. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  281. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  282. package/dist/services/session/turns/namespace.d.mts +1 -1
  283. package/dist/services/session/turns/namespace.mjs +1 -1
  284. package/dist/services/session-editor/index.d.mts +1 -1
  285. package/dist/services/session-editor/index.mjs +1 -1
  286. package/dist/services/settings/index.d.mts +3 -3
  287. package/dist/services/settings/index.mjs +1 -1
  288. package/dist/services/settings/namespace.d.mts +4 -4
  289. package/dist/services/settings/namespace.mjs +1 -1
  290. package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
  291. package/dist/services/settings/storage/clients-namespace.mjs +1 -1
  292. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  293. package/dist/services/settings/storage/index.d.mts +3 -3
  294. package/dist/services/settings/storage/index.mjs +1 -1
  295. package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
  296. package/dist/services/settings/storage/providers-namespace.mjs +1 -1
  297. package/dist/services/subagent/index.d.mts +1 -1
  298. package/dist/services/subagent/index.mjs +1 -1
  299. package/dist/services/subagent-template/index.d.mts +2 -2
  300. package/dist/services/subagent-template/namespace.d.mts +1 -1
  301. package/dist/services/subagent-template/schemas.d.mts +1 -1
  302. package/dist/services/tool-approval/index.d.mts +1 -1
  303. package/dist/services/tool-approval/index.mjs +1 -1
  304. package/dist/services/tools/index.d.mts +1 -1
  305. package/dist/services/tools/index.mjs +1 -1
  306. package/dist/services/tray-menu/index.d.mts +3 -3
  307. package/dist/services/tray-menu/index.mjs +1 -1
  308. package/dist/services/tray-menu/namespace.d.mts +1 -1
  309. package/dist/services/tray-menu/schemas.d.mts +1 -1
  310. package/dist/services/turn/index.d.mts +1 -1
  311. package/dist/services/turn/namespace.d.mts +1 -1
  312. package/dist/services/workflow-transitions/index.d.mts +1 -1
  313. package/dist/services/workflow-transitions/index.mjs +1 -1
  314. package/dist/session-BMy2kRpX.mjs +90 -0
  315. package/dist/session-Cipx34j6.mjs +1 -0
  316. package/dist/{shared-B9AWRm9A.mjs → shared-BFVuCDPx.mjs} +1 -1
  317. package/dist/{skill-DGNtc_ww.mjs → skill-C1D51nhh.mjs} +1 -1
  318. package/dist/{src-BmSQ3rlz.mjs → src-xbmzokNe.mjs} +1 -1
  319. package/dist/storage/drizzle/client.d.mts +1 -1
  320. package/dist/storage/drizzle/client.mjs +1 -1
  321. package/dist/storage/drizzle/index.d.mts +2 -41
  322. package/dist/storage/drizzle/index.mjs +1 -1
  323. package/dist/storage/handlers/drizzle/index.d.mts +1 -1
  324. package/dist/storage/handlers/drizzle/index.mjs +1 -1
  325. package/dist/storage/handlers/index.d.mts +1 -1
  326. package/dist/storage/handlers/index.mjs +1 -1
  327. package/dist/tool-approval-service-BVgN9Q1r.mjs +1 -0
  328. package/dist/{tools-DWKWX3eV.mjs → tools-DxwHox1a.mjs} +1 -1
  329. package/dist/{transition-D3zUBTPc.d.mts → transition-C_Ka6b0-.d.mts} +6 -6
  330. package/dist/{types-CtDGkyLx2.d.mts → types-BNjPhj_a.d.mts} +1 -1
  331. package/dist/{types-OKJCOjme.d.mts → types-ClpEaoAm.d.mts} +4 -24
  332. package/dist/{types-DcxBYlPA.d.mts → types-CwvN4uN2.d.mts} +49 -3029
  333. package/dist/ui-kernel/index.d.mts +1 -1
  334. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  335. package/dist/utils/index.d.mts +1 -22
  336. package/dist/utils/index.mjs +2 -2
  337. package/dist/utils/project-manifest.mjs +1 -1
  338. package/dist/{version-BYeVh1pI.mjs → version-BfNnVAGr.mjs} +1 -1
  339. package/dist/{view-builder-B0j9p5C0.d.mts → view-builder-KYsPqV-5.d.mts} +4 -4
  340. package/dist/{visibility-DtDLRBdr.mjs → visibility-Dl1o2I01.mjs} +1 -1
  341. package/dist/worker-node-BDOYPEpi.mjs +1 -0
  342. package/dist/{worker-node-Dtf9ilsR.mjs → worker-node-DJ41Tr-F.mjs} +1 -1
  343. package/dist/workflow-Hzc5jlnV.mjs +1 -0
  344. package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
  345. package/dist/workflow-engine/index.d.mts +95 -95
  346. package/dist/workflow-engine/index.mjs +1 -1
  347. package/dist/workflow-engine/package.d.mts +1 -1
  348. package/dist/workflow-engine/package.mjs +1 -1
  349. package/dist/workflow-engine/provider-operation.d.mts +1 -1
  350. package/dist/workflow-engine/testing/index.d.mts +2 -2
  351. package/dist/workflow-engine/testing/index.mjs +1 -1
  352. package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
  353. package/dist/workflow-engine/testing/sqlite.mjs +1 -1
  354. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  355. package/dist/{workflow-transitions-c_VQbyV0.mjs → workflow-transitions-DM0fN_eP.mjs} +1 -1
  356. package/dist/workflow-worker-DARC7UZl.mjs +1 -0
  357. package/package.json +1 -18
  358. package/dist/adapter-Dz1fX5Wa.mjs +0 -1
  359. package/dist/attach-error-Cb3GbeKe.mjs +0 -1
  360. package/dist/bus-UgFdHybD.mjs +0 -1
  361. package/dist/caller-owned-adapter-stub-C1M7FKrv.mjs +0 -1
  362. package/dist/capabilities-BUwuA7XX.mjs +0 -1
  363. package/dist/capability-j3NekkIu.mjs +0 -1
  364. package/dist/code-execution/worker-entry.d.mts +0 -21
  365. package/dist/code-execution/worker-entry.mjs +0 -1
  366. package/dist/code-execution-Ckmn8OZu.mjs +0 -1
  367. package/dist/code-execution-CweDSWco.mjs +0 -1
  368. package/dist/code-execution-DqkQjKa1.mjs +0 -1
  369. package/dist/contracts/code-execution/index.d.mts +0 -2
  370. package/dist/contracts/code-execution/index.mjs +0 -1
  371. package/dist/drizzle/0034_m_msha1388.sql +0 -41
  372. package/dist/drizzle/0035_m_mshgj6x7.sql +0 -40
  373. package/dist/drizzle/0036_m_msivwbgm.sql +0 -1
  374. package/dist/drizzle/0037_runtime_instance_incarnation_counter.sql +0 -6
  375. package/dist/event-B8ELuk6k.mjs +0 -1
  376. package/dist/framework-packages-BHgul8Kl.mjs +0 -1
  377. package/dist/handlers-BsHAFtye.mjs +0 -57
  378. package/dist/identity-OjRlG6dZ.mjs +0 -1
  379. package/dist/index-Bqk0pJBQ2.d.mts +0 -138
  380. package/dist/index-Cny5RvjO.d.mts +0 -800
  381. package/dist/index-DHnSLGP4.d.mts +0 -268
  382. package/dist/index-DQ8o3JGi.d.mts +0 -132
  383. package/dist/index-DWBkiiXH.d.mts +0 -18
  384. package/dist/index-Dg11JxKZ.d.mts +0 -496
  385. package/dist/json-value-BBZ6uGwc.mjs +0 -1
  386. package/dist/json-value-DPqb-SJ8.d.mts +0 -177
  387. package/dist/model-DrzPt3ou.mjs +0 -1
  388. package/dist/namespace-sCPb79-7.mjs +0 -1
  389. package/dist/npm-package-name-DuTYVICk.mjs +0 -1
  390. package/dist/orchestrator-shared-BGlN-m-V.mjs +0 -1
  391. package/dist/ownership-memory-handler-BpGdR_uG.mjs +0 -1
  392. package/dist/ownership-recovery-guard-DyW5vGBr.mjs +0 -1
  393. package/dist/package-DttKA9wN.mjs +0 -1
  394. package/dist/runtime-node/code-execution/index.d.mts +0 -3
  395. package/dist/runtime-node/code-execution/index.mjs +0 -1
  396. package/dist/schemas-C3kyQWGf.mjs +0 -1
  397. package/dist/schemas-TK29KWx-.mjs +0 -1
  398. package/dist/schemas-_2Syo_01.mjs +0 -1
  399. package/dist/scoped-bus-DoPmCJeM.mjs +0 -1
  400. package/dist/services/code-execution/index.d.mts +0 -2
  401. package/dist/services/code-execution/index.mjs +0 -1
  402. package/dist/session-BOpTI79g.mjs +0 -1
  403. package/dist/session-CXOPk3yg.mjs +0 -95
  404. package/dist/tool-approval-service-BFDOFUGC.mjs +0 -1
  405. package/dist/types-Cwza95hS.mjs +0 -1
  406. package/dist/types-DnK6Wa_Y.d.mts +0 -260
  407. package/dist/worker-node-CjuQb9hl.mjs +0 -1
  408. package/dist/workflow-C4mck_NW.mjs +0 -1
  409. package/dist/workflow-worker-aNbdgqml.mjs +0 -1
  410. /package/dist/{adapter-auth-runtime-DHHppU4f.mjs → adapter-auth-runtime-D9Lnl7cc.mjs} +0 -0
  411. /package/dist/{adapter-binding-CATvmGuz.d.mts → adapter-binding-B-FBoCys.d.mts} +0 -0
  412. /package/dist/{ajv-krzJXh1X.mjs → ajv-L5fKxaia.mjs} +0 -0
  413. /package/dist/{attempt-record-codec-BYfYkj4M.mjs → attempt-record-codec-DaFLKR5C.mjs} +0 -0
  414. /package/dist/{await-trigger-Bkg2BQfg.mjs → await-trigger-ph1S0zVI.mjs} +0 -0
  415. /package/dist/{base-orchestrator-B4YW6z_Q.d.mts → base-orchestrator-D9u4NyiM.d.mts} +0 -0
  416. /package/dist/{client-BG0WX5Vz.d.mts → client-4ihewPUm.d.mts} +0 -0
  417. /package/dist/{client-binary-version-verifier-0lCKZOTg.mjs → client-binary-version-verifier-DJajc_Ff.mjs} +0 -0
  418. /package/dist/{client-binary-version-verifier-lcv83Hq3.d.mts → client-binary-version-verifier-jDDZ64Ah.d.mts} +0 -0
  419. /package/dist/{clients-namespace-DLAjOTTb.d.mts → clients-namespace-DFWuUawf.d.mts} +0 -0
  420. /package/dist/{config-namespace-CH7sJZ4f.d.mts → config-namespace-D1kyZj0B.d.mts} +0 -0
  421. /package/dist/{create-static-mount-DxuixuLZ.mjs → create-static-mount-9tnGpIeK.mjs} +0 -0
  422. /package/dist/{cross-spawn-CZygZJMH.mjs → cross-spawn-BIgueAqr.mjs} +0 -0
  423. /package/dist/{cursor-storage-bsc9lZKk.mjs → cursor-storage-ROWfiTh1.mjs} +0 -0
  424. /package/dist/{definition-BrgzUuFk.d.mts → definition-DB-kKc0d.d.mts} +0 -0
  425. /package/dist/{definitions-CRpdnHYM.mjs → definitions-CF6YmEhL.mjs} +0 -0
  426. /package/dist/{descriptor-to-package-CcjdoWP4.mjs → descriptor-to-package-BecVCopf.mjs} +0 -0
  427. /package/dist/{drizzle-Bzc-OGVI.mjs → drizzle-CPv3vdTE.mjs} +0 -0
  428. /package/dist/{esm-i-S5TW72.mjs → esm-CBFWM8u_.mjs} +0 -0
  429. /package/dist/{extension-context-QmFuHdq5.d.mts → extension-context-DzB7ydM3.d.mts} +0 -0
  430. /package/dist/{extension-namespace-QoTTwKPt.mjs → extension-namespace-B554RmCp.mjs} +0 -0
  431. /package/dist/{extension-package-provenance-aYrZuS4W.mjs → extension-package-provenance-Dh_-Z-tE.mjs} +0 -0
  432. /package/dist/{facet-BnMh7Jyc.mjs → facet-DVsW12iF.mjs} +0 -0
  433. /package/dist/{filesystem-service-ZJ43SbBi.d.mts → filesystem-service-Cm2RHKBa.d.mts} +0 -0
  434. /package/dist/{handler-DF1fVDpf.mjs → handler-Bqlk-6BY.mjs} +0 -0
  435. /package/dist/{host-B-_ntOMH.mjs → host-k5yoyKHg.mjs} +0 -0
  436. /package/dist/{index-8NdPPzUh2.d.mts → index--atUpi5l2.d.mts} +0 -0
  437. /package/dist/{index-Ek4y8M9J2.d.mts → index-42UdYStR.d.mts} +0 -0
  438. /package/dist/{index-C4V8Pmi4.d.mts → index-BJAB-BW_.d.mts} +0 -0
  439. /package/dist/{index-l01zsChf.d.mts → index-BJMezANn.d.mts} +0 -0
  440. /package/dist/{index-D037TVsm.d.mts → index-BQprJNA_.d.mts} +0 -0
  441. /package/dist/{index-B4svZC6L.d.mts → index-BRCrFirq.d.mts} +0 -0
  442. /package/dist/{index-jxPncqWZ2.d.mts → index-BSbGB23v.d.mts} +0 -0
  443. /package/dist/{index-BMRB9yhF.d.mts → index-BVcQcphK.d.mts} +0 -0
  444. /package/dist/{index-B2Y1Wvbh.d.mts → index-BcvqDfcN.d.mts} +0 -0
  445. /package/dist/{index-DgspOUa72.d.mts → index-BeENojSx2.d.mts} +0 -0
  446. /package/dist/{index-VzLAV0Yt.d.mts → index-Beo_Ik8-.d.mts} +0 -0
  447. /package/dist/{index-CqdMbYmR.d.mts → index-BgGe9WZz.d.mts} +0 -0
  448. /package/dist/{index-kzIjbrS02.d.mts → index-Bqm0ahTQ.d.mts} +0 -0
  449. /package/dist/{index-B-3I98nw.d.mts → index-C7HcDpHE.d.mts} +0 -0
  450. /package/dist/{index-pvX-BIpr2.d.mts → index-CK3f0bAL.d.mts} +0 -0
  451. /package/dist/{index-B5dP8rj6.d.mts → index-CQuRTeRa.d.mts} +0 -0
  452. /package/dist/{index-BC-6qNeo.d.mts → index-CRmE88hi.d.mts} +0 -0
  453. /package/dist/{index-CVpaGijY.d.mts → index-CvW9_SzR.d.mts} +0 -0
  454. /package/dist/{index-BFWvT0NG.d.mts → index-CxSSdIZz.d.mts} +0 -0
  455. /package/dist/{index-BmevAPME2.d.mts → index-DBadVauL.d.mts} +0 -0
  456. /package/dist/{index-BM56936c.d.mts → index-DP3o_13U.d.mts} +0 -0
  457. /package/dist/{index-BfV8U4XX.d.mts → index-DgOfgjx3.d.mts} +0 -0
  458. /package/dist/{index-8y4hT9WL.d.mts → index-DwLRZscE.d.mts} +0 -0
  459. /package/dist/{index-CmbkCxj-.d.mts → index-E4SET1AA.d.mts} +0 -0
  460. /package/dist/{index-BuMsrli0.d.mts → index-OADt3xlS.d.mts} +0 -0
  461. /package/dist/{capability-service-BW1-teFU.d.mts → index-Ol9RBB0W2.d.mts} +0 -0
  462. /package/dist/{index-CL0Jo1b92.d.mts → index-aoxdnhJ42.d.mts} +0 -0
  463. /package/dist/{index-BTEJfzjE.d.mts → index-bIe_57cL.d.mts} +0 -0
  464. /package/dist/{jsonl-transport-Cyyh5Wje.mjs → jsonl-transport-Bp_6pB2a.mjs} +0 -0
  465. /package/dist/{lib-BqV8hYtk.mjs → lib-Bwdd2m81.mjs} +0 -0
  466. /package/dist/{model-registry-Cixxx2jv.mjs → model-registry-Y854mUml.mjs} +0 -0
  467. /package/dist/{model-registry-C9rFu3kV.mjs → model-registry-yURX738J.mjs} +0 -0
  468. /package/dist/{modes-DwsJ3yVl.mjs → modes-DmUsjHdV.mjs} +0 -0
  469. /package/dist/{namespace-jVTsuZHX.mjs → namespace-B9FEGuEu.mjs} +0 -0
  470. /package/dist/{namespace-NXm_zvL1.mjs → namespace-BFqkUTJp.mjs} +0 -0
  471. /package/dist/{namespace-BUYDmd0r.d.mts → namespace-Bi3CmYQy.d.mts} +0 -0
  472. /package/dist/{namespace-CVFaZv8x.d.mts → namespace-BusZERU8.d.mts} +0 -0
  473. /package/dist/{namespace-B0ftHlK3.d.mts → namespace-ByP1Iipi.d.mts} +0 -0
  474. /package/dist/{namespace-BGRHcrmp.d.mts → namespace-C1D77w7U.d.mts} +0 -0
  475. /package/dist/{namespace-Du0accdE.mjs → namespace-CFjdyNXG.mjs} +0 -0
  476. /package/dist/{namespace-DiwqpB-c.mjs → namespace-CfIW0hpQ.mjs} +0 -0
  477. /package/dist/{namespace-BW3Bfu9h.mjs → namespace-CkBbNFSU.mjs} +0 -0
  478. /package/dist/{namespace-DOezqDti.d.mts → namespace-CrDlawqu.d.mts} +0 -0
  479. /package/dist/{namespace-BdAK0lD8.d.mts → namespace-DX1Ec15L.d.mts} +0 -0
  480. /package/dist/{namespace-tjoxekmf.mjs → namespace-DbNWsPFY.mjs} +0 -0
  481. /package/dist/{namespace-CPG6u60N.d.mts → namespace-Dgg0uoe6.d.mts} +0 -0
  482. /package/dist/{namespace-l-HG1rLF.d.mts → namespace-DwZwGXgF.d.mts} +0 -0
  483. /package/dist/{namespace-DqZweTbX.d.mts → namespace-s2y_NFKf.d.mts} +0 -0
  484. /package/dist/{namespace-DBO1OzYB.d.mts → namespace-yREpGJgG.d.mts} +0 -0
  485. /package/dist/{out-8bOYN6EF.mjs → out-DrhwCgqM.mjs} +0 -0
  486. /package/dist/{package-EGTn-Ng1.mjs → package-CBdvjyyZ.mjs} +0 -0
  487. /package/dist/{packages-Bp124-gx.mjs → packages-FBv3fAOR.mjs} +0 -0
  488. /package/dist/{packages-CxPMEg8D.d.mts → packages-N3-2Kl-Y.d.mts} +0 -0
  489. /package/dist/{platform-CxyYPrkf.mjs → platform-BrsMv_S3.mjs} +0 -0
  490. /package/dist/{provider-operation-DbdyFwNm.d.mts → provider-operation-DJ_TLZFf.d.mts} +0 -0
  491. /package/dist/{providers-C-eekMxD.mjs → providers-CCcn4Ndp.mjs} +0 -0
  492. /package/dist/{providers-namespace-CfZKp-C0.d.mts → providers-namespace-DeJBh6MP.d.mts} +0 -0
  493. /package/dist/{quick-lru-CCEnf7y6.mjs → quick-lru-uwB0hP-y.mjs} +0 -0
  494. /package/dist/{schema-introspection-6-r_KEJQ.mjs → schema-introspection-C1wvklj9.mjs} +0 -0
  495. /package/dist/{schema-C0opCPww.mjs → schema-jIapW8Kb.mjs} +0 -0
  496. /package/dist/{schemas-BXc9qOpl.d.mts → schemas-B3bfVYcL.d.mts} +0 -0
  497. /package/dist/{schemas-BivbWRkG.mjs → schemas-BNdiVBWh.mjs} +0 -0
  498. /package/dist/{schemas-B6Q-qdmn.d.mts → schemas-CD0wOQxx.d.mts} +0 -0
  499. /package/dist/{schemas-B50oWBuj.d.mts → schemas-CeUI2i5j.d.mts} +0 -0
  500. /package/dist/{schemas-ChmQldVH.d.mts → schemas-Cg-Kwp8c.d.mts} +0 -0
  501. /package/dist/{schemas-Pe892GgN.d.mts → schemas-Cv3rR9Sz.d.mts} +0 -0
  502. /package/dist/{schemas-B8hKbBwI.mjs → schemas-DgwEVUt-.mjs} +0 -0
  503. /package/dist/{schemas-D7ScxLrf.d.mts → schemas-VbB1FTxx.d.mts} +0 -0
  504. /package/dist/{schemas-scyC2tFF.mjs → schemas-mLpOfMoN.mjs} +0 -0
  505. /package/dist/{schemas-bfZNpl0B.d.mts → schemas-qA279_j_.d.mts} +0 -0
  506. /package/dist/{schemas-BGvkTiCx.d.mts → schemas-sMoRnBdZ.d.mts} +0 -0
  507. /package/dist/{semver-BI7kTNsY.mjs → semver-DTXuyLcK.mjs} +0 -0
  508. /package/dist/{server-lifecycle-L8zja8t8.d.mts → server-lifecycle-C_8iKgat.d.mts} +0 -0
  509. /package/dist/{server-lifecycle-B_OZnoe-.mjs → server-lifecycle-DKx_fWlq.mjs} +0 -0
  510. /package/dist/{session-lineage-bUkd3fqx.d.mts → session-lineage-D5E142LU.d.mts} +0 -0
  511. /package/dist/{shared-schemas-CQ6blrEW.mjs → shared-schemas-aahW97QW.mjs} +0 -0
  512. /package/dist/{src-BacfeiI4.mjs → src-DHqsl5Pg.mjs} +0 -0
  513. /package/dist/{storage-namespace-BZce8kkW.mjs → storage-namespace-Dz2jsssp.mjs} +0 -0
  514. /package/dist/{storage-namespace-YmE8XCCL.d.mts → storage-namespace-Tf3P5yJ5.d.mts} +0 -0
  515. /package/dist/{storage-namespace-definition-Cca-zwXU.mjs → storage-namespace-definition-CDef0E20.mjs} +0 -0
  516. /package/dist/{supports-color-SV_FgSN2.mjs → supports-color-i7OTnKcZ.mjs} +0 -0
  517. /package/dist/{telemetry-BqoC87F-.mjs → telemetry-BvCBUjFg.mjs} +0 -0
  518. /package/dist/{timeout-DVlN2Zhy.mjs → timeout-B0nYjLc8.mjs} +0 -0
  519. /package/dist/{tray-menu-service-eVVxgPLc.mjs → tray-menu-service-Deo6yyP8.mjs} +0 -0
  520. /package/dist/{types-DdpSEmTO.d.mts → types-CNS55jvt.d.mts} +0 -0
  521. /package/dist/{types-tyv0B605.d.mts → types-Ce6LL25v.d.mts} +0 -0
  522. /package/dist/{types-BlB23n4f.d.mts → types-xCdGghb2.d.mts} +0 -0
  523. /package/dist/{ui-config-B35GloSX.mjs → ui-config-BIyGzMNL.mjs} +0 -0
  524. /package/dist/{variant-Dwnge3J_.mjs → variant-B4uWdxW7.mjs} +0 -0
  525. /package/dist/{window-registry-Pcf35cac.d.mts → window-registry-BLtVx3Iw.d.mts} +0 -0
  526. /package/dist/{window-registry-CKiMJjId.mjs → window-registry-CoBJq3u4.mjs} +0 -0
  527. /package/dist/{zod-json-schema-Dixc-B1T.mjs → zod-json-schema-BAGAFfCN.mjs} +0 -0
@@ -1,260 +0,0 @@
1
- import { z } from "zod";
2
- import { CodeExecutionFailedOutcomeCode, JsonValue } from "@makaio/framework/contracts";
3
-
4
- //#region runtimes/node/src/code-execution/types.d.ts
5
- /** Default maximum number of virtual files a submitted program may contain. */
6
- declare const CODE_EXECUTION_DEFAULT_MAX_PROGRAM_FILES = 256;
7
- /** Default maximum aggregate UTF-8 size of a submitted program's sources, in bytes (5 MiB). */
8
- declare const CODE_EXECUTION_DEFAULT_MAX_SOURCE_BYTES: number;
9
- /** Default maximum serialized JSON size of a handler result, in bytes (1 MiB). */
10
- declare const CODE_EXECUTION_DEFAULT_MAX_RESULT_BYTES: number;
11
- /**
12
- * Default maximum serialized JSON size of an invocation's arguments, in bytes (1 MiB).
13
- *
14
- * The argument is the one part of a request no other budget measures, and it is
15
- * retained for longer than any of them: a queued invocation holds it from
16
- * admission until dispatch, and the pool then structured-clones it into the
17
- * worker. Bounding it is what keeps a burst of large arguments from costing the
18
- * host more than the configured concurrency implies.
19
- *
20
- * Matched to {@link CODE_EXECUTION_DEFAULT_MAX_RESULT_BYTES} deliberately: both
21
- * bound one JSON value crossing the same thread boundary, in opposite
22
- * directions, so a host that raises one usually means the pair.
23
- */
24
- declare const CODE_EXECUTION_DEFAULT_MAX_ARGUMENT_BYTES: number;
25
- /** Default maximum number of concurrently executing worker threads. */
26
- declare const CODE_EXECUTION_DEFAULT_MAX_CONCURRENCY = 4;
27
- /**
28
- * Default maximum number of invocations allowed to wait for an execution slot.
29
- *
30
- * Concurrency bounds what executes; this bounds what is *retained while
31
- * waiting*. A queued invocation holds its whole request — up to
32
- * {@link CODE_EXECUTION_DEFAULT_MAX_SOURCE_BYTES} of sources and
33
- * {@link CODE_EXECUTION_DEFAULT_MAX_ARGUMENT_BYTES} of arguments — from arrival
34
- * until dispatch, and its deadline is the caller's rather than the provider's,
35
- * so an unbounded queue makes the host's retained memory a function of the
36
- * arrival rate. Refusing past the cap keeps it a function of configuration.
37
- *
38
- * 16 is four times {@link CODE_EXECUTION_DEFAULT_MAX_CONCURRENCY}, so an
39
- * ordinary burst still queues and is served rather than being refused, while
40
- * the worst-case retained request set stays a small multiple of what the
41
- * executing invocations already hold.
42
- */
43
- declare const CODE_EXECUTION_DEFAULT_MAX_QUEUED_INVOCATIONS = 16;
44
- /** Default idle duration after which unused worker threads are reaped, in milliseconds. */
45
- declare const CODE_EXECUTION_DEFAULT_IDLE_TIMEOUT_MS = 30000;
46
- /**
47
- * Default number of invocations a worker thread serves before it is retired.
48
- *
49
- * Every invocation adds a module graph to its worker's ESM module map, and Node
50
- * never evicts one: the record is keyed by URL, and each invocation imports a
51
- * freshly materialized program under a URL that has never been seen before. A
52
- * worker that is never idle long enough to be reaped therefore grows without
53
- * bound. Retiring it after a fixed number of invocations is what turns that
54
- * into a bounded working set.
55
- *
56
- * 64 trades the two costs against each other: retirement pays one worker spawn
57
- * and one TypeScript-loader bootstrap, which is worth amortizing, while the
58
- * accumulated graphs of 64 bounded programs are not.
59
- */
60
- declare const CODE_EXECUTION_DEFAULT_MAX_INVOCATIONS_PER_WORKER = 64;
61
- /**
62
- * Composition options for the Piscina-backed CodeExecution provider.
63
- *
64
- * Every option is host-owned: the provider never derives capability, package
65
- * availability, or environment from the submitted program.
66
- */
67
- interface PiscinaCodeExecutionProviderOptions {
68
- /**
69
- * Provider identifier, bounded by the public CodeExecution identifier limit.
70
- * @defaultValue `'piscina-code-execution'`
71
- */
72
- readonly id?: string;
73
- /** Human-readable provider name. @defaultValue `'Local (Piscina)'` */
74
- readonly displayName?: string;
75
- /** Selection priority among matching providers; higher wins. @defaultValue 0 */
76
- readonly priority?: number;
77
- /** Maximum concurrent worker threads. @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_CONCURRENCY} */
78
- readonly maxConcurrency?: number;
79
- /**
80
- * Invocations allowed to wait for an execution slot before the provider
81
- * refuses further work.
82
- *
83
- * {@link maxConcurrency} bounds what executes; this bounds what is retained
84
- * while waiting. A queued invocation holds its sources and its arguments from
85
- * arrival until dispatch, under the caller's deadline rather than the
86
- * provider's, so without this bound a burst of valid requests would grow the
87
- * host's retained memory with the arrival rate.
88
- *
89
- * An invocation that arrives at a full queue is refused immediately — it is
90
- * never enqueued — and reported as `provider_unavailable`. Zero disables
91
- * queueing entirely: only what fits into a free slot right away is admitted.
92
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_QUEUED_INVOCATIONS}
93
- */
94
- readonly maxQueuedInvocations?: number;
95
- /**
96
- * Idle duration before worker threads are reaped, in milliseconds.
97
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_IDLE_TIMEOUT_MS}
98
- */
99
- readonly idleTimeoutMs?: number;
100
- /**
101
- * Invocations a worker thread serves before it is retired and replaced.
102
- *
103
- * Idle reaping alone does not bound a worker's memory: a pool that is
104
- * continuously busy never goes idle, and every invocation permanently adds a
105
- * module graph to its worker's ESM module map. This bound is what makes the
106
- * working set a function of the configured value rather than of uptime.
107
- *
108
- * Enforced as a strict upper bound per thread, and reached sooner when
109
- * {@link maxConcurrency} is above one — a whole generation of workers is
110
- * retired together once the *generation* has served this many invocations, so
111
- * no thread in it can have served more.
112
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_INVOCATIONS_PER_WORKER}
113
- */
114
- readonly maxInvocationsPerWorker?: number;
115
- /**
116
- * Environment variables visible to worker threads.
117
- *
118
- * Defaults to an empty object rather than the host process environment, so
119
- * host secrets are not handed to executed code by accident. Node built-ins
120
- * and filesystem access stay available regardless — this provider runs
121
- * trusted code only and the environment is not a sandbox.
122
- *
123
- * Configured values are stripped from diagnostics before those can reach a
124
- * contract failure, but only above a minimum length: a value of three
125
- * characters or fewer occurs in ordinary prose, so redacting it would mangle
126
- * the diagnostic it is meant to protect. Such a value is therefore **not**
127
- * redacted and can appear verbatim in a bus-bound message — do not place a
128
- * secret in an environment value that short. The length is measured on the
129
- * whitespace-collapsed value, which is the form diagnostics are matched in.
130
- *
131
- * The resolved worker entry's own loader variables are applied *after* these,
132
- * so a value here that happens to name one of them does not take effect: that
133
- * loader is what bounds which ordinary packages a submitted program resolves,
134
- * and it is provider-owned rather than host-configurable.
135
- */
136
- readonly environment?: Readonly<Record<string, string>>;
137
- /**
138
- * Ordinary bare package names the program may import, mapped to absolute
139
- * package root directories.
140
- *
141
- * These packages are linked into the materialized program, and a resolve
142
- * guard in the worker rejects every *other* ordinary import — including one
143
- * an ambient `node_modules` above the temporary program root would otherwise
144
- * satisfy. So the map is the whole truth about which packages a program can
145
- * reach by name, on any host.
146
- *
147
- * It bounds bare specifiers and nothing else. Node built-ins, absolute and
148
- * `file:` specifiers, and direct filesystem access all remain available to
149
- * the executed code, and a configured package's own dependencies resolve
150
- * within that package as usual — configuring a package vouches for what it
151
- * depends on. This is a resolution boundary, not an isolation boundary.
152
- */
153
- readonly packageRoots?: Readonly<Record<string, string>>;
154
- /** Maximum number of virtual files per program. @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_PROGRAM_FILES} */
155
- readonly maxProgramFiles?: number;
156
- /**
157
- * Maximum aggregate UTF-8 source size per program, in bytes.
158
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_SOURCE_BYTES}
159
- */
160
- readonly maxSourceBytes?: number;
161
- /**
162
- * Maximum serialized JSON size of a handler result, in bytes.
163
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_RESULT_BYTES}
164
- */
165
- readonly maxResultBytes?: number;
166
- /**
167
- * Maximum serialized JSON size of an invocation's arguments, in bytes.
168
- *
169
- * Enforced before the invocation waits for an admission slot, and reported as
170
- * `invalid_program`: the argument is part of what was submitted, so an
171
- * over-budget one is a rejected request rather than a provider fault.
172
- * @defaultValue {@link CODE_EXECUTION_DEFAULT_MAX_ARGUMENT_BYTES}
173
- */
174
- readonly maxArgumentBytes?: number;
175
- }
176
- /**
177
- * Structured-clone-safe task handed to the worker entry for one invocation.
178
- *
179
- * The task carries only resolved primitives and JSON values. TypeScript
180
- * transpilation and module loading happen in the worker thread, so no
181
- * program source and no live host object crosses the boundary.
182
- */
183
- interface CodeExecutionWorkerTask {
184
- /**
185
- * `file:` URL of the generated module that re-exports the program's entry namespace.
186
- *
187
- * Not the program's entry module itself. Importing that directly would let a
188
- * program exporting a callable `then` hijack the import promise; see
189
- * {@link CODE_EXECUTION_ENTRY_NAMESPACE_EXPORT}, which names the export this
190
- * module carries the entry namespace on.
191
- */
192
- readonly entryNamespaceUrl: string;
193
- /** `file:` URL used as the importing parent for the scoped import. */
194
- readonly parentUrl: string;
195
- /**
196
- * `file:` URL prefixes identifying the modules the import allowlist applies to.
197
- *
198
- * Every spelling of the program root, each ending in a slash. Everything the
199
- * worker resolves for its own module graph sits outside these prefixes and is
200
- * therefore unaffected. More than one prefix is required because the module
201
- * loader reports a module reached through a symlinked prefix by its real
202
- * path, which is a different spelling of the same root.
203
- */
204
- readonly programRootUrls: readonly string[];
205
- /**
206
- * Ordinary bare package names the program is allowed to import.
207
- *
208
- * Carried per task rather than read from the worker's environment because the
209
- * allowlist is a property of the host's composition, and the worker must be
210
- * able to enforce it without knowing how the provider was configured. Node
211
- * resolves a bare specifier by walking up from the importing module, so
212
- * linking these packages into the program root is not by itself an
213
- * allowlist — an ancestor `node_modules` would satisfy an unlisted import.
214
- */
215
- readonly allowedPackages: readonly string[];
216
- /** Name of the export invoked on the entry module. */
217
- readonly exportName: string;
218
- /** JSON-safe value passed to the invoked export as its single argument. */
219
- readonly arguments: JsonValue;
220
- /** Per-invocation TypeScript loader namespace, isolating module caches between invocations. */
221
- readonly namespace: string;
222
- /** Maximum serialized JSON size of the handler result, in bytes. */
223
- readonly maxResultBytes: number;
224
- /**
225
- * Values to strip from diagnostics before they leave the worker.
226
- *
227
- * Carries the materialized program paths for this invocation plus the
228
- * host-configured values the provider knows are sensitive. Redacting in the
229
- * worker as well as in the host keeps a long diagnostic from being truncated
230
- * around a value the host would then no longer be able to match.
231
- */
232
- readonly redactedPaths: readonly string[];
233
- }
234
- /** Worker outcome for an invocation whose export returned a JSON-safe value the host revalidates after transfer. */
235
- interface CodeExecutionWorkerCompletedOutcome {
236
- /** Discriminant for a completed invocation. */
237
- readonly kind: 'completed';
238
- /** JSON-safe value validated by the worker and revalidated by the host after transfer. */
239
- readonly value: JsonValue;
240
- }
241
- /** Worker outcome for an invocation that failed inside the worker thread. */
242
- interface CodeExecutionWorkerFailedOutcome {
243
- /** Discriminant for a failed invocation. */
244
- readonly kind: 'failed';
245
- /** Stable failure classification, already narrowed to a `failed` outcome code. */
246
- readonly code: CodeExecutionFailedOutcomeCode;
247
- /** Sanitized, bounded summary of what went wrong. */
248
- readonly message: string;
249
- }
250
- /**
251
- * Discriminated envelope the worker entry returns for every invocation.
252
- *
253
- * The worker resolves rather than rejects for expected failures so that only
254
- * small, clone-safe values cross the thread boundary. Timeouts and
255
- * cancellations are not represented here: those are observed by the host
256
- * thread through the effective abort signal.
257
- */
258
- type CodeExecutionWorkerOutcome = CodeExecutionWorkerCompletedOutcome | CodeExecutionWorkerFailedOutcome;
259
- //#endregion
260
- export { CODE_EXECUTION_DEFAULT_MAX_PROGRAM_FILES as a, CODE_EXECUTION_DEFAULT_MAX_SOURCE_BYTES as c, PiscinaCodeExecutionProviderOptions as d, CODE_EXECUTION_DEFAULT_MAX_INVOCATIONS_PER_WORKER as i, CodeExecutionWorkerOutcome as l, CODE_EXECUTION_DEFAULT_MAX_ARGUMENT_BYTES as n, CODE_EXECUTION_DEFAULT_MAX_QUEUED_INVOCATIONS as o, CODE_EXECUTION_DEFAULT_MAX_CONCURRENCY as r, CODE_EXECUTION_DEFAULT_MAX_RESULT_BYTES as s, CODE_EXECUTION_DEFAULT_IDLE_TIMEOUT_MS as t, CodeExecutionWorkerTask as u };
@@ -1 +0,0 @@
1
- import{n as e}from"./json-value-BBZ6uGwc.mjs";import{n as t}from"./capability-j3NekkIu.mjs";import{z as n}from"zod";const r=n.enum([`wait-in-process`,`exit-and-redispatch`,`exit-and-resume`]),i=`worker-node`,a=`makaio.runtime-node.piscina-local`,o=1,s=n.object({version:n.literal(1),providerId:n.string().min(1),providerData:e}).strict(),c={source:128,code:64,summary:512,observedAt:64},l=n.object({source:n.string().min(1).max(c.source),summary:n.string().min(1).max(c.summary),observedAt:n.iso.datetime({offset:!0}).max(c.observedAt),code:n.string().min(1).max(c.code).optional()}).strict(),u=`exhaustive-search-unavailable`,d=`no-allocation-observed`,f=`ambiguous-allocation-match`,p=`pre-request-rejection`,m=[`unknown`,`provisioning`,`ready`,`running`,`suspended`,`terminal`,`absent`],h=n.enum(m),g=n.object({state:h,allocationRef:s,evidence:e.optional()}),_=[`local-directory`,`workspace-snapshot`],v=n.enum(_),y=n.string().min(1).refine(e=>!e.startsWith(`/`)&&!/^[A-Za-z]:[/\\]/.test(e),{message:`sourcePath must be relative (no leading / or drive letter)`}),b=n.object({kind:n.literal(`local-directory`),workspaceId:n.string().min(1),rootDigest:n.string().min(1),sourcePath:y}).strict(),x=n.object({kind:n.literal(`workspace-snapshot`),snapshotId:n.string().min(1),digest:n.string().min(1),sourcePath:y}).strict(),S=n.discriminatedUnion(`kind`,[b,x]),C=/^sha(?:256|384|512)-[A-Za-z0-9+/]+=*$/,w=n.object({packageName:n.string().min(1),version:n.string().min(1),entrypoint:n.string().min(1).refine(e=>!e.includes(`node_modules`)&&!e.startsWith(`/`)&&!/^[A-Za-z]:[/\\]/.test(e),{message:`entrypoint must be package-relative (no node_modules, no absolute path)`}),integrity:n.string().min(1).refine(e=>C.test(e),{message:`integrity must be a valid SRI hash (sha256-..., sha384-..., or sha512-...)`})}).strict(),T=n.object({maxRuntimeMs:n.number().int().positive().optional(),persistentStorage:n.boolean(),customCapabilities:n.array(n.string().min(1)).default([]),suspensionStrategy:r.default(`wait-in-process`),supportsRecovery:n.boolean().default(!1),materializationModes:n.array(v).min(1).default([`local-directory`])}),E=n.object({maxRuntimeMs:n.number().int().positive().optional(),persistentStorage:n.boolean().optional(),customCapabilities:n.array(n.string().min(1)).default([]),recoverableAllocation:n.boolean().optional(),materializationModes:n.array(v).optional()}),D=[`provisioner-process-bound`,`provider-managed`],O=n.enum(D),k=[`found`,`confirmed-absent`,`unknown`],A=n.discriminatedUnion(`kind`,[n.object({kind:n.literal(`found`),allocationRef:s}).strict(),n.object({kind:n.literal(`confirmed-absent`),evidence:l}).strict(),n.object({kind:n.literal(`unknown`),evidence:l}).strict()]),j=n.enum([`accepted`,`duplicate`,`conflict`,`fenced`]);var M=class extends Error{constructor(e){super(e),this.name=`ProviderAllocationRefError`}};function N(e,t){let n=s.shape.providerId.parse(e);return{build:e=>{let r=t.parse(e);return{version:1,providerId:n,providerData:s.shape.providerData.parse(r)}},parse:e=>{if(e.version!==1)throw new M(`Unsupported allocation ref version ${String(e.version)}, expected 1`);if(e.providerId!==n)throw new M(`Allocation ref provider '${e.providerId}' does not match this provider '${n}'`);let r=t.safeParse(e.providerData);if(!r.success)throw new M(`Invalid provider data in allocation ref: ${r.error.message}`);return r.data}}}function P(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1),r=n.charCodeAt(n.length-1);return`${r>=55296&&r<=56319?n.slice(0,-1):n}…`}function F(e,t,n){let r=c.summary;return l.parse({source:e,summary:P(n,r),observedAt:new Date().toISOString(),...t===void 0?{}:{code:t}})}function I(e,n){return e.emit(t.register,{capabilityId:i,provider:n})}function L(e,n){return e.emit(t.unregister,{capabilityId:i,providerId:n})}export{E as A,c as C,S as D,w as E,r as M,O,A as S,i as T,j as _,N as a,k as b,g as c,l as d,u as f,d as g,v as h,M as i,x as j,T as k,h as l,_ as m,L as n,m as o,b as p,F as r,f as s,I as t,a as u,p as v,D as w,s as x,o as y};
@@ -1 +0,0 @@
1
- import{h as e,m as t,s as n}from"./schemas-C3kyQWGf.mjs";import{a as r,i,n as a,o}from"./json-value-BBZ6uGwc.mjs";import{t as s}from"./zod-json-schema-Dixc-B1T.mjs";import"./artifact-Btbuib48.mjs";import{a as c}from"./visibility-DtDLRBdr.mjs";import"./model-DrzPt3ou.mjs";import{t as l}from"./provider-context-zTDSH2x9.mjs";import{a as u,o as d}from"./schemas-QWDnauKX.mjs";import{A as f,D as p,E as ee,M as te}from"./worker-node-CjuQb9hl.mjs";import{r as ne}from"./schemas-BfO5jkrL.mjs";import{z as m}from"zod";import{createBusNamespace as h,getFullSubjectForSubjectDefinition as re,observability as g,splitSubjectKey as ie}from"@makaio/framework/core";const _=m.object({kind:m.string().min(1),id:m.string().min(1)});function ae(e){return`${se(e.kind)}:${se(e.id)}`}function oe(e){let t=ce(e);if(t<1)throw Error(`Invalid artifact ref key: ${e}`);let n=le(e.slice(t+1));if(n.length===0)throw Error(`Invalid artifact ref key (empty id): ${e}`);return{kind:le(e.slice(0,t)),id:n}}function se(e){return e.replace(/\\/g,`\\\\`).replace(/:/g,`\\:`)}function ce(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(t){t=!1;continue}if(r===`\\`){t=!0;continue}if(r===`:`)return n}return-1}function le(e){let t=``,n=!1;for(let r of e){if(n){if(r!==`\\`&&r!==`:`)throw Error(`Invalid artifact ref key component: ${e}`);t+=r,n=!1;continue}if(r===`\\`){n=!0;continue}t+=r}if(n)throw Error(`Invalid artifact ref key component: ${e}`);return t}const ue=m.enum([`completed`,`failed`,`cancelled`]),de=m.object({status:ue,completedAt:m.number().int().nonnegative(),error:m.string().min(1).optional(),reason:m.string().min(1).optional()}).strict(),fe=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),finalizerId:m.string().min(1),transitionKey:m.string().min(1),claimToken:m.string().min(1),intent:de,claimedAt:m.number().int().nonnegative()}).strict(),pe=m.object({accepted:m.boolean()}).strict(),me=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,v=m.string().regex(me,`Workflow finalizer IDs must be lowercase dot, dash, or underscore separated names.`),y=m.string().regex(me,`Workflow delegate result finalizer IDs must be lowercase dot, dash, or underscore separated names.`),he=m.object({toolName:m.string().min(1),outcome:m.enum([`success`,`failure`]).optional(),artifact:m.object({kind:m.string().min(1),id:m.string().min(1),revision:m.string().min(1)}).strict().optional()}).strict().superRefine((e,t)=>{e.artifact!==void 0&&e.outcome!==`success`&&t.addIssue({code:`custom`,path:[`artifact`],message:`requires an explicit successful outcome`})}),ge=m.object({durationMs:m.number().int().nonnegative(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),cachedInputTokens:m.number().int().nonnegative().optional(),toolCallCount:m.number().int().nonnegative().optional(),binding:m.object({adapterName:m.string().min(1),providerConfigId:m.string().min(1).optional(),providerDefinitionId:m.string().min(1).optional(),model:m.string().min(1).optional(),auth:m.object({mode:m.enum([`explicit`,`inferred`,`none`]),owner:m.enum([`provider`,`client`]),methodId:m.string().min(1)}).strict().optional()}).strict()}).strict(),b=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:m.enum([`delegate-agent`,`delegate-role`]),rawResult:o,toolObservations:m.array(he),economics:ge.optional()}).strict(),_e=b.extend({finalizerId:y}).strict(),x=m.object({output:o}).strict();function ve(e){if(!v.safeParse(e).success)throw Error(`Invalid workflow finalizer ID: "${e}"`);let t=`workflow-finalizer:${e}`,n=h(t,{finalize:{request:fe,response:pe}});return{namespaceDomain:t,namespace:n,subjects:n.subjects}}function ye(e){if(!y.safeParse(e).success)throw Error(`Invalid workflow delegate result finalizer ID: "${e}"`);let t=`workflow-delegate-finalizer:${e}`,n=h(t,{finalize:{request:b,response:x}});return{namespaceDomain:t,namespace:n,subjects:n.subjects}}const S=m.union([m.string(),m.number(),m.boolean(),m.null()]),be=m.union([S,m.object({$in:m.array(S)}).strict(),m.object({$ne:S}).strict(),m.object({$exists:m.boolean()}).strict(),m.object({$startsWith:m.string()}).strict(),m.object({$endsWith:m.string()}).strict()]),xe=m.record(m.string(),be),Se=m.object({kind:ne,params:i,filter:xe.optional(),filterExpression:m.string().optional()}),C=m.discriminatedUnion(`type`,[m.object({type:m.literal(`global`)}).strict(),m.object({type:m.literal(`workspace`),id:m.string().min(1)}).strict(),m.object({type:m.literal(`session`),id:m.string().min(1)}).strict(),m.object({type:m.literal(`external`),kind:m.string().min(1),id:m.string().min(1)}).strict()]),w=m.string().min(1),T=m.object({kind:m.string().min(1),schemaVersion:m.string().min(1),scope:e,resolve:m.string().min(1).optional(),create:m.string().min(1).optional(),statusPath:m.string().min(1).optional()}),Ce=m.object({kind:m.string().min(1),schemaVersion:m.string().min(1),scope:e,dataExpression:m.string().optional()}),we=m.object({file:m.string().min(1),line:m.number().int().positive().optional(),column:m.number().int().positive().optional()}),E=m.enum([`station`,`delegate-agent`,`delegate-role`,`parallel`,`gate`,`iterate`,`iterate-chain`,`loop`,`sequence`]),Te=m.enum([`all-settled`,`fail-fast`]),D=m.object({id:m.string().min(1),when:w.optional(),skip:w.optional(),writes:m.array(Ce).optional()}),O=m.lazy(()=>m.discriminatedUnion(`type`,[A,Ee,De,Oe,ke,Ae,je,Ne,k])),k=D.extend({type:m.literal(`sequence`),nodes:m.lazy(()=>m.array(O))}),A=D.extend({type:m.literal(`station`),prompt:m.string().min(1),role:m.string().min(1).optional(),outputSchema:r.optional(),timeoutMs:m.number().int().positive().optional(),completion:u.optional()}),Ee=D.extend({type:m.literal(`delegate-agent`),agentId:m.string().min(1),inputExpression:m.string().optional(),outputSchema:r.optional(),allowedTools:m.array(m.string()).optional(),completion:u.optional(),resultFinalizerId:y.optional()}),De=D.extend({type:m.literal(`delegate-role`),role:m.string().min(1),prompt:m.string().min(1),outputSchema:r.optional(),allowedTools:m.array(m.string()).optional(),resultFinalizerId:y.optional(),timeoutMs:m.number().int().positive().optional(),completion:u.optional()}),Oe=D.extend({type:m.literal(`parallel`),mode:Te.optional(),branches:m.record(m.string().min(1),m.lazy(()=>k))}),ke=D.extend({type:m.literal(`gate`),prompt:m.string().min(1),title:m.string().optional(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().int().positive().nullable(),resumeSchema:r.optional()}),Ae=D.extend({type:m.literal(`iterate`),collection:m.string().min(1),body:m.lazy(()=>k),concurrency:m.number().int().nonnegative().optional()}),je=D.extend({type:m.literal(`iterate-chain`),collection:m.string().min(1),body:m.lazy(()=>k)}),Me=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`pass`)}).strict(),m.object({kind:m.literal(`loop`)}).strict(),m.object({kind:m.literal(`escalate`),reason:m.string().min(1)}).strict()]),Ne=D.extend({type:m.literal(`loop`),maxRounds:m.number().int().positive(),body:m.lazy(()=>k),gate:m.object({handler:m.string().min(1),input:m.string().min(1).optional(),config:o.optional(),escalation:m.object({title:m.string().optional(),prompt:m.string().min(1),resumeSchema:r.optional(),autoAction:m.enum([`approve`,`reject`]).default(`reject`),timeoutMs:m.number().int().positive().nullable().default(null)}).strict().optional()}).strict()}),Pe=m.object({factoryId:m.string().min(1),preview:m.array(m.lazy(()=>O)).optional(),sourceLocation:we.optional()}),Fe=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`editor`)}).strict(),m.object({kind:m.literal(`extension`),extension:m.string().min(1),externalId:m.string().min(1).optional(),syncedAt:m.string().datetime().optional(),metadata:a.default({})}).strict()]),Ie=m.object({schema:r,initial:o.optional()}),Le=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1)}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),j=m.object({id:m.string().min(1),name:m.string().optional(),description:m.string().optional(),inputSchema:r.optional(),configSchema:r.optional(),outputSchema:r.optional(),state:Ie.optional(),artifact:T.optional(),root:k,triggers:m.array(Se).optional(),scope:C.default({type:`global`}),canvasLayout:m.record(m.string(),o).optional(),source:Fe.optional(),executableSource:Le.optional(),requirements:f.optional(),successFinalizerId:v.optional()}),M=m.enum([`pending`,`running`,`paused`,`finalizing`,`completed`,`failed`,`cancelled`]),N=m.object({id:m.string(),workflowId:m.string(),coordinatorSessionId:m.string().optional(),status:M,inputs:o,config:a.optional(),startedAt:m.number(),completedAt:m.number().optional(),error:m.string().optional(),reason:m.string().optional(),triggerPayload:a.optional(),scope:C,artifactRef:_.optional()}),Re=m.object({frameId:m.string(),nodeId:m.string(),nodeType:E,path:m.array(m.string()),parentFrameId:m.string().optional(),status:m.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().optional(),output:o.optional(),error:m.string().optional(),startedAt:m.number().optional(),completedAt:m.number().optional()}),P=m.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),ze=m.object({executionId:m.string(),nodeId:m.string(),frameId:m.string(),schema:r,prompt:m.string().optional(),status:P,autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().int().positive().nullable(),resumeData:o.optional(),reason:m.string().optional(),createdAt:m.number(),resolvedAt:m.number().optional()}),F=m.object({adapterName:m.string().min(1),providerConfigId:m.string().min(1).optional(),model:m.string().optional(),reasoningEffort:c.optional(),harnessId:m.string().optional(),systemPrompt:m.string().optional(),contextMode:d.optional(),providerContext:l.optional(),adapterConfig:a.optional(),tools:m.array(m.string()).optional(),disallowedTools:m.array(m.string()).optional(),allowedDirectories:m.array(m.string()).optional(),completion:u.optional()}),Be=F,Ve=m.object({scope:C.optional()}),He=m.object({startedAt:m.number(),id:m.string()}),Ue=1,We=500,Ge=50,Ke=m.object({workflowId:m.string().min(1).optional(),scope:C.optional(),status:M.optional(),artifactRef:_.optional(),limit:m.number().int().min(1).max(500).default(50),cursor:He.optional()}).refine(e=>e.workflowId!==void 0||e.scope!==void 0||e.artifactRef!==void 0,{message:`Either workflowId, scope, or artifactRef is required.`}),qe=200,Je=100,Ye=10,Xe=m.object({refs:m.array(_).min(1).max(200),limitPerRef:m.number().int().min(1).max(100).default(10)}),Ze=m.object({executionId:m.string().min(1).optional(),status:P.optional(),limit:m.number().int().min(1).max(500).default(50)}).refine(e=>e.executionId!==void 0||e.status!==void 0,{message:`Either executionId or status is required.`}),I=m.enum([`station`,`delegate-agent`,`delegate-role`,`gate`]),Qe=m.enum([`station`]),$e=m.object({input:m.number().int().nonnegative(),output:m.number().int().nonnegative(),cached:m.number().int().nonnegative().optional()}),et=m.object({duration:m.number().nonnegative(),tokenUsage:$e.optional(),estimatedCost:m.number().nonnegative().optional(),toolCalls:m.number().int().nonnegative().optional()}),tt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`none`)}).strict(),m.object({kind:m.literal(`hmac`),secret:m.string().min(1)}).strict()]),nt=m.object({cwd:m.string().min(1),env:m.record(m.string(),m.string()).optional()}),rt=m.object({executionId:m.string().min(1),stepId:m.string().min(1),reason:m.string().optional()});function it(e){let t=ie(e);if(t===void 0)throw Error(`Invalid step cancel subject: ${e}`);return{subject:t.subject,$meta:{namespace:t.namespace,isRequest:!1,payload:{},local:!1,channel:!1}}}const at=m.object({executionId:m.string().min(1),reason:m.string().optional()});function ot(e){let t=ie(e);if(t===void 0)throw Error(`Invalid workflow cancel subject: ${e}`);return{subject:t.subject,$meta:{namespace:t.namespace,isRequest:!1,payload:{},local:!1,channel:!1}}}const st=m.object({stepId:m.string().min(1),executionId:m.string().min(1),workflowId:m.string().min(1),coordinatorSessionId:m.string().min(1),stepType:Qe,stepDefinition:A,resolvedInputs:a,busUrl:m.string().optional(),busAuth:tt.default({kind:`none`}),platformDefaults:nt,cancelSubject:m.string().min(1)}).superRefine((e,t)=>{e.stepType!==e.stepDefinition.type&&t.addIssue({code:`custom`,path:[`stepDefinition`,`type`],message:`stepDefinition.type must match stepType (${e.stepType})`})}),ct=`Workflow cancelled`,lt=m.object({status:m.enum([`completed`,`failed`]),output:o.optional(),error:m.string().optional(),telemetry:et}),ut=m.enum([`running`,`completed`,`failed`,`skipped`]),dt=m.object({executionId:m.string().min(1),frameId:m.string().min(1),stepId:m.string().min(1),stepType:I,status:ut,startedAt:m.number().optional(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative().optional(),toolCallCount:m.number().int().nonnegative().optional(),input:m.string().optional(),output:m.string().optional()}),ft=m.enum([`triggered-by`,`feedback-loop`,`rerun-of`]),L=m.object({sourceExecutionId:m.string().min(1),targetExecutionId:m.string().min(1),linkType:ft,metadata:m.record(m.string(),m.unknown()).optional()}),pt=m.object({sourceExecutionId:m.string().min(1).optional(),targetExecutionId:m.string().min(1).optional()}).refine(e=>e.sourceExecutionId!==void 0||e.targetExecutionId!==void 0,{message:`Either sourceExecutionId or targetExecutionId is required.`}),mt={RUN_CONTEXT_NOT_FOUND:`WORKFLOW_RUN_CONTEXT_NOT_FOUND`,SNAPSHOT_UNAVAILABLE:`WORKFLOW_SNAPSHOT_UNAVAILABLE`,SOURCE_MISMATCH:`WORKFLOW_SOURCE_MISMATCH`,NOT_EXECUTABLE:`WORKFLOW_NOT_EXECUTABLE`,HANDLER_UNAVAILABLE:`WORKFLOW_HANDLER_UNAVAILABLE`};var ht=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`WorkflowError`}};const R=m.string().refine(e=>e===``||e.startsWith(`/`),{message:`JSON Patch paths must be empty or start with "/".`}),gt=m.object({op:m.enum([`add`,`replace`,`test`]),path:R,value:o}).strict(),_t=m.object({op:m.literal(`remove`),path:R}).strict(),vt=m.object({op:m.enum([`move`,`copy`]),path:R,from:R}).strict(),z=m.discriminatedUnion(`op`,[gt,_t,vt]),yt=m.object({type:m.literal(`artifact-query`),query:n,select:m.enum([`latest`,`all`]),optional:m.boolean().optional()}),bt=m.object({type:m.literal(`bus-request`),subject:m.string().min(1),payload:m.record(m.string(),m.unknown()).optional(),optional:m.boolean().optional()}),xt=m.discriminatedUnion(`type`,[yt,bt]),St=m.object({type:m.literal(`artifact`),kind:m.string().min(1),schemaVersion:m.string().min(1),scope:e,metadata:m.record(m.string(),m.unknown()).optional()}),Ct=m.object({type:m.literal(`bus-event`),subject:m.string().min(1),payload:m.record(m.string(),m.unknown()).optional()}),wt=m.discriminatedUnion(`type`,[St,Ct]),Tt=m.object({content:m.string(),metadata:m.record(m.string(),m.unknown()).optional()}),Et=m.object({sources:m.record(m.string(),Tt)}),Dt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`none`)}).strict(),m.object({kind:m.literal(`hmac`),secret:m.string().min(1)}).strict()]),Ot=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1)}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),B=m.enum([`immediate`,`await-trigger`]),kt=m.object({source:Ot,definition:j.optional(),executionId:m.string().min(1),workflowId:m.string().min(1),triggerPayload:a.default({}),triggerMode:B.optional(),inputs:o.default({}),config:a.optional(),artifactRef:_.optional(),scope:C.default({type:`global`}),busUrl:m.string().optional(),busAuth:Dt.default({kind:`none`}),env:m.record(m.string(),m.string()).default({}),coordinatorSessionId:m.string().min(1),cancelSubject:m.string().min(1),suspensionStrategy:te.default(`wait-in-process`),terminalAuthority:m.enum([`worker`,`authority`]).optional(),materializationSpec:p.optional()}),V=m.object({executionId:m.string().min(1),workflowId:m.string().min(1)}),At=m.discriminatedUnion(`status`,[V.extend({status:m.literal(`completed`),artifact:t.optional()}).strict(),V.extend({status:m.literal(`failed`),error:m.string().min(1)}).strict(),V.extend({status:m.literal(`cancelled`),reason:m.string().min(1).optional()}).strict(),V.extend({status:m.literal(`paused`),pausedAtGateId:m.string().min(1),pausedAtFrameId:m.string().min(1)}).strict()]),jt=m.object({contributionRefs:m.array(ee)}).strict(),Mt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1).refine(e=>!e.startsWith(`/`)&&!/^[A-Za-z]:[/\\]/.test(e),{message:`path must be workspace-relative (no leading / or drive letter)`})}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),Nt=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),source:Mt,definitionSnapshot:j.optional(),workerManifest:jt.default({contributionRefs:[]}),inputs:o.default({}),config:a.optional(),scope:C.default({type:`global`}),triggerPayload:a.default({}),triggerMode:B.optional(),artifactRef:_.optional(),coordinatorSessionId:m.string().min(1),dispatchMetadata:a.optional(),cancelSubject:m.string().min(1),env:m.record(m.string(),m.string()).default({}),createdAt:m.number(),suspensionStrategy:te.default(`wait-in-process`),terminalAuthority:m.enum([`worker`,`authority`]).optional(),materializationSpec:p.optional()}).superRefine((e,t)=>{e.source.kind===`definition`&&e.definitionSnapshot===void 0&&t.addIssue({code:m.ZodIssueCode.custom,path:[`definitionSnapshot`],message:`definitionSnapshot is required when source.kind is "definition"`}),e.source.kind===`path`?e.materializationSpec===void 0?t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`],message:`materializationSpec is required when source.kind is "path"`}):e.materializationSpec.sourcePath!==e.source.path&&t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`,`sourcePath`],message:`materializationSpec.sourcePath must match source.path`}):e.materializationSpec!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`],message:`materializationSpec is only valid when source.kind is "path"`})}),H=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),workflowName:m.string().optional(),status:m.enum([`pending`,`running`,`paused`,`finalizing`,`completed`,`failed`,`cancelled`]),startedAt:m.number(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),totalInputTokens:m.number().int().nonnegative().optional(),totalOutputTokens:m.number().int().nonnegative().optional(),totalEstimatedCost:m.number().nonnegative().optional(),error:m.string().optional(),failedNodeId:m.string().optional()}),Pt=m.object({executionId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:E,path:m.array(m.string()),status:m.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:m.number().int().nonnegative(),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().optional(),startedAt:m.number().optional(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative().optional(),error:m.string().optional()}),Ft=m.object({executionId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),artifact:T,revision:m.string().min(1).optional(),writtenAt:m.number()}),It=m.object({executionId:m.string().min(1),nodeId:m.string().min(1),frameId:m.string().min(1),status:m.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),prompt:m.string().optional(),openedAt:m.number(),resolvedAt:m.number().optional(),resumeData:o.optional()}),Lt=m.object({executionId:m.string().min(1),inputTokens:m.number().int().nonnegative(),outputTokens:m.number().int().nonnegative(),cachedTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative(),byModel:m.record(m.string(),m.object({inputTokens:m.number().int().nonnegative(),outputTokens:m.number().int().nonnegative(),estimatedCost:m.number().nonnegative()})).optional()}),Rt=m.object({total:m.number().int().nonnegative(),byStatus:m.object({pending:m.number().int().nonnegative(),running:m.number().int().nonnegative(),paused:m.number().int().nonnegative(),finalizing:m.number().int().nonnegative(),completed:m.number().int().nonnegative(),failed:m.number().int().nonnegative(),cancelled:m.number().int().nonnegative()}),totalDurationMs:m.number().nonnegative(),totalInputTokens:m.number().int().nonnegative(),totalOutputTokens:m.number().int().nonnegative(),totalEstimatedCost:m.number().nonnegative()}),zt=m.object({executionId:m.string().min(1),frameId:m.string().min(1),factoryId:m.string().min(1),materializedNodeIds:m.array(m.string().min(1)),factoryInput:r.optional(),materializedAt:m.number()}),Bt=`wfx-ext-`,Vt=m.object({frameId:m.string().min(1).optional(),nodeId:m.string().min(1),nodeType:I,path:m.array(m.string().min(1)).optional(),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().min(1).optional(),startedAt:m.number().int().nonnegative().optional()}).strict(),Ht=m.object({frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:I,path:m.array(m.string().min(1)),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().min(1).optional(),startedAt:m.number().int().nonnegative(),durationMs:m.number().int().nonnegative().optional()}).strict(),Ut=m.object({executionId:m.string().startsWith(Bt,{message:`executionId must use the wfx-ext- prefix`}).optional(),name:m.string().min(1),startedAt:m.number().int().nonnegative().optional(),scope:C.optional(),artifactRef:_.optional(),input:o.optional(),triggerPayload:a.optional(),frame:Vt.optional()}).superRefine((e,t)=>{e.executionId!==void 0&&e.startedAt===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`startedAt is required when executionId is supplied`,path:[`startedAt`]})}),Wt=m.object({executionId:m.string().min(1),status:m.enum([`completed`,`failed`,`cancelled`]),error:m.string().min(1).optional(),reason:m.string().min(1).optional(),completedAt:m.number().nonnegative().overwrite(e=>Math.trunc(e)).optional(),frame:Ht.optional()}).superRefine((e,t)=>{if(e.status===`failed`&&e.error===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'failed' requires a non-empty 'error' message`,path:[`error`]}),e.status===`cancelled`&&e.reason===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'cancelled' requires a non-empty 'reason' string`,path:[`reason`]}),e.status===`completed`&&e.error!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'completed' must not carry an 'error'`,path:[`error`]}),e.status===`completed`&&e.reason!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'completed' must not carry a 'reason'`,path:[`reason`]}),e.frame!==void 0&&e.completedAt===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`completedAt is required when frame metadata is supplied`,path:[`completedAt`]}),e.frame!==void 0&&e.completedAt!==void 0){let n=e.completedAt-e.frame.startedAt;n<0&&t.addIssue({code:m.ZodIssueCode.custom,message:`completedAt must not precede frame.startedAt`,path:[`completedAt`]}),e.frame.durationMs!==void 0&&e.frame.durationMs!==n&&t.addIssue({code:m.ZodIssueCode.custom,message:`frame.durationMs must equal completedAt - frame.startedAt`,path:[`frame`,`durationMs`]})}}),Gt=m.object({message:m.string().min(1),details:m.string().min(1).optional(),kind:m.string().min(1).optional(),metadata:o.optional()}).strict(),U=m.object({executionId:m.string(),stepId:m.string(),stepType:m.enum([`station`,`delegate-agent`,`delegate-role`,`gate`])}),W=U.extend({stepType:m.literal(`gate`)}),Kt=m.discriminatedUnion(`source`,[W.extend({frameId:m.string(),action:m.enum([`approve`,`reject`]),source:m.literal(`user`),reason:m.string().optional()}),W.extend({frameId:m.string(),action:m.enum([`approve`,`reject`]),source:m.literal(`timeout`)}),W.extend({frameId:m.string(),source:m.literal(`cancelled`)})]),qt=W.extend({workflowId:m.string(),workflowName:m.string(),title:m.string(),message:m.string(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().nullable(),openedAt:m.number()}),Jt={getDefinition:{request:m.object({id:m.string()}),response:m.object({workflow:j.nullable()})},setDefinition:{request:m.object({workflow:j}),response:m.object({id:m.string()})},deleteDefinition:{request:m.object({id:m.string()}),response:m.object({deleted:m.boolean()})},listDefinitions:{request:Ve,response:m.object({workflows:m.array(j)})},"definition.created":j,"definition.updated":j,"definition.deleted":m.object({id:m.string()}),start:{request:m.object({workflowId:m.string(),input:o.optional(),config:o.optional(),artifactRef:_.optional(),scope:C.optional(),parentSessionId:m.string().optional(),triggerPayload:a.optional()}),response:m.object({executionId:m.string()})},rerun:{request:m.object({executionId:m.string().min(1),mode:m.enum([`snapshot`,`current`]),input:o.optional(),config:o.optional(),artifactRef:_.optional(),scope:C.optional(),parentSessionId:m.string().optional(),triggerPayload:a.optional(),reason:m.string().min(1).optional()}),response:m.object({executionId:m.string()})},cancel:{request:m.object({executionId:m.string(),reason:m.string().optional()}),response:m.object({cancelled:m.boolean()})},bootstrapAuthorityState:{request:m.object({executionId:m.string().min(1),terminalAuthority:m.literal(`authority`),definition:j}).strict(),response:m.object({persisted:m.boolean()})},acceptAuthorityRunnerResult:{request:m.object({executionId:m.string().min(1),result:At.refine(e=>e.status!==`paused`,{message:`Authority runner results must be terminal`})}).strict().superRefine((e,t)=>{e.result.executionId!==e.executionId&&t.addIssue({code:m.ZodIssueCode.custom,path:[`result`,`executionId`],message:`result.executionId must match executionId`})}),response:m.object({accepted:m.boolean(),status:M})},finalizeDelegateResult:{request:_e,response:x},getExecution:{request:m.object({executionId:m.string()}),response:m.object({execution:N.nullable()})},listExecutions:{request:Ke,response:m.object({executions:m.array(N)})},listExecutionsByArtifactRefs:{request:Xe,response:m.object({executionsByRef:m.record(m.string(),m.array(N))})},listSpans:{request:m.object({executionId:m.string()}),response:m.object({spans:m.array(dt)})},listGateInstances:{request:Ze,response:m.object({gates:m.array(ze)})},setExecutionLink:{request:m.object({link:L}),response:m.object({id:m.string()})},listExecutionLinks:{request:pt,response:m.object({links:m.array(L)})},listFrames:{request:m.object({executionId:m.string().min(1)}),response:m.object({frames:m.array(Re)})},runFile:{request:m.object({filePath:m.string().min(1),materializationSpec:p.optional(),triggerPayload:a.optional(),triggerMode:B.default(`immediate`),scope:C.optional()}),response:m.object({executionId:m.string()})},registerExternalExecution:{request:Ut,response:m.object({executionId:m.string(),frameId:m.string().optional()})},completeExternalExecution:{request:Wt,response:m.object({success:m.boolean()})},resolveRole:{request:m.object({roleId:m.string().min(1)}),response:F},resolveAgent:{request:m.object({agentId:m.string().min(1)}),response:Be},getRunContext:{request:m.object({executionId:m.string().min(1)}),response:Nt},"execution.started":m.object({executionId:m.string(),workflowId:m.string(),coordinatorSessionId:m.string().optional(),startedAt:m.number().nonnegative().optional(),artifactRef:_.optional()}),"execution.completed":m.object({executionId:m.string(),workflowId:m.string(),totalDuration:m.number(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.failed":m.object({executionId:m.string(),workflowId:m.string(),error:m.string(),failedStepId:m.string().optional(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.cancelled":m.object({executionId:m.string(),workflowId:m.string(),reason:m.string().optional(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.progress":m.object({executionId:m.string().min(1),workflowId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),progress:Gt,emittedAt:m.number().int().nonnegative()}),"execution.paused":g.schema(m.object({executionId:m.string(),workflowId:m.string(),pausedAtGateId:m.string().min(1),pausedAtFrameId:m.string().min(1)}),{traceAll:!0}),"step.beforeStart":U,"step.started":U.extend({sessionId:m.string().optional(),subagentId:m.string().optional()}),"step.completed":U.extend({result:o.optional(),duration:m.number()}),"step.failed":U.extend({error:m.string()}),"step.skipped":U.extend({reason:m.string().optional(),condition:m.string().optional()}),"gate.requested":qt,"gate.awaitApproval":{request:qt,response:m.object({action:m.enum([`approve`,`reject`]),source:m.enum([`user`,`timeout`]),reason:m.string().optional()})},"gate.respond":{request:m.object({executionId:m.string(),gateId:m.string(),action:m.enum([`approve`,`reject`]),frameId:m.string().optional(),resumeData:o,reason:m.string().optional()}),response:m.object({accepted:m.boolean()})},"gate.resolved":Kt,"frame.started":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),nodeType:E,path:m.array(m.string()),parentFrameId:m.string().optional(),startedAt:m.number().nonnegative().optional()}),"frame.completed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),output:o.optional(),duration:m.number().nonnegative().optional(),completedAt:m.number().nonnegative().optional()}),"frame.failed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),error:m.string(),duration:m.number().nonnegative().optional(),completedAt:m.number().nonnegative().optional()}),"frame.sessionLinked":m.object({executionId:g.attribute(m.string(),`makaio.execution.id`),frameId:g.attribute(m.string(),`makaio.frame.id`),sessionId:g.attribute(m.string(),`makaio.session.id`)}).strict(),"gate.suspended":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),schema:r,prompt:m.string().optional(),title:m.string().optional(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().nullable(),openedAt:m.number()}),"gate.resumed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),resumeData:o}),"dynamic.materialized":m.object({executionId:m.string(),frameId:m.string(),factoryId:m.string().min(1),materializedNodes:m.number().int().nonnegative()}),"artifact.updated":m.object({executionId:m.string(),frameId:m.string(),artifactRef:m.object({kind:m.string().min(1),id:m.string().min(1)}),paths:m.array(m.string()),operation:m.string().min(1),revision:m.string().min(1).optional()}),"worklog.get":{request:m.object({executionId:m.string().min(1)}),response:m.object({summary:H.nullable()})},"worklog.frame.get":{request:m.object({frameId:m.string().min(1)}),response:m.object({frame:Pt.nullable()})},"worklog.list":{request:m.object({workflowId:m.string().min(1).optional(),status:M.optional(),limit:m.number().int().positive().optional(),offset:m.number().int().nonnegative().optional()}),response:m.object({items:m.array(H),total:m.number().int().nonnegative()})},"worklog.stats":{request:m.object({workflowId:m.string().min(1).optional(),since:m.number().int().nonnegative().optional(),until:m.number().int().nonnegative().optional()}),response:m.object({stats:Rt})},"worklog.changed":m.object({executionId:m.string().min(1)}),"state.get":{request:m.object({executionId:m.string().min(1)}),response:m.object({executionId:m.string().min(1),sequence:m.number().int().nonnegative(),value:o})},"state.patch":{request:m.object({executionId:m.string().min(1),expectedSequence:m.number().int().nonnegative(),patch:m.array(z),nextValue:o}),response:m.object({executionId:m.string().min(1),sequence:m.number().int().positive(),value:o})},"state.updated":m.object({executionId:m.string().min(1),sequence:m.number().int().positive(),patch:m.array(z),value:o,updatedAt:m.number().int().positive()})},Yt=h(`workflow`,Jt),Xt=Yt.subjects;function Zt(e,t){G(e,t,void 0,0,[],`root`,void 0,void 0)}function G(e,t,n,r,i,a,o,s){let c={parent:n,depth:r,ancestors:i,relationship:a,...o!==void 0&&{index:o},...s!==void 0&&{branchKey:s}};if(t.enter?.(e,c)===!1)return;let l=[...i,e.id],u=r+1;switch(e.type){case`sequence`:{let n=e;for(let r=0;r<n.nodes.length;r++)G(n.nodes[r],t,e,u,l,`sequence-child`,r,void 0);break}case`parallel`:{let n=e;for(let[r,i]of Object.entries(n.branches))G(i,t,e,u,l,`parallel-branch`,void 0,r);break}case`iterate`:G(e.body,t,e,u,l,`iterate-body`,void 0,void 0);break;case`iterate-chain`:G(e.body,t,e,u,l,`iterate-chain-body`,void 0,void 0);break;case`loop`:G(e.body,t,e,u,l,`loop-body`,void 0,void 0);break}t.leave?.(e,c)}function Qt(e){switch(e){case`station`:case`delegate-agent`:case`delegate-role`:case`gate`:return`leaf`;case`parallel`:case`iterate`:case`iterate-chain`:case`loop`:return`control`;case`sequence`:return`structural`}}function $t(e,t,n){return e===`parallel-branch`&&t!==void 0?[{kind:`branch`,key:t}]:e===`sequence-child`&&n!==void 0?[{kind:`index`,value:n}]:e===`iterate-body`||e===`iterate-chain-body`||e===`loop-body`?[{kind:`body`}]:[]}function en(e){return e.replace(/\\/g,`\\\\`).replace(/\//g,`\\/`)}function tn(e){return e.map(e=>{switch(e.kind){case`node`:return`n:${en(e.id)}`;case`branch`:return`b:${en(e.key)}`;case`index`:return`i:${e.value}`;case`body`:return`body`}}).join(`/`)}function nn(e){let t=[],n=[],r=new Map,i=[],a=[],o=[];return Zt(e.root,{enter(e,s){let c=$t(s.relationship,s.branchKey,s.index),l={kind:`node`,id:e.id};i.push(...c,l),o.push(c.length+1);let u=[...i],d=tn(u),f=a.at(-1);if(t.push({key:d,nodeId:e.id,type:e.type,role:Qt(e.type),path:u,parentKey:f,...s.branchKey!==void 0&&{branchKey:s.branchKey}}),f!==void 0&&s.parent!==void 0)switch(s.parent.type){case`sequence`:{n.push({sourceKey:f,targetKey:d,kind:`contains`});let e=r.get(f);e!==void 0&&n.push({sourceKey:e,targetKey:d,kind:`sequence`}),r.set(f,d);break}case`parallel`:n.push({sourceKey:f,targetKey:d,kind:`branch`});break;case`iterate`:case`iterate-chain`:case`loop`:n.push({sourceKey:f,targetKey:d,kind:`body`});break;default:n.push({sourceKey:f,targetKey:d,kind:`contains`});break}a.push(d)},leave(){let e=o.pop()??0;i.splice(i.length-e,e),a.pop()}}),{nodes:t,edges:n}}const rn=`makaio.bus-event`,an=`makaio.cron`,on=`UTC`;function K(e,t,n){return{kind:e,params:t,...n.filter!==void 0&&{filter:n.filter},...n.filterExpression!==void 0&&{filterExpression:n.filterExpression}}}function sn(e,t){let n=i.parse(t.params);return e.paramsSchema.parse(n),K(e.kind,n,t)}function cn(e){return K(rn,{subject:re(e.subject)},e)}const ln=m.object({schedule:m.string().min(1),timezone:m.string().min(1).default(`UTC`)});function un(e){return K(an,ln.parse(e),{})}function q(e){return J(e.body.nodes,e.id)}function J(e,t){for(let n of e){if(n.type===`loop`)return`Nested loop '${n.id}' found inside loop '${t}' — V1 does not support nested loops`;if(n.type===`sequence`){let e=J(n.nodes,t);if(e)return e}if(n.type===`parallel`)for(let e of Object.values(n.branches)){let n=J(e.nodes,t);if(n)return n}if(n.type===`iterate`||n.type===`iterate-chain`){let e=n.body,r=J(e.nodes,t);if(r)return r}}}const Y=new WeakMap,dn=new WeakMap;function X(e,t,n){let r=Y.get(e);if(r!==void 0&&t.set(e.id,r),e.type===`sequence`)for(let r of e.nodes)X(r,t,n);else if(e.type===`parallel`)for(let r of Object.values(e.branches))X(r,t,n);else if(e.type===`iterate`)X(e.body,t,n);else if(e.type===`iterate-chain`)X(e.body,t,n);else if(e.type===`loop`){if(n!==void 0){let t=dn.get(e);t!==void 0&&n.set(e.gate.handler,t)}X(e.body,t,n)}}function fn(e,t,n){let r={id:e,type:`station`,prompt:e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}};return Y.set(r,t),r}function pn(e,t,n){return{id:e,type:`delegate-agent`,agentId:t.agentId,...t.inputExpression!==void 0&&{inputExpression:t.inputExpression},...t.outputSchema!==void 0&&{outputSchema:t.outputSchema},...t.allowedTools!==void 0&&{allowedTools:t.allowedTools},...t.completion!==void 0&&{completion:t.completion},...t.resultFinalizerId!==void 0&&{resultFinalizerId:t.resultFinalizerId},...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}}}function mn(e,t,n){return{id:e,type:`delegate-role`,role:t,prompt:n?.prompt??e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip},...n?.outputSchema!==void 0&&{outputSchema:n.outputSchema},...n?.timeoutMs!==void 0&&{timeoutMs:n.timeoutMs},...n?.completion!==void 0&&{completion:n.completion},...n?.allowedTools!==void 0&&{allowedTools:n.allowedTools},...n?.resultFinalizerId!==void 0&&{resultFinalizerId:n.resultFinalizerId}}}function hn(e,t){return{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:s(t.resume)}}}function gn(e,t,n){let r=`${e}__item`,i={id:r,type:`station`,prompt:r},a={id:e,type:`iterate`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:[i]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}};return Y.set(i,t),a}function _n(e,t,n){return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function vn(e,t,n){let r={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:`${e}__body`,type:`sequence`,nodes:t},gate:yn(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},i=q(r);if(i!==void 0)throw Error(i);return dn.set(r,n.gate.evaluate),r}function yn(e){let t=e.gate.escalation;return{handler:e.gate.handler,...e.gate.input!==void 0&&{input:e.gate.input},...e.gate.config!==void 0&&{config:e.gate.config},...t!==void 0&&{escalation:{prompt:t.prompt,autoAction:t.autoAction??`reject`,timeoutMs:t.timeoutMs??null,...t.title!==void 0&&{title:t.title},...t.resumeSchema!==void 0&&{resumeSchema:t.resumeSchema}}}}}function Z(e,t){if(e.has(t))throw Error(`Duplicate step ID: ${t}`);e.add(t)}function Q(e,t){if(Z(e,t.id),t.type===`sequence`)for(let n of t.nodes)Q(e,n);else if(t.type===`parallel`)for(let n of Object.values(t.branches))Q(e,n);else (t.type===`iterate`||t.type===`iterate-chain`||t.type===`loop`)&&Q(e,t.body)}function bn(e,t,n,r,i){let a={};return t.forEach((t,o)=>{if(t.id.length===0)throw Error(`parallel branch at index ${o} has an empty ID`);let s=t.id,c=`${e}__${s}`;Q(n,t),Z(n,c),X(t,r,i),a[s]={id:c,type:`sequence`,nodes:[t]}}),a}function xn(e,t,n,r,i){let a=`${e}__body`,o=`${e}__item`;Z(r,a),Z(r,o),i.set(o,t);let s={id:o,type:`station`,prompt:o};return{id:e,type:`iterate`,collection:n.collection,body:{id:a,type:`sequence`,nodes:[s]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Sn(e,t,n){return t.resume!==void 0&&(n[e]=t.resume),{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:s(t.resume)}}}function Cn(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:o,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function wn(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);let s={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:o,type:`sequence`,nodes:t},gate:yn(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},c=q(s);if(c!==void 0)throw Error(c);return a.set(n.gate.handler,n.gate.evaluate),s}function Tn(e,t){e.input=n=>(t.zodSchemas.input=n,t.definition.inputSchema=s(n),e),e.config=n=>(t.zodSchemas.config=n,t.definition.configSchema=s(n),e),e.output=n=>(t.zodSchemas.output=n,t.definition.outputSchema=s(n),e),e.artifact=n=>(n.schema!==void 0&&(t.zodSchemas.artifact=n.schema),t.definition.artifact={kind:n.kind,schemaVersion:n.schemaVersion,scope:n.scope,...n.resolve!==void 0&&{resolve:n.resolve},...n.create!==void 0&&{create:n.create},...n.statusPath!==void 0&&{statusPath:n.statusPath}},e),e.state=e=>(t.definition.state={schema:e.schema,...e.initial!==void 0&&{initial:e.initial}},$(t))}function En(e,t){let{rootNodes:n,runtimeHandlers:r,runtimeLoopGates:i,registeredIds:a,zodGates:o}=t;e.station=(t,i,o)=>(Z(a,t),n.push({id:t,type:`station`,prompt:t,...o?.when!==void 0&&{when:o.when},...o?.skip!==void 0&&{skip:o.skip}}),r.set(t,i),e),e.delegateToAgent=(t,r,i)=>(Z(a,t),n.push(pn(t,r,i)),e),e.delegateToRole=(t,r,i)=>(Z(a,t),n.push(mn(t,r,i)),e),e.parallel=(t,o,s)=>(Z(a,t),n.push({id:t,type:`parallel`,mode:o.mode??`all-settled`,branches:bn(t,s,a,r,i),...o.when!==void 0&&{when:o.when},...o.skip!==void 0&&{skip:o.skip}}),e),e.gate=(t,r)=>(Z(a,t),n.push(Sn(t,r,o)),e),e.iterate=(t,i,o)=>(Z(a,t),n.push(xn(t,i,o,a,r)),e),e.iterateChain=(t,o,s)=>(Z(a,t),n.push(Cn(t,o,s,a,r,i)),e),e.loop=(t,o,s)=>(Z(a,t),n.push(wn(t,o,s,a,r,i)),e),e.addNode=e=>Dn(e,a,r,i,n)}function Dn(e,t,n,r,i){Q(t,e),X(e,n,r),i.push(e)}function $(e){let t={id:e.definition.id,definition:e.definition,runtimeHandlers:e.runtimeHandlers,runtimeFactories:e.runtimeFactories,runtimeLoopGates:e.runtimeLoopGates,source:void 0,get zodSchemas(){return e.zodSchemas},addTrigger(t){return e.triggers.push(t),$(e)}};return Tn(t,e),En(t,e),t}function On(e,t){let n=[],r=new Map,i=new Map,a=new Set,o={},s={gates:o},c=new Map,l=t?.triggers?[...t.triggers]:[];return $({rootNodes:n,runtimeHandlers:r,runtimeFactories:c,runtimeLoopGates:i,registeredIds:a,zodGates:o,zodSchemas:s,definition:{id:e,...t?.name!==void 0&&{name:t.name},...t?.description!==void 0&&{description:t.description},...t?.successFinalizerId!==void 0&&{successFinalizerId:v.parse(t.successFinalizerId)},root:{id:`${e}__root`,type:`sequence`,nodes:n},triggers:l,scope:{type:`global`}},triggers:l})}function kn(e){if(e.workflows.length===0)throw Error(`defineWorkflowBundle: workflows must not be empty`);return{workflows:Object.freeze([...e.workflows])}}const An=m.enum([`artifact.created`,`artifact.revised`,`artifact.status.changed`]),jn=m.record(m.string(),o),Mn=m.object({type:m.string().min(1),input:m.record(m.string(),o).optional()}),Nn=m.object({id:m.string().min(1),description:m.string().optional(),on:An,when:jn.optional(),action:Mn,enabled:m.boolean().default(!0)});export{xt as $,D as $t,Ht as A,M as At,Nt as B,Ee as Bt,Zt as C,_ as Cn,Je as Ct,Xt as D,Ue as Dt,Jt as E,We as Et,H as F,Ce as Ft,kt as G,Re as Gt,At as H,Pe as Ht,Pt as I,Se as It,yt as J,P as Jt,Ot as K,ze as Kt,It as L,w as Lt,Ut as M,Ze as Mt,Ft as N,Me as Nt,Wt as O,He as Ot,zt as P,T as Pt,wt as Q,Ne as Qt,Rt as R,Fe as Rt,nn as S,ve as Sn,Ye as St,Gt as T,ae as Tn,Ge as Tt,B as U,N as Ut,jt as V,De as Vt,Dt as W,C as Wt,bt as X,Ae as Xt,Ct as Y,je as Yt,Et as Z,Ve as Zt,cn as _,pe as _n,at as _t,kn as a,F as an,L as at,un as b,ue as bn,it as bt,mn as c,Ie as cn,ut as ct,_n as d,_e as dn,lt as dt,O as en,Tt as et,vn as f,b as fn,tt as ft,rn as g,fe as gn,ct as gt,sn as h,he as hn,$e as ht,Nn as i,Be as in,pt as it,Vt as j,Xe as jt,Bt as k,Ke as kt,hn as l,A as ln,rt as lt,q as m,y as mn,et as mt,jn as n,Te as nn,ht as nt,On as o,k as on,ft as ot,fn as p,x as pn,nt as pt,St as q,ke as qt,An as r,Oe as rn,mt as rt,pn as s,we as sn,dt as st,Mn as t,E as tn,z as tt,gn as u,ge as un,st as ut,an as v,de as vn,Qe as vt,Yt as w,oe as wn,qe as wt,on as x,ye as xn,ot as xt,ln as y,v as yn,I as yt,Lt as z,j as zt};
@@ -1 +0,0 @@
1
- import{resolveMakaioHome as e}from"./runtime-node/makaio-config.mjs";import{t}from"./extension-package-provenance-aYrZuS4W.mjs";import{n,o as r,t as i}from"./await-trigger-Bkg2BQfg.mjs";import*as a from"node:fs/promises";import{access as o}from"node:fs/promises";import*as s from"node:path";import{basename as c,join as l}from"node:path";import*as u from"node:crypto";import{constants as d}from"node:fs";import{createBusInstance as f,waitForSubscriptionPropagation as p}from"@makaio/framework/bus";import{AdapterSubjects as m,BoundedRecoveryEvidenceSchema as h,FrameworkContractNamespaces as g,FrameworkStorageNamespaces as _,PROVIDER_ALLOCATION_REF_VERSION as ee,ProviderAllocationRefSchema as te,RECOVERY_EVIDENCE_LIMITS as v,WorkerNodeCapabilitiesSchema as ne,WorkerNodeSubjects as y,WorkflowSubjects as re,WorkflowWorkerConfigSchema as ie,createWorkflowCancelSubject as ae}from"@makaio/framework/contracts";import{ExtensionCoordinator as oe,KernelSubjects as se,coalesceExtensionOverrides as ce,filterEligibleExtensions as le}from"@makaio/framework/kernel";import{BaseService as ue}from"@makaio/framework/service-base";import{AdapterRuntimeSubjects as de,registerAdapterRuntimeIdentityHandlers as fe}from"@makaio/framework/services/adapter-runtime";import{CLIDetectionNamespace as pe,CLIDetectionSubjects as me}from"@makaio/framework/services/cli-detection/namespace";import{SessionOrchestratorToken as he,ToolRegistryToken as ge,canonicalModelPackage as _e,createSubagentServicePackage as ve,createToolContributionProcessor as ye,frameworkCorePackages as b,sessionBridgePackage as be,sessionOrchestratorPackage as xe,sessionPackage as Se,sessionStoragePackage as Ce,toolRegistryPackage as we}from"@makaio/framework/services";import{AdapterSubsystemSubjects as x}from"@makaio/framework/services/adapter-subsystem";import{createClientsCorePackage as Te}from"@makaio/framework/clients";import{AdapterSubsystemToken as S,createAdapterSubsystemContributionProcessor as Ee,createAdapterSubsystemPackage as De,orderAfterAdapterSubsystem as Oe}from"@makaio/framework/adapter-subsystem";import{execa as ke}from"execa";import Ae from"piscina";import{ExecutionAttemptAuthority as je,runAuthorityDispatchedAttempt as Me}from"@makaio/framework/workflow-engine";import{runWorkflowOrchestrator as Ne}from"@makaio/framework/workflow-engine/workflow-orchestrator";function C(e){return e.on(m.getCapabilities,async t=>{let{adapterName:n,adapterId:r}=t.payload;if(r){await t.next();return}if(n){let r=await e.requestOptional(de.resolveId,{adapterName:n}),i=r.handled?r.data.adapterId:void 0;i&&(t.payload.adapterId=i)}await t.next()},{priority:20})}function w(e){let{coordinator:t,configRepository:n,platformDefaults:r,prepareAuthRuntime:i,runtimeSnapshotHandlerPriority:a,runtimeDefinitionHandlerPriority:o}=e,s=De({configRepository:n,coordinator:t,platformDefaults:r,...i!==void 0&&{prepareAuthRuntime:i},...a!==void 0&&{runtimeSnapshotHandlerPriority:a},...o!==void 0&&{runtimeDefinitionHandlerPriority:o}});return t.registerContributionProcessor(Ee({getAdapterSubsystemService:()=>t.getExtensionService(S)})),{adapterSubsystemPackage:s}}function T(e){let{bus:t,currentMachineId:n}=e,r=fe(t,{currentMachineId:n,listKnownAdapterNames:e.listKnownAdapterNames??(async()=>{let{configs:e}=await t.request(x.listAdapterConfigs,{});return e.map(e=>e.name)}),...e.resolveLiveAdapterId!==void 0&&{resolveLiveAdapterId:e.resolveLiveAdapterId},...e.resolveLiveAdapterIdentity!==void 0&&{resolveLiveAdapterIdentity:e.resolveLiveAdapterIdentity},...e.listLiveAdapterIdentities!==void 0&&{listLiveAdapterIdentities:e.listLiveAdapterIdentities}}),i=C(t);return{cleanup:()=>{r.cleanup(),i()}}}function E(e,t){if(!(e instanceof Error))return!1;let{rootPackageName:n,subpath:r}=Pe(t),i=(r===void 0?[t]:[t,n]).flatMap(e=>[`Cannot find package '${e}'`,`Cannot find module '${e}'`,`Cannot find package "${e}"`,`Cannot find module "${e}"`]),a=e;return(a.code===`ERR_MODULE_NOT_FOUND`||a.code===`MODULE_NOT_FOUND`)&&i.some(t=>e.message.includes(t))||a.code===`ERR_PACKAGE_PATH_NOT_EXPORTED`&&r!==void 0&&e.message.includes(`Package subpath '${r}' is not defined by "exports"`)&&Fe(e.message,n)?!0:i.some(t=>e.message.includes(t))}async function D(e){try{return await import(e)}catch(t){if(E(t,e))return null;throw t}}function Pe(e){let t=e.split(`/`);return e.startsWith(`@`)?{rootPackageName:t.slice(0,2).join(`/`),subpath:t.length>2?`./${t.slice(2).join(`/`)}`:void 0}:{rootPackageName:t[0]??e,subpath:t.length>1?`./${t.slice(1).join(`/`)}`:void 0}}function Fe(e,t){let n=t,r=t.replaceAll(`/`,`\\`);return e.includes(`/${n}/package.json`)||e.includes(`\\${r}\\package.json`)}async function O(e,t=process.env,n=process.platform){let r=t[Object.keys(t).find(e=>e.toUpperCase()===`PATH`)??`PATH`]??``,i=(t.PATHEXT??`.EXE;.CMD;.BAT;.COM`).split(`;`).filter(Boolean),a=n===`win32`?s.extname(e)===``?i:[``,...i]:[``];for(let t of r.split(s.delimiter)){let n=t.replace(/^"|"$/gu,``),r=s.resolve(n||process.cwd());for(let t of a){let n=s.join(r,`${e}${t}`);try{return await o(n,d.X_OK),n}catch{}}}}async function k(e,t=5e3,n=1e3){let{stdout:r}=await ke(e,[`--version`],{forceKillAfterDelay:n,timeout:t});return r}function Ie(e){return e.match(/(\d+\.\d+\.\d+)/u)?.[1]??`unknown`}async function Le(e,t=O,n=k){try{let r=await t(e);if(r===void 0)return{binary:e,found:!1};let i=await n(r);return i.length===0?{binary:e,found:!1}:{binary:e,found:!0,path:r,version:Ie(i)}}catch{return{binary:e,found:!1}}}async function Re(e,t=O,n=k){return Promise.all(e.map(e=>Le(e,t,n)))}var ze=class extends ue{constructor(e){super(e)}onInit(){this.registerHandler(me.scan,async e=>{let t=await Re(e.payload.binaries);e.setResult({results:t})})}};const A={name:`makaio.cli-detection`,displayName:`CLI Detection`,version:`0.1.0`,critical:!0,surface:`any`,namespaces:[pe],create:e=>new ze(e.bus)};function j(e,t){e.push(...Be(t))}function Be(e){return e===void 0?[]:typeof e==`function`?[e]:[...e]}function Ve(e,t=[]){let n=new Set([e]),r=new Set,i=new Map;for(let e of t)typeof e==`string`?n.add(e):(r.add(e.id),e.version!==void 0&&i.set(e.id,e.version));return{hosts:n,capabilities:r,...i.size>0?{capabilityVersions:i}:{}}}function He(e=[]){return e.some(e=>typeof e==`string`&&e===`node`)?e:[`node`,...e]}function M(e){return ce(le(We(e.packages,e.configProvider),e.surface,e.runtimeEnvironment))}function Ue(e,n){let r=M(n),i=new Set(r.map(t));return e.filter(({ownerPackage:e})=>i.has(e)).map(({package:e})=>e)}function We(e,t){return t?e.filter(e=>t.loadEnabled(e.name)!==!1):e}function N(e,t){return e.filter(e=>e.runtimeOwnership?.[t]===!0).map(e=>e.name)}function Ge(e,t){let n=N(e,t);if(n.length>1)throw Error(`Multiple extensions own runtimeOwnership.${t}: ${n.join(`, `)}`)}function P(e){return Ge(e,`sessionOrchestrator`),N(e,`sessionOrchestrator`).length===0}function Ke(e){return e===!0||P(e)?b:b.filter(e=>e.name!==he.name)}function F(e,t,n){let r=[];try{for(let i of e){let e=i.runtimeBoot;e&&j(r,e.configure({bus:t,registerContributionProcessor:e=>{r.push(n.registerContributionProcessor(e))},forEachActiveExtension:e=>{n.forEachActiveExtension(e)}}))}}catch(e){let t=[];for(let e of[...r].reverse())try{e()}catch(e){t.push(e)}throw t.length>0?AggregateError([e,...t],`Extension boot contribution failed and rollback cleanup reported additional errors`,{cause:e}):e}return r}function qe(){let e=process.env.MAKAIO_SKIP_EXTENSIONS;if(!e)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(t)}var Je=class{pool;constructor(e){this.pool=new Ae({filename:e.workerEntry,maxThreads:e.maxConcurrency??4,idleTimeout:e.idleTimeoutMs??3e4})}async run(e,t){return this.pool.run(e,{signal:t})}onMessage(e){return this.pool.on(`message`,e),()=>this.pool.off(`message`,e)}async dispose(){await this.pool.destroy()}},I=class extends Error{code;constructor(e,t){super(e),this.code=t,this.name=`MaterializationError`}};function L(e,t,n){let r=s.resolve(t)+s.sep,i=s.resolve(e);if(i!==s.resolve(t)&&!i.startsWith(r))throw new I(`${n} escapes allowed root: ${e} is not within ${t}`,`containment-violation`)}async function R(e,t,n,r){let i=r??await a.realpath(t),o;try{o=await a.realpath(e)}catch{return e}let c=i+s.sep;if(o!==i&&!o.startsWith(c))throw new I(`${n} escapes allowed root via symlink: real path ${o} is not within ${i}`,`symlink-escape`);return o}function z(e){let t=e.indexOf(`-`);if(t===-1)throw new I(`Invalid SRI integrity format: ${e}`,`contribution-integrity-mismatch`);return{algorithm:e.slice(0,t),digest:e.slice(t+1)}}async function Ye(e,t){let n=await a.readFile(e);return u.createHash(t).update(n).digest(`base64`)}const B=new Set([`.git`,`node_modules`]);function Xe(e){return B.has(e.toLowerCase())}async function Ze(e,t){let n=t.toLowerCase();if(!B.has(n))return!1;if(t===n)return!0;try{let[r,i]=await Promise.all([a.lstat(s.join(e,t)),a.lstat(s.join(e,n))]);return r.dev===i.dev&&r.ino===i.ino}catch(e){if(e.code===`ENOENT`)return!1;throw e}}const Qe=B,$e=new Set([`.DS_Store`]);async function V(e,t){let n=u.createHash(t),r=[];async function i(t){let n=await a.readdir(t,{withFileTypes:!0});for(let a of n){let n=s.join(t,a.name);if(a.isSymbolicLink())throw new I(`Contribution package contains a symbolic link: ${s.relative(e,n)}`,`symlink-escape`);if(a.isDirectory()){Qe.has(a.name)||await i(n);continue}if(a.isFile()){$e.has(a.name)||r.push(s.relative(e,n));continue}throw new I(`Contribution package contains an unsupported filesystem entry: ${s.relative(e,n)}`,`contribution-integrity-mismatch`)}}await i(e),r.sort();for(let t of r)n.update(t.split(s.sep).join(`/`)),n.update(`\0`),n.update(await a.readFile(s.join(e,t))),n.update(`\0`);return`${t}-${n.digest(`base64`)}`}async function H(e,t=`sha256`){let n=u.createHash(t),r=[];async function i(t){let n=await a.readdir(t,{withFileTypes:!0});for(let a of n){let n=s.join(t,a.name);if(!await Ze(t,a.name)){if(a.isDirectory()){await i(n);continue}if(a.isFile()){r.push(s.relative(e,n));continue}throw a.isSymbolicLink()?new I(`Workspace root contains a symbolic link: ${s.relative(e,n)}`,`symlink-escape`):new I(`Workspace root contains an unsupported filesystem entry: ${s.relative(e,n)}`,`unsupported-filesystem-entry`)}}}await i(e),r.sort();for(let t of r){n.update(t),n.update(`\0`);let r=await a.readFile(s.join(e,t));n.update(r),n.update(`\0`)}return`${t}-${n.digest(`base64`)}`}async function U(e,t,n){let r=s.join(t,`node_modules`,e.packageName);L(r,t,`Contribution package directory`),await R(r,t,`Contribution package directory`,n);let i=s.join(r,`package.json`),o;try{o=await a.readFile(i,`utf-8`)}catch{throw new I(`Contribution package not found: ${e.packageName} (expected at ${r})`,`contribution-missing`)}let c=JSON.parse(o);if(c.name!==e.packageName)throw new I(`Contribution identity mismatch: expected ${e.packageName}, found ${c.name??`<none>`}`,`contribution-missing`);if(c.version!==e.version)throw new I(`Contribution version mismatch for ${e.packageName}: expected ${e.version}, found ${c.version??`<none>`}`,`contribution-version-mismatch`);let l=s.join(r,e.entrypoint);L(l,r,`Contribution entrypoint`),await R(l,t,`Contribution entrypoint`,n);try{await a.access(l)}catch{throw new I(`Contribution entrypoint not found for ${e.packageName}: ${e.entrypoint}`,`contribution-entrypoint-mismatch`)}let{algorithm:u}=z(e.integrity),d;try{d=await V(r,u)}catch(t){if(t instanceof I)throw t;let n=typeof t==`object`&&t&&`code`in t&&typeof t.code==`string`?t.code:void 0;throw n!==void 0&&!n.startsWith(`ERR_`)?new I(`Contribution package cannot be read for ${e.packageName}`,`contribution-entrypoint-mismatch`):t}if(d!==e.integrity)throw new I(`Contribution integrity mismatch for ${e.packageName}: expected ${e.integrity}, computed ${d}`,`contribution-integrity-mismatch`);return l}async function W(e,t,n){let r=await n.resolveWorkspaceRoot(e.workspaceId);if(r===void 0)throw new I(`Unknown workspace ID: ${e.workspaceId}`,`unknown-workspace`);try{if(!(await a.stat(r)).isDirectory())throw new I(`Workspace root is not a directory: ${r}`,`containment-violation`)}catch(e){throw e instanceof I?e:new I(`Workspace root does not exist: ${r}`,`containment-violation`)}let i=await a.realpath(r),o=s.resolve(r,e.sourcePath);if(L(o,r,`Source path`),s.relative(r,o).split(s.sep).some(Xe))throw new I(`Workflow source path selects excluded workspace content: ${e.sourcePath}`,`source-path-mismatch`);await R(o,r,`Source path`,i);let c=await H(r);if(c!==e.rootDigest)throw new I(`Workspace root digest mismatch: expected ${e.rootDigest}, computed ${c}`,`digest-mismatch`);try{await a.access(o)}catch{throw new I(`Workflow source file not found: ${o}`,`source-missing`)}return{workspaceRoot:r,sourcePath:o,contributionEntrypoints:await Promise.all(t.map(e=>U(e,r,i))),platform:process.platform,arch:process.arch}}var G=class{options;manifest;pool;constructor(e){this.options=e,this.manifest=e.manifest}async run(e,t,n){this.pool??=new Je(this.options);let r=n??this.manifest,i=await this.materializeTask(e,r,t);return{state:`uncommitted`,result:await this.pool.run(i,t)}}runWithReadiness(e,t,n){this.pool??=new Je(this.options);let i=this.pool,a,o=!1,s,c=new Promise((t,n)=>{s=n,a=i.onMessage(n=>{r(n)&&(n.executionId!==e.executionId||n.cancelSubject!==e.cancelSubject||(o=!0,a?.(),t(n)))})}),l=n??this.manifest,u=this.materializeTask(e,l,t).then(e=>i.run(e,t));return u.then(()=>{o||(o=!0,a?.(),s(Error(`Workflow worker completed before ready signal: ${e.executionId}`)))},e=>{o||(o=!0,a?.(),s(e instanceof Error?e:Error(String(e))))}),{result:u,ready:c}}async dispose(){await this.pool?.dispose()}async materializeTask(e,t,n){if(n.throwIfAborted(),!(e.source.kind===`path`||t.contributionRefs.length>0))return{config:e,manifest:t,contributionEntrypoints:[]};let r=e.materializationSpec;if(r?.kind!==`local-directory`)throw Error(`ThinWorkflowPiscinaRunner requires a local-directory materialization spec for path-backed workflows or declared contributions.`);if(this.options.resolveWorkspaceRoot===void 0)throw Error(`ThinWorkflowPiscinaRunner requires a host workspace-root resolver for local-directory materialization.`);let i=await W(r,t.contributionRefs,{resolveWorkspaceRoot:this.options.resolveWorkspaceRoot});if(n.throwIfAborted(),e.source.kind!==`path`)throw Error(`local-directory materialization requires a path-backed workflow source.`);return{config:{...e,source:{kind:`path`,path:i.sourcePath}},manifest:t,contributionEntrypoints:i.contributionEntrypoints}}};function K(e){return e.mode===`source`?l(e.moduleDir,`workflow-worker`,`worker-entry.ts`):l(e.moduleDir,`workflow-worker`,`worker-entry.mjs`)}var q=class{options;constructor(e){this.options=e}async run(e,t,n,r){let i={...e,terminalAuthority:`authority`},a=n??this.options.manifest,o=this.options.requirements,s=r?.dispatchMetadata;return Me({authority:this.options.authority,executionId:e.executionId,dispatch:e=>this.options.dispatch({executionAttemptId:e,config:i,...a!==void 0&&{manifest:a},...o!==void 0&&{requirements:o},...s!==void 0&&{metadata:s}},t)})}},J=class{#e;constructor(e){this.#e=e.bus}async run(e,t,r){let a=ie.parse(e),o=await n(a);return{state:`uncommitted`,result:await Ne({config:await i(a,o,this.#e,t),loaded:o,bus:this.#e,signal:t})}}};function et(){return{contributionRefs:[]}}function tt(e){if(e.workflowRunner?.mode===`worker-node`&&!e.executionAttemptRepository)throw Error(`WorkerNode dispatch mode requires an ExecutionAttemptRepository. Pass 'executionAttemptRepository' to createNodeWorkflowRunnerPackageOptions when workflowRunner.mode is 'worker-node'.`);let t=e.executionAttemptRepository?new je(e.executionAttemptRepository):void 0,n=c(e.runtimeModuleDir)===`src`?`source`:`dist`,r=Y({moduleDir:e.runtimeModuleDir,defaultWorkerEntryMode:n,runner:e.workflowRunner,bus:e.bus,authority:t});return{...r!==void 0&&{workflowRunner:r},executorConfig:{busUrl:e.busUrl,busAuth:{kind:`none`},platformDefaults:e.platformDefaults,makaioHome:e.makaioHome},...e.executionAttemptRepository!==void 0&&{executionAttemptRepository:e.executionAttemptRepository},...t!==void 0&&{executionAttemptAuthority:t},...e.workflowMaterializationSpecResolvers!==void 0&&{workflowMaterializationSpecResolvers:e.workflowMaterializationSpecResolvers}}}function Y(e){let{runner:t}=e;if(t)switch(t.mode){case void 0:case`in-process`:if(e.bus===void 0)throw Error(`InProcessWorkflowRunner requires a bus instance. Pass 'bus' to createNodeWorkflowRunner when runner.mode is 'in-process'.`);return new J({bus:e.bus});case`worker-node`:{if(e.authority===void 0)throw Error(`WorkerNodeRunner requires an ExecutionAttemptAuthority. Pass 'authority' to createNodeWorkflowRunner when runner.mode is 'worker-node'.`);let n=e.bus,r=t.dispatch??(n===void 0?void 0:(e,t)=>n.request(y.dispatch,{executionAttemptId:e.executionAttemptId,config:e.config,manifest:e.manifest,requirements:e.requirements,metadata:e.metadata},{signal:t}));if(r===void 0)throw Error(`WorkerNodeRunner requires either a dispatch function or a bus instance. Pass 'bus' to createNodeWorkflowRunner when runner.mode is 'worker-node'.`);return new q({dispatch:r,authority:e.authority,...t.manifest!==void 0&&{manifest:t.manifest},...t.requirements!==void 0&&{requirements:t.requirements}})}case`piscina`:return new G({workerEntry:t.workerEntry??K({moduleDir:e.moduleDir,mode:t.workerEntryMode??e.defaultWorkerEntryMode}),manifest:t.manifest??et(),...t.resolveWorkspaceRoot!==void 0&&{resolveWorkspaceRoot:t.resolveWorkspaceRoot},maxConcurrency:t.maxConcurrency,idleTimeoutMs:t.idleTimeoutMs})}}const nt=new Set([`accepted`,`duplicate`]);var X=class extends Error{decision;result;reason;constructor(e,t,n=`authority-rejected`){super(`Outcome delivery ${n===`deadline-exceeded`?`deadline exceeded`:`rejected by Authority`} (decision=${e}, executionId=${t.executionId}, status=${t.status})`),this.decision=e,this.result=t,this.reason=n,this.name=`OutcomeDeliveryError`}};function Z(e){return new X(`deadline-exceeded`,e,`deadline-exceeded`)}function rt(e){let t={maxRetries:e?.maxRetries??7,baseDelayMs:e?.baseDelayMs??1e3,maxDelayMs:e?.maxDelayMs??3e4,deadlineMs:e?.deadlineMs??12e4};if(!Number.isSafeInteger(t.maxRetries)||t.maxRetries<0)throw TypeError(`Outcome submission maxRetries must be a non-negative safe integer, got ${t.maxRetries}`);for(let[e,n]of Object.entries({baseDelayMs:t.baseDelayMs,maxDelayMs:t.maxDelayMs,deadlineMs:t.deadlineMs}))if(!Number.isFinite(n)||n<=0)throw TypeError(`Outcome submission ${e} must be a positive finite number, got ${n}`);return t}async function it(e,t,n,r){let i=t.baseDelayMs*2**(e-1),a=n-Date.now(),o=Math.min(i,t.maxDelayMs,a);await new Promise(e=>setTimeout(e,o));let s=n-Date.now();if(s<=0)return!1;if(r!==void 0){let e;try{await Promise.race([r(),new Promise(t=>{e=setTimeout(t,s)})])}catch{}finally{e!==void 0&&clearTimeout(e)}}return Date.now()<n}async function Q(e,t,n){let r=rt(n?.retry),i=n?.reconnect,a=Date.now()+r.deadlineMs,o;for(let n=0;n<=r.maxRetries;n++){if(a-Date.now()<=0||n>0&&!await it(n,r,a,i))throw Z(t.result);try{let n=a-Date.now();if(n<=0)throw Z(t.result);let{decision:r}=await e.request(y.control.outcome.submit,{executionAttemptId:t.executionAttemptId,executionId:t.executionId,result:t.result},{timeout:n});if(nt.has(r))return r;throw new X(r,t.result)}catch(e){if(e instanceof X)throw e;if(o=e,Date.now()>=a)throw Z(t.result)}}throw o??Z(t.result)}const at={maxRetries:3,baseDelayMs:200,maxDelayMs:2e3,deadlineMs:1e4},ot={persistentStorage:!0,customCapabilities:[`workflow.local-runtime`,`workflow.thin-runner`],suspensionStrategy:`wait-in-process`,supportsRecovery:!1,materializationModes:[`local-directory`]};function st(e){let t=new Set,n;return{conclude:r=>{if(n!==void 0)return;n={evidence:h.parse({source:e.slice(0,v.source),summary:r.slice(0,v.summary),observedAt:new Date().toISOString()})};let i=[...t];t.clear();for(let e of i)try{e(n)}catch(e){console.error(`[PiscinaThinWorkflowProvider] Infrastructure-conclusion observer failed:`,e)}},observe:e=>n===void 0?(t.add(e),()=>t.delete(e)):(e(n),()=>void 0)}}var ct=class{executionAttemptId;controller;detachCallerAbort;infrastructure;constructor(e,t,n,r){this.executionAttemptId=e,this.controller=t,this.detachCallerAbort=n,this.infrastructure=r}cancel(e){return this.controller.abort(e??`WorkerNode cancelled`),this.detachCallerAbort(),Promise.resolve()}terminate(){return this.controller.abort(`WorkerNode terminated`),this.detachCallerAbort(),Promise.resolve()}release(){return this.detachCallerAbort(),Promise.resolve()}observeInfrastructureConclusion(e){return this.infrastructure.observe(e)}},lt=class{options;environment=`piscina`;allocationLifetime=`provisioner-process-bound`;baseCapabilities;constructor(e){this.options=e,this.baseCapabilities=ne.parse({...ot,...e.baseCapabilities,suspensionStrategy:e.baseCapabilities?.suspensionStrategy??ot.suspensionStrategy,supportsRecovery:!1})}get id(){return this.options.id}get displayName(){return this.options.displayName}async provision(e,t){t.throwIfAborted();let n=new AbortController,r=st(this.id),i=()=>{n.abort(t.reason)};t.addEventListener(`abort`,i,{once:!0});let a=()=>t.removeEventListener(`abort`,i);try{let{executionAttemptId:i,executionId:o,workerConfig:s}=e,c=this.buildAllocationRef(i),l=new ct(i,n,a,r);t.throwIfAborted();let u=this.options.runner.runWithReadiness(e.workerConfig,n.signal,e.workerManifest);return u.ready.then(async e=>{n.signal.aborted||await this.options.bus.emit(y.control[`attempt-ready`],{executionAttemptId:i,executionId:o,adapters:[...e.adapters]})},()=>void 0).catch(e=>n.abort(e)),this.submitOutcomeOnSettlement(u.result,o,i,s.workflowId,r.conclude),{kind:`allocated`,allocationRef:c,handle:l}}catch(e){throw n.abort(e),a(),e}}async submitOutcomeOnSettlement(e,t,n,r,i){let a;try{a=await e}catch(e){a={executionId:t,workflowId:r,status:`failed`,error:e instanceof Error?e.message:String(e)}}try{let e={...at,...this.options.outcomeRetry};await Q(this.options.bus,{executionAttemptId:n,executionId:t,result:a},{retry:e})}catch(e){e instanceof X?console.error(`[PiscinaThinWorkflowProvider] Outcome rejected for execution '${t}' attempt '${n}' (decision=${e.decision}):`,e):console.error(`[PiscinaThinWorkflowProvider] Failed to submit outcome for execution '${t}' attempt '${n}':`,e),i(`Piscina worker for attempt '${n}' ended without an acknowledged outcome because outcome submission could not be completed`)}}buildAllocationRef(e){let t={version:ee,providerId:this.id,providerData:{executionAttemptId:e,allocatedAt:Date.now()}};return te.parse(t)}};const ut=[Ce,be,Se];function dt(e){let t;return()=>(t??=(async()=>{let t=[];for(let n of[...e].reverse())try{await n()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Isolated workflow runtime shutdown reported errors`)})(),t)}function ft(e,t,n){return T({bus:e,currentMachineId:n,resolveLiveAdapterId:e=>t.getExtensionService(S)?.resolveLiveAdapterId(e),resolveLiveAdapterIdentity:e=>t.getExtensionService(S)?.resolveLiveAdapterIdentity(e),listLiveAdapterIdentities:()=>t.getExtensionService(S)?.getLiveAdapterIdentities()??[]})}async function pt(e){let t=f();t.registerNamespaces([...g,..._]);let{context:n}=e,r=new oe(t,{surface:`headless`,extensionContextBase:{cwd:n.cwd,platform:n.platform,homedir:n.homedir,makaioHome:n.makaioHome,username:n.username,machineId:n.machineId,tryImport:D}}),i,a=[()=>t.disconnect()],o=dt(a);try{await e.connectAuthority(t);let s=[...e.contributedPackages,...await e.loadContributedPackages?.(t)??[]],{adapterSubsystemPackage:c}=w({coordinator:r,configRepository:e.configRepository,platformDefaults:{cwd:n.cwd},runtimeSnapshotHandlerPriority:1,runtimeDefinitionHandlerPriority:1,...e.prepareAuthRuntime!==void 0&&{prepareAuthRuntime:e.prepareAuthRuntime}}),l=Te({definitions:s.flatMap(e=>e.clients??[]),binaryResolutionPolicy:`global-only`});r.registerContributionProcessor(ye());let u=[...ut,c,_e,...P(s)?[xe]:[],ve(1),we,A,l,...Oe(s)];r.load(u),a.push(...F(u,t,r)),a.push(()=>r.shutdown()),await r.startAll(),i=ft(t,r,n.machineId),a.push(()=>{i?.cleanup(),i=void 0});let d=r.getExtensionService(ge);if(d===void 0)throw Error(`Isolated workflow tool registry did not start.`);for(let t of e.toolsets)await d.register(t);return await t.emit(se.ready,{machineId:n.machineId}),{bus:t,coordinator:r,machineId:n.machineId,shutdown:o}}catch(e){throw await o().catch(()=>void 0),e}}function mt(e,t){return{executionId:e,workflowId:t,status:`cancelled`,reason:`Execution cancelled`}}async function $(e,t,n){let r=new AbortController,i=e.on(ae(t),()=>{r.abort()}),a=()=>{r.abort()};return n?.addEventListener(`abort`,a,{once:!0}),n?.aborted&&r.abort(),await p(i),{signal:r.signal,cleanup:()=>{n?.removeEventListener(`abort`,a),i()}}}function ht(t,n){let r=e();return{cwd:t.workspaceRoot,platform:t.platform,homedir:r,makaioHome:r,username:`workflow-worker`,machineId:n}}async function gt(e,t,n,r,i,a){return await pt({connectAuthority:async n=>{await e.connectBus(n,t,i)},contributedPackages:[...r],configRepository:e.configRepository,context:ht(n,a),toolsets:[...e.toolsets],...e.prepareAuthRuntime!==void 0&&{prepareAuthRuntime:e.prepareAuthRuntime}})}async function _t(e,t,n){let{executionId:r,executionAttemptId:i}=e,a=mt(r,n);return{result:a,decision:await Q(t,{executionAttemptId:i,executionId:r,result:a},{retry:e.outcomeRetry,reconnect:()=>t.reconnect()})}}async function vt(e,t,n,r,i){let{executionId:a,executionAttemptId:o}=e,s;try{s=await e.execute(t.bus,n,r,i)}catch(e){s=i.aborted&&e instanceof DOMException&&e.name===`AbortError`?mt(a,n.workflowId):{executionId:a,workflowId:n.workflowId,status:`failed`,error:e instanceof Error?e.message:String(e)}}let c=await Q(t.bus,{executionAttemptId:o,executionId:a,result:s},{retry:e.outcomeRetry,reconnect:()=>t.bus.reconnect()});if(e.onPostCommit!==void 0)try{await e.onPostCommit(s,c)}catch{}return{result:s,decision:c}}async function yt(e,t,n,r,i,a){let o=await $(n,r.cancelSubject),s=AbortSignal.any([i,o.signal]),c=s,l,u,d;try{s.throwIfAborted();let f=await e.materialize(r,s),p=f.context;d=f.cleanup,s.throwIfAborted();let m=await e.loadContributions(p,s);s.throwIfAborted(),l=await gt(e,t,p,m,s,a),u=await $(l.bus,r.cancelSubject,o.signal),o.cleanup(),n.disconnect();let h=AbortSignal.any([i,u.signal]);c=h,h.throwIfAborted();let{adapters:g}=await l.bus.request(x.listAdapters,{});return h.throwIfAborted(),await l.bus.emit(y.control[`attempt-ready`],{executionAttemptId:e.executionAttemptId,executionId:e.executionId,adapters:g.map(e=>e.name)}),await vt(e,l,r,p,h)}catch(t){if(!(c.aborted&&t instanceof DOMException&&t.name===`AbortError`))throw t;return await _t(e,l?.bus??n,r.workflowId)}finally{o.cleanup(),u?.cleanup(),l!==void 0&&await l.shutdown().catch(()=>void 0),d!==void 0&&await d().catch(()=>void 0)}}async function bt(e,t){t.throwIfAborted();let n=await e.bootstrap(t);t.throwIfAborted();let r=f();r.registerNamespaces([...g,..._]);try{return await e.connectBus(r,n,t),await yt(e,n,r,await r.request(re.getRunContext,{executionId:e.executionId},{signal:t}),t,`headless-worker-${e.executionAttemptId}`)}finally{try{r.disconnect()}catch{}}}export{A,j as C,M as D,F as E,C as F,D as M,T as N,Ue as O,w as P,Ve as S,qe as T,H as _,X as a,z as b,tt as c,K as d,G as f,V as g,R as h,nt as i,E as j,Ke as k,J as l,L as m,pt as n,Q as o,I as p,lt as r,Y as s,bt as t,q as u,Ye as v,He as w,U as x,W as y};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes