@mastra/client-js 1.52.0 → 1.53.0-alpha.0

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.52.0"
6
+ version: "1.53.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.52.0",
2
+ "version": "1.53.0-alpha.0",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -80,9 +80,11 @@ The second parameter is an options object:
80
80
 
81
81
  **sendSources** (`boolean`): (Agent only) Whether to include source citations in the output. (Default: `false`)
82
82
 
83
+ **includeSubAgentMetadata** (`boolean`): (Agent only) Whether to stream sub-agent progress as data-tool-agent and data-tool-agent-step parts when the agent delegates to sub-agents. handleChatStream() and chatRoute() enable this by default. (Default: `false`)
84
+
83
85
  **includeTextStreamParts** (`boolean`): (Workflow only) Whether to include text stream parts in the output. (Default: `true`)
84
86
 
85
- **messageMetadata** (`(options: { part: UIMessageStreamPart }) => Record<string, unknown> | undefined`): (Agent only) A function that receives the current stream part and returns metadata to attach to start and finish chunks.
87
+ **messageMetadata** (`(options: { part: UIMessageStreamPart; traceId?: string }) => Record<string, unknown> | undefined`): (Agent only) A function that receives the current stream part and returns metadata to attach to start and finish chunks. Also receives the run's traceId (undefined when tracing is disabled), so you can return it as metadata, for example ({ part, traceId }) => (part.type === 'start' ? { traceId } : undefined).
86
88
 
87
89
  **onError** (`(error: unknown) => string`): (Agent only) A function to handle errors during stream conversion. Receives the error and should return a string representation.
88
90
 
@@ -394,25 +394,26 @@ Hono and Fastify enforce the request-body limit before JSON parsing. Express and
394
394
 
395
395
  ## Fields and operators
396
396
 
397
- | Predicate context | Fields | Operators |
398
- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
399
- | Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
400
- | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
401
- | Trace | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
402
- | Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
403
- | Span | `name`, `spanType`, `model`, `provider`, `status`, `entityType`, `entityId`, `entityName`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId`, `runId`, `sessionId`, `userId`, `organizationId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
404
- | Span | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
405
- | Span | `error` | `exists`, `notExists` |
406
- | Score | `scorerId`, `scorerVersion`, `scoreSource`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
407
- | Score | `score`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
408
- | Score | `spanId` | `exists`, `notExists` |
409
- | Feedback | `feedbackType`, `feedbackSource`, `feedbackUserId`, `sourceId`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
410
- | Feedback | `value`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
411
- | Feedback | `comment` | `exists`, `notExists` |
412
-
413
- Compose predicates with `{ op: 'and', args: [...] }`, `{ op: 'or', args: [...] }`, and `{ op: 'not', arg: ... }`. Comparison predicates place a field reference on the left and a literal on the right. Membership predicates use a field reference in `value` and a homogeneous literal array in `set`. Tag predicates name the stored tag collection in `path`. `includes` and `notIncludes` also take one tag in `value`, while `exists` and `notExists` take only `op` and `path`. See [Filter by tags](#filter-by-tags).
414
-
415
- String comparisons are case-sensitive, and literals are never coerced. Canonical string fields compare exact stored values. Metadata string values are trimmed before comparison, as described below. Numeric predicates, including `score` and `durationMs`, require numbers, while timestamp predicates require ISO timestamp strings. A missing value satisfies neither positive nor ordered predicates, although it does satisfy the negative operators `ne` and `notIn`. Combine a negative predicate with `exists` when the field must also be present.
397
+ | Predicate context | Fields | Operators |
398
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
399
+ | Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityName`, `entityType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
400
+ | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
401
+ | Trace | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
402
+ | Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
403
+ | Span | `name` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists`, `matches`, `notMatches` |
404
+ | Span | `spanType`, `model`, `provider`, `status`, `entityType`, `entityId`, `entityName`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId`, `runId`, `sessionId`, `userId`, `organizationId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
405
+ | Span | `startedAt`, `endedAt`, `durationMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
406
+ | Span | `error` | `exists`, `notExists` |
407
+ | Score | `scorerId`, `scorerVersion`, `scoreSource`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
408
+ | Score | `score`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
409
+ | Score | `spanId` | `exists`, `notExists` |
410
+ | Feedback | `feedbackType`, `feedbackSource`, `feedbackUserId`, `sourceId`, `entityVersionId`, `parentEntityVersionId`, `rootEntityVersionId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
411
+ | Feedback | `value`, `timestamp` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
412
+ | Feedback | `comment` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists`, `matches`, `notMatches` |
413
+
414
+ Compose predicates with `{ op: 'and', args: [...] }`, `{ op: 'or', args: [...] }`, and `{ op: 'not', arg: ... }`. Comparison predicates place a field reference on the left and a literal on the right. Membership predicates use a field reference in `value` and a homogeneous literal array in `set`. Tag predicates name the stored tag collection in `path`. `includes` and `notIncludes` also take one tag in `value`, while `exists` and `notExists` take only `op` and `path`. See [Filter by tags](#filter-by-tags). Text predicates use the comparison shape with a string literal. See [Filter by text](#filter-by-text).
415
+
416
+ String comparisons are case-sensitive, and literals are never coerced. `matches` and `notMatches` are the exception: they compare words case-insensitively. Canonical string fields compare exact stored values. Metadata string values are trimmed before comparison, as described below. Numeric predicates, including `score` and `durationMs`, require numbers, while timestamp predicates require ISO timestamp strings. A missing value satisfies neither positive nor ordered predicates, although it does satisfy the negative operators `ne` and `notIn`. Combine a negative predicate with `exists` when the field must also be present.
416
417
 
417
418
  ### Filter by root duration
418
419
 
@@ -631,6 +632,31 @@ Tags compare exactly and case-sensitively as whole strings. `value` must be one
631
632
 
632
633
  `tags` is available in trace predicates only, including those inside `traces.some` or `traces.none`. `in`, `notIn`, and the comparison operators are rejected for `tags`. Value discovery for `tags` returns each observed tag with the number of qualifying traces that carry it.
633
634
 
635
+ ### Filter by text
636
+
637
+ Human-written text fields support word matching in addition to exact comparison. `matches` succeeds when the literal's words appear in the field, in order, as whole words. `notMatches` succeeds when the field exists but doesn't contain those words. This query finds traces whose current feedback mentions an incorrect dosage:
638
+
639
+ ```typescript
640
+ const incorrectDosage = {
641
+ feedback: {
642
+ some: {
643
+ op: 'matches',
644
+ left: { path: 'comment' },
645
+ right: { literal: 'incorrect dosage' },
646
+ },
647
+ },
648
+ }
649
+ ```
650
+
651
+ Both the literal and the stored value are lowercased and split into words. A word is a run of letters, digits, and combining marks, so any other character, such as punctuation, spaces, or `_`, separates words. `incorrect` matches `This answer is incorrect.` but not `This was incorrectly formatted.`, and `gpt 5` matches `llm: 'gpt-5'`. A literal with several words must appear as a contiguous phrase in that order. Letters keep their accents: `café` doesn't match `cafe`. Text is composed to Unicode NFC first, so `café` matches whether the accent is stored as part of the letter or as a separate mark, and marks stay inside their word, so `नमस` doesn't match `नमस्ते`. The Turkish `İ` folds to `i`, and a Greek final `ς` equals `σ`. PostgreSQL lowercases letters according to the database locale, so a database created with the `C` locale doesn't fold the case of letters outside ASCII. Use a UTF-8 locale such as `en_US.UTF-8` for consistent results.
652
+
653
+ | Operator | Matches when |
654
+ | ------------ | ------------------------------------------------------------------------ |
655
+ | `matches` | The field contains the literal's words as a contiguous whole-word phrase |
656
+ | `notMatches` | The field is present and doesn't contain that phrase |
657
+
658
+ The literal must contain at least one letter or digit; otherwise the request fails with `422 TRACE_QUERY_INVALID`. A missing field satisfies neither operator. Use `{ op: 'not', arg: { op: 'matches', ... } }` when records without the field should also match. Text operators are available on span `name` and feedback `comment`. Other string fields, numbers, timestamps, tags, and metadata reject them. Substring, wildcard, regular-expression, and fuzzy matching aren't supported, and there is no search across several fields.
659
+
634
660
  ### Filter by feedback
635
661
 
636
662
  Every condition inside one `feedback.some` or `feedback.none` clause applies to the same current feedback record. `feedbackType` and `feedbackSource` are exact application-defined strings rather than built-in enums. This query finds traces with a numeric patient rating below zero:
@@ -668,7 +694,7 @@ const missingClinicianReview = {
668
694
  }
669
695
  ```
670
696
 
671
- Feedback `timestamp` predicates are independent of the root `timeRange`. Use `comment` only with `exists` or `notExists`. Comment contents aren't searchable. The deprecated feedback fields `source` and `userId` aren't available. Use `feedbackSource` and `feedbackUserId`.
697
+ Feedback `timestamp` predicates are independent of the root `timeRange`. `comment` supports exact string operators and word matching with `matches` and `notMatches`. See [Filter by text](#filter-by-text). The deprecated feedback fields `source` and `userId` aren't available. Use `feedbackSource` and `feedbackUserId`.
672
698
 
673
699
  ## Responses
674
700
 
@@ -37,6 +37,14 @@ type InputShared_Auxiliary_204 = {
37
37
  op: 'includes' | 'notIncludes';
38
38
  path: string;
39
39
  value: string;
40
+ } | {
41
+ op: 'matches' | 'notMatches';
42
+ left: {
43
+ path: string;
44
+ };
45
+ right: {
46
+ literal: string;
47
+ };
40
48
  } | {
41
49
  op: 'and' | 'or';
42
50
  args: InputShared_Auxiliary_204[];
@@ -45,24 +53,24 @@ type InputShared_Auxiliary_204 = {
45
53
  arg: InputShared_Auxiliary_204;
46
54
  } | {
47
55
  spans: {
48
- some: InputShared_Auxiliary_223;
56
+ some: InputShared_Auxiliary_227;
49
57
  } | {
50
- none: InputShared_Auxiliary_223;
58
+ none: InputShared_Auxiliary_227;
51
59
  };
52
60
  } | {
53
61
  scores: {
54
- some: InputShared_Auxiliary_223;
62
+ some: InputShared_Auxiliary_227;
55
63
  } | {
56
- none: InputShared_Auxiliary_223;
64
+ none: InputShared_Auxiliary_227;
57
65
  };
58
66
  } | {
59
67
  feedback: {
60
- some: InputShared_Auxiliary_223;
68
+ some: InputShared_Auxiliary_227;
61
69
  } | {
62
- none: InputShared_Auxiliary_223;
70
+ none: InputShared_Auxiliary_227;
63
71
  };
64
72
  };
65
- type InputShared_Auxiliary_223 = {
73
+ type InputShared_Auxiliary_227 = {
66
74
  op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte';
67
75
  left: {
68
76
  path: string;
@@ -89,19 +97,27 @@ type InputShared_Auxiliary_223 = {
89
97
  op: 'includes' | 'notIncludes';
90
98
  path: string;
91
99
  value: string;
100
+ } | {
101
+ op: 'matches' | 'notMatches';
102
+ left: {
103
+ path: string;
104
+ };
105
+ right: {
106
+ literal: string;
107
+ };
92
108
  } | {
93
109
  op: 'and' | 'or';
94
- args: InputShared_Auxiliary_223[];
110
+ args: InputShared_Auxiliary_227[];
95
111
  } | {
96
112
  op: 'not';
97
- arg: InputShared_Auxiliary_223;
113
+ arg: InputShared_Auxiliary_227;
98
114
  };
99
- type InputShared_Auxiliary_254 = {
115
+ type InputShared_Auxiliary_261 = {
100
116
  op: 'and' | 'or';
101
- args: InputShared_Auxiliary_254[];
117
+ args: InputShared_Auxiliary_261[];
102
118
  } | {
103
119
  op: 'not';
104
- arg: InputShared_Auxiliary_254;
120
+ arg: InputShared_Auxiliary_261;
105
121
  } | {
106
122
  traces: {
107
123
  some: InputShared_Auxiliary_204;
@@ -109,7 +125,7 @@ type InputShared_Auxiliary_254 = {
109
125
  none: InputShared_Auxiliary_204;
110
126
  };
111
127
  };
112
- type InputShared_Auxiliary_682 = {
128
+ type InputShared_Auxiliary_689 = {
113
129
  op: 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte';
114
130
  left: {
115
131
  path: string;
@@ -141,17 +157,17 @@ type InputShared_Auxiliary_682 = {
141
157
  };
142
158
  } | {
143
159
  op: 'and' | 'or';
144
- args: InputShared_Auxiliary_682[];
160
+ args: InputShared_Auxiliary_689[];
145
161
  } | {
146
162
  op: 'not';
147
- arg: InputShared_Auxiliary_682;
163
+ arg: InputShared_Auxiliary_689;
148
164
  };
149
- type InputShared_Auxiliary_756 = {
165
+ type InputShared_Auxiliary_763 = {
150
166
  id?: string | undefined;
151
167
  name: string;
152
168
  type: 'file' | 'folder';
153
169
  content?: string | undefined;
154
- children?: InputShared_Auxiliary_756[] | undefined;
170
+ children?: InputShared_Auxiliary_763[] | undefined;
155
171
  };
156
172
  type Shared_Auxiliary_764 = {
157
173
  id?: string | undefined;
@@ -189,6 +205,7 @@ type InputShared_Type_2 = {
189
205
  requestContextKeys?: string[] | undefined;
190
206
  traceId?: string | undefined;
191
207
  parentSpanId?: string | undefined;
208
+ nestUnderParent?: boolean | undefined;
192
209
  tags?: string[] | undefined;
193
210
  hideInput?: boolean | undefined;
194
211
  hideOutput?: boolean | undefined;
@@ -1307,7 +1324,7 @@ type InputShared_Type_88 = {
1307
1324
  [key: string]: unknown;
1308
1325
  } | undefined;
1309
1326
  steps: InputShared_Type_83[];
1310
- predicates: InputShared_Auxiliary_682[];
1327
+ predicates: InputShared_Auxiliary_689[];
1311
1328
  };
1312
1329
  type InputShared_Type_89 = {
1313
1330
  type: 'loop';
@@ -1318,7 +1335,7 @@ type InputShared_Type_89 = {
1318
1335
  } | undefined;
1319
1336
  step: InputShared_Type_83;
1320
1337
  loopType: 'dowhile' | 'dountil';
1321
- predicate: InputShared_Auxiliary_682;
1338
+ predicate: InputShared_Auxiliary_689;
1322
1339
  };
1323
1340
  type InputShared_Type_90 = InputShared_Type_80 | InputShared_Type_81 | InputShared_Type_82 | {
1324
1341
  type: 'workflow';
@@ -7942,7 +7959,7 @@ export type PostObservabilityTracesAggregate_Body = {
7942
7959
  groupBy?: string[];
7943
7960
  interval?: ('1m' | '5m' | '15m' | '1h' | '1d') | undefined;
7944
7961
  measures: (('count' | 'duration.avg' | 'duration.min' | 'duration.max' | 'duration.p50' | 'duration.p90' | 'duration.p95' | 'duration.p99' | 'errorCount' | 'errorRate' | 'tokens.input.sum' | 'tokens.input.avg' | 'tokens.output.sum' | 'tokens.output.avg' | 'tokens.total.sum' | 'tokens.total.avg' | 'tokens.reasoning.sum' | 'tokens.reasoning.avg' | 'tokens.cached.sum' | 'tokens.cached.avg' | 'cost.sum' | 'cost.avg') | `countDistinct.${string}`)[];
7945
- having?: InputShared_Auxiliary_223 | undefined;
7962
+ having?: InputShared_Auxiliary_227 | undefined;
7946
7963
  orderBy?: {
7947
7964
  field: string;
7948
7965
  direction: 'asc' | 'desc';
@@ -7992,7 +8009,7 @@ export type PostObservabilityThreadsQuery_Body = {
7992
8009
  };
7993
8010
  where?: InputShared_Auxiliary_204 | undefined;
7994
8011
  };
7995
- where?: InputShared_Auxiliary_254 | undefined;
8012
+ where?: InputShared_Auxiliary_261 | undefined;
7996
8013
  page?: {
7997
8014
  limit?: number;
7998
8015
  after?: (string | null) | undefined;
@@ -8030,7 +8047,7 @@ export type PostObservabilitySpansQuery_Body = {
8030
8047
  from: string;
8031
8048
  to: string;
8032
8049
  };
8033
- where?: InputShared_Auxiliary_223 | undefined;
8050
+ where?: InputShared_Auxiliary_227 | undefined;
8034
8051
  orderBy?: {
8035
8052
  field: 'startedAt' | 'endedAt';
8036
8053
  direction: 'asc' | 'desc';
@@ -8108,7 +8125,7 @@ export type PostObservabilityTracesQueryFields_Response = {
8108
8125
  canonicalFields: {
8109
8126
  path: string;
8110
8127
  valueKind: 'string' | 'number' | 'stringOrNumber' | 'timestamp' | 'presence' | 'array';
8111
- operators: ('eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'notIn' | 'exists' | 'notExists' | 'includes' | 'notIncludes')[];
8128
+ operators: ('eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'notIn' | 'exists' | 'notExists' | 'includes' | 'notIncludes' | 'matches' | 'notMatches')[];
8112
8129
  valueSuggestions: boolean;
8113
8130
  }[];
8114
8131
  observedFields: {
@@ -14358,7 +14375,7 @@ export type PostStoredSkills_Body = {
14358
14375
  /** List of asset file paths */
14359
14376
  assets?: string[] | undefined;
14360
14377
  /** Full file tree structure for the skill */
14361
- files?: InputShared_Auxiliary_756[] | undefined;
14378
+ files?: InputShared_Auxiliary_763[] | undefined;
14362
14379
  /** Additional metadata for the skill */
14363
14380
  metadata?: {
14364
14381
  [key: string]: unknown;
@@ -14408,7 +14425,7 @@ export type PatchStoredSkillsStoredSkillId_Body = {
14408
14425
  /** List of asset file paths */
14409
14426
  assets?: (string[] | undefined) | undefined;
14410
14427
  /** Full file tree structure for the skill */
14411
- files?: (InputShared_Auxiliary_756[] | undefined) | undefined;
14428
+ files?: (InputShared_Auxiliary_763[] | undefined) | undefined;
14412
14429
  /** Additional metadata for the skill */
14413
14430
  metadata?: ({
14414
14431
  [key: string]: unknown;