mayura 1.1.0 → 1.2.0-rc.1

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 (954) hide show
  1. package/README.md +10 -0
  2. package/ag-ui/index.d.ts +1 -0
  3. package/ag-ui/index.js +1 -0
  4. package/authz/index.d.ts +1 -0
  5. package/authz/index.js +1 -0
  6. package/docs/README.md +162 -0
  7. package/docs/cli/init.md +12 -0
  8. package/docs/cli/run.md +182 -182
  9. package/docs/concepts/outcomes.md +2 -0
  10. package/docs/concepts/permissions.md +50 -0
  11. package/docs/concepts/runtime.md +189 -1
  12. package/docs/concepts/tools.md +1 -0
  13. package/docs/concepts/workflows.md +8 -0
  14. package/docs/guides/ag-ui.md +560 -0
  15. package/docs/guides/agent-handoffs.md +120 -0
  16. package/docs/guides/ai-gateways.md +60 -0
  17. package/docs/guides/approvals-and-human-input.md +24 -0
  18. package/docs/guides/authorization.md +499 -0
  19. package/docs/guides/child-agents.md +7 -0
  20. package/docs/guides/copy-in-ui.md +79 -0
  21. package/docs/guides/deployment.md +3 -2
  22. package/docs/guides/durable-workflows.md +3 -0
  23. package/docs/guides/framework-starters.md +92 -0
  24. package/docs/guides/helpers.md +2 -2
  25. package/docs/guides/lifecycle-hooks.md +34 -0
  26. package/docs/guides/memory-and-context.md +117 -0
  27. package/docs/guides/model-providers.md +19 -0
  28. package/docs/guides/observability.md +9 -0
  29. package/docs/guides/rag.md +180 -0
  30. package/docs/guides/react.md +237 -1
  31. package/docs/guides/release-readiness.md +101 -0
  32. package/docs/guides/sandboxes.md +3 -2
  33. package/docs/guides/server-and-client.md +404 -1
  34. package/docs/guides/storage.md +1 -0
  35. package/docs/guides/testing.md +4 -2
  36. package/docs/guides/threads.md +296 -0
  37. package/docs/integrations/auth-auth0.md +120 -0
  38. package/docs/integrations/auth-clerk.md +128 -0
  39. package/docs/integrations/auth-cognito.md +120 -0
  40. package/docs/integrations/auth-entra.md +126 -0
  41. package/docs/integrations/auth-facebook.md +165 -0
  42. package/docs/integrations/auth-firebase.md +116 -0
  43. package/docs/integrations/auth-google.md +151 -0
  44. package/docs/integrations/auth-neon.md +109 -0
  45. package/docs/integrations/auth-okta.md +122 -0
  46. package/docs/integrations/auth-supabase.md +122 -0
  47. package/docs/integrations/auth-workos.md +121 -0
  48. package/docs/integrations/authz-cedar.md +131 -0
  49. package/docs/integrations/authz-http.md +175 -0
  50. package/docs/integrations/authz-openfga.md +187 -0
  51. package/docs/integrations/authz-oso.md +154 -0
  52. package/docs/integrations/authz-permit.md +152 -0
  53. package/docs/integrations/browser-agent-browser.md +155 -0
  54. package/docs/integrations/browser-anchor.md +137 -0
  55. package/docs/integrations/browser-browser-use.md +134 -0
  56. package/docs/integrations/browser-browserbase.md +134 -0
  57. package/docs/integrations/browser-browserless.md +121 -0
  58. package/docs/integrations/browser-browserview.md +146 -0
  59. package/docs/integrations/browser-cloudflare.md +159 -0
  60. package/docs/integrations/browser-firecrawl.md +200 -0
  61. package/docs/integrations/browser-hyperbrowser.md +133 -0
  62. package/docs/integrations/browser-kernel.md +131 -0
  63. package/docs/integrations/browser-stagehand.md +159 -0
  64. package/docs/integrations/browser-steel.md +133 -0
  65. package/docs/integrations/browser-viewer.md +167 -0
  66. package/docs/integrations/cloudflare-quick-action.md +175 -0
  67. package/docs/integrations/deploy-agentcore.md +189 -0
  68. package/docs/integrations/deploy-aws-ecs.md +169 -0
  69. package/docs/integrations/deploy-aws-lambda.md +197 -0
  70. package/docs/integrations/deploy-azure.md +151 -0
  71. package/docs/integrations/deploy-cloudflare.md +220 -0
  72. package/docs/integrations/deploy-cloudrun.md +149 -0
  73. package/docs/integrations/deploy-digitalocean.md +147 -0
  74. package/docs/integrations/deploy-fly.md +154 -0
  75. package/docs/integrations/deploy-railway.md +138 -0
  76. package/docs/integrations/deploy-render.md +144 -0
  77. package/docs/integrations/deploy-vercel.md +173 -0
  78. package/docs/integrations/filestorage-agentfs.md +111 -0
  79. package/docs/integrations/filestorage-azure-blob.md +127 -0
  80. package/docs/integrations/filestorage-files-sdk.md +120 -0
  81. package/docs/integrations/filestorage-gcs.md +121 -0
  82. package/docs/integrations/filestorage-google-drive.md +129 -0
  83. package/docs/integrations/filestorage-mesa.md +130 -0
  84. package/docs/integrations/filestorage-r2.md +119 -0
  85. package/docs/integrations/filestorage-vercel-blob.md +121 -0
  86. package/docs/integrations/gateway-cloudflare.md +57 -0
  87. package/docs/integrations/gateway-helicone.md +57 -0
  88. package/docs/integrations/gateway-litellm.md +57 -0
  89. package/docs/integrations/gateway-openrouter.md +59 -0
  90. package/docs/integrations/gateway-portkey.md +57 -0
  91. package/docs/integrations/gateway-vercel.md +57 -0
  92. package/docs/integrations/km-reqkey.md +172 -0
  93. package/docs/integrations/km-unkey.md +179 -0
  94. package/docs/integrations/observability-arize.md +226 -0
  95. package/docs/integrations/observability-betterstack.md +161 -0
  96. package/docs/integrations/observability-datadog.md +181 -0
  97. package/docs/integrations/observability-langfuse.md +174 -0
  98. package/docs/integrations/observability-langsmith.md +182 -0
  99. package/docs/integrations/observability-posthog.md +156 -0
  100. package/docs/integrations/observability-sentry.md +167 -0
  101. package/docs/integrations/provider-anthropic.md +238 -0
  102. package/docs/integrations/provider-azure.md +251 -0
  103. package/docs/integrations/provider-bedrock.md +258 -0
  104. package/docs/integrations/provider-google.md +223 -0
  105. package/docs/integrations/provider-groq.md +216 -0
  106. package/docs/integrations/provider-mistral.md +220 -0
  107. package/docs/integrations/provider-ollama.md +220 -0
  108. package/docs/integrations/provider-openai.md +294 -0
  109. package/docs/integrations/reranker-cohere.md +23 -0
  110. package/docs/integrations/reranker-jina.md +23 -0
  111. package/docs/integrations/reranker-voyage.md +23 -0
  112. package/docs/integrations/sandbox-agentcore.md +140 -0
  113. package/docs/integrations/sandbox-apple-container.md +132 -0
  114. package/docs/integrations/sandbox-cloudflare.md +132 -0
  115. package/docs/integrations/sandbox-codesandbox.md +138 -0
  116. package/docs/integrations/sandbox-daytona.md +148 -0
  117. package/docs/integrations/sandbox-e2b-desktop.md +137 -0
  118. package/docs/integrations/sandbox-e2b.md +109 -0
  119. package/docs/integrations/sandbox-fly.md +143 -0
  120. package/docs/integrations/sandbox-modal.md +129 -0
  121. package/docs/integrations/sandbox-northflank.md +135 -0
  122. package/docs/integrations/sandbox-railway.md +141 -0
  123. package/docs/integrations/sandbox-vercel.md +140 -0
  124. package/docs/integrations/storage-d1.md +128 -0
  125. package/docs/integrations/storage-dynamodb.md +158 -0
  126. package/docs/integrations/storage-libsql.md +143 -0
  127. package/docs/integrations/storage-mongodb.md +123 -0
  128. package/docs/integrations/storage-mysql.md +133 -0
  129. package/docs/integrations/vector-chroma.md +26 -0
  130. package/docs/integrations/vector-libsql.md +24 -0
  131. package/docs/integrations/vector-pgvector.md +24 -0
  132. package/docs/integrations/vector-pinecone.md +26 -0
  133. package/docs/integrations/vector-qdrant.md +26 -0
  134. package/docs/integrations/vector-weaviate.md +26 -0
  135. package/docs/integrations/voice-assemblyai.md +148 -0
  136. package/docs/integrations/voice-azure.md +159 -0
  137. package/docs/integrations/voice-cartesia.md +148 -0
  138. package/docs/integrations/voice-deepgram.md +141 -0
  139. package/docs/integrations/voice-elevenlabs.md +142 -0
  140. package/docs/integrations/voice-google.md +176 -0
  141. package/docs/integrations/voice-openai.md +158 -0
  142. package/docs/project/credits.md +2 -1
  143. package/docs/reference/entry-points.md +1 -0
  144. package/docs/reference/integrations.md +137 -88
  145. package/lib/adapter-code-docker/image/Dockerfile +1 -1
  146. package/lib/adapter-code-docker/package.json +1 -1
  147. package/lib/adapter-code-quickjs/package.json +1 -1
  148. package/lib/adapter-mcp/package.json +1 -1
  149. package/lib/ag-ui/dist/durable-frontend-tools.d.ts +4 -0
  150. package/lib/ag-ui/dist/durable-frontend-tools.d.ts.map +1 -0
  151. package/lib/ag-ui/dist/durable-frontend-tools.js +275 -0
  152. package/lib/ag-ui/dist/durable-frontend-tools.js.map +1 -0
  153. package/lib/ag-ui/dist/frontend-executor.d.ts +44 -0
  154. package/lib/ag-ui/dist/frontend-executor.d.ts.map +1 -0
  155. package/lib/ag-ui/dist/frontend-executor.js +148 -0
  156. package/lib/ag-ui/dist/frontend-executor.js.map +1 -0
  157. package/lib/ag-ui/dist/frontend-tools.d.ts +109 -0
  158. package/lib/ag-ui/dist/frontend-tools.d.ts.map +1 -0
  159. package/lib/ag-ui/dist/frontend-tools.js +227 -0
  160. package/lib/ag-ui/dist/frontend-tools.js.map +1 -0
  161. package/lib/ag-ui/dist/index.d.ts +67 -0
  162. package/lib/ag-ui/dist/index.d.ts.map +1 -0
  163. package/lib/ag-ui/dist/index.js +605 -0
  164. package/lib/ag-ui/dist/index.js.map +1 -0
  165. package/lib/ag-ui/dist/interrupts.d.ts +18 -0
  166. package/lib/ag-ui/dist/interrupts.d.ts.map +1 -0
  167. package/lib/ag-ui/dist/interrupts.js +48 -0
  168. package/lib/ag-ui/dist/interrupts.js.map +1 -0
  169. package/lib/ag-ui/dist/messages.d.ts +15 -0
  170. package/lib/ag-ui/dist/messages.d.ts.map +1 -0
  171. package/lib/ag-ui/dist/messages.js +89 -0
  172. package/lib/ag-ui/dist/messages.js.map +1 -0
  173. package/lib/ag-ui/dist/protocol.d.ts +197 -0
  174. package/lib/ag-ui/dist/protocol.d.ts.map +1 -0
  175. package/lib/ag-ui/dist/protocol.js +177 -0
  176. package/lib/ag-ui/dist/protocol.js.map +1 -0
  177. package/lib/ag-ui/dist/state.d.ts +40 -0
  178. package/lib/ag-ui/dist/state.d.ts.map +1 -0
  179. package/lib/ag-ui/dist/state.js +160 -0
  180. package/lib/ag-ui/dist/state.js.map +1 -0
  181. package/lib/ag-ui/package.json +5 -0
  182. package/lib/ag-ui/src/durable-frontend-tools.ts +201 -0
  183. package/lib/ag-ui/src/frontend-executor.ts +96 -0
  184. package/lib/ag-ui/src/frontend-tools.ts +208 -0
  185. package/lib/ag-ui/src/index.ts +445 -0
  186. package/lib/ag-ui/src/interrupts.ts +45 -0
  187. package/lib/ag-ui/src/messages.ts +68 -0
  188. package/lib/ag-ui/src/protocol.ts +179 -0
  189. package/lib/ag-ui/src/state.ts +132 -0
  190. package/lib/artifacts/package.json +1 -1
  191. package/lib/auth/dist/identity.js +1 -1
  192. package/lib/auth/dist/identity.js.map +1 -1
  193. package/lib/auth/package.json +1 -1
  194. package/lib/auth/src/identity.ts +1 -1
  195. package/lib/authz/dist/index.d.ts +44 -0
  196. package/lib/authz/dist/index.d.ts.map +1 -0
  197. package/lib/authz/dist/index.js +177 -0
  198. package/lib/authz/dist/index.js.map +1 -0
  199. package/lib/authz/package.json +5 -0
  200. package/lib/authz/src/index.ts +148 -0
  201. package/lib/browser/package.json +1 -1
  202. package/lib/cli/dist/bin.js +28 -0
  203. package/lib/cli/dist/bin.js.map +1 -1
  204. package/lib/cli/dist/index.d.ts +2 -1
  205. package/lib/cli/dist/index.d.ts.map +1 -1
  206. package/lib/cli/dist/index.js +13 -6
  207. package/lib/cli/dist/index.js.map +1 -1
  208. package/lib/cli/dist/ui.d.ts +27 -0
  209. package/lib/cli/dist/ui.d.ts.map +1 -0
  210. package/lib/cli/dist/ui.js +80 -0
  211. package/lib/cli/dist/ui.js.map +1 -0
  212. package/lib/cli/package.json +1 -1
  213. package/lib/cli/src/bin.ts +11 -0
  214. package/lib/cli/src/index.ts +14 -6
  215. package/lib/cli/src/ui.ts +52 -0
  216. package/lib/cli/starters/approval-workflow/README.md +1 -1
  217. package/lib/cli/starters/approval-workflow/dot-env.example +1 -1
  218. package/lib/cli/starters/approval-workflow/test/refunds.test.ts +18 -1
  219. package/lib/cli/starters/cli-agent/test/assistant.test.ts +12 -0
  220. package/lib/cli/starters/event-automation/README.md +1 -1
  221. package/lib/cli/starters/event-automation/compose.yaml +1 -1
  222. package/lib/cli/starters/event-automation/dot-env.example +3 -3
  223. package/lib/cli/starters/event-automation/test/automation.test.ts +18 -1
  224. package/lib/cli/starters/hono/Dockerfile +12 -0
  225. package/lib/cli/starters/hono/README.md +94 -0
  226. package/lib/cli/starters/hono/compose.yaml +19 -0
  227. package/lib/cli/starters/hono/deno.json +3 -0
  228. package/lib/cli/starters/hono/dot-dockerignore +11 -0
  229. package/lib/cli/starters/hono/dot-env.example +7 -0
  230. package/lib/cli/starters/hono/dot-gitignore +15 -0
  231. package/lib/cli/starters/hono/mayura.project.json +37 -0
  232. package/lib/cli/starters/hono/package.json +47 -0
  233. package/lib/cli/starters/hono/scripts/dev.mjs +5 -0
  234. package/lib/cli/starters/hono/scripts/setup.mjs +9 -0
  235. package/lib/cli/starters/hono/server/application.mjs +74 -0
  236. package/lib/cli/starters/hono/server/auth.mjs +24 -0
  237. package/lib/cli/starters/hono/server/bun.mjs +10 -0
  238. package/lib/cli/starters/hono/server/deno.mjs +10 -0
  239. package/lib/cli/starters/hono/server/hono-node.mjs +10 -0
  240. package/lib/cli/starters/hono/server/node.mjs +31 -0
  241. package/lib/cli/starters/hono/server/portable.mjs +9 -0
  242. package/lib/cli/starters/hono/server/worker-edge.mjs +18 -0
  243. package/lib/cli/starters/hono/server/worker.mjs +11 -0
  244. package/lib/cli/starters/hono/server/workflows.mjs +23 -0
  245. package/lib/cli/starters/hono/src/ChatApp.jsx +57 -0
  246. package/lib/cli/starters/hono/src/Notebook.jsx +25 -0
  247. package/lib/cli/starters/hono/src/components/mayura/approval.tsx +142 -0
  248. package/lib/cli/starters/hono/src/components/mayura/thread-history.tsx +142 -0
  249. package/lib/cli/starters/hono/src/components/mayura/thread-list.tsx +9 -0
  250. package/lib/cli/starters/hono/src/components/mayura/ui.css +14 -0
  251. package/lib/cli/starters/hono/src/connect.js +21 -0
  252. package/lib/cli/starters/hono/src/session.js +138 -0
  253. package/lib/cli/starters/hono/src/style.css +11 -0
  254. package/lib/cli/starters/hono/src/vite-env.d.ts +1 -0
  255. package/lib/cli/starters/hono/test/server.test.mjs +95 -0
  256. package/lib/cli/starters/hono/test/session.test.mjs +16 -0
  257. package/lib/cli/starters/hono/tsconfig.json +34 -0
  258. package/lib/cli/starters/hono/vite.config.ts +3 -0
  259. package/lib/cli/starters/hono/web/index.html +1 -0
  260. package/lib/cli/starters/hono/web/main.jsx +4 -0
  261. package/lib/cli/starters/hono/wrangler.jsonc +29 -0
  262. package/lib/cli/starters/nextjs/Dockerfile +12 -0
  263. package/lib/cli/starters/nextjs/README.md +76 -0
  264. package/lib/cli/starters/nextjs/app/api/mayura/[[...path]]/route.ts +8 -0
  265. package/lib/cli/starters/nextjs/app/layout.tsx +4 -0
  266. package/lib/cli/starters/nextjs/app/page.tsx +2 -0
  267. package/lib/cli/starters/nextjs/compose.yaml +19 -0
  268. package/lib/cli/starters/nextjs/dot-dockerignore +11 -0
  269. package/lib/cli/starters/nextjs/dot-env.example +7 -0
  270. package/lib/cli/starters/nextjs/dot-gitignore +14 -0
  271. package/lib/cli/starters/nextjs/mayura.project.json +37 -0
  272. package/lib/cli/starters/nextjs/next-env.d.ts +7 -0
  273. package/lib/cli/starters/nextjs/next.config.mjs +1 -0
  274. package/lib/cli/starters/nextjs/package.json +38 -0
  275. package/lib/cli/starters/nextjs/scripts/setup.mjs +9 -0
  276. package/lib/cli/starters/nextjs/server/application.mjs +74 -0
  277. package/lib/cli/starters/nextjs/server/auth.mjs +24 -0
  278. package/lib/cli/starters/nextjs/server/node.mjs +31 -0
  279. package/lib/cli/starters/nextjs/server/worker.mjs +11 -0
  280. package/lib/cli/starters/nextjs/server/workflows.mjs +23 -0
  281. package/lib/cli/starters/nextjs/src/ChatApp.jsx +57 -0
  282. package/lib/cli/starters/nextjs/src/Notebook.jsx +25 -0
  283. package/lib/cli/starters/nextjs/src/components/mayura/approval.tsx +142 -0
  284. package/lib/cli/starters/nextjs/src/components/mayura/thread-history.tsx +142 -0
  285. package/lib/cli/starters/nextjs/src/components/mayura/thread-list.tsx +9 -0
  286. package/lib/cli/starters/nextjs/src/components/mayura/ui.css +14 -0
  287. package/lib/cli/starters/nextjs/src/connect.js +21 -0
  288. package/lib/cli/starters/nextjs/src/session.js +138 -0
  289. package/lib/cli/starters/nextjs/src/style.css +11 -0
  290. package/lib/cli/starters/nextjs/test/server.test.mjs +95 -0
  291. package/lib/cli/starters/nextjs/test/session.test.mjs +16 -0
  292. package/lib/cli/starters/nextjs/tsconfig.json +44 -0
  293. package/lib/cli/starters/nuxt/Dockerfile +12 -0
  294. package/lib/cli/starters/nuxt/README.md +77 -0
  295. package/lib/cli/starters/nuxt/app/app.vue +34 -0
  296. package/lib/cli/starters/nuxt/compose.yaml +19 -0
  297. package/lib/cli/starters/nuxt/dot-dockerignore +11 -0
  298. package/lib/cli/starters/nuxt/dot-env.example +7 -0
  299. package/lib/cli/starters/nuxt/dot-gitignore +14 -0
  300. package/lib/cli/starters/nuxt/mayura.project.json +37 -0
  301. package/lib/cli/starters/nuxt/nuxt.config.ts +1 -0
  302. package/lib/cli/starters/nuxt/package.json +37 -0
  303. package/lib/cli/starters/nuxt/scripts/setup.mjs +9 -0
  304. package/lib/cli/starters/nuxt/server/application.mjs +74 -0
  305. package/lib/cli/starters/nuxt/server/auth.mjs +24 -0
  306. package/lib/cli/starters/nuxt/server/node.mjs +31 -0
  307. package/lib/cli/starters/nuxt/server/routes/api/mayura/[...path].ts +3 -0
  308. package/lib/cli/starters/nuxt/server/worker.mjs +11 -0
  309. package/lib/cli/starters/nuxt/server/workflows.mjs +23 -0
  310. package/lib/cli/starters/nuxt/src/connect.js +21 -0
  311. package/lib/cli/starters/nuxt/src/session.js +138 -0
  312. package/lib/cli/starters/nuxt/src/style.css +11 -0
  313. package/lib/cli/starters/nuxt/src/view.js +49 -0
  314. package/lib/cli/starters/nuxt/test/server.test.mjs +95 -0
  315. package/lib/cli/starters/nuxt/test/session.test.mjs +16 -0
  316. package/lib/cli/starters/nuxt/tsconfig.json +3 -0
  317. package/lib/cli/starters/react-router/Dockerfile +12 -0
  318. package/lib/cli/starters/react-router/README.md +78 -0
  319. package/lib/cli/starters/react-router/app/root.tsx +3 -0
  320. package/lib/cli/starters/react-router/app/routes/api.ts +3 -0
  321. package/lib/cli/starters/react-router/app/routes/home.tsx +2 -0
  322. package/lib/cli/starters/react-router/app/routes.ts +2 -0
  323. package/lib/cli/starters/react-router/compose.yaml +19 -0
  324. package/lib/cli/starters/react-router/dot-dockerignore +11 -0
  325. package/lib/cli/starters/react-router/dot-env.example +7 -0
  326. package/lib/cli/starters/react-router/dot-gitignore +14 -0
  327. package/lib/cli/starters/react-router/mayura.project.json +37 -0
  328. package/lib/cli/starters/react-router/package.json +43 -0
  329. package/lib/cli/starters/react-router/react-router.config.ts +2 -0
  330. package/lib/cli/starters/react-router/scripts/setup.mjs +9 -0
  331. package/lib/cli/starters/react-router/server/application.mjs +74 -0
  332. package/lib/cli/starters/react-router/server/auth.mjs +24 -0
  333. package/lib/cli/starters/react-router/server/node.mjs +31 -0
  334. package/lib/cli/starters/react-router/server/worker.mjs +11 -0
  335. package/lib/cli/starters/react-router/server/workflows.mjs +23 -0
  336. package/lib/cli/starters/react-router/src/ChatApp.jsx +57 -0
  337. package/lib/cli/starters/react-router/src/Notebook.jsx +25 -0
  338. package/lib/cli/starters/react-router/src/components/mayura/approval.tsx +142 -0
  339. package/lib/cli/starters/react-router/src/components/mayura/thread-history.tsx +142 -0
  340. package/lib/cli/starters/react-router/src/components/mayura/thread-list.tsx +9 -0
  341. package/lib/cli/starters/react-router/src/components/mayura/ui.css +14 -0
  342. package/lib/cli/starters/react-router/src/connect.js +21 -0
  343. package/lib/cli/starters/react-router/src/session.js +138 -0
  344. package/lib/cli/starters/react-router/src/style.css +11 -0
  345. package/lib/cli/starters/react-router/src/vite-env.d.ts +1 -0
  346. package/lib/cli/starters/react-router/test/server.test.mjs +95 -0
  347. package/lib/cli/starters/react-router/test/session.test.mjs +16 -0
  348. package/lib/cli/starters/react-router/tsconfig.json +39 -0
  349. package/lib/cli/starters/react-router/vite.config.ts +3 -0
  350. package/lib/cli/starters/research-team/README.md +1 -1
  351. package/lib/cli/starters/research-team/dot-env.example +1 -1
  352. package/lib/cli/starters/research-team/test/research.test.ts +18 -1
  353. package/lib/cli/starters/support-agent/dot-env.example +1 -1
  354. package/lib/cli/starters/support-agent/test/support.test.ts +18 -1
  355. package/lib/cli/starters/sveltekit/Dockerfile +12 -0
  356. package/lib/cli/starters/sveltekit/README.md +79 -0
  357. package/lib/cli/starters/sveltekit/compose.yaml +19 -0
  358. package/lib/cli/starters/sveltekit/dot-dockerignore +11 -0
  359. package/lib/cli/starters/sveltekit/dot-env.example +7 -0
  360. package/lib/cli/starters/sveltekit/dot-gitignore +14 -0
  361. package/lib/cli/starters/sveltekit/mayura.project.json +37 -0
  362. package/lib/cli/starters/sveltekit/package.json +39 -0
  363. package/lib/cli/starters/sveltekit/scripts/setup.mjs +9 -0
  364. package/lib/cli/starters/sveltekit/server/application.mjs +74 -0
  365. package/lib/cli/starters/sveltekit/server/auth.mjs +24 -0
  366. package/lib/cli/starters/sveltekit/server/node.mjs +31 -0
  367. package/lib/cli/starters/sveltekit/server/worker.mjs +11 -0
  368. package/lib/cli/starters/sveltekit/server/workflows.mjs +23 -0
  369. package/lib/cli/starters/sveltekit/src/app.html +1 -0
  370. package/lib/cli/starters/sveltekit/src/connect.js +21 -0
  371. package/lib/cli/starters/sveltekit/src/routes/+page.svelte +48 -0
  372. package/lib/cli/starters/sveltekit/src/routes/api/mayura/[...path]/+server.ts +4 -0
  373. package/lib/cli/starters/sveltekit/src/session.js +138 -0
  374. package/lib/cli/starters/sveltekit/src/style.css +11 -0
  375. package/lib/cli/starters/sveltekit/src/view.js +49 -0
  376. package/lib/cli/starters/sveltekit/test/server.test.mjs +95 -0
  377. package/lib/cli/starters/sveltekit/test/session.test.mjs +16 -0
  378. package/lib/cli/starters/sveltekit/tsconfig.json +11 -0
  379. package/lib/cli/starters/sveltekit/vite.config.ts +5 -0
  380. package/lib/cli/starters/tanstack-start/Dockerfile +12 -0
  381. package/lib/cli/starters/tanstack-start/README.md +80 -0
  382. package/lib/cli/starters/tanstack-start/compose.yaml +19 -0
  383. package/lib/cli/starters/tanstack-start/dot-dockerignore +11 -0
  384. package/lib/cli/starters/tanstack-start/dot-env.example +7 -0
  385. package/lib/cli/starters/tanstack-start/dot-gitignore +14 -0
  386. package/lib/cli/starters/tanstack-start/mayura.project.json +37 -0
  387. package/lib/cli/starters/tanstack-start/package.json +42 -0
  388. package/lib/cli/starters/tanstack-start/scripts/setup.mjs +9 -0
  389. package/lib/cli/starters/tanstack-start/server/application.mjs +74 -0
  390. package/lib/cli/starters/tanstack-start/server/auth.mjs +24 -0
  391. package/lib/cli/starters/tanstack-start/server/node.mjs +31 -0
  392. package/lib/cli/starters/tanstack-start/server/worker.mjs +11 -0
  393. package/lib/cli/starters/tanstack-start/server/workflows.mjs +23 -0
  394. package/lib/cli/starters/tanstack-start/src/ChatApp.jsx +57 -0
  395. package/lib/cli/starters/tanstack-start/src/Notebook.jsx +25 -0
  396. package/lib/cli/starters/tanstack-start/src/components/mayura/approval.tsx +142 -0
  397. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-history.tsx +142 -0
  398. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-list.tsx +9 -0
  399. package/lib/cli/starters/tanstack-start/src/components/mayura/ui.css +14 -0
  400. package/lib/cli/starters/tanstack-start/src/connect.js +21 -0
  401. package/lib/cli/starters/tanstack-start/src/routeTree.gen.ts +86 -0
  402. package/lib/cli/starters/tanstack-start/src/router.tsx +4 -0
  403. package/lib/cli/starters/tanstack-start/src/routes/__root.tsx +3 -0
  404. package/lib/cli/starters/tanstack-start/src/routes/api.mayura.$.ts +4 -0
  405. package/lib/cli/starters/tanstack-start/src/routes/index.tsx +3 -0
  406. package/lib/cli/starters/tanstack-start/src/session.js +138 -0
  407. package/lib/cli/starters/tanstack-start/src/style.css +11 -0
  408. package/lib/cli/starters/tanstack-start/test/server.test.mjs +95 -0
  409. package/lib/cli/starters/tanstack-start/test/session.test.mjs +16 -0
  410. package/lib/cli/starters/tanstack-start/tsconfig.json +35 -0
  411. package/lib/cli/starters/tanstack-start/vite.config.ts +5 -0
  412. package/lib/cli/ui/approval.tsx +142 -0
  413. package/lib/cli/ui/browser-view.tsx +6 -0
  414. package/lib/cli/ui/chat.tsx +17 -0
  415. package/lib/cli/ui/citations.tsx +7 -0
  416. package/lib/cli/ui/registry.json +153 -0
  417. package/lib/cli/ui/run-status.tsx +4 -0
  418. package/lib/cli/ui/sandbox-terminal.tsx +5 -0
  419. package/lib/cli/ui/thread-history.tsx +142 -0
  420. package/lib/cli/ui/thread-list.tsx +9 -0
  421. package/lib/cli/ui/tool-call.tsx +6 -0
  422. package/lib/cli/ui/ui.css +14 -0
  423. package/lib/cli/ui/voice.tsx +21 -0
  424. package/lib/cli/ui/workflow-progress.tsx +4 -0
  425. package/lib/client/dist/conversation-stores.d.ts +84 -0
  426. package/lib/client/dist/conversation-stores.d.ts.map +1 -0
  427. package/lib/client/dist/conversation-stores.js +196 -0
  428. package/lib/client/dist/conversation-stores.js.map +1 -0
  429. package/lib/client/dist/conversations.d.ts +228 -0
  430. package/lib/client/dist/conversations.d.ts.map +1 -0
  431. package/lib/client/dist/conversations.js +465 -0
  432. package/lib/client/dist/conversations.js.map +1 -0
  433. package/lib/client/dist/headless.d.ts +11 -1
  434. package/lib/client/dist/headless.d.ts.map +1 -1
  435. package/lib/client/dist/headless.js +73 -6
  436. package/lib/client/dist/headless.js.map +1 -1
  437. package/lib/client/dist/history-event.d.ts +3 -0
  438. package/lib/client/dist/history-event.d.ts.map +1 -0
  439. package/lib/client/dist/history-event.js +9 -0
  440. package/lib/client/dist/history-event.js.map +1 -0
  441. package/lib/client/dist/index.d.ts +25 -7
  442. package/lib/client/dist/index.d.ts.map +1 -1
  443. package/lib/client/dist/index.js +57 -16
  444. package/lib/client/dist/index.js.map +1 -1
  445. package/lib/client/dist/thread-compaction-store.d.ts +41 -0
  446. package/lib/client/dist/thread-compaction-store.d.ts.map +1 -0
  447. package/lib/client/dist/thread-compaction-store.js +135 -0
  448. package/lib/client/dist/thread-compaction-store.js.map +1 -0
  449. package/lib/client/package.json +1 -1
  450. package/lib/client/src/conversation-stores.ts +167 -0
  451. package/lib/client/src/conversations.ts +325 -0
  452. package/lib/client/src/headless.ts +41 -8
  453. package/lib/client/src/history-event.ts +8 -0
  454. package/lib/client/src/index.ts +62 -29
  455. package/lib/client/src/thread-compaction-store.ts +92 -0
  456. package/lib/client-react/dist/compaction-components.d.ts +16 -0
  457. package/lib/client-react/dist/compaction-components.d.ts.map +1 -0
  458. package/lib/client-react/dist/compaction-components.js +81 -0
  459. package/lib/client-react/dist/compaction-components.js.map +1 -0
  460. package/lib/client-react/dist/components.d.ts +2 -0
  461. package/lib/client-react/dist/components.d.ts.map +1 -1
  462. package/lib/client-react/dist/components.js +2 -0
  463. package/lib/client-react/dist/components.js.map +1 -1
  464. package/lib/client-react/dist/conversation-components.d.ts +30 -0
  465. package/lib/client-react/dist/conversation-components.d.ts.map +1 -0
  466. package/lib/client-react/dist/conversation-components.js +120 -0
  467. package/lib/client-react/dist/conversation-components.js.map +1 -0
  468. package/lib/client-react/dist/index.d.ts +17 -2
  469. package/lib/client-react/dist/index.d.ts.map +1 -1
  470. package/lib/client-react/dist/index.js +43 -0
  471. package/lib/client-react/dist/index.js.map +1 -1
  472. package/lib/client-react/package.json +1 -1
  473. package/lib/client-react/src/compaction-components.ts +89 -0
  474. package/lib/client-react/src/components.ts +4 -0
  475. package/lib/client-react/src/conversation-components.ts +138 -0
  476. package/lib/client-react/src/index.ts +47 -1
  477. package/lib/code-mode/dist/index.d.ts.map +1 -1
  478. package/lib/code-mode/dist/index.js +2 -0
  479. package/lib/code-mode/dist/index.js.map +1 -1
  480. package/lib/code-mode/package.json +1 -1
  481. package/lib/code-mode/src/index.ts +2 -0
  482. package/lib/code-mode-workflows/package.json +1 -1
  483. package/lib/context/dist/assemble.d.ts.map +1 -1
  484. package/lib/context/dist/assemble.js +25 -2
  485. package/lib/context/dist/assemble.js.map +1 -1
  486. package/lib/context/dist/cache.d.ts.map +1 -1
  487. package/lib/context/dist/cache.js +5 -0
  488. package/lib/context/dist/cache.js.map +1 -1
  489. package/lib/context/dist/contracts.d.ts +5 -3
  490. package/lib/context/dist/contracts.d.ts.map +1 -1
  491. package/lib/context/dist/contracts.js.map +1 -1
  492. package/lib/context/package.json +1 -1
  493. package/lib/context/src/assemble.ts +18 -2
  494. package/lib/context/src/cache.ts +3 -0
  495. package/lib/context/src/contracts.ts +5 -3
  496. package/lib/core/dist/authorization-audit.d.ts +41 -0
  497. package/lib/core/dist/authorization-audit.d.ts.map +1 -0
  498. package/lib/core/dist/authorization-audit.js +103 -0
  499. package/lib/core/dist/authorization-audit.js.map +1 -0
  500. package/lib/core/dist/authorization.d.ts +69 -0
  501. package/lib/core/dist/authorization.d.ts.map +1 -0
  502. package/lib/core/dist/authorization.js +156 -0
  503. package/lib/core/dist/authorization.js.map +1 -0
  504. package/lib/core/dist/contracts.d.ts +19 -2
  505. package/lib/core/dist/contracts.d.ts.map +1 -1
  506. package/lib/core/dist/contracts.js.map +1 -1
  507. package/lib/core/dist/errors.d.ts +1 -1
  508. package/lib/core/dist/errors.d.ts.map +1 -1
  509. package/lib/core/dist/errors.js.map +1 -1
  510. package/lib/core/dist/index.d.ts +2 -0
  511. package/lib/core/dist/index.d.ts.map +1 -1
  512. package/lib/core/dist/index.js +2 -0
  513. package/lib/core/dist/index.js.map +1 -1
  514. package/lib/core/package.json +1 -1
  515. package/lib/core/src/authorization-audit.ts +93 -0
  516. package/lib/core/src/authorization.ts +148 -0
  517. package/lib/core/src/contracts.ts +18 -4
  518. package/lib/core/src/errors.ts +1 -1
  519. package/lib/core/src/index.ts +4 -0
  520. package/lib/exporter-otlp/dist/authorization.d.ts +22 -0
  521. package/lib/exporter-otlp/dist/authorization.d.ts.map +1 -0
  522. package/lib/exporter-otlp/dist/authorization.js +78 -0
  523. package/lib/exporter-otlp/dist/authorization.js.map +1 -0
  524. package/lib/exporter-otlp/dist/opentelemetry.d.ts +1 -0
  525. package/lib/exporter-otlp/dist/opentelemetry.d.ts.map +1 -1
  526. package/lib/exporter-otlp/dist/opentelemetry.js +1 -0
  527. package/lib/exporter-otlp/dist/opentelemetry.js.map +1 -1
  528. package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
  529. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
  530. package/lib/exporter-otlp/dist/signals.js +2 -2
  531. package/lib/exporter-otlp/dist/signals.js.map +1 -1
  532. package/lib/exporter-otlp/package.json +1 -1
  533. package/lib/exporter-otlp/src/authorization.ts +70 -0
  534. package/lib/exporter-otlp/src/opentelemetry.ts +2 -0
  535. package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
  536. package/lib/exporter-otlp/src/signals.ts +2 -2
  537. package/lib/files/package.json +1 -1
  538. package/lib/guardrails/package.json +1 -1
  539. package/lib/helpers/dist/configuration.d.ts.map +1 -1
  540. package/lib/helpers/dist/configuration.js +18 -5
  541. package/lib/helpers/dist/configuration.js.map +1 -1
  542. package/lib/helpers/package.json +1 -1
  543. package/lib/helpers/src/configuration.ts +14 -6
  544. package/lib/keys/dist/conformance.d.ts.map +1 -1
  545. package/lib/keys/dist/conformance.js +17 -7
  546. package/lib/keys/dist/conformance.js.map +1 -1
  547. package/lib/keys/package.json +1 -1
  548. package/lib/keys/src/conformance.ts +17 -7
  549. package/lib/memory/dist/authorization.d.ts +10 -0
  550. package/lib/memory/dist/authorization.d.ts.map +1 -0
  551. package/lib/memory/dist/authorization.js +65 -0
  552. package/lib/memory/dist/authorization.js.map +1 -0
  553. package/lib/memory/dist/contracts.d.ts +3 -1
  554. package/lib/memory/dist/contracts.d.ts.map +1 -1
  555. package/lib/memory/dist/contracts.js.map +1 -1
  556. package/lib/memory/dist/index.d.ts.map +1 -1
  557. package/lib/memory/dist/index.js +49 -13
  558. package/lib/memory/dist/index.js.map +1 -1
  559. package/lib/memory/dist/native.d.ts +3 -1
  560. package/lib/memory/dist/native.d.ts.map +1 -1
  561. package/lib/memory/dist/native.js +177 -33
  562. package/lib/memory/dist/native.js.map +1 -1
  563. package/lib/memory/package.json +1 -1
  564. package/lib/memory/src/authorization.ts +46 -0
  565. package/lib/memory/src/contracts.ts +3 -1
  566. package/lib/memory/src/index.ts +41 -17
  567. package/lib/memory/src/native.ts +122 -42
  568. package/lib/memory-remote/dist/index.d.ts +2 -1
  569. package/lib/memory-remote/dist/index.d.ts.map +1 -1
  570. package/lib/memory-remote/dist/index.js +38 -3
  571. package/lib/memory-remote/dist/index.js.map +1 -1
  572. package/lib/memory-remote/package.json +1 -1
  573. package/lib/memory-remote/src/index.ts +31 -5
  574. package/lib/observability/dist/validation.d.ts.map +1 -1
  575. package/lib/observability/dist/validation.js +35 -2
  576. package/lib/observability/dist/validation.js.map +1 -1
  577. package/lib/observability/package.json +1 -1
  578. package/lib/observability/src/validation.ts +19 -2
  579. package/lib/provider-anthropic/dist/index.d.ts.map +1 -1
  580. package/lib/provider-anthropic/dist/index.js +70 -3
  581. package/lib/provider-anthropic/dist/index.js.map +1 -1
  582. package/lib/provider-anthropic/package.json +1 -1
  583. package/lib/provider-anthropic/src/index.ts +58 -3
  584. package/lib/provider-openai/dist/index.d.ts +6 -3
  585. package/lib/provider-openai/dist/index.d.ts.map +1 -1
  586. package/lib/provider-openai/dist/index.js +129 -15
  587. package/lib/provider-openai/dist/index.js.map +1 -1
  588. package/lib/provider-openai/package.json +1 -1
  589. package/lib/provider-openai/src/index.ts +112 -19
  590. package/lib/rag/dist/catalog.d.ts +5 -0
  591. package/lib/rag/dist/catalog.d.ts.map +1 -0
  592. package/lib/rag/dist/catalog.js +39 -0
  593. package/lib/rag/dist/catalog.js.map +1 -0
  594. package/lib/rag/dist/contracts.d.ts +138 -0
  595. package/lib/rag/dist/contracts.d.ts.map +1 -0
  596. package/lib/rag/dist/contracts.js +2 -0
  597. package/lib/rag/dist/contracts.js.map +1 -0
  598. package/lib/rag/dist/host.d.ts +5 -0
  599. package/lib/rag/dist/host.d.ts.map +1 -0
  600. package/lib/rag/dist/host.js +5 -0
  601. package/lib/rag/dist/host.js.map +1 -0
  602. package/lib/rag/dist/http.d.ts +12 -0
  603. package/lib/rag/dist/http.d.ts.map +1 -0
  604. package/lib/rag/dist/http.js +102 -0
  605. package/lib/rag/dist/http.js.map +1 -0
  606. package/lib/rag/dist/index.d.ts +11 -0
  607. package/lib/rag/dist/index.d.ts.map +1 -0
  608. package/lib/rag/dist/index.js +10 -0
  609. package/lib/rag/dist/index.js.map +1 -0
  610. package/lib/rag/dist/ingestion.d.ts +66 -0
  611. package/lib/rag/dist/ingestion.d.ts.map +1 -0
  612. package/lib/rag/dist/ingestion.js +200 -0
  613. package/lib/rag/dist/ingestion.js.map +1 -0
  614. package/lib/rag/dist/loaders.d.ts +59 -0
  615. package/lib/rag/dist/loaders.d.ts.map +1 -0
  616. package/lib/rag/dist/loaders.js +128 -0
  617. package/lib/rag/dist/loaders.js.map +1 -0
  618. package/lib/rag/dist/metrics.d.ts +24 -0
  619. package/lib/rag/dist/metrics.d.ts.map +1 -0
  620. package/lib/rag/dist/metrics.js +30 -0
  621. package/lib/rag/dist/metrics.js.map +1 -0
  622. package/lib/rag/dist/models.d.ts +21 -0
  623. package/lib/rag/dist/models.d.ts.map +1 -0
  624. package/lib/rag/dist/models.js +55 -0
  625. package/lib/rag/dist/models.js.map +1 -0
  626. package/lib/rag/dist/native.d.ts +11 -0
  627. package/lib/rag/dist/native.d.ts.map +1 -0
  628. package/lib/rag/dist/native.js +107 -0
  629. package/lib/rag/dist/native.js.map +1 -0
  630. package/lib/rag/dist/retrieval.d.ts +21 -0
  631. package/lib/rag/dist/retrieval.d.ts.map +1 -0
  632. package/lib/rag/dist/retrieval.js +149 -0
  633. package/lib/rag/dist/retrieval.js.map +1 -0
  634. package/lib/rag/dist/tool.d.ts +13 -0
  635. package/lib/rag/dist/tool.d.ts.map +1 -0
  636. package/lib/rag/dist/tool.js +27 -0
  637. package/lib/rag/dist/tool.js.map +1 -0
  638. package/lib/rag/dist/validation.d.ts +29 -0
  639. package/lib/rag/dist/validation.d.ts.map +1 -0
  640. package/lib/rag/dist/validation.js +94 -0
  641. package/lib/rag/dist/validation.js.map +1 -0
  642. package/lib/rag/dist/vectors.d.ts +15 -0
  643. package/lib/rag/dist/vectors.d.ts.map +1 -0
  644. package/lib/rag/dist/vectors.js +79 -0
  645. package/lib/rag/dist/vectors.js.map +1 -0
  646. package/lib/rag/package.json +5 -0
  647. package/lib/rag/src/catalog.ts +28 -0
  648. package/lib/rag/src/contracts.ts +76 -0
  649. package/lib/rag/src/host.ts +4 -0
  650. package/lib/rag/src/http.ts +38 -0
  651. package/lib/rag/src/index.ts +10 -0
  652. package/lib/rag/src/ingestion.ts +151 -0
  653. package/lib/rag/src/loaders.ts +85 -0
  654. package/lib/rag/src/metrics.ts +23 -0
  655. package/lib/rag/src/models.ts +41 -0
  656. package/lib/rag/src/native.ts +65 -0
  657. package/lib/rag/src/retrieval.ts +95 -0
  658. package/lib/rag/src/tool.ts +23 -0
  659. package/lib/rag/src/validation.ts +62 -0
  660. package/lib/rag/src/vectors.ts +55 -0
  661. package/lib/runtime/dist/agent.d.ts +15 -1
  662. package/lib/runtime/dist/agent.d.ts.map +1 -1
  663. package/lib/runtime/dist/agent.js +65 -4
  664. package/lib/runtime/dist/agent.js.map +1 -1
  665. package/lib/runtime/dist/checkpoint.d.ts +131 -0
  666. package/lib/runtime/dist/checkpoint.d.ts.map +1 -0
  667. package/lib/runtime/dist/checkpoint.js +203 -0
  668. package/lib/runtime/dist/checkpoint.js.map +1 -0
  669. package/lib/runtime/dist/handoffs.d.ts +12 -0
  670. package/lib/runtime/dist/handoffs.d.ts.map +1 -0
  671. package/lib/runtime/dist/handoffs.js +28 -0
  672. package/lib/runtime/dist/handoffs.js.map +1 -0
  673. package/lib/runtime/dist/history.d.ts +27 -0
  674. package/lib/runtime/dist/history.d.ts.map +1 -0
  675. package/lib/runtime/dist/history.js +106 -0
  676. package/lib/runtime/dist/history.js.map +1 -0
  677. package/lib/runtime/dist/hooks.d.ts +11 -2
  678. package/lib/runtime/dist/hooks.d.ts.map +1 -1
  679. package/lib/runtime/dist/hooks.js +1 -1
  680. package/lib/runtime/dist/hooks.js.map +1 -1
  681. package/lib/runtime/dist/index.d.ts +5 -2
  682. package/lib/runtime/dist/index.d.ts.map +1 -1
  683. package/lib/runtime/dist/index.js.map +1 -1
  684. package/lib/runtime/dist/managed-guards.d.ts +1 -0
  685. package/lib/runtime/dist/managed-guards.d.ts.map +1 -1
  686. package/lib/runtime/dist/managed-guards.js +2 -0
  687. package/lib/runtime/dist/managed-guards.js.map +1 -1
  688. package/lib/runtime/dist/recording.d.ts +31 -0
  689. package/lib/runtime/dist/recording.d.ts.map +1 -0
  690. package/lib/runtime/dist/recording.js +2 -0
  691. package/lib/runtime/dist/recording.js.map +1 -0
  692. package/lib/runtime/dist/router.d.ts.map +1 -1
  693. package/lib/runtime/dist/router.js +1 -0
  694. package/lib/runtime/dist/router.js.map +1 -1
  695. package/lib/runtime/dist/runtime.d.ts +100 -5
  696. package/lib/runtime/dist/runtime.d.ts.map +1 -1
  697. package/lib/runtime/dist/runtime.js +1207 -284
  698. package/lib/runtime/dist/runtime.js.map +1 -1
  699. package/lib/runtime/package.json +1 -1
  700. package/lib/runtime/src/agent.ts +58 -5
  701. package/lib/runtime/src/checkpoint.ts +236 -0
  702. package/lib/runtime/src/handoffs.ts +22 -0
  703. package/lib/runtime/src/history.ts +92 -0
  704. package/lib/runtime/src/hooks.ts +8 -3
  705. package/lib/runtime/src/index.ts +7 -2
  706. package/lib/runtime/src/managed-guards.ts +3 -0
  707. package/lib/runtime/src/recording.ts +31 -0
  708. package/lib/runtime/src/router.ts +1 -0
  709. package/lib/runtime/src/runtime.ts +838 -69
  710. package/lib/sandbox/package.json +1 -1
  711. package/lib/sdk/package.json +1 -1
  712. package/lib/server/dist/approval-reconciliation.d.ts +72 -0
  713. package/lib/server/dist/approval-reconciliation.d.ts.map +1 -0
  714. package/lib/server/dist/approval-reconciliation.js +257 -0
  715. package/lib/server/dist/approval-reconciliation.js.map +1 -0
  716. package/lib/server/dist/authorization.d.ts +20 -0
  717. package/lib/server/dist/authorization.d.ts.map +1 -0
  718. package/lib/server/dist/authorization.js +136 -0
  719. package/lib/server/dist/authorization.js.map +1 -0
  720. package/lib/server/dist/conversation-recovery.d.ts +42 -0
  721. package/lib/server/dist/conversation-recovery.d.ts.map +1 -0
  722. package/lib/server/dist/conversation-recovery.js +90 -0
  723. package/lib/server/dist/conversation-recovery.js.map +1 -0
  724. package/lib/server/dist/index.d.ts +52 -4
  725. package/lib/server/dist/index.d.ts.map +1 -1
  726. package/lib/server/dist/index.js +899 -85
  727. package/lib/server/dist/index.js.map +1 -1
  728. package/lib/server/dist/inspector-bundle.d.ts +1 -1
  729. package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
  730. package/lib/server/dist/inspector-bundle.js +4 -4
  731. package/lib/server/dist/inspector-bundle.js.map +1 -1
  732. package/lib/server/dist/thread-compaction.d.ts +33 -0
  733. package/lib/server/dist/thread-compaction.d.ts.map +1 -0
  734. package/lib/server/dist/thread-compaction.js +116 -0
  735. package/lib/server/dist/thread-compaction.js.map +1 -0
  736. package/lib/server/package.json +1 -1
  737. package/lib/server/src/approval-reconciliation.ts +226 -0
  738. package/lib/server/src/authorization.ts +99 -0
  739. package/lib/server/src/conversation-recovery.ts +85 -0
  740. package/lib/server/src/index.ts +680 -81
  741. package/lib/server/src/inspector-bundle.ts +4 -4
  742. package/lib/server/src/thread-compaction.ts +97 -0
  743. package/lib/server-node/dist/hardening.d.ts +6 -0
  744. package/lib/server-node/dist/hardening.d.ts.map +1 -1
  745. package/lib/server-node/dist/hardening.js +25 -0
  746. package/lib/server-node/dist/hardening.js.map +1 -1
  747. package/lib/server-node/dist/index.d.ts +6 -1
  748. package/lib/server-node/dist/index.d.ts.map +1 -1
  749. package/lib/server-node/dist/index.js +7 -3
  750. package/lib/server-node/dist/index.js.map +1 -1
  751. package/lib/server-node/dist/production.d.ts +6 -1
  752. package/lib/server-node/dist/production.d.ts.map +1 -1
  753. package/lib/server-node/dist/production.js +7 -3
  754. package/lib/server-node/dist/production.js.map +1 -1
  755. package/lib/server-node/package.json +1 -1
  756. package/lib/server-node/src/hardening.ts +25 -0
  757. package/lib/server-node/src/index.ts +12 -3
  758. package/lib/server-node/src/production.ts +12 -3
  759. package/lib/skills/package.json +1 -1
  760. package/lib/storage/package.json +1 -1
  761. package/lib/storage-contracts/dist/conversation-contracts.d.ts +298 -0
  762. package/lib/storage-contracts/dist/conversation-contracts.d.ts.map +1 -0
  763. package/lib/storage-contracts/dist/conversation-contracts.js +701 -0
  764. package/lib/storage-contracts/dist/conversation-contracts.js.map +1 -0
  765. package/lib/storage-contracts/dist/frontend-tools.d.ts +114 -0
  766. package/lib/storage-contracts/dist/frontend-tools.d.ts.map +1 -0
  767. package/lib/storage-contracts/dist/frontend-tools.js +335 -0
  768. package/lib/storage-contracts/dist/frontend-tools.js.map +1 -0
  769. package/lib/storage-contracts/dist/index.d.ts +2 -0
  770. package/lib/storage-contracts/dist/index.d.ts.map +1 -1
  771. package/lib/storage-contracts/dist/index.js +2 -0
  772. package/lib/storage-contracts/dist/index.js.map +1 -1
  773. package/lib/storage-contracts/dist/run-records.d.ts +9 -1
  774. package/lib/storage-contracts/dist/run-records.d.ts.map +1 -1
  775. package/lib/storage-contracts/dist/run-records.js +45 -17
  776. package/lib/storage-contracts/dist/run-records.js.map +1 -1
  777. package/lib/storage-contracts/package.json +1 -1
  778. package/lib/storage-contracts/src/conversation-contracts.ts +546 -0
  779. package/lib/storage-contracts/src/frontend-tools.ts +233 -0
  780. package/lib/storage-contracts/src/index.ts +2 -0
  781. package/lib/storage-contracts/src/run-records.ts +44 -18
  782. package/lib/storage-postgres/dist/postgres.d.ts +2 -2
  783. package/lib/storage-postgres/dist/postgres.d.ts.map +1 -1
  784. package/lib/storage-postgres/dist/postgres.js.map +1 -1
  785. package/lib/storage-postgres/dist/store.d.ts +2 -2
  786. package/lib/storage-postgres/dist/store.d.ts.map +1 -1
  787. package/lib/storage-postgres/dist/store.js +4 -1
  788. package/lib/storage-postgres/dist/store.js.map +1 -1
  789. package/lib/storage-postgres/package.json +1 -1
  790. package/lib/storage-postgres/src/postgres.ts +2 -2
  791. package/lib/storage-postgres/src/store.ts +6 -3
  792. package/lib/storage-sql/dist/conversation-database.d.ts +25 -0
  793. package/lib/storage-sql/dist/conversation-database.d.ts.map +1 -0
  794. package/lib/storage-sql/dist/conversation-database.js +388 -0
  795. package/lib/storage-sql/dist/conversation-database.js.map +1 -0
  796. package/lib/storage-sql/dist/conversation-persistence.d.ts +89 -0
  797. package/lib/storage-sql/dist/conversation-persistence.d.ts.map +1 -0
  798. package/lib/storage-sql/dist/conversation-persistence.js +113 -0
  799. package/lib/storage-sql/dist/conversation-persistence.js.map +1 -0
  800. package/lib/storage-sql/dist/document/conversation-rows.d.ts +5 -0
  801. package/lib/storage-sql/dist/document/conversation-rows.d.ts.map +1 -0
  802. package/lib/storage-sql/dist/document/conversation-rows.js +177 -0
  803. package/lib/storage-sql/dist/document/conversation-rows.js.map +1 -0
  804. package/lib/storage-sql/dist/document/store.d.ts +3 -3
  805. package/lib/storage-sql/dist/document/store.d.ts.map +1 -1
  806. package/lib/storage-sql/dist/document/store.js +7 -1
  807. package/lib/storage-sql/dist/document/store.js.map +1 -1
  808. package/lib/storage-sql/dist/host.d.ts +4 -0
  809. package/lib/storage-sql/dist/host.d.ts.map +1 -1
  810. package/lib/storage-sql/dist/host.js +2 -0
  811. package/lib/storage-sql/dist/host.js.map +1 -1
  812. package/lib/storage-sql/dist/thread-compaction.d.ts +8 -0
  813. package/lib/storage-sql/dist/thread-compaction.d.ts.map +1 -0
  814. package/lib/storage-sql/dist/thread-compaction.js +130 -0
  815. package/lib/storage-sql/dist/thread-compaction.js.map +1 -0
  816. package/lib/storage-sql/package.json +1 -1
  817. package/lib/storage-sql/src/conversation-database.ts +323 -0
  818. package/lib/storage-sql/src/conversation-persistence.ts +166 -0
  819. package/lib/storage-sql/src/document/conversation-rows.ts +162 -0
  820. package/lib/storage-sql/src/document/store.ts +11 -4
  821. package/lib/storage-sql/src/host.ts +4 -0
  822. package/lib/storage-sql/src/thread-compaction.ts +110 -0
  823. package/lib/storage-sqlite/dist/sqlite-database.d.ts +4 -1
  824. package/lib/storage-sqlite/dist/sqlite-database.d.ts.map +1 -1
  825. package/lib/storage-sqlite/dist/sqlite-database.js +5 -1
  826. package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -1
  827. package/lib/storage-sqlite/dist/sqlite-worker.js +6 -0
  828. package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -1
  829. package/lib/storage-sqlite/dist/sqlite.d.ts +2 -2
  830. package/lib/storage-sqlite/dist/sqlite.d.ts.map +1 -1
  831. package/lib/storage-sqlite/dist/sqlite.js +3 -1
  832. package/lib/storage-sqlite/dist/sqlite.js.map +1 -1
  833. package/lib/storage-sqlite/package.json +1 -1
  834. package/lib/storage-sqlite/src/sqlite-database.ts +6 -2
  835. package/lib/storage-sqlite/src/sqlite-worker.ts +3 -1
  836. package/lib/storage-sqlite/src/sqlite.ts +5 -3
  837. package/lib/terminal/package.json +1 -1
  838. package/lib/testing/dist/index.d.ts +5 -1
  839. package/lib/testing/dist/index.d.ts.map +1 -1
  840. package/lib/testing/dist/index.js +14 -3
  841. package/lib/testing/dist/index.js.map +1 -1
  842. package/lib/testing/package.json +1 -1
  843. package/lib/testing/src/index.ts +14 -4
  844. package/lib/threads/dist/authorization.d.ts +10 -0
  845. package/lib/threads/dist/authorization.d.ts.map +1 -0
  846. package/lib/threads/dist/authorization.js +94 -0
  847. package/lib/threads/dist/authorization.js.map +1 -0
  848. package/lib/threads/dist/compaction.d.ts +55 -0
  849. package/lib/threads/dist/compaction.d.ts.map +1 -0
  850. package/lib/threads/dist/compaction.js +279 -0
  851. package/lib/threads/dist/compaction.js.map +1 -0
  852. package/lib/threads/dist/history.d.ts +44 -0
  853. package/lib/threads/dist/history.d.ts.map +1 -0
  854. package/lib/threads/dist/history.js +134 -0
  855. package/lib/threads/dist/history.js.map +1 -0
  856. package/lib/threads/dist/index.d.ts +256 -0
  857. package/lib/threads/dist/index.d.ts.map +1 -0
  858. package/lib/threads/dist/index.js +640 -0
  859. package/lib/threads/dist/index.js.map +1 -0
  860. package/lib/threads/dist/media.d.ts +14 -0
  861. package/lib/threads/dist/media.d.ts.map +1 -0
  862. package/lib/threads/dist/media.js +25 -0
  863. package/lib/threads/dist/media.js.map +1 -0
  864. package/lib/threads/package.json +5 -0
  865. package/lib/threads/src/authorization.ts +68 -0
  866. package/lib/threads/src/compaction.ts +225 -0
  867. package/lib/threads/src/history.ts +100 -0
  868. package/lib/threads/src/index.ts +625 -0
  869. package/lib/threads/src/media.ts +27 -0
  870. package/lib/tools/dist/approval-binding.d.ts +17 -0
  871. package/lib/tools/dist/approval-binding.d.ts.map +1 -0
  872. package/lib/tools/dist/approval-binding.js +29 -0
  873. package/lib/tools/dist/approval-binding.js.map +1 -0
  874. package/lib/tools/dist/batch.d.ts.map +1 -1
  875. package/lib/tools/dist/batch.js +18 -0
  876. package/lib/tools/dist/batch.js.map +1 -1
  877. package/lib/tools/dist/continuation.d.ts +39 -0
  878. package/lib/tools/dist/continuation.d.ts.map +1 -0
  879. package/lib/tools/dist/continuation.js +56 -0
  880. package/lib/tools/dist/continuation.js.map +1 -0
  881. package/lib/tools/dist/host.d.ts +3 -0
  882. package/lib/tools/dist/host.d.ts.map +1 -1
  883. package/lib/tools/dist/host.js +3 -0
  884. package/lib/tools/dist/host.js.map +1 -1
  885. package/lib/tools/dist/index.d.ts +23 -1
  886. package/lib/tools/dist/index.d.ts.map +1 -1
  887. package/lib/tools/dist/index.js +61 -7
  888. package/lib/tools/dist/index.js.map +1 -1
  889. package/lib/tools/package.json +1 -1
  890. package/lib/tools/src/approval-binding.ts +39 -0
  891. package/lib/tools/src/batch.ts +11 -0
  892. package/lib/tools/src/continuation.ts +64 -0
  893. package/lib/tools/src/host.ts +4 -0
  894. package/lib/tools/src/index.ts +72 -8
  895. package/lib/voice/package.json +1 -1
  896. package/lib/workflows/dist/agent-step.d.ts +3 -1
  897. package/lib/workflows/dist/agent-step.d.ts.map +1 -1
  898. package/lib/workflows/dist/agent-step.js +2 -1
  899. package/lib/workflows/dist/agent-step.js.map +1 -1
  900. package/lib/workflows/dist/agents.d.ts +3 -1
  901. package/lib/workflows/dist/agents.d.ts.map +1 -1
  902. package/lib/workflows/dist/agents.js +2 -1
  903. package/lib/workflows/dist/agents.js.map +1 -1
  904. package/lib/workflows/dist/authorization.d.ts +15 -0
  905. package/lib/workflows/dist/authorization.d.ts.map +1 -0
  906. package/lib/workflows/dist/authorization.js +69 -0
  907. package/lib/workflows/dist/authorization.js.map +1 -0
  908. package/lib/workflows/dist/children-coordinator.js +2 -2
  909. package/lib/workflows/dist/children-coordinator.js.map +1 -1
  910. package/lib/workflows/dist/children-runtime.d.ts +3 -0
  911. package/lib/workflows/dist/children-runtime.d.ts.map +1 -1
  912. package/lib/workflows/dist/children-runtime.js +207 -156
  913. package/lib/workflows/dist/children-runtime.js.map +1 -1
  914. package/lib/workflows/dist/graph-coordinator.js +2 -2
  915. package/lib/workflows/dist/graph-coordinator.js.map +1 -1
  916. package/lib/workflows/dist/lifecycle-runtime.d.ts +12 -1
  917. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
  918. package/lib/workflows/dist/lifecycle-runtime.js +85 -18
  919. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
  920. package/lib/workflows/dist/loop-runtime.d.ts.map +1 -1
  921. package/lib/workflows/dist/loop-runtime.js +44 -20
  922. package/lib/workflows/dist/loop-runtime.js.map +1 -1
  923. package/lib/workflows/dist/runtime.d.ts +3 -0
  924. package/lib/workflows/dist/runtime.d.ts.map +1 -1
  925. package/lib/workflows/dist/runtime.js +43 -12
  926. package/lib/workflows/dist/runtime.js.map +1 -1
  927. package/lib/workflows/dist/saga-runtime.d.ts.map +1 -1
  928. package/lib/workflows/dist/saga-runtime.js +51 -20
  929. package/lib/workflows/dist/saga-runtime.js.map +1 -1
  930. package/lib/workflows/dist/scheduled.d.ts.map +1 -1
  931. package/lib/workflows/dist/scheduled.js +32 -9
  932. package/lib/workflows/dist/scheduled.js.map +1 -1
  933. package/lib/workflows/package.json +1 -1
  934. package/lib/workflows/src/agent-step.ts +5 -2
  935. package/lib/workflows/src/agents.ts +5 -2
  936. package/lib/workflows/src/authorization.ts +57 -0
  937. package/lib/workflows/src/children-coordinator.ts +2 -2
  938. package/lib/workflows/src/children-runtime.ts +30 -16
  939. package/lib/workflows/src/graph-coordinator.ts +2 -2
  940. package/lib/workflows/src/lifecycle-runtime.ts +80 -15
  941. package/lib/workflows/src/loop-runtime.ts +41 -17
  942. package/lib/workflows/src/runtime.ts +47 -12
  943. package/lib/workflows/src/saga-runtime.ts +47 -16
  944. package/lib/workflows/src/scheduled.ts +33 -12
  945. package/lib/workstream/package.json +1 -1
  946. package/llms-full.txt +18012 -360
  947. package/llms.txt +157 -1
  948. package/package.json +25 -1
  949. package/rag/host/index.d.ts +1 -0
  950. package/rag/host/index.js +1 -0
  951. package/rag/index.d.ts +1 -0
  952. package/rag/index.js +1 -0
  953. package/threads/index.d.ts +1 -0
  954. package/threads/index.js +1 -0
package/README.md CHANGED
@@ -123,6 +123,13 @@ Anthropic (`anthropicMessages` from `mayura/provider-anthropic`) and OpenAI-comp
123
123
  (`openAICompatibleChat` from `mayura/provider-openai`) are drop-in replacements for the model. The
124
124
  [quickstart](docs/quickstart.md) goes further: streaming, a durable workflow, and serving the agent over HTTP.
125
125
 
126
+ ## Runnable thread chat
127
+
128
+ From a repository checkout, run `pnpm build` then `node examples/thread-chat/server.mjs` and open the printed URL.
129
+ The [thread chat example](examples/thread-chat/README.md) wires React history and approval controls to SQLite-backed
130
+ runs: send a note, approve/reject the proposed write, or cancel. It works without a model API key and recovers a
131
+ waiting approval after page reload.
132
+
126
133
  ## CLI
127
134
 
128
135
  The `mayura` command comes with the package. Start a new project with the interactive wizard: pick a starter, pick a
@@ -183,3 +190,6 @@ Mayura is created by **Aryabh** ([dev@rokad.co](mailto:dev@rokad.co)). The team
183
190
 
184
191
  Mayura is open source under the [Apache-2.0 license](LICENSE). See [CONTRIBUTING.md](CONTRIBUTING.md) to contribute,
185
192
  [SECURITY.md](SECURITY.md) to report a vulnerability and [SUPPORT.md](SUPPORT.md) for support.
193
+
194
+
195
+ The release-1.2 development branch includes the offline `examples/ag-ui-chat` notebook and a copy-in React registry (`mayura add ui --list`). See [copy-in UI](docs/guides/copy-in-ui.md) and [AG-UI](docs/guides/ag-ui.md). Local Windows tests, builds and package checks pass. V1.2 remains unreleased; see the [release validation status](docs/guides/release-readiness.md) for results and remaining qualifications.
@@ -0,0 +1 @@
1
+ export * from '../lib/ag-ui/dist/index.js';
package/ag-ui/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../lib/ag-ui/dist/index.js';
@@ -0,0 +1 @@
1
+ export * from '../lib/authz/dist/index.js';
package/authz/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../lib/authz/dist/index.js';
package/docs/README.md CHANGED
@@ -11,6 +11,7 @@ Mayura is a TypeScript framework for building AI agents, typed tools and durable
11
11
  - [Introduction](introduction.md): what Mayura is and how its parts fit together.
12
12
  - [Quickstart](quickstart.md): create a project, or add a first agent to your own.
13
13
  - [Installation](installation.md): requirements, optional packages and TypeScript settings.
14
+ - [V1.2 release validation status](guides/release-readiness.md): completed local and CI checks, limitations and remaining release gates.
14
15
  - [Using Mayura with AI coding agents](ai-agents.md): documentation your assistant can read offline.
15
16
 
16
17
  ## Concepts
@@ -23,15 +24,21 @@ Mayura is a TypeScript framework for building AI agents, typed tools and durable
23
24
  - [Costs and budgets](concepts/costs-and-budgets.md): prices, cost caps and shared budgets.
24
25
  - [Workflows](concepts/workflows.md): multi-step work, in memory or durable.
25
26
 
27
+ - [Framework starters](guides/framework-starters.md): six notebook applications with scoped threads, exact approvals and workers.
28
+
29
+ - [Retrieval augmented generation](guides/rag.md): scoped evidence, durable ingestion, vector stores and reranking.
30
+
26
31
  ## Agents and models
27
32
 
28
33
  - [Model providers](guides/model-providers.md): OpenAI, Anthropic and OpenAI-compatible providers.
29
34
  - [Model registry](guides/model-registry.md): models as provider/model from @mayurajs provider packages, with prices, retries and chains.
35
+ - [AI gateways](guides/ai-gateways.md): explicit gateway credentials, scoped models, discovery and reported costs.
30
36
  - [Model routing](guides/model-routing.md): failover between providers.
31
37
  - [Streaming](guides/streaming.md): show an answer while it is written.
32
38
  - [Vision](guides/vision.md): agents that see images and PDFs, from the input or from tools.
33
39
  - [Voice](guides/voice.md): transcribe speech and speak text, with prices and per-call bounds.
34
40
  - [Child agents](guides/child-agents.md): agents that delegate to other agents.
41
+ - [Agent handoffs](guides/agent-handoffs.md): transfer a conversation with a continuing budget and separate agent permissions.
35
42
  - [Skills](guides/skills.md): `SKILL.md` folders an agent loads on demand.
36
43
  - [MCP tools](guides/mcp.md): call tools on an MCP server.
37
44
  - [Terminal chat and commands](guides/terminal.md): run an agent in a terminal.
@@ -49,7 +56,9 @@ Mayura is a TypeScript framework for building AI agents, typed tools and durable
49
56
  ## Data, safety and extensions
50
57
 
51
58
  - [Storage](guides/storage.md): SQLite, PostgreSQL, libSQL (Turso), MySQL, MongoDB, D1 and DynamoDB.
59
+ - [Threads](guides/threads.md): keep users' conversations and run each message with the conversation so far.
52
60
  - [Memory and context](guides/memory-and-context.md): what an agent remembers and sees.
61
+ - [Fine-grained authorization](guides/authorization.md): scoped resource access with the core policy contract and built-in RBAC.
53
62
  - [Guardrails](guides/guardrails.md): check, block or redact inputs and outputs.
54
63
  - [Lifecycle hooks](guides/lifecycle-hooks.md): code that can stop a run at defined points.
55
64
  - [Artifacts](guides/artifacts.md): store files that runs produce.
@@ -62,8 +71,10 @@ Mayura is a TypeScript framework for building AI agents, typed tools and durable
62
71
  ## Serve, observe and deploy
63
72
 
64
73
  - [Server and client](guides/server-and-client.md): serve agents and workflows over HTTP.
74
+ - [AG-UI adapter](guides/ag-ui.md): scoped run events, stored messages, state snapshots/deltas, permissioned durable frontend tools with native-owner recovery and approval interrupts with the experimental AG-UI 1.0 profile.
65
75
  - [Authentication and API keys](guides/authentication.md): tokens from identity providers and API keys on your own storage, mapped to what callers may do.
66
76
  - [React](guides/react.md): hooks, components and forms.
77
+ - [Copy-in UI components](guides/copy-in-ui.md): versioned source registry, safe CLI installation and component gallery.
67
78
  - [Observability](guides/observability.md): events, tracing and OpenTelemetry.
68
79
  - [Operator console](guides/operator-console.md): a UI for runs, workflows and approvals.
69
80
  - [Deployment](guides/deployment.md): run Mayura in production.
@@ -77,6 +88,157 @@ Mayura is a TypeScript framework for building AI agents, typed tools and durable
77
88
  - [mayura deploy](cli/deploy.md): deploy with Docker, Compose, Kubernetes or a platform package.
78
89
  - [Operator commands](cli/operations.md): manage a running server.
79
90
 
91
+ <!-- integrations:start (generated by scripts/integrations-index.mjs) -->
92
+
93
+ ## Integrations: vector stores
94
+
95
+ - [Chroma](integrations/vector-chroma.md): Scoped native vector storage for chroma.
96
+ - [Libsql](integrations/vector-libsql.md): Scoped native vector storage for libsql.
97
+ - [Pgvector](integrations/vector-pgvector.md): Scoped native vector storage for pgvector.
98
+ - [Pinecone](integrations/vector-pinecone.md): Scoped native vector storage for pinecone.
99
+ - [Qdrant](integrations/vector-qdrant.md): Scoped native vector storage for qdrant.
100
+ - [Weaviate](integrations/vector-weaviate.md): Scoped native vector storage for weaviate.
101
+
102
+ ## Integrations: rerankers
103
+
104
+ - [Cohere](integrations/reranker-cohere.md): Bounded indexed-result reranking with cohere.
105
+ - [Jina](integrations/reranker-jina.md): Bounded indexed-result reranking with jina.
106
+ - [Voyage](integrations/reranker-voyage.md): Bounded indexed-result reranking with voyage.
107
+
108
+ ## Integrations: ai gateways
109
+
110
+ - [Cloudflare AI Gateway](integrations/gateway-cloudflare.md): Cloudflare AI Gateway models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
111
+ - [Helicone](integrations/gateway-helicone.md): Helicone models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
112
+ - [LiteLLM](integrations/gateway-litellm.md): LiteLLM models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
113
+ - [OpenRouter](integrations/gateway-openrouter.md): OpenRouter models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
114
+ - [Portkey](integrations/gateway-portkey.md): Portkey models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
115
+ - [Vercel AI Gateway](integrations/gateway-vercel.md): Vercel AI Gateway models for Mayura, with explicit credentials, bounded calls and gateway cost accounting.
116
+
117
+ ## Integrations: model providers
118
+
119
+ - [Amazon Web Services](integrations/provider-bedrock.md): Amazon Bedrock models for Mayura, through the official AWS SDK and the Converse API.
120
+ - [Anthropic](integrations/provider-anthropic.md): Anthropic Claude models for Mayura, through the official Anthropic SDK.
121
+ - [Google](integrations/provider-google.md): Google Gemini models for Mayura, through the official Google Gen AI SDK.
122
+ - [Groq](integrations/provider-groq.md): Groq models for Mayura, through the official Groq SDK.
123
+ - [Microsoft Azure](integrations/provider-azure.md): Azure OpenAI models for Mayura, through the official OpenAI SDK and Azure's v1 API.
124
+ - [Mistral AI](integrations/provider-mistral.md): Mistral models for Mayura, through the official Mistral SDK.
125
+ - [Ollama](integrations/provider-ollama.md): Ollama models for Mayura, local or in Ollama's cloud, through the official Ollama SDK.
126
+ - [OpenAI](integrations/provider-openai.md): OpenAI models for Mayura, through the official OpenAI SDK.
127
+
128
+ ## Integrations: voice
129
+
130
+ - [AssemblyAI](integrations/voice-assemblyai.md): AssemblyAI speech-to-text for Mayura's voice registry, over AssemblyAI's HTTP API.
131
+ - [Cartesia](integrations/voice-cartesia.md): Cartesia speech-to-text and text-to-speech for Mayura's voice registry, over Cartesia's HTTP API.
132
+ - [Deepgram](integrations/voice-deepgram.md): Deepgram speech-to-text and text-to-speech for Mayura's voice registry, over Deepgram's HTTP API.
133
+ - [ElevenLabs](integrations/voice-elevenlabs.md): ElevenLabs speech-to-text and text-to-speech for Mayura's voice registry, over ElevenLabs' HTTP API.
134
+ - [Google Cloud](integrations/voice-google.md): Google Cloud Speech-to-Text and Text-to-Speech for Mayura's voice registry, over Google's HTTP APIs.
135
+ - [Microsoft Azure](integrations/voice-azure.md): Azure Speech transcription and text-to-speech for Mayura's voice registry, over Azure's HTTP APIs.
136
+ - [OpenAI](integrations/voice-openai.md): OpenAI speech-to-text and text-to-speech for Mayura's voice registry, through the official OpenAI SDK.
137
+
138
+ ## Integrations: storage
139
+
140
+ - [Amazon Web Services](integrations/storage-dynamodb.md): Mayura storage on Amazon DynamoDB, as optimistic transactions through the official AWS SDK.
141
+ - [Cloudflare](integrations/storage-d1.md): Mayura storage on Cloudflare D1, as optimistic transactions over a Worker's D1 binding.
142
+ - [MongoDB](integrations/storage-mongodb.md): Mayura storage on MongoDB, through the official MongoDB driver.
143
+ - [MySQL](integrations/storage-mysql.md): Mayura storage on MySQL 8, through mysql2.
144
+ - [Turso](integrations/storage-libsql.md): Mayura storage on libSQL (Turso, sqld or a local file), through the official libSQL client.
145
+
146
+ ## Integrations: files
147
+
148
+ - [Cloudflare](integrations/filestorage-r2.md): Cloudflare R2 through a Workers binding, for Mayura's file stores.
149
+ - [Files SDK](integrations/filestorage-files-sdk.md): Any Files SDK provider for Mayura's file stores.
150
+ - [Google Cloud](integrations/filestorage-gcs.md): Google Cloud Storage for Mayura's file stores, over the Cloud Storage JSON API.
151
+ - [Google Drive](integrations/filestorage-google-drive.md): Google Drive for Mayura's file stores, over the Drive API v3.
152
+ - [Mesa](integrations/filestorage-mesa.md): Mesa (mesa.dev), a versioned filesystem for agents, for Mayura's file stores.
153
+ - [Microsoft Azure](integrations/filestorage-azure-blob.md): Azure Blob Storage for Mayura's file stores, over the Blob REST API.
154
+ - [Turso](integrations/filestorage-agentfs.md): AgentFS (Turso's filesystem for agents) for Mayura's file stores.
155
+ - [Vercel](integrations/filestorage-vercel-blob.md): Vercel Blob for Mayura's file stores, over the Blob API with fetch.
156
+
157
+ ## Integrations: observability
158
+
159
+ - [Arize](integrations/observability-arize.md): Arize AX for Mayura's traces, with OpenInference attributes beside the GenAI ones.
160
+ - [Better Stack](integrations/observability-betterstack.md): Better Stack for Mayura's traces, over a source's OpenTelemetry endpoint.
161
+ - [Datadog](integrations/observability-datadog.md): Datadog APM or LLM Observability for Mayura's traces, over Datadog's OTLP intake.
162
+ - [Langfuse](integrations/observability-langfuse.md): Langfuse for Mayura's traces: agent runs, model calls and tool calls over Langfuse's OpenTelemetry endpoint.
163
+ - [LangSmith](integrations/observability-langsmith.md): LangSmith for Mayura's traces, with LangSmith's run types, over LangSmith's OpenTelemetry endpoint.
164
+ - [PostHog](integrations/observability-posthog.md): PostHog LLM analytics for Mayura's traces, over PostHog's OpenTelemetry endpoint for AI events.
165
+ - [Sentry](integrations/observability-sentry.md): Sentry for Mayura's traces, with Sentry's gen_ai span ops, over Sentry's OTLP endpoint.
166
+
167
+ ## Integrations: sandboxes
168
+
169
+ - [Apple](integrations/sandbox-apple-container.md): Apple container (macOS) sandboxes for mayura/sandbox, through the container command line.
170
+ - [AWS](integrations/sandbox-agentcore.md): Amazon Bedrock AgentCore Code Interpreter sessions as sandboxes for mayura/sandbox.
171
+ - [Cloudflare](integrations/sandbox-cloudflare.md): Cloudflare Sandboxes for mayura/sandbox, through the sandbox bridge Worker.
172
+ - [CodeSandbox](integrations/sandbox-codesandbox.md): CodeSandbox (Together) sandboxes for mayura/sandbox, through the CodeSandbox SDK.
173
+ - [Daytona](integrations/sandbox-daytona.md): Daytona sandboxes for mayura/sandbox, over Daytona's REST and toolbox APIs.
174
+ - [E2B](integrations/sandbox-e2b.md): E2B sandboxes for mayura/sandbox, over E2B's HTTP APIs.
175
+ - [E2B](integrations/sandbox-e2b-desktop.md): E2B Desktop sandboxes for mayura/sandbox: a Linux desktop agents can see and use.
176
+ - [Fly.io](integrations/sandbox-fly.md): Fly.io Machines as sandboxes for mayura/sandbox, over the Machines API.
177
+ - [Modal](integrations/sandbox-modal.md): Modal Sandboxes for mayura/sandbox, through Modal's JavaScript SDK.
178
+ - [Northflank](integrations/sandbox-northflank.md): Northflank sandboxes for mayura/sandbox, through Northflank's JavaScript client.
179
+ - [Railway](integrations/sandbox-railway.md): Railway Sandboxes for mayura/sandbox, through Railway's TypeScript SDK.
180
+ - [Vercel](integrations/sandbox-vercel.md): Vercel Sandbox for mayura/sandbox, over Vercel's REST API.
181
+
182
+ ## Integrations: browsers
183
+
184
+ - [agent-browser](integrations/browser-agent-browser.md): Vercel Labs' agent-browser CLI as tools on a mayura/browser browser.
185
+ - [Anchor Browser](integrations/browser-anchor.md): Anchor Browser browsers for mayura/browser, over its sessions API.
186
+ - [Browser Use](integrations/browser-browser-use.md): Browser Use cloud browsers for mayura/browser, over its browsers API.
187
+ - [Browserbase](integrations/browser-browserbase.md): Browserbase browsers for mayura/browser, over its sessions API.
188
+ - [Browserless](integrations/browser-browserless.md): Browserless browsers for mayura/browser, hosted or self-hosted.
189
+ - [BrowserView](integrations/browser-browserview.md): BrowserView browsers for mayura/browser, over its sessions API.
190
+ - [Cloudflare](integrations/browser-cloudflare.md): Cloudflare Browser Run browsers for mayura/browser, over its CDP endpoint.
191
+ - [Cloudflare](integrations/cloudflare-quick-action.md): Cloudflare Browser Run quick actions (markdown, links, scrape, screenshots, PDFs, JSON, crawls) as a client and as tools.
192
+ - [Firecrawl](integrations/browser-firecrawl.md): Firecrawl browsers for mayura/browser, and Firecrawl's scrape, map, search, crawl and extract as tools.
193
+ - [Hyperbrowser](integrations/browser-hyperbrowser.md): Hyperbrowser browsers for mayura/browser, over its sessions API.
194
+ - [Kernel](integrations/browser-kernel.md): Kernel browsers for mayura/browser, over its browsers API.
195
+ - [Mayura](integrations/browser-viewer.md): A live viewer for mayura/browser browsers: a screencast of the active tab, shared by link, optionally interactive.
196
+ - [Stagehand](integrations/browser-stagehand.md): Stagehand's act, extract and observe as tools on a mayura/browser browser.
197
+ - [Steel](integrations/browser-steel.md): Steel browsers for mayura/browser, over its sessions API.
198
+
199
+ ## Integrations: authorization policies
200
+
201
+ - [Cedar](integrations/authz-cedar.md): Scoped local Cedar authorization with pinned policies, trusted attributes and core audit integration.
202
+ - [HTTP authorization](integrations/authz-http.md): Bounded HTTP authorization policies with scoped fail-closed decisions and core audit integration.
203
+ - [OpenFGA](integrations/authz-openfga.md): Scoped OpenFGA authorization checks with pinned models, bounded transport and core audit integration.
204
+ - [Oso](integrations/authz-oso.md): Scoped Oso Cloud authorization checks with bounded transport and shared core audit integration.
205
+ - [Permit.io](integrations/authz-permit.md): Scoped Permit.io PDP checks with explicit environment credentials, bounded transport and core audit integration.
206
+
207
+ ## Integrations: sign-in providers
208
+
209
+ - [Amazon Cognito](integrations/auth-cognito.md): Amazon Cognito user pool tokens as Mayura server identities, verified with the pool's published keys.
210
+ - [Auth0](integrations/auth-auth0.md): Auth0 access tokens as Mayura server identities, verified with your tenant's published keys.
211
+ - [Clerk](integrations/auth-clerk.md): Clerk session tokens as Mayura server identities, verified with Clerk's published keys or its PEM key.
212
+ - [Facebook](integrations/auth-facebook.md): Facebook Login access tokens (checked with Facebook) and Limited Login tokens as Mayura server identities, and a preset for better-auth's Facebook sign-in.
213
+ - [Firebase](integrations/auth-firebase.md): Firebase Authentication ID tokens as Mayura server identities, verified with Google's published keys.
214
+ - [Google](integrations/auth-google.md): Google ID tokens as Mayura server identities, and a least-privilege preset for better-auth's Google sign-in.
215
+ - [Microsoft Entra ID](integrations/auth-entra.md): Microsoft Entra ID access tokens for your API as Mayura server identities, single- or multi-tenant.
216
+ - [Neon](integrations/auth-neon.md): Neon Auth (managed better-auth) JWTs as Mayura server identities, verified with your project's published keys.
217
+ - [Okta](integrations/auth-okta.md): Okta access tokens as Mayura server identities, verified with your authorization server's published keys.
218
+ - [Supabase](integrations/auth-supabase.md): Supabase Auth access tokens as Mayura server identities, verified with your project's published keys.
219
+ - [WorkOS](integrations/auth-workos.md): WorkOS AuthKit session tokens and Connect machine tokens as Mayura server identities, verified with WorkOS's published keys.
220
+
221
+ ## Integrations: api key services
222
+
223
+ - [ReqKey](integrations/km-reqkey.md): API keys issued by ReqKey as Mayura server identities, validated with ReqKey's API.
224
+ - [Unkey](integrations/km-unkey.md): API keys issued by Unkey as Mayura server identities, verified with Unkey's API.
225
+
226
+ ## Integrations: deploy targets
227
+
228
+ - [Amazon Bedrock AgentCore](integrations/deploy-agentcore.md): Amazon Bedrock AgentCore Runtime as a mayura deploy target: an ARM64 image serving its HTTP contract, then the runtime update.
229
+ - [Amazon ECS](integrations/deploy-aws-ecs.md): Amazon ECS on Fargate as a mayura deploy target: task definitions, a checked migration task, then the services.
230
+ - [AWS Lambda](integrations/deploy-aws-lambda.md): AWS Lambda as a mayura deploy target: one container image, the migration function first, then the API and workflows functions.
231
+ - [Azure Container Apps](integrations/deploy-azure.md): Azure Container Apps as a mayura deploy target: a migration job run to success, then the server and worker apps.
232
+ - [Cloudflare](integrations/deploy-cloudflare.md): Cloudflare as a mayura deploy target: the app in Containers, or the serverless module on Workers, with wrangler.
233
+ - [DigitalOcean App Platform](integrations/deploy-digitalocean.md): DigitalOcean App Platform as a mayura deploy target: a pre-deploy migration, the server and a worker, released by image tag.
234
+ - [Fly.io](integrations/deploy-fly.md): Fly.io as a mayura deploy target: server and worker processes, the migration as the release command.
235
+ - [Google Cloud Run](integrations/deploy-cloudrun.md): Google Cloud Run as a mayura deploy target: a migration job, then the server and an always-on worker as services.
236
+ - [Railway](integrations/deploy-railway.md): Railway as a mayura deploy target: server and worker services, each migrating before it goes live.
237
+ - [Render](integrations/deploy-render.md): Render as a mayura deploy target: a Blueprint with a web service, a background worker and PostgreSQL.
238
+ - [Vercel](integrations/deploy-vercel.md): Vercel Functions as a mayura deploy target: the API, cron-driven workflows, and storage migrated before each release.
239
+
240
+ <!-- integrations:end -->
241
+
80
242
  ## Reference
81
243
 
82
244
  - [Entry points](reference/entry-points.md): every `mayura/...` import.
package/docs/cli/init.md CHANGED
@@ -190,3 +190,15 @@ starter or template name, `source` paths under `src/` ending in `.ts`, and no du
190
190
  - [Develop with mayura dev](dev.md)
191
191
  - [Model providers](../guides/model-providers.md)
192
192
  - [Quickstart](../quickstart.md)
193
+
194
+ ## Framework applications
195
+
196
+ `mayura init --starter` also accepts `nextjs`, `hono`, `react-router`, `tanstack-start`, `sveltekit` and `nuxt`.
197
+ These produce complete scoped notebook applications with persistent threads, exact approval UI, offline model
198
+ fixtures, environment examples, deployment files and a separate worker or Cron path. See
199
+ [Framework starters](../guides/framework-starters.md) for local setup, runtime boundaries and remaining qualifications.
200
+
201
+ The project catalog can name definitions under `server/` as `.mjs`, as well as `src/` TypeScript sources.
202
+ Initializer plans remain content-bound: no install scripts run, paths cannot escape the destination, and replacing
203
+ files requires the displayed digest. Framework route filenames may include bounded `+`, `$` and bracket characters.
204
+ The initializer pins the Hono starter's reviewed D1 extension to the same Mayura release.
package/docs/cli/run.md CHANGED
@@ -1,182 +1,182 @@
1
- ---
2
- title: "Serve, worker and migrate"
3
- description: "Run your application in production with mayura serve, mayura worker and mayura migrate, and write the module they load."
4
- ---
5
-
6
- In production a Mayura application usually runs as separate processes: one or more **servers** that answer HTTP
7
- requests, one or more **workers** that advance durable workflows, and a **migration** step that updates the storage
8
- schema before new code starts. The CLI runs each of these from one application module that you write:
9
-
10
- ```bash
11
- mayura migrate --app dist/src/app.js
12
- mayura serve --app dist/src/app.js
13
- mayura worker --app dist/src/app.js --probe-host 0.0.0.0 --probe-port 9090
14
- ```
15
-
16
- The CLI owns only the process lifecycle: starting, handling Ctrl+C or `SIGTERM`, graceful shutdown and worker probes.
17
- Your module wires its own storage, agents, workflows and authentication with its own installed `mayura` package.
18
-
19
- ## The application module
20
-
21
- The module's default export is an object with up to four functions. Wrap it in `defineMayuraApplication` from
22
- `mayura/cli`, which checks the shape:
23
-
24
- ```ts
25
- import { defineMayuraApplication } from 'mayura/cli';
26
- import { listenProductionServer } from 'mayura/server-node';
27
- import { createWorkflowWorker } from 'mayura/workflows';
28
-
29
- // openServices, agents, authenticate and workerUnits stand for your own code: storage, agent
30
- // registrations, token verification and the workflow runtimes the worker drives.
31
- let services: Promise<Services> | undefined;
32
- const ready = () => (services ??= openServices());
33
-
34
- export default defineMayuraApplication({
35
- async server() {
36
- await ready();
37
- return listenProductionServer({
38
- publicOrigin: 'https://agents.example.com',
39
- hostname: '0.0.0.0',
40
- port: 8080,
41
- tls: { terminatedBy: 'proxy' },
42
- agents,
43
- authenticate,
44
- });
45
- },
46
- async worker() {
47
- return createWorkflowWorker({ units: workerUnits(await ready()) });
48
- },
49
- async migrate() {
50
- await ready();
51
- return { schemaVersion: 1 };
52
- },
53
- async shutdown() {
54
- if (services) await (await services).close();
55
- },
56
- });
57
- ```
58
-
59
- | Function | Used by | Must return |
60
- |---|---|---|
61
- | `server()` | `mayura serve` | A running server with `isAccepting()` and `close()`, such as the result of `listenProductionServer` from `mayura/server-node` |
62
- | `worker()` | `mayura worker` | A worker with `start()`, `isReady()` and `drain()`, such as the result of `createWorkflowWorker` from `mayura/workflows` |
63
- | `migrate()` | `mayura migrate` | Any JSON-serializable report, printed when the migration finishes |
64
- | `shutdown()` | all three | Nothing. Runs last, after the server closes, the worker drains or the migration ends, for example to close storage. |
65
-
66
- Define at least one function, and only these four. A command whose function is missing fails with `INVALID_CONFIG`,
67
- for example `mayura worker` on a module without `worker`.
68
-
69
- `--app` must name a single regular `.js` or `.mjs` file: build your TypeScript first. Directories, symbolic links and
70
- other file types are refused, and the CLI imports nothing else. For a complete, working module, see `src/app.ts` in
71
- any starter, such as
72
- [approval-workflow](https://github.com/KartikeyAI/mayura/blob/main/packages/cli/starters/approval-workflow/src/app.ts).
73
-
74
- ## mayura serve
75
-
76
- `mayura serve --app <module>` calls `server()` and keeps it running. On the first Ctrl+C or `SIGTERM` it closes the
77
- server gracefully, then calls `shutdown()`. A second signal during shutdown forces the process to exit.
78
-
79
- `listenProductionServer` stops accepting new requests, fails its readiness check so load balancers stop routing to
80
- it, and drains in-flight requests before it closes. See [Deployment](../guides/deployment.md).
81
-
82
- ## mayura worker
83
-
84
- `mayura worker --app <module>` calls `worker()`, then `start()`. On the first Ctrl+C or `SIGTERM` it drains the
85
- worker, waiting for in-flight work to finish, then calls `shutdown()`.
86
-
87
- | Option | Meaning |
88
- |---|---|
89
- | `--drain-timeout-ms <ms>` | How long draining may take, from 1 to 300000. Default 30000. |
90
- | `--probe-port <port>` | Serve HTTP health probes on this port. Off by default. |
91
- | `--probe-host <host>` | The address the probes listen on. Default `127.0.0.1`. |
92
-
93
- With `--probe-port`, the worker answers two probes for your orchestrator:
94
-
95
- - `GET /livez` returns 200 while the process is running, and 503 once it starts stopping.
96
- - `GET /readyz` returns 200 while the worker reports itself ready, and 503 when it does not, for example while it is
97
- draining. A worker with a leadership lease is ready only while it can confirm the lease in storage.
98
-
99
- The probe listener comes from `mayura/server-node` in your application's own installation, so `mayura` must be
100
- installed alongside the module. In a container, use `--probe-host 0.0.0.0` so the orchestrator can reach it.
101
-
102
- When the worker stops, it reports whether the drain finished in time, and how much work was interrupted if it did not.
103
-
104
- ### Run once
105
-
106
- With `--once`, the worker advances everything that is due and exits, instead of running until it is stopped. Use it
107
- from a scheduled job (a Cloud Run job, a Kubernetes CronJob) or a scheduler that starts a process every minute:
108
-
109
- ```bash
110
- mayura worker --app dist/src/app.js --once --budget-ms 50000
111
- ```
112
-
113
- It takes the leadership lease once, runs passes until every host has completed a sweep of its runs or the budget runs
114
- out, then releases the lease and calls `shutdown()`. A pass that has started finishes, so keep the budget below your
115
- platform's time limit by at least your longest tool's `timeoutMs`. Each host keeps its place in storage, so if a sweep
116
- does not finish, the next run continues from there rather than starting over.
117
-
118
- | Option | Meaning |
119
- |---|---|
120
- | `--once` | Advance what is due, then exit. Not with `--probe-port`, `--probe-host` or `--drain-timeout-ms`. |
121
- | `--budget-ms <ms>` | Stop starting passes after this long, from 1000 to 3600000. Default 60000. |
122
-
123
- It prints a report and its status:
124
-
125
- | Status | Meaning | Exit code |
126
- |---|---|---|
127
- | `succeeded` | Every host completed a sweep. | 0 |
128
- | `incomplete` | The budget ran out first; the next run continues. Run it more often or give it more time. | 0 |
129
- | `standby` | Another replica holds the lease, so this run did nothing. | 0 |
130
- | `held` | An operator holds the fleet, so nothing was driven. | 0 |
131
- | `failed` | A pass failed, for example because storage was unavailable. | 1 |
132
-
133
- The worker must come from `createWorkflowWorker`, whose `runOnce` this calls; in your own code, such as a scheduled
134
- function, call `worker.runOnce({ budgetMs })` directly.
135
-
136
- ## mayura migrate
137
-
138
- `mayura migrate --app <module>` calls `migrate()` once, then `shutdown()`, and exits. Nothing else starts. Run it
139
- before deploying new code, for example as a release step or an init container:
140
-
141
- ```bash
142
- mayura migrate --app dist/src/app.js --json
143
- ```
144
-
145
- Migrations are explicit and one-way. Mayura's storage refuses data in a format or schema version it does not
146
- support; see [Storage](../guides/storage.md).
147
-
148
- ## Output
149
-
150
- In a terminal each command prints one line per stage:
151
-
152
- ```text
153
- ● Worker started, probes on 0.0.0.0:9090. Press Ctrl+C to stop.
154
- ● Stopping… (press Ctrl+C again to force)
155
- ✔ Stopped
156
- ```
157
-
158
- When output is piped, as in most deployments, each stage is one JSON line, then the command's final JSON document:
159
-
160
- ```text
161
- {"event":"worker-started","probe":{"hostname":"0.0.0.0","port":9090}}
162
- {"event":"stopping"}
163
- {"event":"stopped","drained":true,"interrupted":0}
164
- ```
165
-
166
- `serve` prints `serving`, `stopping` and `stopped` events. `migrate` prints `{ "status": "migrated", "report": <report> }`,
167
- where the report is whatever your `migrate()` returned. See [CLI overview](overview.md) for exit codes and errors.
168
-
169
- ## Good to know
170
-
171
- - `serve` and `worker` do not load `.env`. Set configuration in the real process environment. Only
172
- [mayura dev](dev.md) reads `.env`.
173
- - Run servers and workers as separate processes. With a leadership lease (`createWorkflowLeadership` from
174
- `mayura/workflows`), several worker replicas can run without driving the same workflows twice.
175
-
176
- ## Related
177
-
178
- - [Deployment](../guides/deployment.md)
179
- - [Develop with mayura dev](dev.md)
180
- - [Server and client](../guides/server-and-client.md)
181
- - [Workflow operations](../guides/workflow-operations.md)
182
- - [Storage](../guides/storage.md)
1
+ ---
2
+ title: "Serve, worker and migrate"
3
+ description: "Run your application in production with mayura serve, mayura worker and mayura migrate, and write the module they load."
4
+ ---
5
+
6
+ In production a Mayura application usually runs as separate processes: one or more **servers** that answer HTTP
7
+ requests, one or more **workers** that advance durable workflows, and a **migration** step that updates the storage
8
+ schema before new code starts. The CLI runs each of these from one application module that you write:
9
+
10
+ ```bash
11
+ mayura migrate --app dist/src/app.js
12
+ mayura serve --app dist/src/app.js
13
+ mayura worker --app dist/src/app.js --probe-host 0.0.0.0 --probe-port 9090
14
+ ```
15
+
16
+ The CLI owns only the process lifecycle: starting, handling Ctrl+C or `SIGTERM`, graceful shutdown and worker probes.
17
+ Your module wires its own storage, agents, workflows and authentication with its own installed `mayura` package.
18
+
19
+ ## The application module
20
+
21
+ The module's default export is an object with up to four functions. Wrap it in `defineMayuraApplication` from
22
+ `mayura/cli`, which checks the shape:
23
+
24
+ ```ts
25
+ import { defineMayuraApplication } from 'mayura/cli';
26
+ import { listenProductionServer } from 'mayura/server-node';
27
+ import { createWorkflowWorker } from 'mayura/workflows';
28
+
29
+ // openServices, agents, authenticate and workerUnits stand for your own code: storage, agent
30
+ // registrations, token verification and the workflow runtimes the worker drives.
31
+ let services: Promise<Services> | undefined;
32
+ const ready = () => (services ??= openServices());
33
+
34
+ export default defineMayuraApplication({
35
+ async server() {
36
+ await ready();
37
+ return listenProductionServer({
38
+ publicOrigin: 'https://agents.example.com',
39
+ hostname: '0.0.0.0',
40
+ port: 8080,
41
+ tls: { terminatedBy: 'proxy' },
42
+ agents,
43
+ authenticate,
44
+ });
45
+ },
46
+ async worker() {
47
+ return createWorkflowWorker({ units: workerUnits(await ready()) });
48
+ },
49
+ async migrate() {
50
+ await ready();
51
+ return { schemaVersion: 1 };
52
+ },
53
+ async shutdown() {
54
+ if (services) await (await services).close();
55
+ },
56
+ });
57
+ ```
58
+
59
+ | Function | Used by | Must return |
60
+ |---|---|---|
61
+ | `server()` | `mayura serve` | A running server with `isAccepting()` and `close()`, such as the result of `listenProductionServer` from `mayura/server-node` |
62
+ | `worker()` | `mayura worker` | A worker with `start()`, `isReady()` and `drain()`, such as the result of `createWorkflowWorker` from `mayura/workflows` |
63
+ | `migrate()` | `mayura migrate` | Any JSON-serializable report, printed when the migration finishes |
64
+ | `shutdown()` | all three | Nothing. Runs last, after the server closes, the worker drains or the migration ends, for example to close storage. |
65
+
66
+ Define at least one function, and only these four. A command whose function is missing fails with `INVALID_CONFIG`,
67
+ for example `mayura worker` on a module without `worker`.
68
+
69
+ `--app` must name a single regular `.js` or `.mjs` file: build your TypeScript first. Directories, symbolic links and
70
+ other file types are refused, and the CLI imports nothing else. For a complete, working module, see `src/app.ts` in
71
+ any starter, such as
72
+ [approval-workflow](https://github.com/KartikeyAI/mayura/blob/main/packages/cli/starters/approval-workflow/src/app.ts).
73
+
74
+ ## mayura serve
75
+
76
+ `mayura serve --app <module>` calls `server()` and keeps it running. On the first Ctrl+C or `SIGTERM` it closes the
77
+ server gracefully, then calls `shutdown()`. A second signal during shutdown forces the process to exit.
78
+
79
+ `listenProductionServer` stops accepting new requests, fails its readiness check so load balancers stop routing to
80
+ it, and drains in-flight requests before it closes. See [Deployment](../guides/deployment.md).
81
+
82
+ ## mayura worker
83
+
84
+ `mayura worker --app <module>` calls `worker()`, then `start()`. On the first Ctrl+C or `SIGTERM` it drains the
85
+ worker, waiting for in-flight work to finish, then calls `shutdown()`.
86
+
87
+ | Option | Meaning |
88
+ |---|---|
89
+ | `--drain-timeout-ms <ms>` | How long draining may take, from 1 to 300000. Default 30000. |
90
+ | `--probe-port <port>` | Serve HTTP health probes on this port. Off by default. |
91
+ | `--probe-host <host>` | The address the probes listen on. Default `127.0.0.1`. |
92
+
93
+ With `--probe-port`, the worker answers two probes for your orchestrator:
94
+
95
+ - `GET /livez` returns 200 while the process is running, and 503 once it starts stopping.
96
+ - `GET /readyz` returns 200 while the worker reports itself ready, and 503 when it does not, for example while it is
97
+ draining. A worker with a leadership lease is ready only while it can confirm the lease in storage.
98
+
99
+ The probe listener comes from `mayura/server-node` in your application's own installation, so `mayura` must be
100
+ installed alongside the module. In a container, use `--probe-host 0.0.0.0` so the orchestrator can reach it.
101
+
102
+ When the worker stops, it reports whether the drain finished in time, and how much work was interrupted if it did not.
103
+
104
+ ### Run once
105
+
106
+ With `--once`, the worker advances everything that is due and exits, instead of running until it is stopped. Use it
107
+ from a scheduled job (a Cloud Run job, a Kubernetes CronJob) or a scheduler that starts a process every minute:
108
+
109
+ ```bash
110
+ mayura worker --app dist/src/app.js --once --budget-ms 50000
111
+ ```
112
+
113
+ It takes the leadership lease once, runs passes until every host has completed a sweep of its runs or the budget runs
114
+ out, then releases the lease and calls `shutdown()`. A pass that has started finishes, so keep the budget below your
115
+ platform's time limit by at least your longest tool's `timeoutMs`. Each host keeps its place in storage, so if a sweep
116
+ does not finish, the next run continues from there rather than starting over.
117
+
118
+ | Option | Meaning |
119
+ |---|---|
120
+ | `--once` | Advance what is due, then exit. Not with `--probe-port`, `--probe-host` or `--drain-timeout-ms`. |
121
+ | `--budget-ms <ms>` | Stop starting passes after this long, from 1000 to 3600000. Default 60000. |
122
+
123
+ It prints a report and its status:
124
+
125
+ | Status | Meaning | Exit code |
126
+ |---|---|---|
127
+ | `succeeded` | Every host completed a sweep. | 0 |
128
+ | `incomplete` | The budget ran out first; the next run continues. Run it more often or give it more time. | 0 |
129
+ | `standby` | Another replica holds the lease, so this run did nothing. | 0 |
130
+ | `held` | An operator holds the fleet, so nothing was driven. | 0 |
131
+ | `failed` | A pass failed, for example because storage was unavailable. | 1 |
132
+
133
+ The worker must come from `createWorkflowWorker`, whose `runOnce` this calls; in your own code, such as a scheduled
134
+ function, call `worker.runOnce({ budgetMs })` directly.
135
+
136
+ ## mayura migrate
137
+
138
+ `mayura migrate --app <module>` calls `migrate()` once, then `shutdown()`, and exits. Nothing else starts. Run it
139
+ before deploying new code, for example as a release step or an init container:
140
+
141
+ ```bash
142
+ mayura migrate --app dist/src/app.js --json
143
+ ```
144
+
145
+ Migrations are explicit and one-way. Mayura's storage refuses data in a format or schema version it does not
146
+ support; see [Storage](../guides/storage.md).
147
+
148
+ ## Output
149
+
150
+ In a terminal each command prints one line per stage:
151
+
152
+ ```text
153
+ ● Worker started, probes on 0.0.0.0:9090. Press Ctrl+C to stop.
154
+ ● Stopping… (press Ctrl+C again to force)
155
+ ✔ Stopped
156
+ ```
157
+
158
+ When output is piped, as in most deployments, each stage is one JSON line, then the command's final JSON document:
159
+
160
+ ```text
161
+ {"event":"worker-started","probe":{"hostname":"0.0.0.0","port":9090}}
162
+ {"event":"stopping"}
163
+ {"event":"stopped","drained":true,"interrupted":0}
164
+ ```
165
+
166
+ `serve` prints `serving`, `stopping` and `stopped` events. `migrate` prints `{ "status": "migrated", "report": <report> }`,
167
+ where the report is whatever your `migrate()` returned. See [CLI overview](overview.md) for exit codes and errors.
168
+
169
+ ## Good to know
170
+
171
+ - `serve` and `worker` do not load `.env`. Set configuration in the real process environment. Only
172
+ [mayura dev](dev.md) reads `.env`.
173
+ - Run servers and workers as separate processes. With a leadership lease (`createWorkflowLeadership` from
174
+ `mayura/workflows`), several worker replicas can run without driving the same workflows twice.
175
+
176
+ ## Related
177
+
178
+ - [Deployment](../guides/deployment.md)
179
+ - [Develop with mayura dev](dev.md)
180
+ - [Server and client](../guides/server-and-client.md)
181
+ - [Workflow operations](../guides/workflow-operations.md)
182
+ - [Storage](../guides/storage.md)