@mastra/client-js 0.0.0-fix-bundle-cleanup-20250911062914 → 0.0.0-fix-cloud-peer-deps-20250923194656
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 +215 -4
- package/README.md +2 -6
- package/dist/client.d.ts +36 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +330 -134
- 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 +329 -135
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +5 -6
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +42 -11
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/index.d.ts +0 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/legacy-workflow.d.ts +5 -2
- package/dist/resources/legacy-workflow.d.ts.map +1 -1
- package/dist/resources/mcp-tool.d.ts +2 -1
- package/dist/resources/mcp-tool.d.ts.map +1 -1
- package/dist/resources/observability.d.ts +10 -0
- package/dist/resources/observability.d.ts.map +1 -1
- package/dist/resources/tool.d.ts +2 -1
- package/dist/resources/tool.d.ts.map +1 -1
- package/dist/resources/vNextNetwork.d.ts +2 -1
- package/dist/resources/vNextNetwork.d.ts.map +1 -1
- package/dist/resources/vector.d.ts +5 -2
- package/dist/resources/vector.d.ts.map +1 -1
- package/dist/resources/workflow.d.ts +96 -11
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/types.d.ts +42 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/resources/network.d.ts +0 -30
- package/dist/resources/network.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,20 @@ function parseClientRuntimeContext(runtimeContext) {
|
|
|
15
15
|
}
|
|
16
16
|
return void 0;
|
|
17
17
|
}
|
|
18
|
+
function base64RuntimeContext(runtimeContext) {
|
|
19
|
+
if (runtimeContext) {
|
|
20
|
+
return btoa(JSON.stringify(runtimeContext));
|
|
21
|
+
}
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function runtimeContextQueryString(runtimeContext) {
|
|
25
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
26
|
+
if (!runtimeContextParam) return "";
|
|
27
|
+
const searchParams = new URLSearchParams();
|
|
28
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
29
|
+
const queryString = searchParams.toString();
|
|
30
|
+
return queryString ? `?${queryString}` : "";
|
|
31
|
+
}
|
|
18
32
|
function isZodType(value) {
|
|
19
33
|
return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
|
|
20
34
|
}
|
|
@@ -77,7 +91,7 @@ async function sharedProcessMastraStream({
|
|
|
77
91
|
if (line.startsWith("data: ")) {
|
|
78
92
|
const data = line.slice(6);
|
|
79
93
|
if (data === "[DONE]") {
|
|
80
|
-
console.
|
|
94
|
+
console.info("\u{1F3C1} Stream finished");
|
|
81
95
|
return;
|
|
82
96
|
}
|
|
83
97
|
try {
|
|
@@ -199,7 +213,9 @@ async function executeToolCallAndRespond({
|
|
|
199
213
|
resourceId,
|
|
200
214
|
threadId,
|
|
201
215
|
runtimeContext,
|
|
202
|
-
tracingContext: { currentSpan: void 0 }
|
|
216
|
+
tracingContext: { currentSpan: void 0 },
|
|
217
|
+
suspend: async () => {
|
|
218
|
+
}
|
|
203
219
|
},
|
|
204
220
|
{
|
|
205
221
|
messages: response.messages,
|
|
@@ -273,17 +289,21 @@ var AgentVoice = class extends BaseResource {
|
|
|
273
289
|
}
|
|
274
290
|
/**
|
|
275
291
|
* Get available speakers for the agent's voice provider
|
|
292
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
293
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
276
294
|
* @returns Promise containing list of available speakers
|
|
277
295
|
*/
|
|
278
|
-
getSpeakers() {
|
|
279
|
-
return this.request(`/api/agents/${this.agentId}/voice/speakers`);
|
|
296
|
+
getSpeakers(runtimeContext) {
|
|
297
|
+
return this.request(`/api/agents/${this.agentId}/voice/speakers${runtimeContextQueryString(runtimeContext)}`);
|
|
280
298
|
}
|
|
281
299
|
/**
|
|
282
300
|
* Get the listener configuration for the agent's voice provider
|
|
301
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
302
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
283
303
|
* @returns Promise containing a check if the agent has listening capabilities
|
|
284
304
|
*/
|
|
285
|
-
getListener() {
|
|
286
|
-
return this.request(`/api/agents/${this.agentId}/voice/listener`);
|
|
305
|
+
getListener(runtimeContext) {
|
|
306
|
+
return this.request(`/api/agents/${this.agentId}/voice/listener${runtimeContextQueryString(runtimeContext)}`);
|
|
287
307
|
}
|
|
288
308
|
};
|
|
289
309
|
var Agent = class extends BaseResource {
|
|
@@ -295,14 +315,15 @@ var Agent = class extends BaseResource {
|
|
|
295
315
|
voice;
|
|
296
316
|
/**
|
|
297
317
|
* Retrieves details about the agent
|
|
318
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
298
319
|
* @returns Promise containing agent details including model and instructions
|
|
299
320
|
*/
|
|
300
|
-
details() {
|
|
301
|
-
return this.request(`/api/agents/${this.agentId}`);
|
|
321
|
+
details(runtimeContext) {
|
|
322
|
+
return this.request(`/api/agents/${this.agentId}${runtimeContextQueryString(runtimeContext)}`);
|
|
302
323
|
}
|
|
303
324
|
async generate(params) {
|
|
304
325
|
console.warn(
|
|
305
|
-
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September
|
|
326
|
+
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September 30th, 2025. Please use generateLegacy if you don't want to upgrade just yet."
|
|
306
327
|
);
|
|
307
328
|
return this.generateLegacy(params);
|
|
308
329
|
}
|
|
@@ -337,7 +358,9 @@ var Agent = class extends BaseResource {
|
|
|
337
358
|
resourceId,
|
|
338
359
|
threadId,
|
|
339
360
|
runtimeContext,
|
|
340
|
-
tracingContext: { currentSpan: void 0 }
|
|
361
|
+
tracingContext: { currentSpan: void 0 },
|
|
362
|
+
suspend: async () => {
|
|
363
|
+
}
|
|
341
364
|
},
|
|
342
365
|
{
|
|
343
366
|
messages: response.messages,
|
|
@@ -371,7 +394,16 @@ var Agent = class extends BaseResource {
|
|
|
371
394
|
}
|
|
372
395
|
return response;
|
|
373
396
|
}
|
|
374
|
-
async generateVNext(
|
|
397
|
+
async generateVNext(messagesOrParams, options) {
|
|
398
|
+
let params;
|
|
399
|
+
if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
|
|
400
|
+
params = messagesOrParams;
|
|
401
|
+
} else {
|
|
402
|
+
params = {
|
|
403
|
+
messages: messagesOrParams,
|
|
404
|
+
...options
|
|
405
|
+
};
|
|
406
|
+
}
|
|
375
407
|
const processedParams = {
|
|
376
408
|
...params,
|
|
377
409
|
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
@@ -672,7 +704,7 @@ var Agent = class extends BaseResource {
|
|
|
672
704
|
*/
|
|
673
705
|
async stream(params) {
|
|
674
706
|
console.warn(
|
|
675
|
-
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September
|
|
707
|
+
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September 30th, 2025. Please use streamLegacy if you don't want to upgrade just yet."
|
|
676
708
|
);
|
|
677
709
|
return this.streamLegacy(params);
|
|
678
710
|
}
|
|
@@ -1021,7 +1053,9 @@ var Agent = class extends BaseResource {
|
|
|
1021
1053
|
threadId: processedParams.threadId,
|
|
1022
1054
|
runtimeContext: processedParams.runtimeContext,
|
|
1023
1055
|
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1024
|
-
tracingContext: { currentSpan: void 0 }
|
|
1056
|
+
tracingContext: { currentSpan: void 0 },
|
|
1057
|
+
suspend: async () => {
|
|
1058
|
+
}
|
|
1025
1059
|
},
|
|
1026
1060
|
{
|
|
1027
1061
|
messages: response.messages,
|
|
@@ -1100,7 +1134,16 @@ var Agent = class extends BaseResource {
|
|
|
1100
1134
|
};
|
|
1101
1135
|
return streamResponse;
|
|
1102
1136
|
}
|
|
1103
|
-
async streamVNext(
|
|
1137
|
+
async streamVNext(messagesOrParams, options) {
|
|
1138
|
+
let params;
|
|
1139
|
+
if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
|
|
1140
|
+
params = messagesOrParams;
|
|
1141
|
+
} else {
|
|
1142
|
+
params = {
|
|
1143
|
+
messages: messagesOrParams,
|
|
1144
|
+
...options
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1104
1147
|
const processedParams = {
|
|
1105
1148
|
...params,
|
|
1106
1149
|
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
@@ -1176,7 +1219,9 @@ var Agent = class extends BaseResource {
|
|
|
1176
1219
|
threadId: processedParams.threadId,
|
|
1177
1220
|
runtimeContext: processedParams.runtimeContext,
|
|
1178
1221
|
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1179
|
-
tracingContext: { currentSpan: void 0 }
|
|
1222
|
+
tracingContext: { currentSpan: void 0 },
|
|
1223
|
+
suspend: async () => {
|
|
1224
|
+
}
|
|
1180
1225
|
},
|
|
1181
1226
|
{
|
|
1182
1227
|
messages: response.messages,
|
|
@@ -1245,10 +1290,11 @@ var Agent = class extends BaseResource {
|
|
|
1245
1290
|
/**
|
|
1246
1291
|
* Gets details about a specific tool available to the agent
|
|
1247
1292
|
* @param toolId - ID of the tool to retrieve
|
|
1293
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1248
1294
|
* @returns Promise containing tool details
|
|
1249
1295
|
*/
|
|
1250
|
-
getTool(toolId) {
|
|
1251
|
-
return this.request(`/api/agents/${this.agentId}/tools/${toolId}`);
|
|
1296
|
+
getTool(toolId, runtimeContext) {
|
|
1297
|
+
return this.request(`/api/agents/${this.agentId}/tools/${toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1252
1298
|
}
|
|
1253
1299
|
/**
|
|
1254
1300
|
* Executes a tool for the agent
|
|
@@ -1259,7 +1305,7 @@ var Agent = class extends BaseResource {
|
|
|
1259
1305
|
executeTool(toolId, params) {
|
|
1260
1306
|
const body = {
|
|
1261
1307
|
data: params.data,
|
|
1262
|
-
runtimeContext:
|
|
1308
|
+
runtimeContext: parseClientRuntimeContext(params.runtimeContext)
|
|
1263
1309
|
};
|
|
1264
1310
|
return this.request(`/api/agents/${this.agentId}/tools/${toolId}/execute`, {
|
|
1265
1311
|
method: "POST",
|
|
@@ -1268,17 +1314,19 @@ var Agent = class extends BaseResource {
|
|
|
1268
1314
|
}
|
|
1269
1315
|
/**
|
|
1270
1316
|
* Retrieves evaluation results for the agent
|
|
1317
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1271
1318
|
* @returns Promise containing agent evaluations
|
|
1272
1319
|
*/
|
|
1273
|
-
evals() {
|
|
1274
|
-
return this.request(`/api/agents/${this.agentId}/evals/ci`);
|
|
1320
|
+
evals(runtimeContext) {
|
|
1321
|
+
return this.request(`/api/agents/${this.agentId}/evals/ci${runtimeContextQueryString(runtimeContext)}`);
|
|
1275
1322
|
}
|
|
1276
1323
|
/**
|
|
1277
1324
|
* Retrieves live evaluation results for the agent
|
|
1325
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1278
1326
|
* @returns Promise containing live agent evaluations
|
|
1279
1327
|
*/
|
|
1280
|
-
liveEvals() {
|
|
1281
|
-
return this.request(`/api/agents/${this.agentId}/evals/live`);
|
|
1328
|
+
liveEvals(runtimeContext) {
|
|
1329
|
+
return this.request(`/api/agents/${this.agentId}/evals/live${runtimeContextQueryString(runtimeContext)}`);
|
|
1282
1330
|
}
|
|
1283
1331
|
/**
|
|
1284
1332
|
* Updates the model for the agent
|
|
@@ -1291,61 +1339,27 @@ var Agent = class extends BaseResource {
|
|
|
1291
1339
|
body: params
|
|
1292
1340
|
});
|
|
1293
1341
|
}
|
|
1294
|
-
};
|
|
1295
|
-
var Network = class extends BaseResource {
|
|
1296
|
-
constructor(options, networkId) {
|
|
1297
|
-
super(options);
|
|
1298
|
-
this.networkId = networkId;
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* Retrieves details about the network
|
|
1302
|
-
* @returns Promise containing network details
|
|
1303
|
-
*/
|
|
1304
|
-
details() {
|
|
1305
|
-
return this.request(`/api/networks/${this.networkId}`);
|
|
1306
|
-
}
|
|
1307
1342
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
* @param params -
|
|
1310
|
-
* @returns Promise containing the
|
|
1343
|
+
* Updates the model for the agent in the model list
|
|
1344
|
+
* @param params - Parameters for updating the model
|
|
1345
|
+
* @returns Promise containing the updated model
|
|
1311
1346
|
*/
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
...params,
|
|
1315
|
-
output: zodToJsonSchema(params.output),
|
|
1316
|
-
experimental_output: zodToJsonSchema(params.experimental_output)
|
|
1317
|
-
};
|
|
1318
|
-
return this.request(`/api/networks/${this.networkId}/generate`, {
|
|
1347
|
+
updateModelInModelList({ modelConfigId, ...params }) {
|
|
1348
|
+
return this.request(`/api/agents/${this.agentId}/models/${modelConfigId}`, {
|
|
1319
1349
|
method: "POST",
|
|
1320
|
-
body:
|
|
1350
|
+
body: params
|
|
1321
1351
|
});
|
|
1322
1352
|
}
|
|
1323
1353
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* @param params -
|
|
1326
|
-
* @returns Promise containing the
|
|
1354
|
+
* Reorders the models for the agent
|
|
1355
|
+
* @param params - Parameters for reordering the model list
|
|
1356
|
+
* @returns Promise containing the updated model list
|
|
1327
1357
|
*/
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
...params,
|
|
1331
|
-
output: zodToJsonSchema(params.output),
|
|
1332
|
-
experimental_output: zodToJsonSchema(params.experimental_output)
|
|
1333
|
-
};
|
|
1334
|
-
const response = await this.request(`/api/networks/${this.networkId}/stream`, {
|
|
1358
|
+
reorderModelList(params) {
|
|
1359
|
+
return this.request(`/api/agents/${this.agentId}/models/reorder`, {
|
|
1335
1360
|
method: "POST",
|
|
1336
|
-
body:
|
|
1337
|
-
stream: true
|
|
1361
|
+
body: params
|
|
1338
1362
|
});
|
|
1339
|
-
if (!response.body) {
|
|
1340
|
-
throw new Error("No response body");
|
|
1341
|
-
}
|
|
1342
|
-
response.processDataStream = async (options = {}) => {
|
|
1343
|
-
await processDataStream({
|
|
1344
|
-
stream: response.body,
|
|
1345
|
-
...options
|
|
1346
|
-
});
|
|
1347
|
-
};
|
|
1348
|
-
return response;
|
|
1349
1363
|
}
|
|
1350
1364
|
};
|
|
1351
1365
|
|
|
@@ -1436,10 +1450,13 @@ var Vector = class extends BaseResource {
|
|
|
1436
1450
|
/**
|
|
1437
1451
|
* Retrieves details about a specific vector index
|
|
1438
1452
|
* @param indexName - Name of the index to get details for
|
|
1453
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1439
1454
|
* @returns Promise containing vector index details
|
|
1440
1455
|
*/
|
|
1441
|
-
details(indexName) {
|
|
1442
|
-
return this.request(
|
|
1456
|
+
details(indexName, runtimeContext) {
|
|
1457
|
+
return this.request(
|
|
1458
|
+
`/api/vector/${this.vectorName}/indexes/${indexName}${runtimeContextQueryString(runtimeContext)}`
|
|
1459
|
+
);
|
|
1443
1460
|
}
|
|
1444
1461
|
/**
|
|
1445
1462
|
* Deletes a vector index
|
|
@@ -1453,10 +1470,11 @@ var Vector = class extends BaseResource {
|
|
|
1453
1470
|
}
|
|
1454
1471
|
/**
|
|
1455
1472
|
* Retrieves a list of all available indexes
|
|
1473
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1456
1474
|
* @returns Promise containing array of index names
|
|
1457
1475
|
*/
|
|
1458
|
-
getIndexes() {
|
|
1459
|
-
return this.request(`/api/vector/${this.vectorName}/indexes`);
|
|
1476
|
+
getIndexes(runtimeContext) {
|
|
1477
|
+
return this.request(`/api/vector/${this.vectorName}/indexes${runtimeContextQueryString(runtimeContext)}`);
|
|
1460
1478
|
}
|
|
1461
1479
|
/**
|
|
1462
1480
|
* Creates a new vector index
|
|
@@ -1502,17 +1520,20 @@ var LegacyWorkflow = class extends BaseResource {
|
|
|
1502
1520
|
}
|
|
1503
1521
|
/**
|
|
1504
1522
|
* Retrieves details about the legacy workflow
|
|
1523
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1505
1524
|
* @returns Promise containing legacy workflow details including steps and graphs
|
|
1506
1525
|
*/
|
|
1507
|
-
details() {
|
|
1508
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}`);
|
|
1526
|
+
details(runtimeContext) {
|
|
1527
|
+
return this.request(`/api/workflows/legacy/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1509
1528
|
}
|
|
1510
1529
|
/**
|
|
1511
1530
|
* Retrieves all runs for a legacy workflow
|
|
1512
1531
|
* @param params - Parameters for filtering runs
|
|
1532
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1513
1533
|
* @returns Promise containing legacy workflow runs array
|
|
1514
1534
|
*/
|
|
1515
|
-
runs(params) {
|
|
1535
|
+
runs(params, runtimeContext) {
|
|
1536
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1516
1537
|
const searchParams = new URLSearchParams();
|
|
1517
1538
|
if (params?.fromDate) {
|
|
1518
1539
|
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
@@ -1529,6 +1550,9 @@ var LegacyWorkflow = class extends BaseResource {
|
|
|
1529
1550
|
if (params?.resourceId) {
|
|
1530
1551
|
searchParams.set("resourceId", params.resourceId);
|
|
1531
1552
|
}
|
|
1553
|
+
if (runtimeContextParam) {
|
|
1554
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1555
|
+
}
|
|
1532
1556
|
if (searchParams.size) {
|
|
1533
1557
|
return this.request(`/api/workflows/legacy/${this.workflowId}/runs?${searchParams}`);
|
|
1534
1558
|
} else {
|
|
@@ -1682,10 +1706,11 @@ var Tool = class extends BaseResource {
|
|
|
1682
1706
|
}
|
|
1683
1707
|
/**
|
|
1684
1708
|
* Retrieves details about the tool
|
|
1709
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1685
1710
|
* @returns Promise containing tool details including description and schemas
|
|
1686
1711
|
*/
|
|
1687
|
-
details() {
|
|
1688
|
-
return this.request(`/api/tools/${this.toolId}`);
|
|
1712
|
+
details(runtimeContext) {
|
|
1713
|
+
return this.request(`/api/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1689
1714
|
}
|
|
1690
1715
|
/**
|
|
1691
1716
|
* Executes the tool with the provided parameters
|
|
@@ -1762,17 +1787,20 @@ var Workflow = class extends BaseResource {
|
|
|
1762
1787
|
}
|
|
1763
1788
|
/**
|
|
1764
1789
|
* Retrieves details about the workflow
|
|
1790
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1765
1791
|
* @returns Promise containing workflow details including steps and graphs
|
|
1766
1792
|
*/
|
|
1767
|
-
details() {
|
|
1768
|
-
return this.request(`/api/workflows/${this.workflowId}`);
|
|
1793
|
+
details(runtimeContext) {
|
|
1794
|
+
return this.request(`/api/workflows/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1769
1795
|
}
|
|
1770
1796
|
/**
|
|
1771
1797
|
* Retrieves all runs for a workflow
|
|
1772
1798
|
* @param params - Parameters for filtering runs
|
|
1799
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1773
1800
|
* @returns Promise containing workflow runs array
|
|
1774
1801
|
*/
|
|
1775
|
-
runs(params) {
|
|
1802
|
+
runs(params, runtimeContext) {
|
|
1803
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1776
1804
|
const searchParams = new URLSearchParams();
|
|
1777
1805
|
if (params?.fromDate) {
|
|
1778
1806
|
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
@@ -1789,6 +1817,9 @@ var Workflow = class extends BaseResource {
|
|
|
1789
1817
|
if (params?.resourceId) {
|
|
1790
1818
|
searchParams.set("resourceId", params.resourceId);
|
|
1791
1819
|
}
|
|
1820
|
+
if (runtimeContextParam) {
|
|
1821
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1822
|
+
}
|
|
1792
1823
|
if (searchParams.size) {
|
|
1793
1824
|
return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
|
|
1794
1825
|
} else {
|
|
@@ -1798,18 +1829,22 @@ var Workflow = class extends BaseResource {
|
|
|
1798
1829
|
/**
|
|
1799
1830
|
* Retrieves a specific workflow run by its ID
|
|
1800
1831
|
* @param runId - The ID of the workflow run to retrieve
|
|
1832
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1801
1833
|
* @returns Promise containing the workflow run details
|
|
1802
1834
|
*/
|
|
1803
|
-
runById(runId) {
|
|
1804
|
-
return this.request(`/api/workflows/${this.workflowId}/runs/${runId}`);
|
|
1835
|
+
runById(runId, runtimeContext) {
|
|
1836
|
+
return this.request(`/api/workflows/${this.workflowId}/runs/${runId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1805
1837
|
}
|
|
1806
1838
|
/**
|
|
1807
1839
|
* Retrieves the execution result for a specific workflow run by its ID
|
|
1808
1840
|
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
1841
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1809
1842
|
* @returns Promise containing the workflow run execution result
|
|
1810
1843
|
*/
|
|
1811
|
-
runExecutionResult(runId) {
|
|
1812
|
-
return this.request(
|
|
1844
|
+
runExecutionResult(runId, runtimeContext) {
|
|
1845
|
+
return this.request(
|
|
1846
|
+
`/api/workflows/${this.workflowId}/runs/${runId}/execution-result${runtimeContextQueryString(runtimeContext)}`
|
|
1847
|
+
);
|
|
1813
1848
|
}
|
|
1814
1849
|
/**
|
|
1815
1850
|
* Cancels a specific workflow run by its ID
|
|
@@ -1832,27 +1867,61 @@ var Workflow = class extends BaseResource {
|
|
|
1832
1867
|
body: { event: params.event, data: params.data }
|
|
1833
1868
|
});
|
|
1834
1869
|
}
|
|
1870
|
+
/**
|
|
1871
|
+
* @deprecated Use createRunAsync() instead.
|
|
1872
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
1873
|
+
*/
|
|
1874
|
+
async createRun(_params) {
|
|
1875
|
+
throw new Error(
|
|
1876
|
+
"createRun() has been deprecated. Please use createRunAsync() instead.\n\nMigration guide:\n Before: const run = workflow.createRun();\n After: const run = await workflow.createRunAsync();\n\nNote: createRunAsync() is an async method, so make sure your calling function is async."
|
|
1877
|
+
);
|
|
1878
|
+
}
|
|
1835
1879
|
/**
|
|
1836
1880
|
* Creates a new workflow run
|
|
1837
1881
|
* @param params - Optional object containing the optional runId
|
|
1838
|
-
* @returns Promise containing the runId of the created run
|
|
1882
|
+
* @returns Promise containing the runId of the created run with methods to control execution
|
|
1839
1883
|
*/
|
|
1840
|
-
|
|
1884
|
+
async createRunAsync(params) {
|
|
1841
1885
|
const searchParams = new URLSearchParams();
|
|
1842
1886
|
if (!!params?.runId) {
|
|
1843
1887
|
searchParams.set("runId", params.runId);
|
|
1844
1888
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1889
|
+
const res = await this.request(
|
|
1890
|
+
`/api/workflows/${this.workflowId}/create-run?${searchParams.toString()}`,
|
|
1891
|
+
{
|
|
1892
|
+
method: "POST"
|
|
1893
|
+
}
|
|
1894
|
+
);
|
|
1895
|
+
const runId = res.runId;
|
|
1896
|
+
return {
|
|
1897
|
+
runId,
|
|
1898
|
+
start: async (p) => {
|
|
1899
|
+
return this.start({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1900
|
+
},
|
|
1901
|
+
startAsync: async (p) => {
|
|
1902
|
+
return this.startAsync({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1903
|
+
},
|
|
1904
|
+
watch: async (onRecord) => {
|
|
1905
|
+
return this.watch({ runId }, onRecord);
|
|
1906
|
+
},
|
|
1907
|
+
stream: async (p) => {
|
|
1908
|
+
return this.stream({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1909
|
+
},
|
|
1910
|
+
resume: async (p) => {
|
|
1911
|
+
return this.resume({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
|
|
1912
|
+
},
|
|
1913
|
+
resumeAsync: async (p) => {
|
|
1914
|
+
return this.resumeAsync({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
|
|
1915
|
+
},
|
|
1916
|
+
resumeStreamVNext: async (p) => {
|
|
1917
|
+
return this.resumeStreamVNext({
|
|
1918
|
+
runId,
|
|
1919
|
+
step: p.step,
|
|
1920
|
+
resumeData: p.resumeData,
|
|
1921
|
+
runtimeContext: p.runtimeContext
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1856
1925
|
}
|
|
1857
1926
|
/**
|
|
1858
1927
|
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
@@ -1880,7 +1949,6 @@ var Workflow = class extends BaseResource {
|
|
|
1880
1949
|
const runtimeContext = parseClientRuntimeContext(rest.runtimeContext);
|
|
1881
1950
|
return this.request(`/api/workflows/${this.workflowId}/resume?runId=${runId}`, {
|
|
1882
1951
|
method: "POST",
|
|
1883
|
-
stream: true,
|
|
1884
1952
|
body: {
|
|
1885
1953
|
step,
|
|
1886
1954
|
resumeData,
|
|
@@ -1924,7 +1992,54 @@ var Workflow = class extends BaseResource {
|
|
|
1924
1992
|
}
|
|
1925
1993
|
);
|
|
1926
1994
|
if (!response.ok) {
|
|
1927
|
-
throw new Error(`Failed to stream
|
|
1995
|
+
throw new Error(`Failed to stream workflow: ${response.statusText}`);
|
|
1996
|
+
}
|
|
1997
|
+
if (!response.body) {
|
|
1998
|
+
throw new Error("Response body is null");
|
|
1999
|
+
}
|
|
2000
|
+
let failedChunk = void 0;
|
|
2001
|
+
const transformStream = new TransformStream({
|
|
2002
|
+
start() {
|
|
2003
|
+
},
|
|
2004
|
+
async transform(chunk, controller) {
|
|
2005
|
+
try {
|
|
2006
|
+
const decoded = new TextDecoder().decode(chunk);
|
|
2007
|
+
const chunks = decoded.split(RECORD_SEPARATOR2);
|
|
2008
|
+
for (const chunk2 of chunks) {
|
|
2009
|
+
if (chunk2) {
|
|
2010
|
+
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
2011
|
+
try {
|
|
2012
|
+
const parsedChunk = JSON.parse(newChunk);
|
|
2013
|
+
controller.enqueue(parsedChunk);
|
|
2014
|
+
failedChunk = void 0;
|
|
2015
|
+
} catch {
|
|
2016
|
+
failedChunk = newChunk;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
} catch {
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2024
|
+
return response.body.pipeThrough(transformStream);
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Observes workflow stream for a workflow run
|
|
2028
|
+
* @param params - Object containing the runId
|
|
2029
|
+
* @returns Promise containing the workflow execution results
|
|
2030
|
+
*/
|
|
2031
|
+
async observeStream(params) {
|
|
2032
|
+
const searchParams = new URLSearchParams();
|
|
2033
|
+
searchParams.set("runId", params.runId);
|
|
2034
|
+
const response = await this.request(
|
|
2035
|
+
`/api/workflows/${this.workflowId}/observe-stream?${searchParams.toString()}`,
|
|
2036
|
+
{
|
|
2037
|
+
method: "POST",
|
|
2038
|
+
stream: true
|
|
2039
|
+
}
|
|
2040
|
+
);
|
|
2041
|
+
if (!response.ok) {
|
|
2042
|
+
throw new Error(`Failed to observe workflow stream: ${response.statusText}`);
|
|
1928
2043
|
}
|
|
1929
2044
|
if (!response.body) {
|
|
1930
2045
|
throw new Error("Response body is null");
|
|
@@ -1970,7 +2085,7 @@ var Workflow = class extends BaseResource {
|
|
|
1970
2085
|
`/api/workflows/${this.workflowId}/streamVNext?${searchParams.toString()}`,
|
|
1971
2086
|
{
|
|
1972
2087
|
method: "POST",
|
|
1973
|
-
body: { inputData: params.inputData, runtimeContext },
|
|
2088
|
+
body: { inputData: params.inputData, runtimeContext, closeOnSuspend: params.closeOnSuspend },
|
|
1974
2089
|
stream: true
|
|
1975
2090
|
}
|
|
1976
2091
|
);
|
|
@@ -2022,6 +2137,22 @@ var Workflow = class extends BaseResource {
|
|
|
2022
2137
|
}
|
|
2023
2138
|
});
|
|
2024
2139
|
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Resumes a suspended workflow step that uses streamVNext asynchronously and returns a promise that resolves when the workflow is complete
|
|
2142
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
2143
|
+
* @returns Promise containing the workflow resume results
|
|
2144
|
+
*/
|
|
2145
|
+
resumeStreamVNext(params) {
|
|
2146
|
+
const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
|
|
2147
|
+
return this.request(`/api/workflows/${this.workflowId}/resume-stream?runId=${params.runId}`, {
|
|
2148
|
+
method: "POST",
|
|
2149
|
+
body: {
|
|
2150
|
+
step: params.step,
|
|
2151
|
+
resumeData: params.resumeData,
|
|
2152
|
+
runtimeContext
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2025
2156
|
/**
|
|
2026
2157
|
* Watches workflow transitions in real-time
|
|
2027
2158
|
* @param runId - Optional run ID to filter the watch stream
|
|
@@ -2156,10 +2287,11 @@ var MCPTool = class extends BaseResource {
|
|
|
2156
2287
|
}
|
|
2157
2288
|
/**
|
|
2158
2289
|
* Retrieves details about this specific tool from the MCP server.
|
|
2290
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2159
2291
|
* @returns Promise containing the tool's information (name, description, schema).
|
|
2160
2292
|
*/
|
|
2161
|
-
details() {
|
|
2162
|
-
return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}`);
|
|
2293
|
+
details(runtimeContext) {
|
|
2294
|
+
return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
2163
2295
|
}
|
|
2164
2296
|
/**
|
|
2165
2297
|
* Executes this specific tool on the MCP server.
|
|
@@ -2215,11 +2347,20 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2215
2347
|
};
|
|
2216
2348
|
}
|
|
2217
2349
|
}
|
|
2350
|
+
/**
|
|
2351
|
+
* @deprecated Use createRunAsync() instead.
|
|
2352
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
2353
|
+
*/
|
|
2354
|
+
async createRun(_params) {
|
|
2355
|
+
throw new Error(
|
|
2356
|
+
"createRun() has been deprecated. Please use createRunAsync() instead.\n\nMigration guide:\n Before: const run = agentBuilder.createRun();\n After: const run = await agentBuilder.createRunAsync();\n\nNote: createRunAsync() is an async method, so make sure your calling function is async."
|
|
2357
|
+
);
|
|
2358
|
+
}
|
|
2218
2359
|
/**
|
|
2219
2360
|
* Creates a new agent builder action run and returns the runId.
|
|
2220
2361
|
* This calls `/api/agent-builder/:actionId/create-run`.
|
|
2221
2362
|
*/
|
|
2222
|
-
async
|
|
2363
|
+
async createRunAsync(params) {
|
|
2223
2364
|
const searchParams = new URLSearchParams();
|
|
2224
2365
|
if (!!params?.runId) {
|
|
2225
2366
|
searchParams.set("runId", params.runId);
|
|
@@ -2229,14 +2370,6 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2229
2370
|
method: "POST"
|
|
2230
2371
|
});
|
|
2231
2372
|
}
|
|
2232
|
-
/**
|
|
2233
|
-
* Creates a new workflow run (alias for createRun)
|
|
2234
|
-
* @param params - Optional object containing the optional runId
|
|
2235
|
-
* @returns Promise containing the runId of the created run
|
|
2236
|
-
*/
|
|
2237
|
-
createRunAsync(params) {
|
|
2238
|
-
return this.createRun(params);
|
|
2239
|
-
}
|
|
2240
2373
|
/**
|
|
2241
2374
|
* Starts agent builder action asynchronously and waits for completion.
|
|
2242
2375
|
* This calls `/api/agent-builder/:actionId/start-async`.
|
|
@@ -2596,6 +2729,12 @@ var Observability = class extends BaseResource {
|
|
|
2596
2729
|
const queryString = searchParams.toString();
|
|
2597
2730
|
return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
|
|
2598
2731
|
}
|
|
2732
|
+
score(params) {
|
|
2733
|
+
return this.request(`/api/observability/traces/score`, {
|
|
2734
|
+
method: "POST",
|
|
2735
|
+
body: { ...params }
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2599
2738
|
};
|
|
2600
2739
|
|
|
2601
2740
|
// src/resources/network-memory-thread.ts
|
|
@@ -2670,10 +2809,11 @@ var VNextNetwork = class extends BaseResource {
|
|
|
2670
2809
|
}
|
|
2671
2810
|
/**
|
|
2672
2811
|
* Retrieves details about the network
|
|
2812
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2673
2813
|
* @returns Promise containing vNext network details
|
|
2674
2814
|
*/
|
|
2675
|
-
details() {
|
|
2676
|
-
return this.request(`/api/networks/v-next/${this.networkId}`);
|
|
2815
|
+
details(runtimeContext) {
|
|
2816
|
+
return this.request(`/api/networks/v-next/${this.networkId}${runtimeContextQueryString(runtimeContext)}`);
|
|
2677
2817
|
}
|
|
2678
2818
|
/**
|
|
2679
2819
|
* Generates a response from the v-next network
|
|
@@ -2808,10 +2948,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2808
2948
|
}
|
|
2809
2949
|
/**
|
|
2810
2950
|
* Retrieves all available agents
|
|
2951
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2811
2952
|
* @returns Promise containing map of agent IDs to agent details
|
|
2812
2953
|
*/
|
|
2813
|
-
getAgents() {
|
|
2814
|
-
|
|
2954
|
+
getAgents(runtimeContext) {
|
|
2955
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
2956
|
+
const searchParams = new URLSearchParams();
|
|
2957
|
+
if (runtimeContextParam) {
|
|
2958
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
2959
|
+
}
|
|
2960
|
+
const queryString = searchParams.toString();
|
|
2961
|
+
return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
|
|
2815
2962
|
}
|
|
2816
2963
|
/**
|
|
2817
2964
|
* Gets an agent instance by ID
|
|
@@ -2829,6 +2976,14 @@ var MastraClient = class extends BaseResource {
|
|
|
2829
2976
|
getMemoryThreads(params) {
|
|
2830
2977
|
return this.request(`/api/memory/threads?resourceid=${params.resourceId}&agentId=${params.agentId}`);
|
|
2831
2978
|
}
|
|
2979
|
+
/**
|
|
2980
|
+
* Retrieves memory config for a resource
|
|
2981
|
+
* @param params - Parameters containing the resource ID
|
|
2982
|
+
* @returns Promise containing array of memory threads
|
|
2983
|
+
*/
|
|
2984
|
+
getMemoryConfig(params) {
|
|
2985
|
+
return this.request(`/api/memory/config?agentId=${params.agentId}`);
|
|
2986
|
+
}
|
|
2832
2987
|
/**
|
|
2833
2988
|
* Creates a new memory thread
|
|
2834
2989
|
* @param params - Parameters for creating the memory thread
|
|
@@ -2845,6 +3000,24 @@ var MastraClient = class extends BaseResource {
|
|
|
2845
3000
|
getMemoryThread(threadId, agentId) {
|
|
2846
3001
|
return new MemoryThread(this.options, threadId, agentId);
|
|
2847
3002
|
}
|
|
3003
|
+
getThreadMessages(threadId, opts = {}) {
|
|
3004
|
+
let url = "";
|
|
3005
|
+
if (opts.agentId) {
|
|
3006
|
+
url = `/api/memory/threads/${threadId}/messages?agentId=${opts.agentId}`;
|
|
3007
|
+
} else if (opts.networkId) {
|
|
3008
|
+
url = `/api/memory/network/threads/${threadId}/messages?networkId=${opts.networkId}`;
|
|
3009
|
+
}
|
|
3010
|
+
return this.request(url);
|
|
3011
|
+
}
|
|
3012
|
+
deleteThread(threadId, opts = {}) {
|
|
3013
|
+
let url = "";
|
|
3014
|
+
if (opts.agentId) {
|
|
3015
|
+
url = `/api/memory/threads/${threadId}?agentId=${opts.agentId}`;
|
|
3016
|
+
} else if (opts.networkId) {
|
|
3017
|
+
url = `/api/memory/network/threads/${threadId}?networkId=${opts.networkId}`;
|
|
3018
|
+
}
|
|
3019
|
+
return this.request(url, { method: "DELETE" });
|
|
3020
|
+
}
|
|
2848
3021
|
/**
|
|
2849
3022
|
* Saves messages to memory
|
|
2850
3023
|
* @param params - Parameters containing messages to save
|
|
@@ -2907,10 +3080,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2907
3080
|
}
|
|
2908
3081
|
/**
|
|
2909
3082
|
* Retrieves all available tools
|
|
3083
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2910
3084
|
* @returns Promise containing map of tool IDs to tool details
|
|
2911
3085
|
*/
|
|
2912
|
-
getTools() {
|
|
2913
|
-
|
|
3086
|
+
getTools(runtimeContext) {
|
|
3087
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
3088
|
+
const searchParams = new URLSearchParams();
|
|
3089
|
+
if (runtimeContextParam) {
|
|
3090
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
3091
|
+
}
|
|
3092
|
+
const queryString = searchParams.toString();
|
|
3093
|
+
return this.request(`/api/tools${queryString ? `?${queryString}` : ""}`);
|
|
2914
3094
|
}
|
|
2915
3095
|
/**
|
|
2916
3096
|
* Gets a tool instance by ID
|
|
@@ -2937,10 +3117,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2937
3117
|
}
|
|
2938
3118
|
/**
|
|
2939
3119
|
* Retrieves all available workflows
|
|
3120
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2940
3121
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
2941
3122
|
*/
|
|
2942
|
-
getWorkflows() {
|
|
2943
|
-
|
|
3123
|
+
getWorkflows(runtimeContext) {
|
|
3124
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
3125
|
+
const searchParams = new URLSearchParams();
|
|
3126
|
+
if (runtimeContextParam) {
|
|
3127
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
3128
|
+
}
|
|
3129
|
+
const queryString = searchParams.toString();
|
|
3130
|
+
return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
|
|
2944
3131
|
}
|
|
2945
3132
|
/**
|
|
2946
3133
|
* Gets a workflow instance by ID
|
|
@@ -3108,13 +3295,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3108
3295
|
return this.request(`/api/telemetry`);
|
|
3109
3296
|
}
|
|
3110
3297
|
}
|
|
3111
|
-
/**
|
|
3112
|
-
* Retrieves all available networks
|
|
3113
|
-
* @returns Promise containing map of network IDs to network details
|
|
3114
|
-
*/
|
|
3115
|
-
getNetworks() {
|
|
3116
|
-
return this.request("/api/networks");
|
|
3117
|
-
}
|
|
3118
3298
|
/**
|
|
3119
3299
|
* Retrieves all available vNext networks
|
|
3120
3300
|
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
@@ -3122,14 +3302,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3122
3302
|
getVNextNetworks() {
|
|
3123
3303
|
return this.request("/api/networks/v-next");
|
|
3124
3304
|
}
|
|
3125
|
-
/**
|
|
3126
|
-
* Gets a network instance by ID
|
|
3127
|
-
* @param networkId - ID of the network to retrieve
|
|
3128
|
-
* @returns Network instance
|
|
3129
|
-
*/
|
|
3130
|
-
getNetwork(networkId) {
|
|
3131
|
-
return new Network(this.options, networkId);
|
|
3132
|
-
}
|
|
3133
3305
|
/**
|
|
3134
3306
|
* Gets a vNext network instance by ID
|
|
3135
3307
|
* @param networkId - ID of the vNext network to retrieve
|
|
@@ -3320,8 +3492,30 @@ var MastraClient = class extends BaseResource {
|
|
|
3320
3492
|
getAITraces(params) {
|
|
3321
3493
|
return this.observability.getTraces(params);
|
|
3322
3494
|
}
|
|
3495
|
+
score(params) {
|
|
3496
|
+
return this.observability.score(params);
|
|
3497
|
+
}
|
|
3323
3498
|
};
|
|
3324
3499
|
|
|
3325
|
-
|
|
3500
|
+
// src/tools.ts
|
|
3501
|
+
var ClientTool = class {
|
|
3502
|
+
id;
|
|
3503
|
+
description;
|
|
3504
|
+
inputSchema;
|
|
3505
|
+
outputSchema;
|
|
3506
|
+
execute;
|
|
3507
|
+
constructor(opts) {
|
|
3508
|
+
this.id = opts.id;
|
|
3509
|
+
this.description = opts.description;
|
|
3510
|
+
this.inputSchema = opts.inputSchema;
|
|
3511
|
+
this.outputSchema = opts.outputSchema;
|
|
3512
|
+
this.execute = opts.execute;
|
|
3513
|
+
}
|
|
3514
|
+
};
|
|
3515
|
+
function createTool(opts) {
|
|
3516
|
+
return new ClientTool(opts);
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
export { ClientTool, MastraClient, createTool };
|
|
3326
3520
|
//# sourceMappingURL=index.js.map
|
|
3327
3521
|
//# sourceMappingURL=index.js.map
|