@mastra/server 1.79.0-alpha.7 → 1.79.0-alpha.9

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.
Files changed (63) hide show
  1. package/dist/{api-schema-manifest-CXmfl718.js → api-schema-manifest-CWRIJP-B.js} +2 -2
  2. package/dist/{api-schema-manifest-CXmfl718.js.map → api-schema-manifest-CWRIJP-B.js.map} +1 -1
  3. package/dist/{api-schema-manifest-D06vSmIN.cjs → api-schema-manifest-DUseI2VG.cjs} +2 -2
  4. package/dist/{api-schema-manifest-D06vSmIN.cjs.map → api-schema-manifest-DUseI2VG.cjs.map} +1 -1
  5. package/dist/{dist-BGzSzjTX.cjs → dist-9c3PXXpk.cjs} +100 -7
  6. package/dist/{dist-BGzSzjTX.cjs.map → dist-9c3PXXpk.cjs.map} +1 -1
  7. package/dist/{dist-BeXd4jq2.js → dist-DGCnbhNe.js} +100 -7
  8. package/dist/{dist-BeXd4jq2.js.map → dist-DGCnbhNe.js.map} +1 -1
  9. package/dist/docs/SKILL.md +1 -1
  10. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  11. package/dist/docs/references/docs-guides-mcp-authentication-authorization.md +2 -2
  12. package/dist/docs/references/reference-observability-tracing-advanced-queries.md +40 -31
  13. package/dist/{observability-new-endpoints-s3ccgoif.cjs → observability-new-endpoints-AMp9bnMV.cjs} +6 -4
  14. package/dist/observability-new-endpoints-AMp9bnMV.cjs.map +1 -0
  15. package/dist/{observability-new-endpoints-DMbbmOzO.js → observability-new-endpoints-BU8JYPfh.js} +7 -5
  16. package/dist/observability-new-endpoints-BU8JYPfh.js.map +1 -0
  17. package/dist/{routes-BTqI1f9k.cjs → routes-DPojsNf1.cjs} +2 -2
  18. package/dist/{routes-BTqI1f9k.cjs.map → routes-DPojsNf1.cjs.map} +1 -1
  19. package/dist/{routes-kj3891v4.js → routes-rwufkyUe.js} +2 -2
  20. package/dist/{routes-kj3891v4.js.map → routes-rwufkyUe.js.map} +1 -1
  21. package/dist/server/handlers/agent-builder.cjs +1 -1
  22. package/dist/server/handlers/agent-builder.js +1 -1
  23. package/dist/server/handlers/agent-controller.cjs +190 -170
  24. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  25. package/dist/server/handlers/agent-controller.d.ts +165 -155
  26. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  27. package/dist/server/handlers/agent-controller.js +190 -170
  28. package/dist/server/handlers/agent-controller.js.map +1 -1
  29. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  30. package/dist/server/handlers/observability-new-endpoints.d.ts +20 -4
  31. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  32. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  33. package/dist/server/handlers/observability-shared.cjs +44 -21
  34. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  35. package/dist/server/handlers/observability-shared.d.ts +15 -4
  36. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  37. package/dist/server/handlers/observability-shared.js +42 -20
  38. package/dist/server/handlers/observability-shared.js.map +1 -1
  39. package/dist/server/handlers/observability.cjs +1 -1
  40. package/dist/server/handlers/observability.js +1 -1
  41. package/dist/server/handlers/system.cjs +2 -2
  42. package/dist/server/handlers/system.d.ts +6 -0
  43. package/dist/server/handlers/system.d.ts.map +1 -1
  44. package/dist/server/handlers/system.js +2 -2
  45. package/dist/server/schemas/index.cjs +1 -1
  46. package/dist/server/schemas/index.js +1 -1
  47. package/dist/server/schemas/system.d.ts +6 -0
  48. package/dist/server/schemas/system.d.ts.map +1 -1
  49. package/dist/server/server-adapter/index.cjs +1 -1
  50. package/dist/server/server-adapter/index.js +1 -1
  51. package/dist/server/server-adapter/routes/observability.d.ts +10 -2
  52. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  53. package/dist/server/server-adapter/routes/system.d.ts +6 -0
  54. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  55. package/dist/{system-wG9idyeI.cjs → system-BvpFMIJB.cjs} +4 -1
  56. package/dist/system-BvpFMIJB.cjs.map +1 -0
  57. package/dist/{system-CiAOa3RO.js → system-CpzPxRRq.js} +4 -1
  58. package/dist/system-CpzPxRRq.js.map +1 -0
  59. package/package.json +6 -6
  60. package/dist/observability-new-endpoints-DMbbmOzO.js.map +0 -1
  61. package/dist/observability-new-endpoints-s3ccgoif.cjs.map +0 -1
  62. package/dist/system-CiAOa3RO.js.map +0 -1
  63. package/dist/system-wG9idyeI.cjs.map +0 -1
@@ -3,7 +3,7 @@ name: mastra-server
3
3
  description: Documentation for @mastra/server. Use when working with @mastra/server APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/server"
6
- version: "1.79.0-alpha.7"
6
+ version: "1.79.0-alpha.9"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.79.0-alpha.7",
2
+ "version": "1.79.0-alpha.9",
3
3
  "package": "@mastra/server",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -47,7 +47,7 @@ A separate provider per MCP server does one thing and not another:
47
47
 
48
48
  The specification recommends support for **Client ID Metadata Documents (CIMD)**, which identify a client through an HTTPS metadata URL. It also defines pre-registration. Clients that support all registration options should prefer existing pre-registered information when available. Legacy Dynamic Client Registration (DCR) remains optional for compatibility but is deprecated for new implementations. See the versioned [client registration rules](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration).
49
49
 
50
- Mastra's provider accepts pre-registered client information and supports a DCR-based flow. Don't infer CIMD support from the presence of OAuth support. Check the registration mechanism supported by your client integration and authorization server before choosing a deployment.
50
+ `MCPOAuthClientProvider` never registers a client at runtime and doesn't support DCR. Configure exactly one client identity: `clientInformation` for a client pre-registered with the authorization server, or `clientMetadataUrl` for CIMD. Check that your authorization server supports the mechanism you choose before deploying. See the [OAuth client reference](https://mastra.ai/reference/tools/mcp-client) for configuration examples.
51
51
 
52
52
  Mastra's interactive `authenticate()` flow uses a local loopback callback server. It isn't a hosted multi-user login endpoint. A hosted application must own its callback endpoint and associate each authorization attempt with the correct user and provider. See [interactive browser authentication](https://mastra.ai/reference/tools/mcp-client).
53
53
 
@@ -97,7 +97,7 @@ Protecting Mastra routes with `server.auth` and providing interoperable OAuth di
97
97
 
98
98
  Alongside the MCP transport, Mastra registers REST routes used by Studio to list servers, inspect tools, execute tools, and read resources. See the [MCP routes reference](https://mastra.ai/reference/server/routes) for the full list. These paths use the default `/api` prefix.
99
99
 
100
- The `POST /api/mcp/:serverId/tools/:toolId/execute` route calls `executeTool()` directly, without a protocol client. With a Mastra FGA provider configured, `MCPServer.executeTool()` enforces tool execution permission using the user in `requestContext`. The REST tool list also filters tools through FGA. These permission checks don't replace route authentication.
100
+ The `POST /api/mcp/:serverId/tools/:toolId/execute` route calls `executeTool()` directly, without a protocol client. With a Mastra FGA provider configured, `MCPServer.executeTool()` enforces tool execution permission using the user in `requestContext`. The REST tool list also filters tools through FGA, but these permission checks don't replace route authentication.
101
101
 
102
102
  Built-in authentication for these routes depends on `server.auth`. Without it, `requiresAuth: true` doesn't enforce authentication. Custom middleware that checks only the `/mcp` or `/sse` transport paths leaves the REST routes open. If you use custom middleware instead of `server.auth`, default-deny `/api/mcp/*` and allow access only after authentication.
103
103
 
@@ -21,18 +21,20 @@ For hosted traces, see [Query observability data on Mastra Platform](https://mas
21
21
 
22
22
  The configured observability store must support each API. Call `getObservabilityCapabilities()` or `GET /api/observability/capabilities` and check these flags before showing a feature:
23
23
 
24
- | Capability | Store feature | Enables |
25
- | ---------------------------- | --------------------------------- | -------------------------------------------------------------------------------------- |
26
- | `traceQuery` | `trace-query` | `queryTraces()` |
27
- | `traceAggregate` | `trace-aggregate` | `aggregateTraces()` |
28
- | `traceQueryRootDuration` | `trace-query-root-duration` | Trace-scope `durationMs` predicates |
29
- | `traceQueryTimeToFirstChunk` | `trace-query-time-to-first-chunk` | `timeToFirstChunkMs` predicates and results |
30
- | `traceQueryContextIds` | `trace-query-context-ids` | `runId`, `sessionId`, `userId`, and `organizationId` predicates |
31
- | `traceQueryRootSpanFields` | `trace-query-root-span-fields` | Trace-scope `name` and `spanType` predicates, dimensions, and `countDistinct` measures |
32
- | `traceQueryDiscovery` | `trace-query-discovery` | [Field and value discovery](#discover-fields-and-values) |
33
- | `traceQueryTenantScope` | `trace-query-tenant-scope` | [Trusted tenant scope](#trusted-tenant-scope) |
34
-
35
- A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name` and `spanType` are the exception and return `422` with a `field_not_allowed` issue.
24
+ | Capability | Store feature | Enables |
25
+ | -------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- |
26
+ | `traceQuery` | `trace-query` | `queryTraces()` |
27
+ | `traceAggregate` | `trace-aggregate` | `aggregateTraces()` |
28
+ | `traceQueryRootDuration` | `trace-query-root-duration` | Trace-scope `durationMs` predicates |
29
+ | `traceQueryTimeToFirstChunk` | `trace-query-time-to-first-chunk` | `timeToFirstChunkMs` predicates and results |
30
+ | `traceQueryTimeToFirstChunkSort` | `trace-query-time-to-first-chunk-sort` | `orderBy` on `timeToFirstChunkMs` |
31
+ | `traceQueryContextIds` | `trace-query-context-ids` | `runId`, `sessionId`, `userId`, and `organizationId` predicates |
32
+ | `traceQueryRootSpanFields` | `trace-query-root-span-fields` | Trace-scope `name` and `spanType` predicates, dimensions, and `countDistinct` measures |
33
+ | `traceQueryRootEntityId` | `trace-query-root-entity-id` | Trace-scope `entityId` predicates, dimensions, and `countDistinct` measures |
34
+ | `traceQueryDiscovery` | `trace-query-discovery` | [Field and value discovery](#discover-fields-and-values) |
35
+ | `traceQueryTenantScope` | `trace-query-tenant-scope` | [Trusted tenant scope](#trusted-tenant-scope) |
36
+
37
+ A missing `traceAggregate` value means the server doesn't support aggregation. Servers without the aggregate route return `404`, and stores without the feature return `501 TRACE_AGGREGATE_UNSUPPORTED`. Against a store without a sub-feature, a request that uses a gated field returns `501` before storage runs. Root span `name`, `spanType`, and `entityId` are the exception and return `422` with a `field_not_allowed` issue.
36
38
 
37
39
  ## Select traces
38
40
 
@@ -75,7 +77,7 @@ Span clauses examine the current root span and current child spans. The root `ti
75
77
 
76
78
  | Predicate context | Fields | Operators |
77
79
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
78
- | Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityName`, `entityType`, `name`, `spanType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
80
+ | Trace | `traceId`, `threadId`, `resourceId`, `runId`, `sessionId`, `userId`, `organizationId`, `entityId`, `entityName`, `entityType`, `name`, `spanType`, `environment`, `status` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
79
81
  | Trace metadata | `metadata.<key>` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
80
82
  | Trace | `startedAt`, `endedAt`, `durationMs`, `timeToFirstChunkMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
81
83
  | Trace | `tags` | `includes`, `notIncludes`, `exists`, `notExists` |
@@ -84,7 +86,7 @@ Span clauses examine the current root span and current child spans. The root `ti
84
86
  | Span | `startedAt`, `endedAt`, `durationMs`, `timeToFirstChunkMs` | `eq`, `ne`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `exists`, `notExists` |
85
87
  | Span | `error` | `exists`, `notExists` |
86
88
 
87
- Trace-scope `name` and `spanType` read the current root span, so `{ op: 'eq', left: { path: 'spanType' }, right: { literal: 'workflow_run' } }` selects traces started by a workflow run. Inside `spans.some` or `spans.none`, the same fields match any span in the trace.
89
+ Trace-scope `name`, `spanType`, and `entityId` read the current root span, so `{ op: 'eq', left: { path: 'spanType' }, right: { literal: 'workflow_run' } }` selects traces started by a workflow run. Inside `spans.some` or `spans.none`, the same fields match any span in the trace.
88
90
 
89
91
  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).
90
92
 
@@ -128,7 +130,13 @@ const slowFirstChunk = {
128
130
 
129
131
  The value is `null` when the span didn't stream a chunk, for example a tool call or a workflow run. A `null` value counts as missing, so it matches `notExists` and never matches ordered predicates. A value of `0` isn't missing. It means the first chunk arrived in the same millisecond the span started.
130
132
 
131
- Trace query results include the root span's `timeToFirstChunkMs`, and `querySpans()` results include each span's value. Sorting by this field isn't supported. Stores advertise support through the `trace-query-time-to-first-chunk` feature, and the server reports it as the `traceQueryTimeToFirstChunk` capability. Against an older store, results omit the field, a predicate on it returns `501` before storage runs, and field discovery omits it.
133
+ Trace query results include the root span's `timeToFirstChunkMs`, and `querySpans()` results include each span's value. Stores advertise support through the `trace-query-time-to-first-chunk` feature, and the server reports it as the `traceQueryTimeToFirstChunk` capability. Against an older store, results omit the field, a predicate on it returns `501` before storage runs, and field discovery omits it.
134
+
135
+ #### Sort by time to first chunk
136
+
137
+ Pass `orderBy: [{ field: 'timeToFirstChunkMs', direction: 'desc' }]` to list the slowest first chunks first. Traces sort by the root span's value. Missing values sort last in both directions, and `0` sorts as a value. Ties break by `traceId` for traces and by span identity for `querySpans()`.
138
+
139
+ Stores advertise the sort through the `trace-query-time-to-first-chunk-sort` feature, and the server reports it as the `traceQueryTimeToFirstChunkSort` capability. Against an older store, the sort returns `501` before storage runs.
132
140
 
133
141
  #### Filter by context identifiers
134
142
 
@@ -437,16 +445,16 @@ curl --request POST \
437
445
 
438
446
  ### Request fields
439
447
 
440
- | Field | Required | Description |
441
- | ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
442
- | `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`. |
443
- | `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses. |
444
- | `orderBy` | No | One item ordering results by `startedAt` or `endedAt`, in `asc` or `desc` order. Defaults to `startedAt desc`. Not accepted in delta mode. |
445
- | `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`. |
446
- | `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100. |
447
- | `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`. |
448
- | `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark. |
449
- | `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100. |
448
+ | Field | Required | Description |
449
+ | ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
450
+ | `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`. |
451
+ | `where` | No | Recursive trace predicate. Supports scalar conditions and `spans.some` or `spans.none` clauses. |
452
+ | `orderBy` | No | One item ordering results by `startedAt`, `endedAt`, or `timeToFirstChunkMs`, in `asc` or `desc` order. Defaults to `startedAt desc`. Not accepted in delta mode. |
453
+ | `page` | No | `{ limit, after }`. `limit` defaults to 100 and has a maximum of 1000. Pass the opaque `page.next` value as `after`. |
454
+ | `pagination` | No | Numbered pages: `{ page, perPage }`. Defaults to page 0 and 10 results. `perPage` has a maximum of 100. |
455
+ | `mode` | No | Set to `'delta'` to poll using a delta cursor instead of `page` or `pagination`. |
456
+ | `after` | No | Delta mode only. Opaque `deltaCursor` from a numbered page or previous poll. Omit to establish the current watermark. |
457
+ | `limit` | No | Delta mode only. Maximum results per batch. Defaults to 10 and has a maximum of 100. |
450
458
 
451
459
  Unknown fields are rejected. Requests can't select a projection, declare joins, request counts or measures, or control authorization. Use [`aggregateTraces()`](#aggregate-traces) for counts and measures. Request bodies are limited to 256 KiB.
452
460
 
@@ -657,12 +665,13 @@ Unknown fields are rejected. Aggregation isn't paginated. Narrow the selection,
657
665
 
658
666
  Dimensions read the current root span of each selected trace:
659
667
 
660
- | Dimension | Notes |
661
- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
662
- | `entityType`, `entityName`, `environment`, `status`, `serviceName`, `executionSource` | Root span attributes. |
663
- | `threadId`, `resourceId`, `userId`, `sessionId`, `organizationId`, `experimentId` | Context identifiers recorded on the root span. |
664
- | `name`, `spanType` | Root span name and type. Requires the `traceQueryRootSpanFields` capability. |
665
- | `metadata.<key>` | One non-empty top-level metadata key. Values are trimmed. Missing, empty, and non-string values group as `null`. |
668
+ | Dimension | Notes |
669
+ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
670
+ | `entityType`, `entityName`, `environment`, `status`, `serviceName`, `executionSource` | Root span attributes. |
671
+ | `threadId`, `resourceId`, `userId`, `sessionId`, `organizationId`, `experimentId` | Context identifiers recorded on the root span. |
672
+ | `name`, `spanType` | Root span name and type. Requires the `traceQueryRootSpanFields` capability. |
673
+ | `entityId` | Root span entity ID. Groups traces that have no `entityName`, such as scorer runs. Requires the `traceQueryRootEntityId` capability. |
674
+ | `metadata.<key>` | One non-empty top-level metadata key. Values are trimmed. Missing, empty, and non-string values group as `null`. |
666
675
 
667
676
  Every dimension except `serviceName`, `executionSource`, and `experimentId` is also a trace-scope `where` field, so you can drill into a group by adding its values to the predicate. `traceId`, `spanId`, `runId`, and `requestId` aren't groupable. Traces with no value for a dimension form their own group with a `null` value.
668
677
 
@@ -5,7 +5,7 @@ const require_constants = require("./constants-e7aaPCLj.cjs");
5
5
  const require_server_handlers_error = require("./server/handlers/error.cjs");
6
6
  const require_server_handlers_observability_list_query_schemas = require("./server/handlers/observability-list-query-schemas.cjs");
7
7
  const require_server_handlers_observability_shared = require("./server/handlers/observability-shared.cjs");
8
- const require_system = require("./system-wG9idyeI.cjs");
8
+ const require_system = require("./system-BvpFMIJB.cjs");
9
9
  const require_server_handlers_author_enrichment = require("./server/handlers/author-enrichment.cjs");
10
10
  const require_server_handlers_authorship = require("./server/handlers/authorship.cjs");
11
11
  let zod_v4 = require("zod/v4");
@@ -1034,6 +1034,7 @@ const QUERY_TRACES = createNewRoute(require_server_handlers_observability_shared
1034
1034
  require_server_handlers_observability_shared.assertObservabilityTraceQueryContextIdsSupported(observabilityStore, plan.where);
1035
1035
  require_server_handlers_observability_shared.assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilityStore, plan.where);
1036
1036
  require_server_handlers_observability_shared.assertObservabilityTraceQueryRootSpanFieldsSupported(observabilityStore, plan);
1037
+ require_server_handlers_observability_shared.assertObservabilityTraceQueryTimeToFirstChunkSortSupported(observabilityStore, plan.orderBy);
1037
1038
  require_server_handlers_observability_shared.assertObservabilityTraceQueryTenantScopeSupported(observabilityStore, plan.scope);
1038
1039
  if (plan.paginationMode === "delta" && !observabilityStore.getFeatures()?.includes("delta-polling")) throw new require_http_exception.HTTPException(501, { message: "This storage provider does not support observability delta polling" });
1039
1040
  } catch (error) {
@@ -1249,6 +1250,7 @@ const QUERY_SPANS = createNewRoute(require_server_handlers_observability_shared.
1249
1250
  require_server_handlers_observability_shared.assertObservabilitySpanQuerySupported(observabilityStore);
1250
1251
  require_server_handlers_observability_shared.assertObservabilitySpanQueryFieldsSupported(observabilityStore, plan.where);
1251
1252
  require_server_handlers_observability_shared.assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilityStore, plan.where);
1253
+ require_server_handlers_observability_shared.assertObservabilityTraceQueryTimeToFirstChunkSortSupported(observabilityStore, plan.orderBy);
1252
1254
  require_server_handlers_observability_shared.assertObservabilityTraceQueryTenantScopeSupported(observabilityStore, plan.scope);
1253
1255
  } catch (error) {
1254
1256
  if (error instanceof _mastra_core_storage.TraceQueryValidationError) throwTraceQueryError(422, {
@@ -1341,13 +1343,13 @@ const GET_TRACE_QUERY_FIELDS = createNewRoute(require_server_handlers_observabil
1341
1343
  }
1342
1344
  try {
1343
1345
  const observed = await observabilityStore.getTraceQueryObservedFields(plan);
1344
- const canonicalFields = _mastra_core_storage.getTraceQueryCanonicalFieldDescriptors(predicateScope, search).filter((field) => predicateScope !== "trace" || field.path !== "durationMs" || require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootDuration(observabilityStore)).filter((field) => !require_server_handlers_observability_shared.isTraceQueryContextIdField(field.path) || require_server_handlers_observability_shared.supportsObservabilityTraceQueryContextIds(observabilityStore)).filter((field) => field.path !== "timeToFirstChunkMs" || require_server_handlers_observability_shared.supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore)).filter((field) => predicateScope !== "trace" || !require_server_handlers_observability_shared.isTraceQueryRootSpanField(field.path) || require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootSpanFields(observabilityStore));
1346
+ const canonicalFields = _mastra_core_storage.getTraceQueryCanonicalFieldDescriptors(predicateScope, search).filter((field) => predicateScope !== "trace" || field.path !== "durationMs" || require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootDuration(observabilityStore)).filter((field) => !require_server_handlers_observability_shared.isTraceQueryContextIdField(field.path) || require_server_handlers_observability_shared.supportsObservabilityTraceQueryContextIds(observabilityStore)).filter((field) => field.path !== "timeToFirstChunkMs" || require_server_handlers_observability_shared.supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore)).filter((field) => predicateScope !== "trace" || require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootSpanField(observabilityStore, field.path));
1345
1347
  const describesAggregate = predicateScope === "trace" && require_server_handlers_observability_shared.supportsTraceAggregateCore() && _mastra_core_storage.traceAggregateDiscoverySchema !== void 0 && require_server_handlers_observability_shared.supportsObservabilityTraceAggregate(observabilityStore);
1346
1348
  return {
1347
1349
  canonicalFields,
1348
1350
  ...observed,
1349
1351
  ...describesAggregate && { aggregate: {
1350
- dimensions: _mastra_core_storage.getTraceAggregateDimensionDescriptors().filter((dimension) => !require_server_handlers_observability_shared.isTraceQueryRootSpanField(dimension.path) || require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootSpanFields(observabilityStore)),
1352
+ dimensions: _mastra_core_storage.getTraceAggregateDimensionDescriptors().filter((dimension) => require_server_handlers_observability_shared.supportsObservabilityTraceQueryRootSpanField(observabilityStore, dimension.path)),
1351
1353
  measures: _mastra_core_storage.getTraceAggregateMeasureDescriptors()
1352
1354
  } }
1353
1355
  };
@@ -2199,4 +2201,4 @@ Object.defineProperty(exports, "UPDATE_FEEDBACK_REVIEW_STATUS", {
2199
2201
  }
2200
2202
  });
2201
2203
 
2202
- //# sourceMappingURL=observability-new-endpoints-s3ccgoif.cjs.map
2204
+ //# sourceMappingURL=observability-new-endpoints-AMp9bnMV.cjs.map