@mastra/client-js 1.0.0-beta.13 → 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 CHANGED
@@ -1,5 +1,177 @@
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
+
78
+ ## 1.0.0-beta.14
79
+
80
+ ### Patch Changes
81
+
82
+ - feat: Add field filtering and nested workflow control to workflow execution result endpoint ([#11246](https://github.com/mastra-ai/mastra/pull/11246))
83
+
84
+ Adds two optional query parameters to `/api/workflows/:workflowId/runs/:runId/execution-result` endpoint:
85
+ - `fields`: Request only specific fields (e.g., `status`, `result`, `error`)
86
+ - `withNestedWorkflows`: Control whether to fetch nested workflow data
87
+
88
+ This significantly reduces response payload size and improves response times for large workflows.
89
+
90
+ ## Server Endpoint Usage
91
+
92
+ ```http
93
+ # Get only status (minimal payload - fastest)
94
+ GET /api/workflows/:workflowId/runs/:runId/execution-result?fields=status
95
+
96
+ # Get status and result
97
+ GET /api/workflows/:workflowId/runs/:runId/execution-result?fields=status,result
98
+
99
+ # Get all fields but without nested workflow data (faster)
100
+ GET /api/workflows/:workflowId/runs/:runId/execution-result?withNestedWorkflows=false
101
+
102
+ # Get only specific fields without nested workflow data
103
+ GET /api/workflows/:workflowId/runs/:runId/execution-result?fields=status,steps&withNestedWorkflows=false
104
+
105
+ # Get full data (default behavior)
106
+ GET /api/workflows/:workflowId/runs/:runId/execution-result
107
+ ```
108
+
109
+ ## Client SDK Usage
110
+
111
+ ```typescript
112
+ import { MastraClient } from '@mastra/client-js';
113
+
114
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
115
+ const workflow = client.getWorkflow('myWorkflow');
116
+
117
+ // Get only status (minimal payload - fastest)
118
+ const statusOnly = await workflow.runExecutionResult(runId, {
119
+ fields: ['status'],
120
+ });
121
+ console.log(statusOnly.status); // 'success' | 'failed' | 'running' | etc.
122
+
123
+ // Get status and result
124
+ const statusAndResult = await workflow.runExecutionResult(runId, {
125
+ fields: ['status', 'result'],
126
+ });
127
+
128
+ // Get all fields but without nested workflow data (faster)
129
+ const resultWithoutNested = await workflow.runExecutionResult(runId, {
130
+ withNestedWorkflows: false,
131
+ });
132
+
133
+ // Get specific fields without nested workflow data
134
+ const optimized = await workflow.runExecutionResult(runId, {
135
+ fields: ['status', 'steps'],
136
+ withNestedWorkflows: false,
137
+ });
138
+
139
+ // Get full execution result (default behavior)
140
+ const fullResult = await workflow.runExecutionResult(runId);
141
+ ```
142
+
143
+ ## Core API Changes
144
+
145
+ The `Workflow.getWorkflowRunExecutionResult` method now accepts an options object:
146
+
147
+ ```typescript
148
+ await workflow.getWorkflowRunExecutionResult(runId, {
149
+ withNestedWorkflows: false, // default: true, set to false to skip nested workflow data
150
+ fields: ['status', 'result'], // optional field filtering
151
+ });
152
+ ```
153
+
154
+ ## Inngest Compatibility
155
+
156
+ The `@mastra/inngest` package has been updated to use the new options object API. This is a non-breaking internal change - no action required from inngest workflow users.
157
+
158
+ ## Performance Impact
159
+
160
+ For workflows with large step outputs:
161
+ - Requesting only `status`: ~99% reduction in payload size
162
+ - Requesting `status,result,error`: ~95% reduction in payload size
163
+ - Using `withNestedWorkflows=false`: Avoids expensive nested workflow data fetching
164
+ - Combining both: Maximum performance optimization
165
+
166
+ - Fix delayed promises rejecting when stream suspends on tool-call-approval ([#11278](https://github.com/mastra-ai/mastra/pull/11278))
167
+
168
+ When a stream ends in suspended state (e.g., requiring tool approval), the delayed promises like `toolResults`, `toolCalls`, `text`, etc. now resolve with partial results instead of rejecting with an error. This allows consumers to access data that was produced before the suspension.
169
+
170
+ Also improves generic type inference for `LLMStepResult` and related types throughout the streaming infrastructure.
171
+
172
+ - Updated dependencies [[`4f94ed8`](https://github.com/mastra-ai/mastra/commit/4f94ed8177abfde3ec536e3574883e075423350c), [`ac3cc23`](https://github.com/mastra-ai/mastra/commit/ac3cc2397d1966bc0fc2736a223abc449d3c7719), [`a86f4df`](https://github.com/mastra-ai/mastra/commit/a86f4df0407311e0d2ea49b9a541f0938810d6a9), [`029540c`](https://github.com/mastra-ai/mastra/commit/029540ca1e582fc2dd8d288ecd4a9b0f31a954ef), [`66741d1`](https://github.com/mastra-ai/mastra/commit/66741d1a99c4f42cf23a16109939e8348ac6852e), [`01b20fe`](https://github.com/mastra-ai/mastra/commit/01b20fefb7c67c2b7d79417598ef4e60256d1225), [`0dbf199`](https://github.com/mastra-ai/mastra/commit/0dbf199110f22192ce5c95b1c8148d4872b4d119), [`a7ce182`](https://github.com/mastra-ai/mastra/commit/a7ce1822a8785ce45d62dd5c911af465e144f7d7)]:
173
+ - @mastra/core@1.0.0-beta.14
174
+
3
175
  ## 1.0.0-beta.13
4
176
 
5
177
  ### 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,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,EAChC,oBAAoB,EACpB,gCAAgC,EAChC,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,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AE,0BAA0B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAiB/F;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOrE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI/C;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAI7E;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,GAAE,cAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIpE,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI7E,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
  }
@@ -3079,13 +3123,26 @@ var Workflow = class extends BaseResource {
3079
3123
  /**
3080
3124
  * Retrieves the execution result for a specific workflow run by its ID
3081
3125
  * @param runId - The ID of the workflow run to retrieve the execution result for
3082
- * @param requestContext - Optional request context to pass as query parameter
3126
+ * @param options - Optional configuration
3127
+ * @param options.requestContext - Optional request context to pass as query parameter
3128
+ * @param options.fields - Optional array of fields to return (e.g., ['status', 'result']). Available fields: status, result, error, payload, steps, activeStepsPath, serializedStepGraph. Omitting this returns all fields.
3129
+ * @param options.withNestedWorkflows - Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance when you don't need nested workflow details.
3083
3130
  * @returns Promise containing the workflow run execution result
3084
3131
  */
3085
- runExecutionResult(runId, requestContext) {
3086
- return this.request(
3087
- `/api/workflows/${this.workflowId}/runs/${runId}/execution-result${requestContextQueryString(requestContext)}`
3088
- );
3132
+ runExecutionResult(runId, options) {
3133
+ const searchParams = new URLSearchParams();
3134
+ if (options?.fields && options.fields.length > 0) {
3135
+ searchParams.set("fields", options.fields.join(","));
3136
+ }
3137
+ if (options?.withNestedWorkflows !== void 0) {
3138
+ searchParams.set("withNestedWorkflows", String(options.withNestedWorkflows));
3139
+ }
3140
+ const requestContextParam = base64RequestContext(parseClientRequestContext(options?.requestContext));
3141
+ if (requestContextParam) {
3142
+ searchParams.set("requestContext", requestContextParam);
3143
+ }
3144
+ const queryString = searchParams.size > 0 ? `?${searchParams.toString()}` : "";
3145
+ return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/execution-result${queryString}`);
3089
3146
  }
3090
3147
  /**
3091
3148
  * Creates a new workflow run
@@ -3661,9 +3718,12 @@ var Observability = class extends BaseResource {
3661
3718
  return this.request(`/api/observability/traces/${traceId}`);
3662
3719
  }
3663
3720
  /**
3664
- * Retrieves paginated list of traces with optional filtering
3665
- * @param params - Parameters for pagination and filtering
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)
3666
3725
  * @returns Promise containing paginated traces and pagination info
3726
+ * @deprecated Use {@link listTraces} instead for new features like ordering and more filters.
3667
3727
  */
3668
3728
  getTraces(params) {
3669
3729
  const { pagination, filters } = params;
@@ -3696,25 +3756,34 @@ var Observability = class extends BaseResource {
3696
3756
  const queryString = searchParams.toString();
3697
3757
  return this.request(`/api/observability/traces${queryString ? `?${queryString}` : ""}`);
3698
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
+ }
3699
3770
  /**
3700
3771
  * Retrieves scores by trace ID and span ID
3701
3772
  * @param params - Parameters containing trace ID, span ID, and pagination options
3702
3773
  * @returns Promise containing scores and pagination info
3703
3774
  */
3704
3775
  listScoresBySpan(params) {
3705
- const { traceId, spanId, page, perPage } = params;
3706
- const searchParams = new URLSearchParams();
3707
- if (page !== void 0) {
3708
- searchParams.set("page", String(page));
3709
- }
3710
- if (perPage !== void 0) {
3711
- searchParams.set("perPage", String(perPage));
3712
- }
3713
- const queryString = searchParams.toString();
3776
+ const { traceId, spanId, ...pagination } = params;
3777
+ const queryString = toQueryParams(pagination);
3714
3778
  return this.request(
3715
3779
  `/api/observability/traces/${encodeURIComponent(traceId)}/${encodeURIComponent(spanId)}/scores${queryString ? `?${queryString}` : ""}`
3716
3780
  );
3717
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
+ */
3718
3787
  score(params) {
3719
3788
  return this.request(`/api/observability/traces/score`, {
3720
3789
  method: "POST",
@@ -4264,9 +4333,27 @@ var MastraClient = class extends BaseResource {
4264
4333
  getTrace(traceId) {
4265
4334
  return this.observability.getTrace(traceId);
4266
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
+ */
4267
4344
  getTraces(params) {
4268
4345
  return this.observability.getTraces(params);
4269
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
+ }
4270
4357
  listScoresBySpan(params) {
4271
4358
  return this.observability.listScoresBySpan(params);
4272
4359
  }
@@ -4319,6 +4406,16 @@ var MastraClient = class extends BaseResource {
4319
4406
  getStoredAgent(storedAgentId) {
4320
4407
  return new StoredAgent(this.options, storedAgentId);
4321
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
+ }
4322
4419
  };
4323
4420
 
4324
4421
  // src/tools.ts