mayura 0.1.0-dev.0 → 1.0.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 (509) hide show
  1. package/README.md +153 -35
  2. package/docs/README.md +81 -0
  3. package/docs/ai-agents.md +73 -0
  4. package/docs/cli/dev.md +111 -0
  5. package/docs/cli/init.md +192 -0
  6. package/docs/cli/operations.md +235 -0
  7. package/docs/cli/overview.md +129 -0
  8. package/docs/cli/run.md +150 -0
  9. package/docs/concepts/agent.md +199 -0
  10. package/docs/concepts/costs-and-budgets.md +179 -0
  11. package/docs/concepts/outcomes.md +154 -0
  12. package/docs/concepts/permissions.md +156 -0
  13. package/docs/concepts/runtime.md +172 -0
  14. package/docs/concepts/tools.md +204 -0
  15. package/docs/concepts/workflows.md +135 -0
  16. package/docs/guides/approvals-and-human-input.md +279 -0
  17. package/docs/guides/artifacts.md +123 -0
  18. package/docs/guides/child-agents.md +159 -0
  19. package/docs/guides/code-mode.md +234 -0
  20. package/docs/guides/deployment.md +297 -0
  21. package/docs/guides/durable-workflows.md +462 -0
  22. package/docs/guides/guardrails.md +207 -0
  23. package/docs/guides/helpers.md +176 -0
  24. package/docs/guides/lifecycle-hooks.md +189 -0
  25. package/docs/guides/mcp.md +124 -0
  26. package/docs/guides/memory-and-context.md +294 -0
  27. package/docs/guides/model-providers.md +372 -0
  28. package/docs/guides/model-routing.md +138 -0
  29. package/docs/guides/observability.md +238 -0
  30. package/docs/guides/operator-console.md +140 -0
  31. package/docs/guides/react.md +276 -0
  32. package/docs/guides/sagas-and-loops.md +213 -0
  33. package/docs/guides/server-and-client.md +533 -0
  34. package/docs/guides/skills.md +152 -0
  35. package/docs/guides/storage.md +245 -0
  36. package/docs/guides/streaming.md +147 -0
  37. package/docs/guides/terminal.md +166 -0
  38. package/docs/guides/testing.md +222 -0
  39. package/docs/guides/vision.md +158 -0
  40. package/docs/guides/webhooks.md +172 -0
  41. package/docs/guides/workflow-composition.md +142 -0
  42. package/docs/guides/workflow-operations.md +268 -0
  43. package/docs/installation.md +89 -0
  44. package/docs/introduction.md +74 -0
  45. package/docs/project/security.md +178 -0
  46. package/docs/project/support.md +85 -0
  47. package/docs/project/versioning.md +119 -0
  48. package/docs/quickstart.md +193 -0
  49. package/docs/reference/entry-points.md +145 -0
  50. package/lib/adapter-code-docker/dist/index.d.ts +8 -1
  51. package/lib/adapter-code-docker/dist/index.d.ts.map +1 -1
  52. package/lib/adapter-code-docker/dist/index.js +64 -67
  53. package/lib/adapter-code-docker/dist/index.js.map +1 -1
  54. package/lib/adapter-code-docker/dist/options.d.ts +15 -0
  55. package/lib/adapter-code-docker/dist/options.d.ts.map +1 -0
  56. package/lib/adapter-code-docker/dist/options.js +56 -0
  57. package/lib/adapter-code-docker/dist/options.js.map +1 -0
  58. package/lib/adapter-code-docker/image/Dockerfile +4 -2
  59. package/lib/adapter-code-docker/package.json +1 -1
  60. package/lib/adapter-code-docker/src/index.ts +63 -65
  61. package/lib/adapter-code-docker/src/options.ts +51 -0
  62. package/lib/adapter-code-quickjs/dist/index.d.ts +16 -4
  63. package/lib/adapter-code-quickjs/dist/index.d.ts.map +1 -1
  64. package/lib/adapter-code-quickjs/dist/index.js +94 -50
  65. package/lib/adapter-code-quickjs/dist/index.js.map +1 -1
  66. package/lib/adapter-code-quickjs/dist/worker-command.d.ts +27 -0
  67. package/lib/adapter-code-quickjs/dist/worker-command.d.ts.map +1 -0
  68. package/lib/adapter-code-quickjs/dist/worker-command.js +66 -0
  69. package/lib/adapter-code-quickjs/dist/worker-command.js.map +1 -0
  70. package/lib/adapter-code-quickjs/dist/worker.js +421 -104
  71. package/lib/adapter-code-quickjs/dist/worker.js.map +1 -1
  72. package/lib/adapter-code-quickjs/package.json +1 -1
  73. package/lib/adapter-code-quickjs/src/index.ts +88 -44
  74. package/lib/adapter-code-quickjs/src/worker-command.ts +68 -0
  75. package/lib/adapter-code-quickjs/src/worker.ts +315 -89
  76. package/lib/adapter-mcp/package.json +1 -1
  77. package/lib/artifacts/dist/contracts.d.ts +6 -2
  78. package/lib/artifacts/dist/contracts.d.ts.map +1 -1
  79. package/lib/artifacts/dist/contracts.js.map +1 -1
  80. package/lib/artifacts/dist/index.d.ts +1 -0
  81. package/lib/artifacts/dist/index.d.ts.map +1 -1
  82. package/lib/artifacts/dist/index.js +1 -0
  83. package/lib/artifacts/dist/index.js.map +1 -1
  84. package/lib/artifacts/dist/local-store.d.ts.map +1 -1
  85. package/lib/artifacts/dist/local-store.js +4 -7
  86. package/lib/artifacts/dist/local-store.js.map +1 -1
  87. package/lib/artifacts/dist/media.d.ts +11 -0
  88. package/lib/artifacts/dist/media.d.ts.map +1 -0
  89. package/lib/artifacts/dist/media.js +18 -0
  90. package/lib/artifacts/dist/media.js.map +1 -0
  91. package/lib/artifacts/package.json +1 -1
  92. package/lib/artifacts/src/contracts.ts +6 -2
  93. package/lib/artifacts/src/index.ts +1 -0
  94. package/lib/artifacts/src/local-store.ts +5 -7
  95. package/lib/artifacts/src/media.ts +20 -0
  96. package/lib/cli/dist/agent-guide.d.ts +10 -0
  97. package/lib/cli/dist/agent-guide.d.ts.map +1 -0
  98. package/lib/cli/dist/agent-guide.js +47 -0
  99. package/lib/cli/dist/agent-guide.js.map +1 -0
  100. package/lib/cli/dist/bin.js +13 -4
  101. package/lib/cli/dist/bin.js.map +1 -1
  102. package/lib/cli/dist/dev.d.ts.map +1 -1
  103. package/lib/cli/dist/dev.js +7 -1
  104. package/lib/cli/dist/dev.js.map +1 -1
  105. package/lib/cli/dist/index.d.ts +2 -2
  106. package/lib/cli/dist/index.d.ts.map +1 -1
  107. package/lib/cli/dist/index.js +12 -2
  108. package/lib/cli/dist/index.js.map +1 -1
  109. package/lib/cli/dist/interactive.d.ts.map +1 -1
  110. package/lib/cli/dist/interactive.js +52 -11
  111. package/lib/cli/dist/interactive.js.map +1 -1
  112. package/lib/cli/dist/operations.d.ts +25 -2
  113. package/lib/cli/dist/operations.d.ts.map +1 -1
  114. package/lib/cli/dist/operations.js +125 -12
  115. package/lib/cli/dist/operations.js.map +1 -1
  116. package/lib/cli/dist/output.d.ts.map +1 -1
  117. package/lib/cli/dist/output.js +3 -0
  118. package/lib/cli/dist/output.js.map +1 -1
  119. package/lib/cli/dist/providers.d.ts +34 -4
  120. package/lib/cli/dist/providers.d.ts.map +1 -1
  121. package/lib/cli/dist/providers.js +26 -5
  122. package/lib/cli/dist/providers.js.map +1 -1
  123. package/lib/cli/package.json +1 -1
  124. package/lib/cli/src/agent-guide.ts +46 -0
  125. package/lib/cli/src/bin.ts +11 -3
  126. package/lib/cli/src/dev.ts +5 -1
  127. package/lib/cli/src/index.ts +10 -2
  128. package/lib/cli/src/interactive.ts +44 -12
  129. package/lib/cli/src/operations.ts +82 -12
  130. package/lib/cli/src/output.ts +3 -0
  131. package/lib/cli/src/providers.ts +45 -10
  132. package/lib/cli/starters/approval-workflow/dot-env.example +11 -0
  133. package/lib/cli/starters/approval-workflow/src/config.ts +24 -6
  134. package/lib/cli/starters/approval-workflow/src/model.ts +10 -3
  135. package/lib/cli/starters/cli-agent/README.md +121 -0
  136. package/lib/cli/starters/cli-agent/dot-env.example +37 -0
  137. package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +13 -0
  138. package/lib/cli/starters/cli-agent/dot-gitignore +10 -0
  139. package/lib/cli/starters/cli-agent/mayura.project.json +15 -0
  140. package/lib/cli/starters/cli-agent/package.json +29 -0
  141. package/lib/cli/starters/cli-agent/skills/release-notes/SKILL.md +18 -0
  142. package/lib/cli/starters/cli-agent/skills/release-notes/references/example.md +12 -0
  143. package/lib/cli/starters/cli-agent/src/assistant.ts +125 -0
  144. package/lib/cli/starters/cli-agent/src/cli.ts +72 -0
  145. package/lib/cli/starters/cli-agent/src/config.ts +117 -0
  146. package/lib/cli/starters/cli-agent/src/model.ts +34 -0
  147. package/lib/cli/starters/cli-agent/src/workspace.ts +171 -0
  148. package/lib/cli/starters/cli-agent/test/assistant.test.ts +205 -0
  149. package/lib/cli/starters/cli-agent/tsconfig.json +20 -0
  150. package/lib/cli/starters/event-automation/README.md +4 -3
  151. package/lib/cli/starters/event-automation/dot-env.example +11 -0
  152. package/lib/cli/starters/event-automation/src/config.ts +24 -6
  153. package/lib/cli/starters/event-automation/src/ingress.ts +3 -5
  154. package/lib/cli/starters/event-automation/src/model.ts +10 -3
  155. package/lib/cli/starters/event-automation/src/triage.ts +15 -21
  156. package/lib/cli/starters/event-automation/test/automation.test.ts +3 -3
  157. package/lib/cli/starters/research-team/README.md +2 -2
  158. package/lib/cli/starters/research-team/dot-env.example +11 -0
  159. package/lib/cli/starters/research-team/src/config.ts +24 -6
  160. package/lib/cli/starters/research-team/src/model.ts +10 -3
  161. package/lib/cli/starters/research-team/src/services.ts +1 -1
  162. package/lib/cli/starters/research-team/src/workflow.ts +45 -58
  163. package/lib/cli/starters/support-agent/dot-env.example +11 -0
  164. package/lib/cli/starters/support-agent/src/assistant.ts +4 -3
  165. package/lib/cli/starters/support-agent/src/config.ts +24 -6
  166. package/lib/cli/starters/support-agent/src/guardrails.ts +3 -1
  167. package/lib/cli/starters/support-agent/src/model.ts +10 -3
  168. package/lib/cli/starters/support-agent/test/support.test.ts +25 -1
  169. package/lib/cli/templates/code-mode-workflow.ts +1 -1
  170. package/lib/client/dist/forms.d.ts.map +1 -1
  171. package/lib/client/dist/forms.js +3 -4
  172. package/lib/client/dist/forms.js.map +1 -1
  173. package/lib/client/dist/headless.d.ts +3 -1
  174. package/lib/client/dist/headless.d.ts.map +1 -1
  175. package/lib/client/dist/headless.js +10 -6
  176. package/lib/client/dist/headless.js.map +1 -1
  177. package/lib/client/dist/index.d.ts +95 -6
  178. package/lib/client/dist/index.d.ts.map +1 -1
  179. package/lib/client/dist/index.js +397 -124
  180. package/lib/client/dist/index.js.map +1 -1
  181. package/lib/client/dist/workflows.d.ts +1 -1
  182. package/lib/client/dist/workflows.d.ts.map +1 -1
  183. package/lib/client/dist/workflows.js +7 -6
  184. package/lib/client/dist/workflows.js.map +1 -1
  185. package/lib/client/package.json +1 -1
  186. package/lib/client/src/forms.ts +3 -4
  187. package/lib/client/src/headless.ts +13 -7
  188. package/lib/client/src/index.ts +344 -74
  189. package/lib/client/src/workflows.ts +8 -7
  190. package/lib/client-react/package.json +1 -1
  191. package/lib/code-mode/dist/index.d.ts +32 -1
  192. package/lib/code-mode/dist/index.d.ts.map +1 -1
  193. package/lib/code-mode/dist/index.js +289 -221
  194. package/lib/code-mode/dist/index.js.map +1 -1
  195. package/lib/code-mode/package.json +1 -1
  196. package/lib/code-mode/src/index.ts +288 -184
  197. package/lib/code-mode-workflows/package.json +1 -1
  198. package/lib/context/package.json +1 -1
  199. package/lib/core/dist/budget.d.ts.map +1 -1
  200. package/lib/core/dist/budget.js +17 -2
  201. package/lib/core/dist/budget.js.map +1 -1
  202. package/lib/core/dist/contracts.d.ts +57 -0
  203. package/lib/core/dist/contracts.d.ts.map +1 -1
  204. package/lib/core/dist/contracts.js +36 -0
  205. package/lib/core/dist/contracts.js.map +1 -1
  206. package/lib/core/dist/destination.d.ts +12 -0
  207. package/lib/core/dist/destination.d.ts.map +1 -0
  208. package/lib/core/dist/destination.js +37 -0
  209. package/lib/core/dist/destination.js.map +1 -0
  210. package/lib/core/dist/event-stream.d.ts +1 -1
  211. package/lib/core/dist/event-stream.d.ts.map +1 -1
  212. package/lib/core/dist/event-stream.js +7 -0
  213. package/lib/core/dist/event-stream.js.map +1 -1
  214. package/lib/core/dist/host.d.ts +3 -0
  215. package/lib/core/dist/host.d.ts.map +1 -1
  216. package/lib/core/dist/host.js +3 -0
  217. package/lib/core/dist/host.js.map +1 -1
  218. package/lib/core/dist/index.d.ts +2 -0
  219. package/lib/core/dist/index.d.ts.map +1 -1
  220. package/lib/core/dist/index.js +2 -0
  221. package/lib/core/dist/index.js.map +1 -1
  222. package/lib/core/dist/media.d.ts +98 -0
  223. package/lib/core/dist/media.d.ts.map +1 -0
  224. package/lib/core/dist/media.js +227 -0
  225. package/lib/core/dist/media.js.map +1 -0
  226. package/lib/core/dist/model-schema.d.ts +37 -0
  227. package/lib/core/dist/model-schema.d.ts.map +1 -0
  228. package/lib/core/dist/model-schema.js +154 -0
  229. package/lib/core/dist/model-schema.js.map +1 -0
  230. package/lib/core/package.json +1 -1
  231. package/lib/core/src/budget.ts +17 -2
  232. package/lib/core/src/contracts.ts +71 -3
  233. package/lib/core/src/destination.ts +33 -0
  234. package/lib/core/src/event-stream.ts +5 -1
  235. package/lib/core/src/host.ts +3 -0
  236. package/lib/core/src/index.ts +2 -0
  237. package/lib/core/src/media.ts +228 -0
  238. package/lib/core/src/model-schema.ts +129 -0
  239. package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
  240. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
  241. package/lib/exporter-otlp/dist/signals.js +2 -2
  242. package/lib/exporter-otlp/dist/signals.js.map +1 -1
  243. package/lib/exporter-otlp/package.json +1 -1
  244. package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
  245. package/lib/exporter-otlp/src/signals.ts +2 -2
  246. package/lib/guardrails/package.json +1 -1
  247. package/lib/helpers/package.json +1 -1
  248. package/lib/memory/dist/index.js +1 -1
  249. package/lib/memory/dist/index.js.map +1 -1
  250. package/lib/memory/dist/native.d.ts.map +1 -1
  251. package/lib/memory/dist/native.js +4 -3
  252. package/lib/memory/dist/native.js.map +1 -1
  253. package/lib/memory/package.json +1 -1
  254. package/lib/memory/src/index.ts +1 -1
  255. package/lib/memory/src/native.ts +4 -3
  256. package/lib/memory-remote/package.json +1 -1
  257. package/lib/observability/package.json +1 -1
  258. package/lib/provider-anthropic/dist/index.d.ts +36 -3
  259. package/lib/provider-anthropic/dist/index.d.ts.map +1 -1
  260. package/lib/provider-anthropic/dist/index.js +128 -78
  261. package/lib/provider-anthropic/dist/index.js.map +1 -1
  262. package/lib/provider-anthropic/package.json +1 -1
  263. package/lib/provider-anthropic/src/index.ts +152 -76
  264. package/lib/provider-openai/dist/index.d.ts +71 -4
  265. package/lib/provider-openai/dist/index.d.ts.map +1 -1
  266. package/lib/provider-openai/dist/index.js +259 -96
  267. package/lib/provider-openai/dist/index.js.map +1 -1
  268. package/lib/provider-openai/package.json +1 -1
  269. package/lib/provider-openai/src/index.ts +282 -84
  270. package/lib/runtime/dist/agent.d.ts +18 -1
  271. package/lib/runtime/dist/agent.d.ts.map +1 -1
  272. package/lib/runtime/dist/agent.js +59 -3
  273. package/lib/runtime/dist/agent.js.map +1 -1
  274. package/lib/runtime/dist/composition.d.ts.map +1 -1
  275. package/lib/runtime/dist/composition.js +2 -1
  276. package/lib/runtime/dist/composition.js.map +1 -1
  277. package/lib/runtime/dist/hooks.d.ts +15 -3
  278. package/lib/runtime/dist/hooks.d.ts.map +1 -1
  279. package/lib/runtime/dist/hooks.js.map +1 -1
  280. package/lib/runtime/dist/index.d.ts +1 -1
  281. package/lib/runtime/dist/index.d.ts.map +1 -1
  282. package/lib/runtime/dist/index.js.map +1 -1
  283. package/lib/runtime/dist/response.d.ts +7 -1
  284. package/lib/runtime/dist/response.d.ts.map +1 -1
  285. package/lib/runtime/dist/response.js +23 -2
  286. package/lib/runtime/dist/response.js.map +1 -1
  287. package/lib/runtime/dist/router.d.ts +10 -3
  288. package/lib/runtime/dist/router.d.ts.map +1 -1
  289. package/lib/runtime/dist/router.js +45 -8
  290. package/lib/runtime/dist/router.js.map +1 -1
  291. package/lib/runtime/dist/runtime.d.ts +9 -1
  292. package/lib/runtime/dist/runtime.d.ts.map +1 -1
  293. package/lib/runtime/dist/runtime.js +50 -22
  294. package/lib/runtime/dist/runtime.js.map +1 -1
  295. package/lib/runtime/package.json +1 -1
  296. package/lib/runtime/src/agent.ts +69 -3
  297. package/lib/runtime/src/composition.ts +2 -1
  298. package/lib/runtime/src/hooks.ts +10 -4
  299. package/lib/runtime/src/index.ts +1 -1
  300. package/lib/runtime/src/response.ts +20 -2
  301. package/lib/runtime/src/router.ts +43 -10
  302. package/lib/runtime/src/runtime.ts +58 -27
  303. package/lib/sdk/package.json +1 -1
  304. package/lib/server/dist/index.d.ts +192 -3
  305. package/lib/server/dist/index.d.ts.map +1 -1
  306. package/lib/server/dist/index.js +687 -148
  307. package/lib/server/dist/index.js.map +1 -1
  308. package/lib/server/dist/inspector-bundle.d.ts +1 -1
  309. package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
  310. package/lib/server/dist/inspector-bundle.js +4 -4
  311. package/lib/server/dist/inspector-bundle.js.map +1 -1
  312. package/lib/server/package.json +1 -1
  313. package/lib/server/src/index.ts +589 -134
  314. package/lib/server/src/inspector-bundle.ts +4 -4
  315. package/lib/server-node/dist/hardening.d.ts +1 -1
  316. package/lib/server-node/dist/hardening.d.ts.map +1 -1
  317. package/lib/server-node/dist/hardening.js +4 -2
  318. package/lib/server-node/dist/hardening.js.map +1 -1
  319. package/lib/server-node/dist/index.d.ts +2 -1
  320. package/lib/server-node/dist/index.d.ts.map +1 -1
  321. package/lib/server-node/dist/index.js.map +1 -1
  322. package/lib/server-node/dist/probe.js +2 -2
  323. package/lib/server-node/dist/probe.js.map +1 -1
  324. package/lib/server-node/dist/production.d.ts +8 -1
  325. package/lib/server-node/dist/production.d.ts.map +1 -1
  326. package/lib/server-node/dist/production.js +15 -2
  327. package/lib/server-node/dist/production.js.map +1 -1
  328. package/lib/server-node/package.json +1 -1
  329. package/lib/server-node/src/hardening.ts +5 -3
  330. package/lib/server-node/src/index.ts +2 -1
  331. package/lib/server-node/src/probe.ts +2 -2
  332. package/lib/server-node/src/production.ts +23 -3
  333. package/lib/skills/dist/index.d.ts +81 -0
  334. package/lib/skills/dist/index.d.ts.map +1 -0
  335. package/lib/skills/dist/index.js +311 -0
  336. package/lib/skills/dist/index.js.map +1 -0
  337. package/lib/skills/package.json +5 -0
  338. package/lib/skills/src/index.ts +260 -0
  339. package/lib/storage/package.json +1 -1
  340. package/lib/storage-contracts/dist/contracts.d.ts +12 -5
  341. package/lib/storage-contracts/dist/contracts.d.ts.map +1 -1
  342. package/lib/storage-contracts/dist/contracts.js +24 -6
  343. package/lib/storage-contracts/dist/contracts.js.map +1 -1
  344. package/lib/storage-contracts/dist/index.d.ts +2 -0
  345. package/lib/storage-contracts/dist/index.d.ts.map +1 -1
  346. package/lib/storage-contracts/dist/index.js +2 -0
  347. package/lib/storage-contracts/dist/index.js.map +1 -1
  348. package/lib/storage-contracts/dist/memory-contracts.js +1 -1
  349. package/lib/storage-contracts/dist/memory-contracts.js.map +1 -1
  350. package/lib/storage-contracts/dist/run-records.d.ts +100 -0
  351. package/lib/storage-contracts/dist/run-records.d.ts.map +1 -0
  352. package/lib/storage-contracts/dist/run-records.js +464 -0
  353. package/lib/storage-contracts/dist/run-records.js.map +1 -0
  354. package/lib/storage-contracts/dist/schema-digest.d.ts +17 -0
  355. package/lib/storage-contracts/dist/schema-digest.d.ts.map +1 -0
  356. package/lib/storage-contracts/dist/schema-digest.js +94 -0
  357. package/lib/storage-contracts/dist/schema-digest.js.map +1 -0
  358. package/lib/storage-contracts/dist/submission-journal.js +1 -1
  359. package/lib/storage-contracts/dist/submission-journal.js.map +1 -1
  360. package/lib/storage-contracts/dist/workflow-format5.d.ts +30 -2
  361. package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
  362. package/lib/storage-contracts/dist/workflow-format5.js +57 -5
  363. package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
  364. package/lib/storage-contracts/package.json +1 -1
  365. package/lib/storage-contracts/src/contracts.ts +29 -5
  366. package/lib/storage-contracts/src/index.ts +2 -0
  367. package/lib/storage-contracts/src/memory-contracts.ts +1 -1
  368. package/lib/storage-contracts/src/run-records.ts +365 -0
  369. package/lib/storage-contracts/src/schema-digest.ts +71 -0
  370. package/lib/storage-contracts/src/submission-journal.ts +1 -1
  371. package/lib/storage-contracts/src/workflow-format5.ts +70 -6
  372. package/lib/storage-postgres/dist/postgres.js +6 -6
  373. package/lib/storage-postgres/dist/postgres.js.map +1 -1
  374. package/lib/storage-postgres/package.json +1 -1
  375. package/lib/storage-postgres/src/postgres.ts +6 -6
  376. package/lib/storage-sql/dist/aggregate-session.js +1 -1
  377. package/lib/storage-sql/dist/aggregate-session.js.map +1 -1
  378. package/lib/storage-sql/dist/scheduled-database.js +1 -1
  379. package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
  380. package/lib/storage-sql/dist/workflow-tree-validation.js +1 -1
  381. package/lib/storage-sql/dist/workflow-tree-validation.js.map +1 -1
  382. package/lib/storage-sql/package.json +1 -1
  383. package/lib/storage-sql/src/aggregate-session.ts +1 -1
  384. package/lib/storage-sql/src/scheduled-database.ts +1 -1
  385. package/lib/storage-sql/src/workflow-tree-validation.ts +1 -1
  386. package/lib/storage-sqlite/dist/sqlite-database.js +4 -4
  387. package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -1
  388. package/lib/storage-sqlite/dist/sqlite-worker.js +2 -2
  389. package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -1
  390. package/lib/storage-sqlite/dist/sqlite.js +1 -1
  391. package/lib/storage-sqlite/dist/sqlite.js.map +1 -1
  392. package/lib/storage-sqlite/package.json +1 -1
  393. package/lib/storage-sqlite/src/sqlite-database.ts +4 -4
  394. package/lib/storage-sqlite/src/sqlite-worker.ts +2 -2
  395. package/lib/storage-sqlite/src/sqlite.ts +1 -1
  396. package/lib/terminal/dist/index.d.ts +92 -0
  397. package/lib/terminal/dist/index.d.ts.map +1 -0
  398. package/lib/terminal/dist/index.js +397 -0
  399. package/lib/terminal/dist/index.js.map +1 -0
  400. package/lib/terminal/package.json +5 -0
  401. package/lib/terminal/src/index.ts +273 -0
  402. package/lib/testing/dist/index.d.ts +44 -1
  403. package/lib/testing/dist/index.d.ts.map +1 -1
  404. package/lib/testing/dist/index.js +63 -10
  405. package/lib/testing/dist/index.js.map +1 -1
  406. package/lib/testing/package.json +1 -1
  407. package/lib/testing/src/index.ts +83 -10
  408. package/lib/tools/dist/index.d.ts +32 -4
  409. package/lib/tools/dist/index.d.ts.map +1 -1
  410. package/lib/tools/dist/index.js +64 -11
  411. package/lib/tools/dist/index.js.map +1 -1
  412. package/lib/tools/package.json +1 -1
  413. package/lib/tools/src/index.ts +74 -13
  414. package/lib/workflows/dist/agent-step.d.ts +82 -0
  415. package/lib/workflows/dist/agent-step.d.ts.map +1 -0
  416. package/lib/workflows/dist/agent-step.js +161 -0
  417. package/lib/workflows/dist/agent-step.js.map +1 -0
  418. package/lib/workflows/dist/children-runtime.js +8 -8
  419. package/lib/workflows/dist/children-runtime.js.map +1 -1
  420. package/lib/workflows/dist/composite-fleet.js +2 -2
  421. package/lib/workflows/dist/composite-fleet.js.map +1 -1
  422. package/lib/workflows/dist/hook-relay.js +2 -2
  423. package/lib/workflows/dist/hook-relay.js.map +1 -1
  424. package/lib/workflows/dist/leadership.js +3 -3
  425. package/lib/workflows/dist/leadership.js.map +1 -1
  426. package/lib/workflows/dist/lifecycle-definition.d.ts +26 -4
  427. package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
  428. package/lib/workflows/dist/lifecycle-definition.js +31 -6
  429. package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
  430. package/lib/workflows/dist/lifecycle-fleet.d.ts.map +1 -1
  431. package/lib/workflows/dist/lifecycle-fleet.js +9 -11
  432. package/lib/workflows/dist/lifecycle-fleet.js.map +1 -1
  433. package/lib/workflows/dist/lifecycle-human-transport.d.ts +22 -2
  434. package/lib/workflows/dist/lifecycle-human-transport.d.ts.map +1 -1
  435. package/lib/workflows/dist/lifecycle-human-transport.js +115 -33
  436. package/lib/workflows/dist/lifecycle-human-transport.js.map +1 -1
  437. package/lib/workflows/dist/lifecycle-runtime.d.ts +62 -1
  438. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
  439. package/lib/workflows/dist/lifecycle-runtime.js +247 -64
  440. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
  441. package/lib/workflows/dist/lifecycle.d.ts +6 -4
  442. package/lib/workflows/dist/lifecycle.d.ts.map +1 -1
  443. package/lib/workflows/dist/lifecycle.js +2 -0
  444. package/lib/workflows/dist/lifecycle.js.map +1 -1
  445. package/lib/workflows/dist/loop-runtime.d.ts.map +1 -1
  446. package/lib/workflows/dist/loop-runtime.js +38 -26
  447. package/lib/workflows/dist/loop-runtime.js.map +1 -1
  448. package/lib/workflows/dist/migration.d.ts +1 -1
  449. package/lib/workflows/dist/migration.d.ts.map +1 -1
  450. package/lib/workflows/dist/migration.js +3 -3
  451. package/lib/workflows/dist/migration.js.map +1 -1
  452. package/lib/workflows/dist/operator-transports.d.ts +24 -2
  453. package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
  454. package/lib/workflows/dist/operator-transports.js +49 -3
  455. package/lib/workflows/dist/operator-transports.js.map +1 -1
  456. package/lib/workflows/dist/runtime.d.ts.map +1 -1
  457. package/lib/workflows/dist/runtime.js +12 -21
  458. package/lib/workflows/dist/runtime.js.map +1 -1
  459. package/lib/workflows/dist/saga-runtime.d.ts.map +1 -1
  460. package/lib/workflows/dist/saga-runtime.js +44 -30
  461. package/lib/workflows/dist/saga-runtime.js.map +1 -1
  462. package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
  463. package/lib/workflows/dist/scheduled-helpers.js +3 -3
  464. package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
  465. package/lib/workflows/dist/storage-failure.d.ts +16 -0
  466. package/lib/workflows/dist/storage-failure.d.ts.map +1 -0
  467. package/lib/workflows/dist/storage-failure.js +38 -0
  468. package/lib/workflows/dist/storage-failure.js.map +1 -0
  469. package/lib/workflows/dist/traces.js +2 -2
  470. package/lib/workflows/dist/traces.js.map +1 -1
  471. package/lib/workflows/package.json +1 -1
  472. package/lib/workflows/src/agent-step.ts +198 -0
  473. package/lib/workflows/src/children-runtime.ts +8 -8
  474. package/lib/workflows/src/composite-fleet.ts +2 -2
  475. package/lib/workflows/src/hook-relay.ts +2 -2
  476. package/lib/workflows/src/leadership.ts +3 -3
  477. package/lib/workflows/src/lifecycle-definition.ts +50 -9
  478. package/lib/workflows/src/lifecycle-fleet.ts +7 -8
  479. package/lib/workflows/src/lifecycle-human-transport.ts +110 -26
  480. package/lib/workflows/src/lifecycle-runtime.ts +254 -60
  481. package/lib/workflows/src/lifecycle.ts +7 -0
  482. package/lib/workflows/src/loop-runtime.ts +34 -25
  483. package/lib/workflows/src/migration.ts +2 -2
  484. package/lib/workflows/src/operator-transports.ts +48 -4
  485. package/lib/workflows/src/runtime.ts +12 -21
  486. package/lib/workflows/src/saga-runtime.ts +38 -28
  487. package/lib/workflows/src/scheduled-helpers.ts +3 -3
  488. package/lib/workflows/src/storage-failure.ts +37 -0
  489. package/lib/workflows/src/traces.ts +2 -2
  490. package/lib/workstream/dist/humans.d.ts +7 -3
  491. package/lib/workstream/dist/humans.d.ts.map +1 -1
  492. package/lib/workstream/dist/humans.js +13 -2
  493. package/lib/workstream/dist/humans.js.map +1 -1
  494. package/lib/workstream/dist/index.js +2 -2
  495. package/lib/workstream/dist/index.js.map +1 -1
  496. package/lib/workstream/dist/timers.js +2 -2
  497. package/lib/workstream/dist/timers.js.map +1 -1
  498. package/lib/workstream/dist/webhooks.d.ts +6 -2
  499. package/lib/workstream/dist/webhooks.d.ts.map +1 -1
  500. package/lib/workstream/dist/webhooks.js +17 -7
  501. package/lib/workstream/dist/webhooks.js.map +1 -1
  502. package/lib/workstream/package.json +1 -1
  503. package/lib/workstream/src/humans.ts +15 -5
  504. package/lib/workstream/src/index.ts +2 -2
  505. package/lib/workstream/src/timers.ts +2 -2
  506. package/lib/workstream/src/webhooks.ts +21 -8
  507. package/llms-full.txt +9289 -0
  508. package/llms.txt +90 -0
  509. package/package.json +16 -5
package/README.md CHANGED
@@ -1,55 +1,173 @@
1
1
  # Mayura
2
2
 
3
- An independent TypeScript framework for building agents, typed tools and durable workflows.
3
+ [![npm](https://img.shields.io/npm/v/mayura?label=npm)](https://www.npmjs.com/package/mayura)
4
+ [![CI](https://github.com/KartikeyAI/mayura/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/KartikeyAI/mayura/actions/workflows/ci.yml)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
4
6
 
5
- **Pre-1.0 — not yet published.** The public API is classified stable for 1.0 and gated by an API report ([policy](docs/api-stability.md)), but no package is published. Owner-held release steps remain; see the [v1 release plan](docs/v1-release-plan.md). Mayura is Apache-2.0 licensed; the currently qualified platforms are intentionally narrow. See [development status](docs/development-status.md) and the [support matrix](docs/support-matrix.md).
7
+ Mayura is a TypeScript framework for building AI agents, typed tools and durable workflows. You describe an agent with
8
+ schemas for what goes in and what comes out, give it tools, and run it on any major model provider. Mayura enforces
9
+ the rest: an agent can use only the models and tools you allow, every run has cost, step and time limits, inputs and
10
+ outputs are validated at every boundary, and when something can't be known for sure (did that payment go through?)
11
+ Mayura says so rather than guessing. When a task outgrows a single run, the same agents and tools become steps in
12
+ durable workflows that wait for people, timers and events, and survive restarts. It is one npm package, `mayura`,
13
+ with a CLI that scaffolds, runs and operates your project.
6
14
 
7
- Mayura is one npm package, `mayura` (not yet published). `mayura` is the SDK, and each part has its own entry point:
15
+ ## Features
16
+
17
+ - **Typed agents and tools.** Zod (or any Standard Schema validator) for inputs and outputs, validated at runtime and
18
+ inferred in TypeScript.
19
+ - **Any model.** OpenAI, Anthropic, and OpenAI-compatible providers such as Groq, Gemini, Mistral, DeepSeek, xAI,
20
+ OpenRouter, Together, Fireworks, Azure OpenAI and local servers. Route between providers with automatic failover.
21
+ - **Explicit permissions.** A run can use only the models, tools and effects you grant; nothing is implied by
22
+ registering a tool.
23
+ - **Cost control.** Model prices, per-call and per-run cost caps, and step, tool-call and time limits on every run;
24
+ budgets shared across agents and workflows.
25
+ - **Durable workflows.** Steps, approvals, timers, signals, fan-out, sagas and loops that survive restarts, on SQLite
26
+ or PostgreSQL.
27
+ - **People in the loop.** Approvals and typed questions for people, answered from code, the CLI, a React form or the
28
+ operator console.
29
+ - **Streaming.** Stream an agent's answer as it is written, with guards on every batch.
30
+ - **Vision.** Agents that see images and PDFs, with the input or from tools such as screenshots; checked by their
31
+ own bytes, limited, and never shown to hooks or logs.
32
+ - **Guardrails and hooks.** Input and output guards, PII redaction, moderation, and lifecycle hooks that can stop a
33
+ run.
34
+ - **Memory and context.** Native memory with keyword, semantic and hybrid search, plus Mem0, Supermemory and
35
+ OpenViking adapters.
36
+ - **Skills, MCP and Code Mode.** Load `SKILL.md` skills on demand, call MCP tools, and run model-written code in a
37
+ QuickJS or Docker sandbox.
38
+ - **Multi-agent.** Child agents, agents as tools and speculative branches under one shared budget.
39
+ - **Serve it anywhere.** An authenticated HTTP server with live events, a browser client, React hooks and components,
40
+ an operator console, and terminal chat or one-shot commands.
41
+ - **Observability.** Run events, workflow tracing and OpenTelemetry (OTLP) export. Nothing is sent anywhere unless you
42
+ configure it.
43
+ - **Test offline.** Scripted models run agents, tools and workflows without a network or an API key.
44
+
45
+ ## Quickstart
46
+
47
+ Mayura runs on Node.js 22 (22.12 or later) or 24 (24.14.1 or later).
48
+
49
+ ```bash
50
+ npm install mayura zod
51
+ ```
52
+
53
+ An agent that answers weather questions with a tool, on OpenAI:
54
+
55
+ ```ts
56
+ import { createRuntime, defineAgent, defineTool } from 'mayura';
57
+ import { openAIResponses } from 'mayura/provider-openai';
58
+ import { z } from 'zod';
59
+
60
+ const getWeather = defineTool({
61
+ id: 'weather.get', version: '1', description: 'Current weather for a city.',
62
+ input: z.object({ city: z.string() }),
63
+ output: z.object({ celsius: z.number(), sky: z.string() }),
64
+ effects: 'read', capabilities: [],
65
+ execute: async ({ city }) => ({ celsius: 21, sky: 'clear' }), // call your weather API here
66
+ });
67
+
68
+ const agent = defineAgent({
69
+ id: 'weather-assistant', version: '1',
70
+ instructions: 'Answer questions about the weather. Use the weather tool.',
71
+ input: z.object({ question: z.string() }), output: z.object({ reply: z.string() }), tools: [getWeather],
72
+ model: openAIResponses({
73
+ apiKey: process.env.OPENAI_API_KEY!, model: 'gpt-5-mini',
74
+ // Your model's prices, in micros (millionths of a dollar) per million tokens, and a cap per model call.
75
+ pricing: { inputMicrosPerMillionTokens: 250_000, outputMicrosPerMillionTokens: 2_000_000 },
76
+ maxCostMicros: 20_000,
77
+ }),
78
+ });
79
+
80
+ // Nothing is allowed unless you allow it, and every run has limits (here, at most 10 cents).
81
+ const runtime = createRuntime({
82
+ profile: 'ephemeral',
83
+ permissions: { allow: ['model:openai.responses', 'tool:weather.get', 'effect:read'] },
84
+ limits: { maxCostMicros: 100_000 },
85
+ });
86
+
87
+ const result = await runtime.submit(agent, { input: { question: 'Do I need an umbrella in Paris?' } }).result();
88
+ if (result.status === 'succeeded') console.log(result.output.reply);
89
+ else console.error(result.status, result.error.message);
90
+ await runtime.close();
91
+ ```
92
+
93
+ Mayura turns your Zod schemas into the JSON Schema the model provider needs. If a schema can't be sent to the
94
+ provider (for example a field is `.optional()`; use `.nullable()`), `defineAgent` tells you which field and how to fix
95
+ it before anything runs.
96
+
97
+ No API key yet? Swap the model for a scripted one and everything else runs offline, which is also how you test
98
+ agents:
8
99
 
9
100
  ```ts
10
- import { createRuntime, defineAgent } from 'mayura';
11
- import { defineWorkflowLifecycle, fanOut } from 'mayura/workflows/lifecycle';
12
- import { createSqliteStore } from 'mayura/storage-sqlite'; // with the optional peer: npm install better-sqlite3
101
+ import { scriptedModel } from 'mayura/testing';
102
+
103
+ const model = scriptedModel([
104
+ { type: 'tool_calls', calls: [{ id: 'call-1', toolId: 'weather.get', input: { city: 'Paris' } }], usage: { costMicros: 0 } },
105
+ { type: 'final', output: { reply: 'Clear skies and 21°C, so no umbrella needed.' }, usage: { costMicros: 0 } },
106
+ ]);
107
+ // Grant 'model:scripted' instead of 'model:openai.responses'.
13
108
  ```
14
109
 
15
- `npx mayura init` creates a project. Native SQLite, PostgreSQL, QuickJS and React are optional peers: install
16
- `better-sqlite3`, `pg`, `quickjs-emscripten-core` with `@jitl/quickjs-wasmfile-release-sync`, or `react` only when you
17
- use the part that needs it. Inside this repository the same entry points come from `packages/mayura`, a generated
18
- facade over the workspace packages (`@mayura/*`, which are internal and never published).
110
+ Anthropic (`anthropicMessages` from `mayura/provider-anthropic`) and OpenAI-compatible providers
111
+ (`openAICompatibleChat` from `mayura/provider-openai`) are drop-in replacements for the model. The
112
+ [quickstart](docs/quickstart.md) goes further: streaming, a durable workflow, and serving the agent over HTTP.
19
113
 
20
- ## Developing this checkout
114
+ ## CLI
21
115
 
22
- Mayura supports Node.js 22 LTS (>= 22.12.0) and 24 (>= 24.14.1); the maintainer workspace uses Node.js 24.14.1 and pnpm 10.17.1. Consumer applications will not need this workspace build system.
116
+ The `mayura` command comes with the package. Start a new project with the interactive wizard: pick a starter, pick a
117
+ model provider and paste its API key (it goes into the project's `.env`, never anywhere else).
23
118
 
24
- ```sh
25
- pnpm install --frozen-lockfile --ignore-scripts
26
- pnpm check
27
- pnpm example
119
+ ```bash
120
+ npx mayura init
28
121
  ```
29
122
 
30
- The basic SDK requires no Docker, native database, server or hosted account. [Select SQLite or PostgreSQL explicitly](docs/how-to/storage-installation.md); existing `mayura/storage` imports remain a both-adapter compatibility option. Docker is used only for integration testing/deployment profiles that select it.
123
+ Or without prompts, for scripts and CI:
31
124
 
32
- ## Current development slices
125
+ ```bash
126
+ npx mayura starters
127
+ npx mayura init --starter support-agent --directory my-agent
128
+ npx mayura init --starter support-agent --directory my-agent --apply
129
+ ```
33
130
 
34
- - Typed agents and tools, bounded process-local tool DAGs with exact predecessor-output references, and [required child agents](docs/how-to/agent-orchestration.md) with shared authority, budgets and cancellation.
35
- - [Workflow-as-tool composition](docs/how-to/workflow-composition.md) for explicit approval-free ephemeral graphs, without installing database drivers.
36
- - Optional SQL-backed workflows, approvals, signals, memory/context foundations and a [standalone leased job ledger](docs/specs/leased-scheduler.md). Explicit [scheduled workflows](docs/scheduled-workflows.md) couple claims, approvals, fixed costs and workflow transitions atomically.
37
- - [Durable completion waits](docs/how-to/execution-completion-waits.md) over existing scheduled workflows, without keeping a worker or callback alive while waiting.
38
- - [Versioned workflow graph waits](docs/how-to/workflow-graph-waits.md) with immutable existing-run targets, explicit resumption and metadata-only results before downstream tools or approvals.
39
- - [Finite graph discovery](docs/how-to/workflow-graph-discovery.md) for finding unfinished persisted graphs after restart, with bounded examined-owner pages and explicit application-owned continuation.
40
- - [Registered graph continuation](docs/how-to/workflow-graph-coordinator.md) through one shared driver, with finite pages, exact per-definition resource plans and safe partial-page retry reports.
41
- - [Durable shared budgets](docs/how-to/durable-budgets.md) for trusted hosts, with atomic financial/call reservations, unknown-cost retention and committed overrun evidence. Existing workflows are not automatically enrolled.
42
- - Local processors and [metered auxiliary guardrails](docs/specs/auxiliary-guardrails.md), including explicit moderation and protected-segment language processing.
43
- - [Required lifecycle hooks](docs/how-to/lifecycle-hooks.md) with immutable proposals, mediated read/pure-tool actions, shared limits and output withholding.
44
- - An authenticated Fetch API, browser-safe client and optional [loopback-only Hono/Node host](docs/how-to/local-server.md). This is not production or durable multi-host serving.
45
- - Authenticated, revision-bound [workflow signal delivery](docs/specs/workflow-signal-transport.md) across server, browser client and Node CLI, with application-owned durable journaling.
46
- - Optional [native metadata observability](docs/specs/native-observability.md) with bounded history, explicit gaps and isolated sinks, plus a separate experimental [OTLP/HTTP JSON log exporter](docs/specs/otlp-http-json-logs.md); neither is mandatory durable audit.
47
- - Optional [local artifact storage](docs/specs/local-artifacts.md) with scoped content addressing, staged promotion, integrity-checked reads, bounded attachment disclosure and staging cleanup.
131
+ `init` always shows its plan first and writes only with `--apply`. Four starters are complete server projects with a
132
+ worker, tests and deployment files: `support-agent`, `approval-workflow`, `research-team` and `event-automation`. The
133
+ fifth, `cli-agent`, is a command-line assistant you chat with in a terminal. There are also eight small single-file
134
+ templates (`mayura templates`).
135
+
136
+ Inside a project:
137
+
138
+ ```bash
139
+ mayura dev
140
+ mayura migrate --app dist/src/app.js
141
+ mayura serve --app dist/src/app.js
142
+ mayura worker --app dist/src/app.js
143
+ ```
48
144
 
49
- The retained verification history includes a clean 2,525-test two-process checkpoint with PostgreSQL and live Docker, later focused slices, packed-consumer profiles, cross-platform base installation checks and exact V01–V22 evidence. Passing those finite gates does not qualify untested production environments; see the [status ledger](docs/development-status.md) and [closure ledger](docs/release-gate-closure.md).
145
+ `mayura dev` builds, runs and restarts on every change, and loads `.env`. `migrate`, `serve` and `worker` run your
146
+ application in production. The CLI also operates a running server: runs, workflows, approvals and fleet control. The
147
+ token is always piped, never typed as an argument:
148
+
149
+ ```bash
150
+ echo "$MAYURA_OPERATOR_TOKEN" | mayura workflow-list --url https://agents.example.com --token-stdin
151
+ ```
152
+
153
+ Output is readable in a terminal and JSON when piped (or with `--json`). `mayura --help` lists every command.
50
154
 
51
155
  ## Documentation
52
156
 
53
- Start with the [quickstart](docs/quickstart.md), [documentation index](docs/README.md), and [architecture](docs/adr/0001-foundation.md).
157
+ - [Introduction](docs/introduction.md): what Mayura is and how its parts fit together.
158
+ - [Quickstart](docs/quickstart.md): from `npm install` to a served agent.
159
+ - [Concepts](docs/README.md#concepts): agents, tools, the runtime, outcomes, permissions, costs and workflows.
160
+ - [Guides](docs/README.md): model providers, streaming, durable workflows, storage, memory, guardrails, servers,
161
+ React, deployment and more.
162
+ - [CLI](docs/cli/overview.md) and the [entry point reference](docs/reference/entry-points.md).
163
+ - [Using Mayura with AI coding agents](docs/ai-agents.md): `llms.txt`, and documentation that ships inside the package.
164
+
165
+ The documentation also ships in the npm package (`node_modules/mayura/docs`), so your editor's AI assistant can read
166
+ the docs for the exact version you have installed.
167
+
168
+ ## Author and team
169
+
170
+ Mayura is created by **Aryabh** ([dev@rokad.co](mailto:dev@rokad.co)). The team section is coming soon.
54
171
 
55
- Mayura is open source under Apache-2.0. Workspace manifests remain private as a publication safety control; the controlled release process creates reviewed public artifacts only after registry/repository ownership and provenance are verified.
172
+ Mayura is open source under the [Apache-2.0 license](LICENSE). See [CONTRIBUTING.md](CONTRIBUTING.md) to contribute,
173
+ [SECURITY.md](SECURITY.md) to report a vulnerability and [SUPPORT.md](SUPPORT.md) for support.
package/docs/README.md ADDED
@@ -0,0 +1,81 @@
1
+ ---
2
+ title: "Mayura documentation"
3
+ description: "Every page of the Mayura documentation, in reading order."
4
+ ---
5
+
6
+ Mayura is a TypeScript framework for building AI agents, typed tools and durable workflows. New here? Read the
7
+ [introduction](introduction.md), then follow the [quickstart](quickstart.md).
8
+
9
+ ## Get started
10
+
11
+ - [Introduction](introduction.md): what Mayura is and how its parts fit together.
12
+ - [Quickstart](quickstart.md): create a project, or add a first agent to your own.
13
+ - [Installation](installation.md): requirements, optional packages and TypeScript settings.
14
+ - [Using Mayura with AI coding agents](ai-agents.md): documentation your assistant can read offline.
15
+
16
+ ## Concepts
17
+
18
+ - [Agents](concepts/agent.md): instructions, schemas, a model and tools.
19
+ - [Tools](concepts/tools.md): typed functions with declared effects.
20
+ - [Runtime](concepts/runtime.md): running agents, events, cancellation and limits.
21
+ - [Outcomes](concepts/outcomes.md): how a run ends, error codes, and what to do about each.
22
+ - [Permissions](concepts/permissions.md): the allow-list every run is checked against.
23
+ - [Costs and budgets](concepts/costs-and-budgets.md): prices, cost caps and shared budgets.
24
+ - [Workflows](concepts/workflows.md): multi-step work, in memory or durable.
25
+
26
+ ## Agents and models
27
+
28
+ - [Model providers](guides/model-providers.md): OpenAI, Anthropic and OpenAI-compatible providers.
29
+ - [Model routing](guides/model-routing.md): failover between providers.
30
+ - [Streaming](guides/streaming.md): show an answer while it is written.
31
+ - [Vision](guides/vision.md): agents that see images and PDFs, from the input or from tools.
32
+ - [Child agents](guides/child-agents.md): agents that delegate to other agents.
33
+ - [Skills](guides/skills.md): `SKILL.md` folders an agent loads on demand.
34
+ - [MCP tools](guides/mcp.md): call tools on an MCP server.
35
+ - [Terminal chat and commands](guides/terminal.md): run an agent in a terminal.
36
+ - [Testing](guides/testing.md): test agents, tools and workflows offline.
37
+
38
+ ## Workflows
39
+
40
+ - [Workflow composition](guides/workflow-composition.md): in-memory workflow graphs and workflows as tools.
41
+ - [Durable workflows](guides/durable-workflows.md): steps that survive restarts.
42
+ - [Approvals and human input](guides/approvals-and-human-input.md): wait for people.
43
+ - [Sagas and loops](guides/sagas-and-loops.md): compensation and repetition.
44
+ - [Webhooks](guides/webhooks.md): start and signal workflows from signed webhooks.
45
+ - [Operating workflows](guides/workflow-operations.md): pause, resume, cancel, versions and migrations.
46
+
47
+ ## Data, safety and extensions
48
+
49
+ - [Storage](guides/storage.md): SQLite and PostgreSQL.
50
+ - [Memory and context](guides/memory-and-context.md): what an agent remembers and sees.
51
+ - [Guardrails](guides/guardrails.md): check, block or redact inputs and outputs.
52
+ - [Lifecycle hooks](guides/lifecycle-hooks.md): code that can stop a run at defined points.
53
+ - [Artifacts](guides/artifacts.md): store files that runs produce.
54
+ - [Code Mode](guides/code-mode.md): run model-written code in a sandbox.
55
+ - [Helpers](guides/helpers.md): configuration, secrets, retries and other utilities.
56
+
57
+ ## Serve, observe and deploy
58
+
59
+ - [Server and client](guides/server-and-client.md): serve agents and workflows over HTTP.
60
+ - [React](guides/react.md): hooks, components and forms.
61
+ - [Observability](guides/observability.md): events, tracing and OpenTelemetry.
62
+ - [Operator console](guides/operator-console.md): a UI for runs, workflows and approvals.
63
+ - [Deployment](guides/deployment.md): run Mayura in production.
64
+
65
+ ## CLI
66
+
67
+ - [Overview](cli/overview.md): the `mayura` command.
68
+ - [mayura init](cli/init.md): starters and templates.
69
+ - [mayura dev](cli/dev.md): develop with rebuild and restart.
70
+ - [serve, worker and migrate](cli/run.md): run an application.
71
+ - [Operator commands](cli/operations.md): manage a running server.
72
+
73
+ ## Reference
74
+
75
+ - [Entry points](reference/entry-points.md): every `mayura/...` import.
76
+
77
+ ## Project
78
+
79
+ - [Versioning and stability](project/versioning.md): what each release promises.
80
+ - [Supported platforms](project/support.md): Node.js versions, operating systems and getting help.
81
+ - [Security model](project/security.md): what Mayura protects against, and reporting vulnerabilities.
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: "Using Mayura with AI coding agents"
3
+ description: "Point Claude Code, Cursor, Codex and other coding assistants at documentation that matches your installed Mayura version."
4
+ ---
5
+
6
+ Coding assistants write better Mayura code when they read the documentation for the version you actually have
7
+ installed, instead of guessing from memory. Mayura ships everything an assistant needs inside the package, and
8
+ `mayura init` tells assistants where to find it.
9
+
10
+ ## What's in the package
11
+
12
+ After `npm install mayura`, these are in `node_modules/mayura/`:
13
+
14
+ | File | What it is |
15
+ |---|---|
16
+ | `docs/` | This documentation, as Markdown, for the installed version. Start at `docs/README.md`. |
17
+ | `llms.txt` | An index of every page with a one-line description, in the [llms.txt](https://llmstxt.org) format. |
18
+ | `llms-full.txt` | All of the documentation in one file, for assistants that prefer to load everything at once. |
19
+ | `lib/<entry point>/dist/*.d.ts` | The exact types of every entry point, with doc comments. |
20
+
21
+ Because these come from the package, they always match the code your project runs, even offline.
22
+
23
+ ## Projects created by `mayura init`
24
+
25
+ Every project `mayura init` creates has an `AGENTS.md` that tells assistants:
26
+
27
+ - where the documentation is (`node_modules/mayura/docs/` and `llms-full.txt`);
28
+ - what the project is and which `npm run` scripts it has;
29
+ - the rules assistants most often get wrong: import paths, explicit permissions, cost limits in micros, strict
30
+ schemas for real models (`.nullable()`, not `.optional()`), checking `result.status`, keeping keys out of code, and testing offline.
31
+
32
+ It also has a `CLAUDE.md` that imports `AGENTS.md`, for assistants that read that file instead. Edit both freely; they
33
+ are yours.
34
+
35
+ ## Adding Mayura guidance to an existing project
36
+
37
+ If your project already has an `AGENTS.md` (or `CLAUDE.md`, `.cursorrules`, `copilot-instructions.md`), add this:
38
+
39
+ ```text
40
+ ## Mayura
41
+
42
+ This project uses Mayura (`mayura` on npm). Before writing Mayura code, read the documentation for the installed
43
+ version: node_modules/mayura/docs/README.md (index) or node_modules/mayura/llms-full.txt (everything in one file).
44
+
45
+ - Import from `mayura` or `mayura/<entry point>`, never `@mayura/...`.
46
+ - Grant permissions explicitly: `model:<adapter id>`, `tool:<tool id>`, `effect:<read|write|host>`, capabilities.
47
+ - Costs are in micros (1,000,000 = $1); set `limits.maxCostMicros` for runs that use paid models.
48
+ - Check `result.status` before `result.output`; `outcome_unknown` means reconcile, never retry blindly.
49
+ - Test offline with `scriptedModel` from `mayura/testing`.
50
+ ```
51
+
52
+ ## The CLI works well for agents
53
+
54
+ - `npx mayura --help` lists every command, and `--help` after any command explains it.
55
+ - `--json` (or any piped output) prints one JSON document per command, with a `status` field, so an agent can read
56
+ results reliably. Errors are JSON on stderr with a `code` and a `message`.
57
+ - `mayura init` is plan-first: without `--apply` it writes nothing and prints every file it would create. It never
58
+ replaces a file unless it is run again with `--apply --confirm` and the plan's digest, so an agent can't overwrite
59
+ your work by accident.
60
+ - The CLI never prompts for a token. Commands that talk to a server read it from standard input (`--token-stdin`), so
61
+ it never appears in the command line or the agent's transcript.
62
+
63
+ ## Online
64
+
65
+ The same index is at the root of the repository:
66
+ [llms.txt](https://github.com/KartikeyAI/mayura/blob/main/llms.txt).
67
+
68
+ ## Related
69
+
70
+ - [Quickstart](quickstart.md)
71
+ - [mayura init](cli/init.md)
72
+ - [CLI overview](cli/overview.md)
73
+ - [Entry points](reference/entry-points.md)
@@ -0,0 +1,111 @@
1
+ ---
2
+ title: "Develop with mayura dev"
3
+ description: "Build and run your project with mayura dev, load .env, and rebuild and restart on every saved change."
4
+ ---
5
+
6
+ `mayura dev` is the development loop for a Mayura project. It builds the project, runs it, and on every saved change
7
+ rebuilds and restarts it. It also loads the project's `.env` file, so your model provider settings and other
8
+ configuration reach the running code without being exported in your shell.
9
+
10
+ Every starter runs it as `npm run dev`:
11
+
12
+ ```bash
13
+ cd refunds
14
+ npm install
15
+ npm run dev
16
+ ```
17
+
18
+ You can also run it directly from the project directory:
19
+
20
+ ```bash
21
+ npx mayura dev
22
+ ```
23
+
24
+ ## What it runs
25
+
26
+ Run `mayura dev` in a directory with a `package.json`. It then:
27
+
28
+ 1. **Builds** the project with its `build` script. With no `build` script but a `tsconfig.json`, it runs
29
+ `tsc -p tsconfig.json`. With neither, it skips the build.
30
+ 2. **Starts** the built project, choosing the first of these that applies:
31
+ - the file you pass with `--entry <file>`;
32
+ - `dist/src/dev.js`, if the project has one. The starters use this for a one-process local run with demo data;
33
+ - otherwise, the application module (`--app <module>`, default `dist/src/app.js`) the way production runs it:
34
+ `mayura migrate` once, then `mayura serve` and `mayura worker` as two separate processes.
35
+
36
+ If there is nothing to run, it says so and keeps watching. If `migrate` fails, it waits for your next change.
37
+
38
+ | Option | Meaning |
39
+ |---|---|
40
+ | `--entry <file>` | Run this built file with Node.js instead of looking for `dist/src/dev.js`. |
41
+ | `--app <module>` | The application module for migrate, serve and worker. Default `dist/src/app.js`. |
42
+ | `--no-watch` | Build and run once. The command ends when the project exits. |
43
+
44
+ Paths are relative to the project directory and point at built JavaScript, not TypeScript sources. For the
45
+ application module's contract, see [Serve, worker and migrate](run.md).
46
+
47
+ A project created from a template builds to `dist/index.js`, so run it with an entry:
48
+
49
+ ```bash
50
+ npx mayura dev --entry dist/index.js
51
+ ```
52
+
53
+ ## .env loading
54
+
55
+ Before every build and every start, `mayura dev` reads `.env` from the project directory and passes its values to the
56
+ build and to the processes it starts. Editing `.env` takes effect on the next restart.
57
+
58
+ - Variables already set in your environment win over the file, as with `node --env-file`.
59
+ - It prints only the variable names it loaded, never their values:
60
+
61
+ ```text
62
+ loaded .env: ANTHROPIC_API_KEY, MAYURA_MODEL, MAYURA_MODEL_PROVIDER
63
+ ```
64
+
65
+ - `node_modules/.bin` is added to `PATH`, so build scripts find `tsc` and other local tools.
66
+
67
+ `.env` is for local development. In production, set the same variables in the real environment of your server and
68
+ worker processes; `mayura serve` and `mayura worker` do not read `.env`.
69
+
70
+ ## Watching and restarting
71
+
72
+ After the first start, `mayura dev` watches the project directory. When you save a file it waits 200 ms for more
73
+ changes, then rebuilds:
74
+
75
+ ```text
76
+ ~ src/workflow.ts changed
77
+ ✔ built in 2.4s
78
+ ● running dist/src/dev.js
79
+ ```
80
+
81
+ - **If the build succeeds**, it stops the running processes and starts them again with the new build.
82
+ - **If the build fails**, it prints the last 40 lines of the build output and leaves the last good version running.
83
+ Fix the error and save again.
84
+
85
+ It ignores changes the project makes to itself: `node_modules`, `dist`, `.data`, `.git`, `coverage`, SQLite
86
+ database files, `*.tsbuildinfo` and `*.log`. It reacts only when a file's modification time or size changes, or a
87
+ file appears or disappears, so merely reading files does not trigger a rebuild.
88
+
89
+ When it restarts, it asks each running process to stop and waits for it to exit. A process that has not exited
90
+ after 10 seconds is killed. On Windows the process is ended directly rather than interrupted.
91
+
92
+ ## Stopping
93
+
94
+ Press Ctrl+C once to stop. `mayura dev` stops watching and waits for the running processes to shut down
95
+ gracefully; they receive the same interrupt from the terminal, so a worker can drain its in-flight work. Press Ctrl+C
96
+ again to force an immediate exit.
97
+
98
+ ## Good to know
99
+
100
+ - If the platform cannot watch the directory recursively, `mayura dev` fails with `UNSUPPORTED_PROFILE`. Use
101
+ `--no-watch`.
102
+ - The `serve` and `worker` processes it starts write their own lifecycle lines to the same terminal.
103
+ - `mayura dev` is for your machine. For production, run `mayura migrate`, `mayura serve` and `mayura worker`
104
+ yourself; see [Serve, worker and migrate](run.md) and [Deployment](../guides/deployment.md).
105
+
106
+ ## Related
107
+
108
+ - [Create a project](init.md)
109
+ - [Serve, worker and migrate](run.md)
110
+ - [CLI overview](overview.md)
111
+ - [Model providers](../guides/model-providers.md)