@mastra/client-js 1.2.0 → 1.3.0-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 +93 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +2103 -269
- package/dist/client.d.ts +30 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +32 -22
- package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
- package/dist/docs/{server/07-auth0.md → references/docs-server-auth-auth0.md} +68 -79
- package/dist/docs/{server/03-clerk.md → references/docs-server-auth-clerk.md} +41 -52
- package/dist/docs/{server/05-firebase.md → references/docs-server-auth-firebase.md} +83 -97
- package/dist/docs/{server/02-jwt.md → references/docs-server-auth-jwt.md} +46 -35
- package/dist/docs/{server/04-supabase.md → references/docs-server-auth-supabase.md} +33 -44
- package/dist/docs/{server/06-workos.md → references/docs-server-auth-workos.md} +45 -56
- package/dist/docs/{server/01-mastra-client.md → references/docs-server-mastra-client.md} +32 -20
- package/dist/docs/{ai-sdk/01-reference.md → references/reference-ai-sdk-to-ai-sdk-stream.md} +27 -153
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v4-messages.md +79 -0
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v5-messages.md +73 -0
- package/dist/docs/references/reference-client-js-agents.md +438 -0
- package/dist/docs/references/reference-client-js-error-handling.md +16 -0
- package/dist/docs/references/reference-client-js-logs.md +24 -0
- package/dist/docs/references/reference-client-js-mastra-client.md +63 -0
- package/dist/docs/references/reference-client-js-memory.md +225 -0
- package/dist/docs/references/reference-client-js-observability.md +72 -0
- package/dist/docs/references/reference-client-js-telemetry.md +20 -0
- package/dist/docs/references/reference-client-js-tools.md +44 -0
- package/dist/docs/references/reference-client-js-vectors.md +79 -0
- package/dist/docs/references/reference-client-js-workflows.md +199 -0
- package/dist/index.cjs +139 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +139 -16
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +7 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/base.d.ts +0 -11
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/stored-scorer.d.ts +30 -0
- package/dist/resources/stored-scorer.d.ts.map +1 -0
- package/dist/types.d.ts +322 -44
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/dist/docs/README.md +0 -33
- package/dist/docs/client-js/01-reference.md +0 -1180
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,98 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.3.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **Added stored scorer CRUD API and updated editor namespace calls** ([#12846](https://github.com/mastra-ai/mastra/pull/12846))
|
|
8
|
+
- Added server routes for stored scorer definitions: create, read, update, delete, list, and list resolved
|
|
9
|
+
- Added `StoredScorer` resource to the client SDK with full CRUD support
|
|
10
|
+
- Updated all server handlers to use the new editor namespace pattern (`editor.agent.getById`, `editor.agent.list`, `editor.prompt.preview`) and generic storage domain methods (`store.create`, `store.getById`, `store.delete`)
|
|
11
|
+
|
|
12
|
+
- Added `requestContextSchema` to stored agent types and replaced local conditional field type definitions with re-exports from `@mastra/core/storage` (`Rule`, `RuleGroup`, `StorageConditionalVariant`, `StorageConditionalField`). Existing type aliases (`StoredAgentRule`, `StoredAgentRuleGroup`, `ConditionalVariant`, `ConditionalField`) are preserved for backward compatibility. ([#12896](https://github.com/mastra-ai/mastra/pull/12896))
|
|
13
|
+
|
|
14
|
+
- Add clone agent feature. Code-defined or stored agents can be cloned into new stored agents via the client SDK: ([#12861](https://github.com/mastra-ai/mastra/pull/12861))
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const client = new MastraClient();
|
|
18
|
+
const cloned = await client.getAgent('my-agent').clone({
|
|
19
|
+
newName: 'My Agent Copy',
|
|
20
|
+
requestContext: { workspace: 'dev' },
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The clone serializes the agent's full resolved configuration — model, instructions, tools, workflows, sub-agents, memory, input/output processors, and scorers — using the caller's `requestContext` and persists it as a new stored agent.
|
|
25
|
+
|
|
26
|
+
- Add tool description overrides for stored agents: ([#12794](https://github.com/mastra-ai/mastra/pull/12794))
|
|
27
|
+
- Changed stored agent `tools` field from `string[]` to `Record<string, { description?: string }>` to allow per-tool description overrides
|
|
28
|
+
- When a stored agent specifies a custom `description` for a tool, the override is applied at resolution time
|
|
29
|
+
- Updated server API schemas, client SDK types, and editor resolution logic accordingly
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Fixed multiple issues with stored agents: ([#12861](https://github.com/mastra-ai/mastra/pull/12861))
|
|
34
|
+
1. **Memory field can now be disabled**: Fixed an issue where the memory field couldn't be set to `null` to disable memory on stored agents. The update endpoint now accepts `memory: null` to explicitly disable memory configuration.
|
|
35
|
+
2. **Agent-level scorers are now discoverable**: Fixed an issue where scorers attached to code-defined agents (e.g., answer relevancy scorer) were not available in the scorer dropdown for stored agents. The system now automatically registers agent-level scorers with the Mastra instance, making them discoverable through `resolveStoredScorers`.
|
|
36
|
+
3. **Agent IDs are now derived from names**: Agent IDs are now automatically generated from the agent name using slugification (e.g., "My Cool Agent" becomes "my-cool-agent") instead of using random UUIDs. This makes agent IDs more readable and consistent with code-defined agents.
|
|
37
|
+
|
|
38
|
+
**Before:**
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// Creating an agent required a manual ID
|
|
42
|
+
const agent = await client.createStoredAgent({
|
|
43
|
+
id: crypto.randomUUID(), // Required, resulted in "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
44
|
+
name: 'My Cool Agent',
|
|
45
|
+
// ...
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Couldn't disable memory
|
|
49
|
+
await client.updateStoredAgent(agentId, {
|
|
50
|
+
memory: null, // ❌ Would throw validation error
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Agent-level scorers weren't available for stored agents
|
|
54
|
+
// e.g., answer-relevancy-scorer from evalAgent wasn't in the dropdown
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**After:**
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// ID is auto-generated from name
|
|
61
|
+
const agent = await client.createStoredAgent({
|
|
62
|
+
name: 'My Cool Agent',
|
|
63
|
+
// ...
|
|
64
|
+
});
|
|
65
|
+
// agent.id is now "my-cool-agent"
|
|
66
|
+
|
|
67
|
+
// Can disable memory
|
|
68
|
+
await client.updateStoredAgent(agentId, {
|
|
69
|
+
memory: null, // ✅ Works, disables memory
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// All agent-level scorers are now available in the dropdown
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Fixed A2A client URLs to correctly include the API prefix. Previously, requests to agent card and A2A execution endpoints were missing the `/api/` prefix (e.g., `/.well-known/[agent-id]/agent-card.json` instead of `/api/.well-known/[agent-id]/agent-card.json`), causing 404 errors. ([#12841](https://github.com/mastra-ai/mastra/pull/12841))
|
|
76
|
+
|
|
77
|
+
- Supporting work to enable workflow step metadata ([#12508](https://github.com/mastra-ai/mastra/pull/12508))
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
|
|
80
|
+
- @mastra/core@1.3.0-alpha.1
|
|
81
|
+
|
|
82
|
+
## 1.2.1-alpha.0
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Update types and add new methods: ([#12704](https://github.com/mastra-ai/mastra/pull/12704))
|
|
87
|
+
- Updated `CreateStoredAgentParams` and `UpdateStoredAgentParams` types to match server schemas
|
|
88
|
+
- Added proper `SerializedMemoryConfig` type with all fields including `embedder` and `embedderOptions`
|
|
89
|
+
- Fixed `StoredAgentScorerConfig` to use correct sampling types (`'none' | 'ratio'`)
|
|
90
|
+
- Added `listVectors()` and `listEmbedders()` methods to the client
|
|
91
|
+
- Added corresponding `ListVectorsResponse` and `ListEmbeddersResponse` types
|
|
92
|
+
|
|
93
|
+
- Updated dependencies [[`90f7894`](https://github.com/mastra-ai/mastra/commit/90f7894568dc9481f40a4d29672234fae23090bb), [`8109aee`](https://github.com/mastra-ai/mastra/commit/8109aeeab758e16cd4255a6c36f044b70eefc6a6)]:
|
|
94
|
+
- @mastra/core@1.2.1-alpha.0
|
|
95
|
+
|
|
3
96
|
## 1.2.0
|
|
4
97
|
|
|
5
98
|
### Minor Changes
|