@mastra/server 1.79.0-alpha.8 → 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.
- package/dist/{api-schema-manifest-CXiWNHBm.js → api-schema-manifest-CWRIJP-B.js} +2 -2
- package/dist/{api-schema-manifest-CXiWNHBm.js.map → api-schema-manifest-CWRIJP-B.js.map} +1 -1
- package/dist/{api-schema-manifest-Cs2cYG-m.cjs → api-schema-manifest-DUseI2VG.cjs} +2 -2
- package/dist/{api-schema-manifest-Cs2cYG-m.cjs.map → api-schema-manifest-DUseI2VG.cjs.map} +1 -1
- package/dist/{dist-BGzSzjTX.cjs → dist-9c3PXXpk.cjs} +100 -7
- package/dist/{dist-BGzSzjTX.cjs.map → dist-9c3PXXpk.cjs.map} +1 -1
- package/dist/{dist-BeXd4jq2.js → dist-DGCnbhNe.js} +100 -7
- package/dist/{dist-BeXd4jq2.js.map → dist-DGCnbhNe.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-guides-mcp-authentication-authorization.md +2 -2
- package/dist/docs/references/reference-observability-tracing-advanced-queries.md +11 -9
- package/dist/{observability-new-endpoints-outfOdc8.cjs → observability-new-endpoints-AMp9bnMV.cjs} +4 -4
- package/dist/observability-new-endpoints-AMp9bnMV.cjs.map +1 -0
- package/dist/{observability-new-endpoints-7wGwP3se.js → observability-new-endpoints-BU8JYPfh.js} +5 -5
- package/dist/{observability-new-endpoints-7wGwP3se.js.map → observability-new-endpoints-BU8JYPfh.js.map} +1 -1
- package/dist/{routes-gZRBp2vK.cjs → routes-DPojsNf1.cjs} +2 -2
- package/dist/{routes-gZRBp2vK.cjs.map → routes-DPojsNf1.cjs.map} +1 -1
- package/dist/{routes-BYcXmjX3.js → routes-rwufkyUe.js} +2 -2
- package/dist/{routes-BYcXmjX3.js.map → routes-rwufkyUe.js.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-controller.cjs +190 -170
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts +165 -155
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +190 -170
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +8 -0
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +31 -21
- package/dist/server/handlers/observability-shared.cjs.map +1 -1
- package/dist/server/handlers/observability-shared.d.ts +9 -4
- package/dist/server/handlers/observability-shared.d.ts.map +1 -1
- package/dist/server/handlers/observability-shared.js +31 -20
- package/dist/server/handlers/observability-shared.js.map +1 -1
- package/dist/server/handlers/observability.cjs +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.d.ts +4 -0
- package/dist/server/handlers/system.d.ts.map +1 -1
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/schemas/system.d.ts +4 -0
- package/dist/server/schemas/system.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +4 -0
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/system.d.ts +4 -0
- package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
- package/dist/{system-DvpPWdIa.cjs → system-BvpFMIJB.cjs} +3 -1
- package/dist/system-BvpFMIJB.cjs.map +1 -0
- package/dist/{system-BLcPGYXT.js → system-CpzPxRRq.js} +3 -1
- package/dist/system-CpzPxRRq.js.map +1 -0
- package/package.json +6 -6
- package/dist/observability-new-endpoints-outfOdc8.cjs.map +0 -1
- package/dist/system-BLcPGYXT.js.map +0 -1
- package/dist/system-DvpPWdIa.cjs.map +0 -1
|
@@ -3822,6 +3822,7 @@ export declare const GET_CAPABILITIES: Omit<import("@mastra/core/server").ApiRou
|
|
|
3822
3822
|
traceQueryContextIds: boolean;
|
|
3823
3823
|
traceQueryTimeToFirstChunk: boolean;
|
|
3824
3824
|
traceQueryRootSpanFields: boolean;
|
|
3825
|
+
traceQueryRootEntityId: boolean;
|
|
3825
3826
|
traceQueryTimeToFirstChunkSort: boolean;
|
|
3826
3827
|
traceQueryDiscovery: boolean;
|
|
3827
3828
|
traceQueryTenantScope: boolean;
|
|
@@ -3829,6 +3830,7 @@ export declare const GET_CAPABILITIES: Omit<import("@mastra/core/server").ApiRou
|
|
|
3829
3830
|
threadQuery: boolean;
|
|
3830
3831
|
threadQueryRows: boolean;
|
|
3831
3832
|
spanQuery: boolean;
|
|
3833
|
+
spanQueryContextFields: boolean;
|
|
3832
3834
|
traceRetentionDays?: number | undefined;
|
|
3833
3835
|
feedback: boolean;
|
|
3834
3836
|
};
|
|
@@ -3862,6 +3864,7 @@ export declare const GET_CAPABILITIES: Omit<import("@mastra/core/server").ApiRou
|
|
|
3862
3864
|
traceQueryContextIds: z.ZodBoolean;
|
|
3863
3865
|
traceQueryTimeToFirstChunk: z.ZodBoolean;
|
|
3864
3866
|
traceQueryRootSpanFields: z.ZodBoolean;
|
|
3867
|
+
traceQueryRootEntityId: z.ZodBoolean;
|
|
3865
3868
|
traceQueryTimeToFirstChunkSort: z.ZodBoolean;
|
|
3866
3869
|
traceQueryDiscovery: z.ZodBoolean;
|
|
3867
3870
|
traceQueryTenantScope: z.ZodBoolean;
|
|
@@ -3869,6 +3872,7 @@ export declare const GET_CAPABILITIES: Omit<import("@mastra/core/server").ApiRou
|
|
|
3869
3872
|
threadQuery: z.ZodBoolean;
|
|
3870
3873
|
threadQueryRows: z.ZodDefault<z.ZodBoolean>;
|
|
3871
3874
|
spanQuery: z.ZodBoolean;
|
|
3875
|
+
spanQueryContextFields: z.ZodDefault<z.ZodBoolean>;
|
|
3872
3876
|
traceRetentionDays: z.ZodOptional<z.ZodNumber>;
|
|
3873
3877
|
feedback: z.ZodBoolean;
|
|
3874
3878
|
}, z.core.$strip>;
|
|
@@ -7365,6 +7369,7 @@ export declare const NEW_ROUTES: {
|
|
|
7365
7369
|
traceQueryContextIds: boolean;
|
|
7366
7370
|
traceQueryTimeToFirstChunk: boolean;
|
|
7367
7371
|
traceQueryRootSpanFields: boolean;
|
|
7372
|
+
traceQueryRootEntityId: boolean;
|
|
7368
7373
|
traceQueryTimeToFirstChunkSort: boolean;
|
|
7369
7374
|
traceQueryDiscovery: boolean;
|
|
7370
7375
|
traceQueryTenantScope: boolean;
|
|
@@ -7372,6 +7377,7 @@ export declare const NEW_ROUTES: {
|
|
|
7372
7377
|
threadQuery: boolean;
|
|
7373
7378
|
threadQueryRows: boolean;
|
|
7374
7379
|
spanQuery: boolean;
|
|
7380
|
+
spanQueryContextFields: boolean;
|
|
7375
7381
|
traceRetentionDays?: number | undefined;
|
|
7376
7382
|
feedback: boolean;
|
|
7377
7383
|
};
|
|
@@ -7405,6 +7411,7 @@ export declare const NEW_ROUTES: {
|
|
|
7405
7411
|
traceQueryContextIds: z.ZodBoolean;
|
|
7406
7412
|
traceQueryTimeToFirstChunk: z.ZodBoolean;
|
|
7407
7413
|
traceQueryRootSpanFields: z.ZodBoolean;
|
|
7414
|
+
traceQueryRootEntityId: z.ZodBoolean;
|
|
7408
7415
|
traceQueryTimeToFirstChunkSort: z.ZodBoolean;
|
|
7409
7416
|
traceQueryDiscovery: z.ZodBoolean;
|
|
7410
7417
|
traceQueryTenantScope: z.ZodBoolean;
|
|
@@ -7412,6 +7419,7 @@ export declare const NEW_ROUTES: {
|
|
|
7412
7419
|
threadQuery: z.ZodBoolean;
|
|
7413
7420
|
threadQueryRows: z.ZodDefault<z.ZodBoolean>;
|
|
7414
7421
|
spanQuery: z.ZodBoolean;
|
|
7422
|
+
spanQueryContextFields: z.ZodDefault<z.ZodBoolean>;
|
|
7415
7423
|
traceRetentionDays: z.ZodOptional<z.ZodNumber>;
|
|
7416
7424
|
feedback: z.ZodBoolean;
|
|
7417
7425
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability-new-endpoints.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/observability-new-endpoints.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAY3B,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAsB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"observability-new-endpoints.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/observability-new-endpoints.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAY3B,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAsB,MAAM,0BAA0B,CAAC;AA8N/F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4F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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCtB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as LIST_FEEDBACK, C as GET_SCORE_BREAKDOWN, D as GET_TAGS, E as GET_SERVICE_NAMES, F as QUERY_SPANS, I as QUERY_THREADS, L as QUERY_TRACES, M as LIST_METRICS, N as LIST_SCORES, O as GET_TRACE_QUERY_FIELDS, P as NEW_ROUTES, R as UPDATE_FEEDBACK_REVIEW_STATUS, S as GET_SCORE_AGGREGATE, T as GET_SCORE_TIME_SERIES, _ as GET_METRIC_LABEL_VALUES, a as DELETE_SCORES, b as GET_METRIC_TIME_SERIES, c as GET_ENTITY_TYPES, d as GET_FEEDBACK_BREAKDOWN, f as GET_FEEDBACK_PERCENTILES, g as GET_METRIC_LABEL_KEYS, h as GET_METRIC_BREAKDOWN, i as DELETE_FEEDBACK, j as LIST_LOGS, k as GET_TRACE_QUERY_VALUES, l as GET_ENVIRONMENTS, m as GET_METRIC_AGGREGATE, n as CREATE_FEEDBACK, o as GET_CAPABILITIES, p as GET_FEEDBACK_TIME_SERIES, r as CREATE_SCORE, s as GET_ENTITY_NAMES, t as AGGREGATE_TRACES, u as GET_FEEDBACK_AGGREGATE, v as GET_METRIC_NAMES, w as GET_SCORE_PERCENTILES, x as GET_SCORE, y as GET_METRIC_PERCENTILES } from "../../observability-new-endpoints-
|
|
1
|
+
import { A as LIST_FEEDBACK, C as GET_SCORE_BREAKDOWN, D as GET_TAGS, E as GET_SERVICE_NAMES, F as QUERY_SPANS, I as QUERY_THREADS, L as QUERY_TRACES, M as LIST_METRICS, N as LIST_SCORES, O as GET_TRACE_QUERY_FIELDS, P as NEW_ROUTES, R as UPDATE_FEEDBACK_REVIEW_STATUS, S as GET_SCORE_AGGREGATE, T as GET_SCORE_TIME_SERIES, _ as GET_METRIC_LABEL_VALUES, a as DELETE_SCORES, b as GET_METRIC_TIME_SERIES, c as GET_ENTITY_TYPES, d as GET_FEEDBACK_BREAKDOWN, f as GET_FEEDBACK_PERCENTILES, g as GET_METRIC_LABEL_KEYS, h as GET_METRIC_BREAKDOWN, i as DELETE_FEEDBACK, j as LIST_LOGS, k as GET_TRACE_QUERY_VALUES, l as GET_ENVIRONMENTS, m as GET_METRIC_AGGREGATE, n as CREATE_FEEDBACK, o as GET_CAPABILITIES, p as GET_FEEDBACK_TIME_SERIES, r as CREATE_SCORE, s as GET_ENTITY_NAMES, t as AGGREGATE_TRACES, u as GET_FEEDBACK_AGGREGATE, v as GET_METRIC_NAMES, w as GET_SCORE_PERCENTILES, x as GET_SCORE, y as GET_METRIC_PERCENTILES } from "../../observability-new-endpoints-BU8JYPfh.js";
|
|
2
2
|
export { AGGREGATE_TRACES, CREATE_FEEDBACK, CREATE_SCORE, DELETE_FEEDBACK, DELETE_SCORES, GET_CAPABILITIES, GET_ENTITY_NAMES, GET_ENTITY_TYPES, GET_ENVIRONMENTS, GET_FEEDBACK_AGGREGATE, GET_FEEDBACK_BREAKDOWN, GET_FEEDBACK_PERCENTILES, GET_FEEDBACK_TIME_SERIES, GET_METRIC_AGGREGATE, GET_METRIC_BREAKDOWN, GET_METRIC_LABEL_KEYS, GET_METRIC_LABEL_VALUES, GET_METRIC_NAMES, GET_METRIC_PERCENTILES, GET_METRIC_TIME_SERIES, GET_SCORE, GET_SCORE_AGGREGATE, GET_SCORE_BREAKDOWN, GET_SCORE_PERCENTILES, GET_SCORE_TIME_SERIES, GET_SERVICE_NAMES, GET_TAGS, GET_TRACE_QUERY_FIELDS, GET_TRACE_QUERY_VALUES, LIST_FEEDBACK, LIST_LOGS, LIST_METRICS, LIST_SCORES, NEW_ROUTES, QUERY_SPANS, QUERY_THREADS, QUERY_TRACES, UPDATE_FEEDBACK_REVIEW_STATUS };
|
|
@@ -42,7 +42,12 @@ const TRACE_QUERY_CONTEXT_ID_FIELDS = /* @__PURE__ */ new Set([
|
|
|
42
42
|
const OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE = "trace-query-time-to-first-chunk";
|
|
43
43
|
const TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS = /* @__PURE__ */ new Set(["timeToFirstChunkMs"]);
|
|
44
44
|
const OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE = "trace-query-root-span-fields";
|
|
45
|
-
const
|
|
45
|
+
const OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE = "trace-query-root-entity-id";
|
|
46
|
+
const TRACE_QUERY_ROOT_SPAN_FIELD_FEATURES = /* @__PURE__ */ new Map([
|
|
47
|
+
["name", OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE],
|
|
48
|
+
["spanType", OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE],
|
|
49
|
+
["entityId", OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE]
|
|
50
|
+
]);
|
|
46
51
|
const OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE = "trace-query-time-to-first-chunk-sort";
|
|
47
52
|
const OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE = "trace-query-discovery";
|
|
48
53
|
const OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE = "thread-query";
|
|
@@ -154,12 +159,12 @@ function assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilitySto
|
|
|
154
159
|
if (!usesField(predicate, TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS) || supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore)) return;
|
|
155
160
|
throw new require_http_exception.HTTPException(501, { message: "Time to first chunk predicates are not supported by the configured observability store" });
|
|
156
161
|
}
|
|
157
|
-
function rootSpanFieldIssues(predicate) {
|
|
162
|
+
function rootSpanFieldIssues(observabilityStore, predicate) {
|
|
158
163
|
if (!predicate) return [];
|
|
159
|
-
if (predicate.type === "boolean") return predicate.args.flatMap(rootSpanFieldIssues);
|
|
160
|
-
if (predicate.type === "not") return rootSpanFieldIssues(predicate.arg);
|
|
161
|
-
if (predicate.type === "relation") return predicate.collection === "traces" ? rootSpanFieldIssues(predicate.predicate) : [];
|
|
162
|
-
return
|
|
164
|
+
if (predicate.type === "boolean") return predicate.args.flatMap((arg) => rootSpanFieldIssues(observabilityStore, arg));
|
|
165
|
+
if (predicate.type === "not") return rootSpanFieldIssues(observabilityStore, predicate.arg);
|
|
166
|
+
if (predicate.type === "relation") return predicate.collection === "traces" ? rootSpanFieldIssues(observabilityStore, predicate.predicate) : [];
|
|
167
|
+
return supportsObservabilityTraceQueryRootSpanField(observabilityStore, predicate.field) ? [] : [rootSpanFieldIssue(["where"], predicate.field)];
|
|
163
168
|
}
|
|
164
169
|
function rootSpanFieldIssue(path, field) {
|
|
165
170
|
return {
|
|
@@ -168,28 +173,30 @@ function rootSpanFieldIssue(path, field) {
|
|
|
168
173
|
message: `Root span ${field} requires an updated storage adapter with trace-query root span field support.`
|
|
169
174
|
};
|
|
170
175
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Whether the store can serve `path` at trace scope. Fields that don't read the root span are
|
|
178
|
+
* always supported here; other gates cover them.
|
|
179
|
+
*/
|
|
180
|
+
function supportsObservabilityTraceQueryRootSpanField(observabilityStore, path) {
|
|
181
|
+
const feature = TRACE_QUERY_ROOT_SPAN_FIELD_FEATURES.get(path);
|
|
182
|
+
return feature === void 0 || getFeatures(observabilityStore)?.includes(feature) === true;
|
|
176
183
|
}
|
|
177
184
|
/**
|
|
178
|
-
* Stores that predate trace-scope
|
|
179
|
-
* 500, so requests that use
|
|
185
|
+
* Stores that predate a trace-scope root span field have no SQL for it and would fail with a
|
|
186
|
+
* 500, so requests that use it are rejected as invalid instead.
|
|
180
187
|
*/
|
|
181
188
|
function assertObservabilityTraceQueryRootSpanFieldsSupported(observabilityStore, plan) {
|
|
182
|
-
|
|
189
|
+
const supported = (field) => supportsObservabilityTraceQueryRootSpanField(observabilityStore, field);
|
|
183
190
|
const issues = [
|
|
184
|
-
...rootSpanFieldIssues(plan.where),
|
|
185
|
-
...(plan.dimensions ?? []).flatMap((dimension, index) =>
|
|
186
|
-
...(plan.measures ?? []).flatMap((measure, index) => measure.type === "countDistinct" && measure.field !== void 0 &&
|
|
191
|
+
...rootSpanFieldIssues(observabilityStore, plan.where),
|
|
192
|
+
...(plan.dimensions ?? []).flatMap((dimension, index) => supported(dimension) ? [] : [rootSpanFieldIssue(["groupBy", index], dimension)]),
|
|
193
|
+
...(plan.measures ?? []).flatMap((measure, index) => measure.type === "countDistinct" && measure.field !== void 0 && !supported(measure.field) ? [rootSpanFieldIssue(["measures", index], measure.field)] : [])
|
|
187
194
|
];
|
|
188
195
|
if (issues.length > 0) throw new _mastra_core_storage.TraceQueryValidationError(issues);
|
|
189
196
|
}
|
|
190
197
|
function assertObservabilityTraceQueryRootSpanValuesSupported(observabilityStore, plan) {
|
|
191
|
-
if (plan.predicateScope !== "trace"
|
|
192
|
-
if (
|
|
198
|
+
if (plan.predicateScope !== "trace") return;
|
|
199
|
+
if (supportsObservabilityTraceQueryRootSpanField(observabilityStore, plan.path)) return;
|
|
193
200
|
throw new _mastra_core_storage.TraceQueryValidationError([rootSpanFieldIssue(["path"], plan.path)]);
|
|
194
201
|
}
|
|
195
202
|
function supportsObservabilityTraceQueryTimeToFirstChunkSort(observabilityStore) {
|
|
@@ -253,6 +260,7 @@ const NO_OBSERVABILITY_STORAGE_CAPABILITIES = {
|
|
|
253
260
|
traceQueryContextIds: false,
|
|
254
261
|
traceQueryTimeToFirstChunk: false,
|
|
255
262
|
traceQueryRootSpanFields: false,
|
|
263
|
+
traceQueryRootEntityId: false,
|
|
256
264
|
traceQueryTimeToFirstChunkSort: false,
|
|
257
265
|
traceQueryDiscovery: false,
|
|
258
266
|
traceQueryTenantScope: false,
|
|
@@ -260,6 +268,7 @@ const NO_OBSERVABILITY_STORAGE_CAPABILITIES = {
|
|
|
260
268
|
threadQuery: false,
|
|
261
269
|
threadQueryRows: false,
|
|
262
270
|
spanQuery: false,
|
|
271
|
+
spanQueryContextFields: false,
|
|
263
272
|
feedback: false
|
|
264
273
|
};
|
|
265
274
|
/**
|
|
@@ -315,6 +324,7 @@ function getObservabilityStorageCapabilities(observabilityStore) {
|
|
|
315
324
|
traceQueryContextIds: (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE),
|
|
316
325
|
traceQueryTimeToFirstChunk: (traceQuery || threadQuery || spanQuery) && declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE),
|
|
317
326
|
traceQueryRootSpanFields: (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE),
|
|
327
|
+
traceQueryRootEntityId: (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE),
|
|
318
328
|
traceQueryTimeToFirstChunkSort: (traceQuery || spanQuery) && declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE),
|
|
319
329
|
traceQueryDiscovery: newApiCore && supportsTraceQueryDiscoveryCore() && declares(OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE),
|
|
320
330
|
traceQueryTenantScope: (traceQuery || threadQuery) && _mastra_core_features.coreFeatures.has("observability-trace-query-tenant-scope") && declares(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE),
|
|
@@ -322,6 +332,7 @@ function getObservabilityStorageCapabilities(observabilityStore) {
|
|
|
322
332
|
threadQuery,
|
|
323
333
|
threadQueryRows: threadQuery && typeof _mastra_core_storage.planThreadRowsQuery === "function" && declares("thread-query-rows"),
|
|
324
334
|
spanQuery,
|
|
335
|
+
spanQueryContextFields: spanQuery && declares("span-query-context-fields"),
|
|
325
336
|
feedback: newApiCore && declares(OBSERVABILITY_FEEDBACK_STORAGE_FEATURE)
|
|
326
337
|
};
|
|
327
338
|
}
|
|
@@ -693,11 +704,10 @@ exports.getObservabilityStore = getObservabilityStore;
|
|
|
693
704
|
exports.getScoresStore = getScoresStore;
|
|
694
705
|
exports.getStorage = getStorage;
|
|
695
706
|
exports.isTraceQueryContextIdField = isTraceQueryContextIdField;
|
|
696
|
-
exports.isTraceQueryRootSpanField = isTraceQueryRootSpanField;
|
|
697
707
|
exports.supportsObservabilityTraceAggregate = supportsObservabilityTraceAggregate;
|
|
698
708
|
exports.supportsObservabilityTraceQueryContextIds = supportsObservabilityTraceQueryContextIds;
|
|
699
709
|
exports.supportsObservabilityTraceQueryRootDuration = supportsObservabilityTraceQueryRootDuration;
|
|
700
|
-
exports.
|
|
710
|
+
exports.supportsObservabilityTraceQueryRootSpanField = supportsObservabilityTraceQueryRootSpanField;
|
|
701
711
|
exports.supportsObservabilityTraceQueryTimeToFirstChunk = supportsObservabilityTraceQueryTimeToFirstChunk;
|
|
702
712
|
exports.supportsObservabilityTraceQueryTimeToFirstChunkSort = supportsObservabilityTraceQueryTimeToFirstChunkSort;
|
|
703
713
|
exports.supportsSpanQueryCore = supportsSpanQueryCore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability-shared.cjs","names":["coreStorage","candidate","HTTPException","coreFeatures","z","paginationArgsSchema","wrapSchemaForQueryParams","listModeSchema","deltaCursorSchema","deltaLimitSchema"],"sources":["../../../src/server/handlers/observability-shared.ts"],"sourcesContent":["import type { Mastra } from '@mastra/core';\nimport { coreFeatures } from '@mastra/core/features';\nimport type {\n MastraCompositeStore,\n ObservabilityStorage,\n ScoresStorage,\n TraceQueryIssue,\n TrustedTraceQueryScalarPredicate,\n TrustedThreadPredicate,\n TrustedTraceQueryPredicate,\n} from '@mastra/core/storage';\nimport * as coreStorage from '@mastra/core/storage';\nimport { z } from 'zod/v4';\nimport { HTTPException } from '../http-exception';\nimport type { ServerRoute } from '../server-adapter/routes';\nimport { wrapSchemaForQueryParams } from '../server-adapter/routes/route-builder';\nimport {\n deltaCursorSchema,\n deltaLimitSchema,\n listModeSchema,\n paginationArgsSchema,\n} from './observability-list-query-schemas';\n\nexport const OBSERVABILITY_DELTA_POLLING_FEATURE = 'observability-delta-polling';\nexport const OBSERVABILITY_DELTA_POLLING_UPGRADE_MESSAGE =\n 'Delta polling requires a newer @mastra/core with observability delta polling support. Please upgrade.';\nconst OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE = 'trace-query';\nconst OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE = 'trace-aggregate';\nconst OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE = 'span-query';\nconst SPAN_QUERY_CONTEXT_FIELDS = new Set([\n 'traceId',\n 'spanId',\n 'parentSpanId',\n 'threadId',\n 'resourceId',\n 'requestId',\n 'serviceName',\n 'experimentId',\n 'environment',\n 'executionSource',\n 'parentEntityType',\n 'parentEntityId',\n 'parentEntityName',\n 'rootEntityType',\n 'rootEntityId',\n 'rootEntityName',\n]);\nconst OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE = 'trace-query-root-duration';\nconst OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE = 'trace-query-context-ids';\nconst TRACE_QUERY_CONTEXT_ID_FIELDS = new Set(['runId', 'sessionId', 'userId', 'organizationId']);\nconst OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE = 'trace-query-time-to-first-chunk';\nconst TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS = new Set(['timeToFirstChunkMs']);\nconst OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE = 'trace-query-root-span-fields';\nconst TRACE_QUERY_ROOT_SPAN_FIELDS = new Set(['name', 'spanType']);\nconst OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE = 'trace-query-time-to-first-chunk-sort';\nconst OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE = 'trace-query-discovery';\nconst OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE = 'thread-query';\nconst OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE = 'trace-query-tenant-scope';\nconst OBSERVABILITY_FEEDBACK_STORAGE_FEATURE = 'feedback';\nexport const OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_CORE_FEATURE = 'observability-trace-query-tenant-scope';\nexport const OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_UPGRADE_MESSAGE =\n 'Trusted tenant scope requires a newer @mastra/core with trace-query tenant scope support. Please upgrade.';\n\nexport function supportsTraceQueryDiscoveryCore() {\n return (\n coreStorage.getTraceQueryFieldsArgsSchema !== undefined &&\n coreStorage.getTraceQueryFieldsResponseSchema !== undefined &&\n coreStorage.getTraceQueryValuesArgsSchema !== undefined &&\n coreStorage.getTraceQueryValuesResponseSchema !== undefined &&\n typeof coreStorage.planTraceQueryObservedFields === 'function' &&\n typeof coreStorage.planTraceQueryValues === 'function' &&\n typeof coreStorage.getTraceQueryCanonicalFieldDescriptors === 'function' &&\n typeof coreStorage.TraceQueryResourceLimitError === 'function'\n );\n}\n\nexport function supportsTraceAggregateCore() {\n return (\n coreStorage.traceAggregateRequestSchema !== undefined &&\n coreStorage.traceAggregateResponseSchema !== undefined &&\n typeof coreStorage.planTraceAggregate === 'function'\n );\n}\n\nexport function supportsSpanQueryCore() {\n return (\n coreStorage.spanQueryRequestSchema !== undefined &&\n coreStorage.spanQueryResponseSchema !== undefined &&\n typeof coreStorage.planSpanQuery === 'function'\n );\n}\n\nexport const OBSERVABILITY_LIST_ENDPOINTS = {\n traces: 'traces',\n branches: 'branches',\n logs: 'logs',\n metrics: 'metrics',\n scores: 'scores',\n feedback: 'feedback',\n} as const;\n\nexport type ObservabilityListEndpoint =\n (typeof OBSERVABILITY_LIST_ENDPOINTS)[keyof typeof OBSERVABILITY_LIST_ENDPOINTS];\nconst OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE = 'delta-polling';\n\nfunction getFeatures(observabilityStore: ObservabilityStorage): readonly string[] | undefined {\n const candidate = observabilityStore as ObservabilityStorage & {\n getFeatures?: () => readonly string[] | undefined;\n };\n return candidate.getFeatures?.();\n}\n\n/** Retrieves MastraCompositeStore or throws 500 if unavailable. */\nexport function getStorage(mastra: Mastra): MastraCompositeStore {\n const storage = mastra.getStorage();\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not available' });\n }\n return storage;\n}\n\n/** Retrieves the observability storage domain or throws 501 if unavailable. */\nexport async function getObservabilityStore(mastra: Mastra): Promise<ObservabilityStorage> {\n const storage = getStorage(mastra);\n const observability = await storage.getStore('observability');\n if (!observability) {\n // 501, not 500: a missing or explicitly disabled observability domain\n // (e.g. `domains: { observability: false }`) is a capability gap, not a\n // server failure — matching the other 501s in this file.\n throw new HTTPException(501, { message: 'Observability storage domain is not available' });\n }\n return observability;\n}\n\n/** Retrieves the scores storage domain or throws 501 if unavailable. */\nexport async function getScoresStore(mastra: Mastra): Promise<ScoresStorage> {\n const storage = getStorage(mastra);\n const scores = await storage.getStore('scores');\n if (!scores) {\n throw new HTTPException(501, { message: 'Scores storage domain is not available' });\n }\n return scores;\n}\n\nexport function assertObservabilityTraceQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Advanced trace queries are not supported by the configured observability store',\n });\n}\n\nexport function supportsObservabilityTraceAggregate(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE) === true;\n}\n\nexport function assertObservabilityTraceAggregateSupported(observabilityStore: ObservabilityStorage) {\n if (supportsObservabilityTraceAggregate(observabilityStore)) return;\n\n throw new HTTPException(501, {\n message: 'Trace aggregation is not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilitySpanQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Span queries are not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilitySpanQueryFieldsSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryScalarPredicate | undefined,\n) {\n if (!predicate || getFeatures(observabilityStore)?.includes('span-query-context-fields')) return;\n if (predicate.type === 'boolean') {\n for (const arg of predicate.args) assertObservabilitySpanQueryFieldsSupported(observabilityStore, arg);\n } else if (predicate.type === 'not') {\n assertObservabilitySpanQueryFieldsSupported(observabilityStore, predicate.arg);\n } else if (SPAN_QUERY_CONTEXT_FIELDS.has(predicate.field)) {\n throw new coreStorage.TraceQueryValidationError([\n {\n code: 'field_not_allowed',\n path: ['where'],\n message: `Filtering by ${predicate.field} requires an updated storage adapter with span query context-field support.`,\n },\n ]);\n }\n}\n\nfunction usesRootDuration(predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined): boolean {\n if (!predicate) return false;\n if (predicate.type === 'boolean') return predicate.args.some(usesRootDuration);\n if (predicate.type === 'not') return usesRootDuration(predicate.arg);\n if (predicate.type === 'relation') {\n return predicate.collection === 'traces' && usesRootDuration(predicate.predicate);\n }\n return predicate.field === 'durationMs';\n}\n\nexport function supportsObservabilityTraceQueryRootDuration(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE) === true;\n}\n\nexport function assertObservabilityTraceQueryRootDurationSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (!usesRootDuration(predicate) || supportsObservabilityTraceQueryRootDuration(observabilityStore)) return;\n\n throw new HTTPException(501, {\n message: 'Root duration predicates are not supported by the configured observability store',\n });\n}\n\n/** Whether any scalar predicate, at any depth and inside any relation, names one of `fields`. */\nfunction usesField(\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n fields: ReadonlySet<string>,\n): boolean {\n if (!predicate) return false;\n if (predicate.type === 'boolean') return predicate.args.some(arg => usesField(arg, fields));\n if (predicate.type === 'not') return usesField(predicate.arg, fields);\n if (predicate.type === 'relation') return usesField(predicate.predicate, fields);\n return fields.has(predicate.field);\n}\n\nexport function supportsObservabilityTraceQueryContextIds(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE) === true;\n}\n\nexport function isTraceQueryContextIdField(path: string): boolean {\n return TRACE_QUERY_CONTEXT_ID_FIELDS.has(path);\n}\n\nexport function assertObservabilityTraceQueryContextIdsSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (\n !usesField(predicate, TRACE_QUERY_CONTEXT_ID_FIELDS) ||\n supportsObservabilityTraceQueryContextIds(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Context identifier predicates are not supported by the configured observability store',\n });\n}\n\nexport function supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore: ObservabilityStorage) {\n return (\n getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE) === true\n );\n}\n\n/** Covers trace, thread and span query predicates, including `spans` and `traces` relations. */\nexport function assertObservabilityTraceQueryTimeToFirstChunkSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (\n !usesField(predicate, TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS) ||\n supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Time to first chunk predicates are not supported by the configured observability store',\n });\n}\n\nfunction rootSpanFieldIssues(\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n): TraceQueryIssue[] {\n if (!predicate) return [];\n if (predicate.type === 'boolean') return predicate.args.flatMap(rootSpanFieldIssues);\n if (predicate.type === 'not') return rootSpanFieldIssues(predicate.arg);\n // Only trace-scope `name`/`spanType` read the root; inside `spans.some` they are long-supported span fields.\n if (predicate.type === 'relation') {\n return predicate.collection === 'traces' ? rootSpanFieldIssues(predicate.predicate) : [];\n }\n return TRACE_QUERY_ROOT_SPAN_FIELDS.has(predicate.field) ? [rootSpanFieldIssue(['where'], predicate.field)] : [];\n}\n\nfunction rootSpanFieldIssue(path: Array<string | number>, field: string): TraceQueryIssue {\n return {\n code: 'field_not_allowed',\n path,\n message: `Root span ${field} requires an updated storage adapter with trace-query root span field support.`,\n };\n}\n\nexport function supportsObservabilityTraceQueryRootSpanFields(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE) === true;\n}\n\nexport function isTraceQueryRootSpanField(path: string): boolean {\n return TRACE_QUERY_ROOT_SPAN_FIELDS.has(path);\n}\n\n/**\n * Stores that predate trace-scope `name`/`spanType` have no SQL for them and would fail with a\n * 500, so requests that use them are rejected as invalid instead.\n */\nexport function assertObservabilityTraceQueryRootSpanFieldsSupported(\n observabilityStore: ObservabilityStorage,\n plan: {\n where?: TrustedTraceQueryPredicate | TrustedThreadPredicate;\n dimensions?: readonly string[];\n measures?: ReadonlyArray<{ type: string; field?: string }>;\n },\n) {\n if (supportsObservabilityTraceQueryRootSpanFields(observabilityStore)) return;\n const issues = [\n ...rootSpanFieldIssues(plan.where),\n ...(plan.dimensions ?? []).flatMap((dimension, index) =>\n isTraceQueryRootSpanField(dimension) ? [rootSpanFieldIssue(['groupBy', index], dimension)] : [],\n ),\n ...(plan.measures ?? []).flatMap((measure, index) =>\n measure.type === 'countDistinct' && measure.field !== undefined && isTraceQueryRootSpanField(measure.field)\n ? [rootSpanFieldIssue(['measures', index], measure.field)]\n : [],\n ),\n ];\n if (issues.length > 0) throw new coreStorage.TraceQueryValidationError(issues);\n}\n\nexport function assertObservabilityTraceQueryRootSpanValuesSupported(\n observabilityStore: ObservabilityStorage,\n plan: { predicateScope: string; path: string },\n) {\n if (plan.predicateScope !== 'trace' || !isTraceQueryRootSpanField(plan.path)) return;\n if (supportsObservabilityTraceQueryRootSpanFields(observabilityStore)) return;\n throw new coreStorage.TraceQueryValidationError([rootSpanFieldIssue(['path'], plan.path)]);\n}\n\nexport function supportsObservabilityTraceQueryTimeToFirstChunkSort(observabilityStore: ObservabilityStorage) {\n return (\n getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE) ===\n true\n );\n}\n\n/** Covers the sort of trace and span queries. */\nexport function assertObservabilityTraceQueryTimeToFirstChunkSortSupported(\n observabilityStore: ObservabilityStorage,\n orderBy: { field: string },\n) {\n if (\n !TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS.has(orderBy.field) ||\n supportsObservabilityTraceQueryTimeToFirstChunkSort(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Sorting by time to first chunk is not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilityTraceQueryDiscoverySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Trace query discovery is not supported by the configured observability store',\n });\n}\n\n/**\n * A scoped request must never run unscoped: a store that predates tenant scope would\n * silently ignore `plan.scope` and return every tenant's rows, so it is rejected instead.\n * Unscoped requests are unaffected.\n */\nexport function assertObservabilityTraceQueryTenantScopeSupported(\n observabilityStore: ObservabilityStorage,\n scope: coreStorage.TraceQueryTenantScope | undefined,\n) {\n if (scope === undefined) return;\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'The configured observability store cannot enforce the trusted tenant scope',\n });\n}\n\nexport function assertObservabilityThreadQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Advanced thread queries are not supported by the configured observability store',\n });\n}\n\n/**\n * Returns true when the store's class chain overrides `method` below the class\n * that first declares it (the `ObservabilityStorage` base, whose default\n * throws `*_NOT_IMPLEMENTED`). Walks the store's own prototype chain instead of\n * comparing against this package's `ObservabilityStorage.prototype`, so it\n * works for stores built against older or duplicated `@mastra/core` installs\n * and for stores that predate {@link ObservabilityStorage.getFeatures}.\n */\nfunction implementsObservabilityStorageMethod(observabilityStore: object, method: string): boolean {\n if (Object.prototype.hasOwnProperty.call(observabilityStore, method)) return true;\n\n let resolvedOwner: object | undefined;\n let declaringBase: object | undefined;\n for (\n let proto: object | null = Object.getPrototypeOf(observabilityStore);\n proto && proto !== Object.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n if (Object.prototype.hasOwnProperty.call(proto, method)) {\n resolvedOwner ??= proto;\n declaringBase = proto;\n }\n }\n return resolvedOwner !== undefined && resolvedOwner !== declaringBase;\n}\n\nexport type ObservabilityDiscoveryCapabilities = {\n entityTypes: boolean;\n entityNames: boolean;\n serviceNames: boolean;\n environments: boolean;\n tags: boolean;\n metrics: boolean;\n};\n\nexport type ObservabilityStorageCapabilities = {\n metrics: boolean;\n logs: boolean;\n discovery: ObservabilityDiscoveryCapabilities;\n deltaPolling: boolean;\n traceQuery: boolean;\n traceQueryRootDuration: boolean;\n traceQueryContextIds: boolean;\n traceQueryTimeToFirstChunk: boolean;\n traceQueryRootSpanFields: boolean;\n traceQueryTimeToFirstChunkSort: boolean;\n traceQueryDiscovery: boolean;\n traceQueryTenantScope: boolean;\n traceAggregate: boolean;\n threadQuery: boolean;\n threadQueryRows: boolean;\n spanQuery: boolean;\n /** Days of traces the store keeps. Omitted when the store does not report a limit. */\n traceRetentionDays?: number;\n feedback: boolean;\n};\n\nexport const NO_OBSERVABILITY_STORAGE_CAPABILITIES: ObservabilityStorageCapabilities = {\n metrics: false,\n logs: false,\n discovery: {\n entityTypes: false,\n entityNames: false,\n serviceNames: false,\n environments: false,\n tags: false,\n metrics: false,\n },\n deltaPolling: false,\n traceQuery: false,\n traceQueryRootDuration: false,\n traceQueryContextIds: false,\n traceQueryTimeToFirstChunk: false,\n traceQueryRootSpanFields: false,\n traceQueryTimeToFirstChunkSort: false,\n traceQueryDiscovery: false,\n traceQueryTenantScope: false,\n traceAggregate: false,\n threadQuery: false,\n threadQueryRows: false,\n spanQuery: false,\n feedback: false,\n};\n\n/**\n * Resolves which optional observability APIs the configured store can serve.\n *\n * Feature declarations (`getFeatures()`) are optional. When a store declares\n * a feature list, that list is final. Stores without `getFeatures()` predate\n * declarations: metrics, logs and filter discovery are detected by whether the\n * store implements the underlying method, so those packages report accurately\n * without being upgraded. Delta polling and the trace/thread query APIs depend\n * on runtime behavior a method check can't see, so they are only reported for\n * stores that declare them. Feedback is also declaration-only: Studio hides\n * the feedback UI behind this flag, and store versions that implement feedback\n * without declaring it simply don't advertise it until upgraded.\n */\nexport function getObservabilityStorageCapabilities(\n observabilityStore: ObservabilityStorage,\n): ObservabilityStorageCapabilities {\n const declaredFeatures = getFeatures(observabilityStore);\n const features = declaredFeatures ?? [];\n const newApiCore = coreFeatures.has('observability:v1.13.2');\n const declares = (feature: string) => features.includes(feature);\n // Undeclared stores must implement every method behind the feature.\n const supports = (feature: string, methods: readonly string[]) => {\n if (!newApiCore) return false;\n if (!declaredFeatures) {\n return methods.every(method => implementsObservabilityStorageMethod(observabilityStore, method));\n }\n return declares(feature);\n };\n // Stores released before the per-endpoint discovery features existed declare\n // `trace-query` and implement every discovery method, so treat it as implying discovery.\n const supportsDiscovery = (feature: string, methods: readonly string[]) =>\n supports(feature, methods) || (newApiCore && declares(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE));\n const traceQuery =\n newApiCore &&\n typeof coreStorage.planTraceQuery === 'function' &&\n declares(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE);\n const threadQuery =\n newApiCore &&\n typeof coreStorage.planThreadQuery === 'function' &&\n declares(OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE);\n const spanQuery = newApiCore && supportsSpanQueryCore() && declares(OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE);\n\n return {\n // `listMetrics` is left out: it backs a newer route that metric dashboards don't use,\n // and older stores that implement the OLAP methods predate it.\n metrics: supports('metrics', [\n 'getMetricAggregate',\n 'getMetricBreakdown',\n 'getMetricTimeSeries',\n 'getMetricPercentiles',\n ]),\n logs: supports('logs', ['listLogs']),\n discovery: {\n entityTypes: supportsDiscovery('entity-type-discovery', ['getEntityTypes']),\n entityNames: supportsDiscovery('entity-name-discovery', ['getEntityNames']),\n serviceNames: supportsDiscovery('service-name-discovery', ['getServiceNames']),\n environments: supportsDiscovery('environment-discovery', ['getEnvironments']),\n tags: supportsDiscovery('tag-discovery', ['getTags']),\n metrics: supportsDiscovery('metric-discovery', ['getMetricNames', 'getMetricLabelKeys', 'getMetricLabelValues']),\n },\n deltaPolling:\n coreFeatures.has(OBSERVABILITY_DELTA_POLLING_FEATURE) && declares(OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE),\n traceQuery,\n traceQueryRootDuration:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE),\n traceQueryContextIds:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE),\n traceQueryTimeToFirstChunk:\n (traceQuery || threadQuery || spanQuery) &&\n declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE),\n traceQueryRootSpanFields:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE),\n traceQueryTimeToFirstChunkSort:\n (traceQuery || spanQuery) && declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE),\n traceQueryDiscovery:\n newApiCore && supportsTraceQueryDiscoveryCore() && declares(OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE),\n traceQueryTenantScope:\n (traceQuery || threadQuery) &&\n coreFeatures.has(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_CORE_FEATURE) &&\n declares(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE),\n traceAggregate:\n newApiCore && supportsTraceAggregateCore() && declares(OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE),\n threadQuery,\n threadQueryRows:\n threadQuery && typeof coreStorage.planThreadRowsQuery === 'function' && declares('thread-query-rows'),\n spanQuery,\n feedback: newApiCore && declares(OBSERVABILITY_FEEDBACK_STORAGE_FEATURE),\n };\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): boolean {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Discovery is optional for observability stores. When the configured store\n * doesn't implement a discovery method, answer with an empty result instead of\n * a 500 so filter lookups degrade quietly on stores without discovery support.\n * Clients should check `observabilityStorageCapabilities.discovery` from\n * `GET /system/packages` before calling these routes.\n */\nexport async function withDiscoveryFallback<T>(run: () => Promise<T>, empty: T): Promise<T> {\n try {\n return await run();\n } catch (error) {\n if (isObservabilityStorageNotImplementedError(error)) return empty;\n throw error;\n }\n}\n\nexport function assertObservabilityDeltaSupported(\n observabilityStore: ObservabilityStorage,\n endpoint: ObservabilityListEndpoint,\n) {\n if (!coreFeatures.has(OBSERVABILITY_DELTA_POLLING_FEATURE)) {\n throw new HTTPException(501, {\n message: `${OBSERVABILITY_DELTA_POLLING_UPGRADE_MESSAGE} (endpoint: ${endpoint})`,\n });\n }\n\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE)) {\n return;\n }\n\n throw new HTTPException(501, {\n message: `Delta polling is not supported by the configured observability store for ${endpoint}`,\n });\n}\n\nexport interface RouteDetails {\n method: ServerRoute['method'];\n path: `/${string}`;\n summary: string;\n description: string;\n requiresPermission?: ServerRoute['requiresPermission'];\n}\n\nexport const NEW_ROUTE_DEFS = {\n QUERY_TRACES: {\n method: 'POST',\n path: '/observability/traces/query',\n summary: 'Query traces',\n description:\n 'Returns completed logical traces or distinct thread groups matching an advanced trace query. Thread grouping remains supported but is deprecated; use queryTraceThreads instead.',\n requiresPermission: 'observability:read',\n },\n\n AGGREGATE_TRACES: {\n method: 'POST',\n path: '/observability/traces/aggregate',\n summary: 'Aggregate traces',\n description:\n 'Returns grouped and optionally time-bucketed measures (counts, durations, error rates) over completed logical traces matching an advanced trace predicate',\n requiresPermission: 'observability:read',\n },\n\n QUERY_THREADS: {\n method: 'POST',\n path: '/observability/threads/query',\n summary: 'Query threads',\n description:\n 'Returns full-history thread rows with activity timestamps, first/last traces, previews and context fields',\n requiresPermission: 'observability:read',\n },\n\n QUERY_SPANS: {\n method: 'POST',\n path: '/observability/spans/query',\n summary: 'Query spans',\n description: 'Returns completed spans matching a span predicate, one row per span, with cursor pagination',\n requiresPermission: 'observability:read',\n },\n\n GET_TRACE_QUERY_FIELDS: {\n method: 'POST',\n path: '/observability/traces/query/fields',\n summary: 'Discover trace query fields',\n description: 'Returns canonical query fields and observed top-level string metadata fields',\n requiresPermission: 'observability:read',\n },\n\n GET_TRACE_QUERY_VALUES: {\n method: 'POST',\n path: '/observability/traces/query/values',\n summary: 'Discover trace query values',\n description: 'Returns bounded string value suggestions and occurrence counts for one eligible query field',\n requiresPermission: 'observability:read',\n },\n\n LIST_METRICS: {\n method: 'GET',\n path: '/observability/metrics',\n summary: 'List metrics',\n description: 'Returns a paginated list of metrics with optional filtering and sorting',\n },\n\n LIST_LOGS: {\n method: 'GET',\n path: '/observability/logs',\n summary: 'List logs',\n description: 'Returns a paginated list of logs with optional filtering and sorting',\n },\n\n LIST_SCORES: {\n method: 'GET',\n path: '/observability/scores',\n summary: 'List scores',\n description: 'Returns a paginated list of scores with optional filtering and sorting',\n },\n\n CREATE_SCORE: {\n method: 'POST',\n path: '/observability/scores',\n summary: 'Create a score',\n description: 'Creates a single score record in the observability store',\n },\n\n DELETE_SCORES: {\n method: 'DELETE',\n path: '/observability/scores',\n summary: 'Delete scores',\n description: 'Deletes score records by scoreId, optionally scoped to a tenant',\n requiresPermission: 'observability:delete',\n },\n\n GET_SCORE: {\n method: 'GET',\n path: '/observability/scores/:scoreId',\n summary: 'Get score',\n description: 'Returns a single score by scoreId',\n },\n\n GET_SCORE_AGGREGATE: {\n method: 'POST',\n path: '/observability/scores/aggregate',\n summary: 'Get score aggregate',\n description: 'Returns an aggregated score value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_BREAKDOWN: {\n method: 'POST',\n path: '/observability/scores/breakdown',\n summary: 'Get score breakdown',\n description: 'Returns score values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_TIME_SERIES: {\n method: 'POST',\n path: '/observability/scores/timeseries',\n summary: 'Get score time series',\n description: 'Returns score values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_PERCENTILES: {\n method: 'POST',\n path: '/observability/scores/percentiles',\n summary: 'Get score percentiles',\n description: 'Returns percentile values for a score bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n LIST_FEEDBACK: {\n method: 'GET',\n path: '/observability/feedback',\n summary: 'List feedback',\n description: 'Returns a paginated list of feedback with optional filtering and sorting',\n },\n\n CREATE_FEEDBACK: {\n method: 'POST',\n path: '/observability/feedback',\n summary: 'Create feedback',\n description: 'Creates a single feedback record in the observability store',\n },\n\n DELETE_FEEDBACK: {\n method: 'DELETE',\n path: '/observability/feedback',\n summary: 'Delete feedback',\n description: 'Deletes feedback records by feedbackId, optionally scoped to a tenant',\n requiresPermission: 'observability:delete',\n },\n\n UPDATE_FEEDBACK_REVIEW_STATUS: {\n method: 'PATCH',\n path: '/observability/feedback/:feedbackId/review-status',\n summary: 'Update feedback review status',\n description: \"Updates a feedback record's review workflow status\",\n requiresPermission: 'observability:write',\n },\n\n GET_FEEDBACK_AGGREGATE: {\n method: 'POST',\n path: '/observability/feedback/aggregate',\n summary: 'Get feedback aggregate',\n description: 'Returns an aggregated numeric feedback value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_BREAKDOWN: {\n method: 'POST',\n path: '/observability/feedback/breakdown',\n summary: 'Get feedback breakdown',\n description: 'Returns numeric feedback values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_TIME_SERIES: {\n method: 'POST',\n path: '/observability/feedback/timeseries',\n summary: 'Get feedback time series',\n description: 'Returns numeric feedback values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_PERCENTILES: {\n method: 'POST',\n path: '/observability/feedback/percentiles',\n summary: 'Get feedback percentiles',\n description: 'Returns percentile values for numeric feedback bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_AGGREGATE: {\n method: 'POST',\n path: '/observability/metrics/aggregate',\n summary: 'Get metric aggregate',\n description: 'Returns an aggregated metric value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_BREAKDOWN: {\n method: 'POST',\n path: '/observability/metrics/breakdown',\n summary: 'Get metric breakdown',\n description: 'Returns metric values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_TIME_SERIES: {\n method: 'POST',\n path: '/observability/metrics/timeseries',\n summary: 'Get metric time series',\n description: 'Returns metric values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_PERCENTILES: {\n method: 'POST',\n path: '/observability/metrics/percentiles',\n summary: 'Get metric percentiles',\n description: 'Returns percentile values for a metric bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_NAMES: {\n method: 'GET',\n path: '/observability/discovery/metric-names',\n summary: 'Get metric names',\n description: 'Returns distinct metric names with optional prefix filtering',\n },\n\n GET_METRIC_LABEL_KEYS: {\n method: 'GET',\n path: '/observability/discovery/metric-label-keys',\n summary: 'Get metric label keys',\n description: 'Returns distinct label keys for a given metric',\n },\n\n GET_METRIC_LABEL_VALUES: {\n method: 'GET',\n path: '/observability/discovery/metric-label-values',\n summary: 'Get label values',\n description: 'Returns distinct values for a given metric label key',\n },\n\n GET_ENTITY_TYPES: {\n method: 'GET',\n path: '/observability/discovery/entity-types',\n summary: 'Get entity types',\n description: 'Returns distinct entity types from observability data',\n },\n\n GET_ENTITY_NAMES: {\n method: 'GET',\n path: '/observability/discovery/entity-names',\n summary: 'Get entity names',\n description: 'Returns distinct entity names with optional type filtering',\n },\n\n GET_SERVICE_NAMES: {\n method: 'GET',\n path: '/observability/discovery/service-names',\n summary: 'Get service names',\n description: 'Returns distinct service names from observability data',\n },\n\n GET_ENVIRONMENTS: {\n method: 'GET',\n path: '/observability/discovery/environments',\n summary: 'Get environments',\n description: 'Returns distinct environments from observability data',\n },\n\n GET_TAGS: {\n method: 'GET',\n path: '/observability/discovery/tags',\n summary: 'Get tags',\n description: 'Returns distinct tags with optional entity type filtering',\n },\n\n GET_CAPABILITIES: {\n method: 'GET',\n path: '/observability/capabilities',\n summary: 'Get observability capabilities',\n description:\n 'Returns which optional observability APIs the configured observability storage supports. Every flag is false when no observability storage is configured.',\n },\n} as const satisfies Record<string, RouteDetails>;\n\nexport type NewRoutesKey = keyof typeof NEW_ROUTE_DEFS;\nexport type NewRoutesDefinitions = (typeof NEW_ROUTE_DEFS)[NewRoutesKey];\n\nexport function createObservabilityListQuerySchema<\n TFilter extends z.ZodObject<z.ZodRawShape>,\n TOrderBy extends z.ZodObject<z.ZodRawShape>,\n>(filterSchema: TFilter, orderBySchema: TOrderBy) {\n const unwrapDefault = (schema: unknown) => {\n const zodSchema = schema as z.ZodTypeAny;\n return zodSchema instanceof z.ZodDefault ? zodSchema.unwrap() : zodSchema;\n };\n const paginationShape = paginationArgsSchema.shape as unknown as Record<string, z.ZodTypeAny>;\n const orderByShape = orderBySchema.shape as unknown as Record<string, z.ZodTypeAny>;\n\n const pageSchema = unwrapDefault(paginationShape.page);\n const perPageSchema = unwrapDefault(paginationShape.perPage);\n const fieldSchema = orderByShape.field ? unwrapDefault(orderByShape.field) : z.never().optional();\n const directionSchema = orderByShape.direction ? unwrapDefault(orderByShape.direction) : z.never().optional();\n\n return wrapSchemaForQueryParams(\n z\n .object({\n ...filterSchema.shape,\n page: pageSchema,\n perPage: perPageSchema,\n field: fieldSchema,\n direction: directionSchema,\n mode: listModeSchema.optional(),\n after: deltaCursorSchema.optional(),\n limit: deltaLimitSchema,\n })\n .partial(),\n ).superRefine((value, ctx) => {\n const isDelta = value.mode === 'delta';\n const hasPagination = value.page !== undefined || value.perPage !== undefined;\n const hasOrderBy = value.field !== undefined || value.direction !== undefined;\n const hasAfter = value.after !== undefined;\n const hasLimit = value.limit !== undefined;\n\n if (isDelta) {\n if (hasPagination) {\n if (value.page !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['page'],\n message: '`page` is not allowed when `mode=delta`',\n });\n }\n if (value.perPage !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['perPage'],\n message: '`perPage` is not allowed when `mode=delta`',\n });\n }\n }\n if (hasOrderBy) {\n if (value.field !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['field'],\n message: '`field` is not allowed when `mode=delta`',\n });\n }\n if (value.direction !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['direction'],\n message: '`direction` is not allowed when `mode=delta`',\n });\n }\n }\n return;\n }\n\n if (hasAfter) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['after'],\n message: '`after` is only allowed when `mode=delta`',\n });\n }\n if (hasLimit) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['limit'],\n message: '`limit` is only allowed when `mode=delta`',\n });\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAuBA,MAAa,sCAAsC;AACnD,MAAa,8CACX;AACF,MAAM,4CAA4C;AAClD,MAAM,gDAAgD;AACtD,MAAM,2CAA2C;AACjD,MAAM,4CAA4B,IAAI,IAAI;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,0DAA0D;AAChE,MAAM,wDAAwD;AAC9D,MAAM,gDAAgC,IAAI,IAAI;CAAC;CAAS;CAAa;CAAU;AAAgB,CAAC;AAChG,MAAM,gEAAgE;AACtE,MAAM,yDAAyC,IAAI,IAAI,CAAC,oBAAoB,CAAC;AAC7E,MAAM,6DAA6D;AACnE,MAAM,+CAA+B,IAAI,IAAI,CAAC,QAAQ,UAAU,CAAC;AACjE,MAAM,qEAAqE;AAC3E,MAAM,sDAAsD;AAC5D,MAAM,6CAA6C;AACnD,MAAM,yDAAyD;AAC/D,MAAM,yCAAyC;AAC/C,MAAa,s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AAU,MAAM,SAAS;EAC/B,MAAM,gBAAgB,MAAM,SAAS,KAAA,KAAa,MAAM,YAAY,KAAA;EACpE,MAAM,aAAa,MAAM,UAAU,KAAA,KAAa,MAAM,cAAc,KAAA;EACpE,MAAM,WAAW,MAAM,UAAU,KAAA;EACjC,MAAM,WAAW,MAAM,UAAU,KAAA;EAEjC,IAAI,SAAS;GACX,IAAI,eAAe;IACjB,IAAI,MAAM,SAAS,KAAA,GACjB,IAAI,SAAS;KACX,MAAML,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,MAAM;KACb,SAAS;IACX,CAAC;IAEH,IAAI,MAAM,YAAY,KAAA,GACpB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,SAAS;KAChB,SAAS;IACX,CAAC;GAEL;GACA,IAAI,YAAY;IACd,IAAI,MAAM,UAAU,KAAA,GAClB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,OAAO;KACd,SAAS;IACX,CAAC;IAEH,IAAI,MAAM,cAAc,KAAA,GACtB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,WAAW;KAClB,SAAS;IACX,CAAC;GAEL;GACA;EACF;EAEA,IAAI,UACF,IAAI,SAAS;GACX,MAAMA,OAAAA,EAAE,aAAa;GACrB,MAAM,CAAC,OAAO;GACd,SAAS;EACX,CAAC;EAEH,IAAI,UACF,IAAI,SAAS;GACX,MAAMA,OAAAA,EAAE,aAAa;GACrB,MAAM,CAAC,OAAO;GACd,SAAS;EACX,CAAC;CAEL,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"observability-shared.cjs","names":["coreStorage","candidate","HTTPException","coreFeatures","z","paginationArgsSchema","wrapSchemaForQueryParams","listModeSchema","deltaCursorSchema","deltaLimitSchema"],"sources":["../../../src/server/handlers/observability-shared.ts"],"sourcesContent":["import type { Mastra } from '@mastra/core';\nimport { coreFeatures } from '@mastra/core/features';\nimport type {\n MastraCompositeStore,\n ObservabilityStorage,\n ScoresStorage,\n TraceQueryIssue,\n TrustedTraceQueryScalarPredicate,\n TrustedThreadPredicate,\n TrustedTraceQueryPredicate,\n} from '@mastra/core/storage';\nimport * as coreStorage from '@mastra/core/storage';\nimport { z } from 'zod/v4';\nimport { HTTPException } from '../http-exception';\nimport type { ServerRoute } from '../server-adapter/routes';\nimport { wrapSchemaForQueryParams } from '../server-adapter/routes/route-builder';\nimport {\n deltaCursorSchema,\n deltaLimitSchema,\n listModeSchema,\n paginationArgsSchema,\n} from './observability-list-query-schemas';\n\nexport const OBSERVABILITY_DELTA_POLLING_FEATURE = 'observability-delta-polling';\nexport const OBSERVABILITY_DELTA_POLLING_UPGRADE_MESSAGE =\n 'Delta polling requires a newer @mastra/core with observability delta polling support. Please upgrade.';\nconst OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE = 'trace-query';\nconst OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE = 'trace-aggregate';\nconst OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE = 'span-query';\nconst SPAN_QUERY_CONTEXT_FIELDS = new Set([\n 'traceId',\n 'spanId',\n 'parentSpanId',\n 'threadId',\n 'resourceId',\n 'requestId',\n 'serviceName',\n 'experimentId',\n 'environment',\n 'executionSource',\n 'parentEntityType',\n 'parentEntityId',\n 'parentEntityName',\n 'rootEntityType',\n 'rootEntityId',\n 'rootEntityName',\n]);\nconst OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE = 'trace-query-root-duration';\nconst OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE = 'trace-query-context-ids';\nconst TRACE_QUERY_CONTEXT_ID_FIELDS = new Set(['runId', 'sessionId', 'userId', 'organizationId']);\nconst OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE = 'trace-query-time-to-first-chunk';\nconst TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS = new Set(['timeToFirstChunkMs']);\nconst OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE = 'trace-query-root-span-fields';\nconst OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE = 'trace-query-root-entity-id';\n// Trace-scope fields read from the root span, keyed by the storage feature that added their SQL.\nconst TRACE_QUERY_ROOT_SPAN_FIELD_FEATURES = new Map([\n ['name', OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE],\n ['spanType', OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE],\n ['entityId', OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE],\n]);\nconst OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE = 'trace-query-time-to-first-chunk-sort';\nconst OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE = 'trace-query-discovery';\nconst OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE = 'thread-query';\nconst OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE = 'trace-query-tenant-scope';\nconst OBSERVABILITY_FEEDBACK_STORAGE_FEATURE = 'feedback';\nexport const OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_CORE_FEATURE = 'observability-trace-query-tenant-scope';\nexport const OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_UPGRADE_MESSAGE =\n 'Trusted tenant scope requires a newer @mastra/core with trace-query tenant scope support. Please upgrade.';\n\nexport function supportsTraceQueryDiscoveryCore() {\n return (\n coreStorage.getTraceQueryFieldsArgsSchema !== undefined &&\n coreStorage.getTraceQueryFieldsResponseSchema !== undefined &&\n coreStorage.getTraceQueryValuesArgsSchema !== undefined &&\n coreStorage.getTraceQueryValuesResponseSchema !== undefined &&\n typeof coreStorage.planTraceQueryObservedFields === 'function' &&\n typeof coreStorage.planTraceQueryValues === 'function' &&\n typeof coreStorage.getTraceQueryCanonicalFieldDescriptors === 'function' &&\n typeof coreStorage.TraceQueryResourceLimitError === 'function'\n );\n}\n\nexport function supportsTraceAggregateCore() {\n return (\n coreStorage.traceAggregateRequestSchema !== undefined &&\n coreStorage.traceAggregateResponseSchema !== undefined &&\n typeof coreStorage.planTraceAggregate === 'function'\n );\n}\n\nexport function supportsSpanQueryCore() {\n return (\n coreStorage.spanQueryRequestSchema !== undefined &&\n coreStorage.spanQueryResponseSchema !== undefined &&\n typeof coreStorage.planSpanQuery === 'function'\n );\n}\n\nexport const OBSERVABILITY_LIST_ENDPOINTS = {\n traces: 'traces',\n branches: 'branches',\n logs: 'logs',\n metrics: 'metrics',\n scores: 'scores',\n feedback: 'feedback',\n} as const;\n\nexport type ObservabilityListEndpoint =\n (typeof OBSERVABILITY_LIST_ENDPOINTS)[keyof typeof OBSERVABILITY_LIST_ENDPOINTS];\nconst OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE = 'delta-polling';\n\nfunction getFeatures(observabilityStore: ObservabilityStorage): readonly string[] | undefined {\n const candidate = observabilityStore as ObservabilityStorage & {\n getFeatures?: () => readonly string[] | undefined;\n };\n return candidate.getFeatures?.();\n}\n\n/** Retrieves MastraCompositeStore or throws 500 if unavailable. */\nexport function getStorage(mastra: Mastra): MastraCompositeStore {\n const storage = mastra.getStorage();\n if (!storage) {\n throw new HTTPException(500, { message: 'Storage is not available' });\n }\n return storage;\n}\n\n/** Retrieves the observability storage domain or throws 501 if unavailable. */\nexport async function getObservabilityStore(mastra: Mastra): Promise<ObservabilityStorage> {\n const storage = getStorage(mastra);\n const observability = await storage.getStore('observability');\n if (!observability) {\n // 501, not 500: a missing or explicitly disabled observability domain\n // (e.g. `domains: { observability: false }`) is a capability gap, not a\n // server failure — matching the other 501s in this file.\n throw new HTTPException(501, { message: 'Observability storage domain is not available' });\n }\n return observability;\n}\n\n/** Retrieves the scores storage domain or throws 501 if unavailable. */\nexport async function getScoresStore(mastra: Mastra): Promise<ScoresStorage> {\n const storage = getStorage(mastra);\n const scores = await storage.getStore('scores');\n if (!scores) {\n throw new HTTPException(501, { message: 'Scores storage domain is not available' });\n }\n return scores;\n}\n\nexport function assertObservabilityTraceQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Advanced trace queries are not supported by the configured observability store',\n });\n}\n\nexport function supportsObservabilityTraceAggregate(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE) === true;\n}\n\nexport function assertObservabilityTraceAggregateSupported(observabilityStore: ObservabilityStorage) {\n if (supportsObservabilityTraceAggregate(observabilityStore)) return;\n\n throw new HTTPException(501, {\n message: 'Trace aggregation is not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilitySpanQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Span queries are not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilitySpanQueryFieldsSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryScalarPredicate | undefined,\n) {\n if (!predicate || getFeatures(observabilityStore)?.includes('span-query-context-fields')) return;\n if (predicate.type === 'boolean') {\n for (const arg of predicate.args) assertObservabilitySpanQueryFieldsSupported(observabilityStore, arg);\n } else if (predicate.type === 'not') {\n assertObservabilitySpanQueryFieldsSupported(observabilityStore, predicate.arg);\n } else if (SPAN_QUERY_CONTEXT_FIELDS.has(predicate.field)) {\n throw new coreStorage.TraceQueryValidationError([\n {\n code: 'field_not_allowed',\n path: ['where'],\n message: `Filtering by ${predicate.field} requires an updated storage adapter with span query context-field support.`,\n },\n ]);\n }\n}\n\nfunction usesRootDuration(predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined): boolean {\n if (!predicate) return false;\n if (predicate.type === 'boolean') return predicate.args.some(usesRootDuration);\n if (predicate.type === 'not') return usesRootDuration(predicate.arg);\n if (predicate.type === 'relation') {\n return predicate.collection === 'traces' && usesRootDuration(predicate.predicate);\n }\n return predicate.field === 'durationMs';\n}\n\nexport function supportsObservabilityTraceQueryRootDuration(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE) === true;\n}\n\nexport function assertObservabilityTraceQueryRootDurationSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (!usesRootDuration(predicate) || supportsObservabilityTraceQueryRootDuration(observabilityStore)) return;\n\n throw new HTTPException(501, {\n message: 'Root duration predicates are not supported by the configured observability store',\n });\n}\n\n/** Whether any scalar predicate, at any depth and inside any relation, names one of `fields`. */\nfunction usesField(\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n fields: ReadonlySet<string>,\n): boolean {\n if (!predicate) return false;\n if (predicate.type === 'boolean') return predicate.args.some(arg => usesField(arg, fields));\n if (predicate.type === 'not') return usesField(predicate.arg, fields);\n if (predicate.type === 'relation') return usesField(predicate.predicate, fields);\n return fields.has(predicate.field);\n}\n\nexport function supportsObservabilityTraceQueryContextIds(observabilityStore: ObservabilityStorage) {\n return getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE) === true;\n}\n\nexport function isTraceQueryContextIdField(path: string): boolean {\n return TRACE_QUERY_CONTEXT_ID_FIELDS.has(path);\n}\n\nexport function assertObservabilityTraceQueryContextIdsSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (\n !usesField(predicate, TRACE_QUERY_CONTEXT_ID_FIELDS) ||\n supportsObservabilityTraceQueryContextIds(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Context identifier predicates are not supported by the configured observability store',\n });\n}\n\nexport function supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore: ObservabilityStorage) {\n return (\n getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE) === true\n );\n}\n\n/** Covers trace, thread and span query predicates, including `spans` and `traces` relations. */\nexport function assertObservabilityTraceQueryTimeToFirstChunkSupported(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n) {\n if (\n !usesField(predicate, TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS) ||\n supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Time to first chunk predicates are not supported by the configured observability store',\n });\n}\n\nfunction rootSpanFieldIssues(\n observabilityStore: ObservabilityStorage,\n predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined,\n): TraceQueryIssue[] {\n if (!predicate) return [];\n if (predicate.type === 'boolean') return predicate.args.flatMap(arg => rootSpanFieldIssues(observabilityStore, arg));\n if (predicate.type === 'not') return rootSpanFieldIssues(observabilityStore, predicate.arg);\n // Only trace-scope root span fields read the root; inside `spans.some` they are long-supported span fields.\n if (predicate.type === 'relation') {\n return predicate.collection === 'traces' ? rootSpanFieldIssues(observabilityStore, predicate.predicate) : [];\n }\n return supportsObservabilityTraceQueryRootSpanField(observabilityStore, predicate.field)\n ? []\n : [rootSpanFieldIssue(['where'], predicate.field)];\n}\n\nfunction rootSpanFieldIssue(path: Array<string | number>, field: string): TraceQueryIssue {\n return {\n code: 'field_not_allowed',\n path,\n message: `Root span ${field} requires an updated storage adapter with trace-query root span field support.`,\n };\n}\n\n/**\n * Whether the store can serve `path` at trace scope. Fields that don't read the root span are\n * always supported here; other gates cover them.\n */\nexport function supportsObservabilityTraceQueryRootSpanField(observabilityStore: ObservabilityStorage, path: string) {\n const feature = TRACE_QUERY_ROOT_SPAN_FIELD_FEATURES.get(path);\n return feature === undefined || getFeatures(observabilityStore)?.includes(feature) === true;\n}\n\n/**\n * Stores that predate a trace-scope root span field have no SQL for it and would fail with a\n * 500, so requests that use it are rejected as invalid instead.\n */\nexport function assertObservabilityTraceQueryRootSpanFieldsSupported(\n observabilityStore: ObservabilityStorage,\n plan: {\n where?: TrustedTraceQueryPredicate | TrustedThreadPredicate;\n dimensions?: readonly string[];\n measures?: ReadonlyArray<{ type: string; field?: string }>;\n },\n) {\n const supported = (field: string) => supportsObservabilityTraceQueryRootSpanField(observabilityStore, field);\n const issues = [\n ...rootSpanFieldIssues(observabilityStore, plan.where),\n ...(plan.dimensions ?? []).flatMap((dimension, index) =>\n supported(dimension) ? [] : [rootSpanFieldIssue(['groupBy', index], dimension)],\n ),\n ...(plan.measures ?? []).flatMap((measure, index) =>\n measure.type === 'countDistinct' && measure.field !== undefined && !supported(measure.field)\n ? [rootSpanFieldIssue(['measures', index], measure.field)]\n : [],\n ),\n ];\n if (issues.length > 0) throw new coreStorage.TraceQueryValidationError(issues);\n}\n\nexport function assertObservabilityTraceQueryRootSpanValuesSupported(\n observabilityStore: ObservabilityStorage,\n plan: { predicateScope: string; path: string },\n) {\n if (plan.predicateScope !== 'trace') return;\n if (supportsObservabilityTraceQueryRootSpanField(observabilityStore, plan.path)) return;\n throw new coreStorage.TraceQueryValidationError([rootSpanFieldIssue(['path'], plan.path)]);\n}\n\nexport function supportsObservabilityTraceQueryTimeToFirstChunkSort(observabilityStore: ObservabilityStorage) {\n return (\n getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE) ===\n true\n );\n}\n\n/** Covers the sort of trace and span queries. */\nexport function assertObservabilityTraceQueryTimeToFirstChunkSortSupported(\n observabilityStore: ObservabilityStorage,\n orderBy: { field: string },\n) {\n if (\n !TRACE_QUERY_TIME_TO_FIRST_CHUNK_FIELDS.has(orderBy.field) ||\n supportsObservabilityTraceQueryTimeToFirstChunkSort(observabilityStore)\n ) {\n return;\n }\n\n throw new HTTPException(501, {\n message: 'Sorting by time to first chunk is not supported by the configured observability store',\n });\n}\n\nexport function assertObservabilityTraceQueryDiscoverySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Trace query discovery is not supported by the configured observability store',\n });\n}\n\n/**\n * A scoped request must never run unscoped: a store that predates tenant scope would\n * silently ignore `plan.scope` and return every tenant's rows, so it is rejected instead.\n * Unscoped requests are unaffected.\n */\nexport function assertObservabilityTraceQueryTenantScopeSupported(\n observabilityStore: ObservabilityStorage,\n scope: coreStorage.TraceQueryTenantScope | undefined,\n) {\n if (scope === undefined) return;\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'The configured observability store cannot enforce the trusted tenant scope',\n });\n}\n\nexport function assertObservabilityThreadQuerySupported(observabilityStore: ObservabilityStorage) {\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE)) return;\n\n throw new HTTPException(501, {\n message: 'Advanced thread queries are not supported by the configured observability store',\n });\n}\n\n/**\n * Returns true when the store's class chain overrides `method` below the class\n * that first declares it (the `ObservabilityStorage` base, whose default\n * throws `*_NOT_IMPLEMENTED`). Walks the store's own prototype chain instead of\n * comparing against this package's `ObservabilityStorage.prototype`, so it\n * works for stores built against older or duplicated `@mastra/core` installs\n * and for stores that predate {@link ObservabilityStorage.getFeatures}.\n */\nfunction implementsObservabilityStorageMethod(observabilityStore: object, method: string): boolean {\n if (Object.prototype.hasOwnProperty.call(observabilityStore, method)) return true;\n\n let resolvedOwner: object | undefined;\n let declaringBase: object | undefined;\n for (\n let proto: object | null = Object.getPrototypeOf(observabilityStore);\n proto && proto !== Object.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n if (Object.prototype.hasOwnProperty.call(proto, method)) {\n resolvedOwner ??= proto;\n declaringBase = proto;\n }\n }\n return resolvedOwner !== undefined && resolvedOwner !== declaringBase;\n}\n\nexport type ObservabilityDiscoveryCapabilities = {\n entityTypes: boolean;\n entityNames: boolean;\n serviceNames: boolean;\n environments: boolean;\n tags: boolean;\n metrics: boolean;\n};\n\nexport type ObservabilityStorageCapabilities = {\n metrics: boolean;\n logs: boolean;\n discovery: ObservabilityDiscoveryCapabilities;\n deltaPolling: boolean;\n traceQuery: boolean;\n traceQueryRootDuration: boolean;\n traceQueryContextIds: boolean;\n traceQueryTimeToFirstChunk: boolean;\n traceQueryRootSpanFields: boolean;\n traceQueryRootEntityId: boolean;\n traceQueryTimeToFirstChunkSort: boolean;\n traceQueryDiscovery: boolean;\n traceQueryTenantScope: boolean;\n traceAggregate: boolean;\n threadQuery: boolean;\n threadQueryRows: boolean;\n spanQuery: boolean;\n spanQueryContextFields: boolean;\n /** Days of traces the store keeps. Omitted when the store does not report a limit. */\n traceRetentionDays?: number;\n feedback: boolean;\n};\n\nexport const NO_OBSERVABILITY_STORAGE_CAPABILITIES: ObservabilityStorageCapabilities = {\n metrics: false,\n logs: false,\n discovery: {\n entityTypes: false,\n entityNames: false,\n serviceNames: false,\n environments: false,\n tags: false,\n metrics: false,\n },\n deltaPolling: false,\n traceQuery: false,\n traceQueryRootDuration: false,\n traceQueryContextIds: false,\n traceQueryTimeToFirstChunk: false,\n traceQueryRootSpanFields: false,\n traceQueryRootEntityId: false,\n traceQueryTimeToFirstChunkSort: false,\n traceQueryDiscovery: false,\n traceQueryTenantScope: false,\n traceAggregate: false,\n threadQuery: false,\n threadQueryRows: false,\n spanQuery: false,\n spanQueryContextFields: false,\n feedback: false,\n};\n\n/**\n * Resolves which optional observability APIs the configured store can serve.\n *\n * Feature declarations (`getFeatures()`) are optional. When a store declares\n * a feature list, that list is final. Stores without `getFeatures()` predate\n * declarations: metrics, logs and filter discovery are detected by whether the\n * store implements the underlying method, so those packages report accurately\n * without being upgraded. Delta polling and the trace/thread query APIs depend\n * on runtime behavior a method check can't see, so they are only reported for\n * stores that declare them. Feedback is also declaration-only: Studio hides\n * the feedback UI behind this flag, and store versions that implement feedback\n * without declaring it simply don't advertise it until upgraded.\n */\nexport function getObservabilityStorageCapabilities(\n observabilityStore: ObservabilityStorage,\n): ObservabilityStorageCapabilities {\n const declaredFeatures = getFeatures(observabilityStore);\n const features = declaredFeatures ?? [];\n const newApiCore = coreFeatures.has('observability:v1.13.2');\n const declares = (feature: string) => features.includes(feature);\n // Undeclared stores must implement every method behind the feature.\n const supports = (feature: string, methods: readonly string[]) => {\n if (!newApiCore) return false;\n if (!declaredFeatures) {\n return methods.every(method => implementsObservabilityStorageMethod(observabilityStore, method));\n }\n return declares(feature);\n };\n // Stores released before the per-endpoint discovery features existed declare\n // `trace-query` and implement every discovery method, so treat it as implying discovery.\n const supportsDiscovery = (feature: string, methods: readonly string[]) =>\n supports(feature, methods) || (newApiCore && declares(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE));\n const traceQuery =\n newApiCore &&\n typeof coreStorage.planTraceQuery === 'function' &&\n declares(OBSERVABILITY_TRACE_QUERY_STORAGE_FEATURE);\n const threadQuery =\n newApiCore &&\n typeof coreStorage.planThreadQuery === 'function' &&\n declares(OBSERVABILITY_THREAD_QUERY_STORAGE_FEATURE);\n const spanQuery = newApiCore && supportsSpanQueryCore() && declares(OBSERVABILITY_SPAN_QUERY_STORAGE_FEATURE);\n\n return {\n // `listMetrics` is left out: it backs a newer route that metric dashboards don't use,\n // and older stores that implement the OLAP methods predate it.\n metrics: supports('metrics', [\n 'getMetricAggregate',\n 'getMetricBreakdown',\n 'getMetricTimeSeries',\n 'getMetricPercentiles',\n ]),\n logs: supports('logs', ['listLogs']),\n discovery: {\n entityTypes: supportsDiscovery('entity-type-discovery', ['getEntityTypes']),\n entityNames: supportsDiscovery('entity-name-discovery', ['getEntityNames']),\n serviceNames: supportsDiscovery('service-name-discovery', ['getServiceNames']),\n environments: supportsDiscovery('environment-discovery', ['getEnvironments']),\n tags: supportsDiscovery('tag-discovery', ['getTags']),\n metrics: supportsDiscovery('metric-discovery', ['getMetricNames', 'getMetricLabelKeys', 'getMetricLabelValues']),\n },\n deltaPolling:\n coreFeatures.has(OBSERVABILITY_DELTA_POLLING_FEATURE) && declares(OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE),\n traceQuery,\n traceQueryRootDuration:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_DURATION_STORAGE_FEATURE),\n traceQueryContextIds:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_CONTEXT_IDS_STORAGE_FEATURE),\n traceQueryTimeToFirstChunk:\n (traceQuery || threadQuery || spanQuery) &&\n declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_STORAGE_FEATURE),\n traceQueryRootSpanFields:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_SPAN_FIELDS_STORAGE_FEATURE),\n traceQueryRootEntityId:\n (traceQuery || threadQuery) && declares(OBSERVABILITY_TRACE_QUERY_ROOT_ENTITY_ID_STORAGE_FEATURE),\n traceQueryTimeToFirstChunkSort:\n (traceQuery || spanQuery) && declares(OBSERVABILITY_TRACE_QUERY_TIME_TO_FIRST_CHUNK_SORT_STORAGE_FEATURE),\n traceQueryDiscovery:\n newApiCore && supportsTraceQueryDiscoveryCore() && declares(OBSERVABILITY_TRACE_QUERY_DISCOVERY_STORAGE_FEATURE),\n traceQueryTenantScope:\n (traceQuery || threadQuery) &&\n coreFeatures.has(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_CORE_FEATURE) &&\n declares(OBSERVABILITY_TRACE_QUERY_TENANT_SCOPE_STORAGE_FEATURE),\n traceAggregate:\n newApiCore && supportsTraceAggregateCore() && declares(OBSERVABILITY_TRACE_AGGREGATE_STORAGE_FEATURE),\n threadQuery,\n threadQueryRows:\n threadQuery && typeof coreStorage.planThreadRowsQuery === 'function' && declares('thread-query-rows'),\n spanQuery,\n spanQueryContextFields: spanQuery && declares('span-query-context-fields'),\n feedback: newApiCore && declares(OBSERVABILITY_FEEDBACK_STORAGE_FEATURE),\n };\n}\n\n/**\n * Matches the `OBSERVABILITY_STORAGE_*_NOT_IMPLEMENTED` MastraError the base\n * observability store throws for every optional method a store doesn't\n * implement. Checked by id (not `instanceof`) so it holds across duplicated\n * `@mastra/core` installs.\n */\nfunction isObservabilityStorageNotImplementedError(error: unknown): boolean {\n const id = error && typeof error === 'object' && 'id' in error ? error.id : undefined;\n return typeof id === 'string' && id.startsWith('OBSERVABILITY_STORAGE_') && id.endsWith('_NOT_IMPLEMENTED');\n}\n\n/**\n * Discovery is optional for observability stores. When the configured store\n * doesn't implement a discovery method, answer with an empty result instead of\n * a 500 so filter lookups degrade quietly on stores without discovery support.\n * Clients should check `observabilityStorageCapabilities.discovery` from\n * `GET /system/packages` before calling these routes.\n */\nexport async function withDiscoveryFallback<T>(run: () => Promise<T>, empty: T): Promise<T> {\n try {\n return await run();\n } catch (error) {\n if (isObservabilityStorageNotImplementedError(error)) return empty;\n throw error;\n }\n}\n\nexport function assertObservabilityDeltaSupported(\n observabilityStore: ObservabilityStorage,\n endpoint: ObservabilityListEndpoint,\n) {\n if (!coreFeatures.has(OBSERVABILITY_DELTA_POLLING_FEATURE)) {\n throw new HTTPException(501, {\n message: `${OBSERVABILITY_DELTA_POLLING_UPGRADE_MESSAGE} (endpoint: ${endpoint})`,\n });\n }\n\n if (getFeatures(observabilityStore)?.includes(OBSERVABILITY_DELTA_POLLING_STORAGE_FEATURE)) {\n return;\n }\n\n throw new HTTPException(501, {\n message: `Delta polling is not supported by the configured observability store for ${endpoint}`,\n });\n}\n\nexport interface RouteDetails {\n method: ServerRoute['method'];\n path: `/${string}`;\n summary: string;\n description: string;\n requiresPermission?: ServerRoute['requiresPermission'];\n}\n\nexport const NEW_ROUTE_DEFS = {\n QUERY_TRACES: {\n method: 'POST',\n path: '/observability/traces/query',\n summary: 'Query traces',\n description:\n 'Returns completed logical traces or distinct thread groups matching an advanced trace query. Thread grouping remains supported but is deprecated; use queryTraceThreads instead.',\n requiresPermission: 'observability:read',\n },\n\n AGGREGATE_TRACES: {\n method: 'POST',\n path: '/observability/traces/aggregate',\n summary: 'Aggregate traces',\n description:\n 'Returns grouped and optionally time-bucketed measures (counts, durations, error rates) over completed logical traces matching an advanced trace predicate',\n requiresPermission: 'observability:read',\n },\n\n QUERY_THREADS: {\n method: 'POST',\n path: '/observability/threads/query',\n summary: 'Query threads',\n description:\n 'Returns full-history thread rows with activity timestamps, first/last traces, previews and context fields',\n requiresPermission: 'observability:read',\n },\n\n QUERY_SPANS: {\n method: 'POST',\n path: '/observability/spans/query',\n summary: 'Query spans',\n description: 'Returns completed spans matching a span predicate, one row per span, with cursor pagination',\n requiresPermission: 'observability:read',\n },\n\n GET_TRACE_QUERY_FIELDS: {\n method: 'POST',\n path: '/observability/traces/query/fields',\n summary: 'Discover trace query fields',\n description: 'Returns canonical query fields and observed top-level string metadata fields',\n requiresPermission: 'observability:read',\n },\n\n GET_TRACE_QUERY_VALUES: {\n method: 'POST',\n path: '/observability/traces/query/values',\n summary: 'Discover trace query values',\n description: 'Returns bounded string value suggestions and occurrence counts for one eligible query field',\n requiresPermission: 'observability:read',\n },\n\n LIST_METRICS: {\n method: 'GET',\n path: '/observability/metrics',\n summary: 'List metrics',\n description: 'Returns a paginated list of metrics with optional filtering and sorting',\n },\n\n LIST_LOGS: {\n method: 'GET',\n path: '/observability/logs',\n summary: 'List logs',\n description: 'Returns a paginated list of logs with optional filtering and sorting',\n },\n\n LIST_SCORES: {\n method: 'GET',\n path: '/observability/scores',\n summary: 'List scores',\n description: 'Returns a paginated list of scores with optional filtering and sorting',\n },\n\n CREATE_SCORE: {\n method: 'POST',\n path: '/observability/scores',\n summary: 'Create a score',\n description: 'Creates a single score record in the observability store',\n },\n\n DELETE_SCORES: {\n method: 'DELETE',\n path: '/observability/scores',\n summary: 'Delete scores',\n description: 'Deletes score records by scoreId, optionally scoped to a tenant',\n requiresPermission: 'observability:delete',\n },\n\n GET_SCORE: {\n method: 'GET',\n path: '/observability/scores/:scoreId',\n summary: 'Get score',\n description: 'Returns a single score by scoreId',\n },\n\n GET_SCORE_AGGREGATE: {\n method: 'POST',\n path: '/observability/scores/aggregate',\n summary: 'Get score aggregate',\n description: 'Returns an aggregated score value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_BREAKDOWN: {\n method: 'POST',\n path: '/observability/scores/breakdown',\n summary: 'Get score breakdown',\n description: 'Returns score values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_TIME_SERIES: {\n method: 'POST',\n path: '/observability/scores/timeseries',\n summary: 'Get score time series',\n description: 'Returns score values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_SCORE_PERCENTILES: {\n method: 'POST',\n path: '/observability/scores/percentiles',\n summary: 'Get score percentiles',\n description: 'Returns percentile values for a score bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n LIST_FEEDBACK: {\n method: 'GET',\n path: '/observability/feedback',\n summary: 'List feedback',\n description: 'Returns a paginated list of feedback with optional filtering and sorting',\n },\n\n CREATE_FEEDBACK: {\n method: 'POST',\n path: '/observability/feedback',\n summary: 'Create feedback',\n description: 'Creates a single feedback record in the observability store',\n },\n\n DELETE_FEEDBACK: {\n method: 'DELETE',\n path: '/observability/feedback',\n summary: 'Delete feedback',\n description: 'Deletes feedback records by feedbackId, optionally scoped to a tenant',\n requiresPermission: 'observability:delete',\n },\n\n UPDATE_FEEDBACK_REVIEW_STATUS: {\n method: 'PATCH',\n path: '/observability/feedback/:feedbackId/review-status',\n summary: 'Update feedback review status',\n description: \"Updates a feedback record's review workflow status\",\n requiresPermission: 'observability:write',\n },\n\n GET_FEEDBACK_AGGREGATE: {\n method: 'POST',\n path: '/observability/feedback/aggregate',\n summary: 'Get feedback aggregate',\n description: 'Returns an aggregated numeric feedback value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_BREAKDOWN: {\n method: 'POST',\n path: '/observability/feedback/breakdown',\n summary: 'Get feedback breakdown',\n description: 'Returns numeric feedback values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_TIME_SERIES: {\n method: 'POST',\n path: '/observability/feedback/timeseries',\n summary: 'Get feedback time series',\n description: 'Returns numeric feedback values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_FEEDBACK_PERCENTILES: {\n method: 'POST',\n path: '/observability/feedback/percentiles',\n summary: 'Get feedback percentiles',\n description: 'Returns percentile values for numeric feedback bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_AGGREGATE: {\n method: 'POST',\n path: '/observability/metrics/aggregate',\n summary: 'Get metric aggregate',\n description: 'Returns an aggregated metric value with optional period-over-period comparison',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_BREAKDOWN: {\n method: 'POST',\n path: '/observability/metrics/breakdown',\n summary: 'Get metric breakdown',\n description: 'Returns metric values grouped by specified dimensions',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_TIME_SERIES: {\n method: 'POST',\n path: '/observability/metrics/timeseries',\n summary: 'Get metric time series',\n description: 'Returns metric values bucketed by time interval with optional grouping',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_PERCENTILES: {\n method: 'POST',\n path: '/observability/metrics/percentiles',\n summary: 'Get metric percentiles',\n description: 'Returns percentile values for a metric bucketed by time interval',\n requiresPermission: 'observability:read',\n },\n\n GET_METRIC_NAMES: {\n method: 'GET',\n path: '/observability/discovery/metric-names',\n summary: 'Get metric names',\n description: 'Returns distinct metric names with optional prefix filtering',\n },\n\n GET_METRIC_LABEL_KEYS: {\n method: 'GET',\n path: '/observability/discovery/metric-label-keys',\n summary: 'Get metric label keys',\n description: 'Returns distinct label keys for a given metric',\n },\n\n GET_METRIC_LABEL_VALUES: {\n method: 'GET',\n path: '/observability/discovery/metric-label-values',\n summary: 'Get label values',\n description: 'Returns distinct values for a given metric label key',\n },\n\n GET_ENTITY_TYPES: {\n method: 'GET',\n path: '/observability/discovery/entity-types',\n summary: 'Get entity types',\n description: 'Returns distinct entity types from observability data',\n },\n\n GET_ENTITY_NAMES: {\n method: 'GET',\n path: '/observability/discovery/entity-names',\n summary: 'Get entity names',\n description: 'Returns distinct entity names with optional type filtering',\n },\n\n GET_SERVICE_NAMES: {\n method: 'GET',\n path: '/observability/discovery/service-names',\n summary: 'Get service names',\n description: 'Returns distinct service names from observability data',\n },\n\n GET_ENVIRONMENTS: {\n method: 'GET',\n path: '/observability/discovery/environments',\n summary: 'Get environments',\n description: 'Returns distinct environments from observability data',\n },\n\n GET_TAGS: {\n method: 'GET',\n path: '/observability/discovery/tags',\n summary: 'Get tags',\n description: 'Returns distinct tags with optional entity type filtering',\n },\n\n GET_CAPABILITIES: {\n method: 'GET',\n path: '/observability/capabilities',\n summary: 'Get observability capabilities',\n description:\n 'Returns which optional observability APIs the configured observability storage supports. Every flag is false when no observability storage is configured.',\n },\n} as const satisfies Record<string, RouteDetails>;\n\nexport type NewRoutesKey = keyof typeof NEW_ROUTE_DEFS;\nexport type NewRoutesDefinitions = (typeof NEW_ROUTE_DEFS)[NewRoutesKey];\n\nexport function createObservabilityListQuerySchema<\n TFilter extends z.ZodObject<z.ZodRawShape>,\n TOrderBy extends z.ZodObject<z.ZodRawShape>,\n>(filterSchema: TFilter, orderBySchema: TOrderBy) {\n const unwrapDefault = (schema: unknown) => {\n const zodSchema = schema as z.ZodTypeAny;\n return zodSchema instanceof z.ZodDefault ? zodSchema.unwrap() : zodSchema;\n };\n const paginationShape = paginationArgsSchema.shape as unknown as Record<string, z.ZodTypeAny>;\n const orderByShape = orderBySchema.shape as unknown as Record<string, z.ZodTypeAny>;\n\n const pageSchema = unwrapDefault(paginationShape.page);\n const perPageSchema = unwrapDefault(paginationShape.perPage);\n const fieldSchema = orderByShape.field ? unwrapDefault(orderByShape.field) : z.never().optional();\n const directionSchema = orderByShape.direction ? unwrapDefault(orderByShape.direction) : z.never().optional();\n\n return wrapSchemaForQueryParams(\n z\n .object({\n ...filterSchema.shape,\n page: pageSchema,\n perPage: perPageSchema,\n field: fieldSchema,\n direction: directionSchema,\n mode: listModeSchema.optional(),\n after: deltaCursorSchema.optional(),\n limit: deltaLimitSchema,\n })\n .partial(),\n ).superRefine((value, ctx) => {\n const isDelta = value.mode === 'delta';\n const hasPagination = value.page !== undefined || value.perPage !== undefined;\n const hasOrderBy = value.field !== undefined || value.direction !== undefined;\n const hasAfter = value.after !== undefined;\n const hasLimit = value.limit !== undefined;\n\n if (isDelta) {\n if (hasPagination) {\n if (value.page !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['page'],\n message: '`page` is not allowed when `mode=delta`',\n });\n }\n if (value.perPage !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['perPage'],\n message: '`perPage` is not allowed when `mode=delta`',\n });\n }\n }\n if (hasOrderBy) {\n if (value.field !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['field'],\n message: '`field` is not allowed when `mode=delta`',\n });\n }\n if (value.direction !== undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['direction'],\n message: '`direction` is not allowed when `mode=delta`',\n });\n }\n }\n return;\n }\n\n if (hasAfter) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['after'],\n message: '`after` is only allowed when `mode=delta`',\n });\n }\n if (hasLimit) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['limit'],\n message: '`limit` is only allowed when `mode=delta`',\n });\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAuBA,MAA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,KAAA,GACpB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,SAAS;KAChB,SAAS;IACX,CAAC;GAEL;GACA,IAAI,YAAY;IACd,IAAI,MAAM,UAAU,KAAA,GAClB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,OAAO;KACd,SAAS;IACX,CAAC;IAEH,IAAI,MAAM,cAAc,KAAA,GACtB,IAAI,SAAS;KACX,MAAMA,OAAAA,EAAE,aAAa;KACrB,MAAM,CAAC,WAAW;KAClB,SAAS;IACX,CAAC;GAEL;GACA;EACF;EAEA,IAAI,UACF,IAAI,SAAS;GACX,MAAMA,OAAAA,EAAE,aAAa;GACrB,MAAM,CAAC,OAAO;GACd,SAAS;EACX,CAAC;EAEH,IAAI,UACF,IAAI,SAAS;GACX,MAAMA,OAAAA,EAAE,aAAa;GACrB,MAAM,CAAC,OAAO;GACd,SAAS;EACX,CAAC;CAEL,CAAC;AACH"}
|
|
@@ -38,11 +38,14 @@ export declare function assertObservabilityTraceQueryContextIdsSupported(observa
|
|
|
38
38
|
export declare function supportsObservabilityTraceQueryTimeToFirstChunk(observabilityStore: ObservabilityStorage): boolean;
|
|
39
39
|
/** Covers trace, thread and span query predicates, including `spans` and `traces` relations. */
|
|
40
40
|
export declare function assertObservabilityTraceQueryTimeToFirstChunkSupported(observabilityStore: ObservabilityStorage, predicate: TrustedTraceQueryPredicate | TrustedThreadPredicate | undefined): void;
|
|
41
|
-
export declare function supportsObservabilityTraceQueryRootSpanFields(observabilityStore: ObservabilityStorage): boolean;
|
|
42
|
-
export declare function isTraceQueryRootSpanField(path: string): boolean;
|
|
43
41
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* Whether the store can serve `path` at trace scope. Fields that don't read the root span are
|
|
43
|
+
* always supported here; other gates cover them.
|
|
44
|
+
*/
|
|
45
|
+
export declare function supportsObservabilityTraceQueryRootSpanField(observabilityStore: ObservabilityStorage, path: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Stores that predate a trace-scope root span field have no SQL for it and would fail with a
|
|
48
|
+
* 500, so requests that use it are rejected as invalid instead.
|
|
46
49
|
*/
|
|
47
50
|
export declare function assertObservabilityTraceQueryRootSpanFieldsSupported(observabilityStore: ObservabilityStorage, plan: {
|
|
48
51
|
where?: TrustedTraceQueryPredicate | TrustedThreadPredicate;
|
|
@@ -87,6 +90,7 @@ export type ObservabilityStorageCapabilities = {
|
|
|
87
90
|
traceQueryContextIds: boolean;
|
|
88
91
|
traceQueryTimeToFirstChunk: boolean;
|
|
89
92
|
traceQueryRootSpanFields: boolean;
|
|
93
|
+
traceQueryRootEntityId: boolean;
|
|
90
94
|
traceQueryTimeToFirstChunkSort: boolean;
|
|
91
95
|
traceQueryDiscovery: boolean;
|
|
92
96
|
traceQueryTenantScope: boolean;
|
|
@@ -94,6 +98,7 @@ export type ObservabilityStorageCapabilities = {
|
|
|
94
98
|
threadQuery: boolean;
|
|
95
99
|
threadQueryRows: boolean;
|
|
96
100
|
spanQuery: boolean;
|
|
101
|
+
spanQueryContextFields: boolean;
|
|
97
102
|
/** Days of traces the store keeps. Omitted when the store does not report a limit. */
|
|
98
103
|
traceRetentionDays?: number;
|
|
99
104
|
feedback: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability-shared.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/observability-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EAEb,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAS5D,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AACjF,eAAO,MAAM,2CAA2C,0GACiD,CAAC;
|
|
1
|
+
{"version":3,"file":"observability-shared.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/observability-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EAEb,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAS5D,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AACjF,eAAO,MAAM,2CAA2C,0GACiD,CAAC;AAwC1G,eAAO,MAAM,mDAAmD,2CAA2C,CAAC;AAC5G,eAAO,MAAM,sDAAsD,8GAC0C,CAAC;AAE9G,wBAAgB,+BAA+B,YAW9C;AAED,wBAAgB,0BAA0B,YAMzC;AAED,wBAAgB,qBAAqB,YAMpC;AAED,eAAO,MAAM,4BAA4B;aACvC,MAAM,EAAE,QAAQ;aAChB,QAAQ,EAAE,UAAU;aACpB,IAAI,EAAE,MAAM;aACZ,OAAO,EAAE,SAAS;aAClB,MAAM,EAAE,QAAQ;aAChB,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAUnF,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAM/D;AAED,+EAA+E;AAC/E,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oB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