@mastra/client-js 1.0.0-beta.14 → 1.0.0-beta.16

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 CHANGED
@@ -1,5 +1,89 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 1.0.0-beta.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `cancel()` method as an alias for `cancelRun()` in the Run class. The new method provides a more concise API while maintaining backward compatibility. Includes comprehensive documentation about abort signals and how steps can respond to cancellation. ([#11417](https://github.com/mastra-ai/mastra/pull/11417))
8
+
9
+ - Updated dependencies [[`3d93a15`](https://github.com/mastra-ai/mastra/commit/3d93a15796b158c617461c8b98bede476ebb43e2), [`efe406a`](https://github.com/mastra-ai/mastra/commit/efe406a1353c24993280ebc2ed61dd9f65b84b26), [`119e5c6`](https://github.com/mastra-ai/mastra/commit/119e5c65008f3e5cfca954eefc2eb85e3bf40da4), [`74e504a`](https://github.com/mastra-ai/mastra/commit/74e504a3b584eafd2f198001c6a113bbec589fd3), [`e33fdbd`](https://github.com/mastra-ai/mastra/commit/e33fdbd07b33920d81e823122331b0c0bee0bb59), [`929f69c`](https://github.com/mastra-ai/mastra/commit/929f69c3436fa20dd0f0e2f7ebe8270bd82a1529), [`8a73529`](https://github.com/mastra-ai/mastra/commit/8a73529ca01187f604b1f3019d0a725ac63ae55f)]:
10
+ - @mastra/core@1.0.0-beta.16
11
+
12
+ ## 1.0.0-beta.15
13
+
14
+ ### Minor Changes
15
+
16
+ - Unified observability schema with entity-based span identification ([#11132](https://github.com/mastra-ai/mastra/pull/11132))
17
+
18
+ ## What changed
19
+
20
+ Spans now use a unified identification model with `entityId`, `entityType`, and `entityName` instead of separate `agentId`, `toolId`, `workflowId` fields.
21
+
22
+ **Before:**
23
+
24
+ ```typescript
25
+ // Old span structure
26
+ span.agentId; // 'my-agent'
27
+ span.toolId; // undefined
28
+ span.workflowId; // undefined
29
+ ```
30
+
31
+ **After:**
32
+
33
+ ```typescript
34
+ // New span structure
35
+ span.entityType; // EntityType.AGENT
36
+ span.entityId; // 'my-agent'
37
+ span.entityName; // 'My Agent'
38
+ ```
39
+
40
+ ## New `listTraces()` API
41
+
42
+ Query traces with filtering, pagination, and sorting:
43
+
44
+ ```typescript
45
+ const { spans, pagination } = await storage.listTraces({
46
+ filters: {
47
+ entityType: EntityType.AGENT,
48
+ entityId: 'my-agent',
49
+ userId: 'user-123',
50
+ environment: 'production',
51
+ status: TraceStatus.SUCCESS,
52
+ startedAt: { start: new Date('2024-01-01'), end: new Date('2024-01-31') },
53
+ },
54
+ pagination: { page: 0, perPage: 50 },
55
+ orderBy: { field: 'startedAt', direction: 'DESC' },
56
+ });
57
+ ```
58
+
59
+ **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`.
60
+
61
+ ## New retrieval methods
62
+ - `getSpan({ traceId, spanId })` - Get a single span
63
+ - `getRootSpan({ traceId })` - Get the root span of a trace
64
+ - `getTrace({ traceId })` - Get all spans for a trace
65
+
66
+ ## Backward compatibility
67
+
68
+ The legacy `getTraces()` method continues to work. When you pass `name: "agent run: my-agent"`, it automatically transforms to `entityId: "my-agent", entityType: AGENT`.
69
+
70
+ ## Migration
71
+
72
+ **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`.
73
+
74
+ **No action required:** Your existing code continues to work. Adopt the new fields and `listTraces()` API at your convenience.
75
+
76
+ ### Patch Changes
77
+
78
+ - Add debugger-like click-through UI to workflow graph ([#11350](https://github.com/mastra-ai/mastra/pull/11350))
79
+
80
+ - Add `getSystemPackages()` method to retrieve installed Mastra packages and their versions from the server ([#11211](https://github.com/mastra-ai/mastra/pull/11211))
81
+
82
+ - Fix error parsing json body for reset agent endpoint ([#11379](https://github.com/mastra-ai/mastra/pull/11379))
83
+
84
+ - 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)]:
85
+ - @mastra/core@1.0.0-beta.15
86
+
3
87
  ## 1.0.0-beta.14
4
88
 
5
89
  ### 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, TracesPaginatedArg } from '@mastra/core/storage';
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 { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresResponse, ListScoresByRunIdParams, ListScoresByEntityIdParams, ListScoresBySpanParams, SaveScoreParams, SaveScoreResponse, GetTracesResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse } from './types.js';
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<ListScoresResponse>;
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<ListScoresResponse>;
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<ListScoresResponse>;
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
- getTraces(params: TracesPaginatedArg): Promise<GetTracesResponse>;
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
@@ -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,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,GAAG,EACH,OAAO,EACP,YAAY,EAEZ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IG;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
  /**
@@ -2689,12 +2725,79 @@ var Run = class extends BaseResource {
2689
2725
  /**
2690
2726
  * Cancels a specific workflow run by its ID
2691
2727
  * @returns Promise containing a success message
2728
+ * @deprecated Use `cancel()` instead
2692
2729
  */
2693
2730
  cancelRun() {
2694
2731
  return this.request(`/api/workflows/${this.workflowId}/runs/${this.runId}/cancel`, {
2695
2732
  method: "POST"
2696
2733
  });
2697
2734
  }
2735
+ /**
2736
+ * Cancels a workflow run.
2737
+ *
2738
+ * This method aborts any running steps and updates the workflow status to 'canceled' .
2739
+ * It works for both actively running workflows and suspended/waiting workflows.
2740
+ *
2741
+ * ## How cancellation works
2742
+ *
2743
+ * When called, the workflow will:
2744
+ * 1. **Trigger the abort signal** - Uses the standard Web API AbortSignal to notify running steps
2745
+ * 2. **Prevent subsequent steps** - No further steps will be executed
2746
+ *
2747
+ * ## Abort signal behavior
2748
+ *
2749
+ * Steps that check the `abortSignal` parameter can respond to cancellation:
2750
+ * - Steps can listen to the 'abort' event: `abortSignal.addEventListener('abort', callback)`
2751
+ * - Steps can check if already aborted: `if (abortSignal.aborted) { ... }`
2752
+ * - Useful for canceling timeouts, network requests, or long-running operations
2753
+ *
2754
+ * **Note:** Steps must actively check the abort signal to be canceled mid-execution.
2755
+ * Steps that don't check the signal will run to completion, but subsequent steps won't execute.
2756
+ *
2757
+ * @returns Promise that resolves with `{ message: 'Workflow run canceled' }` when cancellation succeeds
2758
+ * @throws {HTTPException} 400 - If workflow ID or run ID is missing
2759
+ * @throws {HTTPException} 404 - If workflow or workflow run is not found
2760
+ *
2761
+ * @example
2762
+ * ```typescript
2763
+ * const run = await workflow.createRun({ runId: 'run-123' });
2764
+ * await run.cancel();
2765
+ * // Returns: { message: 'Workflow run canceled' }
2766
+ * ```
2767
+ *
2768
+ * @example
2769
+ * ```typescript
2770
+ * // Example of a step that responds to cancellation
2771
+ * const step = createStep({
2772
+ * id: 'long-running-step',
2773
+ * execute: async ({ inputData, abortSignal, abort }) => {
2774
+ * const timeout = new Promise((resolve) => {
2775
+ * const timer = setTimeout(() => resolve('done'), 10000);
2776
+ *
2777
+ * // Clean up if canceled
2778
+ * abortSignal.addEventListener('abort', () => {
2779
+ * clearTimeout(timer);
2780
+ * resolve('canceled');
2781
+ * });
2782
+ * });
2783
+ *
2784
+ * const result = await timeout;
2785
+ *
2786
+ * // Check if aborted after async operation
2787
+ * if (abortSignal.aborted) {
2788
+ * return abort(); // Stop execution
2789
+ * }
2790
+ *
2791
+ * return { result };
2792
+ * }
2793
+ * });
2794
+ * ```
2795
+ */
2796
+ cancel() {
2797
+ return this.request(`/api/workflows/${this.workflowId}/runs/${this.runId}/cancel`, {
2798
+ method: "POST"
2799
+ });
2800
+ }
2698
2801
  /**
2699
2802
  * Starts a workflow run synchronously without waiting for the workflow to complete
2700
2803
  * @param params - Object containing the inputData, initialState and requestContext
@@ -2708,7 +2811,8 @@ var Run = class extends BaseResource {
2708
2811
  inputData: params?.inputData,
2709
2812
  initialState: params?.initialState,
2710
2813
  requestContext,
2711
- tracingOptions: params.tracingOptions
2814
+ tracingOptions: params.tracingOptions,
2815
+ perStep: params.perStep
2712
2816
  }
2713
2817
  });
2714
2818
  }
@@ -2721,6 +2825,7 @@ var Run = class extends BaseResource {
2721
2825
  step,
2722
2826
  resumeData,
2723
2827
  tracingOptions,
2828
+ perStep,
2724
2829
  ...rest
2725
2830
  }) {
2726
2831
  const requestContext = parseClientRequestContext(rest.requestContext);
@@ -2730,7 +2835,8 @@ var Run = class extends BaseResource {
2730
2835
  step,
2731
2836
  resumeData,
2732
2837
  requestContext,
2733
- tracingOptions
2838
+ tracingOptions,
2839
+ perStep
2734
2840
  }
2735
2841
  });
2736
2842
  }
@@ -2750,7 +2856,8 @@ var Run = class extends BaseResource {
2750
2856
  initialState: params.initialState,
2751
2857
  requestContext,
2752
2858
  tracingOptions: params.tracingOptions,
2753
- resourceId: params.resourceId
2859
+ resourceId: params.resourceId,
2860
+ perStep: params.perStep
2754
2861
  }
2755
2862
  }).then(deserializeWorkflowError);
2756
2863
  }
@@ -2772,7 +2879,8 @@ var Run = class extends BaseResource {
2772
2879
  initialState: params.initialState,
2773
2880
  requestContext,
2774
2881
  tracingOptions: params.tracingOptions,
2775
- resourceId: params.resourceId
2882
+ resourceId: params.resourceId,
2883
+ perStep: params.perStep
2776
2884
  },
2777
2885
  stream: true
2778
2886
  }
@@ -2826,7 +2934,8 @@ var Run = class extends BaseResource {
2826
2934
  requestContext,
2827
2935
  closeOnSuspend: params.closeOnSuspend,
2828
2936
  tracingOptions: params.tracingOptions,
2829
- resourceId: params.resourceId
2937
+ resourceId: params.resourceId,
2938
+ perStep: params.perStep
2830
2939
  },
2831
2940
  stream: true
2832
2941
  }
@@ -2874,7 +2983,8 @@ var Run = class extends BaseResource {
2874
2983
  step: params.step,
2875
2984
  resumeData: params.resumeData,
2876
2985
  requestContext,
2877
- tracingOptions: params.tracingOptions
2986
+ tracingOptions: params.tracingOptions,
2987
+ perStep: params.perStep
2878
2988
  }
2879
2989
  }).then(deserializeWorkflowError);
2880
2990
  }
@@ -2895,7 +3005,8 @@ var Run = class extends BaseResource {
2895
3005
  step: params.step,
2896
3006
  resumeData: params.resumeData,
2897
3007
  requestContext,
2898
- tracingOptions: params.tracingOptions
3008
+ tracingOptions: params.tracingOptions,
3009
+ perStep: params.perStep
2899
3010
  },
2900
3011
  stream: true
2901
3012
  }
@@ -3674,9 +3785,12 @@ var Observability = class extends BaseResource {
3674
3785
  return this.request(`/api/observability/traces/${traceId}`);
3675
3786
  }
3676
3787
  /**
3677
- * Retrieves paginated list of traces with optional filtering
3678
- * @param params - Parameters for pagination and filtering
3788
+ * Retrieves paginated list of traces with optional filtering.
3789
+ * This is the legacy API preserved for backward compatibility.
3790
+ *
3791
+ * @param params - Parameters for pagination and filtering (legacy format)
3679
3792
  * @returns Promise containing paginated traces and pagination info
3793
+ * @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
3680
3794
  */
3681
3795
  getTraces(params) {
3682
3796
  const { pagination, filters } = params;
@@ -3709,25 +3823,34 @@ var Observability = class extends BaseResource {
3709
3823
  const queryString = searchParams.toString();
3710
3824
  return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
3711
3825
  }
3826
+ /**
3827
+ * Retrieves paginated list of traces with optional filtering and sorting.
3828
+ * This is the new API with improved filtering options.
3829
+ *
3830
+ * @param params - Parameters for pagination, filtering, and ordering
3831
+ * @returns Promise containing paginated traces and pagination info
3832
+ */
3833
+ listTraces(params = {}) {
3834
+ const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
3835
+ return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
3836
+ }
3712
3837
  /**
3713
3838
  * Retrieves scores by trace ID and span ID
3714
3839
  * @param params - Parameters containing trace ID, span ID, and pagination options
3715
3840
  * @returns Promise containing scores and pagination info
3716
3841
  */
3717
3842
  listScoresBySpan(params) {
3718
- const { traceId, spanId, page, perPage } = params;
3719
- const searchParams = new URLSearchParams();
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();
3843
+ const { traceId, spanId, ...pagination } = params;
3844
+ const queryString = toQueryParams(pagination);
3727
3845
  return this.request(
3728
3846
  `/api/observability/traces/${encodeURIComponent(traceId)}/${encodeURIComponent(spanId)}/scores${queryString ? `?${queryString}` : ""}`
3729
3847
  );
3730
3848
  }
3849
+ /**
3850
+ * Scores one or more traces using a specified scorer.
3851
+ * @param params - Scorer name and targets to score
3852
+ * @returns Promise containing the scoring status
3853
+ */
3731
3854
  score(params) {
3732
3855
  return this.request(`/api/observability/traces/score`, {
3733
3856
  method: "POST",
@@ -4277,9 +4400,27 @@ var MastraClient = class extends BaseResource {
4277
4400
  getTrace(traceId) {
4278
4401
  return this.observability.getTrace(traceId);
4279
4402
  }
4403
+ /**
4404
+ * Retrieves paginated list of traces with optional filtering.
4405
+ * This is the legacy API preserved for backward compatibility.
4406
+ *
4407
+ * @param params - Parameters for pagination and filtering (legacy format)
4408
+ * @returns Promise containing paginated traces and pagination info
4409
+ * @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
4410
+ */
4280
4411
  getTraces(params) {
4281
4412
  return this.observability.getTraces(params);
4282
4413
  }
4414
+ /**
4415
+ * Retrieves paginated list of traces with optional filtering and sorting.
4416
+ * This is the new API with improved filtering options.
4417
+ *
4418
+ * @param params - Parameters for pagination, filtering, and ordering
4419
+ * @returns Promise containing paginated traces and pagination info
4420
+ */
4421
+ listTraces(params = {}) {
4422
+ return this.observability.listTraces(params);
4423
+ }
4283
4424
  listScoresBySpan(params) {
4284
4425
  return this.observability.listScoresBySpan(params);
4285
4426
  }
@@ -4332,6 +4473,16 @@ var MastraClient = class extends BaseResource {
4332
4473
  getStoredAgent(storedAgentId) {
4333
4474
  return new StoredAgent(this.options, storedAgentId);
4334
4475
  }
4476
+ // ============================================================================
4477
+ // System
4478
+ // ============================================================================
4479
+ /**
4480
+ * Retrieves installed Mastra packages and their versions
4481
+ * @returns Promise containing the list of installed Mastra packages
4482
+ */
4483
+ getSystemPackages() {
4484
+ return this.request("/api/system/packages");
4485
+ }
4335
4486
  };
4336
4487
 
4337
4488
  // src/tools.ts