@mastra/client-js 1.30.1-alpha.0 → 1.30.1-alpha.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/CHANGELOG.md +7 -0
- package/dist/docs/SKILL.md +3 -3
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/{docs-agents-heartbeats.md → docs-long-running-agents-heartbeats.md} +5 -5
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-messages.md +1 -1
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +1 -1
- package/dist/docs/references/reference-client-js-agents.md +9 -9
- package/dist/docs/references/reference-client-js-mastra-client.md +5 -5
- package/dist/docs/references/reference-client-js-responses.md +3 -3
- package/package.json +3 -3
- /package/dist/docs/references/{docs-agents-signals.md → docs-long-running-agents-signals.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.30.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`3ffb8b7`](https://github.com/mastra-ai/mastra/commit/3ffb8b720e90f5e6977129ec1f6707d43c2bebe0), [`5ea76a7`](https://github.com/mastra-ai/mastra/commit/5ea76a723d966c72da9aa3ab30ae20276e049765), [`6445560`](https://github.com/mastra-ai/mastra/commit/6445560327045d20b239585fc63fed72e9ce36ec), [`a2ba369`](https://github.com/mastra-ai/mastra/commit/a2ba369e796dfab610f41c6875965b488272fa55), [`ae51e81`](https://github.com/mastra-ai/mastra/commit/ae51e818825582d42500338dfc1929a082eff0ba), [`6f304ef`](https://github.com/mastra-ai/mastra/commit/6f304ef319e99725e884bdb8d3193c001b6e5964)]:
|
|
8
|
+
- @mastra/core@1.50.0-alpha.1
|
|
9
|
+
|
|
3
10
|
## 1.30.1-alpha.0
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-client-js
|
|
|
3
3
|
description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/client-js"
|
|
6
|
-
version: "1.30.1-alpha.
|
|
6
|
+
version: "1.30.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -17,9 +17,9 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
17
17
|
### Docs
|
|
18
18
|
|
|
19
19
|
- [A2A](references/docs-agents-a2a.md) - Expose and call remote Mastra agents over the Agent-to-Agent protocol.
|
|
20
|
-
- [Heartbeats](references/docs-agents-heartbeats.md) - Run an agent on a cron schedule to deliver a recurring prompt, with optional thread delivery and lifecycle hooks.
|
|
21
|
-
- [Signals](references/docs-agents-signals.md) - Learn how to send real-time messages and context into a Mastra agent thread.
|
|
22
20
|
- [Editor overview](references/docs-editor-overview.md) - Let non-technical team members iterate on agents, version every change, and run experiments without redeploying.
|
|
21
|
+
- [Heartbeats](references/docs-long-running-agents-heartbeats.md) - Run an agent on a cron schedule to deliver a recurring prompt, with optional thread delivery and lifecycle hooks.
|
|
22
|
+
- [Signals](references/docs-long-running-agents-signals.md) - Learn how to send real-time messages and context into a Mastra agent thread.
|
|
23
23
|
- [Auth0](references/docs-server-auth-auth0.md) - Documentation for the @mastra/auth-auth0 package, which authenticates Mastra applications using Auth0 authentication.
|
|
24
24
|
- [Clerk](references/docs-server-auth-clerk.md) - Documentation for the `@mastra/auth-clerk` package, which authenticates Mastra applications using Clerk authentication.
|
|
25
25
|
- [Firebase](references/docs-server-auth-firebase.md) - Documentation for the `@mastra/auth-firebase` package, which authenticates Mastra applications using Firebase Authentication.
|
package/dist/docs/references/{docs-agents-heartbeats.md → docs-long-running-agents-heartbeats.md}
RENAMED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
> **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
8
8
|
|
|
9
|
-
A heartbeat runs an agent on a cron schedule. On each fire, Mastra sends a prompt to the agent, either as a [signal](https://mastra.ai/docs/agents/signals) into a thread or as a threadless `agent.generate()` run. Use heartbeats for recurring agent work such as daily summaries, periodic checks, or scheduled nudges into a conversation.
|
|
9
|
+
A heartbeat runs an agent on a cron schedule. On each fire, Mastra sends a prompt to the agent, either as a [signal](https://mastra.ai/docs/long-running-agents/signals) into a thread or as a threadless `agent.generate()` run. Use heartbeats for recurring agent work such as daily summaries, periodic checks, or scheduled nudges into a conversation.
|
|
10
10
|
|
|
11
11
|
Heartbeats are persisted, so they survive restarts and redeploys. Manage them at runtime through `mastra.heartbeats`, the canonical create, read, update, and delete (CRUD) surface.
|
|
12
12
|
|
|
@@ -73,7 +73,7 @@ Without a `threadId`, each fire is an isolated `agent.generate()` run. Nothing i
|
|
|
73
73
|
|
|
74
74
|
### Threaded
|
|
75
75
|
|
|
76
|
-
With a `threadId`, the heartbeat sends a [signal](https://mastra.ai/docs/agents/signals) into that thread, so the prompt joins the agent's conversation. Threaded heartbeats require a `resourceId` alongside the `threadId`.
|
|
76
|
+
With a `threadId`, the heartbeat sends a [signal](https://mastra.ai/docs/long-running-agents/signals) into that thread, so the prompt joins the agent's conversation. Threaded heartbeats require a `resourceId` alongside the `threadId`.
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
79
|
await mastra.heartbeats.create({
|
|
@@ -85,9 +85,9 @@ await mastra.heartbeats.create({
|
|
|
85
85
|
})
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
Threaded heartbeats accept extra fields that control how the signal behaves. They mirror the options [`agent.sendSignal`](https://mastra.ai/docs/agents/signals) accepts and stay JSON-serializable so they persist with the schedule.
|
|
88
|
+
Threaded heartbeats accept extra fields that control how the signal behaves. They mirror the options [`agent.sendSignal`](https://mastra.ai/docs/long-running-agents/signals) accepts and stay JSON-serializable so they persist with the schedule.
|
|
89
89
|
|
|
90
|
-
- `signalType`: the [signal type](https://mastra.ai/docs/agents/signals) to send, for example `notification` or `system-reminder`. Defaults to `notification`.
|
|
90
|
+
- `signalType`: the [signal type](https://mastra.ai/docs/long-running-agents/signals) to send, for example `notification` or `system-reminder`. Defaults to `notification`.
|
|
91
91
|
- `tagName`: the XML tag the signal renders as. Defaults to `heartbeat`, so a fire surfaces to the agent as `<heartbeat>…</heartbeat>`.
|
|
92
92
|
- `attributes`: values rendered onto the signal's XML tag.
|
|
93
93
|
- `ifActive`: behavior when the thread is already streaming, as `{ behavior, attributes }`. `behavior` is one of `deliver`, `persist`, or `discard`.
|
|
@@ -209,5 +209,5 @@ Hook exceptions are caught and logged. They never re-route the worker or trigger
|
|
|
209
209
|
|
|
210
210
|
## Related
|
|
211
211
|
|
|
212
|
-
- [Signals](https://mastra.ai/docs/agents/signals): the delivery mechanism behind threaded heartbeats.
|
|
212
|
+
- [Signals](https://mastra.ai/docs/long-running-agents/signals): the delivery mechanism behind threaded heartbeats.
|
|
213
213
|
- [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows): run a workflow, rather than an agent, on a cron schedule.
|
|
@@ -44,7 +44,7 @@ export default function Chat() {
|
|
|
44
44
|
|
|
45
45
|
**messages** (`MessageListInput`): Messages to convert. Can be a string, array of strings, a single message object, or an array of message objects in any supported format.
|
|
46
46
|
|
|
47
|
-
**options.version** (`'v5' | 'v6'`): Selects the AI SDK message type to return. Omit it or pass
|
|
47
|
+
**options.version** (`'v5' | 'v6'`): Selects the AI SDK message type to return. Omit it or pass 'v5' for the existing default behavior. Pass 'v6' when your app is typed against AI SDK v6 useChat() message types.
|
|
48
48
|
|
|
49
49
|
## Returns
|
|
50
50
|
|
|
@@ -64,7 +64,7 @@ The first parameter is the Mastra stream to convert. It can be one of:
|
|
|
64
64
|
|
|
65
65
|
The second parameter is an options object:
|
|
66
66
|
|
|
67
|
-
**version** (`'v5' | 'v6'`): Selects the AI SDK stream contract to emit. Omit it or pass
|
|
67
|
+
**version** (`'v5' | 'v6'`): Selects the AI SDK stream contract to emit. Omit it or pass 'v5' for the existing default behavior. Pass 'v6' when your app is typed against AI SDK v6 response helpers. (Default: `'v5'`)
|
|
68
68
|
|
|
69
69
|
**from** (`'agent' | 'network' | 'workflow'`): The type of Mastra stream being converted. (Default: `'agent'`)
|
|
70
70
|
|
|
@@ -237,21 +237,21 @@ await agent.sendSignal({
|
|
|
237
237
|
|
|
238
238
|
Returns `{ accepted: true, runId: string }`.
|
|
239
239
|
|
|
240
|
-
**signal** (`{ type: 'user' | 'reactive' | 'notification' | string; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): Lower-level signal payload. Use
|
|
240
|
+
**signal** (`{ type: 'user' | 'reactive' | 'notification' | string; tagName?: string; contents: string | Array<TextPart | FilePart>; attributes?: Record<string, JSONValue>; metadata?: Record<string, unknown>; providerOptions?: ProviderMetadata }`): Lower-level signal payload. Use type for the semantic signal category and tagName for the XML tag shown to the model. providerOptions is attached to the resulting prompt turn and persisted on the stored signal message.
|
|
241
241
|
|
|
242
242
|
**runId** (`string`): Run ID to target directly.
|
|
243
243
|
|
|
244
|
-
**resourceId** (`string`): Resource ID for the memory thread. Use with
|
|
244
|
+
**resourceId** (`string`): Resource ID for the memory thread. Use with threadId for thread-targeted signals.
|
|
245
245
|
|
|
246
|
-
**threadId** (`string`): Thread ID to target. Use with
|
|
246
|
+
**threadId** (`string`): Thread ID to target. Use with resourceId for thread-targeted signals.
|
|
247
247
|
|
|
248
|
-
**ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to
|
|
248
|
+
**ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to deliver.
|
|
249
249
|
|
|
250
250
|
**ifActive.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is active.
|
|
251
251
|
|
|
252
|
-
**ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to
|
|
252
|
+
**ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to wake.
|
|
253
253
|
|
|
254
|
-
**ifIdle.streamOptions** (`Omit<AgentExecutionOptions, 'messages'>`): Options for the stream that starts when
|
|
254
|
+
**ifIdle.streamOptions** (`Omit<AgentExecutionOptions, 'messages'>`): Options for the stream that starts when ifIdle.behavior is wake.
|
|
255
255
|
|
|
256
256
|
**ifIdle.attributes** (`Record<string, string | number | boolean>`): Attributes merged into the signal when Mastra accepts it while the target thread is idle.
|
|
257
257
|
|
|
@@ -281,11 +281,11 @@ await subscription.processDataStream({
|
|
|
281
281
|
|
|
282
282
|
**threadId** (`string`): Thread ID to subscribe to.
|
|
283
283
|
|
|
284
|
-
**processDataStream().reconnect** (`boolean | { maxRetries?: number; delayMs?: number }`): Reconnects the subscription stream after it closes or a reconnect request fails.
|
|
284
|
+
**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.
|
|
285
285
|
|
|
286
286
|
### `streamUntilIdle()`
|
|
287
287
|
|
|
288
|
-
Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
|
|
288
|
+
Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/long-running-agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
|
|
289
289
|
|
|
290
290
|
```typescript
|
|
291
291
|
const response = await agent.streamUntilIdle('Research solana for me', {
|
|
@@ -307,7 +307,7 @@ response.processDataStream({
|
|
|
307
307
|
|
|
308
308
|
### `resumeStreamUntilIdle()`
|
|
309
309
|
|
|
310
|
-
Resume a suspended agent stream with custom data and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. Use this to continue execution after a suspension point, such as a workflow suspend within an agent. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `resumeStream()`:
|
|
310
|
+
Resume a suspended agent stream with custom data and keep the stream open until every [background task](https://mastra.ai/docs/long-running-agents/background-tasks) dispatched during the run completes. Use this to continue execution after a suspension point, such as a workflow suspend within an agent. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `resumeStream()`:
|
|
311
311
|
|
|
312
312
|
```typescript
|
|
313
313
|
const response = await agent.resumeStreamUntilIdle(
|
|
@@ -57,7 +57,7 @@ You can also pass `requestContext` as a `Record<string, any>`.
|
|
|
57
57
|
|
|
58
58
|
**getAgent(agentId)** (`Agent`): Retrieves a specific agent instance by ID.
|
|
59
59
|
|
|
60
|
-
**listMemoryThreads(params)** (`Promise<StorageThreadType[]>`): Retrieves memory threads for the specified resource and agent. Requires a
|
|
60
|
+
**listMemoryThreads(params)** (`Promise<StorageThreadType[]>`): Retrieves memory threads for the specified resource and agent. Requires a resourceId and an agentId.
|
|
61
61
|
|
|
62
62
|
**createMemoryThread(params)** (`Promise<MemoryThread>`): Creates a new memory thread with the given parameters.
|
|
63
63
|
|
|
@@ -75,13 +75,13 @@ You can also pass `requestContext` as a `Record<string, any>`.
|
|
|
75
75
|
|
|
76
76
|
**getWorkflow(workflowId)** (`Workflow`): Retrieves a specific workflow instance by ID.
|
|
77
77
|
|
|
78
|
-
**getAgentBuilderActions()** (`Promise<Record<string, WorkflowInfo>>`): Returns all available Agent Builder actions. See
|
|
78
|
+
**getAgentBuilderActions()** (`Promise<Record<string, WorkflowInfo>>`): Returns all available Agent Builder actions. See Agent Builder API.
|
|
79
79
|
|
|
80
|
-
**getAgentBuilderAction(actionId)** (`AgentBuilder`): Retrieves an Agent Builder action by ID. See
|
|
80
|
+
**getAgentBuilderAction(actionId)** (`AgentBuilder`): Retrieves an Agent Builder action by ID. See Agent Builder API.
|
|
81
81
|
|
|
82
|
-
**responses** (`Responses`): Provides OpenAI-style Responses API helpers with
|
|
82
|
+
**responses** (`Responses`): Provides OpenAI-style Responses API helpers with create(), retrieve(), stream(), and delete().
|
|
83
83
|
|
|
84
|
-
**conversations** (`Conversations`): Provides conversation helpers with
|
|
84
|
+
**conversations** (`Conversations`): Provides conversation helpers with create(), retrieve(), delete(), and items.list().
|
|
85
85
|
|
|
86
86
|
**getVector(vectorName)** (`MastraVector`): Returns a vector store instance by name.
|
|
87
87
|
|
|
@@ -196,15 +196,15 @@ The returned response object includes:
|
|
|
196
196
|
|
|
197
197
|
## Parameters
|
|
198
198
|
|
|
199
|
-
**agent\_id** (`string`): Required on initial requests. Selects the Mastra agent that executes the request. Stored follow-up turns can omit it when continuing with
|
|
199
|
+
**agent\_id** (`string`): Required on initial requests. Selects the Mastra agent that executes the request. Stored follow-up turns can omit it when continuing with previous\_response\_id.
|
|
200
200
|
|
|
201
|
-
**model** (`string`): Optional model override for this request, such as
|
|
201
|
+
**model** (`string`): Optional model override for this request, such as openai/gpt-5. If omitted, Mastra uses the model configured on the selected agent.
|
|
202
202
|
|
|
203
203
|
**input** (`string | Array<{ role: 'system' | 'developer' | 'user' | 'assistant'; content: string | Array<{ type: 'input_text' | 'text' | 'output_text'; text: string }> }>`): Required. Input text or message array for the response.
|
|
204
204
|
|
|
205
205
|
**instructions** (`string`): Optional instruction override for this request.
|
|
206
206
|
|
|
207
|
-
**text** (`{ format: { type: 'json_object' } | { type: 'json_schema'; name: string; schema: Record<string, unknown>; description?: string; strict?: boolean } }`): Optional text output format. Use
|
|
207
|
+
**text** (`{ format: { type: 'json_object' } | { type: 'json_schema'; name: string; schema: Record<string, unknown>; description?: string; strict?: boolean } }`): Optional text output format. Use json\_object for JSON mode or json\_schema for schema-constrained structured output.
|
|
208
208
|
|
|
209
209
|
**providerOptions** (`Record<string, Record<string, unknown> | undefined>`): Optional provider-specific options passed through to the underlying model call.
|
|
210
210
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "1.30.1-alpha.
|
|
3
|
+
"version": "1.30.1-alpha.1",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"canonicalize": "^1.0.8",
|
|
40
40
|
"jose": "^6.2.1",
|
|
41
41
|
"json-schema": "^0.4.0",
|
|
42
|
-
"@mastra/core": "1.50.0-alpha.
|
|
42
|
+
"@mastra/core": "1.50.0-alpha.1",
|
|
43
43
|
"@mastra/schema-compat": "1.3.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"vitest": "4.1.8",
|
|
58
58
|
"zod": "^4.4.3",
|
|
59
59
|
"@internal/ai-sdk-v4": "0.0.58",
|
|
60
|
-
"@internal/lint": "0.0.111",
|
|
61
60
|
"@internal/ai-sdk-v5": "0.0.58",
|
|
61
|
+
"@internal/lint": "0.0.111",
|
|
62
62
|
"@internal/types-builder": "0.0.86"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
/package/dist/docs/references/{docs-agents-signals.md → docs-long-running-agents-signals.md}
RENAMED
|
File without changes
|