@mastra/mcp-docs-server 1.3.6-alpha.14 → 1.3.6-alpha.16
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/deployment/mastra-server.md +2 -2
- package/.docs/docs/harness/durable-agents.md +45 -9
- package/.docs/docs/server/pubsub.md +2 -0
- package/.docs/docs/workflows/overview.md +2 -0
- package/.docs/integrations/sandboxes/blaxel.md +3 -1
- package/.docs/integrations/sandboxes/e2b.md +15 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/302ai.md +3 -1
- package/.docs/models/providers/edenai.md +305 -308
- package/.docs/models/providers/kilo.md +7 -7
- package/.docs/models/providers/moark.md +17 -9
- package/.docs/reference/agents/durable-agent.md +40 -4
- package/.docs/reference/client-js/agent-controller.md +1 -1
- package/.docs/reference/client-js/agents.md +2 -2
- package/.docs/reference/client-js/datasets.md +19 -0
- package/.docs/reference/core/mastra-class.md +12 -4
- package/.docs/reference/pubsub/lease-provider.md +2 -0
- package/.docs/reference/pubsub/valkey-streams.md +1 -1
- package/.docs/reference/server/routes.md +1 -0
- package/.docs/reference/storage/retention.md +21 -18
- package/package.json +4 -4
|
@@ -43,11 +43,11 @@ for await (const chunk of stream) {
|
|
|
43
43
|
| `kilo/~anthropic/claude-opus-latest` | 1.0M | | | | | | $4 | $20 |
|
|
44
44
|
| `kilo/~anthropic/claude-sonnet-latest` | 1.0M | | | | | | $2 | $10 |
|
|
45
45
|
| `kilo/~deepseek/deepseek-flash-latest` | 1.0M | | | | | | $0.00 | $0.60 |
|
|
46
|
-
| `kilo/~deepseek/deepseek-pro-latest` | 1.0M | | | | | | $0.
|
|
46
|
+
| `kilo/~deepseek/deepseek-pro-latest` | 1.0M | | | | | | $0.22 | $0.66 |
|
|
47
47
|
| `kilo/~deepseek/deepseek-v4-flash-latest` | 1.0M | | | | | | $0.01 | $1 |
|
|
48
48
|
| `kilo/~google/gemini-flash-latest` | 1.0M | | | | | | $0.75 | $4 |
|
|
49
49
|
| `kilo/~google/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
50
|
-
| `kilo/~moonshotai/kimi-latest` | 1.0M | | | | | | $0.
|
|
50
|
+
| `kilo/~moonshotai/kimi-latest` | 1.0M | | | | | | $0.28 | $15 |
|
|
51
51
|
| `kilo/~openai/gpt-astra-latest` | 1.1M | | | | | | $10 | $50 |
|
|
52
52
|
| `kilo/~openai/gpt-luna-latest` | 1.1M | | | | | | $0.10 | $0.50 |
|
|
53
53
|
| `kilo/~openai/gpt-mini-latest` | 400K | | | | | | $0.75 | $5 |
|
|
@@ -107,7 +107,7 @@ for await (const chunk of stream) {
|
|
|
107
107
|
| `kilo/deepseek/deepseek-v3.1-terminus` | 164K | | | | | | $0.27 | $1 |
|
|
108
108
|
| `kilo/deepseek/deepseek-v3.2` | 164K | | | | | | $0.26 | $0.80 |
|
|
109
109
|
| `kilo/deepseek/deepseek-v3.2-exp` | 164K | | | | | | $0.27 | $0.41 |
|
|
110
|
-
| `kilo/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.
|
|
110
|
+
| `kilo/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.03 | $1 |
|
|
111
111
|
| `kilo/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.44 | $1 |
|
|
112
112
|
| `kilo/deepseek/deepseek-v4-flash-vision-exp` | 1.0M | | | | | | $0.22 | $0.65 |
|
|
113
113
|
| `kilo/deepseek/deepseek-v4-pro` | 1.0M | | | | | | $2 | $3 |
|
|
@@ -212,7 +212,7 @@ for await (const chunk of stream) {
|
|
|
212
212
|
| `kilo/moonshotai/kimi-k2-0905` | 262K | | | | | | $0.60 | $3 |
|
|
213
213
|
| `kilo/moonshotai/kimi-k2-thinking` | 262K | | | | | | $0.60 | $3 |
|
|
214
214
|
| `kilo/moonshotai/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
215
|
-
| `kilo/moonshotai/kimi-k2.6` | 262K | | | | | | $0.
|
|
215
|
+
| `kilo/moonshotai/kimi-k2.6` | 262K | | | | | | $0.43 | $2 |
|
|
216
216
|
| `kilo/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.67 | $3 |
|
|
217
217
|
| `kilo/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
218
218
|
| `kilo/morph/morph-v3-fast` | 82K | | | | | | $0.80 | $1 |
|
|
@@ -343,7 +343,7 @@ for await (const chunk of stream) {
|
|
|
343
343
|
| `kilo/qwen/qwen3.5-plus-02-15` | 1.0M | | | | | | $0.26 | $2 |
|
|
344
344
|
| `kilo/qwen/qwen3.5-plus-20260420` | 1.0M | | | | | | $0.30 | $2 |
|
|
345
345
|
| `kilo/qwen/qwen3.6-27b` | 262K | | | | | | $0.45 | $3 |
|
|
346
|
-
| `kilo/qwen/qwen3.6-35b-a3b` | 262K | | | | | | $0.
|
|
346
|
+
| `kilo/qwen/qwen3.6-35b-a3b` | 262K | | | | | | $0.10 | $0.95 |
|
|
347
347
|
| `kilo/qwen/qwen3.6-flash` | 1.0M | | | | | | $0.19 | $1 |
|
|
348
348
|
| `kilo/qwen/qwen3.6-plus` | 1.0M | | | | | | $0.33 | $2 |
|
|
349
349
|
| `kilo/qwen/qwen3.7-flash` | 1.0M | | | | | | $0.03 | $0.13 |
|
|
@@ -380,9 +380,9 @@ for await (const chunk of stream) {
|
|
|
380
380
|
| `kilo/tencent/hy-mt2-1.8b` | 8K | | | | | | $0.04 | $0.18 |
|
|
381
381
|
| `kilo/tencent/hy-mt2-30b-a3b` | 8K | | | | | | $0.07 | $0.29 |
|
|
382
382
|
| `kilo/tencent/hy-mt2-7b` | 8K | | | | | | $0.07 | $0.29 |
|
|
383
|
-
| `kilo/tencent/hy3` | 262K | | | | | | $0.
|
|
383
|
+
| `kilo/tencent/hy3` | 262K | | | | | | $0.08 | $0.33 |
|
|
384
384
|
| `kilo/tencent/hy3-preview` | 262K | | | | | | $0.18 | $0.60 |
|
|
385
|
-
| `kilo/tencent/hy4-preview` | 1.0M | | | | | | $0.
|
|
385
|
+
| `kilo/tencent/hy4-preview` | 1.0M | | | | | | $0.75 | $2 |
|
|
386
386
|
| `kilo/thedrummer/cydonia-24b-v4.1` | 131K | | | | | | $0.30 | $0.50 |
|
|
387
387
|
| `kilo/thedrummer/skyfall-36b-v2` | 33K | | | | | | $0.55 | $0.80 |
|
|
388
388
|
| `kilo/thedrummer/unslopnemo-12b` | 1.0M | | | | | | $0.40 | $0.40 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Moark
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 10 Moark models through Mastra's model router. Authentication is handled automatically using the `MOARK_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Moark documentation](https://moark.com).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "moark/
|
|
22
|
+
model: "moark/DeepSeek-V4-Flash"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -36,10 +36,18 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
## Models
|
|
38
38
|
|
|
39
|
-
| Model
|
|
40
|
-
|
|
|
41
|
-
| `moark/
|
|
42
|
-
| `moark/
|
|
39
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
40
|
+
| ------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
41
|
+
| `moark/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.50 | $0.50 |
|
|
42
|
+
| `moark/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.15 | $0.30 |
|
|
43
|
+
| `moark/DeepSeek-V4-Pro` | 1.0M | | | | | | $2 | $4 |
|
|
44
|
+
| `moark/GLM-4.7` | 205K | | | | | | $0.42 | $2 |
|
|
45
|
+
| `moark/GLM-5.3` | 1.0M | | | | | | $1 | $4 |
|
|
46
|
+
| `moark/Kimi-K2.6` | 262K | | | | | | $0.98 | $4 |
|
|
47
|
+
| `moark/kimi-k3` | 1.0M | | | | | | $3 | $15 |
|
|
48
|
+
| `moark/MiniMax-M2.1` | 205K | | | | | | $0.29 | $1 |
|
|
49
|
+
| `moark/MiniMax-M2.7` | 205K | | | | | | $0.29 | $1 |
|
|
50
|
+
| `moark/Qwen3.6-Flash` | 1.0M | | | | | | $0.18 | $1 |
|
|
43
51
|
|
|
44
52
|
Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
|
|
45
53
|
|
|
@@ -53,7 +61,7 @@ const agent = new Agent({
|
|
|
53
61
|
name: "custom-agent",
|
|
54
62
|
model: {
|
|
55
63
|
url: "https://moark.com/v1",
|
|
56
|
-
id: "moark/
|
|
64
|
+
id: "moark/DeepSeek-V4-Flash",
|
|
57
65
|
apiKey: process.env.MOARK_API_KEY,
|
|
58
66
|
headers: {
|
|
59
67
|
"X-Custom-Header": "value"
|
|
@@ -71,8 +79,8 @@ const agent = new Agent({
|
|
|
71
79
|
model: ({ requestContext }) => {
|
|
72
80
|
const useAdvanced = requestContext.task === "complex";
|
|
73
81
|
return useAdvanced
|
|
74
|
-
? "moark/
|
|
75
|
-
: "moark/
|
|
82
|
+
? "moark/kimi-k3"
|
|
83
|
+
: "moark/DeepSeek-V4-Flash";
|
|
76
84
|
}
|
|
77
85
|
});
|
|
78
86
|
```
|
|
@@ -164,7 +164,7 @@ Returns: [`Promise<DurableAgentStreamResult>`](#durableagentstreamresult)
|
|
|
164
164
|
|
|
165
165
|
#### `resume(runId, resumeData, options?)`
|
|
166
166
|
|
|
167
|
-
Resumes a suspended run, for example after a tool approval. Pass the `runId` from the original stream and the data the run was waiting on. Throws if no registry entry exists for the run.
|
|
167
|
+
Resumes a suspended run, for example after a tool approval. Pass the `runId` from the original stream and the data the run was waiting on. Throws if no registry entry exists for the run. If another execution holds the run, `resume()` waits up to 5 seconds for it to finish, then throws `DURABLE_AGENT_EXECUTION_CONFLICT`. See [run ownership](https://mastra.ai/docs/harness/durable-agents).
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
170
|
const { output, cleanup } = await durableAgent.resume(runId, {
|
|
@@ -324,11 +324,18 @@ interface DurableAgentListActiveRunsResult {
|
|
|
324
324
|
|
|
325
325
|
#### `recoverActiveRuns(options?)`
|
|
326
326
|
|
|
327
|
-
Discovers runs stuck in `running` status for this agent and re-drives them from the last persisted snapshot. Accepts the same filters and pagination as `listActiveRuns()`, plus `runId`. Returns
|
|
327
|
+
Discovers runs stuck in `running` status for this agent and re-drives them from the last persisted snapshot. Accepts the same filters and pagination as `listActiveRuns()`, plus `runId`. Returns the outcome for each run.
|
|
328
328
|
|
|
329
329
|
```typescript
|
|
330
330
|
const result = await durableAgent.recoverActiveRuns()
|
|
331
|
-
// {
|
|
331
|
+
// {
|
|
332
|
+
// recovered: [
|
|
333
|
+
// { runId: 'run-1', status: 'success' },
|
|
334
|
+
// { runId: 'run-2', status: 'skipped', reason: 'run-active', retryAt: 1760123456789 },
|
|
335
|
+
// ],
|
|
336
|
+
// succeeded: 1,
|
|
337
|
+
// failed: 0,
|
|
338
|
+
// }
|
|
332
339
|
```
|
|
333
340
|
|
|
334
341
|
Pass a `runId` to recover a single known run:
|
|
@@ -337,11 +344,26 @@ Pass a `runId` to recover a single known run:
|
|
|
337
344
|
await durableAgent.recoverActiveRuns({ runId: 'run-abc-123' })
|
|
338
345
|
```
|
|
339
346
|
|
|
347
|
+
A run that another execution still drives isn't taken over. Its entry has `status: 'skipped'` and a `reason`, and `recoverActiveRuns()` doesn't check it again. For a run held by another process, `retryAt` is the time after which that claim lapses unless renewed. Call `recoverActiveRuns({ runId })` after it to recover the run if its process crashed. [`mastra.recoverAllDurableAgents()`](https://mastra.ai/reference/core/mastra-class) schedules these re-checks itself.
|
|
348
|
+
|
|
349
|
+
| `reason` | Meaning |
|
|
350
|
+
| --------------------- | ------------------------------------------------------------------------------ |
|
|
351
|
+
| `run-active` | Another execution, possibly in another process, holds the run. Sets `retryAt`. |
|
|
352
|
+
| `run-active-locally` | This process is executing the run. |
|
|
353
|
+
| `already-in-progress` | This process is already recovering the run. |
|
|
354
|
+
|
|
340
355
|
Returns:
|
|
341
356
|
|
|
342
357
|
```typescript
|
|
343
358
|
interface DurableAgentRecoverActiveRunsResult {
|
|
344
|
-
recovered: Array<{
|
|
359
|
+
recovered: Array<{
|
|
360
|
+
runId: string
|
|
361
|
+
status: 'success' | 'failed' | 'skipped'
|
|
362
|
+
error?: Error
|
|
363
|
+
reason?: 'run-active' | 'run-active-locally' | 'already-in-progress'
|
|
364
|
+
// Epoch milliseconds
|
|
365
|
+
retryAt?: number
|
|
366
|
+
}>
|
|
345
367
|
succeeded: number
|
|
346
368
|
failed: number
|
|
347
369
|
}
|
|
@@ -363,6 +385,20 @@ await output.text
|
|
|
363
385
|
cleanup()
|
|
364
386
|
```
|
|
365
387
|
|
|
388
|
+
`recover()` throws instead of recovering a run that isn't orphaned:
|
|
389
|
+
|
|
390
|
+
| Error ID | Thrown when |
|
|
391
|
+
| ------------------------------------------- | -------------------------------------------------------------------- |
|
|
392
|
+
| `DURABLE_AGENT_RUN_ACTIVE` | Another execution holds the run, and `force` isn't set. |
|
|
393
|
+
| `DURABLE_AGENT_RECOVER_RUN_ACTIVE_LOCALLY` | This process is executing the run. `force` doesn't override this. |
|
|
394
|
+
| `DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS` | This process is already recovering the run. |
|
|
395
|
+
| `DURABLE_AGENT_RECOVER_RUN_SUSPENDED` | The run is suspended. Continue it with `resume()`. |
|
|
396
|
+
| `DURABLE_AGENT_EXECUTION_CONFLICT` | With `force`, another execution claimed the run during the takeover. |
|
|
397
|
+
|
|
398
|
+
The server's `POST /agents/:agentId/recover` route returns these errors as `409 Conflict`.
|
|
399
|
+
|
|
400
|
+
**options.force** (`boolean`): Take the run over even while another execution holds it. That execution loses the run and stops, and streams for the run drop the events it still publishes. Its writes are rejected when the storage adapter supports run fencing. (Default: `false`)
|
|
401
|
+
|
|
366
402
|
Returns: [`Promise<DurableAgentStreamResult>`](#durableagentstreamresult)
|
|
367
403
|
|
|
368
404
|
## Stream options
|
|
@@ -109,7 +109,7 @@ Subscribes to the session's event stream over SSE. The promise resolves once the
|
|
|
109
109
|
|
|
110
110
|
**onReconnect** (`() => void`): Called each time the stream is re-established after a drop. The server does not replay events missed while disconnected, so re-sync from here with session.state() and, for the message gap, session.listMessages().
|
|
111
111
|
|
|
112
|
-
**reconnect** (`boolean | { maxRetries?: number; delayMs?: number; maxDelayMs?: number }`): Re-establishes the stream after an established stream drops. Retries back off exponentially from delayMs (default 1000) up to maxDelayMs (default 30000). maxRetries (default Infinity) bounds the attempts per outage and resets once a connection is re-established. When retries are exhausted, onError fires.
|
|
112
|
+
**reconnect** (`boolean | { maxRetries?: number; delayMs?: number; maxDelayMs?: number }`): Re-establishes the stream after an established stream drops. Retries back off exponentially from delayMs (default 1000) up to maxDelayMs (default 30000). maxRetries (default Infinity) bounds the attempts per outage and resets once a connection is re-established. When retries are exhausted, onError fires. A reconnect request that fails with a 4xx (other than 408 and 429) or 501 stops reconnecting immediately and passes that MastraClientError to onError.
|
|
113
113
|
|
|
114
114
|
Returns: `Promise<AgentControllerSubscription>`, an object with an `unsubscribe()` method that stops reading and releases the stream.
|
|
115
115
|
|
|
@@ -304,13 +304,13 @@ await subscription.processDataStream({
|
|
|
304
304
|
|
|
305
305
|
Pass `withInitialHistory: true` (or `{ perPage }`) to receive the stored messages as a first `thread-history` chunk instead of fetching history separately. Finished runs aren't replayed after it, so completed answers don't stream again on reconnect.
|
|
306
306
|
|
|
307
|
-
`subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted. Pass `reconnect: true` to resubscribe when the transport closes or a reconnect request fails, such as after a proxy idle timeout.
|
|
307
|
+
`subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted. Pass `reconnect: true` to resubscribe when the transport closes or a reconnect request fails, such as after a proxy idle timeout. If a reconnect request fails with a 4xx status (for example `401` or `403`) or `501`, `processDataStream()` stops reconnecting and rejects with the original `MastraClientError`. `408` and `429` are still retried.
|
|
308
308
|
|
|
309
309
|
**resourceId** (`string`): Resource ID for the memory thread.
|
|
310
310
|
|
|
311
311
|
**threadId** (`string`): Thread ID to subscribe to.
|
|
312
312
|
|
|
313
|
-
**processDataStream().reconnect** (`boolean | { maxRetries?: number; delayMs?: number }`): Reconnects the subscription stream after it closes or a reconnect request fails. true retries indefinitely with a one-second delay.
|
|
313
|
+
**processDataStream().reconnect** (`boolean | { maxRetries?: number; delayMs?: number }`): Reconnects the subscription stream after it closes or a reconnect request fails. true retries indefinitely with a one-second delay. A 4xx (other than 408 and 429) or 501 response stops reconnecting and rejects with that error.
|
|
314
314
|
|
|
315
315
|
The subscription also exposes `abort(options?)` and `unsubscribe()`. `await subscription.abort({ clearPendingSignals: true })` requests an abort and clears pending signals without closing the subscription. Omit the flag to preserve pending input. `unsubscribe()` closes the subscription without aborting the run.
|
|
316
316
|
|
|
@@ -159,6 +159,25 @@ await client.deleteDatasetExperiment('dataset-id', 'experiment-id', {
|
|
|
159
159
|
|
|
160
160
|
Returns `Promise<{ success: boolean }>`. A missing experiment, an experiment associated with another dataset, or a dataset outside the supplied tenancy returns a `404` response.
|
|
161
161
|
|
|
162
|
+
## getExperiment()
|
|
163
|
+
|
|
164
|
+
Gets an experiment by ID without requiring a dataset reference. The response includes the experiment's `datasetId`, which is `null` for experiments orphaned by dataset deletion.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const experiment = await client.getExperiment('experiment-id', {
|
|
168
|
+
organizationId: 'organization-id',
|
|
169
|
+
projectId: 'project-id',
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**experimentId** (`string`): ID of the experiment to get.
|
|
174
|
+
|
|
175
|
+
**options.organizationId** (`string`): Organization ID used to scope the lookup.
|
|
176
|
+
|
|
177
|
+
**options.projectId** (`string`): Project ID used to scope the lookup.
|
|
178
|
+
|
|
179
|
+
Returns the experiment. A missing experiment, or one outside the supplied tenancy, returns a `404` response.
|
|
180
|
+
|
|
162
181
|
## deleteExperiment()
|
|
163
182
|
|
|
164
183
|
Deletes an experiment by ID without requiring a dataset reference. Use this method for experiments orphaned by dataset deletion. The server deletes the experiment's observability traces and then deletes the experiment and its result records. Unsupported storage leaves the traces in place, and the server logs a warning. If trace deletion fails for any other reason, the promise rejects and Mastra keeps the experiment and its result records, although some traces may already have been removed.
|
|
@@ -131,10 +131,14 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
131
131
|
|
|
132
132
|
**scheduler.enabled** (`boolean`): Explicitly enable or disable the scheduler.
|
|
133
133
|
|
|
134
|
-
**recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off' }`)
|
|
134
|
+
**recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off', workflows: 'auto', workflowConcurrency: 5 }`)
|
|
135
135
|
|
|
136
136
|
**recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
|
|
137
137
|
|
|
138
|
+
**recovery.workflows** (`'auto' | 'off'`): Set to 'off' to skip restarting active workflow runs on server boot. Individual workflows can also opt out with autoRestartActiveRuns: false.
|
|
139
|
+
|
|
140
|
+
**recovery.workflowConcurrency** (`number`): Maximum number of workflow runs restarted at the same time during boot recovery. Use Infinity for no limit. Workflow and durable agent recovery run in parallel.
|
|
141
|
+
|
|
138
142
|
## Methods
|
|
139
143
|
|
|
140
144
|
### `recoverAllDurableAgents()`
|
|
@@ -143,17 +147,21 @@ Re-drives every orphaned `running` durable-agent run across all registered durab
|
|
|
143
147
|
|
|
144
148
|
Requires persistent storage. With an in-memory store, there's nothing to recover after a process restart.
|
|
145
149
|
|
|
150
|
+
A run that another execution still drives isn't taken over. It's counted in `skipped` and checked again once that execution's claim could have lapsed, so a run whose process crashed is recovered without another call. `shutdown()` cancels pending re-checks. See [run ownership](https://mastra.ai/docs/harness/durable-agents).
|
|
151
|
+
|
|
146
152
|
```typescript
|
|
147
153
|
const result = await mastra.recoverAllDurableAgents()
|
|
148
|
-
// { agents: 2, recovered: 3, succeeded: 3, failed: 0 }
|
|
154
|
+
// { agents: 2, recovered: 3, succeeded: 3, failed: 0, skipped: 1 }
|
|
149
155
|
```
|
|
150
156
|
|
|
151
157
|
Returns:
|
|
152
158
|
|
|
153
159
|
**agents** (`number`): Number of durable agents scanned.
|
|
154
160
|
|
|
155
|
-
**recovered** (`number`): Total number of runs that were re-driven.
|
|
161
|
+
**recovered** (`number`): Total number of runs that were re-driven: succeeded plus failed.
|
|
156
162
|
|
|
157
163
|
**succeeded** (`number`): Runs that restarted successfully.
|
|
158
164
|
|
|
159
|
-
**failed** (`number`): Runs whose restart threw an error.
|
|
165
|
+
**failed** (`number`): Runs whose restart threw an error.
|
|
166
|
+
|
|
167
|
+
**skipped** (`number`): Runs that another execution still drives. Each is checked again later.
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/harness/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
|
|
8
8
|
|
|
9
|
+
[Durable agents](https://mastra.ai/docs/harness/durable-agents) also claim each run through a lease when the workflows store doesn't support run fencing, so crash recovery can tell whether another process still drives the run.
|
|
10
|
+
|
|
9
11
|
Leasing is separate from pub/sub. A `LeaseProvider` implementation needs actual lock coordination, whether through an atomic Redis operation such as `SET` or Lua or through an in-memory map for a single process. For backends that omit leasing, the signals runtime preserves single-process behavior with a no-op provider.
|
|
10
12
|
|
|
11
13
|
The built-in [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) implements `LeaseProvider`, which is what enables signals to coordinate across instances in distributed and serverless deployments.
|
|
@@ -49,7 +49,7 @@ export const mastra = new Mastra({
|
|
|
49
49
|
|
|
50
50
|
## Constructor parameters
|
|
51
51
|
|
|
52
|
-
**url** (`string`): Valkey connection URL. Falls back to valkeyOptions.url. (Default: `valkey://localhost:6379`)
|
|
52
|
+
**url** (`string`): Valkey connection URL. Falls back to valkeyOptions.url. rediss\:// and valkeys\:// URLs enable TLS unless valkeyOptions.useTLS is set. (Default: `valkey://localhost:6379`)
|
|
53
53
|
|
|
54
54
|
**valkeyOptions** (`ValkeyClientOptions`): GLIDE connection options, including native client configuration.
|
|
55
55
|
|
|
@@ -405,6 +405,7 @@ On authenticated servers, the read routes require the `stored-workflows:read` pe
|
|
|
405
405
|
| `POST` | `/api/datasets/:datasetId/items` | Add a dataset item |
|
|
406
406
|
| `DELETE` | `/api/datasets/:datasetId/items/:itemId/purge` | Permanently scrub an item's content from every dataset version and linked experiment result |
|
|
407
407
|
| `GET` | `/api/experiments` | List experiments across datasets |
|
|
408
|
+
| `GET` | `/api/experiments/:experimentId` | Get an experiment by ID without knowing its dataset |
|
|
408
409
|
| `DELETE` | `/api/experiments/:experimentId` | Delete an experiment, including one orphaned by dataset deletion |
|
|
409
410
|
| `GET` | `/api/datasets/:datasetId/experiments` | List experiments for a dataset |
|
|
410
411
|
| `POST` | `/api/datasets/:datasetId/experiments` | Trigger an experiment, or create one without starting it (`start: false`) |
|
|
@@ -95,29 +95,32 @@ Set the `retention` field on the store config.
|
|
|
95
95
|
|
|
96
96
|
Each domain specifies its age-prunable tables and the timestamp column that anchors comparison, chosen so `maxAge` matches the meaning of the data. Append-only logs use creation time, live state uses last activity, and jobs or runs use completion time so in-flight work isn't pruned.
|
|
97
97
|
|
|
98
|
-
| Domain | Table key | Anchor column | `maxAge` measures
|
|
99
|
-
| ----------------- | ------------------ | ---------------- |
|
|
100
|
-
| `memory` | `threads` | `createdAt` | Thread age
|
|
101
|
-
| `memory` | `messages` | `createdAt` | Message age
|
|
102
|
-
| `memory` | `resources` | `createdAt` | Resource age
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `observability` | `
|
|
106
|
-
| `observability` | `
|
|
107
|
-
| `observability` | `
|
|
108
|
-
| `observability` | `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
98
|
+
| Domain | Table key | Anchor column | `maxAge` measures |
|
|
99
|
+
| ----------------- | ------------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `memory` | `threads` | `createdAt` | Thread age |
|
|
101
|
+
| `memory` | `messages` | `createdAt` | Message age |
|
|
102
|
+
| `memory` | `resources` | `createdAt` | Resource age |
|
|
103
|
+
| `memory` | `runFences` | `retiredAt` | Time since the durable agent execution holding the fence settled. Fences of running executions (`NULL`) are never pruned |
|
|
104
|
+
| `threadState` | `threadState` | `updatedAt` | Inactivity: state for still-active threads survives |
|
|
105
|
+
| `observability` | `spans` | `startedAt` | Span age |
|
|
106
|
+
| `observability` | `metrics` | `timestamp` | Metric event age (vNext only) |
|
|
107
|
+
| `observability` | `logs` | `timestamp` | Log event age (vNext only) |
|
|
108
|
+
| `observability` | `scores` | `timestamp` | Score event age (vNext only) |
|
|
109
|
+
| `observability` | `feedback` | `timestamp` | Feedback event age (vNext only) |
|
|
110
|
+
| `scores` | `scorers` | `createdAt` | Score record age |
|
|
111
|
+
| `workflows` | `workflowSnapshot` | `updatedAt` | Inactivity, suspended or long-running workflows survive |
|
|
112
|
+
| `workflows` | `runOwnership` | `updatedAt` | Inactivity. A running durable agent execution renews its claim every 10 seconds, so keep `maxAge` well above its 30-second lease |
|
|
113
|
+
| `backgroundTasks` | `backgroundTasks` | `completedAt` | Time since completion, in-flight tasks (`NULL`) are never pruned |
|
|
114
|
+
| `experiments` | `experiments` | `completedAt` | Time since completion, running experiments are never pruned |
|
|
115
|
+
| `notifications` | `notifications` | `createdAt` | Notification age |
|
|
116
|
+
| `harness` | `sessions` | `createdAt` | Session record age |
|
|
117
|
+
| `schedules` | `triggers` | `actual_fire_at` | Fire-history age (epoch-ms column) |
|
|
116
118
|
|
|
117
119
|
> **Note:**
|
|
118
120
|
>
|
|
119
121
|
> - The memory `observational_memory` table has no timestamp anchor, so it can't be age-pruned and isn't a valid retention key.
|
|
120
122
|
> - Experiments prune as whole units: an aged experiment's result rows are deleted together with it (results cascade with their parent), so a run is never left partially deleted. Retention doesn't have a separate `results` key.
|
|
123
|
+
> - `runOwnership` and `runFences` hold the run fencing records of durable agents, one small record per run in each. If the `runOwnership` `maxAge` is too short, a running execution can lose its run, but an execution that lost a run still can't write. A fence is retired only when its execution settles, so the fence of a run that crashed and was never recovered is never pruned.
|
|
121
124
|
> - For `schedules`, the growth table is the fire history (`schedule_triggers`, one row per fire): schedule definitions are config and aren't pruned.
|
|
122
125
|
> - On PostgreSQL, timestamp anchors use the timezone-aware mirror columns (for example `createdAtZ`, `completedAtZ`).
|
|
123
126
|
> - DuckDB observability stores append-only events for all five signals. Its `spans` policy uses the event `timestamp` column rather than `startedAt`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.3.6-alpha.
|
|
3
|
+
"version": "1.3.6-alpha.16",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@mastra/mcp-legacy": "npm:@mastra/mcp@^1.18.0",
|
|
27
27
|
"local-pkg": "^1.1.2",
|
|
28
28
|
"zod": "^4.6.4",
|
|
29
|
-
"@mastra/core": "1.76.0-alpha.
|
|
29
|
+
"@mastra/core": "1.76.0-alpha.8",
|
|
30
30
|
"@mastra/mcp": "^2.3.0-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"tsx": "^4.23.1",
|
|
44
44
|
"typescript": "^7.0.2",
|
|
45
45
|
"vitest": "4.1.11",
|
|
46
|
+
"@internal/types-builder": "0.0.116",
|
|
46
47
|
"@internal/lint": "0.0.141",
|
|
47
|
-
"@mastra/core": "1.76.0-alpha.
|
|
48
|
-
"@internal/types-builder": "0.0.116"
|
|
48
|
+
"@mastra/core": "1.76.0-alpha.8"
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://mastra.ai",
|
|
51
51
|
"repository": {
|