@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.cjs
CHANGED
|
@@ -21,6 +21,20 @@ 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
|
+
}
|
|
30
|
+
function runtimeContextQueryString(runtimeContext) {
|
|
31
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
32
|
+
if (!runtimeContextParam) return "";
|
|
33
|
+
const searchParams = new URLSearchParams();
|
|
34
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
35
|
+
const queryString = searchParams.toString();
|
|
36
|
+
return queryString ? `?${queryString}` : "";
|
|
37
|
+
}
|
|
24
38
|
function isZodType(value) {
|
|
25
39
|
return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
|
|
26
40
|
}
|
|
@@ -83,7 +97,7 @@ async function sharedProcessMastraStream({
|
|
|
83
97
|
if (line.startsWith("data: ")) {
|
|
84
98
|
const data = line.slice(6);
|
|
85
99
|
if (data === "[DONE]") {
|
|
86
|
-
console.
|
|
100
|
+
console.info("\u{1F3C1} Stream finished");
|
|
87
101
|
return;
|
|
88
102
|
}
|
|
89
103
|
try {
|
|
@@ -205,7 +219,9 @@ async function executeToolCallAndRespond({
|
|
|
205
219
|
resourceId,
|
|
206
220
|
threadId,
|
|
207
221
|
runtimeContext,
|
|
208
|
-
tracingContext: { currentSpan: void 0 }
|
|
222
|
+
tracingContext: { currentSpan: void 0 },
|
|
223
|
+
suspend: async () => {
|
|
224
|
+
}
|
|
209
225
|
},
|
|
210
226
|
{
|
|
211
227
|
messages: response.messages,
|
|
@@ -279,17 +295,21 @@ var AgentVoice = class extends BaseResource {
|
|
|
279
295
|
}
|
|
280
296
|
/**
|
|
281
297
|
* Get available speakers for the agent's voice provider
|
|
298
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
299
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
282
300
|
* @returns Promise containing list of available speakers
|
|
283
301
|
*/
|
|
284
|
-
getSpeakers() {
|
|
285
|
-
return this.request(`/api/agents/${this.agentId}/voice/speakers`);
|
|
302
|
+
getSpeakers(runtimeContext) {
|
|
303
|
+
return this.request(`/api/agents/${this.agentId}/voice/speakers${runtimeContextQueryString(runtimeContext)}`);
|
|
286
304
|
}
|
|
287
305
|
/**
|
|
288
306
|
* Get the listener configuration for the agent's voice provider
|
|
307
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
308
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
289
309
|
* @returns Promise containing a check if the agent has listening capabilities
|
|
290
310
|
*/
|
|
291
|
-
getListener() {
|
|
292
|
-
return this.request(`/api/agents/${this.agentId}/voice/listener`);
|
|
311
|
+
getListener(runtimeContext) {
|
|
312
|
+
return this.request(`/api/agents/${this.agentId}/voice/listener${runtimeContextQueryString(runtimeContext)}`);
|
|
293
313
|
}
|
|
294
314
|
};
|
|
295
315
|
var Agent = class extends BaseResource {
|
|
@@ -301,14 +321,15 @@ var Agent = class extends BaseResource {
|
|
|
301
321
|
voice;
|
|
302
322
|
/**
|
|
303
323
|
* Retrieves details about the agent
|
|
324
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
304
325
|
* @returns Promise containing agent details including model and instructions
|
|
305
326
|
*/
|
|
306
|
-
details() {
|
|
307
|
-
return this.request(`/api/agents/${this.agentId}`);
|
|
327
|
+
details(runtimeContext) {
|
|
328
|
+
return this.request(`/api/agents/${this.agentId}${runtimeContextQueryString(runtimeContext)}`);
|
|
308
329
|
}
|
|
309
330
|
async generate(params) {
|
|
310
331
|
console.warn(
|
|
311
|
-
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September
|
|
332
|
+
"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."
|
|
312
333
|
);
|
|
313
334
|
return this.generateLegacy(params);
|
|
314
335
|
}
|
|
@@ -343,7 +364,9 @@ var Agent = class extends BaseResource {
|
|
|
343
364
|
resourceId,
|
|
344
365
|
threadId,
|
|
345
366
|
runtimeContext,
|
|
346
|
-
tracingContext: { currentSpan: void 0 }
|
|
367
|
+
tracingContext: { currentSpan: void 0 },
|
|
368
|
+
suspend: async () => {
|
|
369
|
+
}
|
|
347
370
|
},
|
|
348
371
|
{
|
|
349
372
|
messages: response.messages,
|
|
@@ -377,7 +400,16 @@ var Agent = class extends BaseResource {
|
|
|
377
400
|
}
|
|
378
401
|
return response;
|
|
379
402
|
}
|
|
380
|
-
async generateVNext(
|
|
403
|
+
async generateVNext(messagesOrParams, options) {
|
|
404
|
+
let params;
|
|
405
|
+
if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
|
|
406
|
+
params = messagesOrParams;
|
|
407
|
+
} else {
|
|
408
|
+
params = {
|
|
409
|
+
messages: messagesOrParams,
|
|
410
|
+
...options
|
|
411
|
+
};
|
|
412
|
+
}
|
|
381
413
|
const processedParams = {
|
|
382
414
|
...params,
|
|
383
415
|
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
@@ -678,7 +710,7 @@ var Agent = class extends BaseResource {
|
|
|
678
710
|
*/
|
|
679
711
|
async stream(params) {
|
|
680
712
|
console.warn(
|
|
681
|
-
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September
|
|
713
|
+
"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."
|
|
682
714
|
);
|
|
683
715
|
return this.streamLegacy(params);
|
|
684
716
|
}
|
|
@@ -1027,7 +1059,9 @@ var Agent = class extends BaseResource {
|
|
|
1027
1059
|
threadId: processedParams.threadId,
|
|
1028
1060
|
runtimeContext: processedParams.runtimeContext,
|
|
1029
1061
|
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1030
|
-
tracingContext: { currentSpan: void 0 }
|
|
1062
|
+
tracingContext: { currentSpan: void 0 },
|
|
1063
|
+
suspend: async () => {
|
|
1064
|
+
}
|
|
1031
1065
|
},
|
|
1032
1066
|
{
|
|
1033
1067
|
messages: response.messages,
|
|
@@ -1106,7 +1140,16 @@ var Agent = class extends BaseResource {
|
|
|
1106
1140
|
};
|
|
1107
1141
|
return streamResponse;
|
|
1108
1142
|
}
|
|
1109
|
-
async streamVNext(
|
|
1143
|
+
async streamVNext(messagesOrParams, options) {
|
|
1144
|
+
let params;
|
|
1145
|
+
if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
|
|
1146
|
+
params = messagesOrParams;
|
|
1147
|
+
} else {
|
|
1148
|
+
params = {
|
|
1149
|
+
messages: messagesOrParams,
|
|
1150
|
+
...options
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1110
1153
|
const processedParams = {
|
|
1111
1154
|
...params,
|
|
1112
1155
|
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
@@ -1182,7 +1225,9 @@ var Agent = class extends BaseResource {
|
|
|
1182
1225
|
threadId: processedParams.threadId,
|
|
1183
1226
|
runtimeContext: processedParams.runtimeContext,
|
|
1184
1227
|
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1185
|
-
tracingContext: { currentSpan: void 0 }
|
|
1228
|
+
tracingContext: { currentSpan: void 0 },
|
|
1229
|
+
suspend: async () => {
|
|
1230
|
+
}
|
|
1186
1231
|
},
|
|
1187
1232
|
{
|
|
1188
1233
|
messages: response.messages,
|
|
@@ -1251,10 +1296,11 @@ var Agent = class extends BaseResource {
|
|
|
1251
1296
|
/**
|
|
1252
1297
|
* Gets details about a specific tool available to the agent
|
|
1253
1298
|
* @param toolId - ID of the tool to retrieve
|
|
1299
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1254
1300
|
* @returns Promise containing tool details
|
|
1255
1301
|
*/
|
|
1256
|
-
getTool(toolId) {
|
|
1257
|
-
return this.request(`/api/agents/${this.agentId}/tools/${toolId}`);
|
|
1302
|
+
getTool(toolId, runtimeContext) {
|
|
1303
|
+
return this.request(`/api/agents/${this.agentId}/tools/${toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1258
1304
|
}
|
|
1259
1305
|
/**
|
|
1260
1306
|
* Executes a tool for the agent
|
|
@@ -1265,7 +1311,7 @@ var Agent = class extends BaseResource {
|
|
|
1265
1311
|
executeTool(toolId, params) {
|
|
1266
1312
|
const body = {
|
|
1267
1313
|
data: params.data,
|
|
1268
|
-
runtimeContext:
|
|
1314
|
+
runtimeContext: parseClientRuntimeContext(params.runtimeContext)
|
|
1269
1315
|
};
|
|
1270
1316
|
return this.request(`/api/agents/${this.agentId}/tools/${toolId}/execute`, {
|
|
1271
1317
|
method: "POST",
|
|
@@ -1274,17 +1320,19 @@ var Agent = class extends BaseResource {
|
|
|
1274
1320
|
}
|
|
1275
1321
|
/**
|
|
1276
1322
|
* Retrieves evaluation results for the agent
|
|
1323
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1277
1324
|
* @returns Promise containing agent evaluations
|
|
1278
1325
|
*/
|
|
1279
|
-
evals() {
|
|
1280
|
-
return this.request(`/api/agents/${this.agentId}/evals/ci`);
|
|
1326
|
+
evals(runtimeContext) {
|
|
1327
|
+
return this.request(`/api/agents/${this.agentId}/evals/ci${runtimeContextQueryString(runtimeContext)}`);
|
|
1281
1328
|
}
|
|
1282
1329
|
/**
|
|
1283
1330
|
* Retrieves live evaluation results for the agent
|
|
1331
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1284
1332
|
* @returns Promise containing live agent evaluations
|
|
1285
1333
|
*/
|
|
1286
|
-
liveEvals() {
|
|
1287
|
-
return this.request(`/api/agents/${this.agentId}/evals/live`);
|
|
1334
|
+
liveEvals(runtimeContext) {
|
|
1335
|
+
return this.request(`/api/agents/${this.agentId}/evals/live${runtimeContextQueryString(runtimeContext)}`);
|
|
1288
1336
|
}
|
|
1289
1337
|
/**
|
|
1290
1338
|
* Updates the model for the agent
|
|
@@ -1297,61 +1345,27 @@ var Agent = class extends BaseResource {
|
|
|
1297
1345
|
body: params
|
|
1298
1346
|
});
|
|
1299
1347
|
}
|
|
1300
|
-
};
|
|
1301
|
-
var Network = class extends BaseResource {
|
|
1302
|
-
constructor(options, networkId) {
|
|
1303
|
-
super(options);
|
|
1304
|
-
this.networkId = networkId;
|
|
1305
|
-
}
|
|
1306
1348
|
/**
|
|
1307
|
-
*
|
|
1308
|
-
* @
|
|
1309
|
-
|
|
1310
|
-
details() {
|
|
1311
|
-
return this.request(`/api/networks/${this.networkId}`);
|
|
1312
|
-
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Generates a response from the agent
|
|
1315
|
-
* @param params - Generation parameters including prompt
|
|
1316
|
-
* @returns Promise containing the generated response
|
|
1349
|
+
* Updates the model for the agent in the model list
|
|
1350
|
+
* @param params - Parameters for updating the model
|
|
1351
|
+
* @returns Promise containing the updated model
|
|
1317
1352
|
*/
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
...params,
|
|
1321
|
-
output: zodToJsonSchema(params.output),
|
|
1322
|
-
experimental_output: zodToJsonSchema(params.experimental_output)
|
|
1323
|
-
};
|
|
1324
|
-
return this.request(`/api/networks/${this.networkId}/generate`, {
|
|
1353
|
+
updateModelInModelList({ modelConfigId, ...params }) {
|
|
1354
|
+
return this.request(`/api/agents/${this.agentId}/models/${modelConfigId}`, {
|
|
1325
1355
|
method: "POST",
|
|
1326
|
-
body:
|
|
1356
|
+
body: params
|
|
1327
1357
|
});
|
|
1328
1358
|
}
|
|
1329
1359
|
/**
|
|
1330
|
-
*
|
|
1331
|
-
* @param params -
|
|
1332
|
-
* @returns Promise containing the
|
|
1360
|
+
* Reorders the models for the agent
|
|
1361
|
+
* @param params - Parameters for reordering the model list
|
|
1362
|
+
* @returns Promise containing the updated model list
|
|
1333
1363
|
*/
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
...params,
|
|
1337
|
-
output: zodToJsonSchema(params.output),
|
|
1338
|
-
experimental_output: zodToJsonSchema(params.experimental_output)
|
|
1339
|
-
};
|
|
1340
|
-
const response = await this.request(`/api/networks/${this.networkId}/stream`, {
|
|
1364
|
+
reorderModelList(params) {
|
|
1365
|
+
return this.request(`/api/agents/${this.agentId}/models/reorder`, {
|
|
1341
1366
|
method: "POST",
|
|
1342
|
-
body:
|
|
1343
|
-
stream: true
|
|
1367
|
+
body: params
|
|
1344
1368
|
});
|
|
1345
|
-
if (!response.body) {
|
|
1346
|
-
throw new Error("No response body");
|
|
1347
|
-
}
|
|
1348
|
-
response.processDataStream = async (options = {}) => {
|
|
1349
|
-
await uiUtils.processDataStream({
|
|
1350
|
-
stream: response.body,
|
|
1351
|
-
...options
|
|
1352
|
-
});
|
|
1353
|
-
};
|
|
1354
|
-
return response;
|
|
1355
1369
|
}
|
|
1356
1370
|
};
|
|
1357
1371
|
|
|
@@ -1442,10 +1456,13 @@ var Vector = class extends BaseResource {
|
|
|
1442
1456
|
/**
|
|
1443
1457
|
* Retrieves details about a specific vector index
|
|
1444
1458
|
* @param indexName - Name of the index to get details for
|
|
1459
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1445
1460
|
* @returns Promise containing vector index details
|
|
1446
1461
|
*/
|
|
1447
|
-
details(indexName) {
|
|
1448
|
-
return this.request(
|
|
1462
|
+
details(indexName, runtimeContext) {
|
|
1463
|
+
return this.request(
|
|
1464
|
+
`/api/vector/${this.vectorName}/indexes/${indexName}${runtimeContextQueryString(runtimeContext)}`
|
|
1465
|
+
);
|
|
1449
1466
|
}
|
|
1450
1467
|
/**
|
|
1451
1468
|
* Deletes a vector index
|
|
@@ -1459,10 +1476,11 @@ var Vector = class extends BaseResource {
|
|
|
1459
1476
|
}
|
|
1460
1477
|
/**
|
|
1461
1478
|
* Retrieves a list of all available indexes
|
|
1479
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1462
1480
|
* @returns Promise containing array of index names
|
|
1463
1481
|
*/
|
|
1464
|
-
getIndexes() {
|
|
1465
|
-
return this.request(`/api/vector/${this.vectorName}/indexes`);
|
|
1482
|
+
getIndexes(runtimeContext) {
|
|
1483
|
+
return this.request(`/api/vector/${this.vectorName}/indexes${runtimeContextQueryString(runtimeContext)}`);
|
|
1466
1484
|
}
|
|
1467
1485
|
/**
|
|
1468
1486
|
* Creates a new vector index
|
|
@@ -1508,17 +1526,20 @@ var LegacyWorkflow = class extends BaseResource {
|
|
|
1508
1526
|
}
|
|
1509
1527
|
/**
|
|
1510
1528
|
* Retrieves details about the legacy workflow
|
|
1529
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1511
1530
|
* @returns Promise containing legacy workflow details including steps and graphs
|
|
1512
1531
|
*/
|
|
1513
|
-
details() {
|
|
1514
|
-
return this.request(`/api/workflows/legacy/${this.workflowId}`);
|
|
1532
|
+
details(runtimeContext) {
|
|
1533
|
+
return this.request(`/api/workflows/legacy/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1515
1534
|
}
|
|
1516
1535
|
/**
|
|
1517
1536
|
* Retrieves all runs for a legacy workflow
|
|
1518
1537
|
* @param params - Parameters for filtering runs
|
|
1538
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1519
1539
|
* @returns Promise containing legacy workflow runs array
|
|
1520
1540
|
*/
|
|
1521
|
-
runs(params) {
|
|
1541
|
+
runs(params, runtimeContext) {
|
|
1542
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1522
1543
|
const searchParams = new URLSearchParams();
|
|
1523
1544
|
if (params?.fromDate) {
|
|
1524
1545
|
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
@@ -1535,6 +1556,9 @@ var LegacyWorkflow = class extends BaseResource {
|
|
|
1535
1556
|
if (params?.resourceId) {
|
|
1536
1557
|
searchParams.set("resourceId", params.resourceId);
|
|
1537
1558
|
}
|
|
1559
|
+
if (runtimeContextParam) {
|
|
1560
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1561
|
+
}
|
|
1538
1562
|
if (searchParams.size) {
|
|
1539
1563
|
return this.request(`/api/workflows/legacy/${this.workflowId}/runs?${searchParams}`);
|
|
1540
1564
|
} else {
|
|
@@ -1688,10 +1712,11 @@ var Tool = class extends BaseResource {
|
|
|
1688
1712
|
}
|
|
1689
1713
|
/**
|
|
1690
1714
|
* Retrieves details about the tool
|
|
1715
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1691
1716
|
* @returns Promise containing tool details including description and schemas
|
|
1692
1717
|
*/
|
|
1693
|
-
details() {
|
|
1694
|
-
return this.request(`/api/tools/${this.toolId}`);
|
|
1718
|
+
details(runtimeContext) {
|
|
1719
|
+
return this.request(`/api/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1695
1720
|
}
|
|
1696
1721
|
/**
|
|
1697
1722
|
* Executes the tool with the provided parameters
|
|
@@ -1768,17 +1793,20 @@ var Workflow = class extends BaseResource {
|
|
|
1768
1793
|
}
|
|
1769
1794
|
/**
|
|
1770
1795
|
* Retrieves details about the workflow
|
|
1796
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1771
1797
|
* @returns Promise containing workflow details including steps and graphs
|
|
1772
1798
|
*/
|
|
1773
|
-
details() {
|
|
1774
|
-
return this.request(`/api/workflows/${this.workflowId}`);
|
|
1799
|
+
details(runtimeContext) {
|
|
1800
|
+
return this.request(`/api/workflows/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1775
1801
|
}
|
|
1776
1802
|
/**
|
|
1777
1803
|
* Retrieves all runs for a workflow
|
|
1778
1804
|
* @param params - Parameters for filtering runs
|
|
1805
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1779
1806
|
* @returns Promise containing workflow runs array
|
|
1780
1807
|
*/
|
|
1781
|
-
runs(params) {
|
|
1808
|
+
runs(params, runtimeContext) {
|
|
1809
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
1782
1810
|
const searchParams = new URLSearchParams();
|
|
1783
1811
|
if (params?.fromDate) {
|
|
1784
1812
|
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
@@ -1795,6 +1823,9 @@ var Workflow = class extends BaseResource {
|
|
|
1795
1823
|
if (params?.resourceId) {
|
|
1796
1824
|
searchParams.set("resourceId", params.resourceId);
|
|
1797
1825
|
}
|
|
1826
|
+
if (runtimeContextParam) {
|
|
1827
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
1828
|
+
}
|
|
1798
1829
|
if (searchParams.size) {
|
|
1799
1830
|
return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
|
|
1800
1831
|
} else {
|
|
@@ -1804,18 +1835,22 @@ var Workflow = class extends BaseResource {
|
|
|
1804
1835
|
/**
|
|
1805
1836
|
* Retrieves a specific workflow run by its ID
|
|
1806
1837
|
* @param runId - The ID of the workflow run to retrieve
|
|
1838
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1807
1839
|
* @returns Promise containing the workflow run details
|
|
1808
1840
|
*/
|
|
1809
|
-
runById(runId) {
|
|
1810
|
-
return this.request(`/api/workflows/${this.workflowId}/runs/${runId}`);
|
|
1841
|
+
runById(runId, runtimeContext) {
|
|
1842
|
+
return this.request(`/api/workflows/${this.workflowId}/runs/${runId}${runtimeContextQueryString(runtimeContext)}`);
|
|
1811
1843
|
}
|
|
1812
1844
|
/**
|
|
1813
1845
|
* Retrieves the execution result for a specific workflow run by its ID
|
|
1814
1846
|
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
1847
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
1815
1848
|
* @returns Promise containing the workflow run execution result
|
|
1816
1849
|
*/
|
|
1817
|
-
runExecutionResult(runId) {
|
|
1818
|
-
return this.request(
|
|
1850
|
+
runExecutionResult(runId, runtimeContext) {
|
|
1851
|
+
return this.request(
|
|
1852
|
+
`/api/workflows/${this.workflowId}/runs/${runId}/execution-result${runtimeContextQueryString(runtimeContext)}`
|
|
1853
|
+
);
|
|
1819
1854
|
}
|
|
1820
1855
|
/**
|
|
1821
1856
|
* Cancels a specific workflow run by its ID
|
|
@@ -1838,27 +1873,61 @@ var Workflow = class extends BaseResource {
|
|
|
1838
1873
|
body: { event: params.event, data: params.data }
|
|
1839
1874
|
});
|
|
1840
1875
|
}
|
|
1876
|
+
/**
|
|
1877
|
+
* @deprecated Use createRunAsync() instead.
|
|
1878
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
1879
|
+
*/
|
|
1880
|
+
async createRun(_params) {
|
|
1881
|
+
throw new Error(
|
|
1882
|
+
"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."
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1841
1885
|
/**
|
|
1842
1886
|
* Creates a new workflow run
|
|
1843
1887
|
* @param params - Optional object containing the optional runId
|
|
1844
|
-
* @returns Promise containing the runId of the created run
|
|
1888
|
+
* @returns Promise containing the runId of the created run with methods to control execution
|
|
1845
1889
|
*/
|
|
1846
|
-
|
|
1890
|
+
async createRunAsync(params) {
|
|
1847
1891
|
const searchParams = new URLSearchParams();
|
|
1848
1892
|
if (!!params?.runId) {
|
|
1849
1893
|
searchParams.set("runId", params.runId);
|
|
1850
1894
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1895
|
+
const res = await this.request(
|
|
1896
|
+
`/api/workflows/${this.workflowId}/create-run?${searchParams.toString()}`,
|
|
1897
|
+
{
|
|
1898
|
+
method: "POST"
|
|
1899
|
+
}
|
|
1900
|
+
);
|
|
1901
|
+
const runId = res.runId;
|
|
1902
|
+
return {
|
|
1903
|
+
runId,
|
|
1904
|
+
start: async (p) => {
|
|
1905
|
+
return this.start({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1906
|
+
},
|
|
1907
|
+
startAsync: async (p) => {
|
|
1908
|
+
return this.startAsync({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1909
|
+
},
|
|
1910
|
+
watch: async (onRecord) => {
|
|
1911
|
+
return this.watch({ runId }, onRecord);
|
|
1912
|
+
},
|
|
1913
|
+
stream: async (p) => {
|
|
1914
|
+
return this.stream({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
|
|
1915
|
+
},
|
|
1916
|
+
resume: async (p) => {
|
|
1917
|
+
return this.resume({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
|
|
1918
|
+
},
|
|
1919
|
+
resumeAsync: async (p) => {
|
|
1920
|
+
return this.resumeAsync({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
|
|
1921
|
+
},
|
|
1922
|
+
resumeStreamVNext: async (p) => {
|
|
1923
|
+
return this.resumeStreamVNext({
|
|
1924
|
+
runId,
|
|
1925
|
+
step: p.step,
|
|
1926
|
+
resumeData: p.resumeData,
|
|
1927
|
+
runtimeContext: p.runtimeContext
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1862
1931
|
}
|
|
1863
1932
|
/**
|
|
1864
1933
|
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
@@ -1886,7 +1955,6 @@ var Workflow = class extends BaseResource {
|
|
|
1886
1955
|
const runtimeContext = parseClientRuntimeContext(rest.runtimeContext);
|
|
1887
1956
|
return this.request(`/api/workflows/${this.workflowId}/resume?runId=${runId}`, {
|
|
1888
1957
|
method: "POST",
|
|
1889
|
-
stream: true,
|
|
1890
1958
|
body: {
|
|
1891
1959
|
step,
|
|
1892
1960
|
resumeData,
|
|
@@ -1930,7 +1998,54 @@ var Workflow = class extends BaseResource {
|
|
|
1930
1998
|
}
|
|
1931
1999
|
);
|
|
1932
2000
|
if (!response.ok) {
|
|
1933
|
-
throw new Error(`Failed to stream
|
|
2001
|
+
throw new Error(`Failed to stream workflow: ${response.statusText}`);
|
|
2002
|
+
}
|
|
2003
|
+
if (!response.body) {
|
|
2004
|
+
throw new Error("Response body is null");
|
|
2005
|
+
}
|
|
2006
|
+
let failedChunk = void 0;
|
|
2007
|
+
const transformStream = new TransformStream({
|
|
2008
|
+
start() {
|
|
2009
|
+
},
|
|
2010
|
+
async transform(chunk, controller) {
|
|
2011
|
+
try {
|
|
2012
|
+
const decoded = new TextDecoder().decode(chunk);
|
|
2013
|
+
const chunks = decoded.split(RECORD_SEPARATOR2);
|
|
2014
|
+
for (const chunk2 of chunks) {
|
|
2015
|
+
if (chunk2) {
|
|
2016
|
+
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
2017
|
+
try {
|
|
2018
|
+
const parsedChunk = JSON.parse(newChunk);
|
|
2019
|
+
controller.enqueue(parsedChunk);
|
|
2020
|
+
failedChunk = void 0;
|
|
2021
|
+
} catch {
|
|
2022
|
+
failedChunk = newChunk;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
} catch {
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
2030
|
+
return response.body.pipeThrough(transformStream);
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Observes workflow stream for a workflow run
|
|
2034
|
+
* @param params - Object containing the runId
|
|
2035
|
+
* @returns Promise containing the workflow execution results
|
|
2036
|
+
*/
|
|
2037
|
+
async observeStream(params) {
|
|
2038
|
+
const searchParams = new URLSearchParams();
|
|
2039
|
+
searchParams.set("runId", params.runId);
|
|
2040
|
+
const response = await this.request(
|
|
2041
|
+
`/api/workflows/${this.workflowId}/observe-stream?${searchParams.toString()}`,
|
|
2042
|
+
{
|
|
2043
|
+
method: "POST",
|
|
2044
|
+
stream: true
|
|
2045
|
+
}
|
|
2046
|
+
);
|
|
2047
|
+
if (!response.ok) {
|
|
2048
|
+
throw new Error(`Failed to observe workflow stream: ${response.statusText}`);
|
|
1934
2049
|
}
|
|
1935
2050
|
if (!response.body) {
|
|
1936
2051
|
throw new Error("Response body is null");
|
|
@@ -1976,7 +2091,7 @@ var Workflow = class extends BaseResource {
|
|
|
1976
2091
|
`/api/workflows/${this.workflowId}/streamVNext?${searchParams.toString()}`,
|
|
1977
2092
|
{
|
|
1978
2093
|
method: "POST",
|
|
1979
|
-
body: { inputData: params.inputData, runtimeContext },
|
|
2094
|
+
body: { inputData: params.inputData, runtimeContext, closeOnSuspend: params.closeOnSuspend },
|
|
1980
2095
|
stream: true
|
|
1981
2096
|
}
|
|
1982
2097
|
);
|
|
@@ -2028,6 +2143,22 @@ var Workflow = class extends BaseResource {
|
|
|
2028
2143
|
}
|
|
2029
2144
|
});
|
|
2030
2145
|
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Resumes a suspended workflow step that uses streamVNext asynchronously and returns a promise that resolves when the workflow is complete
|
|
2148
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
2149
|
+
* @returns Promise containing the workflow resume results
|
|
2150
|
+
*/
|
|
2151
|
+
resumeStreamVNext(params) {
|
|
2152
|
+
const runtimeContext = parseClientRuntimeContext(params.runtimeContext);
|
|
2153
|
+
return this.request(`/api/workflows/${this.workflowId}/resume-stream?runId=${params.runId}`, {
|
|
2154
|
+
method: "POST",
|
|
2155
|
+
body: {
|
|
2156
|
+
step: params.step,
|
|
2157
|
+
resumeData: params.resumeData,
|
|
2158
|
+
runtimeContext
|
|
2159
|
+
}
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2031
2162
|
/**
|
|
2032
2163
|
* Watches workflow transitions in real-time
|
|
2033
2164
|
* @param runId - Optional run ID to filter the watch stream
|
|
@@ -2162,10 +2293,11 @@ var MCPTool = class extends BaseResource {
|
|
|
2162
2293
|
}
|
|
2163
2294
|
/**
|
|
2164
2295
|
* Retrieves details about this specific tool from the MCP server.
|
|
2296
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2165
2297
|
* @returns Promise containing the tool's information (name, description, schema).
|
|
2166
2298
|
*/
|
|
2167
|
-
details() {
|
|
2168
|
-
return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}`);
|
|
2299
|
+
details(runtimeContext) {
|
|
2300
|
+
return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
|
|
2169
2301
|
}
|
|
2170
2302
|
/**
|
|
2171
2303
|
* Executes this specific tool on the MCP server.
|
|
@@ -2221,11 +2353,20 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2221
2353
|
};
|
|
2222
2354
|
}
|
|
2223
2355
|
}
|
|
2356
|
+
/**
|
|
2357
|
+
* @deprecated Use createRunAsync() instead.
|
|
2358
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
2359
|
+
*/
|
|
2360
|
+
async createRun(_params) {
|
|
2361
|
+
throw new Error(
|
|
2362
|
+
"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."
|
|
2363
|
+
);
|
|
2364
|
+
}
|
|
2224
2365
|
/**
|
|
2225
2366
|
* Creates a new agent builder action run and returns the runId.
|
|
2226
2367
|
* This calls `/api/agent-builder/:actionId/create-run`.
|
|
2227
2368
|
*/
|
|
2228
|
-
async
|
|
2369
|
+
async createRunAsync(params) {
|
|
2229
2370
|
const searchParams = new URLSearchParams();
|
|
2230
2371
|
if (!!params?.runId) {
|
|
2231
2372
|
searchParams.set("runId", params.runId);
|
|
@@ -2235,14 +2376,6 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2235
2376
|
method: "POST"
|
|
2236
2377
|
});
|
|
2237
2378
|
}
|
|
2238
|
-
/**
|
|
2239
|
-
* Creates a new workflow run (alias for createRun)
|
|
2240
|
-
* @param params - Optional object containing the optional runId
|
|
2241
|
-
* @returns Promise containing the runId of the created run
|
|
2242
|
-
*/
|
|
2243
|
-
createRunAsync(params) {
|
|
2244
|
-
return this.createRun(params);
|
|
2245
|
-
}
|
|
2246
2379
|
/**
|
|
2247
2380
|
* Starts agent builder action asynchronously and waits for completion.
|
|
2248
2381
|
* This calls `/api/agent-builder/:actionId/start-async`.
|
|
@@ -2602,6 +2735,12 @@ var Observability = class extends BaseResource {
|
|
|
2602
2735
|
const queryString = searchParams.toString();
|
|
2603
2736
|
return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
|
|
2604
2737
|
}
|
|
2738
|
+
score(params) {
|
|
2739
|
+
return this.request(`/api/observability/traces/score`, {
|
|
2740
|
+
method: "POST",
|
|
2741
|
+
body: { ...params }
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2605
2744
|
};
|
|
2606
2745
|
|
|
2607
2746
|
// src/resources/network-memory-thread.ts
|
|
@@ -2676,10 +2815,11 @@ var VNextNetwork = class extends BaseResource {
|
|
|
2676
2815
|
}
|
|
2677
2816
|
/**
|
|
2678
2817
|
* Retrieves details about the network
|
|
2818
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2679
2819
|
* @returns Promise containing vNext network details
|
|
2680
2820
|
*/
|
|
2681
|
-
details() {
|
|
2682
|
-
return this.request(`/api/networks/v-next/${this.networkId}`);
|
|
2821
|
+
details(runtimeContext) {
|
|
2822
|
+
return this.request(`/api/networks/v-next/${this.networkId}${runtimeContextQueryString(runtimeContext)}`);
|
|
2683
2823
|
}
|
|
2684
2824
|
/**
|
|
2685
2825
|
* Generates a response from the v-next network
|
|
@@ -2814,10 +2954,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2814
2954
|
}
|
|
2815
2955
|
/**
|
|
2816
2956
|
* Retrieves all available agents
|
|
2957
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2817
2958
|
* @returns Promise containing map of agent IDs to agent details
|
|
2818
2959
|
*/
|
|
2819
|
-
getAgents() {
|
|
2820
|
-
|
|
2960
|
+
getAgents(runtimeContext) {
|
|
2961
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
2962
|
+
const searchParams = new URLSearchParams();
|
|
2963
|
+
if (runtimeContextParam) {
|
|
2964
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
2965
|
+
}
|
|
2966
|
+
const queryString = searchParams.toString();
|
|
2967
|
+
return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
|
|
2821
2968
|
}
|
|
2822
2969
|
/**
|
|
2823
2970
|
* Gets an agent instance by ID
|
|
@@ -2835,6 +2982,14 @@ var MastraClient = class extends BaseResource {
|
|
|
2835
2982
|
getMemoryThreads(params) {
|
|
2836
2983
|
return this.request(`/api/memory/threads?resourceid=${params.resourceId}&agentId=${params.agentId}`);
|
|
2837
2984
|
}
|
|
2985
|
+
/**
|
|
2986
|
+
* Retrieves memory config for a resource
|
|
2987
|
+
* @param params - Parameters containing the resource ID
|
|
2988
|
+
* @returns Promise containing array of memory threads
|
|
2989
|
+
*/
|
|
2990
|
+
getMemoryConfig(params) {
|
|
2991
|
+
return this.request(`/api/memory/config?agentId=${params.agentId}`);
|
|
2992
|
+
}
|
|
2838
2993
|
/**
|
|
2839
2994
|
* Creates a new memory thread
|
|
2840
2995
|
* @param params - Parameters for creating the memory thread
|
|
@@ -2851,6 +3006,24 @@ var MastraClient = class extends BaseResource {
|
|
|
2851
3006
|
getMemoryThread(threadId, agentId) {
|
|
2852
3007
|
return new MemoryThread(this.options, threadId, agentId);
|
|
2853
3008
|
}
|
|
3009
|
+
getThreadMessages(threadId, opts = {}) {
|
|
3010
|
+
let url = "";
|
|
3011
|
+
if (opts.agentId) {
|
|
3012
|
+
url = `/api/memory/threads/${threadId}/messages?agentId=${opts.agentId}`;
|
|
3013
|
+
} else if (opts.networkId) {
|
|
3014
|
+
url = `/api/memory/network/threads/${threadId}/messages?networkId=${opts.networkId}`;
|
|
3015
|
+
}
|
|
3016
|
+
return this.request(url);
|
|
3017
|
+
}
|
|
3018
|
+
deleteThread(threadId, opts = {}) {
|
|
3019
|
+
let url = "";
|
|
3020
|
+
if (opts.agentId) {
|
|
3021
|
+
url = `/api/memory/threads/${threadId}?agentId=${opts.agentId}`;
|
|
3022
|
+
} else if (opts.networkId) {
|
|
3023
|
+
url = `/api/memory/network/threads/${threadId}?networkId=${opts.networkId}`;
|
|
3024
|
+
}
|
|
3025
|
+
return this.request(url, { method: "DELETE" });
|
|
3026
|
+
}
|
|
2854
3027
|
/**
|
|
2855
3028
|
* Saves messages to memory
|
|
2856
3029
|
* @param params - Parameters containing messages to save
|
|
@@ -2913,10 +3086,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2913
3086
|
}
|
|
2914
3087
|
/**
|
|
2915
3088
|
* Retrieves all available tools
|
|
3089
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2916
3090
|
* @returns Promise containing map of tool IDs to tool details
|
|
2917
3091
|
*/
|
|
2918
|
-
getTools() {
|
|
2919
|
-
|
|
3092
|
+
getTools(runtimeContext) {
|
|
3093
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
3094
|
+
const searchParams = new URLSearchParams();
|
|
3095
|
+
if (runtimeContextParam) {
|
|
3096
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
3097
|
+
}
|
|
3098
|
+
const queryString = searchParams.toString();
|
|
3099
|
+
return this.request(`/api/tools${queryString ? `?${queryString}` : ""}`);
|
|
2920
3100
|
}
|
|
2921
3101
|
/**
|
|
2922
3102
|
* Gets a tool instance by ID
|
|
@@ -2943,10 +3123,17 @@ var MastraClient = class extends BaseResource {
|
|
|
2943
3123
|
}
|
|
2944
3124
|
/**
|
|
2945
3125
|
* Retrieves all available workflows
|
|
3126
|
+
* @param runtimeContext - Optional runtime context to pass as query parameter
|
|
2946
3127
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
2947
3128
|
*/
|
|
2948
|
-
getWorkflows() {
|
|
2949
|
-
|
|
3129
|
+
getWorkflows(runtimeContext) {
|
|
3130
|
+
const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
|
|
3131
|
+
const searchParams = new URLSearchParams();
|
|
3132
|
+
if (runtimeContextParam) {
|
|
3133
|
+
searchParams.set("runtimeContext", runtimeContextParam);
|
|
3134
|
+
}
|
|
3135
|
+
const queryString = searchParams.toString();
|
|
3136
|
+
return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
|
|
2950
3137
|
}
|
|
2951
3138
|
/**
|
|
2952
3139
|
* Gets a workflow instance by ID
|
|
@@ -3114,13 +3301,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3114
3301
|
return this.request(`/api/telemetry`);
|
|
3115
3302
|
}
|
|
3116
3303
|
}
|
|
3117
|
-
/**
|
|
3118
|
-
* Retrieves all available networks
|
|
3119
|
-
* @returns Promise containing map of network IDs to network details
|
|
3120
|
-
*/
|
|
3121
|
-
getNetworks() {
|
|
3122
|
-
return this.request("/api/networks");
|
|
3123
|
-
}
|
|
3124
3304
|
/**
|
|
3125
3305
|
* Retrieves all available vNext networks
|
|
3126
3306
|
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
@@ -3128,14 +3308,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3128
3308
|
getVNextNetworks() {
|
|
3129
3309
|
return this.request("/api/networks/v-next");
|
|
3130
3310
|
}
|
|
3131
|
-
/**
|
|
3132
|
-
* Gets a network instance by ID
|
|
3133
|
-
* @param networkId - ID of the network to retrieve
|
|
3134
|
-
* @returns Network instance
|
|
3135
|
-
*/
|
|
3136
|
-
getNetwork(networkId) {
|
|
3137
|
-
return new Network(this.options, networkId);
|
|
3138
|
-
}
|
|
3139
3311
|
/**
|
|
3140
3312
|
* Gets a vNext network instance by ID
|
|
3141
3313
|
* @param networkId - ID of the vNext network to retrieve
|
|
@@ -3326,8 +3498,32 @@ var MastraClient = class extends BaseResource {
|
|
|
3326
3498
|
getAITraces(params) {
|
|
3327
3499
|
return this.observability.getTraces(params);
|
|
3328
3500
|
}
|
|
3501
|
+
score(params) {
|
|
3502
|
+
return this.observability.score(params);
|
|
3503
|
+
}
|
|
3329
3504
|
};
|
|
3330
3505
|
|
|
3506
|
+
// src/tools.ts
|
|
3507
|
+
var ClientTool = class {
|
|
3508
|
+
id;
|
|
3509
|
+
description;
|
|
3510
|
+
inputSchema;
|
|
3511
|
+
outputSchema;
|
|
3512
|
+
execute;
|
|
3513
|
+
constructor(opts) {
|
|
3514
|
+
this.id = opts.id;
|
|
3515
|
+
this.description = opts.description;
|
|
3516
|
+
this.inputSchema = opts.inputSchema;
|
|
3517
|
+
this.outputSchema = opts.outputSchema;
|
|
3518
|
+
this.execute = opts.execute;
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3521
|
+
function createTool(opts) {
|
|
3522
|
+
return new ClientTool(opts);
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
exports.ClientTool = ClientTool;
|
|
3331
3526
|
exports.MastraClient = MastraClient;
|
|
3527
|
+
exports.createTool = createTool;
|
|
3332
3528
|
//# sourceMappingURL=index.cjs.map
|
|
3333
3529
|
//# sourceMappingURL=index.cjs.map
|