@mastra/client-js 1.54.1-alpha.2 → 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.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-client-js-observability.md +2 -2
- package/dist/docs/references/reference-observability-tracing-trace-query.md +19 -15
- package/dist/route-types.generated.d.ts +18 -0
- package/dist/route-types.generated.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.
|
|
6
|
+
version: "1.54.1-alpha.3"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -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
|
|
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
|
|
|
@@ -67,7 +67,7 @@ It accepts the same filtering, ordering and delta-polling arguments as `listTrac
|
|
|
67
67
|
|
|
68
68
|
## Querying traces
|
|
69
69
|
|
|
70
|
-
`queryTraces()` finds completed logical traces using trace fields and conditions over related spans. Every query requires an ISO timestamp range
|
|
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({
|
|
@@ -8,7 +8,7 @@ Use `queryTraces()`, `mastra api trace query`, or `POST /api/observability/trace
|
|
|
8
8
|
|
|
9
9
|
For example, find traces with a failed tool call or a duration above a threshold. Each result represents a trace. Use its `traceId` to [retrieve the full trace](https://mastra.ai/reference/client-js/observability).
|
|
10
10
|
|
|
11
|
-
The endpoint uses the same authentication as other observability routes and requires the `observability:read` permission. The configured observability store must support trace queries. Every query requires a time range
|
|
11
|
+
The endpoint uses the same authentication as other observability routes and requires the `observability:read` permission. The configured observability store must support trace queries. Every query requires a time range.
|
|
12
12
|
|
|
13
13
|
For hosted traces, see [Query observability data on Mastra Platform](https://mastra.ai/docs/mastra-platform/observability) for project credentials and regional endpoints.
|
|
14
14
|
|
|
@@ -74,14 +74,19 @@ mastra api --url http://localhost:4111 trace query '{
|
|
|
74
74
|
|
|
75
75
|
The explicit `--url` targets a local Mastra server. Without it, observability commands default to `https://observability.mastra.ai`, even when a local server is running. See [CLI target resolution](https://mastra.ai/reference/cli/mastra) for authentication and regional endpoints. The target server and configured store must support the requested query capabilities.
|
|
76
76
|
|
|
77
|
-
Inspect the command
|
|
77
|
+
Inspect the command with:
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
80
|
mastra api trace query --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
For a local Mastra server, inspect its request and response schemas with:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
81
86
|
mastra api --url http://localhost:4111 trace query --schema
|
|
82
87
|
```
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
Mastra Platform doesn't currently expose the schema endpoint used by `--schema`. Use [Request fields](#request-fields) and [Fields and operators](#fields-and-operators) to construct queries for either target. To find fields and values recorded in your project, use [field and value discovery](#discover-fields-and-values).
|
|
85
90
|
|
|
86
91
|
## Send an HTTP request
|
|
87
92
|
|
|
@@ -115,16 +120,16 @@ curl --request POST \
|
|
|
115
120
|
|
|
116
121
|
## Request fields
|
|
117
122
|
|
|
118
|
-
| Field | Required | Description
|
|
119
|
-
| ------------ | -------- |
|
|
120
|
-
| `timeRange` | Yes | Trace start-time boundary. `from` is inclusive and `to` is exclusive. Both values must be ISO timestamps, `from` must be earlier than `to
|
|
121
|
-
| `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses.
|
|
122
|
-
| `orderBy` | No | One item ordering results by `startedAt` or `endedAt`, in `asc` or `desc` order. Defaults to `startedAt desc`. Not accepted in delta mode.
|
|
123
|
-
| `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`.
|
|
124
|
-
| `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100.
|
|
125
|
-
| `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`.
|
|
126
|
-
| `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark.
|
|
127
|
-
| `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100.
|
|
123
|
+
| Field | Required | Description |
|
|
124
|
+
| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| `timeRange` | Yes | Trace start-time boundary. `from` is inclusive and `to` is exclusive. Both values must be ISO timestamps, and `from` must be earlier than `to`. |
|
|
126
|
+
| `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses. |
|
|
127
|
+
| `orderBy` | No | One item ordering results by `startedAt` or `endedAt`, in `asc` or `desc` order. Defaults to `startedAt desc`. Not accepted in delta mode. |
|
|
128
|
+
| `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`. |
|
|
129
|
+
| `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100. |
|
|
130
|
+
| `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`. |
|
|
131
|
+
| `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark. |
|
|
132
|
+
| `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100. |
|
|
128
133
|
|
|
129
134
|
Unknown fields are rejected. Requests can't select a projection, declare joins, request counts or measures, or control authorization. Request bodies are limited to 256 KiB.
|
|
130
135
|
|
|
@@ -134,7 +139,6 @@ The planner rejects a query before storage execution when it exceeds any of thes
|
|
|
134
139
|
|
|
135
140
|
| Input | Maximum |
|
|
136
141
|
| ----------------------------------------- | ----------------- |
|
|
137
|
-
| Trace selection `timeRange` | 31 days |
|
|
138
142
|
| Predicate nesting depth | 12 levels |
|
|
139
143
|
| Predicate nodes | 100 |
|
|
140
144
|
| Related `spans` clauses | 8 total |
|
|
@@ -594,7 +598,7 @@ Value suggestions are available for these canonical fields:
|
|
|
594
598
|
|
|
595
599
|
Each executable top-level string `metadata.<key>` field also supports value suggestions in the `trace` scope. Identifiers, timestamps, durations, errors, and version IDs don't. The fields response still includes canonical fields with `valueSuggestions: false`. The values endpoint rejects those paths with `422 TRACE_QUERY_INVALID`.
|
|
596
600
|
|
|
597
|
-
Both discovery requests require a half-open time range
|
|
601
|
+
Both discovery requests require a half-open time range. They use the same current-record semantics as `queryTraces()`: qualifying completed roots satisfy `from <= startedAt < to`, and related values come only from current records joined to those roots by `traceId`. Discovery doesn't accept or apply a draft `where` predicate.
|
|
598
602
|
|
|
599
603
|
`search` defaults to the empty string, is trimmed, and matches case-insensitive literal substrings. Characters such as `%` and `_` have no wildcard meaning. An empty search returns the most frequent results. `limit` defaults to 25 and has a maximum of 100. Both endpoints fetch one extra result to set their truncation flag, but don't provide a cursor. When a flag is `true`, refine `search`. It doesn't imply that a next page is available. No matches return an empty array and `false` truncation.
|
|
600
604
|
|
|
@@ -2548,6 +2548,12 @@ type Shared_Type_61 = {
|
|
|
2548
2548
|
requestContext?: ({
|
|
2549
2549
|
[key: string]: unknown;
|
|
2550
2550
|
} | null) | undefined;
|
|
2551
|
+
/** Short text preview of the span input */
|
|
2552
|
+
inputPreview?: (string | null) | undefined;
|
|
2553
|
+
/** Short text preview of the span output */
|
|
2554
|
+
outputPreview?: (string | null) | undefined;
|
|
2555
|
+
/** Short text preview of the span error */
|
|
2556
|
+
errorPreview?: (string | null) | undefined;
|
|
2551
2557
|
/** Database record creation time */
|
|
2552
2558
|
createdAt: Date;
|
|
2553
2559
|
/** Database record last update time */
|
|
@@ -2581,6 +2587,8 @@ type Shared_Type_62 = {
|
|
|
2581
2587
|
[key: string]: unknown;
|
|
2582
2588
|
} | null) | undefined;
|
|
2583
2589
|
inputPreview?: (string | null) | undefined;
|
|
2590
|
+
outputPreview?: (string | null) | undefined;
|
|
2591
|
+
errorPreview?: (string | null) | undefined;
|
|
2584
2592
|
/** Database record creation time */
|
|
2585
2593
|
createdAt: Date;
|
|
2586
2594
|
/** Database record last update time */
|
|
@@ -2643,6 +2651,12 @@ type Shared_Type_63 = {
|
|
|
2643
2651
|
requestContext?: ({
|
|
2644
2652
|
[key: string]: unknown;
|
|
2645
2653
|
} | null) | undefined;
|
|
2654
|
+
/** Short text preview of the span input */
|
|
2655
|
+
inputPreview?: (string | null) | undefined;
|
|
2656
|
+
/** Short text preview of the span output */
|
|
2657
|
+
outputPreview?: (string | null) | undefined;
|
|
2658
|
+
/** Short text preview of the span error */
|
|
2659
|
+
errorPreview?: (string | null) | undefined;
|
|
2646
2660
|
/** Database record creation time */
|
|
2647
2661
|
createdAt: Date;
|
|
2648
2662
|
/** Database record last update time */
|
|
@@ -2659,6 +2673,8 @@ type Shared_Type_64 = {
|
|
|
2659
2673
|
[key: string]: unknown;
|
|
2660
2674
|
} | null;
|
|
2661
2675
|
inputPreview: string | null;
|
|
2676
|
+
outputPreview: string | null;
|
|
2677
|
+
errorPreview: string | null;
|
|
2662
2678
|
threadId: string | null;
|
|
2663
2679
|
resourceId: string | null;
|
|
2664
2680
|
startedAt: string;
|
|
@@ -8184,6 +8200,8 @@ export type PostObservabilitySpansQuery_Response = {
|
|
|
8184
8200
|
inputTruncated: boolean;
|
|
8185
8201
|
outputPreview: string | null;
|
|
8186
8202
|
outputTruncated: boolean;
|
|
8203
|
+
errorPreview: string | null;
|
|
8204
|
+
errorTruncated: boolean;
|
|
8187
8205
|
cost: {
|
|
8188
8206
|
state: 'available';
|
|
8189
8207
|
amount: number;
|