@mastra/client-js 0.0.0-fix-persist-session-cache-option-mcp-server-20251031182703 → 0.0.0-fix-9244-clickhouse-metadata-20251104220626
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 +168 -3
- package/README.md +1 -3
- package/dist/client.d.ts +10 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +85 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -226
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +3 -25
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +0 -18
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/memory-thread.d.ts +7 -7
- package/dist/resources/memory-thread.d.ts.map +1 -1
- package/dist/resources/observability.d.ts +2 -2
- package/dist/resources/observability.d.ts.map +1 -1
- package/dist/resources/workflow.d.ts +3 -56
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/types.d.ts +26 -29
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -203,7 +203,6 @@ var BaseResource = class {
|
|
|
203
203
|
async function executeToolCallAndRespond({
|
|
204
204
|
response,
|
|
205
205
|
params,
|
|
206
|
-
runId,
|
|
207
206
|
resourceId,
|
|
208
207
|
threadId,
|
|
209
208
|
requestContext,
|
|
@@ -217,22 +216,18 @@ async function executeToolCallAndRespond({
|
|
|
217
216
|
for (const toolCall of toolCalls) {
|
|
218
217
|
const clientTool = params.clientTools?.[toolCall.toolName];
|
|
219
218
|
if (clientTool && clientTool.execute) {
|
|
220
|
-
const result = await clientTool.execute(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
resourceId,
|
|
225
|
-
threadId,
|
|
226
|
-
requestContext,
|
|
227
|
-
tracingContext: { currentSpan: void 0 },
|
|
228
|
-
suspend: async () => {
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
{
|
|
219
|
+
const result = await clientTool.execute(toolCall?.args, {
|
|
220
|
+
requestContext,
|
|
221
|
+
tracingContext: { currentSpan: void 0 },
|
|
222
|
+
agent: {
|
|
232
223
|
messages: response.messages,
|
|
233
|
-
toolCallId: toolCall?.toolCallId
|
|
224
|
+
toolCallId: toolCall?.toolCallId,
|
|
225
|
+
suspend: async () => {
|
|
226
|
+
},
|
|
227
|
+
threadId,
|
|
228
|
+
resourceId
|
|
234
229
|
}
|
|
235
|
-
);
|
|
230
|
+
});
|
|
236
231
|
const updatedMessages = [
|
|
237
232
|
...response.response.messages || [],
|
|
238
233
|
{
|
|
@@ -342,7 +337,7 @@ var Agent = class extends BaseResource {
|
|
|
342
337
|
requestContext: parseClientRequestContext(params.requestContext),
|
|
343
338
|
clientTools: processClientTools(params.clientTools)
|
|
344
339
|
};
|
|
345
|
-
const {
|
|
340
|
+
const { resourceId, threadId, requestContext } = processedParams;
|
|
346
341
|
const response = await this.request(
|
|
347
342
|
`/api/agents/${this.agentId}/generate-legacy`,
|
|
348
343
|
{
|
|
@@ -358,22 +353,18 @@ var Agent = class extends BaseResource {
|
|
|
358
353
|
for (const toolCall of toolCalls) {
|
|
359
354
|
const clientTool = params.clientTools?.[toolCall.toolName];
|
|
360
355
|
if (clientTool && clientTool.execute) {
|
|
361
|
-
const result = await clientTool.execute(
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
resourceId,
|
|
366
|
-
threadId,
|
|
367
|
-
requestContext,
|
|
368
|
-
tracingContext: { currentSpan: void 0 },
|
|
369
|
-
suspend: async () => {
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
{
|
|
356
|
+
const result = await clientTool.execute(toolCall?.args, {
|
|
357
|
+
requestContext,
|
|
358
|
+
tracingContext: { currentSpan: void 0 },
|
|
359
|
+
agent: {
|
|
373
360
|
messages: response.messages,
|
|
374
|
-
toolCallId: toolCall?.toolCallId
|
|
361
|
+
toolCallId: toolCall?.toolCallId,
|
|
362
|
+
suspend: async () => {
|
|
363
|
+
},
|
|
364
|
+
threadId,
|
|
365
|
+
resourceId
|
|
375
366
|
}
|
|
376
|
-
);
|
|
367
|
+
});
|
|
377
368
|
const updatedMessages = [
|
|
378
369
|
...response.response.messages,
|
|
379
370
|
{
|
|
@@ -416,7 +407,7 @@ var Agent = class extends BaseResource {
|
|
|
416
407
|
schema: zodToJsonSchema(params.structuredOutput.schema)
|
|
417
408
|
} : void 0
|
|
418
409
|
};
|
|
419
|
-
const {
|
|
410
|
+
const { resourceId, threadId, requestContext } = processedParams;
|
|
420
411
|
const response = await this.request(
|
|
421
412
|
`/api/agents/${this.agentId}/generate`,
|
|
422
413
|
{
|
|
@@ -428,7 +419,6 @@ var Agent = class extends BaseResource {
|
|
|
428
419
|
return executeToolCallAndRespond({
|
|
429
420
|
response,
|
|
430
421
|
params,
|
|
431
|
-
runId,
|
|
432
422
|
resourceId,
|
|
433
423
|
threadId,
|
|
434
424
|
requestContext,
|
|
@@ -1048,23 +1038,19 @@ var Agent = class extends BaseResource {
|
|
|
1048
1038
|
const clientTool = processedParams.clientTools?.[toolCall2.toolName];
|
|
1049
1039
|
if (clientTool && clientTool.execute) {
|
|
1050
1040
|
shouldExecuteClientTool = true;
|
|
1051
|
-
const result = await clientTool.execute(
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
threadId: processedParams.threadId,
|
|
1057
|
-
requestContext: processedParams.requestContext,
|
|
1058
|
-
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1059
|
-
tracingContext: { currentSpan: void 0 },
|
|
1060
|
-
suspend: async () => {
|
|
1061
|
-
}
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1041
|
+
const result = await clientTool.execute(toolCall2?.args, {
|
|
1042
|
+
requestContext: processedParams.requestContext,
|
|
1043
|
+
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1044
|
+
tracingContext: { currentSpan: void 0 },
|
|
1045
|
+
agent: {
|
|
1064
1046
|
messages: response.messages,
|
|
1065
|
-
toolCallId: toolCall2?.toolCallId
|
|
1047
|
+
toolCallId: toolCall2?.toolCallId,
|
|
1048
|
+
suspend: async () => {
|
|
1049
|
+
},
|
|
1050
|
+
threadId: processedParams.threadId,
|
|
1051
|
+
resourceId: processedParams.resourceId
|
|
1066
1052
|
}
|
|
1067
|
-
);
|
|
1053
|
+
});
|
|
1068
1054
|
const lastMessageRaw = messages[messages.length - 1];
|
|
1069
1055
|
const lastMessage = lastMessageRaw != null ? JSON.parse(JSON.stringify(lastMessageRaw)) : void 0;
|
|
1070
1056
|
const toolInvocationPart = lastMessage?.parts?.find(
|
|
@@ -1252,23 +1238,19 @@ var Agent = class extends BaseResource {
|
|
|
1252
1238
|
for (const toolCall2 of toolCalls) {
|
|
1253
1239
|
const clientTool = processedParams.clientTools?.[toolCall2.toolName];
|
|
1254
1240
|
if (clientTool && clientTool.execute) {
|
|
1255
|
-
const result = await clientTool.execute(
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
threadId: processedParams.threadId,
|
|
1261
|
-
requestContext: processedParams.requestContext,
|
|
1262
|
-
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1263
|
-
tracingContext: { currentSpan: void 0 },
|
|
1264
|
-
suspend: async () => {
|
|
1265
|
-
}
|
|
1266
|
-
},
|
|
1267
|
-
{
|
|
1241
|
+
const result = await clientTool.execute(toolCall2?.args, {
|
|
1242
|
+
requestContext: processedParams.requestContext,
|
|
1243
|
+
// TODO: Pass proper tracing context when client-js supports tracing
|
|
1244
|
+
tracingContext: { currentSpan: void 0 },
|
|
1245
|
+
agent: {
|
|
1268
1246
|
messages: response.messages,
|
|
1269
|
-
toolCallId: toolCall2?.toolCallId
|
|
1247
|
+
toolCallId: toolCall2?.toolCallId,
|
|
1248
|
+
suspend: async () => {
|
|
1249
|
+
},
|
|
1250
|
+
threadId: processedParams.threadId,
|
|
1251
|
+
resourceId: processedParams.resourceId
|
|
1270
1252
|
}
|
|
1271
|
-
);
|
|
1253
|
+
});
|
|
1272
1254
|
const lastMessage = JSON.parse(JSON.stringify(messages[messages.length - 1]));
|
|
1273
1255
|
const toolInvocationPart = lastMessage?.parts?.find(
|
|
1274
1256
|
(part) => part.type === "tool-invocation" && part.toolInvocation?.toolCallId === toolCall2.toolCallId
|
|
@@ -1393,12 +1375,6 @@ var Agent = class extends BaseResource {
|
|
|
1393
1375
|
body: params
|
|
1394
1376
|
});
|
|
1395
1377
|
}
|
|
1396
|
-
async generateVNext(_messagesOrParams, _options) {
|
|
1397
|
-
throw new Error("generateVNext has been renamed to generate. Please use generate instead.");
|
|
1398
|
-
}
|
|
1399
|
-
async streamVNext(_messagesOrParams, _options) {
|
|
1400
|
-
throw new Error("streamVNext has been renamed to stream. Please use stream instead.");
|
|
1401
|
-
}
|
|
1402
1378
|
};
|
|
1403
1379
|
|
|
1404
1380
|
// src/resources/memory-thread.ts
|
|
@@ -1446,9 +1422,9 @@ var MemoryThread = class extends BaseResource {
|
|
|
1446
1422
|
);
|
|
1447
1423
|
}
|
|
1448
1424
|
/**
|
|
1449
|
-
* Retrieves messages associated with the thread
|
|
1425
|
+
* Retrieves messages associated with the thread (always returns mastra-db format)
|
|
1450
1426
|
* @param params - Optional parameters including limit for number of messages to retrieve and request context
|
|
1451
|
-
* @returns Promise containing thread messages
|
|
1427
|
+
* @returns Promise containing thread messages in mastra-db format
|
|
1452
1428
|
*/
|
|
1453
1429
|
getMessages(params) {
|
|
1454
1430
|
const query = new URLSearchParams({
|
|
@@ -1460,19 +1436,20 @@ var MemoryThread = class extends BaseResource {
|
|
|
1460
1436
|
);
|
|
1461
1437
|
}
|
|
1462
1438
|
/**
|
|
1463
|
-
* Retrieves paginated messages associated with the thread with
|
|
1464
|
-
* @param params - Pagination parameters including
|
|
1439
|
+
* Retrieves paginated messages associated with the thread with filtering and ordering options
|
|
1440
|
+
* @param params - Pagination parameters including page, perPage, orderBy, filter, include options, and request context
|
|
1465
1441
|
* @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
|
|
1466
1442
|
*/
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1443
|
+
listMessages(params = {}) {
|
|
1444
|
+
const { page, perPage, orderBy, filter, include, resourceId, requestContext } = params;
|
|
1445
|
+
const queryParams = {};
|
|
1446
|
+
if (resourceId) queryParams.resourceId = resourceId;
|
|
1447
|
+
if (page !== void 0) queryParams.page = String(page);
|
|
1448
|
+
if (perPage !== void 0) queryParams.perPage = String(perPage);
|
|
1449
|
+
if (orderBy) queryParams.orderBy = JSON.stringify(orderBy);
|
|
1450
|
+
if (filter) queryParams.filter = JSON.stringify(filter);
|
|
1451
|
+
if (include) queryParams.include = JSON.stringify(include);
|
|
1452
|
+
const query = new URLSearchParams(queryParams);
|
|
1476
1453
|
return this.request(
|
|
1477
1454
|
`/api/memory/threads/${this.threadId}/messages/paginated?${query.toString()}${requestContextQueryString(requestContext, "&")}`
|
|
1478
1455
|
);
|
|
@@ -1610,51 +1587,6 @@ var Workflow = class extends BaseResource {
|
|
|
1610
1587
|
super(options);
|
|
1611
1588
|
this.workflowId = workflowId;
|
|
1612
1589
|
}
|
|
1613
|
-
/**
|
|
1614
|
-
* Creates an async generator that processes a readable stream and yields workflow records
|
|
1615
|
-
* separated by the Record Separator character (\x1E)
|
|
1616
|
-
*
|
|
1617
|
-
* @param stream - The readable stream to process
|
|
1618
|
-
* @returns An async generator that yields parsed records
|
|
1619
|
-
*/
|
|
1620
|
-
async *streamProcessor(stream) {
|
|
1621
|
-
const reader = stream.getReader();
|
|
1622
|
-
let doneReading = false;
|
|
1623
|
-
let buffer = "";
|
|
1624
|
-
try {
|
|
1625
|
-
while (!doneReading) {
|
|
1626
|
-
const { done, value } = await reader.read();
|
|
1627
|
-
doneReading = done;
|
|
1628
|
-
if (done && !value) continue;
|
|
1629
|
-
try {
|
|
1630
|
-
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
1631
|
-
const chunks = (buffer + decoded).split(RECORD_SEPARATOR);
|
|
1632
|
-
buffer = chunks.pop() || "";
|
|
1633
|
-
for (const chunk of chunks) {
|
|
1634
|
-
if (chunk) {
|
|
1635
|
-
if (typeof chunk === "string") {
|
|
1636
|
-
try {
|
|
1637
|
-
const parsedChunk = JSON.parse(chunk);
|
|
1638
|
-
yield parsedChunk;
|
|
1639
|
-
} catch {
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
} catch {
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
if (buffer) {
|
|
1648
|
-
try {
|
|
1649
|
-
yield JSON.parse(buffer);
|
|
1650
|
-
} catch {
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
} finally {
|
|
1654
|
-
reader.cancel().catch(() => {
|
|
1655
|
-
});
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
1590
|
/**
|
|
1659
1591
|
* Retrieves details about the workflow
|
|
1660
1592
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -1678,11 +1610,15 @@ var Workflow = class extends BaseResource {
|
|
|
1678
1610
|
if (params?.toDate) {
|
|
1679
1611
|
searchParams.set("toDate", params.toDate.toISOString());
|
|
1680
1612
|
}
|
|
1681
|
-
if (params?.
|
|
1682
|
-
|
|
1613
|
+
if (params?.perPage !== null && params?.perPage !== void 0) {
|
|
1614
|
+
if (params.perPage === false) {
|
|
1615
|
+
searchParams.set("perPage", "false");
|
|
1616
|
+
} else if (typeof params.perPage === "number" && params.perPage > 0 && Number.isInteger(params.perPage)) {
|
|
1617
|
+
searchParams.set("perPage", String(params.perPage));
|
|
1618
|
+
}
|
|
1683
1619
|
}
|
|
1684
|
-
if (params?.
|
|
1685
|
-
searchParams.set("
|
|
1620
|
+
if (params?.page !== null && params?.page !== void 0 && !isNaN(Number(params?.page))) {
|
|
1621
|
+
searchParams.set("page", String(params.page));
|
|
1686
1622
|
}
|
|
1687
1623
|
if (params?.resourceId) {
|
|
1688
1624
|
searchParams.set("resourceId", params.resourceId);
|
|
@@ -1737,21 +1673,12 @@ var Workflow = class extends BaseResource {
|
|
|
1737
1673
|
body: { event: params.event, data: params.data }
|
|
1738
1674
|
});
|
|
1739
1675
|
}
|
|
1740
|
-
/**
|
|
1741
|
-
* @deprecated Use createRunAsync() instead.
|
|
1742
|
-
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
1743
|
-
*/
|
|
1744
|
-
async createRun(_params) {
|
|
1745
|
-
throw new Error(
|
|
1746
|
-
"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."
|
|
1747
|
-
);
|
|
1748
|
-
}
|
|
1749
1676
|
/**
|
|
1750
1677
|
* Creates a new workflow run
|
|
1751
1678
|
* @param params - Optional object containing the optional runId
|
|
1752
1679
|
* @returns Promise containing the runId of the created run with methods to control execution
|
|
1753
1680
|
*/
|
|
1754
|
-
async
|
|
1681
|
+
async createRun(params) {
|
|
1755
1682
|
const searchParams = new URLSearchParams();
|
|
1756
1683
|
if (!!params?.runId) {
|
|
1757
1684
|
searchParams.set("runId", params.runId);
|
|
@@ -1781,9 +1708,6 @@ var Workflow = class extends BaseResource {
|
|
|
1781
1708
|
tracingOptions: p.tracingOptions
|
|
1782
1709
|
});
|
|
1783
1710
|
},
|
|
1784
|
-
watch: async (onRecord) => {
|
|
1785
|
-
return this.watch({ runId }, onRecord);
|
|
1786
|
-
},
|
|
1787
1711
|
stream: async (p) => {
|
|
1788
1712
|
return this.stream({ runId, inputData: p.inputData, requestContext: p.requestContext });
|
|
1789
1713
|
},
|
|
@@ -2138,29 +2062,6 @@ var Workflow = class extends BaseResource {
|
|
|
2138
2062
|
});
|
|
2139
2063
|
return response.body.pipeThrough(transformStream);
|
|
2140
2064
|
}
|
|
2141
|
-
/**
|
|
2142
|
-
* Watches workflow transitions in real-time
|
|
2143
|
-
* @param runId - Optional run ID to filter the watch stream
|
|
2144
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
2145
|
-
*/
|
|
2146
|
-
async watch({ runId }, onRecord) {
|
|
2147
|
-
const response = await this.request(`/api/workflows/${this.workflowId}/watch?runId=${runId}`, {
|
|
2148
|
-
stream: true
|
|
2149
|
-
});
|
|
2150
|
-
if (!response.ok) {
|
|
2151
|
-
throw new Error(`Failed to watch workflow: ${response.statusText}`);
|
|
2152
|
-
}
|
|
2153
|
-
if (!response.body) {
|
|
2154
|
-
throw new Error("Response body is null");
|
|
2155
|
-
}
|
|
2156
|
-
for await (const record of this.streamProcessor(response.body)) {
|
|
2157
|
-
if (typeof record === "string") {
|
|
2158
|
-
onRecord(JSON.parse(record));
|
|
2159
|
-
} else {
|
|
2160
|
-
onRecord(record);
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
2065
|
/**
|
|
2165
2066
|
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
2166
2067
|
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
@@ -2361,20 +2262,11 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2361
2262
|
}
|
|
2362
2263
|
});
|
|
2363
2264
|
}
|
|
2364
|
-
/**
|
|
2365
|
-
* @deprecated Use createRunAsync() instead.
|
|
2366
|
-
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
2367
|
-
*/
|
|
2368
|
-
async createRun(_params) {
|
|
2369
|
-
throw new Error(
|
|
2370
|
-
"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."
|
|
2371
|
-
);
|
|
2372
|
-
}
|
|
2373
2265
|
/**
|
|
2374
2266
|
* Creates a new agent builder action run and returns the runId.
|
|
2375
2267
|
* This calls `/api/agent-builder/:actionId/create-run`.
|
|
2376
2268
|
*/
|
|
2377
|
-
async
|
|
2269
|
+
async createRun(params) {
|
|
2378
2270
|
const searchParams = new URLSearchParams();
|
|
2379
2271
|
if (!!params?.runId) {
|
|
2380
2272
|
searchParams.set("runId", params.runId);
|
|
@@ -2543,32 +2435,6 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2543
2435
|
}
|
|
2544
2436
|
return response.body.pipeThrough(this.createRecordParserTransform());
|
|
2545
2437
|
}
|
|
2546
|
-
/**
|
|
2547
|
-
* Watches an existing agent builder action run by runId.
|
|
2548
|
-
* This is used for hot reload recovery - it loads the existing run state
|
|
2549
|
-
* and streams any remaining progress.
|
|
2550
|
-
* This calls `/api/agent-builder/:actionId/watch`.
|
|
2551
|
-
*/
|
|
2552
|
-
async watch({ runId, eventType }, onRecord) {
|
|
2553
|
-
const url = `/api/agent-builder/${this.actionId}/watch?runId=${runId}${eventType ? `&eventType=${eventType}` : ""}`;
|
|
2554
|
-
const response = await this.request(url, {
|
|
2555
|
-
method: "GET",
|
|
2556
|
-
stream: true
|
|
2557
|
-
});
|
|
2558
|
-
if (!response.ok) {
|
|
2559
|
-
throw new Error(`Failed to watch agent builder action: ${response.statusText}`);
|
|
2560
|
-
}
|
|
2561
|
-
if (!response.body) {
|
|
2562
|
-
throw new Error("Response body is null");
|
|
2563
|
-
}
|
|
2564
|
-
for await (const record of this.streamProcessor(response.body)) {
|
|
2565
|
-
if (typeof record === "string") {
|
|
2566
|
-
onRecord(JSON.parse(record));
|
|
2567
|
-
} else {
|
|
2568
|
-
onRecord(record);
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
}
|
|
2572
2438
|
/**
|
|
2573
2439
|
* Observes an existing agent builder action run stream.
|
|
2574
2440
|
* Replays cached execution from the beginning, then continues with live stream.
|
|
@@ -2686,11 +2552,11 @@ var AgentBuilder = class extends BaseResource {
|
|
|
2686
2552
|
if (params?.toDate) {
|
|
2687
2553
|
searchParams.set("toDate", params.toDate.toISOString());
|
|
2688
2554
|
}
|
|
2689
|
-
if (params?.
|
|
2690
|
-
searchParams.set("
|
|
2555
|
+
if (params?.perPage !== void 0) {
|
|
2556
|
+
searchParams.set("perPage", String(params.perPage));
|
|
2691
2557
|
}
|
|
2692
|
-
if (params?.
|
|
2693
|
-
searchParams.set("
|
|
2558
|
+
if (params?.page !== void 0) {
|
|
2559
|
+
searchParams.set("page", String(params.page));
|
|
2694
2560
|
}
|
|
2695
2561
|
if (params?.resourceId) {
|
|
2696
2562
|
searchParams.set("resourceId", params.resourceId);
|
|
@@ -2787,7 +2653,7 @@ var Observability = class extends BaseResource {
|
|
|
2787
2653
|
* @param params - Parameters containing trace ID, span ID, and pagination options
|
|
2788
2654
|
* @returns Promise containing scores and pagination info
|
|
2789
2655
|
*/
|
|
2790
|
-
|
|
2656
|
+
listScoresBySpan(params) {
|
|
2791
2657
|
const { traceId, spanId, page, perPage } = params;
|
|
2792
2658
|
const searchParams = new URLSearchParams();
|
|
2793
2659
|
if (page !== void 0) {
|
|
@@ -2850,8 +2716,8 @@ var MastraClient = class extends BaseResource {
|
|
|
2850
2716
|
const queryParams = new URLSearchParams({
|
|
2851
2717
|
resourceId: params.resourceId,
|
|
2852
2718
|
agentId: params.agentId,
|
|
2853
|
-
...params.
|
|
2854
|
-
...params.
|
|
2719
|
+
...params.page !== void 0 && { page: params.page.toString() },
|
|
2720
|
+
...params.perPage !== void 0 && { perPage: params.perPage.toString() },
|
|
2855
2721
|
...params.orderBy && { orderBy: params.orderBy },
|
|
2856
2722
|
...params.sortDirection && { sortDirection: params.sortDirection }
|
|
2857
2723
|
});
|
|
@@ -3091,16 +2957,16 @@ var MastraClient = class extends BaseResource {
|
|
|
3091
2957
|
}
|
|
3092
2958
|
/**
|
|
3093
2959
|
* Retrieves a list of available MCP servers.
|
|
3094
|
-
* @param params - Optional parameters for pagination (
|
|
2960
|
+
* @param params - Optional parameters for pagination (perPage, page).
|
|
3095
2961
|
* @returns Promise containing the list of MCP servers and pagination info.
|
|
3096
2962
|
*/
|
|
3097
2963
|
getMcpServers(params) {
|
|
3098
2964
|
const searchParams = new URLSearchParams();
|
|
3099
|
-
if (params?.
|
|
3100
|
-
searchParams.set("
|
|
2965
|
+
if (params?.perPage !== void 0) {
|
|
2966
|
+
searchParams.set("perPage", String(params.perPage));
|
|
3101
2967
|
}
|
|
3102
|
-
if (params?.
|
|
3103
|
-
searchParams.set("
|
|
2968
|
+
if (params?.page !== void 0) {
|
|
2969
|
+
searchParams.set("page", String(params.page));
|
|
3104
2970
|
}
|
|
3105
2971
|
const queryString = searchParams.toString();
|
|
3106
2972
|
return this.request(`/api/mcp/v0/servers${queryString ? `?${queryString}` : ""}`);
|
|
@@ -3223,7 +3089,7 @@ var MastraClient = class extends BaseResource {
|
|
|
3223
3089
|
getScorer(scorerId) {
|
|
3224
3090
|
return this.request(`/api/scores/scorers/${encodeURIComponent(scorerId)}`);
|
|
3225
3091
|
}
|
|
3226
|
-
|
|
3092
|
+
listScoresByScorerId(params) {
|
|
3227
3093
|
const { page, perPage, scorerId, entityId, entityType } = params;
|
|
3228
3094
|
const searchParams = new URLSearchParams();
|
|
3229
3095
|
if (entityId) {
|
|
@@ -3246,7 +3112,7 @@ var MastraClient = class extends BaseResource {
|
|
|
3246
3112
|
* @param params - Parameters containing run ID and pagination options
|
|
3247
3113
|
* @returns Promise containing scores and pagination info
|
|
3248
3114
|
*/
|
|
3249
|
-
|
|
3115
|
+
listScoresByRunId(params) {
|
|
3250
3116
|
const { runId, page, perPage } = params;
|
|
3251
3117
|
const searchParams = new URLSearchParams();
|
|
3252
3118
|
if (page !== void 0) {
|
|
@@ -3263,7 +3129,7 @@ var MastraClient = class extends BaseResource {
|
|
|
3263
3129
|
* @param params - Parameters containing entity ID, type, and pagination options
|
|
3264
3130
|
* @returns Promise containing scores and pagination info
|
|
3265
3131
|
*/
|
|
3266
|
-
|
|
3132
|
+
listScoresByEntityId(params) {
|
|
3267
3133
|
const { entityId, entityType, page, perPage } = params;
|
|
3268
3134
|
const searchParams = new URLSearchParams();
|
|
3269
3135
|
if (page !== void 0) {
|
|
@@ -3288,21 +3154,14 @@ var MastraClient = class extends BaseResource {
|
|
|
3288
3154
|
body: params
|
|
3289
3155
|
});
|
|
3290
3156
|
}
|
|
3291
|
-
/**
|
|
3292
|
-
* Retrieves model providers with available keys
|
|
3293
|
-
* @returns Promise containing model providers with available keys
|
|
3294
|
-
*/
|
|
3295
|
-
getModelProviders() {
|
|
3296
|
-
return this.request(`/api/model-providers`);
|
|
3297
|
-
}
|
|
3298
3157
|
getAITrace(traceId) {
|
|
3299
3158
|
return this.observability.getTrace(traceId);
|
|
3300
3159
|
}
|
|
3301
3160
|
getAITraces(params) {
|
|
3302
3161
|
return this.observability.getTraces(params);
|
|
3303
3162
|
}
|
|
3304
|
-
|
|
3305
|
-
return this.observability.
|
|
3163
|
+
listScoresBySpan(params) {
|
|
3164
|
+
return this.observability.listScoresBySpan(params);
|
|
3306
3165
|
}
|
|
3307
3166
|
score(params) {
|
|
3308
3167
|
return this.observability.score(params);
|