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.
- package/README.md +153 -35
- package/docs/README.md +81 -0
- package/docs/ai-agents.md +73 -0
- package/docs/cli/dev.md +111 -0
- package/docs/cli/init.md +192 -0
- package/docs/cli/operations.md +235 -0
- package/docs/cli/overview.md +129 -0
- package/docs/cli/run.md +150 -0
- package/docs/concepts/agent.md +199 -0
- package/docs/concepts/costs-and-budgets.md +179 -0
- package/docs/concepts/outcomes.md +154 -0
- package/docs/concepts/permissions.md +156 -0
- package/docs/concepts/runtime.md +172 -0
- package/docs/concepts/tools.md +204 -0
- package/docs/concepts/workflows.md +135 -0
- package/docs/guides/approvals-and-human-input.md +279 -0
- package/docs/guides/artifacts.md +123 -0
- package/docs/guides/child-agents.md +159 -0
- package/docs/guides/code-mode.md +234 -0
- package/docs/guides/deployment.md +297 -0
- package/docs/guides/durable-workflows.md +462 -0
- package/docs/guides/guardrails.md +207 -0
- package/docs/guides/helpers.md +176 -0
- package/docs/guides/lifecycle-hooks.md +189 -0
- package/docs/guides/mcp.md +124 -0
- package/docs/guides/memory-and-context.md +294 -0
- package/docs/guides/model-providers.md +372 -0
- package/docs/guides/model-routing.md +138 -0
- package/docs/guides/observability.md +238 -0
- package/docs/guides/operator-console.md +140 -0
- package/docs/guides/react.md +276 -0
- package/docs/guides/sagas-and-loops.md +213 -0
- package/docs/guides/server-and-client.md +533 -0
- package/docs/guides/skills.md +152 -0
- package/docs/guides/storage.md +245 -0
- package/docs/guides/streaming.md +147 -0
- package/docs/guides/terminal.md +166 -0
- package/docs/guides/testing.md +222 -0
- package/docs/guides/vision.md +158 -0
- package/docs/guides/webhooks.md +172 -0
- package/docs/guides/workflow-composition.md +142 -0
- package/docs/guides/workflow-operations.md +268 -0
- package/docs/installation.md +89 -0
- package/docs/introduction.md +74 -0
- package/docs/project/security.md +178 -0
- package/docs/project/support.md +85 -0
- package/docs/project/versioning.md +119 -0
- package/docs/quickstart.md +193 -0
- package/docs/reference/entry-points.md +145 -0
- package/lib/adapter-code-docker/dist/index.d.ts +8 -1
- package/lib/adapter-code-docker/dist/index.d.ts.map +1 -1
- package/lib/adapter-code-docker/dist/index.js +64 -67
- package/lib/adapter-code-docker/dist/index.js.map +1 -1
- package/lib/adapter-code-docker/dist/options.d.ts +15 -0
- package/lib/adapter-code-docker/dist/options.d.ts.map +1 -0
- package/lib/adapter-code-docker/dist/options.js +56 -0
- package/lib/adapter-code-docker/dist/options.js.map +1 -0
- package/lib/adapter-code-docker/image/Dockerfile +4 -2
- package/lib/adapter-code-docker/package.json +1 -1
- package/lib/adapter-code-docker/src/index.ts +63 -65
- package/lib/adapter-code-docker/src/options.ts +51 -0
- package/lib/adapter-code-quickjs/dist/index.d.ts +16 -4
- package/lib/adapter-code-quickjs/dist/index.d.ts.map +1 -1
- package/lib/adapter-code-quickjs/dist/index.js +94 -50
- package/lib/adapter-code-quickjs/dist/index.js.map +1 -1
- package/lib/adapter-code-quickjs/dist/worker-command.d.ts +27 -0
- package/lib/adapter-code-quickjs/dist/worker-command.d.ts.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker-command.js +66 -0
- package/lib/adapter-code-quickjs/dist/worker-command.js.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker.js +421 -104
- package/lib/adapter-code-quickjs/dist/worker.js.map +1 -1
- package/lib/adapter-code-quickjs/package.json +1 -1
- package/lib/adapter-code-quickjs/src/index.ts +88 -44
- package/lib/adapter-code-quickjs/src/worker-command.ts +68 -0
- package/lib/adapter-code-quickjs/src/worker.ts +315 -89
- package/lib/adapter-mcp/package.json +1 -1
- package/lib/artifacts/dist/contracts.d.ts +6 -2
- package/lib/artifacts/dist/contracts.d.ts.map +1 -1
- package/lib/artifacts/dist/contracts.js.map +1 -1
- package/lib/artifacts/dist/index.d.ts +1 -0
- package/lib/artifacts/dist/index.d.ts.map +1 -1
- package/lib/artifacts/dist/index.js +1 -0
- package/lib/artifacts/dist/index.js.map +1 -1
- package/lib/artifacts/dist/local-store.d.ts.map +1 -1
- package/lib/artifacts/dist/local-store.js +4 -7
- package/lib/artifacts/dist/local-store.js.map +1 -1
- package/lib/artifacts/dist/media.d.ts +11 -0
- package/lib/artifacts/dist/media.d.ts.map +1 -0
- package/lib/artifacts/dist/media.js +18 -0
- package/lib/artifacts/dist/media.js.map +1 -0
- package/lib/artifacts/package.json +1 -1
- package/lib/artifacts/src/contracts.ts +6 -2
- package/lib/artifacts/src/index.ts +1 -0
- package/lib/artifacts/src/local-store.ts +5 -7
- package/lib/artifacts/src/media.ts +20 -0
- package/lib/cli/dist/agent-guide.d.ts +10 -0
- package/lib/cli/dist/agent-guide.d.ts.map +1 -0
- package/lib/cli/dist/agent-guide.js +47 -0
- package/lib/cli/dist/agent-guide.js.map +1 -0
- package/lib/cli/dist/bin.js +13 -4
- package/lib/cli/dist/bin.js.map +1 -1
- package/lib/cli/dist/dev.d.ts.map +1 -1
- package/lib/cli/dist/dev.js +7 -1
- package/lib/cli/dist/dev.js.map +1 -1
- package/lib/cli/dist/index.d.ts +2 -2
- package/lib/cli/dist/index.d.ts.map +1 -1
- package/lib/cli/dist/index.js +12 -2
- package/lib/cli/dist/index.js.map +1 -1
- package/lib/cli/dist/interactive.d.ts.map +1 -1
- package/lib/cli/dist/interactive.js +52 -11
- package/lib/cli/dist/interactive.js.map +1 -1
- package/lib/cli/dist/operations.d.ts +25 -2
- package/lib/cli/dist/operations.d.ts.map +1 -1
- package/lib/cli/dist/operations.js +125 -12
- package/lib/cli/dist/operations.js.map +1 -1
- package/lib/cli/dist/output.d.ts.map +1 -1
- package/lib/cli/dist/output.js +3 -0
- package/lib/cli/dist/output.js.map +1 -1
- package/lib/cli/dist/providers.d.ts +34 -4
- package/lib/cli/dist/providers.d.ts.map +1 -1
- package/lib/cli/dist/providers.js +26 -5
- package/lib/cli/dist/providers.js.map +1 -1
- package/lib/cli/package.json +1 -1
- package/lib/cli/src/agent-guide.ts +46 -0
- package/lib/cli/src/bin.ts +11 -3
- package/lib/cli/src/dev.ts +5 -1
- package/lib/cli/src/index.ts +10 -2
- package/lib/cli/src/interactive.ts +44 -12
- package/lib/cli/src/operations.ts +82 -12
- package/lib/cli/src/output.ts +3 -0
- package/lib/cli/src/providers.ts +45 -10
- package/lib/cli/starters/approval-workflow/dot-env.example +11 -0
- package/lib/cli/starters/approval-workflow/src/config.ts +24 -6
- package/lib/cli/starters/approval-workflow/src/model.ts +10 -3
- package/lib/cli/starters/cli-agent/README.md +121 -0
- package/lib/cli/starters/cli-agent/dot-env.example +37 -0
- package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/cli-agent/dot-gitignore +10 -0
- package/lib/cli/starters/cli-agent/mayura.project.json +15 -0
- package/lib/cli/starters/cli-agent/package.json +29 -0
- package/lib/cli/starters/cli-agent/skills/release-notes/SKILL.md +18 -0
- package/lib/cli/starters/cli-agent/skills/release-notes/references/example.md +12 -0
- package/lib/cli/starters/cli-agent/src/assistant.ts +125 -0
- package/lib/cli/starters/cli-agent/src/cli.ts +72 -0
- package/lib/cli/starters/cli-agent/src/config.ts +117 -0
- package/lib/cli/starters/cli-agent/src/model.ts +34 -0
- package/lib/cli/starters/cli-agent/src/workspace.ts +171 -0
- package/lib/cli/starters/cli-agent/test/assistant.test.ts +205 -0
- package/lib/cli/starters/cli-agent/tsconfig.json +20 -0
- package/lib/cli/starters/event-automation/README.md +4 -3
- package/lib/cli/starters/event-automation/dot-env.example +11 -0
- package/lib/cli/starters/event-automation/src/config.ts +24 -6
- package/lib/cli/starters/event-automation/src/ingress.ts +3 -5
- package/lib/cli/starters/event-automation/src/model.ts +10 -3
- package/lib/cli/starters/event-automation/src/triage.ts +15 -21
- package/lib/cli/starters/event-automation/test/automation.test.ts +3 -3
- package/lib/cli/starters/research-team/README.md +2 -2
- package/lib/cli/starters/research-team/dot-env.example +11 -0
- package/lib/cli/starters/research-team/src/config.ts +24 -6
- package/lib/cli/starters/research-team/src/model.ts +10 -3
- package/lib/cli/starters/research-team/src/services.ts +1 -1
- package/lib/cli/starters/research-team/src/workflow.ts +45 -58
- package/lib/cli/starters/support-agent/dot-env.example +11 -0
- package/lib/cli/starters/support-agent/src/assistant.ts +4 -3
- package/lib/cli/starters/support-agent/src/config.ts +24 -6
- package/lib/cli/starters/support-agent/src/guardrails.ts +3 -1
- package/lib/cli/starters/support-agent/src/model.ts +10 -3
- package/lib/cli/starters/support-agent/test/support.test.ts +25 -1
- package/lib/cli/templates/code-mode-workflow.ts +1 -1
- package/lib/client/dist/forms.d.ts.map +1 -1
- package/lib/client/dist/forms.js +3 -4
- package/lib/client/dist/forms.js.map +1 -1
- package/lib/client/dist/headless.d.ts +3 -1
- package/lib/client/dist/headless.d.ts.map +1 -1
- package/lib/client/dist/headless.js +10 -6
- package/lib/client/dist/headless.js.map +1 -1
- package/lib/client/dist/index.d.ts +95 -6
- package/lib/client/dist/index.d.ts.map +1 -1
- package/lib/client/dist/index.js +397 -124
- package/lib/client/dist/index.js.map +1 -1
- package/lib/client/dist/workflows.d.ts +1 -1
- package/lib/client/dist/workflows.d.ts.map +1 -1
- package/lib/client/dist/workflows.js +7 -6
- package/lib/client/dist/workflows.js.map +1 -1
- package/lib/client/package.json +1 -1
- package/lib/client/src/forms.ts +3 -4
- package/lib/client/src/headless.ts +13 -7
- package/lib/client/src/index.ts +344 -74
- package/lib/client/src/workflows.ts +8 -7
- package/lib/client-react/package.json +1 -1
- package/lib/code-mode/dist/index.d.ts +32 -1
- package/lib/code-mode/dist/index.d.ts.map +1 -1
- package/lib/code-mode/dist/index.js +289 -221
- package/lib/code-mode/dist/index.js.map +1 -1
- package/lib/code-mode/package.json +1 -1
- package/lib/code-mode/src/index.ts +288 -184
- package/lib/code-mode-workflows/package.json +1 -1
- package/lib/context/package.json +1 -1
- package/lib/core/dist/budget.d.ts.map +1 -1
- package/lib/core/dist/budget.js +17 -2
- package/lib/core/dist/budget.js.map +1 -1
- package/lib/core/dist/contracts.d.ts +57 -0
- package/lib/core/dist/contracts.d.ts.map +1 -1
- package/lib/core/dist/contracts.js +36 -0
- package/lib/core/dist/contracts.js.map +1 -1
- package/lib/core/dist/destination.d.ts +12 -0
- package/lib/core/dist/destination.d.ts.map +1 -0
- package/lib/core/dist/destination.js +37 -0
- package/lib/core/dist/destination.js.map +1 -0
- package/lib/core/dist/event-stream.d.ts +1 -1
- package/lib/core/dist/event-stream.d.ts.map +1 -1
- package/lib/core/dist/event-stream.js +7 -0
- package/lib/core/dist/event-stream.js.map +1 -1
- package/lib/core/dist/host.d.ts +3 -0
- package/lib/core/dist/host.d.ts.map +1 -1
- package/lib/core/dist/host.js +3 -0
- package/lib/core/dist/host.js.map +1 -1
- package/lib/core/dist/index.d.ts +2 -0
- package/lib/core/dist/index.d.ts.map +1 -1
- package/lib/core/dist/index.js +2 -0
- package/lib/core/dist/index.js.map +1 -1
- package/lib/core/dist/media.d.ts +98 -0
- package/lib/core/dist/media.d.ts.map +1 -0
- package/lib/core/dist/media.js +227 -0
- package/lib/core/dist/media.js.map +1 -0
- package/lib/core/dist/model-schema.d.ts +37 -0
- package/lib/core/dist/model-schema.d.ts.map +1 -0
- package/lib/core/dist/model-schema.js +154 -0
- package/lib/core/dist/model-schema.js.map +1 -0
- package/lib/core/package.json +1 -1
- package/lib/core/src/budget.ts +17 -2
- package/lib/core/src/contracts.ts +71 -3
- package/lib/core/src/destination.ts +33 -0
- package/lib/core/src/event-stream.ts +5 -1
- package/lib/core/src/host.ts +3 -0
- package/lib/core/src/index.ts +2 -0
- package/lib/core/src/media.ts +228 -0
- package/lib/core/src/model-schema.ts +129 -0
- package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
- package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
- package/lib/exporter-otlp/dist/signals.js +2 -2
- package/lib/exporter-otlp/dist/signals.js.map +1 -1
- package/lib/exporter-otlp/package.json +1 -1
- package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
- package/lib/exporter-otlp/src/signals.ts +2 -2
- package/lib/guardrails/package.json +1 -1
- package/lib/helpers/package.json +1 -1
- package/lib/memory/dist/index.js +1 -1
- package/lib/memory/dist/index.js.map +1 -1
- package/lib/memory/dist/native.d.ts.map +1 -1
- package/lib/memory/dist/native.js +4 -3
- package/lib/memory/dist/native.js.map +1 -1
- package/lib/memory/package.json +1 -1
- package/lib/memory/src/index.ts +1 -1
- package/lib/memory/src/native.ts +4 -3
- package/lib/memory-remote/package.json +1 -1
- package/lib/observability/package.json +1 -1
- package/lib/provider-anthropic/dist/index.d.ts +36 -3
- package/lib/provider-anthropic/dist/index.d.ts.map +1 -1
- package/lib/provider-anthropic/dist/index.js +128 -78
- package/lib/provider-anthropic/dist/index.js.map +1 -1
- package/lib/provider-anthropic/package.json +1 -1
- package/lib/provider-anthropic/src/index.ts +152 -76
- package/lib/provider-openai/dist/index.d.ts +71 -4
- package/lib/provider-openai/dist/index.d.ts.map +1 -1
- package/lib/provider-openai/dist/index.js +259 -96
- package/lib/provider-openai/dist/index.js.map +1 -1
- package/lib/provider-openai/package.json +1 -1
- package/lib/provider-openai/src/index.ts +282 -84
- package/lib/runtime/dist/agent.d.ts +18 -1
- package/lib/runtime/dist/agent.d.ts.map +1 -1
- package/lib/runtime/dist/agent.js +59 -3
- package/lib/runtime/dist/agent.js.map +1 -1
- package/lib/runtime/dist/composition.d.ts.map +1 -1
- package/lib/runtime/dist/composition.js +2 -1
- package/lib/runtime/dist/composition.js.map +1 -1
- package/lib/runtime/dist/hooks.d.ts +15 -3
- package/lib/runtime/dist/hooks.d.ts.map +1 -1
- package/lib/runtime/dist/hooks.js.map +1 -1
- package/lib/runtime/dist/index.d.ts +1 -1
- package/lib/runtime/dist/index.d.ts.map +1 -1
- package/lib/runtime/dist/index.js.map +1 -1
- package/lib/runtime/dist/response.d.ts +7 -1
- package/lib/runtime/dist/response.d.ts.map +1 -1
- package/lib/runtime/dist/response.js +23 -2
- package/lib/runtime/dist/response.js.map +1 -1
- package/lib/runtime/dist/router.d.ts +10 -3
- package/lib/runtime/dist/router.d.ts.map +1 -1
- package/lib/runtime/dist/router.js +45 -8
- package/lib/runtime/dist/router.js.map +1 -1
- package/lib/runtime/dist/runtime.d.ts +9 -1
- package/lib/runtime/dist/runtime.d.ts.map +1 -1
- package/lib/runtime/dist/runtime.js +50 -22
- package/lib/runtime/dist/runtime.js.map +1 -1
- package/lib/runtime/package.json +1 -1
- package/lib/runtime/src/agent.ts +69 -3
- package/lib/runtime/src/composition.ts +2 -1
- package/lib/runtime/src/hooks.ts +10 -4
- package/lib/runtime/src/index.ts +1 -1
- package/lib/runtime/src/response.ts +20 -2
- package/lib/runtime/src/router.ts +43 -10
- package/lib/runtime/src/runtime.ts +58 -27
- package/lib/sdk/package.json +1 -1
- package/lib/server/dist/index.d.ts +192 -3
- package/lib/server/dist/index.d.ts.map +1 -1
- package/lib/server/dist/index.js +687 -148
- package/lib/server/dist/index.js.map +1 -1
- package/lib/server/dist/inspector-bundle.d.ts +1 -1
- package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
- package/lib/server/dist/inspector-bundle.js +4 -4
- package/lib/server/dist/inspector-bundle.js.map +1 -1
- package/lib/server/package.json +1 -1
- package/lib/server/src/index.ts +589 -134
- package/lib/server/src/inspector-bundle.ts +4 -4
- package/lib/server-node/dist/hardening.d.ts +1 -1
- package/lib/server-node/dist/hardening.d.ts.map +1 -1
- package/lib/server-node/dist/hardening.js +4 -2
- package/lib/server-node/dist/hardening.js.map +1 -1
- package/lib/server-node/dist/index.d.ts +2 -1
- package/lib/server-node/dist/index.d.ts.map +1 -1
- package/lib/server-node/dist/index.js.map +1 -1
- package/lib/server-node/dist/probe.js +2 -2
- package/lib/server-node/dist/probe.js.map +1 -1
- package/lib/server-node/dist/production.d.ts +8 -1
- package/lib/server-node/dist/production.d.ts.map +1 -1
- package/lib/server-node/dist/production.js +15 -2
- package/lib/server-node/dist/production.js.map +1 -1
- package/lib/server-node/package.json +1 -1
- package/lib/server-node/src/hardening.ts +5 -3
- package/lib/server-node/src/index.ts +2 -1
- package/lib/server-node/src/probe.ts +2 -2
- package/lib/server-node/src/production.ts +23 -3
- package/lib/skills/dist/index.d.ts +81 -0
- package/lib/skills/dist/index.d.ts.map +1 -0
- package/lib/skills/dist/index.js +311 -0
- package/lib/skills/dist/index.js.map +1 -0
- package/lib/skills/package.json +5 -0
- package/lib/skills/src/index.ts +260 -0
- package/lib/storage/package.json +1 -1
- package/lib/storage-contracts/dist/contracts.d.ts +12 -5
- package/lib/storage-contracts/dist/contracts.d.ts.map +1 -1
- package/lib/storage-contracts/dist/contracts.js +24 -6
- package/lib/storage-contracts/dist/contracts.js.map +1 -1
- package/lib/storage-contracts/dist/index.d.ts +2 -0
- package/lib/storage-contracts/dist/index.d.ts.map +1 -1
- package/lib/storage-contracts/dist/index.js +2 -0
- package/lib/storage-contracts/dist/index.js.map +1 -1
- package/lib/storage-contracts/dist/memory-contracts.js +1 -1
- package/lib/storage-contracts/dist/memory-contracts.js.map +1 -1
- package/lib/storage-contracts/dist/run-records.d.ts +100 -0
- package/lib/storage-contracts/dist/run-records.d.ts.map +1 -0
- package/lib/storage-contracts/dist/run-records.js +464 -0
- package/lib/storage-contracts/dist/run-records.js.map +1 -0
- package/lib/storage-contracts/dist/schema-digest.d.ts +17 -0
- package/lib/storage-contracts/dist/schema-digest.d.ts.map +1 -0
- package/lib/storage-contracts/dist/schema-digest.js +94 -0
- package/lib/storage-contracts/dist/schema-digest.js.map +1 -0
- package/lib/storage-contracts/dist/submission-journal.js +1 -1
- package/lib/storage-contracts/dist/submission-journal.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.d.ts +30 -2
- package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.js +57 -5
- package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
- package/lib/storage-contracts/package.json +1 -1
- package/lib/storage-contracts/src/contracts.ts +29 -5
- package/lib/storage-contracts/src/index.ts +2 -0
- package/lib/storage-contracts/src/memory-contracts.ts +1 -1
- package/lib/storage-contracts/src/run-records.ts +365 -0
- package/lib/storage-contracts/src/schema-digest.ts +71 -0
- package/lib/storage-contracts/src/submission-journal.ts +1 -1
- package/lib/storage-contracts/src/workflow-format5.ts +70 -6
- package/lib/storage-postgres/dist/postgres.js +6 -6
- package/lib/storage-postgres/dist/postgres.js.map +1 -1
- package/lib/storage-postgres/package.json +1 -1
- package/lib/storage-postgres/src/postgres.ts +6 -6
- package/lib/storage-sql/dist/aggregate-session.js +1 -1
- package/lib/storage-sql/dist/aggregate-session.js.map +1 -1
- package/lib/storage-sql/dist/scheduled-database.js +1 -1
- package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
- package/lib/storage-sql/dist/workflow-tree-validation.js +1 -1
- package/lib/storage-sql/dist/workflow-tree-validation.js.map +1 -1
- package/lib/storage-sql/package.json +1 -1
- package/lib/storage-sql/src/aggregate-session.ts +1 -1
- package/lib/storage-sql/src/scheduled-database.ts +1 -1
- package/lib/storage-sql/src/workflow-tree-validation.ts +1 -1
- package/lib/storage-sqlite/dist/sqlite-database.js +4 -4
- package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -1
- package/lib/storage-sqlite/dist/sqlite-worker.js +2 -2
- package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -1
- package/lib/storage-sqlite/dist/sqlite.js +1 -1
- package/lib/storage-sqlite/dist/sqlite.js.map +1 -1
- package/lib/storage-sqlite/package.json +1 -1
- package/lib/storage-sqlite/src/sqlite-database.ts +4 -4
- package/lib/storage-sqlite/src/sqlite-worker.ts +2 -2
- package/lib/storage-sqlite/src/sqlite.ts +1 -1
- package/lib/terminal/dist/index.d.ts +92 -0
- package/lib/terminal/dist/index.d.ts.map +1 -0
- package/lib/terminal/dist/index.js +397 -0
- package/lib/terminal/dist/index.js.map +1 -0
- package/lib/terminal/package.json +5 -0
- package/lib/terminal/src/index.ts +273 -0
- package/lib/testing/dist/index.d.ts +44 -1
- package/lib/testing/dist/index.d.ts.map +1 -1
- package/lib/testing/dist/index.js +63 -10
- package/lib/testing/dist/index.js.map +1 -1
- package/lib/testing/package.json +1 -1
- package/lib/testing/src/index.ts +83 -10
- package/lib/tools/dist/index.d.ts +32 -4
- package/lib/tools/dist/index.d.ts.map +1 -1
- package/lib/tools/dist/index.js +64 -11
- package/lib/tools/dist/index.js.map +1 -1
- package/lib/tools/package.json +1 -1
- package/lib/tools/src/index.ts +74 -13
- package/lib/workflows/dist/agent-step.d.ts +82 -0
- package/lib/workflows/dist/agent-step.d.ts.map +1 -0
- package/lib/workflows/dist/agent-step.js +161 -0
- package/lib/workflows/dist/agent-step.js.map +1 -0
- package/lib/workflows/dist/children-runtime.js +8 -8
- package/lib/workflows/dist/children-runtime.js.map +1 -1
- package/lib/workflows/dist/composite-fleet.js +2 -2
- package/lib/workflows/dist/composite-fleet.js.map +1 -1
- package/lib/workflows/dist/hook-relay.js +2 -2
- package/lib/workflows/dist/hook-relay.js.map +1 -1
- package/lib/workflows/dist/leadership.js +3 -3
- package/lib/workflows/dist/leadership.js.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.d.ts +26 -4
- package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.js +31 -6
- package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
- package/lib/workflows/dist/lifecycle-fleet.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-fleet.js +9 -11
- package/lib/workflows/dist/lifecycle-fleet.js.map +1 -1
- package/lib/workflows/dist/lifecycle-human-transport.d.ts +22 -2
- package/lib/workflows/dist/lifecycle-human-transport.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-human-transport.js +115 -33
- package/lib/workflows/dist/lifecycle-human-transport.js.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.d.ts +62 -1
- package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.js +247 -64
- package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
- package/lib/workflows/dist/lifecycle.d.ts +6 -4
- package/lib/workflows/dist/lifecycle.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle.js +2 -0
- package/lib/workflows/dist/lifecycle.js.map +1 -1
- package/lib/workflows/dist/loop-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/loop-runtime.js +38 -26
- package/lib/workflows/dist/loop-runtime.js.map +1 -1
- package/lib/workflows/dist/migration.d.ts +1 -1
- package/lib/workflows/dist/migration.d.ts.map +1 -1
- package/lib/workflows/dist/migration.js +3 -3
- package/lib/workflows/dist/migration.js.map +1 -1
- package/lib/workflows/dist/operator-transports.d.ts +24 -2
- package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
- package/lib/workflows/dist/operator-transports.js +49 -3
- package/lib/workflows/dist/operator-transports.js.map +1 -1
- package/lib/workflows/dist/runtime.d.ts.map +1 -1
- package/lib/workflows/dist/runtime.js +12 -21
- package/lib/workflows/dist/runtime.js.map +1 -1
- package/lib/workflows/dist/saga-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/saga-runtime.js +44 -30
- package/lib/workflows/dist/saga-runtime.js.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.js +3 -3
- package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
- package/lib/workflows/dist/storage-failure.d.ts +16 -0
- package/lib/workflows/dist/storage-failure.d.ts.map +1 -0
- package/lib/workflows/dist/storage-failure.js +38 -0
- package/lib/workflows/dist/storage-failure.js.map +1 -0
- package/lib/workflows/dist/traces.js +2 -2
- package/lib/workflows/dist/traces.js.map +1 -1
- package/lib/workflows/package.json +1 -1
- package/lib/workflows/src/agent-step.ts +198 -0
- package/lib/workflows/src/children-runtime.ts +8 -8
- package/lib/workflows/src/composite-fleet.ts +2 -2
- package/lib/workflows/src/hook-relay.ts +2 -2
- package/lib/workflows/src/leadership.ts +3 -3
- package/lib/workflows/src/lifecycle-definition.ts +50 -9
- package/lib/workflows/src/lifecycle-fleet.ts +7 -8
- package/lib/workflows/src/lifecycle-human-transport.ts +110 -26
- package/lib/workflows/src/lifecycle-runtime.ts +254 -60
- package/lib/workflows/src/lifecycle.ts +7 -0
- package/lib/workflows/src/loop-runtime.ts +34 -25
- package/lib/workflows/src/migration.ts +2 -2
- package/lib/workflows/src/operator-transports.ts +48 -4
- package/lib/workflows/src/runtime.ts +12 -21
- package/lib/workflows/src/saga-runtime.ts +38 -28
- package/lib/workflows/src/scheduled-helpers.ts +3 -3
- package/lib/workflows/src/storage-failure.ts +37 -0
- package/lib/workflows/src/traces.ts +2 -2
- package/lib/workstream/dist/humans.d.ts +7 -3
- package/lib/workstream/dist/humans.d.ts.map +1 -1
- package/lib/workstream/dist/humans.js +13 -2
- package/lib/workstream/dist/humans.js.map +1 -1
- package/lib/workstream/dist/index.js +2 -2
- package/lib/workstream/dist/index.js.map +1 -1
- package/lib/workstream/dist/timers.js +2 -2
- package/lib/workstream/dist/timers.js.map +1 -1
- package/lib/workstream/dist/webhooks.d.ts +6 -2
- package/lib/workstream/dist/webhooks.d.ts.map +1 -1
- package/lib/workstream/dist/webhooks.js +17 -7
- package/lib/workstream/dist/webhooks.js.map +1 -1
- package/lib/workstream/package.json +1 -1
- package/lib/workstream/src/humans.ts +15 -5
- package/lib/workstream/src/index.ts +2 -2
- package/lib/workstream/src/timers.ts +2 -2
- package/lib/workstream/src/webhooks.ts +21 -8
- package/llms-full.txt +9289 -0
- package/llms.txt +90 -0
- package/package.json +16 -5
package/README.md
CHANGED
|
@@ -1,55 +1,173 @@
|
|
|
1
1
|
# Mayura
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/mayura)
|
|
4
|
+
[](https://github.com/KartikeyAI/mayura/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
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
|
-
|
|
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 {
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
`
|
|
16
|
-
`
|
|
17
|
-
|
|
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
|
-
##
|
|
114
|
+
## CLI
|
|
21
115
|
|
|
22
|
-
|
|
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
|
-
```
|
|
25
|
-
|
|
26
|
-
pnpm check
|
|
27
|
-
pnpm example
|
|
119
|
+
```bash
|
|
120
|
+
npx mayura init
|
|
28
121
|
```
|
|
29
122
|
|
|
30
|
-
|
|
123
|
+
Or without prompts, for scripts and CI:
|
|
31
124
|
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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)
|
package/docs/cli/dev.md
ADDED
|
@@ -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)
|