@mastra/client-js 0.12.3-alpha.0 → 0.12.3
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 +26 -0
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +72 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -17
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +13 -7
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.12.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Delayed deprecation notice for streamVNext() replacing stream() until Sept 23rd ([#7739](https://github.com/mastra-ai/mastra/pull/7739))
|
|
8
|
+
|
|
9
|
+
- AN packages ([#7711](https://github.com/mastra-ai/mastra/pull/7711))
|
|
10
|
+
|
|
11
|
+
- Client SDK Agents, Mastra server - support runtimeContext with GET requests ([#7734](https://github.com/mastra-ai/mastra/pull/7734))
|
|
12
|
+
|
|
13
|
+
- Change SchemaCompat zodToJsonSchema ref strategy from none to relative, leading to less schema warnings and smaller converted schema sizes ([#7697](https://github.com/mastra-ai/mastra/pull/7697))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
16
|
+
- @mastra/core@0.16.3
|
|
17
|
+
|
|
18
|
+
## 0.12.3-alpha.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Delayed deprecation notice for streamVNext() replacing stream() until Sept 23rd ([#7739](https://github.com/mastra-ai/mastra/pull/7739))
|
|
23
|
+
|
|
24
|
+
- Client SDK Agents, Mastra server - support runtimeContext with GET requests ([#7734](https://github.com/mastra-ai/mastra/pull/7734))
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812)]:
|
|
27
|
+
- @mastra/core@0.16.3-alpha.1
|
|
28
|
+
|
|
3
29
|
## 0.12.3-alpha.0
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AITraceRecord, AITracesPaginatedArg, WorkflowInfo } from '@mastra/core';
|
|
2
2
|
import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
3
4
|
import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, Network, A2A, MCPTool, LegacyWorkflow, AgentBuilder } from './resources/index.js';
|
|
4
5
|
import { NetworkMemoryThread } from './resources/network-memory-thread.js';
|
|
5
6
|
import { VNextNetwork } from './resources/vNextNetwork.js';
|
|
@@ -9,9 +10,10 @@ export declare class MastraClient extends BaseResource {
|
|
|
9
10
|
constructor(options: ClientOptions);
|
|
10
11
|
/**
|
|
11
12
|
* Retrieves all available agents
|
|
13
|
+
* @param runtimeContext - Runtime context to use for the agents
|
|
12
14
|
* @returns Promise containing map of agent IDs to agent details
|
|
13
15
|
*/
|
|
14
|
-
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
16
|
+
getAgents(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetAgentResponse>>;
|
|
15
17
|
/**
|
|
16
18
|
* Gets an agent instance by ID
|
|
17
19
|
* @param agentId - ID of the agent to retrieve
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,OAAO,EACP,GAAG,EACH,OAAO,EACP,cAAc,EACd,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,+BAA+B,EAC/B,gCAAgC,EAChC,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,OAAO,EACP,GAAG,EACH,OAAO,EACP,cAAc,EACd,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EA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,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAID;;;;;;OAMG;IACI,mBAAmB,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAUD;;;OAGG;IACI,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAI/D;;;;OAIG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIvD,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqBzF;;;;OAIG;IACI,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAenF;;;;OAIG;IACI,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAezF;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOrE;;;OAGG;IACH,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAItC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAInD,WAAW,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAGxE"}
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,12 @@ function parseClientRuntimeContext(runtimeContext$1) {
|
|
|
21
21
|
}
|
|
22
22
|
return void 0;
|
|
23
23
|
}
|
|
24
|
+
function base64RuntimeContext(runtimeContext) {
|
|
25
|
+
if (runtimeContext) {
|
|
26
|
+
return btoa(JSON.stringify(runtimeContext));
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
24
30
|
function isZodType(value) {
|
|
25
31
|
return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
|
|
26
32
|
}
|
|
@@ -279,17 +285,31 @@ var AgentVoice = class extends BaseResource {
|
|
|
279
285
|
}
|
|
280
286
|
/**
|
|
281
287
|
* Get available speakers for the agent's voice provider
|
|
288
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
282
289
|
* @returns Promise containing list of available speakers
|
|
283
290
|
*/
|
|
284
|
-
getSpeakers() {
|
|
285
|
-
|
|
291
|
+
getSpeakers(runtimeContext) {
|
|
292
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
293
|
+
const searchParams = new URLSearchParams();
|
|
294
|
+
if (runtimeContextParam) {
|
|
295
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
296
|
+
}
|
|
297
|
+
const queryString = searchParams.toString();
|
|
298
|
+
return this.request(`/api/agents/${this.agentId}/voice/speakers${queryString ? `?${queryString}` : ""}`);
|
|
286
299
|
}
|
|
287
300
|
/**
|
|
288
301
|
* Get the listener configuration for the agent's voice provider
|
|
302
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
289
303
|
* @returns Promise containing a check if the agent has listening capabilities
|
|
290
304
|
*/
|
|
291
|
-
getListener() {
|
|
292
|
-
|
|
305
|
+
getListener(runtimeContext) {
|
|
306
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
307
|
+
const searchParams = new URLSearchParams();
|
|
308
|
+
if (runtimeContextParam) {
|
|
309
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
310
|
+
}
|
|
311
|
+
const queryString = searchParams.toString();
|
|
312
|
+
return this.request(`/api/agents/${this.agentId}/voice/listener${queryString ? `?${queryString}` : ""}`);
|
|
293
313
|
}
|
|
294
314
|
};
|
|
295
315
|
var Agent = class extends BaseResource {
|
|
@@ -301,14 +321,21 @@ var Agent = class extends BaseResource {
|
|
|
301
321
|
voice;
|
|
302
322
|
/**
|
|
303
323
|
* Retrieves details about the agent
|
|
324
|
+
* @param runtimeContext - Runtime context to use for the agent
|
|
304
325
|
* @returns Promise containing agent details including model and instructions
|
|
305
326
|
*/
|
|
306
|
-
details() {
|
|
307
|
-
|
|
327
|
+
details(runtimeContext) {
|
|
328
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
329
|
+
const searchParams = new URLSearchParams();
|
|
330
|
+
if (runtimeContextParam) {
|
|
331
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
332
|
+
}
|
|
333
|
+
const queryString = searchParams.toString();
|
|
334
|
+
return this.request(`/api/agents/${this.agentId}${queryString ? `?${queryString}` : ""}`);
|
|
308
335
|
}
|
|
309
336
|
async generate(params) {
|
|
310
337
|
console.warn(
|
|
311
|
-
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September
|
|
338
|
+
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September 23rd, 2025. Please use generateLegacy if you don't want to upgrade just yet."
|
|
312
339
|
);
|
|
313
340
|
return this.generateLegacy(params);
|
|
314
341
|
}
|
|
@@ -678,7 +705,7 @@ var Agent = class extends BaseResource {
|
|
|
678
705
|
*/
|
|
679
706
|
async stream(params) {
|
|
680
707
|
console.warn(
|
|
681
|
-
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September
|
|
708
|
+
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September 23rd, 2025. Please use streamLegacy if you don't want to upgrade just yet."
|
|
682
709
|
);
|
|
683
710
|
return this.streamLegacy(params);
|
|
684
711
|
}
|
|
@@ -1251,10 +1278,17 @@ var Agent = class extends BaseResource {
|
|
|
1251
1278
|
/**
|
|
1252
1279
|
* Gets details about a specific tool available to the agent
|
|
1253
1280
|
* @param toolId - ID of the tool to retrieve
|
|
1281
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1254
1282
|
* @returns Promise containing tool details
|
|
1255
1283
|
*/
|
|
1256
|
-
getTool(toolId) {
|
|
1257
|
-
|
|
1284
|
+
getTool(toolId, runtimeContext) {
|
|
1285
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1286
|
+
const searchParams = new URLSearchParams();
|
|
1287
|
+
if (runtimeContextParam) {
|
|
1288
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1289
|
+
}
|
|
1290
|
+
const queryString = searchParams.toString();
|
|
1291
|
+
return this.request(`/api/agents/${this.agentId}/tools/${toolId}${queryString ? `?${queryString}` : ""}`);
|
|
1258
1292
|
}
|
|
1259
1293
|
/**
|
|
1260
1294
|
* Executes a tool for the agent
|
|
@@ -1265,7 +1299,7 @@ var Agent = class extends BaseResource {
|
|
|
1265
1299
|
executeTool(toolId, params) {
|
|
1266
1300
|
const body = {
|
|
1267
1301
|
data: params.data,
|
|
1268
|
-
runtimeContext:
|
|
1302
|
+
runtimeContext: parseClientRuntimeContext(params.runtimeContext)
|
|
1269
1303
|
};
|
|
1270
1304
|
return this.request(`/api/agents/${this.agentId}/tools/${toolId}/execute`, {
|
|
1271
1305
|
method: "POST",
|
|
@@ -1274,17 +1308,31 @@ var Agent = class extends BaseResource {
|
|
|
1274
1308
|
}
|
|
1275
1309
|
/**
|
|
1276
1310
|
* Retrieves evaluation results for the agent
|
|
1311
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1277
1312
|
* @returns Promise containing agent evaluations
|
|
1278
1313
|
*/
|
|
1279
|
-
evals() {
|
|
1280
|
-
|
|
1314
|
+
evals(runtimeContext) {
|
|
1315
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1316
|
+
const searchParams = new URLSearchParams();
|
|
1317
|
+
if (runtimeContextParam) {
|
|
1318
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1319
|
+
}
|
|
1320
|
+
const queryString = searchParams.toString();
|
|
1321
|
+
return this.request(`/api/agents/${this.agentId}/evals/ci${queryString ? `?${queryString}` : ""}`);
|
|
1281
1322
|
}
|
|
1282
1323
|
/**
|
|
1283
1324
|
* Retrieves live evaluation results for the agent
|
|
1325
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1284
1326
|
* @returns Promise containing live agent evaluations
|
|
1285
1327
|
*/
|
|
1286
|
-
liveEvals() {
|
|
1287
|
-
|
|
1328
|
+
liveEvals(runtimeContext) {
|
|
1329
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1330
|
+
const searchParams = new URLSearchParams();
|
|
1331
|
+
if (runtimeContextParam) {
|
|
1332
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1333
|
+
}
|
|
1334
|
+
const queryString = searchParams.toString();
|
|
1335
|
+
return this.request(`/api/agents/${this.agentId}/evals/live${queryString ? `?${queryString}` : ""}`);
|
|
1288
1336
|
}
|
|
1289
1337
|
/**
|
|
1290
1338
|
* Updates the model for the agent
|
|
@@ -2814,10 +2862,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2814
2862
|
}
|
|
2815
2863
|
/**
|
|
2816
2864
|
* Retrieves all available agents
|
|
2865
|
+
* @param runtimeContext - Runtime context to use for the agents
|
|
2817
2866
|
* @returns Promise containing map of agent IDs to agent details
|
|
2818
2867
|
*/
|
|
2819
|
-
getAgents() {
|
|
2820
|
-
|
|
2868
|
+
getAgents(runtimeContext) {
|
|
2869
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
2870
|
+
const searchParams = new URLSearchParams();
|
|
2871
|
+
if (runtimeContextParam) {
|
|
2872
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
2873
|
+
}
|
|
2874
|
+
const queryString = searchParams.toString();
|
|
2875
|
+
return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
|
|
2821
2876
|
}
|
|
2822
2877
|
/**
|
|
2823
2878
|
* Gets an agent instance by ID
|