@lightdash/common 3.116.0 → 3.118.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.
Files changed (34) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  3. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  4. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.js +87 -5
  5. package/dist/cjs/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  6. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  7. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  8. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +89 -13
  9. package/dist/cjs/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  10. package/dist/cjs/schemas/chartAsCodeSchema.d.ts +35 -35
  11. package/dist/cjs/schemas/json/mcp-tools-1.0.json +146 -6
  12. package/dist/esm/.tsbuildinfo +1 -1
  13. package/dist/esm/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  14. package/dist/esm/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  15. package/dist/esm/ee/AiAgent/composerSemanticArtifact.js +88 -6
  16. package/dist/esm/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  17. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  18. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  19. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +90 -14
  20. package/dist/esm/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  21. package/dist/esm/schemas/chartAsCodeSchema.d.ts +35 -35
  22. package/dist/esm/schemas/json/mcp-tools-1.0.json +146 -6
  23. package/dist/types/.tsbuildinfo +1 -1
  24. package/dist/types/ee/AiAgent/composerSemanticArtifact.d.ts +4 -1
  25. package/dist/types/ee/AiAgent/composerSemanticArtifact.d.ts.map +1 -1
  26. package/dist/types/ee/AiAgent/composerSemanticArtifact.js +88 -6
  27. package/dist/types/ee/AiAgent/composerSemanticArtifact.js.map +1 -1
  28. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts +117 -5
  29. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.d.ts.map +1 -1
  30. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js +90 -14
  31. package/dist/types/ee/AiAgent/schemas/tools/toolComposerQueryArgs.js.map +1 -1
  32. package/dist/types/schemas/chartAsCodeSchema.d.ts +35 -35
  33. package/dist/types/schemas/json/mcp-tools-1.0.json +146 -6
  34. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { type Explore } from '../../types/explore';
1
2
  import { type SemanticLayerSourceQuery } from '../../types/querySources';
2
3
  import type { AiCustomChartTypeChartArtifactConfig, AiSemanticChartArtifactConfig } from './index';
3
4
  import { type ComposerStoredChartVizConfig } from './schemas';
@@ -13,12 +14,14 @@ export type AiComposerSemanticArtifactVersion = {
13
14
  * keeps the classic interactions. Null when the classic payload cannot carry
14
15
  * the node or its viz config.
15
16
  */
16
- export declare const toComposerSemanticArtifactVersion: ({ title, description, node, vizConfig, maxQueryLimit, }: {
17
+ export declare const toComposerSemanticArtifactVersion: ({ title, description, node, vizConfig, maxQueryLimit, explore, }: {
17
18
  title: string;
18
19
  description: string | null;
19
20
  node: SemanticLayerSourceQuery;
20
21
  vizConfig: ComposerStoredChartVizConfig;
21
22
  /** The classic artifact clamps its limit to this. */
22
23
  maxQueryLimit: number;
24
+ /** Types custom metric filters; null when the explore is unavailable. */
25
+ explore: Explore | null;
23
26
  }) => AiComposerSemanticArtifactVersion | null;
24
27
  //# sourceMappingURL=composerSemanticArtifact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"composerSemanticArtifact.d.ts","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EACR,oCAAoC,EACpC,6BAA6B,EAChC,MAAM,SAAS,CAAC;AACjB,OAAO,EAGH,KAAK,4BAA4B,EAGpC,MAAM,WAAW,CAAC;AAEnB,wEAAwE;AACxE,MAAM,MAAM,iCAAiC,GAAG;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EACH,6BAA6B,GAC7B,oCAAoC,CAAC;CAC9C,CAAC;AAkIF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,4DAM3C;IACC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,EAAE,4BAA4B,CAAC;IACxC,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;CACzB,KAAG,iCAAiC,GAAG,IAiDvC,CAAC"}
1
+ {"version":3,"file":"composerSemanticArtifact.d.ts","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAcnD,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAKzE,OAAO,KAAK,EACR,oCAAoC,EACpC,6BAA6B,EAChC,MAAM,SAAS,CAAC;AACjB,OAAO,EAGH,KAAK,4BAA4B,EAGpC,MAAM,WAAW,CAAC;AAEnB,wEAAwE;AACxE,MAAM,MAAM,iCAAiC,GAAG;IAC5C,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EACH,6BAA6B,GAC7B,oCAAoC,CAAC;CAC9C,CAAC;AAkNF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,qEAO3C;IACC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,EAAE,4BAA4B,CAAC;IACxC,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3B,KAAG,iCAAiC,GAAG,IAiEvC,CAAC"}
@@ -4,7 +4,11 @@ exports.toComposerSemanticArtifactVersion = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const field_1 = require("../../types/field");
6
6
  const filter_1 = require("../../types/filter");
7
+ const metricQuery_1 = require("../../types/metricQuery");
7
8
  const assertUnreachable_1 = tslib_1.__importDefault(require("../../utils/assertUnreachable"));
9
+ const fields_1 = require("../../utils/fields");
10
+ const filters_1 = require("../../utils/filters");
11
+ const item_1 = require("../../utils/item");
8
12
  const schemas_1 = require("./schemas");
9
13
  // Persisted rules require a fieldType, which parsing validates and then drops.
10
14
  const fieldTypeOf = (filterType) => {
@@ -112,9 +116,78 @@ const toRunQueryChartConfig = (vizConfig) => {
112
116
  secondaryYAxisLabel: labels?.y2 ?? null,
113
117
  };
114
118
  };
119
+ const runQueryAggregations = [
120
+ field_1.MetricType.AVERAGE,
121
+ field_1.MetricType.COUNT,
122
+ field_1.MetricType.COUNT_DISTINCT,
123
+ field_1.MetricType.MAX,
124
+ field_1.MetricType.MIN,
125
+ field_1.MetricType.SUM,
126
+ field_1.MetricType.MEDIAN,
127
+ ];
128
+ /** A metric filter as runQuery persists it; undefined when its field is unknown. */
129
+ const toRunQueryMetricFilter = (rule, explore) => {
130
+ const dimension = (0, fields_1.getDimensions)(explore).find((field) => `${field.table}.${field.name}` === rule.target.fieldRef);
131
+ if (!dimension)
132
+ return undefined;
133
+ const fieldFilterType = (0, filters_1.getFilterTypeFromItemType)(dimension.type);
134
+ const settings = rule.settings;
135
+ const hasValues = rule.operator !== filter_1.FilterOperator.NULL &&
136
+ rule.operator !== filter_1.FilterOperator.NOT_NULL;
137
+ return {
138
+ table: dimension.table,
139
+ filter: {
140
+ fieldId: (0, item_1.getItemId)(dimension),
141
+ fieldType: dimension.type,
142
+ fieldFilterType,
143
+ operator: rule.operator,
144
+ ...(hasValues ? { values: rule.values ?? [] } : {}),
145
+ ...(settings !== undefined ? { settings } : {}),
146
+ },
147
+ };
148
+ };
149
+ /** runQuery's custom metrics for a node's additional metrics; undefined when one cannot be carried. */
150
+ const toRunQueryCustomMetrics = (additionalMetrics, explore) => {
151
+ const customMetrics = additionalMetrics.map((metric) => {
152
+ if ((0, metricQuery_1.isPeriodOverPeriodAdditionalMetric)(metric)) {
153
+ // runQuery's comparison builder drops distinct keys and percentiles.
154
+ if (metric.distinctKeys?.length || metric.percentile !== undefined)
155
+ return undefined;
156
+ return {
157
+ kind: 'periodComparison',
158
+ baseMetricId: metric.baseMetricId,
159
+ timeDimensionId: metric.timeDimensionId,
160
+ granularity: metric.granularity,
161
+ periodOffset: metric.periodOffset,
162
+ };
163
+ }
164
+ if (!metric.baseDimensionName ||
165
+ !runQueryAggregations.includes(metric.type)) {
166
+ return undefined;
167
+ }
168
+ const filters = (metric.filters ?? []).map((rule) => explore ? toRunQueryMetricFilter(rule, explore) : undefined);
169
+ if (filters.some((filter) => filter === undefined))
170
+ return undefined;
171
+ return {
172
+ kind: 'aggregation',
173
+ name: metric.name,
174
+ label: metric.label ?? metric.name,
175
+ description: metric.description ?? '',
176
+ baseDimensionName: (0, item_1.getItemId)({
177
+ table: metric.table,
178
+ name: metric.baseDimensionName,
179
+ }),
180
+ table: metric.table,
181
+ type: metric.type,
182
+ filters: filters.length > 0 ? filters : null,
183
+ };
184
+ });
185
+ return customMetrics.every((metric) => metric !== undefined)
186
+ ? customMetrics
187
+ : undefined;
188
+ };
115
189
  // Fields the runQuery payload has no place for.
116
190
  const hasClassicQueryShape = (node) => !node.tableCalculations?.length &&
117
- !node.additionalMetrics?.length &&
118
191
  !node.customDimensions?.length &&
119
192
  !node.metricOverrides &&
120
193
  !node.dimensionOverrides &&
@@ -125,27 +198,36 @@ const hasClassicQueryShape = (node) => !node.tableCalculations?.length &&
125
198
  * keeps the classic interactions. Null when the classic payload cannot carry
126
199
  * the node or its viz config.
127
200
  */
128
- const toComposerSemanticArtifactVersion = ({ title, description, node, vizConfig, maxQueryLimit, }) => {
201
+ const toComposerSemanticArtifactVersion = ({ title, description, node, vizConfig, maxQueryLimit, explore, }) => {
129
202
  if (!hasClassicQueryShape(node))
130
203
  return null;
131
204
  if (node.limit !== undefined && node.limit > maxQueryLimit)
132
205
  return null;
133
206
  const filters = toResolvedFilters(node.filters);
134
207
  const chartConfig = toRunQueryChartConfig(vizConfig);
135
- if (filters === undefined || chartConfig === undefined)
208
+ const additionalMetrics = node.additionalMetrics ?? [];
209
+ const customMetrics = toRunQueryCustomMetrics(additionalMetrics, explore);
210
+ if (filters === undefined ||
211
+ chartConfig === undefined ||
212
+ customMetrics === undefined) {
136
213
  return null;
214
+ }
215
+ // runQuery derives period comparison columns from customMetrics itself.
216
+ const generatedMetricIds = new Set(additionalMetrics
217
+ .filter(metricQuery_1.isPeriodOverPeriodAdditionalMetric)
218
+ .map(item_1.getItemId));
137
219
  const parsed = schemas_1.toolRunQueryExpressionResolvedArgsSchema.safeParse({
138
220
  title,
139
221
  description: description ?? '',
140
222
  queryConfig: {
141
223
  exploreName: node.exploreName,
142
224
  dimensions: node.dimensions,
143
- metrics: node.metrics,
225
+ metrics: node.metrics.filter((metricId) => !generatedMetricIds.has(metricId)),
144
226
  filters,
145
227
  sorts: node.sorts ?? [],
146
228
  limit: node.limit ?? null,
147
229
  parameters: node.parameters ?? null,
148
- customMetrics: null,
230
+ customMetrics: customMetrics.length > 0 ? customMetrics : null,
149
231
  tableCalculations: null,
150
232
  },
151
233
  chartConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"composerSemanticArtifact.js","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":";;;;AAAA,6CAAkD;AAClD,+CAM4B;AAE5B,8FAA8D;AAK9D,uCAMmB;AAYnB,+EAA+E;AAC/E,MAAM,WAAW,GAAG,CAAC,UAAsB,EAAiB,EAAE;IAC1D,QAAQ,UAAU,EAAE,CAAC;QACjB,KAAK,mBAAU,CAAC,MAAM;YAClB,OAAO,qBAAa,CAAC,MAAM,CAAC;QAChC,KAAK,mBAAU,CAAC,MAAM;YAClB,OAAO,qBAAa,CAAC,MAAM,CAAC;QAChC,KAAK,mBAAU,CAAC,IAAI;YAChB,OAAO,qBAAa,CAAC,IAAI,CAAC;QAC9B,KAAK,mBAAU,CAAC,OAAO;YACnB,OAAO,qBAAa,CAAC,OAAO,CAAC;QACjC;YACI,OAAO,IAAA,2BAAiB,EAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;IACpE,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE,CACzD,MAAM,CAAC,MAAM,CAAU,mBAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEvD,0FAA0F;AAC1F,MAAM,qBAAqB,GAAG,CAAC,KAA8B,EAAE,EAAE;IAC7D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GACpB,KAAK,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,GA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AC9B,KAAK;QACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;IACF,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACH,GAAG,OAAO;YACV,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;SACzD,CAAC;IACN,CAAC;IACD,OAAO;QACH,GAAG,OAAO;QACV,SAAS,EAAE;YACP,MAAM,EAAE,iBAAiB;YACzB,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,SAAS,CAAC,cAAc;YACxC,GAAG,CAAC,SAAS,CAAC,iBAAiB,KAAK,IAAI;gBACpC,CAAC,CAAC,EAAE,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAAE;gBACpD,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,EAAE,MAAM,CAAC,IAAI;SACtB;KACJ,CAAC;AACN,CAAC,CAAC;AA9DW,QAAA,iCAAiC,GAAjC,iCAAiC,CA8D5C"}
1
+ {"version":3,"file":"composerSemanticArtifact.js","sourceRoot":"","sources":["../../../../src/ee/AiAgent/composerSemanticArtifact.ts"],"names":[],"mappings":";;;;AACA,6CAA8D;AAC9D,+CAO4B;AAC5B,yDAGiC;AAEjC,8FAA8D;AAC9D,+CAAmD;AACnD,iDAAgE;AAChE,2CAA6C;AAK7C,uCAMmB;AAYnB,+EAA+E;AAC/E,MAAM,WAAW,GAAG,CAAC,UAAsB,EAAiB,EAAE;IAC1D,QAAQ,UAAU,EAAE,CAAC;QACjB,KAAK,mBAAU,CAAC,MAAM;YAClB,OAAO,qBAAa,CAAC,MAAM,CAAC;QAChC,KAAK,mBAAU,CAAC,MAAM;YAClB,OAAO,qBAAa,CAAC,MAAM,CAAC;QAChC,KAAK,mBAAU,CAAC,IAAI;YAChB,OAAO,qBAAa,CAAC,IAAI,CAAC;QAC9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,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI;YACnC,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI;YAC9D,iBAAiB,EAAE,IAAI;SAC1B;QACD,WAAW;QACX,WAAW,EAAE,IAAI;KACpB,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,OAAO,GAAG;QACZ,YAAY,EAAE,OAAgB;QAC9B,KAAK;QACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;IACF,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACH,GAAG,OAAO;YACV,SAAS,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;SACzD,CAAC;IACN,CAAC;IACD,OAAO;QACH,GAAG,OAAO;QACV,SAAS,EAAE;YACP,MAAM,EAAE,iBAAiB;YACzB,aAAa,EAAE,CAAC;YAChB,cAAc,EAAE,SAAS,CAAC,cAAc;YACxC,GAAG,CAAC,SAAS,CAAC,iBAAiB,KAAK,IAAI;gBACpC,CAAC,CAAC,EAAE,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAAE;gBACpD,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,EAAE,MAAM,CAAC,IAAI;SACtB;KACJ,CAAC;AACN,CAAC,CAAC;AAjFW,QAAA,iCAAiC,GAAjC,iCAAiC,CAiF5C"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { DimensionType } from '../../../../types/field';
2
+ import { DimensionType, MetricType } from '../../../../types/field';
3
3
  import { type Filters } from '../../../../types/filter';
4
+ import { type AdditionalMetric } from '../../../../types/metricQuery';
4
5
  import { QuerySourceType, type ApiConnectorType, type ApiSourceQuery, type DuckdbSourceQuery, type ExternalSourceQuery, type PythonSourceQuery, type QueryNodeId, type SemanticLayerSourceQuery, type SqlSourceQuery } from '../../../../types/querySources';
5
6
  /** The composer query tool's name, and the name calls persisted before the rename carry. */
6
7
  export declare const COMPOSER_QUERY_TOOL_NAMES: readonly ['query', 'runComposerQueries'];
@@ -9,6 +10,7 @@ export declare const isComposerQueryToolName: (toolName: string) => toolName is
9
10
  export declare const DEFAULT_COMPOSER_QUERY_LIMIT = 500;
10
11
  export declare const DEFAULT_COMPOSER_QUERY_MAX_LIMIT = 5000;
11
12
  export declare const COMPOSER_QUERY_PREVIEW_ROW_LIMIT = 50;
13
+ export declare const COMPOSER_NODE_SAMPLE_ROW_LIMIT = 5;
12
14
  /** A project connection an api node can query. */
13
15
  export type ComposerApiConnection = {
14
16
  connectionUuid: string;
@@ -26,6 +28,32 @@ export declare const composerSemanticLayerFiltersSchema: z.ZodNullable<z.ZodObje
26
28
  dimensions: z.ZodNullable<z.ZodString>;
27
29
  metrics: z.ZodNullable<z.ZodString>;
28
30
  }, z.core.$strict>>;
31
+ declare const composerCustomMetricSchema: z.ZodObject<{
32
+ table: z.ZodString;
33
+ name: z.ZodString;
34
+ label: z.ZodString;
35
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ aggregation: z.ZodEnum<{
37
+ average: MetricType.AVERAGE;
38
+ count: MetricType.COUNT;
39
+ count_distinct: MetricType.COUNT_DISTINCT;
40
+ max: MetricType.MAX;
41
+ median: MetricType.MEDIAN;
42
+ min: MetricType.MIN;
43
+ percentile: MetricType.PERCENTILE;
44
+ sum: MetricType.SUM;
45
+ }>;
46
+ dimensionFieldId: z.ZodString;
47
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
48
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ }, z.core.$strip>;
50
+ declare const composerPeriodComparisonSchema: z.ZodObject<{
51
+ metricFieldId: z.ZodString;
52
+ timeDimensionFieldId: z.ZodString;
53
+ periodOffset: z.ZodCoercedNumber<unknown>;
54
+ }, z.core.$strip>;
55
+ export type ToolComposerCustomMetric = z.infer<typeof composerCustomMetricSchema>;
56
+ export type ToolComposerPeriodComparison = z.infer<typeof composerPeriodComparisonSchema>;
29
57
  type CreateToolComposerQueriesArgsSchemaOptions = {
30
58
  maxLimit?: number;
31
59
  defaultLimit?: number;
@@ -55,7 +83,31 @@ export declare const createToolComposerQueriesArgsSchemaV1: ({ maxLimit, default
55
83
  fieldId: z.ZodString;
56
84
  descending: z.ZodBoolean;
57
85
  }, z.core.$strip>>>;
58
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
86
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
87
+ table: z.ZodString;
88
+ name: z.ZodString;
89
+ label: z.ZodString;
90
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ aggregation: z.ZodEnum<{
92
+ average: MetricType.AVERAGE;
93
+ count: MetricType.COUNT;
94
+ count_distinct: MetricType.COUNT_DISTINCT;
95
+ max: MetricType.MAX;
96
+ median: MetricType.MEDIAN;
97
+ min: MetricType.MIN;
98
+ percentile: MetricType.PERCENTILE;
99
+ sum: MetricType.SUM;
100
+ }>;
101
+ dimensionFieldId: z.ZodString;
102
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
103
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ }, z.core.$strip>>>>;
105
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
106
+ metricFieldId: z.ZodString;
107
+ timeDimensionFieldId: z.ZodString;
108
+ periodOffset: z.ZodCoercedNumber<unknown>;
109
+ }, z.core.$strip>>>>;
110
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
59
111
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
60
112
  }, z.core.$strip>, z.ZodObject<{
61
113
  title: z.ZodString;
@@ -122,7 +174,31 @@ export declare const toolComposerQueriesArgsSchema: z.ZodObject<{
122
174
  fieldId: z.ZodString;
123
175
  descending: z.ZodBoolean;
124
176
  }, z.core.$strip>>>;
125
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
177
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
178
+ table: z.ZodString;
179
+ name: z.ZodString;
180
+ label: z.ZodString;
181
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
182
+ aggregation: z.ZodEnum<{
183
+ average: MetricType.AVERAGE;
184
+ count: MetricType.COUNT;
185
+ count_distinct: MetricType.COUNT_DISTINCT;
186
+ max: MetricType.MAX;
187
+ median: MetricType.MEDIAN;
188
+ min: MetricType.MIN;
189
+ percentile: MetricType.PERCENTILE;
190
+ sum: MetricType.SUM;
191
+ }>;
192
+ dimensionFieldId: z.ZodString;
193
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
194
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ }, z.core.$strip>>>>;
196
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
197
+ metricFieldId: z.ZodString;
198
+ timeDimensionFieldId: z.ZodString;
199
+ periodOffset: z.ZodCoercedNumber<unknown>;
200
+ }, z.core.$strip>>>>;
201
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
126
202
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
127
203
  }, z.core.$strip>, z.ZodObject<{
128
204
  title: z.ZodString;
@@ -188,7 +264,31 @@ export declare const toolComposerQueriesArgsSchemaPersisted: z.ZodPreprocess<z.Z
188
264
  fieldId: z.ZodString;
189
265
  descending: z.ZodBoolean;
190
266
  }, z.core.$strip>>>;
191
- parameters: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
267
+ customMetrics: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
268
+ table: z.ZodString;
269
+ name: z.ZodString;
270
+ label: z.ZodString;
271
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
+ aggregation: z.ZodEnum<{
273
+ average: MetricType.AVERAGE;
274
+ count: MetricType.COUNT;
275
+ count_distinct: MetricType.COUNT_DISTINCT;
276
+ max: MetricType.MAX;
277
+ median: MetricType.MEDIAN;
278
+ min: MetricType.MIN;
279
+ percentile: MetricType.PERCENTILE;
280
+ sum: MetricType.SUM;
281
+ }>;
282
+ dimensionFieldId: z.ZodString;
283
+ percentile: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
284
+ filter: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ }, z.core.$strip>>>>;
286
+ periodComparisons: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
287
+ metricFieldId: z.ZodString;
288
+ timeDimensionFieldId: z.ZodString;
289
+ periodOffset: z.ZodCoercedNumber<unknown>;
290
+ }, z.core.$strip>>>>;
291
+ parameters: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>>>;
192
292
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
193
293
  }, z.core.$strip>, z.ZodObject<{
194
294
  title: z.ZodString;
@@ -239,8 +339,9 @@ export type ToolComposerQueryNode = z.infer<ReturnType<typeof createToolComposer
239
339
  export type ToolComposerSemanticLayerNode = Extract<ToolComposerQueryNode, {
240
340
  sourceType: QuerySourceType.SEMANTIC_LAYER;
241
341
  }>;
242
- export type ResolvedToolComposerQueryNode = Exclude<ToolComposerQueryNode, ToolComposerSemanticLayerNode> | (Omit<ToolComposerSemanticLayerNode, 'filters'> & {
342
+ export type ResolvedToolComposerQueryNode = Exclude<ToolComposerQueryNode, ToolComposerSemanticLayerNode> | (Omit<ToolComposerSemanticLayerNode, 'filters' | 'customMetrics' | 'periodComparisons'> & {
243
343
  filters: Filters | null;
344
+ additionalMetrics: AdditionalMetric[];
244
345
  });
245
346
  /**
246
347
  * Converts a validated tool node into the canonical SourceQuery shape the
@@ -270,6 +371,11 @@ export declare const toolComposerQueriesStructuredContentSchema: z.ZodObject<{
270
371
  sourceType: z.ZodEnum<typeof QuerySourceType>;
271
372
  rowCount: z.ZodNullable<z.ZodNumber>;
272
373
  limit: z.ZodNumber;
374
+ columns: z.ZodNullable<z.ZodArray<z.ZodObject<{
375
+ reference: z.ZodString;
376
+ type: z.ZodEnum<typeof DimensionType>;
377
+ }, z.core.$strip>>>;
378
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
273
379
  }, z.core.$strip>>;
274
380
  columns: z.ZodArray<z.ZodObject<{
275
381
  reference: z.ZodString;
@@ -312,6 +418,7 @@ export declare const mcpQueryStructuredOutputSchema: z.ZodObject<{
312
418
  reference: z.ZodString;
313
419
  type: z.ZodEnum<typeof DimensionType>;
314
420
  }, z.core.$strip>>>;
421
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
315
422
  }, z.core.$strip>>;
316
423
  }, z.core.$strip>;
317
424
  export type McpQueryStructuredContent = z.infer<typeof mcpQueryStructuredOutputSchema>;
@@ -352,6 +459,11 @@ export declare const toolComposerQueriesOutputSchema: z.ZodUnion<readonly [z.Zod
352
459
  sourceType: z.ZodEnum<typeof QuerySourceType>;
353
460
  rowCount: z.ZodNullable<z.ZodNumber>;
354
461
  limit: z.ZodNumber;
462
+ columns: z.ZodNullable<z.ZodArray<z.ZodObject<{
463
+ reference: z.ZodString;
464
+ type: z.ZodEnum<typeof DimensionType>;
465
+ }, z.core.$strip>>>;
466
+ sample: z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
355
467
  }, z.core.$strip>>;
356
468
  columns: z.ZodArray<z.ZodObject<{
357
469
  reference: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"toolComposerQueryArgs.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolComposerQueryArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAMxD,OAAO,EACH,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACtB,MAAM,gCAAgC,CAAC;AAUxC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,YAClC,OAAO,EACP,oBAAoB,CACd,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,eAAO,MAAM,uBAAuB,aACtB,MAAM,KACjB,QAAQ,IAAI,qBACwD,CAAC;AAExE,eAAO,MAAM,4BAA4B,MAAM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M,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS1C,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CACzC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CACzD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,+BAA+B,CACzC,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,0CAA0C,CACpD,CAAC"}
1
+ {"version":3,"file":"toolComposerQueryArgs.d.ts","sourceRoot":"","sources":["../../../../../../src/ee/AiAgent/schemas/tools/toolComposerQueryArgs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,KAAK,gBAAgB,EAGxB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACH,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACtB,MAAM,gCAAgC,CAAC;AAaxC,4FAA4F;AAC5F,eAAO,MAAM,yBAAyB,YAClC,OAAO,EACP,oBAAoB,CACd,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,eAAO,MAAM,uBAAuB,aACtB,MAAM,KACjB,QAAQ,IAAI,qBACwD,CAAC;AAExE,eAAO,MAAM,4BAA4B,MAAM,CAAC;AA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B,CAAC;AAsCF,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCrD,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CzC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,8BAA8B,CACxC,CAAC;AAEF,QAAA,MAAM,wCAAwC;;;;;;iBAM5C,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,wCAAwC,CAClD,CAAC;AAEF,eAAO,MAAM,uCAAuC,aACtC,OAAO,KAClB,kCAAkC,GAAG,IAGvC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS1C,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CACzC,UAAU,CAAC,OAAO,mCAAmC,CAAC,CACzD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,+BAA+B,CACzC,CAAC;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,0CAA0C,CACpD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toolComposerQueriesOutputSchema = exports.parseToolComposerQueriesSuccessMetadata = exports.mcpQueryStructuredOutputSchema = exports.toolComposerQueriesStructuredContentSchema = exports.parsePartialToolComposerQueriesArgs = exports.toolComposerQueryNodeToSourceQuery = exports.toolComposerQueriesArgsSchemaPersisted = exports.toolComposerQueriesArgsSchema = exports.createToolComposerQueriesArgsSchema = exports.createToolComposerQueriesArgsSchemaV1 = exports.composerSemanticLayerFiltersSchema = exports.TOOL_COMPOSER_QUERIES_DESCRIPTION = exports.MCP_TOOL_QUERY_DESCRIPTION = exports.getToolComposerQueriesDescription = exports.COMPOSER_QUERY_PREVIEW_ROW_LIMIT = exports.DEFAULT_COMPOSER_QUERY_MAX_LIMIT = exports.DEFAULT_COMPOSER_QUERY_LIMIT = exports.isComposerQueryToolName = exports.COMPOSER_QUERY_TOOL_NAMES = void 0;
3
+ exports.toolComposerQueriesOutputSchema = exports.parseToolComposerQueriesSuccessMetadata = exports.mcpQueryStructuredOutputSchema = exports.toolComposerQueriesStructuredContentSchema = exports.parsePartialToolComposerQueriesArgs = exports.toolComposerQueryNodeToSourceQuery = exports.toolComposerQueriesArgsSchemaPersisted = exports.toolComposerQueriesArgsSchema = exports.createToolComposerQueriesArgsSchema = exports.createToolComposerQueriesArgsSchemaV1 = exports.composerSemanticLayerFiltersSchema = exports.TOOL_COMPOSER_QUERIES_DESCRIPTION = exports.MCP_TOOL_QUERY_DESCRIPTION = exports.getToolComposerQueriesDescription = exports.COMPOSER_NODE_SAMPLE_ROW_LIMIT = exports.COMPOSER_QUERY_PREVIEW_ROW_LIMIT = exports.DEFAULT_COMPOSER_QUERY_MAX_LIMIT = exports.DEFAULT_COMPOSER_QUERY_LIMIT = exports.isComposerQueryToolName = exports.COMPOSER_QUERY_TOOL_NAMES = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const zod_1 = require("zod");
6
6
  const field_1 = require("../../../../types/field");
@@ -20,6 +20,7 @@ exports.isComposerQueryToolName = isComposerQueryToolName;
20
20
  exports.DEFAULT_COMPOSER_QUERY_LIMIT = 500;
21
21
  exports.DEFAULT_COMPOSER_QUERY_MAX_LIMIT = 5000;
22
22
  exports.COMPOSER_QUERY_PREVIEW_ROW_LIMIT = 50;
23
+ exports.COMPOSER_NODE_SAMPLE_ROW_LIMIT = 5;
23
24
  const getComposerNodeKindsDescription = ({ enablePythonNodes, apiConnections, sqlNote, }) => `Node kinds:
24
25
  - "semanticLayer": a metric query against an explore. Result columns are the requested field ids.
25
26
  - "sql": raw SQL against the project warehouse; ${sqlNote}.
@@ -35,7 +36,7 @@ const getComposerNodeKindsDescription = ({ enablePythonNodes, apiConnections, sq
35
36
  : ''}
36
37
 
37
38
  A node reads only the rows its references returned, so a referenced result that reached its limit is incomplete: before totalling, averaging or ranking over it, give that node a limit that holds its whole population, or aggregate there.`;
38
- const getToolComposerQueriesDescription = ({ enablePythonNodes, apiConnections, }) => `Run a pipeline: one or more nodes submitted together, where ${enablePythonNodes ? 'duckdb and python' : 'duckdb'} nodes join or transform other nodes' results. The terminal node's rows are returned to you.
39
+ const getToolComposerQueriesDescription = ({ enablePythonNodes, apiConnections, }) => `Run a pipeline: one or more nodes submitted together, where ${enablePythonNodes ? 'duckdb and python' : 'duckdb'} nodes join or transform other nodes' results. One call returns one node's rows, the terminal node's, so exactly one submitted node may go unread by the others: to get several results, combine them in one duckdb node (UNION ALL or JOIN) or submit them in separate calls. Every other submitted node is listed with its columns and first rows.
39
40
 
40
41
  ${getComposerNodeKindsDescription({
41
42
  enablePythonNodes,
@@ -45,7 +46,9 @@ ${getComposerNodeKindsDescription({
45
46
 
46
47
  Reuse across calls: a node id names one node for the whole thread. To build on a node from an earlier call, read its node id in "references" without resubmitting it; it is copied into this pipeline with everything it reads and served from cache when possible. Resubmitting a node id with a different definition is an error, so give a changed node a new node id.`;
47
48
  exports.getToolComposerQueriesDescription = getToolComposerQueriesDescription;
48
- exports.MCP_TOOL_QUERY_DESCRIPTION = `Run a pipeline: one or more nodes submitted together, where duckdb and python nodes join or transform other nodes' results. A pipeline of one node runs a single semantic-layer or SQL query, and later calls can reuse its node.
49
+ exports.MCP_TOOL_QUERY_DESCRIPTION = `Run a pipeline: one or more nodes submitted together, where duckdb and python nodes join or transform other nodes' results. A pipeline of one node runs a single semantic-layer or SQL query.
50
+
51
+ One call returns one node's rows, so exactly one submitted node may go unread by the others: combine several results in one duckdb node (UNION ALL or JOIN), or submit them in separate calls reusing earlier nodes.
49
52
 
50
53
  ${getComposerNodeKindsDescription({
51
54
  enablePythonNodes: true,
@@ -55,9 +58,9 @@ ${getComposerNodeKindsDescription({
55
58
 
56
59
  A python node's "code" defines \`def run(inputs, params)\`, and semanticLayer "filters" are flat expression strings; each field documents its contract.
57
60
 
58
- Reuse earlier nodes: a result returns a sessionId once a node has finished; finished nodes are saved in it. On a follow-up, pass that sessionId and read saved nodes by node id in "references", submitting only the new nodes. Reused nodes come with everything they read and are served from cache when possible, so results come back faster. A saved node id names one node for the whole session, so give a changed node a new node id; a failed or unfinished node is not saved, so resubmit it under the same id. Omit sessionId to start a new session.
61
+ Reuse earlier nodes: a result returns a sessionId once a node has finished; finished nodes are saved in it. On a follow-up, pass that sessionId and read saved nodes by node id in "references", submitting only the new nodes. Reused nodes bring everything they read and are served from cache when possible. A saved node id names one node for the whole session, so give a changed node a new node id; a failed or unfinished node is not saved, so resubmit it under the same id. Omit sessionId to start a new session.
59
62
 
60
- Returns a preview of the terminal node's rows and every node's queryUuid. The terminal node is the unique sink, or the node named in terminalNodeId. If the result is running, follow up with get_query_result on the terminal node's queryUuid; it also fetches the first page of any node's result by its queryUuid. query computes data only; it saves and charts nothing.`;
63
+ Returns the terminal node's first rows, other submitted nodes' columns and first rows, and every node's queryUuid. If the result is running, follow up with get_query_result on the terminal node's queryUuid; it also fetches the first page of any node's result by its queryUuid. query computes data only; it saves and charts nothing.`;
61
64
  exports.TOOL_COMPOSER_QUERIES_DESCRIPTION = (0, exports.getToolComposerQueriesDescription)({
62
65
  enablePythonNodes: false,
63
66
  apiConnections: [],
@@ -81,6 +84,57 @@ exports.composerSemanticLayerFiltersSchema = expressionSchemas_1.filterExpressio
81
84
  .strict()
82
85
  .nullable()
83
86
  .describe("Filters on this node's explore as flat expression strings, never structured rule objects: one for dimension fields and one for metric fields, each choosing AND or OR independently and combined with AND. Null when unfiltered, or null for an unused kind.");
87
+ const composerCustomMetricSchema = zod_1.z.object({
88
+ table: zod_1.z
89
+ .string()
90
+ .describe('Table of the base dimension; the metric belongs to it.'),
91
+ name: zod_1.z
92
+ .string()
93
+ .regex(/^[a-z][a-z0-9_]*$/, 'Custom metric names use lowercase snake_case')
94
+ .describe('snake_case name. The metric\'s field id is "<table>_<name>": list it in "metrics" to select it, and use it in sorts, metric filters and periodComparisons.'),
95
+ label: zod_1.z.string().describe('Column label shown to users.'),
96
+ description: zod_1.z
97
+ .string()
98
+ .nullish()
99
+ .describe("Shown to users as the metric's description. Null when the label is enough."),
100
+ aggregation: zod_1.z
101
+ .enum([
102
+ field_1.MetricType.SUM,
103
+ field_1.MetricType.AVERAGE,
104
+ field_1.MetricType.COUNT,
105
+ field_1.MetricType.COUNT_DISTINCT,
106
+ field_1.MetricType.MIN,
107
+ field_1.MetricType.MAX,
108
+ field_1.MetricType.MEDIAN,
109
+ field_1.MetricType.PERCENTILE,
110
+ ])
111
+ .describe('Aggregation over the base dimension. Number dimensions take any; string, date and timestamp dimensions take count, count_distinct, min or max; boolean dimensions take count or count_distinct.'),
112
+ dimensionFieldId: zod_1.z
113
+ .string()
114
+ .describe('Field id of the dimension to aggregate, a dimension of "table".'),
115
+ percentile: zod_1.z
116
+ .number()
117
+ .min(0)
118
+ .max(100)
119
+ .nullish()
120
+ .describe('0–100, set only for the percentile aggregation.'),
121
+ filter: expressionSchemas_1.filterExpressionInputSchema
122
+ .nullish()
123
+ .describe('Aggregates only the rows this flat AND expression over dimensions matches, in the node filter grammar, e.g. "orders_status equals=completed". Null aggregates every row.'),
124
+ });
125
+ const composerPeriodComparisonSchema = zod_1.z.object({
126
+ metricFieldId: zod_1.z
127
+ .string()
128
+ .describe('Metric to compare: a field id in "metrics", explore or custom.'),
129
+ timeDimensionFieldId: zod_1.z
130
+ .string()
131
+ .describe('Time dimension in "dimensions" with a day, week, month, quarter or year grain; the offset counts in that grain.'),
132
+ periodOffset: zod_1.z.coerce
133
+ .number()
134
+ .int()
135
+ .min(1)
136
+ .describe('Periods to look back: 1 for the previous period, 12 on a month grain for the same month last year.'),
137
+ });
84
138
  const sortFieldSchema = zod_1.z.object({
85
139
  fieldId: zod_1.z.string().describe('Field id to sort by.'),
86
140
  descending: zod_1.z
@@ -126,10 +180,17 @@ const createToolComposerQueriesArgsSchemaV1 = ({ maxLimit = exports.DEFAULT_COMP
126
180
  .array(sortFieldSchema)
127
181
  .nullable()
128
182
  .describe('Sorts by fields this node also selects in dimensions or metrics, e.g. [{"fieldId": "orders_order_date", "descending": true}].'),
183
+ customMetrics: zod_1.z
184
+ .array(composerCustomMetricSchema)
185
+ .nullish()
186
+ .describe('Metrics the explore lacks, each an aggregation over one of its dimensions, computed in this query.'),
187
+ periodComparisons: zod_1.z
188
+ .array(composerPeriodComparisonSchema)
189
+ .nullish()
190
+ .describe('Each adds a column holding a metric shifted back in time, next to that metric, e.g. revenue the same month last year. The warehouse reads the earlier period even when the filters exclude it. The column id is generated; read it from the result columns.'),
129
191
  parameters: zod_1.z
130
192
  .record(zod_1.z.string(), toolRunQueryArgs_1.parameterValueSchema)
131
- .nullable()
132
- .default(null)
193
+ .nullish()
133
194
  .describe('Parameter values for this node, keyed by parameter name exactly as shown in the explore metadata (e.g. {"orders.metric": "active_users"}). Set them whenever a selected field is marked "requires parameters" and the default does not match what the user asked for: an unset parameter silently resolves to its default, which can return the wrong data. null when the explore has no parameters or the defaults are correct.'),
134
195
  limit: limitSchema,
135
196
  });
@@ -219,7 +280,7 @@ const createToolComposerQueriesArgsSchemaV1 = ({ maxLimit = exports.DEFAULT_COMP
219
280
  terminalNodeId: zod_1.z
220
281
  .string()
221
282
  .nullable()
222
- .describe('The terminal node. Null picks the unique sink, the one submitted node no other submitted node reads; name a node when there are several sinks.'),
283
+ .describe('The terminal node. Null picks the one submitted node no other submitted node reads; a node id returns that node of the pipeline instead, including a node from an earlier call.'),
223
284
  })
224
285
  .build();
225
286
  };
@@ -279,6 +340,9 @@ const toolComposerQueryNodeToSourceQuery = (node) => {
279
340
  filters,
280
341
  sorts,
281
342
  parameters,
343
+ ...(node.additionalMetrics.length > 0
344
+ ? { additionalMetrics: node.additionalMetrics }
345
+ : {}),
282
346
  limit: node.limit,
283
347
  };
284
348
  }
@@ -462,6 +526,10 @@ const parsePartialToolComposerQueriesArgs = (input) => {
462
526
  };
463
527
  };
464
528
  exports.parsePartialToolComposerQueriesArgs = parsePartialToolComposerQueriesArgs;
529
+ const composerQueryColumnSchema = zod_1.z.object({
530
+ reference: zod_1.z.string().describe('Column name as it appears in the rows.'),
531
+ type: zod_1.z.nativeEnum(field_1.DimensionType),
532
+ });
465
533
  const composerQueryNodeSummarySchema = zod_1.z.object({
466
534
  nodeId: nodeIdSchema,
467
535
  title: zod_1.z.string().nullable().describe('What users see for this node.'),
@@ -477,10 +545,14 @@ const composerQueryNodeSummarySchema = zod_1.z.object({
477
545
  .int()
478
546
  .positive()
479
547
  .describe('Row limit this node ran with. A rowCount equal to it means the node reached its limit, so more rows may exist.'),
480
- });
481
- const composerQueryColumnSchema = zod_1.z.object({
482
- reference: zod_1.z.string().describe('Column name as it appears in the rows.'),
483
- type: zod_1.z.nativeEnum(field_1.DimensionType),
548
+ columns: zod_1.z
549
+ .array(composerQueryColumnSchema)
550
+ .nullable()
551
+ .describe('Columns of a node submitted in this call; null for reused nodes and for the terminal node, whose columns are in columns.'),
552
+ sample: zod_1.z
553
+ .array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
554
+ .nullable()
555
+ .describe(`First ${exports.COMPOSER_NODE_SAMPLE_ROW_LIMIT} rows of a node submitted in this call other than the terminal node; null otherwise or when data access is disabled.`),
484
556
  });
485
557
  exports.toolComposerQueriesStructuredContentSchema = zod_1.z.object({
486
558
  terminalNodeId: nodeIdSchema.describe('Node whose rows are returned.'),
@@ -538,7 +610,11 @@ exports.mcpQueryStructuredOutputSchema = zod_1.z.object({
538
610
  columns: zod_1.z
539
611
  .array(composerQueryColumnSchema)
540
612
  .nullable()
541
- .describe('Result columns; null until the node is done.'),
613
+ .describe('Result columns of the terminal node and of nodes submitted in this call; null for reused nodes and until the node is done.'),
614
+ sample: zod_1.z
615
+ .array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
616
+ .nullable()
617
+ .describe(`First ${exports.COMPOSER_NODE_SAMPLE_ROW_LIMIT} rows of a done node submitted in this call other than the terminal node; null for the terminal node and for reused, failed or unfinished nodes.`),
542
618
  }))
543
619
  .describe('Every node of the pipeline, in dependency order.'),
544
620
  });