@sisense/sdk-ai-core 0.10.1 → 0.13.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 (120) hide show
  1. package/dist/engines/build-chart/build-chart-engine.d.ts +1 -1
  2. package/dist/engines/build-chart/build-chart-engine.d.ts.map +1 -1
  3. package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts +26 -0
  4. package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts.map +1 -0
  5. package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts +27 -0
  6. package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts.map +1 -0
  7. package/dist/engines/build-chart/create-chart/create-chart.d.ts +4 -21
  8. package/dist/engines/build-chart/create-chart/create-chart.d.ts.map +1 -1
  9. package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts +8 -4
  10. package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts.map +1 -1
  11. package/dist/engines/build-chart/create-chart/generate-chart.d.ts +18 -0
  12. package/dist/engines/build-chart/create-chart/generate-chart.d.ts.map +1 -0
  13. package/dist/engines/build-chart/create-chart/get-columns-json.d.ts +15 -0
  14. package/dist/engines/build-chart/create-chart/get-columns-json.d.ts.map +1 -0
  15. package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts +11 -0
  16. package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts.map +1 -0
  17. package/dist/engines/build-chart/shared/csdk-data-options-for-llm.d.ts +14 -0
  18. package/dist/engines/build-chart/shared/csdk-data-options-for-llm.d.ts.map +1 -0
  19. package/dist/engines/build-chart/types.d.ts +243 -509
  20. package/dist/engines/build-chart/types.d.ts.map +1 -1
  21. package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +1608 -8812
  22. package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts.map +1 -1
  23. package/dist/engines/build-chart/update-chart/schemas.d.ts +68 -977
  24. package/dist/engines/build-chart/update-chart/schemas.d.ts.map +1 -1
  25. package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts +1 -1
  26. package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts.map +1 -1
  27. package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +1 -1
  28. package/dist/engines/build-chart/update-chart/update-chart-query.d.ts.map +1 -1
  29. package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts +1 -1
  30. package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts.map +1 -1
  31. package/dist/engines/build-chart/update-chart/update-chart-title.d.ts +1 -1
  32. package/dist/engines/build-chart/update-chart/update-chart-title.d.ts.map +1 -1
  33. package/dist/engines/build-chart/update-chart/update-chart-type.d.ts +1 -1
  34. package/dist/engines/build-chart/update-chart/update-chart-type.d.ts.map +1 -1
  35. package/dist/engines/build-csv-model/build-csv-model-engine.d.ts +1 -1
  36. package/dist/engines/build-csv-model/build-csv-model-engine.d.ts.map +1 -1
  37. package/dist/engines/build-csv-model/rest-build.d.ts.map +1 -1
  38. package/dist/engines/build-csv-model/types.d.ts +9 -71
  39. package/dist/engines/build-csv-model/types.d.ts.map +1 -1
  40. package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +1 -1
  41. package/dist/engines/build-dashboard/build-dashboard-engine.d.ts.map +1 -1
  42. package/dist/engines/build-dashboard/build-dashboard-service.d.ts +3 -3
  43. package/dist/engines/build-dashboard/build-dashboard-service.d.ts.map +1 -1
  44. package/dist/engines/build-dashboard/create-chart-widget.d.ts.map +1 -1
  45. package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts +2 -2
  46. package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts.map +1 -1
  47. package/dist/engines/build-dashboard/types.d.ts +34 -106
  48. package/dist/engines/build-dashboard/types.d.ts.map +1 -1
  49. package/dist/engines/build-dashboard/update-chart-widget.d.ts.map +1 -1
  50. package/dist/engines/build-data-model/build-data-model-engine.d.ts +1 -1
  51. package/dist/engines/build-data-model/build-data-model-engine.d.ts.map +1 -1
  52. package/dist/engines/build-data-model/types.d.ts +59 -316
  53. package/dist/engines/build-data-model/types.d.ts.map +1 -1
  54. package/dist/engines/build-query/build-query-engine.d.ts +1 -1
  55. package/dist/engines/build-query/build-query-engine.d.ts.map +1 -1
  56. package/dist/engines/build-query/types.d.ts +2 -10
  57. package/dist/engines/build-query/types.d.ts.map +1 -1
  58. package/dist/engines/get-dashboards/get-dashboards-engine.d.ts +1 -1
  59. package/dist/engines/get-dashboards/get-dashboards-engine.d.ts.map +1 -1
  60. package/dist/engines/get-dashboards/types.d.ts +2 -2
  61. package/dist/engines/get-dashboards/types.d.ts.map +1 -1
  62. package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts +5 -4
  63. package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts.map +1 -1
  64. package/dist/engines/get-data-source-fields/types.d.ts +5 -8
  65. package/dist/engines/get-data-source-fields/types.d.ts.map +1 -1
  66. package/dist/engines/get-data-sources/get-data-sources-engine.d.ts +1 -1
  67. package/dist/engines/get-data-sources/get-data-sources-engine.d.ts.map +1 -1
  68. package/dist/engines/get-data-sources/types.d.ts +2 -2
  69. package/dist/engines/get-data-sources/types.d.ts.map +1 -1
  70. package/dist/engines/index.d.ts +1 -1
  71. package/dist/engines/index.d.ts.map +1 -1
  72. package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts +1 -1
  73. package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts.map +1 -1
  74. package/dist/engines/manage-perspectives/types.d.ts +58 -194
  75. package/dist/engines/manage-perspectives/types.d.ts.map +1 -1
  76. package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +1 -1
  77. package/dist/engines/recommend-queries/recommend-queries-engine.d.ts.map +1 -1
  78. package/dist/engines/recommend-queries/types.d.ts +5 -17
  79. package/dist/engines/recommend-queries/types.d.ts.map +1 -1
  80. package/dist/index.d.ts +6 -3
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +26249 -7707
  83. package/dist/index.js.map +1 -1
  84. package/dist/services/dashboards/fusion-dashboards-service.d.ts.map +1 -1
  85. package/dist/services/data-models/ecm-service.d.ts +14 -0
  86. package/dist/services/data-models/ecm-service.d.ts.map +1 -1
  87. package/dist/services/data-sources/data-sources-service.d.ts.map +1 -1
  88. package/dist/services/llm/llm-models-service.d.ts +15 -0
  89. package/dist/services/llm/llm-models-service.d.ts.map +1 -0
  90. package/dist/services/nlq/nlq-service.d.ts +3 -14
  91. package/dist/services/nlq/nlq-service.d.ts.map +1 -1
  92. package/dist/singleton-clients.d.ts +4 -22
  93. package/dist/singleton-clients.d.ts.map +1 -1
  94. package/dist/utils/abort-signal.d.ts +3 -0
  95. package/dist/utils/abort-signal.d.ts.map +1 -0
  96. package/dist/utils/create-custom-fetch.d.ts +2 -3
  97. package/dist/utils/create-custom-fetch.d.ts.map +1 -1
  98. package/dist/utils/create-serialized-tool-group.d.ts +24 -0
  99. package/dist/utils/create-serialized-tool-group.d.ts.map +1 -0
  100. package/dist/utils/create-stream-completion.d.ts +69 -0
  101. package/dist/utils/create-stream-completion.d.ts.map +1 -0
  102. package/dist/utils/create-structured-completion.d.ts +18 -0
  103. package/dist/utils/create-structured-completion.d.ts.map +1 -0
  104. package/dist/utils/create-tools-completion.d.ts +28 -0
  105. package/dist/utils/create-tools-completion.d.ts.map +1 -0
  106. package/dist/utils/llm-client.d.ts +8 -0
  107. package/dist/utils/llm-client.d.ts.map +1 -0
  108. package/dist/utils/llm-provider-options.d.ts +14 -0
  109. package/dist/utils/llm-provider-options.d.ts.map +1 -0
  110. package/dist/utils/zod-utils.d.ts +9 -17
  111. package/dist/utils/zod-utils.d.ts.map +1 -1
  112. package/package.json +20 -18
  113. package/dist/engines/build-chart/create-chart/generate-chart-table.d.ts +0 -28
  114. package/dist/engines/build-chart/create-chart/generate-chart-table.d.ts.map +0 -1
  115. package/dist/services/globals/globals-service.d.ts +0 -2
  116. package/dist/services/globals/globals-service.d.ts.map +0 -1
  117. package/dist/utils/chat-completion-utils.d.ts +0 -55
  118. package/dist/utils/chat-completion-utils.d.ts.map +0 -1
  119. package/dist/utils/openai-client.d.ts +0 -11
  120. package/dist/utils/openai-client.d.ts.map +0 -1
@@ -1,21 +1,16 @@
1
- import { CalculatedMeasureColumn, MeasureColumn } from '@sisense/sdk-data';
2
- import { ChartType, ChartWidgetProps, StyledColumn, StyledMeasureColumn, WithCommonWidgetProps } from '@sisense/sdk-ui';
1
+ import { ChartType, ChartWidgetProps, WithCommonWidgetProps } from '@sisense/sdk-ui';
3
2
  import { HttpClient } from '@sisense/sdk-rest-client';
4
- import { default as OpenAI } from 'openai';
5
- import { z } from 'zod';
3
+ import { z } from 'zod/v4';
6
4
  import { QueryResult } from '../build-query/types';
7
5
  import { ChartState, Dataset, QueryState } from '../../services/nlq/nlq-service';
6
+ import { LanguageModel } from 'ai';
8
7
  export type ArtifactReference = {
9
8
  artifactId?: string;
10
9
  };
11
10
  export type ExtendedChartWidgetProps = WithCommonWidgetProps<ChartWidgetProps, 'chart'> & ArtifactReference & {
12
- /**
13
- * data columns used to generate chart recommendations
14
- */
15
- dataColumns?: ColumnType[];
16
11
  /** Query state used to generate this chart — needed to revise query structure incrementally */
17
12
  queryState?: QueryState;
18
- /** Sample / tabular payload from NLQ when available (same source as standalone buildQuery). */
13
+ /** Sample / tabular payload from the query execution. */
19
14
  dataset?: Dataset;
20
15
  /** Optional CSDK chart JSON when a caller persists it alongside NLQ state (distinct from REST `chartState` / {@link QueryState}). */
21
16
  chartState?: ChartState;
@@ -40,8 +35,6 @@ export interface ChartSummary {
40
35
  dataSourceTitle: string;
41
36
  /** Compact CSDK chart configuration (chartType, dataOptions, filters, styleOptions) */
42
37
  chartState?: BaseChartSummary;
43
- /** NLQ state for incremental structural revisions via updateChartQuery */
44
- queryState?: QueryState;
45
38
  /** Whether this chart creation resulted in an error */
46
39
  isError?: boolean;
47
40
  /** Dataset rows/sample from NLQ when present on the saved chart widget; surfaced on {@link ChartSummary} when `naturalResponseEnabled` */
@@ -55,565 +48,305 @@ export type ChartContextPromptEntry = ChartSummary | {
55
48
  chartId: string;
56
49
  chartState: BaseChartSummary;
57
50
  };
58
- export type ColumnType = StyledColumn | StyledMeasureColumn | Column | MeasureColumn | CalculatedMeasureColumn;
59
- export interface Column {
51
+ /**
52
+ * Normalized styled-column shape used throughout the chart pipeline.
53
+ * `queryState` elements are normalized to this form before use (see `getColumnsJSON`).
54
+ * `dataOptions` items are already in this form after `translateChartFromJSON`.
55
+ * The `column` value is opaque — never inspected by chart manipulation code.
56
+ */
57
+ export type ColumnJSON = {
58
+ column: unknown;
59
+ [key: string]: unknown;
60
+ };
61
+ export interface ColumnSummary {
60
62
  id?: number;
61
63
  name: string;
62
64
  type?: string;
63
65
  }
64
- export declare const chartType: z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>;
65
- export declare const axesMapping: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
66
- type: z.ZodEnum<["bar", "column", "area", "line", "polar"]>;
67
- category: z.ZodArray<z.ZodNumber, "many">;
68
- value: z.ZodArray<z.ZodNumber, "many">;
69
- breakBy: z.ZodArray<z.ZodNumber, "many">;
70
- }, "strict", z.ZodTypeAny, {
71
- value: number[];
72
- type: "area" | "column" | "line" | "bar" | "polar";
73
- category: number[];
74
- breakBy: number[];
75
- }, {
76
- value: number[];
77
- type: "area" | "column" | "line" | "bar" | "polar";
78
- category: number[];
79
- breakBy: number[];
80
- }>, z.ZodObject<{
81
- type: z.ZodEnum<["pie", "funnel", "treemap", "sunburst"]>;
82
- category: z.ZodArray<z.ZodNumber, "many">;
83
- value: z.ZodArray<z.ZodNumber, "many">;
84
- }, "strict", z.ZodTypeAny, {
85
- value: number[];
86
- type: "pie" | "funnel" | "treemap" | "sunburst";
87
- category: number[];
88
- }, {
89
- value: number[];
90
- type: "pie" | "funnel" | "treemap" | "sunburst";
91
- category: number[];
92
- }>, z.ZodObject<{
66
+ export declare const chartType: z.ZodEnum<{
67
+ area: "area";
68
+ table: "table";
69
+ indicator: "indicator";
70
+ column: "column";
71
+ line: "line";
72
+ pie: "pie";
73
+ bar: "bar";
74
+ polar: "polar";
75
+ funnel: "funnel";
76
+ treemap: "treemap";
77
+ sunburst: "sunburst";
78
+ scatter: "scatter";
79
+ areamap: "areamap";
80
+ boxplot: "boxplot";
81
+ scattermap: "scattermap";
82
+ arearange: "arearange";
83
+ }>;
84
+ export declare const axesMappingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ type: z.ZodEnum<{
86
+ area: "area";
87
+ column: "column";
88
+ line: "line";
89
+ bar: "bar";
90
+ polar: "polar";
91
+ }>;
92
+ category: z.ZodArray<z.ZodNumber>;
93
+ value: z.ZodArray<z.ZodNumber>;
94
+ breakBy: z.ZodArray<z.ZodNumber>;
95
+ }, z.core.$strict>, z.ZodObject<{
96
+ type: z.ZodEnum<{
97
+ pie: "pie";
98
+ funnel: "funnel";
99
+ treemap: "treemap";
100
+ sunburst: "sunburst";
101
+ }>;
102
+ category: z.ZodArray<z.ZodNumber>;
103
+ value: z.ZodArray<z.ZodNumber>;
104
+ }, z.core.$strict>, z.ZodObject<{
93
105
  type: z.ZodLiteral<"scatter">;
94
- x: z.ZodArray<z.ZodNumber, "many">;
95
- y: z.ZodArray<z.ZodNumber, "many">;
96
- breakByPoint: z.ZodArray<z.ZodNumber, "many">;
97
- breakByColor: z.ZodArray<z.ZodNumber, "many">;
98
- size: z.ZodArray<z.ZodNumber, "many">;
99
- }, "strict", z.ZodTypeAny, {
100
- type: "scatter";
101
- x: number[];
102
- y: number[];
103
- breakByPoint: number[];
104
- breakByColor: number[];
105
- size: number[];
106
- }, {
107
- type: "scatter";
108
- x: number[];
109
- y: number[];
110
- breakByPoint: number[];
111
- breakByColor: number[];
112
- size: number[];
113
- }>, z.ZodObject<{
106
+ x: z.ZodArray<z.ZodNumber>;
107
+ y: z.ZodArray<z.ZodNumber>;
108
+ breakByPoint: z.ZodArray<z.ZodNumber>;
109
+ breakByColor: z.ZodArray<z.ZodNumber>;
110
+ size: z.ZodArray<z.ZodNumber>;
111
+ }, z.core.$strict>, z.ZodObject<{
114
112
  type: z.ZodLiteral<"table">;
115
- columns: z.ZodArray<z.ZodNumber, "many">;
116
- pagination: z.ZodBoolean;
117
- rowsPerPage: z.ZodNumber;
118
- }, "strict", z.ZodTypeAny, {
119
- type: "table";
120
- columns: number[];
121
- pagination: boolean;
122
- rowsPerPage: number;
123
- }, {
124
- type: "table";
125
- columns: number[];
126
- pagination: boolean;
127
- rowsPerPage: number;
128
- }>, z.ZodObject<{
113
+ columns: z.ZodArray<z.ZodNumber>;
114
+ }, z.core.$strict>, z.ZodObject<{
129
115
  type: z.ZodLiteral<"range">;
130
- category: z.ZodArray<z.ZodNumber, "many">;
131
- value: z.ZodArray<z.ZodNumber, "many">;
132
- breakBy: z.ZodArray<z.ZodNumber, "many">;
133
- }, "strict", z.ZodTypeAny, {
134
- value: number[];
135
- type: "range";
136
- category: number[];
137
- breakBy: number[];
138
- }, {
139
- value: number[];
140
- type: "range";
141
- category: number[];
142
- breakBy: number[];
143
- }>, z.ZodObject<{
116
+ category: z.ZodArray<z.ZodNumber>;
117
+ value: z.ZodArray<z.ZodNumber>;
118
+ breakBy: z.ZodArray<z.ZodNumber>;
119
+ }, z.core.$strict>, z.ZodObject<{
144
120
  type: z.ZodLiteral<"indicator">;
145
- value: z.ZodArray<z.ZodNumber, "many">;
146
- secondary: z.ZodArray<z.ZodNumber, "many">;
147
- min: z.ZodArray<z.ZodNumber, "many">;
148
- max: z.ZodArray<z.ZodNumber, "many">;
149
- }, "strict", z.ZodTypeAny, {
150
- value: number[];
151
- type: "indicator";
152
- secondary: number[];
153
- min: number[];
154
- max: number[];
155
- }, {
156
- value: number[];
157
- type: "indicator";
158
- secondary: number[];
159
- min: number[];
160
- max: number[];
161
- }>, z.ZodObject<{
121
+ value: z.ZodArray<z.ZodNumber>;
122
+ secondary: z.ZodArray<z.ZodNumber>;
123
+ min: z.ZodArray<z.ZodNumber>;
124
+ max: z.ZodArray<z.ZodNumber>;
125
+ }, z.core.$strict>, z.ZodObject<{
162
126
  type: z.ZodLiteral<"boxplot">;
163
- category: z.ZodArray<z.ZodNumber, "many">;
164
- value: z.ZodArray<z.ZodNumber, "many">;
165
- boxType: z.ZodEnum<["iqr", "extremums", "standardDeviation"]>;
127
+ category: z.ZodArray<z.ZodNumber>;
128
+ value: z.ZodArray<z.ZodNumber>;
129
+ boxType: z.ZodEnum<{
130
+ iqr: "iqr";
131
+ extremums: "extremums";
132
+ standardDeviation: "standardDeviation";
133
+ }>;
166
134
  outliersEnabled: z.ZodBoolean;
167
- }, "strict", z.ZodTypeAny, {
168
- value: number[];
169
- type: "boxplot";
170
- category: number[];
171
- boxType: "iqr" | "extremums" | "standardDeviation";
172
- outliersEnabled: boolean;
173
- }, {
174
- value: number[];
175
- type: "boxplot";
176
- category: number[];
177
- boxType: "iqr" | "extremums" | "standardDeviation";
178
- outliersEnabled: boolean;
179
- }>, z.ZodObject<{
135
+ }, z.core.$strict>, z.ZodObject<{
180
136
  type: z.ZodLiteral<"areamap">;
181
- geo: z.ZodArray<z.ZodNumber, "many">;
182
- color: z.ZodArray<z.ZodNumber, "many">;
183
- }, "strict", z.ZodTypeAny, {
184
- type: "areamap";
185
- geo: number[];
186
- color: number[];
187
- }, {
188
- type: "areamap";
189
- geo: number[];
190
- color: number[];
191
- }>, z.ZodObject<{
137
+ geo: z.ZodArray<z.ZodNumber>;
138
+ color: z.ZodArray<z.ZodNumber>;
139
+ }, z.core.$strict>, z.ZodObject<{
192
140
  type: z.ZodLiteral<"scattermap">;
193
- geo: z.ZodArray<z.ZodNumber, "many">;
194
- size: z.ZodArray<z.ZodNumber, "many">;
195
- colorBy: z.ZodArray<z.ZodNumber, "many">;
196
- details: z.ZodArray<z.ZodNumber, "many">;
197
- locationLevel: z.ZodEnum<["auto", "country", "state", "city"]>;
198
- }, "strict", z.ZodTypeAny, {
199
- type: "scattermap";
200
- details: number[];
201
- size: number[];
202
- geo: number[];
203
- colorBy: number[];
204
- locationLevel: "auto" | "country" | "state" | "city";
205
- }, {
206
- type: "scattermap";
207
- details: number[];
208
- size: number[];
209
- geo: number[];
210
- colorBy: number[];
211
- locationLevel: "auto" | "country" | "state" | "city";
212
- }>]>;
213
- export declare const nullableChartType: z.ZodNullable<z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>>;
141
+ geo: z.ZodArray<z.ZodNumber>;
142
+ size: z.ZodArray<z.ZodNumber>;
143
+ colorBy: z.ZodArray<z.ZodNumber>;
144
+ details: z.ZodArray<z.ZodNumber>;
145
+ locationLevel: z.ZodEnum<{
146
+ auto: "auto";
147
+ country: "country";
148
+ state: "state";
149
+ city: "city";
150
+ }>;
151
+ }, z.core.$strict>]>;
152
+ export declare const nullableChartType: z.ZodNullable<z.ZodEnum<{
153
+ area: "area";
154
+ table: "table";
155
+ indicator: "indicator";
156
+ column: "column";
157
+ line: "line";
158
+ pie: "pie";
159
+ bar: "bar";
160
+ polar: "polar";
161
+ funnel: "funnel";
162
+ treemap: "treemap";
163
+ sunburst: "sunburst";
164
+ scatter: "scatter";
165
+ areamap: "areamap";
166
+ boxplot: "boxplot";
167
+ scattermap: "scattermap";
168
+ arearange: "arearange";
169
+ }>>;
214
170
  export declare const chartIdSchema: z.ZodDefault<z.ZodString>;
215
171
  export declare const queryIdSchema: z.ZodDefault<z.ZodNullable<z.ZodString>>;
216
172
  export declare const chartRecommendationsSchema: z.ZodObject<{
217
- chartType: z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>;
218
- axesMapping: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
219
- type: z.ZodEnum<["bar", "column", "area", "line", "polar"]>;
220
- category: z.ZodArray<z.ZodNumber, "many">;
221
- value: z.ZodArray<z.ZodNumber, "many">;
222
- breakBy: z.ZodArray<z.ZodNumber, "many">;
223
- }, "strict", z.ZodTypeAny, {
224
- value: number[];
225
- type: "area" | "column" | "line" | "bar" | "polar";
226
- category: number[];
227
- breakBy: number[];
228
- }, {
229
- value: number[];
230
- type: "area" | "column" | "line" | "bar" | "polar";
231
- category: number[];
232
- breakBy: number[];
233
- }>, z.ZodObject<{
234
- type: z.ZodEnum<["pie", "funnel", "treemap", "sunburst"]>;
235
- category: z.ZodArray<z.ZodNumber, "many">;
236
- value: z.ZodArray<z.ZodNumber, "many">;
237
- }, "strict", z.ZodTypeAny, {
238
- value: number[];
239
- type: "pie" | "funnel" | "treemap" | "sunburst";
240
- category: number[];
241
- }, {
242
- value: number[];
243
- type: "pie" | "funnel" | "treemap" | "sunburst";
244
- category: number[];
245
- }>, z.ZodObject<{
173
+ chartType: z.ZodEnum<{
174
+ area: "area";
175
+ table: "table";
176
+ indicator: "indicator";
177
+ column: "column";
178
+ line: "line";
179
+ pie: "pie";
180
+ bar: "bar";
181
+ polar: "polar";
182
+ funnel: "funnel";
183
+ treemap: "treemap";
184
+ sunburst: "sunburst";
185
+ scatter: "scatter";
186
+ areamap: "areamap";
187
+ boxplot: "boxplot";
188
+ scattermap: "scattermap";
189
+ arearange: "arearange";
190
+ }>;
191
+ axesMapping: z.ZodDiscriminatedUnion<[z.ZodObject<{
192
+ type: z.ZodEnum<{
193
+ area: "area";
194
+ column: "column";
195
+ line: "line";
196
+ bar: "bar";
197
+ polar: "polar";
198
+ }>;
199
+ category: z.ZodArray<z.ZodNumber>;
200
+ value: z.ZodArray<z.ZodNumber>;
201
+ breakBy: z.ZodArray<z.ZodNumber>;
202
+ }, z.core.$strict>, z.ZodObject<{
203
+ type: z.ZodEnum<{
204
+ pie: "pie";
205
+ funnel: "funnel";
206
+ treemap: "treemap";
207
+ sunburst: "sunburst";
208
+ }>;
209
+ category: z.ZodArray<z.ZodNumber>;
210
+ value: z.ZodArray<z.ZodNumber>;
211
+ }, z.core.$strict>, z.ZodObject<{
246
212
  type: z.ZodLiteral<"scatter">;
247
- x: z.ZodArray<z.ZodNumber, "many">;
248
- y: z.ZodArray<z.ZodNumber, "many">;
249
- breakByPoint: z.ZodArray<z.ZodNumber, "many">;
250
- breakByColor: z.ZodArray<z.ZodNumber, "many">;
251
- size: z.ZodArray<z.ZodNumber, "many">;
252
- }, "strict", z.ZodTypeAny, {
253
- type: "scatter";
254
- x: number[];
255
- y: number[];
256
- breakByPoint: number[];
257
- breakByColor: number[];
258
- size: number[];
259
- }, {
260
- type: "scatter";
261
- x: number[];
262
- y: number[];
263
- breakByPoint: number[];
264
- breakByColor: number[];
265
- size: number[];
266
- }>, z.ZodObject<{
213
+ x: z.ZodArray<z.ZodNumber>;
214
+ y: z.ZodArray<z.ZodNumber>;
215
+ breakByPoint: z.ZodArray<z.ZodNumber>;
216
+ breakByColor: z.ZodArray<z.ZodNumber>;
217
+ size: z.ZodArray<z.ZodNumber>;
218
+ }, z.core.$strict>, z.ZodObject<{
267
219
  type: z.ZodLiteral<"table">;
268
- columns: z.ZodArray<z.ZodNumber, "many">;
269
- pagination: z.ZodBoolean;
270
- rowsPerPage: z.ZodNumber;
271
- }, "strict", z.ZodTypeAny, {
272
- type: "table";
273
- columns: number[];
274
- pagination: boolean;
275
- rowsPerPage: number;
276
- }, {
277
- type: "table";
278
- columns: number[];
279
- pagination: boolean;
280
- rowsPerPage: number;
281
- }>, z.ZodObject<{
220
+ columns: z.ZodArray<z.ZodNumber>;
221
+ }, z.core.$strict>, z.ZodObject<{
282
222
  type: z.ZodLiteral<"range">;
283
- category: z.ZodArray<z.ZodNumber, "many">;
284
- value: z.ZodArray<z.ZodNumber, "many">;
285
- breakBy: z.ZodArray<z.ZodNumber, "many">;
286
- }, "strict", z.ZodTypeAny, {
287
- value: number[];
288
- type: "range";
289
- category: number[];
290
- breakBy: number[];
291
- }, {
292
- value: number[];
293
- type: "range";
294
- category: number[];
295
- breakBy: number[];
296
- }>, z.ZodObject<{
223
+ category: z.ZodArray<z.ZodNumber>;
224
+ value: z.ZodArray<z.ZodNumber>;
225
+ breakBy: z.ZodArray<z.ZodNumber>;
226
+ }, z.core.$strict>, z.ZodObject<{
297
227
  type: z.ZodLiteral<"indicator">;
298
- value: z.ZodArray<z.ZodNumber, "many">;
299
- secondary: z.ZodArray<z.ZodNumber, "many">;
300
- min: z.ZodArray<z.ZodNumber, "many">;
301
- max: z.ZodArray<z.ZodNumber, "many">;
302
- }, "strict", z.ZodTypeAny, {
303
- value: number[];
304
- type: "indicator";
305
- secondary: number[];
306
- min: number[];
307
- max: number[];
308
- }, {
309
- value: number[];
310
- type: "indicator";
311
- secondary: number[];
312
- min: number[];
313
- max: number[];
314
- }>, z.ZodObject<{
228
+ value: z.ZodArray<z.ZodNumber>;
229
+ secondary: z.ZodArray<z.ZodNumber>;
230
+ min: z.ZodArray<z.ZodNumber>;
231
+ max: z.ZodArray<z.ZodNumber>;
232
+ }, z.core.$strict>, z.ZodObject<{
315
233
  type: z.ZodLiteral<"boxplot">;
316
- category: z.ZodArray<z.ZodNumber, "many">;
317
- value: z.ZodArray<z.ZodNumber, "many">;
318
- boxType: z.ZodEnum<["iqr", "extremums", "standardDeviation"]>;
234
+ category: z.ZodArray<z.ZodNumber>;
235
+ value: z.ZodArray<z.ZodNumber>;
236
+ boxType: z.ZodEnum<{
237
+ iqr: "iqr";
238
+ extremums: "extremums";
239
+ standardDeviation: "standardDeviation";
240
+ }>;
319
241
  outliersEnabled: z.ZodBoolean;
320
- }, "strict", z.ZodTypeAny, {
321
- value: number[];
322
- type: "boxplot";
323
- category: number[];
324
- boxType: "iqr" | "extremums" | "standardDeviation";
325
- outliersEnabled: boolean;
326
- }, {
327
- value: number[];
328
- type: "boxplot";
329
- category: number[];
330
- boxType: "iqr" | "extremums" | "standardDeviation";
331
- outliersEnabled: boolean;
332
- }>, z.ZodObject<{
242
+ }, z.core.$strict>, z.ZodObject<{
333
243
  type: z.ZodLiteral<"areamap">;
334
- geo: z.ZodArray<z.ZodNumber, "many">;
335
- color: z.ZodArray<z.ZodNumber, "many">;
336
- }, "strict", z.ZodTypeAny, {
337
- type: "areamap";
338
- geo: number[];
339
- color: number[];
340
- }, {
341
- type: "areamap";
342
- geo: number[];
343
- color: number[];
344
- }>, z.ZodObject<{
244
+ geo: z.ZodArray<z.ZodNumber>;
245
+ color: z.ZodArray<z.ZodNumber>;
246
+ }, z.core.$strict>, z.ZodObject<{
345
247
  type: z.ZodLiteral<"scattermap">;
346
- geo: z.ZodArray<z.ZodNumber, "many">;
347
- size: z.ZodArray<z.ZodNumber, "many">;
348
- colorBy: z.ZodArray<z.ZodNumber, "many">;
349
- details: z.ZodArray<z.ZodNumber, "many">;
350
- locationLevel: z.ZodEnum<["auto", "country", "state", "city"]>;
351
- }, "strict", z.ZodTypeAny, {
352
- type: "scattermap";
353
- details: number[];
354
- size: number[];
355
- geo: number[];
356
- colorBy: number[];
357
- locationLevel: "auto" | "country" | "state" | "city";
358
- }, {
359
- type: "scattermap";
360
- details: number[];
361
- size: number[];
362
- geo: number[];
363
- colorBy: number[];
364
- locationLevel: "auto" | "country" | "state" | "city";
365
- }>]>;
366
- }, "strip", z.ZodTypeAny, {
367
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
368
- axesMapping: {
369
- value: number[];
370
- type: "area" | "column" | "line" | "bar" | "polar";
371
- category: number[];
372
- breakBy: number[];
373
- } | {
374
- value: number[];
375
- type: "pie" | "funnel" | "treemap" | "sunburst";
376
- category: number[];
377
- } | {
378
- type: "scatter";
379
- x: number[];
380
- y: number[];
381
- breakByPoint: number[];
382
- breakByColor: number[];
383
- size: number[];
384
- } | {
385
- type: "table";
386
- columns: number[];
387
- pagination: boolean;
388
- rowsPerPage: number;
389
- } | {
390
- value: number[];
391
- type: "range";
392
- category: number[];
393
- breakBy: number[];
394
- } | {
395
- value: number[];
396
- type: "indicator";
397
- secondary: number[];
398
- min: number[];
399
- max: number[];
400
- } | {
401
- value: number[];
402
- type: "boxplot";
403
- category: number[];
404
- boxType: "iqr" | "extremums" | "standardDeviation";
405
- outliersEnabled: boolean;
406
- } | {
407
- type: "areamap";
408
- geo: number[];
409
- color: number[];
410
- } | {
411
- type: "scattermap";
412
- details: number[];
413
- size: number[];
414
- geo: number[];
415
- colorBy: number[];
416
- locationLevel: "auto" | "country" | "state" | "city";
417
- };
418
- }, {
419
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
420
- axesMapping: {
421
- value: number[];
422
- type: "area" | "column" | "line" | "bar" | "polar";
423
- category: number[];
424
- breakBy: number[];
425
- } | {
426
- value: number[];
427
- type: "pie" | "funnel" | "treemap" | "sunburst";
428
- category: number[];
429
- } | {
430
- type: "scatter";
431
- x: number[];
432
- y: number[];
433
- breakByPoint: number[];
434
- breakByColor: number[];
435
- size: number[];
436
- } | {
437
- type: "table";
438
- columns: number[];
439
- pagination: boolean;
440
- rowsPerPage: number;
441
- } | {
442
- value: number[];
443
- type: "range";
444
- category: number[];
445
- breakBy: number[];
446
- } | {
447
- value: number[];
448
- type: "indicator";
449
- secondary: number[];
450
- min: number[];
451
- max: number[];
452
- } | {
453
- value: number[];
454
- type: "boxplot";
455
- category: number[];
456
- boxType: "iqr" | "extremums" | "standardDeviation";
457
- outliersEnabled: boolean;
458
- } | {
459
- type: "areamap";
460
- geo: number[];
461
- color: number[];
462
- } | {
463
- type: "scattermap";
464
- details: number[];
465
- size: number[];
466
- geo: number[];
467
- colorBy: number[];
468
- locationLevel: "auto" | "country" | "state" | "city";
469
- };
470
- }>;
248
+ geo: z.ZodArray<z.ZodNumber>;
249
+ size: z.ZodArray<z.ZodNumber>;
250
+ colorBy: z.ZodArray<z.ZodNumber>;
251
+ details: z.ZodArray<z.ZodNumber>;
252
+ locationLevel: z.ZodEnum<{
253
+ auto: "auto";
254
+ country: "country";
255
+ state: "state";
256
+ city: "city";
257
+ }>;
258
+ }, z.core.$strict>]>;
259
+ }, z.core.$strip>;
471
260
  /**
472
261
  * Canonical tool description for buildChart — reusable by any host (sdk-assistant, MCP server, custom integrations).
473
262
  * Hosts may append host-specific notes but should not duplicate or contradict this text.
474
263
  */
475
- export declare const buildChartToolDescription = "Creates or revises a chart from a natural language prompt.\n\nThree ways to scope the run (pass `userPrompt` unchanged in all cases):\n\n1. **New chart from scratch:** omit both `priorChartId` and `queryId` and describe the desired chart in `userPrompt`.\n2. **Revise an existing chart:** pass `priorChartId` (the chartId from a prior buildChart result, or the widget id when inside a dashboard). The chart's existing data context and style are preserved across revisions. Do not run other tools (e.g. query tool) when revising an existing chart.\n3. **Verbatim prior query:** pass `queryId` (an id from a prior data query result) to chart to reuse that query result if needed to not waste the prior query work.\n\nDo not pass both `priorChartId` and `queryId` \u2014 if both are set, `priorChartId` takes precedence.\n\nPass the user prompt exactly as received \u2014 do not transform or modify it.";
264
+ export declare const buildChartToolDescription = "Creates or revises a chart from a natural language prompt.\n\nRevising a chart includes updating the chart's data structure (data options), sorting, trend and forecast, style options, and filters. \n\nThree ways to scope the run:\n\n1. **New chart from scratch:** omit both `priorChartId` and `queryId` and describe the desired chart in `userPrompt`.\n2. **Revise an existing chart:** pass `priorChartId` (the chartId from a prior buildChart result, or the widget id when inside a dashboard). The chart's existing data context and style are preserved across revisions.\n3. **Verbatim prior query:** pass `queryId` (an id from a prior data query result) to chart to reuse that query result if needed to not waste the prior query work.\n\nWhen revising an existing chart, do not run other tools (e.g. query tool) and do not pass `queryId`.\n\nPass the user prompt exactly as received \u2014 do not transform or modify it.";
476
265
  export declare const buildChartSchema: z.ZodObject<{
477
266
  dataSourceTitle: z.ZodString;
478
267
  userPrompt: z.ZodString;
479
- priorChartId: z.ZodOptional<z.ZodString>;
268
+ priorChartId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
480
269
  queryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
481
- }, "strip", z.ZodTypeAny, {
482
- dataSourceTitle: string;
483
- userPrompt: string;
484
- priorChartId?: string | undefined;
485
- queryId?: string | null | undefined;
486
- }, {
487
- dataSourceTitle: string;
488
- userPrompt: string;
489
- priorChartId?: string | undefined;
490
- queryId?: string | null | undefined;
491
- }>;
270
+ }, z.core.$strip>;
492
271
  export declare const createChartSchema: z.ZodObject<{
493
272
  queryPrompt: z.ZodString;
494
273
  chartPrompt: z.ZodString;
495
- chartType: z.ZodNullable<z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>>;
274
+ chartType: z.ZodNullable<z.ZodEnum<{
275
+ area: "area";
276
+ table: "table";
277
+ indicator: "indicator";
278
+ column: "column";
279
+ line: "line";
280
+ pie: "pie";
281
+ bar: "bar";
282
+ polar: "polar";
283
+ funnel: "funnel";
284
+ treemap: "treemap";
285
+ sunburst: "sunburst";
286
+ scatter: "scatter";
287
+ areamap: "areamap";
288
+ boxplot: "boxplot";
289
+ scattermap: "scattermap";
290
+ arearange: "arearange";
291
+ }>>;
496
292
  chartTitle: z.ZodString;
497
293
  queryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
498
- }, "strip", z.ZodTypeAny, {
499
- queryPrompt: string;
500
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange" | null;
501
- queryId: string | null;
502
- chartPrompt: string;
503
- chartTitle: string;
504
- }, {
505
- queryPrompt: string;
506
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange" | null;
507
- chartPrompt: string;
508
- chartTitle: string;
509
- queryId?: string | null | undefined;
510
- }>;
294
+ }, z.core.$strip>;
511
295
  export declare const updateChartSchema: z.ZodObject<{
512
296
  userPrompt: z.ZodString;
513
- } & {
514
297
  chartId: z.ZodDefault<z.ZodString>;
515
- }, "strip", z.ZodTypeAny, {
516
- userPrompt: string;
517
- chartId: string;
518
- }, {
519
- userPrompt: string;
520
- chartId?: string | undefined;
521
- }>;
298
+ }, z.core.$strip>;
522
299
  export declare const updateChartTitleSchema: z.ZodObject<{
523
300
  userPrompt: z.ZodString;
524
- } & {
525
301
  chartId: z.ZodDefault<z.ZodString>;
526
- } & {
527
302
  chartTitle: z.ZodString;
528
- }, "strip", z.ZodTypeAny, {
529
- userPrompt: string;
530
- chartTitle: string;
531
- chartId: string;
532
- }, {
533
- userPrompt: string;
534
- chartTitle: string;
535
- chartId?: string | undefined;
536
- }>;
303
+ }, z.core.$strip>;
537
304
  export declare const updateChartTypeSchema: z.ZodObject<{
538
305
  userPrompt: z.ZodString;
539
- } & {
540
306
  chartId: z.ZodDefault<z.ZodString>;
541
- } & {
542
- chartType: z.ZodEnum<["bar", "column", "area", "line", "polar", "pie", "funnel", "treemap", "sunburst", "scatter", "table", "indicator", "boxplot", "areamap", "scattermap", "arearange"]>;
543
- }, "strip", z.ZodTypeAny, {
544
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
545
- userPrompt: string;
546
- chartId: string;
547
- }, {
548
- chartType: "area" | "table" | "indicator" | "column" | "line" | "pie" | "bar" | "polar" | "funnel" | "treemap" | "sunburst" | "scatter" | "areamap" | "boxplot" | "scattermap" | "arearange";
549
- userPrompt: string;
550
- chartId?: string | undefined;
551
- }>;
307
+ chartType: z.ZodEnum<{
308
+ area: "area";
309
+ table: "table";
310
+ indicator: "indicator";
311
+ column: "column";
312
+ line: "line";
313
+ pie: "pie";
314
+ bar: "bar";
315
+ polar: "polar";
316
+ funnel: "funnel";
317
+ treemap: "treemap";
318
+ sunburst: "sunburst";
319
+ scatter: "scatter";
320
+ areamap: "areamap";
321
+ boxplot: "boxplot";
322
+ scattermap: "scattermap";
323
+ arearange: "arearange";
324
+ }>;
325
+ }, z.core.$strip>;
552
326
  export declare const updateChartTypeOfMeasuresSchema: z.ZodObject<{
553
327
  userPrompt: z.ZodString;
554
- } & {
555
328
  chartId: z.ZodDefault<z.ZodString>;
556
- }, "strip", z.ZodTypeAny, {
557
- userPrompt: string;
558
- chartId: string;
559
- }, {
560
- userPrompt: string;
561
- chartId?: string | undefined;
562
- }>;
329
+ }, z.core.$strip>;
563
330
  export declare const updateChartSortingSchema: z.ZodObject<{
564
331
  userPrompt: z.ZodString;
565
- } & {
566
332
  chartId: z.ZodDefault<z.ZodString>;
567
- }, "strip", z.ZodTypeAny, {
568
- userPrompt: string;
569
- chartId: string;
570
- }, {
571
- userPrompt: string;
572
- chartId?: string | undefined;
573
- }>;
333
+ }, z.core.$strip>;
574
334
  export declare const updateTrendAndForecastSchema: z.ZodObject<{
575
335
  userPrompt: z.ZodString;
576
- } & {
577
336
  chartId: z.ZodDefault<z.ZodString>;
578
- }, "strip", z.ZodTypeAny, {
579
- userPrompt: string;
580
- chartId: string;
581
- }, {
582
- userPrompt: string;
583
- chartId?: string | undefined;
584
- }>;
337
+ }, z.core.$strip>;
585
338
  export declare const updateOtherChartDataOptionsSchema: z.ZodObject<{
586
339
  userPrompt: z.ZodString;
587
- } & {
588
340
  chartId: z.ZodDefault<z.ZodString>;
589
- }, "strip", z.ZodTypeAny, {
590
- userPrompt: string;
591
- chartId: string;
592
- }, {
593
- userPrompt: string;
594
- chartId?: string | undefined;
595
- }>;
341
+ }, z.core.$strip>;
596
342
  export declare const updateChartStyleOptionsSchema: z.ZodObject<{
597
343
  userPrompt: z.ZodString;
598
- } & {
599
344
  chartId: z.ZodDefault<z.ZodString>;
600
- }, "strip", z.ZodTypeAny, {
601
- userPrompt: string;
602
- chartId: string;
603
- }, {
604
- userPrompt: string;
605
- chartId?: string | undefined;
606
- }>;
345
+ }, z.core.$strip>;
607
346
  export declare const updateChartQuerySchema: z.ZodObject<{
608
347
  revisionPrompt: z.ZodString;
609
348
  chartId: z.ZodString;
610
- }, "strip", z.ZodTypeAny, {
611
- chartId: string;
612
- revisionPrompt: string;
613
- }, {
614
- chartId: string;
615
- revisionPrompt: string;
616
- }>;
349
+ }, z.core.$strip>;
617
350
  /**
618
351
  * Build chart context interface
619
352
  */
@@ -622,6 +355,7 @@ export interface BuildChartContext {
622
355
  * Tool call ID
623
356
  */
624
357
  toolCallId: string;
358
+ abortSignal?: AbortSignal;
625
359
  /**
626
360
  * Data source title (required)
627
361
  */
@@ -646,15 +380,13 @@ export interface BuildChartContext {
646
380
  * @returns The query result, or null if not found
647
381
  */
648
382
  retrieveQuery?: (queryId: string) => QueryResult | null;
649
- /** Whether NLQ V3 is enabled */
650
- isNlqV3Enabled?: boolean;
651
383
  /**
652
384
  * When false, incremental NLQ uses Layer-2 text augmentation instead of REST `chartState`.
653
385
  * Typically threaded from host config when available.
654
386
  */
655
387
  isNlqDeltaEnabled?: boolean;
656
388
  httpClient?: HttpClient;
657
- openAIClient?: OpenAI;
389
+ llmClient?: LanguageModel;
658
390
  /**
659
391
  * When true, include `dataset` on the returned {@link ChartSummary} when the saved chart
660
392
  * widget carries `dataset`.
@@ -662,5 +394,7 @@ export interface BuildChartContext {
662
394
  naturalResponseEnabled?: boolean;
663
395
  /** Common filters (e.g., from dashboard filters) to be applied to the query of the chart. */
664
396
  commonFilters?: unknown;
397
+ /** ID of a prior query result when this chart uses that query; otherwise null/undefined */
398
+ queryId?: string | null;
665
399
  }
666
400
  //# sourceMappingURL=types.d.ts.map