@mastra/client-js 1.54.1-alpha.1 → 1.54.1-alpha.3

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.
@@ -3,7 +3,7 @@ name: mastra-client-js
3
3
  description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/client-js"
6
- version: "1.54.1-alpha.1"
6
+ version: "1.54.1-alpha.3"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -54,7 +54,7 @@ Read the individual reference documents for detailed explanations and code examp
54
54
  - [Reference: Versioning](references/reference-editor-versioning.md) - Editor versions stored agents and prompt blocks. Database-backed resources use draft and publish operations.
55
55
  - [Client SDK](references/reference-migrations-upgrade-to-v1-client.md) - Client SDK changes align with server-side API updates, including utility renames, updated pagination, and type naming conventions.
56
56
  - [Reference: Metric queries](references/reference-observability-metrics-queries.md) - Metric queries read raw and aggregated metric data from the observability storage domain. For exporter and storage setup, see the Metrics overview.
57
- - [Advanced trace queries](references/reference-observability-tracing-trace-query.md) - Query completed traces, thread identities, and spans with recursive predicates, numbered pages, keyset cursors, and delta polling.
57
+ - [Trace queries](references/reference-observability-tracing-trace-query.md) - Find completed traces by trace fields and related spans. Filter results, paginate, poll for updates, and discover query fields.
58
58
 
59
59
 
60
60
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.54.1-alpha.1",
2
+ "version": "1.54.1-alpha.3",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -45,7 +45,7 @@ const completeTrace = await mastraClient.getTrace(traces.spans[0].traceId)
45
45
 
46
46
  ## Listing traces for a list view
47
47
 
48
- `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries a short `inputPreview` string instead, so a list can render a preview column without transferring the whole prompt, plus `threadId` and `resourceId` for the memory context columns.
48
+ `listTracesLight()` returns the same rows as a trace list, without the `input`, `output` and `attributes` payloads. Each row carries short `inputPreview`, `outputPreview` and `errorPreview` strings instead (at most 100 characters, ending with `…` when cut), so a list can render preview columns without transferring the whole payload, plus `threadId` and `resourceId` for the memory context columns.
49
49
 
50
50
  Prefer it whenever you are rendering many traces at once, and fetch the full record only when a row is opened:
51
51
 
@@ -65,9 +65,9 @@ const selected = await mastraClient.getTrace(list.spans[0].traceId)
65
65
 
66
66
  It accepts the same filtering, ordering and delta-polling arguments as `listTraces()`. Use `listTraces()` when you actually need the full span payloads.
67
67
 
68
- ## Querying traces and threads
68
+ ## Querying traces
69
69
 
70
- `queryTraces()` finds completed logical traces using trace fields and conditions over related spans, scores, or feedback. Every query requires an ISO timestamp range of at most 31 days.
70
+ `queryTraces()` finds completed logical traces using trace fields and conditions over related spans. Every query requires an ISO timestamp range.
71
71
 
72
72
  ```typescript
73
73
  const result = await mastraClient.queryTraces({
@@ -76,12 +76,12 @@ const result = await mastraClient.queryTraces({
76
76
  to: '2026-08-08T00:00:00.000Z',
77
77
  },
78
78
  where: {
79
- scores: {
79
+ spans: {
80
80
  some: {
81
81
  op: 'and',
82
82
  args: [
83
- { op: 'eq', left: { path: 'scorerId' }, right: { literal: 'factuality' } },
84
- { op: 'lt', left: { path: 'score' }, right: { literal: 0.6 } },
83
+ { op: 'eq', left: { path: 'spanType' }, right: { literal: 'tool_call' } },
84
+ { op: 'exists', path: 'error' },
85
85
  ],
86
86
  },
87
87
  },
@@ -89,6 +89,8 @@ const result = await mastraClient.queryTraces({
89
89
  })
90
90
  ```
91
91
 
92
+ See [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for request fields, predicates, limits, response shapes, and errors.
93
+
92
94
  ### Load a page and poll for traces
93
95
 
94
96
  `queryTraces()` supports keyset traversal with `page`, numbered pages with `pagination`, and delta polling with `mode: 'delta'`. Use one mode per request. To migrate from `listTracesLight()`, read `traces` instead of `spans` and retain the numbered page's `deltaCursor`:
@@ -114,7 +116,7 @@ const changes = await mastraClient.queryTraces({
114
116
 
115
117
  Merge `changes.traces` by `traceId`, retain `changes.deltaCursor`, and continue while `changes.delta.hasMore` is `true`. Keep the same time range and predicate across polls. Only completed traces are returned; polling doesn't guarantee notifications for related-record updates, deletions, or traces that stop matching.
116
118
 
117
- See [Delta polling](https://mastra.ai/reference/observability/tracing/trace-query) for bootstrap behavior, cursor lifetime, retention, and a complete polling loop. `queryTraceThreads()` remains keyset-only.
119
+ See [Delta polling](https://mastra.ai/reference/observability/tracing/trace-query) for bootstrap behavior, cursor lifetime, retention, and a complete polling loop.
118
120
 
119
121
  ### Discover trace-query fields and values
120
122
 
@@ -134,7 +136,7 @@ const fields = await mastraClient.getTraceQueryFields({
134
136
  })
135
137
  ```
136
138
 
137
- Use the exact local path from the response with the same scope. For example, `model` belongs inside a `spans.some` or `spans.none` predicate. A global picker can fetch `trace`, `spans`, `scores`, and `feedback` in parallel.
139
+ Use the exact local path from the response with the same scope. For example, `model` belongs inside a `spans.some` or `spans.none` predicate. A field picker can fetch the `trace` and `spans` scopes in parallel.
138
140
 
139
141
  Call `getTraceQueryValues()` only after selecting a field with `valueSuggestions: true`:
140
142
 
@@ -162,89 +164,6 @@ Suggestions are bounded and advisory. Manual values remain valid when suggestion
162
164
 
163
165
  A discovery timeout rejects with `504 TRACE_QUERY_EXECUTION_TIMEOUT`. Backend memory or resource exhaustion rejects with `503 TRACE_QUERY_RESOURCE_LIMIT`. Neither error contains partial suggestions; truncation flags are only present on successful, completely ranked responses.
164
166
 
165
- `queryTraceThreads()` returns thread identities derived from observability traces after applying eligibility and cross-trace conditions. It doesn't read or return memory thread records or messages. In this example, one production trace can have the low factuality score while another production trace in the same thread has the clinician correction:
166
-
167
- ```typescript
168
- const result = await mastraClient.queryTraceThreads({
169
- traces: {
170
- timeRange: {
171
- from: '2026-08-01T00:00:00.000Z',
172
- to: '2026-08-08T00:00:00.000Z',
173
- },
174
- where: {
175
- op: 'eq',
176
- left: { path: 'environment' },
177
- right: { literal: 'production' },
178
- },
179
- },
180
- where: {
181
- op: 'and',
182
- args: [
183
- {
184
- traces: {
185
- some: {
186
- scores: {
187
- some: {
188
- op: 'lt',
189
- left: { path: 'score' },
190
- right: { literal: 0.6 },
191
- },
192
- },
193
- },
194
- },
195
- },
196
- {
197
- traces: {
198
- some: {
199
- feedback: {
200
- some: {
201
- op: 'eq',
202
- left: { path: 'feedbackType' },
203
- right: { literal: 'clinician-correction' },
204
- },
205
- },
206
- },
207
- },
208
- },
209
- ],
210
- },
211
- })
212
-
213
- // { threads: [{ threadId: 'thread-123' }], page: { next: null } }
214
- ```
215
-
216
- The API limits predicate depth, nodes, related clauses, set members, literal bytes, and the total literal budget before storage execution. Cursor pages are deterministic but aren't a database snapshot, so signals written between requests can change later pages. PostgreSQL and ClickHouse trace and thread queries have a configurable 15-second execution timeout.
217
-
218
- See [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query) for the complete limits, request fields, predicates, thread qualification semantics, cursor pagination, response shapes, and errors.
219
-
220
- ## Querying spans
221
-
222
- `querySpans()` returns one row per matching completed span across traces. Use it to list the spans themselves. `queryTraces()` with a `spans.some` predicate returns the traces that contain a matching span instead. Every query requires an ISO timestamp range of at most 31 days.
223
-
224
- ```typescript
225
- const result = await mastraClient.querySpans({
226
- timeRange: {
227
- from: '2026-10-01T00:00:00.000Z',
228
- to: '2026-10-02T00:00:00.000Z',
229
- },
230
- where: {
231
- op: 'eq',
232
- left: { path: 'spanType' },
233
- right: { literal: 'tool_call' },
234
- },
235
- orderBy: [{ field: 'startedAt', direction: 'desc' }],
236
- page: { limit: 50 },
237
- })
238
-
239
- // { spans: [{ traceId, spanId, name, spanType, status, durationMs, cost, ... }], page: { next } }
240
- ```
241
-
242
- Pass `result.page.next` back as `page.after` with the same time range, filter, and ordering to load the next page. Each row contains identifiers, display fields, input and output previews, and the span's model cost. Use `getSpan()` to load the full span.
243
-
244
- Span queries are optional for observability stores. Check `capabilities.spanQuery` from `getObservabilityCapabilities()` before calling `querySpans()`, and treat a missing value as unsupported. Unsupported servers reject with `501 SPAN_QUERY_UNSUPPORTED`.
245
-
246
- See [Query individual spans](https://mastra.ai/reference/observability/tracing/trace-query) for filters, ordering, cursors, cost states, limits, and errors.
247
-
248
167
  ## Deleting traces
249
168
 
250
169
  Delete traces and their associated spans, metrics, logs, scores, and feedback:
@@ -393,7 +312,7 @@ const ratingPercentiles = await mastraClient.getFeedbackPercentiles({
393
312
 
394
313
  ## Related
395
314
 
396
- - [Advanced trace queries](https://mastra.ai/reference/observability/tracing/trace-query): Query completed traces with recursive predicates
315
+ - [Trace queries](https://mastra.ai/reference/observability/tracing/trace-query): Query completed traces with recursive predicates
397
316
  - [Feedback guide](https://mastra.ai/docs/observability/feedback): Learn how to create, list, and query feedback
398
317
  - [Feedback reference](https://mastra.ai/reference/observability/feedback): Review feedback schemas and HTTP routes
399
318
  - [Agents API](https://mastra.ai/reference/client-js/agents): Learn about agent interactions that generate traces