@sqlrooms/mosaic 0.29.0-rc.8 → 0.29.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/README.md +84 -74
  2. package/dist/ai/agentIntent.d.ts +5 -0
  3. package/dist/ai/agentIntent.d.ts.map +1 -0
  4. package/dist/ai/agentIntent.js +8 -0
  5. package/dist/ai/agentIntent.js.map +1 -0
  6. package/dist/ai/block-document/constants.d.ts +9 -0
  7. package/dist/ai/block-document/constants.d.ts.map +1 -0
  8. package/dist/ai/block-document/constants.js +9 -0
  9. package/dist/ai/block-document/constants.js.map +1 -0
  10. package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts +48 -0
  11. package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts.map +1 -0
  12. package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js +59 -0
  13. package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js.map +1 -0
  14. package/dist/ai/block-document/createBlockDocumentChartTools.d.ts +19 -0
  15. package/dist/ai/block-document/createBlockDocumentChartTools.d.ts.map +1 -0
  16. package/dist/ai/block-document/createBlockDocumentChartTools.js +37 -0
  17. package/dist/ai/block-document/createBlockDocumentChartTools.js.map +1 -0
  18. package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts +32 -0
  19. package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts.map +1 -0
  20. package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js +37 -0
  21. package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js.map +1 -0
  22. package/dist/ai/constants.d.ts +3 -0
  23. package/dist/ai/constants.d.ts.map +1 -0
  24. package/dist/ai/constants.js +3 -0
  25. package/dist/ai/constants.js.map +1 -0
  26. package/dist/ai/createDataTableExplorerTool.d.ts +69 -0
  27. package/dist/ai/createDataTableExplorerTool.d.ts.map +1 -0
  28. package/dist/ai/createDataTableExplorerTool.js +68 -0
  29. package/dist/ai/createDataTableExplorerTool.js.map +1 -0
  30. package/dist/ai/dashboard/constants.d.ts +6 -0
  31. package/dist/ai/dashboard/constants.d.ts.map +1 -0
  32. package/dist/ai/dashboard/constants.js +6 -0
  33. package/dist/ai/dashboard/constants.js.map +1 -0
  34. package/dist/ai/dashboard/createDashboardAgentTool.d.ts +17 -0
  35. package/dist/ai/dashboard/createDashboardAgentTool.d.ts.map +1 -0
  36. package/dist/ai/dashboard/createDashboardAgentTool.js +205 -0
  37. package/dist/ai/dashboard/createDashboardAgentTool.js.map +1 -0
  38. package/dist/ai/dashboard/createDashboardAiAdapter.d.ts +14 -0
  39. package/dist/ai/dashboard/createDashboardAiAdapter.d.ts.map +1 -0
  40. package/dist/ai/dashboard/createDashboardAiAdapter.js +75 -0
  41. package/dist/ai/dashboard/createDashboardAiAdapter.js.map +1 -0
  42. package/dist/ai/dashboard/createDashboardAiTools.d.ts +26 -0
  43. package/dist/ai/dashboard/createDashboardAiTools.d.ts.map +1 -0
  44. package/dist/ai/dashboard/createDashboardAiTools.js +40 -0
  45. package/dist/ai/dashboard/createDashboardAiTools.js.map +1 -0
  46. package/dist/ai/dashboard/createDashboardChartTools.d.ts +27 -0
  47. package/dist/ai/dashboard/createDashboardChartTools.d.ts.map +1 -0
  48. package/dist/ai/dashboard/createDashboardChartTools.js +55 -0
  49. package/dist/ai/dashboard/createDashboardChartTools.js.map +1 -0
  50. package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts +23 -0
  51. package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts.map +1 -0
  52. package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js +29 -0
  53. package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js.map +1 -0
  54. package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts +28 -0
  55. package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts.map +1 -0
  56. package/dist/ai/dashboard/createListDashboardPanelsTool.js +54 -0
  57. package/dist/ai/dashboard/createListDashboardPanelsTool.js.map +1 -0
  58. package/dist/ai/dashboard/dashboard-types.d.ts +59 -0
  59. package/dist/ai/dashboard/dashboard-types.d.ts.map +1 -0
  60. package/dist/ai/dashboard/dashboard-types.js +2 -0
  61. package/dist/ai/dashboard/dashboard-types.js.map +1 -0
  62. package/dist/ai/database-types.d.ts +12 -0
  63. package/dist/ai/database-types.d.ts.map +1 -0
  64. package/dist/ai/database-types.js +2 -0
  65. package/dist/ai/database-types.js.map +1 -0
  66. package/dist/ai/errors.d.ts +8 -0
  67. package/dist/ai/errors.d.ts.map +1 -0
  68. package/dist/ai/errors.js +11 -0
  69. package/dist/ai/errors.js.map +1 -0
  70. package/dist/ai/tool-helpers.d.ts +28 -29
  71. package/dist/ai/tool-helpers.d.ts.map +1 -1
  72. package/dist/ai/tool-helpers.js +38 -76
  73. package/dist/ai/tool-helpers.js.map +1 -1
  74. package/dist/ai/tool-schemas.d.ts +9 -4
  75. package/dist/ai/tool-schemas.d.ts.map +1 -1
  76. package/dist/ai/tool-schemas.js +12 -12
  77. package/dist/ai/tool-schemas.js.map +1 -1
  78. package/dist/ai/tool-types.d.ts +19 -1
  79. package/dist/ai/tool-types.d.ts.map +1 -1
  80. package/dist/ai/tool-types.js.map +1 -1
  81. package/dist/ai/types.d.ts +64 -0
  82. package/dist/ai/types.d.ts.map +1 -0
  83. package/dist/ai/types.js +2 -0
  84. package/dist/ai/types.js.map +1 -0
  85. package/dist/ai.d.ts +16 -2
  86. package/dist/ai.d.ts.map +1 -1
  87. package/dist/ai.js +14 -5
  88. package/dist/ai.js.map +1 -1
  89. package/dist/charts/MosaicChart.js +1 -1
  90. package/dist/charts/MosaicChart.js.map +1 -1
  91. package/dist/charts/MosaicChartView.d.ts.map +1 -1
  92. package/dist/charts/MosaicChartView.js +1 -2
  93. package/dist/charts/MosaicChartView.js.map +1 -1
  94. package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.d.ts.map +1 -1
  95. package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js +2 -1
  96. package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js.map +1 -1
  97. package/dist/charts/chart-settings/MosaicChartTypeSelector.d.ts.map +1 -1
  98. package/dist/charts/chart-settings/MosaicChartTypeSelector.js +4 -11
  99. package/dist/charts/chart-settings/MosaicChartTypeSelector.js.map +1 -1
  100. package/dist/charts/chart-types/base-types.d.ts +27 -23
  101. package/dist/charts/chart-types/base-types.d.ts.map +1 -1
  102. package/dist/charts/chart-types/base-types.js +3 -1
  103. package/dist/charts/chart-types/base-types.js.map +1 -1
  104. package/dist/charts/chart-types/box-plot/definition.d.ts.map +1 -1
  105. package/dist/charts/chart-types/box-plot/definition.js +1 -0
  106. package/dist/charts/chart-types/box-plot/definition.js.map +1 -1
  107. package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts +37 -3
  108. package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts.map +1 -1
  109. package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js +26 -6
  110. package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js.map +1 -1
  111. package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +2 -2
  112. package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -1
  113. package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +12 -1
  114. package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -1
  115. package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js +13 -3
  116. package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -1
  117. package/dist/charts/chart-types/box-plot/tool.d.ts +20 -24
  118. package/dist/charts/chart-types/box-plot/tool.d.ts.map +1 -1
  119. package/dist/charts/chart-types/box-plot/tool.js +25 -33
  120. package/dist/charts/chart-types/box-plot/tool.js.map +1 -1
  121. package/dist/charts/chart-types/box-plot/validation.d.ts +9 -0
  122. package/dist/charts/chart-types/box-plot/validation.d.ts.map +1 -0
  123. package/dist/charts/chart-types/box-plot/validation.js +32 -0
  124. package/dist/charts/chart-types/box-plot/validation.js.map +1 -0
  125. package/dist/charts/chart-types/column-types.d.ts +8 -0
  126. package/dist/charts/chart-types/column-types.d.ts.map +1 -0
  127. package/dist/charts/chart-types/column-types.js +2 -0
  128. package/dist/charts/chart-types/column-types.js.map +1 -0
  129. package/dist/charts/chart-types/count-plot/definition.d.ts.map +1 -1
  130. package/dist/charts/chart-types/count-plot/definition.js +1 -0
  131. package/dist/charts/chart-types/count-plot/definition.js.map +1 -1
  132. package/dist/charts/chart-types/count-plot/spec.d.ts.map +1 -1
  133. package/dist/charts/chart-types/count-plot/spec.js +1 -19
  134. package/dist/charts/chart-types/count-plot/spec.js.map +1 -1
  135. package/dist/charts/chart-types/count-plot/tool.d.ts +19 -24
  136. package/dist/charts/chart-types/count-plot/tool.d.ts.map +1 -1
  137. package/dist/charts/chart-types/count-plot/tool.js +25 -32
  138. package/dist/charts/chart-types/count-plot/tool.js.map +1 -1
  139. package/dist/charts/chart-types/count-plot/validation.d.ts +8 -0
  140. package/dist/charts/chart-types/count-plot/validation.d.ts.map +1 -0
  141. package/dist/charts/chart-types/count-plot/validation.js +20 -0
  142. package/dist/charts/chart-types/count-plot/validation.js.map +1 -0
  143. package/dist/charts/chart-types/createChartInstructions.d.ts +3 -0
  144. package/dist/charts/chart-types/createChartInstructions.d.ts.map +1 -0
  145. package/dist/charts/chart-types/createChartInstructions.js +12 -0
  146. package/dist/charts/chart-types/createChartInstructions.js.map +1 -0
  147. package/dist/charts/chart-types/createChartTools.d.ts +15 -9
  148. package/dist/charts/chart-types/createChartTools.d.ts.map +1 -1
  149. package/dist/charts/chart-types/createChartTools.js +16 -10
  150. package/dist/charts/chart-types/createChartTools.js.map +1 -1
  151. package/dist/charts/chart-types/custom-spec/definition.d.ts.map +1 -1
  152. package/dist/charts/chart-types/custom-spec/definition.js +1 -0
  153. package/dist/charts/chart-types/custom-spec/definition.js.map +1 -1
  154. package/dist/charts/chart-types/errors.d.ts +10 -0
  155. package/dist/charts/chart-types/errors.d.ts.map +1 -1
  156. package/dist/charts/chart-types/errors.js +18 -0
  157. package/dist/charts/chart-types/errors.js.map +1 -1
  158. package/dist/charts/chart-types/heatmap/definition.d.ts.map +1 -1
  159. package/dist/charts/chart-types/heatmap/definition.js +1 -0
  160. package/dist/charts/chart-types/heatmap/definition.js.map +1 -1
  161. package/dist/charts/chart-types/heatmap/spec.d.ts.map +1 -1
  162. package/dist/charts/chart-types/heatmap/spec.js +1 -33
  163. package/dist/charts/chart-types/heatmap/spec.js.map +1 -1
  164. package/dist/charts/chart-types/heatmap/tool.d.ts +20 -24
  165. package/dist/charts/chart-types/heatmap/tool.d.ts.map +1 -1
  166. package/dist/charts/chart-types/heatmap/tool.js +26 -36
  167. package/dist/charts/chart-types/heatmap/tool.js.map +1 -1
  168. package/dist/charts/chart-types/heatmap/validation.d.ts +9 -0
  169. package/dist/charts/chart-types/heatmap/validation.d.ts.map +1 -0
  170. package/dist/charts/chart-types/heatmap/validation.js +34 -0
  171. package/dist/charts/chart-types/heatmap/validation.js.map +1 -0
  172. package/dist/charts/chart-types/histogram/definition.d.ts.map +1 -1
  173. package/dist/charts/chart-types/histogram/definition.js +1 -0
  174. package/dist/charts/chart-types/histogram/definition.js.map +1 -1
  175. package/dist/charts/chart-types/histogram/spec.d.ts.map +1 -1
  176. package/dist/charts/chart-types/histogram/spec.js +1 -21
  177. package/dist/charts/chart-types/histogram/spec.js.map +1 -1
  178. package/dist/charts/chart-types/histogram/tool.d.ts +37 -24
  179. package/dist/charts/chart-types/histogram/tool.d.ts.map +1 -1
  180. package/dist/charts/chart-types/histogram/tool.js +38 -32
  181. package/dist/charts/chart-types/histogram/tool.js.map +1 -1
  182. package/dist/charts/chart-types/histogram/validation.d.ts +9 -0
  183. package/dist/charts/chart-types/histogram/validation.d.ts.map +1 -0
  184. package/dist/charts/chart-types/histogram/validation.js +22 -0
  185. package/dist/charts/chart-types/histogram/validation.js.map +1 -0
  186. package/dist/charts/chart-types/index.d.ts +1 -7
  187. package/dist/charts/chart-types/index.d.ts.map +1 -1
  188. package/dist/charts/chart-types/index.js +2 -8
  189. package/dist/charts/chart-types/index.js.map +1 -1
  190. package/dist/charts/chart-types/line-chart/definition.d.ts.map +1 -1
  191. package/dist/charts/chart-types/line-chart/definition.js +1 -0
  192. package/dist/charts/chart-types/line-chart/definition.js.map +1 -1
  193. package/dist/charts/chart-types/line-chart/spec.d.ts.map +1 -1
  194. package/dist/charts/chart-types/line-chart/spec.js +5 -46
  195. package/dist/charts/chart-types/line-chart/spec.js.map +1 -1
  196. package/dist/charts/chart-types/line-chart/tool.d.ts +26 -24
  197. package/dist/charts/chart-types/line-chart/tool.d.ts.map +1 -1
  198. package/dist/charts/chart-types/line-chart/tool.js +26 -38
  199. package/dist/charts/chart-types/line-chart/tool.js.map +1 -1
  200. package/dist/charts/chart-types/line-chart/validation.d.ts +16 -0
  201. package/dist/charts/chart-types/line-chart/validation.d.ts.map +1 -0
  202. package/dist/charts/chart-types/line-chart/validation.js +43 -0
  203. package/dist/charts/chart-types/line-chart/validation.js.map +1 -0
  204. package/dist/charts/chart-types/resolveChartTypes.d.ts +3 -0
  205. package/dist/charts/chart-types/resolveChartTypes.d.ts.map +1 -0
  206. package/dist/charts/chart-types/resolveChartTypes.js +8 -0
  207. package/dist/charts/chart-types/resolveChartTypes.js.map +1 -0
  208. package/dist/charts/chart-types/scatter-plot/definition.d.ts.map +1 -1
  209. package/dist/charts/chart-types/scatter-plot/definition.js +1 -0
  210. package/dist/charts/chart-types/scatter-plot/definition.js.map +1 -1
  211. package/dist/charts/chart-types/scatter-plot/spec.d.ts.map +1 -1
  212. package/dist/charts/chart-types/scatter-plot/spec.js +1 -45
  213. package/dist/charts/chart-types/scatter-plot/spec.js.map +1 -1
  214. package/dist/charts/chart-types/scatter-plot/tool.d.ts +21 -24
  215. package/dist/charts/chart-types/scatter-plot/tool.d.ts.map +1 -1
  216. package/dist/charts/chart-types/scatter-plot/tool.js +28 -41
  217. package/dist/charts/chart-types/scatter-plot/tool.js.map +1 -1
  218. package/dist/charts/chart-types/scatter-plot/validation.d.ts +13 -0
  219. package/dist/charts/chart-types/scatter-plot/validation.d.ts.map +1 -0
  220. package/dist/charts/chart-types/scatter-plot/validation.js +52 -0
  221. package/dist/charts/chart-types/scatter-plot/validation.js.map +1 -0
  222. package/dist/charts/chart-types/tool-types.d.ts +43 -0
  223. package/dist/charts/chart-types/tool-types.d.ts.map +1 -0
  224. package/dist/charts/chart-types/tool-types.js +2 -0
  225. package/dist/charts/chart-types/tool-types.js.map +1 -0
  226. package/dist/charts/chart-types/utils.d.ts +3 -0
  227. package/dist/charts/chart-types/utils.d.ts.map +1 -0
  228. package/dist/charts/chart-types/utils.js +4 -0
  229. package/dist/charts/chart-types/utils.js.map +1 -0
  230. package/dist/charts/dashboard/MosaicDashboardChartRenderer.d.ts.map +1 -1
  231. package/dist/charts/dashboard/MosaicDashboardChartRenderer.js +5 -3
  232. package/dist/charts/dashboard/MosaicDashboardChartRenderer.js.map +1 -1
  233. package/dist/charts/useChartDataPolicy.js +2 -2
  234. package/dist/charts/useChartDataPolicy.js.map +1 -1
  235. package/dist/components/AggregationSelector.d.ts.map +1 -1
  236. package/dist/components/AggregationSelector.js +1 -1
  237. package/dist/components/AggregationSelector.js.map +1 -1
  238. package/dist/components/ColorSelector.d.ts.map +1 -1
  239. package/dist/components/ColorSelector.js +1 -2
  240. package/dist/components/ColorSelector.js.map +1 -1
  241. package/dist/components/FieldSelectorInput.d.ts.map +1 -1
  242. package/dist/components/FieldSelectorInput.js +3 -3
  243. package/dist/components/FieldSelectorInput.js.map +1 -1
  244. package/dist/components/TemporalGranularitySelector.d.ts.map +1 -1
  245. package/dist/components/TemporalGranularitySelector.js +1 -1
  246. package/dist/components/TemporalGranularitySelector.js.map +1 -1
  247. package/dist/dashboard/MosaicDashboardCommands.d.ts +19 -0
  248. package/dist/dashboard/MosaicDashboardCommands.d.ts.map +1 -0
  249. package/dist/dashboard/MosaicDashboardCommands.js +226 -0
  250. package/dist/dashboard/MosaicDashboardCommands.js.map +1 -0
  251. package/dist/dashboard/dashboard-types.d.ts.map +1 -1
  252. package/dist/dashboard/dashboard-types.js.map +1 -1
  253. package/dist/dashboard/panel/MosaicDashboardPanel.d.ts.map +1 -1
  254. package/dist/dashboard/panel/MosaicDashboardPanel.js +1 -1
  255. package/dist/dashboard/panel/MosaicDashboardPanel.js.map +1 -1
  256. package/dist/dashboard/panel/MosaicDashboardPanelLayout.d.ts.map +1 -1
  257. package/dist/dashboard/panel/MosaicDashboardPanelLayout.js +3 -3
  258. package/dist/dashboard/panel/MosaicDashboardPanelLayout.js.map +1 -1
  259. package/dist/dashboard/panel/MosaicDashboardPanels.d.ts.map +1 -1
  260. package/dist/dashboard/panel/MosaicDashboardPanels.js +4 -2
  261. package/dist/dashboard/panel/MosaicDashboardPanels.js.map +1 -1
  262. package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.d.ts.map +1 -1
  263. package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js +4 -4
  264. package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js.map +1 -1
  265. package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -1
  266. package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +5 -3
  267. package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -1
  268. package/dist/dashboard/useSelectedOrFirstTable.d.ts +1 -1
  269. package/dist/dashboard/useSelectedOrFirstTable.d.ts.map +1 -1
  270. package/dist/dashboard/useSelectedOrFirstTable.js +10 -8
  271. package/dist/dashboard/useSelectedOrFirstTable.js.map +1 -1
  272. package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts +3 -2
  273. package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts.map +1 -1
  274. package/dist/data-table-explorer/DataTableExplorerCategoryClient.js +3 -3
  275. package/dist/data-table-explorer/DataTableExplorerCategoryClient.js.map +1 -1
  276. package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts +3 -1
  277. package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts.map +1 -1
  278. package/dist/data-table-explorer/DataTableExplorerCountClient.js +3 -3
  279. package/dist/data-table-explorer/DataTableExplorerCountClient.js.map +1 -1
  280. package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts +3 -2
  281. package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts.map +1 -1
  282. package/dist/data-table-explorer/DataTableExplorerHistogramClient.js +4 -4
  283. package/dist/data-table-explorer/DataTableExplorerHistogramClient.js.map +1 -1
  284. package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts +3 -1
  285. package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts.map +1 -1
  286. package/dist/data-table-explorer/DataTableExplorerPageClient.js +3 -1
  287. package/dist/data-table-explorer/DataTableExplorerPageClient.js.map +1 -1
  288. package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts +3 -2
  289. package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts.map +1 -1
  290. package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js +3 -3
  291. package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js.map +1 -1
  292. package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.d.ts.map +1 -1
  293. package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js +7 -4
  294. package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js.map +1 -1
  295. package/dist/data-table-explorer/dataTableExplorerController.d.ts +58 -2
  296. package/dist/data-table-explorer/dataTableExplorerController.d.ts.map +1 -1
  297. package/dist/data-table-explorer/dataTableExplorerController.js +68 -8
  298. package/dist/data-table-explorer/dataTableExplorerController.js.map +1 -1
  299. package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts +23 -1
  300. package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts.map +1 -1
  301. package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js +46 -13
  302. package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js.map +1 -1
  303. package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts +17 -3
  304. package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts.map +1 -1
  305. package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js +9 -6
  306. package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js.map +1 -1
  307. package/dist/data-table-explorer/types.d.ts +10 -0
  308. package/dist/data-table-explorer/types.d.ts.map +1 -1
  309. package/dist/data-table-explorer/types.js.map +1 -1
  310. package/dist/data-table-explorer/useDataTableExplorer.d.ts.map +1 -1
  311. package/dist/data-table-explorer/useDataTableExplorer.js +10 -6
  312. package/dist/data-table-explorer/useDataTableExplorer.js.map +1 -1
  313. package/dist/data-table-explorer/utils.d.ts +64 -6
  314. package/dist/data-table-explorer/utils.d.ts.map +1 -1
  315. package/dist/data-table-explorer/utils.js +58 -0
  316. package/dist/data-table-explorer/utils.js.map +1 -1
  317. package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.d.ts.map +1 -1
  318. package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js +2 -2
  319. package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js.map +1 -1
  320. package/dist/index.d.ts +49 -29
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +81 -25
  323. package/dist/index.js.map +1 -1
  324. package/dist/mosaicTableReference.d.ts +59 -0
  325. package/dist/mosaicTableReference.d.ts.map +1 -0
  326. package/dist/mosaicTableReference.js +68 -0
  327. package/dist/mosaicTableReference.js.map +1 -0
  328. package/dist/useVgPlotChartRender.d.ts.map +1 -1
  329. package/dist/useVgPlotChartRender.js +26 -1
  330. package/dist/useVgPlotChartRender.js.map +1 -1
  331. package/dist/utils/table-lookup.d.ts +7 -0
  332. package/dist/utils/table-lookup.d.ts.map +1 -0
  333. package/dist/utils/table-lookup.js +10 -0
  334. package/dist/utils/table-lookup.js.map +1 -0
  335. package/package.json +14 -14
  336. package/dist/ai/ai.d.ts +0 -108
  337. package/dist/ai/ai.d.ts.map +0 -1
  338. package/dist/ai/ai.js +0 -461
  339. package/dist/ai/ai.js.map +0 -1
  340. package/dist/ai/data-table-explorer-tool.d.ts +0 -40
  341. package/dist/ai/data-table-explorer-tool.d.ts.map +0 -1
  342. package/dist/ai/data-table-explorer-tool.js +0 -75
  343. package/dist/ai/data-table-explorer-tool.js.map +0 -1
  344. package/dist/ai/list-panels-tool.d.ts +0 -35
  345. package/dist/ai/list-panels-tool.d.ts.map +0 -1
  346. package/dist/ai/list-panels-tool.js +0 -66
  347. package/dist/ai/list-panels-tool.js.map +0 -1
  348. package/dist/ai/remove-panel-tool.d.ts +0 -31
  349. package/dist/ai/remove-panel-tool.d.ts.map +0 -1
  350. package/dist/ai/remove-panel-tool.js +0 -55
  351. package/dist/ai/remove-panel-tool.js.map +0 -1
  352. package/dist/ai/tool-validation.d.ts +0 -3
  353. package/dist/ai/tool-validation.d.ts.map +0 -1
  354. package/dist/ai/tool-validation.js +0 -11
  355. package/dist/ai/tool-validation.js.map +0 -1
  356. package/dist/components/Combobox.d.ts +0 -45
  357. package/dist/components/Combobox.d.ts.map +0 -1
  358. package/dist/components/Combobox.js +0 -58
  359. package/dist/components/Combobox.js.map +0 -1
  360. package/dist/components/useCombobox.d.ts +0 -23
  361. package/dist/components/useCombobox.d.ts.map +0 -1
  362. package/dist/components/useCombobox.js +0 -26
  363. package/dist/components/useCombobox.js.map +0 -1
@@ -1,8 +1,18 @@
1
1
  import { Selection } from '@uwdata/mosaic-core';
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { BoxPlotClient } from './BoxPlotClient';
4
+ /**
5
+ * Creates and connects the Mosaic client used by the box plot renderer.
6
+ *
7
+ * @param args - Hook inputs including chart settings, Mosaic coordinator,
8
+ * optional dashboard services, and the resolved source table.
9
+ * @param args.table - Canonical `QualifiedTableName` for the source table. The
10
+ * hook passes this structured identity through to {@link BoxPlotClient}, where
11
+ * it is converted to a Mosaic SQL table reference at query-build time.
12
+ * @returns The active client ref and normalized renderer state.
13
+ */
4
14
  export function useBoxPlotClient(args) {
5
- const { config, coordinator, dataPolicy, params, runtimeIssueContext, runtimeIssueReporter, tableName, } = args;
15
+ const { config, coordinator, dataPolicy, params, runtimeIssueContext, runtimeIssueReporter, table, } = args;
6
16
  const [state, setState] = useState({
7
17
  isLoading: true,
8
18
  outliers: [],
@@ -30,7 +40,7 @@ export function useBoxPlotClient(args) {
30
40
  runtimeIssueContext,
31
41
  runtimeIssueReporter,
32
42
  selection,
33
- tableName,
43
+ table,
34
44
  x: config.x,
35
45
  y: config.y,
36
46
  });
@@ -49,7 +59,7 @@ export function useBoxPlotClient(args) {
49
59
  runtimeIssueContext,
50
60
  runtimeIssueReporter,
51
61
  selection,
52
- tableName,
62
+ table,
53
63
  ]);
54
64
  const effectiveState = !config || !config.x || !config.y
55
65
  ? {
@@ -1 +1 @@
1
- {"version":3,"file":"useBoxPlotClient.js","sourceRoot":"","sources":["../../../../../src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAoB,MAAM,iBAAiB,CAAC;AASjE,MAAM,UAAU,gBAAgB,CAAC,IAQhC;IACC,MAAM,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,GACV,GAAG,IAAI,CAAC;IACT,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe;QAC/C,SAAS,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AS;KACV,CAAC,CAAC;IAEH,MAAM,cAAc,GAClB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC,CAAC;YACE,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;SACd;QACH,CAAC,CAAC,KAAK,CAAC;IAEZ,OAAO,EAAC,SAAS,EAAE,KAAK,EAAE,cAAc,EAAC,CAAC;AAC5C,CAAC","sourcesContent":["import {Coordinator, Selection} from '@uwdata/mosaic-core';\nimport {useEffect, useMemo, useRef, useState} from 'react';\nimport {BoxPlotClient, type BoxPlotState} from './BoxPlotClient';\nimport type {BrushSelectionParams} from '../../base-types';\nimport type {\n ChartDataPolicy,\n ChartRuntimeIssueContext,\n ChartRuntimeIssueReporter,\n} from '../../../../chart-runtime';\nimport {BoxPlotChartSettings} from '../schema';\n\nexport function useBoxPlotClient(args: {\n config: BoxPlotChartSettings | null;\n coordinator: Coordinator;\n dataPolicy?: ChartDataPolicy | null;\n params?: BrushSelectionParams;\n runtimeIssueContext?: ChartRuntimeIssueContext;\n runtimeIssueReporter?: ChartRuntimeIssueReporter;\n tableName: string;\n}) {\n const {\n config,\n coordinator,\n dataPolicy,\n params,\n runtimeIssueContext,\n runtimeIssueReporter,\n tableName,\n } = args;\n const [state, setState] = useState<BoxPlotState>({\n isLoading: true,\n outliers: [],\n summaries: [],\n });\n const clientRef = useRef<BoxPlotClient | null>(null);\n\n // Get or create the crossfilter selection\n const selection = useMemo(() => {\n // First try to get the brush selection from params (which should be connected to crossfilter)\n const brushSelection = params?.get('brush');\n if (brushSelection) {\n return brushSelection;\n }\n // Fallback: create a new crossfilter selection (shouldn't happen in dashboard context)\n return Selection.crossfilter();\n }, [params]);\n\n useEffect(() => {\n if (!config || !config.x || !config.y) {\n clientRef.current = null;\n return;\n }\n\n const client = new BoxPlotClient({\n dataPolicy,\n onStateChange: setState,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n tableName,\n x: config.x,\n y: config.y,\n });\n clientRef.current = client;\n coordinator.connect(client);\n\n return () => {\n client.destroy();\n if (clientRef.current === client) {\n clientRef.current = null;\n }\n };\n }, [\n config,\n coordinator,\n dataPolicy,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n tableName,\n ]);\n\n const effectiveState =\n !config || !config.x || !config.y\n ? {\n isLoading: false,\n outliers: [],\n summaries: [],\n }\n : state;\n\n return {clientRef, state: effectiveState};\n}\n"]}
1
+ {"version":3,"file":"useBoxPlotClient.js","sourceRoot":"","sources":["../../../../../src/charts/chart-types/box-plot/renderer/useBoxPlotClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAoB,MAAM,iBAAiB,CAAC;AAUjE;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAQhC;IACC,MAAM,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,GACN,GAAG,IAAI,CAAC;IACT,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe;QAC/C,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IAErD,0CAA0C;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,8FAA8F;QAC9F,MAAM,cAAc,GAAG,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,cAAc,CAAC;QACxB,CAAC;QACD,uFAAuF;QACvF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{useEffect, useMemo, useRef, useState} from 'react';\nimport {BoxPlotClient, type BoxPlotState} from './BoxPlotClient';\nimport type {BrushSelectionParams} from '../../base-types';\nimport type {QualifiedTableName} from '@sqlrooms/duckdb';\nimport type {\n ChartDataPolicy,\n ChartRuntimeIssueContext,\n ChartRuntimeIssueReporter,\n} from '../../../../chart-runtime';\nimport {BoxPlotChartSettings} from '../schema';\n\n/**\n * Creates and connects the Mosaic client used by the box plot renderer.\n *\n * @param args - Hook inputs including chart settings, Mosaic coordinator,\n * optional dashboard services, and the resolved source table.\n * @param args.table - Canonical `QualifiedTableName` for the source table. The\n * hook passes this structured identity through to {@link BoxPlotClient}, where\n * it is converted to a Mosaic SQL table reference at query-build time.\n * @returns The active client ref and normalized renderer state.\n */\nexport function useBoxPlotClient(args: {\n config: BoxPlotChartSettings | null;\n coordinator: Coordinator;\n dataPolicy?: ChartDataPolicy | null;\n params?: BrushSelectionParams;\n runtimeIssueContext?: ChartRuntimeIssueContext;\n runtimeIssueReporter?: ChartRuntimeIssueReporter;\n table: QualifiedTableName;\n}) {\n const {\n config,\n coordinator,\n dataPolicy,\n params,\n runtimeIssueContext,\n runtimeIssueReporter,\n table,\n } = args;\n const [state, setState] = useState<BoxPlotState>({\n isLoading: true,\n outliers: [],\n summaries: [],\n });\n const clientRef = useRef<BoxPlotClient | null>(null);\n\n // Get or create the crossfilter selection\n const selection = useMemo(() => {\n // First try to get the brush selection from params (which should be connected to crossfilter)\n const brushSelection = params?.get('brush');\n if (brushSelection) {\n return brushSelection;\n }\n // Fallback: create a new crossfilter selection (shouldn't happen in dashboard context)\n return Selection.crossfilter();\n }, [params]);\n\n useEffect(() => {\n if (!config || !config.x || !config.y) {\n clientRef.current = null;\n return;\n }\n\n const client = new BoxPlotClient({\n dataPolicy,\n onStateChange: setState,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n table,\n x: config.x,\n y: config.y,\n });\n clientRef.current = client;\n coordinator.connect(client);\n\n return () => {\n client.destroy();\n if (clientRef.current === client) {\n clientRef.current = null;\n }\n };\n }, [\n config,\n coordinator,\n dataPolicy,\n runtimeIssueContext,\n runtimeIssueReporter,\n selection,\n table,\n ]);\n\n const effectiveState =\n !config || !config.x || !config.y\n ? {\n isLoading: false,\n outliers: [],\n summaries: [],\n }\n : state;\n\n return {clientRef, state: effectiveState};\n}\n"]}
@@ -1,9 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { type DashboardToolDeps } from '../base-types';
3
- export declare const BoxPlotToolParameters: z.ZodObject<{
4
- artifactId: z.ZodOptional<z.ZodString>;
5
- tableName: z.ZodOptional<z.ZodString>;
6
- createArtifactIfMissing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2
+ import { ChartToolParams, ChartToolOutput } from '../tool-types';
3
+ export declare const BoxPlotToolInput: z.ZodObject<{
4
+ tableName: z.ZodString;
5
+ title: z.ZodOptional<z.ZodString>;
7
6
  panelId: z.ZodOptional<z.ZodString>;
8
7
  reasoning: z.ZodString;
9
8
  settings: z.ZodObject<{
@@ -11,30 +10,27 @@ export declare const BoxPlotToolParameters: z.ZodObject<{
11
10
  y: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
12
11
  }, z.core.$strip>;
13
12
  }, z.core.$strip>;
14
- export type BoxPlotToolParams = z.infer<typeof BoxPlotToolParameters>;
15
- export declare function createBoxPlotAiTool(deps: DashboardToolDeps): import("ai").Tool<{
16
- createArtifactIfMissing: boolean;
13
+ export type BoxPlotToolInput = z.infer<typeof BoxPlotToolInput>;
14
+ export declare function createBoxPlotAiTool({ databaseAdapter, addChart, }: ChartToolParams): import("ai").Tool<{
15
+ tableName: string;
17
16
  reasoning: string;
18
17
  settings: {
19
18
  x: string;
20
19
  y: string;
21
20
  };
22
- artifactId?: string | undefined;
23
- tableName?: string | undefined;
21
+ title?: string | undefined;
24
22
  panelId?: string | undefined;
25
- }, {
26
- llmResult: {
27
- success: boolean;
28
- details: string;
29
- data: import("..").PanelResult;
30
- errorMessage?: undefined;
31
- };
32
- } | {
33
- llmResult: {
34
- success: boolean;
35
- errorMessage: string;
36
- details?: undefined;
37
- data?: undefined;
23
+ }, ChartToolOutput<{
24
+ chartType: "box-plot";
25
+ settings: {
26
+ x?: string | undefined;
27
+ y?: string | undefined;
38
28
  };
39
- }>;
29
+ settingsOpen?: boolean | undefined;
30
+ dataPolicy?: {
31
+ disabled?: boolean | undefined;
32
+ maxRows?: number | undefined;
33
+ reason?: string | undefined;
34
+ } | undefined;
35
+ }>>;
40
36
  //# sourceMappingURL=tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAQrD,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAEhC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;GA4E1D"}
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAOtB,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAI/D,eAAO,MAAM,gBAAgB;;;;;;;;;iBAE3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,wBAAgB,mBAAmB,CAAC,EAClC,eAAe,EACf,QAAQ,GACT,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;IAmDjB"}
@@ -1,13 +1,13 @@
1
1
  import { tool } from 'ai';
2
2
  import { BoxPlotChartSettings } from './schema';
3
- import { BaseChartToolParameters } from '../../../ai/tool-schemas';
4
- import { validateColumnExists } from '../../../ai/tool-validation';
3
+ import { BaseChartToolInput } from '../../../ai/tool-schemas';
5
4
  import { NUMERIC_COLUMN_TYPES, CATEGORICAL_COLUMN_TYPES, } from '../../../column-types-utils';
6
- import { createOrUpdateChartPanel } from '../../../ai/tool-helpers';
7
- export const BoxPlotToolParameters = BaseChartToolParameters.extend({
5
+ import { validateBoxPlotSettings } from './validation';
6
+ import { ensureTable } from '../../../ai/tool-helpers';
7
+ export const BoxPlotToolInput = BaseChartToolInput.extend({
8
8
  settings: BoxPlotChartSettings.required(),
9
9
  });
10
- export function createBoxPlotAiTool(deps) {
10
+ export function createBoxPlotAiTool({ databaseAdapter, addChart, }) {
11
11
  return tool({
12
12
  description: `Box plot: compares distributions of numeric values across categories. Shows median, quartiles (25th, 75th percentiles), and outliers per group.
13
13
 
@@ -20,45 +20,37 @@ Required:
20
20
 
21
21
  NOTE: Box plots aggregate data by computing quartiles and outliers per group, so they handle large datasets efficiently (no data point limit).
22
22
 
23
- To UPDATE an existing box plot: provide the panelId parameter. Otherwise creates new panel.
24
-
25
23
  Best for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.
26
24
 
27
25
  Do NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,
28
- inputSchema: BoxPlotToolParameters,
29
- execute: async (params, context) => {
26
+ inputSchema: BoxPlotToolInput,
27
+ execute: async ({ tableName, title, settings, panelId }) => {
30
28
  try {
31
- const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing, context);
32
- const { tableName, columns } = deps.resolveTable(artifactId, params.tableName);
33
- // Validate settings
34
- validateColumnExists(params.settings.x, CATEGORICAL_COLUMN_TYPES, columns, 'x');
35
- validateColumnExists(params.settings.y, NUMERIC_COLUMN_TYPES, columns, 'y');
36
- const result = createOrUpdateChartPanel(deps, {
37
- panelId: params.panelId,
38
- dashboardId: artifactId,
29
+ const dataTable = ensureTable(databaseAdapter, tableName);
30
+ validateBoxPlotSettings({
31
+ dataTable,
32
+ settings,
33
+ });
34
+ const config = {
35
+ chartType: 'box-plot',
36
+ settings,
37
+ };
38
+ await addChart({
39
39
  tableName,
40
- title: `Box plot - ${params.settings.y} by ${params.settings.x}`,
41
- config: {
42
- chartType: 'box-plot',
43
- settings: params.settings,
44
- },
40
+ panelId,
41
+ title,
42
+ config,
45
43
  });
46
44
  return {
47
- llmResult: {
48
- success: true,
49
- details: params.panelId
50
- ? `Updated box plot "${result.title}".`
51
- : `Created box plot "${result.title}".`,
52
- data: result,
53
- },
45
+ success: true,
46
+ details: `Generated box plot configuration.`,
47
+ data: config,
54
48
  };
55
49
  }
56
50
  catch (error) {
57
51
  return {
58
- llmResult: {
59
- success: false,
60
- errorMessage: error instanceof Error ? error.message : String(error),
61
- },
52
+ success: false,
53
+ errorMessage: error instanceof Error ? error.message : String(error),
62
54
  };
63
55
  }
64
56
  },
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAClE,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAIH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,OAAO,IAAI,CAAC;Q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EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {BoxPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../../../ai/tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../../../ai/tool-validation';\nimport {\n NUMERIC_COLUMN_TYPES,\n CATEGORICAL_COLUMN_TYPES,\n} from '../../../column-types-utils';\nimport {createOrUpdateChartPanel} from '../../../ai/tool-helpers';\n\nexport const BoxPlotToolParameters = BaseChartToolParameters.extend({\n settings: BoxPlotChartSettings.required(),\n});\n\nexport type BoxPlotToolParams = z.infer<typeof BoxPlotToolParameters>;\n\nexport function createBoxPlotAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Box plot: compares distributions of numeric values across categories. Shows median, quartiles (25th, 75th percentiles), and outliers per group.\n\nUse when: user asks to \"compare [numeric] across/by [category]\", \"distribution by group\", \"show outliers by\", \"compare ranges\".\nExample queries: \"compare population by administrative region\", \"show elevation distribution by terrain type\", \"parcel area range by zone\", \"compare building heights across districts\", \"temperature by climate zone\".\n\nRequired:\n- x: categorical/grouping column (${CATEGORICAL_COLUMN_TYPES.join(', ')}) - e.g., region, terrain type, zone classification\n- y: numeric (${NUMERIC_COLUMN_TYPES.join(', ')})\n\nNOTE: Box plots aggregate data by computing quartiles and outliers per group, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing box plot: provide the panelId parameter. Otherwise creates new panel.\n\nBest for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.\n\nDo NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,\n inputSchema: BoxPlotToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings\n validateColumnExists(\n params.settings.x,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'x',\n );\n validateColumnExists(\n params.settings.y,\n NUMERIC_COLUMN_TYPES,\n columns,\n 'y',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: `Box plot - ${params.settings.y} by ${params.settings.x}`,\n config: {\n chartType: 'box-plot',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated box plot \"${result.title}\".`\n : `Created box plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAqB,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACxD,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAIH,MAAM,UAAU,mBAAmB,CAAC,EAClC,eAAe,EACf,QAAQ,GACQ;IAChB,OAAO,IAAI,CAAwD;QACjE,WAAW,EAAE;;;;;;oCAMmB,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;gBACvD,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;mHAMoE;QAC/G,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,KAAK,EAAE,EAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAC,EAAE,EAAE;YACvD,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,WAAW,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;gBAE1D,uBAAuB,CAAC;oBACtB,SAAS;oBACT,QAAQ;iBACT,CAAC,CAAC;gBAEH,MAAM,MAAM,GAAuB;oBACjC,SAAS,EAAE,UAAmB;oBAC9B,QAAQ;iBACT,CAAC;gBAEF,MAAM,QAAQ,CAAC;oBACb,SAAS;oBACT,OAAO;oBACP,KAAK;oBACL,MAAM;iBACP,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,mCAAmC;oBAC5C,IAAI,EAAE,MAAM;iBACb,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,YAAY,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBACrE,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {BoxPlotChartConfig, BoxPlotChartSettings} from './schema';\nimport {BaseChartToolInput} from '../../../ai/tool-schemas';\nimport {\n NUMERIC_COLUMN_TYPES,\n CATEGORICAL_COLUMN_TYPES,\n} from '../../../column-types-utils';\nimport {ChartToolParams, ChartToolOutput} from '../tool-types';\nimport {validateBoxPlotSettings} from './validation';\nimport {ensureTable} from '../../../ai/tool-helpers';\n\nexport const BoxPlotToolInput = BaseChartToolInput.extend({\n settings: BoxPlotChartSettings.required(),\n});\n\nexport type BoxPlotToolInput = z.infer<typeof BoxPlotToolInput>;\n\nexport function createBoxPlotAiTool({\n databaseAdapter,\n addChart,\n}: ChartToolParams) {\n return tool<BoxPlotToolInput, ChartToolOutput<BoxPlotChartConfig>>({\n description: `Box plot: compares distributions of numeric values across categories. Shows median, quartiles (25th, 75th percentiles), and outliers per group.\n\nUse when: user asks to \"compare [numeric] across/by [category]\", \"distribution by group\", \"show outliers by\", \"compare ranges\".\nExample queries: \"compare population by administrative region\", \"show elevation distribution by terrain type\", \"parcel area range by zone\", \"compare building heights across districts\", \"temperature by climate zone\".\n\nRequired:\n- x: categorical/grouping column (${CATEGORICAL_COLUMN_TYPES.join(', ')}) - e.g., region, terrain type, zone classification\n- y: numeric (${NUMERIC_COLUMN_TYPES.join(', ')})\n\nNOTE: Box plots aggregate data by computing quartiles and outliers per group, so they handle large datasets efficiently (no data point limit).\n\nBest for: comparing distributions between groups, finding outliers per category, seeing spread and variance differences.\n\nDo NOT use for: single distribution (use histogram), time trends (use line-chart), simple counts (use count-plot).`,\n inputSchema: BoxPlotToolInput,\n execute: async ({tableName, title, settings, panelId}) => {\n try {\n const dataTable = ensureTable(databaseAdapter, tableName);\n\n validateBoxPlotSettings({\n dataTable,\n settings,\n });\n\n const config: BoxPlotChartConfig = {\n chartType: 'box-plot' as const,\n settings,\n };\n\n await addChart({\n tableName,\n panelId,\n title,\n config,\n });\n\n return {\n success: true,\n details: `Generated box plot configuration.`,\n data: config,\n };\n } catch (error) {\n return {\n success: false,\n errorMessage: error instanceof Error ? error.message : String(error),\n };\n }\n },\n });\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { BoxPlotChartSettings } from './schema';
2
+ import { ValidateSpecOptions } from '../base-types';
3
+ import { TableColumn } from '@sqlrooms/duckdb';
4
+ export type ValidatedBoxPlotSettings = {
5
+ xColumn: TableColumn;
6
+ yColumn: TableColumn;
7
+ };
8
+ export declare function validateBoxPlotSettings({ dataTable, settings: { x, y }, }: ValidateSpecOptions<BoxPlotChartSettings>): ValidatedBoxPlotSettings;
9
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAOlD,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,QAAQ,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,GACjB,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,wBAAwB,CAiCtE"}
@@ -0,0 +1,32 @@
1
+ import { InvalidColumnTypeError, MissingColumnsError, RequiredFieldsError, } from '../errors';
2
+ import { isCategoricalType, isNumericType } from '../../../column-types-utils';
3
+ export function validateBoxPlotSettings({ dataTable, settings: { x, y }, }) {
4
+ // Basic validation for required fields
5
+ if (!x || !y) {
6
+ throw new RequiredFieldsError([
7
+ ...(x ? [] : ['X field (categorical)']),
8
+ ...(y ? [] : ['Y field (numeric)']),
9
+ ]);
10
+ }
11
+ // Validate X and Y field existence
12
+ const xColumn = dataTable.columns.find((col) => col.name === x);
13
+ const yColumn = dataTable.columns.find((col) => col.name === y);
14
+ if (!xColumn || !yColumn) {
15
+ throw new MissingColumnsError([
16
+ ...(xColumn ? [] : [x]),
17
+ ...(yColumn ? [] : [y]),
18
+ ]);
19
+ }
20
+ // Validate X is categorical and Y is numeric
21
+ if (!isCategoricalType(xColumn.type)) {
22
+ throw new InvalidColumnTypeError(xColumn.name, 'categorical');
23
+ }
24
+ if (!isNumericType(yColumn.type)) {
25
+ throw new InvalidColumnTypeError(yColumn.name, 'numeric');
26
+ }
27
+ return {
28
+ xColumn,
29
+ yColumn,
30
+ };
31
+ }
32
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/box-plot/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAQ7E,MAAM,UAAU,uBAAuB,CAAC,EACtC,SAAS,EACT,QAAQ,EAAE,EAAC,CAAC,EAAE,CAAC,EAAC,GAC0B;IAC1C,uCAAuC;IACvC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACb,MAAM,IAAI,mBAAmB,CAAC;YAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;YACvC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;SACpC,CAAC,CAAC;IACL,CAAC;IAED,mCAAmC;IACnC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IAEhE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,mBAAmB,CAAC;YAC5B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB,CAAC,CAAC;IACL,CAAC;IAED,6CAA6C;IAC7C,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO;QACL,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import {BoxPlotChartSettings} from './schema';\nimport {ValidateSpecOptions} from '../base-types';\nimport {\n InvalidColumnTypeError,\n MissingColumnsError,\n RequiredFieldsError,\n} from '../errors';\nimport {isCategoricalType, isNumericType} from '../../../column-types-utils';\nimport {TableColumn} from '@sqlrooms/duckdb';\n\nexport type ValidatedBoxPlotSettings = {\n xColumn: TableColumn;\n yColumn: TableColumn;\n};\n\nexport function validateBoxPlotSettings({\n dataTable,\n settings: {x, y},\n}: ValidateSpecOptions<BoxPlotChartSettings>): ValidatedBoxPlotSettings {\n // Basic validation for required fields\n if (!x || !y) {\n throw new RequiredFieldsError([\n ...(x ? [] : ['X field (categorical)']),\n ...(y ? [] : ['Y field (numeric)']),\n ]);\n }\n\n // Validate X and Y field existence\n const xColumn = dataTable.columns.find((col) => col.name === x);\n const yColumn = dataTable.columns.find((col) => col.name === y);\n\n if (!xColumn || !yColumn) {\n throw new MissingColumnsError([\n ...(xColumn ? [] : [x]),\n ...(yColumn ? [] : [y]),\n ]);\n }\n\n // Validate X is categorical and Y is numeric\n if (!isCategoricalType(xColumn.type)) {\n throw new InvalidColumnTypeError(xColumn.name, 'categorical');\n }\n\n if (!isNumericType(yColumn.type)) {\n throw new InvalidColumnTypeError(yColumn.name, 'numeric');\n }\n\n return {\n xColumn,\n yColumn,\n };\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Column info passed to chart builder UI
3
+ */
4
+ export interface ChartBuilderColumn {
5
+ name: string;
6
+ type: string;
7
+ }
8
+ //# sourceMappingURL=column-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-types.d.ts","sourceRoot":"","sources":["../../../src/charts/chart-types/column-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=column-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../../src/charts/chart-types/column-types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Column info passed to chart builder UI\n */\nexport interface ChartBuilderColumn {\n name: string;\n type: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAyB,MAAM,UAAU,CAAC;AAStE,eAAO,MAAM,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAW1E,CAAC"}
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAyB,MAAM,UAAU,CAAC;AAStE,eAAO,MAAM,kBAAkB,EAAE,uBAAuB,CAAC,oBAAoB,CAY1E,CAAC"}
@@ -9,6 +9,7 @@ export const countPlotChartType = {
9
9
  id: 'count-plot',
10
10
  label: 'Count Plot',
11
11
  description: DESCRIPTION,
12
+ aiDescription: `${DESCRIPTION} - frequency of categorical values (always safe, aggregates automatically)`,
12
13
  icon: BarChartHorizontal,
13
14
  schema: CountPlotChartSettings,
14
15
  settingsComponent: CountPlotSettingsComponent,
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,sBAAsB,EAAC,MAAM,UAAU,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAC7B;IACE,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,sBAAsB;IAC9B,iBAAiB,EAAE,0BAA0B;IAC7C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,mBAAmB;CAChC,CAAC","sourcesContent":["import type {SpecChartTypeDefinition} from '../base-types';\nimport {CountPlotChartConfig, CountPlotChartSettings} from './schema';\nimport {titleFromDescription} from '../../../chart-builders/chartTypeUtils';\nimport {CountPlotSettingsComponent} from './CountPlotSettings';\nimport {createCountPlotAiTool} from './tool';\nimport {BarChartHorizontal} from 'lucide-react';\nimport {createCountPlotSpec} from './spec';\n\nconst DESCRIPTION = 'Create a count plot of a field';\n\nexport const countPlotChartType: SpecChartTypeDefinition<CountPlotChartConfig> =\n {\n id: 'count-plot',\n label: 'Count Plot',\n description: DESCRIPTION,\n icon: BarChartHorizontal,\n schema: CountPlotChartSettings,\n settingsComponent: CountPlotSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n createTool: createCountPlotAiTool,\n createSpec: createCountPlotSpec,\n };\n"]}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/definition.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,sBAAsB,EAAC,MAAM,UAAU,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAC,0BAA0B,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,qBAAqB,EAAC,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAC7B;IACE,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,WAAW;IACxB,aAAa,EAAE,GAAG,WAAW,4EAA4E;IACzG,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,sBAAsB;IAC9B,iBAAiB,EAAE,0BAA0B;IAC7C,UAAU,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAC7C,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,mBAAmB;CAChC,CAAC","sourcesContent":["import type {SpecChartTypeDefinition} from '../base-types';\nimport {CountPlotChartConfig, CountPlotChartSettings} from './schema';\nimport {titleFromDescription} from '../../../chart-builders/chartTypeUtils';\nimport {CountPlotSettingsComponent} from './CountPlotSettings';\nimport {createCountPlotAiTool} from './tool';\nimport {BarChartHorizontal} from 'lucide-react';\nimport {createCountPlotSpec} from './spec';\n\nconst DESCRIPTION = 'Create a count plot of a field';\n\nexport const countPlotChartType: SpecChartTypeDefinition<CountPlotChartConfig> =\n {\n id: 'count-plot',\n label: 'Count Plot',\n description: DESCRIPTION,\n aiDescription: `${DESCRIPTION} - frequency of categorical values (always safe, aggregates automatically)`,\n icon: BarChartHorizontal,\n schema: CountPlotChartSettings,\n settingsComponent: CountPlotSettingsComponent,\n buildTitle: titleFromDescription(DESCRIPTION),\n createTool: createCountPlotAiTool,\n createSpec: createCountPlotSpec,\n };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAMhD,OAAO,EAAC,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAMxE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GACjD,IAAI,CA4DN"}
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAMxE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,CAAC,GACjD,IAAI,CA4DN"}
@@ -1,6 +1,5 @@
1
- import { InvalidColumnTypeError, MissingColumnsError, RequiredFieldsError, } from '../errors';
2
1
  import { getChartTableReference } from '../base-types';
3
- import { isCategoricalType } from '../../../column-types-utils';
2
+ import { validateCountPlotSettings } from './validation';
4
3
  const BG_COLOR = 'var(--color-chart-overlay)';
5
4
  const FG_COLOR = 'var(--color-chart-1)';
6
5
  export function createCountPlotSpec(options) {
@@ -60,21 +59,4 @@ export function createCountPlotSpec(options) {
60
59
  params: { brush: { select: 'crossfilter' } },
61
60
  };
62
61
  }
63
- function validateCountPlotSettings({ dataTable, settings: { field }, }) {
64
- // Basic validation for required fields
65
- if (!field) {
66
- throw new RequiredFieldsError('Field');
67
- }
68
- // Validate field existence and type
69
- const fieldColumn = dataTable.columns.find((col) => col.name === field);
70
- if (!fieldColumn) {
71
- throw new MissingColumnsError(field);
72
- }
73
- if (!isCategoricalType(fieldColumn.type)) {
74
- throw new InvalidColumnTypeError(fieldColumn.name, 'categorical');
75
- }
76
- return {
77
- fieldColumn,
78
- };
79
- }
80
62
  //# sourceMappingURL=spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/spec.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAoB,sBAAsB,EAAC,MAAM,eAAe,CAAC;AACxE,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAE9D,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAExC,MAAM,UAAU,mBAAmB,CACjC,OAAkD;IAElD,MAAM,EAAC,SAAS,EAAE,aAAa,EAAC,GAAG,OAAO,CAAC;IAE3C,MAAM,EAAC,WAAW,EAAC,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,cAAc,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAEzD,4DAA4D;IAC5D,yCAAyC;IACzC,MAAM,IAAI,GAAc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,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,WAAW,CAAC,IAAI;QACxB,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC;QACnD,MAAM,EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,aAAa,EAAC,EAAC;KACjC,CAAC;AACZ,CAAC;AAED,SAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,QAAQ,EAAE,EAAC,KAAK,EAAC,GACyB;IAC1C,uCAAuC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,oCAAoC;IACpC,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IAExE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,sBAAsB,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACpE,CAAC;IAED,OAAO;QACL,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import type {Spec} from '@uwdata/mosaic-spec';\nimport {CountPlotChartSettings} from './schema';\nimport {\n InvalidColumnTypeError,\n MissingColumnsError,\n RequiredFieldsError,\n} from '../errors';\nimport {CreateSpecOptions, getChartTableReference} from '../base-types';\nimport {isCategoricalType} from '../../../column-types-utils';\n\nconst BG_COLOR = 'var(--color-chart-overlay)';\nconst FG_COLOR = 'var(--color-chart-1)';\n\nexport function createCountPlotSpec(\n options: CreateSpecOptions<CountPlotChartSettings>,\n): Spec {\n const {dataTable, selectionName} = options;\n\n const {fieldColumn} = validateCountPlotSettings(options);\n const tableReference = getChartTableReference(dataTable);\n\n // Count plot shows categorical frequency as horizontal bars\n // Categories on Y-axis, counts on X-axis\n const plot: unknown[] = [\n {\n mark: 'barX',\n data: {from: tableReference},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n fill: BG_COLOR,\n inset: 0.5,\n },\n {\n mark: 'barX',\n data: {from: tableReference, filterBy: '$brush'},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n fill: FG_COLOR,\n inset: 0.5,\n },\n {\n mark: 'text',\n data: {from: tableReference, filterBy: '$brush'},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n text: {count: null},\n dx: 5,\n textAnchor: 'start',\n fill: 'currentColor',\n fontSize: 11,\n },\n ];\n\n if (selectionName) {\n plot.push({select: 'intervalY', as: '$brush'});\n }\n\n return {\n plot,\n xLabel: 'Count',\n yLabel: fieldColumn.name,\n height: 400,\n width: 380,\n margins: {left: 50, right: 50, top: 20, bottom: 50},\n params: {brush: {select: 'crossfilter'}},\n } as Spec;\n}\n\nfunction validateCountPlotSettings({\n dataTable,\n settings: {field},\n}: CreateSpecOptions<CountPlotChartSettings>) {\n // Basic validation for required fields\n if (!field) {\n throw new RequiredFieldsError('Field');\n }\n\n // Validate field existence and type\n const fieldColumn = dataTable.columns.find((col) => col.name === field);\n\n if (!fieldColumn) {\n throw new MissingColumnsError(field);\n }\n\n if (!isCategoricalType(fieldColumn.type)) {\n throw new InvalidColumnTypeError(fieldColumn.name, 'categorical');\n }\n\n return {\n fieldColumn,\n };\n}\n"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,EAAE,GAAG;SACX;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAC;YAChD,CAAC,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC;YAChB,CAAC,EAAE;gBACD,MAAM,EAAE,WAAW,CAAC,IAAI;gBACxB,IAAI,EAAE,EAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAC;aAC5C;YACD,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC;YACnB,EAAE,EAAE,CAAC;YACL,UAAU,EAAE,OAAO;YACnB,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,EAAE;SACb;KACF,CAAC;IAEF,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,WAAW,CAAC,IAAI;QACxB,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,EAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC;QACnD,MAAM,EAAE,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,aAAa,EAAC,EAAC;KACjC,CAAC;AACZ,CAAC","sourcesContent":["import type {Spec} from '@uwdata/mosaic-spec';\nimport {CountPlotChartSettings} from './schema';\nimport {CreateSpecOptions, getChartTableReference} from '../base-types';\nimport {validateCountPlotSettings} from './validation';\n\nconst BG_COLOR = 'var(--color-chart-overlay)';\nconst FG_COLOR = 'var(--color-chart-1)';\n\nexport function createCountPlotSpec(\n options: CreateSpecOptions<CountPlotChartSettings>,\n): Spec {\n const {dataTable, selectionName} = options;\n\n const {fieldColumn} = validateCountPlotSettings(options);\n const tableReference = getChartTableReference(dataTable);\n\n // Count plot shows categorical frequency as horizontal bars\n // Categories on Y-axis, counts on X-axis\n const plot: unknown[] = [\n {\n mark: 'barX',\n data: {from: tableReference},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n fill: BG_COLOR,\n inset: 0.5,\n },\n {\n mark: 'barX',\n data: {from: tableReference, filterBy: '$brush'},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n fill: FG_COLOR,\n inset: 0.5,\n },\n {\n mark: 'text',\n data: {from: tableReference, filterBy: '$brush'},\n x: {count: null},\n y: {\n column: fieldColumn.name,\n sort: {x: 'sum', order: 'desc', limit: 100},\n },\n text: {count: null},\n dx: 5,\n textAnchor: 'start',\n fill: 'currentColor',\n fontSize: 11,\n },\n ];\n\n if (selectionName) {\n plot.push({select: 'intervalY', as: '$brush'});\n }\n\n return {\n plot,\n xLabel: 'Count',\n yLabel: fieldColumn.name,\n height: 400,\n width: 380,\n margins: {left: 50, right: 50, top: 20, bottom: 50},\n params: {brush: {select: 'crossfilter'}},\n } as Spec;\n}\n"]}
@@ -1,38 +1,33 @@
1
1
  import { z } from 'zod';
2
- import { type DashboardToolDeps } from '../base-types';
3
- export declare const CountPlotToolParameters: z.ZodObject<{
4
- artifactId: z.ZodOptional<z.ZodString>;
5
- tableName: z.ZodOptional<z.ZodString>;
6
- createArtifactIfMissing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2
+ import { ChartToolParams, ChartToolOutput } from '../tool-types';
3
+ export declare const CountPlotToolInput: z.ZodObject<{
4
+ tableName: z.ZodString;
5
+ title: z.ZodOptional<z.ZodString>;
7
6
  panelId: z.ZodOptional<z.ZodString>;
8
7
  reasoning: z.ZodString;
9
8
  settings: z.ZodObject<{
10
9
  field: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
11
10
  }, z.core.$strip>;
12
11
  }, z.core.$strip>;
13
- export type CountPlotToolParams = z.infer<typeof CountPlotToolParameters>;
14
- export declare function createCountPlotAiTool(deps: DashboardToolDeps): import("ai").Tool<{
15
- createArtifactIfMissing: boolean;
12
+ export type CountPlotToolInput = z.infer<typeof CountPlotToolInput>;
13
+ export declare function createCountPlotAiTool({ databaseAdapter, addChart, }: ChartToolParams): import("ai").Tool<{
14
+ tableName: string;
16
15
  reasoning: string;
17
16
  settings: {
18
17
  field: string;
19
18
  };
20
- artifactId?: string | undefined;
21
- tableName?: string | undefined;
19
+ title?: string | undefined;
22
20
  panelId?: string | undefined;
23
- }, {
24
- llmResult: {
25
- success: boolean;
26
- details: string;
27
- data: import("..").PanelResult;
28
- errorMessage?: undefined;
29
- };
30
- } | {
31
- llmResult: {
32
- success: boolean;
33
- errorMessage: string;
34
- details?: undefined;
35
- data?: undefined;
21
+ }, ChartToolOutput<{
22
+ chartType: "count-plot";
23
+ settings: {
24
+ field?: string | undefined;
36
25
  };
37
- }>;
26
+ settingsOpen?: boolean | undefined;
27
+ dataPolicy?: {
28
+ disabled?: boolean | undefined;
29
+ maxRows?: number | undefined;
30
+ reason?: string | undefined;
31
+ } | undefined;
32
+ }>>;
38
33
  //# sourceMappingURL=tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKrD,eAAO,MAAM,uBAAuB;;;;;;;;;iBAElC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE1E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;GAmE5D"}
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAI/D,eAAO,MAAM,kBAAkB;;;;;;;;iBAE7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,wBAAgB,qBAAqB,CAAC,EACpC,eAAe,EACf,QAAQ,GACT,EAAE,eAAe;;;;;;;;;;;;;;;;;;;IAgDjB"}
@@ -1,13 +1,13 @@
1
1
  import { tool } from 'ai';
2
2
  import { CountPlotChartSettings } from './schema';
3
- import { BaseChartToolParameters } from '../../../ai/tool-schemas';
4
- import { validateColumnExists } from '../../../ai/tool-validation';
3
+ import { BaseChartToolInput } from '../../../ai/tool-schemas';
5
4
  import { CATEGORICAL_COLUMN_TYPES } from '../../../column-types-utils';
6
- import { createOrUpdateChartPanel } from '../../../ai/tool-helpers';
7
- export const CountPlotToolParameters = BaseChartToolParameters.extend({
5
+ import { validateCountPlotSettings } from './validation';
6
+ import { ensureTable } from '../../../ai/tool-helpers';
7
+ export const CountPlotToolInput = BaseChartToolInput.extend({
8
8
  settings: CountPlotChartSettings.required(),
9
9
  });
10
- export function createCountPlotAiTool(deps) {
10
+ export function createCountPlotAiTool({ databaseAdapter, addChart, }) {
11
11
  return tool({
12
12
  description: `Count plot: horizontal bar chart showing frequency of categorical/text values. Counts how many times each unique value appears.
13
13
 
@@ -18,43 +18,36 @@ Required: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}
18
18
 
19
19
  NOTE: Count plots aggregate by counting unique values, so they handle large datasets efficiently (no data point limit).
20
20
 
21
- To UPDATE an existing count plot: provide the panelId parameter. Otherwise creates new panel.
22
-
23
21
  CRITICAL: Only for categorical data (text, categories, enums).
24
22
  Do NOT use for: numeric distributions (use histogram), relationships between columns (use scatter-plot), time series (use line-chart).`,
25
- inputSchema: CountPlotToolParameters,
26
- execute: async (params, context) => {
23
+ inputSchema: CountPlotToolInput,
24
+ execute: async ({ tableName, title, settings, panelId }) => {
27
25
  try {
28
- const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing, context);
29
- const { tableName, columns } = deps.resolveTable(artifactId, params.tableName);
30
- // Validate settings - expect categorical columns
31
- validateColumnExists(params.settings.field, CATEGORICAL_COLUMN_TYPES, columns, 'field');
32
- const result = createOrUpdateChartPanel(deps, {
33
- panelId: params.panelId,
34
- dashboardId: artifactId,
26
+ const dataTable = ensureTable(databaseAdapter, tableName);
27
+ validateCountPlotSettings({
28
+ dataTable,
29
+ settings,
30
+ });
31
+ const chartConfig = {
32
+ chartType: 'count-plot',
33
+ settings,
34
+ };
35
+ await addChart({
35
36
  tableName,
36
- title: `Count plot of ${params.settings.field}`,
37
- config: {
38
- chartType: 'count-plot',
39
- settings: params.settings,
40
- },
37
+ panelId,
38
+ title,
39
+ config: chartConfig,
41
40
  });
42
41
  return {
43
- llmResult: {
44
- success: true,
45
- details: params.panelId
46
- ? `Updated count plot "${result.title}".`
47
- : `Created count plot "${result.title}".`,
48
- data: result,
49
- },
42
+ success: true,
43
+ details: `Generated count plot configuration for "${settings.field}".`,
44
+ data: chartConfig,
50
45
  };
51
46
  }
52
47
  catch (error) {
53
48
  return {
54
- llmResult: {
55
- success: false,
56
- errorMessage: error instanceof Error ? error.message : String(error),
57
- },
49
+ success: false,
50
+ errorMessage: error instanceof Error ? error.message : String(error),
58
51
  };
59
52
  }
60
53
  },
@@ -1 +1 @@
1
- {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,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BAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,MAAM,CAAC,OAAO;4BACrB,CAAC,CAAC,uBAAuB,MAAM,CAAC,KAAK,IAAI;4BACzC,CAAC,CAAC,uBAAuB,MAAM,CAAC,KAAK,IAAI;wBAC3C,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {CountPlotChartSettings} from './schema';\nimport {BaseChartToolParameters} from '../../../ai/tool-schemas';\nimport {type DashboardToolDeps} from '../base-types';\nimport {validateColumnExists} from '../../../ai/tool-validation';\nimport {CATEGORICAL_COLUMN_TYPES} from '../../../column-types-utils';\nimport {createOrUpdateChartPanel} from '../../../ai/tool-helpers';\n\nexport const CountPlotToolParameters = BaseChartToolParameters.extend({\n settings: CountPlotChartSettings.required(),\n});\n\nexport type CountPlotToolParams = z.infer<typeof CountPlotToolParameters>;\n\nexport function createCountPlotAiTool(deps: DashboardToolDeps) {\n return tool({\n description: `Count plot: horizontal bar chart showing frequency of categorical/text values. Counts how many times each unique value appears.\n\nUse when: user asks to \"count\", \"frequency of\", \"how many\", \"breakdown by category\", \"distribution of [text/category column]\".\nExample queries: \"count by land use type\", \"how many features per administrative region\", \"frequency of terrain types\", \"breakdown by zone classification\", \"count parcels by ownership type\".\n\nRequired: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}).\n\nNOTE: Count plots aggregate by counting unique values, so they handle large datasets efficiently (no data point limit).\n\nTo UPDATE an existing count plot: provide the panelId parameter. Otherwise creates new panel.\n\nCRITICAL: Only for categorical data (text, categories, enums).\nDo NOT use for: numeric distributions (use histogram), relationships between columns (use scatter-plot), time series (use line-chart).`,\n inputSchema: CountPlotToolParameters,\n execute: async (params, context) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n context,\n );\n const {tableName, columns} = deps.resolveTable(\n artifactId,\n params.tableName,\n );\n\n // Validate settings - expect categorical columns\n validateColumnExists(\n params.settings.field,\n CATEGORICAL_COLUMN_TYPES,\n columns,\n 'field',\n );\n\n const result = createOrUpdateChartPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: `Count plot of ${params.settings.field}`,\n config: {\n chartType: 'count-plot',\n settings: params.settings,\n },\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated count plot \"${result.title}\".`\n : `Created count plot \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AAExB,OAAO,EAAuB,sBAAsB,EAAC,MAAM,UAAU,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAC,yBAAyB,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IAC1D,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,EACpC,eAAe,EACf,QAAQ,GACQ;IAChB,OAAO,IAAI,CAA4D;QACrE,WAAW,EAAE;;;;;4CAK2B,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;uIAKwD;QACnI,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,KAAK,EAAE,EAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAC,EAAE,EAAE;YACvD,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,WAAW,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;gBAE1D,yBAAyB,CAAC;oBACxB,SAAS;oBACT,QAAQ;iBACT,CAAC,CAAC;gBAEH,MAAM,WAAW,GAAyB;oBACxC,SAAS,EAAE,YAAqB;oBAChC,QAAQ;iBACT,CAAC;gBAEF,MAAM,QAAQ,CAAC;oBACb,SAAS;oBACT,OAAO;oBACP,KAAK;oBACL,MAAM,EAAE,WAAW;iBACpB,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,2CAA2C,QAAQ,CAAC,KAAK,IAAI;oBACtE,IAAI,EAAE,WAAW;iBAClB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,YAAY,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBACrE,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport {CountPlotChartConfig, CountPlotChartSettings} from './schema';\nimport {BaseChartToolInput} from '../../../ai/tool-schemas';\nimport {CATEGORICAL_COLUMN_TYPES} from '../../../column-types-utils';\nimport {ChartToolParams, ChartToolOutput} from '../tool-types';\nimport {validateCountPlotSettings} from './validation';\nimport {ensureTable} from '../../../ai/tool-helpers';\n\nexport const CountPlotToolInput = BaseChartToolInput.extend({\n settings: CountPlotChartSettings.required(),\n});\n\nexport type CountPlotToolInput = z.infer<typeof CountPlotToolInput>;\n\nexport function createCountPlotAiTool({\n databaseAdapter,\n addChart,\n}: ChartToolParams) {\n return tool<CountPlotToolInput, ChartToolOutput<CountPlotChartConfig>>({\n description: `Count plot: horizontal bar chart showing frequency of categorical/text values. Counts how many times each unique value appears.\n\nUse when: user asks to \"count\", \"frequency of\", \"how many\", \"breakdown by category\", \"distribution of [text/category column]\".\nExample queries: \"count by land use type\", \"how many features per administrative region\", \"frequency of terrain types\", \"breakdown by zone classification\", \"count parcels by ownership type\".\n\nRequired: field must be categorical/text (${CATEGORICAL_COLUMN_TYPES.join(', ')}).\n\nNOTE: Count plots aggregate by counting unique values, so they handle large datasets efficiently (no data point limit).\n\nCRITICAL: Only for categorical data (text, categories, enums).\nDo NOT use for: numeric distributions (use histogram), relationships between columns (use scatter-plot), time series (use line-chart).`,\n inputSchema: CountPlotToolInput,\n execute: async ({tableName, title, settings, panelId}) => {\n try {\n const dataTable = ensureTable(databaseAdapter, tableName);\n\n validateCountPlotSettings({\n dataTable,\n settings,\n });\n\n const chartConfig: CountPlotChartConfig = {\n chartType: 'count-plot' as const,\n settings,\n };\n\n await addChart({\n tableName,\n panelId,\n title,\n config: chartConfig,\n });\n\n return {\n success: true,\n details: `Generated count plot configuration for \"${settings.field}\".`,\n data: chartConfig,\n };\n } catch (error) {\n return {\n success: false,\n errorMessage: error instanceof Error ? error.message : String(error),\n };\n }\n },\n });\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { CountPlotChartSettings } from './schema';
2
+ import { ValidateSpecOptions } from '../base-types';
3
+ import { TableColumn } from '@sqlrooms/duckdb';
4
+ export type ValidatedCountPlotSettings = {
5
+ fieldColumn: TableColumn;
6
+ };
7
+ export declare function validateCountPlotSettings({ dataTable, settings: { field }, }: ValidateSpecOptions<CountPlotChartSettings>): ValidatedCountPlotSettings;
8
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/charts/chart-types/count-plot/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAOlD,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,EACxC,SAAS,EACT,QAAQ,EAAE,EAAC,KAAK,EAAC,GAClB,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,GAAG,0BAA0B,CAoB1E"}