mayura 1.2.0 → 1.2.2

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 (409) hide show
  1. package/README.md +2 -0
  2. package/docs/README.md +17 -4
  3. package/docs/cli/init.md +15 -3
  4. package/docs/concepts/workflows.md +60 -1
  5. package/docs/guides/choosing-a-starter.md +80 -0
  6. package/docs/guides/durable-workflows.md +1 -1
  7. package/docs/guides/framework-starters.md +5 -1
  8. package/docs/guides/hono.md +94 -0
  9. package/docs/guides/nextjs.md +94 -0
  10. package/docs/guides/nuxt.md +94 -0
  11. package/docs/guides/rag-deployment.md +48 -0
  12. package/docs/guides/rag-modal-pinecone-starter.md +63 -0
  13. package/docs/guides/rag-production.md +48 -0
  14. package/docs/guides/rag-quickstart.md +119 -0
  15. package/docs/guides/rag.md +23 -3
  16. package/docs/guides/react-router.md +94 -0
  17. package/docs/guides/release-readiness.md +78 -55
  18. package/docs/guides/sveltekit.md +94 -0
  19. package/docs/guides/tanstack-start.md +94 -0
  20. package/docs/guides/workflow-composition.md +1 -1
  21. package/docs/integrations/reranker-cohere.md +1 -0
  22. package/docs/integrations/reranker-jina.md +1 -0
  23. package/docs/integrations/reranker-voyage.md +1 -0
  24. package/docs/integrations/vector-chroma.md +1 -0
  25. package/docs/integrations/vector-libsql.md +1 -0
  26. package/docs/integrations/vector-pgvector.md +1 -0
  27. package/docs/integrations/vector-pinecone.md +4 -1
  28. package/docs/integrations/vector-qdrant.md +1 -0
  29. package/docs/integrations/vector-weaviate.md +1 -0
  30. package/docs/introduction.md +5 -0
  31. package/docs/project/whats-new.md +70 -2
  32. package/docs/quickstart.md +5 -3
  33. package/lib/adapter-code-docker/image/Dockerfile +1 -1
  34. package/lib/adapter-code-docker/package.json +1 -1
  35. package/lib/adapter-code-quickjs/package.json +1 -1
  36. package/lib/adapter-mcp/package.json +1 -1
  37. package/lib/ag-ui/package.json +1 -1
  38. package/lib/artifacts/package.json +1 -1
  39. package/lib/auth/package.json +1 -1
  40. package/lib/authz/package.json +1 -1
  41. package/lib/browser/package.json +1 -1
  42. package/lib/cli/dist/index.d.ts +1 -1
  43. package/lib/cli/dist/index.d.ts.map +1 -1
  44. package/lib/cli/dist/index.js +63 -20
  45. package/lib/cli/dist/index.js.map +1 -1
  46. package/lib/cli/dist/interactive.js +2 -2
  47. package/lib/cli/dist/interactive.js.map +1 -1
  48. package/lib/cli/dist/operations.d.ts +1 -0
  49. package/lib/cli/dist/operations.d.ts.map +1 -1
  50. package/lib/cli/dist/operations.js +13 -5
  51. package/lib/cli/dist/operations.js.map +1 -1
  52. package/lib/cli/package.json +1 -1
  53. package/lib/cli/src/index.ts +51 -12
  54. package/lib/cli/src/interactive.ts +2 -2
  55. package/lib/cli/src/operations.ts +9 -5
  56. package/lib/cli/starter-assets/manifest.json +1 -0
  57. package/lib/cli/starters/hono/package.json +2 -2
  58. package/lib/cli/starters/rag-modal-pinecone/README.md +60 -0
  59. package/lib/cli/starters/rag-modal-pinecone/dot-env.example +23 -0
  60. package/lib/cli/starters/{event-automation → rag-modal-pinecone}/dot-gitignore +2 -4
  61. package/lib/cli/starters/rag-modal-pinecone/fixtures/on-call.md +4 -0
  62. package/lib/cli/starters/rag-modal-pinecone/mayura.project.json +13 -0
  63. package/lib/cli/starters/rag-modal-pinecone/modal-app.py +110 -0
  64. package/lib/cli/starters/rag-modal-pinecone/package.json +28 -0
  65. package/lib/cli/starters/rag-modal-pinecone/src/application.ts +148 -0
  66. package/lib/cli/starters/rag-modal-pinecone/src/cli.ts +78 -0
  67. package/lib/cli/starters/rag-modal-pinecone/src/hosted.ts +137 -0
  68. package/lib/cli/starters/rag-modal-pinecone/test/modal_worker_test.py +53 -0
  69. package/lib/cli/starters/rag-modal-pinecone/test/pipeline.test.ts +137 -0
  70. package/lib/cli/starters/{cli-agent → rag-modal-pinecone}/tsconfig.json +0 -1
  71. package/lib/client/dist/index.d.ts.map +1 -1
  72. package/lib/client/dist/index.js +12 -4
  73. package/lib/client/dist/index.js.map +1 -1
  74. package/lib/client/dist/workflow-limits.d.ts +6 -0
  75. package/lib/client/dist/workflow-limits.d.ts.map +1 -0
  76. package/lib/client/dist/workflow-limits.js +15 -0
  77. package/lib/client/dist/workflow-limits.js.map +1 -0
  78. package/lib/client/dist/workflows.d.ts +3 -0
  79. package/lib/client/dist/workflows.d.ts.map +1 -1
  80. package/lib/client/dist/workflows.js +15 -7
  81. package/lib/client/dist/workflows.js.map +1 -1
  82. package/lib/client/package.json +1 -1
  83. package/lib/client/src/index.ts +7 -4
  84. package/lib/client/src/workflow-limits.ts +12 -0
  85. package/lib/client/src/workflows.ts +12 -6
  86. package/lib/client-react/package.json +1 -1
  87. package/lib/code-mode/package.json +1 -1
  88. package/lib/code-mode-workflows/package.json +1 -1
  89. package/lib/context/package.json +1 -1
  90. package/lib/core/dist/host.d.ts +1 -0
  91. package/lib/core/dist/host.d.ts.map +1 -1
  92. package/lib/core/dist/host.js +1 -0
  93. package/lib/core/dist/host.js.map +1 -1
  94. package/lib/core/dist/index.d.ts +1 -0
  95. package/lib/core/dist/index.d.ts.map +1 -1
  96. package/lib/core/dist/index.js +1 -0
  97. package/lib/core/dist/index.js.map +1 -1
  98. package/lib/core/dist/workflow-environment.d.ts +9 -0
  99. package/lib/core/dist/workflow-environment.d.ts.map +1 -0
  100. package/lib/core/dist/workflow-environment.js +15 -0
  101. package/lib/core/dist/workflow-environment.js.map +1 -0
  102. package/lib/core/dist/workflow-limits.d.ts +7 -0
  103. package/lib/core/dist/workflow-limits.d.ts.map +1 -0
  104. package/lib/core/dist/workflow-limits.js +17 -0
  105. package/lib/core/dist/workflow-limits.js.map +1 -0
  106. package/lib/core/package.json +1 -1
  107. package/lib/core/src/host.ts +1 -0
  108. package/lib/core/src/index.ts +1 -0
  109. package/lib/core/src/workflow-environment.ts +15 -0
  110. package/lib/core/src/workflow-limits.ts +16 -0
  111. package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
  112. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
  113. package/lib/exporter-otlp/dist/signals.js +2 -2
  114. package/lib/exporter-otlp/dist/signals.js.map +1 -1
  115. package/lib/exporter-otlp/package.json +1 -1
  116. package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
  117. package/lib/exporter-otlp/src/signals.ts +2 -2
  118. package/lib/files/package.json +1 -1
  119. package/lib/guardrails/package.json +1 -1
  120. package/lib/helpers/package.json +1 -1
  121. package/lib/keys/package.json +1 -1
  122. package/lib/memory/package.json +1 -1
  123. package/lib/memory-remote/package.json +1 -1
  124. package/lib/observability/package.json +1 -1
  125. package/lib/provider-anthropic/package.json +1 -1
  126. package/lib/provider-openai/package.json +1 -1
  127. package/lib/rag/dist/bm25.d.ts +13 -0
  128. package/lib/rag/dist/bm25.d.ts.map +1 -0
  129. package/lib/rag/dist/bm25.js +76 -0
  130. package/lib/rag/dist/bm25.js.map +1 -0
  131. package/lib/rag/dist/document-lexical.d.ts +7 -0
  132. package/lib/rag/dist/document-lexical.d.ts.map +1 -0
  133. package/lib/rag/dist/document-lexical.js +33 -0
  134. package/lib/rag/dist/document-lexical.js.map +1 -0
  135. package/lib/rag/dist/evidence-window.d.ts +15 -0
  136. package/lib/rag/dist/evidence-window.d.ts.map +1 -0
  137. package/lib/rag/dist/evidence-window.js +52 -0
  138. package/lib/rag/dist/evidence-window.js.map +1 -0
  139. package/lib/rag/dist/retrieval.d.ts +6 -0
  140. package/lib/rag/dist/retrieval.d.ts.map +1 -1
  141. package/lib/rag/dist/retrieval.js +60 -6
  142. package/lib/rag/dist/retrieval.js.map +1 -1
  143. package/lib/rag/dist/vectors.d.ts +8 -0
  144. package/lib/rag/dist/vectors.d.ts.map +1 -1
  145. package/lib/rag/dist/vectors.js +121 -4
  146. package/lib/rag/dist/vectors.js.map +1 -1
  147. package/lib/rag/package.json +1 -1
  148. package/lib/rag/src/bm25.ts +35 -0
  149. package/lib/rag/src/document-lexical.ts +17 -0
  150. package/lib/rag/src/evidence-window.ts +41 -0
  151. package/lib/rag/src/retrieval.ts +56 -7
  152. package/lib/rag/src/vectors.ts +62 -4
  153. package/lib/runtime/package.json +1 -1
  154. package/lib/sandbox/package.json +1 -1
  155. package/lib/sdk/package.json +1 -1
  156. package/lib/server/dist/index.d.ts +2 -0
  157. package/lib/server/dist/index.d.ts.map +1 -1
  158. package/lib/server/dist/index.js +12 -4
  159. package/lib/server/dist/index.js.map +1 -1
  160. package/lib/server/dist/inspector-bundle.d.ts +1 -1
  161. package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
  162. package/lib/server/dist/inspector-bundle.js +4 -4
  163. package/lib/server/dist/inspector-bundle.js.map +1 -1
  164. package/lib/server/package.json +1 -1
  165. package/lib/server/src/index.ts +9 -4
  166. package/lib/server/src/inspector-bundle.ts +4 -4
  167. package/lib/server-node/package.json +1 -1
  168. package/lib/skills/package.json +1 -1
  169. package/lib/storage/package.json +1 -1
  170. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +2 -0
  171. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -1
  172. package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -1
  173. package/lib/storage-contracts/dist/workflow-format2.d.ts +2 -0
  174. package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -1
  175. package/lib/storage-contracts/dist/workflow-format2.js +8 -7
  176. package/lib/storage-contracts/dist/workflow-format2.js.map +1 -1
  177. package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -1
  178. package/lib/storage-contracts/dist/workflow-format3.js +9 -7
  179. package/lib/storage-contracts/dist/workflow-format3.js.map +1 -1
  180. package/lib/storage-contracts/dist/workflow-format4.d.ts +2 -0
  181. package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -1
  182. package/lib/storage-contracts/dist/workflow-format4.js +9 -8
  183. package/lib/storage-contracts/dist/workflow-format4.js.map +1 -1
  184. package/lib/storage-contracts/dist/workflow-format5.d.ts +4 -0
  185. package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
  186. package/lib/storage-contracts/dist/workflow-format5.js +9 -8
  187. package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
  188. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +2 -0
  189. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -1
  190. package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -1
  191. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +2 -0
  192. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -1
  193. package/lib/storage-contracts/dist/workflow-tree-contracts.js +5 -3
  194. package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -1
  195. package/lib/storage-contracts/package.json +1 -1
  196. package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +2 -0
  197. package/lib/storage-contracts/src/workflow-format2.ts +10 -7
  198. package/lib/storage-contracts/src/workflow-format3.ts +9 -7
  199. package/lib/storage-contracts/src/workflow-format4.ts +11 -8
  200. package/lib/storage-contracts/src/workflow-format5.ts +13 -8
  201. package/lib/storage-contracts/src/workflow-graph-contracts.ts +2 -0
  202. package/lib/storage-contracts/src/workflow-tree-contracts.ts +7 -3
  203. package/lib/storage-postgres/package.json +1 -1
  204. package/lib/storage-sql/dist/scheduled-database.js +1 -1
  205. package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
  206. package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -1
  207. package/lib/storage-sql/dist/workflow-tree-database.js +37 -1
  208. package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -1
  209. package/lib/storage-sql/package.json +1 -1
  210. package/lib/storage-sql/src/scheduled-database.ts +1 -1
  211. package/lib/storage-sql/src/workflow-tree-database.ts +15 -1
  212. package/lib/storage-sqlite/package.json +1 -1
  213. package/lib/terminal/package.json +1 -1
  214. package/lib/testing/package.json +1 -1
  215. package/lib/threads/package.json +1 -1
  216. package/lib/tools/package.json +1 -1
  217. package/lib/voice/package.json +1 -1
  218. package/lib/workflows/dist/children-definition.d.ts +5 -1
  219. package/lib/workflows/dist/children-definition.d.ts.map +1 -1
  220. package/lib/workflows/dist/children-definition.js +6 -2
  221. package/lib/workflows/dist/children-definition.js.map +1 -1
  222. package/lib/workflows/dist/children-runtime.d.ts.map +1 -1
  223. package/lib/workflows/dist/children-runtime.js +4 -3
  224. package/lib/workflows/dist/children-runtime.js.map +1 -1
  225. package/lib/workflows/dist/definition.d.ts +4 -0
  226. package/lib/workflows/dist/definition.d.ts.map +1 -1
  227. package/lib/workflows/dist/definition.js +6 -3
  228. package/lib/workflows/dist/definition.js.map +1 -1
  229. package/lib/workflows/dist/graph-definition.d.ts +5 -1
  230. package/lib/workflows/dist/graph-definition.d.ts.map +1 -1
  231. package/lib/workflows/dist/graph-definition.js +8 -4
  232. package/lib/workflows/dist/graph-definition.js.map +1 -1
  233. package/lib/workflows/dist/lifecycle-definition.d.ts +5 -1
  234. package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
  235. package/lib/workflows/dist/lifecycle-definition.js +5 -2
  236. package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
  237. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
  238. package/lib/workflows/dist/lifecycle-runtime.js +4 -5
  239. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
  240. package/lib/workflows/dist/node-batches.d.ts +9 -0
  241. package/lib/workflows/dist/node-batches.d.ts.map +1 -0
  242. package/lib/workflows/dist/node-batches.js +19 -0
  243. package/lib/workflows/dist/node-batches.js.map +1 -0
  244. package/lib/workflows/dist/operator-transports.d.ts +1 -0
  245. package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
  246. package/lib/workflows/dist/operator-transports.js +1 -0
  247. package/lib/workflows/dist/operator-transports.js.map +1 -1
  248. package/lib/workflows/dist/runtime.d.ts.map +1 -1
  249. package/lib/workflows/dist/runtime.js +6 -7
  250. package/lib/workflows/dist/runtime.js.map +1 -1
  251. package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
  252. package/lib/workflows/dist/scheduled-helpers.js +3 -2
  253. package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
  254. package/lib/workflows/dist/scheduled.d.ts.map +1 -1
  255. package/lib/workflows/dist/scheduled.js +2 -1
  256. package/lib/workflows/dist/scheduled.js.map +1 -1
  257. package/lib/workflows/package.json +1 -1
  258. package/lib/workflows/src/children-definition.ts +10 -3
  259. package/lib/workflows/src/children-runtime.ts +3 -2
  260. package/lib/workflows/src/definition.ts +9 -2
  261. package/lib/workflows/src/graph-definition.ts +10 -3
  262. package/lib/workflows/src/lifecycle-definition.ts +10 -3
  263. package/lib/workflows/src/lifecycle-runtime.ts +4 -4
  264. package/lib/workflows/src/node-batches.ts +21 -0
  265. package/lib/workflows/src/operator-transports.ts +3 -1
  266. package/lib/workflows/src/runtime.ts +6 -6
  267. package/lib/workflows/src/scheduled-helpers.ts +3 -2
  268. package/lib/workflows/src/scheduled.ts +2 -1
  269. package/lib/workstream/package.json +1 -1
  270. package/llms-full.txt +1442 -281
  271. package/llms.txt +17 -3
  272. package/package.json +4 -4
  273. package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +0 -13
  274. package/lib/cli/starters/cli-agent/dot-gitignore +0 -10
  275. package/lib/cli/starters/event-automation/dot-dockerignore +0 -7
  276. package/lib/cli/starters/event-automation/dot-github/workflows/ci.yml +0 -13
  277. package/lib/cli/starters/event-automation/src/model.ts +0 -40
  278. package/lib/cli/starters/event-automation/tsconfig.json +0 -20
  279. package/lib/cli/starters/nextjs/Dockerfile +0 -12
  280. package/lib/cli/starters/nextjs/compose.yaml +0 -19
  281. package/lib/cli/starters/nextjs/dot-dockerignore +0 -11
  282. package/lib/cli/starters/nextjs/dot-env.example +0 -7
  283. package/lib/cli/starters/nextjs/scripts/setup.mjs +0 -9
  284. package/lib/cli/starters/nextjs/server/application.mjs +0 -74
  285. package/lib/cli/starters/nextjs/server/auth.mjs +0 -24
  286. package/lib/cli/starters/nextjs/server/worker.mjs +0 -11
  287. package/lib/cli/starters/nextjs/server/workflows.mjs +0 -23
  288. package/lib/cli/starters/nextjs/src/ChatApp.jsx +0 -57
  289. package/lib/cli/starters/nextjs/src/Notebook.jsx +0 -25
  290. package/lib/cli/starters/nextjs/src/components/mayura/approval.tsx +0 -142
  291. package/lib/cli/starters/nextjs/src/components/mayura/thread-history.tsx +0 -142
  292. package/lib/cli/starters/nextjs/src/components/mayura/thread-list.tsx +0 -9
  293. package/lib/cli/starters/nextjs/src/components/mayura/ui.css +0 -14
  294. package/lib/cli/starters/nextjs/src/connect.js +0 -21
  295. package/lib/cli/starters/nextjs/src/session.js +0 -138
  296. package/lib/cli/starters/nextjs/src/style.css +0 -11
  297. package/lib/cli/starters/nextjs/test/server.test.mjs +0 -95
  298. package/lib/cli/starters/nextjs/test/session.test.mjs +0 -16
  299. package/lib/cli/starters/nuxt/compose.yaml +0 -19
  300. package/lib/cli/starters/nuxt/dot-dockerignore +0 -11
  301. package/lib/cli/starters/nuxt/dot-env.example +0 -7
  302. package/lib/cli/starters/nuxt/dot-gitignore +0 -14
  303. package/lib/cli/starters/nuxt/scripts/setup.mjs +0 -9
  304. package/lib/cli/starters/nuxt/server/application.mjs +0 -74
  305. package/lib/cli/starters/nuxt/server/auth.mjs +0 -24
  306. package/lib/cli/starters/nuxt/server/worker.mjs +0 -11
  307. package/lib/cli/starters/nuxt/server/workflows.mjs +0 -23
  308. package/lib/cli/starters/nuxt/src/connect.js +0 -21
  309. package/lib/cli/starters/nuxt/src/session.js +0 -138
  310. package/lib/cli/starters/nuxt/src/style.css +0 -11
  311. package/lib/cli/starters/nuxt/test/server.test.mjs +0 -95
  312. package/lib/cli/starters/nuxt/test/session.test.mjs +0 -16
  313. package/lib/cli/starters/react-router/Dockerfile +0 -12
  314. package/lib/cli/starters/react-router/compose.yaml +0 -19
  315. package/lib/cli/starters/react-router/dot-dockerignore +0 -11
  316. package/lib/cli/starters/react-router/dot-env.example +0 -7
  317. package/lib/cli/starters/react-router/dot-gitignore +0 -14
  318. package/lib/cli/starters/react-router/scripts/setup.mjs +0 -9
  319. package/lib/cli/starters/react-router/server/application.mjs +0 -74
  320. package/lib/cli/starters/react-router/server/auth.mjs +0 -24
  321. package/lib/cli/starters/react-router/server/worker.mjs +0 -11
  322. package/lib/cli/starters/react-router/server/workflows.mjs +0 -23
  323. package/lib/cli/starters/react-router/src/ChatApp.jsx +0 -57
  324. package/lib/cli/starters/react-router/src/Notebook.jsx +0 -25
  325. package/lib/cli/starters/react-router/src/components/mayura/approval.tsx +0 -142
  326. package/lib/cli/starters/react-router/src/components/mayura/thread-history.tsx +0 -142
  327. package/lib/cli/starters/react-router/src/components/mayura/thread-list.tsx +0 -9
  328. package/lib/cli/starters/react-router/src/components/mayura/ui.css +0 -14
  329. package/lib/cli/starters/react-router/src/connect.js +0 -21
  330. package/lib/cli/starters/react-router/src/session.js +0 -138
  331. package/lib/cli/starters/react-router/src/style.css +0 -11
  332. package/lib/cli/starters/react-router/src/vite-env.d.ts +0 -1
  333. package/lib/cli/starters/react-router/test/server.test.mjs +0 -95
  334. package/lib/cli/starters/react-router/test/session.test.mjs +0 -16
  335. package/lib/cli/starters/research-team/dot-dockerignore +0 -7
  336. package/lib/cli/starters/research-team/dot-github/workflows/ci.yml +0 -13
  337. package/lib/cli/starters/research-team/dot-gitignore +0 -10
  338. package/lib/cli/starters/research-team/src/model.ts +0 -40
  339. package/lib/cli/starters/research-team/tsconfig.json +0 -20
  340. package/lib/cli/starters/support-agent/dot-dockerignore +0 -7
  341. package/lib/cli/starters/support-agent/dot-github/workflows/ci.yml +0 -13
  342. package/lib/cli/starters/support-agent/dot-gitignore +0 -10
  343. package/lib/cli/starters/support-agent/src/model.ts +0 -40
  344. package/lib/cli/starters/support-agent/tsconfig.json +0 -20
  345. package/lib/cli/starters/sveltekit/Dockerfile +0 -12
  346. package/lib/cli/starters/sveltekit/compose.yaml +0 -19
  347. package/lib/cli/starters/sveltekit/dot-dockerignore +0 -11
  348. package/lib/cli/starters/sveltekit/dot-env.example +0 -7
  349. package/lib/cli/starters/sveltekit/dot-gitignore +0 -14
  350. package/lib/cli/starters/sveltekit/scripts/setup.mjs +0 -9
  351. package/lib/cli/starters/sveltekit/server/application.mjs +0 -74
  352. package/lib/cli/starters/sveltekit/server/auth.mjs +0 -24
  353. package/lib/cli/starters/sveltekit/server/worker.mjs +0 -11
  354. package/lib/cli/starters/sveltekit/server/workflows.mjs +0 -23
  355. package/lib/cli/starters/sveltekit/src/connect.js +0 -21
  356. package/lib/cli/starters/sveltekit/src/session.js +0 -138
  357. package/lib/cli/starters/sveltekit/src/style.css +0 -11
  358. package/lib/cli/starters/sveltekit/src/view.js +0 -49
  359. package/lib/cli/starters/sveltekit/test/server.test.mjs +0 -95
  360. package/lib/cli/starters/sveltekit/test/session.test.mjs +0 -16
  361. package/lib/cli/starters/tanstack-start/Dockerfile +0 -12
  362. package/lib/cli/starters/tanstack-start/compose.yaml +0 -19
  363. package/lib/cli/starters/tanstack-start/dot-dockerignore +0 -11
  364. package/lib/cli/starters/tanstack-start/dot-env.example +0 -7
  365. package/lib/cli/starters/tanstack-start/dot-gitignore +0 -14
  366. package/lib/cli/starters/tanstack-start/scripts/setup.mjs +0 -9
  367. package/lib/cli/starters/tanstack-start/server/application.mjs +0 -74
  368. package/lib/cli/starters/tanstack-start/server/auth.mjs +0 -24
  369. package/lib/cli/starters/tanstack-start/server/worker.mjs +0 -11
  370. package/lib/cli/starters/tanstack-start/server/workflows.mjs +0 -23
  371. package/lib/cli/starters/tanstack-start/src/ChatApp.jsx +0 -57
  372. package/lib/cli/starters/tanstack-start/src/Notebook.jsx +0 -25
  373. package/lib/cli/starters/tanstack-start/src/components/mayura/approval.tsx +0 -142
  374. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-history.tsx +0 -142
  375. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-list.tsx +0 -9
  376. package/lib/cli/starters/tanstack-start/src/components/mayura/ui.css +0 -14
  377. package/lib/cli/starters/tanstack-start/src/connect.js +0 -21
  378. package/lib/cli/starters/tanstack-start/src/session.js +0 -138
  379. package/lib/cli/starters/tanstack-start/src/style.css +0 -11
  380. package/lib/cli/starters/tanstack-start/test/server.test.mjs +0 -95
  381. package/lib/cli/starters/tanstack-start/test/session.test.mjs +0 -16
  382. /package/lib/cli/{starters/hono/src/components/mayura/ui.css → starter-assets/011cacc77ada0de5b447674e9fc4374a247b9a46eb169722b12649753f24188f} +0 -0
  383. /package/lib/cli/{starters/hono/test/server.test.mjs → starter-assets/0c825d6a776673ec6274cfc29cd45b1a8c56dcb880c291a91075c77e1ef1e4f3} +0 -0
  384. /package/lib/cli/{starters/hono/server/auth.mjs → starter-assets/0dd570bfacc357d23be3340250090b9a4c6193a49cdd02e9b6789e7bee8433dd} +0 -0
  385. /package/lib/cli/{starters/hono/src/components/mayura/approval.tsx → starter-assets/11292bd14cdaf27a8f8317ba4ab768d706a726b2e26474b599f3db116674b4b3} +0 -0
  386. /package/lib/cli/{starters/nextjs/dot-gitignore → starter-assets/1873b02e070347f9a449e07084242982fa6af412c45aa764985d553975b64589} +0 -0
  387. /package/lib/cli/{starters/hono/src/style.css → starter-assets/2f3869e6d69134e43be713c4590bfe48896a5c54ece6ffc1a4f204cfcfe54218} +0 -0
  388. /package/lib/cli/{starters/hono/server/worker.mjs → starter-assets/350d77757f548369beff29d658cf1620752d4e23b4b732d99a1b403ca043137f} +0 -0
  389. /package/lib/cli/{starters/approval-workflow/src/model.ts → starter-assets/37294d24c04b71eaf6d6f0bd52fd4c1cc7a5d3cb63da9c7920ed1d44276da9cb} +0 -0
  390. /package/lib/cli/{starters/approval-workflow/tsconfig.json → starter-assets/4387d6537dd5924ae62326aa3d7d8cbad1e5abd930aecc9daa6fab1ac2f6ef24} +0 -0
  391. /package/lib/cli/{starters/hono/dot-dockerignore → starter-assets/4434be031b58cc6ee680b2860b2ad1fe4089af7ee866c13223dfb621dd042ff1} +0 -0
  392. /package/lib/cli/{starters/hono/src/ChatApp.jsx → starter-assets/46e199317648a076243d6c8e7ffedc48785a6ffc0f203b88c7c4a9479b34c5b9} +0 -0
  393. /package/lib/cli/{starters/hono/src/components/mayura/thread-history.tsx → starter-assets/4741fccbca2e0d2fc6f61d11af3cf7bcc5f0238b67bb46282287207abdc6c536} +0 -0
  394. /package/lib/cli/{starters/approval-workflow/dot-dockerignore → starter-assets/4be664708b0120da5d2b73c5a27968093da06b8728f88f2bda2a1ccbf40f6891} +0 -0
  395. /package/lib/cli/{starters/hono/server/workflows.mjs → starter-assets/4d11f729672df54969a851494877a3c5aee24bb8f8c68eacaaa22e715bf5ed69} +0 -0
  396. /package/lib/cli/{starters/hono/dot-env.example → starter-assets/4f141323062660c4dc5b563300d57bb4cdbdc7fe9bfba96e43d9c64bb274474e} +0 -0
  397. /package/lib/cli/{starters/hono/Dockerfile → starter-assets/5471b74c46258d1edb00eb8f60f4219c389a252f7e224f2692f8f3e71ae43e3e} +0 -0
  398. /package/lib/cli/{starters/hono/scripts/setup.mjs → starter-assets/56e2d6db9fe4b0449c979acd06947a5b776bcc645184b54b8d3654a48bd12c38} +0 -0
  399. /package/lib/cli/{starters/hono/src/Notebook.jsx → starter-assets/6138d1e2ca4469daf4f5545d140943f6e23b0c37f865051b266ec99695cf181a} +0 -0
  400. /package/lib/cli/{starters/hono/src/vite-env.d.ts → starter-assets/65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5} +0 -0
  401. /package/lib/cli/{starters/hono/server/application.mjs → starter-assets/757f43c27415654049ecf01b67d560c83d788108d1aebcf1f16a86d956bd7fb6} +0 -0
  402. /package/lib/cli/{starters/hono/src/components/mayura/thread-list.tsx → starter-assets/97601d0bf331df7bbde88f7ee269610bc8a1239f8eeb58fded6416e588a5b7dd} +0 -0
  403. /package/lib/cli/{starters/approval-workflow/dot-github/workflows/ci.yml → starter-assets/aa4182c76778ba2194ecbfde9a960c20181534fd1ab484df126278dbc6eb0186} +0 -0
  404. /package/lib/cli/{starters/hono/src/session.js → starter-assets/abcc6ebd29ba47a079befb6568054dec8f43d4c729187e4a3610af39789e77be} +0 -0
  405. /package/lib/cli/{starters/hono/compose.yaml → starter-assets/cc1df6f5ce0eebffc567ecea1d599eba97cd1b94ab01551085c0eb87a28e3a6c} +0 -0
  406. /package/lib/cli/{starters/hono/src/connect.js → starter-assets/cd3ddb959b277e7d495cc020a6f8146acfbcc9d05ececa3809e8aafcf84504d9} +0 -0
  407. /package/lib/cli/{starters/hono/test/session.test.mjs → starter-assets/dfe75fd07538427d80ba76767e037e929664c80ff5a41b7544496a789181bb73} +0 -0
  408. /package/lib/cli/{starters/approval-workflow/dot-gitignore → starter-assets/f3ef7285253ec9668732f535306beee602e91cb6e20f83d4799b3323399ce569} +0 -0
  409. /package/lib/cli/{starters/nuxt/src/view.js → starter-assets/ff840fe960683d377e78f731b5d4318adf6050384791fa20e4948d34192aa35d} +0 -0
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, freezeJson, jsonValue, MayuraError, type InferInput, type InferOutput, type JsonObject, type JsonValue, type Schema } from '@mayura/core';
2
3
  import { assertTool, type AnyTool } from '@mayura/tools';
3
4
  import { workflowHashMaterial } from '@mayura/storage-contracts';
@@ -11,10 +12,14 @@ export type WorkflowNode =
11
12
  | { readonly kind: 'tool'; readonly id: string; readonly tool: AnyTool; readonly input: Binding; readonly dependsOn?: readonly string[]; readonly approval?: boolean }
12
13
  | { readonly kind: 'join'; readonly id: string; readonly dependsOn: readonly string[] };
13
14
  export interface WorkflowOptions<I extends Schema, O extends Schema> {
15
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
16
+ readonly maxNodes?: number | false;
14
17
  readonly id: string; readonly version: string; readonly input: I; readonly output: O;
15
18
  readonly nodes: readonly WorkflowNode[]; readonly result: Binding;
16
19
  }
17
20
  export interface WorkflowDefinition<I extends Schema = Schema, O extends Schema = Schema> {
21
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
22
+ readonly maxNodes?: number | false;
18
23
  readonly id: string; readonly version: string; readonly digest: string;
19
24
  readonly input: Schema<InferInput<I>, InferOutput<I>>;
20
25
  readonly output: Schema<InferInput<O>, InferOutput<O>>;
@@ -52,7 +57,9 @@ function checkedBinding(binding: Binding, ids: Set<string>): Binding {
52
57
  export function defineWorkflow<I extends Schema, O extends Schema>(options: WorkflowOptions<I, O>): WorkflowDefinition<I, O> {
53
58
  if (!options || !identifier.test(options.id) || typeof options.version !== 'string' || !options.version.length || options.version.length > 128) throw new MayuraError('INVALID_CONFIG', 'Workflow id/version must be bounded identifiers.');
54
59
  assertSchema(options.input); assertSchema(options.output);
55
- if (!Array.isArray(options.nodes) || options.nodes.length === 0 || options.nodes.length > 128) throw new MayuraError('INVALID_CONFIG', 'A workflow requires 1–128 nodes.');
60
+ if (!Array.isArray(options.nodes) || options.nodes.length === 0 || options.nodes.length > workflowNodeLimit(options.maxNodes)) throw new MayuraError('INVALID_CONFIG', 'A workflow requires nodes within its configured maxNodes bound.');
61
+ workflowNodeLimit(options.maxNodes);
62
+ const nodeLimit = options.maxNodes === undefined ? {} : { maxNodes: options.maxNodes };
56
63
  const ids = new Set(options.nodes.map(node => node.id));
57
64
  if (ids.size !== options.nodes.length || [...ids].some(id => !identifier.test(id) || ['constructor', 'prototype', '__proto__'].includes(id))) throw new MayuraError('INVALID_CONFIG', 'Step identifiers must be unique and bounded.');
58
65
  const nodes = options.nodes.map(node => {
@@ -86,7 +93,7 @@ export function defineWorkflow<I extends Schema, O extends Schema>(options: Work
86
93
  const standard = schema['~standard'];
87
94
  return Object.freeze({ '~standard': Object.freeze({ version: 1 as const, vendor: standard.vendor, validate: standard.validate.bind(standard) }) }) as Schema<InferInput<S>, InferOutput<S>>;
88
95
  };
89
- const definition = Object.freeze({ id: options.id, version: options.version, digest: digest('mayura:workflow:v1', { id: options.id, version: options.version, graph, result }), input: snapshot(options.input), output: snapshot(options.output), nodes: Object.freeze(nodes), result });
96
+ const definition = Object.freeze({ ...nodeLimit, id: options.id, version: options.version, digest: digest('mayura:workflow:v1', { id: options.id, version: options.version, ...nodeLimit, graph, result }), input: snapshot(options.input), output: snapshot(options.output), nodes: Object.freeze(nodes), result });
90
97
  definitions.add(definition);
91
98
  return definition;
92
99
  }
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';
2
3
  import { assertTool, type AnyTool } from '@mayura/tools';
3
4
  import { workflowGraphManifest, type WorkflowGraphManifest, type WorkflowGraphTargetBinding } from '@mayura/storage-contracts';
@@ -10,11 +11,15 @@ export type WorkflowGraphNode = WorkflowNode | {
10
11
  readonly targets: WorkflowGraphTargetBinding;
11
12
  };
12
13
  export interface WorkflowGraphOptions<I extends Schema, O extends Schema> {
14
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
15
+ readonly maxNodes?: number | false;
13
16
  readonly id: string; readonly version: string; readonly input: I; readonly output: O;
14
17
  readonly nodes: readonly WorkflowGraphNode[]; readonly result: Binding;
15
18
  }
16
19
  declare const graphDefinitionBrand: unique symbol;
17
20
  export interface WorkflowGraphDefinition<I extends Schema = Schema, O extends Schema = Schema> {
21
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
22
+ readonly maxNodes?: number | false;
18
23
  readonly [graphDefinitionBrand]: true;
19
24
  readonly format: 3; readonly id: string; readonly version: string; readonly digest: string;
20
25
  readonly input: Schema<InferInput<I>, InferOutput<I>>;
@@ -31,9 +36,10 @@ export function assertWorkflowGraph(definition: AnyWorkflowGraph): void {
31
36
  }
32
37
 
33
38
  /** Build the exact versioned, data-only material admitted by the storage contract. */
34
- export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version' | 'nodes' | 'result'>): WorkflowGraphManifest {
39
+ export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version' | 'nodes' | 'result' | 'maxNodes'>): WorkflowGraphManifest {
35
40
  try {
36
41
  return workflowGraphManifest({ format: 3, id: definition.id, version: definition.version,
42
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
37
43
  graph: definition.nodes.map(node => node.kind === 'tool'
38
44
  ? { id: node.id, kind: node.kind, dependsOn: node.dependsOn ?? [], tool: node.tool.id,
39
45
  toolVersion: node.tool.version, effects: node.tool.effects, capabilities: node.tool.capabilities,
@@ -47,7 +53,7 @@ export function graphManifest(definition: Pick<AnyWorkflowGraph, 'id' | 'version
47
53
 
48
54
  /** Define a finite format-3 graph; existing format-2 factories retain their exact contract. */
49
55
  export function defineWorkflowGraph<I extends Schema, O extends Schema>(options: WorkflowGraphOptions<I, O>): WorkflowGraphDefinition<I, O> {
50
- if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > 128) throw new MayuraError('INVALID_CONFIG', 'A workflow graph requires 1–128 nodes.');
56
+ if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > workflowNodeLimit(options.maxNodes)) throw new MayuraError('INVALID_CONFIG', 'A workflow graph requires nodes within its configured maxNodes bound.');
51
57
  assertSchema(options.input); assertSchema(options.output);
52
58
  const tools = new Map<string, AnyTool>();
53
59
  for (const node of options.nodes) {
@@ -63,7 +69,8 @@ export function defineWorkflowGraph<I extends Schema, O extends Schema>(options:
63
69
  const standard = schema['~standard'];
64
70
  return Object.freeze({ '~standard': Object.freeze({ version: 1 as const, vendor: standard.vendor, validate: standard.validate.bind(standard) }) }) as Schema<InferInput<S>, InferOutput<S>>;
65
71
  };
66
- const definition = Object.freeze({ format: 3 as const, id: manifest.id, version: manifest.version,
72
+ const definition = Object.freeze({
73
+ ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }), format: 3 as const, id: manifest.id, version: manifest.version,
67
74
  digest: digest('mayura:workflow:v2', manifest), input: snapshot(options.input), output: snapshot(options.output), nodes,
68
75
  result: manifest.result }) as WorkflowGraphDefinition<I, O>;
69
76
  definitions.add(definition); return definition;
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';
2
3
  import { schemaDigest, workflowLifecycleManifest, type WorkflowLifecycleHumanKind, type WorkflowLifecycleManifest } from '@mayura/storage-contracts';
3
4
  import { assertTool, type AnyTool } from '@mayura/tools';
@@ -61,6 +62,8 @@ export type WorkflowLifecycleNode = (WorkflowNode & { readonly when?: Binding })
61
62
  | WorkflowLifecycleSignalNode;
62
63
 
63
64
  export interface WorkflowLifecycleOptions<I extends Schema, O extends Schema> {
65
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
66
+ readonly maxNodes?: number | false;
64
67
  readonly id: string;
65
68
  readonly version: string;
66
69
  readonly input: I;
@@ -71,6 +74,8 @@ export interface WorkflowLifecycleOptions<I extends Schema, O extends Schema> {
71
74
 
72
75
  declare const lifecycleDefinitionBrand: unique symbol;
73
76
  export interface WorkflowLifecycleDefinition<I extends Schema = Schema, O extends Schema = Schema> {
77
+ /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
78
+ readonly maxNodes?: number | false;
74
79
  readonly [lifecycleDefinitionBrand]: true;
75
80
  readonly format: 5;
76
81
  readonly id: string;
@@ -111,12 +116,13 @@ function derivedDigest(node: WorkflowLifecycleHumanNode): string {
111
116
 
112
117
  /** Build the strict data-only format-5 material; response and payload validators are never persisted. */
113
118
  export function lifecycleManifest(
114
- definition: Pick<AnyWorkflowLifecycle, 'id' | 'version' | 'nodes' | 'result'>,
119
+ definition: Pick<AnyWorkflowLifecycle, 'id' | 'version' | 'nodes' | 'result' | 'maxNodes'>,
115
120
  ): WorkflowLifecycleManifest {
116
121
  try {
117
122
  return workflowLifecycleManifest({
118
123
  format: 5,
119
124
  id: definition.id,
125
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
120
126
  version: definition.version,
121
127
  graph: definition.nodes.map(node => {
122
128
  // Present only when declared, so a definition without conditions keeps its digest.
@@ -150,8 +156,8 @@ export function lifecycleManifest(
150
156
  export function defineWorkflowLifecycle<I extends Schema, O extends Schema>(
151
157
  options: WorkflowLifecycleOptions<I, O>,
152
158
  ): WorkflowLifecycleDefinition<I, O> {
153
- if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > 128) {
154
- throw new MayuraError('INVALID_CONFIG', 'A workflow lifecycle requires 1–128 nodes.');
159
+ if (!options || !Array.isArray(options.nodes) || options.nodes.length < 1 || options.nodes.length > workflowNodeLimit(options.maxNodes)) {
160
+ throw new MayuraError('INVALID_CONFIG', 'A workflow lifecycle requires nodes within its configured maxNodes bound.');
155
161
  }
156
162
  assertSchema(options.input); assertSchema(options.output);
157
163
  const tools = new Map<string, Extract<WorkflowLifecycleNode, { readonly kind: 'tool' }>['tool']>();
@@ -189,6 +195,7 @@ export function defineWorkflowLifecycle<I extends Schema, O extends Schema>(
189
195
  });
190
196
  })) as readonly WorkflowLifecycleNode[];
191
197
  const definition = Object.freeze({
198
+ ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }),
192
199
  format: 5 as const,
193
200
  id: manifest.id,
194
201
  version: manifest.version,
@@ -1,4 +1,6 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { workflowNodeLimit } from '@mayura/core';
3
+ import { advanceWorkflowNodes } from './node-batches.js';
2
4
  import type { Authorizer } from '@mayura/core';
3
5
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate,
4
6
  type ExecutionReceipt, type JsonObject, type JsonValue, type Permissions, type Scope } from '@mayura/core';
@@ -751,9 +753,7 @@ export function createWorkflowLifecycleRuntime(options: WorkflowLifecycleRuntime
751
753
  // Each wave holds one drain admission until its effects and receipts settle.
752
754
  const release = gate.enter(); if (!release) return checkedSnapshot(before);
753
755
  try {
754
- const results = await Promise.allSettled(definition.nodes.map(node => executeNode(id, definition, node)));
755
- const failure = results.find(result => result.status === 'rejected');
756
- if (failure?.status === 'rejected') throw failure.reason;
756
+ await advanceWorkflowNodes(definition.nodes.filter(node => !terminalStepStatuses.has(state.steps[node.id]!.status)), node => executeNode(id, definition, node));
757
757
  } finally { release(); }
758
758
  let after = await load(id); const next = stateFrom(after); const run = verifyDefinition(definition, after, next);
759
759
  const steps = Object.values(next.steps);
@@ -885,7 +885,7 @@ export function createWorkflowLifecycleRuntime(options: WorkflowLifecycleRuntime
885
885
  steps[entry.target] = entry.action === 'keep' || entry.action === 'accept'
886
886
  || (entry.action === 'update' && source?.kind === 'signal' && fresh.steps[entry.target]!.kind === 'signal') ? source! : fresh.steps[entry.target]!;
887
887
  }
888
- const next: State = { ...state, definition: migration.to.digest, policy, maxCostMicros,
888
+ const next: State = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, policy, maxCostMicros,
889
889
  steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, steps[node.id]!])) };
890
890
  // Released holds: only carried tool steps keep reserved cost.
891
891
  next.reservedMicros = Object.values(next.steps).reduce((sum, step) => sum + (step.kind === 'tool' ? step.costReserved : 0), 0);
@@ -0,0 +1,21 @@
1
+ import { DEFAULT_WORKFLOW_MAX_NODES } from '@mayura/core';
2
+
3
+ /**
4
+ * A larger graph does not grant more concurrent storage requests. Retain the legacy
5
+ * wave width for existing graphs; wider graphs use small batches to bound CAS
6
+ * contention as well as queue occupancy. Settle each batch before advancing.
7
+ */
8
+ export async function advanceWorkflowNodes<T extends { readonly kind: string }>(
9
+ nodes: readonly T[],
10
+ execute: (node: T) => Promise<void>,
11
+ ): Promise<void> {
12
+ const large = nodes.length > DEFAULT_WORKFLOW_MAX_NODES;
13
+ for (let offset = 0; offset < nodes.length;) {
14
+ // Join transitions contend on the same aggregate; concurrent CAS adds work without parallel effects.
15
+ const width = large ? (nodes[offset]!.kind === 'join' ? 1 : 8) : DEFAULT_WORKFLOW_MAX_NODES;
16
+ const results = await Promise.allSettled(nodes.slice(offset, offset + width).map(execute));
17
+ const failure = results.find((result) => result.status === 'rejected');
18
+ if (failure?.status === 'rejected') throw failure.reason;
19
+ offset += width;
20
+ }
21
+ }
@@ -118,6 +118,7 @@ export type WorkflowOperatorStatus = 'running' | 'waiting' | 'paused' | 'succeed
118
118
  export type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer' | 'signal';
119
119
  export type WorkflowOperatorStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';
120
120
  export interface WorkflowOperatorView {
121
+ readonly maxNodes?: number | false;
121
122
  readonly format: 3 | 4 | 5; readonly definitionId: string; readonly definitionVersion: string; readonly runId: string; readonly revision: number;
122
123
  readonly status: WorkflowOperatorStatus;
123
124
  readonly nodes: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly dependsOn: readonly string[] }[];
@@ -162,7 +163,7 @@ export interface WorkflowOperatorTarget {
162
163
  }
163
164
  /** A signal as the operator API delivers it: the verified operator is its sender. */
164
165
  export interface WorkflowOperatorSignal { readonly signalName: string; readonly signalId: string; readonly value: JsonValue; readonly actorId: string }
165
- interface Registered { readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }
166
+ interface Registered { readonly maxNodes?: number | false; readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }
166
167
  /** Maps the authenticated operator to the credential the runtime's `verifyHuman` accepts; without it approvals are unavailable. */
167
168
  export type WorkflowApprovalCredential = (actorId: string) => unknown;
168
169
 
@@ -174,6 +175,7 @@ type Subjects = ReadonlyMap<string, NonNullable<WorkflowOperatorApproval['subjec
174
175
  const project = (format: 3 | 4 | 5, definition: Registered, snapshot: { readonly id: string; readonly version: number; readonly status: string;
175
176
  readonly steps: Readonly<Record<string, { readonly status: string; readonly child?: { readonly runId: string } | null;
176
177
  readonly approval?: unknown }>> }, subjects: Subjects = new Map()): WorkflowOperatorView => Object.freeze({
178
+ ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
177
179
  format, definitionId: definition.id, definitionVersion: definition.version, runId: snapshot.id, revision: snapshot.version, status: snapshot.status as WorkflowOperatorStatus,
178
180
  nodes: definition.nodes.map(node => ({ id: node.id, kind: node.kind as WorkflowOperatorNodeKind, dependsOn: [...(node.dependsOn ?? [])] })),
179
181
  steps: definition.nodes.map(node => { const step = snapshot.steps[node.id]!;
@@ -1,4 +1,6 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { advanceWorkflowNodes } from './node-batches.js';
3
+ import { workflowNodeLimit } from '@mayura/core';
2
4
  import type { Authorizer } from '@mayura/core';
3
5
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate, type ExecutionReceipt, type JsonObject, type JsonValue, type Permissions, type Scope } from '@mayura/core';
4
6
  import { invokeTool } from '@mayura/tools';
@@ -67,7 +69,7 @@ function outputs(state: State): Record<string, JsonValue> {
67
69
  catch { throw new MayuraError('CONFLICT', 'Stored workflow output failed integrity validation.'); }
68
70
  }
69
71
  function initialState(definition: AnyWorkflow, input: JsonValue, policy: string, maxCostMicros: number): State {
70
- return { format: 2, definition: definition.digest, policy, input, status: 'running', maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,
72
+ return { format: 2, ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }), definition: definition.digest, policy, input, status: 'running', maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,
71
73
  steps: Object.fromEntries(definition.nodes.map(node => [node.id, { kind: node.kind, status: 'pending', callId: `step:${node.id}`, output: null, receipt: null, approval: null, costReserved: 0, candidateHash: null }])) };
72
74
  }
73
75
 
@@ -257,7 +259,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
257
259
  await auth.execute(definition.digest, id);
258
260
  const before = await load(id); const state = stateFrom(before);
259
261
  if (state.definition !== definition.digest || before.definitionHash !== definition.digest || state.policy !== policy || state.maxCostMicros !== maxCostMicros) throw new MayuraError('CONFLICT', 'Definition or policy changed; explicit migration/review is required.');
260
- if (Object.keys(state.steps).length !== definition.nodes.length || definition.nodes.some(node => !Object.hasOwn(state.steps, node.id))) throw new MayuraError('CONFLICT', 'Stored steps do not match the pinned definition.');
262
+ if (workflowNodeLimit(state.maxNodes) !== workflowNodeLimit(definition.maxNodes) || Object.keys(state.steps).length !== definition.nodes.length || definition.nodes.some(node => !Object.hasOwn(state.steps, node.id))) throw new MayuraError('CONFLICT', 'Stored steps do not match the pinned definition.');
261
263
  for (const node of definition.nodes) {
262
264
  const step = state.steps[node.id]!;
263
265
  if (step.kind !== node.kind || (node.kind === 'tool' && step.receipt && step.receipt.toolId !== node.tool.id) || (step.status === 'succeeded' && (node.dependsOn ?? []).some(dependency => state.steps[dependency]?.status !== 'succeeded'))) throw new MayuraError('CONFLICT', 'Stored step evidence does not match the pinned graph.');
@@ -266,9 +268,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
266
268
  // Each wave holds one drain admission until its effects and receipts settle.
267
269
  const release = gate.enter(); if (!release) return checkedSnapshot(before);
268
270
  try {
269
- const results = await Promise.allSettled(definition.nodes.map(node => executeNode(id, node)));
270
- const failure = results.find(result => result.status === 'rejected');
271
- if (failure?.status === 'rejected') throw failure.reason;
271
+ await advanceWorkflowNodes(definition.nodes.filter(node => !terminalSteps.has(state.steps[node.id]!.status)), node => executeNode(id, node));
272
272
  } finally { release(); }
273
273
  let after = await load(id); const next = stateFrom(after); const steps = Object.values(next.steps);
274
274
  if (next.status === 'paused' || next.status === 'cancelled') return checkedSnapshot(after);
@@ -347,7 +347,7 @@ export function createWorkflowRuntime(options: WorkflowRuntimeOptions) {
347
347
  const fresh = initialState(migration.to, state.input, policy, maxCostMicros);
348
348
  const carried: Record<string, Step> = {};
349
349
  for (const entry of plan.entries) if (entry.target) carried[entry.target] = entry.action === 'keep' || entry.action === 'accept' ? state.steps[entry.source!]! : fresh.steps[entry.target]!;
350
- const next: State = { ...state, definition: migration.to.digest, steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, carried[node.id]!])) };
350
+ const next: State = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, steps: Object.fromEntries(migration.to.nodes.map(node => [node.id, carried[node.id]!])) };
351
351
  next.reservedMicros = Object.values(next.steps).reduce((sum, step) => sum + step.costReserved, 0);
352
352
  try { assertWorkflowStateMatchesManifest(workflowState({ id, state: jsonValue(next) as JsonObject }), scheduledManifest(migration.to)); }
353
353
  catch { throw new MayuraError('CONFLICT', 'Migration refused: the migrated state does not satisfy the new definition.'); }
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '@mayura/core';
1
2
  import { freezeJson, jsonValue, MayuraError, type JsonValue } from '@mayura/core';
2
3
  import {
3
4
  StorageError, workflowManifest, workflowState, workflowGraphState,
@@ -72,7 +73,7 @@ export async function scheduledCallback<T>(operation: () => T | PromiseLike<T>,
72
73
 
73
74
  /** Construct the original data-only definition material without changing its version hash. */
74
75
  export function scheduledManifest(definition: AnyWorkflow): WorkflowManifest {
75
- return workflowManifest({ id: definition.id, version: definition.version,
76
+ return workflowManifest({ id: definition.id, version: definition.version, ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
76
77
  graph: definition.nodes.map(node => node.kind === 'join'
77
78
  ? { id: node.id, kind: node.kind, dependsOn: node.dependsOn }
78
79
  : { id: node.id, kind: node.kind, dependsOn: node.dependsOn ?? [], tool: node.tool.id,
@@ -111,7 +112,7 @@ function checkOwnedView(view: ScheduledStoredSnapshot, scope: string, id: string
111
112
  // checks and decoding need happen only once for this exact owned snapshot.
112
113
  if (ownedViews.has(view)) return view;
113
114
  if (!Array.isArray(view.jobs)
114
- || view.jobs.length > 128 || !Number.isSafeInteger(view.record.version) || view.record.version < 1
115
+ || view.jobs.length > workflowNodeLimit(view.record.state['maxNodes']) || !Number.isSafeInteger(view.record.version) || view.record.version < 1
115
116
  || !/^[a-f0-9]{64}$/.test(view.manifestHash) || !/^[a-f0-9]{64}$/.test(view.resourceHash)
116
117
  || view.record.definitionHash !== view.manifestHash) throw new Error();
117
118
  const state = scheduledState(view.record, profile);
@@ -1,4 +1,5 @@
1
1
  import { workflowAuthorization } from './authorization.js';
2
+ import { workflowNodeLimit } from '@mayura/core';
2
3
  import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate, type ExecutionReceipt, type ExecutionSettlement, type JsonObject, type JsonValue, type Schema, type InferInput, type Scope } from '@mayura/core';
3
4
  import { invokeTool } from '@mayura/tools';
4
5
  import { bindToolApproval } from '@mayura/tools/host';
@@ -696,7 +697,7 @@ export function createScheduledDriver(options: ScheduledWorkflowRuntimeOptions |
696
697
  carried[entry.target] = entry.action === 'keep' || entry.action === 'accept' ? state.steps[entry.source!] : fresh.steps[entry.target];
697
698
  }
698
699
  const steps = Object.fromEntries((to.manifest as WorkflowManifest | WorkflowGraphManifest).graph.map(node => [node.id, carried[node.id]]));
699
- const next = { ...state, definition: migration.to.digest, steps,
700
+ const next = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, steps,
700
701
  reservedMicros: Object.values(steps).reduce<number>((sum, step) => sum + (step as { costReserved: number }).costReserved, 0) };
701
702
  // One attempt at the planned version: a concurrent change needs a fresh review, and a storage refusal keeps its reason.
702
703
  let result: ScheduledStoredSnapshot;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "private": true
5
5
  }