@sisense/sdk-ai-core 0.15.1 → 0.60.1

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 (169) hide show
  1. package/dist/__vite-browser-external-l0sNRNKZ.js +1 -0
  2. package/dist/constants.d.ts +36 -0
  3. package/dist/engines/atomic-handle-args.d.ts +45 -0
  4. package/dist/engines/atomic-tool-requirements.d.ts +38 -0
  5. package/dist/engines/author-pulse/actions/create.d.ts +9 -0
  6. package/dist/engines/author-pulse/actions/define.d.ts +9 -0
  7. package/dist/engines/author-pulse/actions/load-existing.d.ts +9 -0
  8. package/dist/engines/author-pulse/actions/redefine.d.ts +9 -0
  9. package/dist/engines/author-pulse/actions/set-receive-notifications.d.ts +8 -0
  10. package/dist/engines/author-pulse/actions/update-spec.d.ts +11 -0
  11. package/dist/engines/author-pulse/actions/update-workflow.d.ts +9 -0
  12. package/dist/engines/author-pulse/atomic-adapter.d.ts +10 -0
  13. package/dist/engines/author-pulse/atomic-tools.d.ts +362 -0
  14. package/dist/engines/author-pulse/author-pulse-engine.d.ts +21 -0
  15. package/dist/engines/author-pulse/index.d.ts +9 -0
  16. package/dist/engines/author-pulse/shared/adjustment-error.d.ts +15 -0
  17. package/dist/engines/author-pulse/shared/assemble-create-workflow-payload.d.ts +36 -0
  18. package/dist/engines/author-pulse/shared/assert-agentic-workflow.d.ts +12 -0
  19. package/dist/engines/author-pulse/shared/compile-query-from-prompt.d.ts +95 -0
  20. package/dist/engines/author-pulse/shared/decision-spec-validation.d.ts +84 -0
  21. package/dist/engines/author-pulse/shared/notification-urls.d.ts +52 -0
  22. package/dist/engines/author-pulse/shared/pulse-knowledge.d.ts +36 -0
  23. package/dist/engines/author-pulse/shared/pulse-signature.d.ts +39 -0
  24. package/dist/engines/author-pulse/shared/resolve-frequency.d.ts +18 -0
  25. package/dist/engines/author-pulse/shared/staging.d.ts +65 -0
  26. package/dist/engines/author-pulse/shared/workflow-ownership.d.ts +14 -0
  27. package/dist/engines/author-pulse/types.d.ts +1385 -0
  28. package/dist/engines/build-chart/atomic-adapter.d.ts +20 -0
  29. package/dist/engines/build-chart/atomic-tools.d.ts +214 -0
  30. package/dist/engines/build-chart/build-chart-engine.d.ts +1 -1
  31. package/dist/engines/build-chart/chart-tool-name.d.ts +3 -0
  32. package/dist/engines/build-chart/create-chart/assemble-chart-widget.d.ts +1 -1
  33. package/dist/engines/build-chart/create-chart/chart-json-axes-mapping.d.ts +1 -1
  34. package/dist/engines/build-chart/create-chart/create-chart.d.ts +1 -1
  35. package/dist/engines/build-chart/create-chart/derive-chart-title.d.ts +7 -0
  36. package/dist/engines/build-chart/create-chart/generate-chart-recommendations.d.ts +2 -2
  37. package/dist/engines/build-chart/create-chart/resolve-chart-query.d.ts +4 -0
  38. package/dist/engines/build-chart/shared/normalize-cartesian-axes-mapping.d.ts +1 -1
  39. package/dist/engines/build-chart/shared/sync-chart-state-measure-flags.d.ts +3 -0
  40. package/dist/engines/build-chart/types.d.ts +49 -19
  41. package/dist/engines/build-chart/update-chart/apply-prior-chart-style.d.ts +8 -5
  42. package/dist/engines/build-chart/update-chart/chart-options-schemas.d.ts +18 -18
  43. package/dist/engines/build-chart/update-chart/schemas.d.ts +2 -2
  44. package/dist/engines/build-chart/update-chart/update-chart-data-options.d.ts +7 -2
  45. package/dist/engines/build-chart/update-chart/update-chart-query.d.ts +1 -1
  46. package/dist/engines/build-chart/update-chart/update-chart-style-options.d.ts +7 -2
  47. package/dist/engines/build-chart/update-chart/update-chart-title.d.ts +1 -1
  48. package/dist/engines/build-chart/update-chart/update-chart-type.d.ts +7 -2
  49. package/dist/engines/build-csv-model/build-csv-model-engine.d.ts +1 -1
  50. package/dist/engines/build-csv-model/types.d.ts +1 -1
  51. package/dist/engines/build-dashboard/add-dashboard-narration.d.ts +50 -0
  52. package/dist/engines/build-dashboard/add-dashboard-widgets.d.ts +1 -1
  53. package/dist/engines/build-dashboard/atomic-adapter.d.ts +21 -0
  54. package/dist/engines/build-dashboard/atomic-tools.d.ts +231 -0
  55. package/dist/engines/build-dashboard/build-dashboard-engine.d.ts +1 -1
  56. package/dist/engines/build-dashboard/build-dashboard-service.d.ts +2 -1
  57. package/dist/engines/build-dashboard/create-dashboard.d.ts +3 -4
  58. package/dist/engines/build-dashboard/dashboard-filters/manipulate-dashboard-filters.d.ts +2 -1
  59. package/dist/engines/build-dashboard/dashboard-filters/translate-filters.d.ts +17 -1
  60. package/dist/engines/build-dashboard/index.d.ts +2 -0
  61. package/dist/engines/build-dashboard/layout/place-widget.d.ts +53 -0
  62. package/dist/engines/build-dashboard/load-existing-fusion-dashboard.d.ts +1 -1
  63. package/dist/engines/build-dashboard/remove-dashboard-widgets.d.ts +4 -0
  64. package/dist/engines/build-dashboard/resolve-chart-widgets.d.ts +16 -0
  65. package/dist/engines/build-dashboard/types.d.ts +180 -18
  66. package/dist/engines/build-data-model/build-data-model-engine.d.ts +1 -1
  67. package/dist/engines/build-data-model/types.d.ts +1 -1
  68. package/dist/engines/build-query/build-query-engine.d.ts +33 -5
  69. package/dist/engines/build-query/index.d.ts +1 -1
  70. package/dist/engines/build-query/types.d.ts +216 -3
  71. package/dist/engines/build-status/build-status-engine.d.ts +8 -0
  72. package/dist/engines/build-status/builds-client.d.ts +44 -0
  73. package/dist/engines/build-status/index.d.ts +2 -0
  74. package/dist/engines/build-status/types.d.ts +177 -0
  75. package/dist/engines/datamodel-graph/data-model-map-text.d.ts +28 -0
  76. package/dist/engines/datamodel-graph/datamodel-graph-engine.d.ts +31 -0
  77. package/dist/engines/datamodel-graph/index.d.ts +4 -0
  78. package/dist/engines/datamodel-graph/summaries.d.ts +97 -0
  79. package/dist/engines/datamodel-graph/test-fixtures.d.ts +42 -0
  80. package/dist/engines/datamodel-graph/types.d.ts +190 -0
  81. package/dist/engines/evaluate-pulse/evaluate-pulse-engine.d.ts +10 -0
  82. package/dist/engines/evaluate-pulse/index.d.ts +2 -0
  83. package/dist/engines/evaluate-pulse/types.d.ts +85 -0
  84. package/dist/engines/get-dashboard-narration/get-dashboard-narration-engine.d.ts +23 -0
  85. package/dist/engines/get-dashboard-narration/index.d.ts +2 -0
  86. package/dist/engines/get-dashboard-narration/types.d.ts +64 -0
  87. package/dist/engines/get-dashboards/get-dashboards-engine.d.ts +1 -1
  88. package/dist/engines/get-dashboards/types.d.ts +16 -4
  89. package/dist/engines/get-data-preview/get-data-preview-engine.d.ts +18 -0
  90. package/dist/engines/get-data-preview/index.d.ts +2 -0
  91. package/dist/engines/get-data-preview/types.d.ts +35 -0
  92. package/dist/engines/get-data-source-fields/get-data-source-fields-engine.d.ts +12 -6
  93. package/dist/engines/get-data-source-fields/index.d.ts +1 -0
  94. package/dist/engines/get-data-source-fields/model-relations.d.ts +38 -0
  95. package/dist/engines/get-data-source-fields/types.d.ts +53 -3
  96. package/dist/engines/get-data-sources/get-data-sources-engine.d.ts +1 -1
  97. package/dist/engines/get-data-sources/types.d.ts +2 -2
  98. package/dist/engines/index.d.ts +17 -0
  99. package/dist/engines/inspect-pulse/atomic-adapter.d.ts +8 -0
  100. package/dist/engines/inspect-pulse/atomic-tools.d.ts +60 -0
  101. package/dist/engines/inspect-pulse/index.d.ts +4 -0
  102. package/dist/engines/inspect-pulse/inspect-pulse-engine.d.ts +7 -0
  103. package/dist/engines/inspect-pulse/types.d.ts +209 -0
  104. package/dist/engines/manage-perspectives/manage-perspectives-engine.d.ts +5 -1
  105. package/dist/engines/manage-perspectives/types.d.ts +13 -8
  106. package/dist/engines/pulse-tool-words.d.ts +62 -0
  107. package/dist/engines/recommend-queries/recommend-queries-engine.d.ts +1 -1
  108. package/dist/engines/recommend-queries/types.d.ts +1 -1
  109. package/dist/engines/shared/existing-answer-cascade.d.ts +52 -0
  110. package/dist/engines/shared/get-filters-json-for-llm-summary.d.ts +2 -2
  111. package/dist/engines/shared/nlq-query-helpers.d.ts +2 -2
  112. package/dist/engines/shared/project-dashboard-json.d.ts +151 -0
  113. package/dist/engines/shared/project-widget-json.d.ts +67 -0
  114. package/dist/engines/shared/projection-helpers.d.ts +19 -0
  115. package/dist/engines/shared/redact-data-models-closed-to-ai.d.ts +55 -0
  116. package/dist/engines/shared/redact-hidden-columns-from-ai.d.ts +55 -0
  117. package/dist/index.d.ts +21 -0
  118. package/dist/index.js +56879 -27530
  119. package/dist/services/ai-access/ai-access-service.d.ts +68 -0
  120. package/dist/services/dashboards/dashboards-service.d.ts +9 -3
  121. package/dist/services/dashboards/fusion-dashboards-service.d.ts +34 -4
  122. package/dist/services/data-sources/data-sources-service.d.ts +149 -5
  123. package/dist/services/data-sources/find-data-source-by-title.d.ts +8 -0
  124. package/dist/services/datamodel-graph/datamodel-graph-service.d.ts +457 -0
  125. package/dist/services/existing-answer/existing-answer-query-service.d.ts +31 -0
  126. package/dist/services/formulas/formulas-service.d.ts +19 -0
  127. package/dist/services/hide-from-ai/hide-from-ai.d.ts +31 -0
  128. package/dist/services/knowledge-graph/knowledge-graph-service.d.ts +96 -0
  129. package/dist/services/llm/llm-consumption-service.d.ts +7 -2
  130. package/dist/services/llm/llm-models-service.d.ts +10 -2
  131. package/dist/services/llm/llm-settings-service.d.ts +73 -0
  132. package/dist/services/nlq/nlq-preview-dataset.d.ts +34 -0
  133. package/dist/services/nlq/nlq-service.d.ts +138 -3
  134. package/dist/services/pulse/evaluate-pulse-client.d.ts +78 -0
  135. package/dist/services/pulse/pulse-alerts-service.d.ts +264 -0
  136. package/dist/services/pulse/pulse-events-service.d.ts +217 -0
  137. package/dist/services/semantic-search/semantic-search-service.d.ts +43 -0
  138. package/dist/services/tool-store/tool-store-service.d.ts +32 -0
  139. package/dist/services/users-groups-service.d.ts +37 -0
  140. package/dist/skills/index.d.ts +127 -0
  141. package/dist/tool-availability/controlled-tools.d.ts +56 -0
  142. package/dist/tool-availability/index.d.ts +4 -0
  143. package/dist/tool-availability/offer-tools.d.ts +44 -0
  144. package/dist/tool-availability/resolve-tool-availability.d.ts +68 -0
  145. package/dist/tool-availability/withdrawn-text.d.ts +33 -0
  146. package/dist/tool-catalog/catalog.d.ts +387 -0
  147. package/dist/tool-catalog/index.d.ts +3 -0
  148. package/dist/tool-catalog/manifest.d.ts +5 -0
  149. package/dist/tool-catalog/prototype-lookup.d.ts +10 -0
  150. package/dist/tool-catalog/types.d.ts +67 -0
  151. package/dist/tools.manifest.json +826 -0
  152. package/dist/utils/chat-stream-errors.d.ts +42 -0
  153. package/dist/utils/create-custom-fetch.d.ts +19 -1
  154. package/dist/utils/create-stream-completion.d.ts +84 -6
  155. package/dist/utils/create-structured-completion.d.ts +29 -2
  156. package/dist/utils/create-tools-completion.d.ts +9 -0
  157. package/dist/utils/deferred-tools.d.ts +45 -0
  158. package/dist/utils/dev-debug.d.ts +5 -0
  159. package/dist/utils/generate-suggestions.d.ts +32 -0
  160. package/dist/utils/http-client.d.ts +3 -1
  161. package/dist/utils/llm-call-observer.d.ts +83 -0
  162. package/dist/utils/llm-client.d.ts +11 -1
  163. package/dist/utils/llm-model-override.d.ts +41 -0
  164. package/dist/utils/quoted-text.d.ts +6 -0
  165. package/dist/utils/server-error-body.d.ts +23 -0
  166. package/dist/utils/text-tokens.d.ts +35 -0
  167. package/dist/utils/user-action-tracking.d.ts +48 -5
  168. package/dist/utils/zod-utils.d.ts +9 -1
  169. package/package.json +28 -18
@@ -0,0 +1,20 @@
1
+ import { AtomicChartToolName } from './atomic-tools';
2
+ import { BuildChartContext, ChartSummary } from './types';
3
+ /**
4
+ * What an atomic chart tool needs from its host: the `buildChart` context, with `dataSourceTitle`
5
+ * optional because only `createWidget` and `rebindWidgetQuery` take it as an argument.
6
+ */
7
+ export type AtomicChartContext = Omit<BuildChartContext, 'dataSourceTitle'> & {
8
+ dataSourceTitle?: string;
9
+ };
10
+ /**
11
+ * Adapter from an atomic chart tool to the composite `buildChart` engine (SNS-135308): it accepts the
12
+ * tool's flat arguments, validates them, turns them into the matching `buildChart` action and runs
13
+ * the existing engine. The tools differ from the composite only in the shape of their input, so
14
+ * both do exactly the same work and the engine and its handlers stay the single implementation.
15
+ *
16
+ * `dataSourceTitle` comes from the arguments, else the context, else the chart being revised; a
17
+ * tool that has none of them reports an empty title in its summary, which no step of the action reads.
18
+ * LLM calls made for the action are attributed to the atomic tool's name unless the host sets one.
19
+ */
20
+ export declare function atomicChartAdapter(toolName: AtomicChartToolName, args: unknown, context: AtomicChartContext): Promise<ChartSummary>;
@@ -0,0 +1,214 @@
1
+ import { z } from 'zod';
2
+ import { ArgRenames } from '../atomic-handle-args';
3
+ export declare const createWidgetToolDescription = "Creates a new widget from a prior buildQuery result; today a widget is always a chart. Call buildQuery first and pass its queryId. Returns a widgetId, which the widget-editing tools and the dashboard tools take.";
4
+ export declare const updateWidgetTitleToolDescription = "Renames a chart built earlier in this conversation. Takes the widgetId from the latest successful widget tool result.";
5
+ export declare const updateChartTypeToolDescription = "Changes the chart type of a chart built earlier in this conversation (for example column to line), keeping its data. Takes the widgetId from the latest successful widget tool result.";
6
+ export declare const rebindWidgetQueryToolDescription = "Points a chart built earlier in this conversation at new data. Call buildQuery first and pass its new queryId. Takes the widgetId from the latest successful widget tool result.";
7
+ export declare const updateWidgetSortingToolDescription = "Changes how a chart's data is sorted, from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
8
+ export declare const updateChartTrendForecastToolDescription = "Adds, changes or removes a measure's trend line or forecast on a chart, from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
9
+ export declare const updateWidgetStyleToolDescription = "Changes a chart's legend, labels and axis chrome (for example moving the legend, an axis title, or enabling the secondary axis), from a natural-language description. Not for colors: series, bar, line and slice colors use updateWidgetDataOptions. Takes the widgetId from the latest successful widget tool result.";
10
+ export declare const updateWidgetDataOptionsToolDescription = "Edits a chart's data options, including ALL colors (line, bar, series and slice colors, seriesToColorMap, measure color), showing a measure on the right axis, and related mapping, from a natural-language description. Use this rather than updateWidgetStyle whenever a color changes. Takes the widgetId from the latest successful widget tool result.";
11
+ export declare const updateChartMeasureTypesToolDescription = "Sets the chart type of individual measures in a combo chart (for example one measure drawn as a line over columns), from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
12
+ export declare const createWidgetToolSchema: z.ZodObject<{
13
+ dataSourceTitle: z.ZodString;
14
+ queryId: z.ZodString;
15
+ chartType: z.ZodEnum<{
16
+ area: "area";
17
+ table: "table";
18
+ column: "column";
19
+ indicator: "indicator";
20
+ line: "line";
21
+ pie: "pie";
22
+ bar: "bar";
23
+ polar: "polar";
24
+ funnel: "funnel";
25
+ treemap: "treemap";
26
+ sunburst: "sunburst";
27
+ scatter: "scatter";
28
+ areamap: "areamap";
29
+ boxplot: "boxplot";
30
+ scattermap: "scattermap";
31
+ arearange: "arearange";
32
+ }>;
33
+ title: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ export declare const updateWidgetTitleToolSchema: z.ZodObject<{
36
+ priorWidgetId: z.ZodString;
37
+ title: z.ZodString;
38
+ }, z.core.$strip>;
39
+ export declare const updateChartTypeToolSchema: z.ZodObject<{
40
+ priorWidgetId: z.ZodString;
41
+ chartType: z.ZodEnum<{
42
+ area: "area";
43
+ table: "table";
44
+ column: "column";
45
+ indicator: "indicator";
46
+ line: "line";
47
+ pie: "pie";
48
+ bar: "bar";
49
+ polar: "polar";
50
+ funnel: "funnel";
51
+ treemap: "treemap";
52
+ sunburst: "sunburst";
53
+ scatter: "scatter";
54
+ areamap: "areamap";
55
+ boxplot: "boxplot";
56
+ scattermap: "scattermap";
57
+ arearange: "arearange";
58
+ }>;
59
+ }, z.core.$strip>;
60
+ export declare const rebindWidgetQueryToolSchema: z.ZodObject<{
61
+ dataSourceTitle: z.ZodString;
62
+ priorWidgetId: z.ZodString;
63
+ queryId: z.ZodString;
64
+ }, z.core.$strip>;
65
+ export declare const updateWidgetSortingToolSchema: z.ZodObject<{
66
+ priorWidgetId: z.ZodString;
67
+ userPrompt: z.ZodString;
68
+ }, z.core.$strip>;
69
+ export declare const updateChartTrendForecastToolSchema: z.ZodObject<{
70
+ priorWidgetId: z.ZodString;
71
+ userPrompt: z.ZodString;
72
+ }, z.core.$strip>;
73
+ export declare const updateWidgetStyleToolSchema: z.ZodObject<{
74
+ priorWidgetId: z.ZodString;
75
+ userPrompt: z.ZodString;
76
+ }, z.core.$strip>;
77
+ export declare const updateWidgetDataOptionsToolSchema: z.ZodObject<{
78
+ priorWidgetId: z.ZodString;
79
+ userPrompt: z.ZodString;
80
+ }, z.core.$strip>;
81
+ export declare const updateChartMeasureTypesToolSchema: z.ZodObject<{
82
+ priorWidgetId: z.ZodString;
83
+ userPrompt: z.ZodString;
84
+ }, z.core.$strip>;
85
+ /** One atomic chart tool: its name, the `buildChart` action it stands for, and what the model sees. */
86
+ export interface AtomicChartTool {
87
+ name: string;
88
+ /** The `action.type` of the composite `buildChart` tool this operation corresponds to. */
89
+ actionType: string;
90
+ description: string;
91
+ inputSchema: z.ZodObject<Record<string, z.ZodType>>;
92
+ /** Argument names that differ from the composite action's; the adapter maps them back. */
93
+ argRenames?: ArgRenames;
94
+ }
95
+ /** In the order the composite tool's actions are documented. */
96
+ export declare const ATOMIC_CHART_TOOLS: readonly [{
97
+ readonly name: "createWidget";
98
+ readonly actionType: "create";
99
+ readonly description: "Creates a new widget from a prior buildQuery result; today a widget is always a chart. Call buildQuery first and pass its queryId. Returns a widgetId, which the widget-editing tools and the dashboard tools take.";
100
+ readonly inputSchema: z.ZodObject<{
101
+ dataSourceTitle: z.ZodString;
102
+ queryId: z.ZodString;
103
+ chartType: z.ZodEnum<{
104
+ area: "area";
105
+ table: "table";
106
+ column: "column";
107
+ indicator: "indicator";
108
+ line: "line";
109
+ pie: "pie";
110
+ bar: "bar";
111
+ polar: "polar";
112
+ funnel: "funnel";
113
+ treemap: "treemap";
114
+ sunburst: "sunburst";
115
+ scatter: "scatter";
116
+ areamap: "areamap";
117
+ boxplot: "boxplot";
118
+ scattermap: "scattermap";
119
+ arearange: "arearange";
120
+ }>;
121
+ title: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>;
123
+ }, {
124
+ readonly name: "updateWidgetTitle";
125
+ readonly actionType: "update-title";
126
+ readonly description: "Renames a chart built earlier in this conversation. Takes the widgetId from the latest successful widget tool result.";
127
+ readonly inputSchema: z.ZodObject<{
128
+ priorWidgetId: z.ZodString;
129
+ title: z.ZodString;
130
+ }, z.core.$strip>;
131
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
132
+ }, {
133
+ readonly name: "updateChartType";
134
+ readonly actionType: "update-type";
135
+ readonly description: "Changes the chart type of a chart built earlier in this conversation (for example column to line), keeping its data. Takes the widgetId from the latest successful widget tool result.";
136
+ readonly inputSchema: z.ZodObject<{
137
+ priorWidgetId: z.ZodString;
138
+ chartType: z.ZodEnum<{
139
+ area: "area";
140
+ table: "table";
141
+ column: "column";
142
+ indicator: "indicator";
143
+ line: "line";
144
+ pie: "pie";
145
+ bar: "bar";
146
+ polar: "polar";
147
+ funnel: "funnel";
148
+ treemap: "treemap";
149
+ sunburst: "sunburst";
150
+ scatter: "scatter";
151
+ areamap: "areamap";
152
+ boxplot: "boxplot";
153
+ scattermap: "scattermap";
154
+ arearange: "arearange";
155
+ }>;
156
+ }, z.core.$strip>;
157
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
158
+ }, {
159
+ readonly name: "rebindWidgetQuery";
160
+ readonly actionType: "rebind-query";
161
+ readonly description: "Points a chart built earlier in this conversation at new data. Call buildQuery first and pass its new queryId. Takes the widgetId from the latest successful widget tool result.";
162
+ readonly inputSchema: z.ZodObject<{
163
+ dataSourceTitle: z.ZodString;
164
+ priorWidgetId: z.ZodString;
165
+ queryId: z.ZodString;
166
+ }, z.core.$strip>;
167
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
168
+ }, {
169
+ readonly name: "updateWidgetSorting";
170
+ readonly actionType: "update-sorting";
171
+ readonly description: "Changes how a chart's data is sorted, from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
172
+ readonly inputSchema: z.ZodObject<{
173
+ priorWidgetId: z.ZodString;
174
+ userPrompt: z.ZodString;
175
+ }, z.core.$strip>;
176
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
177
+ }, {
178
+ readonly name: "updateChartTrendForecast";
179
+ readonly actionType: "update-trend-forecast";
180
+ readonly description: "Adds, changes or removes a measure's trend line or forecast on a chart, from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
181
+ readonly inputSchema: z.ZodObject<{
182
+ priorWidgetId: z.ZodString;
183
+ userPrompt: z.ZodString;
184
+ }, z.core.$strip>;
185
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
186
+ }, {
187
+ readonly name: "updateWidgetStyle";
188
+ readonly actionType: "update-style";
189
+ readonly description: "Changes a chart's legend, labels and axis chrome (for example moving the legend, an axis title, or enabling the secondary axis), from a natural-language description. Not for colors: series, bar, line and slice colors use updateWidgetDataOptions. Takes the widgetId from the latest successful widget tool result.";
190
+ readonly inputSchema: z.ZodObject<{
191
+ priorWidgetId: z.ZodString;
192
+ userPrompt: z.ZodString;
193
+ }, z.core.$strip>;
194
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
195
+ }, {
196
+ readonly name: "updateWidgetDataOptions";
197
+ readonly actionType: "update-data-options";
198
+ readonly description: "Edits a chart's data options, including ALL colors (line, bar, series and slice colors, seriesToColorMap, measure color), showing a measure on the right axis, and related mapping, from a natural-language description. Use this rather than updateWidgetStyle whenever a color changes. Takes the widgetId from the latest successful widget tool result.";
199
+ readonly inputSchema: z.ZodObject<{
200
+ priorWidgetId: z.ZodString;
201
+ userPrompt: z.ZodString;
202
+ }, z.core.$strip>;
203
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
204
+ }, {
205
+ readonly name: "updateChartMeasureTypes";
206
+ readonly actionType: "update-measure-chart-types";
207
+ readonly description: "Sets the chart type of individual measures in a combo chart (for example one measure drawn as a line over columns), from a natural-language description. Takes the widgetId from the latest successful widget tool result.";
208
+ readonly inputSchema: z.ZodObject<{
209
+ priorWidgetId: z.ZodString;
210
+ userPrompt: z.ZodString;
211
+ }, z.core.$strip>;
212
+ readonly argRenames: Readonly<Record<string, import('../atomic-handle-args').ArgRename>>;
213
+ }];
214
+ export type AtomicChartToolName = (typeof ATOMIC_CHART_TOOLS)[number]['name'];
@@ -1,3 +1,3 @@
1
1
  import { ChartSummary, BuildChartContext, buildChartSchema } from './types';
2
- import { default as z } from 'zod/v4';
2
+ import { default as z } from 'zod';
3
3
  export declare function buildChartEngine(params: z.infer<typeof buildChartSchema>, context: BuildChartContext): Promise<ChartSummary>;
@@ -0,0 +1,3 @@
1
+ import { BuildChartContext } from './types';
2
+ /** `x-tool-name` for a chart run: the calling tool's, else `buildChart`. */
3
+ export declare const chartToolName: (context: Pick<BuildChartContext, "toolName">) => string;
@@ -2,7 +2,7 @@ import { ChartType } from '@sisense/sdk-ui';
2
2
  import { DataOptionsJSON } from '@sisense/sdk-ui/analytics-composer';
3
3
  import { ColumnJSON, ExtendedChartWidgetProps, axesMappingSchema as axesMappingSchema } from '../types';
4
4
  import { QueryExecutionResult } from '../../../services/nlq/nlq-service';
5
- import { z } from 'zod/v4';
5
+ import { z } from 'zod';
6
6
  export type AssembleChartWidgetParams = {
7
7
  nlqResult: QueryExecutionResult;
8
8
  chartType: ChartType;
@@ -1,6 +1,6 @@
1
1
  import { ChartJSON, DataOptionsJSON } from '@sisense/sdk-ui/analytics-composer';
2
2
  import { QueryState } from '../../../services/nlq/nlq-service';
3
- import { z } from 'zod/v4';
3
+ import { z } from 'zod';
4
4
  import { axesMappingSchema } from '../types';
5
5
  /**
6
6
  * Axes whose data-options entry is a single item rather than an array.
@@ -1,5 +1,5 @@
1
1
  import { BuildChartContext, createChartSchema } from '../types';
2
- import { default as z } from 'zod/v4';
2
+ import { default as z } from 'zod';
3
3
  export declare const createChart: ({ queryPrompt, chartPrompt, chartType, chartTitle, queryId, }: z.infer<typeof createChartSchema>, context: BuildChartContext) => Promise<{
4
4
  message: string;
5
5
  chartState: import('../../..').ChartState;
@@ -0,0 +1,7 @@
1
+ import { QueryState } from '../../../services/nlq/nlq-service';
2
+ /**
3
+ * A readable title for a chart whose query has none, built from the query's own columns, for
4
+ * example "Total Revenue by Brand". Never the prompt: a prompt is an instruction, not a title.
5
+ * Returns '' when the query has no readable measure or dimension.
6
+ */
7
+ export declare const deriveChartTitle: (queryState: QueryState) => string;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { ChartType } from '@sisense/sdk-ui';
3
3
  import { chartRecommendationsSchema, ColumnSummary } from '../types';
4
4
  import { LanguageModel } from 'ai';
@@ -6,4 +6,4 @@ import { LanguageModel } from 'ai';
6
6
  * Returns LLM chart type and axes mapping as raw numeric index arrays.
7
7
  * Column array order defines axis indices; `id` is assigned from position.
8
8
  */
9
- export declare const generateChartRecommendations: (userPrompt: string, columns: ColumnSummary[] | undefined, chartType: ChartType | undefined, llmClient?: LanguageModel) => Promise<z.infer<typeof chartRecommendationsSchema>>;
9
+ export declare const generateChartRecommendations: (userPrompt: string, columns: ColumnSummary[] | undefined, chartType: ChartType | undefined, llmClient?: LanguageModel, toolName?: string) => Promise<z.infer<typeof chartRecommendationsSchema>>;
@@ -7,4 +7,8 @@ export type ResolveChartQueryParams = {
7
7
  queryId?: string | null;
8
8
  priorQueryState?: QueryState;
9
9
  };
10
+ /**
11
+ * The returned `title` is the query's own generated title, '' when it has none. A prompt is an
12
+ * instruction, never a title, so `queryPrompt` only drives a fresh query and is not a fallback.
13
+ */
10
14
  export declare const resolveChartQuery: ({ dataSourceTitle, queryPrompt, queryId, priorQueryState, }: ResolveChartQueryParams, context: BuildChartContext) => Promise<QueryResult>;
@@ -1,4 +1,4 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { axesMappingSchema, ColumnJSON } from '../types';
3
3
  /**
4
4
  * For cartesian charts, moves measure column indices mistakenly placed in breakBy
@@ -1,8 +1,10 @@
1
1
  import { ChartDataOptions, StyledMeasureColumn } from '@sisense/sdk-ui';
2
2
  import { BaseChartSummary } from '../types';
3
+ type SortType = 'sortAsc' | 'sortDesc' | 'sortNone';
3
4
  export type MeasurePresentationFlags = {
4
5
  showOnRightAxis?: boolean;
5
6
  color?: StyledMeasureColumn['color'];
7
+ sortType?: SortType;
6
8
  };
7
9
  /**
8
10
  * Snapshots per-measure presentation flags before translateChartToJSON, which
@@ -19,3 +21,4 @@ export declare function restoreCartesianMeasureFlags(dataOptions: ChartDataOptio
19
21
  * after translateChartToJSON, which can drop showOnRightAxis from the summary.
20
22
  */
21
23
  export declare function syncChartStateMeasureFlagsFromDataOptions(chartState: BaseChartSummary, dataOptions: ChartDataOptions | undefined): BaseChartSummary;
24
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ChartType, ChartWidgetProps, WithCommonWidgetProps } from '@sisense/sdk-ui';
2
2
  import { HttpClient } from '@sisense/sdk-rest-client';
3
- import { z } from 'zod/v4';
3
+ import { z } from 'zod';
4
4
  import { QueryResult } from '../build-query/types';
5
5
  import { ChartState, Dataset, QueryState } from '../../services/nlq/nlq-service';
6
6
  import { LanguageModel } from 'ai';
@@ -63,11 +63,22 @@ export interface ColumnSummary {
63
63
  name: string;
64
64
  type?: string;
65
65
  }
66
+ /**
67
+ * Chart types whose axesMapping has a `breakBy` array meaning "no series
68
+ * breakdown" when empty (cartesianChartSchema + rangeChartSchema). Models
69
+ * (esp. under Bedrock JSON mode, without native structured-output
70
+ * enforcement) sometimes omit this key entirely rather than sending `[]` —
71
+ * used to default it in before the resulting dataOptions reach the chart
72
+ * widget, whose own runtime validator expects the key to be present.
73
+ */
74
+ export declare const BREAK_BY_CHART_TYPES: Set<string>;
75
+ /** Chart types whose axesMapping has breakByPoint/breakByColor (scatterChartSchema). */
76
+ export declare const BREAK_BY_POINT_COLOR_CHART_TYPES: Set<string>;
66
77
  export declare const chartType: z.ZodEnum<{
67
78
  area: "area";
68
79
  table: "table";
69
- indicator: "indicator";
70
80
  column: "column";
81
+ indicator: "indicator";
71
82
  line: "line";
72
83
  pie: "pie";
73
84
  bar: "bar";
@@ -148,12 +159,12 @@ export declare const axesMappingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
148
159
  state: "state";
149
160
  city: "city";
150
161
  }>;
151
- }, z.core.$strict>]>;
162
+ }, z.core.$strict>], "type">;
152
163
  export declare const nullableChartType: z.ZodNullable<z.ZodEnum<{
153
164
  area: "area";
154
165
  table: "table";
155
- indicator: "indicator";
156
166
  column: "column";
167
+ indicator: "indicator";
157
168
  line: "line";
158
169
  pie: "pie";
159
170
  bar: "bar";
@@ -173,8 +184,8 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
173
184
  chartType: z.ZodEnum<{
174
185
  area: "area";
175
186
  table: "table";
176
- indicator: "indicator";
177
187
  column: "column";
188
+ indicator: "indicator";
178
189
  line: "line";
179
190
  pie: "pie";
180
191
  bar: "bar";
@@ -255,13 +266,28 @@ export declare const chartRecommendationsSchema: z.ZodObject<{
255
266
  state: "state";
256
267
  city: "city";
257
268
  }>;
258
- }, z.core.$strict>]>;
269
+ }, z.core.$strict>], "type">;
259
270
  }, z.core.$strip>;
271
+ /**
272
+ * Recommendations schema for a single chart-recommendation request. When the
273
+ * caller already knows the chart type, the `axesMapping` discriminated union is
274
+ * collapsed to the one relevant variant. This keeps the compiled JSON-schema
275
+ * grammar small enough for Bedrock Claude's native structured output
276
+ * (`Output.object`), which otherwise rejects the full 9-variant union with
277
+ * "compiled grammar too large" (a 422) and silently degrades every BYOK
278
+ * chart-recommendation call to unenforced plain-text generation — see SNS-132195
279
+ * (and the related grammar-size note on cartesianChartSchema, SNS-131599).
280
+ * Falls back to the full union for an unknown/unset type, where the model must
281
+ * pick the chart type itself.
282
+ */
283
+ export declare function chartRecommendationsSchemaFor(selectedChartType: ChartType | null | undefined): z.ZodSchema<z.infer<typeof chartRecommendationsSchema>>;
260
284
  /**
261
285
  * Canonical tool description for buildChart — reusable by any host (sdk-assistant, MCP server, custom integrations).
262
286
  * Hosts may append host-specific notes but should not duplicate or contradict this text.
263
287
  */
264
- export declare const buildChartToolDescription = "Creates or revises a chart via a required structured `action` param. For new data, call buildQuery first. Load the buildChart skill via loadSkill before calling this tool \u2014 the skill documents all action types and when to use each. Hosts may append UI notes (e.g. showCanvas).";
288
+ export declare const buildChartToolDescription = "Creates or revises a chart via a required structured `action` object (not a JSON string). For new data, call buildQuery first. Example: action: { type: \"create\", queryId, chartType }. Load the buildChart skill via loadSkill before calling \u2014 it documents all action types. Series/bar/line/slice colors use action.type update-data-options (not update-style). update-style is legend/labels/axis chrome only. Hosts may append UI notes (e.g. showCanvas).";
289
+ /** Shared by every create-time `title` field: it is a user-requested override, not a required label. */
290
+ export declare const OPTIONAL_CHART_TITLE_DESCRIPTION = "Set only when the user asked for a specific chart title; it then replaces the generated title. Omit it otherwise: the generated title of the query is used, or one built from its measures and dimensions when it has none.";
265
291
  /** JSON-Schema-safe union; run {@link parseActionWithGuards} at execution time. */
266
292
  export declare const buildChartActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
267
293
  type: z.ZodLiteral<"create">;
@@ -269,8 +295,8 @@ export declare const buildChartActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
269
295
  chartType: z.ZodEnum<{
270
296
  area: "area";
271
297
  table: "table";
272
- indicator: "indicator";
273
298
  column: "column";
299
+ indicator: "indicator";
274
300
  line: "line";
275
301
  pie: "pie";
276
302
  bar: "bar";
@@ -284,7 +310,7 @@ export declare const buildChartActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
284
310
  scattermap: "scattermap";
285
311
  arearange: "arearange";
286
312
  }>;
287
- title: z.ZodString;
313
+ title: z.ZodOptional<z.ZodString>;
288
314
  }, z.core.$strip>, z.ZodObject<{
289
315
  type: z.ZodLiteral<"update-title">;
290
316
  priorChartId: z.ZodString;
@@ -295,8 +321,8 @@ export declare const buildChartActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
295
321
  chartType: z.ZodEnum<{
296
322
  area: "area";
297
323
  table: "table";
298
- indicator: "indicator";
299
324
  column: "column";
325
+ indicator: "indicator";
300
326
  line: "line";
301
327
  pie: "pie";
302
328
  bar: "bar";
@@ -334,18 +360,18 @@ export declare const buildChartActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
334
360
  type: z.ZodLiteral<"update-measure-chart-types">;
335
361
  priorChartId: z.ZodString;
336
362
  userPrompt: z.ZodString;
337
- }, z.core.$strip>]>;
363
+ }, z.core.$strip>], "type">;
338
364
  export type BuildChartAction = z.infer<typeof buildChartActionSchema>;
339
365
  export declare const buildChartSchema: z.ZodObject<{
340
366
  dataSourceTitle: z.ZodString;
341
- action: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
+ action: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
342
368
  type: z.ZodLiteral<"create">;
343
369
  queryId: z.ZodString;
344
370
  chartType: z.ZodEnum<{
345
371
  area: "area";
346
372
  table: "table";
347
- indicator: "indicator";
348
373
  column: "column";
374
+ indicator: "indicator";
349
375
  line: "line";
350
376
  pie: "pie";
351
377
  bar: "bar";
@@ -359,7 +385,7 @@ export declare const buildChartSchema: z.ZodObject<{
359
385
  scattermap: "scattermap";
360
386
  arearange: "arearange";
361
387
  }>;
362
- title: z.ZodString;
388
+ title: z.ZodOptional<z.ZodString>;
363
389
  }, z.core.$strip>, z.ZodObject<{
364
390
  type: z.ZodLiteral<"update-title">;
365
391
  priorChartId: z.ZodString;
@@ -370,8 +396,8 @@ export declare const buildChartSchema: z.ZodObject<{
370
396
  chartType: z.ZodEnum<{
371
397
  area: "area";
372
398
  table: "table";
373
- indicator: "indicator";
374
399
  column: "column";
400
+ indicator: "indicator";
375
401
  line: "line";
376
402
  pie: "pie";
377
403
  bar: "bar";
@@ -409,7 +435,7 @@ export declare const buildChartSchema: z.ZodObject<{
409
435
  type: z.ZodLiteral<"update-measure-chart-types">;
410
436
  priorChartId: z.ZodString;
411
437
  userPrompt: z.ZodString;
412
- }, z.core.$strip>]>;
438
+ }, z.core.$strip>], "type">, unknown>;
413
439
  }, z.core.$strip>;
414
440
  export declare const createChartSchema: z.ZodObject<{
415
441
  queryPrompt: z.ZodString;
@@ -417,8 +443,8 @@ export declare const createChartSchema: z.ZodObject<{
417
443
  chartType: z.ZodNullable<z.ZodEnum<{
418
444
  area: "area";
419
445
  table: "table";
420
- indicator: "indicator";
421
446
  column: "column";
447
+ indicator: "indicator";
422
448
  line: "line";
423
449
  pie: "pie";
424
450
  bar: "bar";
@@ -432,7 +458,7 @@ export declare const createChartSchema: z.ZodObject<{
432
458
  scattermap: "scattermap";
433
459
  arearange: "arearange";
434
460
  }>>;
435
- chartTitle: z.ZodString;
461
+ chartTitle: z.ZodOptional<z.ZodString>;
436
462
  queryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
437
463
  }, z.core.$strip>;
438
464
  export declare const updateChartSchema: z.ZodObject<{
@@ -450,8 +476,8 @@ export declare const updateChartTypeSchema: z.ZodObject<{
450
476
  chartType: z.ZodEnum<{
451
477
  area: "area";
452
478
  table: "table";
453
- indicator: "indicator";
454
479
  column: "column";
480
+ indicator: "indicator";
455
481
  line: "line";
456
482
  pie: "pie";
457
483
  bar: "bar";
@@ -498,6 +524,8 @@ export interface BuildChartContext {
498
524
  * Tool call ID
499
525
  */
500
526
  toolCallId: string;
527
+ /** `x-tool-name` for this run's calls when another tool runs the engine. Default `buildChart`. */
528
+ toolName?: string;
501
529
  abortSignal?: AbortSignal;
502
530
  /**
503
531
  * Data source title (required)
@@ -539,4 +567,6 @@ export interface BuildChartContext {
539
567
  commonFilters?: unknown;
540
568
  /** ID of a prior query result when this chart uses that query; otherwise null/undefined */
541
569
  queryId?: string | null;
570
+ /** Original verbatim user question, for Knowledge Graph capture. Set from conversation messages in the tool handler. */
571
+ userQuery?: string;
542
572
  }
@@ -1,9 +1,12 @@
1
1
  import { ExtendedChartWidgetProps } from '../types';
2
2
  /**
3
- * Copies chart type, style options, and per-measure visual flags (right-axis, color)
4
- * from a prior chart onto the newly generated widget props.
3
+ * Copies chart type, style options, per-measure visual flags (right-axis, color)
4
+ * and column-bound sort / trend / forecast from a prior chart onto the newly
5
+ * generated widget props.
5
6
  *
6
- * NOTE: sort / trend / forecast are intentionally NOT copied — they reference column
7
- * names that may no longer exist after structural changes (add/remove/swap dimensions).
7
+ * @returns descriptions of sort / trend / forecast settings that could not be
8
+ * carried over because their column no longer exists.
8
9
  */
9
- export declare function applyPriorChartStyle(widgetProps: ExtendedChartWidgetProps, priorChart: ExtendedChartWidgetProps): void;
10
+ export declare function applyPriorChartStyle(widgetProps: ExtendedChartWidgetProps, priorChart: ExtendedChartWidgetProps): string[];
11
+ /** Appends a note about dropped settings so the model can tell the user. */
12
+ export declare function withDroppedSettings(message: string, dropped: string[]): string;