drizzle-cube 0.9.0 → 0.9.2

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 (287) hide show
  1. package/dist/adapters/ActivityGridChart.config-BIHNNXe8.cjs +1 -0
  2. package/dist/adapters/ActivityGridChart.config-D8brFtkU.js +2 -0
  3. package/dist/adapters/AreaChart.config-BjBnqhrD.js +2 -0
  4. package/dist/adapters/AreaChart.config-hCYHwAaC.cjs +1 -0
  5. package/dist/adapters/BarChart.config-JWskLg7a.js +2 -0
  6. package/dist/adapters/BarChart.config-ldUoUV-V.cjs +1 -0
  7. package/dist/adapters/BoxPlotChart.config-DXgi-pWk.js +2 -0
  8. package/dist/adapters/BoxPlotChart.config-t7CU_SEB.cjs +1 -0
  9. package/dist/adapters/BubbleChart.config-BqNbgcs4.js +2 -0
  10. package/dist/adapters/BubbleChart.config-SRbrJWj2.cjs +1 -0
  11. package/dist/adapters/CandlestickChart.config-CTqj07at.cjs +1 -0
  12. package/dist/adapters/CandlestickChart.config-D-KaQpN1.js +2 -0
  13. package/dist/adapters/DataTable.config-4QtzEm2K.js +2 -0
  14. package/dist/adapters/DataTable.config-C4OZyZKL.cjs +1 -0
  15. package/dist/adapters/DotStripChart.config-CrwF5K67.cjs +1 -0
  16. package/dist/adapters/DotStripChart.config-tmdykLsT.js +2 -0
  17. package/dist/adapters/FunnelChart.config-Dk7bb3KU.cjs +1 -0
  18. package/dist/adapters/FunnelChart.config-Uah6h6t6.js +2 -0
  19. package/dist/adapters/GaugeChart.config-BGi82n3v.cjs +1 -0
  20. package/dist/adapters/GaugeChart.config-DIWl6xVG.js +2 -0
  21. package/dist/adapters/HeatMapChart.config-C1Wl6SHf.js +2 -0
  22. package/dist/adapters/HeatMapChart.config-CsA67rfc.cjs +1 -0
  23. package/dist/adapters/KpiDelta.config-CBo61Kp9.cjs +1 -0
  24. package/dist/adapters/KpiDelta.config-CgYK9zIF.js +2 -0
  25. package/dist/adapters/KpiNumber.config-BqQjoY4A.cjs +1 -0
  26. package/dist/adapters/KpiNumber.config-Dt8kOvIA.js +2 -0
  27. package/dist/adapters/KpiText.config-BE8HbXQ0.js +2 -0
  28. package/dist/adapters/KpiText.config-DaSbcfKE.cjs +1 -0
  29. package/dist/adapters/LineChart.config-CUPtbHNz.cjs +1 -0
  30. package/dist/adapters/LineChart.config-DHlctcYT.js +2 -0
  31. package/dist/adapters/MarkdownChart.config-B0T5A7dw.js +2 -0
  32. package/dist/adapters/MarkdownChart.config-iV60Icd3.cjs +1 -0
  33. package/dist/adapters/MeasureProfileChart.config-CBCezRPr.cjs +1 -0
  34. package/dist/adapters/MeasureProfileChart.config-CO9Cc3Ha.js +2 -0
  35. package/dist/adapters/PieChart.config-D6Ofc2h-.js +2 -0
  36. package/dist/adapters/PieChart.config-TOCX24yj.cjs +1 -0
  37. package/dist/adapters/ProportionBarChart.config-BfiCmXI7.js +2 -0
  38. package/dist/adapters/ProportionBarChart.config-Bh8_aieC.cjs +1 -0
  39. package/dist/adapters/RadarChart.config-BfWKUYv4.cjs +1 -0
  40. package/dist/adapters/RadarChart.config-x87UPfQH.js +2 -0
  41. package/dist/adapters/RadialBarChart.config-BGA-fVmo.js +2 -0
  42. package/dist/adapters/RadialBarChart.config-Bo3E1IWc.cjs +1 -0
  43. package/dist/adapters/RecordsTable.config-CKb4xY0c.cjs +1 -0
  44. package/dist/adapters/RecordsTable.config-KsPOo8YB.js +2 -0
  45. package/dist/adapters/RetentionCombinedChart.config-DVDQBMW8.js +2 -0
  46. package/dist/adapters/RetentionCombinedChart.config-DqfOBn6k.cjs +1 -0
  47. package/dist/adapters/RetentionHeatmap.config-B7NVTM5_.cjs +1 -0
  48. package/dist/adapters/RetentionHeatmap.config-tnd7N7g-.js +2 -0
  49. package/dist/adapters/SankeyChart.config-B1K4e0RA.js +2 -0
  50. package/dist/adapters/SankeyChart.config-I26Q_e5f.cjs +1 -0
  51. package/dist/adapters/ScatterChart.config-CMta6GGl.cjs +1 -0
  52. package/dist/adapters/ScatterChart.config-WwER0vgC.js +2 -0
  53. package/dist/adapters/SunburstChart.config-CBYye6Ez.js +2 -0
  54. package/dist/adapters/SunburstChart.config-DbC1AZCI.cjs +1 -0
  55. package/dist/adapters/TreeMapChart.config-EcJf0Dzm.cjs +1 -0
  56. package/dist/adapters/TreeMapChart.config-wNJWipDf.js +2 -0
  57. package/dist/adapters/WaterfallChart.config--d2EuVF-.cjs +1 -0
  58. package/dist/adapters/WaterfallChart.config-CPJLjH4K.js +2 -0
  59. package/dist/adapters/{compiler-SBDjxyQ3.js → compiler-B4tLaYye.js} +10 -10
  60. package/dist/adapters/{compiler-BdVMQ3Xj.cjs → compiler-BYm93X_G.cjs} +5 -5
  61. package/dist/adapters/core/index.cjs +1 -1
  62. package/dist/adapters/core/index.js +1 -1
  63. package/dist/adapters/{core-CSt8MGbw.cjs → core-BQEJzwTJ.cjs} +1 -1
  64. package/dist/adapters/{core-CXrxqh7l.js → core-CVDf8WNs.js} +2 -2
  65. package/dist/adapters/express/index.cjs +1 -1
  66. package/dist/adapters/express/index.js +5 -5
  67. package/dist/adapters/fastify/index.cjs +1 -1
  68. package/dist/adapters/fastify/index.js +5 -5
  69. package/dist/adapters/{handler-Cppe-aqH.js → handler-Ck2X85KS.js} +170 -151
  70. package/dist/adapters/handler-MFn_eVcJ.cjs +16 -0
  71. package/dist/adapters/hono/index.cjs +1 -1
  72. package/dist/adapters/hono/index.js +4 -4
  73. package/dist/adapters/mcp-app-html-V1nZOil3.cjs +1 -0
  74. package/dist/adapters/mcp-app-html-sD7j035f.js +5 -0
  75. package/dist/adapters/mcp-app-html.cjs +1 -0
  76. package/dist/adapters/mcp-app-html.d.ts +25 -0
  77. package/dist/adapters/mcp-app-html.js +2 -0
  78. package/dist/adapters/mcp-tools.cjs +1 -1
  79. package/dist/adapters/mcp-tools.js +21 -20
  80. package/dist/adapters/mcp-transport-BQxL1h2h.cjs +42 -0
  81. package/dist/adapters/mcp-transport-yJDy3T6W.js +758 -0
  82. package/dist/adapters/mcp-transport.d.ts +19 -2
  83. package/dist/adapters/nextjs/index.cjs +1 -1
  84. package/dist/adapters/nextjs/index.js +5 -5
  85. package/dist/adapters/{openai-BIoIunc7.js → openai-B7EVH3cl.js} +2578 -1797
  86. package/dist/adapters/openai-BkD4iuG8.cjs +19 -0
  87. package/dist/adapters/{openai-62sEF0Ev.js → openai-DRFOtBUU.js} +1 -1
  88. package/dist/adapters/{openai-CaxNY6TC.cjs → openai-FjvP4Mek.cjs} +1 -1
  89. package/dist/adapters/{utils-C_RKaP0n.js → utils-BY3FDOmN.js} +8 -1
  90. package/dist/adapters/utils-BkdzL4m9.cjs +132 -0
  91. package/dist/adapters/utils.cjs +1 -1
  92. package/dist/adapters/utils.js +1 -1
  93. package/dist/cjs/adapters/mcp-app-html.d.ts +25 -0
  94. package/dist/cjs/adapters/mcp-transport.d.ts +19 -2
  95. package/dist/cjs/client/charts/chartConfigs.d.ts +34 -0
  96. package/dist/cjs/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +10 -2
  97. package/dist/cjs/client/components/AnalysisBuilder/TemplateEditor.d.ts +17 -0
  98. package/dist/cjs/client/components/AnalysisBuilder/templateSyntax.d.ts +26 -0
  99. package/dist/cjs/client/components/analyticsPortlet/parsePortletQuery.d.ts +12 -0
  100. package/dist/cjs/client/components/analyticsPortlet/portletRenderState.d.ts +7 -0
  101. package/dist/cjs/client/components/charts/MarkdownChart.d.ts +1 -1
  102. package/dist/cjs/client/components/charts/MarkdownChart.helpers.d.ts +156 -0
  103. package/dist/cjs/client/components/charts/markdownTemplate.d.ts +92 -0
  104. package/dist/client/charts/chartConfigs.d.ts +34 -0
  105. package/dist/client/charts.js +12 -12
  106. package/dist/client/chunks/{DashboardEditModal-DjMGNTUa.js → DashboardEditModal-B8zIH0ja.js} +2529 -2368
  107. package/dist/client/chunks/DashboardEditModal-B8zIH0ja.js.map +1 -0
  108. package/dist/client/chunks/{DotStripChart-EEtJyV1v.js → DotStripChart-BCgHGY0s.js} +4 -4
  109. package/dist/client/chunks/{DotStripChart-EEtJyV1v.js.map → DotStripChart-BCgHGY0s.js.map} +1 -1
  110. package/dist/client/chunks/{ProportionBarChart-3r7ZPX-V.js → ProportionBarChart-DzdKxzr4.js} +3 -3
  111. package/dist/client/chunks/{ProportionBarChart-3r7ZPX-V.js.map → ProportionBarChart-DzdKxzr4.js.map} +1 -1
  112. package/dist/client/chunks/{RecordsTable-DvMXV6F6.js → RecordsTable-kQfZ25Pz.js} +4 -4
  113. package/dist/client/chunks/{RecordsTable-DvMXV6F6.js.map → RecordsTable-kQfZ25Pz.js.map} +1 -1
  114. package/dist/client/chunks/{RetentionCombinedChart-DbxB86fj.js → RetentionCombinedChart-CvddCEOk.js} +3 -3
  115. package/dist/client/chunks/{RetentionCombinedChart-DbxB86fj.js.map → RetentionCombinedChart-CvddCEOk.js.map} +1 -1
  116. package/dist/client/chunks/{RetentionHeatmap-CE3rxhAU.js → RetentionHeatmap-BURt-mfm.js} +2 -2
  117. package/dist/client/chunks/{RetentionHeatmap-CE3rxhAU.js.map → RetentionHeatmap-BURt-mfm.js.map} +1 -1
  118. package/dist/client/chunks/{analysis-builder-lQk_qJBQ.js → analysis-builder-C0hzThmQ.js} +1688 -1675
  119. package/dist/client/chunks/{analysis-builder-lQk_qJBQ.js.map → analysis-builder-C0hzThmQ.js.map} +1 -1
  120. package/dist/client/chunks/{analysis-builder-shared-C_pLSXJR.js → analysis-builder-shared-CQFcY6vA.js} +476 -476
  121. package/dist/client/chunks/{analysis-builder-shared-C_pLSXJR.js.map → analysis-builder-shared-CQFcY6vA.js.map} +1 -1
  122. package/dist/client/chunks/{chart-activity-grid-UZIp9_2E.js → chart-activity-grid-aIyjUpbJ.js} +9 -2
  123. package/dist/client/chunks/chart-activity-grid-aIyjUpbJ.js.map +1 -0
  124. package/dist/client/chunks/{chart-area-CEBcvCcn.js → chart-area-DCCvp06H.js} +3 -3
  125. package/dist/client/chunks/{chart-area-CEBcvCcn.js.map → chart-area-DCCvp06H.js.map} +1 -1
  126. package/dist/client/chunks/{chart-bar-DGh7cpU-.js → chart-bar-C8xQ15Aa.js} +3 -3
  127. package/dist/client/chunks/{chart-bar-DGh7cpU-.js.map → chart-bar-C8xQ15Aa.js.map} +1 -1
  128. package/dist/client/chunks/{chart-box-plot-CeqoKPFa.js → chart-box-plot-DFMjBoL1.js} +2 -2
  129. package/dist/client/chunks/{chart-box-plot-CeqoKPFa.js.map → chart-box-plot-DFMjBoL1.js.map} +1 -1
  130. package/dist/client/chunks/{chart-bubble-8uH_JKNt.js → chart-bubble-CavhSOT8.js} +2 -2
  131. package/dist/client/chunks/{chart-bubble-8uH_JKNt.js.map → chart-bubble-CavhSOT8.js.map} +1 -1
  132. package/dist/client/chunks/{chart-candlestick-DogklMg1.js → chart-candlestick-BlJ6l-0-.js} +2 -2
  133. package/dist/client/chunks/{chart-candlestick-DogklMg1.js.map → chart-candlestick-BlJ6l-0-.js.map} +1 -1
  134. package/dist/client/chunks/{chart-config-markdown-C5kBQOjP.js → chart-config-markdown-CK8PAWUg.js} +8 -3
  135. package/dist/client/chunks/chart-config-markdown-CK8PAWUg.js.map +1 -0
  136. package/dist/client/chunks/{chart-data-table-CCvvgeG_.js → chart-data-table-Dfup1JpL.js} +426 -423
  137. package/dist/client/chunks/chart-data-table-Dfup1JpL.js.map +1 -0
  138. package/dist/client/chunks/{chart-funnel-D2vGQhaz.js → chart-funnel-DqBD-oth.js} +2 -2
  139. package/dist/client/chunks/{chart-funnel-D2vGQhaz.js.map → chart-funnel-DqBD-oth.js.map} +1 -1
  140. package/dist/client/chunks/{chart-gauge-DbU0rxqv.js → chart-gauge-Tr9BRoTo.js} +3 -3
  141. package/dist/client/chunks/{chart-gauge-DbU0rxqv.js.map → chart-gauge-Tr9BRoTo.js.map} +1 -1
  142. package/dist/client/chunks/{chart-heat-map-x6aQq91x.js → chart-heat-map-V200X1EP.js} +3 -3
  143. package/dist/client/chunks/{chart-heat-map-x6aQq91x.js.map → chart-heat-map-V200X1EP.js.map} +1 -1
  144. package/dist/client/chunks/{chart-kpi-delta-B2-m16QC.js → chart-kpi-delta-DuXkAxKV.js} +3 -3
  145. package/dist/client/chunks/{chart-kpi-delta-B2-m16QC.js.map → chart-kpi-delta-DuXkAxKV.js.map} +1 -1
  146. package/dist/client/chunks/{chart-kpi-number-DggvlYT_.js → chart-kpi-number-CzRaT5KF.js} +5 -5
  147. package/dist/client/chunks/{chart-kpi-number-DggvlYT_.js.map → chart-kpi-number-CzRaT5KF.js.map} +1 -1
  148. package/dist/client/chunks/{chart-kpi-text-BFy-m1NP.js → chart-kpi-text-DxMl_C7M.js} +3 -3
  149. package/dist/client/chunks/{chart-kpi-text-BFy-m1NP.js.map → chart-kpi-text-DxMl_C7M.js.map} +1 -1
  150. package/dist/client/chunks/{chart-line-C4r44HWi.js → chart-line-rl9q-vom.js} +3 -3
  151. package/dist/client/chunks/{chart-line-C4r44HWi.js.map → chart-line-rl9q-vom.js.map} +1 -1
  152. package/dist/client/chunks/chart-markdown-DJq7fXKF.js +8622 -0
  153. package/dist/client/chunks/chart-markdown-DJq7fXKF.js.map +1 -0
  154. package/dist/client/chunks/{chart-measure-profile-Dc-d82kF.js → chart-measure-profile-BDpkr55p.js} +3 -3
  155. package/dist/client/chunks/{chart-measure-profile-Dc-d82kF.js.map → chart-measure-profile-BDpkr55p.js.map} +1 -1
  156. package/dist/client/chunks/{chart-pie-BHrPxga2.js → chart-pie-W4Mk0WFB.js} +3 -3
  157. package/dist/client/chunks/{chart-pie-BHrPxga2.js.map → chart-pie-W4Mk0WFB.js.map} +1 -1
  158. package/dist/client/chunks/{chart-radar-I9sOFbG5.js → chart-radar-BXkMOUVC.js} +3 -3
  159. package/dist/client/chunks/{chart-radar-I9sOFbG5.js.map → chart-radar-BXkMOUVC.js.map} +1 -1
  160. package/dist/client/chunks/{chart-radial-bar-DeDMMf9P.js → chart-radial-bar-CSw1hCK2.js} +3 -3
  161. package/dist/client/chunks/{chart-radial-bar-DeDMMf9P.js.map → chart-radial-bar-CSw1hCK2.js.map} +1 -1
  162. package/dist/client/chunks/{chart-sankey-1qB7yWHq.js → chart-sankey-CXG8SeW3.js} +2 -2
  163. package/dist/client/chunks/{chart-sankey-1qB7yWHq.js.map → chart-sankey-CXG8SeW3.js.map} +1 -1
  164. package/dist/client/chunks/{chart-scatter-BHttSxcc.js → chart-scatter-BHp1yLvR.js} +3 -3
  165. package/dist/client/chunks/{chart-scatter-BHttSxcc.js.map → chart-scatter-BHp1yLvR.js.map} +1 -1
  166. package/dist/client/chunks/{chart-sunburst-Cmzol8kR.js → chart-sunburst-CHgQCRCz.js} +3 -3
  167. package/dist/client/chunks/{chart-sunburst-Cmzol8kR.js.map → chart-sunburst-CHgQCRCz.js.map} +1 -1
  168. package/dist/client/chunks/{chart-tree-map-CdSwr_zI.js → chart-tree-map-YBAOj00L.js} +3 -3
  169. package/dist/client/chunks/{chart-tree-map-CdSwr_zI.js.map → chart-tree-map-YBAOj00L.js.map} +1 -1
  170. package/dist/client/chunks/{chart-waterfall-BN3B5luW.js → chart-waterfall-CSQ3xvUJ.js} +3 -3
  171. package/dist/client/chunks/{chart-waterfall-BN3B5luW.js.map → chart-waterfall-CSQ3xvUJ.js.map} +1 -1
  172. package/dist/client/chunks/{charts-core-DIneMirc.js → charts-core-ghjDtt0_.js} +2 -2
  173. package/dist/client/chunks/{charts-core-DIneMirc.js.map → charts-core-ghjDtt0_.js.map} +1 -1
  174. package/dist/client/chunks/charts-loader-B_ye_C5_.js +87 -0
  175. package/dist/client/chunks/{charts-loader-OHpTBq8c.js.map → charts-loader-B_ye_C5_.js.map} +1 -1
  176. package/dist/client/chunks/{dist-BPmPx7kz.js → dist-COqN0-Yj.js} +4 -4
  177. package/dist/client/chunks/{dist-BPmPx7kz.js.map → dist-COqN0-Yj.js.map} +1 -1
  178. package/dist/client/chunks/{exceljs.min-CiByP8VQ.js → exceljs.min-CdNVdwM3.js} +8 -11
  179. package/dist/client/chunks/{exceljs.min-CiByP8VQ.js.map → exceljs.min-CdNVdwM3.js.map} +1 -1
  180. package/dist/client/chunks/{nl-NL-dk-kC0sL.js → nl-NL-CKdVNqSp.js} +8 -1
  181. package/dist/client/chunks/nl-NL-CKdVNqSp.js.map +1 -0
  182. package/dist/client/chunks/{schema-visualization-PYa578pV.js → schema-visualization-txYCG4v5.js} +4 -4
  183. package/dist/client/chunks/{schema-visualization-PYa578pV.js.map → schema-visualization-txYCG4v5.js.map} +1 -1
  184. package/dist/client/chunks/{useDirtyStateTracking-BQupC3wJ.js → useDirtyStateTracking-BUk23Wbh.js} +6 -6
  185. package/dist/client/chunks/{useDirtyStateTracking-BQupC3wJ.js.map → useDirtyStateTracking-BUk23Wbh.js.map} +1 -1
  186. package/dist/client/chunks/{useExplainAI-DORnTynt.js → useExplainAI-CGLroDBD.js} +5 -5
  187. package/dist/client/chunks/{useExplainAI-DORnTynt.js.map → useExplainAI-CGLroDBD.js.map} +1 -1
  188. package/dist/client/chunks/{vendor-DDo8nSGP.js → vendor-CApRxi77.js} +5 -6
  189. package/dist/client/chunks/{vendor-DDo8nSGP.js.map → vendor-CApRxi77.js.map} +1 -1
  190. package/dist/client/components/AnalysisBuilder/AnalysisChartConfigPanel.d.ts +10 -2
  191. package/dist/client/components/AnalysisBuilder/TemplateEditor.d.ts +17 -0
  192. package/dist/client/components/AnalysisBuilder/templateSyntax.d.ts +26 -0
  193. package/dist/client/components/analyticsPortlet/parsePortletQuery.d.ts +12 -0
  194. package/dist/client/components/analyticsPortlet/portletRenderState.d.ts +7 -0
  195. package/dist/client/components/charts/MarkdownChart.d.ts +1 -1
  196. package/dist/client/components/charts/MarkdownChart.helpers.d.ts +156 -0
  197. package/dist/client/components/charts/markdownTemplate.d.ts +92 -0
  198. package/dist/client/components.js +2 -2
  199. package/dist/client/hooks.js +3 -3
  200. package/dist/client/icons.js +1 -1
  201. package/dist/client/index.js +409 -409
  202. package/dist/client/index.js.map +1 -1
  203. package/dist/client/providers.js +1 -1
  204. package/dist/client/schema.js +1 -1
  205. package/dist/client/styles.css +1 -1
  206. package/dist/client/utils.js +4 -4
  207. package/dist/client-bundle-stats.html +1 -1
  208. package/dist/mcp-app/mcp-app.html +190 -132
  209. package/dist/server/index.cjs +17 -23
  210. package/dist/server/index.js +176 -147
  211. package/dist/server/openai-BWGYfr6Z.cjs +19 -0
  212. package/dist/server/{openai-nBhuSFd3.js → openai-Cap1nBuK.js} +1 -1
  213. package/dist/server/{openai-C1gLuR-0.js → openai-DW5TRMXE.js} +2577 -1796
  214. package/dist/server/{openai-rF50ZEiR.cjs → openai-G2EivP-n.cjs} +1 -1
  215. package/package.json +14 -3
  216. package/dist/adapters/ActivityGridChart.config-DfyZh3He.js +0 -2
  217. package/dist/adapters/ActivityGridChart.config-DgOwl51m.cjs +0 -1
  218. package/dist/adapters/AreaChart.config-BL_ZpMsg.js +0 -2
  219. package/dist/adapters/AreaChart.config-rc1phjmI.cjs +0 -1
  220. package/dist/adapters/BarChart.config-C6k4BxhM.cjs +0 -1
  221. package/dist/adapters/BarChart.config-CBACR7Z-.js +0 -2
  222. package/dist/adapters/BoxPlotChart.config-Bvg6yFn2.js +0 -2
  223. package/dist/adapters/BoxPlotChart.config-CAlLRM0v.cjs +0 -1
  224. package/dist/adapters/BubbleChart.config-22qXNskY.js +0 -2
  225. package/dist/adapters/BubbleChart.config-BkB3P6Bi.cjs +0 -1
  226. package/dist/adapters/CandlestickChart.config-DuZb-y6d.cjs +0 -1
  227. package/dist/adapters/CandlestickChart.config-G78UbuwS.js +0 -2
  228. package/dist/adapters/DataTable.config-BXkpzOC2.js +0 -2
  229. package/dist/adapters/DataTable.config-CwPlSht6.cjs +0 -1
  230. package/dist/adapters/DotStripChart.config-Bw9Ww5zY.cjs +0 -1
  231. package/dist/adapters/DotStripChart.config-D5sbLAqA.js +0 -2
  232. package/dist/adapters/FunnelChart.config-CUs1rqN2.cjs +0 -1
  233. package/dist/adapters/FunnelChart.config-Cw9qrC2C.js +0 -2
  234. package/dist/adapters/GaugeChart.config-CjGtJVoO.cjs +0 -1
  235. package/dist/adapters/GaugeChart.config-F5SA5Oi3.js +0 -2
  236. package/dist/adapters/HeatMapChart.config-CvgmSiuY.cjs +0 -1
  237. package/dist/adapters/HeatMapChart.config-DrvQrPHT.js +0 -2
  238. package/dist/adapters/KpiDelta.config-B-UJWdJ5.cjs +0 -1
  239. package/dist/adapters/KpiDelta.config-C00mTZYy.js +0 -2
  240. package/dist/adapters/KpiNumber.config-CB0kTeoV.cjs +0 -1
  241. package/dist/adapters/KpiNumber.config-D3CogH8j.js +0 -2
  242. package/dist/adapters/KpiText.config-B0LbKRCf.js +0 -2
  243. package/dist/adapters/KpiText.config-Dv4TNprC.cjs +0 -1
  244. package/dist/adapters/LineChart.config-CdONxSLL.js +0 -2
  245. package/dist/adapters/LineChart.config-DBHsfIYG.cjs +0 -1
  246. package/dist/adapters/MarkdownChart.config-AYKXdpuw.cjs +0 -1
  247. package/dist/adapters/MarkdownChart.config-CngxD_Lc.js +0 -2
  248. package/dist/adapters/MeasureProfileChart.config-B0a5sUk6.cjs +0 -1
  249. package/dist/adapters/MeasureProfileChart.config-ByW5F1Ey.js +0 -2
  250. package/dist/adapters/PieChart.config-Csx1ctk4.js +0 -2
  251. package/dist/adapters/PieChart.config-Dfw66Xab.cjs +0 -1
  252. package/dist/adapters/ProportionBarChart.config-BaeYznc1.cjs +0 -1
  253. package/dist/adapters/ProportionBarChart.config-DCOizSVs.js +0 -2
  254. package/dist/adapters/RadarChart.config-AxQh97rB.js +0 -2
  255. package/dist/adapters/RadarChart.config-BjP-zEGW.cjs +0 -1
  256. package/dist/adapters/RadialBarChart.config-D5EwyJ0G.cjs +0 -1
  257. package/dist/adapters/RadialBarChart.config-DMaEJYM_.js +0 -2
  258. package/dist/adapters/RecordsTable.config-BdN0kZ8b.js +0 -2
  259. package/dist/adapters/RecordsTable.config-CWRvGDbi.cjs +0 -1
  260. package/dist/adapters/RetentionCombinedChart.config-BpciOTeX.cjs +0 -1
  261. package/dist/adapters/RetentionCombinedChart.config-CY8TDzuy.js +0 -2
  262. package/dist/adapters/RetentionHeatmap.config-BZPRoVpF.cjs +0 -1
  263. package/dist/adapters/RetentionHeatmap.config-YMZt-u-T.js +0 -2
  264. package/dist/adapters/SankeyChart.config-BdSA-Jlp.cjs +0 -1
  265. package/dist/adapters/SankeyChart.config-Dlgi5_DA.js +0 -2
  266. package/dist/adapters/ScatterChart.config-VJ0xG0Ak.cjs +0 -1
  267. package/dist/adapters/ScatterChart.config-oOd1Jplx.js +0 -2
  268. package/dist/adapters/SunburstChart.config-Cllhyjy4.js +0 -2
  269. package/dist/adapters/SunburstChart.config-DU11BAei.cjs +0 -1
  270. package/dist/adapters/TreeMapChart.config--EB8bQTo.js +0 -2
  271. package/dist/adapters/TreeMapChart.config-BPmMLBH1.cjs +0 -1
  272. package/dist/adapters/WaterfallChart.config-E99Fl6uM.cjs +0 -1
  273. package/dist/adapters/WaterfallChart.config-xz3DaoMQ.js +0 -2
  274. package/dist/adapters/handler-_u5krbOj.cjs +0 -26
  275. package/dist/adapters/mcp-transport-CpF7usmR.js +0 -754
  276. package/dist/adapters/mcp-transport-DXIfb0p-.cjs +0 -42
  277. package/dist/adapters/openai-EBTQKJnV.cjs +0 -19
  278. package/dist/adapters/utils-DXWQUJbD.cjs +0 -128
  279. package/dist/client/chunks/DashboardEditModal-DjMGNTUa.js.map +0 -1
  280. package/dist/client/chunks/chart-activity-grid-UZIp9_2E.js.map +0 -1
  281. package/dist/client/chunks/chart-config-markdown-C5kBQOjP.js.map +0 -1
  282. package/dist/client/chunks/chart-data-table-CCvvgeG_.js.map +0 -1
  283. package/dist/client/chunks/chart-markdown-b0qPZ617.js +0 -3926
  284. package/dist/client/chunks/chart-markdown-b0qPZ617.js.map +0 -1
  285. package/dist/client/chunks/charts-loader-OHpTBq8c.js +0 -87
  286. package/dist/client/chunks/nl-NL-dk-kC0sL.js.map +0 -1
  287. package/dist/server/openai-BmADmD1e.cjs +0 -19
@@ -1114,7 +1114,7 @@ var nt = class extends w {
1114
1114
  if (!t || t.length === 0) return e;
1115
1115
  for (let n = 0; n < e.length; n++) {
1116
1116
  let r = e[n];
1117
- if (!(!r || typeof r != "object")) for (let e of t) {
1117
+ if (r && typeof r == "object") for (let e of t) {
1118
1118
  let t = r[e];
1119
1119
  t != null && typeof t != "number" && (r[e] = this.coerceToNumber(t));
1120
1120
  }
@@ -2376,6 +2376,11 @@ var pn = {
2376
2376
  "chart.markdown.label": "Markdown",
2377
2377
  "chart.markdown.description": "Display custom markdown content with formatting",
2378
2378
  "chart.markdown.useCase": "Perfect for adding documentation, notes, section headers, instructions, or formatted text to dashboards",
2379
+ "chart.markdown.contentHint": "Markdown, or a data template when a query is attached",
2380
+ "chart.markdown.contentDescription": "Markdown. With a query attached it becomes a template. Variables: rows, labelled, data, rowCount, first, last.",
2381
+ "chart.markdown.contentDocsLabel": "Template syntax reference",
2382
+ "chart.config.learnMore": "Learn more",
2383
+ "chart.markdown.contentPlaceholder": "## Headcount\n\nWe employ **{{ rows | map:\"employees_count\" | sum }}** people across {{ rowCount }} teams.\n\n{{ labelled | table }}",
2379
2384
  "chart.funnel.label": "Funnel Chart",
2380
2385
  "chart.funnel.description": "Show conversion through sequential steps",
2381
2386
  "chart.funnel.useCase": "Best for visualising user journey funnels, sales pipelines, or multi-step processes",
@@ -3227,6 +3232,8 @@ var pn = {
3227
3232
  "chart.runtime.kpiNumber.noData": "No data",
3228
3233
  "chart.runtime.markdown.noContent": "No content",
3229
3234
  "chart.runtime.markdown.addContent": "Add markdown content in the chart configuration",
3235
+ "chart.runtime.markdown.templateError": "Template error",
3236
+ "chart.runtime.markdown.templateWarning": "Unresolved references",
3230
3237
  "chart.runtime.axisFormat.label": "Label",
3231
3238
  "chart.runtime.axisFormat.autoLabel": "Auto-generated label",
3232
3239
  "chart.runtime.axisFormat.unit": "Unit",
@@ -4444,7 +4451,7 @@ var Fn = class e {
4444
4451
  let r = /* @__PURE__ */ new Set();
4445
4452
  for (let i of e.dimensions || []) {
4446
4453
  let [e, a] = i.split("."), o = t.get(e)?.dimensions?.[a]?.correlatesOn;
4447
- !o || r.has(o) || (r.add(o), n.push(o));
4454
+ o && !r.has(o) && (r.add(o), n.push(o));
4448
4455
  }
4449
4456
  }
4450
4457
  hasAggregateMeasures(e, t) {
@@ -6542,7 +6549,7 @@ var oi = class {
6542
6549
  if (this.cacheConfig?.enabled !== !1 && this.cacheConfig?.provider) return Xr(e, t, this.cacheConfig, n);
6543
6550
  }
6544
6551
  async lookup(e, t) {
6545
- if (!(!e || !this.cacheConfig?.provider)) {
6552
+ if (e && this.cacheConfig?.provider) {
6546
6553
  if (t) {
6547
6554
  this.cacheConfig.onCacheEvent?.({
6548
6555
  type: "miss",
@@ -6582,7 +6589,7 @@ var oi = class {
6582
6589
  }
6583
6590
  }
6584
6591
  async store(e, t) {
6585
- if (!(!e || !this.cacheConfig?.provider)) try {
6592
+ if (e && this.cacheConfig?.provider) try {
6586
6593
  let n = Date.now();
6587
6594
  await this.cacheConfig.provider.set(e, t, this.cacheConfig.defaultTtlMs ?? 3e5), this.cacheConfig.onCacheEvent?.({
6588
6595
  type: "set",
@@ -7504,7 +7511,7 @@ var mi = {
7504
7511
  })) : n.push(A("server.validation.retention.bindingKeyCubeNotFound", { cubeName: r }));
7505
7512
  }
7506
7513
  validateBreakdownDimensions(e, t, n) {
7507
- if (!(!e.breakdownDimensions || e.breakdownDimensions.length === 0)) for (let r of e.breakdownDimensions) {
7514
+ if (e.breakdownDimensions && e.breakdownDimensions.length !== 0) for (let r of e.breakdownDimensions) {
7508
7515
  let [e, i] = r.split(".");
7509
7516
  if (!e || !i) {
7510
7517
  n.push(A("server.validation.retention.invalidBreakdownDimFormat", { dimension: r }));
@@ -7984,7 +7991,7 @@ var Si = class {
7984
7991
  if (!e?.joins) return !1;
7985
7992
  for (let [, r] of Object.entries(e.joins)) {
7986
7993
  let e = T(r.targetCube, n);
7987
- if (!(!e || e.name !== t) && (r.relationship === "belongsTo" || r.relationship === "hasOne")) return !0;
7994
+ if (e && e.name === t && (r.relationship === "belongsTo" || r.relationship === "hasOne")) return !0;
7988
7995
  }
7989
7996
  return !1;
7990
7997
  }
@@ -8104,7 +8111,7 @@ var Si = class {
8104
8111
  }
8105
8112
  getPrimaryKeyColumns(e) {
8106
8113
  let t = [];
8107
- for (let [n, r] of Object.entries(e.dimensions ?? {})) !r.primaryKey || typeof r.sql == "function" || t.push({
8114
+ for (let [n, r] of Object.entries(e.dimensions ?? {})) r.primaryKey && typeof r.sql != "function" && t.push({
8108
8115
  column: r.sql,
8109
8116
  alias: `${e.name}.${n}`
8110
8117
  });
@@ -8193,7 +8200,7 @@ function Ti(e, t, n, r) {
8193
8200
  function Ei(e, t, n) {
8194
8201
  let r = /* @__PURE__ */ new Map();
8195
8202
  if (!e.preAggregationCTEs || e.preAggregationCTEs.length === 0) return r;
8196
- for (let i of e.preAggregationCTEs) if (!(!i.propagatingFilters || i.propagatingFilters.length === 0)) for (let e of i.propagatingFilters) {
8203
+ for (let i of e.preAggregationCTEs) if (i.propagatingFilters && i.propagatingFilters.length !== 0) for (let e of i.propagatingFilters) {
8197
8204
  let i = e.sourceCube.name;
8198
8205
  if (!r.has(i)) {
8199
8206
  let a = { filters: e.filters }, o = /* @__PURE__ */ new Map([[i, e.sourceCube]]), s = n.queryBuilder.buildWhereConditions(o, a, t);
@@ -8383,7 +8390,7 @@ function Li(e, t, n, r, i, a) {
8383
8390
  let c = /* @__PURE__ */ new Set(), l = Bi(e);
8384
8391
  if (e.joinCubes && e.joinCubes.length > 0) for (let n of e.joinCubes) {
8385
8392
  let r = n.cube.name;
8386
- l.has(r) && !i.cteAliasMap.has(r) || (s = Vi(s, n, e, i, t, o), s = Wi(s, n, e, i, t, a, c));
8393
+ (!l.has(r) || i.cteAliasMap.has(r)) && (s = Vi(s, n, e, i, t, o), s = Wi(s, n, e, i, t, a, c));
8387
8394
  }
8388
8395
  return {
8389
8396
  drizzleQuery: s,
@@ -14409,7 +14416,7 @@ var lf = [
14409
14416
  //#endregion
14410
14417
  //#region src/server/agent/system-prompt.ts
14411
14418
  function uf(e, t) {
14412
- if (!(!t.measures || t.measures.length === 0)) {
14419
+ if (t.measures && t.measures.length !== 0) {
14413
14420
  e.push(""), e.push("**Measures:**");
14414
14421
  for (let n of t.measures) {
14415
14422
  let r = n.description ? ` - ${n.description}` : "";
@@ -14418,7 +14425,7 @@ function uf(e, t) {
14418
14425
  }
14419
14426
  }
14420
14427
  function df(e, t) {
14421
- if (!(!t.dimensions || t.dimensions.length === 0)) {
14428
+ if (t.dimensions && t.dimensions.length !== 0) {
14422
14429
  e.push(""), e.push("**Dimensions:**");
14423
14430
  for (let n of t.dimensions) {
14424
14431
  let r = n.description ? ` - ${n.description}` : "";
@@ -14427,7 +14434,7 @@ function df(e, t) {
14427
14434
  }
14428
14435
  }
14429
14436
  function ff(e, t) {
14430
- if (!(!t.relationships || t.relationships.length === 0)) {
14437
+ if (t.relationships && t.relationships.length !== 0) {
14431
14438
  e.push(""), e.push("**Joins:**");
14432
14439
  for (let n of t.relationships) e.push(`- → \`${n.targetCube}\` (${n.relationship})`);
14433
14440
  }
@@ -14754,7 +14761,7 @@ function xf(e) {
14754
14761
  }
14755
14762
  function Sf(e, t) {
14756
14763
  let n = new Set(t), r = {};
14757
- for (let t of e) !n.has(t.name) || !t.title || xf(t.name.split(".").pop() || t.name) !== xf(t.title) && (r[t.name] = t.title);
14764
+ for (let t of e) n.has(t.name) && t.title && xf(t.name.split(".").pop() || t.name) !== xf(t.title) && (r[t.name] = t.title);
14758
14765
  return Object.keys(r).length > 0 ? r : void 0;
14759
14766
  }
14760
14767
  function Cf(e, t, n) {
@@ -15778,8 +15785,13 @@ var Gf = /* @__PURE__ */ e({ barChartConfig: () => Kf }), Kf = {
15778
15785
  key: "content",
15779
15786
  label: "chart.configText.markdown_content",
15780
15787
  type: "string",
15781
- placeholder: "# Welcome\n\nAdd your **markdown** content here:\n\n- Lists with bullets\n- [Links](https://example.com)\n- *Italic* and **bold** text\n\n---\n\nUse --- for horizontal rules.",
15782
- description: "chart.configText.enter_markdown_text_supports_headers_bold_text_italic_text_links_text_ur"
15788
+ placement: "chart",
15789
+ rows: 18,
15790
+ syntax: "markdownTemplate",
15791
+ placeholder: "chart.markdown.contentPlaceholder",
15792
+ description: "chart.markdown.contentDescription",
15793
+ docsUrl: "https://knap.md/variables",
15794
+ docsLabel: "chart.markdown.contentDocsLabel"
15783
15795
  },
15784
15796
  {
15785
15797
  key: "accentColorIndex",
@@ -17059,7 +17071,7 @@ function pm(e) {
17059
17071
  continue;
17060
17072
  }
17061
17073
  if (e.skipQuery) {
17062
- t.push(` ${n}${i} No query needed.`);
17074
+ t.push(` ${n}${i} Query optional: omit it for static text, or supply one to render displayConfig.content as a data template.`);
17063
17075
  continue;
17064
17076
  }
17065
17077
  let s = o.map((e) => {
@@ -17239,8 +17251,18 @@ var gm = {
17239
17251
  ],
17240
17252
  description: "recordsTable only: rows per page (default 25)."
17241
17253
  }
17242
- }, bm = /* @__PURE__ */ "bar.line.area.pie.scatter.radar.bubble.table.kpiNumber.kpiDelta.kpiText.funnel.heatmap.sankey.sunburst.retentionHeatmap.retentionCombined.boxPlot.markdown.recordsTable.treemap.radialBar.proportionBar.dotStrip.waterfall.measureProfile.activityGrid.gauge.candlestick".split(".");
17243
- function xm() {
17254
+ };
17255
+ //#endregion
17256
+ //#region src/shared/query-shape.ts
17257
+ function bm(e) {
17258
+ if (!e || typeof e != "object") return !1;
17259
+ let t = (e) => Array.isArray(e) ? e.length : 0;
17260
+ return t(e.measures) > 0 || t(e.dimensions) > 0 || t(e.timeDimensions) > 0;
17261
+ }
17262
+ //#endregion
17263
+ //#region src/server/agent/tools.ts
17264
+ var xm = "With a query attached, `content` is rendered as a Knap template over the result rows. Variables: `rows` (rows keyed by snake_case alias, so Employees.avgSalary becomes employees_avg_salary), `labelled` (same rows keyed by field label — use this for `{{ labelled | table }}` so column headers read well), `data` (raw rows, addressed as `{{ data[0][\"Employees.count\"] }}`), `rowCount`, `first` and `last`. Filters include sum, map, join, length, sort, reverse, slice, round, number_format, date and table. Example: `We employ {{ rows | map:\"employees_count\" | sum }} people across {{ rowCount }} teams.` A template cannot sort and then index, so rely on the query's own order via `first` and `last`.", Sm = /* @__PURE__ */ "bar.line.area.pie.scatter.radar.bubble.table.kpiNumber.kpiDelta.kpiText.funnel.heatmap.sankey.sunburst.retentionHeatmap.retentionCombined.boxPlot.markdown.recordsTable.treemap.radialBar.proportionBar.dotStrip.waterfall.measureProfile.activityGrid.gauge.candlestick".split(".");
17265
+ function Cm() {
17244
17266
  return [
17245
17267
  {
17246
17268
  name: "discover_cubes",
@@ -17285,7 +17307,7 @@ function xm() {
17285
17307
  },
17286
17308
  {
17287
17309
  name: "add_portlet",
17288
- description: "Add a chart visualization to the notebook.\n" + pm(bm) + "\nThe query is validated before adding. The portlet fetches its own data.",
17310
+ description: "Add a chart visualization to the notebook.\n" + pm(Sm) + "\nThe query is validated before adding. The portlet fetches its own data.",
17289
17311
  parameters: {
17290
17312
  type: "object",
17291
17313
  properties: {
@@ -17299,7 +17321,7 @@ function xm() {
17299
17321
  },
17300
17322
  chartType: {
17301
17323
  type: "string",
17302
- enum: bm,
17324
+ enum: Sm,
17303
17325
  description: "Chart type to render"
17304
17326
  },
17305
17327
  chartConfig: {
@@ -17339,6 +17361,10 @@ function xm() {
17339
17361
  type: "string",
17340
17362
  enum: ["horizontal", "vertical"]
17341
17363
  },
17364
+ content: {
17365
+ type: "string",
17366
+ description: "Markdown body, for the \"markdown\" chart type. " + xm
17367
+ },
17342
17368
  ...ym,
17343
17369
  ..._m
17344
17370
  },
@@ -17372,7 +17398,7 @@ function xm() {
17372
17398
  },
17373
17399
  chartType: {
17374
17400
  type: "string",
17375
- enum: bm,
17401
+ enum: Sm,
17376
17402
  description: "Replacement chart type"
17377
17403
  },
17378
17404
  chartConfig: {
@@ -17434,12 +17460,12 @@ function xm() {
17434
17460
  },
17435
17461
  chartType: {
17436
17462
  type: "string",
17437
- enum: bm,
17463
+ enum: Sm,
17438
17464
  description: "Chart type. Use \"markdown\" for section headers."
17439
17465
  },
17440
17466
  query: {
17441
17467
  type: "string",
17442
- description: "JSON string of the query. Omit or leave empty for markdown portlets."
17468
+ description: "JSON string of the query. For a markdown portlet this is optional: omit it for a static text block or section header, or supply one to render displayConfig.content as a template over the result rows."
17443
17469
  },
17444
17470
  chartConfig: {
17445
17471
  type: "object",
@@ -17465,7 +17491,7 @@ function xm() {
17465
17491
  },
17466
17492
  displayConfig: {
17467
17493
  type: "object",
17468
- description: "Chart display configuration (for markdown: { content, hideHeader, transparentBackground, autoHeight })",
17494
+ description: "Chart display configuration (for markdown: { content, hideHeader, transparentBackground, autoHeight }). " + xm,
17469
17495
  properties: {
17470
17496
  ...ym,
17471
17497
  ..._m
@@ -17577,7 +17603,7 @@ function xm() {
17577
17603
  }
17578
17604
  ];
17579
17605
  }
17580
- function Sm(e) {
17606
+ function wm(e) {
17581
17607
  let { semanticLayer: t, securityContext: n } = e, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
17582
17608
  r.set("discover_cubes", async (e) => {
17583
17609
  let r = { cubes: (await Lf(t, n, {
@@ -17774,32 +17800,35 @@ function Sm(e) {
17774
17800
  };
17775
17801
  let i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
17776
17802
  for (let e of r) {
17777
- let r = e.chartType;
17778
- if (r === "markdown") continue;
17779
- let s = e.query;
17780
- if (!s) {
17803
+ let r = e.chartType, s = r === "markdown", c = e.query;
17804
+ if (!c) {
17805
+ if (s) continue;
17781
17806
  i.push(`Portlet "${e.title}": missing query`);
17782
17807
  continue;
17783
17808
  }
17784
- let c;
17809
+ let l;
17785
17810
  try {
17786
- c = JSON.parse(s);
17811
+ l = JSON.parse(c);
17787
17812
  } catch {
17788
17813
  i.push(`Portlet "${e.title}": invalid JSON query`);
17789
17814
  continue;
17790
17815
  }
17791
- c = zf(c);
17792
- let l = t.validateQuery(c, n);
17793
- if (!l.isValid) {
17794
- i.push(`Portlet "${e.title}": ${l.errors.join(", ")}`);
17816
+ if (l = zf(l), s && !bm(l)) continue;
17817
+ let u = t.validateQuery(l, n);
17818
+ if (!u.isValid) {
17819
+ i.push(`Portlet "${e.title}": ${u.errors.join(", ")}`);
17820
+ continue;
17821
+ }
17822
+ if (s) {
17823
+ o.set(e, r);
17795
17824
  continue;
17796
17825
  }
17797
- let u = sm(r, e.chartConfig, c).chartType, d = dm(u, e.chartConfig, c), f = om(u, d, c);
17798
- if (!f.isValid) {
17799
- i.push(`Portlet "${e.title}": ${f.errors.join(", ")}`);
17826
+ let d = sm(r, e.chartConfig, l).chartType, f = dm(d, e.chartConfig, l), p = om(d, f, l);
17827
+ if (!p.isValid) {
17828
+ i.push(`Portlet "${e.title}": ${p.errors.join(", ")}`);
17800
17829
  continue;
17801
17830
  }
17802
- a.set(e, d), o.set(e, u);
17831
+ a.set(e, f), o.set(e, d);
17803
17832
  }
17804
17833
  if (i.length > 0) return {
17805
17834
  result: `Dashboard has invalid portlets — fix these errors and retry:\n${i.join("\n")}`,
@@ -17822,7 +17851,7 @@ function Sm(e) {
17822
17851
  chartConfig: a.get(e) ?? e.chartConfig ?? {},
17823
17852
  displayConfig: e.displayConfig || {}
17824
17853
  } },
17825
- query: n ? {} : c
17854
+ query: n && !bm(c) ? {} : c
17826
17855
  };
17827
17856
  return {
17828
17857
  id: e.id,
@@ -17859,14 +17888,14 @@ function Sm(e) {
17859
17888
  }
17860
17889
  //#endregion
17861
17890
  //#region src/server/agent/providers/factory.ts
17862
- async function Cm(e, t, n) {
17891
+ async function Tm(e, t, n) {
17863
17892
  switch (e) {
17864
17893
  case "anthropic": {
17865
17894
  let { AnthropicProvider: e } = await import("./anthropic-MQlafOZv.js");
17866
17895
  return new e(t);
17867
17896
  }
17868
17897
  case "openai": {
17869
- let { OpenAIProvider: e } = await import("./openai-nBhuSFd3.js");
17898
+ let { OpenAIProvider: e } = await import("./openai-Cap1nBuK.js");
17870
17899
  return new e(t, n);
17871
17900
  }
17872
17901
  case "google": {
@@ -17878,16 +17907,16 @@ async function Cm(e, t, n) {
17878
17907
  }
17879
17908
  //#endregion
17880
17909
  //#region src/server/agent/handler-steps.ts
17881
- function wm(e, t) {
17910
+ function Em(e, t) {
17882
17911
  if (Array.isArray(t)) for (let n of t) e.push(n);
17883
17912
  else e.push(t);
17884
17913
  }
17885
- function Tm(e) {
17914
+ function Dm(e) {
17886
17915
  if (e) try {
17887
17916
  e();
17888
17917
  } catch {}
17889
17918
  }
17890
- function Em(e, t) {
17919
+ function Om(e, t) {
17891
17920
  let n = [];
17892
17921
  if (!e || e.length === 0) return n;
17893
17922
  for (let r of e) {
@@ -17920,7 +17949,7 @@ function Em(e, t) {
17920
17949
  content: typeof e.result == "string" ? e.result : JSON.stringify(e.result ?? ""),
17921
17950
  isError: e.status === "error"
17922
17951
  }));
17923
- wm(n, t.formatToolResults(i));
17952
+ Em(n, t.formatToolResults(i));
17924
17953
  } else e.length > 0 && n.push({
17925
17954
  role: "assistant",
17926
17955
  content: r.content
@@ -17928,22 +17957,22 @@ function Em(e, t) {
17928
17957
  }
17929
17958
  return n;
17930
17959
  }
17931
- function Dm(e, t) {
17932
- if (!(e?.type !== "tool_use" || !t)) try {
17960
+ function km(e, t) {
17961
+ if (e?.type === "tool_use" && t) try {
17933
17962
  e.input = JSON.parse(t);
17934
17963
  } catch {
17935
17964
  e.input = {}, e.inputParseError = !0;
17936
17965
  }
17937
17966
  }
17938
- function Om(e, t) {
17967
+ function Am(e, t) {
17939
17968
  let n = e.contentBlocks[e.contentBlocks.length - 1];
17940
17969
  n && n.type === "text" ? n.text = (n.text || "") + t : e.contentBlocks.push({
17941
17970
  type: "text",
17942
17971
  text: t
17943
17972
  });
17944
17973
  }
17945
- function km(e, t) {
17946
- e.currentBlockIsToolUse && e.currentToolInputJson && Dm(e.contentBlocks[e.contentBlocks.length - 1], e.currentToolInputJson), e.contentBlocks.push({
17974
+ function jm(e, t) {
17975
+ e.currentBlockIsToolUse && e.currentToolInputJson && km(e.contentBlocks[e.contentBlocks.length - 1], e.currentToolInputJson), e.contentBlocks.push({
17947
17976
  type: "tool_use",
17948
17977
  id: t.id,
17949
17978
  name: t.name,
@@ -17951,16 +17980,16 @@ function km(e, t) {
17951
17980
  ...t.metadata ? { metadata: t.metadata } : {}
17952
17981
  }), e.currentToolInputJson = "", e.currentBlockIsToolUse = !0;
17953
17982
  }
17954
- function Am(e, t) {
17983
+ function Mm(e, t) {
17955
17984
  if (t.id && t.input) {
17956
17985
  let n = e.contentBlocks.find((e) => e.type === "tool_use" && e.id === t.id);
17957
17986
  n && (n.input = t.input, t.parseError && (n.inputParseError = !0));
17958
17987
  } else if (e.currentBlockIsToolUse) {
17959
17988
  let t = e.contentBlocks[e.contentBlocks.length - 1];
17960
- t?.type === "tool_use" && e.currentToolInputJson && (Dm(t, e.currentToolInputJson), e.currentToolInputJson = ""), e.currentBlockIsToolUse = !1;
17989
+ t?.type === "tool_use" && e.currentToolInputJson && (km(t, e.currentToolInputJson), e.currentToolInputJson = ""), e.currentBlockIsToolUse = !1;
17961
17990
  }
17962
17991
  }
17963
- async function* jm(e, t) {
17992
+ async function* Nm(e, t) {
17964
17993
  let n = {
17965
17994
  contentBlocks: [],
17966
17995
  currentToolInputJson: "",
@@ -17971,13 +18000,13 @@ async function* jm(e, t) {
17971
18000
  let e = r;
17972
18001
  switch (e.type) {
17973
18002
  case "text_delta":
17974
- Om(n, e.text), yield {
18003
+ Am(n, e.text), yield {
17975
18004
  type: "text_delta",
17976
18005
  data: e.text
17977
18006
  };
17978
18007
  break;
17979
18008
  case "tool_use_start":
17980
- km(n, e), yield {
18009
+ jm(n, e), yield {
17981
18010
  type: "tool_use_start",
17982
18011
  data: {
17983
18012
  id: e.id,
@@ -17990,7 +18019,7 @@ async function* jm(e, t) {
17990
18019
  n.currentToolInputJson += e.json;
17991
18020
  break;
17992
18021
  case "tool_use_end":
17993
- Am(n, e);
18022
+ Mm(n, e);
17994
18023
  break;
17995
18024
  case "message_meta": e.inputTokens != null && (n.inputTokens = e.inputTokens), e.outputTokens != null && (n.outputTokens = e.outputTokens), e.stopReason && (n.stopReason = e.stopReason);
17996
18025
  }
@@ -18002,7 +18031,7 @@ async function* jm(e, t) {
18002
18031
  outputTokens: n.outputTokens
18003
18032
  };
18004
18033
  }
18005
- async function* Mm(e, t) {
18034
+ async function* Pm(e, t) {
18006
18035
  let { executor: n, observability: r, traceId: i, turn: a } = t, o = e.name, s = e.input || {}, c = e.id;
18007
18036
  if (e.inputParseError) {
18008
18037
  let e = `Could not parse the arguments you sent for ${o} — they were not valid JSON, so the tool was not run. Call it again with well-formed JSON arguments.`;
@@ -18014,7 +18043,7 @@ async function* Mm(e, t) {
18014
18043
  result: e,
18015
18044
  isError: !0
18016
18045
  }
18017
- }, Tm(() => r?.onToolEnd?.({
18046
+ }, Dm(() => r?.onToolEnd?.({
18018
18047
  traceId: i,
18019
18048
  turn: a,
18020
18049
  toolName: o,
@@ -18055,7 +18084,7 @@ async function* Mm(e, t) {
18055
18084
  result: e.result,
18056
18085
  ...e.isError ? { isError: !0 } : {}
18057
18086
  }
18058
- }, Tm(() => r?.onToolEnd?.({
18087
+ }, Dm(() => r?.onToolEnd?.({
18059
18088
  traceId: i,
18060
18089
  turn: a,
18061
18090
  toolName: o,
@@ -18078,7 +18107,7 @@ async function* Mm(e, t) {
18078
18107
  result: t,
18079
18108
  isError: !0
18080
18109
  }
18081
- }, Tm(() => r?.onToolEnd?.({
18110
+ }, Dm(() => r?.onToolEnd?.({
18082
18111
  traceId: i,
18083
18112
  turn: a,
18084
18113
  toolName: o,
@@ -18093,26 +18122,26 @@ async function* Mm(e, t) {
18093
18122
  };
18094
18123
  }
18095
18124
  }
18096
- async function* Nm(e, t) {
18125
+ async function* Fm(e, t) {
18097
18126
  let n = [];
18098
18127
  for (let r of e) {
18099
18128
  if (r.type !== "tool_use") continue;
18100
- let e = yield* Mm(r, t);
18129
+ let e = yield* Pm(r, t);
18101
18130
  n.push(e);
18102
18131
  }
18103
18132
  return n;
18104
18133
  }
18105
18134
  //#endregion
18106
18135
  //#region src/server/agent/handler.ts
18107
- var Pm = {
18136
+ var Im = {
18108
18137
  anthropic: "claude-sonnet-4-6",
18109
18138
  openai: "gpt-4.1-mini",
18110
18139
  google: "gemini-3-flash-preview"
18111
18140
  };
18112
- async function* Fm(e) {
18113
- let { message: t, history: n, semanticLayer: r, securityContext: i, agentConfig: a, apiKey: o } = e, s = e.sessionId || crypto.randomUUID(), c = a.observability, l = crypto.randomUUID(), u = Date.now(), d = e.providerOverride || a.provider || "anthropic", f = e.modelOverride || a.model || Pm[d] || "claude-sonnet-4-6", p = e.baseURLOverride || a.baseURL, m = a.maxTurns || 25, h = a.maxTokens || 8192, g;
18141
+ async function* Lm(e) {
18142
+ let { message: t, history: n, semanticLayer: r, securityContext: i, agentConfig: a, apiKey: o } = e, s = e.sessionId || crypto.randomUUID(), c = a.observability, l = crypto.randomUUID(), u = Date.now(), d = e.providerOverride || a.provider || "anthropic", f = e.modelOverride || a.model || Im[d] || "claude-sonnet-4-6", p = e.baseURLOverride || a.baseURL, m = a.maxTurns || 25, h = a.maxTokens || 8192, g;
18114
18143
  try {
18115
- g = await Cm(d, o, { baseURL: p });
18144
+ g = await Tm(d, o, { baseURL: p });
18116
18145
  } catch (e) {
18117
18146
  console.error("[agent] Failed to create %s provider: %s", String(d).replace(/\n|\r/g, ""), String(e instanceof Error ? e.message : e).replace(/\n|\r/g, "")), yield {
18118
18147
  type: "error",
@@ -18120,18 +18149,18 @@ async function* Fm(e) {
18120
18149
  };
18121
18150
  return;
18122
18151
  }
18123
- let _ = xm(), v = Sm({
18152
+ let _ = Cm(), v = wm({
18124
18153
  semanticLayer: r,
18125
18154
  securityContext: i
18126
18155
  }), y = gf(r.getMetadata(i));
18127
- e.systemContext && (y += `\n\n## User Context\n\n${e.systemContext}`), Tm(() => c?.onChatStart?.({
18156
+ e.systemContext && (y += `\n\n## User Context\n\n${e.systemContext}`), Dm(() => c?.onChatStart?.({
18128
18157
  traceId: l,
18129
18158
  sessionId: s,
18130
18159
  message: t,
18131
18160
  model: f,
18132
18161
  historyLength: n?.length ?? 0
18133
18162
  }));
18134
- let b = Em(n, g);
18163
+ let b = Om(n, g);
18135
18164
  b.push({
18136
18165
  role: "user",
18137
18166
  content: t
@@ -18146,8 +18175,8 @@ async function* Fm(e) {
18146
18175
  system: y,
18147
18176
  tools: _,
18148
18177
  messages: b
18149
- }), n = Date.now(), { contentBlocks: r, stopReason: i, inputTokens: a, outputTokens: o } = yield* jm(g, t);
18150
- if (Tm(() => c?.onGenerationEnd?.({
18178
+ }), n = Date.now(), { contentBlocks: r, stopReason: i, inputTokens: a, outputTokens: o } = yield* Nm(g, t);
18179
+ if (Dm(() => c?.onGenerationEnd?.({
18151
18180
  traceId: l,
18152
18181
  turn: e,
18153
18182
  model: f,
@@ -18168,7 +18197,7 @@ async function* Fm(e) {
18168
18197
  break;
18169
18198
  }
18170
18199
  if (!g.shouldContinue(i)) break;
18171
- let s = yield* Nm(r, {
18200
+ let s = yield* Fm(r, {
18172
18201
  executor: v,
18173
18202
  observability: c,
18174
18203
  traceId: l,
@@ -18177,9 +18206,9 @@ async function* Fm(e) {
18177
18206
  yield {
18178
18207
  type: "turn_complete",
18179
18208
  data: {}
18180
- }, wm(b, g.formatToolResults(s));
18209
+ }, Em(b, g.formatToolResults(s));
18181
18210
  }
18182
- Tm(() => c?.onChatEnd?.({
18211
+ Dm(() => c?.onChatEnd?.({
18183
18212
  traceId: l,
18184
18213
  sessionId: s,
18185
18214
  totalTurns: ee,
@@ -18209,42 +18238,42 @@ async function* Fm(e) {
18209
18238
  }
18210
18239
  //#endregion
18211
18240
  //#region src/server/ai/suggestion-helpers.ts
18212
- function Im(e) {
18241
+ function Rm(e) {
18213
18242
  return e.toISOString().split("T")[0];
18214
18243
  }
18215
- function Lm(e, t) {
18216
- let n = /* @__PURE__ */ new Date(), r = Im(n);
18244
+ function zm(e, t) {
18245
+ let n = /* @__PURE__ */ new Date(), r = Rm(n);
18217
18246
  if (/days?/.test(t)) {
18218
18247
  let t = new Date(n);
18219
18248
  return t.setDate(t.getDate() - e), {
18220
- dateRange: [Im(t), r],
18249
+ dateRange: [Rm(t), r],
18221
18250
  granularity: "day"
18222
18251
  };
18223
18252
  }
18224
18253
  if (/weeks?/.test(t)) {
18225
18254
  let t = new Date(n);
18226
18255
  return t.setDate(t.getDate() - e * 7), {
18227
- dateRange: [Im(t), r],
18256
+ dateRange: [Rm(t), r],
18228
18257
  granularity: e <= 4 ? "day" : "week"
18229
18258
  };
18230
18259
  }
18231
18260
  if (/months?/.test(t)) {
18232
18261
  let t = new Date(n);
18233
18262
  return t.setMonth(t.getMonth() - e), {
18234
- dateRange: [Im(t), r],
18263
+ dateRange: [Rm(t), r],
18235
18264
  granularity: e <= 3 ? "day" : "month"
18236
18265
  };
18237
18266
  }
18238
18267
  return null;
18239
18268
  }
18240
- function Rm(e) {
18269
+ function Bm(e) {
18241
18270
  let t = parseInt(e.slice(1), 10), n = (/* @__PURE__ */ new Date()).getFullYear(), r = (t - 1) * 3, i = new Date(n, r, 1), a = new Date(n, r + 3, 0);
18242
18271
  return {
18243
- dateRange: [Im(i), Im(a)],
18272
+ dateRange: [Rm(i), Rm(a)],
18244
18273
  granularity: "month"
18245
18274
  };
18246
18275
  }
18247
- function zm(e, t, n, r) {
18276
+ function Vm(e, t, n, r) {
18248
18277
  let i = 0;
18249
18278
  for (let a of e.measures) {
18250
18279
  let e = [
@@ -18259,7 +18288,7 @@ function zm(e, t, n, r) {
18259
18288
  }
18260
18289
  return i;
18261
18290
  }
18262
- function Bm(e, t, n, r) {
18291
+ function Hm(e, t, n, r) {
18263
18292
  let i = e.measures.filter((e) => e.type === t.type);
18264
18293
  if (i.length > 0) {
18265
18294
  n.push(i[0].name), r.push(`Suggested ${i[0].name} based on ${t.type} intent`);
@@ -18270,7 +18299,7 @@ function Bm(e, t, n, r) {
18270
18299
  t && (n.push(t.name), r.push(`Suggested ${t.name} for counting`));
18271
18300
  }
18272
18301
  }
18273
- function Vm(e, t, n, r, i) {
18302
+ function Um(e, t, n, r, i) {
18274
18303
  let a = 0;
18275
18304
  for (let n of t) {
18276
18305
  let t = Ff(e, n, "dimension");
@@ -18291,7 +18320,7 @@ function Vm(e, t, n, r, i) {
18291
18320
  }
18292
18321
  //#endregion
18293
18322
  //#region src/server/ai/suggestion.ts
18294
- function Hm() {
18323
+ function Wm() {
18295
18324
  let e = /* @__PURE__ */ new Date(), t = e.toISOString().split("T")[0], n = (e) => e.toISOString().split("T")[0], r = (e) => new Date(e.getFullYear(), e.getMonth(), 1), i = (e) => new Date(e.getFullYear(), 0, 1), a = (e) => {
18296
18325
  let t = Math.floor(e.getMonth() / 3);
18297
18326
  return new Date(e.getFullYear(), t * 3, 1);
@@ -18402,16 +18431,16 @@ function Hm() {
18402
18431
  }
18403
18432
  ];
18404
18433
  }
18405
- var Um = {
18434
+ var Gm = {
18406
18435
  funnel: /\b(funnel|conversion|drop.?off|steps?|journey|pipeline|stages?)\b/i,
18407
18436
  flow: /\b(flows?|paths?|sequence|before|after|next|previous|user.?journey)\b/i,
18408
18437
  retention: /\b(retention|cohort|return|churn|comeback|retained|day.?\d+)\b/i
18409
18438
  };
18410
- function Wm(e) {
18439
+ function Km(e) {
18411
18440
  let t = e.toLowerCase();
18412
- return Um.funnel.test(t) ? "funnel" : Um.flow.test(t) ? "flow" : Um.retention.test(t) ? "retention" : "query";
18441
+ return Gm.funnel.test(t) ? "funnel" : Gm.flow.test(t) ? "flow" : Gm.retention.test(t) ? "retention" : "query";
18413
18442
  }
18414
- function Gm(e, t) {
18443
+ function qm(e, t) {
18415
18444
  let n = t || "the relevant cube";
18416
18445
  switch (e) {
18417
18446
  case "funnel": return [
@@ -18427,16 +18456,16 @@ function Gm(e, t) {
18427
18456
  case "retention": return [`Use /mcp/discover to get ${n} retention configuration and schema`, "Build retention query specifying granularity (day/week/month) and number of periods"];
18428
18457
  }
18429
18458
  }
18430
- function Km(e) {
18431
- let t = Hm(), n = e.toLowerCase();
18459
+ function Jm(e) {
18460
+ let t = Wm(), n = e.toLowerCase();
18432
18461
  for (let e of t) {
18433
18462
  let t = n.match(e.pattern);
18434
18463
  if (t) {
18435
18464
  if (t[1] && /^\d+$/.test(t[1])) {
18436
- let e = Lm(parseInt(t[1], 10), n);
18465
+ let e = zm(parseInt(t[1], 10), n);
18437
18466
  if (e) return e;
18438
18467
  }
18439
- return /^q[1-4]$/i.test(t[0]) ? Rm(t[0]) : {
18468
+ return /^q[1-4]$/i.test(t[0]) ? Bm(t[0]) : {
18440
18469
  dateRange: e.getDateRange(),
18441
18470
  granularity: e.granularity
18442
18471
  };
@@ -18444,7 +18473,7 @@ function Km(e) {
18444
18473
  }
18445
18474
  return null;
18446
18475
  }
18447
- function qm(e) {
18476
+ function Ym(e) {
18448
18477
  let t = e.toLowerCase();
18449
18478
  for (let { pattern: e, type: n } of [
18450
18479
  {
@@ -18473,7 +18502,7 @@ function qm(e) {
18473
18502
  };
18474
18503
  return null;
18475
18504
  }
18476
- function Jm(e) {
18505
+ function Xm(e) {
18477
18506
  let t = e.toLowerCase(), n = [], r = /\bby\s+(\w+(?:\s+\w+)?)/gi, i;
18478
18507
  for (; (i = r.exec(t)) !== null;) n.push(i[1].trim());
18479
18508
  let a = /\bper\s+(\w+)/gi;
@@ -18482,7 +18511,7 @@ function Jm(e) {
18482
18511
  for (; (i = o.exec(t)) !== null;) n.push(i[1].trim());
18483
18512
  return n;
18484
18513
  }
18485
- function Ym(e, t, n, r, i) {
18514
+ function Zm(e, t, n, r, i) {
18486
18515
  if (n) {
18487
18516
  let t = e.find((e) => e.name === n);
18488
18517
  return t ? (r.push(`Using specified cube: ${n}`), [t]) : (i.push(`Specified cube '${n}' not found`), []);
@@ -18493,7 +18522,7 @@ function Ym(e, t, n, r, i) {
18493
18522
  }).map((t) => e.find((e) => e.name === t.cube)).filter((e) => e !== void 0);
18494
18523
  return a.length > 0 && r.push(`Identified relevant cubes: ${a.map((e) => e.name).join(", ")}`), a;
18495
18524
  }
18496
- function Xm(e, t) {
18525
+ function Qm(e, t) {
18497
18526
  return e === "query" ? {
18498
18527
  query: {},
18499
18528
  confidence: 0,
@@ -18507,19 +18536,19 @@ function Xm(e, t) {
18507
18536
  reasoning: [`Detected ${e} intent from natural language`],
18508
18537
  warnings: t,
18509
18538
  analysisMode: e,
18510
- nextSteps: Gm(e, void 0)
18539
+ nextSteps: qm(e, void 0)
18511
18540
  };
18512
18541
  }
18513
- function Zm(e, t, n) {
18514
- let r = [], i = [], a = {}, o = Wm(t), s = Ym(e, t, n, r, i);
18515
- if (s.length === 0) return Xm(o, i);
18516
- let c = s[0], l = .5, u = qm(t);
18542
+ function $m(e, t, n) {
18543
+ let r = [], i = [], a = {}, o = Km(t), s = Zm(e, t, n, r, i);
18544
+ if (s.length === 0) return Qm(o, i);
18545
+ let c = s[0], l = .5, u = Ym(t);
18517
18546
  u && (r.push(`Detected ${u.type} aggregation intent`), l += .1);
18518
18547
  let d = [], f = t.toLowerCase();
18519
- l += zm(c, f, d, r), d.length === 0 && u && Bm(c, u, d, r), d.length === 0 && c.measures.length > 0 && (d.push(c.measures[0].name), r.push(`Using default measure: ${c.measures[0].name}`), i.push("Could not determine specific measure from query, using default")), a.measures = d;
18520
- let p = Jm(t), m = [];
18521
- l += Vm(s, p, f, m, r), m.length > 0 && (a.dimensions = m);
18522
- let h = Km(t);
18548
+ l += Vm(c, f, d, r), d.length === 0 && u && Hm(c, u, d, r), d.length === 0 && c.measures.length > 0 && (d.push(c.measures[0].name), r.push(`Using default measure: ${c.measures[0].name}`), i.push("Could not determine specific measure from query, using default")), a.measures = d;
18549
+ let p = Xm(t), m = [];
18550
+ l += Um(s, p, f, m, r), m.length > 0 && (a.dimensions = m);
18551
+ let h = Jm(t);
18523
18552
  if (h) {
18524
18553
  let e = c.dimensions.find((e) => e.type === "time");
18525
18554
  if (e) {
@@ -18538,7 +18567,7 @@ function Zm(e, t, n) {
18538
18567
  reasoning: [`Detected ${o} intent from natural language`, ...e ? [`Found relevant cube: ${e}`] : []],
18539
18568
  warnings: i.length > 0 ? i : void 0,
18540
18569
  analysisMode: o,
18541
- nextSteps: Gm(o, e)
18570
+ nextSteps: qm(o, e)
18542
18571
  };
18543
18572
  }
18544
18573
  return {
@@ -18557,18 +18586,18 @@ function $(e, t, n, r) {
18557
18586
  message: A(t)
18558
18587
  });
18559
18588
  }
18560
- function Qm(e, t) {
18589
+ function eh(e, t) {
18561
18590
  return e.map((e) => t.get(e) || e);
18562
18591
  }
18563
- function $m(e, t) {
18592
+ function th(e, t) {
18564
18593
  if (t.size === 0) return;
18565
18594
  let n = JSON.parse(JSON.stringify(e));
18566
- return n.measures &&= Qm(n.measures, t), n.dimensions &&= Qm(n.dimensions, t), n.timeDimensions &&= n.timeDimensions.map((e) => ({
18595
+ return n.measures &&= eh(n.measures, t), n.dimensions &&= eh(n.dimensions, t), n.timeDimensions &&= n.timeDimensions.map((e) => ({
18567
18596
  ...e,
18568
18597
  dimension: t.get(e.dimension) || e.dimension
18569
18598
  })), n;
18570
18599
  }
18571
- function eh(e, t) {
18600
+ function nh(e, t) {
18572
18601
  e.measures && e.measures.length > 10 && t.push({
18573
18602
  type: "performance",
18574
18603
  message: A("server.validation.ai.performanceManyMeasures", { count: e.measures.length }),
@@ -18579,7 +18608,7 @@ function eh(e, t) {
18579
18608
  suggestion: A("server.validation.ai.suggestAddDimensionFilters")
18580
18609
  });
18581
18610
  }
18582
- function th(e, t, n) {
18611
+ function rh(e, t, n) {
18583
18612
  let [r] = e.split("."), i = t.find((e) => e.name === r);
18584
18613
  if (!i) return;
18585
18614
  let a = i.dimensions.find((t) => t.name === e);
@@ -18593,7 +18622,7 @@ function th(e, t, n) {
18593
18622
  suggestion: A("server.validation.ai.suggestUseTimeDimension")
18594
18623
  });
18595
18624
  }
18596
- function nh(e, t, n, r, i) {
18625
+ function ih(e, t, n, r, i) {
18597
18626
  let a = e.member, o = a.split(".");
18598
18627
  if (o.length !== 2) {
18599
18628
  n.push({
@@ -18641,7 +18670,7 @@ function nh(e, t, n, r, i) {
18641
18670
  }
18642
18671
  //#endregion
18643
18672
  //#region src/server/ai/validation.ts
18644
- function rh(e, t) {
18673
+ function ah(e, t) {
18645
18674
  let n = null;
18646
18675
  for (let r of t) {
18647
18676
  let t = wf(e.toLowerCase(), r.toLowerCase());
@@ -18652,7 +18681,7 @@ function rh(e, t) {
18652
18681
  }
18653
18682
  return n;
18654
18683
  }
18655
- function ih(e, t, n, r) {
18684
+ function oh(e, t, n, r) {
18656
18685
  let i = e.split(".");
18657
18686
  if (i.length !== 2) {
18658
18687
  n.push({
@@ -18664,7 +18693,7 @@ function ih(e, t, n, r) {
18664
18693
  }
18665
18694
  let [a, o] = i, s = t.find((e) => e.name === a);
18666
18695
  if (!s) {
18667
- let i = t.map((e) => e.name), s = rh(a, i);
18696
+ let i = t.map((e) => e.name), s = ah(a, i);
18668
18697
  s ? (n.push({
18669
18698
  type: "cube_not_found",
18670
18699
  message: A("server.validation.ai.cubeNotFoundWithSuggestion", { cubeName: a }),
@@ -18692,7 +18721,7 @@ function ih(e, t, n, r) {
18692
18721
  correctedValue: i.field
18693
18722
  }), r.set(e, i.field);
18694
18723
  else {
18695
- let t = s.measures.map((e) => e.name.split(".").pop()), i = rh(o, t);
18724
+ let t = s.measures.map((e) => e.name.split(".").pop()), i = ah(o, t);
18696
18725
  if (i) {
18697
18726
  let t = `${a}.${i.field}`;
18698
18727
  n.push({
@@ -18717,7 +18746,7 @@ function ih(e, t, n, r) {
18717
18746
  }
18718
18747
  }
18719
18748
  }
18720
- function ah(e, t, n, r) {
18749
+ function sh(e, t, n, r) {
18721
18750
  let i = e.split(".");
18722
18751
  if (i.length !== 2) {
18723
18752
  n.push({
@@ -18729,7 +18758,7 @@ function ah(e, t, n, r) {
18729
18758
  }
18730
18759
  let [a, o] = i, s = t.find((e) => e.name === a);
18731
18760
  if (!s) {
18732
- let i = t.map((e) => e.name), s = rh(a, i);
18761
+ let i = t.map((e) => e.name), s = ah(a, i);
18733
18762
  s ? (n.push({
18734
18763
  type: "cube_not_found",
18735
18764
  message: A("server.validation.ai.cubeNotFoundWithSuggestion", { cubeName: a }),
@@ -18757,7 +18786,7 @@ function ah(e, t, n, r) {
18757
18786
  correctedValue: i.field
18758
18787
  }), r.set(e, i.field);
18759
18788
  else {
18760
- let t = s.dimensions.map((e) => e.name.split(".").pop()), i = rh(o, t);
18789
+ let t = s.dimensions.map((e) => e.name.split(".").pop()), i = ah(o, t);
18761
18790
  if (i) {
18762
18791
  let t = `${a}.${i.field}`;
18763
18792
  n.push({
@@ -18782,23 +18811,23 @@ function ah(e, t, n, r) {
18782
18811
  }
18783
18812
  }
18784
18813
  }
18785
- function oh(e, t, n, r) {
18814
+ function ch(e, t, n, r) {
18786
18815
  for (let i of e) {
18787
18816
  if ("and" in i && Array.isArray(i.and)) {
18788
- oh(i.and, t, n, r);
18817
+ ch(i.and, t, n, r);
18789
18818
  continue;
18790
18819
  }
18791
18820
  if ("or" in i && Array.isArray(i.or)) {
18792
- oh(i.or, t, n, r);
18821
+ ch(i.or, t, n, r);
18793
18822
  continue;
18794
18823
  }
18795
- "member" in i && nh(i, t, n, r, rh);
18824
+ "member" in i && ih(i, t, n, r, ah);
18796
18825
  }
18797
18826
  }
18798
- function sh(e, t, n, r, i) {
18827
+ function lh(e, t, n, r, i) {
18799
18828
  let a = e.funnel;
18800
18829
  if (!a) return;
18801
- let o = (e, n) => ah(e, t, n, i);
18830
+ let o = (e, n) => sh(e, t, n, i);
18802
18831
  if ($(a.bindingKey, "server.validation.ai.bindingKeyRequired.funnel", o, n), $(a.timeDimension, "server.validation.ai.timeDimensionRequired.funnel", o, n), !a.steps || !Array.isArray(a.steps)) n.push({
18803
18832
  type: "syntax_error",
18804
18833
  message: A("server.validation.ai.funnelStepsRequired")
@@ -18813,23 +18842,23 @@ function sh(e, t, n, r, i) {
18813
18842
  type: "best_practice",
18814
18843
  message: A("server.validation.ai.stepMissingName", { step: e + 1 }),
18815
18844
  suggestion: A("server.validation.ai.suggestAddStepNames")
18816
- }), o.filter && "member" in o.filter && oh([o.filter], t, n, i);
18845
+ }), o.filter && "member" in o.filter && ch([o.filter], t, n, i);
18817
18846
  }
18818
18847
  }
18819
- function ch(e, t, n, r, i) {
18848
+ function uh(e, t, n, r, i) {
18820
18849
  let a = e.flow;
18821
18850
  if (!a) return;
18822
- let o = (e, n) => ah(e, t, n, i);
18851
+ let o = (e, n) => sh(e, t, n, i);
18823
18852
  $(a.bindingKey, "server.validation.ai.bindingKeyRequired.flow", o, n), $(a.timeDimension, "server.validation.ai.timeDimensionRequired.flow", o, n), $(a.eventDimension, "server.validation.ai.eventDimensionRequired", o, n), a.stepsBefore === void 0 && a.stepsAfter === void 0 && r.push({
18824
18853
  type: "best_practice",
18825
18854
  message: A("server.validation.ai.stepsBothMissing"),
18826
18855
  suggestion: A("server.validation.ai.suggestSetSteps")
18827
18856
  });
18828
18857
  }
18829
- function lh(e, t, n, r, i) {
18858
+ function dh(e, t, n, r, i) {
18830
18859
  let a = e.retention;
18831
18860
  if (!a) return;
18832
- let o = (e, n) => ah(e, t, n, i);
18861
+ let o = (e, n) => sh(e, t, n, i);
18833
18862
  $(a.bindingKey, "server.validation.ai.bindingKeyRequired.retention", o, n), $(a.timeDimension, "server.validation.ai.retentionTimeDimensionRequired", o, n), a.granularity || r.push({
18834
18863
  type: "best_practice",
18835
18864
  message: A("server.validation.ai.granularityNotSpecified"),
@@ -18840,28 +18869,28 @@ function lh(e, t, n, r, i) {
18840
18869
  suggestion: A("server.validation.ai.suggestSpecifyPeriods")
18841
18870
  });
18842
18871
  }
18843
- function uh(e, t, n, r, i) {
18844
- return e.funnel ? (sh(e, t, n, r, i), !0) : e.flow ? (ch(e, t, n, r, i), !0) : e.retention ? (lh(e, t, n, r, i), !0) : !1;
18872
+ function fh(e, t, n, r, i) {
18873
+ return e.funnel ? (lh(e, t, n, r, i), !0) : e.flow ? (uh(e, t, n, r, i), !0) : e.retention ? (dh(e, t, n, r, i), !0) : !1;
18845
18874
  }
18846
- function dh(e, t, n, r, i) {
18847
- if (e.measures) for (let r of e.measures) ih(r, t, n, i);
18848
- if (e.dimensions) for (let r of e.dimensions) ah(r, t, n, i);
18849
- if (e.timeDimensions) for (let a of e.timeDimensions) ah(a.dimension, t, n, i), th(a.dimension, t, r);
18850
- e.filters && oh(e.filters, t, n, i), !e.measures?.length && !e.dimensions?.length && n.push({
18875
+ function ph(e, t, n, r, i) {
18876
+ if (e.measures) for (let r of e.measures) oh(r, t, n, i);
18877
+ if (e.dimensions) for (let r of e.dimensions) sh(r, t, n, i);
18878
+ if (e.timeDimensions) for (let a of e.timeDimensions) sh(a.dimension, t, n, i), rh(a.dimension, t, r);
18879
+ e.filters && ch(e.filters, t, n, i), !e.measures?.length && !e.dimensions?.length && n.push({
18851
18880
  type: "syntax_error",
18852
18881
  message: A("server.validation.ai.emptyQuery")
18853
- }), eh(e, r);
18882
+ }), nh(e, r);
18854
18883
  }
18855
- function fh(e, t) {
18884
+ function mh(e, t) {
18856
18885
  let n = [], r = [], i = /* @__PURE__ */ new Map();
18857
- if (uh(e, t, n, r, i)) return {
18886
+ if (fh(e, t, n, r, i)) return {
18858
18887
  isValid: n.length === 0,
18859
18888
  errors: n,
18860
18889
  warnings: r,
18861
18890
  correctedQuery: void 0
18862
18891
  };
18863
- dh(e, t, n, r, i);
18864
- let a = $m(e, i);
18892
+ ph(e, t, n, r, i);
18893
+ let a = th(e, i);
18865
18894
  return {
18866
18895
  isValid: n.length === 0,
18867
18896
  errors: n,
@@ -18871,11 +18900,11 @@ function fh(e, t) {
18871
18900
  }
18872
18901
  //#endregion
18873
18902
  //#region src/server/index.ts
18874
- function ph(e) {
18903
+ function hh(e) {
18875
18904
  return new Hd({
18876
18905
  drizzle: e.drizzle,
18877
18906
  schema: e.schema
18878
18907
  });
18879
18908
  }
18880
18909
  //#endregion
18881
- export { zd as BASE_CUBE_SET_ID, w as BaseDatabaseExecutor, er as CTEBuilder, M as CalculatedMeasureResolver, si as ComparisonQueryBuilder, mt as DatabendExecutor, ga as DrizzlePlanBuilder, Ln as DrizzleSqlBuilder, lt as DuckDBExecutor, ef as EXPLAIN_ANALYSIS_PROMPT, li as FlowQueryBuilder, ci as FunnelQueryBuilder, Ci as IdentityOptimiser, Rn as JoinPathResolver, Si as LogicalPlanBuilder, Qn as LogicalPlanner, Gd as MemoryCacheProvider, Qe as MySQLExecutor, wi as OptimiserPipeline, Je as PostgresExecutor, va as QueryExecutor, Ar as QueryValidationError, hi as RetentionQueryBuilder, Bd as SINGLE_TENANT_CONTEXT, nt as SQLiteExecutor, Kd as STEP0_VALIDATION_PROMPT, Xd as STEP1_SYSTEM_PROMPT, Qd as STEP2_SYSTEM_PROMPT, Jd as SYSTEM_PROMPT_TEMPLATE, Hd as SemanticLayerCompiler, bt as SnowflakeExecutor, fh as aiValidateQuery, gf as buildAgentSystemPrompt, Ud as buildAttributeDimensions, tf as buildExplainAnalysisPrompt, qd as buildStep0Prompt, Zd as buildStep1Prompt, $d as buildStep2Prompt, Yd as buildSystemPrompt, St as createDatabaseExecutor, ht as createDatabendExecutor, ph as createDrizzleSemanticLayer, ut as createDuckDBExecutor, Ot as createMultiCubeContext, $e as createMySQLExecutor, Ye as createPostgresExecutor, rt as createSQLiteExecutor, xt as createSnowflakeExecutor, Sm as createToolExecutor, kt as defineCube, kr as detectQueryMode, Dr as detectQueryModes, Pf as discoverCubes, Ff as findBestFieldMatch, ri as fnv1aHash, nf as formatCubeSchemaForExplain, rf as formatExistingIndexes, Xr as generateCacheKey, Or as getActiveQueryModes, ai as getCubeInvalidationPattern, wt as getJoinType, xm as getToolDefinitions, Fm as handleAgentChat, Cr as hasComparisonMode, Tr as hasFlowMode, wr as hasFunnelMode, Er as hasRetentionMode, Zr as normalizeQuery, T as resolveCubeReference, E as resolveSqlExpression, ii as strongHash, Zm as suggestQuery };
18910
+ export { zd as BASE_CUBE_SET_ID, w as BaseDatabaseExecutor, er as CTEBuilder, M as CalculatedMeasureResolver, si as ComparisonQueryBuilder, mt as DatabendExecutor, ga as DrizzlePlanBuilder, Ln as DrizzleSqlBuilder, lt as DuckDBExecutor, ef as EXPLAIN_ANALYSIS_PROMPT, li as FlowQueryBuilder, ci as FunnelQueryBuilder, Ci as IdentityOptimiser, Rn as JoinPathResolver, Si as LogicalPlanBuilder, Qn as LogicalPlanner, Gd as MemoryCacheProvider, Qe as MySQLExecutor, wi as OptimiserPipeline, Je as PostgresExecutor, va as QueryExecutor, Ar as QueryValidationError, hi as RetentionQueryBuilder, Bd as SINGLE_TENANT_CONTEXT, nt as SQLiteExecutor, Kd as STEP0_VALIDATION_PROMPT, Xd as STEP1_SYSTEM_PROMPT, Qd as STEP2_SYSTEM_PROMPT, Jd as SYSTEM_PROMPT_TEMPLATE, Hd as SemanticLayerCompiler, bt as SnowflakeExecutor, mh as aiValidateQuery, gf as buildAgentSystemPrompt, Ud as buildAttributeDimensions, tf as buildExplainAnalysisPrompt, qd as buildStep0Prompt, Zd as buildStep1Prompt, $d as buildStep2Prompt, Yd as buildSystemPrompt, St as createDatabaseExecutor, ht as createDatabendExecutor, hh as createDrizzleSemanticLayer, ut as createDuckDBExecutor, Ot as createMultiCubeContext, $e as createMySQLExecutor, Ye as createPostgresExecutor, rt as createSQLiteExecutor, xt as createSnowflakeExecutor, wm as createToolExecutor, kt as defineCube, kr as detectQueryMode, Dr as detectQueryModes, Pf as discoverCubes, Ff as findBestFieldMatch, ri as fnv1aHash, nf as formatCubeSchemaForExplain, rf as formatExistingIndexes, Xr as generateCacheKey, Or as getActiveQueryModes, ai as getCubeInvalidationPattern, wt as getJoinType, Cm as getToolDefinitions, Lm as handleAgentChat, Cr as hasComparisonMode, Tr as hasFlowMode, wr as hasFunnelMode, Er as hasRetentionMode, Zr as normalizeQuery, T as resolveCubeReference, E as resolveSqlExpression, ii as strongHash, $m as suggestQuery };