mayura 0.1.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1116) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +8 -0
  3. package/README.md +55 -0
  4. package/lib/adapter-code-docker/dist/index.d.ts +65 -0
  5. package/lib/adapter-code-docker/dist/index.d.ts.map +1 -0
  6. package/lib/adapter-code-docker/dist/index.js +228 -0
  7. package/lib/adapter-code-docker/dist/index.js.map +1 -0
  8. package/lib/adapter-code-docker/image/Dockerfile +12 -0
  9. package/lib/adapter-code-docker/package.json +5 -0
  10. package/lib/adapter-code-docker/src/index.ts +244 -0
  11. package/lib/adapter-code-quickjs/dist/index.d.ts +40 -0
  12. package/lib/adapter-code-quickjs/dist/index.d.ts.map +1 -0
  13. package/lib/adapter-code-quickjs/dist/index.js +169 -0
  14. package/lib/adapter-code-quickjs/dist/index.js.map +1 -0
  15. package/lib/adapter-code-quickjs/dist/worker.d.ts +2 -0
  16. package/lib/adapter-code-quickjs/dist/worker.d.ts.map +1 -0
  17. package/lib/adapter-code-quickjs/dist/worker.js +164 -0
  18. package/lib/adapter-code-quickjs/dist/worker.js.map +1 -0
  19. package/lib/adapter-code-quickjs/package.json +5 -0
  20. package/lib/adapter-code-quickjs/src/index.ts +174 -0
  21. package/lib/adapter-code-quickjs/src/worker.ts +142 -0
  22. package/lib/adapter-mcp/dist/index.d.ts +29 -0
  23. package/lib/adapter-mcp/dist/index.d.ts.map +1 -0
  24. package/lib/adapter-mcp/dist/index.js +54 -0
  25. package/lib/adapter-mcp/dist/index.js.map +1 -0
  26. package/lib/adapter-mcp/package.json +5 -0
  27. package/lib/adapter-mcp/src/index.ts +82 -0
  28. package/lib/artifacts/dist/contracts.d.ts +139 -0
  29. package/lib/artifacts/dist/contracts.d.ts.map +1 -0
  30. package/lib/artifacts/dist/contracts.js +2 -0
  31. package/lib/artifacts/dist/contracts.js.map +1 -0
  32. package/lib/artifacts/dist/index.d.ts +3 -0
  33. package/lib/artifacts/dist/index.d.ts.map +1 -0
  34. package/lib/artifacts/dist/index.js +2 -0
  35. package/lib/artifacts/dist/index.js.map +1 -0
  36. package/lib/artifacts/dist/local-store.d.ts +3 -0
  37. package/lib/artifacts/dist/local-store.d.ts.map +1 -0
  38. package/lib/artifacts/dist/local-store.js +922 -0
  39. package/lib/artifacts/dist/local-store.js.map +1 -0
  40. package/lib/artifacts/package.json +5 -0
  41. package/lib/artifacts/src/contracts.ts +159 -0
  42. package/lib/artifacts/src/index.ts +26 -0
  43. package/lib/artifacts/src/local-store.ts +816 -0
  44. package/lib/cli/dist/application.d.ts +85 -0
  45. package/lib/cli/dist/application.d.ts.map +1 -0
  46. package/lib/cli/dist/application.js +116 -0
  47. package/lib/cli/dist/application.js.map +1 -0
  48. package/lib/cli/dist/bin.d.ts +3 -0
  49. package/lib/cli/dist/bin.d.ts.map +1 -0
  50. package/lib/cli/dist/bin.js +394 -0
  51. package/lib/cli/dist/bin.js.map +1 -0
  52. package/lib/cli/dist/dev.d.ts +21 -0
  53. package/lib/cli/dist/dev.d.ts.map +1 -0
  54. package/lib/cli/dist/dev.js +205 -0
  55. package/lib/cli/dist/dev.js.map +1 -0
  56. package/lib/cli/dist/index.d.ts +72 -0
  57. package/lib/cli/dist/index.d.ts.map +1 -0
  58. package/lib/cli/dist/index.js +423 -0
  59. package/lib/cli/dist/index.js.map +1 -0
  60. package/lib/cli/dist/interactive.d.ts +19 -0
  61. package/lib/cli/dist/interactive.d.ts.map +1 -0
  62. package/lib/cli/dist/interactive.js +163 -0
  63. package/lib/cli/dist/interactive.js.map +1 -0
  64. package/lib/cli/dist/operations.d.ts +215 -0
  65. package/lib/cli/dist/operations.d.ts.map +1 -0
  66. package/lib/cli/dist/operations.js +580 -0
  67. package/lib/cli/dist/operations.js.map +1 -0
  68. package/lib/cli/dist/output.d.ts +29 -0
  69. package/lib/cli/dist/output.d.ts.map +1 -0
  70. package/lib/cli/dist/output.js +244 -0
  71. package/lib/cli/dist/output.js.map +1 -0
  72. package/lib/cli/dist/providers.d.ts +54 -0
  73. package/lib/cli/dist/providers.d.ts.map +1 -0
  74. package/lib/cli/dist/providers.js +96 -0
  75. package/lib/cli/dist/providers.js.map +1 -0
  76. package/lib/cli/package.json +5 -0
  77. package/lib/cli/src/application.ts +109 -0
  78. package/lib/cli/src/bin.ts +261 -0
  79. package/lib/cli/src/dev.ts +139 -0
  80. package/lib/cli/src/index.ts +386 -0
  81. package/lib/cli/src/interactive.ts +132 -0
  82. package/lib/cli/src/operations.ts +458 -0
  83. package/lib/cli/src/output.ts +205 -0
  84. package/lib/cli/src/providers.ts +102 -0
  85. package/lib/cli/starters/approval-workflow/Dockerfile +20 -0
  86. package/lib/cli/starters/approval-workflow/README.md +102 -0
  87. package/lib/cli/starters/approval-workflow/compose.yaml +33 -0
  88. package/lib/cli/starters/approval-workflow/dot-dockerignore +7 -0
  89. package/lib/cli/starters/approval-workflow/dot-env.example +41 -0
  90. package/lib/cli/starters/approval-workflow/dot-github/workflows/ci.yml +13 -0
  91. package/lib/cli/starters/approval-workflow/dot-gitignore +10 -0
  92. package/lib/cli/starters/approval-workflow/mayura.project.json +16 -0
  93. package/lib/cli/starters/approval-workflow/package.json +30 -0
  94. package/lib/cli/starters/approval-workflow/src/app.ts +19 -0
  95. package/lib/cli/starters/approval-workflow/src/auth.ts +68 -0
  96. package/lib/cli/starters/approval-workflow/src/config.ts +107 -0
  97. package/lib/cli/starters/approval-workflow/src/dev.ts +59 -0
  98. package/lib/cli/starters/approval-workflow/src/intake.ts +104 -0
  99. package/lib/cli/starters/approval-workflow/src/model.ts +33 -0
  100. package/lib/cli/starters/approval-workflow/src/server.ts +56 -0
  101. package/lib/cli/starters/approval-workflow/src/services.ts +26 -0
  102. package/lib/cli/starters/approval-workflow/src/token.ts +6 -0
  103. package/lib/cli/starters/approval-workflow/src/worker.ts +18 -0
  104. package/lib/cli/starters/approval-workflow/src/workflow.ts +100 -0
  105. package/lib/cli/starters/approval-workflow/test/refunds.test.ts +140 -0
  106. package/lib/cli/starters/approval-workflow/tsconfig.json +20 -0
  107. package/lib/cli/starters/event-automation/Dockerfile +21 -0
  108. package/lib/cli/starters/event-automation/README.md +150 -0
  109. package/lib/cli/starters/event-automation/compose.yaml +41 -0
  110. package/lib/cli/starters/event-automation/dot-dockerignore +7 -0
  111. package/lib/cli/starters/event-automation/dot-env.example +51 -0
  112. package/lib/cli/starters/event-automation/dot-github/workflows/ci.yml +13 -0
  113. package/lib/cli/starters/event-automation/dot-gitignore +10 -0
  114. package/lib/cli/starters/event-automation/mayura.project.json +17 -0
  115. package/lib/cli/starters/event-automation/package.json +32 -0
  116. package/lib/cli/starters/event-automation/src/app.ts +19 -0
  117. package/lib/cli/starters/event-automation/src/auth.ts +61 -0
  118. package/lib/cli/starters/event-automation/src/config.ts +138 -0
  119. package/lib/cli/starters/event-automation/src/dev.ts +54 -0
  120. package/lib/cli/starters/event-automation/src/ingress.ts +129 -0
  121. package/lib/cli/starters/event-automation/src/mcp.ts +139 -0
  122. package/lib/cli/starters/event-automation/src/model.ts +33 -0
  123. package/lib/cli/starters/event-automation/src/send-sample.ts +29 -0
  124. package/lib/cli/starters/event-automation/src/server.ts +58 -0
  125. package/lib/cli/starters/event-automation/src/services.ts +54 -0
  126. package/lib/cli/starters/event-automation/src/signing.ts +30 -0
  127. package/lib/cli/starters/event-automation/src/token.ts +7 -0
  128. package/lib/cli/starters/event-automation/src/tracker/main.ts +18 -0
  129. package/lib/cli/starters/event-automation/src/tracker/mcp-server.ts +145 -0
  130. package/lib/cli/starters/event-automation/src/tracker/samples.ts +19 -0
  131. package/lib/cli/starters/event-automation/src/tracker/tickets.ts +54 -0
  132. package/lib/cli/starters/event-automation/src/tracker-tools.ts +38 -0
  133. package/lib/cli/starters/event-automation/src/triage.ts +151 -0
  134. package/lib/cli/starters/event-automation/src/worker.ts +19 -0
  135. package/lib/cli/starters/event-automation/src/workflows.ts +57 -0
  136. package/lib/cli/starters/event-automation/test/automation.test.ts +200 -0
  137. package/lib/cli/starters/event-automation/tsconfig.json +20 -0
  138. package/lib/cli/starters/research-team/Dockerfile +22 -0
  139. package/lib/cli/starters/research-team/README.md +189 -0
  140. package/lib/cli/starters/research-team/compose.yaml +38 -0
  141. package/lib/cli/starters/research-team/dot-dockerignore +7 -0
  142. package/lib/cli/starters/research-team/dot-env.example +49 -0
  143. package/lib/cli/starters/research-team/dot-github/workflows/ci.yml +13 -0
  144. package/lib/cli/starters/research-team/dot-gitignore +10 -0
  145. package/lib/cli/starters/research-team/mayura.project.json +22 -0
  146. package/lib/cli/starters/research-team/package.json +30 -0
  147. package/lib/cli/starters/research-team/src/app.ts +19 -0
  148. package/lib/cli/starters/research-team/src/auth.ts +56 -0
  149. package/lib/cli/starters/research-team/src/config.ts +170 -0
  150. package/lib/cli/starters/research-team/src/desk.ts +124 -0
  151. package/lib/cli/starters/research-team/src/dev.ts +58 -0
  152. package/lib/cli/starters/research-team/src/library/corpus.ts +76 -0
  153. package/lib/cli/starters/research-team/src/library/index.ts +109 -0
  154. package/lib/cli/starters/research-team/src/model.ts +33 -0
  155. package/lib/cli/starters/research-team/src/server.ts +69 -0
  156. package/lib/cli/starters/research-team/src/services.ts +48 -0
  157. package/lib/cli/starters/research-team/src/team.ts +173 -0
  158. package/lib/cli/starters/research-team/src/telemetry.ts +95 -0
  159. package/lib/cli/starters/research-team/src/token.ts +6 -0
  160. package/lib/cli/starters/research-team/src/worker.ts +21 -0
  161. package/lib/cli/starters/research-team/src/workflow.ts +197 -0
  162. package/lib/cli/starters/research-team/test/research.test.ts +271 -0
  163. package/lib/cli/starters/research-team/tsconfig.json +20 -0
  164. package/lib/cli/starters/support-agent/Dockerfile +21 -0
  165. package/lib/cli/starters/support-agent/README.md +128 -0
  166. package/lib/cli/starters/support-agent/compose.yaml +33 -0
  167. package/lib/cli/starters/support-agent/dot-dockerignore +7 -0
  168. package/lib/cli/starters/support-agent/dot-env.example +44 -0
  169. package/lib/cli/starters/support-agent/dot-github/workflows/ci.yml +13 -0
  170. package/lib/cli/starters/support-agent/dot-gitignore +10 -0
  171. package/lib/cli/starters/support-agent/mayura.project.json +18 -0
  172. package/lib/cli/starters/support-agent/package.json +43 -0
  173. package/lib/cli/starters/support-agent/src/app.ts +19 -0
  174. package/lib/cli/starters/support-agent/src/assistant.ts +313 -0
  175. package/lib/cli/starters/support-agent/src/auth.ts +69 -0
  176. package/lib/cli/starters/support-agent/src/config.ts +120 -0
  177. package/lib/cli/starters/support-agent/src/dev.ts +115 -0
  178. package/lib/cli/starters/support-agent/src/guardrails.ts +71 -0
  179. package/lib/cli/starters/support-agent/src/model.ts +33 -0
  180. package/lib/cli/starters/support-agent/src/orders.ts +62 -0
  181. package/lib/cli/starters/support-agent/src/returns.ts +86 -0
  182. package/lib/cli/starters/support-agent/src/server.ts +72 -0
  183. package/lib/cli/starters/support-agent/src/services.ts +32 -0
  184. package/lib/cli/starters/support-agent/src/session.ts +55 -0
  185. package/lib/cli/starters/support-agent/src/token.ts +9 -0
  186. package/lib/cli/starters/support-agent/src/worker.ts +19 -0
  187. package/lib/cli/starters/support-agent/test/support.test.ts +263 -0
  188. package/lib/cli/starters/support-agent/tsconfig.json +20 -0
  189. package/lib/cli/starters/support-agent/web/index.html +12 -0
  190. package/lib/cli/starters/support-agent/web/src/App.tsx +43 -0
  191. package/lib/cli/starters/support-agent/web/src/components/chat.tsx +161 -0
  192. package/lib/cli/starters/support-agent/web/src/components/ui/button.tsx +33 -0
  193. package/lib/cli/starters/support-agent/web/src/components/ui/primitives.tsx +48 -0
  194. package/lib/cli/starters/support-agent/web/src/env.d.ts +1 -0
  195. package/lib/cli/starters/support-agent/web/src/lib/api.ts +56 -0
  196. package/lib/cli/starters/support-agent/web/src/lib/utils.ts +4 -0
  197. package/lib/cli/starters/support-agent/web/src/main.tsx +6 -0
  198. package/lib/cli/starters/support-agent/web/src/styles.css +86 -0
  199. package/lib/cli/starters/support-agent/web/tsconfig.json +9 -0
  200. package/lib/cli/starters/support-agent/web/vite.config.ts +13 -0
  201. package/lib/cli/templates/basic-agent.ts +10 -0
  202. package/lib/cli/templates/capability-policy.ts +18 -0
  203. package/lib/cli/templates/code-mode-workflow.ts +34 -0
  204. package/lib/cli/templates/durable-approval.ts +25 -0
  205. package/lib/cli/templates/guarded-streaming-app.ts +23 -0
  206. package/lib/cli/templates/native-memory.ts +15 -0
  207. package/lib/cli/templates/parallel-research.ts +21 -0
  208. package/lib/cli/templates/typed-tool-runner.ts +15 -0
  209. package/lib/client/dist/forms.d.ts +77 -0
  210. package/lib/client/dist/forms.d.ts.map +1 -0
  211. package/lib/client/dist/forms.js +282 -0
  212. package/lib/client/dist/forms.js.map +1 -0
  213. package/lib/client/dist/headless.d.ts +84 -0
  214. package/lib/client/dist/headless.d.ts.map +1 -0
  215. package/lib/client/dist/headless.js +376 -0
  216. package/lib/client/dist/headless.js.map +1 -0
  217. package/lib/client/dist/index.d.ts +266 -0
  218. package/lib/client/dist/index.d.ts.map +1 -0
  219. package/lib/client/dist/index.js +814 -0
  220. package/lib/client/dist/index.js.map +1 -0
  221. package/lib/client/dist/workflows.d.ts +128 -0
  222. package/lib/client/dist/workflows.d.ts.map +1 -0
  223. package/lib/client/dist/workflows.js +379 -0
  224. package/lib/client/dist/workflows.js.map +1 -0
  225. package/lib/client/package.json +5 -0
  226. package/lib/client/src/forms.ts +215 -0
  227. package/lib/client/src/headless.ts +265 -0
  228. package/lib/client/src/index.ts +646 -0
  229. package/lib/client/src/workflows.ts +307 -0
  230. package/lib/client-react/dist/components.d.ts +70 -0
  231. package/lib/client-react/dist/components.d.ts.map +1 -0
  232. package/lib/client-react/dist/components.js +173 -0
  233. package/lib/client-react/dist/components.js.map +1 -0
  234. package/lib/client-react/dist/index.d.ts +29 -0
  235. package/lib/client-react/dist/index.d.ts.map +1 -0
  236. package/lib/client-react/dist/index.js +57 -0
  237. package/lib/client-react/dist/index.js.map +1 -0
  238. package/lib/client-react/package.json +5 -0
  239. package/lib/client-react/src/components.ts +183 -0
  240. package/lib/client-react/src/index.ts +70 -0
  241. package/lib/code-mode/dist/index.d.ts +142 -0
  242. package/lib/code-mode/dist/index.d.ts.map +1 -0
  243. package/lib/code-mode/dist/index.js +498 -0
  244. package/lib/code-mode/dist/index.js.map +1 -0
  245. package/lib/code-mode/package.json +5 -0
  246. package/lib/code-mode/src/index.ts +605 -0
  247. package/lib/code-mode-workflows/dist/index.d.ts +51 -0
  248. package/lib/code-mode-workflows/dist/index.d.ts.map +1 -0
  249. package/lib/code-mode-workflows/dist/index.js +231 -0
  250. package/lib/code-mode-workflows/dist/index.js.map +1 -0
  251. package/lib/code-mode-workflows/package.json +5 -0
  252. package/lib/code-mode-workflows/src/index.ts +259 -0
  253. package/lib/context/dist/assemble.d.ts +11 -0
  254. package/lib/context/dist/assemble.d.ts.map +1 -0
  255. package/lib/context/dist/assemble.js +265 -0
  256. package/lib/context/dist/assemble.js.map +1 -0
  257. package/lib/context/dist/cache.d.ts +53 -0
  258. package/lib/context/dist/cache.d.ts.map +1 -0
  259. package/lib/context/dist/cache.js +147 -0
  260. package/lib/context/dist/cache.js.map +1 -0
  261. package/lib/context/dist/contracts.d.ts +145 -0
  262. package/lib/context/dist/contracts.d.ts.map +1 -0
  263. package/lib/context/dist/contracts.js +2 -0
  264. package/lib/context/dist/contracts.js.map +1 -0
  265. package/lib/context/dist/index.d.ts +4 -0
  266. package/lib/context/dist/index.d.ts.map +1 -0
  267. package/lib/context/dist/index.js +3 -0
  268. package/lib/context/dist/index.js.map +1 -0
  269. package/lib/context/package.json +5 -0
  270. package/lib/context/src/assemble.ts +205 -0
  271. package/lib/context/src/cache.ts +143 -0
  272. package/lib/context/src/contracts.ts +124 -0
  273. package/lib/context/src/index.ts +3 -0
  274. package/lib/core/dist/budget.d.ts +85 -0
  275. package/lib/core/dist/budget.d.ts.map +1 -0
  276. package/lib/core/dist/budget.js +328 -0
  277. package/lib/core/dist/budget.js.map +1 -0
  278. package/lib/core/dist/contracts.d.ts +156 -0
  279. package/lib/core/dist/contracts.d.ts.map +1 -0
  280. package/lib/core/dist/contracts.js +13 -0
  281. package/lib/core/dist/contracts.js.map +1 -0
  282. package/lib/core/dist/errors.d.ts +17 -0
  283. package/lib/core/dist/errors.d.ts.map +1 -0
  284. package/lib/core/dist/errors.js +22 -0
  285. package/lib/core/dist/errors.js.map +1 -0
  286. package/lib/core/dist/event-stream.d.ts +26 -0
  287. package/lib/core/dist/event-stream.d.ts.map +1 -0
  288. package/lib/core/dist/event-stream.js +116 -0
  289. package/lib/core/dist/event-stream.js.map +1 -0
  290. package/lib/core/dist/host.d.ts +7 -0
  291. package/lib/core/dist/host.d.ts.map +1 -0
  292. package/lib/core/dist/host.js +7 -0
  293. package/lib/core/dist/host.js.map +1 -0
  294. package/lib/core/dist/index.d.ts +8 -0
  295. package/lib/core/dist/index.d.ts.map +1 -0
  296. package/lib/core/dist/index.js +7 -0
  297. package/lib/core/dist/index.js.map +1 -0
  298. package/lib/core/dist/json.d.ts +18 -0
  299. package/lib/core/dist/json.d.ts.map +1 -0
  300. package/lib/core/dist/json.js +100 -0
  301. package/lib/core/dist/json.js.map +1 -0
  302. package/lib/core/dist/lifecycle.d.ts +45 -0
  303. package/lib/core/dist/lifecycle.d.ts.map +1 -0
  304. package/lib/core/dist/lifecycle.js +114 -0
  305. package/lib/core/dist/lifecycle.js.map +1 -0
  306. package/lib/core/dist/local-guards.d.ts +4 -0
  307. package/lib/core/dist/local-guards.d.ts.map +1 -0
  308. package/lib/core/dist/local-guards.js +47 -0
  309. package/lib/core/dist/local-guards.js.map +1 -0
  310. package/lib/core/dist/managed-guards.d.ts +44 -0
  311. package/lib/core/dist/managed-guards.d.ts.map +1 -0
  312. package/lib/core/dist/managed-guards.js +146 -0
  313. package/lib/core/dist/managed-guards.js.map +1 -0
  314. package/lib/core/dist/schema.d.ts +36 -0
  315. package/lib/core/dist/schema.d.ts.map +1 -0
  316. package/lib/core/dist/schema.js +24 -0
  317. package/lib/core/dist/schema.js.map +1 -0
  318. package/lib/core/package.json +5 -0
  319. package/lib/core/src/budget.ts +366 -0
  320. package/lib/core/src/contracts.ts +107 -0
  321. package/lib/core/src/errors.ts +33 -0
  322. package/lib/core/src/event-stream.ts +87 -0
  323. package/lib/core/src/host.ts +6 -0
  324. package/lib/core/src/index.ts +7 -0
  325. package/lib/core/src/json.ts +81 -0
  326. package/lib/core/src/lifecycle.ts +133 -0
  327. package/lib/core/src/local-guards.ts +37 -0
  328. package/lib/core/src/managed-guards.ts +154 -0
  329. package/lib/core/src/schema.ts +43 -0
  330. package/lib/exporter-otlp/dist/contracts.d.ts +112 -0
  331. package/lib/exporter-otlp/dist/contracts.d.ts.map +1 -0
  332. package/lib/exporter-otlp/dist/contracts.js +2 -0
  333. package/lib/exporter-otlp/dist/contracts.js.map +1 -0
  334. package/lib/exporter-otlp/dist/index.d.ts +5 -0
  335. package/lib/exporter-otlp/dist/index.d.ts.map +1 -0
  336. package/lib/exporter-otlp/dist/index.js +4 -0
  337. package/lib/exporter-otlp/dist/index.js.map +1 -0
  338. package/lib/exporter-otlp/dist/otlp-http-json.d.ts +4 -0
  339. package/lib/exporter-otlp/dist/otlp-http-json.d.ts.map +1 -0
  340. package/lib/exporter-otlp/dist/otlp-http-json.js +286 -0
  341. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -0
  342. package/lib/exporter-otlp/dist/run-traces.d.ts +15 -0
  343. package/lib/exporter-otlp/dist/run-traces.d.ts.map +1 -0
  344. package/lib/exporter-otlp/dist/run-traces.js +114 -0
  345. package/lib/exporter-otlp/dist/run-traces.js.map +1 -0
  346. package/lib/exporter-otlp/dist/signals.d.ts +4 -0
  347. package/lib/exporter-otlp/dist/signals.d.ts.map +1 -0
  348. package/lib/exporter-otlp/dist/signals.js +330 -0
  349. package/lib/exporter-otlp/dist/signals.js.map +1 -0
  350. package/lib/exporter-otlp/package.json +5 -0
  351. package/lib/exporter-otlp/src/contracts.ts +119 -0
  352. package/lib/exporter-otlp/src/index.ts +23 -0
  353. package/lib/exporter-otlp/src/otlp-http-json.ts +189 -0
  354. package/lib/exporter-otlp/src/run-traces.ts +86 -0
  355. package/lib/exporter-otlp/src/signals.ts +185 -0
  356. package/lib/guardrails/dist/agent-guard.d.ts +9 -0
  357. package/lib/guardrails/dist/agent-guard.d.ts.map +1 -0
  358. package/lib/guardrails/dist/agent-guard.js +23 -0
  359. package/lib/guardrails/dist/agent-guard.js.map +1 -0
  360. package/lib/guardrails/dist/auxiliary-helpers.d.ts +63 -0
  361. package/lib/guardrails/dist/auxiliary-helpers.d.ts.map +1 -0
  362. package/lib/guardrails/dist/auxiliary-helpers.js +147 -0
  363. package/lib/guardrails/dist/auxiliary-helpers.js.map +1 -0
  364. package/lib/guardrails/dist/auxiliary.d.ts +51 -0
  365. package/lib/guardrails/dist/auxiliary.d.ts.map +1 -0
  366. package/lib/guardrails/dist/auxiliary.js +230 -0
  367. package/lib/guardrails/dist/auxiliary.js.map +1 -0
  368. package/lib/guardrails/dist/batches.d.ts +18 -0
  369. package/lib/guardrails/dist/batches.d.ts.map +1 -0
  370. package/lib/guardrails/dist/batches.js +160 -0
  371. package/lib/guardrails/dist/batches.js.map +1 -0
  372. package/lib/guardrails/dist/disclosure.d.ts +30 -0
  373. package/lib/guardrails/dist/disclosure.d.ts.map +1 -0
  374. package/lib/guardrails/dist/disclosure.js +109 -0
  375. package/lib/guardrails/dist/disclosure.js.map +1 -0
  376. package/lib/guardrails/dist/helpers.d.ts +20 -0
  377. package/lib/guardrails/dist/helpers.d.ts.map +1 -0
  378. package/lib/guardrails/dist/helpers.js +72 -0
  379. package/lib/guardrails/dist/helpers.js.map +1 -0
  380. package/lib/guardrails/dist/index.d.ts +9 -0
  381. package/lib/guardrails/dist/index.d.ts.map +1 -0
  382. package/lib/guardrails/dist/index.js +9 -0
  383. package/lib/guardrails/dist/index.js.map +1 -0
  384. package/lib/guardrails/dist/managed.d.ts +18 -0
  385. package/lib/guardrails/dist/managed.d.ts.map +1 -0
  386. package/lib/guardrails/dist/managed.js +67 -0
  387. package/lib/guardrails/dist/managed.js.map +1 -0
  388. package/lib/guardrails/dist/pipeline.d.ts +55 -0
  389. package/lib/guardrails/dist/pipeline.d.ts.map +1 -0
  390. package/lib/guardrails/dist/pipeline.js +201 -0
  391. package/lib/guardrails/dist/pipeline.js.map +1 -0
  392. package/lib/guardrails/package.json +5 -0
  393. package/lib/guardrails/src/agent-guard.ts +22 -0
  394. package/lib/guardrails/src/auxiliary-helpers.ts +146 -0
  395. package/lib/guardrails/src/auxiliary.ts +202 -0
  396. package/lib/guardrails/src/batches.ts +130 -0
  397. package/lib/guardrails/src/disclosure.ts +92 -0
  398. package/lib/guardrails/src/helpers.ts +67 -0
  399. package/lib/guardrails/src/index.ts +8 -0
  400. package/lib/guardrails/src/managed.ts +64 -0
  401. package/lib/guardrails/src/pipeline.ts +185 -0
  402. package/lib/helpers/dist/concurrency.d.ts +25 -0
  403. package/lib/helpers/dist/concurrency.d.ts.map +1 -0
  404. package/lib/helpers/dist/concurrency.js +106 -0
  405. package/lib/helpers/dist/concurrency.js.map +1 -0
  406. package/lib/helpers/dist/configuration.d.ts +42 -0
  407. package/lib/helpers/dist/configuration.d.ts.map +1 -0
  408. package/lib/helpers/dist/configuration.js +119 -0
  409. package/lib/helpers/dist/configuration.js.map +1 -0
  410. package/lib/helpers/dist/control.d.ts +61 -0
  411. package/lib/helpers/dist/control.d.ts.map +1 -0
  412. package/lib/helpers/dist/control.js +220 -0
  413. package/lib/helpers/dist/control.js.map +1 -0
  414. package/lib/helpers/dist/credentials.d.ts +42 -0
  415. package/lib/helpers/dist/credentials.d.ts.map +1 -0
  416. package/lib/helpers/dist/credentials.js +126 -0
  417. package/lib/helpers/dist/credentials.js.map +1 -0
  418. package/lib/helpers/dist/data.d.ts +30 -0
  419. package/lib/helpers/dist/data.d.ts.map +1 -0
  420. package/lib/helpers/dist/data.js +90 -0
  421. package/lib/helpers/dist/data.js.map +1 -0
  422. package/lib/helpers/dist/index.d.ts +6 -0
  423. package/lib/helpers/dist/index.d.ts.map +1 -0
  424. package/lib/helpers/dist/index.js +6 -0
  425. package/lib/helpers/dist/index.js.map +1 -0
  426. package/lib/helpers/package.json +5 -0
  427. package/lib/helpers/src/concurrency.ts +92 -0
  428. package/lib/helpers/src/configuration.ts +131 -0
  429. package/lib/helpers/src/control.ts +231 -0
  430. package/lib/helpers/src/credentials.ts +113 -0
  431. package/lib/helpers/src/data.ts +105 -0
  432. package/lib/helpers/src/index.ts +5 -0
  433. package/lib/memory/dist/contracts.d.ts +146 -0
  434. package/lib/memory/dist/contracts.d.ts.map +1 -0
  435. package/lib/memory/dist/contracts.js +2 -0
  436. package/lib/memory/dist/contracts.js.map +1 -0
  437. package/lib/memory/dist/index.d.ts +10 -0
  438. package/lib/memory/dist/index.d.ts.map +1 -0
  439. package/lib/memory/dist/index.js +316 -0
  440. package/lib/memory/dist/index.js.map +1 -0
  441. package/lib/memory/dist/native.d.ts +157 -0
  442. package/lib/memory/dist/native.d.ts.map +1 -0
  443. package/lib/memory/dist/native.js +664 -0
  444. package/lib/memory/dist/native.js.map +1 -0
  445. package/lib/memory/dist/validation.d.ts +21 -0
  446. package/lib/memory/dist/validation.d.ts.map +1 -0
  447. package/lib/memory/dist/validation.js +123 -0
  448. package/lib/memory/dist/validation.js.map +1 -0
  449. package/lib/memory/dist/vectors.d.ts +40 -0
  450. package/lib/memory/dist/vectors.d.ts.map +1 -0
  451. package/lib/memory/dist/vectors.js +134 -0
  452. package/lib/memory/dist/vectors.js.map +1 -0
  453. package/lib/memory/package.json +5 -0
  454. package/lib/memory/src/contracts.ts +113 -0
  455. package/lib/memory/src/index.ts +241 -0
  456. package/lib/memory/src/native.ts +568 -0
  457. package/lib/memory/src/validation.ts +103 -0
  458. package/lib/memory/src/vectors.ts +121 -0
  459. package/lib/memory-remote/dist/index.d.ts +91 -0
  460. package/lib/memory-remote/dist/index.d.ts.map +1 -0
  461. package/lib/memory-remote/dist/index.js +434 -0
  462. package/lib/memory-remote/dist/index.js.map +1 -0
  463. package/lib/memory-remote/package.json +5 -0
  464. package/lib/memory-remote/src/index.ts +367 -0
  465. package/lib/observability/dist/contracts.d.ts +102 -0
  466. package/lib/observability/dist/contracts.d.ts.map +1 -0
  467. package/lib/observability/dist/contracts.js +2 -0
  468. package/lib/observability/dist/contracts.js.map +1 -0
  469. package/lib/observability/dist/index.d.ts +5 -0
  470. package/lib/observability/dist/index.d.ts.map +1 -0
  471. package/lib/observability/dist/index.js +4 -0
  472. package/lib/observability/dist/index.js.map +1 -0
  473. package/lib/observability/dist/observer.d.ts +4 -0
  474. package/lib/observability/dist/observer.d.ts.map +1 -0
  475. package/lib/observability/dist/observer.js +354 -0
  476. package/lib/observability/dist/observer.js.map +1 -0
  477. package/lib/observability/dist/validation.d.ts +6 -0
  478. package/lib/observability/dist/validation.d.ts.map +1 -0
  479. package/lib/observability/dist/validation.js +203 -0
  480. package/lib/observability/dist/validation.js.map +1 -0
  481. package/lib/observability/package.json +5 -0
  482. package/lib/observability/src/contracts.ts +85 -0
  483. package/lib/observability/src/index.ts +4 -0
  484. package/lib/observability/src/observer.ts +246 -0
  485. package/lib/observability/src/validation.ts +132 -0
  486. package/lib/provider-anthropic/dist/index.d.ts +19 -0
  487. package/lib/provider-anthropic/dist/index.d.ts.map +1 -0
  488. package/lib/provider-anthropic/dist/index.js +342 -0
  489. package/lib/provider-anthropic/dist/index.js.map +1 -0
  490. package/lib/provider-anthropic/package.json +5 -0
  491. package/lib/provider-anthropic/src/index.ts +317 -0
  492. package/lib/provider-openai/dist/index.d.ts +77 -0
  493. package/lib/provider-openai/dist/index.d.ts.map +1 -0
  494. package/lib/provider-openai/dist/index.js +577 -0
  495. package/lib/provider-openai/dist/index.js.map +1 -0
  496. package/lib/provider-openai/package.json +5 -0
  497. package/lib/provider-openai/src/index.ts +459 -0
  498. package/lib/runtime/dist/agent.d.ts +63 -0
  499. package/lib/runtime/dist/agent.d.ts.map +1 -0
  500. package/lib/runtime/dist/agent.js +134 -0
  501. package/lib/runtime/dist/agent.js.map +1 -0
  502. package/lib/runtime/dist/composition.d.ts +21 -0
  503. package/lib/runtime/dist/composition.d.ts.map +1 -0
  504. package/lib/runtime/dist/composition.js +54 -0
  505. package/lib/runtime/dist/composition.js.map +1 -0
  506. package/lib/runtime/dist/event-buffer.d.ts +18 -0
  507. package/lib/runtime/dist/event-buffer.d.ts.map +1 -0
  508. package/lib/runtime/dist/event-buffer.js +66 -0
  509. package/lib/runtime/dist/event-buffer.js.map +1 -0
  510. package/lib/runtime/dist/hook-execution.d.ts +40 -0
  511. package/lib/runtime/dist/hook-execution.d.ts.map +1 -0
  512. package/lib/runtime/dist/hook-execution.js +186 -0
  513. package/lib/runtime/dist/hook-execution.js.map +1 -0
  514. package/lib/runtime/dist/hooks.d.ts +178 -0
  515. package/lib/runtime/dist/hooks.d.ts.map +1 -0
  516. package/lib/runtime/dist/hooks.js +120 -0
  517. package/lib/runtime/dist/hooks.js.map +1 -0
  518. package/lib/runtime/dist/index.d.ts +6 -0
  519. package/lib/runtime/dist/index.d.ts.map +1 -0
  520. package/lib/runtime/dist/index.js +6 -0
  521. package/lib/runtime/dist/index.js.map +1 -0
  522. package/lib/runtime/dist/managed-guards.d.ts +27 -0
  523. package/lib/runtime/dist/managed-guards.d.ts.map +1 -0
  524. package/lib/runtime/dist/managed-guards.js +183 -0
  525. package/lib/runtime/dist/managed-guards.js.map +1 -0
  526. package/lib/runtime/dist/permits.d.ts +9 -0
  527. package/lib/runtime/dist/permits.d.ts.map +1 -0
  528. package/lib/runtime/dist/permits.js +77 -0
  529. package/lib/runtime/dist/permits.js.map +1 -0
  530. package/lib/runtime/dist/response.d.ts +8 -0
  531. package/lib/runtime/dist/response.d.ts.map +1 -0
  532. package/lib/runtime/dist/response.js +83 -0
  533. package/lib/runtime/dist/response.js.map +1 -0
  534. package/lib/runtime/dist/router.d.ts +51 -0
  535. package/lib/runtime/dist/router.d.ts.map +1 -0
  536. package/lib/runtime/dist/router.js +181 -0
  537. package/lib/runtime/dist/router.js.map +1 -0
  538. package/lib/runtime/dist/runtime.d.ts +98 -0
  539. package/lib/runtime/dist/runtime.d.ts.map +1 -0
  540. package/lib/runtime/dist/runtime.js +945 -0
  541. package/lib/runtime/dist/runtime.js.map +1 -0
  542. package/lib/runtime/dist/stream.d.ts +25 -0
  543. package/lib/runtime/dist/stream.d.ts.map +1 -0
  544. package/lib/runtime/dist/stream.js +226 -0
  545. package/lib/runtime/dist/stream.js.map +1 -0
  546. package/lib/runtime/package.json +5 -0
  547. package/lib/runtime/src/agent.ts +167 -0
  548. package/lib/runtime/src/composition.ts +63 -0
  549. package/lib/runtime/src/event-buffer.ts +55 -0
  550. package/lib/runtime/src/hook-execution.ts +188 -0
  551. package/lib/runtime/src/hooks.ts +227 -0
  552. package/lib/runtime/src/index.ts +5 -0
  553. package/lib/runtime/src/managed-guards.ts +176 -0
  554. package/lib/runtime/src/permits.ts +65 -0
  555. package/lib/runtime/src/response.ts +68 -0
  556. package/lib/runtime/src/router.ts +178 -0
  557. package/lib/runtime/src/runtime.ts +909 -0
  558. package/lib/runtime/src/stream.ts +130 -0
  559. package/lib/sdk/dist/index.d.ts +5 -0
  560. package/lib/sdk/dist/index.d.ts.map +1 -0
  561. package/lib/sdk/dist/index.js +5 -0
  562. package/lib/sdk/dist/index.js.map +1 -0
  563. package/lib/sdk/package.json +5 -0
  564. package/lib/sdk/src/index.ts +4 -0
  565. package/lib/server/dist/index.d.ts +343 -0
  566. package/lib/server/dist/index.d.ts.map +1 -0
  567. package/lib/server/dist/index.js +1356 -0
  568. package/lib/server/dist/index.js.map +1 -0
  569. package/lib/server/dist/inspector-bundle.d.ts +6 -0
  570. package/lib/server/dist/inspector-bundle.d.ts.map +1 -0
  571. package/lib/server/dist/inspector-bundle.js +6 -0
  572. package/lib/server/dist/inspector-bundle.js.map +1 -0
  573. package/lib/server/dist/inspector.d.ts +3 -0
  574. package/lib/server/dist/inspector.d.ts.map +1 -0
  575. package/lib/server/dist/inspector.js +27 -0
  576. package/lib/server/dist/inspector.js.map +1 -0
  577. package/lib/server/package.json +5 -0
  578. package/lib/server/src/index.ts +1033 -0
  579. package/lib/server/src/inspector-bundle.ts +5 -0
  580. package/lib/server/src/inspector.ts +27 -0
  581. package/lib/server-node/dist/hardening.d.ts +19 -0
  582. package/lib/server-node/dist/hardening.d.ts.map +1 -0
  583. package/lib/server-node/dist/hardening.js +79 -0
  584. package/lib/server-node/dist/hardening.js.map +1 -0
  585. package/lib/server-node/dist/index.d.ts +18 -0
  586. package/lib/server-node/dist/index.d.ts.map +1 -0
  587. package/lib/server-node/dist/index.js +53 -0
  588. package/lib/server-node/dist/index.js.map +1 -0
  589. package/lib/server-node/dist/probe.d.ts +13 -0
  590. package/lib/server-node/dist/probe.d.ts.map +1 -0
  591. package/lib/server-node/dist/probe.js +44 -0
  592. package/lib/server-node/dist/probe.js.map +1 -0
  593. package/lib/server-node/dist/production.d.ts +32 -0
  594. package/lib/server-node/dist/production.d.ts.map +1 -0
  595. package/lib/server-node/dist/production.js +125 -0
  596. package/lib/server-node/dist/production.js.map +1 -0
  597. package/lib/server-node/package.json +5 -0
  598. package/lib/server-node/src/hardening.ts +79 -0
  599. package/lib/server-node/src/index.ts +58 -0
  600. package/lib/server-node/src/probe.ts +36 -0
  601. package/lib/server-node/src/production.ts +116 -0
  602. package/lib/storage/dist/index.d.ts +4 -0
  603. package/lib/storage/dist/index.d.ts.map +1 -0
  604. package/lib/storage/dist/index.js +5 -0
  605. package/lib/storage/dist/index.js.map +1 -0
  606. package/lib/storage/package.json +5 -0
  607. package/lib/storage/src/index.ts +5 -0
  608. package/lib/storage-contracts/dist/contracts.d.ts +69 -0
  609. package/lib/storage-contracts/dist/contracts.d.ts.map +1 -0
  610. package/lib/storage-contracts/dist/contracts.js +15 -0
  611. package/lib/storage-contracts/dist/contracts.js.map +1 -0
  612. package/lib/storage-contracts/dist/durable-budget-contracts.d.ts +110 -0
  613. package/lib/storage-contracts/dist/durable-budget-contracts.d.ts.map +1 -0
  614. package/lib/storage-contracts/dist/durable-budget-contracts.js +430 -0
  615. package/lib/storage-contracts/dist/durable-budget-contracts.js.map +1 -0
  616. package/lib/storage-contracts/dist/execution-wait-contracts.d.ts +74 -0
  617. package/lib/storage-contracts/dist/execution-wait-contracts.d.ts.map +1 -0
  618. package/lib/storage-contracts/dist/execution-wait-contracts.js +159 -0
  619. package/lib/storage-contracts/dist/execution-wait-contracts.js.map +1 -0
  620. package/lib/storage-contracts/dist/index.d.ts +18 -0
  621. package/lib/storage-contracts/dist/index.d.ts.map +1 -0
  622. package/lib/storage-contracts/dist/index.js +18 -0
  623. package/lib/storage-contracts/dist/index.js.map +1 -0
  624. package/lib/storage-contracts/dist/memory-contracts.d.ts +208 -0
  625. package/lib/storage-contracts/dist/memory-contracts.d.ts.map +1 -0
  626. package/lib/storage-contracts/dist/memory-contracts.js +350 -0
  627. package/lib/storage-contracts/dist/memory-contracts.js.map +1 -0
  628. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +171 -0
  629. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -0
  630. package/lib/storage-contracts/dist/scheduled-workflow-contracts.js +2 -0
  631. package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -0
  632. package/lib/storage-contracts/dist/scheduler-contracts.d.ts +133 -0
  633. package/lib/storage-contracts/dist/scheduler-contracts.d.ts.map +1 -0
  634. package/lib/storage-contracts/dist/scheduler-contracts.js +2 -0
  635. package/lib/storage-contracts/dist/scheduler-contracts.js.map +1 -0
  636. package/lib/storage-contracts/dist/submission-journal.d.ts +21 -0
  637. package/lib/storage-contracts/dist/submission-journal.d.ts.map +1 -0
  638. package/lib/storage-contracts/dist/submission-journal.js +51 -0
  639. package/lib/storage-contracts/dist/submission-journal.js.map +1 -0
  640. package/lib/storage-contracts/dist/workflow-format2.d.ts +54 -0
  641. package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -0
  642. package/lib/storage-contracts/dist/workflow-format2.js +398 -0
  643. package/lib/storage-contracts/dist/workflow-format2.js.map +1 -0
  644. package/lib/storage-contracts/dist/workflow-format3.d.ts +20 -0
  645. package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -0
  646. package/lib/storage-contracts/dist/workflow-format3.js +309 -0
  647. package/lib/storage-contracts/dist/workflow-format3.js.map +1 -0
  648. package/lib/storage-contracts/dist/workflow-format4.d.ts +48 -0
  649. package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -0
  650. package/lib/storage-contracts/dist/workflow-format4.js +132 -0
  651. package/lib/storage-contracts/dist/workflow-format4.js.map +1 -0
  652. package/lib/storage-contracts/dist/workflow-format5.d.ts +94 -0
  653. package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -0
  654. package/lib/storage-contracts/dist/workflow-format5.js +365 -0
  655. package/lib/storage-contracts/dist/workflow-format5.js.map +1 -0
  656. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +69 -0
  657. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -0
  658. package/lib/storage-contracts/dist/workflow-graph-contracts.js +2 -0
  659. package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -0
  660. package/lib/storage-contracts/dist/workflow-graph-discovery.d.ts +45 -0
  661. package/lib/storage-contracts/dist/workflow-graph-discovery.d.ts.map +1 -0
  662. package/lib/storage-contracts/dist/workflow-graph-discovery.js +101 -0
  663. package/lib/storage-contracts/dist/workflow-graph-discovery.js.map +1 -0
  664. package/lib/storage-contracts/dist/workflow-loop-format1.d.ts +52 -0
  665. package/lib/storage-contracts/dist/workflow-loop-format1.d.ts.map +1 -0
  666. package/lib/storage-contracts/dist/workflow-loop-format1.js +134 -0
  667. package/lib/storage-contracts/dist/workflow-loop-format1.js.map +1 -0
  668. package/lib/storage-contracts/dist/workflow-saga-format1.d.ts +52 -0
  669. package/lib/storage-contracts/dist/workflow-saga-format1.d.ts.map +1 -0
  670. package/lib/storage-contracts/dist/workflow-saga-format1.js +235 -0
  671. package/lib/storage-contracts/dist/workflow-saga-format1.js.map +1 -0
  672. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +428 -0
  673. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -0
  674. package/lib/storage-contracts/dist/workflow-tree-contracts.js +151 -0
  675. package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -0
  676. package/lib/storage-contracts/dist/workflow-tree-discovery.d.ts +38 -0
  677. package/lib/storage-contracts/dist/workflow-tree-discovery.d.ts.map +1 -0
  678. package/lib/storage-contracts/dist/workflow-tree-discovery.js +57 -0
  679. package/lib/storage-contracts/dist/workflow-tree-discovery.js.map +1 -0
  680. package/lib/storage-contracts/package.json +5 -0
  681. package/lib/storage-contracts/src/contracts.ts +73 -0
  682. package/lib/storage-contracts/src/durable-budget-contracts.ts +266 -0
  683. package/lib/storage-contracts/src/execution-wait-contracts.ts +169 -0
  684. package/lib/storage-contracts/src/index.ts +17 -0
  685. package/lib/storage-contracts/src/memory-contracts.ts +322 -0
  686. package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +88 -0
  687. package/lib/storage-contracts/src/scheduler-contracts.ts +68 -0
  688. package/lib/storage-contracts/src/submission-journal.ts +50 -0
  689. package/lib/storage-contracts/src/workflow-format2.ts +288 -0
  690. package/lib/storage-contracts/src/workflow-format3.ts +201 -0
  691. package/lib/storage-contracts/src/workflow-format4.ts +96 -0
  692. package/lib/storage-contracts/src/workflow-format5.ts +375 -0
  693. package/lib/storage-contracts/src/workflow-graph-contracts.ts +44 -0
  694. package/lib/storage-contracts/src/workflow-graph-discovery.ts +107 -0
  695. package/lib/storage-contracts/src/workflow-loop-format1.ts +102 -0
  696. package/lib/storage-contracts/src/workflow-saga-format1.ts +165 -0
  697. package/lib/storage-contracts/src/workflow-tree-contracts.ts +191 -0
  698. package/lib/storage-contracts/src/workflow-tree-discovery.ts +39 -0
  699. package/lib/storage-postgres/dist/index.d.ts +2 -0
  700. package/lib/storage-postgres/dist/index.d.ts.map +1 -0
  701. package/lib/storage-postgres/dist/index.js +2 -0
  702. package/lib/storage-postgres/dist/index.js.map +1 -0
  703. package/lib/storage-postgres/dist/postgres.d.ts +8 -0
  704. package/lib/storage-postgres/dist/postgres.d.ts.map +1 -0
  705. package/lib/storage-postgres/dist/postgres.js +233 -0
  706. package/lib/storage-postgres/dist/postgres.js.map +1 -0
  707. package/lib/storage-postgres/package.json +5 -0
  708. package/lib/storage-postgres/src/index.ts +1 -0
  709. package/lib/storage-postgres/src/postgres.ts +222 -0
  710. package/lib/storage-sql/dist/aggregate-session.d.ts +31 -0
  711. package/lib/storage-sql/dist/aggregate-session.d.ts.map +1 -0
  712. package/lib/storage-sql/dist/aggregate-session.js +78 -0
  713. package/lib/storage-sql/dist/aggregate-session.js.map +1 -0
  714. package/lib/storage-sql/dist/contracts.d.ts +2 -0
  715. package/lib/storage-sql/dist/contracts.d.ts.map +1 -0
  716. package/lib/storage-sql/dist/contracts.js +3 -0
  717. package/lib/storage-sql/dist/contracts.js.map +1 -0
  718. package/lib/storage-sql/dist/durable-budget-database.d.ts +33 -0
  719. package/lib/storage-sql/dist/durable-budget-database.d.ts.map +1 -0
  720. package/lib/storage-sql/dist/durable-budget-database.js +191 -0
  721. package/lib/storage-sql/dist/durable-budget-database.js.map +1 -0
  722. package/lib/storage-sql/dist/durable-budget-state.d.ts +24 -0
  723. package/lib/storage-sql/dist/durable-budget-state.d.ts.map +1 -0
  724. package/lib/storage-sql/dist/durable-budget-state.js +211 -0
  725. package/lib/storage-sql/dist/durable-budget-state.js.map +1 -0
  726. package/lib/storage-sql/dist/durable-budget-validation.d.ts +5 -0
  727. package/lib/storage-sql/dist/durable-budget-validation.d.ts.map +1 -0
  728. package/lib/storage-sql/dist/durable-budget-validation.js +22 -0
  729. package/lib/storage-sql/dist/durable-budget-validation.js.map +1 -0
  730. package/lib/storage-sql/dist/execution-completions.d.ts +12 -0
  731. package/lib/storage-sql/dist/execution-completions.d.ts.map +1 -0
  732. package/lib/storage-sql/dist/execution-completions.js +60 -0
  733. package/lib/storage-sql/dist/execution-completions.js.map +1 -0
  734. package/lib/storage-sql/dist/execution-wait-database.d.ts +22 -0
  735. package/lib/storage-sql/dist/execution-wait-database.d.ts.map +1 -0
  736. package/lib/storage-sql/dist/execution-wait-database.js +288 -0
  737. package/lib/storage-sql/dist/execution-wait-database.js.map +1 -0
  738. package/lib/storage-sql/dist/execution-wait-validation.d.ts +8 -0
  739. package/lib/storage-sql/dist/execution-wait-validation.d.ts.map +1 -0
  740. package/lib/storage-sql/dist/execution-wait-validation.js +125 -0
  741. package/lib/storage-sql/dist/execution-wait-validation.js.map +1 -0
  742. package/lib/storage-sql/dist/host.d.ts +22 -0
  743. package/lib/storage-sql/dist/host.d.ts.map +1 -0
  744. package/lib/storage-sql/dist/host.js +21 -0
  745. package/lib/storage-sql/dist/host.js.map +1 -0
  746. package/lib/storage-sql/dist/memory-database.d.ts +24 -0
  747. package/lib/storage-sql/dist/memory-database.d.ts.map +1 -0
  748. package/lib/storage-sql/dist/memory-database.js +359 -0
  749. package/lib/storage-sql/dist/memory-database.js.map +1 -0
  750. package/lib/storage-sql/dist/scheduled-database.d.ts +74 -0
  751. package/lib/storage-sql/dist/scheduled-database.d.ts.map +1 -0
  752. package/lib/storage-sql/dist/scheduled-database.js +1152 -0
  753. package/lib/storage-sql/dist/scheduled-database.js.map +1 -0
  754. package/lib/storage-sql/dist/scheduled-validation.d.ts +9 -0
  755. package/lib/storage-sql/dist/scheduled-validation.d.ts.map +1 -0
  756. package/lib/storage-sql/dist/scheduled-validation.js +200 -0
  757. package/lib/storage-sql/dist/scheduled-validation.js.map +1 -0
  758. package/lib/storage-sql/dist/scheduler-contracts.d.ts +2 -0
  759. package/lib/storage-sql/dist/scheduler-contracts.d.ts.map +1 -0
  760. package/lib/storage-sql/dist/scheduler-contracts.js +3 -0
  761. package/lib/storage-sql/dist/scheduler-contracts.js.map +1 -0
  762. package/lib/storage-sql/dist/scheduler-database.d.ts +55 -0
  763. package/lib/storage-sql/dist/scheduler-database.d.ts.map +1 -0
  764. package/lib/storage-sql/dist/scheduler-database.js +655 -0
  765. package/lib/storage-sql/dist/scheduler-database.js.map +1 -0
  766. package/lib/storage-sql/dist/scheduler-validation.d.ts +22 -0
  767. package/lib/storage-sql/dist/scheduler-validation.d.ts.map +1 -0
  768. package/lib/storage-sql/dist/scheduler-validation.js +201 -0
  769. package/lib/storage-sql/dist/scheduler-validation.js.map +1 -0
  770. package/lib/storage-sql/dist/validation.d.ts +14 -0
  771. package/lib/storage-sql/dist/validation.d.ts.map +1 -0
  772. package/lib/storage-sql/dist/validation.js +106 -0
  773. package/lib/storage-sql/dist/validation.js.map +1 -0
  774. package/lib/storage-sql/dist/workflow-graph-discovery-index.d.ts +7 -0
  775. package/lib/storage-sql/dist/workflow-graph-discovery-index.d.ts.map +1 -0
  776. package/lib/storage-sql/dist/workflow-graph-discovery-index.js +55 -0
  777. package/lib/storage-sql/dist/workflow-graph-discovery-index.js.map +1 -0
  778. package/lib/storage-sql/dist/workflow-graph-discovery-validation.d.ts +5 -0
  779. package/lib/storage-sql/dist/workflow-graph-discovery-validation.d.ts.map +1 -0
  780. package/lib/storage-sql/dist/workflow-graph-discovery-validation.js +22 -0
  781. package/lib/storage-sql/dist/workflow-graph-discovery-validation.js.map +1 -0
  782. package/lib/storage-sql/dist/workflow-tree-database.d.ts +270 -0
  783. package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -0
  784. package/lib/storage-sql/dist/workflow-tree-database.js +1692 -0
  785. package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -0
  786. package/lib/storage-sql/dist/workflow-tree-discovery-validation.d.ts +5 -0
  787. package/lib/storage-sql/dist/workflow-tree-discovery-validation.d.ts.map +1 -0
  788. package/lib/storage-sql/dist/workflow-tree-discovery-validation.js +15 -0
  789. package/lib/storage-sql/dist/workflow-tree-discovery-validation.js.map +1 -0
  790. package/lib/storage-sql/dist/workflow-tree-validation.d.ts +9 -0
  791. package/lib/storage-sql/dist/workflow-tree-validation.d.ts.map +1 -0
  792. package/lib/storage-sql/dist/workflow-tree-validation.js +576 -0
  793. package/lib/storage-sql/dist/workflow-tree-validation.js.map +1 -0
  794. package/lib/storage-sql/package.json +5 -0
  795. package/lib/storage-sql/src/aggregate-session.ts +72 -0
  796. package/lib/storage-sql/src/contracts.ts +2 -0
  797. package/lib/storage-sql/src/durable-budget-database.ts +180 -0
  798. package/lib/storage-sql/src/durable-budget-state.ts +155 -0
  799. package/lib/storage-sql/src/durable-budget-validation.ts +23 -0
  800. package/lib/storage-sql/src/execution-completions.ts +58 -0
  801. package/lib/storage-sql/src/execution-wait-database.ts +219 -0
  802. package/lib/storage-sql/src/execution-wait-validation.ts +108 -0
  803. package/lib/storage-sql/src/host.ts +21 -0
  804. package/lib/storage-sql/src/memory-database.ts +320 -0
  805. package/lib/storage-sql/src/scheduled-database.ts +811 -0
  806. package/lib/storage-sql/src/scheduled-validation.ts +89 -0
  807. package/lib/storage-sql/src/scheduler-contracts.ts +2 -0
  808. package/lib/storage-sql/src/scheduler-database.ts +475 -0
  809. package/lib/storage-sql/src/scheduler-validation.ts +112 -0
  810. package/lib/storage-sql/src/validation.ts +104 -0
  811. package/lib/storage-sql/src/workflow-graph-discovery-index.ts +60 -0
  812. package/lib/storage-sql/src/workflow-graph-discovery-validation.ts +21 -0
  813. package/lib/storage-sql/src/workflow-tree-database.ts +450 -0
  814. package/lib/storage-sql/src/workflow-tree-discovery-validation.ts +13 -0
  815. package/lib/storage-sql/src/workflow-tree-validation.ts +166 -0
  816. package/lib/storage-sqlite/dist/backup.d.ts +24 -0
  817. package/lib/storage-sqlite/dist/backup.d.ts.map +1 -0
  818. package/lib/storage-sqlite/dist/backup.js +84 -0
  819. package/lib/storage-sqlite/dist/backup.js.map +1 -0
  820. package/lib/storage-sqlite/dist/index.d.ts +4 -0
  821. package/lib/storage-sqlite/dist/index.d.ts.map +1 -0
  822. package/lib/storage-sqlite/dist/index.js +4 -0
  823. package/lib/storage-sqlite/dist/index.js.map +1 -0
  824. package/lib/storage-sqlite/dist/migrations.d.ts +6 -0
  825. package/lib/storage-sqlite/dist/migrations.d.ts.map +1 -0
  826. package/lib/storage-sqlite/dist/migrations.js +50 -0
  827. package/lib/storage-sqlite/dist/migrations.js.map +1 -0
  828. package/lib/storage-sqlite/dist/sqlite-database.d.ts +36 -0
  829. package/lib/storage-sqlite/dist/sqlite-database.d.ts.map +1 -0
  830. package/lib/storage-sqlite/dist/sqlite-database.js +179 -0
  831. package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -0
  832. package/lib/storage-sqlite/dist/sqlite-worker.d.ts +2 -0
  833. package/lib/storage-sqlite/dist/sqlite-worker.d.ts.map +1 -0
  834. package/lib/storage-sqlite/dist/sqlite-worker.js +95 -0
  835. package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -0
  836. package/lib/storage-sqlite/dist/sqlite.d.ts +7 -0
  837. package/lib/storage-sqlite/dist/sqlite.d.ts.map +1 -0
  838. package/lib/storage-sqlite/dist/sqlite.js +78 -0
  839. package/lib/storage-sqlite/dist/sqlite.js.map +1 -0
  840. package/lib/storage-sqlite/package.json +5 -0
  841. package/lib/storage-sqlite/src/backup.ts +58 -0
  842. package/lib/storage-sqlite/src/index.ts +3 -0
  843. package/lib/storage-sqlite/src/migrations.ts +46 -0
  844. package/lib/storage-sqlite/src/sqlite-database.ts +172 -0
  845. package/lib/storage-sqlite/src/sqlite-worker.ts +52 -0
  846. package/lib/storage-sqlite/src/sqlite.ts +72 -0
  847. package/lib/testing/dist/index.d.ts +10 -0
  848. package/lib/testing/dist/index.d.ts.map +1 -0
  849. package/lib/testing/dist/index.js +24 -0
  850. package/lib/testing/dist/index.js.map +1 -0
  851. package/lib/testing/package.json +5 -0
  852. package/lib/testing/src/index.ts +26 -0
  853. package/lib/tools/dist/batch.d.ts +71 -0
  854. package/lib/tools/dist/batch.d.ts.map +1 -0
  855. package/lib/tools/dist/batch.js +542 -0
  856. package/lib/tools/dist/batch.js.map +1 -0
  857. package/lib/tools/dist/budget-binding.d.ts +18 -0
  858. package/lib/tools/dist/budget-binding.d.ts.map +1 -0
  859. package/lib/tools/dist/budget-binding.js +65 -0
  860. package/lib/tools/dist/budget-binding.js.map +1 -0
  861. package/lib/tools/dist/context.d.ts +17 -0
  862. package/lib/tools/dist/context.d.ts.map +1 -0
  863. package/lib/tools/dist/context.js +52 -0
  864. package/lib/tools/dist/context.js.map +1 -0
  865. package/lib/tools/dist/host.d.ts +3 -0
  866. package/lib/tools/dist/host.d.ts.map +1 -0
  867. package/lib/tools/dist/host.js +3 -0
  868. package/lib/tools/dist/host.js.map +1 -0
  869. package/lib/tools/dist/index.d.ts +79 -0
  870. package/lib/tools/dist/index.d.ts.map +1 -0
  871. package/lib/tools/dist/index.js +462 -0
  872. package/lib/tools/dist/index.js.map +1 -0
  873. package/lib/tools/package.json +5 -0
  874. package/lib/tools/src/batch.ts +496 -0
  875. package/lib/tools/src/budget-binding.ts +63 -0
  876. package/lib/tools/src/context.ts +56 -0
  877. package/lib/tools/src/host.ts +2 -0
  878. package/lib/tools/src/index.ts +479 -0
  879. package/lib/workflows/dist/agents.d.ts +24 -0
  880. package/lib/workflows/dist/agents.d.ts.map +1 -0
  881. package/lib/workflows/dist/agents.js +55 -0
  882. package/lib/workflows/dist/agents.js.map +1 -0
  883. package/lib/workflows/dist/children-coordinator.d.ts +58 -0
  884. package/lib/workflows/dist/children-coordinator.d.ts.map +1 -0
  885. package/lib/workflows/dist/children-coordinator.js +148 -0
  886. package/lib/workflows/dist/children-coordinator.js.map +1 -0
  887. package/lib/workflows/dist/children-definition.d.ts +43 -0
  888. package/lib/workflows/dist/children-definition.d.ts.map +1 -0
  889. package/lib/workflows/dist/children-definition.js +74 -0
  890. package/lib/workflows/dist/children-definition.js.map +1 -0
  891. package/lib/workflows/dist/children-discovery.d.ts +20 -0
  892. package/lib/workflows/dist/children-discovery.d.ts.map +1 -0
  893. package/lib/workflows/dist/children-discovery.js +103 -0
  894. package/lib/workflows/dist/children-discovery.js.map +1 -0
  895. package/lib/workflows/dist/children-runtime.d.ts +72 -0
  896. package/lib/workflows/dist/children-runtime.d.ts.map +1 -0
  897. package/lib/workflows/dist/children-runtime.js +600 -0
  898. package/lib/workflows/dist/children-runtime.js.map +1 -0
  899. package/lib/workflows/dist/children.d.ts +9 -0
  900. package/lib/workflows/dist/children.d.ts.map +1 -0
  901. package/lib/workflows/dist/children.js +6 -0
  902. package/lib/workflows/dist/children.js.map +1 -0
  903. package/lib/workflows/dist/composite-fleet.d.ts +87 -0
  904. package/lib/workflows/dist/composite-fleet.d.ts.map +1 -0
  905. package/lib/workflows/dist/composite-fleet.js +259 -0
  906. package/lib/workflows/dist/composite-fleet.js.map +1 -0
  907. package/lib/workflows/dist/composite-host.d.ts +45 -0
  908. package/lib/workflows/dist/composite-host.d.ts.map +1 -0
  909. package/lib/workflows/dist/composite-host.js +132 -0
  910. package/lib/workflows/dist/composite-host.js.map +1 -0
  911. package/lib/workflows/dist/composites.d.ts +4 -0
  912. package/lib/workflows/dist/composites.d.ts.map +1 -0
  913. package/lib/workflows/dist/composites.js +3 -0
  914. package/lib/workflows/dist/composites.js.map +1 -0
  915. package/lib/workflows/dist/definition.d.ts +61 -0
  916. package/lib/workflows/dist/definition.d.ts.map +1 -0
  917. package/lib/workflows/dist/definition.js +112 -0
  918. package/lib/workflows/dist/definition.js.map +1 -0
  919. package/lib/workflows/dist/drain.d.ts +21 -0
  920. package/lib/workflows/dist/drain.d.ts.map +1 -0
  921. package/lib/workflows/dist/drain.js +53 -0
  922. package/lib/workflows/dist/drain.js.map +1 -0
  923. package/lib/workflows/dist/ephemeral.d.ts +24 -0
  924. package/lib/workflows/dist/ephemeral.d.ts.map +1 -0
  925. package/lib/workflows/dist/ephemeral.js +122 -0
  926. package/lib/workflows/dist/ephemeral.js.map +1 -0
  927. package/lib/workflows/dist/fleet-control.d.ts +129 -0
  928. package/lib/workflows/dist/fleet-control.d.ts.map +1 -0
  929. package/lib/workflows/dist/fleet-control.js +356 -0
  930. package/lib/workflows/dist/fleet-control.js.map +1 -0
  931. package/lib/workflows/dist/graph-coordinator.d.ts +60 -0
  932. package/lib/workflows/dist/graph-coordinator.d.ts.map +1 -0
  933. package/lib/workflows/dist/graph-coordinator.js +266 -0
  934. package/lib/workflows/dist/graph-coordinator.js.map +1 -0
  935. package/lib/workflows/dist/graph-definition.d.ts +40 -0
  936. package/lib/workflows/dist/graph-definition.d.ts.map +1 -0
  937. package/lib/workflows/dist/graph-definition.js +58 -0
  938. package/lib/workflows/dist/graph-definition.js.map +1 -0
  939. package/lib/workflows/dist/graph-discovery.d.ts +27 -0
  940. package/lib/workflows/dist/graph-discovery.d.ts.map +1 -0
  941. package/lib/workflows/dist/graph-discovery.js +165 -0
  942. package/lib/workflows/dist/graph-discovery.js.map +1 -0
  943. package/lib/workflows/dist/graphs.d.ts +55 -0
  944. package/lib/workflows/dist/graphs.d.ts.map +1 -0
  945. package/lib/workflows/dist/graphs.js +10 -0
  946. package/lib/workflows/dist/graphs.js.map +1 -0
  947. package/lib/workflows/dist/hook-relay.d.ts +67 -0
  948. package/lib/workflows/dist/hook-relay.d.ts.map +1 -0
  949. package/lib/workflows/dist/hook-relay.js +157 -0
  950. package/lib/workflows/dist/hook-relay.js.map +1 -0
  951. package/lib/workflows/dist/index.d.ts +16 -0
  952. package/lib/workflows/dist/index.d.ts.map +1 -0
  953. package/lib/workflows/dist/index.js +15 -0
  954. package/lib/workflows/dist/index.js.map +1 -0
  955. package/lib/workflows/dist/leadership.d.ts +33 -0
  956. package/lib/workflows/dist/leadership.d.ts.map +1 -0
  957. package/lib/workflows/dist/leadership.js +109 -0
  958. package/lib/workflows/dist/leadership.js.map +1 -0
  959. package/lib/workflows/dist/lifecycle-definition.d.ts +89 -0
  960. package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -0
  961. package/lib/workflows/dist/lifecycle-definition.js +137 -0
  962. package/lib/workflows/dist/lifecycle-definition.js.map +1 -0
  963. package/lib/workflows/dist/lifecycle-fleet.d.ts +90 -0
  964. package/lib/workflows/dist/lifecycle-fleet.d.ts.map +1 -0
  965. package/lib/workflows/dist/lifecycle-fleet.js +406 -0
  966. package/lib/workflows/dist/lifecycle-fleet.js.map +1 -0
  967. package/lib/workflows/dist/lifecycle-host.d.ts +44 -0
  968. package/lib/workflows/dist/lifecycle-host.d.ts.map +1 -0
  969. package/lib/workflows/dist/lifecycle-host.js +133 -0
  970. package/lib/workflows/dist/lifecycle-host.js.map +1 -0
  971. package/lib/workflows/dist/lifecycle-human-transport.d.ts +67 -0
  972. package/lib/workflows/dist/lifecycle-human-transport.d.ts.map +1 -0
  973. package/lib/workflows/dist/lifecycle-human-transport.js +149 -0
  974. package/lib/workflows/dist/lifecycle-human-transport.js.map +1 -0
  975. package/lib/workflows/dist/lifecycle-runtime.d.ts +115 -0
  976. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -0
  977. package/lib/workflows/dist/lifecycle-runtime.js +831 -0
  978. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -0
  979. package/lib/workflows/dist/lifecycle.d.ts +10 -0
  980. package/lib/workflows/dist/lifecycle.d.ts.map +1 -0
  981. package/lib/workflows/dist/lifecycle.js +7 -0
  982. package/lib/workflows/dist/lifecycle.js.map +1 -0
  983. package/lib/workflows/dist/loop-definition.d.ts +46 -0
  984. package/lib/workflows/dist/loop-definition.d.ts.map +1 -0
  985. package/lib/workflows/dist/loop-definition.js +55 -0
  986. package/lib/workflows/dist/loop-definition.js.map +1 -0
  987. package/lib/workflows/dist/loop-runtime.d.ts +47 -0
  988. package/lib/workflows/dist/loop-runtime.d.ts.map +1 -0
  989. package/lib/workflows/dist/loop-runtime.js +358 -0
  990. package/lib/workflows/dist/loop-runtime.js.map +1 -0
  991. package/lib/workflows/dist/loops.d.ts +6 -0
  992. package/lib/workflows/dist/loops.d.ts.map +1 -0
  993. package/lib/workflows/dist/loops.js +4 -0
  994. package/lib/workflows/dist/loops.js.map +1 -0
  995. package/lib/workflows/dist/migration-service.d.ts +55 -0
  996. package/lib/workflows/dist/migration-service.d.ts.map +1 -0
  997. package/lib/workflows/dist/migration-service.js +73 -0
  998. package/lib/workflows/dist/migration-service.js.map +1 -0
  999. package/lib/workflows/dist/migration.d.ts +123 -0
  1000. package/lib/workflows/dist/migration.d.ts.map +1 -0
  1001. package/lib/workflows/dist/migration.js +217 -0
  1002. package/lib/workflows/dist/migration.js.map +1 -0
  1003. package/lib/workflows/dist/operator-transports.d.ts +265 -0
  1004. package/lib/workflows/dist/operator-transports.d.ts.map +1 -0
  1005. package/lib/workflows/dist/operator-transports.js +404 -0
  1006. package/lib/workflows/dist/operator-transports.js.map +1 -0
  1007. package/lib/workflows/dist/reconciliation.d.ts +25 -0
  1008. package/lib/workflows/dist/reconciliation.d.ts.map +1 -0
  1009. package/lib/workflows/dist/reconciliation.js +109 -0
  1010. package/lib/workflows/dist/reconciliation.js.map +1 -0
  1011. package/lib/workflows/dist/runtime.d.ts +65 -0
  1012. package/lib/workflows/dist/runtime.d.ts.map +1 -0
  1013. package/lib/workflows/dist/runtime.js +492 -0
  1014. package/lib/workflows/dist/runtime.js.map +1 -0
  1015. package/lib/workflows/dist/saga-definition.d.ts +46 -0
  1016. package/lib/workflows/dist/saga-definition.d.ts.map +1 -0
  1017. package/lib/workflows/dist/saga-definition.js +71 -0
  1018. package/lib/workflows/dist/saga-definition.js.map +1 -0
  1019. package/lib/workflows/dist/saga-runtime.d.ts +51 -0
  1020. package/lib/workflows/dist/saga-runtime.d.ts.map +1 -0
  1021. package/lib/workflows/dist/saga-runtime.js +499 -0
  1022. package/lib/workflows/dist/saga-runtime.js.map +1 -0
  1023. package/lib/workflows/dist/sagas.d.ts +6 -0
  1024. package/lib/workflows/dist/sagas.d.ts.map +1 -0
  1025. package/lib/workflows/dist/sagas.js +4 -0
  1026. package/lib/workflows/dist/sagas.js.map +1 -0
  1027. package/lib/workflows/dist/scheduled-helpers.d.ts +53 -0
  1028. package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -0
  1029. package/lib/workflows/dist/scheduled-helpers.js +230 -0
  1030. package/lib/workflows/dist/scheduled-helpers.js.map +1 -0
  1031. package/lib/workflows/dist/scheduled.d.ts +116 -0
  1032. package/lib/workflows/dist/scheduled.d.ts.map +1 -0
  1033. package/lib/workflows/dist/scheduled.js +781 -0
  1034. package/lib/workflows/dist/scheduled.js.map +1 -0
  1035. package/lib/workflows/dist/traces.d.ts +158 -0
  1036. package/lib/workflows/dist/traces.d.ts.map +1 -0
  1037. package/lib/workflows/dist/traces.js +366 -0
  1038. package/lib/workflows/dist/traces.js.map +1 -0
  1039. package/lib/workflows/dist/versions.d.ts +57 -0
  1040. package/lib/workflows/dist/versions.d.ts.map +1 -0
  1041. package/lib/workflows/dist/versions.js +87 -0
  1042. package/lib/workflows/dist/versions.js.map +1 -0
  1043. package/lib/workflows/dist/worker.d.ts +51 -0
  1044. package/lib/workflows/dist/worker.d.ts.map +1 -0
  1045. package/lib/workflows/dist/worker.js +143 -0
  1046. package/lib/workflows/dist/worker.js.map +1 -0
  1047. package/lib/workflows/package.json +5 -0
  1048. package/lib/workflows/src/agents.ts +65 -0
  1049. package/lib/workflows/src/children-coordinator.ts +50 -0
  1050. package/lib/workflows/src/children-definition.ts +88 -0
  1051. package/lib/workflows/src/children-discovery.ts +32 -0
  1052. package/lib/workflows/src/children-runtime.ts +169 -0
  1053. package/lib/workflows/src/children.ts +12 -0
  1054. package/lib/workflows/src/composite-fleet.ts +155 -0
  1055. package/lib/workflows/src/composite-host.ts +67 -0
  1056. package/lib/workflows/src/composites.ts +6 -0
  1057. package/lib/workflows/src/definition.ts +113 -0
  1058. package/lib/workflows/src/drain.ts +56 -0
  1059. package/lib/workflows/src/ephemeral.ts +124 -0
  1060. package/lib/workflows/src/fleet-control.ts +326 -0
  1061. package/lib/workflows/src/graph-coordinator.ts +223 -0
  1062. package/lib/workflows/src/graph-definition.ts +70 -0
  1063. package/lib/workflows/src/graph-discovery.ts +145 -0
  1064. package/lib/workflows/src/graphs.ts +56 -0
  1065. package/lib/workflows/src/hook-relay.ts +177 -0
  1066. package/lib/workflows/src/index.ts +27 -0
  1067. package/lib/workflows/src/leadership.ts +102 -0
  1068. package/lib/workflows/src/lifecycle-definition.ts +194 -0
  1069. package/lib/workflows/src/lifecycle-fleet.ts +346 -0
  1070. package/lib/workflows/src/lifecycle-host.ts +109 -0
  1071. package/lib/workflows/src/lifecycle-human-transport.ts +170 -0
  1072. package/lib/workflows/src/lifecycle-runtime.ts +673 -0
  1073. package/lib/workflows/src/lifecycle.ts +59 -0
  1074. package/lib/workflows/src/loop-definition.ts +62 -0
  1075. package/lib/workflows/src/loop-runtime.ts +260 -0
  1076. package/lib/workflows/src/loops.ts +7 -0
  1077. package/lib/workflows/src/migration-service.ts +83 -0
  1078. package/lib/workflows/src/migration.ts +242 -0
  1079. package/lib/workflows/src/operator-transports.ts +439 -0
  1080. package/lib/workflows/src/reconciliation.ts +121 -0
  1081. package/lib/workflows/src/runtime.ts +348 -0
  1082. package/lib/workflows/src/saga-definition.ts +104 -0
  1083. package/lib/workflows/src/saga-runtime.ts +406 -0
  1084. package/lib/workflows/src/sagas.ts +24 -0
  1085. package/lib/workflows/src/scheduled-helpers.ts +214 -0
  1086. package/lib/workflows/src/scheduled.ts +707 -0
  1087. package/lib/workflows/src/traces.ts +381 -0
  1088. package/lib/workflows/src/versions.ts +114 -0
  1089. package/lib/workflows/src/worker.ts +115 -0
  1090. package/lib/workstream/dist/executions.d.ts +34 -0
  1091. package/lib/workstream/dist/executions.d.ts.map +1 -0
  1092. package/lib/workstream/dist/executions.js +344 -0
  1093. package/lib/workstream/dist/executions.js.map +1 -0
  1094. package/lib/workstream/dist/humans.d.ts +76 -0
  1095. package/lib/workstream/dist/humans.d.ts.map +1 -0
  1096. package/lib/workstream/dist/humans.js +273 -0
  1097. package/lib/workstream/dist/humans.js.map +1 -0
  1098. package/lib/workstream/dist/index.d.ts +61 -0
  1099. package/lib/workstream/dist/index.d.ts.map +1 -0
  1100. package/lib/workstream/dist/index.js +310 -0
  1101. package/lib/workstream/dist/index.js.map +1 -0
  1102. package/lib/workstream/dist/timers.d.ts +41 -0
  1103. package/lib/workstream/dist/timers.d.ts.map +1 -0
  1104. package/lib/workstream/dist/timers.js +240 -0
  1105. package/lib/workstream/dist/timers.js.map +1 -0
  1106. package/lib/workstream/dist/webhooks.d.ts +69 -0
  1107. package/lib/workstream/dist/webhooks.d.ts.map +1 -0
  1108. package/lib/workstream/dist/webhooks.js +313 -0
  1109. package/lib/workstream/dist/webhooks.js.map +1 -0
  1110. package/lib/workstream/package.json +5 -0
  1111. package/lib/workstream/src/executions.ts +253 -0
  1112. package/lib/workstream/src/humans.ts +323 -0
  1113. package/lib/workstream/src/index.ts +279 -0
  1114. package/lib/workstream/src/timers.ts +212 -0
  1115. package/lib/workstream/src/webhooks.ts +180 -0
  1116. package/package.json +281 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-service.js","sourceRoot":"","sources":["../src/migration-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,gHAAgH;AAChH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAqB,EAAE,KAAY,EAAE,KAAa;IAC3F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,WAAW,CAAC,eAAe,EAAE,8BAA8B,CAAC,CAAC;IACvI,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACpI,OAAO,MAAM,EAAE,cAAc,CAAC;AAChC,CAAC;AA0BD,MAAM,QAAQ,GA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import { digest } from './definition.js';\nimport type { MigrationCommand, MigrationPlan, WorkflowMigration, WorkflowMigrationCatalog, WorkflowMigrationResult } from './migration.js';\n\n/** The definition digest a durable run is pinned to, or undefined when the run does not exist in this scope. */\nexport async function pinnedDefinitionHash(store: AggregateStore, scope: Scope, runId: string): Promise<string | undefined> {\n if (typeof runId !== 'string' || !/^[a-f0-9]{64}$/.test(runId)) throw new MayuraError('INVALID_INPUT', 'An exact run id is required.');\n const record = await store.read(digest('mayura:scope:v1', { principalId: scope?.principalId, projectId: scope?.projectId }), runId);\n return record?.definitionHash;\n}\n\nexport interface WorkflowMigrationOfferRecord {\n readonly id: string; readonly description: string;\n readonly fromVersion: string; readonly toVersion: string; readonly fromDigest: string; readonly toDigest: string;\n}\nexport interface WorkflowMigrationServiceOptions<S extends { readonly version: number }> {\n readonly catalog: WorkflowMigrationCatalog;\n /** The run's pinned definition digest; undefined when the run is not visible. See `pinnedDefinitionHash`. */\n readonly pinned: (runId: string) => Promise<string | undefined>;\n /** The run's current snapshot; its `version` is the revision operators act on. */\n readonly inspect: (runId: string) => Promise<S>;\n /** The format runtime's `migrate` (for fleets, the fleet wrapper so indexes follow the run). */\n readonly migrate: (migration: WorkflowMigration, command: MigrationCommand) => Promise<WorkflowMigrationResult<S>>;\n}\nexport type WorkflowMigrationApplyResult<S> =\n | { readonly status: 'applied'; readonly plan: MigrationPlan; readonly snapshot: S }\n | { readonly status: 'refused'; readonly plan: MigrationPlan }\n | { readonly status: 'conflict' } | { readonly status: 'not_found' };\nexport interface WorkflowMigrationService<S> {\n list(runId: string): Promise<readonly WorkflowMigrationOfferRecord[] | null>;\n plan(runId: string, migrationId: string): Promise<MigrationPlan | null>;\n /** Apply at an exact revision. A plan with blockers is `refused`; a changed revision or concurrent change is `conflict`. */\n apply(runId: string, migrationId: string, command: { readonly revision: number; readonly actorId: string; readonly commandId: string }): Promise<WorkflowMigrationApplyResult<S>>;\n}\n\nconst identity = (definition: unknown): { readonly version: string; readonly digest: string } => {\n const value = definition as { readonly version?: unknown; readonly digest?: unknown };\n if (typeof value?.version !== 'string' || typeof value.digest !== 'string') throw new MayuraError('INVALID_CONFIG', 'Migration definitions need a version and digest.');\n return { version: value.version, digest: value.digest };\n};\nconst isConflict = (error: unknown): boolean => error instanceof MayuraError && error.code === 'CONFLICT';\n\n/**\n * Operator-facing migration service over one format runtime: offers the catalog's migrations for a run's pinned\n * version, previews plans and applies them at an exact revision. It adds no authority: every decision stays in the\n * runtime's planner and the store's transactional re-verification.\n */\nexport function createWorkflowMigrationService<S extends { readonly version: number }>(options: WorkflowMigrationServiceOptions<S>): WorkflowMigrationService<S> {\n const { catalog, pinned, inspect, migrate } = options;\n if (!catalog || typeof catalog.from !== 'function' || typeof pinned !== 'function' || typeof inspect !== 'function' || typeof migrate !== 'function') {\n throw new MayuraError('INVALID_CONFIG', 'A migration service needs a catalog and pinned, inspect and migrate callbacks.');\n }\n const offered = async (runId: string, migrationId: string): Promise<WorkflowMigration | undefined> => {\n const hash = await pinned(runId); if (hash === undefined) return undefined;\n return catalog.from(hash).find(migration => migration.id === migrationId);\n };\n const service: WorkflowMigrationService<S> = {\n async list(runId) {\n const hash = await pinned(runId); if (hash === undefined) return null;\n return Object.freeze(catalog.from(hash).map(migration => {\n const from = identity(migration.from); const to = identity(migration.to);\n return Object.freeze({ id: migration.id, description: migration.description, fromVersion: from.version, toVersion: to.version, fromDigest: from.digest, toDigest: to.digest });\n }));\n },\n async plan(runId, migrationId) {\n const migration = await offered(runId, migrationId); if (!migration) return null;\n // The plan carries no authority; the actor and command identities are placeholders that are never recorded.\n return (await migrate(migration, { id: runId, actorId: 'preview', commandId: 'preview', dryRun: true })).plan;\n },\n async apply(runId, migrationId, command) {\n const migration = await offered(runId, migrationId); if (!migration) return (await pinned(runId)) === undefined ? { status: 'not_found' } : { status: 'conflict' };\n if ((await inspect(runId)).version !== command.revision) return { status: 'conflict' };\n const { plan } = await migrate(migration, { id: runId, actorId: command.actorId, commandId: command.commandId, dryRun: true });\n if (!plan.allowed) return { status: 'refused', plan };\n try {\n const result = await migrate(migration, { id: runId, actorId: command.actorId, commandId: command.commandId });\n return { status: 'applied', plan: result.plan, snapshot: result.snapshot! };\n } catch (error) { if (isConflict(error)) return { status: 'conflict' }; throw error; }\n },\n };\n return Object.freeze(service);\n}\n"]}
@@ -0,0 +1,123 @@
1
+ import { type JsonValue } from '../../core/dist/index.js';
2
+ /**
3
+ * Reviewed in-place migration of an in-flight durable run from one definition version to another. The migration is a
4
+ * declaration; the framework decides what is safe from the run's actual state and refuses everything else.
5
+ */
6
+ export interface WorkflowMigrationOptions<F, T> {
7
+ /** Stable identity recorded in the run's audit trail, for example `invoice-review-1-to-2` (letters, digits, `.`, `_`, `-`). */
8
+ readonly id: string;
9
+ readonly from: F;
10
+ readonly to: T;
11
+ /** Target node id -> source node id, for steps that were renamed. Only unstarted or waiting steps can be renamed. */
12
+ readonly renames?: Readonly<Record<string, string>>;
13
+ /** Target node ids whose definition changed but whose settled source result the reviewer accepts as-is. */
14
+ readonly acceptCompleted?: readonly string[];
15
+ /** Source node ids that settled and are removed by the new definition; the reviewer accepts dropping their results. */
16
+ readonly acceptRemoved?: readonly string[];
17
+ readonly description?: string;
18
+ }
19
+ export interface WorkflowMigration<F = unknown, T = unknown> {
20
+ readonly kind: 'mayura.workflow-migration';
21
+ readonly id: string;
22
+ readonly from: F;
23
+ readonly to: T;
24
+ readonly renames: Readonly<Record<string, string>>;
25
+ readonly acceptCompleted: readonly string[];
26
+ readonly acceptRemoved: readonly string[];
27
+ readonly description: string;
28
+ }
29
+ /**
30
+ * One node of a definition, reduced to what a migration compares. `fingerprint` covers the node's full definition.
31
+ * `evidence` names what a settled step's recorded state is bound to (for a tool step, the tool its receipt names):
32
+ * a changed node can only accept an existing result when this is unchanged.
33
+ */
34
+ export interface MigrationNode {
35
+ readonly id: string;
36
+ readonly kind: string;
37
+ readonly dependsOn: readonly string[];
38
+ readonly fingerprint: string;
39
+ readonly evidence?: string;
40
+ }
41
+ /** Evidence of a manifest node: the tool a receipt must name, or whether a human request carries a deadline. */
42
+ export declare function nodeEvidence(node: {
43
+ readonly kind: string;
44
+ readonly tool?: unknown;
45
+ readonly deadlineAtMs?: unknown;
46
+ }): string | undefined;
47
+ /** The run's current state of one source step, normalized across formats. */
48
+ export interface MigrationStep {
49
+ readonly id: string;
50
+ readonly status: string;
51
+ }
52
+ export type MigrationAction = 'keep' | 'update' | 'reset' | 'accept' | 'add' | 'remove';
53
+ export interface MigrationPlanEntry {
54
+ readonly action: MigrationAction;
55
+ /** Node id in the target definition (absent for `remove`). */
56
+ readonly target?: string;
57
+ /** Node id in the source definition (absent for `add`). */
58
+ readonly source?: string;
59
+ readonly status?: string;
60
+ }
61
+ export interface MigrationBlocker {
62
+ readonly node: string;
63
+ readonly reason: string;
64
+ }
65
+ export interface MigrationPlan {
66
+ readonly migrationId: string;
67
+ readonly format: string;
68
+ readonly runId: string;
69
+ readonly fromDigest: string;
70
+ readonly toDigest: string;
71
+ readonly entries: readonly MigrationPlanEntry[];
72
+ readonly blockers: readonly MigrationBlocker[];
73
+ readonly allowed: boolean;
74
+ }
75
+ export declare function defineWorkflowMigration<F, T>(options: WorkflowMigrationOptions<F, T>): WorkflowMigration<F, T>;
76
+ export declare function assertWorkflowMigration(value: unknown): asserts value is WorkflowMigration;
77
+ /** Canonical fingerprint of one manifest node: every field except the node's id. */
78
+ export declare function nodeFingerprint(node: Readonly<Record<string, unknown>>): string;
79
+ /**
80
+ * Decide, from the run's real state, what a migration does to each node. The format migrator applies the entries only
81
+ * when `allowed`; blockers explain every refusal.
82
+ */
83
+ export declare function planWorkflowMigration(input: {
84
+ readonly migration: WorkflowMigration;
85
+ readonly format: string;
86
+ readonly runId: string;
87
+ readonly fromDigest: string;
88
+ readonly toDigest: string;
89
+ readonly from: readonly MigrationNode[];
90
+ readonly to: readonly MigrationNode[];
91
+ readonly steps: readonly MigrationStep[];
92
+ /** Format-level refusals found before node planning (for example: run not paused, run is a wait target). */
93
+ readonly preconditions?: readonly MigrationBlocker[];
94
+ }): MigrationPlan;
95
+ /** Result of a migration request: always the plan; the migrated snapshot unless it was a dry run. */
96
+ export interface WorkflowMigrationResult<S> {
97
+ readonly plan: MigrationPlan;
98
+ readonly snapshot?: S;
99
+ }
100
+ /** Audit event payload recorded with every applied migration. */
101
+ export declare function migrationEvent(plan: MigrationPlan, actorId: string, commandId: string): {
102
+ readonly type: 'run.migrated';
103
+ readonly data: Record<string, JsonValue>;
104
+ };
105
+ /** Reject a plan with blockers, surfacing the first reason. */
106
+ export declare function assertMigrationAllowed(plan: MigrationPlan): void;
107
+ /** Identity of the actor and command applying a migration; both are recorded in the audit event. */
108
+ export interface MigrationCommand {
109
+ readonly id: string;
110
+ readonly actorId: string;
111
+ readonly commandId: string;
112
+ readonly dryRun?: boolean;
113
+ }
114
+ export declare function migrationCommand(value: MigrationCommand): MigrationCommand;
115
+ /** Reviewed migrations a host offers, indexed by source definition digest. */
116
+ export interface WorkflowMigrationCatalog<M extends WorkflowMigration = WorkflowMigration> {
117
+ /** Migrations whose source is the given pinned definition digest, in registration order. */
118
+ from(definitionHash: string): readonly M[];
119
+ get(id: string): M | undefined;
120
+ readonly all: readonly M[];
121
+ }
122
+ export declare function createWorkflowMigrationCatalog<M extends WorkflowMigration>(migrations: readonly M[]): WorkflowMigrationCatalog<M>;
123
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGlF;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,EAAE,CAAC;IAC5C,+HAA+H;IAC/H,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IACf,qHAAqH;IACrH,QAA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AAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAEhE;AAED,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE;AAC1I,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CAM1E;AAED,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACvF,4FAA4F;IAC5F,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC3C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC;CAC5B;AACD,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,iBAAiB,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAYjI"}
@@ -0,0 +1,217 @@
1
+ import { MayuraError, freezeJson, jsonValue } from '../../core/dist/index.js';
2
+ import { digest } from './definition.js';
3
+ /** Evidence of a manifest node: the tool a receipt must name, or whether a human request carries a deadline. */
4
+ export function nodeEvidence(node) {
5
+ if (node.kind === 'tool' && typeof node.tool === 'string')
6
+ return `tool:${node.tool}`;
7
+ if (node.kind === 'human')
8
+ return node.deadlineAtMs === null || node.deadlineAtMs === undefined ? 'human' : 'human:deadline';
9
+ return undefined;
10
+ }
11
+ /** Statuses of a step that has not started and holds nothing. */
12
+ const unstarted = new Set(['pending']);
13
+ /** Statuses of a step parked on an external decision; a changed definition re-issues the request. */
14
+ const parked = new Set(['waiting', 'approved', 'forward_waiting', 'compensation_waiting']);
15
+ /** Statuses with work possibly in flight or with an unresolved effect; never changed, removed or renamed. */
16
+ const inFlight = new Set(['dispatching', 'unknown', 'leased', 'started', 'running']);
17
+ /** Successfully settled statuses that dependent steps may build on (a bypassed lifecycle step never ran; its output is null). */
18
+ const succeeded = new Set(['succeeded', 'compensated', 'bypassed']);
19
+ /** A step whose condition did not hold: it holds nothing, so a changed definition decides the condition again. */
20
+ const reconsidered = new Set(['bypassed']);
21
+ const identifier = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;
22
+ const nodePattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;
23
+ /** Migration ids appear in URLs and audit events: no separators. */
24
+ const migrationIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
25
+ export function defineWorkflowMigration(options) {
26
+ try {
27
+ if (!options || typeof options !== 'object' || typeof options.id !== 'string' || !migrationIdPattern.test(options.id) || !options.from || !options.to)
28
+ throw new Error();
29
+ const renames = Object.entries(options.renames ?? {});
30
+ if (renames.length > 256 || renames.some(([to, from]) => !nodePattern.test(to) || typeof from !== 'string' || !nodePattern.test(from))
31
+ || new Set(renames.map(([, from]) => from)).size !== renames.length)
32
+ throw new Error();
33
+ const list = (value) => {
34
+ if (value === undefined)
35
+ return [];
36
+ if (!Array.isArray(value) || value.length > 256 || value.some(item => typeof item !== 'string' || !nodePattern.test(item)))
37
+ throw new Error();
38
+ return [...new Set(value)].sort();
39
+ };
40
+ const description = options.description ?? '';
41
+ if (typeof description !== 'string' || description.length > 2_048)
42
+ throw new Error();
43
+ return Object.freeze({ kind: 'mayura.workflow-migration', id: options.id, from: options.from, to: options.to,
44
+ renames: Object.freeze(Object.fromEntries(renames)), acceptCompleted: Object.freeze(list(options.acceptCompleted)),
45
+ acceptRemoved: Object.freeze(list(options.acceptRemoved)), description });
46
+ }
47
+ catch {
48
+ throw new MayuraError('INVALID_CONFIG', 'A workflow migration needs a bounded id, both definitions, and bounded node lists.');
49
+ }
50
+ }
51
+ export function assertWorkflowMigration(value) {
52
+ if (!value || typeof value !== 'object' || value.kind !== 'mayura.workflow-migration' || !Object.isFrozen(value)) {
53
+ throw new MayuraError('INVALID_CONFIG', 'A genuine defineWorkflowMigration value is required.');
54
+ }
55
+ }
56
+ /** Canonical fingerprint of one manifest node: every field except the node's id. */
57
+ export function nodeFingerprint(node) {
58
+ const { id: _id, ...rest } = node;
59
+ void _id;
60
+ return digest('mayura:migration-node:v1', freezeJson(jsonValue(rest)));
61
+ }
62
+ /**
63
+ * Decide, from the run's real state, what a migration does to each node. The format migrator applies the entries only
64
+ * when `allowed`; blockers explain every refusal.
65
+ */
66
+ export function planWorkflowMigration(input) {
67
+ const { migration } = input;
68
+ const source = new Map(input.from.map(node => [node.id, node]));
69
+ const target = new Map(input.to.map(node => [node.id, node]));
70
+ const status = new Map(input.steps.map(step => [step.id, step.status]));
71
+ const blockers = [...(input.preconditions ?? [])];
72
+ const entries = [];
73
+ const renamed = new Map(Object.entries(migration.renames));
74
+ const renamedSources = new Set(renamed.values());
75
+ const accepted = new Set(migration.acceptCompleted);
76
+ const removable = new Set(migration.acceptRemoved);
77
+ if (input.fromDigest === input.toDigest)
78
+ blockers.push({ node: '*', reason: 'The source and target definitions are identical.' });
79
+ for (const [to, from] of renamed) {
80
+ if (!target.has(to))
81
+ blockers.push({ node: to, reason: 'A rename targets a node the new definition does not have.' });
82
+ if (!source.has(from))
83
+ blockers.push({ node: from, reason: 'A rename names a source node the old definition does not have.' });
84
+ if (source.has(to) && to !== from)
85
+ blockers.push({ node: to, reason: 'A rename cannot target a node id that still exists in the old definition.' });
86
+ }
87
+ for (const id of accepted)
88
+ if (!target.has(id))
89
+ blockers.push({ node: id, reason: 'acceptCompleted names a node the new definition does not have.' });
90
+ for (const id of removable)
91
+ if (!source.has(id) || target.has(id))
92
+ blockers.push({ node: id, reason: 'acceptRemoved names a node that is not removed.' });
93
+ const carried = new Map(); // target id -> effective carried status
94
+ for (const node of input.to) {
95
+ const from = renamed.get(node.id) ?? (source.has(node.id) && !renamedSources.has(node.id) ? node.id : undefined);
96
+ if (from === undefined) {
97
+ entries.push({ action: 'add', target: node.id });
98
+ carried.set(node.id, 'pending');
99
+ continue;
100
+ }
101
+ const previous = source.get(from);
102
+ const current = status.get(from) ?? 'pending';
103
+ if (!previous)
104
+ continue;
105
+ const changed = previous.fingerprint !== node.fingerprint || previous.kind !== node.kind || from !== node.id;
106
+ if (inFlight.has(current)) {
107
+ if (changed)
108
+ blockers.push({ node: node.id, reason: `Step "${from}" is ${current}; a step with work in flight or an unresolved effect cannot change.` });
109
+ entries.push({ action: 'keep', target: node.id, source: from, status: current });
110
+ carried.set(node.id, current);
111
+ continue;
112
+ }
113
+ if (!changed) {
114
+ entries.push({ action: 'keep', target: node.id, source: from, status: current });
115
+ carried.set(node.id, current);
116
+ continue;
117
+ }
118
+ if (previous.kind !== node.kind && !unstarted.has(current)) {
119
+ blockers.push({ node: node.id, reason: `Step "${from}" already started as a ${previous.kind} and cannot become a ${node.kind}.` });
120
+ carried.set(node.id, current);
121
+ continue;
122
+ }
123
+ if (unstarted.has(current)) {
124
+ entries.push({ action: 'update', target: node.id, source: from, status: current });
125
+ carried.set(node.id, 'pending');
126
+ continue;
127
+ }
128
+ if (parked.has(current) || reconsidered.has(current)) {
129
+ entries.push({ action: 'reset', target: node.id, source: from, status: current });
130
+ carried.set(node.id, 'pending');
131
+ continue;
132
+ }
133
+ // Blocked nodes still count with their current status below, so dependents report only root causes.
134
+ if (from !== node.id) {
135
+ blockers.push({ node: node.id, reason: `Step "${from}" already settled (${current}); settled steps cannot be renamed.` });
136
+ carried.set(node.id, current);
137
+ continue;
138
+ }
139
+ if (!accepted.has(node.id)) {
140
+ blockers.push({ node: node.id, reason: `Step "${from}" already settled (${current}) and its definition changed; list it in acceptCompleted to keep the existing result.` });
141
+ carried.set(node.id, current);
142
+ continue;
143
+ }
144
+ // A recorded result stays bound to what produced it: a receipt from one tool cannot stand for another tool.
145
+ if (previous.evidence !== node.evidence) {
146
+ blockers.push({ node: node.id, reason: `Step "${from}" settled (${current}) under ${previous.evidence ?? 'another definition'}; the new definition names ${node.evidence ?? 'something else'}, so its result cannot be accepted.` });
147
+ carried.set(node.id, current);
148
+ continue;
149
+ }
150
+ entries.push({ action: 'accept', target: node.id, source: from, status: current });
151
+ carried.set(node.id, current);
152
+ }
153
+ for (const node of input.from) {
154
+ const kept = target.has(node.id) && !renamedSources.has(node.id) && !renamed.has(node.id);
155
+ if (kept || renamedSources.has(node.id))
156
+ continue;
157
+ const current = status.get(node.id) ?? 'pending';
158
+ if (inFlight.has(current))
159
+ blockers.push({ node: node.id, reason: `Step "${node.id}" is ${current} and cannot be removed.` });
160
+ else if (!unstarted.has(current) && !parked.has(current) && current !== 'skipped' && !reconsidered.has(current) && !removable.has(node.id)) {
161
+ blockers.push({ node: node.id, reason: `Step "${node.id}" already settled (${current}); list it in acceptRemoved to drop its result.` });
162
+ }
163
+ else
164
+ entries.push({ action: 'remove', source: node.id, status: current });
165
+ }
166
+ // A step that keeps a started or settled state must have dependencies that already succeeded under the new graph.
167
+ for (const node of input.to) {
168
+ const current = carried.get(node.id);
169
+ if (current === undefined || unstarted.has(current))
170
+ continue;
171
+ for (const dependency of node.dependsOn) {
172
+ const dependencyStatus = carried.get(dependency) ?? 'pending';
173
+ if (!succeeded.has(dependencyStatus))
174
+ blockers.push({ node: node.id, reason: `Step "${node.id}" is ${current} but its new dependency "${dependency}" has not succeeded.` });
175
+ }
176
+ }
177
+ return freezeJson(jsonValue({ migrationId: migration.id, format: input.format, runId: input.runId, fromDigest: input.fromDigest, toDigest: input.toDigest,
178
+ entries, blockers, allowed: blockers.length === 0 }));
179
+ }
180
+ /** Audit event payload recorded with every applied migration. */
181
+ export function migrationEvent(plan, actorId, commandId) {
182
+ return { type: 'run.migrated', data: { migrationId: plan.migrationId, from: plan.fromDigest, to: plan.toDigest, actorId, commandId,
183
+ actions: plan.entries.map(entry => `${entry.action}:${entry.target ?? entry.source}`).join(',').slice(0, 2_048) } };
184
+ }
185
+ /** Reject a plan with blockers, surfacing the first reason. */
186
+ export function assertMigrationAllowed(plan) {
187
+ if (!plan.allowed)
188
+ throw new MayuraError('CONFLICT', `Migration refused: ${plan.blockers[0]?.reason ?? 'unknown reason'}`);
189
+ }
190
+ export function migrationCommand(value) {
191
+ if (!value || typeof value !== 'object' || typeof value.id !== 'string' || !/^[a-f0-9]{64}$/.test(value.id) || typeof value.actorId !== 'string' || !identifier.test(value.actorId)
192
+ || typeof value.commandId !== 'string' || !identifier.test(value.commandId) || (value.dryRun !== undefined && typeof value.dryRun !== 'boolean')) {
193
+ throw new MayuraError('INVALID_INPUT', 'A migration command needs a run id, a bounded actor id and a bounded command id.');
194
+ }
195
+ return value;
196
+ }
197
+ export function createWorkflowMigrationCatalog(migrations) {
198
+ if (!Array.isArray(migrations) || migrations.length > 1_024)
199
+ throw new MayuraError('INVALID_CONFIG', 'A migration catalog holds at most 1,024 migrations.');
200
+ const byId = new Map();
201
+ const bySource = new Map();
202
+ for (const migration of migrations) {
203
+ const candidate = migration;
204
+ assertWorkflowMigration(candidate);
205
+ const from = migration.from.digest;
206
+ const to = migration.to.digest;
207
+ if (typeof from !== 'string' || typeof to !== 'string' || from === to)
208
+ throw new MayuraError('INVALID_CONFIG', `Migration "${migration.id}" must connect two different definition versions.`);
209
+ if (byId.has(migration.id))
210
+ throw new MayuraError('INVALID_CONFIG', `Migration id "${migration.id}" is registered twice.`);
211
+ byId.set(migration.id, migration);
212
+ bySource.set(from, [...(bySource.get(from) ?? []), migration]);
213
+ }
214
+ return Object.freeze({ from: (definitionHash) => Object.freeze([...(bySource.get(definitionHash) ?? [])]),
215
+ get: (id) => byId.get(id), all: Object.freeze([...migrations]) });
216
+ }
217
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAkB,MAAM,cAAc,CAA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,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC/G,GAAG,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import { MayuraError, freezeJson, jsonValue, type JsonValue } from '@mayura/core';\nimport { digest } from './definition.js';\n\n/**\n * Reviewed in-place migration of an in-flight durable run from one definition version to another. The migration is a\n * declaration; the framework decides what is safe from the run's actual state and refuses everything else.\n */\nexport interface WorkflowMigrationOptions<F, T> {\n /** Stable identity recorded in the run's audit trail, for example `invoice-review-1-to-2` (letters, digits, `.`, `_`, `-`). */\n readonly id: string;\n readonly from: F;\n readonly to: T;\n /** Target node id -> source node id, for steps that were renamed. Only unstarted or waiting steps can be renamed. */\n readonly renames?: Readonly<Record<string, string>>;\n /** Target node ids whose definition changed but whose settled source result the reviewer accepts as-is. */\n readonly acceptCompleted?: readonly string[];\n /** Source node ids that settled and are removed by the new definition; the reviewer accepts dropping their results. */\n readonly acceptRemoved?: readonly string[];\n readonly description?: string;\n}\nexport interface WorkflowMigration<F = unknown, T = unknown> {\n readonly kind: 'mayura.workflow-migration';\n readonly id: string;\n readonly from: F;\n readonly to: T;\n readonly renames: Readonly<Record<string, string>>;\n readonly acceptCompleted: readonly string[];\n readonly acceptRemoved: readonly string[];\n readonly description: string;\n}\n\n/**\n * One node of a definition, reduced to what a migration compares. `fingerprint` covers the node's full definition.\n * `evidence` names what a settled step's recorded state is bound to (for a tool step, the tool its receipt names):\n * a changed node can only accept an existing result when this is unchanged.\n */\nexport interface MigrationNode { readonly id: string; readonly kind: string; readonly dependsOn: readonly string[]; readonly fingerprint: string; readonly evidence?: string }\n\n/** Evidence of a manifest node: the tool a receipt must name, or whether a human request carries a deadline. */\nexport function nodeEvidence(node: { readonly kind: string; readonly tool?: unknown; readonly deadlineAtMs?: unknown }): string | undefined {\n if (node.kind === 'tool' && typeof node.tool === 'string') return `tool:${node.tool}`;\n if (node.kind === 'human') return node.deadlineAtMs === null || node.deadlineAtMs === undefined ? 'human' : 'human:deadline';\n return undefined;\n}\n/** The run's current state of one source step, normalized across formats. */\nexport interface MigrationStep { readonly id: string; readonly status: string }\n\nexport type MigrationAction =\n | 'keep' // unchanged node; state carried\n | 'update' // changed node that never started; carried as pending under the new definition\n | 'reset' // changed node that was waiting (approval, human, timer, signal); re-issued as pending\n | 'accept' // changed node that settled; the reviewer accepts the existing result\n | 'add' // new node; starts pending\n | 'remove'; // source node dropped by the new definition\nexport interface MigrationPlanEntry {\n readonly action: MigrationAction;\n /** Node id in the target definition (absent for `remove`). */\n readonly target?: string;\n /** Node id in the source definition (absent for `add`). */\n readonly source?: string;\n readonly status?: string;\n}\nexport interface MigrationBlocker { readonly node: string; readonly reason: string }\nexport interface MigrationPlan {\n readonly migrationId: string;\n readonly format: string;\n readonly runId: string;\n readonly fromDigest: string;\n readonly toDigest: string;\n readonly entries: readonly MigrationPlanEntry[];\n readonly blockers: readonly MigrationBlocker[];\n readonly allowed: boolean;\n}\n\n/** Statuses of a step that has not started and holds nothing. */\nconst unstarted = new Set(['pending']);\n/** Statuses of a step parked on an external decision; a changed definition re-issues the request. */\nconst parked = new Set(['waiting', 'approved', 'forward_waiting', 'compensation_waiting']);\n/** Statuses with work possibly in flight or with an unresolved effect; never changed, removed or renamed. */\nconst inFlight = new Set(['dispatching', 'unknown', 'leased', 'started', 'running']);\n/** Successfully settled statuses that dependent steps may build on (a bypassed lifecycle step never ran; its output is null). */\nconst succeeded = new Set(['succeeded', 'compensated', 'bypassed']);\n/** A step whose condition did not hold: it holds nothing, so a changed definition decides the condition again. */\nconst reconsidered = new Set(['bypassed']);\n\nconst identifier = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;\nconst nodePattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;\n/** Migration ids appear in URLs and audit events: no separators. */\nconst migrationIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;\n\nexport function defineWorkflowMigration<F, T>(options: WorkflowMigrationOptions<F, T>): WorkflowMigration<F, T> {\n try {\n if (!options || typeof options !== 'object' || typeof options.id !== 'string' || !migrationIdPattern.test(options.id) || !options.from || !options.to) throw new Error();\n const renames = Object.entries(options.renames ?? {});\n if (renames.length > 256 || renames.some(([to, from]) => !nodePattern.test(to) || typeof from !== 'string' || !nodePattern.test(from))\n || new Set(renames.map(([, from]) => from)).size !== renames.length) throw new Error();\n const list = (value: unknown): string[] => {\n if (value === undefined) return [];\n if (!Array.isArray(value) || value.length > 256 || value.some(item => typeof item !== 'string' || !nodePattern.test(item))) throw new Error();\n return [...new Set(value as string[])].sort();\n };\n const description = options.description ?? '';\n if (typeof description !== 'string' || description.length > 2_048) throw new Error();\n return Object.freeze({ kind: 'mayura.workflow-migration' as const, id: options.id, from: options.from, to: options.to,\n renames: Object.freeze(Object.fromEntries(renames)), acceptCompleted: Object.freeze(list(options.acceptCompleted)),\n acceptRemoved: Object.freeze(list(options.acceptRemoved)), description });\n } catch { throw new MayuraError('INVALID_CONFIG', 'A workflow migration needs a bounded id, both definitions, and bounded node lists.'); }\n}\n\nexport function assertWorkflowMigration(value: unknown): asserts value is WorkflowMigration {\n if (!value || typeof value !== 'object' || (value as WorkflowMigration).kind !== 'mayura.workflow-migration' || !Object.isFrozen(value)) {\n throw new MayuraError('INVALID_CONFIG', 'A genuine defineWorkflowMigration value is required.');\n }\n}\n\n/** Canonical fingerprint of one manifest node: every field except the node's id. */\nexport function nodeFingerprint(node: Readonly<Record<string, unknown>>): string {\n const { id: _id, ...rest } = node; void _id;\n return digest('mayura:migration-node:v1', freezeJson(jsonValue(rest)) as JsonValue);\n}\n\n/**\n * Decide, from the run's real state, what a migration does to each node. The format migrator applies the entries only\n * when `allowed`; blockers explain every refusal.\n */\nexport function planWorkflowMigration(input: {\n readonly migration: WorkflowMigration; readonly format: string; readonly runId: string; readonly fromDigest: string; readonly toDigest: string;\n readonly from: readonly MigrationNode[]; readonly to: readonly MigrationNode[]; readonly steps: readonly MigrationStep[];\n /** Format-level refusals found before node planning (for example: run not paused, run is a wait target). */\n readonly preconditions?: readonly MigrationBlocker[];\n}): MigrationPlan {\n const { migration } = input;\n const source = new Map(input.from.map(node => [node.id, node])); const target = new Map(input.to.map(node => [node.id, node]));\n const status = new Map(input.steps.map(step => [step.id, step.status]));\n const blockers: MigrationBlocker[] = [...(input.preconditions ?? [])]; const entries: MigrationPlanEntry[] = [];\n const renamed = new Map(Object.entries(migration.renames)); const renamedSources = new Set(renamed.values());\n const accepted = new Set(migration.acceptCompleted); const removable = new Set(migration.acceptRemoved);\n if (input.fromDigest === input.toDigest) blockers.push({ node: '*', reason: 'The source and target definitions are identical.' });\n for (const [to, from] of renamed) {\n if (!target.has(to)) blockers.push({ node: to, reason: 'A rename targets a node the new definition does not have.' });\n if (!source.has(from)) blockers.push({ node: from, reason: 'A rename names a source node the old definition does not have.' });\n if (source.has(to) && to !== from) blockers.push({ node: to, reason: 'A rename cannot target a node id that still exists in the old definition.' });\n }\n for (const id of accepted) if (!target.has(id)) blockers.push({ node: id, reason: 'acceptCompleted names a node the new definition does not have.' });\n for (const id of removable) if (!source.has(id) || target.has(id)) blockers.push({ node: id, reason: 'acceptRemoved names a node that is not removed.' });\n\n const carried = new Map<string, string>(); // target id -> effective carried status\n for (const node of input.to) {\n const from = renamed.get(node.id) ?? (source.has(node.id) && !renamedSources.has(node.id) ? node.id : undefined);\n if (from === undefined) { entries.push({ action: 'add', target: node.id }); carried.set(node.id, 'pending'); continue; }\n const previous = source.get(from); const current = status.get(from) ?? 'pending';\n if (!previous) continue;\n const changed = previous.fingerprint !== node.fingerprint || previous.kind !== node.kind || from !== node.id;\n if (inFlight.has(current)) {\n if (changed) blockers.push({ node: node.id, reason: `Step \"${from}\" is ${current}; a step with work in flight or an unresolved effect cannot change.` });\n entries.push({ action: 'keep', target: node.id, source: from, status: current }); carried.set(node.id, current); continue;\n }\n if (!changed) { entries.push({ action: 'keep', target: node.id, source: from, status: current }); carried.set(node.id, current); continue; }\n if (previous.kind !== node.kind && !unstarted.has(current)) {\n blockers.push({ node: node.id, reason: `Step \"${from}\" already started as a ${previous.kind} and cannot become a ${node.kind}.` }); carried.set(node.id, current); continue;\n }\n if (unstarted.has(current)) { entries.push({ action: 'update', target: node.id, source: from, status: current }); carried.set(node.id, 'pending'); continue; }\n if (parked.has(current) || reconsidered.has(current)) { entries.push({ action: 'reset', target: node.id, source: from, status: current }); carried.set(node.id, 'pending'); continue; }\n // Blocked nodes still count with their current status below, so dependents report only root causes.\n if (from !== node.id) { blockers.push({ node: node.id, reason: `Step \"${from}\" already settled (${current}); settled steps cannot be renamed.` }); carried.set(node.id, current); continue; }\n if (!accepted.has(node.id)) {\n blockers.push({ node: node.id, reason: `Step \"${from}\" already settled (${current}) and its definition changed; list it in acceptCompleted to keep the existing result.` });\n carried.set(node.id, current); continue;\n }\n // A recorded result stays bound to what produced it: a receipt from one tool cannot stand for another tool.\n if (previous.evidence !== node.evidence) {\n blockers.push({ node: node.id, reason: `Step \"${from}\" settled (${current}) under ${previous.evidence ?? 'another definition'}; the new definition names ${node.evidence ?? 'something else'}, so its result cannot be accepted.` });\n carried.set(node.id, current); continue;\n }\n entries.push({ action: 'accept', target: node.id, source: from, status: current }); carried.set(node.id, current);\n }\n for (const node of input.from) {\n const kept = target.has(node.id) && !renamedSources.has(node.id) && !renamed.has(node.id);\n if (kept || renamedSources.has(node.id)) continue;\n const current = status.get(node.id) ?? 'pending';\n if (inFlight.has(current)) blockers.push({ node: node.id, reason: `Step \"${node.id}\" is ${current} and cannot be removed.` });\n else if (!unstarted.has(current) && !parked.has(current) && current !== 'skipped' && !reconsidered.has(current) && !removable.has(node.id)) {\n blockers.push({ node: node.id, reason: `Step \"${node.id}\" already settled (${current}); list it in acceptRemoved to drop its result.` });\n } else entries.push({ action: 'remove', source: node.id, status: current });\n }\n // A step that keeps a started or settled state must have dependencies that already succeeded under the new graph.\n for (const node of input.to) {\n const current = carried.get(node.id);\n if (current === undefined || unstarted.has(current)) continue;\n for (const dependency of node.dependsOn) {\n const dependencyStatus = carried.get(dependency) ?? 'pending';\n if (!succeeded.has(dependencyStatus)) blockers.push({ node: node.id, reason: `Step \"${node.id}\" is ${current} but its new dependency \"${dependency}\" has not succeeded.` });\n }\n }\n return freezeJson(jsonValue({ migrationId: migration.id, format: input.format, runId: input.runId, fromDigest: input.fromDigest, toDigest: input.toDigest,\n entries, blockers, allowed: blockers.length === 0 })) as unknown as MigrationPlan;\n}\n\n/** Result of a migration request: always the plan; the migrated snapshot unless it was a dry run. */\nexport interface WorkflowMigrationResult<S> { readonly plan: MigrationPlan; readonly snapshot?: S }\n\n/** Audit event payload recorded with every applied migration. */\nexport function migrationEvent(plan: MigrationPlan, actorId: string, commandId: string): { readonly type: 'run.migrated'; readonly data: Record<string, JsonValue> } {\n return { type: 'run.migrated', data: { migrationId: plan.migrationId, from: plan.fromDigest, to: plan.toDigest, actorId, commandId,\n actions: plan.entries.map(entry => `${entry.action}:${entry.target ?? entry.source}`).join(',').slice(0, 2_048) } };\n}\n\n/** Reject a plan with blockers, surfacing the first reason. */\nexport function assertMigrationAllowed(plan: MigrationPlan): void {\n if (!plan.allowed) throw new MayuraError('CONFLICT', `Migration refused: ${plan.blockers[0]?.reason ?? 'unknown reason'}`);\n}\n\n/** Identity of the actor and command applying a migration; both are recorded in the audit event. */\nexport interface MigrationCommand { readonly id: string; readonly actorId: string; readonly commandId: string; readonly dryRun?: boolean }\nexport function migrationCommand(value: MigrationCommand): MigrationCommand {\n if (!value || typeof value !== 'object' || typeof value.id !== 'string' || !/^[a-f0-9]{64}$/.test(value.id) || typeof value.actorId !== 'string' || !identifier.test(value.actorId)\n || typeof value.commandId !== 'string' || !identifier.test(value.commandId) || (value.dryRun !== undefined && typeof value.dryRun !== 'boolean')) {\n throw new MayuraError('INVALID_INPUT', 'A migration command needs a run id, a bounded actor id and a bounded command id.');\n }\n return value;\n}\n\n/** Reviewed migrations a host offers, indexed by source definition digest. */\nexport interface WorkflowMigrationCatalog<M extends WorkflowMigration = WorkflowMigration> {\n /** Migrations whose source is the given pinned definition digest, in registration order. */\n from(definitionHash: string): readonly M[];\n get(id: string): M | undefined;\n readonly all: readonly M[];\n}\nexport function createWorkflowMigrationCatalog<M extends WorkflowMigration>(migrations: readonly M[]): WorkflowMigrationCatalog<M> {\n if (!Array.isArray(migrations) || migrations.length > 1_024) throw new MayuraError('INVALID_CONFIG', 'A migration catalog holds at most 1,024 migrations.');\n const byId = new Map<string, M>(); const bySource = new Map<string, M[]>();\n for (const migration of migrations) {\n const candidate: unknown = migration; assertWorkflowMigration(candidate);\n const from = (migration.from as { readonly digest?: unknown }).digest; const to = (migration.to as { readonly digest?: unknown }).digest;\n if (typeof from !== 'string' || typeof to !== 'string' || from === to) throw new MayuraError('INVALID_CONFIG', `Migration \"${migration.id}\" must connect two different definition versions.`);\n if (byId.has(migration.id)) throw new MayuraError('INVALID_CONFIG', `Migration id \"${migration.id}\" is registered twice.`);\n byId.set(migration.id, migration); bySource.set(from, [...(bySource.get(from) ?? []), migration]);\n }\n return Object.freeze({ from: (definitionHash: string) => Object.freeze([...(bySource.get(definitionHash) ?? [])]),\n get: (id: string) => byId.get(id), all: Object.freeze([...migrations]) });\n}\n"]}