@mastra/client-js 1.0.0-beta.14 → 1.0.0-beta.15
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 +75 -0
- package/dist/client.d.ts +29 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +103 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +103 -19
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/observability.d.ts +58 -15
- package/dist/resources/observability.d.ts.map +1 -1
- package/dist/resources/run.d.ts +8 -1
- package/dist/resources/run.d.ts.map +1 -1
- package/dist/types.d.ts +19 -25
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.15
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
|
|
8
|
+
|
|
9
|
+
## What changed
|
|
10
|
+
|
|
11
|
+
Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
|
|
12
|
+
|
|
13
|
+
**Before:**
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// Old span structure
|
|
17
|
+
span.agentId; // 'my-agent'
|
|
18
|
+
span.toolId; // undefined
|
|
19
|
+
span.workflowId; // undefined
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**After:**
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// New span structure
|
|
26
|
+
span.entityType; // EntityType.AGENT
|
|
27
|
+
span.entityId; // 'my-agent'
|
|
28
|
+
span.entityName; // 'My Agent'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## New `listTraces()` API
|
|
32
|
+
|
|
33
|
+
Query traces with filtering, pagination, and sorting:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const { spans, pagination } = await storage.listTraces({
|
|
37
|
+
filters: {
|
|
38
|
+
entityType: EntityType.AGENT,
|
|
39
|
+
entityId: 'my-agent',
|
|
40
|
+
userId: 'user-123',
|
|
41
|
+
environment: 'production',
|
|
42
|
+
status: TraceStatus.SUCCESS,
|
|
43
|
+
startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
|
|
44
|
+
},
|
|
45
|
+
pagination: { page: 0, perPage: 50 },
|
|
46
|
+
orderBy: { field: 'startedAt', direction: 'DESC' },
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Available filters:** date ranges (`startedAt`, `endedAt`), entity (`entityType`, `entityId`, `entityName`), identity (`userId`, `organizationId`), correlation IDs (`runId`, `sessionId`, `threadId`), deployment (`environment`, `source`, `serviceName`), `tags`, `metadata`, and `status`.
|
|
51
|
+
|
|
52
|
+
## New retrieval methods
|
|
53
|
+
- `getSpan({ traceId, spanId })` - Get a single span
|
|
54
|
+
- `getRootSpan({ traceId })` - Get the root span of a trace
|
|
55
|
+
- `getTrace({ traceId })` - Get all spans for a trace
|
|
56
|
+
|
|
57
|
+
## Backward compatibility
|
|
58
|
+
|
|
59
|
+
The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
|
|
60
|
+
|
|
61
|
+
## Migration
|
|
62
|
+
|
|
63
|
+
**Automatic:** SQL-based stores (PostgreSQL, LibSQL, MSSQL) automatically add new columns to existing `spans` tables on initialization. Existing data is preserved with new columns set to `NULL`.
|
|
64
|
+
|
|
65
|
+
**No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Add debugger-like click-through UI to workflow graph ([#11350](https://github.com/mastra-ai/mastra/pull/11350))
|
|
70
|
+
|
|
71
|
+
- Add `getSystemPackages()` method to retrieve installed Mastra packages and their versions from the server ([#11211](https://github.com/mastra-ai/mastra/pull/11211))
|
|
72
|
+
|
|
73
|
+
- Fix error parsing json body for reset agent endpoint ([#11379](https://github.com/mastra-ai/mastra/pull/11379))
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`33a4d2e`](https://github.com/mastra-ai/mastra/commit/33a4d2e4ed8af51f69256232f00c34d6b6b51d48), [`4aaa844`](https://github.com/mastra-ai/mastra/commit/4aaa844a4f19d054490f43638a990cc57bda8d2f), [`4a1a6cb`](https://github.com/mastra-ai/mastra/commit/4a1a6cb3facad54b2bb6780b00ce91d6de1edc08), [`31d13d5`](https://github.com/mastra-ai/mastra/commit/31d13d5fdc2e2380e2e3ee3ec9fb29d2a00f265d), [`4c62166`](https://github.com/mastra-ai/mastra/commit/4c621669f4a29b1f443eca3ba70b814afa286266), [`7bcbf10`](https://github.com/mastra-ai/mastra/commit/7bcbf10133516e03df964b941f9a34e9e4ab4177), [`4353600`](https://github.com/mastra-ai/mastra/commit/43536005a65988a8eede236f69122e7f5a284ba2), [`6986fb0`](https://github.com/mastra-ai/mastra/commit/6986fb064f5db6ecc24aa655e1d26529087b43b3), [`053e979`](https://github.com/mastra-ai/mastra/commit/053e9793b28e970086b0507f7f3b76ea32c1e838), [`e26dc9c`](https://github.com/mastra-ai/mastra/commit/e26dc9c3ccfec54ae3dc3e2b2589f741f9ae60a6), [`55edf73`](https://github.com/mastra-ai/mastra/commit/55edf7302149d6c964fbb7908b43babfc2b52145), [`27c0009`](https://github.com/mastra-ai/mastra/commit/27c0009777a6073d7631b0eb7b481d94e165b5ca), [`dee388d`](https://github.com/mastra-ai/mastra/commit/dee388dde02f2e63c53385ae69252a47ab6825cc), [`3f3fc30`](https://github.com/mastra-ai/mastra/commit/3f3fc3096f24c4a26cffeecfe73085928f72aa63), [`d90ea65`](https://github.com/mastra-ai/mastra/commit/d90ea6536f7aa51c6545a4e9215b55858e98e16d), [`d171e55`](https://github.com/mastra-ai/mastra/commit/d171e559ead9f52ec728d424844c8f7b164c4510), [`10c2735`](https://github.com/mastra-ai/mastra/commit/10c27355edfdad1ee2b826b897df74125eb81fb8), [`1924cf0`](https://github.com/mastra-ai/mastra/commit/1924cf06816e5e4d4d5333065ec0f4bb02a97799), [`b339816`](https://github.com/mastra-ai/mastra/commit/b339816df0984d0243d944ac2655d6ba5f809cde)]:
|
|
76
|
+
- @mastra/core@1.0.0-beta.15
|
|
77
|
+
|
|
3
78
|
## 1.0.0-beta.14
|
|
4
79
|
|
|
5
80
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { ListScoresResponse } from '@mastra/core/evals';
|
|
1
2
|
import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
2
3
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
3
|
-
import type { TraceRecord,
|
|
4
|
+
import type { TraceRecord, ListTracesArgs, ListTracesResponse } from '@mastra/core/storage';
|
|
4
5
|
import type { WorkflowInfo } from '@mastra/core/workflows';
|
|
5
6
|
import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder, StoredAgent } from './resources/index.js';
|
|
6
|
-
import type {
|
|
7
|
+
import type { ListScoresBySpanParams, LegacyTracesPaginatedArg, LegacyGetTracesResponse } from './resources/observability.js';
|
|
8
|
+
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresByRunIdParams, ListScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse, GetSystemPackagesResponse, ListScoresResponse as ListScoresResponseOld } from './types.js';
|
|
7
9
|
export declare class MastraClient extends BaseResource {
|
|
8
10
|
private observability;
|
|
9
11
|
constructor(options: ClientOptions);
|
|
@@ -222,19 +224,19 @@ export declare class MastraClient extends BaseResource {
|
|
|
222
224
|
* @returns Promise containing the scorer
|
|
223
225
|
*/
|
|
224
226
|
getScorer(scorerId: string): Promise<GetScorerResponse>;
|
|
225
|
-
listScoresByScorerId(params: ListScoresByScorerIdParams): Promise<
|
|
227
|
+
listScoresByScorerId(params: ListScoresByScorerIdParams): Promise<ListScoresResponseOld>;
|
|
226
228
|
/**
|
|
227
229
|
* Retrieves scores by run ID
|
|
228
230
|
* @param params - Parameters containing run ID and pagination options
|
|
229
231
|
* @returns Promise containing scores and pagination info
|
|
230
232
|
*/
|
|
231
|
-
listScoresByRunId(params: ListScoresByRunIdParams): Promise<
|
|
233
|
+
listScoresByRunId(params: ListScoresByRunIdParams): Promise<ListScoresResponseOld>;
|
|
232
234
|
/**
|
|
233
235
|
* Retrieves scores by entity ID and type
|
|
234
236
|
* @param params - Parameters containing entity ID, type, and pagination options
|
|
235
237
|
* @returns Promise containing scores and pagination info
|
|
236
238
|
*/
|
|
237
|
-
listScoresByEntityId(params: ListScoresByEntityIdParams): Promise<
|
|
239
|
+
listScoresByEntityId(params: ListScoresByEntityIdParams): Promise<ListScoresResponseOld>;
|
|
238
240
|
/**
|
|
239
241
|
* Saves a score
|
|
240
242
|
* @param params - Parameters containing the score data to save
|
|
@@ -242,7 +244,23 @@ export declare class MastraClient extends BaseResource {
|
|
|
242
244
|
*/
|
|
243
245
|
saveScore(params: SaveScoreParams): Promise<SaveScoreResponse>;
|
|
244
246
|
getTrace(traceId: string): Promise<TraceRecord>;
|
|
245
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Retrieves paginated list of traces with optional filtering.
|
|
249
|
+
* This is the legacy API preserved for backward compatibility.
|
|
250
|
+
*
|
|
251
|
+
* @param params - Parameters for pagination and filtering (legacy format)
|
|
252
|
+
* @returns Promise containing paginated traces and pagination info
|
|
253
|
+
* @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
|
|
254
|
+
*/
|
|
255
|
+
getTraces(params: LegacyTracesPaginatedArg): Promise<LegacyGetTracesResponse>;
|
|
256
|
+
/**
|
|
257
|
+
* Retrieves paginated list of traces with optional filtering and sorting.
|
|
258
|
+
* This is the new API with improved filtering options.
|
|
259
|
+
*
|
|
260
|
+
* @param params - Parameters for pagination, filtering, and ordering
|
|
261
|
+
* @returns Promise containing paginated traces and pagination info
|
|
262
|
+
*/
|
|
263
|
+
listTraces(params?: ListTracesArgs): Promise<ListTracesResponse>;
|
|
246
264
|
listScoresBySpan(params: ListScoresBySpanParams): Promise<ListScoresResponse>;
|
|
247
265
|
score(params: {
|
|
248
266
|
scorerName: string;
|
|
@@ -272,5 +290,10 @@ export declare class MastraClient extends BaseResource {
|
|
|
272
290
|
* @returns StoredAgent instance
|
|
273
291
|
*/
|
|
274
292
|
getStoredAgent(storedAgentId: string): StoredAgent;
|
|
293
|
+
/**
|
|
294
|
+
* Retrieves installed Mastra packages and their versions
|
|
295
|
+
* @returns Promise containing the list of installed Mastra packages
|
|
296
|
+
*/
|
|
297
|
+
getSystemPackages(): Promise<GetSystemPackagesResponse>;
|
|
275
298
|
}
|
|
276
299
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,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E,KAAK,CAAC,MAAM,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAQhD;;;;OAIG;IACI,gBAAgB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsB3F;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOvF;;;;OAIG;IACI,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW;IAQzD;;;OAGG;IACI,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAG/D"}
|
package/dist/index.cjs
CHANGED
|
@@ -1063,6 +1063,41 @@ async function processDataStream({
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
+
function isComplexValue(value) {
|
|
1067
|
+
if (value === null || value === void 0) return false;
|
|
1068
|
+
if (value instanceof Date) return false;
|
|
1069
|
+
return typeof value === "object";
|
|
1070
|
+
}
|
|
1071
|
+
function serializeQueryValue(value) {
|
|
1072
|
+
if (value instanceof Date) {
|
|
1073
|
+
return value.toISOString();
|
|
1074
|
+
}
|
|
1075
|
+
if (isComplexValue(value)) {
|
|
1076
|
+
return JSON.stringify(value, (_key, val) => {
|
|
1077
|
+
if (val instanceof Date) {
|
|
1078
|
+
return val.toISOString();
|
|
1079
|
+
}
|
|
1080
|
+
return val;
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
return String(value);
|
|
1084
|
+
}
|
|
1085
|
+
function toQueryParams(params, flattenKeys = []) {
|
|
1086
|
+
const searchParams = new URLSearchParams();
|
|
1087
|
+
const keysToFlatten = flattenKeys;
|
|
1088
|
+
function addParams(obj) {
|
|
1089
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
1090
|
+
if (value === void 0 || value === null) continue;
|
|
1091
|
+
if (keysToFlatten.includes(key) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) {
|
|
1092
|
+
addParams(value);
|
|
1093
|
+
} else {
|
|
1094
|
+
searchParams.set(key, serializeQueryValue(value));
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
addParams(params);
|
|
1099
|
+
return searchParams.toString();
|
|
1100
|
+
}
|
|
1066
1101
|
function parseClientRequestContext(requestContext$1) {
|
|
1067
1102
|
if (requestContext$1) {
|
|
1068
1103
|
if (requestContext$1 instanceof requestContext.RequestContext) {
|
|
@@ -2426,7 +2461,8 @@ var Agent = class extends BaseResource {
|
|
|
2426
2461
|
*/
|
|
2427
2462
|
resetModel() {
|
|
2428
2463
|
return this.request(`/api/agents/${this.agentId}/model/reset`, {
|
|
2429
|
-
method: "POST"
|
|
2464
|
+
method: "POST",
|
|
2465
|
+
body: {}
|
|
2430
2466
|
});
|
|
2431
2467
|
}
|
|
2432
2468
|
/**
|
|
@@ -2708,7 +2744,8 @@ var Run = class extends BaseResource {
|
|
|
2708
2744
|
inputData: params?.inputData,
|
|
2709
2745
|
initialState: params?.initialState,
|
|
2710
2746
|
requestContext,
|
|
2711
|
-
tracingOptions: params.tracingOptions
|
|
2747
|
+
tracingOptions: params.tracingOptions,
|
|
2748
|
+
perStep: params.perStep
|
|
2712
2749
|
}
|
|
2713
2750
|
});
|
|
2714
2751
|
}
|
|
@@ -2721,6 +2758,7 @@ var Run = class extends BaseResource {
|
|
|
2721
2758
|
step,
|
|
2722
2759
|
resumeData,
|
|
2723
2760
|
tracingOptions,
|
|
2761
|
+
perStep,
|
|
2724
2762
|
...rest
|
|
2725
2763
|
}) {
|
|
2726
2764
|
const requestContext = parseClientRequestContext(rest.requestContext);
|
|
@@ -2730,7 +2768,8 @@ var Run = class extends BaseResource {
|
|
|
2730
2768
|
step,
|
|
2731
2769
|
resumeData,
|
|
2732
2770
|
requestContext,
|
|
2733
|
-
tracingOptions
|
|
2771
|
+
tracingOptions,
|
|
2772
|
+
perStep
|
|
2734
2773
|
}
|
|
2735
2774
|
});
|
|
2736
2775
|
}
|
|
@@ -2750,7 +2789,8 @@ var Run = class extends BaseResource {
|
|
|
2750
2789
|
initialState: params.initialState,
|
|
2751
2790
|
requestContext,
|
|
2752
2791
|
tracingOptions: params.tracingOptions,
|
|
2753
|
-
resourceId: params.resourceId
|
|
2792
|
+
resourceId: params.resourceId,
|
|
2793
|
+
perStep: params.perStep
|
|
2754
2794
|
}
|
|
2755
2795
|
}).then(deserializeWorkflowError);
|
|
2756
2796
|
}
|
|
@@ -2772,7 +2812,8 @@ var Run = class extends BaseResource {
|
|
|
2772
2812
|
initialState: params.initialState,
|
|
2773
2813
|
requestContext,
|
|
2774
2814
|
tracingOptions: params.tracingOptions,
|
|
2775
|
-
resourceId: params.resourceId
|
|
2815
|
+
resourceId: params.resourceId,
|
|
2816
|
+
perStep: params.perStep
|
|
2776
2817
|
},
|
|
2777
2818
|
stream: true
|
|
2778
2819
|
}
|
|
@@ -2826,7 +2867,8 @@ var Run = class extends BaseResource {
|
|
|
2826
2867
|
requestContext,
|
|
2827
2868
|
closeOnSuspend: params.closeOnSuspend,
|
|
2828
2869
|
tracingOptions: params.tracingOptions,
|
|
2829
|
-
resourceId: params.resourceId
|
|
2870
|
+
resourceId: params.resourceId,
|
|
2871
|
+
perStep: params.perStep
|
|
2830
2872
|
},
|
|
2831
2873
|
stream: true
|
|
2832
2874
|
}
|
|
@@ -2874,7 +2916,8 @@ var Run = class extends BaseResource {
|
|
|
2874
2916
|
step: params.step,
|
|
2875
2917
|
resumeData: params.resumeData,
|
|
2876
2918
|
requestContext,
|
|
2877
|
-
tracingOptions: params.tracingOptions
|
|
2919
|
+
tracingOptions: params.tracingOptions,
|
|
2920
|
+
perStep: params.perStep
|
|
2878
2921
|
}
|
|
2879
2922
|
}).then(deserializeWorkflowError);
|
|
2880
2923
|
}
|
|
@@ -2895,7 +2938,8 @@ var Run = class extends BaseResource {
|
|
|
2895
2938
|
step: params.step,
|
|
2896
2939
|
resumeData: params.resumeData,
|
|
2897
2940
|
requestContext,
|
|
2898
|
-
tracingOptions: params.tracingOptions
|
|
2941
|
+
tracingOptions: params.tracingOptions,
|
|
2942
|
+
perStep: params.perStep
|
|
2899
2943
|
},
|
|
2900
2944
|
stream: true
|
|
2901
2945
|
}
|
|
@@ -3674,9 +3718,12 @@ var Observability = class extends BaseResource {
|
|
|
3674
3718
|
return this.request(`/api/observability/traces/${traceId}`);
|
|
3675
3719
|
}
|
|
3676
3720
|
/**
|
|
3677
|
-
* Retrieves paginated list of traces with optional filtering
|
|
3678
|
-
*
|
|
3721
|
+
* Retrieves paginated list of traces with optional filtering.
|
|
3722
|
+
* This is the legacy API preserved for backward compatibility.
|
|
3723
|
+
*
|
|
3724
|
+
* @param params - Parameters for pagination and filtering (legacy format)
|
|
3679
3725
|
* @returns Promise containing paginated traces and pagination info
|
|
3726
|
+
* @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
|
|
3680
3727
|
*/
|
|
3681
3728
|
getTraces(params) {
|
|
3682
3729
|
const { pagination, filters } = params;
|
|
@@ -3709,25 +3756,34 @@ var Observability = class extends BaseResource {
|
|
|
3709
3756
|
const queryString = searchParams.toString();
|
|
3710
3757
|
return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
|
|
3711
3758
|
}
|
|
3759
|
+
/**
|
|
3760
|
+
* Retrieves paginated list of traces with optional filtering and sorting.
|
|
3761
|
+
* This is the new API with improved filtering options.
|
|
3762
|
+
*
|
|
3763
|
+
* @param params - Parameters for pagination, filtering, and ordering
|
|
3764
|
+
* @returns Promise containing paginated traces and pagination info
|
|
3765
|
+
*/
|
|
3766
|
+
listTraces(params = {}) {
|
|
3767
|
+
const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
|
|
3768
|
+
return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
|
|
3769
|
+
}
|
|
3712
3770
|
/**
|
|
3713
3771
|
* Retrieves scores by trace ID and span ID
|
|
3714
3772
|
* @param params - Parameters containing trace ID, span ID, and pagination options
|
|
3715
3773
|
* @returns Promise containing scores and pagination info
|
|
3716
3774
|
*/
|
|
3717
3775
|
listScoresBySpan(params) {
|
|
3718
|
-
const { traceId, spanId,
|
|
3719
|
-
const
|
|
3720
|
-
if (page !== void 0) {
|
|
3721
|
-
searchParams.set("page", String(page));
|
|
3722
|
-
}
|
|
3723
|
-
if (perPage !== void 0) {
|
|
3724
|
-
searchParams.set("perPage", String(perPage));
|
|
3725
|
-
}
|
|
3726
|
-
const queryString = searchParams.toString();
|
|
3776
|
+
const { traceId, spanId, ...pagination } = params;
|
|
3777
|
+
const queryString = toQueryParams(pagination);
|
|
3727
3778
|
return this.request(
|
|
3728
3779
|
`/api/observability/traces/${encodeURIComponent(traceId)}/${encodeURIComponent(spanId)}/scores${queryString ? `?${queryString}` : ""}`
|
|
3729
3780
|
);
|
|
3730
3781
|
}
|
|
3782
|
+
/**
|
|
3783
|
+
* Scores one or more traces using a specified scorer.
|
|
3784
|
+
* @param params - Scorer name and targets to score
|
|
3785
|
+
* @returns Promise containing the scoring status
|
|
3786
|
+
*/
|
|
3731
3787
|
score(params) {
|
|
3732
3788
|
return this.request(`/api/observability/traces/score`, {
|
|
3733
3789
|
method: "POST",
|
|
@@ -4277,9 +4333,27 @@ var MastraClient = class extends BaseResource {
|
|
|
4277
4333
|
getTrace(traceId) {
|
|
4278
4334
|
return this.observability.getTrace(traceId);
|
|
4279
4335
|
}
|
|
4336
|
+
/**
|
|
4337
|
+
* Retrieves paginated list of traces with optional filtering.
|
|
4338
|
+
* This is the legacy API preserved for backward compatibility.
|
|
4339
|
+
*
|
|
4340
|
+
* @param params - Parameters for pagination and filtering (legacy format)
|
|
4341
|
+
* @returns Promise containing paginated traces and pagination info
|
|
4342
|
+
* @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
|
|
4343
|
+
*/
|
|
4280
4344
|
getTraces(params) {
|
|
4281
4345
|
return this.observability.getTraces(params);
|
|
4282
4346
|
}
|
|
4347
|
+
/**
|
|
4348
|
+
* Retrieves paginated list of traces with optional filtering and sorting.
|
|
4349
|
+
* This is the new API with improved filtering options.
|
|
4350
|
+
*
|
|
4351
|
+
* @param params - Parameters for pagination, filtering, and ordering
|
|
4352
|
+
* @returns Promise containing paginated traces and pagination info
|
|
4353
|
+
*/
|
|
4354
|
+
listTraces(params = {}) {
|
|
4355
|
+
return this.observability.listTraces(params);
|
|
4356
|
+
}
|
|
4283
4357
|
listScoresBySpan(params) {
|
|
4284
4358
|
return this.observability.listScoresBySpan(params);
|
|
4285
4359
|
}
|
|
@@ -4332,6 +4406,16 @@ var MastraClient = class extends BaseResource {
|
|
|
4332
4406
|
getStoredAgent(storedAgentId) {
|
|
4333
4407
|
return new StoredAgent(this.options, storedAgentId);
|
|
4334
4408
|
}
|
|
4409
|
+
// ============================================================================
|
|
4410
|
+
// System
|
|
4411
|
+
// ============================================================================
|
|
4412
|
+
/**
|
|
4413
|
+
* Retrieves installed Mastra packages and their versions
|
|
4414
|
+
* @returns Promise containing the list of installed Mastra packages
|
|
4415
|
+
*/
|
|
4416
|
+
getSystemPackages() {
|
|
4417
|
+
return this.request("/api/system/packages");
|
|
4418
|
+
}
|
|
4335
4419
|
};
|
|
4336
4420
|
|
|
4337
4421
|
// src/tools.ts
|