@mastra/mcp-docs-server 1.3.12 → 1.3.13-alpha.10
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/.docs/docs/agents/resumable-streams.md +140 -0
- package/.docs/docs/agents/tools.md +3 -2
- package/.docs/docs/auth/overview.md +1 -0
- package/.docs/docs/auth/simple-auth.md +8 -8
- package/.docs/docs/channels.md +34 -1
- package/.docs/docs/connections/mcp.md +73 -7
- package/.docs/docs/deployment/mastra-server.md +10 -2
- package/.docs/docs/deployment/workers.md +3 -1
- package/.docs/docs/guides/authentication-identity.md +4 -0
- package/.docs/docs/harness/background-tasks.md +2 -1
- package/.docs/docs/harness/durable-agents.md +106 -8
- package/.docs/docs/harness/goals.md +1 -1
- package/.docs/docs/harness/schedules.md +2 -0
- package/.docs/docs/knowledge/agents-and-tools.md +122 -0
- package/.docs/docs/knowledge/load-your-content.md +86 -0
- package/.docs/docs/knowledge/overview.md +106 -0
- package/.docs/docs/knowledge/patterns.md +167 -0
- package/.docs/docs/knowledge/pinned-context.md +177 -0
- package/.docs/docs/knowledge/scopes-and-access.md +202 -0
- package/.docs/docs/knowledge/search.md +63 -0
- package/.docs/docs/mastra-platform/connect.md +231 -0
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/memory/observational-memory.md +23 -23
- package/.docs/docs/memory/overview.md +19 -7
- package/.docs/docs/memory/semantic-recall.md +26 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +41 -0
- package/.docs/docs/observability/tracing/overview.md +0 -2
- package/.docs/docs/sandbox/skills.md +32 -3
- package/.docs/docs/server/custom-adapters.md +44 -11
- package/.docs/docs/server/middleware.md +1 -1
- package/.docs/docs/server/request-context.md +6 -6
- package/.docs/docs/server/server-adapters.md +12 -12
- package/.docs/docs/signals/sending-signals.md +3 -1
- package/.docs/docs/studio/knowledge.md +45 -24
- package/.docs/docs/studio/overview.md +3 -1
- package/.docs/docs/workflows/overview.md +12 -0
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +46 -0
- package/.docs/integrations/auth/clerk.md +46 -7
- package/.docs/integrations/auth/neon.md +217 -0
- package/.docs/integrations/auth/supabase.md +46 -7
- package/.docs/integrations/auth/workos.md +54 -15
- package/.docs/integrations/channels/discord.md +84 -6
- package/.docs/integrations/channels/github.md +63 -24
- package/.docs/integrations/channels/slack.md +89 -8
- package/.docs/integrations/channels/teams.md +79 -5
- package/.docs/integrations/channels/telegram.md +47 -6
- package/.docs/integrations/crm/attio.md +42 -0
- package/.docs/integrations/crm/clay.md +42 -0
- package/.docs/integrations/crm/hubspot.md +41 -0
- package/.docs/integrations/databases/neon.md +37 -1
- package/.docs/integrations/databases/postgresql.md +46 -0
- package/.docs/integrations/deploy/render.md +59 -18
- package/.docs/integrations/deploy/temporal.md +74 -0
- package/.docs/integrations/documents/google-docs.md +41 -0
- package/.docs/integrations/documents/google-sheet.md +41 -0
- package/.docs/integrations/documents/microsoft-excel.md +43 -0
- package/.docs/integrations/documents/microsoft-powerpoint.md +41 -0
- package/.docs/integrations/documents/microsoft-word.md +41 -0
- package/.docs/integrations/documents/notion.md +41 -0
- package/.docs/integrations/documents/one-drive.md +41 -0
- package/.docs/integrations/documents/sharepoint-online.md +41 -0
- package/.docs/integrations/email-calendar/google-calendar.md +41 -0
- package/.docs/integrations/email-calendar/google-mail.md +41 -0
- package/.docs/integrations/email-calendar/outlook.md +41 -0
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/google-drive.md +54 -15
- package/.docs/integrations/observability/arize.md +1 -1
- package/.docs/integrations/observability/posthog.md +50 -11
- package/.docs/integrations/other/canva.md +42 -0
- package/.docs/integrations/other/fireflies.md +41 -0
- package/.docs/integrations/other/incident-io.md +41 -0
- package/.docs/integrations/other/resend.md +43 -0
- package/.docs/integrations/other/robinhood.md +44 -0
- package/.docs/integrations/other/sanity.md +42 -0
- package/.docs/integrations/other/snowflake.md +41 -0
- package/.docs/integrations/project-management/jira.md +41 -0
- package/.docs/integrations/project-management/linear.md +41 -0
- package/.docs/integrations/sandboxes/e2b.md +1 -1
- package/.docs/integrations/voice/openai.md +40 -0
- package/.docs/integrations.md +40 -1
- package/.docs/models/environment-variables.md +1 -1
- package/.docs/models/gateways/azure-openai.md +61 -2
- package/.docs/models/gateways/custom-gateways.md +2 -0
- package/.docs/models/gateways/merge-gateway.md +3 -1
- package/.docs/models/gateways/netlify.md +13 -7
- package/.docs/models/gateways/openrouter.md +13 -12
- package/.docs/models/gateways/requesty.md +221 -0
- package/.docs/models/gateways/vercel.md +423 -419
- package/.docs/models/gateways.md +7 -1
- package/.docs/models/index.md +46 -3
- package/.docs/models/providers/aiand.md +1 -1
- package/.docs/models/providers/aihubmix.md +2 -0
- package/.docs/models/providers/amazon-bedrock.md +4 -0
- package/.docs/models/providers/anthropic.md +2 -1
- package/.docs/models/providers/azure.md +4 -0
- package/.docs/models/providers/baseten.md +2 -1
- package/.docs/models/providers/chutes.md +6 -4
- package/.docs/models/providers/cloudflare-ai-gateway.md +2 -0
- package/.docs/models/providers/cloudflare-workers-ai.md +0 -13
- package/.docs/models/providers/cohere.md +2 -0
- package/.docs/models/providers/crossmodel.md +5 -1
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/edenai.md +12 -13
- package/.docs/models/providers/empiriolabs.md +3 -3
- package/.docs/models/providers/fireworks-ai.md +30 -28
- package/.docs/models/providers/google-vertex.md +2 -0
- package/.docs/models/providers/google.md +4 -3
- package/.docs/models/providers/hyper.md +8 -14
- package/.docs/models/providers/inceptron.md +3 -3
- package/.docs/models/providers/kilo.md +36 -40
- package/.docs/models/providers/llmgateway-providers.md +448 -423
- package/.docs/models/providers/llmgateway.md +10 -6
- package/.docs/models/providers/meta.md +5 -4
- package/.docs/models/providers/modular.md +6 -6
- package/.docs/models/providers/morph.md +2 -1
- package/.docs/models/providers/nano-gpt.md +55 -62
- package/.docs/models/providers/novita-ai.md +4 -2
- package/.docs/models/providers/ollama-cloud.md +2 -1
- package/.docs/models/providers/ollama.md +2 -0
- package/.docs/models/providers/opencode-go.md +3 -1
- package/.docs/models/providers/opencode.md +11 -5
- package/.docs/models/providers/ovhcloud.md +1 -2
- package/.docs/models/providers/prime.md +4 -4
- package/.docs/models/providers/qvac.md +2 -0
- package/.docs/models/providers/tencent-token-plan.md +2 -1
- package/.docs/models/providers/tencent-tokenhub.md +2 -1
- package/.docs/models/providers/tinfoil.md +4 -3
- package/.docs/models/providers/togetherai.md +2 -1
- package/.docs/models/providers/wandb.md +6 -5
- package/.docs/models/providers.md +0 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +4 -2
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/agent.md +3 -1
- package/.docs/reference/agents/channels.md +117 -1
- package/.docs/reference/agents/durable-agent.md +42 -29
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getLLM.md +1 -1
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getModel.md +4 -2
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listScorers.md +1 -1
- package/.docs/reference/agents/listTools.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +33 -2
- package/.docs/reference/auth/better-auth.md +2 -2
- package/.docs/reference/auth/neon.md +24 -15
- package/.docs/reference/build-with-ai.md +12 -2
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +10 -1
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/client-js/observability.md +90 -3
- package/.docs/reference/code-sdk/mount-agent-controller.md +5 -1
- package/.docs/reference/connect/channels.md +55 -1
- package/.docs/reference/connect/credential.md +2 -1
- package/.docs/reference/connect/providers.md +5 -3
- package/.docs/reference/connect/tools.md +34 -3
- package/.docs/reference/core/addDynamicWorkflow.md +1 -1
- package/.docs/reference/core/addGateway.md +1 -1
- package/.docs/reference/core/getAgent.md +4 -2
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getGateway.md +1 -1
- package/.docs/reference/core/getGatewayById.md +14 -1
- package/.docs/reference/core/getMemory.md +2 -2
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/listMemory.md +3 -3
- package/.docs/reference/core/listScorers.md +2 -2
- package/.docs/reference/core/listVectors.md +1 -1
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/evals/completeness.md +0 -1
- package/.docs/reference/evals/content-similarity.md +1 -3
- package/.docs/reference/evals/create-scorer.md +8 -4
- package/.docs/reference/evals/faithfulness.md +1 -1
- package/.docs/reference/evals/hallucination.md +2 -2
- package/.docs/reference/evals/noise-sensitivity.md +8 -1
- package/.docs/reference/evals/scorer-utils.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +3 -3
- package/.docs/reference/index.md +8 -0
- package/.docs/reference/knowledge/knowledge-class.md +296 -0
- package/.docs/reference/knowledge/knowledge-memory-scopes.md +78 -0
- package/.docs/reference/knowledge/knowledge-tools.md +299 -0
- package/.docs/reference/knowledge/limits.md +44 -0
- package/.docs/reference/knowledge/scope-declarations.md +275 -0
- package/.docs/reference/knowledge/tool-instructions.md +56 -0
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +9 -7
- package/.docs/reference/observability/feedback.md +3 -1
- package/.docs/reference/observability/tracing/advanced-queries.md +47 -58
- package/.docs/reference/observability/tracing/configuration.md +3 -0
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +33 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +30 -0
- package/.docs/reference/observability/tracing/interfaces.md +2 -0
- package/.docs/reference/processors/batch-parts-processor.md +0 -2
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +8 -4
- package/.docs/reference/processors/skill-search-processor.md +3 -0
- package/.docs/reference/processors/skills-processor.md +84 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +1 -1
- package/.docs/reference/processors/tool-search-processor.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +4 -2
- package/.docs/reference/pubsub/redis-streams.md +3 -1
- package/.docs/reference/rag/graph-rag.md +2 -2
- package/.docs/reference/rag/rerank.md +1 -1
- package/.docs/reference/rag/rerankWithScorer.md +1 -1
- package/.docs/reference/schedules/overview.md +3 -3
- package/.docs/reference/server/invoke-route.md +86 -0
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/server/routes.md +63 -0
- package/.docs/reference/streaming/ChunkType.md +3 -1
- package/.docs/reference/streaming/agents/MastraModelOutput.md +13 -12
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/tools/mcp-client.md +30 -7
- package/.docs/reference/tools/mcp-server.md +6 -2
- package/.docs/reference/tools/vector-query-tool.md +3 -3
- package/.docs/reference/workers/overview.md +2 -2
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/start.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/run.md +1 -1
- package/.docs/reference/workflows/workflow.md +2 -0
- package/.docs/reference/workspace/factory-sandbox.md +24 -8
- package/.docs/reference/workspace/platform-sandbox.md +22 -7
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +5 -5
- package/dist/index.js +1 -1
- package/dist/{src-BDrEqwuY.js → src-CwUXyWAK.js} +3 -3
- package/dist/src-CwUXyWAK.js.map +1 -0
- package/dist/stdio.js +1 -1
- package/dist/tools/embedded-docs.d.ts.map +1 -1
- package/package.json +4 -5
- package/.docs/docs/mastra-platform/connect/channels.md +0 -165
- package/.docs/docs/mastra-platform/connect/overview.md +0 -102
- package/.docs/docs/mastra-platform/connect/providers.md +0 -66
- package/.docs/docs/mastra-platform/connect/tools.md +0 -151
- package/.docs/models/providers/requesty.md +0 -261
- package/dist/src-BDrEqwuY.js.map +0 -1
|
@@ -88,14 +88,14 @@ The tool returns an object with:
|
|
|
88
88
|
```typescript
|
|
89
89
|
{
|
|
90
90
|
id: string; // Unique chunk/document identifier
|
|
91
|
-
metadata
|
|
92
|
-
vector: number[]; // Embedding vector
|
|
91
|
+
metadata?: any; // All metadata fields (document ID, etc.)
|
|
92
|
+
vector: number[]; // Embedding vector, or [] when unavailable
|
|
93
93
|
score: number; // Similarity score for this retrieval
|
|
94
94
|
document: string; // Full chunk/document text (if available)
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
`document` is only populated by vector stores whose `query()` returns document content, such as Chroma, Elasticsearch, LanceDB, and MongoDB. For other stores, such as PgVector, it's an empty string. Read the chunk text from `sources[i].metadata
|
|
98
|
+
`document` is only populated by vector stores whose `query()` returns document content, such as Chroma, Elasticsearch, LanceDB, and MongoDB. For other stores, such as PgVector, it's an empty string. Read the chunk text from `sources[i].metadata?.text` (or whichever metadata key you stored it under). `metadata` is `undefined` when the store returns no metadata for a result.
|
|
99
99
|
|
|
100
100
|
## Default tool description
|
|
101
101
|
|
|
@@ -31,7 +31,7 @@ Setting `MASTRA_WORKERS` to any value, including `"false"`, also makes `createWo
|
|
|
31
31
|
|
|
32
32
|
The base URL of the API server, used by the orchestration worker to execute workflow steps remotely. Required when the orchestration worker runs in a separate process from the API.
|
|
33
33
|
|
|
34
|
-
```
|
|
34
|
+
```bash
|
|
35
35
|
MASTRA_STEP_EXECUTION_URL=http://api:4111/api
|
|
36
36
|
```
|
|
37
37
|
|
|
@@ -47,7 +47,7 @@ ${MASTRA_STEP_EXECUTION_URL}/workflows/:workflowId/runs/:runId/steps/execute
|
|
|
47
47
|
|
|
48
48
|
A bearer token sent by the orchestration worker when calling the API's step execution endpoint. The API's configured auth provider must recognize this token. See [Worker authentication](https://mastra.ai/docs/auth/workers).
|
|
49
49
|
|
|
50
|
-
```
|
|
50
|
+
```bash
|
|
51
51
|
MASTRA_WORKER_AUTH_TOKEN=sk-worker-secret-token
|
|
52
52
|
```
|
|
53
53
|
|
|
@@ -24,7 +24,7 @@ if (result.status === 'suspended') {
|
|
|
24
24
|
|
|
25
25
|
**resumeData** (`z.infer<TResumeSchema>`): Data for resuming the suspended step
|
|
26
26
|
|
|
27
|
-
**step** (`Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]`): The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or array of step
|
|
27
|
+
**step** (`Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[]`): The step(s) to resume execution from. Can be a Step instance, array of Steps, step ID string, or a step path (an array of step IDs, such as an entry of result.suspended)
|
|
28
28
|
|
|
29
29
|
**requestContext** (`RequestContext`): Request Context data to use when resuming
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ const result = await run.start({
|
|
|
40
40
|
|
|
41
41
|
**tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
42
42
|
|
|
43
|
-
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters).
|
|
43
|
+
**tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). Used to correlate with an external tracing system. Mastra does not treat it as a parent within Mastra storage unless nestUnderParent is true and a valid traceId is also set.
|
|
44
44
|
|
|
45
45
|
**tracingOptions.nestUnderParent** (`boolean`): Set to true together with parentSpanId to attach this run as a child of that span inside the existing trace, for example an LLM judge under the run it scores. Exporters then keep the trace's own name, input, output, and tags. Leave unset when parentSpanId comes from your own tracing system. Ignored without a valid traceId and parentSpanId.
|
|
46
46
|
|
|
@@ -63,7 +63,7 @@ const result = await run.timeTravel({
|
|
|
63
63
|
|
|
64
64
|
## Returns
|
|
65
65
|
|
|
66
|
-
**result** (`
|
|
66
|
+
**result** (`TOutput`): The workflow output. Present when status is 'success'.
|
|
67
67
|
|
|
68
68
|
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
69
69
|
|
|
@@ -62,7 +62,7 @@ A workflow run's `status` indicates its current execution state. The possible va
|
|
|
62
62
|
|
|
63
63
|
**canceled** (`string`): Workflow execution was canceled via the cancel() method. Subsequent steps do not run, and running steps stop only if they respond to their abortSignal
|
|
64
64
|
|
|
65
|
-
**bailed** (`string`):
|
|
65
|
+
**bailed** (`string`): Internal status for a step that called bail() to end the workflow early. Runs never report it: a bailed run completes with status success and the bail payload as its result, and the bailing step is recorded as success too. With the evented engine and perStep: true, the run reports paused with no top-level result instead, and the bail payload stays in the step output
|
|
66
66
|
|
|
67
67
|
**skipped** (`string`): Execution was skipped, for example a branch whose condition didn't match. Mainly reported for individual steps
|
|
68
68
|
|
|
@@ -131,6 +131,8 @@ export const testWorkflow = createWorkflow({
|
|
|
131
131
|
|
|
132
132
|
**options.pruneSnapshot** (`(params: { snapshot: WorkflowRunState; workflowStatus: WorkflowRunStatus }) => WorkflowRunState`): Optional hook to transform the workflow snapshot immediately before it is persisted. Must return JSON-serializable data and preserve everything the workflow needs to resume (suspended step suspendPayloads, suspendedPaths, executionPath, etc.). Used internally by agent runs to keep snapshots minimal; user workflows persist full snapshots by default.
|
|
133
133
|
|
|
134
|
+
**options.storageVersion** (`1 | 2`): Experimental. How runs of this workflow are stored. 1 rewrites the whole run on every save. 2 saves only what changed at each step, which cuts storage writes for long workflows and loops. Version 2 requires the default execution engine and a storage adapter that supports it: in-memory, @mastra/pg, or @mastra/libsql. Creating a run on another adapter throws. It can't be combined with pruneSnapshot. Inside a version 2 run, read earlier steps with await getStepResultAsync(step) instead of getStepResult(step), and a shouldPersistSnapshot predicate sees earlier successful steps without their output. Workflow state is stored as JSON, so values such as Date are read back as strings. A run keeps the version it was stored with, so a run resumed after changing this option continues in that version. A nested workflow's runs use their parent run's version, so this option applies only when the workflow runs on its own.
|
|
135
|
+
|
|
134
136
|
**options.onStart** (`(info: WorkflowStartCallbackInfo) => void | Promise<void>`): Callback awaited before a run starts executing, and before any step runs. Fires only on initial start, not on resume, restart, or time travel. Unlike onFinish and onError, errors thrown here are propagated: they reject the start() or stream() call and the run never executes, so this can be used as a pre-flight gate such as a quota check. The run record created by createRun() stays at status pending.
|
|
135
137
|
|
|
136
138
|
**options.onStart.runId** (`string`): The workflow run ID
|
|
@@ -26,12 +26,12 @@ export const factory = new MastraFactory({
|
|
|
26
26
|
|
|
27
27
|
## Provider classes
|
|
28
28
|
|
|
29
|
-
| Class | Package | Settings
|
|
30
|
-
| ------------------------ | ---------------------------- |
|
|
31
|
-
| `PlatformFactorySandbox` | `@mastra/platform-workspace` | `cpuCount`, `memoryMb`, `idleTimeoutMinutes` | `start`, `get` |
|
|
32
|
-
| `E2BFactorySandbox` | `@mastra/e2b` | `cpuCount`, `memoryMb`, `idleTimeoutMinutes`
|
|
33
|
-
| `DockerFactorySandbox` | `@mastra/docker` | `baseImage`, `owner`
|
|
34
|
-
| `LocalFactorySandbox` | `@mastra/factory` | None
|
|
29
|
+
| Class | Package | Settings | Builds |
|
|
30
|
+
| ------------------------ | ---------------------------- | ----------------------------------------------------------- | ---------------------- |
|
|
31
|
+
| `PlatformFactorySandbox` | `@mastra/platform-workspace` | `cpuCount`, `memoryMb`, `idleTimeoutMinutes`, `publicPorts` | `start`, `get` |
|
|
32
|
+
| `E2BFactorySandbox` | `@mastra/e2b` | `cpuCount`, `memoryMb`, `idleTimeoutMinutes` | `start`, `get`, `list` |
|
|
33
|
+
| `DockerFactorySandbox` | `@mastra/docker` | `baseImage`, `owner` | `start`, `get` |
|
|
34
|
+
| `LocalFactorySandbox` | `@mastra/factory` | None | No |
|
|
35
35
|
|
|
36
36
|
Each provider class takes the same runtime options as its sandbox class (minus `id`, `sandboxId` and `template`, which the class fills in per session), plus `template` options for the repository template and `defaults` for settings the environment leaves unset.
|
|
37
37
|
|
|
@@ -72,7 +72,7 @@ When you omit the `sandbox` option and Platform credentials (`MASTRA_PLATFORM_AC
|
|
|
72
72
|
|
|
73
73
|
An explicit `sandbox` option always takes precedence. Without Platform credentials and without a `sandbox` option, repository sandboxes are off.
|
|
74
74
|
|
|
75
|
-
For an unset setting, the provider applies its own default: 2 CPUs, 1024 MB and a 5 minute idle timeout on Platform and E2B, overridable through `defaults`. On Platform,
|
|
75
|
+
For an unset setting, the provider applies its own default: 2 CPUs, 1024 MB and a 5 minute idle timeout on Platform and E2B, overridable through `defaults`. On Platform, top-level `idleTimeoutMinutes` and `publicPorts` options also apply when `defaults` doesn't set them. `publicPorts` is off by default: when on, anyone with a port's URL can open it without signing in. It applies to sandboxes created after it changes. The schema's `default` values show the effective defaults.
|
|
76
76
|
|
|
77
77
|
Platform polls a build through the builder that started it. After a host restart, an earlier build reads as `unknown`.
|
|
78
78
|
|
|
@@ -180,6 +180,10 @@ Everything Factory knows about the session, passed to `create`, `template` and t
|
|
|
180
180
|
|
|
181
181
|
**resolveHead** (`(cloneUrl, token?) => Promise<string | undefined>`): Resolves the commit a repository template pins, given its clone URL and the credential minted for it. When absent, the provider resolves the default branch head itself.
|
|
182
182
|
|
|
183
|
+
**buildEnv** (`Record<string, string>`): Environment for template builds and setup steps only, never for runtime commands. Keep it out of the template identity and the image. A provider whose builder can't do that may ignore it. If you spread the context into a repository template, take this field out of the spread so it doesn't reach the template's own buildEnv. Factory sets it from the factory's Build variables.
|
|
184
|
+
|
|
185
|
+
**buildEnvRevision** (`string`): Opaque id that changes whenever buildEnv changes. Include it in the template identity so an edit rebuilds the template. It is a random id, never derived from the values.
|
|
186
|
+
|
|
183
187
|
## Build status
|
|
184
188
|
|
|
185
189
|
`FactorySandboxBuild.status` is one of `pending`, `building`, `ready`, `failed` or `unknown`. `unknown` means the provider can't read the status of a build it didn't start in this process.
|
|
@@ -192,7 +196,19 @@ When the sandbox declares `builds`, factory builds the environment template ahea
|
|
|
192
196
|
- on a cron schedule kept in core `Schedules`, enabled through `PATCH { buildTriggers: { schedule: { enabled: true, cron, timezone } } }`; needs a storage adapter with the schedules domain, otherwise the route reports `scheduleAvailable: false`
|
|
193
197
|
- after a push to a linked repository's default branch when `buildTriggers.push.enabled` is set, at most once per `debounceMinutes`
|
|
194
198
|
|
|
195
|
-
Saving environment settings never starts a build. Scheduled and push builds skip when the last build is ready, no repository head moved and no template input changed (settings, repositories and their order, setup commands or the
|
|
199
|
+
Saving environment settings never starts a build. Scheduled and push builds skip when the last build is ready, no repository head moved and no template input changed (settings, repositories and their order, setup commands, the working directory or the factory's Build variables). Factory stores only the last build id and the active template. Status and history come from the provider through `GET …/environment/builds/:buildId` and `GET …/environment/builds` (404 `no_history` when the provider keeps none).
|
|
200
|
+
|
|
201
|
+
## Environment variables
|
|
202
|
+
|
|
203
|
+
Factory members add environment variables for every sandbox of a factory in **Settings › Manage Factory › Environment variables**. Each variable applies to one of:
|
|
204
|
+
|
|
205
|
+
- **Runtime**: Every command in every session sandbox. Adding, editing or deleting one takes effect on the next command in a running sandbox, without a restart. Other Factory servers see the change when the factory's `pubsub` delivers it, or within a second when no cross-process `pubsub` is configured. A process that's already running keeps the environment it started with.
|
|
206
|
+
- **Build**: The template build and the setup commands Factory runs itself, never runtime commands. Factory passes them to the provider as `buildEnv` and `buildEnvRevision`. An edit rebuilds the template on the next build. A running sandbox doesn't rerun setup. New sandboxes start from the rebuilt template, which holds whatever setup produced with the new values, while their own commands never see the values. On Docker, template builds don't receive Build variables yet and an edit doesn't rebuild the image, so only a setup that Factory runs itself sees them.
|
|
207
|
+
- **Both**: Runtime and build.
|
|
208
|
+
|
|
209
|
+
A runtime variable with the same name as a key from the provider's `env` option replaces it, and deleting the variable restores the host value. Names that Factory sets itself, such as `GH_TOKEN`, are reserved.
|
|
210
|
+
|
|
211
|
+
Values are encrypted at rest with the factory's credential encryption key and can't be read back through the API or the UI. Anything running in the sandbox can read them. When sign-in is on and no encryption key is configured, Factory refuses to save variables and the settings page explains why. The routes are `GET /web/factory/projects/:id/sandbox-envs` and `PUT`, `PATCH` and `DELETE /web/factory/projects/:id/sandbox-envs/:name`.
|
|
196
212
|
|
|
197
213
|
## Related
|
|
198
214
|
|
|
@@ -46,7 +46,6 @@ Configure the platform credentials. The access token, project ID, and environmen
|
|
|
46
46
|
MASTRA_PLATFORM_ACCESS_TOKEN=your-platform-access-token
|
|
47
47
|
MASTRA_PROJECT_ID=your-project-id
|
|
48
48
|
MASTRA_ENVIRONMENT_ID=your-environment-id
|
|
49
|
-
SANDBOX_PROVIDER=railway
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
**Constructor**:
|
|
@@ -61,7 +60,7 @@ new PlatformSandbox({
|
|
|
61
60
|
|
|
62
61
|
On a Mastra Platform deployment, `MASTRA_PLATFORM_ACCESS_TOKEN`, `MASTRA_PROJECT_ID`, and `MASTRA_ENVIRONMENT_ID` are injected automatically, so the constructor can be called with no options. For local development, `MASTRA_PLATFORM_ACCESS_TOKEN` can contain an `sk_` API token from your organization's settings page under **API Tokens**.
|
|
63
62
|
|
|
64
|
-
The sandbox provider resolves from the constructor's `sandboxProvider` option, then `SANDBOX_PROVIDER`, then defaults to `
|
|
63
|
+
The sandbox provider resolves from the constructor's `sandboxProvider` option, then `SANDBOX_PROVIDER`, then defaults to `e2b`.
|
|
65
64
|
|
|
66
65
|
## Usage
|
|
67
66
|
|
|
@@ -108,6 +107,20 @@ const workspace = new Workspace({
|
|
|
108
107
|
|
|
109
108
|
The default `ISOLATED` mode allows outbound internet access only, with no private network connectivity.
|
|
110
109
|
|
|
110
|
+
### Public ports
|
|
111
|
+
|
|
112
|
+
Ports are private by default: opening one needs a signed-in preview link. Set `publicPorts` to let anyone with a port's URL reach it, for example a webhook receiver:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const workspace = new Workspace({
|
|
116
|
+
sandbox: new PlatformSandbox({
|
|
117
|
+
publicPorts: true,
|
|
118
|
+
}),
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The port URL is the same either way. Only whether it asks for sign-in changes. The setting is fixed when the sandbox is created, so passing it when reattaching changes nothing for that sandbox. Clones use the `publicPorts` option you passed, not the reattached sandbox's setting.
|
|
123
|
+
|
|
111
124
|
### Reattaching to a running sandbox
|
|
112
125
|
|
|
113
126
|
Pass an existing `sandboxId` to reattach to a live sandbox instead of creating a new one:
|
|
@@ -190,7 +203,7 @@ await sandbox.start()
|
|
|
190
203
|
|
|
191
204
|
`createRepoTemplate()` accepts the same `cpuCount`, `memoryMB`, and `docker` settings as the `Template()` builder methods, as plain options. They carry the identity and stale-fallback semantics described above. Omit them for the provider defaults.
|
|
192
205
|
|
|
193
|
-
`setupCommand` also accepts an array. Each entry runs as its own cached build step. `workingDirectory` sets the cwd for the build and the sandbox, and the repository is cloned to `<workingDirectory>/<repo>`. `buildEnv` passes environment variables to the build steps only. They never enter the serialized definition.
|
|
206
|
+
`setupCommand` also accepts an array. Each entry runs as its own cached build step. `workingDirectory` sets the cwd for the build and the sandbox, and the repository is cloned to `<workingDirectory>/<repo>`. `buildEnv` passes environment variables to the build steps only. They never enter the serialized definition. `buildEnvRevision` is an opaque id written ahead of the clone and setup steps. A new revision rebuilds them. Change it whenever `buildEnv` changes and never derive it from the values.
|
|
194
207
|
|
|
195
208
|
`getRepositoryAccess` mirrors the resolver a Factory sandbox context carries, so a host can pass its context straight through; when it's absent, `createRepoTemplate()` returns `undefined` and the sandbox boots the provider default. The resolver skips reattachment to an existing `sandboxId`; on a fresh start, it resolves the repository's default-branch head before Platform starts or reuses the corresponding template build. If the repository head can't be resolved or the provider build fails, sandbox creation continues with the provider's default template so runtime setup can perform a cold checkout. For private repositories, the short-lived authorization token is sent as an ephemeral build environment value that stays out of the serialized definition and the persisted template record. It has no effect on content identity.
|
|
196
209
|
|
|
@@ -285,7 +298,7 @@ const sandbox = new PlatformSandbox({
|
|
|
285
298
|
|
|
286
299
|
### Cloning for a fleet of sandboxes
|
|
287
300
|
|
|
288
|
-
`clone()` returns an independent sibling `PlatformSandbox` that inherits credentials and defaults (access token, project, environment, provider, template, network isolation, timeout, instructions, env, idle timeout) with per-instance overrides. The returned sandbox is unstarted and provisions on its own `start()`, so `clone()` performs no I/O:
|
|
301
|
+
`clone()` returns an independent sibling `PlatformSandbox` that inherits credentials and defaults (access token, project, environment, provider, template, network isolation, timeout, instructions, env, idle timeout, public ports) with per-instance overrides. The returned sandbox is unstarted and provisions on its own `start()`, so `clone()` performs no I/O:
|
|
289
302
|
|
|
290
303
|
```typescript
|
|
291
304
|
const template = new PlatformSandbox({
|
|
@@ -341,7 +354,7 @@ A long-running process's output stream reconnects periodically, and the process
|
|
|
341
354
|
|
|
342
355
|
**projectId** (`string`): Platform project ID. Falls back to the MASTRA_PROJECT_ID environment variable.
|
|
343
356
|
|
|
344
|
-
**sandboxProvider** (`'railway' | 'e2b'`): Provider used for sandbox and template routes. Falls back to SANDBOX_PROVIDER, then
|
|
357
|
+
**sandboxProvider** (`'railway' | 'e2b'`): Provider used for sandbox and template routes. Falls back to SANDBOX_PROVIDER, then e2b.
|
|
345
358
|
|
|
346
359
|
**environmentId** (`string`): Platform environment ID the sandbox belongs to. Falls back to the MASTRA_ENVIRONMENT_ID environment variable. Required unless sandboxId is passed.
|
|
347
360
|
|
|
@@ -357,6 +370,8 @@ A long-running process's output stream reconnects periodically, and the process
|
|
|
357
370
|
|
|
358
371
|
**networkIsolation** (`'ISOLATED' | 'PRIVATE'`): Network mode. 'ISOLATED' (default) allows outbound internet only. 'PRIVATE' joins the platform environment's private network.
|
|
359
372
|
|
|
373
|
+
**publicPorts** (`boolean`): Let anyone with a port's URL reach it without signing in. Defaults to false. Fixed when the sandbox is created.
|
|
374
|
+
|
|
360
375
|
**env** (`Record<string, string>`): Environment variables baked into the sandbox at creation time. Per-command environment variables can also be passed to executeCommand.
|
|
361
376
|
|
|
362
377
|
**workingDirectory** (`string`): Default directory for command execution when no per-command cwd is given. A per-command cwd always wins. Use an absolute path.
|
|
@@ -380,7 +395,7 @@ const url = await sandbox.networking?.getPortUrl(3000)
|
|
|
380
395
|
// https://3000-<sandbox id>.sandbox.us.mastra.cloud/
|
|
381
396
|
```
|
|
382
397
|
|
|
383
|
-
Ports are private: the URL opens in a browser for members of the sandbox's organization once they sign in to Mastra. You can share it, since it never expires, and opening it wakes a paused sandbox.
|
|
398
|
+
Ports are private by default: the URL opens in a browser for members of the sandbox's organization once they sign in to Mastra. With [`publicPorts: true`](#public-ports), anyone with the URL can open it without signing in. You can share it, since it never expires, and opening it wakes a paused sandbox.
|
|
384
399
|
|
|
385
400
|
`networking` is `undefined` on a sandbox whose ports can't be opened. `getPortUrl()` returns `null` without starting the sandbox when the sandbox isn't running or has been destroyed, for a port that isn't a whole number from 1 to 65535, and for the sandbox's reserved control port. Other platform errors, such as an invalid access token, are thrown.
|
|
386
401
|
|
|
@@ -403,7 +418,7 @@ if (cookie) await browserContext.addCookies([cookie])
|
|
|
403
418
|
|
|
404
419
|
**processes** (`SandboxProcessManager`): Background process manager. spawn() streams output while the process runs, kill() stops it, list() shows what is running in the sandbox, and get(pid) attaches to a process this manager didn't start. See Background processes and the SandboxProcessManager reference.
|
|
405
420
|
|
|
406
|
-
**networking** (`SandboxNetworking | undefined`): Port URLs. getPortUrl(port) returns the URL of a port in the running sandbox, which opens in a browser after signing in to Mastra, or null when the sandbox isn't running. undefined when the sandbox's ports can't be opened. See Port URLs.
|
|
421
|
+
**networking** (`SandboxNetworking | undefined`): Port URLs. getPortUrl(port) returns the URL of a port in the running sandbox, which opens in a browser after signing in to Mastra (or for anyone, with publicPorts: true), or null when the sandbox isn't running. undefined when the sandbox's ports can't be opened. See Port URLs.
|
|
407
422
|
|
|
408
423
|
**filesystem** (`PlatformSandboxFilesystem | undefined`): The sandbox's disk through E2B's files API, sent straight to the VM with the same lease executeCommand() uses. undefined when the sandbox isn't E2B-backed; use executeCommand() then. Paths are absolute and not confined to a root. Copies, appends, and no-overwrite writes run as one command in the VM. See Native filesystem.
|
|
409
424
|
|
|
@@ -186,7 +186,7 @@ The runtime environment applies to commands executed through the sandbox rather
|
|
|
186
186
|
|
|
187
187
|
### `getEnv()`
|
|
188
188
|
|
|
189
|
-
Returns a copy of the sandbox's current runtime environment; because mutations to the returned object don't change the sandbox, use `setEnv()` for updates.
|
|
189
|
+
Available on `MastraSandbox`, not declared on the `WorkspaceSandbox` interface. Returns a copy of the sandbox's current runtime environment; because mutations to the returned object don't change the sandbox, use `setEnv()` for updates.
|
|
190
190
|
|
|
191
191
|
```typescript
|
|
192
192
|
const token = sandbox.getEnv().GH_TOKEN
|
|
@@ -559,10 +559,10 @@ The `index` tool is excluded when the filesystem is in read-only mode.
|
|
|
559
559
|
|
|
560
560
|
Added when skills are configured:
|
|
561
561
|
|
|
562
|
-
| Tool | Description
|
|
563
|
-
| -------------- |
|
|
564
|
-
| `skill` | Activate a skill by name or path. Returns the skill's full instructions, references, scripts, and assets.
|
|
565
|
-
| `skill_search` | Search
|
|
566
|
-
| `skill_read` | Read a specific file (reference, script, or asset) from a skill directory.
|
|
562
|
+
| Tool | Description |
|
|
563
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
564
|
+
| `skill` | Activate a skill by name or path. Returns the skill's full instructions, references, scripts, and assets. |
|
|
565
|
+
| `skill_search` | Search skill names, descriptions, and content. Accepts an optional list of skill names to filter and a `topK` parameter. |
|
|
566
|
+
| `skill_read` | Read a specific file (reference, script, or asset) from a skill directory. |
|
|
567
567
|
|
|
568
568
|
When multiple skills share the same name, `list()` returns all of them. `get()` with a name applies tie-breaking (local > managed > external). If two skills share the same name and source type, `get()` throws an error. Pass a skill's full path to `get()` to bypass tie-breaking. See [Skills with the same name](https://mastra.ai/docs/sandbox/skills) for details.
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createDocsServer, n as runServer } from "./src-
|
|
1
|
+
export { t as createDocsServer, n as runServer } from "./src-CwUXyWAK.js";
|
|
@@ -1081,8 +1081,8 @@ async function readSourceMap(packageName, projectPath) {
|
|
|
1081
1081
|
sourceMapCache.set(cacheKey, null);
|
|
1082
1082
|
return null;
|
|
1083
1083
|
}
|
|
1084
|
-
const
|
|
1085
|
-
const content = await fs.readFile(
|
|
1084
|
+
const docsDir = path.join(packageInfo.rootPath, "dist", "docs");
|
|
1085
|
+
const content = await fs.readFile(path.join(docsDir, "assets", "SOURCE_MAP.json"), "utf-8").catch(() => fs.readFile(path.join(docsDir, "SOURCE_MAP.json"), "utf-8"));
|
|
1086
1086
|
const sourceMap = JSON.parse(content);
|
|
1087
1087
|
sourceMapCache.set(cacheKey, sourceMap);
|
|
1088
1088
|
return sourceMap;
|
|
@@ -1847,4 +1847,4 @@ async function runServer() {
|
|
|
1847
1847
|
}
|
|
1848
1848
|
export { writeErrorLog as i, runServer as n, setLogLevel as r, createDocsServer as t };
|
|
1849
1849
|
|
|
1850
|
-
//# sourceMappingURL=src-
|
|
1850
|
+
//# sourceMappingURL=src-CwUXyWAK.js.map
|