@mastra/mcp-apps-components 0.1.0-alpha.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboards.cjs +1 -1
- package/dist/dashboards.cjs.map +1 -1
- package/dist/dashboards.d.ts +6 -6
- package/dist/dashboards.d.ts.map +1 -1
- package/dist/dashboards.js +1 -1
- package/dist/dashboards.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{observability-dashboard-BH7Qi5Nh.js → observability-dashboard-BsPT3Mon.js} +93 -45
- package/dist/observability-dashboard-BsPT3Mon.js.map +1 -0
- package/dist/{observability-dashboard-D_iAY-Ff.cjs → observability-dashboard-CUTNAsy0.cjs} +93 -45
- package/dist/observability-dashboard-CUTNAsy0.cjs.map +1 -0
- package/dist/observability-dashboard.d.ts +6 -0
- package/dist/observability-dashboard.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/observability-dashboard-BH7Qi5Nh.js.map +0 -1
- package/dist/observability-dashboard-D_iAY-Ff.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"observability-dashboard-D_iAY-Ff.cjs","names":["z","z","z","z","z","DASHBOARD_WIDGET_KINDS","DASHBOARD_SCOPES","z","dashboardQuerySchema","dashboardWidgetViewSchema","DASHBOARD_MAX_QUERIES_PER_VIEW","dashboardWidgetSchema","dashboardDefaultsSchema","DASHBOARD_SCHEMA_VERSION","DASHBOARD_MAX_WIDGETS","OBSERVABILITY_DATE_PRESETS","dashboardDefinitionSchema"],"sources":["../../playground-ui/dist/domains/dashboards/lib/values.es.js","../../playground-ui/dist/domains/dashboards/kinds/kpis/options.es.js","../../playground-ui/dist/domains/dashboards/kinds/scores/options.es.js","../../playground-ui/dist/domains/dashboards/lib/table.es.js","../../playground-ui/dist/domains/dashboards/lib/timeseries.es.js","../../playground-ui/dist/domains/dashboards/lib/chrome.es.js","../src/dashboard-views.ts","../src/observability-dashboard.ts"],"sourcesContent":["import { z } from \"zod/v4\";\n// src/domains/dashboards/lib/values.ts\n/**\n* The options vocabulary widget kinds share. Values reference a view's query results and\n* combine them with a few fixed operations; there are no free-form expressions.\n*/\n/** Names one of the view's queries by its `id`, never its position, so reordering queries keeps refs. */\nvar queryRefSchema = z.string().min(1);\n/** A number read from one query's result. */\nvar valueRefSchema = z.object({\n\t/** The `id` of one of the view's queries. */\n\tquery: queryRefSchema,\n\t/** Metrics and scores read `value` (or the price, `estimatedCost`); trace and span aggregates read a measure. */\n\tfield: z.enum([\"value\", \"estimatedCost\"]).optional(),\n\t/** A trace or span aggregate measure, e.g. `countDistinct.threadId`. */\n\tmeasure: z.string().min(1).optional(),\n\t/** A percentile of a percentiles request, e.g. `0.95`. */\n\tpercentile: z.number().min(0).max(1).optional(),\n\t/** Only the series whose group key is exactly one of these... */\n\tgroups: z.array(z.string()).min(1).optional(),\n\t/** ...or is none of these. */\n\tnotGroups: z.array(z.string()).min(1).optional()\n}).strict();\nvar constSchema = z.strictObject({ const: z.number() });\nvar sumSchema = z.strictObject({ get sum() {\n\treturn z.array(valueExprSchema).min(1);\n} });\nvar minusSchema = z.strictObject({ get minus() {\n\treturn z.tuple([valueExprSchema, valueExprSchema]);\n} });\nvar ratioSchema = z.strictObject({ get ratio() {\n\treturn z.strictObject({\n\t\tof: valueExprSchema,\n\t\tover: valueExprSchema\n\t});\n} });\nvar maxSchema = z.strictObject({ get max() {\n\treturn z.array(valueExprSchema).min(1);\n} });\nvar coalesceSchema = z.strictObject({ get coalesce() {\n\treturn z.array(valueExprSchema).min(1);\n} });\nvar valueExprSchema = z.union([\n\tvalueRefSchema,\n\tconstSchema,\n\tsumSchema,\n\tminusSchema,\n\tratioSchema,\n\tmaxSchema,\n\tcoalesceSchema\n]);\nvar VALUE_FORMATS = [\n\t\"count\",\n\t\"usd\",\n\t\"duration\",\n\t\"percent\",\n\t\"score\"\n];\nvar formatSchema = z.enum(VALUE_FORMATS);\nvar CHART_COLOR_NAMES = [\n\t\"green\",\n\t\"sky\",\n\t\"violet\",\n\t\"teal\",\n\t\"indigo\",\n\t\"warning\",\n\t\"error\",\n\t\"neutral\"\n];\nvar colorSchema = z.enum(CHART_COLOR_NAMES);\n/** Every ref an expression reads, in order. */\nfunction exprRefs(expr) {\n\tif (\"const\" in expr) return [];\n\tif (\"sum\" in expr) return expr.sum.flatMap(exprRefs);\n\tif (\"minus\" in expr) return expr.minus.flatMap(exprRefs);\n\tif (\"ratio\" in expr) return [...exprRefs(expr.ratio.of), ...exprRefs(expr.ratio.over)];\n\tif (\"max\" in expr) return expr.max.flatMap(exprRefs);\n\tif (\"coalesce\" in expr) return expr.coalesce.flatMap(exprRefs);\n\treturn [expr];\n}\nvar defined = (values) => values.filter((v) => v !== void 0);\n/**\n* Evaluates an expression, reading each ref through `read`. A missing operand counts as 0 in `sum` and\n* `minus` while another has a value; the result is missing when every operand is.\n*/\nfunction evaluate(expr, read) {\n\tconst run = (e) => evaluate(e, read);\n\tif (\"const\" in expr) return expr.const;\n\tif (\"sum\" in expr) {\n\t\tconst parts = expr.sum.map(run);\n\t\treturn defined(parts).length ? parts.reduce((total, p) => total + (p ?? 0), 0) : void 0;\n\t}\n\tif (\"minus\" in expr) {\n\t\tconst [a, b] = expr.minus.map(run);\n\t\treturn a === void 0 && b === void 0 ? void 0 : (a ?? 0) - (b ?? 0);\n\t}\n\tif (\"ratio\" in expr) {\n\t\tconst over = run(expr.ratio.over);\n\t\tif (!over) return void 0;\n\t\treturn (run(expr.ratio.of) ?? 0) / over;\n\t}\n\tif (\"max\" in expr) {\n\t\tconst parts = defined(expr.max.map(run));\n\t\treturn parts.length ? Math.max(...parts) : void 0;\n\t}\n\tif (\"coalesce\" in expr) {\n\t\tfor (const e of expr.coalesce) {\n\t\t\tconst v = run(e);\n\t\t\tif (v !== void 0) return v;\n\t\t}\n\t\treturn;\n\t}\n\treturn read(expr);\n}\n/** Whether the series with group key `name` is one a ref reads. */\nfunction matchesGroups(ref, name) {\n\tif (ref.groups && !ref.groups.includes(name)) return false;\n\tif (ref.notGroups?.includes(name)) return false;\n\treturn true;\n}\n/** Each query's answer under its id, for reading refs. Queries without an id can't be referenced. */\nfunction answersById(queries, answers) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tqueries.forEach((q, i) => {\n\t\tif (q.id !== void 0) byId.set(q.id, answers[i]);\n\t});\n\treturn byId;\n}\n/** Where a query id sits in the view's queries, or `undefined` if no query has it. */\nvar queryIndex = (queries, id) => {\n\tif (id === void 0) return void 0;\n\tconst index = queries.findIndex((q) => q.id === id);\n\treturn index < 0 ? void 0 : index;\n};\n/** An issue for each referenced query id the view doesn't have. */\nfunction unknownQueryIssues(ids, queries, where = \"options\") {\n\tconst known = new Set(queries.flatMap((q) => q.id === void 0 ? [] : [q.id]));\n\treturn [...new Set(ids)].filter((id) => !known.has(id)).map((id) => `${where}: reads query '${id}', which the view doesn't have`);\n}\nexport { CHART_COLOR_NAMES, VALUE_FORMATS, answersById, colorSchema, evaluate, exprRefs, formatSchema, matchesGroups, queryIndex, queryRefSchema, unknownQueryIssues, valueExprSchema, valueRefSchema };\n\n//# sourceMappingURL=values.es.js.map","import { exprRefs, unknownQueryIssues, valueExprSchema } from \"../../lib/values.es.js\";\nimport { z } from \"zod/v4\";\n// src/domains/dashboards/kinds/kpis/options.ts\nvar kpiItemSchema = z.object({\n\tlabel: z.string().min(1),\n\ticon: z.enum([\n\t\t\"bot\",\n\t\t\"coins\",\n\t\t\"hash\",\n\t\t\"threads\"\n\t]),\n\tformat: z.enum([\"count\", \"usd\"]),\n\t/** A metrics or scores aggregate value, or the sum of several. Comparing needs `compare` on the queries. */\n\tvalue: valueExprSchema,\n\tdetail: z.string(),\n\tlowerIsBetter: z.boolean().optional()\n}).strict();\nvar kpisOptionsSchema = z.object({ items: z.array(kpiItemSchema).min(1) }).strict();\n/** One aggregate's figures: its value (or price) now, before, and the change the API reports. */\nfunction refFigures(response, ref) {\n\tif (ref.field === \"estimatedCost\") return {\n\t\tvalue: response?.estimatedCost ?? void 0,\n\t\tprevious: response?.previousEstimatedCost ?? void 0,\n\t\tchange: response?.costChangePercent ?? void 0\n\t};\n\treturn {\n\t\tvalue: response?.value ?? void 0,\n\t\tprevious: response?.previousValue ?? void 0,\n\t\tchange: response?.changePercent ?? void 0\n\t};\n}\n/**\n* A KPI's figures. A single aggregate keeps the API's own change; a sum adds the parts and works\n* out the change from the summed previous value, as the Tokens KPI does.\n*/\nfunction kpiFigures(expr, responses) {\n\tif (!(\"sum\" in expr)) {\n\t\tconst [ref] = exprRefs(expr);\n\t\treturn ref ? refFigures(responses.get(ref.query), ref) : {};\n\t}\n\tconst parts = expr.sum.map((e) => kpiFigures(e, responses));\n\tconst hasCurrent = parts.some((p) => p.value !== void 0);\n\tconst hasPrevious = parts.some((p) => p.previous !== void 0);\n\tconst value = parts.reduce((a, p) => a + (p.value ?? 0), 0);\n\tconst previous = parts.reduce((a, p) => a + (p.previous ?? 0), 0);\n\treturn {\n\t\tvalue: hasCurrent ? value : void 0,\n\t\tprevious: hasPrevious ? previous : void 0,\n\t\tchange: hasPrevious && previous > 0 ? (value - previous) / previous * 100 : void 0\n\t};\n}\nvar readsAggregates = (expr) => \"query\" in expr || \"sum\" in expr && expr.sum.every(readsAggregates);\nvar isAggregate = (query) => (query?.source === \"metrics\" || query?.source === \"scores\") && query.request === \"aggregate\";\n/** What the schema can't say: query ids the view has, and only metrics or scores aggregates (scores naming a scorer), or sums of them. */\nvar kpisIssues = (view) => {\n\tconst byId = new Map(view.queries.map((q) => [q.id, q]));\n\treturn [\n\t\t...unknownQueryIssues(view.options.items.flatMap((i) => exprRefs(i.value).map((r) => r.query)), view.queries),\n\t\t...view.options.items.filter((i) => !readsAggregates(i.value)).map((i) => `KPI '${i.label}' can only read an aggregate or sum several`),\n\t\t...view.options.items.flatMap((i) => exprRefs(i.value).filter((r) => byId.has(r.query) && !isAggregate(byId.get(r.query))).map((r) => `KPI '${i.label}' reads query '${r.query}', which is not a metrics or scores aggregate`)),\n\t\t...view.options.items.flatMap((i) => exprRefs(i.value).filter((r) => {\n\t\t\tconst query = byId.get(r.query);\n\t\t\treturn query?.source === \"scores\" && query.scorerId === void 0;\n\t\t}).map((r) => `KPI '${i.label}' reads scores query '${r.query}', which must name a scorer`))\n\t];\n};\nexport { kpiFigures, kpisIssues, kpisOptionsSchema };\n\n//# sourceMappingURL=options.es.js.map","import { queryRefSchema } from \"../../lib/values.es.js\";\nimport { z } from \"zod/v4\";\n// src/domains/dashboards/kinds/scores/options.ts\nvar scoresOptionsSchema = z.object({\n\t/** Id of the scores aggregate giving each scorer's mean over the range, sent as the Scores card sends it. */\n\taverage: queryRefSchema,\n\t/** Id of the scores time series giving each scorer's line. */\n\tseries: queryRefSchema,\n\t/** @deprecated Accepted so saved definitions still parse; every empty chart shows the same message. */\n\temptyMessage: z.string().optional()\n}).strict();\n/**\n* Both ids must name scores queries of the right request, and when both name a scorer it must be the\n* same one, since each scorer's mean and line are drawn together.\n*/\nvar scoresIssues = (view) => {\n\tconst issues = [];\n\tconst average = view.queries.find((q) => q.id === view.options.average);\n\tconst series = view.queries.find((q) => q.id === view.options.series);\n\tif (average?.source !== \"scores\" || average.request !== \"aggregate\") issues.push(`options.average must name a scores aggregate query`);\n\tif (series?.source !== \"scores\" || series.request !== \"timeSeries\") issues.push(`options.series must name a scores timeSeries query`);\n\tconst averageScorer = average?.source === \"scores\" ? average.scorerId : void 0;\n\tconst seriesScorer = series?.source === \"scores\" ? series.scorerId : void 0;\n\tif (averageScorer && seriesScorer && averageScorer !== seriesScorer) issues.push(`options.average names scorer '${averageScorer}' but options.series names '${seriesScorer}'; they must match`);\n\treturn issues;\n};\nexport { scoresIssues, scoresOptionsSchema };\n\n//# sourceMappingURL=options.es.js.map","import { formatCount, formatDuration, formatPercent, formatUsd } from \"../../metrics/lib/chart-format.es.js\";\nimport { groupsOf, measureOf, rowsOf } from \"./answers.es.js\";\nimport { answersById, evaluate, exprRefs, queryRefSchema, unknownQueryIssues, valueExprSchema } from \"./values.es.js\";\nimport { z } from \"zod/v4\";\n// src/domains/dashboards/lib/table.ts\n/**\n* The `table` kind: one row per group, joined across the view's queries on `groupBy`. Each column\n* shows the row's name, a dimension, a value read from the row's answers, or a value's change\n* against the previous window.\n*/\nvar TRACK = String.raw`(?:auto|max-content|\\d+(?:\\.\\d+)?(?:rem|fr))`;\n/** A CSS grid track: `auto`, `max-content`, `12rem`, `3fr`, or `minmax()` of two of those. */\nvar widthSchema = z.string().regex(new RegExp(String.raw`^(?:${TRACK}|minmax\\(\\s*${TRACK}\\s*,\\s*${TRACK}\\s*\\))$`), \"Expected auto, max-content, Nrem, Nfr or minmax(a, b) of those\");\nvar shared = {\n\t/** The header's tooltip. */\n\tdescription: z.string().optional(),\n\twidth: widthSchema.optional(),\n\tsortable: z.boolean().optional()\n};\nvar nameColumnSchema = z.strictObject({\n\ttype: z.literal(\"name\"),\n\t/** `project` shows the host's name for a project id. */\n\tas: z.literal(\"project\").optional(),\n\t/** What a row without a name reads as. Defaults to \"Unnamed\". */\n\tunnamed: z.string().optional(),\n\t/** Before the name: an entity's icon, or the provider logo with the name read as `provider › model`. */\n\tmark: z.union([z.strictObject({ icon: z.enum([\n\t\t\"agent\",\n\t\t\"workflow\",\n\t\t\"tool\"\n\t]) }), z.strictObject({ providerDimension: z.string().min(1) })]).optional(),\n\t...shared\n});\nvar dimensionColumnSchema = z.strictObject({\n\ttype: z.literal(\"dimension\"),\n\tdimension: z.string().min(1),\n\tas: z.literal(\"project\").optional(),\n\t/** A lookup: that query's `dimension`, matched on the row's `joinOn` dimension. */\n\tquery: queryRefSchema.optional(),\n\tjoinOn: z.string().min(1).optional(),\n\t...shared\n});\nvar TABLE_VALUE_FORMATS = [\n\t\"count\",\n\t\"usd\",\n\t\"duration\",\n\t\"percent\"\n];\nvar valueColumnSchema = z.strictObject({\n\ttype: z.literal(\"value\"),\n\t/** Refs read this row's entry in the query: a `measure` of an aggregate, or a group's `field`. */\n\tvalue: valueExprSchema,\n\tformat: z.enum(TABLE_VALUE_FORMATS),\n\t/** The figure the table ranks by, in full tone; the others are muted. */\n\temphasis: z.boolean().optional(),\n\t/** Shown when the row has no value, e.g. 0 for a count. */\n\tmissing: z.number().optional(),\n\t/** A total: a dropped row shows 0, and a value with none before is \"New\". */\n\tadditive: z.boolean().optional(),\n\t/** Which way % Change is good news. */\n\tbetter: z.enum([\"higher\", \"lower\"]).optional(),\n\t/** `usd` only: \"Not priced\" when the row has no value but this column's is above 0. */\n\tunpricedWhen: z.string().min(1).optional(),\n\t...shared\n});\nvar changeColumnSchema = z.strictObject({\n\ttype: z.literal(\"change\"),\n\tdescription: z.string().optional()\n});\nvar tableColumnOptionsSchema = z.discriminatedUnion(\"type\", [\n\tnameColumnSchema,\n\tdimensionColumnSchema,\n\tvalueColumnSchema,\n\tchangeColumnSchema\n]);\nfunction columnOf(id, label, options) {\n\tswitch (options.type) {\n\t\tcase \"name\": return {\n\t\t\tid,\n\t\t\tlabel,\n\t\t\toptions\n\t\t};\n\t\tcase \"dimension\": return {\n\t\t\tid,\n\t\t\tlabel,\n\t\t\toptions\n\t\t};\n\t\tcase \"value\": return {\n\t\t\tid,\n\t\t\tlabel,\n\t\t\toptions\n\t\t};\n\t\tcase \"change\": return {\n\t\t\tid,\n\t\t\tlabel,\n\t\t\toptions\n\t\t};\n\t}\n}\nvar DRILLDOWN_FIELDS = [\n\t\"projectId\",\n\t\"entityName\",\n\t\"threadId\",\n\t\"resourceId\",\n\t\"environment\",\n\t\"sessionId\",\n\t\"userId\",\n\t\"model\",\n\t\"provider\"\n];\nvar tableOptionsSchema = z.strictObject({\n\t/** The dimensions a row is keyed on; the last one names the row. */\n\tgroupBy: z.array(z.string().min(1)).min(1),\n\t/** The starting sort, and where a third click on a header returns. */\n\tdefaultSort: z.strictObject({\n\t\tcolumn: z.string().min(1),\n\t\tdirection: z.enum([\"asc\", \"desc\"])\n\t}),\n\t/** Rows per page. Without it every row shows. */\n\tpageSize: z.number().int().min(1).optional(),\n\temptyMessage: z.string(),\n\tariaLabel: z.string().optional(),\n\t/** Leaves out rows without a name. */\n\thideUnnamed: z.boolean().optional(),\n\t/** Lists groups active in the previous window but absent now, at zero. Defaults to on. */\n\tdropped: z.boolean().optional(),\n\t/** Opens on this view only once it has this many rows; otherwise on the next. */\n\topenWhen: z.strictObject({ minRows: z.number().int().min(1) }).optional(),\n\t/** What a row click adds to the view's `click` drilldown. */\n\trowDrilldown: z.strictObject({\n\t\t/** Row dimension → drilldown field. Empty values are left out. */\n\t\tfields: z.record(z.string(), z.enum(DRILLDOWN_FIELDS)),\n\t\t/** Set: `entityName` goes in as a filter on spans of these types. */\n\t\tspanTypes: z.array(z.string().min(1)).min(1).optional(),\n\t\t/** The row's name goes in even when empty. */\n\t\tkeepEmpty: z.boolean().optional()\n\t}).optional()\n});\n/** The view's columns with their options parsed; `issues` reports what doesn't parse. */\nfunction parseColumns(columns) {\n\tconst parsed = [];\n\tconst issues = [];\n\tfor (const [i, column] of (columns ?? []).entries()) {\n\t\tconst options = tableColumnOptionsSchema.safeParse(column.options ?? {});\n\t\tif (!options.success) {\n\t\t\tconst issue = options.error.issues[0];\n\t\t\tconst path = issue?.path.length ? `.${issue.path.join(\".\")}` : \"\";\n\t\t\tissues.push(`columns.${i}.options${path}: ${issue?.message ?? \"invalid\"}`);\n\t\t\tcontinue;\n\t\t}\n\t\tparsed.push(columnOf(column.id, column.label ?? \"\", options.data));\n\t}\n\treturn {\n\t\tcolumns: parsed,\n\t\tissues\n\t};\n}\nvar isValueColumn = (column) => column.options.type === \"value\";\n/** What the schema can't say: columns that name each other and queries the view has. */\nfunction tableIssues(columns, options, queries) {\n\tconst parsed = parseColumns(columns);\n\tconst issues = [...parsed.issues];\n\tconst byId = new Map(parsed.columns.map((c) => [c.id, c]));\n\tif (!parsed.columns.filter(isValueColumn).length) issues.push(\"columns: a table needs a value column\");\n\tif (columns && !columns.some((c) => c.id === options.defaultSort.column)) issues.push(`options.defaultSort: no column '${options.defaultSort.column}'`);\n\tconst read = [];\n\tfor (const column of parsed.columns) {\n\t\tconst o = column.options;\n\t\tif (o.type === \"value\") {\n\t\t\tread.push(...exprRefs(o.value).map((r) => r.query));\n\t\t\tif (o.unpricedWhen !== void 0 && !(byId.get(o.unpricedWhen)?.options.type === \"value\")) issues.push(`columns: '${column.id}' is unpriced by '${o.unpricedWhen}', which isn't a value column`);\n\t\t}\n\t\tif (o.type === \"dimension\") {\n\t\t\tif (o.query === void 0 !== (o.joinOn === void 0)) issues.push(`columns: '${column.id}' needs both 'query' and 'joinOn', or neither`);\n\t\t\tif (o.query !== void 0) read.push(o.query);\n\t\t\tconst own = o.joinOn ?? o.dimension;\n\t\t\tif (!options.groupBy.includes(own)) issues.push(`columns: '${column.id}' reads '${own}', which rows aren't keyed on`);\n\t\t}\n\t}\n\tissues.push(...unknownQueryIssues(read, queries, \"columns\"));\n\treturn issues;\n}\nvar text = (value) => value == null ? \"\" : String(value);\nvar finite = (value) => typeof value === \"number\" && Number.isFinite(value) ? value : void 0;\n/** A row's key: its `groupBy` values, kept apart however they're spelled. */\nvar rowKey = (values) => JSON.stringify(values);\nvar keyValues = (key) => {\n\tconst parsed = JSON.parse(key);\n\treturn Array.isArray(parsed) ? parsed.map(text) : [];\n};\nfunction entries(answer, groupBy) {\n\tconst groups = groupsOf(answer);\n\tif (groups) return groups.map((g) => ({\n\t\tkey: rowKey(groupBy.map((d) => text(g.dimensions[d]))),\n\t\tdimensions: g.dimensions,\n\t\tread: (ref) => ref.field === \"estimatedCost\" ? g.estimatedCost ?? void 0 : g.value,\n\t\tcostUnit: g.costUnit ?? void 0\n\t}));\n\treturn (rowsOf(answer)?.rows ?? []).map((r) => ({\n\t\tkey: rowKey(groupBy.map((d) => text(r.dimensions?.[d]))),\n\t\tdimensions: r.dimensions ?? {},\n\t\tread: (ref) => ref.measure ? finite(measureOf(r.measures, ref.measure)) : void 0\n\t}));\n}\n/** The queries rows come from, in the view's order: those a value column reads. */\nfunction rowQueries(columns, queries) {\n\tconst read = new Set(columns.filter(isValueColumn).flatMap((c) => exprRefs(c.options.value).map((r) => r.query)));\n\treturn queries.flatMap((q) => q.id !== void 0 && read.has(q.id) ? [q.id] : []);\n}\nfunction newRow(key, groupBy) {\n\tconst values = keyValues(key);\n\treturn {\n\t\tkey,\n\t\tdimensions: Object.fromEntries(groupBy.map((d, i) => [d, values[i] ?? \"\"])),\n\t\tname: values[values.length - 1] ?? \"\",\n\t\tvalues: {},\n\t\tunits: {},\n\t\tlookups: {}\n\t};\n}\n/** Each row-query's entries by row key. */\nfunction indexEntries(ids, answers, groupBy) {\n\treturn new Map(ids.map((id) => [id, new Map(entries(answers.get(id), groupBy).map((e) => [e.key, e]))]));\n}\nvar readAt = (indexed, key) => (ref) => indexed.get(ref.query)?.get(key)?.read(ref);\n/**\n* The rows: one per group in any query a value column reads, created in the view's query order, then\n* each column's value read from the row's entries. A lookup column fills in by its `joinOn` dimension.\n*/\nfunction buildTableRows(options, columns, queries, answers) {\n\tconst { groupBy } = options;\n\tconst ids = rowQueries(columns, queries);\n\tconst indexed = indexEntries(ids, answers, groupBy);\n\tconst rows = /* @__PURE__ */ new Map();\n\tfor (const id of ids) for (const key of indexed.get(id)?.keys() ?? []) if (!rows.has(key)) rows.set(key, newRow(key, groupBy));\n\tconst lookups = columns.flatMap((c) => {\n\t\tconst o = c.options;\n\t\tif (o.type !== \"dimension\" || o.query === void 0 || o.joinOn === void 0) return [];\n\t\tconst named = /* @__PURE__ */ new Map();\n\t\tfor (const entry of entries(answers.get(o.query), groupBy)) {\n\t\t\tconst value = text(entry.dimensions[o.dimension]);\n\t\t\tif (value) named.set(text(entry.dimensions[o.joinOn]), value);\n\t\t}\n\t\treturn [{\n\t\t\tid: c.id,\n\t\t\tjoinOn: o.joinOn,\n\t\t\tnamed\n\t\t}];\n\t});\n\tfor (const row of rows.values()) {\n\t\tconst read = readAt(indexed, row.key);\n\t\tfor (const column of columns.filter(isValueColumn)) {\n\t\t\tconst value = evaluate(column.options.value, read);\n\t\t\trow.values[column.id] = value ?? column.options.missing;\n\t\t\tif (column.options.format === \"usd\" && value !== void 0) {\n\t\t\t\tconst [ref] = exprRefs(column.options.value);\n\t\t\t\trow.units[column.id] = ref ? indexed.get(ref.query)?.get(row.key)?.costUnit : void 0;\n\t\t\t}\n\t\t}\n\t\tfor (const lookup of lookups) row.lookups[lookup.id] = lookup.named.get(row.dimensions[lookup.joinOn] ?? \"\");\n\t}\n\treturn [...rows.values()];\n}\n/** The previous window's values per row key, read the same way. */\nfunction previousTableValues(options, columns, queries, answers) {\n\tconst ids = rowQueries(columns, queries);\n\tconst indexed = indexEntries(ids, answers, options.groupBy);\n\tconst previous = /* @__PURE__ */ new Map();\n\tfor (const id of ids) for (const key of indexed.get(id)?.keys() ?? []) {\n\t\tif (previous.has(key)) continue;\n\t\tconst read = readAt(indexed, key);\n\t\tprevious.set(key, Object.fromEntries(columns.filter(isValueColumn).map((c) => [c.id, evaluate(c.options.value, read)])));\n\t}\n\treturn previous;\n}\n/**\n* The rows to list: unnamed ones left out when asked, and, when the list is whole, a row at zero for\n* each group a total was above 0 for in the previous window but that has no row now.\n*/\nfunction listedRows(options, columns, built, previous, truncated) {\n\tconst named = (rows) => options.hideUnnamed ? rows.filter((r) => r.name !== \"\") : rows;\n\tif (options.dropped === false || !previous || truncated) return named(built);\n\tconst values = columns.filter(isValueColumn);\n\tconst totals = values.filter((c) => c.options.additive);\n\tconst listed = new Set(built.map((r) => r.key));\n\tconst dropped = [];\n\tfor (const [key, before] of previous) {\n\t\tif (listed.has(key) || !totals.some((c) => (before[c.id] ?? 0) > 0)) continue;\n\t\tconst row = newRow(key, options.groupBy);\n\t\tfor (const c of values) row.values[c.id] = c.options.additive && before[c.id] !== void 0 ? 0 : c.options.missing;\n\t\tdropped.push(row);\n\t}\n\treturn named([...built, ...dropped]);\n}\n/**\n* What the table lists once its row queries answer. `current` and `previous` hold one answer per\n* query, in the view's order; leave `previous` out until the previous window has settled.\n*/\nfunction tableContent(options, columns, queries, current, previous) {\n\tconst rowIds = new Set(rowQueries(columns, queries));\n\tconst capped = queries.find((q, i) => q.id !== void 0 && rowIds.has(q.id) && rowsOf(current[i])?.truncated === true);\n\tconst truncated = capped !== void 0;\n\tconst built = buildTableRows(options, columns, queries, answersById(queries, current));\n\tconst before = previous && previousTableValues(options, columns, queries, answersById(queries, previous));\n\treturn {\n\t\trows: listedRows(options, columns, built, before, truncated),\n\t\tbefore,\n\t\ttruncated,\n\t\tlimit: capped && \"limit\" in capped ? capped.limit : void 0\n\t};\n}\n/**\n* Groups whose value in `column` is above zero, once the requests of every query it reads answer.\n* `answers` holds one answer per query, in order.\n*/\nfunction countRows(options, column, queries, answers) {\n\tif (answers.length < queries.length || answers.some((a) => a === void 0)) return \"loading\";\n\treturn buildTableRows(options, [column], queries, answersById(queries, answers)).filter((r) => (r.values[column.id] ?? 0) > 0).length;\n}\n/** How a row's value in `column` moved against the previous window. */\nfunction valueChange(column, now, before) {\n\tif (now === void 0) return { isNew: false };\n\tif (before === void 0) return { isNew: column.options.additive === true && now > 0 };\n\tconst delta = now - before;\n\treturn {\n\t\tdelta,\n\t\tchange: column.options.format === \"percent\" ? delta : before > 0 ? delta / before : void 0,\n\t\tisNew: false\n\t};\n}\nfunction changeTrend(change, column) {\n\tconst { better } = column.options;\n\tif (!better || change.delta === void 0 || change.delta === 0) return void 0;\n\treturn change.delta > 0 === (better === \"higher\") ? \"good\" : \"bad\";\n}\nvar DASH = \"—\";\nfunction formatChange(change, column) {\n\tconst points = column.options.format === \"percent\";\n\tif (change.isNew) return \"New\";\n\tif (change.change === void 0) return \"—\";\n\tif (change.change === 0) return points ? \"0 pt\" : \"0%\";\n\tconst sign = change.change > 0 ? \"+\" : \"−\";\n\tconst size = Math.abs(change.change);\n\tif (!points) return `${sign}${formatPercent(size)}`;\n\treturn size < 5e-4 ? `${sign}<0.1 pt` : `${sign}${(size * 100).toFixed(1)} pt`;\n}\n/** A value in its column's format; dollars unless the answer names another currency. */\nfunction formatValue(column, value, unit) {\n\tswitch (column.options.format) {\n\t\tcase \"usd\": return unit && unit.toUpperCase() !== \"USD\" ? `${formatCount(value)} ${unit}` : formatUsd(value);\n\t\tcase \"duration\": return formatDuration(value);\n\t\tcase \"percent\": return formatPercent(value);\n\t\tdefault: return formatCount(value);\n\t}\n}\n/** What a row click adds: its dimensions as drilldown fields; an entity name as a span filter when asked. */\nfunction rowDrilldown(options, row) {\n\tconst drill = options.rowDrilldown;\n\tif (!drill) return {};\n\tconst nameDimension = options.groupBy[options.groupBy.length - 1];\n\tconst scope = {};\n\tfor (const [dimension, field] of Object.entries(drill.fields)) {\n\t\tconst value = row.dimensions[dimension] ?? \"\";\n\t\tif (!value && !(drill.keepEmpty && dimension === nameDimension)) continue;\n\t\tif (field === \"entityName\" && drill.spanTypes) scope.span = {\n\t\t\tspanTypes: drill.spanTypes,\n\t\t\tentityName: value\n\t\t};\n\t\telse scope[field] = value;\n\t}\n\treturn scope;\n}\n/**\n* The view a table opens on. Without an `openWhen` view, the first. The `openWhen` view opens while\n* its rows load, so the tabs don't jump, and once it has `minRows` of them; it's passed over when it\n* can't count them or has too few.\n*/\nfunction openingView(views, rows) {\n\tconst opener = views.findIndex((v) => v.options.openWhen);\n\tif (opener < 0) return 0;\n\tconst next = (opener + 1) % views.length;\n\tif (rows === \"uncountable\") return next;\n\tif (rows === \"loading\") return opener;\n\treturn rows >= (views[opener]?.options.openWhen?.minRows ?? 0) ? opener : next;\n}\nexport { DASH, DRILLDOWN_FIELDS, TABLE_VALUE_FORMATS, buildTableRows, changeTrend, countRows, formatChange, formatValue, isValueColumn, listedRows, openingView, parseColumns, previousTableValues, rowDrilldown, rowQueries, tableColumnOptionsSchema, tableContent, tableIssues, tableOptionsSchema, valueChange };\n\n//# sourceMappingURL=table.es.js.map","import { bucketGrid, bucketPlan, gridIndex, intervalHours } from \"../../metrics/lib/metrics-buckets.es.js\";\nimport { bucketTraceAggregateRows } from \"../../metrics/lib/trace-aggregate.es.js\";\nimport { measureOf, rowsOf, seriesOf, valueOf } from \"./answers.es.js\";\nimport { colorSchema, evaluate, exprRefs, formatSchema, matchesGroups, queryRefSchema, unknownQueryIssues, valueExprSchema } from \"./values.es.js\";\nimport { z } from \"zod/v4\";\n// src/domains/dashboards/lib/timeseries.ts\nvar timeseriesSeriesSchema = z.object({\n\tdataKey: z.string().min(1),\n\tlabel: z.string().min(1),\n\tcolor: colorSchema,\n\temphasis: z.boolean().optional(),\n\t/** The series' value per bucket. */\n\tvalue: valueExprSchema,\n\t/** The series' value over the whole range, shown beside the card's title marked with the series' color. */\n\trangeTotal: valueExprSchema.optional(),\n\t/** Rounds each bucket's value to a whole number. */\n\tround: z.boolean().optional()\n}).strict();\nvar timeseriesOptionsSchema = z.object({\n\tchart: z.enum([\"stackedBar\", \"line\"]),\n\tformat: formatSchema,\n\t/** `false` leaves the y-axis to the chart's default labels. */\n\taxis: z.boolean().optional(),\n\tseries: z.array(timeseriesSeriesSchema).min(1),\n\t/**\n\t* `chart` re-buckets metrics onto the bar charts' grid (sums merge); `api` keeps the API's 1h or 1d\n\t* buckets (percentiles and averages can't merge). Trace and span aggregates always keep the API's.\n\t*/\n\tbuckets: z.enum([\"chart\", \"api\"]).optional(),\n\t/** Ids of queries sent over the whole range, without an interval (e.g. distinct counts, which can't be summed). */\n\ttotals: z.array(queryRefSchema).optional(),\n\t/** Hides a series whose range total (or, without one, sum of buckets) is zero. */\n\thideEmpty: z.boolean().optional(),\n\t/** Emphasizes the first series shown. */\n\temphasizeFirst: z.boolean().optional(),\n\txLabels: z.literal(\"edges\").optional(),\n\t/** The y-axis range when every plotted value is zero. */\n\tflatYDomain: z.tuple([z.number(), z.number()]).optional(),\n\tyDomain: z.tuple([z.number(), z.number()]).optional(),\n\t/** The card's total, beside its title. Ignored when a series has a `rangeTotal`. */\n\ttotal: z.object({\n\t\t/** `total`: every series summed over the range; `peak`: one series' highest bucket; or an expression over range totals. */\n\t\tvalue: z.union([\n\t\t\tz.literal(\"total\"),\n\t\t\tz.object({ peak: z.string().min(1) }).strict(),\n\t\t\tvalueExprSchema\n\t\t]),\n\t\tformat: formatSchema.optional()\n\t}).strict().optional(),\n\t/** @deprecated Accepted so saved definitions still parse; every empty chart shows the same message. */\n\temptyMessage: z.string().optional(),\n\t/** Empty when this is zero over the range; by default, when every plotted value is zero. */\n\temptyWhenZero: valueExprSchema.optional()\n}).strict();\n/** A ref's value in one trace aggregate row set (ungrouped: one row). */\nfunction fromRows(rows, ref) {\n\tconst { measure } = ref;\n\tif (!measure) return void 0;\n\tconst values = rows.flatMap((r) => measureOf(r.measures, measure) ?? []);\n\treturn values.length ? values.reduce((a, b) => a + b, 0) : void 0;\n}\n/** A ref's value over the whole range, from a totals query or the sum of its buckets. */\nfunction rangeValue(answer, ref, perBucket) {\n\tconst aggregate = rowsOf(answer);\n\tif (aggregate && !aggregate.rows.some((r) => r.bucket)) return fromRows(aggregate.rows, ref) ?? 0;\n\tconst value = valueOf(answer);\n\tif (value) return (ref.field === \"estimatedCost\" ? value.estimatedCost : value.value) ?? void 0;\n\treturn perBucket?.reduce((sum, v) => sum + (v ?? 0), 0);\n}\n/**\n* Lays a timeseries view's answers on the chart's bucket grid. `chart` buckets add every point that\n* falls in a bucket (missing is 0); `api` buckets take the API's point (missing stays unset).\n*/\nfunction shapeTimeseries({ options, responses, window, hasTraceQueries }) {\n\tconst plan = bucketPlan(window.start, window.end);\n\tconst merged = !hasTraceQueries && (options.buckets ?? \"chart\") === \"chart\";\n\tconst stepHours = merged ? plan.stepHours : intervalHours(plan.interval);\n\tconst grid = bucketGrid(window.start, window.end, stepHours);\n\tconst indexOf = gridIndex(grid, stepHours);\n\tconst totals = new Set(options.totals ?? []);\n\tconst cache = /* @__PURE__ */ new Map();\n\tconst bucketed = (ref) => {\n\t\tconst key = JSON.stringify(ref);\n\t\tconst hit = cache.get(key);\n\t\tif (hit) return hit;\n\t\tconst values = grid.map(() => merged ? 0 : void 0);\n\t\tconst answer = responses.get(ref.query);\n\t\tconst aggregate = rowsOf(answer);\n\t\tif (aggregate) bucketTraceAggregateRows(aggregate.rows, window).forEach((b, i) => {\n\t\t\tvalues[i] = fromRows(b.rows, ref) ?? 0;\n\t\t});\n\t\tfor (const s of seriesOf(answer) ?? []) {\n\t\t\tif (ref.percentile !== void 0 && s.percentile !== ref.percentile) continue;\n\t\t\tif (!matchesGroups(ref, s.name ?? \"\")) continue;\n\t\t\tfor (const p of s.points) {\n\t\t\t\tconst i = indexOf(p);\n\t\t\t\tif (i === void 0) continue;\n\t\t\t\tconst v = ref.field === \"estimatedCost\" ? p.estimatedCost ?? 0 : p.value;\n\t\t\t\tvalues[i] = (values[i] ?? 0) + v;\n\t\t\t}\n\t\t}\n\t\tcache.set(key, values);\n\t\treturn values;\n\t};\n\tconst rangeOf = (ref) => rangeValue(responses.get(ref.query), ref, totals.has(ref.query) ? void 0 : bucketed(ref)) ?? 0;\n\tconst overRange = (expr) => evaluate(expr, rangeOf) ?? 0;\n\tconst perSeries = options.series.map((s) => {\n\t\tconst values = grid.map((_, i) => {\n\t\t\tconst v = evaluate(s.value, (ref) => bucketed(ref)[i]);\n\t\t\treturn v === void 0 ? void 0 : s.round ? Math.round(v) : v;\n\t\t});\n\t\tconst sum = values.reduce((a, v) => a + (v ?? 0), 0);\n\t\treturn {\n\t\t\ts,\n\t\t\tvalues,\n\t\t\trangeTotal: s.rangeTotal ? overRange(s.rangeTotal) : void 0,\n\t\t\tsum\n\t\t};\n\t});\n\tconst shown = perSeries.filter((p) => !options.hideEmpty || (p.rangeTotal ?? p.sum) > 0);\n\tconst data = grid.map((labels, i) => {\n\t\tconst bucket = { ...labels };\n\t\tfor (const p of shown) {\n\t\t\tconst v = p.values[i];\n\t\t\tif (v !== void 0) bucket[p.s.dataKey] = v;\n\t\t}\n\t\treturn bucket;\n\t});\n\tlet total;\n\tconst spec = options.total?.value;\n\tif (spec === \"total\") total = shown.reduce((a, p) => a + p.sum, 0);\n\telse if (spec && \"peak\" in spec) {\n\t\tconst peak = perSeries.find((p) => p.s.dataKey === spec.peak);\n\t\ttotal = Math.max(0, ...(peak?.values ?? []).map((v) => v ?? 0));\n\t} else if (spec) total = overRange(spec);\n\tconst flat = shown.every((p) => p.values.every((v) => !v));\n\treturn {\n\t\tdata,\n\t\tseries: shown.map((p, i) => ({\n\t\t\t...p.s,\n\t\t\temphasis: options.emphasizeFirst ? i === 0 : p.s.emphasis,\n\t\t\trangeTotal: p.rangeTotal\n\t\t})),\n\t\tstepHours,\n\t\ttotal,\n\t\tflat,\n\t\tempty: options.emptyWhenZero ? overRange(options.emptyWhenZero) === 0 : flat\n\t};\n}\n/** Aggregations whose values for several groups add up to the value for all of them. */\nvar ADDITIVE = /* @__PURE__ */ new Set([\"sum\", \"count\"]);\n/**\n* The numbers an alert could watch: each series over the range (its `rangeTotal`, else its value),\n* then the card's total when it is an expression.\n*/\nfunction timeseriesAlertValues(options) {\n\tconst values = options.series.map((s) => ({\n\t\tlabel: s.label,\n\t\tvalue: s.rangeTotal ?? s.value\n\t}));\n\tconst total = options.total?.value;\n\tif (total && total !== \"total\" && !(\"peak\" in total)) values.push({\n\t\tlabel: \"Total\",\n\t\tvalue: total\n\t});\n\treturn values;\n}\n/**\n* What the schema can't say: query ids the view has, bucketed queries that leave their interval to the\n* chart's grid, refs that pick one of the percentiles their query asks for, and refs that pick one group\n* of a grouped aggregation that can't be added up.\n*/\nfunction timeseriesIssues(options, queries) {\n\tconst exprs = options.series.flatMap((s) => s.rangeTotal ? [s.value, s.rangeTotal] : [s.value]);\n\tconst total = options.total?.value;\n\tif (total && total !== \"total\" && !(\"peak\" in total)) exprs.push(total);\n\tif (options.emptyWhenZero) exprs.push(options.emptyWhenZero);\n\tconst refs = exprs.flatMap(exprRefs);\n\tconst totals = new Set(options.totals ?? []);\n\tconst byId = new Map(queries.map((q) => [q.id, q]));\n\tconst ownIntervals = queries.filter((q) => q.id !== void 0 && !totals.has(q.id) && \"interval\" in q && q.interval !== void 0).map((q) => `query '${q.id}' sets its own interval; the chart's buckets follow the page's range`);\n\tconst ambiguousPercentiles = refs.filter((r) => {\n\t\tconst query = byId.get(r.query);\n\t\treturn r.percentile === void 0 && query !== void 0 && \"request\" in query && query.request === \"percentiles\" && query.percentiles.length > 1;\n\t}).map((r) => `a value reading query '${r.query}' must pick one of its percentiles`);\n\tconst missingPercentiles = refs.filter((r) => {\n\t\tconst query = byId.get(r.query);\n\t\treturn r.percentile !== void 0 && query !== void 0 && \"request\" in query && query.request === \"percentiles\" && !query.percentiles.includes(r.percentile);\n\t}).map((r) => `a value reading query '${r.query}' picks percentile ${r.percentile}, which the query doesn't ask for`);\n\tconst mixedGroups = refs.filter((r) => {\n\t\tconst query = byId.get(r.query);\n\t\treturn r.groups?.length !== 1 && query !== void 0 && \"request\" in query && query.request === \"timeSeries\" && (query.groupBy?.length ?? 0) > 0 && !ADDITIVE.has(query.aggregation);\n\t}).map((r) => `a value reading query '${r.query}' must pick one group, since its groups' values can't be added up`);\n\treturn [\n\t\t...unknownQueryIssues(refs.map((r) => r.query), queries),\n\t\t...unknownQueryIssues(options.totals ?? [], queries, \"options.totals\"),\n\t\t...ownIntervals,\n\t\t...new Set(ambiguousPercentiles),\n\t\t...new Set(missingPercentiles),\n\t\t...new Set(mixedGroups)\n\t];\n}\nexport { shapeTimeseries, timeseriesAlertValues, timeseriesIssues, timeseriesOptionsSchema, timeseriesSeriesSchema };\n\n//# sourceMappingURL=timeseries.es.js.map","// src/domains/dashboards/lib/chrome.ts\n/** Filters a gate can't apply, named as the filter bar names them. */\nvar FILTER_NAMES = {\n\tserviceName: \"service\",\n\trequestId: \"request ID\",\n\texperimentId: \"experiment\"\n};\nvar unsupportedMessage = (fields, names = FILTER_NAMES) => `Not available with a ${fields.map((f) => names[f] ?? f).join(\" or \")} filter.`;\n/** A view's value in the card's menu: its label in kebab case (`Token usage` → `token-usage`), or its position when unlabelled or blank. */\nvar viewValue = (label, index) => {\n\tconst trimmed = label?.trim();\n\treturn trimmed ? trimmed.toLowerCase().replace(/\\s+/g, \"-\") : String(index);\n};\n/** A view's visible name: its label, or `View n` when unlabelled or blank, so every option has an accessible name. */\nvar viewLabel = (label, index) => label?.trim() || `View ${index + 1}`;\n/**\n* The card title for the open view: the widget's title for a single view; with several, the open\n* view's label, as a menu of every view (as the metrics cards switch views). With somewhere to\n* expand to, the widget's title stays plain instead, and `ExpandAction` links there.\n*/\nfunction viewTitle(widget, views, index, onChoose, expand) {\n\tif (expand?.href(widget)) return { title: widget.title?.trim() ? widget.title : viewLabel(views[0]?.label, 0) };\n\tif (views.length < 2) return { title: widget.title ?? \"\" };\n\tconst options = views.map((v, i) => ({\n\t\tvalue: viewValue(v.label, i),\n\t\tlabel: viewLabel(v.label, i)\n\t}));\n\treturn {\n\t\ttitle: options[index]?.label ?? \"\",\n\t\ttitleMenu: {\n\t\t\tvalue: options[index]?.value ?? \"\",\n\t\t\tonValueChange: (value) => onChoose(options.findIndex((o) => o.value === value)),\n\t\t\toptions\n\t\t}\n\t};\n}\nexport { unsupportedMessage, viewLabel, viewTitle, viewValue };\n\n//# sourceMappingURL=chrome.es.js.map","import { DASHBOARD_SCOPES, DASHBOARD_WIDGET_KINDS } from '@mastra/core/storage/dashboards';\nimport type { DashboardBuiltInWidgetKind, DashboardWidget, DashboardWidgetView } from '@mastra/core/storage/dashboards';\nimport { kpisIssues, kpisOptionsSchema } from '@mastra/playground-ui/domains/dashboards/kinds/kpis/options';\nimport { scoresIssues, scoresOptionsSchema } from '@mastra/playground-ui/domains/dashboards/kinds/scores/options';\nimport { viewValue } from '@mastra/playground-ui/domains/dashboards/lib/chrome';\nimport {\n tableColumnOptionsSchema,\n tableIssues,\n tableOptionsSchema,\n} from '@mastra/playground-ui/domains/dashboards/lib/table';\nimport { timeseriesIssues, timeseriesOptionsSchema } from '@mastra/playground-ui/domains/dashboards/lib/timeseries';\nimport type { z } from 'zod/v4';\n\n/*\n * How the dashboard renderer checks a widget's views, without React. The view loop mirrors\n * playground-ui's `prepareWidget`; the parity test keeps the two in step until they share a module.\n */\n\nexport type DashboardScope = 'org' | 'project';\n\n/** A view as a kind's checks read it: its options parsed, its columns those at the scope. */\ntype CheckedView = Omit<DashboardWidgetView, 'options'> & { options: any };\n\nexport type KindCheck = { optionsSchema: z.ZodType; issues?: (view: CheckedView) => string[] };\n\n/** A problem with a widget, its path relative to the widget. */\nexport type WidgetIssue = { path: PropertyKey[]; message: string };\n\n/** How each built-in kind checks a view: the options it accepts, then what it checks beyond them. */\nexport const KIND_CHECKS: Record<DashboardBuiltInWidgetKind, KindCheck> = {\n kpis: { optionsSchema: kpisOptionsSchema, issues: kpisIssues },\n table: {\n optionsSchema: tableOptionsSchema,\n issues: view => tableIssues(view.columns, view.options, view.queries),\n },\n timeseries: {\n optionsSchema: timeseriesOptionsSchema,\n issues: view => timeseriesIssues(view.options, view.queries),\n },\n scores: { optionsSchema: scoresOptionsSchema, issues: scoresIssues },\n};\n\n/** Whether a widget, view or column tagged with `scope` shows at the page's scope. */\nexport const inScope = (item: { scope?: DashboardScope }, scope: DashboardScope) =>\n item.scope === undefined || item.scope === scope;\n\n/**\n * What the renderer rejects in the widget's views at `scope`, in the order it finds them: options\n * parsed, then the kind's own issues, then labels unique. Takes a widget core's schema accepts.\n * Views in `skipKindChecks` skip the kind's own issues, for callers that already report them.\n */\nexport function viewIssues(\n widget: DashboardWidget,\n check: KindCheck,\n scope: DashboardScope,\n skipKindChecks: ReadonlySet<number> = new Set(),\n): WidgetIssue[] {\n const issues: WidgetIssue[] = [];\n const values = new Set<string>();\n let shown = 0;\n for (const [index, view] of widget.views.entries()) {\n if (!inScope(view, scope)) continue;\n // Every view at the scope is an option in the card's menu, picked by its value; two with one value would\n // leave one unreachable. A view with problems still counts, as the renderer numbers it once they're fixed.\n const value = viewValue(view.label, shown++);\n const repeated = values.has(value);\n values.add(value);\n\n const options = check.optionsSchema.safeParse(view.options ?? {});\n if (!options.success) {\n const found = options.error.issues.length ? options.error.issues : [{ path: [], message: 'Invalid options' }];\n issues.push(\n ...found.map(issue => ({ path: ['views', index, 'options', ...issue.path], message: issue.message })),\n );\n continue;\n }\n // Columns at the other scope are left out before the kind sees them.\n const resolved = { ...view, columns: view.columns?.filter(c => inScope(c, scope)), options: options.data };\n if (!skipKindChecks.has(index)) {\n issues.push(...(check.issues?.(resolved) ?? []).map(message => ({ path: ['views', index], message })));\n }\n if (repeated) {\n issues.push({ path: ['views', index], message: `another view is already labelled '${view.label ?? value}'` });\n }\n }\n return issues;\n}\n\nconst isBuiltInKind = (kind: string): kind is keyof typeof KIND_CHECKS => Object.hasOwn(KIND_CHECKS, kind);\n\nexport const zodIssues = (error: z.ZodError, prefix: PropertyKey[]): WidgetIssue[] =>\n error.issues.map(issue => ({ path: [...prefix, ...issue.path], message: issue.message }));\n\n/**\n * What the renderer would reject in a widget core accepts, paths relative to the widget. Every\n * view's options and columns are parsed; the kind's own checks then run at each scope the widget\n * shows at, as the renderer runs them there, skipping views whose options or columns don't parse.\n * All problems come back together. It also rejects columns on views that aren't tables, which the\n * renderer ignores.\n */\nexport function widgetIssues(widget: DashboardWidget): WidgetIssue[] {\n if (!isBuiltInKind(widget.kind)) {\n return [\n {\n path: ['kind'],\n message: `Unknown widget kind '${widget.kind}'; expected one of ${DASHBOARD_WIDGET_KINDS.join(', ')}`,\n },\n ];\n }\n const check = KIND_CHECKS[widget.kind];\n\n const issues = new Map<string, WidgetIssue>();\n const add = (found: WidgetIssue[]) => {\n for (const issue of found) issues.set(`${JSON.stringify(issue.path)} ${issue.message}`, issue);\n };\n // The table's own checks would report a bad column again, at the view.\n const badColumns = new Set<number>();\n for (const [i, view] of widget.views.entries()) {\n const options = check.optionsSchema.safeParse(view.options ?? {});\n if (!options.success) add(zodIssues(options.error, ['views', i, 'options']));\n if (!view.columns) continue;\n // The renderer ignores columns on other kinds; rejected so a widget written as another kind isn't stored.\n if (widget.kind !== 'table') {\n add([{ path: ['views', i, 'columns'], message: 'Only table widgets have columns' }]);\n continue;\n }\n for (const [m, column] of view.columns.entries()) {\n const columnOptions = tableColumnOptionsSchema.safeParse(column.options ?? {});\n if (!columnOptions.success) {\n add(zodIssues(columnOptions.error, ['views', i, 'columns', m, 'options']));\n badColumns.add(i);\n }\n }\n }\n\n for (const scope of DASHBOARD_SCOPES) {\n if (inScope(widget, scope)) add(viewIssues(widget, check, scope, badColumns));\n }\n return [...issues.values()];\n}\n","import {\n DASHBOARD_MAX_QUERIES_PER_VIEW,\n DASHBOARD_MAX_WIDGETS,\n DASHBOARD_SCHEMA_VERSION,\n dashboardDefaultsSchema,\n dashboardDefinitionSchema,\n dashboardQuerySchema,\n dashboardWidgetSchema,\n dashboardWidgetViewSchema,\n} from '@mastra/core/storage/dashboards';\nimport type {\n DashboardBuiltInWidgetKind,\n DashboardColumn,\n DashboardDefaults,\n DashboardDefinition,\n DashboardQuery,\n DashboardWidget,\n DashboardWidgetView,\n} from '@mastra/core/storage/dashboards';\nimport { kpisIssues, kpisOptionsSchema } from '@mastra/playground-ui/domains/dashboards/kinds/kpis/options';\nimport { scoresIssues, scoresOptionsSchema } from '@mastra/playground-ui/domains/dashboards/kinds/scores/options';\nimport {\n tableColumnOptionsSchema,\n tableIssues,\n tableOptionsSchema,\n} from '@mastra/playground-ui/domains/dashboards/lib/table';\nimport {\n timeseriesIssues,\n timeseriesOptionsSchema,\n timeseriesSeriesSchema,\n} from '@mastra/playground-ui/domains/dashboards/lib/timeseries';\nimport { valueRefSchema } from '@mastra/playground-ui/domains/dashboards/lib/values';\nimport type { ValueExpr, ValueRef } from '@mastra/playground-ui/domains/dashboards/lib/values';\nimport { z } from 'zod/v4';\nimport { OBSERVABILITY_DATE_PRESETS } from './apps/observability-widget/tool';\nimport type { ObservabilityDatePreset } from './apps/observability-widget/tool';\nimport { widgetIssues } from './dashboard-views';\n\n/*\n * The model writes a dashboard in an authoring shape that `toObservabilityDashboard` turns into the\n * stored definition. The definition keeps a view's reads in a `queries` list that options point\n * into by id (values, a chart's `totals`, a total's `peak`, a table's `defaultSort`). The authoring shape has no such ids: each value holds the read it shows, and the\n * converter gathers identical reads into one query. What a value can read depends on where it\n * sits, so a read that can't work there (a breakdown in a chart, a time series in a table) can't\n * be written. Where the definition tells cases apart by a tag (`kind`, `source` + `request`, a\n * column's `type`), the authoring shape names the case by a key holding its fields, so a rejected\n * input is reported at the field that is wrong rather than once per case.\n */\n\nconst report = (context: z.core.$RefinementCtx, issues: string[], path: PropertyKey[] = []) => {\n for (const message of issues) context.addIssue({ code: 'custom', path, message });\n};\n\nconst keysList = (keys: readonly string[]) => keys.map(key => `\\`${key}\\``).join(', ');\n\n/** The keys of `value` among `keys` that hold something. */\nconst keysIn = <K extends string>(value: object, keys: readonly K[]) =>\n keys.filter(key => (value as Record<string, unknown>)[key] !== undefined);\n\n/**\n * Whether exactly one of `keys` holds the case's fields, reporting it when not. Checked before the\n * cases are parsed, so a missing or extra case is reported as such rather than as each case's\n * errors. The keys named are the cases given, or, with none, the keys `fields` doesn't have: a\n * read written where it isn't allowed.\n */\nconst hasOneKey = (\n input: object,\n keys: readonly string[],\n fields: readonly string[],\n what: string,\n context: z.core.$RefinementCtx,\n) => {\n const given = keysIn(input, keys);\n if (given.length === 1) return true;\n const wrong = given.length ? given : Object.keys(input).filter(key => !fields.includes(key));\n context.addIssue({\n code: 'custom',\n path: given.slice(1),\n message: `${what} takes exactly one of ${keysList(keys)}${wrong.length ? `, not ${keysList(wrong)}` : ''}`,\n });\n return false;\n};\n\n/**\n * `schema`, an object with one optional key per case, parsed only once exactly one of `keys` holds\n * the case's fields. Typed as `T`, the union of one-key objects that check leaves.\n */\nconst oneKeyOf = <T>(keys: readonly string[], what: string, schema: z.ZodObject): z.ZodType<T> => {\n const fields = Object.keys(schema.shape);\n return z.preprocess((input, context) => {\n if (!input || typeof input !== 'object' || hasOneKey(input, keys, fields, what, context)) return input;\n return z.NEVER;\n }, schema) as unknown as z.ZodType<T>;\n};\n\n/** The fields of an object schema, without `omit`. */\nconst fieldsOf = (schema: z.ZodObject, omit: readonly string[]) =>\n Object.fromEntries(Object.entries(schema.shape).filter(([key]) => !omit.includes(key)));\n\n/** Canonical JSON: the same for objects that differ only in key order. */\nconst canonical = (value: unknown): string =>\n JSON.stringify(value, (_, v) =>\n v && typeof v === 'object' && !Array.isArray(v)\n ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b)))\n : v,\n );\n\n/** What the project records, so the input schema can list it rather than leave it to a guess. */\nexport type ObservabilityCatalog = {\n /** The metric names with data, as `MastraClient#getMetricNames` lists them. */\n metricNames?: readonly string[];\n};\n\n/** Past this many, metric names stay free strings: a longer list costs more than it guides. */\nexport const OBSERVABILITY_CATALOG_MAX_METRIC_NAMES = 200;\n\n// An unknown metric name reads as zero rather than failing, so the description names the ones\n// Mastra emits.\nconst METRIC_NAME_DESCRIPTION = [\n 'A metric name. Mastra emits `mastra_agent_duration_ms`, `mastra_workflow_duration_ms`, `mastra_tool_duration_ms`,',\n '`mastra_model_duration_ms` and `mastra_processor_duration_ms` (one row per run or call, labelled `status` `ok` or',\n '`error`: `count` them for runs, take percentiles for latency); `mastra_model_total_input_tokens` and',\n '`mastra_model_total_output_tokens` (`sum` them for tokens; read `field: \"estimatedCost\"` for the price), plus',\n 'per-type token metrics such as `mastra_model_input_cache_read_tokens` and `mastra_model_output_reasoning_tokens`.',\n 'Projects can emit their own metrics too.',\n].join(' ');\n\nconst READS = {\n traceAggregate: { source: 'traceAggregate' },\n spanAggregate: { source: 'spanAggregate' },\n metricAggregate: { source: 'metrics', request: 'aggregate' },\n metricBreakdown: { source: 'metrics', request: 'breakdown' },\n metricTimeSeries: { source: 'metrics', request: 'timeSeries' },\n metricPercentiles: { source: 'metrics', request: 'percentiles' },\n} as const satisfies Record<string, { source: DashboardQuery['source']; request?: string }>;\ntype ReadKey = keyof typeof READS;\n\n/** What each place a value sits can read. */\nconst CHART_READS = [\n 'metricTimeSeries',\n 'metricPercentiles',\n 'traceAggregate',\n 'spanAggregate',\n] as const satisfies ReadKey[];\nconst RANGE_READS = [...CHART_READS, 'metricAggregate'] as const satisfies ReadKey[];\nconst TABLE_READS = ['traceAggregate', 'spanAggregate', 'metricBreakdown'] as const satisfies ReadKey[];\nconst KPI_READS = ['metricAggregate'] as const satisfies ReadKey[];\n\n/** The fields of a read that pick a number out of its answer rather than change the request. */\nconst PICKS = ['measure', 'percentile', 'field', 'groups', 'notGroups'] as const;\n\nconst isTraceRead = (key: ReadKey) => key === 'traceAggregate' || key === 'spanAggregate';\n\n/**\n * `query`'s `filters`, named, so JSON Schema lists them once rather than at every read. Every\n * metrics query takes the same filters, as does every scores query. The name goes on the optional\n * field rather than the object inside it: provider compatibility layers (`@mastra/schema-compat`)\n * empty a `$ref` they find wrapped in an optional.\n */\nconst namedFilters = (query: z.ZodObject, id: string) => ({\n filters: (query.shape.filters as z.ZodOptional<z.ZodObject>).meta({ id }),\n});\n\n/** Each read's arguments, with metric names limited to `metricNames` when given. */\nconst readSchemas = (metricNames?: [string, ...string[]]) => {\n const [traceAggregate, spanAggregate, metrics] = dashboardQuerySchema.out.options;\n const [metricAggregate, metricBreakdown, metricTimeSeries, metricPercentiles] = metrics.options;\n const metricName = (metricNames ? z.enum(metricNames) : z.string().min(1)).meta({\n id: 'MastraMetricName',\n description: METRIC_NAME_DESCRIPTION,\n });\n const names = { name: z.array(metricName).nonempty() };\n const filters = namedFilters(metricAggregate, 'MastraMetricFilters');\n const { field, groups, notGroups, percentile } = valueRefSchema.shape;\n const picks = {\n field: field.describe('`value`, or `estimatedCost` for the price. Defaults to `value`.'),\n groups: groups.describe('Only the groups whose key is exactly one of these.'),\n notGroups: notGroups.describe('Only the groups whose key is none of these.'),\n percentile: percentile.unwrap().describe('The percentile to read, e.g. `0.95`.'),\n };\n // Not sent: the page's range sets the interval; a table's or chart's own reads set the sort.\n const omit = ['source', 'request', 'id', 'interval'];\n const measures = traceAggregate.shape.measures as unknown as z.ZodArray<z.ZodType>;\n const traceRead = (source: 'traceAggregate' | 'spanAggregate', query: z.ZodObject) =>\n guardPredicates(\n source,\n z.strictObject({\n ...fieldsOf(query, [...omit, 'measures', 'having', 'orderBy']),\n measure: measures.element.optional().describe('The measure this value reads. Defaults to `count`.'),\n groups: picks.groups,\n notGroups: picks.notGroups,\n }),\n );\n const grouped = (query: z.ZodObject) =>\n (query.shape.groupBy as z.ZodType)\n .optional()\n .describe(\"The dimensions to group by. In a table, defaults to the table's `groupBy`.\");\n return named({\n traceAggregate: traceRead('traceAggregate', traceAggregate),\n spanAggregate: traceRead('spanAggregate', spanAggregate),\n metricAggregate: z.strictObject({ ...fieldsOf(metricAggregate, omit), ...names, ...filters, field: picks.field }),\n metricBreakdown: z.strictObject({\n ...fieldsOf(metricBreakdown, omit),\n ...names,\n ...filters,\n groupBy: grouped(metricBreakdown),\n field: picks.field,\n }),\n metricTimeSeries: z.strictObject({\n ...fieldsOf(metricTimeSeries, omit),\n ...names,\n ...filters,\n field: picks.field,\n groups: picks.groups,\n notGroups: picks.notGroups,\n }),\n metricPercentiles: z.strictObject({\n ...fieldsOf(metricPercentiles, [...omit, 'percentiles']),\n ...filters,\n name: metricName,\n percentile: picks.percentile,\n }),\n });\n};\n\n/** `schemas`, each named, so JSON Schema lists a read's arguments once rather than at every value. */\nconst named = <T extends Record<ReadKey, z.ZodType>>(schemas: T) =>\n Object.fromEntries(\n Object.entries(schemas).map(([key, schema]) => [\n key,\n schema.meta({ id: `Mastra${key[0]!.toUpperCase()}${key.slice(1)}Read` }),\n ]),\n ) as T;\ntype ReadSchemas = ReturnType<typeof readSchemas>;\n\n/** `schema`, with an oversized `where` rejected before zod recurses into it, as the definition does. */\nconst guardPredicates = (source: 'traceAggregate' | 'spanAggregate', schema: z.ZodObject) =>\n z.preprocess((input, context) => {\n if (!input || typeof input !== 'object') return input;\n const guarded = z.safeParse(dashboardQuerySchema.in, { source, ...input });\n if (guarded.success) return input;\n for (const issue of guarded.error.issues) context.addIssue({ ...issue, code: 'custom' });\n return z.NEVER;\n }, schema) as unknown as z.ZodObject;\n\nconst OPERATORS = ['const', 'sum', 'minus', 'ratio', 'max', 'coalesce'] as const;\n/** The keys of a value column that hold its number rather than its options. */\nconst TABLE_VALUE_KEYS: readonly string[] = [...TABLE_READS, ...OPERATORS];\n\n/**\n * The keys a value takes, one of which it sets: each read among `reads` holding its arguments, and\n * each operator over `self`, the value nested inside it. `sumOnly` leaves `sum` as the one operator.\n */\nconst valueCases = (\n schemas: ReadSchemas,\n reads: readonly ReadKey[],\n self: z.ZodType<ObservabilityValue>,\n sumOnly = false,\n) => {\n const operators = sumOnly ? (['sum'] as const) : OPERATORS;\n const parts = (description: string) => z.array(self).min(1).optional().describe(description);\n return {\n keys: [...reads, ...operators],\n summary: `a read (${keysList(reads)}) holding its arguments, or ${sumOnly ? '`sum`' : `an operator (${keysList(operators)})`} over values. Reads that differ only in ${keysList(PICKS)} share one request.`,\n shape: {\n ...Object.fromEntries(reads.map(key => [key, schemas[key].optional()])),\n sum: parts('The parts added up; a missing part counts as 0.'),\n ...(sumOnly\n ? {}\n : {\n const: z.number().optional(),\n minus: z.tuple([self, self]).optional().describe('The first minus the second.'),\n ratio: z\n .strictObject({ of: self, over: self })\n .optional()\n .describe('`of / over`; no value when `over` is 0.'),\n max: parts('The largest part that has a value.'),\n coalesce: parts('The first part that has a value.'),\n }),\n },\n };\n};\n\n/** A value: exactly one key, a read among `reads` or an operator over values. */\nconst valueSchema = (\n schemas: ReadSchemas,\n reads: readonly ReadKey[],\n id: string,\n description: string,\n sumOnly = false,\n): z.ZodType<ObservabilityValue> => {\n const cases = valueCases(\n schemas,\n reads,\n z.lazy(() => value),\n sumOnly,\n );\n const value: z.ZodType<ObservabilityValue> = oneKeyOf<ObservabilityValue>(\n cases.keys,\n 'A value',\n z.strictObject(cases.shape),\n ).meta({ id, description: `${description} Exactly one key: ${cases.summary}` });\n return value;\n};\n\n/** The view's reads, gathered into one query each, so identical reads are sent once. */\nclass Reads {\n readonly queries: DashboardQuery[] = [];\n /** Ids of trace and span aggregates sent over the whole range, which a chart lists as `totals`. */\n readonly wholeRange: string[] = [];\n #byIdentity = new Map<string, DashboardQuery & { measures?: string[]; percentiles?: number[] }>();\n\n /**\n * The ref reading `read` placed in `place`: `range` sends a trace or span aggregate over the whole\n * range; `table` groups it by `groupBy` unless it sets its own.\n */\n ref(read: ObservabilityRead, place: 'bucket' | 'range' | 'table', groupBy?: string[]): ValueRef {\n const [key] = keysIn(read, Object.keys(READS) as ReadKey[]) as [ReadKey];\n const { measure, percentile, field, groups, notGroups, ...args } = (\n read as unknown as Record<ReadKey, ValueRef & Record<string, unknown>>\n )[key];\n const trace = isTraceRead(key);\n const fillsGroupBy = trace || key === 'metricBreakdown';\n if (groupBy && fillsGroupBy && args.groupBy === undefined) (args as { groupBy?: string[] }).groupBy = groupBy;\n const whole = trace && place === 'range';\n const identity = canonical([key, whole, args]);\n let query = this.#byIdentity.get(identity);\n if (!query) {\n query = {\n ...READS[key],\n id: `q${this.queries.length + 1}`,\n ...args,\n ...(trace ? { measures: [] } : {}),\n ...(percentile === undefined ? {} : { percentiles: [] }),\n } as DashboardQuery & { measures?: string[]; percentiles?: number[] };\n this.#byIdentity.set(identity, query);\n this.queries.push(query);\n if (whole) this.wholeRange.push(query.id!);\n }\n const ref: ValueRef = { query: query.id! };\n if (trace) {\n ref.measure = measure ?? 'count';\n if (!query.measures!.includes(ref.measure)) query.measures!.push(ref.measure);\n }\n if (percentile !== undefined) {\n ref.percentile = percentile;\n if (!query.percentiles!.includes(percentile)) query.percentiles!.push(percentile);\n }\n if (field !== undefined) ref.field = field;\n if (groups !== undefined) ref.groups = groups;\n if (notGroups !== undefined) ref.notGroups = notGroups;\n return ref;\n }\n\n /** `value` with each read turned into a ref. */\n expr(value: ObservabilityValue, place: 'bucket' | 'range' | 'table', groupBy?: string[]): ValueExpr {\n const recurse = (v: ObservabilityValue) => this.expr(v, place, groupBy);\n if ('const' in value) return { const: value.const };\n if ('sum' in value) return { sum: value.sum.map(recurse) };\n if ('minus' in value) return { minus: [recurse(value.minus[0]), recurse(value.minus[1])] };\n if ('ratio' in value) return { ratio: { of: recurse(value.ratio.of), over: recurse(value.ratio.over) } };\n if ('max' in value) return { max: value.max.map(recurse) };\n if ('coalesce' in value) return { coalesce: value.coalesce.map(recurse) };\n return this.ref(value, place, groupBy);\n }\n\n /** The queries, a trace or span aggregate no value reads a measure of counting rows. */\n done(): DashboardQuery[] {\n for (const query of this.queries) {\n if ('measures' in query && query.measures?.length === 0) query.measures = ['count'];\n }\n return this.queries;\n }\n}\n\nconst WIDGET_KINDS = ['kpis', 'timeseries', 'table', 'scores'] as const;\ntype WidgetKind = (typeof WIDGET_KINDS)[number];\n\nconst COLUMN_TYPES = tableColumnOptionsSchema.options.map(option => option.shape.type.value);\ntype ColumnType = (typeof COLUMN_TYPES)[number];\n\ntype Draft = Record<string, unknown>;\ntype ViewBody = {\n label?: string;\n description?: string;\n tabs?: unknown;\n} & Draft;\n\nconst viewBase = ({ label, description }: ViewBody) => ({\n ...(label === undefined ? {} : { label }),\n ...(description === undefined ? {} : { description }),\n});\n\nconst toKpisView = (draft: ObservabilityKpisDraft): DashboardWidgetView => {\n const { label: _l, description: _d, tabs: _t, items, ...options } = draft as ViewBody & ObservabilityKpisDraft;\n const reads = new Reads();\n const converted = items.map(({ value, ...item }) => ({ ...item, value: reads.expr(value, 'range') }));\n return { ...viewBase(draft), queries: reads.done(), options: { ...options, items: converted } };\n};\n\nconst toTimeseriesView = (draft: ObservabilityTimeseriesDraft): DashboardWidgetView => {\n const {\n label: _l,\n description: _d,\n tabs: _t,\n series,\n total,\n emptyWhenZero,\n ...options\n } = draft as ViewBody & ObservabilityTimeseriesDraft;\n const reads = new Reads();\n const converted = series.map(({ value, rangeTotal, ...line }, i) => ({\n ...line,\n dataKey: `series${i + 1}`,\n value: reads.expr(value, 'bucket'),\n ...(rangeTotal === undefined ? {} : { rangeTotal: reads.expr(rangeTotal, 'range') }),\n }));\n const peaked = converted.find(line => line.emphasis) ?? converted[0]!;\n const totalValue =\n total === undefined\n ? undefined\n : total.value === 'total'\n ? 'total'\n : total.value === 'peak'\n ? { peak: peaked.dataKey }\n : reads.expr(total.value, 'range');\n return {\n ...viewBase(draft),\n queries: reads.done(),\n options: {\n ...options,\n series: converted,\n ...(total === undefined ? {} : { total: { ...total, value: totalValue } }),\n ...(emptyWhenZero === undefined ? {} : { emptyWhenZero: reads.expr(emptyWhenZero, 'range') }),\n ...(reads.wholeRange.length ? { totals: reads.wholeRange } : {}),\n },\n };\n};\n\nconst columnIds = (columns: ObservabilityColumnDraft[]) => columns.map((column, i) => column.id ?? `column${i + 1}`);\nconst columnType = (column: ObservabilityColumnDraft) => keysIn(column, COLUMN_TYPES)[0]!;\n\nconst toTableView = (draft: ObservabilityTableDraft): DashboardWidgetView => {\n const { label: _l, description: _d, tabs: _t, columns, ...options } = draft as ViewBody & ObservabilityTableDraft;\n const reads = new Reads();\n const ids = columnIds(columns);\n const converted = columns.map((column, i): DashboardColumn => {\n const type = columnType(column);\n const body = (column as Draft)[type] as Draft;\n let typed: Draft = body;\n if (type === 'value') {\n const entries = Object.entries(body);\n const isValueKey = ([key]: [string, unknown]) => TABLE_VALUE_KEYS.includes(key);\n typed = {\n ...Object.fromEntries(entries.filter(entry => !isValueKey(entry))),\n value: reads.expr(\n Object.fromEntries(entries.filter(isValueKey)) as ObservabilityValue,\n 'table',\n options.groupBy,\n ),\n };\n }\n return {\n id: ids[i]!,\n ...(column.label === undefined ? {} : { label: column.label }),\n options: { type, ...typed },\n };\n });\n const sorted = columns.findIndex(column => column.sort !== undefined);\n const values = columns.flatMap((column, i) => (columnType(column) === 'value' ? [i] : []));\n const sortBy =\n sorted >= 0 ? sorted : (values.find(i => ((columns[i] as Draft).value as Draft).emphasis) ?? values[0]!);\n return {\n ...viewBase(draft),\n queries: reads.done(),\n columns: converted,\n options: { ...options, defaultSort: { column: ids[sortBy]!, direction: columns[sorted]?.sort ?? 'desc' } },\n };\n};\n\nconst toScoresView = (draft: ObservabilityScoresDraft): DashboardWidgetView => {\n const {\n label: _l,\n description: _d,\n tabs: _t,\n scorerId,\n scoreSource,\n average,\n series,\n ...options\n } = draft as ViewBody & ObservabilityScoresDraft;\n const scorer = {\n ...(scorerId === undefined ? {} : { scorerId }),\n ...(scoreSource === undefined ? {} : { scoreSource }),\n };\n return {\n ...viewBase(draft),\n queries: [\n { id: 'average', source: 'scores', request: 'aggregate', ...scorer, ...average } as DashboardQuery,\n { id: 'series', source: 'scores', request: 'timeSeries', ...scorer, ...series } as DashboardQuery,\n ],\n options: { ...options, average: 'average', series: 'series' },\n };\n};\n\nconst TO_VIEW = {\n kpis: toKpisView,\n timeseries: toTimeseriesView,\n table: toTableView,\n scores: toScoresView,\n} as Record<WidgetKind, (draft: never) => DashboardWidgetView>;\n\nconst toWidget = (draft: ObservabilityWidgetDraft): DashboardWidget => {\n const { kpis, timeseries, table, scores, ...widget } = draft as Omit<ObservabilityWidgetDraft, WidgetKind> &\n Partial<Record<WidgetKind, ViewBody & { tabs?: ViewBody[] }>>;\n const kind = keysIn({ kpis, timeseries, table, scores }, WIDGET_KINDS)[0]!;\n const first = { kpis, timeseries, table, scores }[kind]!;\n const views = [first, ...(first.tabs ?? [])].map(view => TO_VIEW[kind](view as never));\n return { ...widget, id: widget.id ?? crypto.randomUUID(), span: widget.span ?? FULL_WIDTH, kind, views };\n};\n\n/** What the draft can say wrong that its schema can't: a table's sort and its `unpricedWhen` column. */\nconst tableDraftIssues = (draft: ObservabilityTableDraft, context: z.core.$RefinementCtx) => {\n const before = context.issues.length;\n const { columns } = draft;\n const ids = columnIds(columns);\n const valueIds = columns.flatMap((column, i) => (columnType(column) === 'value' ? [ids[i]!] : []));\n if (!valueIds.length) report(context, ['A table needs at least one `value` column'], ['columns']);\n const sorted = columns.flatMap((column, i) => (column.sort === undefined ? [] : [i]));\n if (sorted.length > 1) {\n report(\n context,\n ['At most one column sets `sort`; without one, the table sorts by its emphasized value column'],\n ['columns', sorted[1]!, 'sort'],\n );\n }\n const seen = new Set<string>();\n ids.forEach((id, i) => {\n if (seen.has(id)) report(context, [`Duplicate column id '${id}'`], ['columns', i, 'id']);\n seen.add(id);\n });\n columns.forEach((column, i) => {\n const unpricedWhen = ((column as Draft).value as Draft | undefined)?.unpricedWhen as string | undefined;\n if (unpricedWhen === undefined || (valueIds.includes(unpricedWhen) && unpricedWhen !== ids[i])) return;\n report(\n context,\n [\n `unpricedWhen names column '${unpricedWhen}', which is not another value column; value column ids are ${keysList(valueIds.filter(id => id !== ids[i]))}`,\n ],\n ['columns', i, 'value', 'unpricedWhen'],\n );\n });\n return context.issues.length === before;\n};\n\nconst FULL_WIDTH = 12;\nconst SPAN_DESCRIPTION =\n 'Columns of a 12-column row, one of 1, 2, 3, 4, 6 or 12: 12 is the full width, 6 half, 4 a third, 3 a quarter. Left out, the full width.';\n\n/**\n * What the renderer rejects across a widget's views, such as two tabs with one label, reported at\n * the view in the draft. Checked once the draft's own fields pass, on the widget they convert to.\n */\nconst widgetDraftIssues = (draft: ObservabilityWidgetDraft, context: z.core.$RefinementCtx) => {\n if (context.issues.length) return;\n const widget = toWidget(draft);\n for (const { path, message } of widgetIssues(widget)) {\n const [, view, ...rest] = path[0] === 'views' ? path : [undefined, undefined, ...path];\n const at = view === undefined ? [] : view === 0 ? [widget.kind] : [widget.kind, 'tabs', (view as number) - 1];\n context.addIssue({ code: 'custom', path: at, message: rest.length ? `${rest.join('.')}: ${message}` : message });\n }\n};\n\n/** Which choices the draft schemas offer. */\nexport type ObservabilityDraftOptions = {\n /** The widget kinds a draft can be; left out, every built-in kind. Others are left out of the schema. */\n kinds?: readonly DashboardBuiltInWidgetKind[];\n /** Whether a dashboard can set `defaults.filters`. Defaults to `true`; with `false`, `defaults` takes only `datePreset`. */\n dashboardFilters?: boolean;\n};\n\n/** The schemas a model writes a widget or a whole dashboard with, built from one catalog. */\nexport type ObservabilityDraftSchemas = {\n widget: z.ZodType<ObservabilityWidgetDraft>;\n dashboard: z.ZodType<ObservabilityDashboardDraft>;\n};\n\n/**\n * The schemas a model writes a widget (`widget`) or a dashboard (`dashboard`) with, metric names\n * limited to `catalog.metricNames` as `createObservabilityDashboardInputSchema` limits them, and\n * only the choices `options` allows: a kind or `defaults.filters` left out is missing from their\n * JSON schema too. Both share their named parts, so build them once per catalog and use both from\n * the result, for example as the input of a tool that saves a widget and one that saves a dashboard.\n * Convert a draft with `toObservabilityWidget` or `toObservabilityDashboard`.\n */\nexport function createObservabilityDraftSchemas(\n catalog: ObservabilityCatalog = {},\n options: ObservabilityDraftOptions = {},\n): ObservabilityDraftSchemas {\n const kinds = options.kinds ? WIDGET_KINDS.filter(kind => options.kinds!.includes(kind)) : WIDGET_KINDS;\n if (!kinds.length) throw new Error('`kinds` must name at least one widget kind');\n const metricNames = [...new Set(catalog.metricNames)].sort();\n const listed = metricNames.length > 0 && metricNames.length <= OBSERVABILITY_CATALOG_MAX_METRIC_NAMES;\n const reads = readSchemas(listed ? (metricNames as [string, ...string[]]) : undefined);\n\n const chartValue = valueSchema(reads, CHART_READS, 'MastraChartValue', \"A series' number per bucket of the chart.\");\n const rangeValue = valueSchema(reads, RANGE_READS, 'MastraRangeValue', 'A number over the whole range.');\n const tableValue = valueSchema(\n reads,\n TABLE_READS,\n 'MastraTableValue',\n \"A row's number: its reads are grouped by the table's `groupBy` unless they set their own.\",\n );\n // A value column's own key is its number; what's nested in an operator is a plain value.\n const tableCases = valueCases(reads, TABLE_READS, tableValue);\n const kpiValue = valueSchema(\n reads,\n KPI_READS,\n 'MastraKpiValue',\n 'A KPI figure: one aggregate or the sum of several.',\n true,\n );\n\n const { label, description } = dashboardWidgetViewSchema.shape;\n const viewOf = <T extends Draft>(\n kind: WidgetKind,\n shape: z.ZodRawShape,\n draftIssues: (draft: T, context: z.core.$RefinementCtx) => boolean,\n kindIssues: (view: DashboardWidgetView) => string[],\n ) =>\n z.strictObject({ label, description, ...shape }).superRefine((draft, context) => {\n if (!draftIssues(draft as unknown as T, context)) return;\n const view = TO_VIEW[kind](draft as never);\n if (view.queries.length > DASHBOARD_MAX_QUERIES_PER_VIEW) {\n return report(context, [\n `This view sends ${view.queries.length} requests, past the ${DASHBOARD_MAX_QUERIES_PER_VIEW} a view can send. Reads that differ only in ${keysList(PICKS)} share one.`,\n ]);\n }\n // What the stored view checks across fields, and what its renderer checks: a safety net.\n const checked = dashboardWidgetViewSchema.safeParse(view);\n if (!checked.success)\n return report(\n context,\n checked.error.issues.map(issue => issue.message),\n );\n report(context, [...new Set(kindIssues(view))]);\n });\n\n const kpiItem = kpisOptionsSchema.shape.items.element as z.ZodObject;\n const kpis = viewOf<ObservabilityKpisDraft>(\n 'kpis',\n {\n items: z\n .array(z.strictObject({ ...fieldsOf(kpiItem, ['value']), value: kpiValue }))\n .min(1)\n .describe('One figure each, compared with the window before when its reads set `compare`.'),\n },\n () => true,\n view => kpisIssues(view as never),\n );\n\n const { total: storedTotal } = timeseriesOptionsSchema.shape;\n const timeseries = viewOf<ObservabilityTimeseriesDraft>(\n 'timeseries',\n {\n ...fieldsOf(timeseriesOptionsSchema, ['series', 'totals', 'total', 'emptyWhenZero']),\n series: z\n .array(\n z.strictObject({\n ...fieldsOf(timeseriesSeriesSchema, ['dataKey', 'value', 'rangeTotal']),\n value: chartValue,\n rangeTotal: rangeValue\n .optional()\n .describe(\"The series' number over the whole range, shown beside the card's title.\"),\n }),\n )\n .min(1),\n total: z\n .strictObject({\n value: z\n .union([z.enum(['total', 'peak']), rangeValue])\n .describe(\n '`total`: every series summed over the range; `peak`: the highest bucket of the emphasized series (the first, when none is); or a number over the range.',\n ),\n format: (storedTotal.unwrap() as z.ZodObject).shape.format as z.ZodType,\n })\n .optional()\n .describe(\"The card's total, beside its title. Ignored when a series has a `rangeTotal`.\"),\n emptyWhenZero: rangeValue\n .optional()\n .describe('Empty when this is zero over the range; by default, when every plotted value is zero.'),\n },\n () => true,\n view => timeseriesIssues(view.options as never, view.queries as never),\n );\n\n const columnOptions = Object.fromEntries(\n tableColumnOptionsSchema.options.map(option => [option.shape.type.value, option as z.ZodObject]),\n ) as Record<ColumnType, z.ZodObject>;\n const column = oneKeyOf<ObservabilityColumnDraft>(\n COLUMN_TYPES,\n 'A column',\n z.strictObject({\n id: z.string().min(1).optional().describe(\"Needed only for another column's `unpricedWhen` to name it.\"),\n label: z.string().optional(),\n sort: z\n .enum(['asc', 'desc'])\n .optional()\n .describe('Sorts the table by this column. Without one, it sorts by its emphasized value column, descending.'),\n name: z.strictObject(fieldsOf(columnOptions.name, ['type'])).optional(),\n dimension: z.strictObject(fieldsOf(columnOptions.dimension, ['type', 'query', 'joinOn'])).optional(),\n value: oneKeyOf<Draft>(\n tableCases.keys,\n 'A value column',\n z.strictObject({\n ...fieldsOf(columnOptions.value, ['type', 'value']),\n unpricedWhen: (columnOptions.value.shape.unpricedWhen as z.ZodType).describe(\n '`usd` only: the `id` of the column whose value above 0 makes a missing price read \"Not priced\".',\n ),\n ...tableCases.shape,\n }),\n )\n .optional()\n .describe(\n `The column's options beside the row's number, written as one key: ${tableCases.summary} Its reads are grouped by the table's \\`groupBy\\` unless they set their own.`,\n ),\n change: z\n .strictObject(fieldsOf(columnOptions.change, ['type']))\n .optional()\n .describe(\"The emphasized value's % change against the window before; its reads set `compare`.\"),\n }),\n ).describe(`Exactly one of ${keysList(COLUMN_TYPES)} names the column's type and holds its options.`);\n const table = viewOf<ObservabilityTableDraft>(\n 'table',\n { ...fieldsOf(tableOptionsSchema, ['defaultSort', 'rowDrilldown']), columns: z.array(column).min(1) },\n tableDraftIssues,\n view => tableIssues(view.columns as never, view.options as never, view.queries as never),\n );\n\n const [scoreAggregate, , scoreTimeSeries] = dashboardQuerySchema.out.options[3].options;\n const { scorerId, scoreSource } = scoreAggregate.shape;\n const scoreFilters = namedFilters(scoreAggregate, 'MastraScoreFilters');\n const scores = viewOf<ObservabilityScoresDraft>(\n 'scores',\n {\n ...fieldsOf(scoresOptionsSchema, ['average', 'series']),\n scorerId,\n scoreSource,\n average: z\n .strictObject({\n ...fieldsOf(scoreAggregate, ['source', 'request', 'id', 'interval', 'scorerId', 'scoreSource']),\n ...scoreFilters,\n })\n .describe(\"Each scorer's mean over the range.\"),\n series: z\n .strictObject({\n ...fieldsOf(scoreTimeSeries, ['source', 'request', 'id', 'interval', 'scorerId', 'scoreSource']),\n ...scoreFilters,\n })\n .describe(\"Each scorer's line over time.\"),\n },\n () => true,\n view => scoresIssues(view as never),\n );\n\n const views = { kpis, timeseries, table, scores } satisfies Record<WidgetKind, z.ZodObject>;\n const { span, title, description: widgetDescription } = dashboardWidgetSchema.shape;\n const widget = oneKeyOf<ObservabilityWidgetDraft>(\n kinds,\n 'A widget',\n z\n .strictObject({\n id: dashboardWidgetSchema.shape.id.optional().describe('Left out, the server assigns one.'),\n span: (span as z.ZodType).optional().describe(SPAN_DESCRIPTION),\n title,\n description: widgetDescription,\n ...Object.fromEntries(\n kinds.map(kind => [\n kind,\n views[kind]\n .safeExtend({\n tabs: z\n .array(views[kind])\n .optional()\n .describe('Further views of this kind, drawn as tabs after this one. Leave out for one view.'),\n })\n .optional(),\n ]),\n ),\n })\n .superRefine((draft, context) => widgetDraftIssues(draft as ObservabilityWidgetDraft, context)),\n ).describe(`Exactly one of ${keysList(kinds)} names the widget's kind and holds its view.`);\n\n const { datePreset } = dashboardDefaultsSchema.shape;\n const defaults = options.dashboardFilters === false ? z.strictObject({ datePreset }) : dashboardDefaultsSchema;\n const dashboard = z\n .strictObject({\n schemaVersion: z.literal(DASHBOARD_SCHEMA_VERSION).optional(),\n defaults: defaults.optional(),\n rows: z.array(z.strictObject({ widgets: z.array(widget).min(1) })).min(1),\n })\n .superRefine((dashboard, context) => {\n const widgets = dashboard.rows.flatMap(row => row.widgets);\n if (widgets.length > DASHBOARD_MAX_WIDGETS) {\n context.addIssue({ code: 'custom', path: ['rows'], message: `At most ${DASHBOARD_MAX_WIDGETS} widgets` });\n }\n const seen = new Set<string>();\n for (const { id } of widgets) {\n if (id === undefined) continue;\n if (seen.has(id)) context.addIssue({ code: 'custom', path: ['rows'], message: `Duplicate widget id '${id}'` });\n seen.add(id);\n }\n }) as z.ZodType<ObservabilityDashboardDraft>;\n return { widget, dashboard };\n}\n\n// Written out rather than inferred from the schemas: inferred, the published declarations would\n// spell out every read and option type once per use.\n\n/** One object per case, holding only that case's key. */\ntype OneKeyOf<T> = { [K in keyof T]: { [P in K]: T[P] } }[keyof T];\n\ntype Args<Q, Omitted extends PropertyKey = never> = Omit<Q, 'source' | 'request' | 'id' | 'interval' | Omitted>;\ntype MetricQuery<R> = Extract<DashboardQuery, { source: 'metrics'; request: R }>;\ntype ScoreQuery<R> = Extract<DashboardQuery, { source: 'scores'; request: R }>;\ntype TraceQuery = Extract<DashboardQuery, { source: 'traceAggregate' }>;\ntype SpanQuery = Extract<DashboardQuery, { source: 'spanAggregate' }>;\ntype Field = { field?: 'value' | 'estimatedCost' };\ntype Groups = { groups?: string[]; notGroups?: string[] };\ntype TraceArgs<Q extends { measures: unknown[] }> = Args<Q, 'measures' | 'having' | 'orderBy'> & {\n measure?: Q['measures'][number];\n} & Groups;\n\n/** Each read's arguments, with what picks the number out of its answer. */\nexport type ObservabilityReads = {\n traceAggregate: TraceArgs<TraceQuery>;\n spanAggregate: TraceArgs<SpanQuery>;\n metricAggregate: Args<MetricQuery<'aggregate'>> & Field;\n metricBreakdown: Args<MetricQuery<'breakdown'>, 'groupBy'> & { groupBy?: string[] } & Field;\n metricTimeSeries: Args<MetricQuery<'timeSeries'>> & Field & Groups;\n metricPercentiles: Args<MetricQuery<'percentiles'>, 'percentiles'> & { percentile: number };\n};\n\n/** One read, named by its key, e.g. `{ metricAggregate: { name: [...], aggregation: 'count' } }`. */\nexport type ObservabilityRead = OneKeyOf<ObservabilityReads>;\n\n/** A number a view shows: a read, or an operator over values. */\nexport type ObservabilityValue =\n | ObservabilityRead\n | { const: number }\n | { sum: ObservabilityValue[] }\n | { minus: [ObservabilityValue, ObservabilityValue] }\n | { ratio: { of: ObservabilityValue; over: ObservabilityValue } }\n | { max: ObservabilityValue[] }\n | { coalesce: ObservabilityValue[] };\n\ntype ViewDraft = { label?: string; description?: string } & Draft;\n\nexport type ObservabilityKpisDraft = ViewDraft & { items: (Draft & { value: ObservabilityValue })[] };\n\nexport type ObservabilityTimeseriesDraft = ViewDraft & {\n series: (Draft & { value: ObservabilityValue; rangeTotal?: ObservabilityValue; emphasis?: boolean })[];\n total?: { value: 'total' | 'peak' | ObservabilityValue; format?: string };\n emptyWhenZero?: ObservabilityValue;\n};\n\n/**\n * A table column, its type named by the key holding its options. A value column's options sit\n * beside its number, e.g. `{ value: { format: 'count', traceAggregate: { measure: 'count' } } }`.\n */\nexport type ObservabilityColumnDraft = { id?: string; label?: string; sort?: 'asc' | 'desc' } & OneKeyOf<{\n name: Draft;\n dimension: Draft & { dimension: string };\n value: Draft & ObservabilityValue & { unpricedWhen?: string };\n change: Draft;\n}>;\n\nexport type ObservabilityTableDraft = ViewDraft & { groupBy: string[]; columns: ObservabilityColumnDraft[] };\n\nexport type ObservabilityScoresDraft = ViewDraft &\n Pick<ScoreQuery<'aggregate'>, 'scorerId' | 'scoreSource'> & {\n average: Args<ScoreQuery<'aggregate'>, 'scorerId' | 'scoreSource'>;\n series: Args<ScoreQuery<'timeSeries'>, 'scorerId' | 'scoreSource'>;\n };\n\ntype WithTabs<V> = V & { tabs?: V[] };\n\n/**\n * A dashboard widget as the model writes it: its kind is the key holding its view, e.g.\n * `{ span: 6, timeseries: { chart, format, series } }`. Left out, the server assigns the `id` and the\n * widget spans the full row.\n */\nexport type ObservabilityWidgetDraft = Omit<\n DashboardWidget,\n 'id' | 'span' | 'kind' | 'views' | 'scope' | 'drilldown'\n> & {\n id?: string;\n span?: DashboardWidget['span'];\n} & OneKeyOf<{\n kpis: WithTabs<ObservabilityKpisDraft>;\n timeseries: WithTabs<ObservabilityTimeseriesDraft>;\n table: WithTabs<ObservabilityTableDraft>;\n scores: WithTabs<ObservabilityScoresDraft>;\n }>;\n\n/** A dashboard definition as the model writes it. */\nexport type ObservabilityDashboardDraft = {\n schemaVersion?: typeof DASHBOARD_SCHEMA_VERSION;\n defaults?: DashboardDefaults;\n rows: { widgets: ObservabilityWidgetDraft[] }[];\n};\n\n/** The opening tool's input: the dashboard to draw and the window to draw it over. */\nexport type ObservabilityDashboardInput = {\n dashboard: ObservabilityDashboardDraft;\n /** Left out, the dashboard's `defaults.datePreset` when it is one of these, else `24h`. */\n datePreset?: ObservabilityDatePreset;\n};\n\n/**\n * The input schema of one widget, as written in a dashboard's `rows[].widgets[]`, for a tool that\n * adds a single widget. Metric names are limited to `catalog.metricNames` as in\n * `createObservabilityDashboardInputSchema`. Build it again when the catalog changes: the schema is a\n * snapshot.\n */\nexport function createObservabilityWidgetInputSchema(\n catalog: ObservabilityCatalog = {},\n): z.ZodType<ObservabilityWidgetDraft> {\n return createObservabilityDraftSchemas(catalog).widget;\n}\n\nconst dashboardInputSchemaOf = (dashboard: ObservabilityDraftSchemas['dashboard']) =>\n z.object({\n dashboard,\n datePreset: z\n .enum(OBSERVABILITY_DATE_PRESETS)\n .optional()\n .describe(\n \"The range drawn. Left out, the dashboard's `defaults.datePreset` when it is one of these, else `24h`.\",\n ),\n }) as z.ZodType<ObservabilityDashboardInput>;\n\n/**\n * The opening tool's input schema, with metric names limited to `catalog.metricNames`, so the\n * model can only name metrics that have data. With no names, or more than\n * `OBSERVABILITY_CATALOG_MAX_METRIC_NAMES`, metric names stay free strings. Build it again when the\n * catalog changes: the schema is a snapshot.\n */\nexport function createObservabilityDashboardInputSchema(\n catalog: ObservabilityCatalog = {},\n): z.ZodType<ObservabilityDashboardInput> {\n return dashboardInputSchemaOf(createObservabilityDraftSchemas(catalog).dashboard);\n}\n\nconst draftSchemas = createObservabilityDraftSchemas();\n\n/** One widget's input schema, with free metric names; `createObservabilityWidgetInputSchema` lists the project's. */\nexport const observabilityWidgetInputSchema = draftSchemas.widget;\n\n/**\n * The opening tool's input schema. It spells out each built-in kind's options and checks them as\n * the widget's renderer does, so a model writing the dashboard sees them and gets actionable errors.\n * Metric names are free strings; `createObservabilityDashboardInputSchema` lists the project's.\n */\nexport const observabilityDashboardInputSchema = dashboardInputSchemaOf(draftSchemas.dashboard);\n\n/** The opening tool's output schema, which the app reads as `structuredContent`. */\nexport const observabilityDashboardOutputSchema: z.ZodType<ObservabilityDashboardOpened> = z.object({\n dashboard: dashboardDefinitionSchema,\n datePreset: z.enum(OBSERVABILITY_DATE_PRESETS).optional(),\n});\n\nexport type ObservabilityDashboardOpened = { dashboard: DashboardDefinition; datePreset?: ObservabilityDatePreset };\n\n/**\n * The stored definition for `input`: each value's reads gathered into the view's queries, and every\n * widget without an id given a fresh UUID, so the host can pin each widget by an id that stays the\n * same whenever the result is shown. Throws when `input` doesn't pass\n * `observabilityDashboardInputSchema`, or the definition doesn't validate (e.g. over the size limit).\n * Like `toObservabilityWidget`, it checks against the default schemas, not a catalog or options.\n */\nexport function toObservabilityDashboard(input: ObservabilityDashboardInput): ObservabilityDashboardOpened {\n const checked = observabilityDashboardInputSchema.safeParse(input);\n if (!checked.success) throw new Error(`The dashboard is invalid: ${z.prettifyError(checked.error)}`);\n // Converted as given, so a draft passed as written gets no defaults written in. A tool's `execute` gets\n // the parsed draft, with core's read defaults (e.g. a trace read's `groupBy: []`) already filled; core\n // fills the same ones on read, so the stored widget means the same either way.\n const { dashboard, datePreset } = input;\n const definition: DashboardDefinition = {\n ...dashboard,\n schemaVersion: DASHBOARD_SCHEMA_VERSION,\n rows: dashboard.rows.map(row => ({ widgets: row.widgets.map(toWidget) })),\n };\n const parsed = dashboardDefinitionSchema.safeParse(definition);\n if (!parsed.success) throw new Error(`The dashboard is invalid: ${z.prettifyError(parsed.error)}`);\n return { dashboard: definition, ...(datePreset ? { datePreset } : {}) };\n}\n\n/**\n * The stored widget for `draft`, converted as in `toObservabilityDashboard`: its reads gathered into\n * each view's queries, its `id` kept or a fresh UUID when it has none, and the full width when it has\n * no span. Throws when `draft` doesn't pass `observabilityWidgetInputSchema`; the error's `cause` is\n * the `ZodError`, whose issue paths point into the draft (e.g. `timeseries.series.1.value`). The\n * converted widget is checked against core's schema too, as a backstop the draft's checks should\n * make unreachable; that error's `cause` has paths into the stored widget. It checks against the default schemas, so it allows every kind and\n * metric name: a tool whose input schema came from `createObservabilityDraftSchemas` with a catalog\n * or `kinds` has already applied them, but elsewhere check `draft` against your own schemas first.\n * Check the widget's place in a dashboard (unique ids, the widget count) with the whole definition.\n */\nexport function toObservabilityWidget(draft: ObservabilityWidgetDraft): DashboardWidget {\n const checked = observabilityWidgetInputSchema.safeParse(draft);\n if (!checked.success) {\n throw new Error(`The widget is invalid: ${z.prettifyError(checked.error)}`, { cause: checked.error });\n }\n // Converted as given, so a draft passed as written gets no defaults written in. A tool's `execute` gets\n // the parsed draft, with core's read defaults (e.g. a trace read's `groupBy: []`) already filled; core\n // fills the same ones on read, so the stored widget means the same either way.\n const widget = toWidget(draft);\n const parsed = dashboardWidgetSchema.safeParse(widget);\n if (!parsed.success) {\n throw new Error(`The widget is invalid: ${z.prettifyError(parsed.error)}`, { cause: parsed.error });\n }\n return widget;\n}\n"],"mappings":";;;;;;;;;AAOA,IAAI,iBAAiBA,OAAAA,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;;AAErC,IAAI,iBAAiBA,OAAAA,EAAE,OAAO;;CAE7B,OAAO;;CAEP,OAAOA,OAAAA,EAAE,KAAK,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,SAAS;;CAEnD,SAASA,OAAAA,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;;CAEpC,YAAYA,OAAAA,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;;CAE9C,QAAQA,OAAAA,EAAE,MAAMA,OAAAA,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;;CAE5C,WAAWA,OAAAA,EAAE,MAAMA,OAAAA,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAA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