@mastra/client-js 1.4.0-alpha.0 → 1.4.0
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 +117 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,122 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added client methods for the Datasets and Experiments API. New methods on `MastraClient`: ([#12747](https://github.com/mastra-ai/mastra/pull/12747))
|
|
8
|
+
- `listDatasets`, `getDataset`, `createDataset`, `updateDataset`, `deleteDataset`
|
|
9
|
+
- `listDatasetItems`, `getDatasetItem`, `addDatasetItem`, `updateDatasetItem`, `deleteDatasetItem`
|
|
10
|
+
- `batchInsertDatasetItems`, `batchDeleteDatasetItems`
|
|
11
|
+
- `listDatasetVersions`, `getItemHistory`, `getDatasetItemVersion`
|
|
12
|
+
- `listDatasetExperiments`, `getDatasetExperiment`, `listDatasetExperimentResults`
|
|
13
|
+
- `triggerDatasetExperiment`, `compareExperiments`
|
|
14
|
+
|
|
15
|
+
- Added observational memory configuration support for stored agents. When creating or editing a stored agent in the playground, you can now enable observational memory and configure its settings including model provider/name, scope (thread or resource), share token budget, and detailed observer/reflector parameters like token limits, buffer settings, and blocking thresholds. The configuration is serialized as part of the agent's memory config and round-trips through storage. ([#12962](https://github.com/mastra-ai/mastra/pull/12962))
|
|
16
|
+
|
|
17
|
+
**Example usage in the playground:**
|
|
18
|
+
|
|
19
|
+
Enable the Observational Memory toggle in the Memory section, then configure:
|
|
20
|
+
- Top-level model (provider + model) used by both observer and reflector
|
|
21
|
+
- Scope: `thread` (per-conversation) or `resource` (shared across threads)
|
|
22
|
+
- Expand **Observer** or **Reflector** sections to override models and tune token budgets
|
|
23
|
+
|
|
24
|
+
**Programmatic usage via client SDK:**
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
await client.createStoredAgent({
|
|
28
|
+
name: 'My Agent',
|
|
29
|
+
// ...other config
|
|
30
|
+
memory: {
|
|
31
|
+
observationalMemory: true, // enable with defaults
|
|
32
|
+
options: { lastMessages: 40 },
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// Or with custom configuration:
|
|
37
|
+
await client.createStoredAgent({
|
|
38
|
+
name: 'My Agent',
|
|
39
|
+
memory: {
|
|
40
|
+
observationalMemory: {
|
|
41
|
+
model: 'google/gemini-2.5-flash',
|
|
42
|
+
scope: 'resource',
|
|
43
|
+
shareTokenBudget: true,
|
|
44
|
+
observation: { messageTokens: 50000 },
|
|
45
|
+
reflection: { observationTokens: 60000 },
|
|
46
|
+
},
|
|
47
|
+
options: { lastMessages: 40 },
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Programmatic usage via editor:**
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
await editor.agent.create({
|
|
56
|
+
name: 'My Agent',
|
|
57
|
+
// ...other config
|
|
58
|
+
memory: {
|
|
59
|
+
observationalMemory: true, // enable with defaults
|
|
60
|
+
options: { lastMessages: 40 },
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Or with custom configuration:
|
|
65
|
+
await editor.agent.create({
|
|
66
|
+
name: 'My Agent',
|
|
67
|
+
memory: {
|
|
68
|
+
observationalMemory: {
|
|
69
|
+
model: 'google/gemini-2.5-flash',
|
|
70
|
+
scope: 'resource',
|
|
71
|
+
shareTokenBudget: true,
|
|
72
|
+
observation: { messageTokens: 50000 },
|
|
73
|
+
reflection: { observationTokens: 60000 },
|
|
74
|
+
},
|
|
75
|
+
options: { lastMessages: 40 },
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Fix `base64RequestContext` to handle non-ASCII characters (e.g. CJK, em-dashes, emoji) without throwing `InvalidCharacterError`. The previous implementation used `btoa()` directly, which only supports Latin1 characters. Now encodes via `TextEncoder` to UTF-8 bytes first, which is compatible with the existing server-side `Buffer.from(str, 'base64').toString('utf-8')` decode. ([#13009](https://github.com/mastra-ai/mastra/pull/13009))
|
|
83
|
+
|
|
84
|
+
- Fixed `Content-Type: application/json` header not being sent on DELETE requests with a body. ([#12747](https://github.com/mastra-ai/mastra/pull/12747))
|
|
85
|
+
|
|
86
|
+
- Fixed `ClientAgent.network()` to properly convert `structuredOutput.schema` and `requestContext` before sending to the server, matching the existing behavior of `generate()` and `stream()`. Previously, Zod schemas passed to `network()` lost non-enumerable properties during JSON serialization, causing the server to misidentify them as pre-converted JSON Schema and resulting in OpenAI rejecting the malformed schema. ([#12942](https://github.com/mastra-ai/mastra/pull/12942))
|
|
87
|
+
|
|
88
|
+
- Added client SDK resources for stored MCP clients and tool providers. ([#12974](https://github.com/mastra-ai/mastra/pull/12974))
|
|
89
|
+
|
|
90
|
+
**Stored MCP Client Resource**
|
|
91
|
+
|
|
92
|
+
New `StoredMCPClient` resource class with methods for managing MCP client configurations:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const client = new MastraClient({ baseUrl: '...' });
|
|
96
|
+
|
|
97
|
+
// CRUD operations
|
|
98
|
+
const mcpClients = await client.storedMCPClient.list();
|
|
99
|
+
const mcpClient = await client.storedMCPClient.get('my-mcp');
|
|
100
|
+
await client.storedMCPClient.create('my-mcp', { name: 'My MCP', servers: { ... } });
|
|
101
|
+
await client.storedMCPClient.delete('my-mcp');
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Tool Provider Resource**
|
|
105
|
+
|
|
106
|
+
New `ToolProvider` resource class for browsing registered tool providers:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const providers = await client.listToolProviders();
|
|
110
|
+
const provider = await client.getToolProvider('composio');
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Updated agent types to include `mcpClients` and `integrationTools` conditional fields.
|
|
114
|
+
|
|
115
|
+
- Updated instructions type to support both plain strings and structured instruction blocks ([#12864](https://github.com/mastra-ai/mastra/pull/12864))
|
|
116
|
+
|
|
117
|
+
- Updated dependencies [[`7ef618f`](https://github.com/mastra-ai/mastra/commit/7ef618f3c49c27e2f6b27d7f564c557c0734325b), [`b373564`](https://github.com/mastra-ai/mastra/commit/b37356491d43b4d53067f10cb669abaf2502f218), [`927c2af`](https://github.com/mastra-ai/mastra/commit/927c2af9792286c122e04409efce0f3c804f777f), [`b896b41`](https://github.com/mastra-ai/mastra/commit/b896b41343de7fcc14442fb40fe82d189e65bbe2), [`6415277`](https://github.com/mastra-ai/mastra/commit/6415277a438faa00db2af850ead5dee25f40c428), [`0831bbb`](https://github.com/mastra-ai/mastra/commit/0831bbb5bc750c18e9b22b45f18687c964b70828), [`63f7eda`](https://github.com/mastra-ai/mastra/commit/63f7eda605eb3e0c8c35ee3912ffe7c999c69f69), [`a5b67a3`](https://github.com/mastra-ai/mastra/commit/a5b67a3589a74415feb663a55d1858324a2afde9), [`877b02c`](https://github.com/mastra-ai/mastra/commit/877b02cdbb15e199184c7f2b8f217be8d3ebada7), [`7567222`](https://github.com/mastra-ai/mastra/commit/7567222b1366f0d39980594792dd9d5060bfe2ab), [`af71458`](https://github.com/mastra-ai/mastra/commit/af71458e3b566f09c11d0e5a0a836dc818e7a24a), [`eb36bd8`](https://github.com/mastra-ai/mastra/commit/eb36bd8c52fcd6ec9674ac3b7a6412405b5983e1), [`3cbf121`](https://github.com/mastra-ai/mastra/commit/3cbf121f55418141924754a83102aade89835947)]:
|
|
118
|
+
- @mastra/core@1.4.0
|
|
119
|
+
|
|
3
120
|
## 1.4.0-alpha.0
|
|
4
121
|
|
|
5
122
|
### Minor 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.4.0
|
|
6
|
+
version: "1.4.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "1.4.0
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@lukeed/uuid": "^2.0.1",
|
|
38
38
|
"json-schema": "^0.4.0",
|
|
39
|
-
"@mastra/core": "1.4.0
|
|
39
|
+
"@mastra/core": "1.4.0",
|
|
40
40
|
"@mastra/schema-compat": "1.1.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "4.0.16",
|
|
55
55
|
"zod": "^3.25.76",
|
|
56
|
-
"@internal/
|
|
57
|
-
"@internal/
|
|
58
|
-
"@internal/types-builder": "0.0.
|
|
59
|
-
"@internal/ai-sdk-
|
|
56
|
+
"@internal/lint": "0.0.59",
|
|
57
|
+
"@internal/ai-sdk-v4": "0.0.6",
|
|
58
|
+
"@internal/types-builder": "0.0.34",
|
|
59
|
+
"@internal/ai-sdk-v5": "0.0.6"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=22.13.0"
|