@mastra/client-js 1.24.0-alpha.2 → 1.24.0-alpha.4
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 +40 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-editor-overview.md +6 -6
- package/dist/docs/references/docs-server-auth-workos.md +1 -1
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +1 -1
- package/dist/docs/references/reference-client-js-responses.md +2 -2
- package/dist/docs/references/reference-client-js-workflows.md +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/route-types.generated.d.ts +39 -4
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.24.0-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added metric time series response type exports for client SDK consumers. ([#17686](https://github.com/mastra-ai/mastra/pull/17686))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`575f815`](https://github.com/mastra-ai/mastra/commit/575f815c5c3567b71c0b83cbb7fa98c8253a9d9c), [`306909a`](https://github.com/mastra-ai/mastra/commit/306909a693de77d709b38706e2673c9547d24a28), [`5191af8`](https://github.com/mastra-ai/mastra/commit/5191af80c799eea25357c545fc05d91b3883531d), [`43bd3d4`](https://github.com/mastra-ai/mastra/commit/43bd3d421987463fdf35386a45199c49499ed069), [`e6fa79e`](https://github.com/mastra-ai/mastra/commit/e6fa79ec72a2ddffdd25e85270398951e9d552a4), [`904bcdf`](https://github.com/mastra-ai/mastra/commit/904bcdf7b8004aa7be823f9f70ca63580e47e470), [`7f5ee1d`](https://github.com/mastra-ai/mastra/commit/7f5ee1dca46daee8d2817f2ebe49e6335da81956), [`1e9aab5`](https://github.com/mastra-ai/mastra/commit/1e9aab50ff11e6e88fde4d7cbf512c44a9fe8d61), [`bf8eb6d`](https://github.com/mastra-ai/mastra/commit/bf8eb6d0ec213a403eb9265a594ad283c44ab3dc), [`493a328`](https://github.com/mastra-ai/mastra/commit/493a328f4346a1deeb9f1e2e44c8f2a3a4d7591b), [`029a414`](https://github.com/mastra-ai/mastra/commit/029a4141719793bd3e898a39eb5a0466a55f5f3a), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`d371ac1`](https://github.com/mastra-ai/mastra/commit/d371ac1d9820afaaf7cfdbc380a475946a994d8f), [`cf182b7`](https://github.com/mastra-ai/mastra/commit/cf182b7fb495767946d9840ef29f19cfa906f31f), [`a049c2a`](https://github.com/mastra-ai/mastra/commit/a049c2a9dfb41d0ee2e7a28874a88cd64fd5669f), [`b147b29`](https://github.com/mastra-ai/mastra/commit/b147b2907f0cd1aa812efe6d6e3f58d22e66fc88), [`2a96528`](https://github.com/mastra-ai/mastra/commit/2a9652848dfa3c5a2426f952e9d93554c26fd90f), [`2656d9c`](https://github.com/mastra-ai/mastra/commit/2656d9c2976d4f3354253bfbbbf9b88a1b2bbf34), [`63e3fe1`](https://github.com/mastra-ai/mastra/commit/63e3fe13cc1ea96f91d7c68aea92f400faf9e4da), [`1d4ce8d`](https://github.com/mastra-ai/mastra/commit/1d4ce8daaa54511f325c1b609d31b8e54009d677), [`8c68372`](https://github.com/mastra-ai/mastra/commit/8c68372e85fe0b066ec12c58bd29ffb93e54c552)]:
|
|
10
|
+
- @mastra/core@1.42.0-alpha.4
|
|
11
|
+
|
|
12
|
+
## 1.24.0-alpha.3
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- **Added** optional `author` field on `StoredAgentResponse` so consumers can render the resolved author (name, email, avatar) returned by stored-agent list and detail endpoints. ([#17205](https://github.com/mastra-ai/mastra/pull/17205))
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- **Added** author enrichment to the stored-agents list and get handlers. When an auth provider is configured, each agent record now includes a resolved `author` object alongside the existing `authorId`: ([#17205](https://github.com/mastra-ai/mastra/pull/17205))
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
{
|
|
24
|
+
id: 'agent_…',
|
|
25
|
+
authorId: 'user_…',
|
|
26
|
+
id, name?, email?, avatarUrl? } // new, optional
|
|
27
|
+
// …
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Lookups are deduplicated per request and use the provider's `getUsers` batch method when available, falling back to per-id `getUser` calls otherwise. The field is omitted when no auth provider is configured or the ID can't be resolved, so existing clients keep working unchanged.
|
|
32
|
+
|
|
33
|
+
- **Added** optional `getUsers(userIds)` batch lookup method to `IUserProvider`. Auth providers can implement it to resolve multiple users in a single call; providers that don't implement it continue to work via per-id `getUser` fallback. ([#17205](https://github.com/mastra-ai/mastra/pull/17205))
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// optional batch lookup, returns results positionally aligned to userIds
|
|
37
|
+
const users = await provider.getUsers?.(['u_1', 'u_2', 'u_3']);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`053735a`](https://github.com/mastra-ai/mastra/commit/053735a75c2c18e23ce34d9468007efa4a45f4c4), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`34839c1`](https://github.com/mastra-ai/mastra/commit/34839c1910b6964bf59ed0cee58844efebbb684e), [`a952852`](https://github.com/mastra-ai/mastra/commit/a952852c971a21fb646cd907c75fcf4443cdc963)]:
|
|
41
|
+
- @mastra/core@1.42.0-alpha.3
|
|
42
|
+
|
|
3
43
|
## 1.24.0-alpha.2
|
|
4
44
|
|
|
5
45
|
### 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.24.0-alpha.
|
|
6
|
+
version: "1.24.0-alpha.4"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -97,7 +97,7 @@ When `source` is `'code'`, the editor writes each override to a deterministic JS
|
|
|
97
97
|
|
|
98
98
|
### Versioning with the code source
|
|
99
99
|
|
|
100
|
-
The code source uses the Git history of each per-agent JSON file as its version history. Each commit that changes a file
|
|
100
|
+
The code source uses the Git history of each per-agent JSON file as its version history. Each commit that changes a file is shown as a read-only version in Studio, labeled with the commit message. Saving in Studio updates the working file in place rather than creating a database draft, so the version dropdown reflects your actual commit history.
|
|
101
101
|
|
|
102
102
|
This means versions and rollbacks are managed through Git rather than through draft and publish actions.
|
|
103
103
|
|
|
@@ -159,11 +159,11 @@ The same operations are available over HTTP through the Mastra server. Use these
|
|
|
159
159
|
| `GET` | `/stored/agents/:storedAgentId/dependents` | List agents that reference this agent as a sub-agent. |
|
|
160
160
|
| `POST` | `/stored/agents/:storedAgentId/export` | Export a stored agent's override as a deterministic JSON config. |
|
|
161
161
|
|
|
162
|
-
The dependents endpoint helps warn before deleting or unsharing an agent that other agents depend on: `dependents` lists caller-readable agents by `id` and `name`, while `hiddenCount` aggregates cross-workspace references the caller
|
|
162
|
+
The dependents endpoint helps warn before deleting or unsharing an agent that other agents depend on: `dependents` lists caller-readable agents by `id` and `name`, while `hiddenCount` aggregates cross-workspace references the caller can't read (surfaced only when the target is public). The export endpoint returns only the fields the agent's [`editor` config](https://mastra.ai/reference/agents/agent) allows, so the output matches the per-agent file the code source writes to disk. The Client SDK wraps these endpoints with `client.listStoredAgents()`, `client.createStoredAgent()`, `client.getStoredAgent()`, `client.getStoredAgent(id).dependents()`, and `client.getStoredAgent(id).export()`. Version management endpoints live under `/stored/agents/:storedAgentId/versions`, see [version management](https://mastra.ai/reference/client-js/agents) for the full list.
|
|
163
163
|
|
|
164
164
|
### Automated experimentation
|
|
165
165
|
|
|
166
|
-
Because stored agents are
|
|
166
|
+
Because stored agents are data, you can build automation loops that tune agents without human involvement. A common pattern is to pair the editor API with [datasets](https://mastra.ai/docs/evals/datasets/overview) and [experiments](https://mastra.ai/docs/evals/datasets/running-experiments):
|
|
167
167
|
|
|
168
168
|
- Run a dataset through the current version of an agent and score the results.
|
|
169
169
|
- Have another agent read the failing cases and propose changes to the instructions or tools.
|
|
@@ -186,7 +186,7 @@ When you edit a code-defined agent through the editor, only specific fields can
|
|
|
186
186
|
|
|
187
187
|
Fields like the agent's `id`, `name`, and `model` come from your code and can't be changed through the editor for code-defined agents. The variables are also read-only.
|
|
188
188
|
|
|
189
|
-
### Controlling what
|
|
189
|
+
### Controlling what's editable
|
|
190
190
|
|
|
191
191
|
Use the `editor` field on a code-defined agent to control which fields the editor can override. This lets you keep some fields code-owned while allowing edits to others:
|
|
192
192
|
|
|
@@ -226,7 +226,7 @@ Each version has one of three statuses:
|
|
|
226
226
|
| --------- | ----------------------------------------------------------------------------------- |
|
|
227
227
|
| Draft | The latest working copy. Every save creates a new draft version. |
|
|
228
228
|
| Published | The active version used in production. Only one version can be published at a time. |
|
|
229
|
-
| Archived | A previous version that
|
|
229
|
+
| Archived | A previous version that's no longer active. You can restore any archived version. |
|
|
230
230
|
|
|
231
231
|
The typical flow is: Edit the draft, test it, then activate it to make it the published version. The previously published version becomes archived so you can restore it if needed. You can do this through Studio or programmatically through the API.
|
|
232
232
|
|
|
@@ -344,7 +344,7 @@ curl -X POST http://localhost:4111/agents/supervisor/generate \
|
|
|
344
344
|
|
|
345
345
|
Version overrides propagate automatically through sub-agent delegation via `requestContext`. When a supervisor delegates to a sub-agent, the framework checks if a version override exists for that sub-agent's ID. If one is found, it resolves the stored version from the editor and uses it instead of the code-defined default.
|
|
346
346
|
|
|
347
|
-
If version resolution fails (for example, when the editor
|
|
347
|
+
If version resolution fails (for example, when the editor isn't configured or the version ID doesn't exist), the framework logs a warning and falls back to the code-defined agent.
|
|
348
348
|
|
|
349
349
|
## Next steps
|
|
350
350
|
|
|
@@ -125,7 +125,7 @@ const workosAuth = new MastraAuthWorkos({
|
|
|
125
125
|
})
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
This is useful when your JWT template already includes the exact FGA context Mastra needs, such as `organizationMembershipId`, tenant IDs, or service-principal identifiers. When `trustJwtClaims` is enabled, Mastra can fall back to those verified claims if a bearer token
|
|
128
|
+
This is useful when your JWT template already includes the exact FGA context Mastra needs, such as `organizationMembershipId`, tenant IDs, or service-principal identifiers. When `trustJwtClaims` is enabled, Mastra can fall back to those verified claims if a bearer token isn't meant to round-trip through `workos.userManagement.getUser()`.
|
|
129
129
|
|
|
130
130
|
### Custom authorization
|
|
131
131
|
|
|
@@ -19,7 +19,7 @@ When the source agent stream includes a final structured output object, `toAISdk
|
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
The `object` field contains your full structured output value. This maps Mastra's final structured output chunk into the AI SDK UI stream. Partial structured output chunks
|
|
22
|
+
The `object` field contains your full structured output value. This maps Mastra's final structured output chunk into the AI SDK UI stream. Partial structured output chunks aren't emitted.
|
|
23
23
|
|
|
24
24
|
## Usage example
|
|
25
25
|
|
|
@@ -130,7 +130,7 @@ Use [`client.conversations`](https://mastra.ai/reference/client-js/conversations
|
|
|
130
130
|
|
|
131
131
|
`response.tools` contains the configured function definitions available for the request.
|
|
132
132
|
|
|
133
|
-
If the model calls a function, that activity
|
|
133
|
+
If the model calls a function, that activity is included in `response.output` as `function_call` and `function_call_output` items alongside the final assistant `message`.
|
|
134
134
|
|
|
135
135
|
When `stream: true`, function calls are also emitted as Responses stream events. Read `response.function_call_arguments.delta` events for partial argument chunks and prefer `response.function_call_arguments.done` for the finalized arguments payload and tool name. Read `response.output_item.done` events for completed `function_call` and `function_call_output` items. Tool output items use `<toolCallId>:output` IDs.
|
|
136
136
|
|
|
@@ -167,7 +167,7 @@ const response = await client.responses.create({
|
|
|
167
167
|
|
|
168
168
|
## Provider-backed requests
|
|
169
169
|
|
|
170
|
-
Use `providerOptions` when you need provider-specific options that Mastra
|
|
170
|
+
Use `providerOptions` when you need provider-specific options that Mastra doesn't normalize at the Responses layer.
|
|
171
171
|
|
|
172
172
|
```typescript
|
|
173
173
|
const response = await client.responses.create({
|
|
@@ -243,7 +243,7 @@ await mastraClient.pauseSchedule('daily-report')
|
|
|
243
243
|
|
|
244
244
|
### `resumeSchedule()`
|
|
245
245
|
|
|
246
|
-
Resume a paused schedule. The next fire time is recomputed from now, so a long-paused schedule
|
|
246
|
+
Resume a paused schedule. The next fire time is recomputed from now, so a long-paused schedule doesn't fire a backlog. Returns the updated schedule. Idempotent.
|
|
247
247
|
|
|
248
248
|
```typescript
|
|
249
249
|
await mastraClient.resumeSchedule('daily-report')
|